2 .\" Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .TH getnetent_r 3 (date) "Linux man-pages (unreleased)"
9 getnetent_r, getnetbyname_r, getnetbyaddr_r \- get
10 network entry (reentrant)
13 .RI ( libc ", " \-lc )
18 .BI "int getnetent_r(struct netent *restrict " result_buf ,
19 .BI " char " buf "[restrict ." buflen "], size_t " buflen ,
20 .BI " struct netent **restrict " result ,
21 .BI " int *restrict " h_errnop );
22 .BI "int getnetbyname_r(const char *restrict " name ,
23 .BI " struct netent *restrict " result_buf ,
24 .BI " char " buf "[restrict ." buflen "], size_t " buflen ,
25 .BI " struct netent **restrict " result ,
26 .BI " int *restrict " h_errnop );
27 .BI "int getnetbyaddr_r(uint32_t " net ", int " type ,
28 .BI " struct netent *restrict " result_buf ,
29 .BI " char " buf "[restrict ." buflen "], size_t " buflen ,
30 .BI " struct netent **restrict " result ,
31 .BI " int *restrict " h_errnop );
35 Feature Test Macro Requirements for glibc (see
36 .BR feature_test_macros (7)):
40 .BR getnetbyname_r (),
41 .BR getnetbyaddr_r ():
45 glibc 2.19 and earlier:
46 _BSD_SOURCE || _SVID_SOURCE
51 .BR getnetbyname_r (),
54 functions are the reentrant equivalents of, respectively,
58 .BR getnetbynumber (3).
59 They differ in the way that the
61 structure is returned,
62 and in the function calling signature and return value.
63 This manual page describes just the differences from
64 the nonreentrant functions.
66 Instead of returning a pointer to a statically allocated
68 structure as the function result,
69 these functions copy the structure into the location pointed to by
74 array is used to store the string fields pointed to by the returned
77 (The nonreentrant functions allocate these strings in static storage.)
78 The size of this array is specified in
82 is too small, the call fails with the error
84 and the caller must try again with a larger buffer.
85 (A buffer of length 1024 bytes should be sufficient for most applications.)
86 .\" I can find no information on the required/recommended buffer size;
87 .\" the nonreentrant functions use a 1024 byte buffer -- mtk.
89 If the function call successfully obtains a network record, then
97 The buffer pointed to by
99 is used to return the value that would be stored in the global variable
101 by the nonreentrant versions of these functions.
102 .\" getnetent.3 doesn't document any use of h_errno, but nevertheless
103 .\" the nonreentrant functions no seem to set h_errno.
105 On success, these functions return 0.
106 On error, they return one of the positive error numbers listed in ERRORS.
108 On error, record not found
109 .RB ( getnetbyname_r (),
110 .BR getnetbyaddr_r ()),
112 .RB ( getnetent_r ())
118 .RB ( getnetent_r ())
119 No more records in database.
124 Try again with a larger buffer
128 For an explanation of the terms used in this section, see
136 Interface Attribute Value
139 .BR getnetbyname_r (),
140 .BR getnetbyaddr_r ()
141 T} Thread safety MT-Safe locale
147 These functions are GNU extensions.
148 Functions with similar names exist on some other systems,
149 though typically with different calling signatures.