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-2022 Free Software Foundation, Inc.
4 Written by Simon Josefsson.
6 This file is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
11 This file 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.
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <https://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 <https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
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>
198 /* If these headers don't define socklen_t, <config.h> does. */
201 /* Rudimentary 'struct msghdr'; this works as long as you don't try to
202 access msg_control or msg_controllen. */
205 socklen_t msg_namelen
;
206 struct iovec
*msg_iov
;
213 /* Ensure SO_REUSEPORT is defined. */
214 /* For the subtle differences between SO_REUSEPORT and SO_REUSEADDR, see
215 https://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t
216 and https://lwn.net/Articles/542629/
219 # define SO_REUSEPORT SO_REUSEADDR
222 /* Fix some definitions from <winsock2.h>. */
224 #if @HAVE_WINSOCK2_H@
226 # if !GNULIB_defined_rpl_fd_isset
228 /* Re-define FD_ISSET to avoid a WSA call while we are not using
230 _GL_SYS_SOCKET_INLINE
int
231 rpl_fd_isset (SOCKET fd
, fd_set
* set
)
237 for (i
= 0; i
< set
->fd_count
; i
++)
238 if (set
->fd_array
[i
] == fd
)
244 # define GNULIB_defined_rpl_fd_isset 1
248 # define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
252 /* Hide some function declarations from <winsock2.h>. */
254 #if @HAVE_WINSOCK2_H@
255 # if !defined _@GUARD_PREFIX@_UNISTD_H
256 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
258 # define close close_used_without_including_unistd_h
259 # elif !defined __clang__
260 _GL_WARN_ON_USE (close
,
261 "close() used without including <unistd.h>");
263 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
265 # define gethostname gethostname_used_without_including_unistd_h
267 _GL_WARN_ON_USE (gethostname
,
268 "gethostname() used without including <unistd.h>");
271 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
272 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
274 # define select select_used_without_including_sys_select_h
276 _GL_WARN_ON_USE (select
,
277 "select() used without including <sys/select.h>");
282 /* Wrap everything else to use libc file descriptors for sockets. */
285 # if @HAVE_WINSOCK2_H@
286 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
288 # define socket rpl_socket
290 _GL_FUNCDECL_RPL (socket
, int, (int domain
, int type
, int protocol
));
291 _GL_CXXALIAS_RPL (socket
, int, (int domain
, int type
, int protocol
));
293 _GL_CXXALIAS_SYS (socket
, int, (int domain
, int type
, int protocol
));
295 _GL_CXXALIASWARN (socket
);
296 #elif @HAVE_WINSOCK2_H@
298 # define socket socket_used_without_requesting_gnulib_module_socket
299 #elif defined GNULIB_POSIXCHECK
301 # if HAVE_RAW_DECL_SOCKET
302 _GL_WARN_ON_USE (socket
, "socket is not always POSIX compliant - "
303 "use gnulib module socket for portability");
308 # if @HAVE_WINSOCK2_H@
309 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
311 # define connect rpl_connect
313 _GL_FUNCDECL_RPL (connect
, int,
314 (int fd
, const struct sockaddr
*addr
, socklen_t addrlen
)
315 _GL_ARG_NONNULL ((2)));
316 _GL_CXXALIAS_RPL (connect
, int,
317 (int fd
, const struct sockaddr
*addr
, socklen_t addrlen
));
319 /* Need to cast, because on NonStop Kernel, the third parameter is
321 _GL_CXXALIAS_SYS_CAST (connect
, int,
323 const struct sockaddr
*addr
, socklen_t addrlen
));
325 _GL_CXXALIASWARN (connect
);
326 #elif @HAVE_WINSOCK2_H@
328 # define connect socket_used_without_requesting_gnulib_module_connect
329 #elif defined GNULIB_POSIXCHECK
331 # if HAVE_RAW_DECL_CONNECT
332 _GL_WARN_ON_USE (connect
, "connect is not always POSIX compliant - "
333 "use gnulib module connect for portability");
338 # if @HAVE_WINSOCK2_H@
339 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
341 # define accept rpl_accept
343 _GL_FUNCDECL_RPL (accept
, int,
345 struct sockaddr
*restrict addr
,
346 socklen_t
*restrict addrlen
));
347 _GL_CXXALIAS_RPL (accept
, int,
349 struct sockaddr
*restrict addr
,
350 socklen_t
*restrict addrlen
));
352 /* Need to cast, because on Solaris 10 systems, the third parameter is
354 _GL_CXXALIAS_SYS_CAST (accept
, int,
356 struct sockaddr
*restrict addr
,
357 socklen_t
*restrict addrlen
));
359 _GL_CXXALIASWARN (accept
);
360 #elif @HAVE_WINSOCK2_H@
362 # define accept accept_used_without_requesting_gnulib_module_accept
363 #elif defined GNULIB_POSIXCHECK
365 # if HAVE_RAW_DECL_ACCEPT
366 _GL_WARN_ON_USE (accept
, "accept is not always POSIX compliant - "
367 "use gnulib module accept for portability");
372 # if @HAVE_WINSOCK2_H@
373 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
375 # define bind rpl_bind
377 _GL_FUNCDECL_RPL (bind
, int,
378 (int fd
, const struct sockaddr
*addr
, socklen_t addrlen
)
379 _GL_ARG_NONNULL ((2)));
380 _GL_CXXALIAS_RPL (bind
, int,
381 (int fd
, const struct sockaddr
*addr
, socklen_t addrlen
));
383 /* Need to cast, because on NonStop Kernel, the third parameter is
385 _GL_CXXALIAS_SYS_CAST (bind
, int,
387 const struct sockaddr
*addr
, socklen_t addrlen
));
389 _GL_CXXALIASWARN (bind
);
390 #elif @HAVE_WINSOCK2_H@
392 # define bind bind_used_without_requesting_gnulib_module_bind
393 #elif defined GNULIB_POSIXCHECK
395 # if HAVE_RAW_DECL_BIND
396 _GL_WARN_ON_USE (bind
, "bind is not always POSIX compliant - "
397 "use gnulib module bind for portability");
401 #if @GNULIB_GETPEERNAME@
402 # if @HAVE_WINSOCK2_H@
403 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
405 # define getpeername rpl_getpeername
407 _GL_FUNCDECL_RPL (getpeername
, int,
408 (int fd
, struct sockaddr
*restrict addr
,
409 socklen_t
*restrict addrlen
)
410 _GL_ARG_NONNULL ((2, 3)));
411 _GL_CXXALIAS_RPL (getpeername
, int,
412 (int fd
, struct sockaddr
*restrict addr
,
413 socklen_t
*restrict addrlen
));
415 /* Need to cast, because on Solaris 10 systems, the third parameter is
417 _GL_CXXALIAS_SYS_CAST (getpeername
, int,
418 (int fd
, struct sockaddr
*restrict addr
,
419 socklen_t
*restrict addrlen
));
421 _GL_CXXALIASWARN (getpeername
);
422 #elif @HAVE_WINSOCK2_H@
424 # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
425 #elif defined GNULIB_POSIXCHECK
427 # if HAVE_RAW_DECL_GETPEERNAME
428 _GL_WARN_ON_USE (getpeername
, "getpeername is not always POSIX compliant - "
429 "use gnulib module getpeername for portability");
433 #if @GNULIB_GETSOCKNAME@
434 # if @HAVE_WINSOCK2_H@
435 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
437 # define getsockname rpl_getsockname
439 _GL_FUNCDECL_RPL (getsockname
, int,
440 (int fd
, struct sockaddr
*restrict addr
,
441 socklen_t
*restrict addrlen
)
442 _GL_ARG_NONNULL ((2, 3)));
443 _GL_CXXALIAS_RPL (getsockname
, int,
444 (int fd
, struct sockaddr
*restrict addr
,
445 socklen_t
*restrict addrlen
));
447 /* Need to cast, because on Solaris 10 systems, the third parameter is
449 _GL_CXXALIAS_SYS_CAST (getsockname
, int,
450 (int fd
, struct sockaddr
*restrict addr
,
451 socklen_t
*restrict addrlen
));
453 _GL_CXXALIASWARN (getsockname
);
454 #elif @HAVE_WINSOCK2_H@
456 # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
457 #elif defined GNULIB_POSIXCHECK
459 # if HAVE_RAW_DECL_GETSOCKNAME
460 _GL_WARN_ON_USE (getsockname
, "getsockname is not always POSIX compliant - "
461 "use gnulib module getsockname for portability");
465 #if @GNULIB_GETSOCKOPT@
466 # if @HAVE_WINSOCK2_H@
467 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
469 # define getsockopt rpl_getsockopt
471 _GL_FUNCDECL_RPL (getsockopt
, int,
472 (int fd
, int level
, int optname
,
473 void *restrict optval
, socklen_t
*restrict optlen
)
474 _GL_ARG_NONNULL ((4, 5)));
475 _GL_CXXALIAS_RPL (getsockopt
, int,
476 (int fd
, int level
, int optname
,
477 void *restrict optval
, socklen_t
*restrict optlen
));
479 /* Need to cast, because on Solaris 10 systems, the fifth parameter is
481 _GL_CXXALIAS_SYS_CAST (getsockopt
, int,
482 (int fd
, int level
, int optname
,
483 void *restrict optval
, socklen_t
*restrict optlen
));
485 _GL_CXXALIASWARN (getsockopt
);
486 #elif @HAVE_WINSOCK2_H@
488 # define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
489 #elif defined GNULIB_POSIXCHECK
491 # if HAVE_RAW_DECL_GETSOCKOPT
492 _GL_WARN_ON_USE (getsockopt
, "getsockopt is not always POSIX compliant - "
493 "use gnulib module getsockopt for portability");
498 # if @HAVE_WINSOCK2_H@
499 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
501 # define listen rpl_listen
503 _GL_FUNCDECL_RPL (listen
, int, (int fd
, int backlog
));
504 _GL_CXXALIAS_RPL (listen
, int, (int fd
, int backlog
));
506 _GL_CXXALIAS_SYS (listen
, int, (int fd
, int backlog
));
508 _GL_CXXALIASWARN (listen
);
509 #elif @HAVE_WINSOCK2_H@
511 # define listen listen_used_without_requesting_gnulib_module_listen
512 #elif defined GNULIB_POSIXCHECK
514 # if HAVE_RAW_DECL_LISTEN
515 _GL_WARN_ON_USE (listen
, "listen is not always POSIX compliant - "
516 "use gnulib module listen for portability");
521 # if @HAVE_WINSOCK2_H@
522 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
524 # define recv rpl_recv
526 _GL_FUNCDECL_RPL (recv
, ssize_t
, (int fd
, void *buf
, size_t len
, int flags
)
527 _GL_ARG_NONNULL ((2)));
528 _GL_CXXALIAS_RPL (recv
, ssize_t
, (int fd
, void *buf
, size_t len
, int flags
));
530 /* Need to cast, because on HP-UX 11.31 the return type may be
532 depending on compiler options. */
533 _GL_CXXALIAS_SYS_CAST (recv
, ssize_t
, (int fd
, void *buf
, size_t len
, int flags
));
535 _GL_CXXALIASWARN (recv
);
536 #elif @HAVE_WINSOCK2_H@
538 # define recv recv_used_without_requesting_gnulib_module_recv
539 #elif defined GNULIB_POSIXCHECK
541 # if HAVE_RAW_DECL_RECV
542 _GL_WARN_ON_USE (recv
, "recv is not always POSIX compliant - "
543 "use gnulib module recv for portability");
548 # if @HAVE_WINSOCK2_H@
549 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
551 # define send rpl_send
553 _GL_FUNCDECL_RPL (send
, ssize_t
,
554 (int fd
, const void *buf
, size_t len
, int flags
)
555 _GL_ARG_NONNULL ((2)));
556 _GL_CXXALIAS_RPL (send
, ssize_t
,
557 (int fd
, const void *buf
, size_t len
, int flags
));
559 /* Need to cast, because on HP-UX 11.31 the return type may be
561 depending on compiler options. */
562 _GL_CXXALIAS_SYS_CAST (send
, ssize_t
,
563 (int fd
, const void *buf
, size_t len
, int flags
));
565 _GL_CXXALIASWARN (send
);
566 #elif @HAVE_WINSOCK2_H@
568 # define send send_used_without_requesting_gnulib_module_send
569 #elif defined GNULIB_POSIXCHECK
571 # if HAVE_RAW_DECL_SEND
572 _GL_WARN_ON_USE (send
, "send is not always POSIX compliant - "
573 "use gnulib module send for portability");
577 #if @GNULIB_RECVFROM@
578 # if @HAVE_WINSOCK2_H@
579 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
581 # define recvfrom rpl_recvfrom
583 _GL_FUNCDECL_RPL (recvfrom
, ssize_t
,
584 (int fd
, void *restrict buf
, size_t len
, int flags
,
585 struct sockaddr
*restrict from
,
586 socklen_t
*restrict fromlen
)
587 _GL_ARG_NONNULL ((2)));
588 _GL_CXXALIAS_RPL (recvfrom
, ssize_t
,
589 (int fd
, void *restrict buf
, size_t len
, int flags
,
590 struct sockaddr
*restrict from
,
591 socklen_t
*restrict fromlen
));
593 /* Need to cast, because on Solaris 10 systems, the sixth parameter is
595 _GL_CXXALIAS_SYS_CAST (recvfrom
, ssize_t
,
596 (int fd
, void *restrict buf
, size_t len
, int flags
,
597 struct sockaddr
*restrict from
,
598 socklen_t
*restrict fromlen
));
600 _GL_CXXALIASWARN (recvfrom
);
601 #elif @HAVE_WINSOCK2_H@
603 # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
604 #elif defined GNULIB_POSIXCHECK
606 # if HAVE_RAW_DECL_RECVFROM
607 _GL_WARN_ON_USE (recvfrom
, "recvfrom is not always POSIX compliant - "
608 "use gnulib module recvfrom for portability");
613 # if @HAVE_WINSOCK2_H@
614 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
616 # define sendto rpl_sendto
618 _GL_FUNCDECL_RPL (sendto
, ssize_t
,
619 (int fd
, const void *buf
, size_t len
, int flags
,
620 const struct sockaddr
*to
, socklen_t tolen
)
621 _GL_ARG_NONNULL ((2)));
622 _GL_CXXALIAS_RPL (sendto
, ssize_t
,
623 (int fd
, const void *buf
, size_t len
, int flags
,
624 const struct sockaddr
*to
, socklen_t tolen
));
626 /* Need to cast, because on NonStop Kernel, the sixth parameter is
628 _GL_CXXALIAS_SYS_CAST (sendto
, ssize_t
,
629 (int fd
, const void *buf
, size_t len
, int flags
,
630 const struct sockaddr
*to
, socklen_t tolen
));
632 _GL_CXXALIASWARN (sendto
);
633 #elif @HAVE_WINSOCK2_H@
635 # define sendto sendto_used_without_requesting_gnulib_module_sendto
636 #elif defined GNULIB_POSIXCHECK
638 # if HAVE_RAW_DECL_SENDTO
639 _GL_WARN_ON_USE (sendto
, "sendto is not always POSIX compliant - "
640 "use gnulib module sendto for portability");
644 #if @GNULIB_SETSOCKOPT@
645 # if @HAVE_WINSOCK2_H@
646 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
648 # define setsockopt rpl_setsockopt
650 _GL_FUNCDECL_RPL (setsockopt
, int, (int fd
, int level
, int optname
,
651 const void * optval
, socklen_t optlen
)
652 _GL_ARG_NONNULL ((4)));
653 _GL_CXXALIAS_RPL (setsockopt
, int, (int fd
, int level
, int optname
,
654 const void * optval
, socklen_t optlen
));
656 /* Need to cast, because on NonStop Kernel, the fifth parameter is
658 _GL_CXXALIAS_SYS_CAST (setsockopt
, int,
659 (int fd
, int level
, int optname
,
660 const void * optval
, socklen_t optlen
));
662 _GL_CXXALIASWARN (setsockopt
);
663 #elif @HAVE_WINSOCK2_H@
665 # define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
666 #elif defined GNULIB_POSIXCHECK
668 # if HAVE_RAW_DECL_SETSOCKOPT
669 _GL_WARN_ON_USE (setsockopt
, "setsockopt is not always POSIX compliant - "
670 "use gnulib module setsockopt for portability");
674 #if @GNULIB_SHUTDOWN@
675 # if @HAVE_WINSOCK2_H@
676 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
678 # define shutdown rpl_shutdown
680 _GL_FUNCDECL_RPL (shutdown
, int, (int fd
, int how
));
681 _GL_CXXALIAS_RPL (shutdown
, int, (int fd
, int how
));
683 _GL_CXXALIAS_SYS (shutdown
, int, (int fd
, int how
));
685 _GL_CXXALIASWARN (shutdown
);
686 #elif @HAVE_WINSOCK2_H@
688 # define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
689 #elif defined GNULIB_POSIXCHECK
691 # if HAVE_RAW_DECL_SHUTDOWN
692 _GL_WARN_ON_USE (shutdown
, "shutdown is not always POSIX compliant - "
693 "use gnulib module shutdown for portability");
698 /* Accept a connection on a socket, with specific opening flags.
699 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
700 and O_TEXT, O_BINARY (defined in "binary-io.h").
701 See also the Linux man page at
702 <https://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */
704 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
705 # define accept4 rpl_accept4
707 _GL_FUNCDECL_RPL (accept4
, int,
708 (int sockfd
, struct sockaddr
*addr
, socklen_t
*addrlen
,
710 _GL_CXXALIAS_RPL (accept4
, int,
711 (int sockfd
, struct sockaddr
*addr
, socklen_t
*addrlen
,
714 _GL_FUNCDECL_SYS (accept4
, int,
715 (int sockfd
, struct sockaddr
*addr
, socklen_t
*addrlen
,
717 _GL_CXXALIAS_SYS (accept4
, int,
718 (int sockfd
, struct sockaddr
*addr
, socklen_t
*addrlen
,
721 _GL_CXXALIASWARN (accept4
);
722 #elif defined GNULIB_POSIXCHECK
724 # if HAVE_RAW_DECL_ACCEPT4
725 _GL_WARN_ON_USE (accept4
, "accept4 is unportable - "
726 "use gnulib module accept4 for portability");
730 _GL_INLINE_HEADER_END
732 #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
733 #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */