public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 00/28] More Linux syscall refactor
@ 2020-11-18 19:55 Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 01/28] Remove generic pthread linuxism on POSIX timer_routine Adhemerval Zanella
                   ` (28 more replies)
  0 siblings, 29 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

This is second part of Linux syscall refactor (the first one [1] focused
on simplify the internal mechanism).  Although this patchset is
independent from first part, some code do intersect (such the ones that
might use the syscall return value), however they are easily fixed
whether one is pushed first.

This part remove ununsed code, consolidate implementation, simplify the
auto-generation syscall list, move some auto-generation to C, and move
some assembly implementation to C.

The idea is to 1. remove implementations from auto-generation which
require either arch-specific knowledge or can't be implemented easily
on C (such as 64-bit variable on 32-bit architecture) and 2. minimize the
assembly implementation that issues syscalls to a bare minimum (only the
ones that are not easily implemented in C, such as clone or vfork).

The long goal with this refactor is to replace the auto-generation
using assembly macros to a auto-generation using C code, thus removing
the requirement of each architecture to provide the ASM assembly macros
(all syscall will be done through proper inline functions).  The
subsequent part to implement it relies on this patchset and the previous
one [1].

[1] https://sourceware.org/pipermail/libc-alpha/2020-November/119456.html

Adhemerval Zanella (28):
  Remove generic pthread linuxism on POSIX timer_routine
  Removed ununsed pthread implementations
  Remove local-setxid.h
  Remove HAVE_INLINED_SYSCALLS usage on generic implementations
  linux: Consolidate and cleanup personality syscall
  x32: Remove syscalls.list
  linux: Assume bind support
  linux: Assume getpeername support
  linux: Assume getsockname support
  linux: Assume getsockopt support
  linux: Assume listen support
  linux: Assume setsockopt support
  linux: Assume shutdown support
  linux: Assume socket support
  linux: Assume socketpair support
  linux: Remove superflous __ASSUME_CONNECT_SYSCALL definitions
  x86_64: Remove ununsed syscalls.list entry
  nptl: Add futex_trylock_pi
  linux: Add fanotify_mark C implementation
  linux: Add prlimit64 C implementation
  linux: Implement mremap in C
  Linux: implement ioctl in C
  mips: Implement n32 lseek64 in C
  x32: Implement lseek64 in C
  linux: Implement pipe in terms of __NR_pipe2
  linux: Consolidate brk implementation
  linux: Add generic C syscall implementation
  alpha: Move implementations to C

 debug/read_chk.c                              |   9 --
 debug/readlink_chk.c                          |   5 -
 nptl/Makefile                                 |   4 -
 nptl/pthread_mutex_trylock.c                  |   9 +-
 nptl/pthread_setegid.c                        |   3 -
 nptl/pthread_seteuid.c                        |   3 -
 nptl/pthread_setgid.c                         |   3 -
 nptl/pthread_setregid.c                       |   3 -
 nptl/pthread_setresgid.c                      |   3 -
 nptl/pthread_setresuid.c                      |   3 -
 nptl/pthread_setreuid.c                       |   3 -
 nptl/pthread_setuid.c                         |   3 -
 sysdeps/generic/local-setxid.h                |   4 -
 sysdeps/nptl/futex-internal.h                 |  36 ++++++
 sysdeps/nptl/lowlevellock-futex.h             |   5 +
 sysdeps/posix/spawni.c                        |   5 +-
 sysdeps/pthread/timer_routines.c              |  19 ----
 sysdeps/unix/syscalls.list                    |   2 -
 sysdeps/unix/sysv/linux/Makefile              |   4 +-
 sysdeps/unix/sysv/linux/aarch64/sysdep.h      |   3 +
 sysdeps/unix/sysv/linux/alpha/brk.S           |  83 --------------
 sysdeps/unix/sysv/linux/{arm => alpha}/brk.c  |  13 +--
 sysdeps/unix/sysv/linux/alpha/dl-brk.S        |   1 -
 .../alpha/{fraiseexcpt.S => fraiseexcpt.c}    |  37 ++-----
 .../sysv/linux/alpha/{getegid.S => getegid.c} |  15 +--
 .../sysv/linux/alpha/{geteuid.S => geteuid.c} |  15 +--
 .../sysv/linux/alpha/{getppid.S => getppid.c} |  15 +--
 .../sysv/linux/alpha/ieee_get_fp_control.S    |  50 ---------
 .../linux/alpha/ieee_get_fp_control.c}        |  29 ++---
 .../sysv/linux/alpha/ieee_set_fp_control.S    |  46 --------
 .../linux/alpha/ieee_set_fp_control.c}        |  24 ++--
 sysdeps/unix/sysv/linux/alpha/pipe.S          |   1 -
 .../alpha/{setcontext.S => setcontext.c}      |  27 ++---
 sysdeps/unix/sysv/linux/alpha/syscalls.list   |  11 --
 sysdeps/unix/sysv/linux/alpha/sysdep.h        |  21 ++++
 sysdeps/unix/sysv/linux/arc/sysdep.h          |   3 +
 sysdeps/unix/sysv/linux/arm/syscalls.list     |  17 ---
 .../unix/sysv/linux/{microblaze => }/brk.c    |   5 +-
 sysdeps/unix/sysv/linux/csky/sysdep.h         |   3 +
 sysdeps/unix/sysv/linux/dl-brk.c              |   5 -
 .../sysv/linux/{sh/pipe.S => fanotify_mark.c} |  42 +++----
 sysdeps/unix/sysv/linux/generic/brk.c         |  43 --------
 sysdeps/unix/sysv/linux/generic/syscalls.list |  12 --
 .../linux/generic/wordsize-32/syscalls.list   |   5 -
 sysdeps/unix/sysv/linux/hppa/brk.c            |  41 -------
 sysdeps/unix/sysv/linux/hppa/fanotify_mark.c  |   2 +
 sysdeps/unix/sysv/linux/hppa/prlimit64.c      |   2 +
 sysdeps/unix/sysv/linux/hppa/syscall.c        |  65 -----------
 sysdeps/unix/sysv/linux/hppa/syscalls.list    |  16 ---
 sysdeps/unix/sysv/linux/i386/brk.c            |  45 --------
 .../unix/sysv/linux/i386/kernel-features.h    |  23 ++--
 sysdeps/unix/sysv/linux/i386/syscalls.list    |   6 -
 sysdeps/unix/sysv/linux/i386/sysdep.h         |   3 +
 sysdeps/unix/sysv/linux/ia64/brk.S            |  50 ---------
 sysdeps/unix/sysv/linux/ia64/dl-brk.S         |   1 -
 sysdeps/unix/sysv/linux/ia64/pipe.S           |  37 -------
 sysdeps/unix/sysv/linux/ia64/syscalls.list    |  11 --
 sysdeps/unix/sysv/linux/ia64/sysdep.h         |   3 +
 .../unix/sysv/linux/{x86_64/brk.c => ioctl.c} |  31 +++---
 sysdeps/unix/sysv/linux/kernel-features.h     |   9 ++
 sysdeps/unix/sysv/linux/local-setxid.h        |  16 ---
 .../unix/sysv/linux/m68k/kernel-features.h    |  23 ++--
 sysdeps/unix/sysv/linux/m68k/syscalls.list    |   3 -
 sysdeps/unix/sysv/linux/m68k/sysdep.h         |   3 +
 .../sysv/linux/microblaze/kernel-features.h   |  10 --
 .../unix/sysv/linux/microblaze/syscalls.list  |   4 -
 sysdeps/unix/sysv/linux/microblaze/sysdep.h   |   3 +
 sysdeps/unix/sysv/linux/mips/brk.c            |  46 --------
 .../unix/sysv/linux/mips/mips32/syscalls.list |   5 -
 sysdeps/unix/sysv/linux/mips/mips32/sysdep.h  |   3 +
 .../unix/sysv/linux/mips/mips64/n32/lseek64.c |  47 ++++++++
 .../sysv/linux/mips/mips64/n32/syscalls.list  |  11 --
 .../sysv/linux/mips/mips64/n64/syscalls.list  |   4 -
 sysdeps/unix/sysv/linux/mips/mips64/sysdep.h  |   3 +
 sysdeps/unix/sysv/linux/mips/pipe.S           |   1 -
 sysdeps/unix/sysv/linux/mips/syscalls.list    |  14 ---
 .../unix/sysv/linux/{sh/brk.c => mremap.c}    |  40 +++----
 sysdeps/unix/sysv/linux/nios2/sysdep.h        |   3 +
 sysdeps/unix/sysv/linux/personality.c         |  24 +---
 sysdeps/unix/sysv/linux/{generic => }/pipe.c  |   6 +-
 sysdeps/unix/sysv/linux/powerpc/dl-brk.S      |   1 -
 .../unix/sysv/linux/powerpc/kernel-features.h |  10 --
 .../linux/powerpc/powerpc32/syscalls.list     |   3 -
 .../unix/sysv/linux/powerpc/powerpc64/brk.S   |  43 --------
 sysdeps/unix/sysv/linux/prlimit.c             |   2 +
 .../{powerpc/powerpc32/brk.S => prlimit64.c}  |  51 ++++-----
 sysdeps/unix/sysv/linux/riscv/sysdep.h        |   3 +
 sysdeps/unix/sysv/linux/s390/brk.c            |  55 ---------
 .../unix/sysv/linux/s390/kernel-features.h    |  22 ++--
 .../sysv/linux/s390/s390-32/syscalls.list     |   4 -
 sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h |   5 +
 sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h |   5 +
 sysdeps/unix/sysv/linux/sh/fanotify_mark.c    |   2 +
 sysdeps/unix/sysv/linux/sh/kernel-features.h  |  10 --
 sysdeps/unix/sysv/linux/sh/syscalls.list      |   6 -
 .../unix/sysv/linux/sparc/kernel-features.h   |  17 ++-
 sysdeps/unix/sysv/linux/sparc/sparc32/brk.c   |  54 ---------
 sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S  |  39 -------
 .../sysv/linux/sparc/sparc32/syscalls.list    |   3 -
 .../unix/sysv/linux/sparc/sparc32/sysdep.h    |   3 +
 sysdeps/unix/sysv/linux/sparc/sparc64/brk.S   | 104 ------------------
 .../unix/sysv/linux/sparc/sparc64/dl-brk.S    |   1 -
 .../sysv/linux/sparc/sparc64/personality.c    |   3 -
 sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S  |  40 -------
 .../sysv/linux/sparc/sparc64/syscalls.list    |   7 --
 sysdeps/unix/sysv/linux/spawni.c              |  19 +++-
 sysdeps/unix/sysv/linux/{riscv => }/syscall.c |  33 +++---
 sysdeps/unix/sysv/linux/syscalls.list         |   2 -
 sysdeps/unix/sysv/linux/sysdep.h              |   4 +
 .../unix/sysv/linux/wordsize-64/syscalls.list |   4 -
 sysdeps/unix/sysv/linux/x86_64/syscalls.list  |  13 ---
 sysdeps/unix/sysv/linux/x86_64/x32/lseek.S    |  43 --------
 sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S  |   1 -
 .../{m68k/brk.c => x86_64/x32/lseek64.c}      |  44 ++++----
 .../unix/sysv/linux/x86_64/x32/syscalls.list  |   4 -
 115 files changed, 429 insertions(+), 1497 deletions(-)
 delete mode 100644 nptl/pthread_setegid.c
 delete mode 100644 nptl/pthread_seteuid.c
 delete mode 100644 nptl/pthread_setgid.c
 delete mode 100644 nptl/pthread_setregid.c
 delete mode 100644 nptl/pthread_setresgid.c
 delete mode 100644 nptl/pthread_setresuid.c
 delete mode 100644 nptl/pthread_setreuid.c
 delete mode 100644 nptl/pthread_setuid.c
 delete mode 100644 sysdeps/generic/local-setxid.h
 delete mode 100644 sysdeps/unix/sysv/linux/alpha/brk.S
 rename sysdeps/unix/sysv/linux/{arm => alpha}/brk.c (77%)
 delete mode 100644 sysdeps/unix/sysv/linux/alpha/dl-brk.S
 rename sysdeps/unix/sysv/linux/alpha/{fraiseexcpt.S => fraiseexcpt.c} (66%)
 rename sysdeps/unix/sysv/linux/alpha/{getegid.S => getegid.c} (79%)
 rename sysdeps/unix/sysv/linux/alpha/{geteuid.S => geteuid.c} (79%)
 rename sysdeps/unix/sysv/linux/alpha/{getppid.S => getppid.c} (79%)
 delete mode 100644 sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S
 rename sysdeps/unix/{mips/pipe.S => sysv/linux/alpha/ieee_get_fp_control.c} (64%)
 delete mode 100644 sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S
 rename sysdeps/unix/{alpha/pipe.S => sysv/linux/alpha/ieee_set_fp_control.c} (68%)
 delete mode 100644 sysdeps/unix/sysv/linux/alpha/pipe.S
 rename sysdeps/unix/sysv/linux/alpha/{setcontext.S => setcontext.c} (62%)
 rename sysdeps/unix/sysv/linux/{microblaze => }/brk.c (90%)
 delete mode 100644 sysdeps/unix/sysv/linux/dl-brk.c
 rename sysdeps/unix/sysv/linux/{sh/pipe.S => fanotify_mark.c} (56%)
 delete mode 100644 sysdeps/unix/sysv/linux/generic/brk.c
 delete mode 100644 sysdeps/unix/sysv/linux/generic/syscalls.list
 delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list
 delete mode 100644 sysdeps/unix/sysv/linux/hppa/brk.c
 create mode 100644 sysdeps/unix/sysv/linux/hppa/fanotify_mark.c
 create mode 100644 sysdeps/unix/sysv/linux/hppa/prlimit64.c
 delete mode 100644 sysdeps/unix/sysv/linux/hppa/syscall.c
 delete mode 100644 sysdeps/unix/sysv/linux/hppa/syscalls.list
 delete mode 100644 sysdeps/unix/sysv/linux/i386/brk.c
 delete mode 100644 sysdeps/unix/sysv/linux/ia64/brk.S
 delete mode 100644 sysdeps/unix/sysv/linux/ia64/dl-brk.S
 delete mode 100644 sysdeps/unix/sysv/linux/ia64/pipe.S
 rename sysdeps/unix/sysv/linux/{x86_64/brk.c => ioctl.c} (63%)
 delete mode 100644 sysdeps/unix/sysv/linux/local-setxid.h
 delete mode 100644 sysdeps/unix/sysv/linux/mips/brk.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/mips32/syscalls.list
 create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n32/lseek64.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
 delete mode 100644 sysdeps/unix/sysv/linux/mips/pipe.S
 rename sysdeps/unix/sysv/linux/{sh/brk.c => mremap.c} (57%)
 rename sysdeps/unix/sysv/linux/{generic => }/pipe.c (86%)
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/dl-brk.S
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
 rename sysdeps/unix/sysv/linux/{powerpc/powerpc32/brk.S => prlimit64.c} (54%)
 delete mode 100644 sysdeps/unix/sysv/linux/s390/brk.c
 create mode 100644 sysdeps/unix/sysv/linux/sh/fanotify_mark.c
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/brk.c
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/dl-brk.S
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/personality.c
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
 rename sysdeps/unix/sysv/linux/{riscv => }/syscall.c (53%)
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/x32/lseek.S
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S
 rename sysdeps/unix/sysv/linux/{m68k/brk.c => x86_64/x32/lseek64.c} (51%)
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list

-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 01/28] Remove generic pthread linuxism on POSIX timer_routine
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 02/28] Removed ununsed pthread implementations Adhemerval Zanella
                   ` (27 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Linux already provide a full implementation, so no need to check if
__NR_rt_sigqueueinfo is defined.

No semantic changes expected.
---
 sysdeps/pthread/timer_routines.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/sysdeps/pthread/timer_routines.c b/sysdeps/pthread/timer_routines.c
index 05e83d7d52..97f9a2c50c 100644
--- a/sysdeps/pthread/timer_routines.c
+++ b/sysdeps/pthread/timer_routines.c
@@ -300,30 +300,11 @@ thread_expire_timer (struct thread_node *self, struct timer_node *timer)
       break;
 
     case SIGEV_SIGNAL:
-#ifdef __NR_rt_sigqueueinfo
-      {
-	siginfo_t info;
-
-	/* First, clear the siginfo_t structure, so that we don't pass our
-	   stack content to other tasks.  */
-	memset (&info, 0, sizeof (siginfo_t));
-	/* We must pass the information about the data in a siginfo_t
-           value.  */
-	info.si_signo = timer->event.sigev_signo;
-	info.si_code = SI_TIMER;
-	info.si_pid = timer->creator_pid;
-	info.si_uid = getuid ();
-	info.si_value = timer->event.sigev_value;
-
-	INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, info.si_signo, &info);
-      }
-#else
       if (pthread_kill (self->captured, timer->event.sigev_signo) != 0)
 	{
 	  if (pthread_kill (self->id, timer->event.sigev_signo) != 0)
 	    abort ();
         }
-#endif
       break;
 
     case SIGEV_THREAD:
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 02/28] Removed ununsed pthread implementations
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 01/28] Remove generic pthread linuxism on POSIX timer_routine Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 03/28] Remove local-setxid.h Adhemerval Zanella
                   ` (26 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

The pthread_setuid, pthread_seteuid, pthread_setreuid,
pthread_setresuid, pthread_setgid, pthread_setegid, pthread_setregid,
and pthread_setresgid are leftovers from linuxthreads.

No semantic changes expected.
---
 nptl/Makefile            | 4 ----
 nptl/pthread_setegid.c   | 3 ---
 nptl/pthread_seteuid.c   | 3 ---
 nptl/pthread_setgid.c    | 3 ---
 nptl/pthread_setregid.c  | 3 ---
 nptl/pthread_setresgid.c | 3 ---
 nptl/pthread_setresuid.c | 3 ---
 nptl/pthread_setreuid.c  | 3 ---
 nptl/pthread_setuid.c    | 3 ---
 9 files changed, 28 deletions(-)
 delete mode 100644 nptl/pthread_setegid.c
 delete mode 100644 nptl/pthread_seteuid.c
 delete mode 100644 nptl/pthread_setgid.c
 delete mode 100644 nptl/pthread_setregid.c
 delete mode 100644 nptl/pthread_setresgid.c
 delete mode 100644 nptl/pthread_setresuid.c
 delete mode 100644 nptl/pthread_setreuid.c
 delete mode 100644 nptl/pthread_setuid.c

diff --git a/nptl/Makefile b/nptl/Makefile
index 74ab758c12..90611790ef 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -170,10 +170,6 @@ libpthread-routines = nptl-init nptlfreeres vars events version pt-interp \
 		      pthread_setattr_default_np pthread_getattr_default_np \
 		      pthread_mutex_conf \
 		      libpthread-compat
-#		      pthread_setuid pthread_seteuid pthread_setreuid \
-#		      pthread_setresuid \
-#		      pthread_setgid pthread_setegid pthread_setregid \
-#		      pthread_setresgid
 
 libpthread-shared-only-routines = version pt-interp pt-allocrtsig \
 				  unwind-forcedunwind
diff --git a/nptl/pthread_setegid.c b/nptl/pthread_setegid.c
deleted file mode 100644
index 9252dfac7d..0000000000
--- a/nptl/pthread_setegid.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SINGLE_THREAD
-#define setegid pthread_setegid_np
-#include <setegid.c>
diff --git a/nptl/pthread_seteuid.c b/nptl/pthread_seteuid.c
deleted file mode 100644
index 47bb698025..0000000000
--- a/nptl/pthread_seteuid.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SINGLE_THREAD
-#define seteuid pthread_seteuid_np
-#include <seteuid.c>
diff --git a/nptl/pthread_setgid.c b/nptl/pthread_setgid.c
deleted file mode 100644
index b06bffbf32..0000000000
--- a/nptl/pthread_setgid.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SINGLE_THREAD
-#define __setgid pthread_setgid_np
-#include <setgid.c>
diff --git a/nptl/pthread_setregid.c b/nptl/pthread_setregid.c
deleted file mode 100644
index 7461d2b7fd..0000000000
--- a/nptl/pthread_setregid.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SINGLE_THREAD
-#define __setregid pthread_setregid_np
-#include <setregid.c>
diff --git a/nptl/pthread_setresgid.c b/nptl/pthread_setresgid.c
deleted file mode 100644
index 369fae2672..0000000000
--- a/nptl/pthread_setresgid.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SINGLE_THREAD
-#define __setresgid pthread_setresgid_np
-#include <setresgid.c>
diff --git a/nptl/pthread_setresuid.c b/nptl/pthread_setresuid.c
deleted file mode 100644
index ac57c0fa8d..0000000000
--- a/nptl/pthread_setresuid.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SINGLE_THREAD
-#define __setresuid pthread_setresuid_np
-#include <setresuid.c>
diff --git a/nptl/pthread_setreuid.c b/nptl/pthread_setreuid.c
deleted file mode 100644
index aa804ab01d..0000000000
--- a/nptl/pthread_setreuid.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SINGLE_THREAD
-#define __setreuid pthread_setreuid_np
-#include <setreuid.c>
diff --git a/nptl/pthread_setuid.c b/nptl/pthread_setuid.c
deleted file mode 100644
index ff949c850f..0000000000
--- a/nptl/pthread_setuid.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SINGLE_THREAD
-#define __setuid pthread_setuid_np
-#include <setuid.c>
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 03/28] Remove local-setxid.h
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 01/28] Remove generic pthread linuxism on POSIX timer_routine Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 02/28] Removed ununsed pthread implementations Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 04/28] Remove HAVE_INLINED_SYSCALLS usage on generic implementations Adhemerval Zanella
                   ` (25 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

The required Linux specific implementation is moved to internal
posix_spawn implementation.

No semantic changes expected.
---
 sysdeps/generic/local-setxid.h         |  4 ----
 sysdeps/posix/spawni.c                 |  5 ++---
 sysdeps/unix/sysv/linux/local-setxid.h | 16 ----------------
 sysdeps/unix/sysv/linux/spawni.c       | 19 ++++++++++++++++++-
 4 files changed, 20 insertions(+), 24 deletions(-)
 delete mode 100644 sysdeps/generic/local-setxid.h
 delete mode 100644 sysdeps/unix/sysv/linux/local-setxid.h

diff --git a/sysdeps/generic/local-setxid.h b/sysdeps/generic/local-setxid.h
deleted file mode 100644
index b70d9ffb32..0000000000
--- a/sysdeps/generic/local-setxid.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* No special support.  Fall back to the regular functions.  */
-
-#define local_seteuid(id) seteuid (id)
-#define local_setegid(id) setegid (id)
diff --git a/sysdeps/posix/spawni.c b/sysdeps/posix/spawni.c
index 943a598771..2dcbc1bf24 100644
--- a/sysdeps/posix/spawni.c
+++ b/sysdeps/posix/spawni.c
@@ -26,7 +26,6 @@
 #include <sys/param.h>
 #include <sys/mman.h>
 #include <not-cancel.h>
-#include <local-setxid.h>
 #include <shlib-compat.h>
 #include <nptl/pthreadP.h>
 #include <dl-sysdep.h>
@@ -139,8 +138,8 @@ __spawni_child (void *arguments)
 
   /* Set the effective user and group IDs.  */
   if ((attr->__flags & POSIX_SPAWN_RESETIDS) != 0
-      && (local_seteuid (__getuid ()) != 0
-	  || local_setegid (__getgid ())) != 0)
+      && (__seteuid (__getuid ()) != 0
+	  || __setegid (__getgid ())) != 0)
     goto fail;
 
   /* Execute the file actions.  */
