Back to index

nagios-plugins  1.4.16
sys_socket.in.h
Go to the documentation of this file.
00001 /* Provide a sys/socket header file for systems lacking it (read: MinGW)
00002    and for systems where it is incomplete.
00003    Copyright (C) 2005-2010 Free Software Foundation, Inc.
00004    Written by Simon Josefsson.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 3, or (at your option)
00009    any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software Foundation,
00018    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
00019 
00020 /* This file is supposed to be used on platforms that lack <sys/socket.h>,
00021    on platforms where <sys/socket.h> cannot be included standalone, and on
00022    platforms where <sys/socket.h> does not provide all necessary definitions.
00023    It is intended to provide definitions and prototypes needed by an
00024    application.  */
00025 
00026 #if __GNUC__ >= 3
00027 @PRAGMA_SYSTEM_HEADER@
00028 #endif
00029 
00030 #if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H
00031 /* Special invocation convention:
00032    - On Cygwin 1.5.x we have a sequence of nested includes
00033      <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>,
00034      and the latter includes <sys/socket.h>.  In this situation, the functions
00035      are not yet declared, therefore we cannot provide the C++ aliases.  */
00036 
00037 #@INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
00038 
00039 #else
00040 /* Normal invocation convention.  */
00041 
00042 #ifndef _GL_SYS_SOCKET_H
00043 
00044 #if @HAVE_SYS_SOCKET_H@
00045 
00046 # define _GL_ALREADY_INCLUDING_SYS_SOCKET_H
00047 
00048 /* On many platforms, <sys/socket.h> assumes prior inclusion of
00049    <sys/types.h>.  */
00050 # include <sys/types.h>
00051 
00052 /* The include_next requires a split double-inclusion guard.  */
00053 # @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
00054 
00055 # undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H
00056 
00057 #endif
00058 
00059 #ifndef _GL_SYS_SOCKET_H
00060 #define _GL_SYS_SOCKET_H
00061 
00062 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
00063 
00064 /* The definition of _GL_ARG_NONNULL is copied here.  */
00065 
00066 /* The definition of _GL_WARN_ON_USE is copied here.  */
00067 
00068 #if !@HAVE_SA_FAMILY_T@
00069 typedef unsigned short  sa_family_t;
00070 #endif
00071 
00072 #if !@HAVE_STRUCT_SOCKADDR_STORAGE@
00073 # include <alignof.h>
00074 /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on
00075    2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */
00076 # define __ss_aligntype unsigned long int
00077 # define _SS_SIZE 256
00078 # define _SS_PADSIZE \
00079     (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype)      \
00080                   ? sizeof (sa_family_t)                                \
00081                   : alignof (__ss_aligntype))                           \
00082                  + sizeof (__ss_aligntype)))
00083 
00084 struct sockaddr_storage
00085 {
00086   sa_family_t ss_family;      /* Address family, etc.  */
00087   __ss_aligntype __ss_align;  /* Force desired alignment.  */
00088   char __ss_padding[_SS_PADSIZE];
00089 };
00090 #endif
00091 
00092 #if @HAVE_SYS_SOCKET_H@
00093 
00094 /* A platform that has <sys/socket.h>.  */
00095 
00096 /* For shutdown().  */
00097 # if !defined SHUT_RD
00098 #  define SHUT_RD 0
00099 # endif
00100 # if !defined SHUT_WR
00101 #  define SHUT_WR 1
00102 # endif
00103 # if !defined SHUT_RDWR
00104 #  define SHUT_RDWR 2
00105 # endif
00106 
00107 #else
00108 
00109 # ifdef __CYGWIN__
00110 #  error "Cygwin does have a sys/socket.h, doesn't it?!?"
00111 # endif
00112 
00113 /* A platform that lacks <sys/socket.h>.
00114 
00115    Currently only MinGW is supported.  See the gnulib manual regarding
00116    Windows sockets.  MinGW has the header files winsock2.h and
00117    ws2tcpip.h that declare the sys/socket.h definitions we need.  Note
00118    that you can influence which definitions you get by setting the
00119    WINVER symbol before including these two files.  For example,
00120    getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
00121    symbol is set indiriectly through WINVER).  You can set this by
00122    adding AC_DEFINE(WINVER, 0x0501) to configure.ac.  Note that your
00123    code may not run on older Windows releases then.  My Windows 2000
00124    box was not able to run the code, for example.  The situation is
00125    slightly confusing because:
00126    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
00127    suggests that getaddrinfo should be available on all Windows
00128    releases. */
00129 
00130 
00131 # if @HAVE_WINSOCK2_H@
00132 #  include <winsock2.h>
00133 # endif
00134 # if @HAVE_WS2TCPIP_H@
00135 #  include <ws2tcpip.h>
00136 # endif
00137 
00138 /* For shutdown(). */
00139 # if !defined SHUT_RD && defined SD_RECEIVE
00140 #  define SHUT_RD SD_RECEIVE
00141 # endif
00142 # if !defined SHUT_WR && defined SD_SEND
00143 #  define SHUT_WR SD_SEND
00144 # endif
00145 # if !defined SHUT_RDWR && defined SD_BOTH
00146 #  define SHUT_RDWR SD_BOTH
00147 # endif
00148 
00149 # if @HAVE_WINSOCK2_H@
00150 /* Include headers needed by the emulation code.  */
00151 #  include <sys/types.h>
00152 #  include <io.h>
00153 
00154 typedef int socklen_t;
00155 
00156 # endif
00157 
00158 #endif
00159 
00160 #if @HAVE_WINSOCK2_H@
00161 
00162 /* Re-define FD_ISSET to avoid a WSA call while we are not using
00163    network sockets.  */
00164 static inline int
00165 rpl_fd_isset (SOCKET fd, fd_set * set)
00166 {
00167   u_int i;
00168   if (set == NULL)
00169     return 0;
00170 
00171   for (i = 0; i < set->fd_count; i++)
00172     if (set->fd_array[i] == fd)
00173       return 1;
00174 
00175   return 0;
00176 }
00177 
00178 # undef FD_ISSET
00179 # define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
00180 
00181 #endif
00182 
00183 /* Wrap everything else to use libc file descriptors for sockets.  */
00184 
00185 #if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
00186 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00187 #  undef close
00188 #  define close close_used_without_including_unistd_h
00189 # else
00190    _GL_WARN_ON_USE (close,
00191                     "close() used without including <unistd.h>");
00192 # endif
00193 #endif
00194 
00195 #if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
00196 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00197 #  undef gethostname
00198 #  define gethostname gethostname_used_without_including_unistd_h
00199 # else
00200    _GL_WARN_ON_USE (gethostname,
00201                     "gethostname() used without including <unistd.h>");
00202 # endif
00203 #endif
00204 
00205 #if @GNULIB_SOCKET@
00206 # if @HAVE_WINSOCK2_H@
00207 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00208 #   undef socket
00209 #   define socket rpl_socket
00210 #  endif
00211 _GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol));
00212 _GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol));
00213 # else
00214 _GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol));
00215 # endif
00216 _GL_CXXALIASWARN (socket);
00217 #elif @HAVE_WINSOCK2_H@
00218 # undef socket
00219 # define socket socket_used_without_requesting_gnulib_module_socket
00220 #elif defined GNULIB_POSIXCHECK
00221 # undef socket
00222 # if HAVE_RAW_DECL_SOCKET
00223 _GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
00224                  "use gnulib module socket for portability");
00225 # endif
00226 #endif
00227 
00228 #if @GNULIB_CONNECT@
00229 # if @HAVE_WINSOCK2_H@
00230 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00231 #   undef connect
00232 #   define connect rpl_connect
00233 #  endif
00234 _GL_FUNCDECL_RPL (connect, int,
00235                   (int fd, const struct sockaddr *addr, socklen_t addrlen)
00236                   _GL_ARG_NONNULL ((2)));
00237 _GL_CXXALIAS_RPL (connect, int,
00238                   (int fd, const struct sockaddr *addr, socklen_t addrlen));
00239 # else
00240 _GL_CXXALIAS_SYS (connect, int,
00241                   (int fd, const struct sockaddr *addr, socklen_t addrlen));
00242 # endif
00243 _GL_CXXALIASWARN (connect);
00244 #elif @HAVE_WINSOCK2_H@
00245 # undef connect
00246 # define connect socket_used_without_requesting_gnulib_module_connect
00247 #elif defined GNULIB_POSIXCHECK
00248 # undef connect
00249 # if HAVE_RAW_DECL_CONNECT
00250 _GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
00251                  "use gnulib module connect for portability");
00252 # endif
00253 #endif
00254 
00255 #if @GNULIB_ACCEPT@
00256 # if @HAVE_WINSOCK2_H@
00257 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00258 #   undef accept
00259 #   define accept rpl_accept
00260 #  endif
00261 _GL_FUNCDECL_RPL (accept, int,
00262                   (int fd, struct sockaddr *addr, socklen_t *addrlen));
00263 _GL_CXXALIAS_RPL (accept, int,
00264                   (int fd, struct sockaddr *addr, socklen_t *addrlen));
00265 # else
00266 /* Need to cast, because on Solaris 10 systems, the third parameter is
00267                                                        void *addrlen.  */
00268 _GL_CXXALIAS_SYS_CAST (accept, int,
00269                        (int fd, struct sockaddr *addr, socklen_t *addrlen));
00270 # endif
00271 _GL_CXXALIASWARN (accept);
00272 #elif @HAVE_WINSOCK2_H@
00273 # undef accept
00274 # define accept accept_used_without_requesting_gnulib_module_accept
00275 #elif defined GNULIB_POSIXCHECK
00276 # undef accept
00277 # if HAVE_RAW_DECL_ACCEPT
00278 _GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
00279                  "use gnulib module accept for portability");
00280 # endif
00281 #endif
00282 
00283 #if @GNULIB_BIND@
00284 # if @HAVE_WINSOCK2_H@
00285 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00286 #   undef bind
00287 #   define bind rpl_bind
00288 #  endif
00289 _GL_FUNCDECL_RPL (bind, int,
00290                   (int fd, const struct sockaddr *addr, socklen_t addrlen)
00291                   _GL_ARG_NONNULL ((2)));
00292 _GL_CXXALIAS_RPL (bind, int,
00293                   (int fd, const struct sockaddr *addr, socklen_t addrlen));
00294 # else
00295 _GL_CXXALIAS_SYS (bind, int,
00296                   (int fd, const struct sockaddr *addr, socklen_t addrlen));
00297 # endif
00298 _GL_CXXALIASWARN (bind);
00299 #elif @HAVE_WINSOCK2_H@
00300 # undef bind
00301 # define bind bind_used_without_requesting_gnulib_module_bind
00302 #elif defined GNULIB_POSIXCHECK
00303 # undef bind
00304 # if HAVE_RAW_DECL_BIND
00305 _GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
00306                  "use gnulib module bind for portability");
00307 # endif
00308 #endif
00309 
00310 #if @GNULIB_GETPEERNAME@
00311 # if @HAVE_WINSOCK2_H@
00312 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00313 #   undef getpeername
00314 #   define getpeername rpl_getpeername
00315 #  endif
00316 _GL_FUNCDECL_RPL (getpeername, int,
00317                   (int fd, struct sockaddr *addr, socklen_t *addrlen)
00318                   _GL_ARG_NONNULL ((2, 3)));
00319 _GL_CXXALIAS_RPL (getpeername, int,
00320                   (int fd, struct sockaddr *addr, socklen_t *addrlen));
00321 # else
00322 /* Need to cast, because on Solaris 10 systems, the third parameter is
00323                                                        void *addrlen.  */
00324 _GL_CXXALIAS_SYS_CAST (getpeername, int,
00325                        (int fd, struct sockaddr *addr, socklen_t *addrlen));
00326 # endif
00327 _GL_CXXALIASWARN (getpeername);
00328 #elif @HAVE_WINSOCK2_H@
00329 # undef getpeername
00330 # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
00331 #elif defined GNULIB_POSIXCHECK
00332 # undef getpeername
00333 # if HAVE_RAW_DECL_GETPEERNAME
00334 _GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
00335                  "use gnulib module getpeername for portability");
00336 # endif
00337 #endif
00338 
00339 #if @GNULIB_GETSOCKNAME@
00340 # if @HAVE_WINSOCK2_H@
00341 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00342 #   undef getsockname
00343 #   define getsockname rpl_getsockname
00344 #  endif
00345 _GL_FUNCDECL_RPL (getsockname, int,
00346                   (int fd, struct sockaddr *addr, socklen_t *addrlen)
00347                   _GL_ARG_NONNULL ((2, 3)));
00348 _GL_CXXALIAS_RPL (getsockname, int,
00349                   (int fd, struct sockaddr *addr, socklen_t *addrlen));
00350 # else
00351 /* Need to cast, because on Solaris 10 systems, the third parameter is
00352                                                        void *addrlen.  */
00353 _GL_CXXALIAS_SYS_CAST (getsockname, int,
00354                        (int fd, struct sockaddr *addr, socklen_t *addrlen));
00355 # endif
00356 _GL_CXXALIASWARN (getsockname);
00357 #elif @HAVE_WINSOCK2_H@
00358 # undef getsockname
00359 # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
00360 #elif defined GNULIB_POSIXCHECK
00361 # undef getsockname
00362 # if HAVE_RAW_DECL_GETSOCKNAME
00363 _GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
00364                  "use gnulib module getsockname for portability");
00365 # endif
00366 #endif
00367 
00368 #if @GNULIB_GETSOCKOPT@
00369 # if @HAVE_WINSOCK2_H@
00370 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00371 #   undef getsockopt
00372 #   define getsockopt rpl_getsockopt
00373 #  endif
00374 _GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname,
00375                                     void *optval, socklen_t *optlen)
00376                                    _GL_ARG_NONNULL ((4, 5)));
00377 _GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname,
00378                                     void *optval, socklen_t *optlen));
00379 # else
00380 /* Need to cast, because on Solaris 10 systems, the fifth parameter is
00381                                                        void *optlen.  */
00382 _GL_CXXALIAS_SYS_CAST (getsockopt, int, (int fd, int level, int optname,
00383                                          void *optval, socklen_t *optlen));
00384 # endif
00385 _GL_CXXALIASWARN (getsockopt);
00386 #elif @HAVE_WINSOCK2_H@
00387 # undef getsockopt
00388 # define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
00389 #elif defined GNULIB_POSIXCHECK
00390 # undef getsockopt
00391 # if HAVE_RAW_DECL_GETSOCKOPT
00392 _GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
00393                  "use gnulib module getsockopt for portability");
00394 # endif
00395 #endif
00396 
00397 #if @GNULIB_LISTEN@
00398 # if @HAVE_WINSOCK2_H@
00399 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00400 #   undef listen
00401 #   define listen rpl_listen
00402 #  endif
00403 _GL_FUNCDECL_RPL (listen, int, (int fd, int backlog));
00404 _GL_CXXALIAS_RPL (listen, int, (int fd, int backlog));
00405 # else
00406 _GL_CXXALIAS_SYS (listen, int, (int fd, int backlog));
00407 # endif
00408 _GL_CXXALIASWARN (listen);
00409 #elif @HAVE_WINSOCK2_H@
00410 # undef listen
00411 # define listen listen_used_without_requesting_gnulib_module_listen
00412 #elif defined GNULIB_POSIXCHECK
00413 # undef listen
00414 # if HAVE_RAW_DECL_LISTEN
00415 _GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
00416                  "use gnulib module listen for portability");
00417 # endif
00418 #endif
00419 
00420 #if @GNULIB_RECV@
00421 # if @HAVE_WINSOCK2_H@
00422 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00423 #   undef recv
00424 #   define recv rpl_recv
00425 #  endif
00426 _GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)
00427                                  _GL_ARG_NONNULL ((2)));
00428 _GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
00429 # else
00430 _GL_CXXALIAS_SYS (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
00431 # endif
00432 _GL_CXXALIASWARN (recv);
00433 #elif @HAVE_WINSOCK2_H@
00434 # undef recv
00435 # define recv recv_used_without_requesting_gnulib_module_recv
00436 #elif defined GNULIB_POSIXCHECK
00437 # undef recv
00438 # if HAVE_RAW_DECL_RECV
00439 _GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
00440                  "use gnulib module recv for portability");
00441 # endif
00442 #endif
00443 
00444 #if @GNULIB_SEND@
00445 # if @HAVE_WINSOCK2_H@
00446 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00447 #   undef send
00448 #   define send rpl_send
00449 #  endif
00450 _GL_FUNCDECL_RPL (send, ssize_t,
00451                   (int fd, const void *buf, size_t len, int flags)
00452                   _GL_ARG_NONNULL ((2)));
00453 _GL_CXXALIAS_RPL (send, ssize_t,
00454                   (int fd, const void *buf, size_t len, int flags));
00455 # else
00456 _GL_CXXALIAS_SYS (send, ssize_t,
00457                   (int fd, const void *buf, size_t len, int flags));
00458 # endif
00459 _GL_CXXALIASWARN (send);
00460 #elif @HAVE_WINSOCK2_H@
00461 # undef send
00462 # define send send_used_without_requesting_gnulib_module_send
00463 #elif defined GNULIB_POSIXCHECK
00464 # undef send
00465 # if HAVE_RAW_DECL_SEND
00466 _GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
00467                  "use gnulib module send for portability");
00468 # endif
00469 #endif
00470 
00471 #if @GNULIB_RECVFROM@
00472 # if @HAVE_WINSOCK2_H@
00473 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00474 #   undef recvfrom
00475 #   define recvfrom rpl_recvfrom
00476 #  endif
00477 _GL_FUNCDECL_RPL (recvfrom, ssize_t,
00478                   (int fd, void *buf, size_t len, int flags,
00479                    struct sockaddr *from, socklen_t *fromlen)
00480                   _GL_ARG_NONNULL ((2)));
00481 _GL_CXXALIAS_RPL (recvfrom, ssize_t,
00482                   (int fd, void *buf, size_t len, int flags,
00483                    struct sockaddr *from, socklen_t *fromlen));
00484 # else
00485 /* Need to cast, because on Solaris 10 systems, the sixth parameter is
00486                                                void *fromlen.  */
00487 _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
00488                        (int fd, void *buf, size_t len, int flags,
00489                         struct sockaddr *from, socklen_t *fromlen));
00490 # endif
00491 _GL_CXXALIASWARN (recvfrom);
00492 #elif @HAVE_WINSOCK2_H@
00493 # undef recvfrom
00494 # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
00495 #elif defined GNULIB_POSIXCHECK
00496 # undef recvfrom
00497 # if HAVE_RAW_DECL_RECVFROM
00498 _GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
00499                  "use gnulib module recvfrom for portability");
00500 # endif
00501 #endif
00502 
00503 #if @GNULIB_SENDTO@
00504 # if @HAVE_WINSOCK2_H@
00505 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00506 #   undef sendto
00507 #   define sendto rpl_sendto
00508 #  endif
00509 _GL_FUNCDECL_RPL (sendto, ssize_t,
00510                   (int fd, const void *buf, size_t len, int flags,
00511                    const struct sockaddr *to, socklen_t tolen)
00512                   _GL_ARG_NONNULL ((2)));
00513 _GL_CXXALIAS_RPL (sendto, ssize_t,
00514                   (int fd, const void *buf, size_t len, int flags,
00515                    const struct sockaddr *to, socklen_t tolen));
00516 # else
00517 _GL_CXXALIAS_SYS (sendto, ssize_t,
00518                   (int fd, const void *buf, size_t len, int flags,
00519                    const struct sockaddr *to, socklen_t tolen));
00520 # endif
00521 _GL_CXXALIASWARN (sendto);
00522 #elif @HAVE_WINSOCK2_H@
00523 # undef sendto
00524 # define sendto sendto_used_without_requesting_gnulib_module_sendto
00525 #elif defined GNULIB_POSIXCHECK
00526 # undef sendto
00527 # if HAVE_RAW_DECL_SENDTO
00528 _GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
00529                  "use gnulib module sendto for portability");
00530 # endif
00531 #endif
00532 
00533 #if @GNULIB_SETSOCKOPT@
00534 # if @HAVE_WINSOCK2_H@
00535 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00536 #   undef setsockopt
00537 #   define setsockopt rpl_setsockopt
00538 #  endif
00539 _GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
00540                                     const void * optval, socklen_t optlen)
00541                                    _GL_ARG_NONNULL ((4)));
00542 _GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
00543                                     const void * optval, socklen_t optlen));
00544 # else
00545 _GL_CXXALIAS_SYS (setsockopt, int, (int fd, int level, int optname,
00546                                     const void * optval, socklen_t optlen));
00547 # endif
00548 _GL_CXXALIASWARN (setsockopt);
00549 #elif @HAVE_WINSOCK2_H@
00550 # undef setsockopt
00551 # define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
00552 #elif defined GNULIB_POSIXCHECK
00553 # undef setsockopt
00554 # if HAVE_RAW_DECL_SETSOCKOPT
00555 _GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
00556                  "use gnulib module setsockopt for portability");
00557 # endif
00558 #endif
00559 
00560 #if @GNULIB_SHUTDOWN@
00561 # if @HAVE_WINSOCK2_H@
00562 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00563 #   undef shutdown
00564 #   define shutdown rpl_shutdown
00565 #  endif
00566 _GL_FUNCDECL_RPL (shutdown, int, (int fd, int how));
00567 _GL_CXXALIAS_RPL (shutdown, int, (int fd, int how));
00568 # else
00569 _GL_CXXALIAS_SYS (shutdown, int, (int fd, int how));
00570 # endif
00571 _GL_CXXALIASWARN (shutdown);
00572 #elif @HAVE_WINSOCK2_H@
00573 # undef shutdown
00574 # define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
00575 #elif defined GNULIB_POSIXCHECK
00576 # undef shutdown
00577 # if HAVE_RAW_DECL_SHUTDOWN
00578 _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
00579                  "use gnulib module shutdown for portability");
00580 # endif
00581 #endif
00582 
00583 #if @HAVE_WINSOCK2_H@
00584 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00585 #  undef select
00586 #  define select select_used_without_including_sys_select_h
00587 # else
00588    _GL_WARN_ON_USE (select,
00589                     "select() used without including <sys/select.h>");
00590 # endif
00591 #endif
00592 
00593 #if @GNULIB_ACCEPT4@
00594 /* Accept a connection on a socket, with specific opening flags.
00595    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
00596    and O_TEXT, O_BINARY (defined in "binary-io.h").
00597    See also the Linux man page at
00598    <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>.  */
00599 # if @HAVE_ACCEPT4@
00600 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00601 #   define accept4 rpl_accept4
00602 #  endif
00603 _GL_FUNCDECL_RPL (accept4, int,
00604                   (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
00605                    int flags));
00606 _GL_CXXALIAS_RPL (accept4, int,
00607                   (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
00608                    int flags));
00609 # else
00610 _GL_FUNCDECL_SYS (accept4, int,
00611                   (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
00612                    int flags));
00613 _GL_CXXALIAS_SYS (accept4, int,
00614                   (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
00615                    int flags));
00616 # endif
00617 _GL_CXXALIASWARN (accept4);
00618 #elif defined GNULIB_POSIXCHECK
00619 # undef accept4
00620 # if HAVE_RAW_DECL_ACCEPT4
00621 _GL_WARN_ON_USE (accept4, "accept4 is unportable - "
00622                  "use gnulib module accept4 for portability");
00623 # endif
00624 #endif
00625 
00626 #endif /* _GL_SYS_SOCKET_H */
00627 #endif /* _GL_SYS_SOCKET_H */
00628 #endif