1GETNETENT_R(3) Linux Programmer's Manual GETNETENT_R(3)
2
3
4
6 getnetent_r, getnetbyname_r, getnetbyaddr_r - get network entry (reen‐
7 trant)
8
10 #include <netdb.h>
11
12 int getnetent_r(struct netent *result_buf, char *buf,
13 size_t buflen, struct netent **result,
14 int *h_errnop);
15
16 int getnetbyname_r(const char *name,
17 struct netent *result_buf, char *buf,
18 size_t buflen, struct netent **result,
19 int *h_errnop);
20
21 int getnetbyaddr_r(uint32_t net, int type,
22 struct netent *result_buf, char *buf,
23 size_t buflen, struct netent **result,
24 int *h_errnop);
25
26 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
27
28 getnetent_r(), getnetbyname_r(), getnetbyaddr_r():
29 Since glibc 2.19:
30 _DEFAULT_SOURCE
31 Glibc 2.19 and earlier:
32 _BSD_SOURCE || _SVID_SOURCE
33
35 The getnetent_r(), getnetbyname_r(), and getnetbyaddr_r() functions are
36 the reentrant equivalents of, respectively, getnetent(3), getnetby‐
37 name(3), and getnetbynumber(3). They differ in the way that the netent
38 structure is returned, and in the function calling signature and return
39 value. This manual page describes just the differences from the non‐
40 reentrant functions.
41
42 Instead of returning a pointer to a statically allocated netent struc‐
43 ture as the function result, these functions copy the structure into
44 the location pointed to by result_buf.
45
46 The buf array is used to store the string fields pointed to by the
47 returned netent structure. (The nonreentrant functions allocate these
48 strings in static storage.) The size of this array is specified in
49 buflen. If buf is too small, the call fails with the error ERANGE, and
50 the caller must try again with a larger buffer. (A buffer of length
51 1024 bytes should be sufficient for most applications.)
52
53 If the function call successfully obtains a network record, then
54 *result is set pointing to result_buf; otherwise, *result is set to
55 NULL.
56
57 The buffer pointed to by h_errnop is used to return the value that
58 would be stored in the global variable h_errno by the nonreentrant ver‐
59 sions of these functions.
60
62 On success, these functions return 0. On error, they return one of the
63 positive error numbers listed in ERRORS.
64
65 On error, record not found (getnetbyname_r(), getnetbyaddr_r()), or end
66 of input (getnetent_r()) result is set to NULL.
67
69 ENOENT (getnetent_r()) No more records in database.
70
71 ERANGE buf is too small. Try again with a larger buffer (and increased
72 buflen).
73
75 For an explanation of the terms used in this section, see
76 attributes(7).
77
78 ┌──────────────────┬───────────────┬────────────────┐
79 │Interface │ Attribute │ Value │
80 ├──────────────────┼───────────────┼────────────────┤
81 │getnetent_r(), │ Thread safety │ MT-Safe locale │
82 │getnetbyname_r(), │ │ │
83 │getnetbyaddr_r() │ │ │
84 └──────────────────┴───────────────┴────────────────┘
86 These functions are GNU extensions. Functions with similar names exist
87 on some other systems, though typically with different calling signa‐
88 tures.
89
91 getnetent(3), networks(5)
92
94 This page is part of release 5.04 of the Linux man-pages project. A
95 description of the project, information about reporting bugs, and the
96 latest version of this page, can be found at
97 https://www.kernel.org/doc/man-pages/.
98
99
100
101GNU 2017-09-15 GETNETENT_R(3)