diff --git a/sysdeps/unix/sysv/linux/local-setxid.h b/sysdeps/unix/sysv/linux/local-setxid.h
deleted file mode 100644
index 97d787d942..0000000000
--- a/sysdeps/unix/sysv/linux/local-setxid.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* SETxID functions which only have to change the local thread and
-   none of the possible other threads.  */
-#include <sysdep.h>
-
-#ifdef __NR_setresuid32
-# define local_seteuid(id) INLINE_SYSCALL (setresuid32, 3, -1, id, -1)
-#else
-# define local_seteuid(id) INLINE_SYSCALL (setresuid, 3, -1, id, -1)
-#endif
-
-
-#ifdef __NR_setresgid32
-# define local_setegid(id) INLINE_SYSCALL (setresgid32, 3, -1, id, -1)
-#else
-# define local_setegid(id) INLINE_SYSCALL (setresgid, 3, -1, id, -1)
-#endif
diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c
index f157bfffd2..d8623534cf 100644
--- a/sysdeps/unix/sysv/linux/spawni.c
+++ b/sysdeps/unix/sysv/linux/spawni.c
@@ -25,7 +25,6 @@
 #include <sys/param.h>
 #include <sys/mman.h>
 #include <not-cancel.h>
-#include <local-setxid.h>
 #include <shlib-compat.h>
 #include <nptl/pthreadP.h>
 #include <dl-sysdep.h>
@@ -74,6 +73,24 @@
 # define STACK(__stack, __stack_size) (__stack + __stack_size)
 #endif
 
+/* SETxID functions which only have to change the local thread and none of the
+   possible other threads.  */
+static int local_seteuid (uid_t euid)
+{
+#ifndef __NR_setresuid32
+# define __NR_setresuid32 __NR_setresuid
+#endif
+  return INLINE_SYSCALL_CALL (setresuid32, -1, euid, -1);
+}
+
+static int local_setegid (uid_t egid)
+{
+#ifndef __NR_setresgid32
+# define __NR_setresgid32 __NR_setresgid
+#endif
+  return INLINE_SYSCALL_CALL (setresgid32, -1, egid, -1);
+}
+
 
 struct posix_spawn_args
 {
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 04/28] Remove HAVE_INLINED_SYSCALLS usage on generic implementations
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (2 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 03/28] Remove local-setxid.h Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 05/28] linux: Consolidate and cleanup personality syscall Adhemerval Zanella
                   ` (24 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Checked on x86_64-linux-gnu.
---
 debug/read_chk.c     | 9 ---------
 debug/readlink_chk.c | 5 -----
 2 files changed, 14 deletions(-)

diff --git a/debug/read_chk.c b/debug/read_chk.c
index abecb0ef23..5887c58d73 100644
--- a/debug/read_chk.c
+++ b/debug/read_chk.c
@@ -17,11 +17,6 @@
 
 #include <unistd.h>
 #include <sys/param.h>
-#ifdef HAVE_INLINED_SYSCALLS
-# include <errno.h>
-# include <sysdep.h>
-#endif
-
 
 ssize_t
 __read_chk (int fd, void *buf, size_t nbytes, size_t buflen)
@@ -29,9 +24,5 @@ __read_chk (int fd, void *buf, size_t nbytes, size_t buflen)
   if (nbytes > buflen)
     __chk_fail ();
 
-#ifdef HAVE_INLINED_SYSCALLS
-  return INLINE_SYSCALL (read, 3, fd, buf, nbytes);
-#else
   return __read (fd, buf, nbytes);
-#endif
 }
diff --git a/debug/readlink_chk.c b/debug/readlink_chk.c
index 853b142b2a..ade44ee0d1 100644
--- a/debug/readlink_chk.c
+++ b/debug/readlink_chk.c
@@ -17,11 +17,6 @@
 
 #include <unistd.h>
 #include <sys/param.h>
-#ifdef HAVE_INLINED_SYSCALLS
-# include <errno.h>
-# include <sysdep.h>
-#endif
-
 
 ssize_t
 __readlink_chk (const char *path, void *buf, size_t len, size_t buflen)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 05/28] linux: Consolidate and cleanup personality syscall
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (3 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 04/28] Remove HAVE_INLINED_SYSCALLS usage on generic implementations Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 06/28] x32: Remove syscalls.list Adhemerval Zanella
                   ` (23 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

The PERSONALITY_TRUNCATE_ARGUMENT handling is also removed: Linux
currently does not define any flag larger than unsigned int and
if it is required for sparc64 (where the syscall does accept an
unsigned long) it would be better to add an arch specific
implementation.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/arm/syscalls.list     |  2 --
 sysdeps/unix/sysv/linux/hppa/syscalls.list    |  1 -
 sysdeps/unix/sysv/linux/i386/syscalls.list    |  2 --
 sysdeps/unix/sysv/linux/m68k/syscalls.list    |  1 -
 .../unix/sysv/linux/microblaze/syscalls.list  |  1 -
 .../sysv/linux/mips/mips64/n32/syscalls.list  |  2 --
 sysdeps/unix/sysv/linux/personality.c         | 24 +------------------
 .../sysv/linux/s390/s390-32/syscalls.list     |  1 -
 sysdeps/unix/sysv/linux/sh/syscalls.list      |  2 --
 .../sysv/linux/sparc/sparc64/personality.c    |  3 ---
 .../unix/sysv/linux/wordsize-64/syscalls.list |  1 -
 .../unix/sysv/linux/x86_64/x32/syscalls.list  |  1 -
 12 files changed, 1 insertion(+), 40 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/personality.c

diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 13441f7eb4..b19f26a2dd 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -19,8 +19,6 @@ prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
 
-personality	EXTRA	personality	Ei:i	__personality	personality
-
 # proper socket implementations:
 bind		-	bind		i:ipi	__bind		bind
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index cd37573b89..2a776aae27 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -13,4 +13,3 @@ socketpair	-	socketpair	i:iiif	__socketpair	socketpair
 
 prlimit64	EXTRA	prlimit64	i:iipp	__prlimit64	prlimit64@@GLIBC_2.17
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	__fanotify_mark	fanotify_mark@@GLIBC_2.19
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
index 58020dfae5..191081b949 100644
--- a/sysdeps/unix/sysv/linux/i386/syscalls.list
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -22,5 +22,3 @@ vm86		-	vm86		i:ip	__vm86		vm86@@GLIBC_2.3.4
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
-
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/m68k/syscalls.list b/sysdeps/unix/sysv/linux/m68k/syscalls.list
index 55a377b841..aba75b59e0 100644
--- a/sysdeps/unix/sysv/linux/m68k/syscalls.list
+++ b/sysdeps/unix/sysv/linux/m68k/syscalls.list
@@ -18,4 +18,3 @@ setfsuid	-	setfsuid32	Ei:i	setfsuid
 cacheflush	EXTRA	cacheflush	i:iiii	__cacheflush	cacheflush
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index 932c9cccc8..4ff1c9da7e 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -4,4 +4,3 @@ cacheflush	EXTRA	cacheflush	i:iiii	__cacheflush	cacheflush
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
index 9e6a584685..e6c511fecb 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
@@ -7,5 +7,3 @@ lseek64		-	lseek		i:iii	__lseek64	__libc_lseek64 lseek64@@GLIBC_2.2 llseek@GLIBC
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 
 fanotify_mark	EXTRA	fanotify_mark	i:iiiis	fanotify_mark
-
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/personality.c b/sysdeps/unix/sysv/linux/personality.c
index e45fffa1c2..4ab7d0ec1d 100644
--- a/sysdeps/unix/sysv/linux/personality.c
+++ b/sysdeps/unix/sysv/linux/personality.c
@@ -18,31 +18,9 @@
 #include <sys/personality.h>
 #include <sysdep.h>
 
-extern __typeof (personality) __personality;
-
 int
 __personality (unsigned long persona)
 {
-#ifdef PERSONALITY_TRUNCATE_ARGUMENT
-  /* Starting with kernel commit v2.6.21-3117-g97dc32c, the type of
-     task_struct->pesonality is "unsigned int".
-     Starting with kernel commit v2.6.35-rc1-372-g485d527, the personality
-     syscall accepts "unsigned int" instead of "long unsigned int".
-     Inbetween, a personality argument that does not fit into "unsigned int"
-     would result to system call returning -EINVAL.
-     We explicitly truncate the personality argument to "unsigned int"
-     to eliminate the uncertainty.  */
-  persona = (unsigned int) persona;
-#endif
-
-  long int ret = INTERNAL_SYSCALL_CALL (personality, persona);
-
-  /* Starting with kernel commit v2.6.29-6609-g11d06b2, the personality syscall
-     never fails.  However, 32-bit kernels might flag valid values as errors, so
-     we need to reverse the error setting.  We can't use the raw result as some
-     arches split the return/error values.  */
-  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (ret)))
-    ret = -INTERNAL_SYSCALL_ERRNO (ret);
-  return ret;
+  return INTERNAL_SYSCALL_CALL (personality, persona);
 }
 weak_alias (__personality, personality)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
index 300b13dd01..5c267744db 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
@@ -17,4 +17,3 @@ setfsuid	-	setfsuid32	Ei:i	setfsuid
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/sh/syscalls.list b/sysdeps/unix/sysv/linux/sh/syscalls.list
index 32badd1ee0..6c2d2c6535 100644
--- a/sysdeps/unix/sysv/linux/sh/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sh/syscalls.list
@@ -18,5 +18,3 @@ setfsuid	-	setfsuid32	Ei:i	setfsuid
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	__fanotify_mark	fanotify_mark@@GLIBC_2.16
-
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/personality.c b/sysdeps/unix/sysv/linux/sparc/sparc64/personality.c
deleted file mode 100644
index 250e501d91..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/personality.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Work around sign extension bug in the kernel.  */
-#define PERSONALITY_TRUNCATE_ARGUMENT
-#include <sysdeps/unix/sysv/linux/personality.c>
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 5de6ec823a..9316778dae 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -6,4 +6,3 @@ sendfile	-	sendfile	i:iipi	sendfile	sendfile64
 prlimit		EXTRA	prlimit64	i:iipp	prlimit		prlimit64
 
 fanotify_mark	EXTRA	fanotify_mark	i:iiiis	fanotify_mark
-personality	EXTRA	personality	i:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
index 58ea31d1fd..758ee988c5 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
@@ -1,4 +1,3 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-personality	EXTRA	personality	Ei:i	__personality	personality
 posix_fadvise64	-	fadvise64	Vi:iiii	posix_fadvise	posix_fadvise64
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 06/28] x32: Remove syscalls.list
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (4 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 05/28] linux: Consolidate and cleanup personality syscall Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 07/28] linux: Assume bind support Adhemerval Zanella
                   ` (22 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

It is not used anyway and generic implementation already handles it.

Checked on x86_64-linux-gnu-x32.
---
 sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list | 3 ---
 1 file changed, 3 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list

diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
deleted file mode 100644
index 758ee988c5..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
+++ /dev/null
@@ -1,3 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-posix_fadvise64	-	fadvise64	Vi:iiii	posix_fadvise	posix_fadvise64
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 07/28] linux: Assume bind support
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (5 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 06/28] x32: Remove syscalls.list Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 08/28] linux: Assume getpeername support Adhemerval Zanella
                   ` (21 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Checked with build for the affected ABI.
---
 sysdeps/unix/sysv/linux/alpha/syscalls.list          | 1 -
 sysdeps/unix/sysv/linux/arm/syscalls.list            | 1 -
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/hppa/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/ia64/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/mips/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 5 ++++-
 sysdeps/unix/sysv/linux/x86_64/syscalls.list         | 1 -
 15 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index c7cbe886ea..a4e432c50c 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -5,7 +5,6 @@ sigstack	-	sigstack	2	sigstack
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-bind		-	bind		i:ipi	__bind		bind
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index b19f26a2dd..5982889636 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -20,7 +20,6 @@ prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
 
 # proper socket implementations:
-bind		-	bind		i:ipi	__bind		bind
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index ed8b216d47..98984cf59d 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -3,7 +3,6 @@
 # Socket APIs
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-bind		-	bind		i:ipi	__bind		bind
 listen		-	listen		i:ii	__listen	listen
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 2a776aae27..0f54c50eba 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # proper socket implementations:
-bind		-	bind		i:ipi	__bind		bind
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 64202a1e84..46c5334385 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_BIND_SYSCALL               1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
@@ -35,6 +34,7 @@
 #undef __ASSUME_ACCEPT_SYSCALL
 
 #if __LINUX_KERNEL_VERSION < 0x040300
+# undef __ASSUME_BIND_SYSCALL
 # undef __ASSUME_ACCEPT4_SYSCALL
 # undef __ASSUME_SENDMSG_SYSCALL
 # undef __ASSUME_RECVMSG_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index bd39441d3c..5a77f18ada 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -3,7 +3,6 @@
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-bind		-	bind		i:ipi	__bind		bind
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index e648eecc0d..71a2631fc0 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -68,6 +68,7 @@
 /* On most architectures, most socket syscalls are supported for all
    supported kernel versions, but on some socketcall architectures
    separate syscalls were only added later.  */
+#define __ASSUME_BIND_SYSCALL           1
 #define __ASSUME_SENDMSG_SYSCALL	1
 #define __ASSUME_RECVMSG_SYSCALL	1
 #define __ASSUME_ACCEPT_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 4cdaf93e6d..06457d3761 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_BIND_SYSCALL               1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
@@ -35,6 +34,7 @@
 #undef __ASSUME_ACCEPT_SYSCALL
 
 #if __LINUX_KERNEL_VERSION < 0x040300
+# undef __ASSUME_BIND_SYSCALL
 # undef __ASSUME_ACCEPT4_SYSCALL
 # undef __ASSUME_RECVMMSG_SYSCALL
 # undef __ASSUME_SENDMMSG_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index def8408014..2facec8c4c 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
 #define __ASSUME_SOCKET_SYSCALL		1
-#define __ASSUME_BIND_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index f3621cdd51..0415d40ee8 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -12,7 +12,6 @@ sysmips		-	sysmips		i:iiii	__sysmips	sysmips
 # Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
 # it's provided for compatibility, though.
 #
-bind		-	bind		i:ipi	__bind		bind
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index a18a2ee97f..c7079a4507 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* New syscalls added for PowerPC in 2.6.37.  */
 #define __ASSUME_SOCKET_SYSCALL	1
-#define __ASSUME_BIND_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 831d0ab7d5..549ecc994d 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_BIND_SYSCALL               1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
@@ -35,6 +34,7 @@
 #undef __ASSUME_ACCEPT_SYSCALL
 
 #if __LINUX_KERNEL_VERSION < 0x040300
+# undef __ASSUME_BIND_SYSCALL
 # undef __ASSUME_ACCEPT4_SYSCALL
 # undef __ASSUME_RECVMMSG_SYSCALL
 # undef __ASSUME_SENDMMSG_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 5bac608a11..04ecd02ecd 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -24,7 +24,6 @@
 
 /* These syscalls were added for SH in 2.6.37.  */
 #define __ASSUME_SOCKET_SYSCALL		1
-#define __ASSUME_BIND_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index ea642120e9..8f7348d9ad 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -45,9 +45,12 @@
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
+#if __LINUX_KERNEL_VERSION < 0x040400
+# undef __ASSUME_BIND_SYSCALL
+#endif
+
 /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */
 #if __LINUX_KERNEL_VERSION >= 0x040400
-# define __ASSUME_BIND_SYSCALL               1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
 #endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index d46524eff3..a6a725e198 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -6,7 +6,6 @@ syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime
 
 
 # proper socket implementations:
-bind		-	bind		i:ipi	__bind		bind
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 08/28] linux: Assume getpeername support
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (6 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 07/28] linux: Assume bind support Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-19 12:55   ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 09/28] linux: Assume getsockname support Adhemerval Zanella
                   ` (20 subsequent siblings)
  28 siblings, 1 reply; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Checked with build for the affected ABI.
---
 sysdeps/unix/syscalls.list                           | 1 -
 sysdeps/unix/sysv/linux/alpha/syscalls.list          | 1 -
 sysdeps/unix/sysv/linux/arm/syscalls.list            | 1 -
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/hppa/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/ia64/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/mips/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list  | 1 -
 sysdeps/unix/sysv/linux/x86_64/syscalls.list         | 1 -
 16 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
index 7209c24110..6d1a2ad441 100644
--- a/sysdeps/unix/syscalls.list
+++ b/sysdeps/unix/syscalls.list
@@ -25,7 +25,6 @@ getgid		-	getgid		Ei:	__getgid	getgid
 getgroups	-	getgroups	i:ip	__getgroups	getgroups
 gethostid	-	gethostid	i:	gethostid
 gethostname	-	gethostname	i:bn	__gethostname	gethostname
-getpeername	-	getpeername	i:ibN	__getpeername	getpeername
 getpid		-	getpid		Ei:	__getpid	getpid
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 getrlimit	-	getrlimit	i:ip	__getrlimit	getrlimit
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index a4e432c50c..62d79edd56 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -5,7 +5,6 @@ sigstack	-	sigstack	2	sigstack
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 listen		-	listen		i:ii	__listen	listen
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 5982889636..87e6c6c88d 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -20,7 +20,6 @@ prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
 
 # proper socket implementations:
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 listen		-	listen		i:ii	__listen	listen
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 98984cf59d..3af1893c80 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -5,7 +5,6 @@ socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
 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
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 0f54c50eba..0d4e9d5e1c 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # proper socket implementations:
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 listen		-	listen		i:ii	__listen	listen
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 46c5334385..53e9890819 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -25,7 +25,6 @@
 # define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
-# define __ASSUME_GETPEERNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
@@ -41,6 +40,7 @@
 # undef __ASSUME_CONNECT_SYSCALL
 # undef __ASSUME_RECVFROM_SYSCALL
 # undef __ASSUME_SENDTO_SYSCALL
+# undef __ASSUME_GETPEERNAME_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 5a77f18ada..5bb62003d0 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -3,7 +3,6 @@
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 listen		-	listen		i:ii	__listen	listen
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 71a2631fc0..9945f4388b 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -78,6 +78,7 @@
 #define __ASSUME_ACCEPT4_SYSCALL	1
 #define __ASSUME_RECVMMSG_SYSCALL	1
 #define __ASSUME_SENDMMSG_SYSCALL	1
+#define __ASSUME_GETPEERNAME_SYSCALL    1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 06457d3761..e321895ae8 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -25,7 +25,6 @@
 # define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
-# define __ASSUME_GETPEERNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
@@ -43,6 +42,7 @@
 # undef __ASSUME_CONNECT_SYSCALL
 # undef __ASSUME_RECVFROM_SYSCALL
 # undef __ASSUME_SENDTO_SYSCALL
+# undef __ASSUME_GETPEERNAME_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 2facec8c4c..13eba077d6 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -22,7 +22,6 @@
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
-#define __ASSUME_GETPEERNAME_SYSCALL	1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index 0415d40ee8..a9dff10271 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -12,7 +12,6 @@ sysmips		-	sysmips		i:iiii	__sysmips	sysmips
 # Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
 # it's provided for compatibility, though.
 #
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 listen		-	listen		i:ii	__listen	listen
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index c7079a4507..ed7d75e0a4 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -22,7 +22,6 @@
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
-#define __ASSUME_GETPEERNAME_SYSCALL	1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 549ecc994d..7a7b22ed01 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -25,7 +25,6 @@
 # define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
-# define __ASSUME_GETPEERNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
@@ -43,6 +42,7 @@
 # undef __ASSUME_CONNECT_SYSCALL
 # undef __ASSUME_RECVFROM_SYSCALL
 # undef __ASSUME_SENDTO_SYSCALL
+# undef __ASSUME_GETPEERNAME_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 04ecd02ecd..34109ae859 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -27,7 +27,6 @@
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
-#define __ASSUME_GETPEERNAME_SYSCALL	1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
index d30d7f2b96..2acc8a1437 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
@@ -1,6 +1,5 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-getpeername	-	getpeername	3	__getpeername	getpeername
 getsockname	-	getsockname	3	__getsockname	getsockname
 getsockopt	-	getsockopt	5	__getsockopt	getsockopt
 shutdown	-	shutdown	2	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index a6a725e198..f7612e6545 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -6,7 +6,6 @@ syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime
 
 
 # proper socket implementations:
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 listen		-	listen		i:ii	__listen	listen
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 09/28] linux: Assume getsockname support
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (7 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 08/28] linux: Assume getpeername support Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-19 12:56   ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 10/28] linux: Assume getsockopt support Adhemerval Zanella
                   ` (19 subsequent siblings)
  28 siblings, 1 reply; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Checked with build for the affected ABI.
---
 sysdeps/unix/sysv/linux/alpha/syscalls.list          | 1 -
 sysdeps/unix/sysv/linux/arm/syscalls.list            | 1 -
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/hppa/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/ia64/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/mips/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 1 -
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list  | 1 -
 sysdeps/unix/sysv/linux/x86_64/syscalls.list         | 1 -
 15 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 62d79edd56..26e4070686 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -5,7 +5,6 @@ sigstack	-	sigstack	2	sigstack
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 87e6c6c88d..71e2b99cf5 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -20,7 +20,6 @@ prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
 
 # proper socket implementations:
-getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 3af1893c80..5e4b8f2e29 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -4,7 +4,6 @@
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
 listen		-	listen		i:ii	__listen	listen
-getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 0d4e9d5e1c..ec6105c655 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # proper socket implementations:
-getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 53e9890819..be1cfe94b8 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -24,7 +24,6 @@
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
-# define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
@@ -41,6 +40,7 @@
 # undef __ASSUME_RECVFROM_SYSCALL
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETPEERNAME_SYSCALL
+# undef __ASSUME_GETSOCKNAME_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 5bb62003d0..748ba3215c 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -3,7 +3,6 @@
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 9945f4388b..7266f34100 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -79,6 +79,7 @@
 #define __ASSUME_RECVMMSG_SYSCALL	1
 #define __ASSUME_SENDMMSG_SYSCALL	1
 #define __ASSUME_GETPEERNAME_SYSCALL    1
+#define __ASSUME_GETSOCKNAME_SYSCALL    1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index e321895ae8..1acdabb637 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -24,7 +24,6 @@
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
-# define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
@@ -43,6 +42,7 @@
 # undef __ASSUME_RECVFROM_SYSCALL
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETPEERNAME_SYSCALL
+# undef __ASSUME_GETSOCKNAME_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 13eba077d6..84c1b144e0 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -21,7 +21,6 @@
 #define __ASSUME_SOCKET_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
-#define __ASSUME_GETSOCKNAME_SYSCALL	1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index a9dff10271..e2a6d1ca64 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -12,7 +12,6 @@ sysmips		-	sysmips		i:iiii	__sysmips	sysmips
 # Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
 # it's provided for compatibility, though.
 #
-getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index ed7d75e0a4..40a38ebe4f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -21,7 +21,6 @@
 #define __ASSUME_SOCKET_SYSCALL	1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
-#define __ASSUME_GETSOCKNAME_SYSCALL	1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 7a7b22ed01..a3bb354246 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -24,7 +24,6 @@
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
-# define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 34109ae859..ee5b556b7b 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -26,7 +26,6 @@
 #define __ASSUME_SOCKET_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
-#define __ASSUME_GETSOCKNAME_SYSCALL	1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
index 2acc8a1437..f20a343840 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
@@ -1,6 +1,5 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-getsockname	-	getsockname	3	__getsockname	getsockname
 getsockopt	-	getsockopt	5	__getsockopt	getsockopt
 shutdown	-	shutdown	2	__shutdown	shutdown
 socketpair	-	socketpair	4	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index f7612e6545..d9cd71773d 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -6,7 +6,6 @@ syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime
 
 
 # proper socket implementations:
-getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 10/28] linux: Assume getsockopt support
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (8 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 09/28] linux: Assume getsockname support Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 11/28] linux: Assume listen support Adhemerval Zanella
                   ` (18 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Checked with build for the affected ABI.
---
 sysdeps/unix/sysv/linux/alpha/syscalls.list          | 1 -
 sysdeps/unix/sysv/linux/arm/syscalls.list            | 1 -
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/hppa/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/ia64/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/mips/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 2 +-
 sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list  | 1 -
 sysdeps/unix/sysv/linux/x86_64/syscalls.list         | 1 -
 16 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 26e4070686..6c6f53204b 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -5,7 +5,6 @@ sigstack	-	sigstack	2	sigstack
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 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/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 71e2b99cf5..3abab1ba72 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -20,7 +20,6 @@ prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
 
 # proper socket implementations:
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 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/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 5e4b8f2e29..a4862dda0e 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -5,5 +5,4 @@ socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
 listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index ec6105c655..a989e25506 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # proper socket implementations:
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 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/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index be1cfe94b8..77cb2d9442 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -22,7 +22,6 @@
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
 # define __ASSUME_LISTEN_SYSCALL             1
-# define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
@@ -41,6 +40,7 @@
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETPEERNAME_SYSCALL
 # undef __ASSUME_GETSOCKNAME_SYSCALL
+# undef __ASSUME_GETSOCKOPT_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 748ba3215c..f2b85d07a8 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -3,7 +3,6 @@
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 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/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 7266f34100..46290fe31c 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -80,6 +80,7 @@
 #define __ASSUME_SENDMMSG_SYSCALL	1
 #define __ASSUME_GETPEERNAME_SYSCALL    1
 #define __ASSUME_GETSOCKNAME_SYSCALL    1
+#define __ASSUME_GETSOCKOPT_SYSCALL     1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 1acdabb637..70b8f8ab1b 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -22,7 +22,6 @@
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
 # define __ASSUME_LISTEN_SYSCALL             1
-# define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
@@ -43,6 +42,7 @@
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETPEERNAME_SYSCALL
 # undef __ASSUME_GETSOCKNAME_SYSCALL
+# undef __ASSUME_GETSOCKOPT_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 84c1b144e0..bdad86089b 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -25,7 +25,6 @@
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 #define __ASSUME_SHUTDOWN_SYSCALL	1
-#define __ASSUME_GETSOCKOPT_SYSCALL	1
 #define __ASSUME_SETSOCKOPT_SYSCALL	1
 
 #include_next <kernel-features.h>
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index e2a6d1ca64..de49b2149d 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -12,7 +12,6 @@ sysmips		-	sysmips		i:iiii	__sysmips	sysmips
 # Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
 # it's provided for compatibility, though.
 #
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 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/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 40a38ebe4f..764db320d6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -25,7 +25,6 @@
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 #define __ASSUME_SHUTDOWN_SYSCALL	1
-#define __ASSUME_GETSOCKOPT_SYSCALL	1
 #define __ASSUME_SETSOCKOPT_SYSCALL	1
 
 /* Define this if your 32-bit syscall API requires 64-bit register
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index a3bb354246..2561329eda 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -22,7 +22,6 @@
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
 # define __ASSUME_LISTEN_SYSCALL             1
-# define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
@@ -42,6 +41,7 @@
 # undef __ASSUME_RECVFROM_SYSCALL
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETPEERNAME_SYSCALL
+# undef __ASSUME_GETSOCKOPT_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index ee5b556b7b..3aa20427d2 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -30,7 +30,6 @@
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 #define __ASSUME_SHUTDOWN_SYSCALL	1
-#define __ASSUME_GETSOCKOPT_SYSCALL	1
 #define __ASSUME_SETSOCKOPT_SYSCALL	1
 
 #include_next <kernel-features.h>
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 8f7348d9ad..dbe34face6 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -38,10 +38,10 @@
 # undef __ASSUME_CONNECT_SYSCALL
 # undef __ASSUME_RECVFROM_SYSCALL
 # undef __ASSUME_SENDTO_SYSCALL
+# undef __ASSUME_GETSOCKOPT_SYSCALL
 #else
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
index f20a343840..0f878a2f3f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
@@ -1,5 +1,4 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-getsockopt	-	getsockopt	5	__getsockopt	getsockopt
 shutdown	-	shutdown	2	__shutdown	shutdown
 socketpair	-	socketpair	4	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index d9cd71773d..c6c4bafe9b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -6,7 +6,6 @@ syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime
 
 
 # proper socket implementations:
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
 listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 11/28] linux: Assume listen support
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (9 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 10/28] linux: Assume getsockopt support Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 12/28] linux: Assume setsockopt support Adhemerval Zanella
                   ` (17 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Checked with build for the affected ABI.
---
 sysdeps/unix/sysv/linux/alpha/syscalls.list          | 1 -
 sysdeps/unix/sysv/linux/arm/syscalls.list            | 1 -
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/hppa/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/ia64/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/mips/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 2 +-
 sysdeps/unix/sysv/linux/x86_64/syscalls.list         | 1 -
 15 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 6c6f53204b..cafe9487e9 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -5,7 +5,6 @@ sigstack	-	sigstack	2	sigstack
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 3abab1ba72..8d7d7cec8c 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -20,7 +20,6 @@ prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
 
 # proper socket implementations:
-listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index a4862dda0e..db3cdcb1be 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -3,6 +3,5 @@
 # Socket APIs
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-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/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index a989e25506..de7e471117 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # proper socket implementations:
-listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 77cb2d9442..f87fe786cf 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
@@ -41,6 +40,7 @@
 # undef __ASSUME_GETPEERNAME_SYSCALL
 # undef __ASSUME_GETSOCKNAME_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
+# undef __ASSUME_LISTEN_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index f2b85d07a8..4a9cec62f5 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -3,7 +3,6 @@
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 46290fe31c..990b7ca5bd 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -81,6 +81,7 @@
 #define __ASSUME_GETPEERNAME_SYSCALL    1
 #define __ASSUME_GETSOCKNAME_SYSCALL    1
 #define __ASSUME_GETSOCKOPT_SYSCALL     1
+#define __ASSUME_LISTEN_SYSCALL         1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 70b8f8ab1b..997dc47b2a 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
@@ -43,6 +42,7 @@
 # undef __ASSUME_GETPEERNAME_SYSCALL
 # undef __ASSUME_GETSOCKNAME_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
+# undef __ASSUME_LISTEN_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index bdad86089b..3f9386d19b 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -20,7 +20,6 @@
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
 #define __ASSUME_SOCKET_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index de49b2149d..df1e2eb126 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -12,7 +12,6 @@ sysmips		-	sysmips		i:iiii	__sysmips	sysmips
 # Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
 # it's provided for compatibility, though.
 #
-listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 764db320d6..8ca8d097b7 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -20,7 +20,6 @@
 /* New syscalls added for PowerPC in 2.6.37.  */
 #define __ASSUME_SOCKET_SYSCALL	1
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 2561329eda..2a0f07a41c 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
@@ -42,6 +41,7 @@
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETPEERNAME_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
+# undef __ASSUME_LISTEN_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 3aa20427d2..19343d478a 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -25,7 +25,6 @@
 /* These syscalls were added for SH in 2.6.37.  */
 #define __ASSUME_SOCKET_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index dbe34face6..8619f4bc38 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -47,11 +47,11 @@
 
 #if __LINUX_KERNEL_VERSION < 0x040400
 # undef __ASSUME_BIND_SYSCALL
+# undef __ASSUME_LISTEN_SYSCALL
 #endif
 
 /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */
 #if __LINUX_KERNEL_VERSION >= 0x040400
-# define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index c6c4bafe9b..d583b64d6f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -6,7 +6,6 @@ syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime
 
 
 # proper socket implementations:
-listen		-	listen		i:ii	__listen	listen
 setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 12/28] linux: Assume setsockopt support
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (10 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 11/28] linux: Assume listen support Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 13/28] linux: Assume shutdown support Adhemerval Zanella
                   ` (16 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Checked with build for the affected ABI.
---
 sysdeps/unix/sysv/linux/alpha/syscalls.list          | 1 -
 sysdeps/unix/sysv/linux/arm/syscalls.list            | 1 -
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/hppa/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/ia64/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/mips/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 7 ++-----
 sysdeps/unix/sysv/linux/x86_64/syscalls.list         | 1 -
 15 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index cafe9487e9..6509fd08df 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -5,7 +5,6 @@ sigstack	-	sigstack	2	sigstack
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 8d7d7cec8c..ef2b3bbdfa 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -20,7 +20,6 @@ prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
 
 # proper socket implementations:
-setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index db3cdcb1be..9e42520f12 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -3,5 +3,4 @@
 # Socket APIs
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index de7e471117..247e1b5831 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # proper socket implementations:
-setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index f87fe786cf..ccf81a2634 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_SETSOCKOPT_SYSCALL         1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
@@ -41,6 +40,7 @@
 # undef __ASSUME_GETSOCKNAME_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
+# undef __ASSUME_SETSOCKOPT_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 4a9cec62f5..3a3cfe5d2a 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -3,7 +3,6 @@
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 990b7ca5bd..fcf42866a5 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -82,6 +82,7 @@
 #define __ASSUME_GETSOCKNAME_SYSCALL    1
 #define __ASSUME_GETSOCKOPT_SYSCALL     1
 #define __ASSUME_LISTEN_SYSCALL         1
+#define __ASSUME_SETSOCKOPT_SYSCALL     1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 997dc47b2a..0db2aa8592 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_SETSOCKOPT_SYSCALL         1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
@@ -43,6 +42,7 @@
 # undef __ASSUME_GETSOCKNAME_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
+# undef __ASSUME_SETSOCKOPT_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 3f9386d19b..30aa9e7550 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -24,7 +24,6 @@
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 #define __ASSUME_SHUTDOWN_SYSCALL	1
-#define __ASSUME_SETSOCKOPT_SYSCALL	1
 
 #include_next <kernel-features.h>
 
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index df1e2eb126..2d7a83d22f 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -12,7 +12,6 @@ sysmips		-	sysmips		i:iiii	__sysmips	sysmips
 # Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
 # it's provided for compatibility, though.
 #
-setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 8ca8d097b7..f6d4135358 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -24,7 +24,6 @@
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 #define __ASSUME_SHUTDOWN_SYSCALL	1
-#define __ASSUME_SETSOCKOPT_SYSCALL	1
 
 /* Define this if your 32-bit syscall API requires 64-bit register
    pairs to start with an even-number register.  */
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 2a0f07a41c..0dfe56e536 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_SETSOCKOPT_SYSCALL         1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
@@ -42,6 +41,7 @@
 # undef __ASSUME_GETPEERNAME_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
+# undef __ASSUME_SETSOCKOPT_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 19343d478a..b36000df4c 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -29,7 +29,6 @@
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 #define __ASSUME_SHUTDOWN_SYSCALL	1
-#define __ASSUME_SETSOCKOPT_SYSCALL	1
 
 #include_next <kernel-features.h>
 
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 8619f4bc38..430d6503cb 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -45,14 +45,11 @@
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
+/* These syscalls were added for both 32-bit and 64-bit in 4.4.  */
 #if __LINUX_KERNEL_VERSION < 0x040400
 # undef __ASSUME_BIND_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
-#endif
-
-/* These syscalls were added for both 32-bit and 64-bit in 4.4.  */
-#if __LINUX_KERNEL_VERSION >= 0x040400
-# define __ASSUME_SETSOCKOPT_SYSCALL         1
+# undef __ASSUME_SETSOCKOPT_SYSCALL
 #endif
 
 #ifdef __arch64__
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index d583b64d6f..8463099365 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -6,7 +6,6 @@ syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime
 
 
 # proper socket implementations:
-setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 13/28] linux: Assume shutdown support
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (11 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 12/28] linux: Assume setsockopt support Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 14/28] linux: Assume socket support Adhemerval Zanella
                   ` (15 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Checked with build for the affected ABI.
---
 sysdeps/unix/sysv/linux/alpha/syscalls.list          | 1 -
 sysdeps/unix/sysv/linux/arm/syscalls.list            | 1 -
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/hppa/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/ia64/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/mips/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 2 +-
 sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list  | 1 -
 sysdeps/unix/sysv/linux/x86_64/syscalls.list         | 1 -
 16 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 6509fd08df..419cf54427 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -5,7 +5,6 @@ sigstack	-	sigstack	2	sigstack
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
 
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index ef2b3bbdfa..dce1f1ae95 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -20,6 +20,5 @@ prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
 
 # proper socket implementations:
-shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 9e42520f12..bcae3bc0d1 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -3,4 +3,3 @@
 # Socket APIs
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 247e1b5831..ab08a76d0c 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # proper socket implementations:
-shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
 
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index ccf81a2634..164d683713 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
 #include_next <kernel-features.h>
@@ -41,6 +40,7 @@
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
+# undef __ASSUME_SHUTDOWN_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 3a3cfe5d2a..b5ad98aaae 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -3,7 +3,6 @@
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
 
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index fcf42866a5..04058111b8 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -83,6 +83,7 @@
 #define __ASSUME_GETSOCKOPT_SYSCALL     1
 #define __ASSUME_LISTEN_SYSCALL         1
 #define __ASSUME_SETSOCKOPT_SYSCALL     1
+#define __ASSUME_SHUTDOWN_SYSCALL       1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 0db2aa8592..b119443ba6 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
 #include_next <kernel-features.h>
@@ -43,6 +42,7 @@
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
+# undef __ASSUME_SHUTDOWN_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 30aa9e7550..a2aaa82c4b 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -23,7 +23,6 @@
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
-#define __ASSUME_SHUTDOWN_SYSCALL	1
 
 #include_next <kernel-features.h>
 
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index 2d7a83d22f..fefe2f16ee 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -12,6 +12,5 @@ sysmips		-	sysmips		i:iiii	__sysmips	sysmips
 # Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
 # it's provided for compatibility, though.
 #
-shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index f6d4135358..a748d44abc 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -23,7 +23,6 @@
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
-#define __ASSUME_SHUTDOWN_SYSCALL	1
 
 /* Define this if your 32-bit syscall API requires 64-bit register
    pairs to start with an even-number register.  */
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 0dfe56e536..619bc3f0d2 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
 #include_next <kernel-features.h>
@@ -42,6 +41,7 @@
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
+# undef __ASSUME_SHUTDOWN_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index b36000df4c..e42c71a84a 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -28,7 +28,6 @@
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
-#define __ASSUME_SHUTDOWN_SYSCALL	1
 
 #include_next <kernel-features.h>
 
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 430d6503cb..acca2a09bc 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -39,10 +39,10 @@
 # undef __ASSUME_RECVFROM_SYSCALL
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
+# undef __ASSUME_SHUTDOWN_SYSCALL
 #else
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
 /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
index 0f878a2f3f..94c081f804 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
@@ -1,4 +1,3 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-shutdown	-	shutdown	2	__shutdown	shutdown
 socketpair	-	socketpair	4	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 8463099365..cb2939ed74 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -6,6 +6,5 @@ syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime
 
 
 # proper socket implementations:
-shutdown	-	shutdown	i:ii	__shutdown	shutdown
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 14/28] linux: Assume socket support
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (12 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 13/28] linux: Assume shutdown support Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 15/28] linux: Assume socketpair support Adhemerval Zanella
                   ` (14 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Checked with build for the affected ABI.
---
 sysdeps/unix/sysv/linux/alpha/syscalls.list          | 1 -
 sysdeps/unix/sysv/linux/arm/syscalls.list            | 1 -
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/hppa/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/ia64/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/mips/syscalls.list           | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 2 +-
 sysdeps/unix/sysv/linux/x86_64/syscalls.list         | 1 -
 15 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 419cf54427..b35f5fc199 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -5,7 +5,6 @@ sigstack	-	sigstack	2	sigstack
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
 
 ptrace		-	ptrace		4	__ptrace	ptrace
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index dce1f1ae95..1dec4bcfdd 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -20,5 +20,4 @@ prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
 
 # proper socket implementations:
-socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index bcae3bc0d1..0749707049 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,5 +1,4 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # Socket APIs
-socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index ab08a76d0c..4a159a4da5 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # proper socket implementations:
-socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
 
 prlimit64	EXTRA	prlimit64	i:iipp	__prlimit64	prlimit64@@GLIBC_2.17
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 164d683713..e15db22472 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
 #endif
 
@@ -41,6 +40,7 @@
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
+# undef __ASSUME_SOCKET_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index b5ad98aaae..33cc01b64a 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -3,7 +3,6 @@
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # proper socket implementations:
-socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
 
 # DIG-compliant access to PCI configuration space:
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 04058111b8..6d5658c680 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -84,6 +84,7 @@
 #define __ASSUME_LISTEN_SYSCALL         1
 #define __ASSUME_SETSOCKOPT_SYSCALL     1
 #define __ASSUME_SHUTDOWN_SYSCALL       1
+#define __ASSUME_SOCKET_SYSCALL         1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index b119443ba6..b9371c36b0 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
 #endif
 
@@ -43,6 +42,7 @@
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
+# undef __ASSUME_SOCKET_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index a2aaa82c4b..3082a05426 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -18,7 +18,6 @@
 #include <endian.h>
 
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
-#define __ASSUME_SOCKET_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index fefe2f16ee..9881c832a5 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -12,5 +12,4 @@ sysmips		-	sysmips		i:iiii	__sysmips	sysmips
 # Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
 # it's provided for compatibility, though.
 #
-socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index a748d44abc..e50a0a5069 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -18,7 +18,6 @@
    <https://www.gnu.org/licenses/>.  */
 
 /* New syscalls added for PowerPC in 2.6.37.  */
-#define __ASSUME_SOCKET_SYSCALL	1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 619bc3f0d2..a74f8af97d 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
 #endif
 
@@ -42,6 +41,7 @@
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
+# undef __ASSUME_SOCKET_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index e42c71a84a..9aecddc1b3 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -23,7 +23,6 @@
 #include <endian.h>
 
 /* These syscalls were added for SH in 2.6.37.  */
-#define __ASSUME_SOCKET_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index acca2a09bc..54e79852e6 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -40,8 +40,8 @@
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
+# undef __ASSUME_SOCKET_SYSCALL
 #else
-# define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index cb2939ed74..447f653cc0 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -6,5 +6,4 @@ syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime
 
 
 # proper socket implementations:
-socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 15/28] linux: Assume socketpair support
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (13 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 14/28] linux: Assume socket support Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 16/28] linux: Remove superflous __ASSUME_CONNECT_SYSCALL definitions Adhemerval Zanella
                   ` (13 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Checked with build for the affected ABI.
---
 sysdeps/unix/sysv/linux/alpha/syscalls.list          | 3 ---
 sysdeps/unix/sysv/linux/arm/syscalls.list            | 3 ---
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 4 ----
 sysdeps/unix/sysv/linux/hppa/syscalls.list           | 3 ---
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 7 ++-----
 sysdeps/unix/sysv/linux/ia64/syscalls.list           | 3 ---
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 7 ++-----
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/mips/syscalls.list           | 6 ------
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 7 ++-----
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 3 +--
 sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list  | 3 ---
 sysdeps/unix/sysv/linux/x86_64/syscalls.list         | 4 ----
 16 files changed, 8 insertions(+), 49 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/generic/syscalls.list
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list

diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index b35f5fc199..6e06255d3c 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -4,9 +4,6 @@ sigstack	-	sigstack	2	sigstack
 
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
-# proper socket implementations:
-socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-
 ptrace		-	ptrace		4	__ptrace	ptrace
 
 # access pci space protected from machine checks:
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 1dec4bcfdd..742ed64ec9 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -18,6 +18,3 @@ setfsuid	-	setfsuid32	Ei:i	setfsuid
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
-
-# proper socket implementations:
-socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
deleted file mode 100644
index 0749707049..0000000000
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ /dev/null
@@ -1,4 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-# Socket APIs
-socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 4a159a4da5..11fada447c 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,4 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-# proper socket implementations:
-socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-
 prlimit64	EXTRA	prlimit64	i:iipp	__prlimit64	prlimit64@@GLIBC_2.17
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	__fanotify_mark	fanotify_mark@@GLIBC_2.19
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index e15db22472..176552766e 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -17,15 +17,11 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* Direct socketcalls available with kernel 4.3.  */
-#if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SOCKETPAIR_SYSCALL         1
-#endif
-
 #include_next <kernel-features.h>
 
 #undef __ASSUME_ACCEPT_SYSCALL
 
+/* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION < 0x040300
 # undef __ASSUME_BIND_SYSCALL
 # undef __ASSUME_ACCEPT4_SYSCALL
@@ -41,6 +37,7 @@
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
 # undef __ASSUME_SOCKET_SYSCALL
+# undef __ASSUME_SOCKETPAIR_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 33cc01b64a..e468da4816 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -2,9 +2,6 @@
 
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
-# proper socket implementations:
-socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-
 # DIG-compliant access to PCI configuration space:
 pciconfig_read	EXTRA	pciconfig_read	5	pciconfig_read
 pciconfig_write	EXTRA	pciconfig_write	5	pciconfig_write
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 6d5658c680..b7c1996943 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -85,6 +85,7 @@
 #define __ASSUME_SETSOCKOPT_SYSCALL     1
 #define __ASSUME_SHUTDOWN_SYSCALL       1
 #define __ASSUME_SOCKET_SYSCALL         1
+#define __ASSUME_SOCKETPAIR_SYSCALL     1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index b9371c36b0..ed7954f09a 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -17,15 +17,11 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* Direct socketcalls available with kernel 4.3.  */
-#if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SOCKETPAIR_SYSCALL         1
-#endif
-
 #include_next <kernel-features.h>
 
 #undef __ASSUME_ACCEPT_SYSCALL
 
+/* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION < 0x040300
 # undef __ASSUME_BIND_SYSCALL
 # undef __ASSUME_ACCEPT4_SYSCALL
@@ -43,6 +39,7 @@
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
 # undef __ASSUME_SOCKET_SYSCALL
+# undef __ASSUME_SOCKETPAIR_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 3082a05426..ede5e8d359 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index 9881c832a5..4b72434b57 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -7,9 +7,3 @@
 cachectl	-	cachectl	i:pii	__cachectl	cachectl
 cacheflush	-	cacheflush	i:pii	_flush_cache	cacheflush
 sysmips		-	sysmips		i:iiii	__sysmips	sysmips
-
-#
-# Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
-# it's provided for compatibility, though.
-#
-socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index e50a0a5069..7397a844cf 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* New syscalls added for PowerPC in 2.6.37.  */
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index a74f8af97d..2b3e162ad7 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -17,15 +17,11 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* Direct socketcalls available with kernel 4.3.  */
-#if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SOCKETPAIR_SYSCALL         1
-#endif
-
 #include_next <kernel-features.h>
 
 #undef __ASSUME_ACCEPT_SYSCALL
 
+/* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION < 0x040300
 # undef __ASSUME_BIND_SYSCALL
 # undef __ASSUME_ACCEPT4_SYSCALL
@@ -42,6 +38,7 @@
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
 # undef __ASSUME_SOCKET_SYSCALL
+# undef __ASSUME_SOCKETPAIR_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 9aecddc1b3..ae0e3be10d 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -24,7 +24,6 @@
 
 /* These syscalls were added for SH in 2.6.37.  */
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 54e79852e6..3ebd4cea85 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -41,8 +41,7 @@
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
 # undef __ASSUME_SOCKET_SYSCALL
-#else
-# define __ASSUME_SOCKETPAIR_SYSCALL         1
+# undef __ASSUME_SOCKETPAIR_SYSCALL
 #endif
 
 /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
deleted file mode 100644
index 94c081f804..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
+++ /dev/null
@@ -1,3 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-socketpair	-	socketpair	4	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 447f653cc0..2f7047be42 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -3,7 +3,3 @@
 arch_prctl	EXTRA	arch_prctl	i:ii	__arch_prctl	arch_prctl
 modify_ldt	EXTRA	modify_ldt	i:ipi	__modify_ldt	modify_ldt
 syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime
-
-
-# proper socket implementations:
-socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 16/28] linux: Remove superflous __ASSUME_CONNECT_SYSCALL definitions
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (14 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 15/28] linux: Assume socketpair support Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 17/28] x86_64: Remove ununsed syscalls.list entry Adhemerval Zanella
                   ` (12 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

They are already set in Linux generic kernel-features.h.

Checked with build for the affected ABI.
---
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 3 files changed, 3 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index ede5e8d359..583f8e3ca5 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -18,7 +18,6 @@
 #include <endian.h>
 
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
-#define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 7397a844cf..269667b3d8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -18,7 +18,6 @@
    <https://www.gnu.org/licenses/>.  */
 
 /* New syscalls added for PowerPC in 2.6.37.  */
-#define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index ae0e3be10d..ead988b54f 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -23,7 +23,6 @@
 #include <endian.h>
 
 /* These syscalls were added for SH in 2.6.37.  */
-#define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 17/28] x86_64: Remove ununsed syscalls.list entry
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (15 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 16/28] linux: Remove superflous __ASSUME_CONNECT_SYSCALL definitions Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 18/28] nptl: Add futex_trylock_pi Adhemerval Zanella
                   ` (11 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Its definition is not used anymore.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 2f7047be42..c04902db23 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -2,4 +2,3 @@
 
 arch_prctl	EXTRA	arch_prctl	i:ii	__arch_prctl	arch_prctl
 modify_ldt	EXTRA	modify_ldt	i:ipi	__modify_ldt	modify_ldt
-syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 18/28] nptl: Add futex_trylock_pi
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (16 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 17/28] x86_64: Remove ununsed syscalls.list entry Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 19/28] linux: Add fanotify_mark C implementation Adhemerval Zanella
                   ` (10 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

This is similar to other futex wrappers on futex-internal.

Checked on x86_64-linux-gnu.
---
 nptl/pthread_mutex_trylock.c      |  9 +++-----
 sysdeps/nptl/futex-internal.h     | 36 +++++++++++++++++++++++++++++++
 sysdeps/nptl/lowlevellock-futex.h |  5 +++++
 3 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c
index 2130f52529..be9d9a3bac 100644
--- a/nptl/pthread_mutex_trylock.c
+++ b/nptl/pthread_mutex_trylock.c
@@ -297,12 +297,9 @@ __pthread_mutex_trylock (pthread_mutex_t *mutex)
 	    int private = (robust
 			   ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
 			   : PTHREAD_MUTEX_PSHARED (mutex));
-	    int e = INTERNAL_SYSCALL_CALL (futex, &mutex->__data.__lock,
-					   __lll_private_flag (FUTEX_TRYLOCK_PI,
-							       private), 0, 0);
-
-	    if (INTERNAL_SYSCALL_ERROR_P (e)
-		&& INTERNAL_SYSCALL_ERRNO (e) == EWOULDBLOCK)
+	    if (futex_trylock_pi ((unsigned int *) &mutex->__data.__lock,
+				  private)
+		== -EWOULDBLOCK)
 	      {
 		/* The kernel has not yet finished the mutex owner death.
 		   We do not need to ensure ordering wrt another memory
diff --git a/sysdeps/nptl/futex-internal.h b/sysdeps/nptl/futex-internal.h
index c27d0cdac8..3cda6c5762 100644
--- a/sysdeps/nptl/futex-internal.h
+++ b/sysdeps/nptl/futex-internal.h
@@ -483,6 +483,42 @@ futex_lock_pi64 (int *futex_word, const struct __timespec64 *abstime,
     }
 }
 
+/* This operaration is similar to futex_lock_pi and it is used when the lock
+   information contains stale state (FUTEX_WAITERS and/or FUTEX_OWNER_DIED).
+   User space can not handle this condition in a race-free manner, but kernel
+   might handle it and acquire the futex.
+
+   Returns:
+
+     - 0 if woken by a PI unlock operation or spuriously.
+     - EAGAIN if the futex owner thread ID is about to exit, but has not yet
+       handled the state cleanup.
+     - EDEADLK if the futex is already locked by the caller.
+     - ESRCH if the thread ID int he futex does not exist.
+     - EINVAL is the state is corrupted or if there is a waiter on the
+       futex.
+*/
+static __always_inline int
+futex_trylock_pi (unsigned int *futex_word, int private)
+{
+  int err = lll_futex_trylock_pi ((int *) futex_word, private);
+  switch (err)
+    {
+    case 0:
+    case -EAGAIN: /* EWOULDBLOCK  */
+    case -EINTR:
+    case -ESRCH:
+    case -EDEADLK:
+    case -EPERM:
+      return -err;
+
+    case -EINVAL:
+    case -EFAULT:
+    default:
+      futex_fatal_error ();
+    }
+}
+
 /* Wakes the top priority waiter that called a futex_lock_pi operation on
    the futex.
 
diff --git a/sysdeps/nptl/lowlevellock-futex.h b/sysdeps/nptl/lowlevellock-futex.h
index 2209ca76a1..0440aeb390 100644
--- a/sysdeps/nptl/lowlevellock-futex.h
+++ b/sysdeps/nptl/lowlevellock-futex.h
@@ -144,6 +144,11 @@
 		     __lll_private_flag (FUTEX_LOCK_PI, private),	\
 		     0, abstime)
 
+#define lll_futex_trylock_pi(futexp, private)				\
+  lll_futex_syscall (4, futexp,						\
+		     __lll_private_flag (FUTEX_TRYLOCK_PI, private),	\
+		     0, 0)
+
 #define lll_futex_timed_unlock_pi(futexp, private) 			\
   lll_futex_syscall (4, futexp,						\
 		     __lll_private_flag (FUTEX_UNLOCK_PI, private),	\
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 19/28] linux: Add fanotify_mark C implementation
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (17 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 18/28] nptl: Add futex_trylock_pi Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 20/28] linux: Add prlimit64 " Adhemerval Zanella
                   ` (9 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Passing 64-bit arguments on syscalls.list is tricky: it requires
to reimplement the expected kernel abi in each architecture.  This
is way to better to represent in C code where we already have
macros for this (SYSCALL_LL64).

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/Makefile              |  2 +-
 sysdeps/unix/sysv/linux/arm/syscalls.list     |  2 --
 sysdeps/unix/sysv/linux/fanotify_mark.c       | 36 +++++++++++++++++++
 .../linux/generic/wordsize-32/syscalls.list   |  1 -
 sysdeps/unix/sysv/linux/hppa/fanotify_mark.c  |  2 ++
 sysdeps/unix/sysv/linux/hppa/syscalls.list    |  1 -
 sysdeps/unix/sysv/linux/i386/syscalls.list    |  2 --
 sysdeps/unix/sysv/linux/m68k/syscalls.list    |  1 -
 .../unix/sysv/linux/microblaze/syscalls.list  |  1 -
 .../unix/sysv/linux/mips/mips32/syscalls.list |  2 --
 .../sysv/linux/mips/mips64/n32/syscalls.list  |  2 --
 .../sysv/linux/mips/mips64/n64/syscalls.list  |  2 --
 .../linux/powerpc/powerpc32/syscalls.list     |  1 -
 .../sysv/linux/s390/s390-32/syscalls.list     |  1 -
 sysdeps/unix/sysv/linux/sh/fanotify_mark.c    |  2 ++
 sysdeps/unix/sysv/linux/sh/syscalls.list      |  2 --
 .../sysv/linux/sparc/sparc32/syscalls.list    |  1 -
 .../unix/sysv/linux/wordsize-64/syscalls.list |  2 --
 18 files changed, 41 insertions(+), 22 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/fanotify_mark.c
 create mode 100644 sysdeps/unix/sysv/linux/hppa/fanotify_mark.c
 create mode 100644 sysdeps/unix/sysv/linux/sh/fanotify_mark.c

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 09604e128b..71bb4cbddd 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -61,7 +61,7 @@ sysdep_routines += adjtimex clone umount umount2 readahead sysctl \
 		   open_by_handle_at mlock2 pkey_mprotect pkey_set pkey_get \
 		   timerfd_gettime timerfd_settime prctl \
 		   process_vm_readv process_vm_writev clock_adjtime \
-		   time64-support pselect32
+		   time64-support pselect32 fanotify_mark
 
 CFLAGS-gethostid.c = -fexceptions
 CFLAGS-tee.c = -fexceptions -fasynchronous-unwind-tables
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 742ed64ec9..ef35963e82 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -16,5 +16,3 @@ setfsgid	-	setfsgid32	Ei:i	setfsgid
 setfsuid	-	setfsuid32	Ei:i	setfsuid
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/fanotify_mark.c b/sysdeps/unix/sysv/linux/fanotify_mark.c
new file mode 100644
index 0000000000..6f8fd2e9cf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/fanotify_mark.c
@@ -0,0 +1,36 @@
+/* Add, remove, or modify an fanotify mark on a filesystem object.
+   Linux specific syscall.
+   Copyright (C) 2020 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 <sys/fanotify.h>
+#include <sysdep.h>
+
+int
+__fanotify_mark (int fd, unsigned int flags, uint64_t mask, int dirfd,
+	         const char *pathname)
+{
+  return INLINE_SYSCALL_CALL (fanotify_mark, fd, flags, SYSCALL_LL64 (mask),
+			      dirfd, pathname);
+}
+#ifdef VERSION_fanotify_mark
+# include <shlib-compat.h>
+versioned_symbol (libc, __fanotify_mark, fanotify_mark,
+		  VERSION_fanotify_mark);
+#else
+weak_alias (__fanotify_mark, fanotify_mark)
+#endif
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list b/sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list
index b775008a37..736edbe654 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list
@@ -2,4 +2,3 @@
 
 # rlimit APIs
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/hppa/fanotify_mark.c b/sysdeps/unix/sysv/linux/hppa/fanotify_mark.c
new file mode 100644
index 0000000000..ce347a4261
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/hppa/fanotify_mark.c
@@ -0,0 +1,2 @@
+#define VERSION_fanotify_mark GLIBC_2_19
+#include <sysdeps/unix/sysv/linux/fanotify_mark.c>
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 11fada447c..a20bdc7726 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,4 +1,3 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 prlimit64	EXTRA	prlimit64	i:iipp	__prlimit64	prlimit64@@GLIBC_2.17
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	__fanotify_mark	fanotify_mark@@GLIBC_2.19
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
index 191081b949..a20d6ebf24 100644
--- a/sysdeps/unix/sysv/linux/i386/syscalls.list
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -20,5 +20,3 @@ vm86old		EXTRA	vm86old		i:p	__vm86old	vm86@GLIBC_2.0
 vm86		-	vm86		i:ip	__vm86		vm86@@GLIBC_2.3.4
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/m68k/syscalls.list b/sysdeps/unix/sysv/linux/m68k/syscalls.list
index aba75b59e0..e28ccc2c45 100644
--- a/sysdeps/unix/sysv/linux/m68k/syscalls.list
+++ b/sysdeps/unix/sysv/linux/m68k/syscalls.list
@@ -17,4 +17,3 @@ setfsuid	-	setfsuid32	Ei:i	setfsuid
 
 cacheflush	EXTRA	cacheflush	i:iiii	__cacheflush	cacheflush
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index 4ff1c9da7e..f479ef0826 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -3,4 +3,3 @@
 cacheflush	EXTRA	cacheflush	i:iiii	__cacheflush	cacheflush
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips32/syscalls.list
index f357b5c918..dbeb184d73 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips32/syscalls.list
@@ -1,5 +1,3 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
index e6c511fecb..6135436182 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
@@ -5,5 +5,3 @@
 lseek64		-	lseek		i:iii	__lseek64	__libc_lseek64 lseek64@@GLIBC_2.2 llseek@GLIBC_2.0:GLIBC_2.28
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-
-fanotify_mark	EXTRA	fanotify_mark	i:iiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
index 8e7d516a2a..ecf9d80ed4 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
@@ -2,8 +2,6 @@
 
 prlimit		EXTRA	prlimit64	i:iipp	prlimit		prlimit64
 
-fanotify_mark	EXTRA	fanotify_mark	i:iiiis	fanotify_mark
-
 fstatfs		-	fstatfs		i:ip	__fstatfs	fstatfs fstatfs64 __fstatfs64
 statfs		-	statfs		i:sp	__statfs	statfs statfs64 __statfs64
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
index 966856e64a..d31303250d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
@@ -4,4 +4,3 @@ chown		-	chown		i:sii	__chown		chown@@GLIBC_2.1
 lchown		-	lchown		i:sii	__lchown	lchown@@GLIBC_2.0 chown@GLIBC_2.0
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
index 5c267744db..1c565e9ba5 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
@@ -16,4 +16,3 @@ setfsgid	-	setfsgid32	Ei:i	setfsgid
 setfsuid	-	setfsuid32	Ei:i	setfsuid
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/sh/fanotify_mark.c b/sysdeps/unix/sysv/linux/sh/fanotify_mark.c
new file mode 100644
index 0000000000..3662f21b60
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/fanotify_mark.c
@@ -0,0 +1,2 @@
+#define VERSION_fanotify_mark GLIBC_2_16
+#include <sysdeps/unix/sysv/linux/fanotify_mark.c>
diff --git a/sysdeps/unix/sysv/linux/sh/syscalls.list b/sysdeps/unix/sysv/linux/sh/syscalls.list
index 6c2d2c6535..ef35963e82 100644
--- a/sysdeps/unix/sysv/linux/sh/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sh/syscalls.list
@@ -16,5 +16,3 @@ setfsgid	-	setfsgid32	Ei:i	setfsgid
 setfsuid	-	setfsuid32	Ei:i	setfsuid
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	__fanotify_mark	fanotify_mark@@GLIBC_2.16
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
index 0b6095ffab..4fcae65451 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
@@ -16,4 +16,3 @@ setfsgid	-	setfsgid32	Ei:i	setfsgid
 setfsuid	-	setfsuid32	Ei:i	setfsuid
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 9316778dae..0404a1c0d7 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -4,5 +4,3 @@ fstatfs		-	fstatfs		i:ip	__fstatfs	fstatfs fstatfs64 __fstatfs64
 statfs		-	statfs		i:sp	__statfs	statfs statfs64
 sendfile	-	sendfile	i:iipi	sendfile	sendfile64
 prlimit		EXTRA	prlimit64	i:iipp	prlimit		prlimit64
-
-fanotify_mark	EXTRA	fanotify_mark	i:iiiis	fanotify_mark
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 20/28] linux: Add prlimit64 C implementation
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (18 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 19/28] linux: Add fanotify_mark C implementation Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 21/28] linux: Implement mremap in C Adhemerval Zanella
                   ` (8 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

The LFS prlimit64 requires a arch-specific implementation in
syscalls.list.  Instead add a generic one that handles the
required symbol alias for __RLIM_T_MATCHES_RLIM64_T.

HPPA is the only outlier which requires a different default
symbol.

Checked on x86_64-linux-gnu and with build for the affected ABIs.
---
 sysdeps/unix/sysv/linux/Makefile              |  2 +-
 sysdeps/unix/sysv/linux/arm/syscalls.list     |  2 -
 .../linux/generic/wordsize-32/syscalls.list   |  4 --
 sysdeps/unix/sysv/linux/hppa/prlimit64.c      |  2 +
 sysdeps/unix/sysv/linux/hppa/syscalls.list    |  3 --
 sysdeps/unix/sysv/linux/i386/syscalls.list    |  2 -
 sysdeps/unix/sysv/linux/m68k/syscalls.list    |  1 -
 .../unix/sysv/linux/microblaze/syscalls.list  |  2 -
 .../unix/sysv/linux/mips/mips32/syscalls.list |  3 --
 .../sysv/linux/mips/mips64/n32/syscalls.list  |  2 -
 .../sysv/linux/mips/mips64/n64/syscalls.list  |  2 -
 .../linux/powerpc/powerpc32/syscalls.list     |  2 -
 sysdeps/unix/sysv/linux/prlimit.c             |  2 +
 sysdeps/unix/sysv/linux/prlimit64.c           | 39 +++++++++++++++++++
 .../sysv/linux/s390/s390-32/syscalls.list     |  2 -
 sysdeps/unix/sysv/linux/sh/syscalls.list      |  2 -
 .../sysv/linux/sparc/sparc32/syscalls.list    |  2 -
 .../unix/sysv/linux/wordsize-64/syscalls.list |  1 -
 18 files changed, 44 insertions(+), 31 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list
 create mode 100644 sysdeps/unix/sysv/linux/hppa/prlimit64.c
 delete mode 100644 sysdeps/unix/sysv/linux/hppa/syscalls.list
 delete mode 100644 sysdeps/unix/sysv/linux/mips/mips32/syscalls.list
 create mode 100644 sysdeps/unix/sysv/linux/prlimit64.c

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 71bb4cbddd..c3b24f9332 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -56,7 +56,7 @@ endif
 ifeq ($(subdir),misc)
 sysdep_routines += adjtimex clone umount umount2 readahead sysctl \
 		   setfsuid setfsgid epoll_pwait signalfd \
-		   eventfd eventfd_read eventfd_write prlimit \
+		   eventfd eventfd_read eventfd_write prlimit prlimit64 \
 		   personality epoll_wait tee vmsplice splice \
 		   open_by_handle_at mlock2 pkey_mprotect pkey_set pkey_get \
 		   timerfd_gettime timerfd_settime prctl \
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index ef35963e82..8340745c86 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -14,5 +14,3 @@ getgroups	-	getgroups32	i:ip	__getgroups	getgroups
 
 setfsgid	-	setfsgid32	Ei:i	setfsgid
 setfsuid	-	setfsuid32	Ei:i	setfsuid
-
-prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list b/sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list
deleted file mode 100644
index 736edbe654..0000000000
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list
+++ /dev/null
@@ -1,4 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-# rlimit APIs
-prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
diff --git a/sysdeps/unix/sysv/linux/hppa/prlimit64.c b/sysdeps/unix/sysv/linux/hppa/prlimit64.c
new file mode 100644
index 0000000000..4554c81dd9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/hppa/prlimit64.c
@@ -0,0 +1,2 @@
+#define VERSION_prlimit64 GLIBC_2_17
+#include <sysdeps/unix/sysv/linux/prlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
deleted file mode 100644
index a20bdc7726..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ /dev/null
@@ -1,3 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-prlimit64	EXTRA	prlimit64	i:iipp	__prlimit64	prlimit64@@GLIBC_2.17
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
index a20d6ebf24..24412aabbc 100644
--- a/sysdeps/unix/sysv/linux/i386/syscalls.list
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -18,5 +18,3 @@ setfsuid	-	setfsuid32	Ei:i	setfsuid
 modify_ldt	EXTRA	modify_ldt	i:ipi	__modify_ldt	modify_ldt
 vm86old		EXTRA	vm86old		i:p	__vm86old	vm86@GLIBC_2.0
 vm86		-	vm86		i:ip	__vm86		vm86@@GLIBC_2.3.4
-
-prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
diff --git a/sysdeps/unix/sysv/linux/m68k/syscalls.list b/sysdeps/unix/sysv/linux/m68k/syscalls.list
index e28ccc2c45..e1e964dd1c 100644
--- a/sysdeps/unix/sysv/linux/m68k/syscalls.list
+++ b/sysdeps/unix/sysv/linux/m68k/syscalls.list
@@ -16,4 +16,3 @@ setfsgid	-	setfsgid32	Ei:i	setfsgid
 setfsuid	-	setfsuid32	Ei:i	setfsuid
 
 cacheflush	EXTRA	cacheflush	i:iiii	__cacheflush	cacheflush
-prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index f479ef0826..5367ef0d0b 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -1,5 +1,3 @@
 # File name	Caller	Syscall name	Args	Strong name	Weak names
 
 cacheflush	EXTRA	cacheflush	i:iiii	__cacheflush	cacheflush
-
-prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips32/syscalls.list
deleted file mode 100644
index dbeb184d73..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips32/syscalls.list
+++ /dev/null
@@ -1,3 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
index 6135436182..6f665635e0 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
@@ -3,5 +3,3 @@
 # C syscall macros cannot be used because this syscall has a 64-bit
 # return value.
 lseek64		-	lseek		i:iii	__lseek64	__libc_lseek64 lseek64@@GLIBC_2.2 llseek@GLIBC_2.0:GLIBC_2.28
-
-prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
index ecf9d80ed4..50ab64d3c2 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
@@ -1,7 +1,5 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-prlimit		EXTRA	prlimit64	i:iipp	prlimit		prlimit64
-
 fstatfs		-	fstatfs		i:ip	__fstatfs	fstatfs fstatfs64 __fstatfs64
 statfs		-	statfs		i:sp	__statfs	statfs statfs64 __statfs64
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
index d31303250d..5231da94b2 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
@@ -2,5 +2,3 @@
 
 chown		-	chown		i:sii	__chown		chown@@GLIBC_2.1
 lchown		-	lchown		i:sii	__lchown	lchown@@GLIBC_2.0 chown@GLIBC_2.0
-
-prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
diff --git a/sysdeps/unix/sysv/linux/prlimit.c b/sysdeps/unix/sysv/linux/prlimit.c
index e12eb4e9bc..6707cf6b1e 100644
--- a/sysdeps/unix/sysv/linux/prlimit.c
+++ b/sysdeps/unix/sysv/linux/prlimit.c
@@ -18,6 +18,7 @@
 #include <sys/resource.h>
 #include <sysdep.h>
 
+#if !__RLIM_T_MATCHES_RLIM64_T
 int
 prlimit (__pid_t pid, enum __rlimit_resource resource,
 	 const struct rlimit *new_rlimit, struct rlimit *old_rlimit)
@@ -73,3 +74,4 @@ prlimit (__pid_t pid, enum __rlimit_resource resource,
 
   return res;
 }
+#endif /* __RLIM_T_MATCHES_RLIM64_T  */
diff --git a/sysdeps/unix/sysv/linux/prlimit64.c b/sysdeps/unix/sysv/linux/prlimit64.c
new file mode 100644
index 0000000000..e3a8718b98
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/prlimit64.c
@@ -0,0 +1,39 @@
+/* Get/set resource limits.  Linux specific syscall.
+   Copyright (C) 2020 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/>.  */
+
+#define prlimit __redirect_prlimit
+#include <sys/resource.h>
+#undef prlimit
+#include <sysdep.h>
+
+int
+__prlimit64 (pid_t pid, enum __rlimit_resource resource,
+	     const struct rlimit64 *new_rlimit, struct rlimit64 *old_rlimit)
+{
+  return INLINE_SYSCALL_CALL (prlimit64, pid, resource, new_rlimit,
+			      old_rlimit);
+}
+#ifdef VERSION_prlimit64
+# include <shlib-compat.h>
+versioned_symbol (libc, __prlimit64, prlimit64, VERSION_prlimit64);
+#else
+strong_alias (__prlimit64, prlimit64)
+# if __RLIM_T_MATCHES_RLIM64_T
+strong_alias (prlimit64, prlimit)
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
index 1c565e9ba5..fa05bac4d5 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
@@ -14,5 +14,3 @@ getgroups	-	getgroups32	i:ip	__getgroups	getgroups
 
 setfsgid	-	setfsgid32	Ei:i	setfsgid
 setfsuid	-	setfsuid32	Ei:i	setfsuid
-
-prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
diff --git a/sysdeps/unix/sysv/linux/sh/syscalls.list b/sysdeps/unix/sysv/linux/sh/syscalls.list
index ef35963e82..8340745c86 100644
--- a/sysdeps/unix/sysv/linux/sh/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sh/syscalls.list
@@ -14,5 +14,3 @@ getgroups	-	getgroups32	i:ip	__getgroups	getgroups
 
 setfsgid	-	setfsgid32	Ei:i	setfsgid
 setfsuid	-	setfsuid32	Ei:i	setfsuid
-
-prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
index 4fcae65451..9e4eb0a165 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
@@ -14,5 +14,3 @@ getgroups	-	getgroups32	i:ip	__getgroups	getgroups
 
 setfsgid	-	setfsgid32	Ei:i	setfsgid
 setfsuid	-	setfsuid32	Ei:i	setfsuid
-
-prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 0404a1c0d7..c5b839e7c2 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -3,4 +3,3 @@
 fstatfs		-	fstatfs		i:ip	__fstatfs	fstatfs fstatfs64 __fstatfs64
 statfs		-	statfs		i:sp	__statfs	statfs statfs64
 sendfile	-	sendfile	i:iipi	sendfile	sendfile64
-prlimit		EXTRA	prlimit64	i:iipp	prlimit		prlimit64
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 21/28] linux: Implement mremap in C
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (19 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 20/28] linux: Add prlimit64 " Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 22/28] Linux: implement ioctl " Adhemerval Zanella
                   ` (7 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

This avoid variadic function in syscalls.list and the possible mismatch
between the asm syscall macros the required ABI to handle the variadic
argument.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/Makefile      |  2 +-
 sysdeps/unix/sysv/linux/mremap.c      | 41 +++++++++++++++++++++++++++
 sysdeps/unix/sysv/linux/syscalls.list |  1 -
 3 files changed, 42 insertions(+), 2 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/mremap.c

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index c3b24f9332..68818862dd 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -61,7 +61,7 @@ sysdep_routines += adjtimex clone umount umount2 readahead sysctl \
 		   open_by_handle_at mlock2 pkey_mprotect pkey_set pkey_get \
 		   timerfd_gettime timerfd_settime prctl \
 		   process_vm_readv process_vm_writev clock_adjtime \
-		   time64-support pselect32 fanotify_mark
+		   time64-support pselect32 fanotify_mark mremap
 
 CFLAGS-gethostid.c = -fexceptions
 CFLAGS-tee.c = -fexceptions -fasynchronous-unwind-tables
diff --git a/sysdeps/unix/sysv/linux/mremap.c b/sysdeps/unix/sysv/linux/mremap.c
new file mode 100644
index 0000000000..83b4e95338
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mremap.c
@@ -0,0 +1,41 @@
+/* Remap a virtual memory address.  Linux specific syscall.
+   Copyright (C) 2020 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 <sys/mman.h>
+#include <sysdep.h>
+#include <stdarg.h>
+#include <stddef.h>
+
+void *
+__mremap (void *addr, size_t old_len, size_t new_len, int flags, ...)
+{
+  va_list va;
+  void *new_addr = NULL;
+
+  if (flags & MREMAP_FIXED)
+    {
+      va_start (va, flags);
+      new_addr = va_arg (va, void *);
+      va_end (va);
+    }
+
+  return (void *) INLINE_SYSCALL_CALL (mremap, addr, old_len, new_len, flags,
+				       new_addr);
+}
+libc_hidden_def (__mremap)
+weak_alias (__mremap, mremap)
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 01ec2bfa95..7a0172a422 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -35,7 +35,6 @@ mincore		-	mincore		i:aUV	mincore
 mlock		-	mlock		i:bU	mlock
 mlockall	-	mlockall	i:i	mlockall
 mount		EXTRA	mount		i:sssUp	__mount	mount
-mremap		EXTRA	mremap		b:aUUip	__mremap	mremap
 munlock		-	munlock		i:aU	munlock
 munlockall	-	munlockall	i:	munlockall
 nfsservctl	EXTRA	nfsservctl	i:ipp	__compat_nfsservctl	nfsservctl@GLIBC_2.0:GLIBC_2.28
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 22/28] Linux: implement ioctl in C
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (20 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 21/28] linux: Implement mremap in C Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 23/28] mips: Implement n32 lseek64 " Adhemerval Zanella
                   ` (6 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

This avoid variadic function in syscalls.list and the possible mismatch
between the asm syscall macros the required ABI to handle the variadic
argument.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/syscalls.list      |  1 -
 sysdeps/unix/sysv/linux/ioctl.c | 36 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 sysdeps/unix/sysv/linux/ioctl.c

diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
index 6d1a2ad441..353afe594f 100644
--- a/sysdeps/unix/syscalls.list
+++ b/sysdeps/unix/syscalls.list
@@ -31,7 +31,6 @@ getrlimit	-	getrlimit	i:ip	__getrlimit	getrlimit
 getsockname	-	getsockname	i:ibN	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	getsockopt
 getuid		-	getuid		Ei:	__getuid	getuid
-ioctl		-	ioctl		i:iiI	__ioctl		ioctl
 kill		-	kill		i:ii	__kill		kill
 link		-	link		i:ss	__link		link
 listen		-	listen		i:ii	__listen	listen
diff --git a/sysdeps/unix/sysv/linux/ioctl.c b/sysdeps/unix/sysv/linux/ioctl.c
new file mode 100644
index 0000000000..fe0dc5661e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ioctl.c
@@ -0,0 +1,36 @@
+/* Control device.  Linux version.
+   Copyright (C) 2020 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 <sys/ioctl.h>
+#include <stdarg.h>
+#include <sysdep.h>
+
+int
+__ioctl (int fd, unsigned long int request, ...)
+{
+  void *arg;
+  va_list va;
+
+  va_start (va, request);
+  arg = va_arg (va, void *);
+  va_end (va);
+
+  return INLINE_SYSCALL_CALL (ioctl, fd, request, arg);
+}
+libc_hidden_def (__ioctl)
+weak_alias (__ioctl, ioctl)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 23/28] mips: Implement n32 lseek64 in C
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (21 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 22/28] Linux: implement ioctl " Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 24/28] x32: Implement " Adhemerval Zanella
                   ` (5 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Checked on mips64-n32-linux-gnu.
---
 .../unix/sysv/linux/mips/mips64/n32/lseek64.c | 47 +++++++++++++++++++
 .../sysv/linux/mips/mips64/n32/syscalls.list  |  5 --
 2 files changed, 47 insertions(+), 5 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n32/lseek64.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list

diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/lseek64.c b/sysdeps/unix/sysv/linux/mips/mips64/n32/lseek64.c
new file mode 100644
index 0000000000..65cec75caf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/lseek64.c
@@ -0,0 +1,47 @@
+/* Linux lseek implementation, 64 bits off_t.  MIPS64n32 version.
+   Copyright (C) 2020 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 <unistd.h>
+#include <sysdep.h>
+
+static inline off64_t
+__lseek64_syscall (long int name, int fd, off64_t offset, int whence)
+{
+  register __syscall_arg_t s0 asm ("$16") = name;
+  register __syscall_arg_t v0 asm ("$2");
+  register __syscall_arg_t a0 asm ("$4") = ARGIFY (fd);
+  register __syscall_arg_t a1 asm ("$5") = ARGIFY (offset);
+  register __syscall_arg_t a2 asm ("$6") = ARGIFY (whence);
+  register __syscall_arg_t a3 asm ("$7");
+  asm volatile (".set\tnoreorder\n\t"
+		MOVE32 "\t%0, %2\n\t"
+		"syscall\n\t"
+		".set reorder"
+		: "=r" (v0), "=r" (a3)
+		: "r" (s0), "r" (a0), "r" (a1), "r" (a2)
+		: __SYSCALL_CLOBBERS);
+  return a3 != 0
+	 ? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (v0))
+         : v0;
+}
+
+#undef INLINE_SYSCALL_CALL
+#define INLINE_SYSCALL_CALL(name, ...) \
+  __lseek64_syscall(__NR_##name, __VA_ARGS__)
+
+#include <sysdeps/unix/sysv/linux/lseek64.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
deleted file mode 100644
index 6f665635e0..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
+++ /dev/null
@@ -1,5 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-# C syscall macros cannot be used because this syscall has a 64-bit
-# return value.
-lseek64		-	lseek		i:iii	__lseek64	__libc_lseek64 lseek64@@GLIBC_2.2 llseek@GLIBC_2.0:GLIBC_2.28
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 24/28] x32: Implement lseek64 in C
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (22 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 23/28] mips: Implement n32 lseek64 " Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 25/28] linux: Implement pipe in terms of __NR_pipe2 Adhemerval Zanella
                   ` (4 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Checked on x86_64-linux-gnu-x32
---
 sysdeps/unix/sysv/linux/x86_64/x32/lseek.S   | 43 -------------------
 sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S |  1 -
 sysdeps/unix/sysv/linux/x86_64/x32/lseek64.c | 44 ++++++++++++++++++++
 3 files changed, 44 insertions(+), 44 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/x32/lseek.S
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S
 create mode 100644 sysdeps/unix/sysv/linux/x86_64/x32/lseek64.c

diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/lseek.S b/sysdeps/unix/sysv/linux/x86_64/x32/lseek.S
deleted file mode 100644
index ca656ba12a..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/x32/lseek.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/* The lseek system call with 64-bit offset.  Linux/x32 version.
-   Copyright (C) 2012-2020 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 <sysdep.h>
-
-/* Return -1LL in a full 64 bits.  */
-#undef SYSCALL_ERROR_HANDLER
-#define SYSCALL_ERROR_HANDLER	\
-0:				\
-	SYSCALL_SET_ERRNO;	\
-	orq $-1, %rax;		\
-	ret;
-
-/* Always use our own error handler.  */
-#undef SYSCALL_ERROR_LABEL
-#define SYSCALL_ERROR_LABEL 0f
-
-PSEUDO (__libc_lseek64, lseek, 3)
-	ret
-PSEUDO_END (__libc_lseek64)
-
-weak_alias (__libc_lseek64, __lseek64)
-libc_hidden_weak (__lseek64)
-weak_alias (__libc_lseek64, lseek64)
-libc_hidden_weak (lseek64)
-weak_alias (__libc_lseek64, __lseek)
-libc_hidden_weak (__lseek)
-weak_alias (__libc_lseek64, lseek)
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S b/sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S
deleted file mode 100644
index d81e98fb51..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S
+++ /dev/null
@@ -1 +0,0 @@
-/* We don't need a definition since the llseek function is what we need.  */
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/lseek64.c b/sysdeps/unix/sysv/linux/x86_64/x32/lseek64.c
new file mode 100644
index 0000000000..49c959943b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/lseek64.c
@@ -0,0 +1,44 @@
+/* Linux lseek implementation, 64 bits off_t.  x86_64/x32 version.
+   Copyright (C) 2020 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 <unistd.h>
+#include <sysdep.h>
+#include <shlib-compat.h>
+
+static inline off64_t
+__lseek64_syscall (long int name, int fd, off64_t offset, int whence)
+{
+  off64_t resultvar;
+  asm volatile ("syscall\n\t"
+		: "=a" (resultvar)
+		: "0" (name),  "D" (fd), "S" (offset), "d" (whence)
+		: "memory", "cc", "r11", "cx");
+  return resultvar < 0
+	 ? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (resultvar))
+	 : resultvar;
+}
+
+#undef INLINE_SYSCALL_CALL
+#define INLINE_SYSCALL_CALL(name, ...) \
+  __lseek64_syscall(__NR_##name, __VA_ARGS__)
+
+/* Disable the llseek compat symbol.  */
+#undef SHLIB_COMPAT
+#define SHLIB_COMPAT(a, b, c) 0
+
+#include <sysdeps/unix/sysv/linux/lseek64.c>
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 25/28] linux: Implement pipe in terms of __NR_pipe2
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (23 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 24/28] x32: Implement " Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 26/28] linux: Consolidate brk implementation Adhemerval Zanella
                   ` (3 subsequent siblings)
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

It removes the arch-specific implementation for alpha, ia64,
mips, sh, and sparc which requires a different kernel ABI
than the usual one.

Checked on x86_64-linux-gnu and with a build for the affected ABIs.
---
 sysdeps/unix/alpha/pipe.S                    | 31 ---------------
 sysdeps/unix/mips/pipe.S                     | 32 ---------------
 sysdeps/unix/sysv/linux/alpha/pipe.S         |  1 -
 sysdeps/unix/sysv/linux/ia64/pipe.S          | 37 -----------------
 sysdeps/unix/sysv/linux/mips/pipe.S          |  1 -
 sysdeps/unix/sysv/linux/{generic => }/pipe.c |  6 +--
 sysdeps/unix/sysv/linux/sh/pipe.S            | 42 --------------------
 sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S | 39 ------------------
 sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S | 40 -------------------
 sysdeps/unix/sysv/linux/syscalls.list        |  1 -
 10 files changed, 3 insertions(+), 227 deletions(-)
 delete mode 100644 sysdeps/unix/alpha/pipe.S
 delete mode 100644 sysdeps/unix/mips/pipe.S
 delete mode 100644 sysdeps/unix/sysv/linux/alpha/pipe.S
 delete mode 100644 sysdeps/unix/sysv/linux/ia64/pipe.S
 delete mode 100644 sysdeps/unix/sysv/linux/mips/pipe.S
 rename sysdeps/unix/sysv/linux/{generic => }/pipe.c (86%)
 delete mode 100644 sysdeps/unix/sysv/linux/sh/pipe.S
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S

diff --git a/sysdeps/unix/alpha/pipe.S b/sysdeps/unix/alpha/pipe.S
deleted file mode 100644
index ae2d94b061..0000000000
--- a/sysdeps/unix/alpha/pipe.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Mosberger (davidm@cs.arizona.edu).
-
-   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/>.  */
-
-/* __pipe is a special syscall since it returns two values.  */
-
-#include <sysdep.h>
-
-PSEUDO (__pipe, pipe, 0)
-	stl	r0, 0(a0)
-	stl	r1, 4(a0)
-	mov	zero, v0
-	ret
-PSEUDO_END(__pipe)
-
-libc_hidden_def (__pipe)
-weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/mips/pipe.S b/sysdeps/unix/mips/pipe.S
deleted file mode 100644
index d541c138c1..0000000000
--- a/sysdeps/unix/mips/pipe.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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 <sysdep.h>
-
-SYSCALL__ (pipe, 1)
-	/* Plop in the two descriptors.  */
-	sw v0, 0(a0)
-	sw v1, 4(a0)
-
-	/* Go out with a clean status.  */
-	move v0, zero
-	j ra
-PSEUDO_END(__pipe)
-
-libc_hidden_def (__pipe)
-weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/alpha/pipe.S b/sysdeps/unix/sysv/linux/alpha/pipe.S
deleted file mode 100644
index 1e7ec1c199..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/pipe.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/alpha/pipe.S>
diff --git a/sysdeps/unix/sysv/linux/ia64/pipe.S b/sysdeps/unix/sysv/linux/ia64/pipe.S
deleted file mode 100644
index c5b8189a28..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/pipe.S
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Mosberger <davidm@hpl.hp.com>
-
-   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/>.  */
-
-/* __pipe is a special syscall since it returns two values.  */
-
-#include <sysdep.h>
-
-ENTRY(__pipe)
-       .regstk 1,0,0,0
-       DO_CALL (SYS_ify (pipe))
-       cmp.ne p6,p0=-1,r10
-       ;;
-(p6)   st4 [in0]=r8,4
-(p6)   mov ret0=0
-       ;;
-(p6)   st4 [in0]=r9
-(p6)   ret
-       br.cond.spnt.few __syscall_error
-PSEUDO_END(__pipe)
-
-libc_hidden_def (__pipe)
-weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/mips/pipe.S b/sysdeps/unix/sysv/linux/mips/pipe.S
deleted file mode 100644
index 1708888da4..0000000000
--- a/sysdeps/unix/sysv/linux/mips/pipe.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/mips/pipe.S>
diff --git a/sysdeps/unix/sysv/linux/generic/pipe.c b/sysdeps/unix/sysv/linux/pipe.c
similarity index 86%
rename from sysdeps/unix/sysv/linux/generic/pipe.c
rename to sysdeps/unix/sysv/linux/pipe.c
index 52f3231cb8..0ea6ca5842 100644
--- a/sysdeps/unix/sysv/linux/generic/pipe.c
+++ b/sysdeps/unix/sysv/linux/pipe.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 2011-2020 Free Software Foundation, Inc.
+/* Create create pipe.  Linux generic version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -26,7 +26,7 @@
 int
 __pipe (int __pipedes[2])
 {
-  return INLINE_SYSCALL (pipe2, 2, __pipedes, 0);
+  return INLINE_SYSCALL_CALL (pipe2, __pipedes, 0);
 }
 libc_hidden_def (__pipe)
 weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/sh/pipe.S b/sysdeps/unix/sysv/linux/sh/pipe.S
deleted file mode 100644
index 0e7a5a4ded..0000000000
--- a/sysdeps/unix/sysv/linux/sh/pipe.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1999-2020 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 <sysdep.h>
-
-ENTRY (__libc_pipe)
-	mov	#+__NR_pipe, r3
-	trapa	#0x10
-	mov     r0, r3
-	mov	#-12, r2
-	shad	r2, r3
-	not	r3, r3			// r1=0 means r0 = -1 to -4095
-	tst	r3, r3			// i.e. error in linux
-	bt	1f
-	mov.l	r0, @r4
-	mov.l	r1, @(4, r4)
-	rts
-	 mov	#0, r0
-1:
-	SYSCALL_ERROR_HANDLER
-.Lpseudo_end:
-	rts
-	 nop
-PSEUDO_END (__libc_pipe)
-
-weak_alias (__libc_pipe, __pipe)
-libc_hidden_def (__pipe)
-weak_alias (__libc_pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S b/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
deleted file mode 100644
index 0b10f1522b..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, 1997.
-
-   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 <sysdep.h>
-
-	.text
-	.globl		__syscall_error
-ENTRY(__libc_pipe)
-        mov	%o0, %o2            /* Save PIPEDES. */
-	mov	SYS_ify(pipe),%g1
-	ta	0x10
-	bcc	1f
-	 mov	%o7, %g1
-	call	__syscall_error
-	 mov	%g1, %o7
-1:	st	%o0, [%o2]           /* PIPEDES[0] = %o0; */
-        st	%o1, [%o2 + 4]       /* PIPEDES[1] = %o1; */
-	retl
-	 clr	%o0
-END(__libc_pipe)
-
-weak_alias (__libc_pipe, __pipe)
-libc_hidden_def (__pipe)
-weak_alias (__libc_pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S b/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
deleted file mode 100644
index 072a1936ea..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, 1997.
-
-   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 <sysdep.h>
-
-	.text
-
-	.globl	__syscall_error
-ENTRY(__libc_pipe)
-	mov	%o0, %o2		/* Save PIPEDES. */
-	LOADSYSCALL(pipe)
-	ta	0x6d
-	bcc,pt	%xcc, 1f
-	 mov	%o7, %g1
-	call	__syscall_error
-	 mov	%g1, %o7
-1:	st	%o0, [%o2]		/* PIPEDES[0] = %o0; */
-	st	%o1, [%o2 + 4]		/* PIPEDES[1] = %o1; */
-	retl
-	 clr	%o0
-END(__libc_pipe)
-
-weak_alias (__libc_pipe, __pipe)
-libc_hidden_def (__pipe)
-weak_alias (__libc_pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 7a0172a422..483caca465 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -38,7 +38,6 @@ mount		EXTRA	mount		i:sssUp	__mount	mount
 munlock		-	munlock		i:aU	munlock
 munlockall	-	munlockall	i:	munlockall
 nfsservctl	EXTRA	nfsservctl	i:ipp	__compat_nfsservctl	nfsservctl@GLIBC_2.0:GLIBC_2.28
-pipe		-	pipe		i:f	__pipe		pipe
 pipe2		-	pipe2		i:fi	__pipe2		pipe2
 pivot_root	EXTRA	pivot_root	i:ss	pivot_root
 query_module	EXTRA	query_module	i:sipip	__compat_query_module	query_module@GLIBC_2.0:GLIBC_2.23
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 26/28] linux: Consolidate brk implementation
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (24 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 25/28] linux: Implement pipe in terms of __NR_pipe2 Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-19 17:31   ` Tulio Magno Quites Machado Filho
  2020-11-19 20:08   ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 27/28] linux: Add generic C syscall implementation Adhemerval Zanella
                   ` (2 subsequent siblings)
  28 siblings, 2 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=no, Size: 40318 bytes --]

It removes all the arch-specific assembly implementation.  The
only outlier is alpha where its kernel ABI to return error
is to return the EINVAL as the returned value instead of address
lower than the requested one.

Also some ABIs exports an additional ___brk_addr symbol and to
handle it an internal HAVE_INTERNAL_BRK_ADDR_SYMBOL.

Checked on x86_64-linux-gnu and with build for the affected ABIs.
---
 sysdeps/unix/sysv/linux/aarch64/sysdep.h      |   3 +
 sysdeps/unix/sysv/linux/alpha/brk.S           |  83 --------------
 sysdeps/unix/sysv/linux/{arm => alpha}/brk.c  |  13 +--
 sysdeps/unix/sysv/linux/alpha/dl-brk.S        |   1 -
 sysdeps/unix/sysv/linux/arc/sysdep.h          |   3 +
 sysdeps/unix/sysv/linux/{generic => }/brk.c   |   6 +-
 sysdeps/unix/sysv/linux/csky/sysdep.h         |   3 +
 sysdeps/unix/sysv/linux/dl-brk.c              |   5 -
 sysdeps/unix/sysv/linux/hppa/brk.c            |  41 -------
 sysdeps/unix/sysv/linux/i386/brk.c            |  45 --------
 sysdeps/unix/sysv/linux/i386/sysdep.h         |   3 +
 sysdeps/unix/sysv/linux/ia64/brk.S            |  50 ---------
 sysdeps/unix/sysv/linux/ia64/dl-brk.S         |   1 -
 sysdeps/unix/sysv/linux/ia64/sysdep.h         |   3 +
 sysdeps/unix/sysv/linux/m68k/brk.c            |  46 --------
 sysdeps/unix/sysv/linux/m68k/sysdep.h         |   3 +
 sysdeps/unix/sysv/linux/microblaze/brk.c      |  42 -------
 sysdeps/unix/sysv/linux/microblaze/sysdep.h   |   3 +
 sysdeps/unix/sysv/linux/mips/brk.c            |  46 --------
 sysdeps/unix/sysv/linux/mips/mips32/sysdep.h  |   3 +
 sysdeps/unix/sysv/linux/mips/mips64/sysdep.h  |   3 +
 sysdeps/unix/sysv/linux/nios2/sysdep.h        |   3 +
 sysdeps/unix/sysv/linux/pipe.c                |   2 +-
 sysdeps/unix/sysv/linux/powerpc/dl-brk.S      |   1 -
 .../unix/sysv/linux/powerpc/powerpc32/brk.S   |  52 ---------
 .../unix/sysv/linux/powerpc/powerpc64/brk.S   |  43 --------
 sysdeps/unix/sysv/linux/riscv/sysdep.h        |   3 +
 sysdeps/unix/sysv/linux/s390/brk.c            |  55 ---------
 sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h |   5 +
 sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h |   5 +
 sysdeps/unix/sysv/linux/sh/brk.c              |  47 --------
 sysdeps/unix/sysv/linux/sparc/sparc32/brk.c   |  54 ---------
 .../unix/sysv/linux/sparc/sparc32/sysdep.h    |   3 +
 sysdeps/unix/sysv/linux/sparc/sparc64/brk.S   | 104 ------------------
 .../unix/sysv/linux/sparc/sparc64/dl-brk.S    |   1 -
 sysdeps/unix/sysv/linux/sysdep.h              |   4 +
 sysdeps/unix/sysv/linux/x86_64/brk.c          |  41 -------
 37 files changed, 60 insertions(+), 769 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/alpha/brk.S
 rename sysdeps/unix/sysv/linux/{arm => alpha}/brk.c (77%)
 delete mode 100644 sysdeps/unix/sysv/linux/alpha/dl-brk.S
 rename sysdeps/unix/sysv/linux/{generic => }/brk.c (90%)
 delete mode 100644 sysdeps/unix/sysv/linux/dl-brk.c
 delete mode 100644 sysdeps/unix/sysv/linux/hppa/brk.c
 delete mode 100644 sysdeps/unix/sysv/linux/i386/brk.c
 delete mode 100644 sysdeps/unix/sysv/linux/ia64/brk.S
 delete mode 100644 sysdeps/unix/sysv/linux/ia64/dl-brk.S
 delete mode 100644 sysdeps/unix/sysv/linux/m68k/brk.c
 delete mode 100644 sysdeps/unix/sysv/linux/microblaze/brk.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/brk.c
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/dl-brk.S
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
 delete mode 100644 sysdeps/unix/sysv/linux/s390/brk.c
 delete mode 100644 sysdeps/unix/sysv/linux/sh/brk.c
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/brk.c
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/dl-brk.S
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/brk.c

diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index 319a7c7ac5..e526328ea4 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -234,6 +234,9 @@
 # define INTERNAL_SYSCALL_NCS(number, nr, args...)	\
 	INTERNAL_SYSCALL_RAW (number, nr, args)
 
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
 #endif	/* __ASSEMBLER__ */
 
 /* Pointer mangling is supported for AArch64.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/brk.S b/sysdeps/unix/sysv/linux/alpha/brk.S
deleted file mode 100644
index 5596b346d8..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/brk.S
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe <brendan@zen.org>, 1993.
-
-   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/>.  */
-
-/* __brk is a special syscall under Linux since it never returns an
-   error.  Instead, the error condition is indicated by returning the old
-   break value (instead of the new, requested one).  */
-
-#include <sysdep.h>
-#include <errno.h>
-
-#ifdef PIC
-.section .bss
-	.align 3
-	.globl __curbrk
-__curbrk: .skip 8
-	.type __curbrk,@object
-	.size __curbrk,8
-#else
-.comm __curbrk, 8
-#endif
-
-	.text
-	.align	4
-	.globl	__brk
-	.ent	__brk
-	.usepv	__brk, std
-
-	cfi_startproc
-__brk:
-	ldgp	gp, 0(t12)
-	subq	sp, 16, sp
-	cfi_adjust_cfa_offset (16)
-#ifdef PROF
-	.set noat
-	lda	AT, _mcount
-	jsr	AT, (AT), _mcount
-	.set at
-#endif
-
-	/* Save the requested brk across the system call.  */
-	stq	a0, 0(sp)
-
-	ldiq	v0, __NR_brk
-	call_pal PAL_callsys
-
-	ldq	a0, 0(sp)
-	addq	sp, 16, sp
-	cfi_adjust_cfa_offset (-16)
-
-	/* Be prepared for an OSF-style brk.  */
-	bne	a3, SYSCALL_ERROR_LABEL
-	beq	v0, $ok
-
-	/* Correctly handle the brk(0) query case.  */
-	cmoveq	a0, v0, a0
-	xor	a0, v0, t0
-	lda	v0, ENOMEM
-	bne	t0, SYSCALL_ERROR_LABEL
-
-	/* Update __curbrk and return cleanly.  */
-	lda	v0, 0
-$ok:	stq	a0, __curbrk
-	ret
-
-PSEUDO_END(__brk)
-	cfi_endproc
-
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/arm/brk.c b/sysdeps/unix/sysv/linux/alpha/brk.c
similarity index 77%
rename from sysdeps/unix/sysv/linux/arm/brk.c
rename to sysdeps/unix/sysv/linux/alpha/brk.c
index d4878939ae..d105a50724 100644
--- a/sysdeps/unix/sysv/linux/arm/brk.c
+++ b/sysdeps/unix/sysv/linux/alpha/brk.c
@@ -1,5 +1,5 @@
-/* brk system call for Linux/ARM.
-   Copyright (C) 1995-2020 Free Software Foundation, Inc.
+/* Change data segment size.  Linux/Alpha.
+   Copyright (C) 2020 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
@@ -20,17 +20,14 @@
 #include <unistd.h>
 #include <sysdep.h>
 
-/* This must be initialized data because commons can't have aliases.  */
 void *__curbrk = 0;
 
 int
 __brk (void *addr)
 {
-  void *newbrk;
-
-  __curbrk = newbrk = (void *) INLINE_SYSCALL (brk, 1, addr);
-
-  if (newbrk < addr)
+  /* Alpha brk returns -ENOMEM in case of failure.  */
+  __curbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr);
+  if ((unsigned long) __curbrk == -ENOMEM)
     {
       __set_errno (ENOMEM);
       return -1;
diff --git a/sysdeps/unix/sysv/linux/alpha/dl-brk.S b/sysdeps/unix/sysv/linux/alpha/dl-brk.S
deleted file mode 100644
index eeb96544e3..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/dl-brk.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <brk.S>
diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.h b/sysdeps/unix/sysv/linux/arc/sysdep.h
index 8465a2f623..24d8866d66 100644
--- a/sysdeps/unix/sysv/linux/arc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/arc/sysdep.h
@@ -221,6 +221,9 @@ hidden_proto (__syscall_error)
 # define PTR_MANGLE(var) (void) (var)
 # define PTR_DEMANGLE(var) (void) (var)
 
+# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+# define HAVE_INTERNAL_BRK_ADDR_SYMBOL  1
+
 #endif /* !__ASSEMBLER__ */
 
 #endif /* linux/arc/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/generic/brk.c b/sysdeps/unix/sysv/linux/brk.c
similarity index 90%
rename from sysdeps/unix/sysv/linux/generic/brk.c
rename to sysdeps/unix/sysv/linux/brk.c
index 40a80ab970..0b6d6d0b70 100644
--- a/sysdeps/unix/sysv/linux/generic/brk.c
+++ b/sysdeps/unix/sysv/linux/brk.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 2011-2020 Free Software Foundation, Inc.
+/* Change data segment.  Linux generic version.
+   Copyright (C) 2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -23,10 +23,12 @@
 /* This must be initialized data because commons can't have aliases.  */
 void *__curbrk = 0;
 
+#if HAVE_INTERNAL_BRK_ADDR_SYMBOL
 /* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
    to work around different old braindamage in the old Linux ELF dynamic
    linker.  */
 weak_alias (__curbrk, ___brk_addr)
+#endif
 
 int
 __brk (void *addr)
diff --git a/sysdeps/unix/sysv/linux/csky/sysdep.h b/sysdeps/unix/sysv/linux/csky/sysdep.h
index 7e8e89dd42..92216572a6 100644
--- a/sysdeps/unix/sysv/linux/csky/sysdep.h
+++ b/sysdeps/unix/sysv/linux/csky/sysdep.h
@@ -461,6 +461,9 @@ __local_syscall_error:				\
 # define INTERNAL_SYSCALL_NCS(number, nr, args...)		\
   INTERNAL_SYSCALL_RAW##nr (number, args)
 
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
 #endif /* __ASSEMBLER__ */
 
 /* Pointer mangling support.  */
diff --git a/sysdeps/unix/sysv/linux/dl-brk.c b/sysdeps/unix/sysv/linux/dl-brk.c
deleted file mode 100644
index c37cdfec33..0000000000
--- a/sysdeps/unix/sysv/linux/dl-brk.c
+++ /dev/null
@@ -1,5 +0,0 @@
-/* We can use the normal code but we also know the __curbrk is not exported
-   from ld.so.  */
-extern void *__curbrk attribute_hidden;
-
-#include <brk.c>
diff --git a/sysdeps/unix/sysv/linux/hppa/brk.c b/sysdeps/unix/sysv/linux/hppa/brk.c
deleted file mode 100644
index 89d1fd1835..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/brk.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* brk system call for Linux/HPPA.
-   Copyright (C) 1995-2020 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 <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-/* This must be initialized data because commons can't have aliases.  */
-void *__curbrk = 0;
-
-int
-__brk (void *addr)
-{
-  void *newbrk;
-
-  __curbrk = newbrk = (void *) INLINE_SYSCALL (brk, 1, addr);
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/i386/brk.c b/sysdeps/unix/sysv/linux/i386/brk.c
deleted file mode 100644
index 021b6d37a0..0000000000
--- a/sysdeps/unix/sysv/linux/i386/brk.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* brk system call for Linux/i386.
-   Copyright (C) 1995-2020 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/>.  */
-
-#if BUILD_PIE_DEFAULT
-/* Can't use "call *%gs:SYSINFO_OFFSET" during statup in static PIE.  */
-# define I386_USE_SYSENTER 0
-#endif
-
-#include <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-/* This must be initialized data because commons can't have aliases.  */
-void *__curbrk = 0;
-
-/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
-   to work around different old braindamage in the old Linux ELF dynamic
-   linker.  */
-weak_alias (__curbrk, ___brk_addr)
-
-int
-__brk (void *addr)
-{
-  void *newbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr);
-  __curbrk = newbrk;
-  if (newbrk < addr)
-    return INLINE_SYSCALL_ERROR_RETURN_VALUE (ENOMEM);
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index bfb5de3b45..addd13dff1 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -291,6 +291,9 @@ struct libc_do_syscall_args
 # define HAVE_TIME_VSYSCALL             "__vdso_time"
 # define HAVE_CLOCK_GETRES_VSYSCALL     "__vdso_clock_getres"
 
+# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
 /* Define a macro which expands inline into the wrapper code for a system
    call.  This use is for internal calls that do not need to handle errors
    normally.  It will never touch errno.  This returns just what the kernel
diff --git a/sysdeps/unix/sysv/linux/ia64/brk.S b/sysdeps/unix/sysv/linux/ia64/brk.S
deleted file mode 100644
index 734d3467a7..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/brk.S
+++ /dev/null
@@ -1,50 +0,0 @@
-/* brk system call for Linux/ia64
-   Copyright (C) 1999-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Written by Stéphane Eranian <eranian@hpl.hp.com> and
-	      Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
-
-   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 <sysdep.h>
-
-#include <asm/errno.h>
-
-	.global __curbrk
-	.type __curbrk,@object
-	.size __curbrk,8
-	.data
-	.align	8
-__curbrk:
-	data8	0
-
-weak_alias (__curbrk, ___brk_addr)
-
-LEAF(__brk)
-	.regstk 1, 0, 0, 0
-	DO_CALL(__NR_brk)
-	cmp.ltu	p6, p0 = ret0, in0
-	addl r9 = @ltoff(__curbrk), gp
-	;;
-	ld8 r9 = [r9]
-(p6) 	mov ret0 = ENOMEM
-(p6)	br.cond.spnt.few __syscall_error
-	;;
-	st8 [r9] = ret0
-	mov ret0 = 0
-	ret
-END(__brk)
-
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/ia64/dl-brk.S b/sysdeps/unix/sysv/linux/ia64/dl-brk.S
deleted file mode 100644
index eeb96544e3..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/dl-brk.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <brk.S>
diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h
index 03ed52552e..e6bcaabecc 100644
--- a/sysdeps/unix/sysv/linux/ia64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h
@@ -172,6 +172,9 @@
 
 #else /* not __ASSEMBLER__ */
 
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
 #define BREAK_INSN_1(num) "break " #num ";;\n\t"
 #define BREAK_INSN(num) BREAK_INSN_1(num)
 
diff --git a/sysdeps/unix/sysv/linux/m68k/brk.c b/sysdeps/unix/sysv/linux/m68k/brk.c
deleted file mode 100644
index ee88acbdc4..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/brk.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* brk system call for Linux/m68k.
-   Copyright (C) 1996-2020 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 <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-void *__curbrk = 0;
-
-/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
-   to work around different old braindamage in the old Linux/x86 ELF
-   dynamic linker.  Sigh.  */
-weak_alias (__curbrk, ___brk_addr)
-
-int
-__brk (void *addr)
-{
-  void *newbrk;
-
-  newbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr);
-  __curbrk = newbrk;
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h
index 3e0ab605de..fe7cf5babb 100644
--- a/sysdeps/unix/sysv/linux/m68k/sysdep.h
+++ b/sysdeps/unix/sysv/linux/m68k/sysdep.h
@@ -292,6 +292,9 @@ SYSCALL_ERROR_LABEL:							      \
   LOAD_REGS_5
 #define ASM_ARGS_6	ASM_ARGS_5, "a" (_a0)
 
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
 #endif /* not __ASSEMBLER__ */
 
 /* Pointer mangling is not yet supported for M68K.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/brk.c b/sysdeps/unix/sysv/linux/microblaze/brk.c
deleted file mode 100644
index 20c3e625e4..0000000000
--- a/sysdeps/unix/sysv/linux/microblaze/brk.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 2011-2020 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 <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-/* This must be initialized data because commons can't have aliases.  */
-void *__curbrk = 0;
-
-/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
-   to work around different old braindamage in the old Linux ELF dynamic
-   linker.  */
-weak_alias (__curbrk, ___brk_addr)
-
-int
-__brk (void *addr)
-{
-  __curbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr);
-  if (__curbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
index 6fd96adbf0..fb1e648b63 100644
--- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h
+++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
@@ -310,6 +310,9 @@ SYSCALL_ERROR_LABEL_DCL:                            \
 
 # define SINGLE_THREAD_BY_GLOBAL	1
 
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
 #endif /* not __ASSEMBLER__ */
 
 #endif /* _LINUX_MICROBLAZE_SYSDEP_H */
diff --git a/sysdeps/unix/sysv/linux/mips/brk.c b/sysdeps/unix/sysv/linux/mips/brk.c
deleted file mode 100644
index 0335837948..0000000000
--- a/sysdeps/unix/sysv/linux/mips/brk.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* brk system call for Linux/MIPS.
-   Copyright (C) 2000-2020 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 <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-void *__curbrk = 0;
-
-/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
-   to work around different old braindamage in the old Linux/x86 ELF
-   dynamic linker.  Sigh.  */
-weak_alias (__curbrk, ___brk_addr)
-
-int
-__brk (void *addr)
-{
-  void *newbrk;
-
-  newbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr);
-  __curbrk = newbrk;
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
index c5bcd90c25..49856c3249 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
@@ -43,6 +43,9 @@
 
 #else   /* ! __ASSEMBLER__ */
 
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
 /* Note that the original Linux syscall restart convention required the
    instruction immediately preceding SYSCALL to initialize $v0 with the
    syscall number.  Then if a restart triggered, $v0 would have been
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h
index 1882fe4e73..73816816d5 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h
@@ -41,6 +41,9 @@
 
 #else   /* ! __ASSEMBLER__ */
 
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
 #if _MIPS_SIM == _ABIN32
 /* Convert X to a long long, without losing any bits if it is one
    already or warning if it is a 32-bit pointer.  */
diff --git a/sysdeps/unix/sysv/linux/nios2/sysdep.h b/sysdeps/unix/sysv/linux/nios2/sysdep.h
index 520c9460a2..51f736fb95 100644
--- a/sysdeps/unix/sysv/linux/nios2/sysdep.h
+++ b/sysdeps/unix/sysv/linux/nios2/sysdep.h
@@ -219,6 +219,9 @@
 
 #define __SYSCALL_CLOBBERS "memory"
 
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
 #endif /* __ASSEMBLER__ */
 
 /* Pointer mangling support.  */
diff --git a/sysdeps/unix/sysv/linux/pipe.c b/sysdeps/unix/sysv/linux/pipe.c
index 0ea6ca5842..bc105ba6a7 100644
--- a/sysdeps/unix/sysv/linux/pipe.c
+++ b/sysdeps/unix/sysv/linux/pipe.c
@@ -26,7 +26,7 @@
 int
 __pipe (int __pipedes[2])
 {
-  return INLINE_SYSCALL_CALL (pipe2, __pipedes, 0);
+  return INLINE_SYSCALL_CALL (pipe2, (int *) __pipedes, 0);
 }
 libc_hidden_def (__pipe)
 weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-brk.S b/sysdeps/unix/sysv/linux/powerpc/dl-brk.S
deleted file mode 100644
index eeb96544e3..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/dl-brk.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <brk.S>
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
deleted file mode 100644
index f3b960795e..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
+++ /dev/null
@@ -1,52 +0,0 @@
-/* brk system call for Linux/ppc.
-   Copyright (C) 1995-2020 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 <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-
-	.comm	__curbrk,4,4
-	.section ".text"
-ENTRY (__brk)
-	mflr	r0
-	stwu    r1,-16(r1)
-	cfi_adjust_cfa_offset (16)
-	stw	r3,8(r1)
-	stw	r0,20(r1)
-	cfi_offset (lr, 4)
-	DO_CALL(SYS_ify(brk))
-	lwz     r6,8(r1)
-#ifdef PIC
-	SETUP_GOT_ACCESS(r5,got_label)
-	addis	r5,r5,__curbrk-got_label@ha
-	stw	r3,__curbrk-got_label@l(r5)
-#else
-	lis     r4,__curbrk@ha
-	stw     r3,__curbrk@l(r4)
-#endif
-	lwz	r0,20(r1)
-	cmplw   r6,r3
-	addi    r1,r1,16
-	mtlr	r0
-	li	r3,0
-	blelr+
-	li      r3,ENOMEM
-	b	__syscall_error@local
-END (__brk)
-
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
deleted file mode 100644
index f206909b72..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/* brk system call for Linux.  PowerPC64 version.
-   Copyright (C) 1995-2020 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 <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-
-	.comm	__curbrk,8,8
-	.section	".toc","aw"
-.LC__curbrk:
-	.tc __curbrk[TC],__curbrk
-	.section ".text"
-ENTRY (__brk)
-	CALL_MCOUNT 1
-
-	std	r3,-8(r1)
-	DO_CALL(SYS_ify(brk))
-	ld	r6,-8(r1)
-	ld	r5,.LC__curbrk@toc(r2)
-	std     r3,0(r5)
-	cmpld   r6,r3
-	li	r3,0
-	blelr+
-	li      r3,ENOMEM
-	TAIL_CALL_SYSCALL_ERROR
-END (__brk)
-
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
index e94afbf106..37ff07a0d7 100644
--- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
+++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h
@@ -155,6 +155,9 @@
    RV64).  */
 # define HAVE_GETCPU_VSYSCALL		"__vdso_getcpu"
 
+# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
 # define INTERNAL_SYSCALL(name, nr, args...) \
 	internal_syscall##nr (SYS_ify (name), args)
 
diff --git a/sysdeps/unix/sysv/linux/s390/brk.c b/sysdeps/unix/sysv/linux/s390/brk.c
deleted file mode 100644
index ca3a730f83..0000000000
--- a/sysdeps/unix/sysv/linux/s390/brk.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-   Copyright (C) 2000-2020 Free Software Foundation, Inc.
-   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
-   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 <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-void *__curbrk = 0;
-
-/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
-   to work around different old braindamage in the old Linux/x86 ELF
-   dynamic linker.  Sigh.  */
-weak_alias (__curbrk, ___brk_addr)
-
-int
-__brk (void *addr)
-{
-  void *newbrk;
-
-  {
-    register void *__addr __asm__("2") = addr;
-
-    __asm__ ("svc  %b1\n\t"		/* call sys_brk */
-	     : "=d" (__addr)
-	     : "I" (SYS_ify(brk)), "r" (__addr)
-	     : "cc", "memory" );
-    newbrk = __addr;
-  }
-  __curbrk = newbrk;
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
index 26b0410cf3..26836620f2 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
@@ -175,6 +175,11 @@
 #define ret_ERRVAL							      \
     br      14
 
+#else
+
+# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
 #endif /* __ASSEMBLER__ */
 
 /* Pointer mangling support.  */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
index 39831a2ec2..7211dadbfd 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
@@ -173,6 +173,11 @@
 #define ret_ERRVAL							      \
     br	    14
 
+#else
+
+# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
 #endif /* __ASSEMBLER__ */
 
 /* Pointer mangling support.  */
diff --git a/sysdeps/unix/sysv/linux/sh/brk.c b/sysdeps/unix/sysv/linux/sh/brk.c
deleted file mode 100644
index 5225d9bfc4..0000000000
--- a/sysdeps/unix/sysv/linux/sh/brk.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* brk system call for Linux/SH.
-   Copyright (C) 1999-2020 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 <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-/* This must be initialized data because commons can't have aliases.  */
-void *__curbrk = 0;
-
-int
-__brk (void *addr)
-{
-  void *newbrk;
-  register long r3 asm ("%r3") = SYS_ify (brk);
-  register long r4 asm ("%r4") = (long)addr;
-
-  asm volatile ("trapa #0x11\n\t" SYSCALL_INST_PAD
-		: "=z"(newbrk)
-		: "r" (r3), "r" (r4));
-
-  __curbrk = newbrk;
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/brk.c b/sysdeps/unix/sysv/linux/sparc/sparc32/brk.c
deleted file mode 100644
index ba9a616f74..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/brk.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* brk system call for Linux/SPARC.
-   Copyright (C) 1995-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Miguel de Icaza (miguel@nuclecu.unam.mx)
-
-   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 <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-/* This must be initialized data because commons can't have aliases.  */
-void *__curbrk = 0;
-
-/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
-   to work around different old braindamage in the old Linux ELF dynamic
-   linker.  */
-weak_alias (__curbrk, ___brk_addr)
-
-int
-__brk (void *addr)
-{
-  void *newbrk;
-
-  {
-    register void *o0 __asm__("%o0") = addr;
-    register int g1 __asm__("%g1") = __NR_brk;
-    __asm ("t 0x10" : "=r"(o0) : "r"(g1), "0"(o0) : "cc");
-    newbrk = o0;
-  }
-
-  __curbrk = newbrk;
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
index 2c3754770b..018ee5781e 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
@@ -121,6 +121,9 @@ ENTRY(name);					\
 	"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",		\
 	"cc", "memory"
 
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
 #endif	/* __ASSEMBLER__ */
 
 /* Pointer mangling support.  */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
deleted file mode 100644
index 471da3d268..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
-
-   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/>.  */
-
-/* __brk is a special syscall under Linux since it never returns an
-   error.  Instead, the error condition is indicated by returning the old
-   break value (instead of the new, requested one).  */
-
-#include <sysdep.h>
-#include <errno.h>
-
-#ifdef PIC
-.section .bss
-	.align 8
-	.globl __curbrk
-__curbrk: .skip 8
-	.type __curbrk,@object
-	.size __curbrk,8
-#else
-.common __curbrk, 8, 8
-#endif
-
-	.text
-ENTRY (__brk)
-	save	%sp, -192, %sp
-	cfi_def_cfa_register(%fp)
-	cfi_window_save
-	cfi_register(%o7, %i7)
-#ifdef PIC
-	SETUP_PIC_REG(l7)
-#endif
-
-	LOADSYSCALL(brk)
-	mov	%i0, %o0
-
-	ta	0x6d
-
-	/* All the ways we can fail... */
-	bcs,pn	%xcc, .Lerr1
-	 nop
-	brz,pt	%i0, .Lok
-	 subcc	%i0, %o0, %g0
-	bne,pn	%xcc, .Lerr0
-	 nop
-
-	/* Update __curbrk and return cleanly.  */
-.Lok:
-#ifndef PIC
-	sethi	%hi(__curbrk), %g1
-	or	%g1, %lo(__curbrk), %g1
-#else
-	sethi	%gdop_hix22(__curbrk), %g1
-	xor	%g1, %gdop_lox10(__curbrk), %g1
-	ldx	[%l7 + %g1], %g1, %gdop(__curbrk)
-#endif
-	stx	%o0, [%g1]
-	mov	%g0, %i0
-
-	/* Don't use "ret" cause the preprocessor will eat it.  */
-	jmpl	%i7+8, %g0
-	 restore
-
-	/* What a horrible way to die.  */
-.Lerr0:	set	ENOMEM, %o0
-.Lerr1:
-#ifndef _LIBC_REENTRANT
-#ifndef PIC
-	sethi	%hi(errno), %g1
-	or	%g1, %lo(errno), %g1
-#else
-	sethi	%gdop_hix22(errno), %g1
-	xor	%g1, %gdop_lox10(errno), %g1
-	ldx	[%l7 + %g1], %g1, %gdop(errno)
-#endif
-	st	%o0, [%g1]
-#else
-#if IS_IN (libc)
-	call	HIDDEN_JUMPTARGET(__errno_location)
-#else
-	call	__errno_location
-#endif
-	 mov	%o0,%l1
-	st	%l1, [%o0]
-#endif
-	sub	%g0, 1, %i0
-	jmpl	%i7+8, %g0
-	 restore
-END (__brk)
-
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-brk.S b/sysdeps/unix/sysv/linux/sparc/sparc64/dl-brk.S
deleted file mode 100644
index eeb96544e3..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-brk.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <brk.S>
diff --git a/sysdeps/unix/sysv/linux/sysdep.h b/sysdeps/unix/sysv/linux/sysdep.h
index 71ecc19cd5..736cf52697 100644
--- a/sysdeps/unix/sysv/linux/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sysdep.h
@@ -99,4 +99,8 @@
    it missing due the usage of a old generic version without it).  */
 #define HAVE_INTERNAL_SEND_SYMBOL	1
 
+/* Export the ___brk_addr symbol on brk.c implementation (some ABIs export
+   it due and old crtstuff.c code).  */
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL   0
+
 #endif /* _SYSDEP_LINUX_H  */
diff --git a/sysdeps/unix/sysv/linux/x86_64/brk.c b/sysdeps/unix/sysv/linux/x86_64/brk.c
deleted file mode 100644
index fba9278c68..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/brk.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* brk system call for Linux/x86_64.
-   Copyright (C) 1995-2020 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 <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-/* This must be initialized data because commons can't have aliases.  */
-void *__curbrk = 0;
-
-int
-__brk (void *addr)
-{
-  void *newbrk;
-
-  __curbrk = newbrk = (void *) INLINE_SYSCALL (brk, 1, addr);
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 27/28] linux: Add generic C syscall implementation
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (25 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 26/28] linux: Consolidate brk implementation Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 19:55 ` [PATCH 28/28] alpha: Move implementations to C Adhemerval Zanella
  2020-11-18 21:06 ` [PATCH 00/28] More Linux syscall refactor Joseph Myers
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

The hppa and riscv one are also removed.  The riscv specially is
abusing the internal interfaces by defining it with a different
signature.  If the idea is to provide an optimized version a better
alternative would be to provide an assembly one as other
architectures.

Checked on x86_64-linux-gnu and with build for the affected ABIs.
---
 sysdeps/unix/sysv/linux/hppa/syscall.c        | 65 -------------------
 sysdeps/unix/sysv/linux/{riscv => }/syscall.c | 33 ++++++----
 2 files changed, 20 insertions(+), 78 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/hppa/syscall.c
 rename sysdeps/unix/sysv/linux/{riscv => }/syscall.c (53%)

diff --git a/sysdeps/unix/sysv/linux/hppa/syscall.c b/sysdeps/unix/sysv/linux/hppa/syscall.c
deleted file mode 100644
index 7f6794b09f..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/syscall.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Copyright (C) 1997-2020 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 <stdarg.h>
-#include <sysdep.h>
-#include <errno.h>
-
-/* HPPA implements syscall() in 'C'; the assembler version would
-   typically be in syscall.S. Also note that we have INLINE_SYSCALL,
-   INTERNAL_SYSCALL, and all the generated pure assembly syscall wrappers.
-   How often the function is used is unknown. */
-
-long int
-syscall (long int __sysno, ...)
-{
-  /* FIXME: Keep this matching INLINE_SYSCALL for hppa */
-  va_list args;
-  long int arg0, arg1, arg2, arg3, arg4, arg5;
-  long int __sys_res;
-
-  /* Load varargs */
-  va_start (args, __sysno);
-  arg0 = va_arg (args, long int);
-  arg1 = va_arg (args, long int);
-  arg2 = va_arg (args, long int);
-  arg3 = va_arg (args, long int);
-  arg4 = va_arg (args, long int);
-  arg5 = va_arg (args, long int);
-  va_end (args);
-
-  {
-    LOAD_ARGS_6 (arg0, arg1, arg2, arg3, arg4, arg5)
-    register unsigned long int __res asm("r28");
-    PIC_REG_DEF
-    LOAD_REGS_6
-    asm volatile (SAVE_ASM_PIC
-		  "	ble  0x100(%%sr2, %%r0)	\n"
-		  "	copy %1, %%r20		\n"
-		  LOAD_ASM_PIC
-		  : "=r" (__res)
-		  : "r" (__sysno) PIC_REG_USE ASM_ARGS_6
-		  : "memory", CALL_CLOB_REGS CLOB_ARGS_6);
-    __sys_res = __res;
-  }
-  if ((unsigned long int) __sys_res >= (unsigned long int) -4095)
-    {
-      __set_errno (-__sys_res);
-      __sys_res = -1;
-    }
-  return __sys_res;
-}
diff --git a/sysdeps/unix/sysv/linux/riscv/syscall.c b/sysdeps/unix/sysv/linux/syscall.c
similarity index 53%
rename from sysdeps/unix/sysv/linux/riscv/syscall.c
rename to sysdeps/unix/sysv/linux/syscall.c
index a99375c054..2e39ed9bc9 100644
--- a/sysdeps/unix/sysv/linux/riscv/syscall.c
+++ b/sysdeps/unix/sysv/linux/syscall.c
@@ -1,5 +1,5 @@
-/* system call interface.  Linux/RISC-V version.
-   Copyright (C) 2001-2020 Free Software Foundation, Inc.
+/* Indirect system call.  Linux version.
+   Copyright (C) 2020 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
@@ -16,19 +16,26 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <stdarg.h>
 #include <sysdep.h>
 
 long int
-syscall (long int syscall_number, long int arg1, long int arg2, long int arg3,
-	 long int arg4, long int arg5, long int arg6, long int arg7)
+syscall (long int number, ...)
 {
-  long int ret;
-
-  ret = INTERNAL_SYSCALL_NCS (syscall_number, 7, arg1, arg2, arg3, arg4,
-			      arg5, arg6, arg7);
-
-  if (INTERNAL_SYSCALL_ERROR_P (ret))
-    return __syscall_error (ret);
-
-  return ret;
+  va_list args;
+
+  va_start (args, number);
+  long int arg0 = va_arg (args, long int);
+  long int arg1 = va_arg (args, long int);
+  long int arg2 = va_arg (args, long int);
+  long int arg3 = va_arg (args, long int);
+  long int arg4 = va_arg (args, long int);
+  long int arg5 = va_arg (args, long int);
+  va_end (args);
+
+  long int ret = INTERNAL_SYSCALL_NCS (number, 6, arg0, arg1, arg2,
+				       arg3, arg4, arg5);
+  return INTERNAL_SYSCALL_ERROR_P (ret)
+	 ? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (ret))
+	 : ret;
 }
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 28/28] alpha: Move implementations to C
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (26 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 27/28] linux: Add generic C syscall implementation Adhemerval Zanella
@ 2020-11-18 19:55 ` Adhemerval Zanella
  2020-11-18 21:06 ` [PATCH 00/28] More Linux syscall refactor Joseph Myers
  28 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-18 19:55 UTC (permalink / raw)
  To: libc-alpha

Move alpha specific the feraiseexcept, getegid, geteuid, getppid,
eee_get_fp_control, ieee_set_fp_control, and setcontext to C
implementations.

Checked on alpha-linux-gnu.
---
 .../alpha/{fraiseexcpt.S => fraiseexcpt.c}    | 37 ++++------------
 .../sysv/linux/alpha/{getegid.S => getegid.c} | 15 ++++---
 .../sysv/linux/alpha/{geteuid.S => geteuid.c} | 15 ++++---
 .../sysv/linux/alpha/{getppid.S => getppid.c} | 15 ++++---
 ...get_fp_control.S => ieee_get_fp_control.c} | 43 ++++++-------------
 ...set_fp_control.S => ieee_set_fp_control.c} | 35 ++++-----------
 .../alpha/{setcontext.S => setcontext.c}      | 27 ++++++------
 sysdeps/unix/sysv/linux/alpha/sysdep.h        | 21 +++++++++
 8 files changed, 87 insertions(+), 121 deletions(-)
 rename sysdeps/unix/sysv/linux/alpha/{fraiseexcpt.S => fraiseexcpt.c} (66%)
 rename sysdeps/unix/sysv/linux/alpha/{getegid.S => getegid.c} (79%)
 rename sysdeps/unix/sysv/linux/alpha/{geteuid.S => geteuid.c} (79%)
 rename sysdeps/unix/sysv/linux/alpha/{getppid.S => getppid.c} (79%)
 rename sysdeps/unix/sysv/linux/alpha/{ieee_get_fp_control.S => ieee_get_fp_control.c} (61%)
 rename sysdeps/unix/sysv/linux/alpha/{ieee_set_fp_control.S => ieee_set_fp_control.c} (62%)
 rename sysdeps/unix/sysv/linux/alpha/{setcontext.S => setcontext.c} (62%)

diff --git a/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S b/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c
similarity index 66%
rename from sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S
rename to sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c
index 8c4b933749..903eaebb66 100644
--- a/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S
+++ b/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2020 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
@@ -15,37 +15,16 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <fenv.h>
 #include <sysdep.h>
 #include "kernel_sysinfo.h"
 
-
-	.text
-
-ENTRY(__feraiseexcept)
-	cfi_startproc
-	PSEUDO_PROLOGUE
-
-	lda	sp, -16(sp)
-	cfi_adjust_cfa_offset(16)
-
-	ldi	v0, __NR_osf_setsysinfo
-	stq	a0, 0(sp)
-	mov	sp, a1
-	ldi	a0, SSI_IEEE_RAISE_EXCEPTION
-	call_pal PAL_callsys
-
-	lda	sp, 16(sp)
-	cfi_adjust_cfa_offset(-16)
-
-	/* Here in libm we can't use SYSCALL_ERROR_LABEL.  Nor is it clear
-	   that we'd want to set errno anyway.  All we're required to do is
-	   return non-zero on error.  Which is exactly A3.  */
-	mov	a3, v0
-	ret
-
-END(__feraiseexcept)
-	cfi_endproc
-
+int
+__feraiseexcept (int excepts)
+{
+  return -INTERNAL_SYSCALL_CALL (osf_setsysinfo, SSI_IEEE_RAISE_EXCEPTION,
+				 &excepts, 0, 0, 0);
+}
 #if IS_IN (libm)
 # include <shlib-compat.h>
 # if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
diff --git a/sysdeps/unix/sysv/linux/alpha/getegid.S b/sysdeps/unix/sysv/linux/alpha/getegid.c
similarity index 79%
rename from sysdeps/unix/sysv/linux/alpha/getegid.S
rename to sysdeps/unix/sysv/linux/alpha/getegid.c
index 72a941210a..9aeccd5ba9 100644
--- a/sysdeps/unix/sysv/linux/alpha/getegid.S
+++ b/sysdeps/unix/sysv/linux/alpha/getegid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Get effective group identity.  Linux/Alpha.
+   Copyright (C) 2020 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
@@ -15,12 +16,12 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <unistd.h>
 #include <sysdep.h>
 
-
-PSEUDO (__getegid, getxgid, 0)
-	MOVE (r1, r0)
-	ret
-PSEUDO_END (__getegid)
-
+gid_t
+__getegid (void)
+{
+  return __internal_syscall_pair (__NR_getxgid).sc_20;
+}
 weak_alias (__getegid, getegid)
diff --git a/sysdeps/unix/sysv/linux/alpha/geteuid.S b/sysdeps/unix/sysv/linux/alpha/geteuid.c
similarity index 79%
rename from sysdeps/unix/sysv/linux/alpha/geteuid.S
rename to sysdeps/unix/sysv/linux/alpha/geteuid.c
index a6db15d55c..63d73ac5d1 100644
--- a/sysdeps/unix/sysv/linux/alpha/geteuid.S
+++ b/sysdeps/unix/sysv/linux/alpha/geteuid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Get effective user identity.  Linux/Alpha.
+   Copyright (C) 2020 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
@@ -15,12 +16,12 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <unistd.h>
 #include <sysdep.h>
 
-
-PSEUDO (__geteuid, getxuid, 0)
-	MOVE (r1, r0)
-	ret
-PSEUDO_END (__geteuid)
-
+uid_t
+__geteuid (void)
+{
+  return __internal_syscall_pair (__NR_getxuid).sc_20;
+}
 weak_alias (__geteuid, geteuid)
diff --git a/sysdeps/unix/sysv/linux/alpha/getppid.S b/sysdeps/unix/sysv/linux/alpha/getppid.c
similarity index 79%
rename from sysdeps/unix/sysv/linux/alpha/getppid.S
rename to sysdeps/unix/sysv/linux/alpha/getppid.c
index ae5cfc03aa..968b2a96a7 100644
--- a/sysdeps/unix/sysv/linux/alpha/getppid.S
+++ b/sysdeps/unix/sysv/linux/alpha/getppid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Get parent process identification.  Linux/Alpha.
+   Copyright (C) 2020 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
@@ -15,12 +16,12 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <unistd.h>
 #include <sysdep.h>
 
-
-PSEUDO (__getppid, getxpid, 0)
-	MOVE (r1, r0)
-	ret
-PSEUDO_END (__getppid)
-
+pid_t
+__getppid (void)
+{
+  return __internal_syscall_pair (__NR_getxpid).sc_20;
+}
 weak_alias (__getppid, getppid)
diff --git a/sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S b/sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.c
similarity index 61%
rename from sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S
rename to sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.c
index 72c2fbfc10..44e467f927 100644
--- a/sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S
+++ b/sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by David Mosberger <davidm@azstarnet.com>, 1995.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -16,35 +15,19 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <fenv_libc.h>
 #include <sysdep.h>
 #include "kernel_sysinfo.h"
 
-
-	.text
-
-ENTRY(__ieee_get_fp_control)
-	cfi_startproc
-	PSEUDO_PROLOGUE
-
-	lda	sp, -16(sp)
-	cfi_adjust_cfa_offset(16)
-
-	mov	sp, a1
-	ldi	a0, GSI_IEEE_FP_CONTROL
-	ldi	v0, __NR_osf_getsysinfo
-	call_pal PAL_callsys
-
-	ldq	t0, 0(sp)
-	lda	sp, 16(sp)
-	cfi_adjust_cfa_offset(-16)
-
-	bne	a3, SYSCALL_ERROR_LABEL
-
-	mov	t0, v0
-	ret
-
-PSEUDO_END(__ieee_get_fp_control)
-	cfi_endproc
-
-libc_hidden_def(__ieee_get_fp_control)
+unsigned long int
+__ieee_get_fp_control (void)
+{
+  unsigned long int env;
+  int r = INLINE_SYSCALL_CALL (osf_getsysinfo, GSI_IEEE_FP_CONTROL, &env, 0,
+			       0, 0);
+  if (r != 0)
+    return r;
+  return env;
+}
+libc_hidden_def (__ieee_get_fp_control)
 weak_alias (__ieee_get_fp_control, ieee_get_fp_control)
diff --git a/sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S b/sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.c
similarity index 62%
rename from sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S
rename to sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.c
index 9e80346b3e..0a85ff1b64 100644
--- a/sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S
+++ b/sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by David Mosberger <davidm@azstarnet.com>, 1995.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -16,31 +15,15 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <fenv_libc.h>
 #include <sysdep.h>
 #include "kernel_sysinfo.h"
 
-
-ENTRY(__ieee_set_fp_control)
-	cfi_startproc
-	PSEUDO_PROLOGUE
-
-	lda	sp, -16(sp)
-	cfi_adjust_cfa_offset(16)
-
-	ldi	v0, __NR_osf_setsysinfo
-	stq	a0, 0(sp)
-	mov	sp, a1
-	ldi	a0, SSI_IEEE_FP_CONTROL
-	call_pal PAL_callsys
-
-	lda	sp, 16(sp)
-	cfi_adjust_cfa_offset(-16)
-
-	bne	a3, SYSCALL_ERROR_LABEL
-	ret
-
-PSEUDO_END(__ieee_set_fp_control)
-	cfi_endproc
-
-libc_hidden_def(__ieee_set_fp_control)
+void
+__ieee_set_fp_control (unsigned long int env)
+{
+  INLINE_SYSCALL_CALL (osf_setsysinfo, SSI_IEEE_FP_CONTROL, &env, 0,
+		       0, 0);
+}
+libc_hidden_def (__ieee_set_fp_control)
 weak_alias (__ieee_set_fp_control, ieee_set_fp_control)
diff --git a/sysdeps/unix/sysv/linux/alpha/setcontext.S b/sysdeps/unix/sysv/linux/alpha/setcontext.c
similarity index 62%
rename from sysdeps/unix/sysv/linux/alpha/setcontext.S
rename to sysdeps/unix/sysv/linux/alpha/setcontext.c
index 734f3d5109..4478bef26b 100644
--- a/sysdeps/unix/sysv/linux/alpha/setcontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/setcontext.c
@@ -1,5 +1,5 @@
-/* Install given context.
-   Copyright (C) 2004-2020 Free Software Foundation, Inc.
+/* Set the user context.  Linux/Alpha version.
+   Copyright (C) 2020 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
@@ -16,19 +16,16 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <ucontext.h>
 #include <sysdep.h>
-#include <ucontext-offsets.h>
 
-
-/* In case the user fiddled it, copy the "official" signal mask
-   from the ucontext_t into the sigcontext structure.  */
-#undef PSEUDO_PREPARE_ARGS
-#define PSEUDO_PREPARE_ARGS			\
-	ldq	$0, UC_SIGMASK($16);		\
-	stq	$0, UC_SIGCTX+SC_MASK($16);	\
-	lda	$16, UC_SIGCTX($16);
-
-PSEUDO(__setcontext, sigreturn, 1)
-	ret
-PSEUDO_END(__setcontext)
+int
+__setcontext (const ucontext_t *ucp)
+{
+  /* In case the user fiddled it, copy the "official" signal mask
+     from the ucontext_t into the sigcontext structure.  */
+  ucontext_t *ucp_noconst = (ucontext_t *) ucp;
+  ucp_noconst->uc_mcontext.sc_mask = *((long int *)&ucp_noconst->uc_sigmask);
+  return INLINE_SYSCALL_CALL (sigreturn, &ucp->uc_mcontext);
+}
 weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/alpha/sysdep.h b/sysdeps/unix/sysv/linux/alpha/sysdep.h
index 7daf445068..6d5458e2d8 100644
--- a/sysdeps/unix/sysv/linux/alpha/sysdep.h
+++ b/sysdeps/unix/sysv/linux/alpha/sysdep.h
@@ -314,6 +314,27 @@ __LABEL(name)						\
 	   : : internal_syscall_clobbers);			\
 	_sc_19 != 0 ? -_sc_0 : _sc_0;				\
 })
+
+struct pair_t
+{
+  long int sc_0;
+  long int sc_20;
+};
+
+static inline struct pair_t
+__internal_syscall_pair (long int name)
+{
+  register long int sc_19 asm ("$19");
+  register long int sc_20 asm ("$20");
+  register long int sc_0 = name;
+  asm volatile ("callsys # %0 %1 <= %2"
+		: "+v" (sc_0), "=r" (sc_19), "=r" (sc_20)
+		:
+		: internal_syscall_clobbers,
+		"$16", "$17", "$18", "$21");
+  return (struct pair_t) { sc_0, sc_20 };
+}
+
 #endif /* ASSEMBLER */
 
 /* Pointer mangling support.  Note that tls access is slow enough that
-- 
2.25.1


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 00/28] More Linux syscall refactor
  2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
                   ` (27 preceding siblings ...)
  2020-11-18 19:55 ` [PATCH 28/28] alpha: Move implementations to C Adhemerval Zanella
@ 2020-11-18 21:06 ` Joseph Myers
  2020-11-19 12:21   ` Adhemerval Zanella
  28 siblings, 1 reply; 38+ messages in thread
From: Joseph Myers @ 2020-11-18 21:06 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

This series introduces assumptions that various socket syscalls are 
available.  That's not valid until the minimum Linux kernel version has 
been increased to at least 4.4 (depending on the architecture, but 
probably such a change would be done globally).  In the case of 
getpeername and getsockname, at least, it's not safe (for 32-bit SPARC 
under 64-bit kernels) until Linux 4.20 - in general, before assuming a 
syscall to be present after any increase of the minimum Linux kernel 
version, it's important to review the actual state of support for that 
syscall in the minimum kernel version, including in compat syscall tables.

As I previously noted 
<https://sourceware.org/pipermail/libc-alpha/2020-July/116453.html>, I 
think we ought to implement Carlos's proposal of removing the runtime 
check for old kernel versions before increasing the minimum kernel 
version, given that an increased version allows very little cleanup for 
e.g. x86_64.

I also think that, when assuming presence of a syscall reduces the C 
implementation of a socket function to just calling a single syscall 
unconditionally, having one line for that function in a single 
syscalls.list file is better than having a manually-maintained C 
implementation.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 00/28] More Linux syscall refactor
  2020-11-18 21:06 ` [PATCH 00/28] More Linux syscall refactor Joseph Myers
