diff mbox series

[7/8] socket: Add time64 alias for getsockopt

Message ID 539b2c5d20735487ae6c1276f42679dc4ff38ae0.1625492203.git.fweimer@redhat.com
State Superseded
Delegated to: Adhemerval Zanella Netto
Headers show
Series Additional time64 aliases | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Florian Weimer July 5, 2021, 1:42 p.m. UTC
---
 socket/Makefile                               |  9 +++-
 socket/sys/socket.h                           | 15 ++++++
 socket/tst-sockopt-time64.c                   |  1 +
 socket/tst-sockopt.c                          | 52 +++++++++++++++++++
 sysdeps/unix/sysv/linux/Versions              |  1 +
 sysdeps/unix/sysv/linux/arm/be/libc.abilist   |  1 +
 sysdeps/unix/sysv/linux/arm/le/libc.abilist   |  1 +
 sysdeps/unix/sysv/linux/arm/syscalls.list     |  2 +-
 sysdeps/unix/sysv/linux/csky/libc.abilist     |  1 +
 sysdeps/unix/sysv/linux/generic/syscalls.list |  2 +-
 sysdeps/unix/sysv/linux/getsockopt.c          |  3 ++
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |  1 +
 sysdeps/unix/sysv/linux/hppa/syscalls.list    |  2 +-
 sysdeps/unix/sysv/linux/i386/libc.abilist     |  1 +
 .../sysv/linux/m68k/coldfire/libc.abilist     |  1 +
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  1 +
 .../sysv/linux/microblaze/be/libc.abilist     |  1 +
 .../sysv/linux/microblaze/le/libc.abilist     |  1 +
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |  1 +
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |  1 +
 .../sysv/linux/mips/mips64/n32/libc.abilist   |  1 +
 sysdeps/unix/sysv/linux/mips/syscalls.list    |  2 +-
 sysdeps/unix/sysv/linux/nios2/libc.abilist    |  1 +
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |  1 +
 .../powerpc/powerpc32/nofpu/libc.abilist      |  1 +
 .../unix/sysv/linux/s390/s390-32/libc.abilist |  1 +
 sysdeps/unix/sysv/linux/sh/be/libc.abilist    |  1 +
 sysdeps/unix/sysv/linux/sh/le/libc.abilist    |  1 +
 .../sysv/linux/sparc/sparc32/libc.abilist     |  1 +
 29 files changed, 103 insertions(+), 5 deletions(-)
 create mode 100644 socket/tst-sockopt-time64.c
 create mode 100644 socket/tst-sockopt.c

Comments

Lukasz Majewski July 20, 2021, 9:10 a.m. UTC | #1
On Mon, 05 Jul 2021 15:42:22 +0200
Florian Weimer via Libc-alpha <libc-alpha@sourceware.org> wrote:

