"Fossies" - the Fresh Open Source Software Archive

Member "gnuastro-0.8/bootstrapped/tests/sys_socket.in.h" (28 Dec 2018, 23603 Bytes) of package /linux/privat/gnuastro-0.8.tar.lz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "sys_socket.in.h": 0.5_vs_0.6.

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