@ 2020-11-19 12:21   ` Adhemerval Zanella
  2020-11-19 16:38     ` Joseph Myers
  0 siblings, 1 reply; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-19 12:21 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha



On 18/11/2020 18:06, Joseph Myers wrote:
> This series introduces assumptions that various socket syscalls are 
> available.  That's not valid until the minimum Linux kernel version has 
> been increased to at least 4.4 (depending on the architecture, but 
> probably such a change would be done globally).  In the case of 
> getpeername and getsockname, at least, it's not safe (for 32-bit SPARC 
> under 64-bit kernels) until Linux 4.20 - in general, before assuming a 
> syscall to be present after any increase of the minimum Linux kernel 
> version, it's important to review the actual state of support for that 
> syscall in the minimum kernel version, including in compat syscall tables.

The idea of this socket changes is to align with default Linux kernel ABI,
to make the outliers to explicit disable the syscall support where 
applicable and simplify the relation netweenn the syscalls.list and the 
required C implementations.

The 'bind', for instance, is not listed on sysdeps/unix/sysv/linux/syscalls.list,
so ports that do not imply on 'generic' will need to explicit disable on
the kernel-features.h.  Another idea of this change it to eventually
remove the sysdeps/unix/sysv/linux/generic/ and make 
sysdeps/unix/sysv/linux the default implementation.

