diff options
author | Bruno Haible <bruno@clisp.org> | 2018-01-27 10:57:59 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2018-01-27 10:57:59 +0100 |
commit | d4f6a210f44a2bbfedfc60353758c39fb86f8d7a (patch) | |
tree | e6c770cbb8e03e9cd4f379f1a04cd349bf17ea12 | |
parent | 46e7ff4afee45c1b2b52849bd36b3b258417ec51 (diff) | |
download | gnulib-d4f6a210f44a2bbfedfc60353758c39fb86f8d7a.tar.gz |
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.
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | doc/posix-functions/accept.texi | 5 | ||||
-rw-r--r-- | doc/posix-functions/getpeername.texi | 5 | ||||
-rw-r--r-- | doc/posix-functions/getsockname.texi | 5 | ||||
-rw-r--r-- | doc/posix-functions/getsockopt.texi | 5 | ||||
-rw-r--r-- | doc/posix-functions/recvfrom.texi | 5 | ||||
-rw-r--r-- | m4/extensions.m4 | 8 | ||||
-rw-r--r-- | m4/socketlib.m4 | 6 | ||||
-rw-r--r-- | modules/accept | 1 | ||||
-rw-r--r-- | modules/getpeername | 1 | ||||
-rw-r--r-- | modules/getsockname | 1 | ||||
-rw-r--r-- | modules/getsockopt | 1 | ||||
-rw-r--r-- | modules/recvfrom | 1 |
13 files changed, 59 insertions, 2 deletions
@@ -1,5 +1,22 @@ 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. * tests/test-getsockname.c (open_server_socket): New function, mostly copied from test-poll.c. diff --git a/doc/posix-functions/accept.texi b/doc/posix-functions/accept.texi index a92ea3f057..b1216ee38a 100644 --- a/doc/posix-functions/accept.texi +++ b/doc/posix-functions/accept.texi @@ -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: diff --git a/doc/posix-functions/getpeername.texi b/doc/posix-functions/getpeername.texi index 5b2776e78f..8476e0a19a 100644 --- a/doc/posix-functions/getpeername.texi +++ b/doc/posix-functions/getpeername.texi @@ -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: diff --git a/doc/posix-functions/getsockname.texi b/doc/posix-functions/getsockname.texi index 7d462a72b0..714565db38 100644 --- a/doc/posix-functions/getsockname.texi +++ b/doc/posix-functions/getsockname.texi @@ -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: diff --git a/doc/posix-functions/getsockopt.texi b/doc/posix-functions/getsockopt.texi index 9e7d26e433..f15c9342fa 100644 --- a/doc/posix-functions/getsockopt.texi +++ b/doc/posix-functions/getsockopt.texi @@ -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: diff --git a/doc/posix-functions/recvfrom.texi b/doc/posix-functions/recvfrom.texi index f591d0c2f9..251ed5c7af 100644 --- a/doc/posix-functions/recvfrom.texi +++ b/doc/posix-functions/recvfrom.texi @@ -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: diff --git a/m4/extensions.m4 b/m4/extensions.m4 index d1b23215b0..71a854f8bf 100644 --- a/m4/extensions.m4 +++ b/m4/extensions.m4 @@ -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 diff --git a/m4/socketlib.m4 b/m4/socketlib.m4 index ca240b1152..a725d3c77e 100644 --- a/m4/socketlib.m4 +++ b/m4/socketlib.m4 @@ -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 diff --git a/modules/accept b/modules/accept index 059a56d299..b997566d57 100644 --- a/modules/accept +++ b/modules/accept @@ -6,6 +6,7 @@ lib/accept.c lib/w32sock.h Depends-on: +extensions sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] diff --git a/modules/getpeername b/modules/getpeername index d1ef822724..53f077b735 100644 --- a/modules/getpeername +++ b/modules/getpeername @@ -7,6 +7,7 @@ lib/getpeername.c lib/w32sock.h Depends-on: +extensions sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] diff --git a/modules/getsockname b/modules/getsockname index 15cf490ca7..8a8ffe0bde 100644 --- a/modules/getsockname +++ b/modules/getsockname @@ -7,6 +7,7 @@ lib/getsockname.c lib/w32sock.h Depends-on: +extensions sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] diff --git a/modules/getsockopt b/modules/getsockopt index 1cd1f2e12b..adb4b87b2f 100644 --- a/modules/getsockopt +++ b/modules/getsockopt @@ -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] diff --git a/modules/recvfrom b/modules/recvfrom index 2b051b461d..590f6fecb8 100644 --- a/modules/recvfrom +++ b/modules/recvfrom @@ -6,6 +6,7 @@ lib/recvfrom.c lib/w32sock.h Depends-on: +extensions sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] |