waitpid: Fix link error in C++ mode.
[pspp] / lib / sys_socket.in.h
index 006a90106cb6b3bfa69685a2cc1d1494d2cb045a..7eacf027eb9489200c762204b36fa84fee50e879 100644 (file)
    It is intended to provide definitions and prototypes needed by an
    application.  */
 
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
 #if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H
 /* Special invocation convention:
    - On Cygwin 1.5.x we have a sequence of nested includes
 
 # define _GL_ALREADY_INCLUDING_SYS_SOCKET_H
 
-# if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-# endif
-
 /* On many platforms, <sys/socket.h> assumes prior inclusion of
    <sys/types.h>.  */
 # include <sys/types.h>
 typedef unsigned short  sa_family_t;
 #endif
 
-#if !@HAVE_STRUCT_SOCKADDR_STORAGE@
+#if @HAVE_STRUCT_SOCKADDR_STORAGE@
+/* Make the 'struct sockaddr_storage' field 'ss_family' visible on AIX 7.1.  */
+# if !@HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@
+#  ifndef ss_family
+#   define ss_family __ss_family
+#  endif
+# endif
+#else
 # include <alignof.h>
 /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on
    2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */
@@ -122,8 +130,8 @@ struct sockaddr_storage
    adding AC_DEFINE(WINVER, 0x0501) to configure.ac.  Note that your
    code may not run on older Windows releases then.  My Windows 2000
    box was not able to run the code, for example.  The situation is
-   slightly confusing because:
-   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
+   slightly confusing because
+   <http://msdn.microsoft.com/en-us/library/ms738520>
    suggests that getaddrinfo should be available on all Windows
    releases. */
 
@@ -183,13 +191,23 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
 /* Wrap everything else to use libc file descriptors for sockets.  */
 
 #if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
-# undef close
-# define close close_used_without_including_unistd_h
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef close
+#  define close close_used_without_including_unistd_h
+# else
+   _GL_WARN_ON_USE (close,
+                    "close() used without including <unistd.h>");
+# endif
 #endif
 
 #if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
-# undef gethostname
-# define gethostname gethostname_used_without_including_unistd_h
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef gethostname
+#  define gethostname gethostname_used_without_including_unistd_h
+# else
+   _GL_WARN_ON_USE (gethostname,
+                    "gethostname() used without including <unistd.h>");
+# endif
 #endif
 
 #if @GNULIB_SOCKET@
@@ -227,8 +245,11 @@ _GL_FUNCDECL_RPL (connect, int,
 _GL_CXXALIAS_RPL (connect, int,
                   (int fd, const struct sockaddr *addr, socklen_t addrlen));
 # else
-_GL_CXXALIAS_SYS (connect, int,
-                  (int fd, const struct sockaddr *addr, socklen_t addrlen));
+/* Need to cast, because on NonStop Kernel, the third parameter is
+                                                     size_t addrlen.  */
+_GL_CXXALIAS_SYS_CAST (connect, int,
+                       (int fd,
+                        const struct sockaddr *addr, socklen_t addrlen));
 # endif
 _GL_CXXALIASWARN (connect);
 #elif @HAVE_WINSOCK2_H@
@@ -282,8 +303,11 @@ _GL_FUNCDECL_RPL (bind, int,
 _GL_CXXALIAS_RPL (bind, int,
                   (int fd, const struct sockaddr *addr, socklen_t addrlen));
 # else
-_GL_CXXALIAS_SYS (bind, int,
-                  (int fd, const struct sockaddr *addr, socklen_t addrlen));
+/* Need to cast, because on NonStop Kernel, the third parameter is
+                                                     size_t addrlen.  */
+_GL_CXXALIAS_SYS_CAST (bind, int,
+                       (int fd,
+                        const struct sockaddr *addr, socklen_t addrlen));
 # endif
 _GL_CXXALIASWARN (bind);
 #elif @HAVE_WINSOCK2_H@
@@ -504,9 +528,11 @@ _GL_CXXALIAS_RPL (sendto, ssize_t,
                   (int fd, const void *buf, size_t len, int flags,
                    const struct sockaddr *to, socklen_t tolen));
 # else
-_GL_CXXALIAS_SYS (sendto, ssize_t,
-                  (int fd, const void *buf, size_t len, int flags,
-                   const struct sockaddr *to, socklen_t tolen));
+/* Need to cast, because on NonStop Kernel, the sixth parameter is
+                                                   size_t tolen.  */
+_GL_CXXALIAS_SYS_CAST (sendto, ssize_t,
+                       (int fd, const void *buf, size_t len, int flags,
+                        const struct sockaddr *to, socklen_t tolen));
 # endif
 _GL_CXXALIASWARN (sendto);
 #elif @HAVE_WINSOCK2_H@
@@ -532,8 +558,11 @@ _GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
 _GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
                                     const void * optval, socklen_t optlen));
 # else
-_GL_CXXALIAS_SYS (setsockopt, int, (int fd, int level, int optname,
-                                    const void * optval, socklen_t optlen));
+/* Need to cast, because on NonStop Kernel, the fifth parameter is
+                                             size_t optlen.  */
+_GL_CXXALIAS_SYS_CAST (setsockopt, int,
+                       (int fd, int level, int optname,
+                        const void * optval, socklen_t optlen));
 # endif
 _GL_CXXALIASWARN (setsockopt);
 #elif @HAVE_WINSOCK2_H@
@@ -571,8 +600,13 @@ _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
 #endif
 
 #if @HAVE_WINSOCK2_H@
-# undef select
-# define select                select_used_without_including_sys_select_h
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef select
+#  define select select_used_without_including_sys_select_h
+# else
+   _GL_WARN_ON_USE (select,
+                    "select() used without including <sys/select.h>");
+# endif
 #endif
 
 #if @GNULIB_ACCEPT4@