And the idea is not change any current assumption, my goal is just reorganize
the code. For getpeername and getsockname is indeed wrong assumption in my
patch, it should disable both for !__arch64__ && __LINUX_KERNEL_VERSION < 0x040400.

> 
> As I previously noted 
> <https://sourceware.org/pipermail/libc-alpha/2020-July/116453.html>, I 
> think we ought to implement Carlos's proposal of removing the runtime 
> check for old kernel versions before increasing the minimum kernel 
> version, given that an increased version allows very little cleanup for 
> e.g. x86_64.

I thing this change is orthogonal to what I am proposing here.

> 
> I also think that, when assuming presence of a syscall reduces the C 
> implementation of a socket function to just calling a single syscall 
> unconditionally, having one line for that function in a single 
> syscalls.list file is better than having a manually-maintained C 
> implementation.
> 

I do agree, and my proposal here in once we have a proper support
for direct syscall with bump minimal kernel support we can just
remove the C implementation and move it to syscalls.list without
the need to change and rework over various files.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 08/28] linux: Assume getpeername support
  2020-11-18 19:55 ` [PATCH 08/28] linux: Assume getpeername support Adhemerval Zanella
@ 2020-11-19 12:55   ` Adhemerval Zanella
  0 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-19 12:55 UTC (permalink / raw)
  To: libc-alpha



