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