]> Savannah Git Hosting - gnulib.git/commitdiff
Fix malfunction of socket functions on HP-UX in 64-bit mode.
authorBruno Haible <bruno@clisp.org>
Sat, 27 Jan 2018 09:57:59 +0000 (10:57 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 27 Jan 2018 09:57:59 +0000 (10:57 +0100)
* m4/socketlib.m4 (gl_SOCKETLIB): Add comment.
* m4/extensions.m4 (AC_USE_SYSTEM_EXTENSIONS): Define
_HPUX_ALT_XOPEN_SOCKET_API.
* modules/accept (Depends-on): Add 'extensions'.
* modules/getpeername (Depends-on): Likewise.
* modules/getsockname (Depends-on): Likewise.
* modules/getsockopt (Depends-on): Likewise.
* modules/recvfrom (Depends-on): Likewise.
* doc/posix-functions/accept.texi: Mention the HP-UX socklen_t problem.
* doc/posix-functions/getpeername.texi: Likewise.
* doc/posix-functions/getsockname.texi: Likewise.
* doc/posix-functions/getsockopt.texi: Likewise.
* doc/posix-functions/recvfrom.texi: Likewise.

13 files changed:
ChangeLog
doc/posix-functions/accept.texi
doc/posix-functions/getpeername.texi
doc/posix-functions/getsockname.texi
doc/posix-functions/getsockopt.texi
doc/posix-functions/recvfrom.texi
m4/extensions.m4
m4/socketlib.m4
modules/accept
modules/getpeername
modules/getsockname
modules/getsockopt
modules/recvfrom

index 70d421982769a713969fced9d3a1d75ccedcc159..e4e24f6407bd7af479a9a7dd256e74c5700d5b07 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2018-01-27  Bruno Haible  <bruno@clisp.org>
+
+       Fix malfunction of socket functions on HP-UX in 64-bit mode.
+       * m4/socketlib.m4 (gl_SOCKETLIB): Add comment.
+       * m4/extensions.m4 (AC_USE_SYSTEM_EXTENSIONS): Define
+       _HPUX_ALT_XOPEN_SOCKET_API.
+       * modules/accept (Depends-on): Add 'extensions'.
+       * modules/getpeername (Depends-on): Likewise.
+       * modules/getsockname (Depends-on): Likewise.
+       * modules/getsockopt (Depends-on): Likewise.
+       * modules/recvfrom (Depends-on): Likewise.
+       * doc/posix-functions/accept.texi: Mention the HP-UX socklen_t problem.
+       * doc/posix-functions/getpeername.texi: Likewise.
+       * doc/posix-functions/getsockname.texi: Likewise.
+       * doc/posix-functions/getsockopt.texi: Likewise.
+       * doc/posix-functions/recvfrom.texi: Likewise.
+
 2018-01-27  Bruno Haible  <bruno@clisp.org>
 
        getsockname tests: More tests.
index a92ea3f057edfb30ba9d80b1215886756e358e47..b1216ee38a41d2b801d6994b772fd8e66ecd75dc 100644 (file)
@@ -17,6 +17,11 @@ the @code{accept} function cannot be used in calls to @code{read},
 On Windows platforms (excluding Cygwin), error codes from this function
 are not placed in @code{errno}, and @code{WSAGetLastError} must be used
 instead.
+@item
+On HP-UX 11, in 64-bit mode, when the macro @code{_HPUX_ALT_XOPEN_SOCKET_API}
+is not defined, this function behaves incorrectly because it is declared
+to take a pointer to a 64-bit wide @code{socklen_t} entity but in fact
+considers it as a pointer to a 32-bit wide @code{unsigned int} entity.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 5b2776e78f0a75fd21f09b87e216f34134867919..8476e0a19a3ce91683a8221afd72e02e931e07a2 100644 (file)
@@ -12,6 +12,11 @@ Portability problems fixed by Gnulib:
 On Windows platforms (excluding Cygwin), error codes from this function
 are not placed in @code{errno}, and @code{WSAGetLastError} must be used
 instead.
+@item
+On HP-UX 11, in 64-bit mode, when the macro @code{_HPUX_ALT_XOPEN_SOCKET_API}
+is not defined, this function behaves incorrectly because it is declared
+to take a pointer to a 64-bit wide @code{socklen_t} entity but in fact
+considers it as a pointer to a 32-bit wide @code{unsigned int} entity.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 7d462a72b0cc6e81dac44a1562cdf4d1126a7196..714565db388d9f44d1ec63d7e7cbef61d51f0dfe 100644 (file)
@@ -12,6 +12,11 @@ Portability problems fixed by Gnulib:
 On Windows platforms (excluding Cygwin), error codes from this function
 are not placed in @code{errno}, and @code{WSAGetLastError} must be used
 instead.
+@item
+On HP-UX 11, in 64-bit mode, when the macro @code{_HPUX_ALT_XOPEN_SOCKET_API}
+is not defined, this function behaves incorrectly because it is declared
+to take a pointer to a 64-bit wide @code{socklen_t} entity but in fact
+considers it as a pointer to a 32-bit wide @code{unsigned int} entity.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 9e7d26e43308ba0d9ae6c00581630c00cec550cd..f15c9342fa66f4d9974884b3eac46aba804ca84c 100644 (file)
@@ -12,6 +12,11 @@ Portability problems fixed by Gnulib:
 On Windows platforms (excluding Cygwin), error codes from this function
 are not placed in @code{errno}, and @code{WSAGetLastError} must be used
 instead.
+@item
+On HP-UX 11, in 64-bit mode, when the macro @code{_HPUX_ALT_XOPEN_SOCKET_API}
+is not defined, this function behaves incorrectly because it is declared
+to take a pointer to a 64-bit wide @code{socklen_t} entity but in fact
+considers it as a pointer to a 32-bit wide @code{unsigned int} entity.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index f591d0c2f93c9ff2d64a7b8e6f4496c91beac8f1..251ed5c7afadb5a969887d65eeb577ce153a2a25 100644 (file)
@@ -16,6 +16,11 @@ OSF/1 5.1.
 On Windows platforms (excluding Cygwin), error codes from this function
 are not placed in @code{errno}, and @code{WSAGetLastError} must be used
 instead.
+@item
+On HP-UX 11, in 64-bit mode, when the macro @code{_HPUX_ALT_XOPEN_SOCKET_API}
+is not defined, this function behaves incorrectly because it is declared
+to take a pointer to a 64-bit wide @code{socklen_t} entity but in fact
+considers it as a pointer to a 32-bit wide @code{unsigned int} entity.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index d1b23215b05adc641f75f69073fd61cbb6dcb351..71a854f8bfaea77e3872f52b9097f26ad3838cbf 100644 (file)
@@ -1,4 +1,4 @@
-# serial 17  -*- Autoconf -*-
+# serial 18  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
 # Copyright (C) 2003, 2006-2018 Free Software Foundation, Inc.
@@ -118,6 +118,11 @@ dnl configure.ac when using autoheader 2.62.
 #ifndef _XOPEN_SOURCE
 # undef _XOPEN_SOURCE
 #endif
+/* Enable X/Open compliant socket functions that do not require linking
+   with -lxnet on HP-UX 11.11.  */
+#ifndef _HPUX_ALT_XOPEN_SOCKET_API
+# undef _HPUX_ALT_XOPEN_SOCKET_API
+#endif
 /* Enable general extensions on Solaris.  */
 #ifndef __EXTENSIONS__
 # undef __EXTENSIONS__
@@ -163,6 +168,7 @@ dnl configure.ac when using autoheader 2.62.
           [ac_cv_should_define__xopen_source=yes])])])
   test $ac_cv_should_define__xopen_source = yes &&
     AC_DEFINE([_XOPEN_SOURCE], [500])