On 18/11/2020 16:55, Adhemerval Zanella wrote:
> Checked with build for the affected ABI.
> ---
>  sysdeps/unix/syscalls.list                           | 1 -
>  sysdeps/unix/sysv/linux/alpha/syscalls.list          | 1 -
>  sysdeps/unix/sysv/linux/arm/syscalls.list            | 1 -
>  sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
>  sysdeps/unix/sysv/linux/hppa/syscalls.list           | 1 -
>  sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/ia64/syscalls.list           | 1 -
>  sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
>  sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
>  sysdeps/unix/sysv/linux/mips/syscalls.list           | 1 -
>  sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
>  sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
>  sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list  | 1 -
>  sysdeps/unix/sysv/linux/x86_64/syscalls.list         | 1 -
>  16 files changed, 4 insertions(+), 15 deletions(-)
> 
> diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
> index 7209c24110..6d1a2ad441 100644
> --- a/sysdeps/unix/syscalls.list
> +++ b/sysdeps/unix/syscalls.list
> @@ -25,7 +25,6 @@ getgid		-	getgid		Ei:	__getgid	getgid
>  getgroups	-	getgroups	i:ip	__getgroups	getgroups
>  gethostid	-	gethostid	i:	gethostid
>  gethostname	-	gethostname	i:bn	__gethostname	gethostname
> -getpeername	-	getpeername	i:ibN	__getpeername	getpeername
>  getpid		-	getpid		Ei:	__getpid	getpid
>  getpriority	-	getpriority	i:ii	__getpriority	getpriority
>  getrlimit	-	getrlimit	i:ip	__getrlimit	getrlimit
> diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
> index a4e432c50c..62d79edd56 100644
> --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
> @@ -5,7 +5,6 @@ sigstack	-	sigstack	2	sigstack
>  getpriority	-	getpriority	i:ii	__getpriority	getpriority
>  
>  # proper socket implementations:
> -getpeername	-	getpeername	i:ipp	__getpeername	getpeername
>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
>  listen		-	listen		i:ii	__listen	listen
> diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
> index 5982889636..87e6c6c88d 100644
> --- a/sysdeps/unix/sysv/linux/arm/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
> @@ -20,7 +20,6 @@ prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
>  fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
>  
>  # proper socket implementations:
> -getpeername	-	getpeername	i:ipp	__getpeername	getpeername
>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
>  listen		-	listen		i:ii	__listen	listen
> diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
> index 98984cf59d..3af1893c80 100644
> --- a/sysdeps/unix/sysv/linux/generic/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
> @@ -5,7 +5,6 @@ socket		-	socket		i:iii	__socket	socket
>  socketpair	-	socketpair	i:iiif	__socketpair	socketpair
>  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
>  shutdown	-	shutdown	i:ii	__shutdown	shutdown
> diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
> index 0f54c50eba..0d4e9d5e1c 100644
> --- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
> @@ -1,7 +1,6 @@
>  # File name	Caller	Syscall name	# args	Strong name	Weak names
>  
>  # proper socket implementations:
> -getpeername	-	getpeername	i:ipp	__getpeername	getpeername
>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
>  listen		-	listen		i:ii	__listen	listen
> diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> index 46c5334385..53e9890819 100644
> --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> @@ -25,7 +25,6 @@
>  # define __ASSUME_GETSOCKOPT_SYSCALL         1
>  # define __ASSUME_SETSOCKOPT_SYSCALL         1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
> -# define __ASSUME_GETPEERNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
>  
> @@ -41,6 +40,7 @@
>  # undef __ASSUME_CONNECT_SYSCALL
>  # undef __ASSUME_RECVFROM_SYSCALL
>  # undef __ASSUME_SENDTO_SYSCALL
> +# undef __ASSUME_GETPEERNAME_SYSCALL
>  #endif
>  
>  /* i686 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
> index 5a77f18ada..5bb62003d0 100644
> --- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
> @@ -3,7 +3,6 @@
>  getpriority	-	getpriority	i:ii	__getpriority	getpriority
>  
>  # proper socket implementations:
> -getpeername	-	getpeername	i:ipp	__getpeername	getpeername
>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
>  listen		-	listen		i:ii	__listen	listen
> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
> index 71a2631fc0..9945f4388b 100644
> --- a/sysdeps/unix/sysv/linux/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
> @@ -78,6 +78,7 @@
>  #define __ASSUME_ACCEPT4_SYSCALL	1
>  #define __ASSUME_RECVMMSG_SYSCALL	1
>  #define __ASSUME_SENDMMSG_SYSCALL	1
> +#define __ASSUME_GETPEERNAME_SYSCALL    1
>  
>  /* Support for SysV IPC through wired syscalls.  All supported architectures
>     either support ipc syscall and/or all the ipc correspondent syscalls.  */
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index 06457d3761..e321895ae8 100644
> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> @@ -25,7 +25,6 @@
>  # define __ASSUME_GETSOCKOPT_SYSCALL         1
>  # define __ASSUME_SETSOCKOPT_SYSCALL         1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
> -# define __ASSUME_GETPEERNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
>  
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_CONNECT_SYSCALL
>  # undef __ASSUME_RECVFROM_SYSCALL
>  # undef __ASSUME_SENDTO_SYSCALL
> +# undef __ASSUME_GETPEERNAME_SYSCALL
>  #endif
>  
>  /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
> diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> index 2facec8c4c..13eba077d6 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> @@ -22,7 +22,6 @@
>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
> -#define __ASSUME_GETPEERNAME_SYSCALL	1
>  #define __ASSUME_SOCKETPAIR_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
> diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
> index 0415d40ee8..a9dff10271 100644
> --- a/sysdeps/unix/sysv/linux/mips/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
> @@ -12,7 +12,6 @@ sysmips		-	sysmips		i:iiii	__sysmips	sysmips
>  # Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
>  # it's provided for compatibility, though.
>  #
> -getpeername	-	getpeername	i:ipp	__getpeername	getpeername
>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
>  listen		-	listen		i:ii	__listen	listen
> diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> index c7079a4507..ed7d75e0a4 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> @@ -22,7 +22,6 @@
>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
> -#define __ASSUME_GETPEERNAME_SYSCALL	1
>  #define __ASSUME_SOCKETPAIR_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
> diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> index 549ecc994d..7a7b22ed01 100644
> --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> @@ -25,7 +25,6 @@
>  # define __ASSUME_GETSOCKOPT_SYSCALL         1
>  # define __ASSUME_SETSOCKOPT_SYSCALL         1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
> -# define __ASSUME_GETPEERNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
>  
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_CONNECT_SYSCALL
>  # undef __ASSUME_RECVFROM_SYSCALL
>  # undef __ASSUME_SENDTO_SYSCALL
> +# undef __ASSUME_GETPEERNAME_SYSCALL
>  #endif
>  
>  /* s390 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> index 04ecd02ecd..34109ae859 100644
> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> @@ -27,7 +27,6 @@
>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
> -#define __ASSUME_GETPEERNAME_SYSCALL	1
>  #define __ASSUME_SOCKETPAIR_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
> index d30d7f2b96..2acc8a1437 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
> @@ -1,6 +1,5 @@
>  # File name	Caller	Syscall name	# args	Strong name	Weak names
>  
> -getpeername	-	getpeername	3	__getpeername	getpeername
>  getsockname	-	getsockname	3	__getsockname	getsockname
>  getsockopt	-	getsockopt	5	__getsockopt	getsockopt
>  shutdown	-	shutdown	2	__shutdown	shutdown

It also requires to disable for sparc32 targeting kernel lower than 4.4:

diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 8f7348d9ad..6429aaf8c2 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -38,6 +38,7 @@
 # undef __ASSUME_CONNECT_SYSCALL
 # undef __ASSUME_RECVFROM_SYSCALL
 # undef __ASSUME_SENDTO_SYSCALL
+# undef __ASSUME_GETPEERNAME_SYSCALL
 #else
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1


> diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
> index a6a725e198..f7612e6545 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
> @@ -6,7 +6,6 @@ syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime
>  
>  
>  # proper socket implementations:
> -getpeername	-	getpeername	i:ipp	__getpeername	getpeername
>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
>  listen		-	listen		i:ii	__listen	listen
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 09/28] linux: Assume getsockname support
  2020-11-18 19:55 ` [PATCH 09/28] linux: Assume getsockname support Adhemerval Zanella
@ 2020-11-19 12:56   ` Adhemerval Zanella
  0 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-19 12:56 UTC (permalink / raw)
  To: libc-alpha



On 18/11/2020 16:55, Adhemerval Zanella wrote:
> Checked with build for the affected ABI.
> ---
>  sysdeps/unix/sysv/linux/alpha/syscalls.list          | 1 -
>  sysdeps/unix/sysv/linux/arm/syscalls.list            | 1 -
>  sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
>  sysdeps/unix/sysv/linux/hppa/syscalls.list           | 1 -
>  sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/ia64/syscalls.list           | 1 -
>  sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
>  sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
>  sysdeps/unix/sysv/linux/mips/syscalls.list           | 1 -
>  sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
>  sysdeps/unix/sysv/linux/s390/kernel-features.h       | 1 -
>  sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
>  sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list  | 1 -
>  sysdeps/unix/sysv/linux/x86_64/syscalls.list         | 1 -
>  15 files changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
> index 62d79edd56..26e4070686 100644
> --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
> @@ -5,7 +5,6 @@ sigstack	-	sigstack	2	sigstack
>  getpriority	-	getpriority	i:ii	__getpriority	getpriority
>  
>  # proper socket implementations:
> -getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
>  listen		-	listen		i:ii	__listen	listen
>  setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
> diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
> index 87e6c6c88d..71e2b99cf5 100644
> --- a/sysdeps/unix/sysv/linux/arm/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
> @@ -20,7 +20,6 @@ prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
>  fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
>  
>  # proper socket implementations:
> -getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
>  listen		-	listen		i:ii	__listen	listen
>  setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
> diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
> index 3af1893c80..5e4b8f2e29 100644
> --- a/sysdeps/unix/sysv/linux/generic/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
> @@ -4,7 +4,6 @@
>  socket		-	socket		i:iii	__socket	socket
>  socketpair	-	socketpair	i:iiif	__socketpair	socketpair
>  listen		-	listen		i:ii	__listen	listen
> -getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
>  getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
>  shutdown	-	shutdown	i:ii	__shutdown	shutdown
> diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
> index 0d4e9d5e1c..ec6105c655 100644
> --- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
> @@ -1,7 +1,6 @@
>  # File name	Caller	Syscall name	# args	Strong name	Weak names
>  
>  # proper socket implementations:
> -getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
>  listen		-	listen		i:ii	__listen	listen
>  setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
> diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> index 53e9890819..be1cfe94b8 100644
> --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> @@ -24,7 +24,6 @@
>  # define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKOPT_SYSCALL         1
>  # define __ASSUME_SETSOCKOPT_SYSCALL         1
> -# define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
>  
> @@ -41,6 +40,7 @@
>  # undef __ASSUME_RECVFROM_SYSCALL
>  # undef __ASSUME_SENDTO_SYSCALL
>  # undef __ASSUME_GETPEERNAME_SYSCALL
> +# undef __ASSUME_GETSOCKNAME_SYSCALL
>  #endif
>  
>  /* i686 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
> index 5bb62003d0..748ba3215c 100644
> --- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
> @@ -3,7 +3,6 @@
>  getpriority	-	getpriority	i:ii	__getpriority	getpriority
>  
>  # proper socket implementations:
> -getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
>  listen		-	listen		i:ii	__listen	listen
>  setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
> index 9945f4388b..7266f34100 100644
> --- a/sysdeps/unix/sysv/linux/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
> @@ -79,6 +79,7 @@
>  #define __ASSUME_RECVMMSG_SYSCALL	1
>  #define __ASSUME_SENDMMSG_SYSCALL	1
>  #define __ASSUME_GETPEERNAME_SYSCALL    1
> +#define __ASSUME_GETSOCKNAME_SYSCALL    1
>  
>  /* Support for SysV IPC through wired syscalls.  All supported architectures
>     either support ipc syscall and/or all the ipc correspondent syscalls.  */
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index e321895ae8..1acdabb637 100644
> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> @@ -24,7 +24,6 @@
>  # define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKOPT_SYSCALL         1
>  # define __ASSUME_SETSOCKOPT_SYSCALL         1
> -# define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
>  
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_RECVFROM_SYSCALL
>  # undef __ASSUME_SENDTO_SYSCALL
>  # undef __ASSUME_GETPEERNAME_SYSCALL
> +# undef __ASSUME_GETSOCKNAME_SYSCALL
>  #endif
>  
>  /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
> diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> index 13eba077d6..84c1b144e0 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> @@ -21,7 +21,6 @@
>  #define __ASSUME_SOCKET_SYSCALL		1
>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
> -#define __ASSUME_GETSOCKNAME_SYSCALL	1
>  #define __ASSUME_SOCKETPAIR_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
> diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
> index a9dff10271..e2a6d1ca64 100644
> --- a/sysdeps/unix/sysv/linux/mips/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
> @@ -12,7 +12,6 @@ sysmips		-	sysmips		i:iiii	__sysmips	sysmips
>  # Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
>  # it's provided for compatibility, though.
>  #
> -getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
>  listen		-	listen		i:ii	__listen	listen
>  setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
> diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> index ed7d75e0a4..40a38ebe4f 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> @@ -21,7 +21,6 @@
>  #define __ASSUME_SOCKET_SYSCALL	1
>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
> -#define __ASSUME_GETSOCKNAME_SYSCALL	1
>  #define __ASSUME_SOCKETPAIR_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
> diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> index 7a7b22ed01..a3bb354246 100644
> --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> @@ -24,7 +24,6 @@
>  # define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKOPT_SYSCALL         1
>  # define __ASSUME_SETSOCKOPT_SYSCALL         1
> -# define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
>  
> diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> index 34109ae859..ee5b556b7b 100644
> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> @@ -26,7 +26,6 @@
>  #define __ASSUME_SOCKET_SYSCALL		1
>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
> -#define __ASSUME_GETSOCKNAME_SYSCALL	1
>  #define __ASSUME_SOCKETPAIR_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
> index 2acc8a1437..f20a343840 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
> @@ -1,6 +1,5 @@
>  # File name	Caller	Syscall name	# args	Strong name	Weak names
>  
> -getsockname	-	getsockname	3	__getsockname	getsockname
>  getsockopt	-	getsockopt	5	__getsockopt	getsockopt
>  shutdown	-	shutdown	2	__shutdown	shutdown
>  socketpair	-	socketpair	4	__socketpair	socketpair