> ---
>  socket/Makefile                               |  9 +++-
>  socket/sys/socket.h                           | 15 ++++++
>  socket/tst-sockopt-time64.c                   |  1 +
>  socket/tst-sockopt.c                          | 52
> +++++++++++++++++++ sysdeps/unix/sysv/linux/Versions              |
> 1 + sysdeps/unix/sysv/linux/arm/be/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/arm/le/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/arm/syscalls.list     |  2 +-
>  sysdeps/unix/sysv/linux/csky/libc.abilist     |  1 +
>  sysdeps/unix/sysv/linux/generic/syscalls.list |  2 +-
>  sysdeps/unix/sysv/linux/getsockopt.c          |  3 ++
>  sysdeps/unix/sysv/linux/hppa/libc.abilist     |  1 +
>  sysdeps/unix/sysv/linux/hppa/syscalls.list    |  2 +-
>  sysdeps/unix/sysv/linux/i386/libc.abilist     |  1 +
>  .../sysv/linux/m68k/coldfire/libc.abilist     |  1 +
>  .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  1 +
>  .../sysv/linux/microblaze/be/libc.abilist     |  1 +
>  .../sysv/linux/microblaze/le/libc.abilist     |  1 +
>  .../sysv/linux/mips/mips32/fpu/libc.abilist   |  1 +
>  .../sysv/linux/mips/mips32/nofpu/libc.abilist |  1 +
>  .../sysv/linux/mips/mips64/n32/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/mips/syscalls.list    |  2 +-
>  sysdeps/unix/sysv/linux/nios2/libc.abilist    |  1 +
>  .../linux/powerpc/powerpc32/fpu/libc.abilist  |  1 +
>  .../powerpc/powerpc32/nofpu/libc.abilist      |  1 +
>  .../unix/sysv/linux/s390/s390-32/libc.abilist |  1 +
>  sysdeps/unix/sysv/linux/sh/be/libc.abilist    |  1 +
>  sysdeps/unix/sysv/linux/sh/le/libc.abilist    |  1 +
>  .../sysv/linux/sparc/sparc32/libc.abilist     |  1 +
>  29 files changed, 103 insertions(+), 5 deletions(-)
>  create mode 100644 socket/tst-sockopt-time64.c
>  create mode 100644 socket/tst-sockopt.c
> 
> diff --git a/socket/Makefile b/socket/Makefile
> index 27ffe44c05..3759576010 100644
> --- a/socket/Makefile
> +++ b/socket/Makefile
> @@ -31,7 +31,14 @@ routines := accept bind connect getpeername
> getsockname getsockopt	\ setsockopt shutdown socket socketpair
> isfdtype opensock	\ sockatmark accept4 recvmmsg sendmmsg
>  
> -tests := tst-accept4
> +tests := \
> +  tst-accept4 \
> +  tst-sockopt \
> +  # tests
> +
> +tests-time64 := \
> +  tst-sockopt-time64 \
> +  # tests
>  
>  aux	 := sa_len
>  
> diff --git a/socket/sys/socket.h b/socket/sys/socket.h
> index e779dc837f..b37c87e7df 100644
> --- a/socket/sys/socket.h
> +++ b/socket/sys/socket.h
> @@ -251,9 +251,24 @@ extern int __REDIRECT (recvmmsg, (int __fd,
> struct mmsghdr *__vmessages, /* Put the current value for socket FD's
> option OPTNAME at protocol level LEVEL into OPTVAL (which is *OPTLEN
> bytes long), and set *OPTLEN to the value's actual length.  Returns 0
> on success, -1 for errors.  */ +#ifndef __USE_TIME_BITS64
>  extern int getsockopt (int __fd, int __level, int __optname,
>  		       void *__restrict __optval,
>  		       socklen_t *__restrict __optlen) __THROW;
> +#else

[*]

> +# ifdef __REDIRECT
> +extern int __REDIRECT_NTH (getsockopt,
> +			   (int __fd, int __level, int __optname,
> +			    void *__restrict __optval,
> +			    socklen_t *__restrict __optlen),
> +			   __getsockopt64);
> +# else
> +extern int __getsockopt64 (int __fd, int __level, int __optname,
> +			   void *__restrict __optval,
> +			   socklen_t *__restrict __optlen) __THROW;

Shouldn't the __getsockopt64() declaration be placed at [*].

> +#  define getsockopt __getsockopt64
> +# endif
> +#endif
>  
>  /* Set socket FD's option OPTNAME at protocol level LEVEL
>     to *OPTVAL (which is OPTLEN bytes long).
> diff --git a/socket/tst-sockopt-time64.c b/socket/tst-sockopt-time64.c
> new file mode 100644
> index 0000000000..f1df48de73
> --- /dev/null
> +++ b/socket/tst-sockopt-time64.c
> @@ -0,0 +1 @@
> +#include "tst-sockopt.c"
> diff --git a/socket/tst-sockopt.c b/socket/tst-sockopt.c
> new file mode 100644
> index 0000000000..f3ce0bc3a4
> --- /dev/null
> +++ b/socket/tst-sockopt.c
> @@ -0,0 +1,52 @@
> +/* Smoke test for socket options.
> +   Copyright (C) 2021 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be
> useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <support/xsocket.h>
> +#include <support/xunistd.h>
> +#include <support/check.h>
> +#include <netinet/in.h>
> +
> +static int
> +do_test (void)
> +{
> +  int fd = xsocket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
> +
> +  struct linger value = { -1, -1 };
> +  socklen_t optlen = sizeof (value);
> +  TEST_COMPARE (getsockopt (fd, SOL_SOCKET, SO_LINGER, &value,
> &optlen), 0);
> +  TEST_COMPARE (optlen, sizeof (value));
> +  TEST_COMPARE (value.l_onoff, 0);
> +  TEST_COMPARE (value.l_linger, 0);
> +
> +  value.l_onoff = 1;
> +  value.l_linger = 30;
> +  TEST_COMPARE (setsockopt (fd, SOL_SOCKET, SO_LINGER, &value,
> sizeof (value)),
> +                0);
> +
> +  value.l_onoff = -1;
> +  value.l_linger = -1;
> +  TEST_COMPARE (getsockopt (fd, SOL_SOCKET, SO_LINGER, &value,
> &optlen), 0);
> +  TEST_COMPARE (optlen, sizeof (value));
> +  TEST_COMPARE (value.l_onoff, 1);
> +  TEST_COMPARE (value.l_linger, 30);
> +
> +  xclose (fd);
> +  return 0;
> +}
> +
> +#include <support/test-driver.c>
> diff --git a/sysdeps/unix/sysv/linux/Versions
> b/sysdeps/unix/sysv/linux/Versions index f9fcc60335..b7d2a2ee4d 100644
> --- a/sysdeps/unix/sysv/linux/Versions
> +++ b/sysdeps/unix/sysv/linux/Versions
> @@ -225,6 +225,7 @@ libc {
>      __gai_suspend_time64;
>      __getitimer64;
>      __getrusage64;
> +    __getsockopt64;
>      __gettimeofday64;
>      __glob64_time64;
>      __globfree64_time64;
> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> b/sysdeps/unix/sysv/linux/arm/be/libc.abilist index
> 7d3c82b6d1..94481027d0 100644 ---
> a/sysdeps/unix/sysv/linux/arm/be/libc.abilist +++
> b/sysdeps/unix/sysv/linux/arm/be/libc.abilist @@ -218,6 +218,7 @@
> GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> b/sysdeps/unix/sysv/linux/arm/le/libc.abilist index
> 758d4bedd4..e4d514af90 100644 ---
> a/sysdeps/unix/sysv/linux/arm/le/libc.abilist +++
> b/sysdeps/unix/sysv/linux/arm/le/libc.abilist @@ -215,6 +215,7 @@
> GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list
> b/sysdeps/unix/sysv/linux/arm/syscalls.list index
> 13441f7eb4..aad60a8871 100644 ---
> a/sysdeps/unix/sysv/linux/arm/syscalls.list +++
> b/sysdeps/unix/sysv/linux/arm/syscalls.list @@ -25,7 +25,7 @@
> personality	EXTRA	personality	Ei:i
> __personality	personality bind		-
> bind		i:ipi	__bind		bind
> getpeername	-	getpeername	i:ipp
> __getpeername	getpeername getsockname	-
> getsockname	i:ipp	__getsockname	getsockname
> -getsockopt	-	getsockopt	i:iiiBN
> __getsockopt	getsockopt +getsockopt	-
> getsockopt	i:iiiBN	__getsockopt	getsockopt
> __getsockopt64 listen		-	listen
> i:ii	__listen	listen setsockopt	-
> setsockopt	i:iiibn	__setsockopt	setsockopt
> shutdown	-	shutdown	i:ii
> __shutdown	shutdown diff --git
> a/sysdeps/unix/sysv/linux/csky/libc.abilist
> b/sysdeps/unix/sysv/linux/csky/libc.abilist index
> 663db34dbd..f4471af348 100644 ---
> a/sysdeps/unix/sysv/linux/csky/libc.abilist +++
> b/sysdeps/unix/sysv/linux/csky/libc.abilist @@ -2350,6 +2350,7 @@
> GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64 F
> GLIBC_2.34 __getitimer64 F GLIBC_2.34 __getrusage64 F +GLIBC_2.34
> __getsockopt64 F GLIBC_2.34 __gettimeofday64 F GLIBC_2.34
> __glob64_time64 F GLIBC_2.34 __globfree64_time64 F diff --git
> a/sysdeps/unix/sysv/linux/generic/syscalls.list
> b/sysdeps/unix/sysv/linux/generic/syscalls.list index
> ed8b216d47..e58eff5bd3 100644 ---
> a/sysdeps/unix/sysv/linux/generic/syscalls.list +++
> b/sysdeps/unix/sysv/linux/generic/syscalls.list @@ -8,5 +8,5 @@
> listen		-	listen		i:ii
> __listen	listen getsockname	-	getsockname
> i:ipp	__getsockname	getsockname getpeername
> -	getpeername	i:ipp	__getpeername
> getpeername setsockopt	-	setsockopt
> i:iiibn	__setsockopt	setsockopt -getsockopt
> -	getsockopt	i:iiiBN	__getsockopt
> getsockopt +getsockopt	-	getsockopt
> i:iiiBN	__getsockopt	getsockopt __getsockopt64
> shutdown	-	shutdown	i:ii
> __shutdown	shutdown diff --git
> a/sysdeps/unix/sysv/linux/getsockopt.c
> b/sysdeps/unix/sysv/linux/getsockopt.c index f86b06dec6..57343d432c
> 100644 --- a/sysdeps/unix/sysv/linux/getsockopt.c +++
> b/sysdeps/unix/sysv/linux/getsockopt.c @@ -101,3 +101,6 @@
> __getsockopt (int fd, int level, int optname, void *optval, socklen_t
> *len) return r; } weak_alias (__getsockopt, getsockopt) +#if
> __TIMESIZE != 64 +weak_alias (__getsockopt, __getsockopt64) +#endif
> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> b/sysdeps/unix/sysv/linux/hppa/libc.abilist index
> 37edc65bad..87859d9399 100644 ---
> a/sysdeps/unix/sysv/linux/hppa/libc.abilist +++
> b/sysdeps/unix/sysv/linux/hppa/libc.abilist @@ -2303,6 +2303,7 @@
> GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64 F
> GLIBC_2.34 __getitimer64 F GLIBC_2.34 __getrusage64 F +GLIBC_2.34
> __getsockopt64 F GLIBC_2.34 __gettimeofday64 F GLIBC_2.34
> __glob64_time64 F GLIBC_2.34 __globfree64_time64 F diff --git
> a/sysdeps/unix/sysv/linux/hppa/syscalls.list
> b/sysdeps/unix/sysv/linux/hppa/syscalls.list index
> cd37573b89..2234f4ac07 100644 ---
> a/sysdeps/unix/sysv/linux/hppa/syscalls.list +++
> b/sysdeps/unix/sysv/linux/hppa/syscalls.list @@ -4,7 +4,7 @@
> bind		-	bind		i:ipi
> __bind		bind getpeername	-
> getpeername	i:ipp	__getpeername	getpeername
> getsockname	-	getsockname	i:ipp
> __getsockname	getsockname -getsockopt	-
> getsockopt	i:iiiBN	__getsockopt	getsockopt
> +getsockopt	-	getsockopt	i:iiiBN
> __getsockopt	getsockopt __getsockopt64 listen
> -	listen		i:ii	__listen	listen
> setsockopt	-	setsockopt	i:iiibn
> __setsockopt	setsockopt shutdown	-
> shutdown	i:ii	__shutdown	shutdown diff --git
> a/sysdeps/unix/sysv/linux/i386/libc.abilist
> b/sysdeps/unix/sysv/linux/i386/libc.abilist index
> e667c6f166..1f411505ce 100644 ---
> a/sysdeps/unix/sysv/linux/i386/libc.abilist +++
> b/sysdeps/unix/sysv/linux/i386/libc.abilist @@ -2486,6 +2486,7 @@
> GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64 F
> GLIBC_2.34 __getitimer64 F GLIBC_2.34 __getrusage64 F +GLIBC_2.34
> __getsockopt64 F GLIBC_2.34 __gettimeofday64 F GLIBC_2.34
> __glob64_time64 F GLIBC_2.34 __globfree64_time64 F diff --git
> a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist index
> 92db44126d..5aba8397e0 100644 ---
> a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist +++
> b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist @@ -219,6 +219,7
> @@ GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64 F
> GLIBC_2.34 __getitimer64 F GLIBC_2.34 __getrusage64 F +GLIBC_2.34
> __getsockopt64 F GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist index
> 8b8decd376..318c50e3fa 100644 ---
> a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist +++
> b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist @@ -2430,6 +2430,7
> @@ GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist index
> 51580fe799..b47cf67949 100644 ---
> a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist +++
> b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist @@ -2401,6
> +2401,7 @@ GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64
> F GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist index
> 4ff4402991..a6e584ae98 100644 ---
> a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist +++
> b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist @@ -2398,6
> +2398,7 @@ GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64
> F GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist index
> ab4d0386d4..f4a6f9ecc5 100644 ---
> a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist +++
> b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist @@ -2395,6
> +2395,7 @@ GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64
> F GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist index
> b31edbbd77..2888edd627 100644 ---
> a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist +++
> b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist @@ -2393,6
> +2393,7 @@ GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64
> F GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist index
> dc49ba11e3..f7a731692b 100644 ---
> a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist +++
> b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist @@ -2401,6
> +2401,7 @@ GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64
> F GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list
> b/sysdeps/unix/sysv/linux/mips/syscalls.list index
> f3621cdd51..13a658fb89 100644 ---
> a/sysdeps/unix/sysv/linux/mips/syscalls.list +++
> b/sysdeps/unix/sysv/linux/mips/syscalls.list @@ -15,7 +15,7 @@
> sysmips		-	sysmips		i:iiii
> __sysmips	sysmips bind		-	bind
> 	i:ipi	__bind		bind getpeername
> -	getpeername	i:ipp	__getpeername
> getpeername getsockname	-	getsockname
> i:ipp	__getsockname	getsockname -getsockopt
> -	getsockopt	i:iiiBN	__getsockopt
> getsockopt +getsockopt	-	getsockopt
> i:iiiBN	__getsockopt	getsockopt __getsockopt64
> listen		-	listen		i:ii
> __listen	listen setsockopt	-	setsockopt
> i:iiibn	__setsockopt	setsockopt shutdown
> -	shutdown	i:ii	__shutdown	shutdown diff
> --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> b/sysdeps/unix/sysv/linux/nios2/libc.abilist index
> e359e90654..5acbc04c87 100644 ---
> a/sysdeps/unix/sysv/linux/nios2/libc.abilist +++
> b/sysdeps/unix/sysv/linux/nios2/libc.abilist @@ -2440,6 +2440,7 @@
> GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64 F
> GLIBC_2.34 __getitimer64 F GLIBC_2.34 __getrusage64 F +GLIBC_2.34
> __getsockopt64 F GLIBC_2.34 __gettimeofday64 F GLIBC_2.34
> __glob64_time64 F GLIBC_2.34 __globfree64_time64 F diff --git
> a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist index
> fbbe434125..1f3058de78 100644 ---
> a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist +++
> b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist @@
> -2457,6 +2457,7 @@ GLIBC_2.34 __futimesat64 F GLIBC_2.34
> __gai_suspend_time64 F GLIBC_2.34 __getitimer64 F GLIBC_2.34
> __getrusage64 F +GLIBC_2.34 __getsockopt64 F GLIBC_2.34
> __gettimeofday64 F GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git
> a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist index
> 476283b260..9584447358 100644 ---
> a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist +++
> b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist @@
> -2490,6 +2490,7 @@ GLIBC_2.34 __futimesat64 F GLIBC_2.34
> __gai_suspend_time64 F GLIBC_2.34 __getitimer64 F GLIBC_2.34
> __getrusage64 F +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist index
> 97d486a10b..dff704b6b9 100644 ---
> a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist +++
> b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist @@ -2455,6
> +2455,7 @@ GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64
> F GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> b/sysdeps/unix/sysv/linux/sh/be/libc.abilist index
> 788ff9bc68..85fc46ab7e 100644 ---
> a/sysdeps/unix/sysv/linux/sh/be/libc.abilist +++
> b/sysdeps/unix/sysv/linux/sh/be/libc.abilist @@ -2310,6 +2310,7 @@
> GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> b/sysdeps/unix/sysv/linux/sh/le/libc.abilist index
> 8a23b8eb52..ebc2a90dac 100644 ---
> a/sysdeps/unix/sysv/linux/sh/le/libc.abilist +++
> b/sysdeps/unix/sysv/linux/sh/le/libc.abilist @@ -2307,6 +2307,7 @@
> GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist index
> 177f3e1e83..8a1d118c67 100644 ---
> a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist +++
> b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist @@ -2450,6
> +2450,7 @@ GLIBC_2.34 __futimesat64 F GLIBC_2.34 __gai_suspend_time64
> F GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F

Reviewed-by: Lukasz Majewski <lukma@denx.de>


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Florian Weimer July 20, 2021, 9:17 a.m. UTC | #2
* Lukasz Majewski:

>> diff --git a/socket/sys/socket.h b/socket/sys/socket.h
>> index e779dc837f..b37c87e7df 100644
>> --- a/socket/sys/socket.h
>> +++ b/socket/sys/socket.h
>> @@ -251,9 +251,24 @@ extern int __REDIRECT (recvmmsg, (int __fd,
>> struct mmsghdr *__vmessages, /* Put the current value for socket FD's
>> option OPTNAME at protocol level LEVEL into OPTVAL (which is *OPTLEN
>> bytes long), and set *OPTLEN to the value's actual length.  Returns 0
>> on success, -1 for errors.  */ +#ifndef __USE_TIME_BITS64
>>  extern int getsockopt (int __fd, int __level, int __optname,
>>  		       void *__restrict __optval,
>>  		       socklen_t *__restrict __optlen) __THROW;
>> +#else
>
> [*]
>
>> +# ifdef __REDIRECT
>> +extern int __REDIRECT_NTH (getsockopt,
>> +			   (int __fd, int __level, int __optname,
>> +			    void *__restrict __optval,
>> +			    socklen_t *__restrict __optlen),
>> +			   __getsockopt64);
>> +# else
>> +extern int __getsockopt64 (int __fd, int __level, int __optname,
>> +			   void *__restrict __optval,
>> +			   socklen_t *__restrict __optlen) __THROW;
>
> Shouldn't the __getsockopt64() declaration be placed at [*].

I think __REDIRECT_NTH does not need a declaration for the redirection
target.

Thanks,
Florian
Lukasz Majewski July 20, 2021, 10:25 a.m. UTC | #3
On Tue, 20 Jul 2021 11:17:23 +0200
Florian Weimer <fweimer@redhat.com> wrote:

> * Lukasz Majewski:
> 
> >> diff --git a/socket/sys/socket.h b/socket/sys/socket.h
> >> index e779dc837f..b37c87e7df 100644
> >> --- a/socket/sys/socket.h
> >> +++ b/socket/sys/socket.h
> >> @@ -251,9 +251,24 @@ extern int __REDIRECT (recvmmsg, (int __fd,
> >> struct mmsghdr *__vmessages, /* Put the current value for socket
> >> FD's option OPTNAME at protocol level LEVEL into OPTVAL (which is
> >> *OPTLEN bytes long), and set *OPTLEN to the value's actual length.
> >>  Returns 0 on success, -1 for errors.  */ +#ifndef
> >> __USE_TIME_BITS64 extern int getsockopt (int __fd, int __level,
> >> int __optname, void *__restrict __optval,
> >>  		       socklen_t *__restrict __optlen) __THROW;
> >> +#else  
> >
> > [*]
> >  
> >> +# ifdef __REDIRECT
> >> +extern int __REDIRECT_NTH (getsockopt,
> >> +			   (int __fd, int __level, int __optname,
> >> +			    void *__restrict __optval,
> >> +			    socklen_t *__restrict __optlen),
> >> +			   __getsockopt64);
> >> +# else
> >> +extern int __getsockopt64 (int __fd, int __level, int __optname,
> >> +			   void *__restrict __optval,
> >> +			   socklen_t *__restrict __optlen)
> >> __THROW;  
> >
> > Shouldn't the __getsockopt64() declaration be placed at [*].  
> 
> I think __REDIRECT_NTH does not need a declaration for the redirection
> target.
> 

Ok.

> Thanks,
> Florian
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Adhemerval Zanella July 21, 2021, 8:09 p.m. UTC | #4
The syscalls.list part is not correct, we want arm, mips32, nios2 (generic),
and csky (generic) to use the Linux getsockopt.c instead of using an alias
for the auto-generated version.

The rest look ok.

On 05/07/2021 10:42, Florian Weimer via Libc-alpha wrote:
> ---
>  socket/Makefile                               |  9 +++-
>  socket/sys/socket.h                           | 15 ++++++
>  socket/tst-sockopt-time64.c                   |  1 +
>  socket/tst-sockopt.c                          | 52 +++++++++++++++++++
>  sysdeps/unix/sysv/linux/Versions              |  1 +
>  sysdeps/unix/sysv/linux/arm/be/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/arm/le/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/arm/syscalls.list     |  2 +-
>  sysdeps/unix/sysv/linux/csky/libc.abilist     |  1 +
>  sysdeps/unix/sysv/linux/generic/syscalls.list |  2 +-
>  sysdeps/unix/sysv/linux/getsockopt.c          |  3 ++
>  sysdeps/unix/sysv/linux/hppa/libc.abilist     |  1 +
>  sysdeps/unix/sysv/linux/hppa/syscalls.list    |  2 +-
>  sysdeps/unix/sysv/linux/i386/libc.abilist     |  1 +
>  .../sysv/linux/m68k/coldfire/libc.abilist     |  1 +
>  .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  1 +
>  .../sysv/linux/microblaze/be/libc.abilist     |  1 +
>  .../sysv/linux/microblaze/le/libc.abilist     |  1 +
>  .../sysv/linux/mips/mips32/fpu/libc.abilist   |  1 +
>  .../sysv/linux/mips/mips32/nofpu/libc.abilist |  1 +
>  .../sysv/linux/mips/mips64/n32/libc.abilist   |  1 +
>  sysdeps/unix/sysv/linux/mips/syscalls.list    |  2 +-
>  sysdeps/unix/sysv/linux/nios2/libc.abilist    |  1 +
>  .../linux/powerpc/powerpc32/fpu/libc.abilist  |  1 +
>  .../powerpc/powerpc32/nofpu/libc.abilist      |  1 +
>  .../unix/sysv/linux/s390/s390-32/libc.abilist |  1 +
>  sysdeps/unix/sysv/linux/sh/be/libc.abilist    |  1 +
>  sysdeps/unix/sysv/linux/sh/le/libc.abilist    |  1 +
>  .../sysv/linux/sparc/sparc32/libc.abilist     |  1 +
>  29 files changed, 103 insertions(+), 5 deletions(-)
>  create mode 100644 socket/tst-sockopt-time64.c
>  create mode 100644 socket/tst-sockopt.c
> 
> diff --git a/socket/Makefile b/socket/Makefile
> index 27ffe44c05..3759576010 100644
> --- a/socket/Makefile
> +++ b/socket/Makefile
> @@ -31,7 +31,14 @@ routines := accept bind connect getpeername getsockname getsockopt	\
>  	    setsockopt shutdown socket socketpair isfdtype opensock	\
>  	    sockatmark accept4 recvmmsg sendmmsg
>  
> -tests := tst-accept4
> +tests := \
> +  tst-accept4 \
> +  tst-sockopt \
> +  # tests
> +
> +tests-time64 := \
> +  tst-sockopt-time64 \
> +  # tests
>  
>  aux	 := sa_len
>  

Ok.

> diff --git a/socket/sys/socket.h b/socket/sys/socket.h
> index e779dc837f..b37c87e7df 100644
> --- a/socket/sys/socket.h
> +++ b/socket/sys/socket.h
> @@ -251,9 +251,24 @@ extern int __REDIRECT (recvmmsg, (int __fd, struct mmsghdr *__vmessages,
>  /* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
>     into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
>     actual length.  Returns 0 on success, -1 for errors.  */
> +#ifndef __USE_TIME_BITS64
>  extern int getsockopt (int __fd, int __level, int __optname,
>  		       void *__restrict __optval,
>  		       socklen_t *__restrict __optlen) __THROW;
> +#else
> +# ifdef __REDIRECT
> +extern int __REDIRECT_NTH (getsockopt,
> +			   (int __fd, int __level, int __optname,
> +			    void *__restrict __optval,
> +			    socklen_t *__restrict __optlen),
> +			   __getsockopt64);
> +# else
> +extern int __getsockopt64 (int __fd, int __level, int __optname,
> +			   void *__restrict __optval,
> +			   socklen_t *__restrict __optlen) __THROW;
> +#  define getsockopt __getsockopt64
> +# endif
> +#endif
>  
>  /* Set socket FD's option OPTNAME at protocol level LEVEL
>     to *OPTVAL (which is OPTLEN bytes long).

Ok.

> diff --git a/socket/tst-sockopt-time64.c b/socket/tst-sockopt-time64.c
> new file mode 100644
> index 0000000000..f1df48de73
> --- /dev/null
> +++ b/socket/tst-sockopt-time64.c
> @@ -0,0 +1 @@
> +#include "tst-sockopt.c"

Ok.

> diff --git a/socket/tst-sockopt.c b/socket/tst-sockopt.c
> new file mode 100644
> index 0000000000..f3ce0bc3a4
> --- /dev/null
> +++ b/socket/tst-sockopt.c
> @@ -0,0 +1,52 @@
> +/* Smoke test for socket options.
> +   Copyright (C) 2021 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <support/xsocket.h>
> +#include <support/xunistd.h>
> +#include <support/check.h>
> +#include <netinet/in.h>
> +
> +static int
> +do_test (void)
> +{
> +  int fd = xsocket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
> +
> +  struct linger value = { -1, -1 };
> +  socklen_t optlen = sizeof (value);
> +  TEST_COMPARE (getsockopt (fd, SOL_SOCKET, SO_LINGER, &value, &optlen), 0);
> +  TEST_COMPARE (optlen, sizeof (value));
> +  TEST_COMPARE (value.l_onoff, 0);
> +  TEST_COMPARE (value.l_linger, 0);
> +
> +  value.l_onoff = 1;
> +  value.l_linger = 30;
> +  TEST_COMPARE (setsockopt (fd, SOL_SOCKET, SO_LINGER, &value, sizeof (value)),
> +                0);
> +
> +  value.l_onoff = -1;
> +  value.l_linger = -1;
> +  TEST_COMPARE (getsockopt (fd, SOL_SOCKET, SO_LINGER, &value, &optlen), 0);
> +  TEST_COMPARE (optlen, sizeof (value));
> +  TEST_COMPARE (value.l_onoff, 1);
> +  TEST_COMPARE (value.l_linger, 30);
> +
> +  xclose (fd);
> +  return 0;
> +}
> +
> +#include <support/test-driver.c>

Ok.

> diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
> index f9fcc60335..b7d2a2ee4d 100644
> --- a/sysdeps/unix/sysv/linux/Versions
> +++ b/sysdeps/unix/sysv/linux/Versions
> @@ -225,6 +225,7 @@ libc {
>      __gai_suspend_time64;
>      __getitimer64;
>      __getrusage64;
> +    __getsockopt64;
>      __gettimeofday64;
>      __glob64_time64;
>      __globfree64_time64;

Ok.

> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> index 7d3c82b6d1..94481027d0 100644
> --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> @@ -218,6 +218,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> index 758d4bedd4..e4d514af90 100644
> --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> @@ -215,6 +215,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
> index 13441f7eb4..aad60a8871 100644
> --- a/sysdeps/unix/sysv/linux/arm/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
> @@ -25,7 +25,7 @@ personality	EXTRA	personality	Ei:i	__personality	personality
>  bind		-	bind		i:ipi	__bind		bind
>  getpeername	-	getpeername	i:ipp	__getpeername	getpeername
>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
> -getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
> +getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt __getsockopt64
>  listen		-	listen		i:ii	__listen	listen
>  setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
>  shutdown	-	shutdown	i:ii	__shutdown	shutdown

This will trigger the auto-generation, which is *not* what we want for
arm (it should use the linux getsockopt.c).

> diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
> index 663db34dbd..f4471af348 100644
> --- a/sysdeps/unix/sysv/linux/csky/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
> @@ -2350,6 +2350,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
> index ed8b216d47..e58eff5bd3 100644
> --- a/sysdeps/unix/sysv/linux/generic/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
> @@ -8,5 +8,5 @@ listen		-	listen		i:ii	__listen	listen
>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getpeername	-	getpeername	i:ipp	__getpeername	getpeername
>  setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
> -getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
> +getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt __getsockopt64
>  shutdown	-	shutdown	i:ii	__shutdown	shutdown

Same as before.

> diff --git a/sysdeps/unix/sysv/linux/getsockopt.c b/sysdeps/unix/sysv/linux/getsockopt.c
> index f86b06dec6..57343d432c 100644
> --- a/sysdeps/unix/sysv/linux/getsockopt.c
> +++ b/sysdeps/unix/sysv/linux/getsockopt.c
> @@ -101,3 +101,6 @@ __getsockopt (int fd, int level, int optname, void *optval, socklen_t *len)
>   return r;
>  }
>  weak_alias (__getsockopt, getsockopt)
> +#if __TIMESIZE != 64
> +weak_alias (__getsockopt, __getsockopt64)
> +#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> index 37edc65bad..87859d9399 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> @@ -2303,6 +2303,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
> index cd37573b89..2234f4ac07 100644
> --- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
> @@ -4,7 +4,7 @@
>  bind		-	bind		i:ipi	__bind		bind
>  getpeername	-	getpeername	i:ipp	__getpeername	getpeername
>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
> -getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
> +getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt __getsockopt64
>  listen		-	listen		i:ii	__listen	listen
>  setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
>  shutdown	-	shutdown	i:ii	__shutdown	shutdown

Same as the ARM part comment.

> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> index e667c6f166..1f411505ce 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> @@ -2486,6 +2486,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> index 92db44126d..5aba8397e0 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> @@ -219,6 +219,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> index 8b8decd376..318c50e3fa 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> @@ -2430,6 +2430,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> index 51580fe799..b47cf67949 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> @@ -2401,6 +2401,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> index 4ff4402991..a6e584ae98 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> @@ -2398,6 +2398,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> index ab4d0386d4..f4a6f9ecc5 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> @@ -2395,6 +2395,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> index b31edbbd77..2888edd627 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> @@ -2393,6 +2393,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> index dc49ba11e3..f7a731692b 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> @@ -2401,6 +2401,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
> index f3621cdd51..13a658fb89 100644
> --- a/sysdeps/unix/sysv/linux/mips/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
> @@ -15,7 +15,7 @@ sysmips		-	sysmips		i:iiii	__sysmips	sysmips
>  bind		-	bind		i:ipi	__bind		bind
>  getpeername	-	getpeername	i:ipp	__getpeername	getpeername
>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
> -getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
> +getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt __getsockopt64
>  listen		-	listen		i:ii	__listen	listen
>  setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
>  shutdown	-	shutdown	i:ii	__shutdown	shutdown

Same as the ARM comment for mips32.

> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> index e359e90654..5acbc04c87 100644
> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> @@ -2440,6 +2440,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> index fbbe434125..1f3058de78 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> @@ -2457,6 +2457,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> index 476283b260..9584447358 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> @@ -2490,6 +2490,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> index 97d486a10b..dff704b6b9 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> @@ -2455,6 +2455,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> index 788ff9bc68..85fc46ab7e 100644
> --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> @@ -2310,6 +2310,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> index 8a23b8eb52..ebc2a90dac 100644
> --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> @@ -2307,6 +2307,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> index 177f3e1e83..8a1d118c67 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> @@ -2450,6 +2450,7 @@ GLIBC_2.34 __futimesat64 F
>  GLIBC_2.34 __gai_suspend_time64 F
>  GLIBC_2.34 __getitimer64 F
>  GLIBC_2.34 __getrusage64 F
> +GLIBC_2.34 __getsockopt64 F
>  GLIBC_2.34 __gettimeofday64 F
>  GLIBC_2.34 __glob64_time64 F
>  GLIBC_2.34 __globfree64_time64 F
>
Florian Weimer July 21, 2021, 8:12 p.m. UTC | #5
* Adhemerval Zanella:

> The syscalls.list part is not correct, we want arm, mips32, nios2 (generic),
> and csky (generic) to use the Linux getsockopt.c instead of using an alias
> for the auto-generated version.

I think this is fixed in the merge conflict resolution in the new
version posted here:

  <https://sourceware.org/pipermail/libc-alpha/2021-July/129255.html>

Thanks,
Florian
Adhemerval Zanella July 21, 2021, 8:17 p.m. UTC | #6
On 21/07/2021 17:12, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> The syscalls.list part is not correct, we want arm, mips32, nios2 (generic),
>> and csky (generic) to use the Linux getsockopt.c instead of using an alias
>> for the auto-generated version.
> 
> I think this is fixed in the merge conflict resolution in the new
> version posted here:
> 
>   <https://sourceware.org/pipermail/libc-alpha/2021-July/129255.html>

Right, I got confused it was not versioned.
diff mbox series

Patch

diff --git a/socket/Makefile b/socket/Makefile
index 27ffe44c05..3759576010 100644
--- a/socket/Makefile
+++ b/socket/Makefile
@@ -31,7 +31,14 @@  routines := accept bind connect getpeername getsockname getsockopt	\
 	    setsockopt shutdown socket socketpair isfdtype opensock	\
 	    sockatmark accept4 recvmmsg sendmmsg
 
-tests := tst-accept4
+tests := \
+  tst-accept4 \
+  tst-sockopt \
+  # tests
+
+tests-time64 := \
+  tst-sockopt-time64 \
+  # tests
 
 aux	 := sa_len
 
diff --git a/socket/sys/socket.h b/socket/sys/socket.h
index e779dc837f..b37c87e7df 100644
--- a/socket/sys/socket.h
+++ b/socket/sys/socket.h
@@ -251,9 +251,24 @@  extern int __REDIRECT (recvmmsg, (int __fd, struct mmsghdr *__vmessages,
 /* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
    into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
    actual length.  Returns 0 on success, -1 for errors.  */
+#ifndef __USE_TIME_BITS64
 extern int getsockopt (int __fd, int __level, int __optname,
 		       void *__restrict __optval,
 		       socklen_t *__restrict __optlen) __THROW;
+#else
+# ifdef __REDIRECT
+extern int __REDIRECT_NTH (getsockopt,
+			   (int __fd, int __level, int __optname,
+			    void *__restrict __optval,
+			    socklen_t *__restrict __optlen),
+			   __getsockopt64);
+# else
+extern int __getsockopt64 (int __fd, int __level, int __optname,
+			   void *__restrict __optval,
+			   socklen_t *__restrict __optlen) __THROW;
+#  define getsockopt __getsockopt64
+# endif
+#endif
 
 /* Set socket FD's option OPTNAME at protocol level LEVEL
    to *OPTVAL (which is OPTLEN bytes long).
diff --git a/socket/tst-sockopt-time64.c b/socket/tst-sockopt-time64.c
new file mode 100644
index 0000000000..f1df48de73
--- /dev/null
+++ b/socket/tst-sockopt-time64.c
@@ -0,0 +1 @@ 
+#include "tst-sockopt.c"
diff --git a/socket/tst-sockopt.c b/socket/tst-sockopt.c
new file mode 100644
index 0000000000..f3ce0bc3a4
--- /dev/null
+++ b/socket/tst-sockopt.c
@@ -0,0 +1,52 @@ 
+/* Smoke test for socket options.
+   Copyright (C) 2021 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <support/xsocket.h>
+#include <support/xunistd.h>
+#include <support/check.h>
+#include <netinet/in.h>
+
+static int
+do_test (void)
+{
+  int fd = xsocket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
+
+  struct linger value = { -1, -1 };
+  socklen_t optlen = sizeof (value);
+  TEST_COMPARE (getsockopt (fd, SOL_SOCKET, SO_LINGER, &value, &optlen), 0);
+  TEST_COMPARE (optlen, sizeof (value));
+  TEST_COMPARE (value.l_onoff, 0);
+  TEST_COMPARE (value.l_linger, 0);
+
+  value.l_onoff = 1;
+  value.l_linger = 30;
+  TEST_COMPARE (setsockopt (fd, SOL_SOCKET, SO_LINGER, &value, sizeof (value)),
+                0);
+
+  value.l_onoff = -1;
+  value.l_linger = -1;
+  TEST_COMPARE (getsockopt (fd, SOL_SOCKET, SO_LINGER, &value, &optlen), 0);
+  TEST_COMPARE (optlen, sizeof (value));
+  TEST_COMPARE (value.l_onoff, 1);
+  TEST_COMPARE (value.l_linger, 30);
+
+  xclose (fd);
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index f9fcc60335..b7d2a2ee4d 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -225,6 +225,7 @@  libc {
     __gai_suspend_time64;
     __getitimer64;
     __getrusage64;
+    __getsockopt64;
     __gettimeofday64;
     __glob64_time64;
     __globfree64_time64;
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index 7d3c82b6d1..94481027d0 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -218,6 +218,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index 758d4bedd4..e4d514af90 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -215,6 +215,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 13441f7eb4..aad60a8871 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -25,7 +25,7 @@  personality	EXTRA	personality	Ei:i	__personality	personality
 bind		-	bind		i:ipi	__bind		bind
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
+getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt __getsockopt64
 listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index 663db34dbd..f4471af348 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -2350,6 +2350,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index ed8b216d47..e58eff5bd3 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -8,5 +8,5 @@  listen		-	listen		i:ii	__listen	listen
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
+getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt __getsockopt64
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/getsockopt.c b/sysdeps/unix/sysv/linux/getsockopt.c
index f86b06dec6..57343d432c 100644
--- a/sysdeps/unix/sysv/linux/getsockopt.c
+++ b/sysdeps/unix/sysv/linux/getsockopt.c
@@ -101,3 +101,6 @@  __getsockopt (int fd, int level, int optname, void *optval, socklen_t *len)
  return r;
 }
 weak_alias (__getsockopt, getsockopt)
+#if __TIMESIZE != 64
+weak_alias (__getsockopt, __getsockopt64)
+#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 37edc65bad..87859d9399 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -2303,6 +2303,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index cd37573b89..2234f4ac07 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -4,7 +4,7 @@ 
 bind		-	bind		i:ipi	__bind		bind
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
+getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt __getsockopt64
 listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index e667c6f166..1f411505ce 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2486,6 +2486,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index 92db44126d..5aba8397e0 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -219,6 +219,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 8b8decd376..318c50e3fa 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2430,6 +2430,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 51580fe799..b47cf67949 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -2401,6 +2401,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index 4ff4402991..a6e584ae98 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -2398,6 +2398,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index ab4d0386d4..f4a6f9ecc5 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -2395,6 +2395,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index b31edbbd77..2888edd627 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -2393,6 +2393,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index dc49ba11e3..f7a731692b 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -2401,6 +2401,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index f3621cdd51..13a658fb89 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -15,7 +15,7 @@  sysmips		-	sysmips		i:iiii	__sysmips	sysmips
 bind		-	bind		i:ipi	__bind		bind
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
+getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt __getsockopt64
 listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index e359e90654..5acbc04c87 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2440,6 +2440,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index fbbe434125..1f3058de78 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2457,6 +2457,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 476283b260..9584447358 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2490,6 +2490,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 97d486a10b..dff704b6b9 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2455,6 +2455,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index 788ff9bc68..85fc46ab7e 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -2310,6 +2310,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index 8a23b8eb52..ebc2a90dac 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -2307,6 +2307,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 177f3e1e83..8a1d118c67 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2450,6 +2450,7 @@  GLIBC_2.34 __futimesat64 F
 GLIBC_2.34 __gai_suspend_time64 F
 GLIBC_2.34 __getitimer64 F
 GLIBC_2.34 __getrusage64 F
+GLIBC_2.34 __getsockopt64 F
 GLIBC_2.34 __gettimeofday64 F
 GLIBC_2.34 __glob64_time64 F
 GLIBC_2.34 __globfree64_time64 F