]>
Commit | Line | Data |
---|---|---|
77f18fb6 MK |
1 | .\" Copyright 2008, Linux Foundation, written by Michael Kerrisk |
2 | .\" <mtk.manpages@gmail.com> | |
3 | .\" | |
93015253 | 4 | .\" %%%LICENSE_START(VERBATIM) |
77f18fb6 MK |
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. | |
8 | .\" | |
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. | |
13 | .\" | |
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 | |
20 | .\" professionally. | |
21 | .\" | |
22 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
23 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 24 | .\" %%%LICENSE_END |
77f18fb6 | 25 | .\" |
5722c835 | 26 | .TH GETNETENT_R 3 2015-07-23 "GNU" "Linux Programmer's Manual" |
77f18fb6 | 27 | .SH NAME |
88850fde | 28 | getnetent_r, getnetbyname_r, getnetbyaddr_r \- get |
77f18fb6 MK |
29 | network entry (reentrant) |
30 | .SH SYNOPSIS | |
31 | .nf | |
32 | .B #include <netdb.h> | |
33 | .sp | |
34 | .BI "int getnetent_r(struct netent *" result_buf ", char *" buf , | |
35 | .BI " size_t " buflen ", struct netent **" result , | |
36 | .BI " int *" h_errnop ); | |
37 | .sp | |
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 ); | |
42 | .sp | |
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 ); | |
47 | .sp | |
48 | .fi | |
49 | .in -4n | |
50 | Feature Test Macro Requirements for glibc (see | |
51 | .BR feature_test_macros (7)): | |
52 | .ad l | |
53 | .in | |
54 | .sp | |
55 | .BR getnetent_r (), | |
56 | .BR getnetbyname_r (), | |
88850fde | 57 | .BR getnetbyaddr_r (): |
fed898aa | 58 | .RS 4 |
77f18fb6 | 59 | _BSD_SOURCE || _SVID_SOURCE |
fed898aa | 60 | .RE |
77f18fb6 MK |
61 | .ad b |
62 | .SH DESCRIPTION | |
63 | The | |
64 | .BR getnetent_r (), | |
65 | .BR getnetbyname_r (), | |
66 | and | |
88850fde | 67 | .BR getnetbyaddr_r () |
77f18fb6 MK |
68 | functions are the reentrant equivalents of, respectively, |
69 | .BR getnetent (3), | |
70 | .BR getnetbyname (3), | |
71 | and | |
72 | .BR getnetbynumber (3). | |
73 | They differ in the way that the | |
74 | .I netent | |
75 | structure is returned, | |
76 | and in the function calling signature and return value. | |
77 | This manual page describes just the differences from | |
54d75d6c | 78 | the nonreentrant functions. |
77f18fb6 MK |
79 | |
80 | Instead of returning a pointer to a statically allocated | |
81 | .I netent | |
82 | structure as the function result, | |
83 | these functions copy the structure into the location pointed to by | |
84 | .IR result_buf . | |
85 | ||
86 | The | |
87 | .I buf | |
88 | array is used to store the string fields pointed to by the returned | |
89 | .I netent | |
90 | structure. | |
54d75d6c | 91 | (The nonreentrant functions allocate these strings in static storage.) |
77f18fb6 MK |
92 | The size of this array is specified in |
93 | .IR buflen . | |
94 | If | |
95 | .I buf | |
96 | is too small, the call fails with the error | |
97 | .BR ERANGE , | |
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; | |
54d75d6c | 101 | .\" the nonreentrant functions use a 1024 byte buffer -- mtk. |
77f18fb6 MK |
102 | |
103 | If the function call successfully obtains a network record, then | |
104 | .I *result | |
105 | is set pointing to | |
106 | .IR result_buf ; | |
107 | otherwise, | |
108 | .I *result | |
109 | is set to NULL. | |
110 | ||
111 | The buffer pointed to by | |
112 | .I h_errnop | |
113 | is used to return the value that would be stored in the global variable | |
114 | .I h_errno | |
54d75d6c | 115 | by the nonreentrant versions of these functions. |
77f18fb6 | 116 | .\" getnetent.3 doesn't document any use of h_errno, but nevertheless |
54d75d6c | 117 | .\" the nonreentrant functions no seem to set h_errno. |
47297adb | 118 | .SH RETURN VALUE |
77f18fb6 | 119 | On success, these functions return 0. |
535f0df5 | 120 | On error, they return one of the positive error numbers listed in ERRORS. |
77f18fb6 MK |
121 | |
122 | On error, record not found | |
123 | .RB ( getnetbyname_r (), | |
88850fde | 124 | .BR getnetbyaddr_r ()), |
77f18fb6 MK |
125 | or end of input |
126 | .RB ( getnetent_r ()) | |
127 | .I result | |
128 | is set to NULL. | |
129 | .SH ERRORS | |
130 | .TP | |
131 | .B ENOENT | |
132 | .RB ( getnetent_r ()) | |
133 | No more records in database. | |
134 | .TP | |
135 | .B ERANGE | |
136 | .I buf | |
137 | is too small. | |
138 | Try again with a larger buffer | |
139 | (and increased | |
140 | .IR buflen ). | |
8eb0dd50 ZL |
141 | .SH ATTRIBUTES |
142 | For an explanation of the terms used in this section, see | |
143 | .BR attributes (7). | |
144 | .TS | |
145 | allbox; | |
146 | lbw17 lb lb | |
147 | l l l. | |
148 | Interface Attribute Value | |
149 | T{ | |
150 | .BR getnetent_r (), | |
151 | .BR getnetbyname_r (), | |
152 | .BR getnetbyaddr_r () | |
153 | T} Thread safety MT-Safe locale | |
154 | .TE | |
155 | ||
47297adb | 156 | .SH CONFORMING TO |
77f18fb6 MK |
157 | These functions are GNU extensions. |
158 | Functions with similar names exist on some other systems, | |
159 | though typically with different calling signatures. | |
47297adb | 160 | .SH SEE ALSO |
77f18fb6 | 161 | .BR getnetent (3), |
77f18fb6 | 162 | .BR networks (5) |