It also requires to disable for sparc32 targeting kernel lower than 4.4:

diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 6429aaf8c2..6af42a6684 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -39,6 +39,7 @@
 # undef __ASSUME_RECVFROM_SYSCALL
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETPEERNAME_SYSCALL
+# undef __ASSUME_GETSOCKNAME_SYSCALL
 #else
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1

> diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
> index f7612e6545..d9cd71773d 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
> @@ -6,7 +6,6 @@ syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime
>  
>  
>  # proper socket implementations:
> -getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
>  listen		-	listen		i:ii	__listen	listen
>  setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 00/28] More Linux syscall refactor
  2020-11-19 12:21   ` Adhemerval Zanella
@ 2020-11-19 16:38     ` Joseph Myers
  2020-11-19 17:43       ` Adhemerval Zanella
  0 siblings, 1 reply; 38+ messages in thread
From: Joseph Myers @ 2020-11-19 16:38 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Thu, 19 Nov 2020, Adhemerval Zanella wrote:

> And the idea is not change any current assumption, my goal is just reorganize
> the code.

Then I think the individual patches need longer descriptions that make 
this clear - that is, that say explicitly that the change is to the 
default, with the final value of the __ASSUME_* macro being unchanged for 
all glibc configurations.  Because that's not what e.g. "Assume bind 
support" suggests to me.

> For getpeername and getsockname is indeed wrong assumption in my
> patch, it should disable both for !__arch64__ && __LINUX_KERNEL_VERSION < 0x040400.

4.20 for those two, I think, because of the compat syscall table.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 26/28] linux: Consolidate brk implementation
  2020-11-18 19:55 ` [PATCH 26/28] linux: Consolidate brk implementation Adhemerval Zanella
@ 2020-11-19 17:31   ` Tulio Magno Quites Machado Filho
  2020-11-19 17:53     ` Adhemerval Zanella
  2020-11-19 20:08   ` Adhemerval Zanella
  1 sibling, 1 reply; 38+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2020-11-19 17:31 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org> writes:

> diff --git a/sysdeps/unix/sysv/linux/pipe.c b/sysdeps/unix/sysv/linux/pipe.c
> index 0ea6ca5842..bc105ba6a7 100644
> --- a/sysdeps/unix/sysv/linux/pipe.c
> +++ b/sysdeps/unix/sysv/linux/pipe.c
> @@ -26,7 +26,7 @@
>  int
>  __pipe (int __pipedes[2])
> -{
> -  return INLINE_SYSCALL_CALL (pipe2, __pipedes, 0);
> +  return INLINE_SYSCALL_CALL (pipe2, (int *) __pipedes, 0);

Oops.  I think this part was intended for the previous patch.

This patch LGTM after removing this.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

-- 
Tulio Magno

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 00/28] More Linux syscall refactor
  2020-11-19 16:38     ` Joseph Myers
@ 2020-11-19 17:43       ` Adhemerval Zanella
  0 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-19 17:43 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha



On 19/11/2020 13:38, Joseph Myers wrote:
> On Thu, 19 Nov 2020, Adhemerval Zanella wrote:
> 
>> And the idea is not change any current assumption, my goal is just reorganize
>> the code.
> 
> Then I think the individual patches need longer descriptions that make 
> this clear - that is, that say explicitly that the change is to the 
> default, with the final value of the __ASSUME_* macro being unchanged for 
> all glibc configurations.  Because that's not what e.g. "Assume bind 
> support" suggests to me.

Fair enough, I will improve the message on the patches.

> 
>> For getpeername and getsockname is indeed wrong assumption in my
>> patch, it should disable both for !__arch64__ && __LINUX_KERNEL_VERSION < 0x040400.
> 
> 4.20 for those two, I think, because of the compat syscall table.
> 

Right, I will fix this also.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 26/28] linux: Consolidate brk implementation
  2020-11-19 17:31   ` Tulio Magno Quites Machado Filho
@ 2020-11-19 17:53     ` Adhemerval Zanella
  0 siblings, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-19 17:53 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, libc-alpha



On 19/11/2020 14:31, Tulio Magno Quites Machado Filho wrote:
> Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org> writes:
> 
>> diff --git a/sysdeps/unix/sysv/linux/pipe.c b/sysdeps/unix/sysv/linux/pipe.c
>> index 0ea6ca5842..bc105ba6a7 100644
>> --- a/sysdeps/unix/sysv/linux/pipe.c
>> +++ b/sysdeps/unix/sysv/linux/pipe.c
>> @@ -26,7 +26,7 @@
>>  int
>>  __pipe (int __pipedes[2])
>> -{
>> -  return INLINE_SYSCALL_CALL (pipe2, __pipedes, 0);
>> +  return INLINE_SYSCALL_CALL (pipe2, (int *) __pipedes, 0);
> 
> Oops.  I think this part was intended for the previous patch.
> 
> This patch LGTM after removing this.
> 
> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
> 

Indeed, I will remove it.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 26/28] linux: Consolidate brk implementation
  2020-11-18 19:55 ` [PATCH 26/28] linux: Consolidate brk implementation Adhemerval Zanella
  2020-11-19 17:31   ` Tulio Magno Quites Machado Filho
@ 2020-11-19 20:08   ` Adhemerval Zanella
  1 sibling, 0 replies; 38+ messages in thread
From: Adhemerval Zanella @ 2020-11-19 20:08 UTC (permalink / raw)
  To: libc-alpha



On 18/11/2020 16:55, Adhemerval Zanella wrote:
> diff --git a/sysdeps/unix/sysv/linux/i386/brk.c b/sysdeps/unix/sysv/linux/i386/brk.c
> deleted file mode 100644
> index 021b6d37a0..0000000000
> --- a/sysdeps/unix/sysv/linux/i386/brk.c
> +++ /dev/null
> @@ -1,45 +0,0 @@
[...]
> -
> -#if BUILD_PIE_DEFAULT
> -/* Can't use "call *%gs:SYSINFO_OFFSET" during statup in static PIE.  */
> -# define I386_USE_SYSENTER 0
> -#endif

This is require to --enable-static-pie work properly, I will reinstate
it.

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2020-11-19 20:08 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 01/28] Remove generic pthread linuxism on POSIX timer_routine Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 02/28] Removed ununsed pthread implementations Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 03/28] Remove local-setxid.h Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 04/28] Remove HAVE_INLINED_SYSCALLS usage on generic implementations Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 05/28] linux: Consolidate and cleanup personality syscall Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 06/28] x32: Remove syscalls.list Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 07/28] linux: Assume bind support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 08/28] linux: Assume getpeername support Adhemerval Zanella
2020-11-19 12:55   ` Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 09/28] linux: Assume getsockname support Adhemerval Zanella
2020-11-19 12:56   ` Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 10/28] linux: Assume getsockopt support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 11/28] linux: Assume listen support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 12/28] linux: Assume setsockopt support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 13/28] linux: Assume shutdown support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 14/28] linux: Assume socket support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 15/28] linux: Assume socketpair support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 16/28] linux: Remove superflous __ASSUME_CONNECT_SYSCALL definitions Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 17/28] x86_64: Remove ununsed syscalls.list entry Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 18/28] nptl: Add futex_trylock_pi Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 19/28] linux: Add fanotify_mark C implementation Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 20/28] linux: Add prlimit64 " Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 21/28] linux: Implement mremap in C Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 22/28] Linux: implement ioctl " Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 23/28] mips: Implement n32 lseek64 " Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 24/28] x32: Implement " Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 25/28] linux: Implement pipe in terms of __NR_pipe2 Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 26/28] linux: Consolidate brk implementation Adhemerval Zanella
2020-11-19 17:31   ` Tulio Magno Quites Machado Filho
2020-11-19 17:53     ` Adhemerval Zanella
2020-11-19 20:08   ` Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 27/28] linux: Add generic C syscall implementation Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 28/28] alpha: Move implementations to C Adhemerval Zanella
2020-11-18 21:06 ` [PATCH 00/28] More Linux syscall refactor Joseph Myers
2020-11-19 12:21   ` Adhemerval Zanella
2020-11-19 16:38     ` Joseph Myers
2020-11-19 17:43       ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).