1 .\" Copyright 2008, Linux Foundation, written by Michael Kerrisk
2 .\" <mtk.manpages@gmail.com>
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
26 .TH GETNETENT_R 3 2010-09-10 "GNU" "Linux Programmer's Manual"
28 getnetent_r, getnetbyname_r, getnetbyaddr_r \- get
29 network entry (reentrant)
34 .BI "int getnetent_r(struct netent *" result_buf ", char *" buf ,
35 .BI " size_t " buflen ", struct netent **" result ,
36 .BI " int *" h_errnop );
38 .BI "int getnetbyname_r(const char *" name ,
39 .BI " struct netent *" result_buf ", char *" buf ,
40 .BI " size_t " buflen ", struct netent **" result ,
41 .BI " int *" h_errnop );
43 .BI "int getnetbyaddr_r(uint32_t " net ", int " type ,
44 .BI " struct netent *" result_buf ", char *" buf ,
45 .BI " size_t " buflen ", struct netent **" result ,
46 .BI " int *" h_errnop );
50 Feature Test Macro Requirements for glibc (see
51 .BR feature_test_macros (7)):
56 .BR getnetbyname_r (),
57 .BR getnetbyaddr_r ():
59 _BSD_SOURCE || _SVID_SOURCE
65 .BR getnetbyname_r (),
68 functions are the reentrant equivalents of, respectively,
72 .BR getnetbynumber (3).
73 They differ in the way that the
75 structure is returned,
76 and in the function calling signature and return value.
77 This manual page describes just the differences from
78 the nonreentrant functions.
80 Instead of returning a pointer to a statically allocated
82 structure as the function result,
83 these functions copy the structure into the location pointed to by
88 array is used to store the string fields pointed to by the returned
91 (The nonreentrant functions allocate these strings in static storage.)
92 The size of this array is specified in
96 is too small, the call fails with the error
98 and the caller must try again with a larger buffer.
99 (A buffer of length 1024 bytes should be sufficient for most applications.)
100 .\" I can find no information on the required/recommended buffer size;
101 .\" the nonreentrant functions use a 1024 byte buffer -- mtk.
103 If the function call successfully obtains a network record, then
111 The buffer pointed to by
113 is used to return the value that would be stored in the global variable
115 by the nonreentrant versions of these functions.
116 .\" getnetent.3 doesn't document any use of h_errno, but nevertheless
117 .\" the nonreentrant functions no seem to set h_errno.
119 On success, these functions return 0.
120 On error, they return one of the positive error numbers listed in ERRORS.
122 On error, record not found
123 .RB ( getnetbyname_r (),
124 .BR getnetbyaddr_r ()),
126 .RB ( getnetent_r ())
132 .RB ( getnetent_r ())
133 No more records in database.
138 Try again with a larger buffer
142 These functions are GNU extensions.
143 Functions with similar names exist on some other systems,
144 though typically with different calling signatures.