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 *restrict result_buf,
13                       char *restrict buf, size_t buflen,
14                       struct netent **restrict result,
15                       int *restrict h_errnop);
16       int getnetbyname_r(const char *restrict name,
17                       struct netent *restrict result_buf,
18                       char *restrict buf, size_t buflen,
19                       struct netent **restrict result,
20                       int *restrict h_errnop);
21       int getnetbyaddr_r(uint32_t net, int type,
22                       struct netent *restrict result_buf,
23                       char *restrict buf, size_t buflen,
24                       struct netent **restrict result,
25                       int *restrict h_errnop);
26
27   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
28
29       getnetent_r(), getnetbyname_r(), getnetbyaddr_r():
30           Since glibc 2.19:
31               _DEFAULT_SOURCE
32           Glibc 2.19 and earlier:
33               _BSD_SOURCE || _SVID_SOURCE
34

DESCRIPTION

36       The getnetent_r(), getnetbyname_r(), and getnetbyaddr_r() functions are
37       the  reentrant  equivalents  of,  respectively, getnetent(3), getnetby‐
38       name(3), and getnetbynumber(3).  They differ in the way that the netent
39       structure is returned, and in the function calling signature and return
40       value.  This manual page describes just the differences from  the  non‐
41       reentrant functions.
42
43       Instead  of returning a pointer to a statically allocated netent struc‐
44       ture as the function result, these functions copy  the  structure  into
45       the location pointed to by result_buf.
46
47       The  buf array is used to store the string fields pointed to by the re‐
48       turned netent structure.  (The nonreentrant  functions  allocate  these
49       strings in static storage.)  The size of this array is specified in bu‐
50       flen.  If buf is too small, the call fails with the error  ERANGE,  and
51       the  caller  must  try again with a larger buffer.  (A buffer of length
52       1024 bytes should be sufficient for most applications.)
53
54       If the function call successfully obtains a network record,  then  *re‐
55       sult is set pointing to result_buf; otherwise, *result is set to 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

RETURN VALUE

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

ERRORS

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

ATTRIBUTES

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

CONFORMING TO

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

SEE ALSO

91       getnetent(3), networks(5)
92

COLOPHON

94       This page is part of release 5.13 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                               2021-03-22                    GETNETENT_R(3)
Impressum