diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-04-07 21:11:46 -0400 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-04-12 21:26:35 -0400 |
commit | 74da141e618ef99959d509cb2e7be35a348a39db (patch) | |
tree | 88ebc38b381a1021fc2d74864a71e230ae591c3d /gl/sys_socket.in.h | |
parent | c63a4f726a0b6ad8cf6040f947754a81fd4683bb (diff) | |
download | monitoring-plugins-74da141e618ef99959d509cb2e7be35a348a39db.tar.gz |
Sync with the latest Gnulib code (177f525)
Signed-off-by: Thomas Guyot-Sionnest <dermoth@aei.ca>
Diffstat (limited to 'gl/sys_socket.in.h')
-rw-r--r-- | gl/sys_socket.in.h | 671 |
1 files changed, 438 insertions, 233 deletions
diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h index dadd56ac..fc105e63 100644 --- a/gl/sys_socket.in.h +++ b/gl/sys_socket.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Provide a sys/socket header file for systems lacking it (read: MinGW) | 1 | /* Provide a sys/socket header file for systems lacking it (read: MinGW) |
2 | and for systems where it is incomplete. | 2 | and for systems where it is incomplete. |
3 | Copyright (C) 2005-2009 Free Software Foundation, Inc. | 3 | Copyright (C) 2005-2010 Free Software Foundation, Inc. |
4 | Written by Simon Josefsson. | 4 | Written by Simon Josefsson. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
@@ -23,13 +23,27 @@ | |||
23 | It is intended to provide definitions and prototypes needed by an | 23 | It is intended to provide definitions and prototypes needed by an |
24 | application. */ | 24 | application. */ |
25 | 25 | ||
26 | #if __GNUC__ >= 3 | ||
27 | @PRAGMA_SYSTEM_HEADER@ | ||
28 | #endif | ||
29 | |||
30 | #if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H | ||
31 | /* Special invocation convention: | ||
32 | - On Cygwin 1.5.x we have a sequence of nested includes | ||
33 | <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>, | ||
34 | and the latter includes <sys/socket.h>. In this situation, the functions | ||
35 | are not yet declared, therefore we cannot provide the C++ aliases. */ | ||
36 | |||
37 | #@INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ | ||
38 | |||
39 | #else | ||
40 | /* Normal invocation convention. */ | ||
41 | |||
26 | #ifndef _GL_SYS_SOCKET_H | 42 | #ifndef _GL_SYS_SOCKET_H |
27 | 43 | ||
28 | #if @HAVE_SYS_SOCKET_H@ | 44 | #if @HAVE_SYS_SOCKET_H@ |
29 | 45 | ||
30 | # if __GNUC__ >= 3 | 46 | # define _GL_ALREADY_INCLUDING_SYS_SOCKET_H |
31 | @PRAGMA_SYSTEM_HEADER@ | ||
32 | # endif | ||
33 | 47 | ||
34 | /* On many platforms, <sys/socket.h> assumes prior inclusion of | 48 | /* On many platforms, <sys/socket.h> assumes prior inclusion of |
35 | <sys/types.h>. */ | 49 | <sys/types.h>. */ |
@@ -38,11 +52,23 @@ | |||
38 | /* The include_next requires a split double-inclusion guard. */ | 52 | /* The include_next requires a split double-inclusion guard. */ |
39 | # @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ | 53 | # @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ |
40 | 54 | ||
55 | # undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H | ||
56 | |||
41 | #endif | 57 | #endif |
42 | 58 | ||
43 | #ifndef _GL_SYS_SOCKET_H | 59 | #ifndef _GL_SYS_SOCKET_H |
44 | #define _GL_SYS_SOCKET_H | 60 | #define _GL_SYS_SOCKET_H |
45 | 61 | ||
62 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | ||
63 | |||
64 | /* The definition of _GL_ARG_NONNULL is copied here. */ | ||
65 | |||
66 | /* The definition of _GL_WARN_ON_USE is copied here. */ | ||
67 | |||
68 | #if !@HAVE_SA_FAMILY_T@ | ||
69 | typedef unsigned short sa_family_t; | ||
70 | #endif | ||
71 | |||
46 | #if !@HAVE_STRUCT_SOCKADDR_STORAGE@ | 72 | #if !@HAVE_STRUCT_SOCKADDR_STORAGE@ |
47 | # include <alignof.h> | 73 | # include <alignof.h> |
48 | /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on | 74 | /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on |
@@ -50,10 +76,10 @@ | |||
50 | # define __ss_aligntype unsigned long int | 76 | # define __ss_aligntype unsigned long int |
51 | # define _SS_SIZE 256 | 77 | # define _SS_SIZE 256 |
52 | # define _SS_PADSIZE \ | 78 | # define _SS_PADSIZE \ |
53 | (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype) \ | 79 | (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype) \ |
54 | ? sizeof (sa_family_t) \ | 80 | ? sizeof (sa_family_t) \ |
55 | : alignof (__ss_aligntype)) \ | 81 | : alignof (__ss_aligntype)) \ |
56 | + sizeof (__ss_aligntype))) | 82 | + sizeof (__ss_aligntype))) |
57 | 83 | ||
58 | struct sockaddr_storage | 84 | struct sockaddr_storage |
59 | { | 85 | { |
@@ -120,8 +146,6 @@ struct sockaddr_storage | |||
120 | # define SHUT_RDWR SD_BOTH | 146 | # define SHUT_RDWR SD_BOTH |
121 | # endif | 147 | # endif |
122 | 148 | ||
123 | /* The definition of GL_LINK_WARNING is copied here. */ | ||
124 | |||
125 | # if @HAVE_WINSOCK2_H@ | 149 | # if @HAVE_WINSOCK2_H@ |
126 | /* Include headers needed by the emulation code. */ | 150 | /* Include headers needed by the emulation code. */ |
127 | # include <sys/types.h> | 151 | # include <sys/types.h> |
@@ -131,11 +155,9 @@ typedef int socklen_t; | |||
131 | 155 | ||
132 | # endif | 156 | # endif |
133 | 157 | ||
134 | # ifdef __cplusplus | 158 | #endif |
135 | extern "C" { | ||
136 | # endif | ||
137 | 159 | ||
138 | # if @HAVE_WINSOCK2_H@ | 160 | #if @HAVE_WINSOCK2_H@ |
139 | 161 | ||
140 | /* Re-define FD_ISSET to avoid a WSA call while we are not using | 162 | /* Re-define FD_ISSET to avoid a WSA call while we are not using |
141 | network sockets. */ | 163 | network sockets. */ |
@@ -153,271 +175,454 @@ rpl_fd_isset (SOCKET fd, fd_set * set) | |||
153 | return 0; | 175 | return 0; |
154 | } | 176 | } |
155 | 177 | ||
156 | # undef FD_ISSET | 178 | # undef FD_ISSET |
157 | # define FD_ISSET(fd, set) rpl_fd_isset(fd, set) | 179 | # define FD_ISSET(fd, set) rpl_fd_isset(fd, set) |
158 | 180 | ||
159 | # endif | 181 | #endif |
160 | 182 | ||
161 | /* Wrap everything else to use libc file descriptors for sockets. */ | 183 | /* Wrap everything else to use libc file descriptors for sockets. */ |
162 | 184 | ||
163 | # if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H | 185 | #if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H |
186 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
164 | # undef close | 187 | # undef close |
165 | # define close close_used_without_including_unistd_h | 188 | # define close close_used_without_including_unistd_h |
189 | # else | ||
190 | _GL_WARN_ON_USE (close, | ||
191 | "close() used without including <unistd.h>"); | ||
166 | # endif | 192 | # endif |
193 | #endif | ||
167 | 194 | ||
168 | # if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H | 195 | #if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H |
196 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
169 | # undef gethostname | 197 | # undef gethostname |
170 | # define gethostname gethostname_used_without_including_unistd_h | 198 | # define gethostname gethostname_used_without_including_unistd_h |
199 | # else | ||
200 | _GL_WARN_ON_USE (gethostname, | ||
201 | "gethostname() used without including <unistd.h>"); | ||
171 | # endif | 202 | # endif |
203 | #endif | ||
172 | 204 | ||
173 | # if @GNULIB_SOCKET@ | 205 | #if @GNULIB_SOCKET@ |
174 | # if @HAVE_WINSOCK2_H@ | 206 | # if @HAVE_WINSOCK2_H@ |
207 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
175 | # undef socket | 208 | # undef socket |
176 | # define socket rpl_socket | 209 | # define socket rpl_socket |
177 | extern int rpl_socket (int, int, int protocol); | ||
178 | # endif | 210 | # endif |
179 | # elif @HAVE_WINSOCK2_H@ | 211 | _GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol)); |
180 | # undef socket | 212 | _GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol)); |
181 | # define socket socket_used_without_requesting_gnulib_module_socket | 213 | # else |
182 | # elif defined GNULIB_POSIXCHECK | 214 | _GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol)); |
183 | # undef socket | 215 | # endif |
184 | # define socket(d,t,p) \ | 216 | _GL_CXXALIASWARN (socket); |
185 | (GL_LINK_WARNING ("socket is not always POSIX compliant - " \ | 217 | #elif @HAVE_WINSOCK2_H@ |
186 | "use gnulib module socket for portability"), \ | 218 | # undef socket |
187 | socket (d, t, p)) | 219 | # define socket socket_used_without_requesting_gnulib_module_socket |
188 | # endif | 220 | #elif defined GNULIB_POSIXCHECK |
189 | 221 | # undef socket | |
190 | # if @GNULIB_CONNECT@ | 222 | # if HAVE_RAW_DECL_SOCKET |
191 | # if @HAVE_WINSOCK2_H@ | 223 | _GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - " |
224 | "use gnulib module socket for portability"); | ||
225 | # endif | ||
226 | #endif | ||
227 | |||
228 | #if @GNULIB_CONNECT@ | ||
229 | # if @HAVE_WINSOCK2_H@ | ||
230 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
192 | # undef connect | 231 | # undef connect |
193 | # define connect rpl_connect | 232 | # define connect rpl_connect |
194 | extern int rpl_connect (int, struct sockaddr *, int); | ||
195 | # endif | 233 | # endif |
196 | # elif @HAVE_WINSOCK2_H@ | 234 | _GL_FUNCDECL_RPL (connect, int, |
197 | # undef connect | 235 | (int fd, const struct sockaddr *addr, socklen_t addrlen) |
198 | # define connect socket_used_without_requesting_gnulib_module_connect | 236 | _GL_ARG_NONNULL ((2))); |
199 | # elif defined GNULIB_POSIXCHECK | 237 | _GL_CXXALIAS_RPL (connect, int, |
200 | # undef connect | 238 | (int fd, const struct sockaddr *addr, socklen_t addrlen)); |
201 | # define connect(s,a,l) \ | 239 | # else |
202 | (GL_LINK_WARNING ("connect is not always POSIX compliant - " \ | 240 | _GL_CXXALIAS_SYS (connect, int, |
203 | "use gnulib module connect for portability"), \ | 241 | (int fd, const struct sockaddr *addr, socklen_t addrlen)); |
204 | connect (s, a, l)) | 242 | # endif |
205 | # endif | 243 | _GL_CXXALIASWARN (connect); |
206 | 244 | #elif @HAVE_WINSOCK2_H@ | |
207 | # if @GNULIB_ACCEPT@ | 245 | # undef connect |
208 | # if @HAVE_WINSOCK2_H@ | 246 | # define connect socket_used_without_requesting_gnulib_module_connect |
247 | #elif defined GNULIB_POSIXCHECK | ||
248 | # undef connect | ||
249 | # if HAVE_RAW_DECL_CONNECT | ||
250 | _GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - " | ||
251 | "use gnulib module connect for portability"); | ||
252 | # endif | ||
253 | #endif | ||
254 | |||
255 | #if @GNULIB_ACCEPT@ | ||
256 | # if @HAVE_WINSOCK2_H@ | ||
257 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
209 | # undef accept | 258 | # undef accept |
210 | # define accept rpl_accept | 259 | # define accept rpl_accept |
211 | extern int rpl_accept (int, struct sockaddr *, int *); | ||
212 | # endif | 260 | # endif |
213 | # elif @HAVE_WINSOCK2_H@ | 261 | _GL_FUNCDECL_RPL (accept, int, |
214 | # undef accept | 262 | (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
215 | # define accept accept_used_without_requesting_gnulib_module_accept | 263 | _GL_CXXALIAS_RPL (accept, int, |
216 | # elif defined GNULIB_POSIXCHECK | 264 | (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
217 | # undef accept | 265 | # else |
218 | # define accept(s,a,l) \ | 266 | /* Need to cast, because on Solaris 10 systems, the third parameter is |
219 | (GL_LINK_WARNING ("accept is not always POSIX compliant - " \ | 267 | void *addrlen. */ |
220 | "use gnulib module accept for portability"), \ | 268 | _GL_CXXALIAS_SYS_CAST (accept, int, |
221 | accept (s, a, l)) | 269 | (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
222 | # endif | 270 | # endif |
223 | 271 | _GL_CXXALIASWARN (accept); | |
224 | # if @GNULIB_BIND@ | 272 | #elif @HAVE_WINSOCK2_H@ |
225 | # if @HAVE_WINSOCK2_H@ | 273 | # undef accept |
274 | # define accept accept_used_without_requesting_gnulib_module_accept | ||
275 | #elif defined GNULIB_POSIXCHECK | ||
276 | # undef accept | ||
277 | # if HAVE_RAW_DECL_ACCEPT | ||
278 | _GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - " | ||
279 | "use gnulib module accept for portability"); | ||
280 | # endif | ||
281 | #endif | ||
282 | |||
283 | #if @GNULIB_BIND@ | ||
284 | # if @HAVE_WINSOCK2_H@ | ||
285 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
226 | # undef bind | 286 | # undef bind |
227 | # define bind rpl_bind | 287 | # define bind rpl_bind |
228 | extern int rpl_bind (int, struct sockaddr *, int); | ||
229 | # endif | 288 | # endif |
230 | # elif @HAVE_WINSOCK2_H@ | 289 | _GL_FUNCDECL_RPL (bind, int, |
231 | # undef bind | 290 | (int fd, const struct sockaddr *addr, socklen_t addrlen) |
232 | # define bind bind_used_without_requesting_gnulib_module_bind | 291 | _GL_ARG_NONNULL ((2))); |
233 | # elif defined GNULIB_POSIXCHECK | 292 | _GL_CXXALIAS_RPL (bind, int, |
234 | # undef bind | 293 | (int fd, const struct sockaddr *addr, socklen_t addrlen)); |
235 | # define bind(s,a,l) \ | 294 | # else |
236 | (GL_LINK_WARNING ("bind is not always POSIX compliant - " \ | 295 | _GL_CXXALIAS_SYS (bind, int, |
237 | "use gnulib module bind for portability"), \ | 296 | (int fd, const struct sockaddr *addr, socklen_t addrlen)); |
238 | bind (s, a, l)) | 297 | # endif |
239 | # endif | 298 | _GL_CXXALIASWARN (bind); |
240 | 299 | #elif @HAVE_WINSOCK2_H@ | |
241 | # if @GNULIB_GETPEERNAME@ | 300 | # undef bind |
242 | # if @HAVE_WINSOCK2_H@ | 301 | # define bind bind_used_without_requesting_gnulib_module_bind |
302 | #elif defined GNULIB_POSIXCHECK | ||
303 | # undef bind | ||
304 | # if HAVE_RAW_DECL_BIND | ||
305 | _GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - " | ||
306 | "use gnulib module bind for portability"); | ||
307 | # endif | ||
308 | #endif | ||
309 | |||
310 | #if @GNULIB_GETPEERNAME@ | ||
311 | # if @HAVE_WINSOCK2_H@ | ||
312 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
243 | # undef getpeername | 313 | # undef getpeername |
244 | # define getpeername rpl_getpeername | 314 | # define getpeername rpl_getpeername |
245 | extern int rpl_getpeername (int, struct sockaddr *, int *); | ||
246 | # endif | 315 | # endif |
247 | # elif @HAVE_WINSOCK2_H@ | 316 | _GL_FUNCDECL_RPL (getpeername, int, |
248 | # undef getpeername | 317 | (int fd, struct sockaddr *addr, socklen_t *addrlen) |
249 | # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername | 318 | _GL_ARG_NONNULL ((2, 3))); |
250 | # elif defined GNULIB_POSIXCHECK | 319 | _GL_CXXALIAS_RPL (getpeername, int, |
251 | # undef getpeername | 320 | (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
252 | # define getpeername(s,a,l) \ | 321 | # else |
253 | (GL_LINK_WARNING ("getpeername is not always POSIX compliant - " \ | 322 | /* Need to cast, because on Solaris 10 systems, the third parameter is |
254 | "use gnulib module getpeername for portability"), \ | 323 | void *addrlen. */ |
255 | getpeername (s, a, l)) | 324 | _GL_CXXALIAS_SYS_CAST (getpeername, int, |
256 | # endif | 325 | (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
257 | 326 | # endif | |
258 | # if @GNULIB_GETSOCKNAME@ | 327 | _GL_CXXALIASWARN (getpeername); |
259 | # if @HAVE_WINSOCK2_H@ | 328 | #elif @HAVE_WINSOCK2_H@ |
329 | # undef getpeername | ||
330 | # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername | ||
331 | #elif defined GNULIB_POSIXCHECK | ||
332 | # undef getpeername | ||
333 | # if HAVE_RAW_DECL_GETPEERNAME | ||
334 | _GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - " | ||
335 | "use gnulib module getpeername for portability"); | ||
336 | # endif | ||
337 | #endif | ||
338 | |||
339 | #if @GNULIB_GETSOCKNAME@ | ||
340 | # if @HAVE_WINSOCK2_H@ | ||
341 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
260 | # undef getsockname | 342 | # undef getsockname |
261 | # define getsockname rpl_getsockname | 343 | # define getsockname rpl_getsockname |
262 | extern int rpl_getsockname (int, struct sockaddr *, int *); | ||
263 | # endif | 344 | # endif |
264 | # elif @HAVE_WINSOCK2_H@ | 345 | _GL_FUNCDECL_RPL (getsockname, int, |
265 | # undef getsockname | 346 | (int fd, struct sockaddr *addr, socklen_t *addrlen) |
266 | # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname | 347 | _GL_ARG_NONNULL ((2, 3))); |
267 | # elif defined GNULIB_POSIXCHECK | 348 | _GL_CXXALIAS_RPL (getsockname, int, |
268 | # undef getsockname | 349 | (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
269 | # define getsockname(s,a,l) \ | 350 | # else |
270 | (GL_LINK_WARNING ("getsockname is not always POSIX compliant - " \ | 351 | /* Need to cast, because on Solaris 10 systems, the third parameter is |
271 | "use gnulib module getsockname for portability"), \ | 352 | void *addrlen. */ |
272 | getsockname (s, a, l)) | 353 | _GL_CXXALIAS_SYS_CAST (getsockname, int, |
273 | # endif | 354 | (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
274 | 355 | # endif | |
275 | # if @GNULIB_GETSOCKOPT@ | 356 | _GL_CXXALIASWARN (getsockname); |
276 | # if @HAVE_WINSOCK2_H@ | 357 | #elif @HAVE_WINSOCK2_H@ |
358 | # undef getsockname | ||
359 | # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname | ||
360 | #elif defined GNULIB_POSIXCHECK | ||
361 | # undef getsockname | ||
362 | # if HAVE_RAW_DECL_GETSOCKNAME | ||
363 | _GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - " | ||
364 | "use gnulib module getsockname for portability"); | ||
365 | # endif | ||
366 | #endif | ||
367 | |||
368 | #if @GNULIB_GETSOCKOPT@ | ||
369 | # if @HAVE_WINSOCK2_H@ | ||
370 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
277 | # undef getsockopt | 371 | # undef getsockopt |
278 | # define getsockopt rpl_getsockopt | 372 | # define getsockopt rpl_getsockopt |
279 | extern int rpl_getsockopt (int, int, int, void *, socklen_t *); | ||
280 | # endif | 373 | # endif |
281 | # elif @HAVE_WINSOCK2_H@ | 374 | _GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname, |
282 | # undef getsockopt | 375 | void *optval, socklen_t *optlen) |
283 | # define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt | 376 | _GL_ARG_NONNULL ((4, 5))); |
284 | # elif defined GNULIB_POSIXCHECK | 377 | _GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname, |
285 | # undef getsockopt | 378 | void *optval, socklen_t *optlen)); |
286 | # define getsockopt(s,lvl,o,v,l) \ | 379 | # else |
287 | (GL_LINK_WARNING ("getsockopt is not always POSIX compliant - " \ | 380 | /* Need to cast, because on Solaris 10 systems, the fifth parameter is |
288 | "use gnulib module getsockopt for portability"), \ | 381 | void *optlen. */ |
289 | getsockopt (s, lvl, o, v, l)) | 382 | _GL_CXXALIAS_SYS_CAST (getsockopt, int, (int fd, int level, int optname, |
290 | # endif | 383 | void *optval, socklen_t *optlen)); |
291 | 384 | # endif | |
292 | # if @GNULIB_LISTEN@ | 385 | _GL_CXXALIASWARN (getsockopt); |
293 | # if @HAVE_WINSOCK2_H@ | 386 | #elif @HAVE_WINSOCK2_H@ |
387 | # undef getsockopt | ||
388 | # define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt | ||
389 | #elif defined GNULIB_POSIXCHECK | ||
390 | # undef getsockopt | ||
391 | # if HAVE_RAW_DECL_GETSOCKOPT | ||
392 | _GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - " | ||
393 | "use gnulib module getsockopt for portability"); | ||
394 | # endif | ||
395 | #endif | ||
396 | |||
397 | #if @GNULIB_LISTEN@ | ||
398 | # if @HAVE_WINSOCK2_H@ | ||
399 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
294 | # undef listen | 400 | # undef listen |
295 | # define listen rpl_listen | 401 | # define listen rpl_listen |
296 | extern int rpl_listen (int, int); | ||
297 | # endif | 402 | # endif |
298 | # elif @HAVE_WINSOCK2_H@ | 403 | _GL_FUNCDECL_RPL (listen, int, (int fd, int backlog)); |
299 | # undef listen | 404 | _GL_CXXALIAS_RPL (listen, int, (int fd, int backlog)); |
300 | # define listen listen_used_without_requesting_gnulib_module_listen | 405 | # else |
301 | # elif defined GNULIB_POSIXCHECK | 406 | _GL_CXXALIAS_SYS (listen, int, (int fd, int backlog)); |
302 | # undef listen | 407 | # endif |
303 | # define listen(s,b) \ | 408 | _GL_CXXALIASWARN (listen); |
304 | (GL_LINK_WARNING ("listen is not always POSIX compliant - " \ | 409 | #elif @HAVE_WINSOCK2_H@ |
305 | "use gnulib module listen for portability"), \ | 410 | # undef listen |
306 | listen (s, b)) | 411 | # define listen listen_used_without_requesting_gnulib_module_listen |
307 | # endif | 412 | #elif defined GNULIB_POSIXCHECK |
308 | 413 | # undef listen | |
309 | # if @GNULIB_RECV@ | 414 | # if HAVE_RAW_DECL_LISTEN |
310 | # if @HAVE_WINSOCK2_H@ | 415 | _GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - " |
416 | "use gnulib module listen for portability"); | ||
417 | # endif | ||
418 | #endif | ||
419 | |||
420 | #if @GNULIB_RECV@ | ||
421 | # if @HAVE_WINSOCK2_H@ | ||
422 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
311 | # undef recv | 423 | # undef recv |
312 | # define recv rpl_recv | 424 | # define recv rpl_recv |
313 | extern int rpl_recv (int, void *, int, int); | ||
314 | # endif | 425 | # endif |
315 | # elif @HAVE_WINSOCK2_H@ | 426 | _GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags) |
316 | # undef recv | 427 | _GL_ARG_NONNULL ((2))); |
317 | # define recv recv_used_without_requesting_gnulib_module_recv | 428 | _GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); |
318 | # elif defined GNULIB_POSIXCHECK | 429 | # else |
319 | # undef recv | 430 | _GL_CXXALIAS_SYS (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); |
320 | # define recv(s,b,n,f) \ | 431 | # endif |
321 | (GL_LINK_WARNING ("recv is not always POSIX compliant - " \ | 432 | _GL_CXXALIASWARN (recv); |
322 | "use gnulib module recv for portability"), \ | 433 | #elif @HAVE_WINSOCK2_H@ |
323 | recv (s, b, n, f)) | 434 | # undef recv |
324 | # endif | 435 | # define recv recv_used_without_requesting_gnulib_module_recv |
325 | 436 | #elif defined GNULIB_POSIXCHECK | |
326 | # if @GNULIB_SEND@ | 437 | # undef recv |
327 | # if @HAVE_WINSOCK2_H@ | 438 | # if HAVE_RAW_DECL_RECV |
439 | _GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - " | ||
440 | "use gnulib module recv for portability"); | ||
441 | # endif | ||
442 | #endif | ||
443 | |||
444 | #if @GNULIB_SEND@ | ||
445 | # if @HAVE_WINSOCK2_H@ | ||
446 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
328 | # undef send | 447 | # undef send |
329 | # define send rpl_send | 448 | # define send rpl_send |
330 | extern int rpl_send (int, const void *, int, int); | ||
331 | # endif | 449 | # endif |
332 | # elif @HAVE_WINSOCK2_H@ | 450 | _GL_FUNCDECL_RPL (send, ssize_t, |
333 | # undef send | 451 | (int fd, const void *buf, size_t len, int flags) |
334 | # define send send_used_without_requesting_gnulib_module_send | 452 | _GL_ARG_NONNULL ((2))); |
335 | # elif defined GNULIB_POSIXCHECK | 453 | _GL_CXXALIAS_RPL (send, ssize_t, |
336 | # undef send | 454 | (int fd, const void *buf, size_t len, int flags)); |
337 | # define send(s,b,n,f) \ | 455 | # else |
338 | (GL_LINK_WARNING ("send is not always POSIX compliant - " \ | 456 | _GL_CXXALIAS_SYS (send, ssize_t, |
339 | "use gnulib module send for portability"), \ | 457 | (int fd, const void *buf, size_t len, int flags)); |
340 | send (s, b, n, f)) | 458 | # endif |
341 | # endif | 459 | _GL_CXXALIASWARN (send); |
342 | 460 | #elif @HAVE_WINSOCK2_H@ | |
343 | # if @GNULIB_RECVFROM@ | 461 | # undef send |
344 | # if @HAVE_WINSOCK2_H@ | 462 | # define send send_used_without_requesting_gnulib_module_send |
463 | #elif defined GNULIB_POSIXCHECK | ||
464 | # undef send | ||
465 | # if HAVE_RAW_DECL_SEND | ||
466 | _GL_WARN_ON_USE (send, "send is not always POSIX compliant - " | ||
467 | "use gnulib module send for portability"); | ||
468 | # endif | ||
469 | #endif | ||
470 | |||
471 | #if @GNULIB_RECVFROM@ | ||
472 | # if @HAVE_WINSOCK2_H@ | ||
473 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
345 | # undef recvfrom | 474 | # undef recvfrom |
346 | # define recvfrom rpl_recvfrom | 475 | # define recvfrom rpl_recvfrom |
347 | extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *); | ||
348 | # endif | 476 | # endif |
349 | # elif @HAVE_WINSOCK2_H@ | 477 | _GL_FUNCDECL_RPL (recvfrom, ssize_t, |
350 | # undef recvfrom | 478 | (int fd, void *buf, size_t len, int flags, |
351 | # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom | 479 | struct sockaddr *from, socklen_t *fromlen) |
352 | # elif defined GNULIB_POSIXCHECK | 480 | _GL_ARG_NONNULL ((2))); |
353 | # undef recvfrom | 481 | _GL_CXXALIAS_RPL (recvfrom, ssize_t, |
354 | # define recvfrom(s,b,n,f,a,l) \ | 482 | (int fd, void *buf, size_t len, int flags, |
355 | (GL_LINK_WARNING ("recvfrom is not always POSIX compliant - " \ | 483 | struct sockaddr *from, socklen_t *fromlen)); |
356 | "use gnulib module recvfrom for portability"), \ | 484 | # else |
357 | recvfrom (s, b, n, f, a, l)) | 485 | /* Need to cast, because on Solaris 10 systems, the sixth parameter is |
358 | # endif | 486 | void *fromlen. */ |
359 | 487 | _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t, | |
360 | # if @GNULIB_SENDTO@ | 488 | (int fd, void *buf, size_t len, int flags, |
361 | # if @HAVE_WINSOCK2_H@ | 489 | struct sockaddr *from, socklen_t *fromlen)); |
490 | # endif | ||
491 | _GL_CXXALIASWARN (recvfrom); | ||
492 | #elif @HAVE_WINSOCK2_H@ | ||
493 | # undef recvfrom | ||
494 | # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom | ||
495 | #elif defined GNULIB_POSIXCHECK | ||
496 | # undef recvfrom | ||
497 | # if HAVE_RAW_DECL_RECVFROM | ||
498 | _GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - " | ||
499 | "use gnulib module recvfrom for portability"); | ||
500 | # endif | ||
501 | #endif | ||
502 | |||
503 | #if @GNULIB_SENDTO@ | ||
504 | # if @HAVE_WINSOCK2_H@ | ||
505 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
362 | # undef sendto | 506 | # undef sendto |
363 | # define sendto rpl_sendto | 507 | # define sendto rpl_sendto |
364 | extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int); | ||
365 | # endif | 508 | # endif |
366 | # elif @HAVE_WINSOCK2_H@ | 509 | _GL_FUNCDECL_RPL (sendto, ssize_t, |
367 | # undef sendto | 510 | (int fd, const void *buf, size_t len, int flags, |
368 | # define sendto sendto_used_without_requesting_gnulib_module_sendto | 511 | const struct sockaddr *to, socklen_t tolen) |
369 | # elif defined GNULIB_POSIXCHECK | 512 | _GL_ARG_NONNULL ((2))); |
370 | # undef sendto | 513 | _GL_CXXALIAS_RPL (sendto, ssize_t, |
371 | # define sendto(s,b,n,f,a,l) \ | 514 | (int fd, const void *buf, size_t len, int flags, |
372 | (GL_LINK_WARNING ("sendto is not always POSIX compliant - " \ | 515 | const struct sockaddr *to, socklen_t tolen)); |
373 | "use gnulib module sendto for portability"), \ | 516 | # else |
374 | sendto (s, b, n, f, a, l)) | 517 | _GL_CXXALIAS_SYS (sendto, ssize_t, |
375 | # endif | 518 | (int fd, const void *buf, size_t len, int flags, |
376 | 519 | const struct sockaddr *to, socklen_t tolen)); | |
377 | # if @GNULIB_SETSOCKOPT@ | 520 | # endif |
378 | # if @HAVE_WINSOCK2_H@ | 521 | _GL_CXXALIASWARN (sendto); |
522 | #elif @HAVE_WINSOCK2_H@ | ||
523 | # undef sendto | ||
524 | # define sendto sendto_used_without_requesting_gnulib_module_sendto | ||
525 | #elif defined GNULIB_POSIXCHECK | ||
526 | # undef sendto | ||
527 | # if HAVE_RAW_DECL_SENDTO | ||
528 | _GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - " | ||
529 | "use gnulib module sendto for portability"); | ||
530 | # endif | ||
531 | #endif | ||
532 | |||
533 | #if @GNULIB_SETSOCKOPT@ | ||
534 | # if @HAVE_WINSOCK2_H@ | ||
535 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
379 | # undef setsockopt | 536 | # undef setsockopt |
380 | # define setsockopt rpl_setsockopt | 537 | # define setsockopt rpl_setsockopt |
381 | extern int rpl_setsockopt (int, int, int, const void *, socklen_t); | ||
382 | # endif | 538 | # endif |
383 | # elif @HAVE_WINSOCK2_H@ | 539 | _GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname, |
384 | # undef setsockopt | 540 | const void * optval, socklen_t optlen) |
385 | # define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt | 541 | _GL_ARG_NONNULL ((4))); |
386 | # elif defined GNULIB_POSIXCHECK | 542 | _GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname, |
387 | # undef setsockopt | 543 | const void * optval, socklen_t optlen)); |
388 | # define setsockopt(s,lvl,o,v,l) \ | 544 | # else |
389 | (GL_LINK_WARNING ("setsockopt is not always POSIX compliant - " \ | 545 | _GL_CXXALIAS_SYS (setsockopt, int, (int fd, int level, int optname, |
390 | "use gnulib module setsockopt for portability"), \ | 546 | const void * optval, socklen_t optlen)); |
391 | setsockopt (s, lvl, o, v, l)) | 547 | # endif |
392 | # endif | 548 | _GL_CXXALIASWARN (setsockopt); |
393 | 549 | #elif @HAVE_WINSOCK2_H@ | |
394 | # if @GNULIB_SHUTDOWN@ | 550 | # undef setsockopt |
395 | # if @HAVE_WINSOCK2_H@ | 551 | # define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt |
552 | #elif defined GNULIB_POSIXCHECK | ||
553 | # undef setsockopt | ||
554 | # if HAVE_RAW_DECL_SETSOCKOPT | ||
555 | _GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - " | ||
556 | "use gnulib module setsockopt for portability"); | ||
557 | # endif | ||
558 | #endif | ||
559 | |||
560 | #if @GNULIB_SHUTDOWN@ | ||
561 | # if @HAVE_WINSOCK2_H@ | ||
562 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
396 | # undef shutdown | 563 | # undef shutdown |
397 | # define shutdown rpl_shutdown | 564 | # define shutdown rpl_shutdown |
398 | extern int rpl_shutdown (int, int); | ||
399 | # endif | 565 | # endif |
400 | # elif @HAVE_WINSOCK2_H@ | 566 | _GL_FUNCDECL_RPL (shutdown, int, (int fd, int how)); |
401 | # undef shutdown | 567 | _GL_CXXALIAS_RPL (shutdown, int, (int fd, int how)); |
402 | # define shutdown shutdown_used_without_requesting_gnulib_module_shutdown | 568 | # else |
403 | # elif defined GNULIB_POSIXCHECK | 569 | _GL_CXXALIAS_SYS (shutdown, int, (int fd, int how)); |
404 | # undef shutdown | 570 | # endif |
405 | # define shutdown(s,h) \ | 571 | _GL_CXXALIASWARN (shutdown); |
406 | (GL_LINK_WARNING ("shutdown is not always POSIX compliant - " \ | 572 | #elif @HAVE_WINSOCK2_H@ |
407 | "use gnulib module shutdown for portability"), \ | 573 | # undef shutdown |
408 | shutdown (s, h)) | 574 | # define shutdown shutdown_used_without_requesting_gnulib_module_shutdown |
575 | #elif defined GNULIB_POSIXCHECK | ||
576 | # undef shutdown | ||
577 | # if HAVE_RAW_DECL_SHUTDOWN | ||
578 | _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - " | ||
579 | "use gnulib module shutdown for portability"); | ||
409 | # endif | 580 | # endif |
581 | #endif | ||
410 | 582 | ||
411 | # if @HAVE_WINSOCK2_H@ | 583 | #if @HAVE_WINSOCK2_H@ |
584 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
412 | # undef select | 585 | # undef select |
413 | # define select select_used_without_including_sys_select_h | 586 | # define select select_used_without_including_sys_select_h |
587 | # else | ||
588 | _GL_WARN_ON_USE (select, | ||
589 | "select() used without including <sys/select.h>"); | ||
414 | # endif | 590 | # endif |
591 | #endif | ||
415 | 592 | ||
416 | # ifdef __cplusplus | 593 | #if @GNULIB_ACCEPT4@ |
417 | } | 594 | /* Accept a connection on a socket, with specific opening flags. |
595 | The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) | ||
596 | and O_TEXT, O_BINARY (defined in "binary-io.h"). | ||
597 | See also the Linux man page at | ||
598 | <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */ | ||
599 | # if @HAVE_ACCEPT4@ | ||
600 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
601 | # define accept4 rpl_accept4 | ||
602 | # endif | ||
603 | _GL_FUNCDECL_RPL (accept4, int, | ||
604 | (int sockfd, struct sockaddr *addr, socklen_t *addrlen, | ||
605 | int flags)); | ||
606 | _GL_CXXALIAS_RPL (accept4, int, | ||
607 | (int sockfd, struct sockaddr *addr, socklen_t *addrlen, | ||
608 | int flags)); | ||
609 | # else | ||
610 | _GL_FUNCDECL_SYS (accept4, int, | ||
611 | (int sockfd, struct sockaddr *addr, socklen_t *addrlen, | ||
612 | int flags)); | ||
613 | _GL_CXXALIAS_SYS (accept4, int, | ||
614 | (int sockfd, struct sockaddr *addr, socklen_t *addrlen, | ||
615 | int flags)); | ||
418 | # endif | 616 | # endif |
419 | 617 | _GL_CXXALIASWARN (accept4); | |
420 | #endif /* HAVE_SYS_SOCKET_H */ | 618 | #elif defined GNULIB_POSIXCHECK |
619 | # undef accept4 | ||
620 | # if HAVE_RAW_DECL_ACCEPT4 | ||
621 | _GL_WARN_ON_USE (accept4, "accept4 is unportable - " | ||
622 | "use gnulib module accept4 for portability"); | ||
623 | # endif | ||
624 | #endif | ||
421 | 625 | ||
422 | #endif /* _GL_SYS_SOCKET_H */ | 626 | #endif /* _GL_SYS_SOCKET_H */ |
423 | #endif /* _GL_SYS_SOCKET_H */ | 627 | #endif /* _GL_SYS_SOCKET_H */ |
628 | #endif | ||