1GETNETENT_R(3)             Linux Programmer's Manual            GETNETENT_R(3)
2
3
4

NAME

6       getnetent_r,  getnetbyname_r, getnetbyaddr_r - get network entry (reen‐
7       trant)
8

SYNOPSIS

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

DESCRIPTION

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 re‐
47       turned netent structure.  (The nonreentrant  functions  allocate  these
48       strings in static storage.)  The size of this array is specified in bu‐
49       flen.  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  *re‐
54       sult is set pointing to result_buf; otherwise, *result is set to NULL.
55
56       The  buffer  pointed  to  by  h_errnop is used to return the value that
57       would be stored in the global variable h_errno by the nonreentrant ver‐
58       sions of these functions.
59

RETURN VALUE

61       On success, these functions return 0.  On error, they return one of the
62       positive error numbers listed in ERRORS.
63
64       On error, record not found (getnetbyname_r(), getnetbyaddr_r()), or end
65       of input (getnetent_r()) result is set to NULL.
66

ERRORS

68       ENOENT (getnetent_r()) No more records in database.
69
70       ERANGE buf is too small.  Try again with a larger buffer (and increased
71              buflen).
72

ATTRIBUTES

74       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
75       tributes(7).
76
77       ┌──────────────────┬───────────────┬────────────────┐
78Interface         Attribute     Value          
79       ├──────────────────┼───────────────┼────────────────┤
80getnetent_r(),    │ Thread safety │ MT-Safe locale │
81getnetbyname_r(), │               │                │
82getnetbyaddr_r()  │               │                │
83       └──────────────────┴───────────────┴────────────────┘

CONFORMING TO

85       These functions are GNU extensions.  Functions with similar names exist
86       on some other systems, though typically with different  calling  signa‐
87       tures.
88

SEE ALSO

90       getnetent(3), networks(5)
91

COLOPHON

93       This  page  is  part of release 5.10 of the Linux man-pages project.  A
94       description of the project, information about reporting bugs,  and  the
95       latest     version     of     this    page,    can    be    found    at
96       https://www.kernel.org/doc/man-pages/.
97
98
99
100GNU                               2017-09-15                    GETNETENT_R(3)
Impressum