Update Gnulib; add new modules.
[bpt/guile.git] / lib / sys_socket.in.h
1 /* Provide a sys/socket header file for systems lacking it (read: MinGW)
2 and for systems where it is incomplete.
3 Copyright (C) 2005-2011 Free Software Foundation, Inc.
4 Written by Simon Josefsson.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19
20 /* This file is supposed to be used on platforms that lack <sys/socket.h>,
21 on platforms where <sys/socket.h> cannot be included standalone, and on
22 platforms where <sys/socket.h> does not provide all necessary definitions.
23 It is intended to provide definitions and prototypes needed by an
24 application. */
25
26 #if __GNUC__ >= 3
27 @PRAGMA_SYSTEM_HEADER@
28 #endif
29 @PRAGMA_COLUMNS@
30
31 #if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H
32 /* Special invocation convention:
33 - On Cygwin 1.5.x we have a sequence of nested includes
34 <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>,
35 and the latter includes <sys/socket.h>. In this situation, the functions
36 are not yet declared, therefore we cannot provide the C++ aliases. */
37
38 #@INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
39
40 #else
41 /* Normal invocation convention. */
42
43 #ifndef _GL_SYS_SOCKET_H
44
45 #if @HAVE_SYS_SOCKET_H@
46
47 # define _GL_ALREADY_INCLUDING_SYS_SOCKET_H
48
49 /* On many platforms, <sys/socket.h> assumes prior inclusion of
50 <sys/types.h>. */
51 # include <sys/types.h>
52
53 /* The include_next requires a split double-inclusion guard. */
54 # @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
55
56 # undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H
57
58 #endif
59
60 #ifndef _GL_SYS_SOCKET_H
61 #define _GL_SYS_SOCKET_H
62
63 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
64
65 /* The definition of _GL_ARG_NONNULL is copied here. */
66
67 /* The definition of _GL_WARN_ON_USE is copied here. */
68
69 #if !@HAVE_SA_FAMILY_T@
70 # if !GNULIB_defined_sa_family_t
71 typedef unsigned short sa_family_t;
72 # define GNULIB_defined_sa_family_t 1
73 # endif
74 #endif
75
76 #if @HAVE_STRUCT_SOCKADDR_STORAGE@
77 /* Make the 'struct sockaddr_storage' field 'ss_family' visible on AIX 7.1. */
78 # if !@HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@
79 # ifndef ss_family
80 # define ss_family __ss_family
81 # endif
82 # endif
83 #else
84 # include <alignof.h>
85 /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on
86 2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */
87 # define __ss_aligntype unsigned long int
88 # define _SS_SIZE 256
89 # define _SS_PADSIZE \
90 (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype) \
91 ? sizeof (sa_family_t) \
92 : alignof (__ss_aligntype)) \
93 + sizeof (__ss_aligntype)))
94
95 # if !GNULIB_defined_struct_sockaddr_storage
96 struct sockaddr_storage
97 {
98 sa_family_t ss_family; /* Address family, etc. */
99 __ss_aligntype __ss_align; /* Force desired alignment. */
100 char __ss_padding[_SS_PADSIZE];
101 };
102 # define GNULIB_defined_struct_sockaddr_storage 1
103 # endif
104
105 #endif
106
107 #if @HAVE_SYS_SOCKET_H@
108
109 /* A platform that has <sys/socket.h>. */
110
111 /* For shutdown(). */
112 # if !defined SHUT_RD
113 # define SHUT_RD 0
114 # endif
115 # if !defined SHUT_WR
116 # define SHUT_WR 1
117 # endif
118 # if !defined SHUT_RDWR
119 # define SHUT_RDWR 2
120 # endif
121
122 #else
123
124 # ifdef __CYGWIN__
125 # error "Cygwin does have a sys/socket.h, doesn't it?!?"
126 # endif
127
128 /* A platform that lacks <sys/socket.h>.
129
130 Currently only MinGW is supported. See the gnulib manual regarding
131 Windows sockets. MinGW has the header files winsock2.h and
132 ws2tcpip.h that declare the sys/socket.h definitions we need. Note
133 that you can influence which definitions you get by setting the
134 WINVER symbol before including these two files. For example,
135 getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
136 symbol is set indiriectly through WINVER). You can set this by
137 adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your
138 code may not run on older Windows releases then. My Windows 2000
139 box was not able to run the code, for example. The situation is
140 slightly confusing because
141 <http://msdn.microsoft.com/en-us/library/ms738520>
142 suggests that getaddrinfo should be available on all Windows
143 releases. */
144
145
146 # if @HAVE_WINSOCK2_H@
147 # include <winsock2.h>
148 # endif
149 # if @HAVE_WS2TCPIP_H@
150 # include <ws2tcpip.h>
151 # endif
152
153 /* For shutdown(). */
154 # if !defined SHUT_RD && defined SD_RECEIVE
155 # define SHUT_RD SD_RECEIVE
156 # endif
157 # if !defined SHUT_WR && defined SD_SEND
158 # define SHUT_WR SD_SEND
159 # endif
160 # if !defined SHUT_RDWR && defined SD_BOTH
161 # define SHUT_RDWR SD_BOTH
162 # endif
163
164 # if @HAVE_WINSOCK2_H@
165 /* Include headers needed by the emulation code. */
166 # include <sys/types.h>
167 # include <io.h>
168
169 # if !GNULIB_defined_socklen_t
170 typedef int socklen_t;
171 # define GNULIB_defined_socklen_t 1
172 # endif
173
174 # endif
175
176 #endif
177
178 #if @HAVE_WINSOCK2_H@
179
180 # if !GNULIB_defined_rpl_fd_isset
181
182 /* Re-define FD_ISSET to avoid a WSA call while we are not using
183 network sockets. */
184 static inline int
185 rpl_fd_isset (SOCKET fd, fd_set * set)
186 {
187 u_int i;
188 if (set == NULL)
189 return 0;
190
191 for (i = 0; i < set->fd_count; i++)
192 if (set->fd_array[i] == fd)
193 return 1;
194
195 return 0;
196 }
197
198 # define GNULIB_defined_rpl_fd_isset 1
199 # endif
200
201 # undef FD_ISSET
202 # define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
203
204 #endif
205
206 /* Wrap everything else to use libc file descriptors for sockets. */
207
208 #if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
209 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
210 # undef close
211 # define close close_used_without_including_unistd_h
212 # else
213 _GL_WARN_ON_USE (close,
214 "close() used without including <unistd.h>");
215 # endif
216 #endif
217
218 #if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
219 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
220 # undef gethostname
221 # define gethostname gethostname_used_without_including_unistd_h
222 # else
223 _GL_WARN_ON_USE (gethostname,
224 "gethostname() used without including <unistd.h>");
225 # endif
226 #endif
227
228 #if @GNULIB_SOCKET@
229 # if @HAVE_WINSOCK2_H@
230 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
231 # undef socket
232 # define socket rpl_socket
233 # endif
234 _GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol));
235 _GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol));
236 # else
237 _GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol));
238 # endif
239 _GL_CXXALIASWARN (socket);
240 #elif @HAVE_WINSOCK2_H@
241 # undef socket
242 # define socket socket_used_without_requesting_gnulib_module_socket
243 #elif defined GNULIB_POSIXCHECK
244 # undef socket
245 # if HAVE_RAW_DECL_SOCKET
246 _GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
247 "use gnulib module socket for portability");
248 # endif
249 #endif
250
251 #if @GNULIB_CONNECT@
252 # if @HAVE_WINSOCK2_H@
253 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
254 # undef connect
255 # define connect rpl_connect
256 # endif
257 _GL_FUNCDECL_RPL (connect, int,
258 (int fd, const struct sockaddr *addr, socklen_t addrlen)
259 _GL_ARG_NONNULL ((2)));
260 _GL_CXXALIAS_RPL (connect, int,
261 (int fd, const struct sockaddr *addr, socklen_t addrlen));
262 # else
263 /* Need to cast, because on NonStop Kernel, the third parameter is
264 size_t addrlen. */
265 _GL_CXXALIAS_SYS_CAST (connect, int,
266 (int fd,
267 const struct sockaddr *addr, socklen_t addrlen));
268 # endif
269 _GL_CXXALIASWARN (connect);
270 #elif @HAVE_WINSOCK2_H@
271 # undef connect
272 # define connect socket_used_without_requesting_gnulib_module_connect
273 #elif defined GNULIB_POSIXCHECK
274 # undef connect
275 # if HAVE_RAW_DECL_CONNECT
276 _GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
277 "use gnulib module connect for portability");
278 # endif
279 #endif
280
281 #if @GNULIB_ACCEPT@
282 # if @HAVE_WINSOCK2_H@
283 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
284 # undef accept
285 # define accept rpl_accept
286 # endif
287 _GL_FUNCDECL_RPL (accept, int,
288 (int fd, struct sockaddr *addr, socklen_t *addrlen));
289 _GL_CXXALIAS_RPL (accept, int,
290 (int fd, struct sockaddr *addr, socklen_t *addrlen));
291 # else
292 /* Need to cast, because on Solaris 10 systems, the third parameter is
293 void *addrlen. */
294 _GL_CXXALIAS_SYS_CAST (accept, int,
295 (int fd, struct sockaddr *addr, socklen_t *addrlen));
296 # endif
297 _GL_CXXALIASWARN (accept);
298 #elif @HAVE_WINSOCK2_H@
299 # undef accept
300 # define accept accept_used_without_requesting_gnulib_module_accept
301 #elif defined GNULIB_POSIXCHECK
302 # undef accept
303 # if HAVE_RAW_DECL_ACCEPT
304 _GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
305 "use gnulib module accept for portability");
306 # endif
307 #endif
308
309 #if @GNULIB_BIND@
310 # if @HAVE_WINSOCK2_H@
311 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
312 # undef bind
313 # define bind rpl_bind
314 # endif
315 _GL_FUNCDECL_RPL (bind, int,
316 (int fd, const struct sockaddr *addr, socklen_t addrlen)
317 _GL_ARG_NONNULL ((2)));
318 _GL_CXXALIAS_RPL (bind, int,
319 (int fd, const struct sockaddr *addr, socklen_t addrlen));
320 # else
321 /* Need to cast, because on NonStop Kernel, the third parameter is
322 size_t addrlen. */
323 _GL_CXXALIAS_SYS_CAST (bind, int,
324 (int fd,
325 const struct sockaddr *addr, socklen_t addrlen));
326 # endif
327 _GL_CXXALIASWARN (bind);
328 #elif @HAVE_WINSOCK2_H@
329 # undef bind
330 # define bind bind_used_without_requesting_gnulib_module_bind
331 #elif defined GNULIB_POSIXCHECK
332 # undef bind
333 # if HAVE_RAW_DECL_BIND
334 _GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
335 "use gnulib module bind for portability");
336 # endif
337 #endif
338
339 #if @GNULIB_GETPEERNAME@
340 # if @HAVE_WINSOCK2_H@
341 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
342 # undef getpeername
343 # define getpeername rpl_getpeername
344 # endif
345 _GL_FUNCDECL_RPL (getpeername, int,
346 (int fd, struct sockaddr *addr, socklen_t *addrlen)
347 _GL_ARG_NONNULL ((2, 3)));
348 _GL_CXXALIAS_RPL (getpeername, int,
349 (int fd, struct sockaddr *addr, socklen_t *addrlen));
350 # else
351 /* Need to cast, because on Solaris 10 systems, the third parameter is
352 void *addrlen. */
353 _GL_CXXALIAS_SYS_CAST (getpeername, int,
354 (int fd, struct sockaddr *addr, socklen_t *addrlen));
355 # endif
356 _GL_CXXALIASWARN (getpeername);
357 #elif @HAVE_WINSOCK2_H@
358 # undef getpeername
359 # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
360 #elif defined GNULIB_POSIXCHECK
361 # undef getpeername
362 # if HAVE_RAW_DECL_GETPEERNAME
363 _GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
364 "use gnulib module getpeername for portability");
365 # endif
366 #endif
367
368 #if @GNULIB_GETSOCKNAME@
369 # if @HAVE_WINSOCK2_H@
370 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
371 # undef getsockname
372 # define getsockname rpl_getsockname
373 # endif
374 _GL_FUNCDECL_RPL (getsockname, int,
375 (int fd, struct sockaddr *addr, socklen_t *addrlen)
376 _GL_ARG_NONNULL ((2, 3)));
377 _GL_CXXALIAS_RPL (getsockname, int,
378 (int fd, struct sockaddr *addr, socklen_t *addrlen));
379 # else
380 /* Need to cast, because on Solaris 10 systems, the third parameter is
381 void *addrlen. */
382 _GL_CXXALIAS_SYS_CAST (getsockname, int,
383 (int fd, struct sockaddr *addr, socklen_t *addrlen));
384 # endif
385 _GL_CXXALIASWARN (getsockname);
386 #elif @HAVE_WINSOCK2_H@
387 # undef getsockname
388 # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
389 #elif defined GNULIB_POSIXCHECK
390 # undef getsockname
391 # if HAVE_RAW_DECL_GETSOCKNAME
392 _GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
393 "use gnulib module getsockname for portability");
394 # endif
395 #endif
396
397 #if @GNULIB_GETSOCKOPT@
398 # if @HAVE_WINSOCK2_H@
399 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
400 # undef getsockopt
401 # define getsockopt rpl_getsockopt
402 # endif
403 _GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname,
404 void *optval, socklen_t *optlen)
405 _GL_ARG_NONNULL ((4, 5)));
406 _GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname,
407 void *optval, socklen_t *optlen));
408 # else
409 /* Need to cast, because on Solaris 10 systems, the fifth parameter is
410 void *optlen. */
411 _GL_CXXALIAS_SYS_CAST (getsockopt, int, (int fd, int level, int optname,
412 void *optval, socklen_t *optlen));
413 # endif
414 _GL_CXXALIASWARN (getsockopt);
415 #elif @HAVE_WINSOCK2_H@
416 # undef getsockopt
417 # define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
418 #elif defined GNULIB_POSIXCHECK
419 # undef getsockopt
420 # if HAVE_RAW_DECL_GETSOCKOPT
421 _GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
422 "use gnulib module getsockopt for portability");
423 # endif
424 #endif
425
426 #if @GNULIB_LISTEN@
427 # if @HAVE_WINSOCK2_H@
428 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
429 # undef listen
430 # define listen rpl_listen
431 # endif
432 _GL_FUNCDECL_RPL (listen, int, (int fd, int backlog));
433 _GL_CXXALIAS_RPL (listen, int, (int fd, int backlog));
434 # else
435 _GL_CXXALIAS_SYS (listen, int, (int fd, int backlog));
436 # endif
437 _GL_CXXALIASWARN (listen);
438 #elif @HAVE_WINSOCK2_H@
439 # undef listen
440 # define listen listen_used_without_requesting_gnulib_module_listen
441 #elif defined GNULIB_POSIXCHECK
442 # undef listen
443 # if HAVE_RAW_DECL_LISTEN
444 _GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
445 "use gnulib module listen for portability");
446 # endif
447 #endif
448
449 #if @GNULIB_RECV@
450 # if @HAVE_WINSOCK2_H@
451 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
452 # undef recv
453 # define recv rpl_recv
454 # endif
455 _GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)
456 _GL_ARG_NONNULL ((2)));
457 _GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
458 # else
459 _GL_CXXALIAS_SYS (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
460 # endif
461 _GL_CXXALIASWARN (recv);
462 #elif @HAVE_WINSOCK2_H@
463 # undef recv
464 # define recv recv_used_without_requesting_gnulib_module_recv
465 #elif defined GNULIB_POSIXCHECK
466 # undef recv
467 # if HAVE_RAW_DECL_RECV
468 _GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
469 "use gnulib module recv for portability");
470 # endif
471 #endif
472
473 #if @GNULIB_SEND@
474 # if @HAVE_WINSOCK2_H@
475 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
476 # undef send
477 # define send rpl_send
478 # endif
479 _GL_FUNCDECL_RPL (send, ssize_t,
480 (int fd, const void *buf, size_t len, int flags)
481 _GL_ARG_NONNULL ((2)));
482 _GL_CXXALIAS_RPL (send, ssize_t,
483 (int fd, const void *buf, size_t len, int flags));
484 # else
485 _GL_CXXALIAS_SYS (send, ssize_t,
486 (int fd, const void *buf, size_t len, int flags));
487 # endif
488 _GL_CXXALIASWARN (send);
489 #elif @HAVE_WINSOCK2_H@
490 # undef send
491 # define send send_used_without_requesting_gnulib_module_send
492 #elif defined GNULIB_POSIXCHECK
493 # undef send
494 # if HAVE_RAW_DECL_SEND
495 _GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
496 "use gnulib module send for portability");
497 # endif
498 #endif
499
500 #if @GNULIB_RECVFROM@
501 # if @HAVE_WINSOCK2_H@
502 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
503 # undef recvfrom
504 # define recvfrom rpl_recvfrom
505 # endif
506 _GL_FUNCDECL_RPL (recvfrom, ssize_t,
507 (int fd, void *buf, size_t len, int flags,
508 struct sockaddr *from, socklen_t *fromlen)
509 _GL_ARG_NONNULL ((2)));
510 _GL_CXXALIAS_RPL (recvfrom, ssize_t,
511 (int fd, void *buf, size_t len, int flags,
512 struct sockaddr *from, socklen_t *fromlen));
513 # else
514 /* Need to cast, because on Solaris 10 systems, the sixth parameter is
515 void *fromlen. */
516 _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
517 (int fd, void *buf, size_t len, int flags,
518 struct sockaddr *from, socklen_t *fromlen));
519 # endif
520 _GL_CXXALIASWARN (recvfrom);
521 #elif @HAVE_WINSOCK2_H@
522 # undef recvfrom
523 # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
524 #elif defined GNULIB_POSIXCHECK
525 # undef recvfrom
526 # if HAVE_RAW_DECL_RECVFROM
527 _GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
528 "use gnulib module recvfrom for portability");
529 # endif
530 #endif
531
532 #if @GNULIB_SENDTO@
533 # if @HAVE_WINSOCK2_H@
534 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
535 # undef sendto
536 # define sendto rpl_sendto
537 # endif
538 _GL_FUNCDECL_RPL (sendto, ssize_t,
539 (int fd, const void *buf, size_t len, int flags,
540 const struct sockaddr *to, socklen_t tolen)
541 _GL_ARG_NONNULL ((2)));
542 _GL_CXXALIAS_RPL (sendto, ssize_t,
543 (int fd, const void *buf, size_t len, int flags,
544 const struct sockaddr *to, socklen_t tolen));
545 # else
546 /* Need to cast, because on NonStop Kernel, the sixth parameter is
547 size_t tolen. */
548 _GL_CXXALIAS_SYS_CAST (sendto, ssize_t,
549 (int fd, const void *buf, size_t len, int flags,
550 const struct sockaddr *to, socklen_t tolen));
551 # endif
552 _GL_CXXALIASWARN (sendto);
553 #elif @HAVE_WINSOCK2_H@
554 # undef sendto
555 # define sendto sendto_used_without_requesting_gnulib_module_sendto
556 #elif defined GNULIB_POSIXCHECK
557 # undef sendto
558 # if HAVE_RAW_DECL_SENDTO
559 _GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
560 "use gnulib module sendto for portability");
561 # endif
562 #endif
563
564 #if @GNULIB_SETSOCKOPT@
565 # if @HAVE_WINSOCK2_H@
566 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
567 # undef setsockopt
568 # define setsockopt rpl_setsockopt
569 # endif
570 _GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
571 const void * optval, socklen_t optlen)
572 _GL_ARG_NONNULL ((4)));
573 _GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
574 const void * optval, socklen_t optlen));
575 # else
576 /* Need to cast, because on NonStop Kernel, the fifth parameter is
577 size_t optlen. */
578 _GL_CXXALIAS_SYS_CAST (setsockopt, int,
579 (int fd, int level, int optname,
580 const void * optval, socklen_t optlen));
581 # endif
582 _GL_CXXALIASWARN (setsockopt);
583 #elif @HAVE_WINSOCK2_H@
584 # undef setsockopt
585 # define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
586 #elif defined GNULIB_POSIXCHECK
587 # undef setsockopt
588 # if HAVE_RAW_DECL_SETSOCKOPT
589 _GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
590 "use gnulib module setsockopt for portability");
591 # endif
592 #endif
593
594 #if @GNULIB_SHUTDOWN@
595 # if @HAVE_WINSOCK2_H@
596 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
597 # undef shutdown
598 # define shutdown rpl_shutdown
599 # endif
600 _GL_FUNCDECL_RPL (shutdown, int, (int fd, int how));
601 _GL_CXXALIAS_RPL (shutdown, int, (int fd, int how));
602 # else
603 _GL_CXXALIAS_SYS (shutdown, int, (int fd, int how));
604 # endif
605 _GL_CXXALIASWARN (shutdown);
606 #elif @HAVE_WINSOCK2_H@
607 # undef shutdown
608 # define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
609 #elif defined GNULIB_POSIXCHECK
610 # undef shutdown
611 # if HAVE_RAW_DECL_SHUTDOWN
612 _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
613 "use gnulib module shutdown for portability");
614 # endif
615 #endif
616
617 #if @HAVE_WINSOCK2_H@
618 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
619 # undef select
620 # define select select_used_without_including_sys_select_h
621 # else
622 _GL_WARN_ON_USE (select,
623 "select() used without including <sys/select.h>");
624 # endif
625 #endif
626
627 #if @GNULIB_ACCEPT4@
628 /* Accept a connection on a socket, with specific opening flags.
629 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
630 and O_TEXT, O_BINARY (defined in "binary-io.h").
631 See also the Linux man page at
632 <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */
633 # if @HAVE_ACCEPT4@
634 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
635 # define accept4 rpl_accept4
636 # endif
637 _GL_FUNCDECL_RPL (accept4, int,
638 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
639 int flags));
640 _GL_CXXALIAS_RPL (accept4, int,
641 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
642 int flags));
643 # else
644 _GL_FUNCDECL_SYS (accept4, int,
645 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
646 int flags));
647 _GL_CXXALIAS_SYS (accept4, int,
648 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
649 int flags));
650 # endif
651 _GL_CXXALIASWARN (accept4);
652 #elif defined GNULIB_POSIXCHECK
653 # undef accept4
654 # if HAVE_RAW_DECL_ACCEPT4
655 _GL_WARN_ON_USE (accept4, "accept4 is unportable - "
656 "use gnulib module accept4 for portability");
657 # endif
658 #endif
659
660 #endif /* _GL_SYS_SOCKET_H */
661 #endif /* _GL_SYS_SOCKET_H */
662 #endif