+  AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API])
 ])# AC_USE_SYSTEM_EXTENSIONS
 
 # gl_USE_SYSTEM_EXTENSIONS
index ca240b115224395c229271af8c076bda2c461e45..a725d3c77e16a79c29ea82bbeadcf5e487124caf 100644 (file)
@@ -1,4 +1,4 @@
-# socketlib.m4 serial 1
+# socketlib.m4 serial 2
 dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -38,6 +38,10 @@ AC_DEFUN([gl_SOCKETLIB],
     dnl Solaris has most socket functions in libsocket.
     dnl Haiku has most socket functions in libnetwork.
     dnl BeOS has most socket functions in libnet.
+    dnl On HP-UX, do NOT link with libxnet, because in 64-bit mode this would
+    dnl break code (e.g. in libraries) that invokes accept(), getpeername(),
+    dnl getsockname(), getsockopt(), or recvfrom() with a 32-bit addrlen. See
+    dnl "man xopen_networking" for details.
     AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
       gl_cv_lib_socket=
       AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
index 059a56d29945ddc42996ae7be09e686144311c6e..b997566d572c86e074035b75442e6f070fdb13a4 100644 (file)
@@ -6,6 +6,7 @@ lib/accept.c
 lib/w32sock.h
 
 Depends-on:
+extensions
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
index d1ef822724c0324f40b52773a949cc3bb82aa221..53f077b735ca97de2763f046a30b803478c61f02 100644 (file)
@@ -7,6 +7,7 @@ lib/getpeername.c
 lib/w32sock.h
 
 Depends-on:
+extensions
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
index 15cf490ca791b2910613cd925686a72e65cdec2a..8a8ffe0bde65a88aaf792177d4dbfb1a94d7bd20 100644 (file)
@@ -7,6 +7,7 @@ lib/getsockname.c
 lib/w32sock.h
 
 Depends-on:
+extensions
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]
index 1cd1f2e12bbb5ff9aa9ddc5fe51a57663b486471..adb4b87b2f06dc05c23e9bc5b3d977aa161b665d 100644 (file)
@@ -6,6 +6,7 @@ lib/getsockopt.c
 lib/w32sock.h
 
 Depends-on:
+extensions
 sys_socket
 socketlib
 sys_time        [test "$ac_cv_header_winsock2_h" = yes]
index 2b051b461dfc846243501d483823fb7640df8d42..590f6fecb809e8c425317f57c06ed346b8b2fe16 100644 (file)
@@ -6,6 +6,7 @@ lib/recvfrom.c
 lib/w32sock.h
 
 Depends-on:
+extensions
 sys_socket
 socketlib
 errno           [test "$ac_cv_header_winsock2_h" = yes]