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-2017 Free Software Foundation, Inc.
4 Written by Simon Josefsson.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
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 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>. */
19 /* This file is supposed to be used on platforms that lack <sys/socket.h>,
20 on platforms where <sys/socket.h> cannot be included standalone, and on
21 platforms where <sys/socket.h> does not provide all necessary definitions.
22 It is intended to provide definitions and prototypes needed by an
26 @PRAGMA_SYSTEM_HEADER@
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. */
37 #@INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
40 /* Normal invocation convention. */
42 #ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
44 #if @HAVE_SYS_SOCKET_H@
46 # define _GL_ALREADY_INCLUDING_SYS_SOCKET_H
48 /* On many platforms, <sys/socket.h> assumes prior inclusion of
50 # include <sys/types.h>
52 /* On FreeBSD 6.4, <sys/socket.h> defines some macros that assume that NULL
56 /* The include_next requires a split double-inclusion guard. */
57 # @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
59 # undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H
63 #ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
64 #define _@GUARD_PREFIX@_SYS_SOCKET_H
66 #ifndef _GL_INLINE_HEADER_BEGIN
67 #error "Please include config.h first."
69 _GL_INLINE_HEADER_BEGIN
70 #ifndef _GL_SYS_SOCKET_INLINE
71 # define _GL_SYS_SOCKET_INLINE _GL_INLINE
74 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
76 /* The definition of _GL_ARG_NONNULL is copied here. */
78 /* The definition of _GL_WARN_ON_USE is copied here. */
80 #if !@HAVE_SA_FAMILY_T@
81 # if !GNULIB_defined_sa_family_t
82 /* On OS/2 kLIBC, sa_family_t is unsigned char unless TCPV40HDRS is defined. */
83 # if !defined __KLIBC__ || defined TCPV40HDRS
84 typedef unsigned short sa_family_t
;
86 typedef unsigned char sa_family_t
;
88 # define GNULIB_defined_sa_family_t 1
92 #if @HAVE_STRUCT_SOCKADDR_STORAGE@
93 /* Make the 'struct sockaddr_storage' field 'ss_family' visible on AIX 7.1. */
94 # if !@HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@
96 # define ss_family __ss_family
100 # include <stdalign.h>
101 /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on
102 2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */
103 # define __ss_aligntype unsigned long int
104 # define _SS_SIZE 256
105 # define _SS_PADSIZE \
106 (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype) \
107 ? sizeof (sa_family_t) \
108 : alignof (__ss_aligntype)) \
109 + sizeof (__ss_aligntype)))
111 # if !GNULIB_defined_struct_sockaddr_storage
112 struct sockaddr_storage
114 sa_family_t ss_family
; /* Address family, etc. */
115 __ss_aligntype __ss_align
; /* Force desired alignment. */
116 char __ss_padding
[_SS_PADSIZE
];
118 # define GNULIB_defined_struct_sockaddr_storage 1
123 /* Get struct iovec. */
124 /* But avoid namespace pollution on glibc systems. */
125 #if ! defined __GLIBC__
126 # include <sys/uio.h>
129 #if @HAVE_SYS_SOCKET_H@
131 /* A platform that has <sys/socket.h>. */
133 /* For shutdown(). */
134 # if !defined SHUT_RD
137 # if !defined SHUT_WR
140 # if !defined SHUT_RDWR
147 # error "Cygwin does have a sys/socket.h, doesn't it?!?"
150 /* A platform that lacks <sys/socket.h>.
152 Currently only MinGW is supported. See the gnulib manual regarding
153 Windows sockets. MinGW has the header files winsock2.h and
154 ws2tcpip.h that declare the sys/socket.h definitions we need. Note
155 that you can influence which definitions you get by setting the
156 WINVER symbol before including these two files. For example,
157 getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
158 symbol is set indirectly through WINVER). You can set this by
159 adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your
160 code may not run on older Windows releases then. My Windows 2000
161 box was not able to run the code, for example. The situation is
162 slightly confusing because
163 <http://msdn.microsoft.com/en-us/library/ms738520>
164 suggests that getaddrinfo should be available on all Windows
167 # if @HAVE_WINSOCK2_H@
168 # include <winsock2.h>
170 # if @HAVE_WS2TCPIP_H@
171 # include <ws2tcpip.h>
174 /* For shutdown(). */
175 # if !defined SHUT_RD && defined SD_RECEIVE
176 # define SHUT_RD SD_RECEIVE
178 # if !defined SHUT_WR && defined SD_SEND
179 # define SHUT_WR SD_SEND
181 # if !defined SHUT_RDWR && defined SD_BOTH
182 # define SHUT_RDWR SD_BOTH
185 # if @HAVE_WINSOCK2_H@
186 /* Include headers needed by the emulation code. */
187 # include <sys/types.h>
190 # if !GNULIB_defined_socklen_t
191 typedef int socklen_t
;
192 # define GNULIB_defined_socklen_t 1
197 /* Rudimentary 'struct msghdr'; this works as long as you don't try to
198 access msg_control or msg_controllen. */
201 socklen_t msg_namelen
;
202 struct iovec
*msg_iov
;
209 /* Fix some definitions from <winsock2.h>. */
211 #if @HAVE_WINSOCK2_H@
213 # if !GNULIB_defined_rpl_fd_isset
215 /* Re-define FD_ISSET to avoid a WSA call while we are not using
217 _GL_SYS_SOCKET_INLINE
int
218 rpl_fd_isset (SOCKET fd
, fd_set
* set
)
224 for (i
= 0; i
< set
->fd_count
; i
++)
225 if (set
->fd_array
[i
] == fd
)
231 # define GNULIB_defined_rpl_fd_isset 1
235 # define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
239 /* Hide some function declarations from <winsock2.h>. */
241 #if @HAVE_WINSOCK2_H@
242 # if !defined _@GUARD_PREFIX@_UNISTD_H
243 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
245 # define close close_used_without_including_unistd_h
247 _GL_WARN_ON_USE (close
,
248 "close() used without including <unistd.h>");
250 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
252 # define gethostname gethostname_used_without_including_unistd_h
254 _GL_WARN_ON_USE (gethostname
,
255 "gethostname() used without including <unistd.h>");
258 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
259 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
261 # define select select_used_without_including_sys_select_h
263 _GL_WARN_ON_USE (select
,
264 "select() used without including <sys/select.h>");
269 /* Wrap everything else to use libc file descriptors for sockets. */
272 # if @HAVE_WINSOCK2_H@
273 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
275 # define socket rpl_socket
277 _GL_FUNCDECL_RPL (socket
, int, (int domain
, int type
, int protocol
));
278 _GL_CXXALIAS_RPL (socket
, int, (int domain
, int type
, int protocol
));
280 _GL_CXXALIAS_SYS (socket
, int, (int domain
, int type
, int protocol
));
282 _GL_CXXALIASWARN (socket
);
283 #elif @HAVE_WINSOCK2_H@
285 # define socket socket_used_without_requesting_gnulib_module_socket
286 #elif defined GNULIB_POSIXCHECK
288 # if HAVE_RAW_DECL_SOCKET
289 _GL_WARN_ON_USE (socket
, "socket is not always POSIX compliant - "
290 "use gnulib module socket for portability");
295 # if @HAVE_WINSOCK2_H@
296 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
298 # define connect rpl_connect
300 _GL_FUNCDECL_RPL (connect
, int,
301 (int fd
, const struct sockaddr
*addr
, socklen_t addrlen
)
302 _GL_ARG_NONNULL ((2)));
303 _GL_CXXALIAS_RPL (connect
, int,
304 (int fd
, const struct sockaddr
*addr
, socklen_t addrlen
));
306 /* Need to cast, because on NonStop Kernel, the third parameter is
308 _GL_CXXALIAS_SYS_CAST (connect
, int,
310 const struct sockaddr
*addr
, socklen_t addrlen
));
312 _GL_CXXALIASWARN (connect
);
313 #elif @HAVE_WINSOCK2_H@
315 # define connect socket_used_without_requesting_gnulib_module_connect
316 #elif defined GNULIB_POSIXCHECK
318 # if HAVE_RAW_DECL_CONNECT
319 _GL_WARN_ON_USE (connect
, "connect is not always POSIX compliant - "
320 "use gnulib module connect for portability");
325 # if @HAVE_WINSOCK2_H@
326 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
328 # define accept rpl_accept
330 _GL_FUNCDECL_RPL (accept
, int,
331 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
332 _GL_CXXALIAS_RPL (accept
, int,
333 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
335 /* Need to cast, because on Solaris 10 systems, the third parameter is
337 _GL_CXXALIAS_SYS_CAST (accept
, int,
338 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
340 _GL_CXXALIASWARN (accept
);
341 #elif @HAVE_WINSOCK2_H@
343 # define accept accept_used_without_requesting_gnulib_module_accept
344 #elif defined GNULIB_POSIXCHECK
346 # if HAVE_RAW_DECL_ACCEPT
347 _GL_WARN_ON_USE (accept
, "accept is not always POSIX compliant - "
348 "use gnulib module accept for portability");
353 # if @HAVE_WINSOCK2_H@
354 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
356 # define bind rpl_bind
358 _GL_FUNCDECL_RPL (bind
, int,
359 (int fd
, const struct sockaddr
*addr
, socklen_t addrlen
)
360 _GL_ARG_NONNULL ((2)));
361 _GL_CXXALIAS_RPL (bind
, int,
362 (int fd
, const struct sockaddr
*addr
, socklen_t addrlen
));
364 /* Need to cast, because on NonStop Kernel, the third parameter is
366 _GL_CXXALIAS_SYS_CAST (bind
, int,
368 const struct sockaddr
*addr
, socklen_t addrlen
));
370 _GL_CXXALIASWARN (bind
);
371 #elif @HAVE_WINSOCK2_H@
373 # define bind bind_used_without_requesting_gnulib_module_bind
374 #elif defined GNULIB_POSIXCHECK
376 # if HAVE_RAW_DECL_BIND
377 _GL_WARN_ON_USE (bind
, "bind is not always POSIX compliant - "
378 "use gnulib module bind for portability");
382 #if @GNULIB_GETPEERNAME@
383 # if @HAVE_WINSOCK2_H@
384 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
386 # define getpeername rpl_getpeername
388 _GL_FUNCDECL_RPL (getpeername
, int,
389 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
)
390 _GL_ARG_NONNULL ((2, 3)));
391 _GL_CXXALIAS_RPL (getpeername
, int,
392 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
394 /* Need to cast, because on Solaris 10 systems, the third parameter is
396 _GL_CXXALIAS_SYS_CAST (getpeername
, int,
397 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
399 _GL_CXXALIASWARN (getpeername
);
400 #elif @HAVE_WINSOCK2_H@
402 # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
403 #elif defined GNULIB_POSIXCHECK
405 # if HAVE_RAW_DECL_GETPEERNAME
406 _GL_WARN_ON_USE (getpeername
, "getpeername is not always POSIX compliant - "
407 "use gnulib module getpeername for portability");
411 #if @GNULIB_GETSOCKNAME@
412 # if @HAVE_WINSOCK2_H@
413 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
415 # define getsockname rpl_getsockname
417 _GL_FUNCDECL_RPL (getsockname
, int,
418 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
)
419 _GL_ARG_NONNULL ((2, 3)));
420 _GL_CXXALIAS_RPL (getsockname
, int,
421 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
423 /* Need to cast, because on Solaris 10 systems, the third parameter is
425 _GL_CXXALIAS_SYS_CAST (getsockname
, int,
426 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
428 _GL_CXXALIASWARN (getsockname
);
429 #elif @HAVE_WINSOCK2_H@
431 # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
432 #elif defined GNULIB_POSIXCHECK
434 # if HAVE_RAW_DECL_GETSOCKNAME
435 _GL_WARN_ON_USE (getsockname
, "getsockname is not always POSIX compliant - "
436 "use gnulib module getsockname for portability");
440 #if @GNULIB_GETSOCKOPT@
441 # if @HAVE_WINSOCK2_H@
442 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
444 # define getsockopt rpl_getsockopt
446 _GL_FUNCDECL_RPL (getsockopt
, int, (int fd
, int level
, int optname
,
447 void *optval
, socklen_t
*optlen
)
448 _GL_ARG_NONNULL ((4, 5)));
449 _GL_CXXALIAS_RPL (getsockopt
, int, (int fd
, int level
, int optname
,
450 void *optval
, socklen_t
*optlen
));
452 /* Need to cast, because on Solaris 10 systems, the fifth parameter is
454 _GL_CXXALIAS_SYS_CAST (getsockopt
, int, (int fd
, int level
, int optname
,
455 void *optval
, socklen_t
*optlen
));
457 _GL_CXXALIASWARN (getsockopt
);
458 #elif @HAVE_WINSOCK2_H@
460 # define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
461 #elif defined GNULIB_POSIXCHECK
463 # if HAVE_RAW_DECL_GETSOCKOPT
464 _GL_WARN_ON_USE (getsockopt
, "getsockopt is not always POSIX compliant - "
465 "use gnulib module getsockopt for portability");
470 # if @HAVE_WINSOCK2_H@
471 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
473 # define listen rpl_listen
475 _GL_FUNCDECL_RPL (listen
, int, (int fd
, int backlog
));
476 _GL_CXXALIAS_RPL (listen
, int, (int fd
, int backlog
));
478 _GL_CXXALIAS_SYS (listen
, int, (int fd
, int backlog
));
480 _GL_CXXALIASWARN (listen
);
481 #elif @HAVE_WINSOCK2_H@
483 # define listen listen_used_without_requesting_gnulib_module_listen
484 #elif defined GNULIB_POSIXCHECK
486 # if HAVE_RAW_DECL_LISTEN
487 _GL_WARN_ON_USE (listen
, "listen is not always POSIX compliant - "
488 "use gnulib module listen for portability");
493 # if @HAVE_WINSOCK2_H@
494 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
496 # define recv rpl_recv
498 _GL_FUNCDECL_RPL (recv
, ssize_t
, (int fd
, void *buf
, size_t len
, int flags
)
499 _GL_ARG_NONNULL ((2)));
500 _GL_CXXALIAS_RPL (recv
, ssize_t
, (int fd
, void *buf
, size_t len
, int flags
));
502 _GL_CXXALIAS_SYS (recv
, ssize_t
, (int fd
, void *buf
, size_t len
, int flags
));
504 _GL_CXXALIASWARN (recv
);
505 #elif @HAVE_WINSOCK2_H@
507 # define recv recv_used_without_requesting_gnulib_module_recv
508 #elif defined GNULIB_POSIXCHECK
510 # if HAVE_RAW_DECL_RECV
511 _GL_WARN_ON_USE (recv
, "recv is not always POSIX compliant - "
512 "use gnulib module recv for portability");
517 # if @HAVE_WINSOCK2_H@
518 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
520 # define send rpl_send
522 _GL_FUNCDECL_RPL (send
, ssize_t
,
523 (int fd
, const void *buf
, size_t len
, int flags
)
524 _GL_ARG_NONNULL ((2)));
525 _GL_CXXALIAS_RPL (send
, ssize_t
,
526 (int fd
, const void *buf
, size_t len
, int flags
));
528 _GL_CXXALIAS_SYS (send
, ssize_t
,
529 (int fd
, const void *buf
, size_t len
, int flags
));
531 _GL_CXXALIASWARN (send
);
532 #elif @HAVE_WINSOCK2_H@
534 # define send send_used_without_requesting_gnulib_module_send
535 #elif defined GNULIB_POSIXCHECK
537 # if HAVE_RAW_DECL_SEND
538 _GL_WARN_ON_USE (send
, "send is not always POSIX compliant - "
539 "use gnulib module send for portability");
543 #if @GNULIB_RECVFROM@
544 # if @HAVE_WINSOCK2_H@
545 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
547 # define recvfrom rpl_recvfrom
549 _GL_FUNCDECL_RPL (recvfrom
, ssize_t
,
550 (int fd
, void *buf
, size_t len
, int flags
,
551 struct sockaddr
*from
, socklen_t
*fromlen
)
552 _GL_ARG_NONNULL ((2)));
553 _GL_CXXALIAS_RPL (recvfrom
, ssize_t
,
554 (int fd
, void *buf
, size_t len
, int flags
,
555 struct sockaddr
*from
, socklen_t
*fromlen
));
557 /* Need to cast, because on Solaris 10 systems, the sixth parameter is
559 _GL_CXXALIAS_SYS_CAST (recvfrom
, ssize_t
,
560 (int fd
, void *buf
, size_t len
, int flags
,
561 struct sockaddr
*from
, socklen_t
*fromlen
));
563 _GL_CXXALIASWARN (recvfrom
);
564 #elif @HAVE_WINSOCK2_H@
566 # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
567 #elif defined GNULIB_POSIXCHECK
569 # if HAVE_RAW_DECL_RECVFROM
570 _GL_WARN_ON_USE (recvfrom
, "recvfrom is not always POSIX compliant - "
571 "use gnulib module recvfrom for portability");
576 # if @HAVE_WINSOCK2_H@
577 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
579 # define sendto rpl_sendto
581 _GL_FUNCDECL_RPL (sendto
, ssize_t
,
582 (int fd
, const void *buf
, size_t len
, int flags
,
583 const struct sockaddr
*to
, socklen_t tolen
)
584 _GL_ARG_NONNULL ((2)));
585 _GL_CXXALIAS_RPL (sendto
, ssize_t
,
586 (int fd
, const void *buf
, size_t len
, int flags
,
587 const struct sockaddr
*to
, socklen_t tolen
));
589 /* Need to cast, because on NonStop Kernel, the sixth parameter is
591 _GL_CXXALIAS_SYS_CAST (sendto
, ssize_t
,
592 (int fd
, const void *buf
, size_t len
, int flags
,
593 const struct sockaddr
*to
, socklen_t tolen
));
595 _GL_CXXALIASWARN (sendto
);
596 #elif @HAVE_WINSOCK2_H@
598 # define sendto sendto_used_without_requesting_gnulib_module_sendto
599 #elif defined GNULIB_POSIXCHECK
601 # if HAVE_RAW_DECL_SENDTO
602 _GL_WARN_ON_USE (sendto
, "sendto is not always POSIX compliant - "
603 "use gnulib module sendto for portability");
607 #if @GNULIB_SETSOCKOPT@
608 # if @HAVE_WINSOCK2_H@
609 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
611 # define setsockopt rpl_setsockopt
613 _GL_FUNCDECL_RPL (setsockopt
, int, (int fd
, int level
, int optname
,
614 const void * optval
, socklen_t optlen
)
615 _GL_ARG_NONNULL ((4)));
616 _GL_CXXALIAS_RPL (setsockopt
, int, (int fd
, int level
, int optname
,
617 const void * optval
, socklen_t optlen
));
619 /* Need to cast, because on NonStop Kernel, the fifth parameter is
621 _GL_CXXALIAS_SYS_CAST (setsockopt
, int,
622 (int fd
, int level
, int optname
,
623 const void * optval
, socklen_t optlen
));
625 _GL_CXXALIASWARN (setsockopt
);
626 #elif @HAVE_WINSOCK2_H@
628 # define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
629 #elif defined GNULIB_POSIXCHECK
631 # if HAVE_RAW_DECL_SETSOCKOPT
632 _GL_WARN_ON_USE (setsockopt
, "setsockopt is not always POSIX compliant - "
633 "use gnulib module setsockopt for portability");
637 #if @GNULIB_SHUTDOWN@
638 # if @HAVE_WINSOCK2_H@
639 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
641 # define shutdown rpl_shutdown
643 _GL_FUNCDECL_RPL (shutdown
, int, (int fd
, int how
));
644 _GL_CXXALIAS_RPL (shutdown
, int, (int fd
, int how
));
646 _GL_CXXALIAS_SYS (shutdown
, int, (int fd
, int how
));
648 _GL_CXXALIASWARN (shutdown
);
649 #elif @HAVE_WINSOCK2_H@
651 # define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
652 #elif defined GNULIB_POSIXCHECK
654 # if HAVE_RAW_DECL_SHUTDOWN
655 _GL_WARN_ON_USE (shutdown
, "shutdown is not always POSIX compliant - "
656 "use gnulib module shutdown for portability");
661 /* Accept a connection on a socket, with specific opening flags.
662 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
663 and O_TEXT, O_BINARY (defined in "binary-io.h").
664 See also the Linux man page at
665 <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */
667 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
668 # define accept4 rpl_accept4
670 _GL_FUNCDECL_RPL (accept4
, int,
671 (int sockfd
, struct sockaddr
*addr
, socklen_t
*addrlen
,
673 _GL_CXXALIAS_RPL (accept4
, int,
674 (int sockfd
, struct sockaddr
*addr
, socklen_t
*addrlen
,
677 _GL_FUNCDECL_SYS (accept4
, int,
678 (int sockfd
, struct sockaddr
*addr
, socklen_t
*addrlen
,
680 _GL_CXXALIAS_SYS (accept4
, int,
681 (int sockfd
, struct sockaddr
*addr
, socklen_t
*addrlen
,
684 _GL_CXXALIASWARN (accept4
);
685 #elif defined GNULIB_POSIXCHECK
687 # if HAVE_RAW_DECL_ACCEPT4
688 _GL_WARN_ON_USE (accept4
, "accept4 is unportable - "
689 "use gnulib module accept4 for portability");
693 _GL_INLINE_HEADER_END
695 #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
696 #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */