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
144 # ifdef __VMS /* OpenVMS */
146 # define CMSG_SPACE(length) _CMSG_SPACE(length)
149 # define CMSG_LEN(length) _CMSG_LEN(length)
156 # error "Cygwin does have a sys/socket.h, doesn't it?!?"
159 /* A platform that lacks <sys/socket.h>.
161 Currently only MinGW is supported. See the gnulib manual regarding
162 Windows sockets. MinGW has the header files winsock2.h and
163 ws2tcpip.h that declare the sys/socket.h definitions we need. Note
164 that you can influence which definitions you get by setting the
165 WINVER symbol before including these two files. For example,
166 getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
167 symbol is set indirectly through WINVER). You can set this by
168 adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your
169 code may not run on older Windows releases then. My Windows 2000
170 box was not able to run the code, for example. The situation is
171 slightly confusing because
172 <http://msdn.microsoft.com/en-us/library/ms738520>
173 suggests that getaddrinfo should be available on all Windows
176 # if @HAVE_WINSOCK2_H@
177 # include <winsock2.h>
179 # if @HAVE_WS2TCPIP_H@
180 # include <ws2tcpip.h>
183 /* For shutdown(). */
184 # if !defined SHUT_RD && defined SD_RECEIVE
185 # define SHUT_RD SD_RECEIVE
187 # if !defined SHUT_WR && defined SD_SEND
188 # define SHUT_WR SD_SEND
190 # if !defined SHUT_RDWR && defined SD_BOTH
191 # define SHUT_RDWR SD_BOTH
194 # if @HAVE_WINSOCK2_H@
195 /* Include headers needed by the emulation code. */
196 # include <sys/types.h>
199 # if !GNULIB_defined_socklen_t
200 typedef int socklen_t
;
201 # define GNULIB_defined_socklen_t 1
206 /* Rudimentary 'struct msghdr'; this works as long as you don't try to
207 access msg_control or msg_controllen. */
210 socklen_t msg_namelen
;
211 struct iovec
*msg_iov
;
218 /* Fix some definitions from <winsock2.h>. */
220 #if @HAVE_WINSOCK2_H@
222 # if !GNULIB_defined_rpl_fd_isset
224 /* Re-define FD_ISSET to avoid a WSA call while we are not using
226 _GL_SYS_SOCKET_INLINE
int
227 rpl_fd_isset (SOCKET fd
, fd_set
* set
)
233 for (i
= 0; i
< set
->fd_count
; i
++)
234 if (set
->fd_array
[i
] == fd
)
240 # define GNULIB_defined_rpl_fd_isset 1
244 # define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
248 /* Hide some function declarations from <winsock2.h>. */
250 #if @HAVE_WINSOCK2_H@
251 # if !defined _@GUARD_PREFIX@_UNISTD_H
252 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
254 # define close close_used_without_including_unistd_h
256 _GL_WARN_ON_USE (close
,
257 "close() used without including <unistd.h>");
259 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
261 # define gethostname gethostname_used_without_including_unistd_h
263 _GL_WARN_ON_USE (gethostname
,
264 "gethostname() used without including <unistd.h>");
267 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
268 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
270 # define select select_used_without_including_sys_select_h
272 _GL_WARN_ON_USE (select
,
273 "select() used without including <sys/select.h>");
278 /* Wrap everything else to use libc file descriptors for sockets. */
281 # if @HAVE_WINSOCK2_H@
282 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
284 # define socket rpl_socket
286 _GL_FUNCDECL_RPL (socket
, int, (int domain
, int type
, int protocol
));
287 _GL_CXXALIAS_RPL (socket
, int, (int domain
, int type
, int protocol
));
289 _GL_CXXALIAS_SYS (socket
, int, (int domain
, int type
, int protocol
));
291 _GL_CXXALIASWARN (socket
);
292 #elif @HAVE_WINSOCK2_H@
294 # define socket socket_used_without_requesting_gnulib_module_socket
295 #elif defined GNULIB_POSIXCHECK
297 # if HAVE_RAW_DECL_SOCKET
298 _GL_WARN_ON_USE (socket
, "socket is not always POSIX compliant - "
299 "use gnulib module socket for portability");
304 # if @HAVE_WINSOCK2_H@
305 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
307 # define connect rpl_connect
309 _GL_FUNCDECL_RPL (connect
, int,
310 (int fd
, const struct sockaddr
*addr
, socklen_t addrlen
)
311 _GL_ARG_NONNULL ((2)));
312 _GL_CXXALIAS_RPL (connect
, int,
313 (int fd
, const struct sockaddr
*addr
, socklen_t addrlen
));
315 /* Need to cast, because on NonStop Kernel, the third parameter is
317 _GL_CXXALIAS_SYS_CAST (connect
, int,
319 const struct sockaddr
*addr
, socklen_t addrlen
));
321 _GL_CXXALIASWARN (connect
);
322 #elif @HAVE_WINSOCK2_H@
324 # define connect socket_used_without_requesting_gnulib_module_connect
325 #elif defined GNULIB_POSIXCHECK
327 # if HAVE_RAW_DECL_CONNECT
328 _GL_WARN_ON_USE (connect
, "connect is not always POSIX compliant - "
329 "use gnulib module connect for portability");
334 # if @HAVE_WINSOCK2_H@
335 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
337 # define accept rpl_accept
339 _GL_FUNCDECL_RPL (accept
, int,
340 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
341 _GL_CXXALIAS_RPL (accept
, int,
342 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
344 /* Need to cast, because on Solaris 10 systems, the third parameter is
346 _GL_CXXALIAS_SYS_CAST (accept
, int,
347 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
349 _GL_CXXALIASWARN (accept
);
350 #elif @HAVE_WINSOCK2_H@
352 # define accept accept_used_without_requesting_gnulib_module_accept
353 #elif defined GNULIB_POSIXCHECK
355 # if HAVE_RAW_DECL_ACCEPT
356 _GL_WARN_ON_USE (accept
, "accept is not always POSIX compliant - "
357 "use gnulib module accept for portability");
362 # if @HAVE_WINSOCK2_H@
363 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
365 # define bind rpl_bind
367 _GL_FUNCDECL_RPL (bind
, int,
368 (int fd
, const struct sockaddr
*addr
, socklen_t addrlen
)
369 _GL_ARG_NONNULL ((2)));
370 _GL_CXXALIAS_RPL (bind
, int,
371 (int fd
, const struct sockaddr
*addr
, socklen_t addrlen
));
373 /* Need to cast, because on NonStop Kernel, the third parameter is
375 _GL_CXXALIAS_SYS_CAST (bind
, int,
377 const struct sockaddr
*addr
, socklen_t addrlen
));
379 _GL_CXXALIASWARN (bind
);
380 #elif @HAVE_WINSOCK2_H@
382 # define bind bind_used_without_requesting_gnulib_module_bind
383 #elif defined GNULIB_POSIXCHECK
385 # if HAVE_RAW_DECL_BIND
386 _GL_WARN_ON_USE (bind
, "bind is not always POSIX compliant - "
387 "use gnulib module bind for portability");
391 #if @GNULIB_GETPEERNAME@
392 # if @HAVE_WINSOCK2_H@
393 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
395 # define getpeername rpl_getpeername
397 _GL_FUNCDECL_RPL (getpeername
, int,
398 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
)
399 _GL_ARG_NONNULL ((2, 3)));
400 _GL_CXXALIAS_RPL (getpeername
, int,
401 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
403 /* Need to cast, because on Solaris 10 systems, the third parameter is
405 _GL_CXXALIAS_SYS_CAST (getpeername
, int,
406 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
408 _GL_CXXALIASWARN (getpeername
);
409 #elif @HAVE_WINSOCK2_H@
411 # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
412 #elif defined GNULIB_POSIXCHECK
414 # if HAVE_RAW_DECL_GETPEERNAME
415 _GL_WARN_ON_USE (getpeername
, "getpeername is not always POSIX compliant - "
416 "use gnulib module getpeername for portability");
420 #if @GNULIB_GETSOCKNAME@
421 # if @HAVE_WINSOCK2_H@
422 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
424 # define getsockname rpl_getsockname
426 _GL_FUNCDECL_RPL (getsockname
, int,
427 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
)
428 _GL_ARG_NONNULL ((2, 3)));
429 _GL_CXXALIAS_RPL (getsockname
, int,
430 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
432 /* Need to cast, because on Solaris 10 systems, the third parameter is
434 _GL_CXXALIAS_SYS_CAST (getsockname
, int,
435 (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
));
437 _GL_CXXALIASWARN (getsockname
);
438 #elif @HAVE_WINSOCK2_H@
440 # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
441 #elif defined GNULIB_POSIXCHECK
443 # if HAVE_RAW_DECL_GETSOCKNAME
444 _GL_WARN_ON_USE (getsockname
, "getsockname is not always POSIX compliant - "
445 "use gnulib module getsockname for portability");
449 #if @GNULIB_GETSOCKOPT@
450 # if @HAVE_WINSOCK2_H@
451 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
453 # define getsockopt rpl_getsockopt
455 _GL_FUNCDECL_RPL (getsockopt
, int, (int fd
, int level
, int optname
,
456 void *optval
, socklen_t
*optlen
)
457 _GL_ARG_NONNULL ((4, 5)));
458 _GL_CXXALIAS_RPL (getsockopt
, int, (int fd
, int level
, int optname
,
459 void *optval
, socklen_t
*optlen
));
461 /* Need to cast, because on Solaris 10 systems, the fifth parameter is
463 _GL_CXXALIAS_SYS_CAST (getsockopt
, int, (int fd
, int level
, int optname
,
464 void *optval
, socklen_t
*optlen
));
466 _GL_CXXALIASWARN (getsockopt
);
467 #elif @HAVE_WINSOCK2_H@
469 # define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
470 #elif defined GNULIB_POSIXCHECK
472 # if HAVE_RAW_DECL_GETSOCKOPT
473 _GL_WARN_ON_USE (getsockopt
, "getsockopt is not always POSIX compliant - "
474 "use gnulib module getsockopt for portability");
479 # if @HAVE_WINSOCK2_H@
480 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
482 # define listen rpl_listen
484 _GL_FUNCDECL_RPL (listen
, int, (int fd
, int backlog
));
485 _GL_CXXALIAS_RPL (listen
, int, (int fd
, int backlog
));
487 _GL_CXXALIAS_SYS (listen
, int, (int fd
, int backlog
));
489 _GL_CXXALIASWARN (listen
);
490 #elif @HAVE_WINSOCK2_H@
492 # define listen listen_used_without_requesting_gnulib_module_listen
493 #elif defined GNULIB_POSIXCHECK
495 # if HAVE_RAW_DECL_LISTEN
496 _GL_WARN_ON_USE (listen
, "listen is not always POSIX compliant - "
497 "use gnulib module listen for portability");
502 # if @HAVE_WINSOCK2_H@
503 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
505 # define recv rpl_recv
507 _GL_FUNCDECL_RPL (recv
, ssize_t
, (int fd
, void *buf
, size_t len
, int flags
)
508 _GL_ARG_NONNULL ((2)));
509 _GL_CXXALIAS_RPL (recv
, ssize_t
, (int fd
, void *buf
, size_t len
, int flags
));
511 _GL_CXXALIAS_SYS (recv
, ssize_t
, (int fd
, void *buf
, size_t len
, int flags
));
513 _GL_CXXALIASWARN (recv
);
514 #elif @HAVE_WINSOCK2_H@
516 # define recv recv_used_without_requesting_gnulib_module_recv
517 #elif defined GNULIB_POSIXCHECK
519 # if HAVE_RAW_DECL_RECV
520 _GL_WARN_ON_USE (recv
, "recv is not always POSIX compliant - "
521 "use gnulib module recv for portability");
526 # if @HAVE_WINSOCK2_H@
527 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
529 # define send rpl_send
531 _GL_FUNCDECL_RPL (send
, ssize_t
,
532 (int fd
, const void *buf
, size_t len
, int flags
)
533 _GL_ARG_NONNULL ((2)));
534 _GL_CXXALIAS_RPL (send
, ssize_t
,
535 (int fd
, const void *buf
, size_t len
, int flags
));
537 _GL_CXXALIAS_SYS (send
, ssize_t
,
538 (int fd
, const void *buf
, size_t len
, int flags
));
540 _GL_CXXALIASWARN (send
);
541 #elif @HAVE_WINSOCK2_H@
543 # define send send_used_without_requesting_gnulib_module_send
544 #elif defined GNULIB_POSIXCHECK
546 # if HAVE_RAW_DECL_SEND
547 _GL_WARN_ON_USE (send
, "send is not always POSIX compliant - "
548 "use gnulib module send for portability");
552 #if @GNULIB_RECVFROM@
553 # if @HAVE_WINSOCK2_H@
554 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
556 # define recvfrom rpl_recvfrom
558 _GL_FUNCDECL_RPL (recvfrom
, ssize_t
,
559 (int fd
, void *buf
, size_t len
, int flags
,
560 struct sockaddr
*from
, socklen_t
*fromlen
)
561 _GL_ARG_NONNULL ((2)));
562 _GL_CXXALIAS_RPL (recvfrom
, ssize_t
,
563 (int fd
, void *buf
, size_t len
, int flags
,
564 struct sockaddr
*from
, socklen_t
*fromlen
));
566 /* Need to cast, because on Solaris 10 systems, the sixth parameter is
568 _GL_CXXALIAS_SYS_CAST (recvfrom
, ssize_t
,
569 (int fd
, void *buf
, size_t len
, int flags
,
570 struct sockaddr
*from
, socklen_t
*fromlen
));
572 _GL_CXXALIASWARN (recvfrom
);
573 #elif @HAVE_WINSOCK2_H@
575 # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
576 #elif defined GNULIB_POSIXCHECK
578 # if HAVE_RAW_DECL_RECVFROM
579 _GL_WARN_ON_USE (recvfrom
, "recvfrom is not always POSIX compliant - "
580 "use gnulib module recvfrom for portability");
585 # if @HAVE_WINSOCK2_H@
586 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
588 # define sendto rpl_sendto
590 _GL_FUNCDECL_RPL (sendto
, ssize_t
,
591 (int fd
, const void *buf
, size_t len
, int flags
,
592 const struct sockaddr
*to
, socklen_t tolen
)
593 _GL_ARG_NONNULL ((2)));
594 _GL_CXXALIAS_RPL (sendto
, ssize_t
,
595 (int fd
, const void *buf
, size_t len
, int flags
,
596 const struct sockaddr
*to
, socklen_t tolen
));
598 /* Need to cast, because on NonStop Kernel, the sixth parameter is
600 _GL_CXXALIAS_SYS_CAST (sendto
, ssize_t
,
601 (int fd
, const void *buf
, size_t len
, int flags
,
602 const struct sockaddr
*to
, socklen_t tolen
));
604 _GL_CXXALIASWARN (sendto
);
605 #elif @HAVE_WINSOCK2_H@
607 # define sendto sendto_used_without_requesting_gnulib_module_sendto
608 #elif defined GNULIB_POSIXCHECK
610 # if HAVE_RAW_DECL_SENDTO
611 _GL_WARN_ON_USE (sendto
, "sendto is not always POSIX compliant - "
612 "use gnulib module sendto for portability");
616 #if @GNULIB_SETSOCKOPT@
617 # if @HAVE_WINSOCK2_H@
618 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
620 # define setsockopt rpl_setsockopt
622 _GL_FUNCDECL_RPL (setsockopt
, int, (int fd
, int level
, int optname
,
623 const void * optval
, socklen_t optlen
)
624 _GL_ARG_NONNULL ((4)));
625 _GL_CXXALIAS_RPL (setsockopt
, int, (int fd
, int level
, int optname
,
626 const void * optval
, socklen_t optlen
));
628 /* Need to cast, because on NonStop Kernel, the fifth parameter is
630 _GL_CXXALIAS_SYS_CAST (setsockopt
, int,
631 (int fd
, int level
, int optname
,
632 const void * optval
, socklen_t optlen
));
634 _GL_CXXALIASWARN (setsockopt
);
635 #elif @HAVE_WINSOCK2_H@
637 # define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
638 #elif defined GNULIB_POSIXCHECK
640 # if HAVE_RAW_DECL_SETSOCKOPT
641 _GL_WARN_ON_USE (setsockopt
, "setsockopt is not always POSIX compliant - "
642 "use gnulib module setsockopt for portability");
646 #if @GNULIB_SHUTDOWN@
647 # if @HAVE_WINSOCK2_H@
648 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
650 # define shutdown rpl_shutdown
652 _GL_FUNCDECL_RPL (shutdown
, int, (int fd
, int how
));
653 _GL_CXXALIAS_RPL (shutdown
, int, (int fd
, int how
));
655 _GL_CXXALIAS_SYS (shutdown
, int, (int fd
, int how
));
657 _GL_CXXALIASWARN (shutdown
);
658 #elif @HAVE_WINSOCK2_H@
660 # define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
661 #elif defined GNULIB_POSIXCHECK
663 # if HAVE_RAW_DECL_SHUTDOWN
664 _GL_WARN_ON_USE (shutdown
, "shutdown is not always POSIX compliant - "
665 "use gnulib module shutdown for portability");
670 /* Accept a connection on a socket, with specific opening flags.
671 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
672 and O_TEXT, O_BINARY (defined in "binary-io.h").
673 See also the Linux man page at
674 <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */
676 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
677 # define accept4 rpl_accept4
679 _GL_FUNCDECL_RPL (accept4
, int,
680 (int sockfd
, struct sockaddr
*addr
, socklen_t
*addrlen
,
682 _GL_CXXALIAS_RPL (accept4
, int,
683 (int sockfd
, struct sockaddr
*addr
, socklen_t
*addrlen
,
686 _GL_FUNCDECL_SYS (accept4
, int,
687 (int sockfd
, struct sockaddr
*addr
, socklen_t
*addrlen
,
689 _GL_CXXALIAS_SYS (accept4
, int,
690 (int sockfd
, struct sockaddr
*addr
, socklen_t
*addrlen
,
693 _GL_CXXALIASWARN (accept4
);
694 #elif defined GNULIB_POSIXCHECK
696 # if HAVE_RAW_DECL_ACCEPT4
697 _GL_WARN_ON_USE (accept4
, "accept4 is unportable - "
698 "use gnulib module accept4 for portability");
702 _GL_INLINE_HEADER_END
704 #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
705 #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */