Optimize for kernels which are known to have the vfork syscall.
[glibc/pb-stable.git] / include / netdb.h
blob7b446058a155ee96c5ebf2fb09a6bbe5e71d901a
1 #ifndef _NETDB_H
2 #include <resolv/netdb.h>
4 /* Macros for accessing h_errno from inside libc. */
5 # ifdef _LIBC_REENTRANT
6 # include <tls.h>
7 # if USE___THREAD
8 # undef h_errno
9 # ifndef NOT_IN_libc
10 # define h_errno __libc_h_errno
11 # else
12 # define h_errno h_errno /* For #ifndef h_errno tests. */
13 # endif
14 extern __thread int h_errno attribute_tls_model_ie;
15 # define __set_h_errno(x) (h_errno = (x))
16 # else
17 static inline int
18 __set_h_errno (int __err)
20 return *__h_errno_location () = __err;
22 # endif
23 # else
24 # undef h_errno
25 # define __set_h_errno(x) (h_errno = (x))
26 extern int h_errno;
27 # endif /* _LIBC_REENTRANT */
29 libc_hidden_proto (hstrerror)
30 libc_hidden_proto (innetgr)
31 libc_hidden_proto (rcmd_af)
32 libc_hidden_proto (rexec_af)
33 libc_hidden_proto (rresvport_af)
34 libc_hidden_proto (ruserok_af)
36 libc_hidden_proto (getaddrinfo)
37 libc_hidden_proto (getnameinfo)
38 libc_hidden_proto (freeaddrinfo)
39 libc_hidden_proto (gai_strerror)
40 libc_hidden_proto (__h_errno_location)
42 /* Document internal interfaces. */
43 extern int __gethostent_r (struct hostent *__restrict __result_buf,
44 char *__restrict __buf, size_t __buflen,
45 struct hostent **__restrict __result,
46 int *__restrict __h_errnop) attribute_hidden;
47 extern int __old_gethostent_r (struct hostent *__restrict __result_buf,
48 char *__restrict __buf, size_t __buflen,
49 struct hostent **__restrict __result,
50 int *__restrict __h_errnop);
52 extern int __gethostbyaddr_r (__const void *__restrict __addr,
53 socklen_t __len, int __type,
54 struct hostent *__restrict __result_buf,
55 char *__restrict __buf, size_t __buflen,
56 struct hostent **__restrict __result,
57 int *__restrict __h_errnop);
58 extern int __old_gethostbyaddr_r (__const void *__restrict __addr,
59 socklen_t __len, int __type,
60 struct hostent *__restrict __result_buf,
61 char *__restrict __buf, size_t __buflen,
62 struct hostent **__restrict __result,
63 int *__restrict __h_errnop);
65 extern int __gethostbyname_r (__const char *__restrict __name,
66 struct hostent *__restrict __result_buf,
67 char *__restrict __buf, size_t __buflen,
68 struct hostent **__restrict __result,
69 int *__restrict __h_errnop);
70 extern int __old_gethostbyname_r (__const char *__restrict __name,
71 struct hostent *__restrict __result_buf,
72 char *__restrict __buf, size_t __buflen,
73 struct hostent **__restrict __result,
74 int *__restrict __h_errnop);
76 extern int __gethostbyname2_r (__const char *__restrict __name, int __af,
77 struct hostent *__restrict __result_buf,
78 char *__restrict __buf, size_t __buflen,
79 struct hostent **__restrict __result,
80 int *__restrict __h_errnop);
81 extern int __old_gethostbyname2_r (__const char *__restrict __name, int __af,
82 struct hostent *__restrict __result_buf,
83 char *__restrict __buf, size_t __buflen,
84 struct hostent **__restrict __result,
85 int *__restrict __h_errnop);
87 extern int __getnetent_r (struct netent *__restrict __result_buf,
88 char *__restrict __buf, size_t __buflen,
89 struct netent **__restrict __result,
90 int *__restrict __h_errnop) attribute_hidden;
91 extern int __old_getnetent_r (struct netent *__restrict __result_buf,
92 char *__restrict __buf, size_t __buflen,
93 struct netent **__restrict __result,
94 int *__restrict __h_errnop);
96 extern int __getnetbyaddr_r (uint32_t __net, int __type,
97 struct netent *__restrict __result_buf,
98 char *__restrict __buf, size_t __buflen,
99 struct netent **__restrict __result,
100 int *__restrict __h_errnop);
101 extern int __old_getnetbyaddr_r (uint32_t __net, int __type,
102 struct netent *__restrict __result_buf,
103 char *__restrict __buf, size_t __buflen,
104 struct netent **__restrict __result,
105 int *__restrict __h_errnop);
107 extern int __getnetbyname_r (__const char *__restrict __name,
108 struct netent *__restrict __result_buf,
109 char *__restrict __buf, size_t __buflen,
110 struct netent **__restrict __result,
111 int *__restrict __h_errnop);
112 extern int __old_getnetbyname_r (__const char *__restrict __name,
113 struct netent *__restrict __result_buf,
114 char *__restrict __buf, size_t __buflen,
115 struct netent **__restrict __result,
116 int *__restrict __h_errnop);
118 extern int __getservent_r (struct servent *__restrict __result_buf,
119 char *__restrict __buf, size_t __buflen,
120 struct servent **__restrict __result)
121 attribute_hidden;
122 extern int __old_getservent_r (struct servent *__restrict __result_buf,
123 char *__restrict __buf, size_t __buflen,
124 struct servent **__restrict __result);
126 extern int __getservbyname_r (__const char *__restrict __name,
127 __const char *__restrict __proto,
128 struct servent *__restrict __result_buf,
129 char *__restrict __buf, size_t __buflen,
130 struct servent **__restrict __result);
131 extern int __old_getservbyname_r (__const char *__restrict __name,
132 __const char *__restrict __proto,
133 struct servent *__restrict __result_buf,
134 char *__restrict __buf, size_t __buflen,
135 struct servent **__restrict __result);
137 extern int __getservbyport_r (int __port,
138 __const char *__restrict __proto,
139 struct servent *__restrict __result_buf,
140 char *__restrict __buf, size_t __buflen,
141 struct servent **__restrict __result);
142 extern int __old_getservbyport_r (int __port,
143 __const char *__restrict __proto,
144 struct servent *__restrict __result_buf,
145 char *__restrict __buf, size_t __buflen,
146 struct servent **__restrict __result);
148 extern int __getprotoent_r (struct protoent *__restrict __result_buf,
149 char *__restrict __buf, size_t __buflen,
150 struct protoent **__restrict __result)
151 attribute_hidden;
152 extern int __old_getprotoent_r (struct protoent *__restrict __result_buf,
153 char *__restrict __buf, size_t __buflen,
154 struct protoent **__restrict __result);
156 extern int __getprotobyname_r (__const char *__restrict __name,
157 struct protoent *__restrict __result_buf,
158 char *__restrict __buf, size_t __buflen,
159 struct protoent **__restrict __result);
160 extern int __old_getprotobyname_r (__const char *__restrict __name,
161 struct protoent *__restrict __result_buf,
162 char *__restrict __buf, size_t __buflen,
163 struct protoent **__restrict __result);
165 extern int __getprotobynumber_r (int __proto,
166 struct protoent *__restrict __res_buf,
167 char *__restrict __buf, size_t __buflen,
168 struct protoent **__restrict __result);
169 extern int __old_getprotobynumber_r (int __proto,
170 struct protoent *__restrict __res_buf,
171 char *__restrict __buf, size_t __buflen,
172 struct protoent **__restrict __result);
174 extern int __getnetgrent_r (char **__restrict __hostp,
175 char **__restrict __userp,
176 char **__restrict __domainp,
177 char *__restrict __buffer, size_t __buflen);
179 extern int ruserpass (const char *host, const char **aname,
180 const char **apass);
181 libc_hidden_proto (ruserpass)
184 /* The following declarations and definitions have been removed from
185 the public header since we don't want people to use them. */
187 #define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */
188 #define AI_ALL 0x0010 /* Return both IPv4 and IPv6 addresses. */
189 #define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
190 returned address type. */
191 #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
193 #include <inet/netgroup.h>
195 struct parser_data;
196 extern int _nss_files_parse_protoent (char *line, struct protoent *result,
197 struct parser_data *data,
198 size_t datalen, int *errnop);
199 extern int _nss_files_parse_servent (char *line, struct servent *result,
200 struct parser_data *data,
201 size_t datalen, int *errnop);
202 extern int _nss_files_parse_netent (char *line, struct netent *result,
203 struct parser_data *data,
204 size_t datalen, int *errnop);
205 extern enum nss_status _nss_netgroup_parseline (char **cursor,
206 struct __netgrent *result,
207 char *buffer, size_t buflen,
208 int *errnop);
209 libc_hidden_proto (_nss_files_parse_protoent)
210 libc_hidden_proto (_nss_files_parse_servent)
211 libc_hidden_proto (_nss_files_parse_netent)
213 #define DECLARE_NSS_PROTOTYPES(service) \
214 extern enum nss_status _nss_ ## service ## _setprotoent (int); \
215 extern enum nss_status _nss_ ## service ## _endprotoent (void); \
216 extern enum nss_status _nss_ ## service ## _getprotoent_r \
217 (struct protoent *proto, char *buffer, size_t buflen, \
218 int *errnop); \
219 extern enum nss_status _nss_ ## service ## _getprotobyname_r \
220 (const char *name, struct protoent *proto, \
221 char *buffer, size_t buflen, int *errnop); \
222 extern enum nss_status _nss_ ## service ## _getprotobynumber_r \
223 (int number, struct protoent *proto, \
224 char *buffer, size_t buflen, int *errnop); \
225 extern enum nss_status _nss_ ## service ## _sethostent (int); \
226 extern enum nss_status _nss_ ## service ## _endhostent (void); \
227 extern enum nss_status _nss_ ## service ## _gethostent_r \
228 (struct hostent *host, char *buffer, size_t buflen, \
229 int *errnop, int *h_errnop); \
230 extern enum nss_status _nss_ ## service ## _gethostbyname2_r \
231 (const char *name, int af, struct hostent *host, \
232 char *buffer, size_t buflen, int *errnop, \
233 int *h_errnop); \
234 extern enum nss_status _nss_ ## service ## _gethostbyname_r \
235 (const char *name, struct hostent *host, char *buffer, \
236 size_t buflen, int *errnop, int *h_errnop); \
237 extern enum nss_status _nss_ ## service ## _gethostbyaddr_r \
238 (const void *addr, socklen_t addrlen, int af, \
239 struct hostent *host, char *buffer, size_t buflen, \
240 int *errnop, int *h_errnop); \
241 extern enum nss_status _nss_ ## service ## _setservent (int); \
242 extern enum nss_status _nss_ ## service ## _endservent (void); \
243 extern enum nss_status _nss_ ## service ## _getservent_r \
244 (struct servent *serv, char *buffer, size_t buflen, \
245 int *errnop); \
246 extern enum nss_status _nss_ ## service ## _getservbyname_r \
247 (const char *name, const char *protocol, \
248 struct servent *serv, char *buffer, size_t buflen, \
249 int *errnop); \
250 extern enum nss_status _nss_ ## service ## _getservbyport_r \
251 (int port, const char *protocol, struct servent *serv, \
252 char *buffer, size_t buflen, int *errnop); \
253 extern enum nss_status _nss_ ## service ## _setnetgrent \
254 (const char *group, struct __netgrent *result); \
255 extern enum nss_status _nss_ ## service ## _endnetgrent \
256 (struct __netgrent *result); \
257 extern enum nss_status _nss_ ## service ## _getnetgrent_r \
258 (struct __netgrent *result, char *buffer, \
259 size_t buflen, int *errnop); \
260 extern enum nss_status _nss_ ## service ## _setnetent (int stayopen); \
261 extern enum nss_status _nss_ ## service ## _endnetent (void); \
262 extern enum nss_status _nss_ ## service ## _getnetent_r \
263 (struct netent *net, char *buffer, size_t buflen, \
264 int *errnop, int *herrnop); \
265 extern enum nss_status _nss_ ## service ## _getnetbyname_r \
266 (const char *name, struct netent *net, char *buffer, \
267 size_t buflen, int *errnop, int *herrnop); \
268 extern enum nss_status _nss_ ## service ## _getnetbyaddr_r \
269 (uint32_t addr, int type, struct netent *net, \
270 char *buffer, size_t buflen, int *errnop, \
271 int *herrnop);
273 DECLARE_NSS_PROTOTYPES (compat)
274 DECLARE_NSS_PROTOTYPES (dns)
275 DECLARE_NSS_PROTOTYPES (files)
276 DECLARE_NSS_PROTOTYPES (hesiod)
277 DECLARE_NSS_PROTOTYPES (nis)
278 DECLARE_NSS_PROTOTYPES (nisplus)
280 #undef DECLARE_NSS_PROTOTYPES
282 #endif /* !_NETDB_H */