unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/7] Remove __waitpid_nocancel
@ 2019-11-14 14:46 Adhemerval Zanella
  2019-11-14 14:46 ` [PATCH 2/7] nptl: Move wait implementation to libc Adhemerval Zanella
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Adhemerval Zanella @ 2019-11-14 14:46 UTC (permalink / raw)
  To: libc-alpha; +Cc: Alistair Francis, alistair23

It enables and disable cancellation with pthread_setcancelstate
prior calling the waitpid.  It simplifies the waitpid implementation
for architectures that does not provide either __NR_waitpid or
__NR_wait4.

Checked on x86_64-linux-gnu.
---
 libio/iopopen.c                            |  6 +++-
 sysdeps/generic/not-cancel.h               |  2 --
 sysdeps/posix/system.c                     |  6 +++-
 sysdeps/unix/sysv/linux/Makefile           |  2 +-
 sysdeps/unix/sysv/linux/not-cancel.h       |  4 ---
 sysdeps/unix/sysv/linux/waitpid_nocancel.c | 34 ----------------------
 6 files changed, 11 insertions(+), 43 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/waitpid_nocancel.c

diff --git a/libio/iopopen.c b/libio/iopopen.c
index 22d53a88ef..a15d3bf4b6 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -281,7 +281,11 @@ _IO_new_proc_close (FILE *fp)
      described in POSIX.2, such implementations are not conforming." */
   do
     {
-      wait_pid = __waitpid_nocancel (((_IO_proc_file *) fp)->pid, &wstatus, 0);
+      int state;
+      __libc_ptf_call (__pthread_setcancelstate,
+		       (PTHREAD_CANCEL_DISABLE, &state), 0);
+      wait_pid = __waitpid (((_IO_proc_file *) fp)->pid, &wstatus, 0);
+      __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
     }
   while (wait_pid == -1 && errno == EINTR);
   if (wait_pid == -1)
diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h
index d3b53e48cf..e0729bb1db 100644
--- a/sysdeps/generic/not-cancel.h
+++ b/sysdeps/generic/not-cancel.h
@@ -47,8 +47,6 @@
   __write (fd, buf, n)
 #define __writev_nocancel_nostatus(fd, iov, n) \
   (void) __writev (fd, iov, n)
-# define __waitpid_nocancel(pid, stat_loc, options) \
-  __waitpid (pid, stat_loc, options)
 #define __fcntl64_nocancel(fd, cmd, ...) \
   __fcntl64 (fd, cmd, __VA_ARGS__)
 
diff --git a/sysdeps/posix/system.c b/sysdeps/posix/system.c
index d8c6cb8e1c..6de85bd3e4 100644
--- a/sysdeps/posix/system.c
+++ b/sysdeps/posix/system.c
@@ -81,7 +81,11 @@ cancel_handler (void *arg)
 
   __kill_noerrno (args->pid, SIGKILL);
 
-  TEMP_FAILURE_RETRY (__waitpid_nocancel (args->pid, NULL, 0));
+  int state;
+  __libc_ptf_call (__pthread_setcancelstate,
+                   (PTHREAD_CANCEL_DISABLE, &state), 0);
+  TEMP_FAILURE_RETRY (__waitpid (args->pid, NULL, 0));
+  __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
 
   DO_LOCK ();
   if (SUB_REF () == 0)
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 07776d28ea..8735092c12 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -216,7 +216,7 @@ sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \
 		   open_nocancel open64_nocancel \
 		   openat_nocancel openat64_nocancel \
 		   read_nocancel pread64_nocancel \
-		   waitpid_nocancel write_nocancel statx_cp
+		   write_nocancel statx_cp
 
 sysdep_headers += bits/fcntl-linux.h
 
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index 192a0a5195..49e4e0249a 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -69,9 +69,6 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt)
   INTERNAL_SYSCALL_CALL (writev, err, fd, iov, iovcnt);
 }
 
-/* Uncancelable waitpid.  */
-__typeof (waitpid) __waitpid_nocancel;
-
 /* Uncancelable fcntl.  */
 __typeof (__fcntl) __fcntl64_nocancel;
 
@@ -84,7 +81,6 @@ hidden_proto (__read_nocancel)
 hidden_proto (__pread64_nocancel)
 hidden_proto (__write_nocancel)
 hidden_proto (__close_nocancel)
-hidden_proto (__waitpid_nocancel)
 hidden_proto (__fcntl64_nocancel)
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/waitpid_nocancel.c b/sysdeps/unix/sysv/linux/waitpid_nocancel.c
deleted file mode 100644
index 3697c6b938..0000000000
--- a/sysdeps/unix/sysv/linux/waitpid_nocancel.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Linux waitpid syscall implementation -- non-cancellable.
-   Copyright (C) 2018-2019 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 <sysdep-cancel.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-#include <not-cancel.h>
-
-__pid_t
-__waitpid_nocancel (__pid_t pid, int *stat_loc, int options)
-{
-#ifdef __NR_waitpid
-  return INLINE_SYSCALL_CALL (waitpid, pid, stat_loc, options);
-#else
-  return INLINE_SYSCALL_CALL (wait4, pid, stat_loc, options, NULL);
-#endif
-}
-libc_hidden_def (__waitpid_nocancel)
-- 
2.17.1


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

* [PATCH 2/7] nptl: Move wait implementation to libc
  2019-11-14 14:46 [PATCH 1/7] Remove __waitpid_nocancel Adhemerval Zanella
@ 2019-11-14 14:46 ` Adhemerval Zanella
  2019-11-14 14:47 ` [PATCH 3/7] nptl: Move waitpid " Adhemerval Zanella
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Adhemerval Zanella @ 2019-11-14 14:46 UTC (permalink / raw)
  To: libc-alpha; +Cc: Alistair Francis, alistair23

Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.
---
 nptl/Makefile                                    |  3 +--
 nptl/Versions                                    |  2 +-
 nptl/libpthread-compat.c                         | 16 ++++++++++++++--
 .../unix/sysv/linux/aarch64/libpthread.abilist   |  2 --
 sysdeps/unix/sysv/linux/alpha/libpthread.abilist |  2 --
 .../unix/sysv/linux/arm/be/libpthread.abilist    |  2 --
 .../unix/sysv/linux/arm/le/libpthread.abilist    |  2 --
 sysdeps/unix/sysv/linux/csky/libpthread.abilist  |  2 --
 sysdeps/unix/sysv/linux/hppa/libpthread.abilist  |  3 ---
 sysdeps/unix/sysv/linux/i386/libpthread.abilist  |  2 --
 sysdeps/unix/sysv/linux/ia64/libpthread.abilist  |  3 ---
 .../sysv/linux/m68k/coldfire/libpthread.abilist  |  2 --
 .../sysv/linux/m68k/m680x0/libpthread.abilist    |  2 --
 .../sysv/linux/microblaze/be/libpthread.abilist  |  2 --
 .../sysv/linux/microblaze/le/libpthread.abilist  |  2 --
 .../sysv/linux/mips/mips32/libpthread.abilist    |  3 ---
 .../sysv/linux/mips/mips64/libpthread.abilist    |  3 ---
 sysdeps/unix/sysv/linux/nios2/libpthread.abilist |  2 --
 .../linux/powerpc/powerpc32/libpthread.abilist   |  2 --
 .../powerpc/powerpc64/be/libpthread.abilist      |  2 --
 .../powerpc/powerpc64/le/libpthread.abilist      |  2 --
 .../sysv/linux/riscv/rv64/libpthread.abilist     |  2 --
 .../sysv/linux/s390/s390-32/libpthread.abilist   |  2 --
 .../sysv/linux/s390/s390-64/libpthread.abilist   |  3 ---
 sysdeps/unix/sysv/linux/sh/be/libpthread.abilist |  3 ---
 sysdeps/unix/sysv/linux/sh/le/libpthread.abilist |  3 ---
 .../sysv/linux/sparc/sparc32/libpthread.abilist  |  2 --
 .../sysv/linux/sparc/sparc64/libpthread.abilist  |  3 ---
 .../unix/sysv/linux/x86_64/64/libpthread.abilist |  3 ---
 .../sysv/linux/x86_64/x32/libpthread.abilist     |  2 --
 30 files changed, 16 insertions(+), 68 deletions(-)

diff --git a/nptl/Makefile b/nptl/Makefile
index f9aadfd644..f93d41176f 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -46,7 +46,7 @@ pthread-compat-wrappers = \
 		      sendto fsync lseek lseek64 \
 		      msync open open64 pause \
 		      pread pread64 pwrite pwrite64 \
-		      tcdrain wait waitpid msgrcv msgsnd \
+		      tcdrain waitpid msgrcv msgsnd \
 		      sigwait sigsuspend \
 		      recvmsg sendmsg
 
@@ -205,7 +205,6 @@ CFLAGS-pread.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pread64.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pwrite.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pwrite64.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-wait.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-waitpid.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-sigwait.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-msgrcv.c += -fexceptions -fasynchronous-unwind-tables
diff --git a/nptl/Versions b/nptl/Versions
index 5d6aedb7de..1dda4b9064 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -99,7 +99,7 @@ libpthread {
     close; __close; fcntl; __fcntl; read; __read; write; __write; accept;
     connect; __connect; recv; recvfrom; recvmsg; send; __send; sendmsg; sendto;
     fsync; lseek; __lseek; msync; open; __open; pause; tcdrain;
-    system; wait; __wait; waitpid;
+    system; waitpid;
 
     # Hidden entry point (through macros).
     _pthread_cleanup_push; _pthread_cleanup_pop;
diff --git a/nptl/libpthread-compat.c b/nptl/libpthread-compat.c
index 7398f5e92d..e11505abfa 100644
--- a/nptl/libpthread-compat.c
+++ b/nptl/libpthread-compat.c
@@ -26,12 +26,24 @@
    version or later, the placeholder symbol is not needed because
    there are plenty of other symbols which populate those later
    versions.  */
-#if (SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_2_6))
+#if (SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1_2) \
+     || SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_2))
 void
 attribute_compat_text_section
 __libpthread_version_placeholder (void)
 {
 }
-compat_symbol (libpthread, __libpthread_version_placeholder,
+#endif
+
+#if (SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1_2))
+strong_alias (__libpthread_version_placeholder,
+              __libpthread_version_placeholder_20)
+compat_symbol (libpthread, __libpthread_version_placeholder_20,
+               __libpthread_version_placeholder, GLIBC_2_0);
+#endif
+#if (SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_2))
+strong_alias (__libpthread_version_placeholder,
+              __libpthread_version_placeholder_212)
+compat_symbol (libpthread, __libpthread_version_placeholder_212,
                __libpthread_version_placeholder, GLIBC_2_1_2);
 #endif
diff --git a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
index 98a8473fcd..cfa71ef697 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
@@ -44,7 +44,6 @@ GLIBC_2.17 __read F
 GLIBC_2.17 __res_state F
 GLIBC_2.17 __send F
 GLIBC_2.17 __sigaction F
-GLIBC_2.17 __wait F
 GLIBC_2.17 __write F
 GLIBC_2.17 _pthread_cleanup_pop F
 GLIBC_2.17 _pthread_cleanup_pop_restore F
@@ -203,7 +202,6 @@ GLIBC_2.17 siglongjmp F
 GLIBC_2.17 sigwait F
 GLIBC_2.17 system F
 GLIBC_2.17 tcdrain F
-GLIBC_2.17 wait F
 GLIBC_2.17 waitpid F
 GLIBC_2.17 write F
 GLIBC_2.18 pthread_getattr_default_np F
diff --git a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
index f42bcffd1e..ddb500a9d7 100644
--- a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
@@ -24,7 +24,6 @@ GLIBC_2.0 __pthread_setspecific F
 GLIBC_2.0 __read F
 GLIBC_2.0 __send F
 GLIBC_2.0 __sigaction F
-GLIBC_2.0 __wait F
 GLIBC_2.0 __write F
 GLIBC_2.0 _pthread_cleanup_pop F
 GLIBC_2.0 _pthread_cleanup_pop_restore F
@@ -103,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 wait F
 GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.1 __libc_allocate_rtsig F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
index c5b7aeb7c4..428aac48e6 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
@@ -79,7 +79,6 @@ GLIBC_2.4 __read F
 GLIBC_2.4 __res_state F
 GLIBC_2.4 __send F
 GLIBC_2.4 __sigaction F
-GLIBC_2.4 __wait F
 GLIBC_2.4 __write F
 GLIBC_2.4 _pthread_cleanup_pop F
 GLIBC_2.4 _pthread_cleanup_pop_restore F
@@ -232,6 +231,5 @@ GLIBC_2.4 siglongjmp F
 GLIBC_2.4 sigwait F
 GLIBC_2.4 system F
 GLIBC_2.4 tcdrain F
-GLIBC_2.4 wait F
 GLIBC_2.4 waitpid F
 GLIBC_2.4 write F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
index c5b7aeb7c4..428aac48e6 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
@@ -79,7 +79,6 @@ GLIBC_2.4 __read F
 GLIBC_2.4 __res_state F
 GLIBC_2.4 __send F
 GLIBC_2.4 __sigaction F
-GLIBC_2.4 __wait F
 GLIBC_2.4 __write F
 GLIBC_2.4 _pthread_cleanup_pop F
 GLIBC_2.4 _pthread_cleanup_pop_restore F
@@ -232,6 +231,5 @@ GLIBC_2.4 siglongjmp F
 GLIBC_2.4 sigwait F
 GLIBC_2.4 system F
 GLIBC_2.4 tcdrain F
-GLIBC_2.4 wait F
 GLIBC_2.4 waitpid F
 GLIBC_2.4 write F
diff --git a/sysdeps/unix/sysv/linux/csky/libpthread.abilist b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
index edbdea39cf..7c17230afd 100644
--- a/sysdeps/unix/sysv/linux/csky/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
@@ -42,7 +42,6 @@ GLIBC_2.29 __read F
 GLIBC_2.29 __res_state F
 GLIBC_2.29 __send F
 GLIBC_2.29 __sigaction F
-GLIBC_2.29 __wait F
 GLIBC_2.29 __write F
 GLIBC_2.29 _pthread_cleanup_pop F
 GLIBC_2.29 _pthread_cleanup_pop_restore F
@@ -219,7 +218,6 @@ GLIBC_2.29 tss_create F
 GLIBC_2.29 tss_delete F
 GLIBC_2.29 tss_get F
 GLIBC_2.29 tss_set F
-GLIBC_2.29 wait F
 GLIBC_2.29 waitpid F
 GLIBC_2.29 write F
 GLIBC_2.30 pthread_cond_clockwait F
diff --git a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
index d87fadf3d8..9b7c7dae3f 100644
--- a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
@@ -18,7 +18,6 @@ GLIBC_2.2 __h_errno_location F
 GLIBC_2.2 __libc_allocate_rtsig F
 GLIBC_2.2 __libc_current_sigrtmax F
 GLIBC_2.2 __libc_current_sigrtmin F
-GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2 __lseek F
 GLIBC_2.2 __open F
 GLIBC_2.2 __open64 F
@@ -47,7 +46,6 @@ GLIBC_2.2 __read F
 GLIBC_2.2 __res_state F
 GLIBC_2.2 __send F
 GLIBC_2.2 __sigaction F
-GLIBC_2.2 __wait F
 GLIBC_2.2 __write F
 GLIBC_2.2 _pthread_cleanup_pop F
 GLIBC_2.2 _pthread_cleanup_pop_restore F
@@ -181,7 +179,6 @@ GLIBC_2.2 siglongjmp F
 GLIBC_2.2 sigwait F
 GLIBC_2.2 system F
 GLIBC_2.2 tcdrain F
-GLIBC_2.2 wait F
 GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
diff --git a/sysdeps/unix/sysv/linux/i386/libpthread.abilist b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
index 5d1bf0f5ab..a35cbdb0e4 100644
--- a/sysdeps/unix/sysv/linux/i386/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
@@ -24,7 +24,6 @@ GLIBC_2.0 __pthread_setspecific F
 GLIBC_2.0 __read F
 GLIBC_2.0 __send F
 GLIBC_2.0 __sigaction F
-GLIBC_2.0 __wait F
 GLIBC_2.0 __write F
 GLIBC_2.0 _pthread_cleanup_pop F
 GLIBC_2.0 _pthread_cleanup_pop_restore F
@@ -103,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 wait F
 GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.1 __libc_allocate_rtsig F
diff --git a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
index c065ddbf67..d15b0f09d8 100644
--- a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
@@ -18,7 +18,6 @@ GLIBC_2.2 __h_errno_location F
 GLIBC_2.2 __libc_allocate_rtsig F
 GLIBC_2.2 __libc_current_sigrtmax F
 GLIBC_2.2 __libc_current_sigrtmin F
-GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2 __lseek F
 GLIBC_2.2 __open F
 GLIBC_2.2 __open64 F
@@ -47,7 +46,6 @@ GLIBC_2.2 __read F
 GLIBC_2.2 __res_state F
 GLIBC_2.2 __send F
 GLIBC_2.2 __sigaction F
-GLIBC_2.2 __wait F
 GLIBC_2.2 __write F
 GLIBC_2.2 _pthread_cleanup_pop F
 GLIBC_2.2 _pthread_cleanup_pop_restore F
@@ -181,7 +179,6 @@ GLIBC_2.2 siglongjmp F
 GLIBC_2.2 sigwait F
 GLIBC_2.2 system F
 GLIBC_2.2 tcdrain F
-GLIBC_2.2 wait F
 GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
index c5b7aeb7c4..428aac48e6 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
@@ -79,7 +79,6 @@ GLIBC_2.4 __read F
 GLIBC_2.4 __res_state F
 GLIBC_2.4 __send F
 GLIBC_2.4 __sigaction F
-GLIBC_2.4 __wait F
 GLIBC_2.4 __write F
 GLIBC_2.4 _pthread_cleanup_pop F
 GLIBC_2.4 _pthread_cleanup_pop_restore F
@@ -232,6 +231,5 @@ GLIBC_2.4 siglongjmp F
 GLIBC_2.4 sigwait F
 GLIBC_2.4 system F
 GLIBC_2.4 tcdrain F
-GLIBC_2.4 wait F
 GLIBC_2.4 waitpid F
 GLIBC_2.4 write F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
index 5d1bf0f5ab..a35cbdb0e4 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
@@ -24,7 +24,6 @@ GLIBC_2.0 __pthread_setspecific F
 GLIBC_2.0 __read F
 GLIBC_2.0 __send F
 GLIBC_2.0 __sigaction F
-GLIBC_2.0 __wait F
 GLIBC_2.0 __write F
 GLIBC_2.0 _pthread_cleanup_pop F
 GLIBC_2.0 _pthread_cleanup_pop_restore F
@@ -103,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 wait F
 GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.1 __libc_allocate_rtsig F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
index bf777df285..50002eb438 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
@@ -44,7 +44,6 @@ GLIBC_2.18 __read F
 GLIBC_2.18 __res_state F
 GLIBC_2.18 __send F
 GLIBC_2.18 __sigaction F
-GLIBC_2.18 __wait F
 GLIBC_2.18 __write F
 GLIBC_2.18 _pthread_cleanup_pop F
 GLIBC_2.18 _pthread_cleanup_pop_restore F
@@ -205,7 +204,6 @@ GLIBC_2.18 siglongjmp F
 GLIBC_2.18 sigwait F
 GLIBC_2.18 system F
 GLIBC_2.18 tcdrain F
-GLIBC_2.18 wait F
 GLIBC_2.18 waitpid F
 GLIBC_2.18 write F
 GLIBC_2.28 call_once F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
index bf777df285..50002eb438 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
@@ -44,7 +44,6 @@ GLIBC_2.18 __read F
 GLIBC_2.18 __res_state F
 GLIBC_2.18 __send F
 GLIBC_2.18 __sigaction F
-GLIBC_2.18 __wait F
 GLIBC_2.18 __write F
 GLIBC_2.18 _pthread_cleanup_pop F
 GLIBC_2.18 _pthread_cleanup_pop_restore F
@@ -205,7 +204,6 @@ GLIBC_2.18 siglongjmp F
 GLIBC_2.18 sigwait F
 GLIBC_2.18 system F
 GLIBC_2.18 tcdrain F
-GLIBC_2.18 wait F
 GLIBC_2.18 waitpid F
 GLIBC_2.18 write F
 GLIBC_2.28 call_once F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
index 1b5fd5e751..93558db21f 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
@@ -24,7 +24,6 @@ GLIBC_2.0 __pthread_setspecific F
 GLIBC_2.0 __read F
 GLIBC_2.0 __send F
 GLIBC_2.0 __sigaction F
-GLIBC_2.0 __wait F
 GLIBC_2.0 __write F
 GLIBC_2.0 _pthread_cleanup_pop F
 GLIBC_2.0 _pthread_cleanup_pop_restore F
@@ -103,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 wait F
 GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.11 pthread_sigqueue F
@@ -117,7 +115,6 @@ GLIBC_2.18 pthread_setattr_default_np F
 GLIBC_2.2 __libc_allocate_rtsig F
 GLIBC_2.2 __libc_current_sigrtmax F
 GLIBC_2.2 __libc_current_sigrtmin F
-GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2 __open64 F
 GLIBC_2.2 __pread64 F
 GLIBC_2.2 __pthread_rwlock_destroy F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
index 1b5fd5e751..93558db21f 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
@@ -24,7 +24,6 @@ GLIBC_2.0 __pthread_setspecific F
 GLIBC_2.0 __read F
 GLIBC_2.0 __send F
 GLIBC_2.0 __sigaction F
-GLIBC_2.0 __wait F
 GLIBC_2.0 __write F
 GLIBC_2.0 _pthread_cleanup_pop F
 GLIBC_2.0 _pthread_cleanup_pop_restore F
@@ -103,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 wait F
 GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.11 pthread_sigqueue F
@@ -117,7 +115,6 @@ GLIBC_2.18 pthread_setattr_default_np F
 GLIBC_2.2 __libc_allocate_rtsig F
 GLIBC_2.2 __libc_current_sigrtmax F
 GLIBC_2.2 __libc_current_sigrtmin F
-GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2 __open64 F
 GLIBC_2.2 __pread64 F
 GLIBC_2.2 __pthread_rwlock_destroy F
diff --git a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
index 03a462ef91..226cf52615 100644
--- a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
@@ -44,7 +44,6 @@ GLIBC_2.21 __read F
 GLIBC_2.21 __res_state F
 GLIBC_2.21 __send F
 GLIBC_2.21 __sigaction F
-GLIBC_2.21 __wait F
 GLIBC_2.21 __write F
 GLIBC_2.21 _pthread_cleanup_pop F
 GLIBC_2.21 _pthread_cleanup_pop_restore F
@@ -205,7 +204,6 @@ GLIBC_2.21 siglongjmp F
 GLIBC_2.21 sigwait F
 GLIBC_2.21 system F
 GLIBC_2.21 tcdrain F
-GLIBC_2.21 wait F
 GLIBC_2.21 waitpid F
 GLIBC_2.21 write F
 GLIBC_2.28 call_once F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
index 0245103a0b..6ddac21923 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
@@ -24,7 +24,6 @@ GLIBC_2.0 __pthread_setspecific F
 GLIBC_2.0 __read F
 GLIBC_2.0 __send F
 GLIBC_2.0 __sigaction F
-GLIBC_2.0 __wait F
 GLIBC_2.0 __write F
 GLIBC_2.0 _pthread_cleanup_pop F
 GLIBC_2.0 _pthread_cleanup_pop_restore F
@@ -103,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 wait F
 GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.1 __libc_allocate_rtsig F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
index 618004a931..c97f8ee3df 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
@@ -67,7 +67,6 @@ GLIBC_2.3 __read F
 GLIBC_2.3 __res_state F
 GLIBC_2.3 __send F
 GLIBC_2.3 __sigaction F
-GLIBC_2.3 __wait F
 GLIBC_2.3 __write F
 GLIBC_2.3 _pthread_cleanup_pop F
 GLIBC_2.3 _pthread_cleanup_pop_restore F
@@ -201,7 +200,6 @@ GLIBC_2.3 siglongjmp F
 GLIBC_2.3 sigwait F
 GLIBC_2.3 system F
 GLIBC_2.3 tcdrain F
-GLIBC_2.3 wait F
 GLIBC_2.3 waitpid F
 GLIBC_2.3 write F
 GLIBC_2.3.2 pthread_cond_broadcast F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
index 98a8473fcd..cfa71ef697 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
@@ -44,7 +44,6 @@ GLIBC_2.17 __read F
 GLIBC_2.17 __res_state F
 GLIBC_2.17 __send F
 GLIBC_2.17 __sigaction F
-GLIBC_2.17 __wait F
 GLIBC_2.17 __write F
 GLIBC_2.17 _pthread_cleanup_pop F
 GLIBC_2.17 _pthread_cleanup_pop_restore F
@@ -203,7 +202,6 @@ GLIBC_2.17 siglongjmp F
 GLIBC_2.17 sigwait F
 GLIBC_2.17 system F
 GLIBC_2.17 tcdrain F
-GLIBC_2.17 wait F
 GLIBC_2.17 waitpid F
 GLIBC_2.17 write F
 GLIBC_2.18 pthread_getattr_default_np F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
index d44217ac85..0ed3f137be 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
@@ -43,7 +43,6 @@ GLIBC_2.27 __read F
 GLIBC_2.27 __res_state F
 GLIBC_2.27 __send F
 GLIBC_2.27 __sigaction F
-GLIBC_2.27 __wait F
 GLIBC_2.27 __write F
 GLIBC_2.27 _pthread_cleanup_pop F
 GLIBC_2.27 _pthread_cleanup_pop_restore F
@@ -200,7 +199,6 @@ GLIBC_2.27 sendto F
 GLIBC_2.27 sigaction F
 GLIBC_2.27 sigwait F
 GLIBC_2.27 tcdrain F
-GLIBC_2.27 wait F
 GLIBC_2.27 waitpid F
 GLIBC_2.27 write F
 GLIBC_2.28 call_once F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
index 429d8b6224..3ef6e2169b 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
@@ -24,7 +24,6 @@ GLIBC_2.0 __pthread_setspecific F
 GLIBC_2.0 __read F
 GLIBC_2.0 __send F
 GLIBC_2.0 __sigaction F
-GLIBC_2.0 __wait F
 GLIBC_2.0 __write F
 GLIBC_2.0 _pthread_cleanup_pop F
 GLIBC_2.0 _pthread_cleanup_pop_restore F
@@ -103,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 wait F
 GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.1 __libc_allocate_rtsig F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
index d42e1fc4b0..b2326477ae 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
@@ -20,7 +20,6 @@ GLIBC_2.2 __h_errno_location F
 GLIBC_2.2 __libc_allocate_rtsig F
 GLIBC_2.2 __libc_current_sigrtmax F
 GLIBC_2.2 __libc_current_sigrtmin F
-GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2 __lseek F
 GLIBC_2.2 __open F
 GLIBC_2.2 __open64 F
@@ -49,7 +48,6 @@ GLIBC_2.2 __read F
 GLIBC_2.2 __res_state F
 GLIBC_2.2 __send F
 GLIBC_2.2 __sigaction F
-GLIBC_2.2 __wait F
 GLIBC_2.2 __write F
 GLIBC_2.2 _pthread_cleanup_pop F
 GLIBC_2.2 _pthread_cleanup_pop_restore F
@@ -183,7 +181,6 @@ GLIBC_2.2 siglongjmp F
 GLIBC_2.2 sigwait F
 GLIBC_2.2 system F
 GLIBC_2.2 tcdrain F
-GLIBC_2.2 wait F
 GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
index d87fadf3d8..9b7c7dae3f 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
@@ -18,7 +18,6 @@ GLIBC_2.2 __h_errno_location F
 GLIBC_2.2 __libc_allocate_rtsig F
 GLIBC_2.2 __libc_current_sigrtmax F
 GLIBC_2.2 __libc_current_sigrtmin F
-GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2 __lseek F
 GLIBC_2.2 __open F
 GLIBC_2.2 __open64 F
@@ -47,7 +46,6 @@ GLIBC_2.2 __read F
 GLIBC_2.2 __res_state F
 GLIBC_2.2 __send F
 GLIBC_2.2 __sigaction F
-GLIBC_2.2 __wait F
 GLIBC_2.2 __write F
 GLIBC_2.2 _pthread_cleanup_pop F
 GLIBC_2.2 _pthread_cleanup_pop_restore F
@@ -181,7 +179,6 @@ GLIBC_2.2 siglongjmp F
 GLIBC_2.2 sigwait F
 GLIBC_2.2 system F
 GLIBC_2.2 tcdrain F
-GLIBC_2.2 wait F
 GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
index d87fadf3d8..9b7c7dae3f 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
@@ -18,7 +18,6 @@ GLIBC_2.2 __h_errno_location F
 GLIBC_2.2 __libc_allocate_rtsig F
 GLIBC_2.2 __libc_current_sigrtmax F
 GLIBC_2.2 __libc_current_sigrtmin F
-GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2 __lseek F
 GLIBC_2.2 __open F
 GLIBC_2.2 __open64 F
@@ -47,7 +46,6 @@ GLIBC_2.2 __read F
 GLIBC_2.2 __res_state F
 GLIBC_2.2 __send F
 GLIBC_2.2 __sigaction F
-GLIBC_2.2 __wait F
 GLIBC_2.2 __write F
 GLIBC_2.2 _pthread_cleanup_pop F
 GLIBC_2.2 _pthread_cleanup_pop_restore F
@@ -181,7 +179,6 @@ GLIBC_2.2 siglongjmp F
 GLIBC_2.2 sigwait F
 GLIBC_2.2 system F
 GLIBC_2.2 tcdrain F
-GLIBC_2.2 wait F
 GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
index f42bcffd1e..ddb500a9d7 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
@@ -24,7 +24,6 @@ GLIBC_2.0 __pthread_setspecific F
 GLIBC_2.0 __read F
 GLIBC_2.0 __send F
 GLIBC_2.0 __sigaction F
-GLIBC_2.0 __wait F
 GLIBC_2.0 __write F
 GLIBC_2.0 _pthread_cleanup_pop F
 GLIBC_2.0 _pthread_cleanup_pop_restore F
@@ -103,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 wait F
 GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.1 __libc_allocate_rtsig F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
index c065ddbf67..d15b0f09d8 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
@@ -18,7 +18,6 @@ GLIBC_2.2 __h_errno_location F
 GLIBC_2.2 __libc_allocate_rtsig F
 GLIBC_2.2 __libc_current_sigrtmax F
 GLIBC_2.2 __libc_current_sigrtmin F
-GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2 __lseek F
 GLIBC_2.2 __open F
 GLIBC_2.2 __open64 F
@@ -47,7 +46,6 @@ GLIBC_2.2 __read F
 GLIBC_2.2 __res_state F
 GLIBC_2.2 __send F
 GLIBC_2.2 __sigaction F
-GLIBC_2.2 __wait F
 GLIBC_2.2 __write F
 GLIBC_2.2 _pthread_cleanup_pop F
 GLIBC_2.2 _pthread_cleanup_pop_restore F
@@ -181,7 +179,6 @@ GLIBC_2.2 siglongjmp F
 GLIBC_2.2 sigwait F
 GLIBC_2.2 system F
 GLIBC_2.2 tcdrain F
-GLIBC_2.2 wait F
 GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
index 610562bd40..ca00d79b0c 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
@@ -18,7 +18,6 @@ GLIBC_2.2.5 __h_errno_location F
 GLIBC_2.2.5 __libc_allocate_rtsig F
 GLIBC_2.2.5 __libc_current_sigrtmax F
 GLIBC_2.2.5 __libc_current_sigrtmin F
-GLIBC_2.2.5 __libpthread_version_placeholder F
 GLIBC_2.2.5 __lseek F
 GLIBC_2.2.5 __open F
 GLIBC_2.2.5 __open64 F
@@ -47,7 +46,6 @@ GLIBC_2.2.5 __read F
 GLIBC_2.2.5 __res_state F
 GLIBC_2.2.5 __send F
 GLIBC_2.2.5 __sigaction F
-GLIBC_2.2.5 __wait F
 GLIBC_2.2.5 __write F
 GLIBC_2.2.5 _pthread_cleanup_pop F
 GLIBC_2.2.5 _pthread_cleanup_pop_restore F
@@ -182,7 +180,6 @@ GLIBC_2.2.5 siglongjmp F
 GLIBC_2.2.5 sigwait F
 GLIBC_2.2.5 system F
 GLIBC_2.2.5 tcdrain F
-GLIBC_2.2.5 wait F
 GLIBC_2.2.5 waitpid F
 GLIBC_2.2.5 write F
 GLIBC_2.28 call_once F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
index aadd9eb0fa..ae748ed431 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
@@ -44,7 +44,6 @@ GLIBC_2.16 __read F
 GLIBC_2.16 __res_state F
 GLIBC_2.16 __send F
 GLIBC_2.16 __sigaction F
-GLIBC_2.16 __wait F
 GLIBC_2.16 __write F
 GLIBC_2.16 _pthread_cleanup_pop F
 GLIBC_2.16 _pthread_cleanup_pop_restore F
@@ -203,7 +202,6 @@ GLIBC_2.16 siglongjmp F
 GLIBC_2.16 sigwait F
 GLIBC_2.16 system F
 GLIBC_2.16 tcdrain F
-GLIBC_2.16 wait F
 GLIBC_2.16 waitpid F
 GLIBC_2.16 write F
 GLIBC_2.18 pthread_getattr_default_np F
-- 
2.17.1


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

* [PATCH 3/7] nptl: Move waitpid implementation to libc
  2019-11-14 14:46 [PATCH 1/7] Remove __waitpid_nocancel Adhemerval Zanella
  2019-11-14 14:46 ` [PATCH 2/7] nptl: Move wait implementation to libc Adhemerval Zanella
@ 2019-11-14 14:47 ` Adhemerval Zanella
  2019-11-14 14:47 ` [PATCH 4/7] Implement wait in terms of waitpid Adhemerval Zanella
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Adhemerval Zanella @ 2019-11-14 14:47 UTC (permalink / raw)
  To: libc-alpha; +Cc: Alistair Francis, alistair23

Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.
---
 nptl/Makefile                                                  | 3 +--
 nptl/Versions                                                  | 2 +-
 sysdeps/unix/sysv/linux/aarch64/libpthread.abilist             | 1 -
 sysdeps/unix/sysv/linux/alpha/libpthread.abilist               | 1 -
 sysdeps/unix/sysv/linux/arm/be/libpthread.abilist              | 1 -
 sysdeps/unix/sysv/linux/arm/le/libpthread.abilist              | 1 -
 sysdeps/unix/sysv/linux/csky/libpthread.abilist                | 1 -
 sysdeps/unix/sysv/linux/hppa/libpthread.abilist                | 1 -
 sysdeps/unix/sysv/linux/i386/libpthread.abilist                | 1 -
 sysdeps/unix/sysv/linux/ia64/libpthread.abilist                | 1 -
 sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist       | 1 -
 sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist         | 1 -
 sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist       | 1 -
 sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist       | 1 -
 sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist         | 1 -
 sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist         | 1 -
 sysdeps/unix/sysv/linux/nios2/libpthread.abilist               | 1 -
 sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist   | 1 -
 .../unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist    | 1 -
 .../unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist    | 1 -
 sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist          | 1 -
 sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist        | 1 -
 sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist        | 1 -
 sysdeps/unix/sysv/linux/sh/be/libpthread.abilist               | 1 -
 sysdeps/unix/sysv/linux/sh/le/libpthread.abilist               | 1 -
 sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist       | 1 -
 sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist       | 1 -
 sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist           | 1 -
 sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist          | 1 -
 29 files changed, 2 insertions(+), 30 deletions(-)

diff --git a/nptl/Makefile b/nptl/Makefile
index f93d41176f..35f998754b 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -46,7 +46,7 @@ pthread-compat-wrappers = \
 		      sendto fsync lseek lseek64 \
 		      msync open open64 pause \
 		      pread pread64 pwrite pwrite64 \
-		      tcdrain waitpid msgrcv msgsnd \
+		      tcdrain msgrcv msgsnd \
 		      sigwait sigsuspend \
 		      recvmsg sendmsg
 
@@ -205,7 +205,6 @@ CFLAGS-pread.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pread64.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pwrite.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pwrite64.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-waitpid.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-sigwait.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-msgrcv.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-msgsnd.c += -fexceptions -fasynchronous-unwind-tables
diff --git a/nptl/Versions b/nptl/Versions
index 1dda4b9064..ff6fc06002 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -99,7 +99,7 @@ libpthread {
     close; __close; fcntl; __fcntl; read; __read; write; __write; accept;
     connect; __connect; recv; recvfrom; recvmsg; send; __send; sendmsg; sendto;
     fsync; lseek; __lseek; msync; open; __open; pause; tcdrain;
-    system; waitpid;
+    system;
 
     # Hidden entry point (through macros).
     _pthread_cleanup_push; _pthread_cleanup_pop;
diff --git a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
index cfa71ef697..7fb670d91f 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
@@ -202,7 +202,6 @@ GLIBC_2.17 siglongjmp F
 GLIBC_2.17 sigwait F
 GLIBC_2.17 system F
 GLIBC_2.17 tcdrain F
-GLIBC_2.17 waitpid F
 GLIBC_2.17 write F
 GLIBC_2.18 pthread_getattr_default_np F
 GLIBC_2.18 pthread_setattr_default_np F
diff --git a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
index ddb500a9d7..42679385d7 100644
--- a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
@@ -102,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.1 __libc_allocate_rtsig F
 GLIBC_2.1 __libc_current_sigrtmax F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
index 428aac48e6..144ef997fe 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
@@ -231,5 +231,4 @@ GLIBC_2.4 siglongjmp F
 GLIBC_2.4 sigwait F
 GLIBC_2.4 system F
 GLIBC_2.4 tcdrain F
-GLIBC_2.4 waitpid F
 GLIBC_2.4 write F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
index 428aac48e6..144ef997fe 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
@@ -231,5 +231,4 @@ GLIBC_2.4 siglongjmp F
 GLIBC_2.4 sigwait F
 GLIBC_2.4 system F
 GLIBC_2.4 tcdrain F
-GLIBC_2.4 waitpid F
 GLIBC_2.4 write F
diff --git a/sysdeps/unix/sysv/linux/csky/libpthread.abilist b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
index 7c17230afd..4edf765af2 100644
--- a/sysdeps/unix/sysv/linux/csky/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
@@ -218,7 +218,6 @@ GLIBC_2.29 tss_create F
 GLIBC_2.29 tss_delete F
 GLIBC_2.29 tss_get F
 GLIBC_2.29 tss_set F
-GLIBC_2.29 waitpid F
 GLIBC_2.29 write F
 GLIBC_2.30 pthread_cond_clockwait F
 GLIBC_2.30 pthread_mutex_clocklock F
diff --git a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
index 9b7c7dae3f..a5dfdef124 100644
--- a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
@@ -179,7 +179,6 @@ GLIBC_2.2 siglongjmp F
 GLIBC_2.2 sigwait F
 GLIBC_2.2 system F
 GLIBC_2.2 tcdrain F
-GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
 GLIBC_2.28 call_once F
diff --git a/sysdeps/unix/sysv/linux/i386/libpthread.abilist b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
index a35cbdb0e4..94e5ea5d0b 100644
--- a/sysdeps/unix/sysv/linux/i386/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
@@ -102,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.1 __libc_allocate_rtsig F
 GLIBC_2.1 __libc_current_sigrtmax F
diff --git a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
index d15b0f09d8..f71c61da1f 100644
--- a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
@@ -179,7 +179,6 @@ GLIBC_2.2 siglongjmp F
 GLIBC_2.2 sigwait F
 GLIBC_2.2 system F
 GLIBC_2.2 tcdrain F
-GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
 GLIBC_2.28 call_once F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
index 428aac48e6..144ef997fe 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
@@ -231,5 +231,4 @@ GLIBC_2.4 siglongjmp F
 GLIBC_2.4 sigwait F
 GLIBC_2.4 system F
 GLIBC_2.4 tcdrain F
-GLIBC_2.4 waitpid F
 GLIBC_2.4 write F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
index a35cbdb0e4..94e5ea5d0b 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
@@ -102,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.1 __libc_allocate_rtsig F
 GLIBC_2.1 __libc_current_sigrtmax F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
index 50002eb438..40dbd1e7c7 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
@@ -204,7 +204,6 @@ GLIBC_2.18 siglongjmp F
 GLIBC_2.18 sigwait F
 GLIBC_2.18 system F
 GLIBC_2.18 tcdrain F
-GLIBC_2.18 waitpid F
 GLIBC_2.18 write F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
index 50002eb438..40dbd1e7c7 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
@@ -204,7 +204,6 @@ GLIBC_2.18 siglongjmp F
 GLIBC_2.18 sigwait F
 GLIBC_2.18 system F
 GLIBC_2.18 tcdrain F
-GLIBC_2.18 waitpid F
 GLIBC_2.18 write F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
index 93558db21f..b29ab3d261 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
@@ -102,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.11 pthread_sigqueue F
 GLIBC_2.12 pthread_getname_np F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
index 93558db21f..b29ab3d261 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
@@ -102,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.11 pthread_sigqueue F
 GLIBC_2.12 pthread_getname_np F
diff --git a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
index 226cf52615..e787d881b5 100644
--- a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
@@ -204,7 +204,6 @@ GLIBC_2.21 siglongjmp F
 GLIBC_2.21 sigwait F
 GLIBC_2.21 system F
 GLIBC_2.21 tcdrain F
-GLIBC_2.21 waitpid F
 GLIBC_2.21 write F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
index 6ddac21923..acf358b471 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
@@ -102,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.1 __libc_allocate_rtsig F
 GLIBC_2.1 __libc_current_sigrtmax F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
index c97f8ee3df..f6ae27d76b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
@@ -200,7 +200,6 @@ GLIBC_2.3 siglongjmp F
 GLIBC_2.3 sigwait F
 GLIBC_2.3 system F
 GLIBC_2.3 tcdrain F
-GLIBC_2.3 waitpid F
 GLIBC_2.3 write F
 GLIBC_2.3.2 pthread_cond_broadcast F
 GLIBC_2.3.2 pthread_cond_destroy F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
index cfa71ef697..7fb670d91f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
@@ -202,7 +202,6 @@ GLIBC_2.17 siglongjmp F
 GLIBC_2.17 sigwait F
 GLIBC_2.17 system F
 GLIBC_2.17 tcdrain F
-GLIBC_2.17 waitpid F
 GLIBC_2.17 write F
 GLIBC_2.18 pthread_getattr_default_np F
 GLIBC_2.18 pthread_setattr_default_np F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
index 0ed3f137be..1581991fd5 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
@@ -199,7 +199,6 @@ GLIBC_2.27 sendto F
 GLIBC_2.27 sigaction F
 GLIBC_2.27 sigwait F
 GLIBC_2.27 tcdrain F
-GLIBC_2.27 waitpid F
 GLIBC_2.27 write F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
index 3ef6e2169b..0bffc8f456 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
@@ -102,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.1 __libc_allocate_rtsig F
 GLIBC_2.1 __libc_current_sigrtmax F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
index b2326477ae..bd82c1969a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
@@ -181,7 +181,6 @@ GLIBC_2.2 siglongjmp F
 GLIBC_2.2 sigwait F
 GLIBC_2.2 system F
 GLIBC_2.2 tcdrain F
-GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
 GLIBC_2.28 call_once F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
index 9b7c7dae3f..a5dfdef124 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
@@ -179,7 +179,6 @@ GLIBC_2.2 siglongjmp F
 GLIBC_2.2 sigwait F
 GLIBC_2.2 system F
 GLIBC_2.2 tcdrain F
-GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
 GLIBC_2.28 call_once F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
index 9b7c7dae3f..a5dfdef124 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
@@ -179,7 +179,6 @@ GLIBC_2.2 siglongjmp F
 GLIBC_2.2 sigwait F
 GLIBC_2.2 system F
 GLIBC_2.2 tcdrain F
-GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
 GLIBC_2.28 call_once F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
index ddb500a9d7..42679385d7 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
@@ -102,7 +102,6 @@ GLIBC_2.0 siglongjmp F
 GLIBC_2.0 sigwait F
 GLIBC_2.0 system F
 GLIBC_2.0 tcdrain F
-GLIBC_2.0 waitpid F
 GLIBC_2.0 write F
 GLIBC_2.1 __libc_allocate_rtsig F
 GLIBC_2.1 __libc_current_sigrtmax F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
index d15b0f09d8..f71c61da1f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
@@ -179,7 +179,6 @@ GLIBC_2.2 siglongjmp F
 GLIBC_2.2 sigwait F
 GLIBC_2.2 system F
 GLIBC_2.2 tcdrain F
-GLIBC_2.2 waitpid F
 GLIBC_2.2 write F
 GLIBC_2.2.3 pthread_getattr_np F
 GLIBC_2.28 call_once F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
index ca00d79b0c..6ec95f4dcc 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
@@ -180,7 +180,6 @@ GLIBC_2.2.5 siglongjmp F
 GLIBC_2.2.5 sigwait F
 GLIBC_2.2.5 system F
 GLIBC_2.2.5 tcdrain F
-GLIBC_2.2.5 waitpid F
 GLIBC_2.2.5 write F
 GLIBC_2.28 call_once F
 GLIBC_2.28 cnd_broadcast F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
index ae748ed431..6d8045dbe0 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
@@ -202,7 +202,6 @@ GLIBC_2.16 siglongjmp F
 GLIBC_2.16 sigwait F
 GLIBC_2.16 system F
 GLIBC_2.16 tcdrain F
-GLIBC_2.16 waitpid F
 GLIBC_2.16 write F
 GLIBC_2.18 pthread_getattr_default_np F
 GLIBC_2.18 pthread_setattr_default_np F
-- 
2.17.1


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

* [PATCH 4/7] Implement wait in terms of waitpid
  2019-11-14 14:46 [PATCH 1/7] Remove __waitpid_nocancel Adhemerval Zanella
  2019-11-14 14:46 ` [PATCH 2/7] nptl: Move wait implementation to libc Adhemerval Zanella
  2019-11-14 14:47 ` [PATCH 3/7] nptl: Move waitpid " Adhemerval Zanella
@ 2019-11-14 14:47 ` Adhemerval Zanella
  2019-11-14 14:47 ` [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined Adhemerval Zanella
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Adhemerval Zanella @ 2019-11-14 14:47 UTC (permalink / raw)
  To: libc-alpha; +Cc: Alistair Francis, alistair23

The posix implementation is used as default and both bsd and linux
version are removed.  It simplifies the implementation for
architectures that does not provide either __NR_waitpid or
__NR_wait4.

Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.
---
 posix/wait.c                   |  6 +-----
 sysdeps/posix/wait.c           | 30 -----------------------------
 sysdeps/unix/bsd/wait.c        | 32 -------------------------------
 sysdeps/unix/sysv/linux/wait.c | 35 ----------------------------------
 4 files changed, 1 insertion(+), 102 deletions(-)
 delete mode 100644 sysdeps/posix/wait.c
 delete mode 100644 sysdeps/unix/bsd/wait.c
 delete mode 100644 sysdeps/unix/sysv/linux/wait.c

diff --git a/posix/wait.c b/posix/wait.c
index 0acd1e4926..908e15030a 100644
--- a/posix/wait.c
+++ b/posix/wait.c
@@ -16,16 +16,12 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <sys/wait.h>
-#include <errno.h>
 
 /* Wait for a child to die.  When one does, put its status in *STAT_LOC
    and return its process ID.  For errors, return (pid_t) -1.  */
 __pid_t
 __wait (int *stat_loc)
 {
-  __set_errno (ENOSYS);
-  return -1;
+  return __waitpid (WAIT_ANY, (int *) stat_loc, 0);
 }
-stub_warning (wait)
-
 weak_alias (__wait, wait)
diff --git a/sysdeps/posix/wait.c b/sysdeps/posix/wait.c
deleted file mode 100644
index 573aa47a6d..0000000000
--- a/sysdeps/posix/wait.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1991-2019 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/wait.h>
-
-
-/* Wait for a child to die.  When one does, put its status in *STAT_LOC
-   and return its process ID.  For errors, return (pid_t) -1.  */
-__pid_t
-__libc_wait (int *stat_loc)
-{
-  return __waitpid (WAIT_ANY, (int *) stat_loc, 0);
-}
-
-weak_alias (__libc_wait, __wait)
-weak_alias (__libc_wait, wait)
diff --git a/sysdeps/unix/bsd/wait.c b/sysdeps/unix/bsd/wait.c
deleted file mode 100644
index 3207d96330..0000000000
--- a/sysdeps/unix/bsd/wait.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1991-2019 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/wait.h>
-#include <errno.h>
-#include <sys/resource.h>
-#include <stddef.h>
-
-/* Wait for a child to die.  When one does, put its status in *STAT_LOC
-   and return its process ID.  For errors, return (pid_t) -1.  */
-__pid_t
-__libc_wait (int *stat_loc)
-{
-  return __wait4 (WAIT_ANY, stat_loc, 0, (struct rusage *) NULL);
-}
-
-weak_alias (__libc_wait, __wait)
-weak_alias (__libc_wait, wait)
diff --git a/sysdeps/unix/sysv/linux/wait.c b/sysdeps/unix/sysv/linux/wait.c
deleted file mode 100644
index c2385c752e..0000000000
--- a/sysdeps/unix/sysv/linux/wait.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991-2019 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/wait.h>
-#include <errno.h>
-#include <sys/resource.h>
-#include <stddef.h>
-#include <sysdep-cancel.h>
-
-/* Wait for a child to die.  When one does, put its status in *STAT_LOC
-   and return its process ID.  For errors, return (pid_t) -1.  */
-pid_t
-__libc_wait (int *stat_loc)
-{
-  pid_t result = SYSCALL_CANCEL (wait4, WAIT_ANY, stat_loc, 0,
-				 (struct rusage *) NULL);
-  return result;
-}
-
-weak_alias (__libc_wait, __wait)
-weak_alias (__libc_wait, wait)
-- 
2.17.1


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

* [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined
  2019-11-14 14:46 [PATCH 1/7] Remove __waitpid_nocancel Adhemerval Zanella
                   ` (2 preceding siblings ...)
  2019-11-14 14:47 ` [PATCH 4/7] Implement wait in terms of waitpid Adhemerval Zanella
@ 2019-11-14 14:47 ` Adhemerval Zanella
  2019-11-15 18:27   ` Alistair Francis
  2019-11-21 17:52   ` Adhemerval Zanella
  2019-11-14 14:47 ` [PATCH 6/7] Implement waitpid in terms of wait4 Adhemerval Zanella
  2019-11-14 14:47 ` [PATCH 7/7] Consolidate wait3 implementations Adhemerval Zanella
  5 siblings, 2 replies; 19+ messages in thread
From: Adhemerval Zanella @ 2019-11-14 14:47 UTC (permalink / raw)
  To: libc-alpha; +Cc: Alistair Francis, alistair23

If the wait4 syscall is not avaliable (such as y2038 safe 32-bit
systems) waitid should be used instead.  However prior Linux 5.4
waitid is not a fully superset of other wait instruction, since it
does not include support for waiting for the current process group.

It would be possible to emulate to issue an extra syscall to get
the current process group, but it is inherent racy: after the current
process group is received and before it is passed to waitid a signal
could arrive causing the current process group to change

So waitid is used if wait4 is not defined iff the build is
enabled with a minimum kernel if 5.4+.  The new assume
__ASSUME_WAITID_PID0_P_PGID is added and an error is issued if waitid
can not be implemented by either __NR_wait4 or
__NR_waitid && __ASSUME_WAITID_PID0_P_PGID.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Co-authored-by: Alistair Francis <alistair.francis@wdc.com>
---
 sysdeps/unix/sysv/linux/kernel-features.h |  6 ++
 sysdeps/unix/sysv/linux/syscalls.list     |  1 -
 sysdeps/unix/sysv/linux/wait4.c           | 88 +++++++++++++++++++++++
 3 files changed, 94 insertions(+), 1 deletion(-)
 create mode 100644 sysdeps/unix/sysv/linux/wait4.c

diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index e6be76ff46..43faaa3f9d 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -208,4 +208,10 @@
 # define __ASSUME_TIME64_SYSCALLS 1
 #endif
 
+/* Linux waitid prior kernel 5.4 does not support waiting for the current
+   process group.  */
+#if __LINUX_KERNEL_VERSION >= 0x050400
+# define __ASSUME_WAITID_PID0_P_PGID
+#endif
+
 #endif /* kernel-features.h */
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 603e517ca6..5f1352ad43 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -67,7 +67,6 @@ swapoff		-	swapoff		i:s	__swapoff	swapoff
 unshare		EXTRA	unshare		i:i	unshare
 uselib		EXTRA	uselib		i:s	__compat_uselib	uselib@GLIBC_2.0:GLIBC_2.23
 utime		-	utime		i:sP	utime
-wait4		-	wait4		i:iWiP	__wait4		wait4
 
 chown		-	chown		i:sii	__libc_chown	__chown chown
 
diff --git a/sysdeps/unix/sysv/linux/wait4.c b/sysdeps/unix/sysv/linux/wait4.c
new file mode 100644
index 0000000000..d09917c7ff
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/wait4.c
@@ -0,0 +1,88 @@
+/* Wait for process to change state.  Linux version.
+   Copyright (C) 2019 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/wait.h>
+#include <sys/resource.h>
+#include <sysdep-cancel.h>
+
+pid_t
+__wait4 (pid_t pid, int *stat_loc, int options, struct rusage *usage)
+{
+#if __NR_wait4
+   return SYSCALL_CANCEL (wait4, pid, stat_loc, options, usage);
+#elif defined (__ASSUME_WAITID_PID0_P_PGID)
+  idtype_t idtype = P_PID;
+
+  if (pid < -1)
+    {
+      idtype = P_PGID;
+      pid *= -1;
+    }
+  else if (pid == -1)
+    {
+      idtype = P_ALL;
+    }
+  else if (pid == 0)
+    {
+      idtype = P_PGID;
+    }
+
+  options |= WEXITED;
+
+  siginfo_t infop;
+  if (SYSCALL_CANCEL (waitid, idtype, pid, &infop, options, usage) < 0)
+    return -1;
+
+  if (stat_loc)
+    {
+      switch (infop.si_code)
+        {
+        case CLD_EXITED:
+          *stat_loc = W_EXITCODE (infop.si_status, 0);
+          break;
+        case CLD_DUMPED:
+          *stat_loc = WCOREFLAG | infop.si_status;
+	  break;
+        case CLD_KILLED:
+          *stat_loc = infop.si_status;
+          break;
+        case CLD_TRAPPED:
+        case CLD_STOPPED:
+          *stat_loc = W_STOPCODE (infop.si_status);
+          break;
+        case CLD_CONTINUED:
+          *stat_loc = __W_CONTINUED;
+          break;
+	default:
+	  *stat_loc = 0;
+	  break;
+        }
+    }
+
+  return infop.si_pid;
+# else
+/* Linux waitid prior kernel 5.4 does not support waiting for the current
+   process.  It would be possible to emulate it by calling getpgid for pid 0,
+   however, it would require an additional syscall and it is inherent racy:
+   after the current process group is received and before it is passed
+   to waitid a signal could arrive causing the current process group to
+   change.  */
+# error "The kernel ABI does not provide a way to implement wait4"
+#endif
+}
+weak_alias (__wait4, wait4)
-- 
2.17.1


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

* [PATCH 6/7] Implement waitpid in terms of wait4
  2019-11-14 14:46 [PATCH 1/7] Remove __waitpid_nocancel Adhemerval Zanella
                   ` (3 preceding siblings ...)
  2019-11-14 14:47 ` [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined Adhemerval Zanella
@ 2019-11-14 14:47 ` Adhemerval Zanella
  2019-11-14 14:47 ` [PATCH 7/7] Consolidate wait3 implementations Adhemerval Zanella
  5 siblings, 0 replies; 19+ messages in thread
From: Adhemerval Zanella @ 2019-11-14 14:47 UTC (permalink / raw)
  To: libc-alpha; +Cc: Alistair Francis, alistair23

This also consolidate all waitpid implementations.

Checked on x86_64-linux-gnu.
---
 include/sys/wait.h                |  1 +
 posix/wait4.c                     |  2 +-
 posix/waitpid.c                   | 34 ++++++-------------------
 sysdeps/mach/hurd/wait4.c         |  2 +-
 sysdeps/unix/bsd/waitpid.c        | 42 -------------------------------
 sysdeps/unix/sysv/linux/wait4.c   |  1 +
 sysdeps/unix/sysv/linux/waitpid.c | 34 -------------------------
 7 files changed, 11 insertions(+), 105 deletions(-)
 delete mode 100644 sysdeps/unix/bsd/waitpid.c
 delete mode 100644 sysdeps/unix/sysv/linux/waitpid.c

diff --git a/include/sys/wait.h b/include/sys/wait.h
index 5ac9cd6ca6..39a327f6b2 100644
--- a/include/sys/wait.h
+++ b/include/sys/wait.h
@@ -15,5 +15,6 @@ extern __pid_t __wait3 (int *__stat_loc,
 extern __pid_t __wait4 (__pid_t __pid, int *__stat_loc,
 			int __options, struct rusage *__usage)
 			attribute_hidden;
+libc_hidden_proto (__wait4);
 #endif
 #endif
diff --git a/posix/wait4.c b/posix/wait4.c
index eb4f7fb6de..5857b4e7c1 100644
--- a/posix/wait4.c
+++ b/posix/wait4.c
@@ -26,5 +26,5 @@ __wait4 (__pid_t pid, int *stat_loc, int options, struct rusage *usage)
   return (pid_t) -1;
 }
 stub_warning (wait4)
-
+libc_hidden_def (__wait4)
 weak_alias (__wait4, wait4)
diff --git a/posix/waitpid.c b/posix/waitpid.c
index adae03918a..0490c37316 100644
--- a/posix/waitpid.c
+++ b/posix/waitpid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
+/* Wait for process to change state.
+   Copyright (C) 1991-2019 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,35 +17,14 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
+#include <sysdep-cancel.h>
+#include <stdlib.h>
 #include <sys/wait.h>
-#include <sys/types.h>
 
-
-/* Wait for a child matching PID to die.
-   If PID is greater than 0, match any process whose process ID is PID.
-   If PID is (pid_t) -1, match any process.
-   If PID is (pid_t) 0, match any process with the
-   same process group as the current process.
-   If PID is less than -1, match any process whose
-   process group is the absolute value of PID.
-   If the WNOHANG bit is set in OPTIONS, and that child
-   is not already dead, return (pid_t) 0.  If successful,
-   return PID and store the dead child's status in STAT_LOC.
-   Return (pid_t) -1 for errors.  If the WUNTRACED bit is set in OPTIONS,
-   return status for stopped children; otherwise don't.  */
-pid_t
-__waitpid (pid_t pid, int *stat_loc, int options)
+__pid_t
+__waitpid (__pid_t pid, int *stat_loc, int options)
 {
-  if ((options & ~(WNOHANG|WUNTRACED)) != 0)
-    {
-      __set_errno (EINVAL);
-      return (pid_t) -1;
-    }
-
-  __set_errno (ENOSYS);
-  return (pid_t) -1;
+  return __wait4 (pid, stat_loc, options, NULL);
 }
 libc_hidden_def (__waitpid)
 weak_alias (__waitpid, waitpid)
-
-stub_warning (waitpid)
diff --git a/sysdeps/mach/hurd/wait4.c b/sysdeps/mach/hurd/wait4.c
index 78ad33e8f5..a0137482c4 100644
--- a/sysdeps/mach/hurd/wait4.c
+++ b/sysdeps/mach/hurd/wait4.c
@@ -49,5 +49,5 @@ __wait4 (pid_t pid, int *stat_loc, int options, struct rusage *usage)
       return (pid_t) __hurd_fail (err);
     }
 }
-
+libc_hidden_def (__wait4)
 weak_alias (__wait4, wait4)
diff --git a/sysdeps/unix/bsd/waitpid.c b/sysdeps/unix/bsd/waitpid.c
deleted file mode 100644
index 679d45d3dd..0000000000
--- a/sysdeps/unix/bsd/waitpid.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1991-2019 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 <sys/wait.h>
-#include <sys/types.h>
-#include <stddef.h>
-
-/* Wait for a child matching PID to die.
-   If PID is greater than 0, match any process whose process ID is PID.
-   If PID is (pid_t) -1, match any process.
-   If PID is (pid_t) 0, match any process with the
-   same process group as the current process.
-   If PID is less than -1, match any process whose
-   process group is the absolute value of PID.
-   If the WNOHANG bit is set in OPTIONS, and that child
-   is not already dead, return (pid_t) 0.  If successful,
-   return PID and store the dead child's status in STAT_LOC.
-   Return (pid_t) -1 for errors.  If the WUNTRACED bit is set in OPTIONS,
-   return status for stopped children; otherwise don't.  */
-pid_t
-__waitpid (pid_t pid, int *stat_loc, int options)
-{
-  return __wait4 (pid, stat_loc, options, NULL);
-}
-
-libc_hidden_def (__waitpid)
-weak_alias (__waitpid, waitpid)
diff --git a/sysdeps/unix/sysv/linux/wait4.c b/sysdeps/unix/sysv/linux/wait4.c
index d09917c7ff..203deb7730 100644
--- a/sysdeps/unix/sysv/linux/wait4.c
+++ b/sysdeps/unix/sysv/linux/wait4.c
@@ -85,4 +85,5 @@ __wait4 (pid_t pid, int *stat_loc, int options, struct rusage *usage)
 # error "The kernel ABI does not provide a way to implement wait4"
 #endif
 }
+libc_hidden_def (__wait4);
 weak_alias (__wait4, wait4)
diff --git a/sysdeps/unix/sysv/linux/waitpid.c b/sysdeps/unix/sysv/linux/waitpid.c
deleted file mode 100644
index d35aac01bc..0000000000
--- a/sysdeps/unix/sysv/linux/waitpid.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Linux waitpid syscall implementation.
-   Copyright (C) 1991-2019 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 <sysdep-cancel.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-
-__pid_t
-__waitpid (__pid_t pid, int *stat_loc, int options)
-{
-#ifdef __NR_waitpid
-  return SYSCALL_CANCEL (waitpid, pid, stat_loc, options);
-#else
-  return SYSCALL_CANCEL (wait4, pid, stat_loc, options, NULL);
-#endif
-}
-libc_hidden_def (__waitpid)
-weak_alias (__waitpid, waitpid)
-- 
2.17.1


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

* [PATCH 7/7] Consolidate wait3 implementations
  2019-11-14 14:46 [PATCH 1/7] Remove __waitpid_nocancel Adhemerval Zanella
                   ` (4 preceding siblings ...)
  2019-11-14 14:47 ` [PATCH 6/7] Implement waitpid in terms of wait4 Adhemerval Zanella
@ 2019-11-14 14:47 ` Adhemerval Zanella
  2019-11-14 15:44   ` Alistair Francis
  5 siblings, 1 reply; 19+ messages in thread
From: Adhemerval Zanella @ 2019-11-14 14:47 UTC (permalink / raw)
  To: libc-alpha; +Cc: Alistair Francis, alistair23

The generic one calls wait4.

Checked on x86_64-linux-gnu.
---
 posix/wait3.c                   | 14 +++---------
 sysdeps/posix/wait3.c           | 39 ---------------------------------
 sysdeps/unix/bsd/wait3.c        | 33 ----------------------------
 sysdeps/unix/sysv/linux/wait3.c |  1 -
 4 files changed, 3 insertions(+), 84 deletions(-)
 delete mode 100644 sysdeps/posix/wait3.c
 delete mode 100644 sysdeps/unix/bsd/wait3.c
 delete mode 100644 sysdeps/unix/sysv/linux/wait3.c

diff --git a/posix/wait3.c b/posix/wait3.c
index 6b6e3a500d..f0abf24e31 100644
--- a/posix/wait3.c
+++ b/posix/wait3.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
+/* Wait for process to change state.
+   Copyright (C) 1991-2019 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,7 +16,6 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
 #include <sys/wait.h>
 #include <sys/types.h>
 
@@ -27,15 +27,7 @@
 pid_t
 __wait3 (int *stat_loc, int options, struct rusage *usage)
 {
-  if ((options & ~(WNOHANG|WUNTRACED)) != 0)
-    {
-      __set_errno (EINVAL);
-      return (pid_t) -1;
-    }
-
-  __set_errno (ENOSYS);
-  return (pid_t) -1;
+  return __wait4 (WAIT_ANY, stat_loc, options, usage);
 }
-stub_warning (wait3)
 
 weak_alias (__wait3, wait3)
diff --git a/sysdeps/posix/wait3.c b/sysdeps/posix/wait3.c
deleted file mode 100644
index daba36c6dc..0000000000
--- a/sysdeps/posix/wait3.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1992-2019 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 <sys/wait.h>
-#include <sys/types.h>
-#include <stddef.h>
-
-/* Wait for a child to exit.  When one does, put its status in *STAT_LOC and
-   return its process ID.  For errors return (pid_t) -1.  If USAGE is not nil,
-   store information about the child's resource usage (as a `struct rusage')
-   there.  If the WUNTRACED bit is set in OPTIONS, return status for stopped
-   children; otherwise don't.  */
-pid_t
-__wait3 (int *stat_loc, int options, struct rusage *usage)
-{
-  if (usage != NULL)
-    {
-      __set_errno (ENOSYS);
-      return (pid_t) -1;
-    }
-  return __waitpid (WAIT_ANY, stat_loc, options);
-}
-
-weak_alias (__wait3, wait3)
diff --git a/sysdeps/unix/bsd/wait3.c b/sysdeps/unix/bsd/wait3.c
deleted file mode 100644
index d7fa7e4496..0000000000
--- a/sysdeps/unix/bsd/wait3.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991-2019 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 <sys/wait.h>
-#include <sys/types.h>
-
-/* Wait for a child to exit.  When one does, put its status in *STAT_LOC and
-   return its process ID.  For errors return (pid_t) -1.  If USAGE is not nil,
-   store information about the child's resource usage (as a `struct rusage')
-   there.  If the WUNTRACED bit is set in OPTIONS, return status for stopped
-   children; otherwise don't.  */
-pid_t
-__wait3 (int *stat_loc, int options, struct rusage *usage)
-{
-  return __wait4 (WAIT_ANY, stat_loc, options, usage);
-}
-
-weak_alias (__wait3, wait3)
diff --git a/sysdeps/unix/sysv/linux/wait3.c b/sysdeps/unix/sysv/linux/wait3.c
deleted file mode 100644
index 2ff027f0e1..0000000000
--- a/sysdeps/unix/sysv/linux/wait3.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/bsd/wait3.c>
-- 
2.17.1


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

* Re: [PATCH 7/7] Consolidate wait3 implementations
  2019-11-14 14:47 ` [PATCH 7/7] Consolidate wait3 implementations Adhemerval Zanella
@ 2019-11-14 15:44   ` Alistair Francis
  2019-12-19 15:33     ` Adhemerval Zanella
  0 siblings, 1 reply; 19+ messages in thread
From: Alistair Francis @ 2019-11-14 15:44 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: GNU C Library, Alistair Francis

On Thu, Nov 14, 2019 at 6:47 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> The generic one calls wait4.
>
> Checked on x86_64-linux-gnu.
> ---

Thanks for doing this! This whole series looks good to me.

Alistair

>  posix/wait3.c                   | 14 +++---------
>  sysdeps/posix/wait3.c           | 39 ---------------------------------
>  sysdeps/unix/bsd/wait3.c        | 33 ----------------------------
>  sysdeps/unix/sysv/linux/wait3.c |  1 -
>  4 files changed, 3 insertions(+), 84 deletions(-)
>  delete mode 100644 sysdeps/posix/wait3.c
>  delete mode 100644 sysdeps/unix/bsd/wait3.c
>  delete mode 100644 sysdeps/unix/sysv/linux/wait3.c
>
> diff --git a/posix/wait3.c b/posix/wait3.c
> index 6b6e3a500d..f0abf24e31 100644
> --- a/posix/wait3.c
> +++ b/posix/wait3.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
> +/* Wait for process to change state.
> +   Copyright (C) 1991-2019 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,7 +16,6 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>
> -#include <errno.h>
>  #include <sys/wait.h>
>  #include <sys/types.h>
>
> @@ -27,15 +27,7 @@
>  pid_t
>  __wait3 (int *stat_loc, int options, struct rusage *usage)
>  {
> -  if ((options & ~(WNOHANG|WUNTRACED)) != 0)
> -    {
> -      __set_errno (EINVAL);
> -      return (pid_t) -1;
> -    }
> -
> -  __set_errno (ENOSYS);
> -  return (pid_t) -1;
> +  return __wait4 (WAIT_ANY, stat_loc, options, usage);
>  }
> -stub_warning (wait3)
>
>  weak_alias (__wait3, wait3)
> diff --git a/sysdeps/posix/wait3.c b/sysdeps/posix/wait3.c
> deleted file mode 100644
> index daba36c6dc..0000000000
> --- a/sysdeps/posix/wait3.c
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/* Copyright (C) 1992-2019 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 <sys/wait.h>
> -#include <sys/types.h>
> -#include <stddef.h>
> -
> -/* Wait for a child to exit.  When one does, put its status in *STAT_LOC and
> -   return its process ID.  For errors return (pid_t) -1.  If USAGE is not nil,
> -   store information about the child's resource usage (as a `struct rusage')
> -   there.  If the WUNTRACED bit is set in OPTIONS, return status for stopped
> -   children; otherwise don't.  */
> -pid_t
> -__wait3 (int *stat_loc, int options, struct rusage *usage)
> -{
> -  if (usage != NULL)
> -    {
> -      __set_errno (ENOSYS);
> -      return (pid_t) -1;
> -    }
> -  return __waitpid (WAIT_ANY, stat_loc, options);
> -}
> -
> -weak_alias (__wait3, wait3)
> diff --git a/sysdeps/unix/bsd/wait3.c b/sysdeps/unix/bsd/wait3.c
> deleted file mode 100644
> index d7fa7e4496..0000000000
> --- a/sysdeps/unix/bsd/wait3.c
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -/* Copyright (C) 1991-2019 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 <sys/wait.h>
> -#include <sys/types.h>
> -
> -/* Wait for a child to exit.  When one does, put its status in *STAT_LOC and
> -   return its process ID.  For errors return (pid_t) -1.  If USAGE is not nil,
> -   store information about the child's resource usage (as a `struct rusage')
> -   there.  If the WUNTRACED bit is set in OPTIONS, return status for stopped
> -   children; otherwise don't.  */
> -pid_t
> -__wait3 (int *stat_loc, int options, struct rusage *usage)
> -{
> -  return __wait4 (WAIT_ANY, stat_loc, options, usage);
> -}
> -
> -weak_alias (__wait3, wait3)
> diff --git a/sysdeps/unix/sysv/linux/wait3.c b/sysdeps/unix/sysv/linux/wait3.c
> deleted file mode 100644
> index 2ff027f0e1..0000000000
> --- a/sysdeps/unix/sysv/linux/wait3.c
> +++ /dev/null
> @@ -1 +0,0 @@
> -#include <sysdeps/unix/bsd/wait3.c>
> --
> 2.17.1
>

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

* Re: [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined
  2019-11-14 14:47 ` [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined Adhemerval Zanella
@ 2019-11-15 18:27   ` Alistair Francis
  2019-11-21 17:48     ` Adhemerval Zanella
  2019-11-21 17:52   ` Adhemerval Zanella
  1 sibling, 1 reply; 19+ messages in thread
From: Alistair Francis @ 2019-11-15 18:27 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: GNU C Library, Alistair Francis

On Thu, Nov 14, 2019 at 9:47 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> If the wait4 syscall is not avaliable (such as y2038 safe 32-bit
> systems) waitid should be used instead.  However prior Linux 5.4
> waitid is not a fully superset of other wait instruction, since it
> does not include support for waiting for the current process group.
>
> It would be possible to emulate to issue an extra syscall to get
> the current process group, but it is inherent racy: after the current
> process group is received and before it is passed to waitid a signal
> could arrive causing the current process group to change
>
> So waitid is used if wait4 is not defined iff the build is
> enabled with a minimum kernel if 5.4+.  The new assume
> __ASSUME_WAITID_PID0_P_PGID is added and an error is issued if waitid
> can not be implemented by either __NR_wait4 or
> __NR_waitid && __ASSUME_WAITID_PID0_P_PGID.
>
> Checked on x86_64-linux-gnu and i686-linux-gnu.
>
> Co-authored-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  sysdeps/unix/sysv/linux/kernel-features.h |  6 ++
>  sysdeps/unix/sysv/linux/syscalls.list     |  1 -
>  sysdeps/unix/sysv/linux/wait4.c           | 88 +++++++++++++++++++++++
>  3 files changed, 94 insertions(+), 1 deletion(-)
>  create mode 100644 sysdeps/unix/sysv/linux/wait4.c
>
> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
> index e6be76ff46..43faaa3f9d 100644
> --- a/sysdeps/unix/sysv/linux/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
> @@ -208,4 +208,10 @@
>  # define __ASSUME_TIME64_SYSCALLS 1
>  #endif
>
> +/* Linux waitid prior kernel 5.4 does not support waiting for the current
> +   process group.  */
> +#if __LINUX_KERNEL_VERSION >= 0x050400
> +# define __ASSUME_WAITID_PID0_P_PGID
> +#endif
> +
>  #endif /* kernel-features.h */
> diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
> index 603e517ca6..5f1352ad43 100644
> --- a/sysdeps/unix/sysv/linux/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/syscalls.list
> @@ -67,7 +67,6 @@ swapoff               -       swapoff         i:s     __swapoff       swapoff
>  unshare                EXTRA   unshare         i:i     unshare
>  uselib         EXTRA   uselib          i:s     __compat_uselib uselib@GLIBC_2.0:GLIBC_2.23
>  utime          -       utime           i:sP    utime
> -wait4          -       wait4           i:iWiP  __wait4         wait4
>
>  chown          -       chown           i:sii   __libc_chown    __chown chown
>
> diff --git a/sysdeps/unix/sysv/linux/wait4.c b/sysdeps/unix/sysv/linux/wait4.c
> new file mode 100644
> index 0000000000..d09917c7ff
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/wait4.c
> @@ -0,0 +1,88 @@
> +/* Wait for process to change state.  Linux version.
> +   Copyright (C) 2019 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/wait.h>
> +#include <sys/resource.h>
> +#include <sysdep-cancel.h>
> +
> +pid_t
> +__wait4 (pid_t pid, int *stat_loc, int options, struct rusage *usage)
> +{
> +#if __NR_wait4

This needs to be #ifdef as __NR_wait4 doesn't exist on RV32.

Alistair

> +   return SYSCALL_CANCEL (wait4, pid, stat_loc, options, usage);
> +#elif defined (__ASSUME_WAITID_PID0_P_PGID)
> +  idtype_t idtype = P_PID;
> +
> +  if (pid < -1)
> +    {
> +      idtype = P_PGID;
> +      pid *= -1;
> +    }
> +  else if (pid == -1)
> +    {
> +      idtype = P_ALL;
> +    }
> +  else if (pid == 0)
> +    {
> +      idtype = P_PGID;
> +    }
> +
> +  options |= WEXITED;
> +
> +  siginfo_t infop;
> +  if (SYSCALL_CANCEL (waitid, idtype, pid, &infop, options, usage) < 0)
> +    return -1;
> +
> +  if (stat_loc)
> +    {
> +      switch (infop.si_code)
> +        {
> +        case CLD_EXITED:
> +          *stat_loc = W_EXITCODE (infop.si_status, 0);
> +          break;
> +        case CLD_DUMPED:
> +          *stat_loc = WCOREFLAG | infop.si_status;
> +         break;
> +        case CLD_KILLED:
> +          *stat_loc = infop.si_status;
> +          break;
> +        case CLD_TRAPPED:
> +        case CLD_STOPPED:
> +          *stat_loc = W_STOPCODE (infop.si_status);
> +          break;
> +        case CLD_CONTINUED:
> +          *stat_loc = __W_CONTINUED;
> +          break;
> +       default:
> +         *stat_loc = 0;
> +         break;
> +        }
> +    }
> +
> +  return infop.si_pid;
> +# else
> +/* Linux waitid prior kernel 5.4 does not support waiting for the current
> +   process.  It would be possible to emulate it by calling getpgid for pid 0,
> +   however, it would require an additional syscall and it is inherent racy:
> +   after the current process group is received and before it is passed
> +   to waitid a signal could arrive causing the current process group to
> +   change.  */
> +# error "The kernel ABI does not provide a way to implement wait4"
> +#endif
> +}
> +weak_alias (__wait4, wait4)
> --
> 2.17.1
>

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

* Re: [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined
  2019-11-15 18:27   ` Alistair Francis
@ 2019-11-21 17:48     ` Adhemerval Zanella
  0 siblings, 0 replies; 19+ messages in thread
From: Adhemerval Zanella @ 2019-11-21 17:48 UTC (permalink / raw)
  To: Alistair Francis; +Cc: GNU C Library, Alistair Francis



On 15/11/2019 15:27, Alistair Francis wrote:
>> +
>> +pid_t
>> +__wait4 (pid_t pid, int *stat_loc, int options, struct rusage *usage)
>> +{
>> +#if __NR_wait4
> 
> This needs to be #ifdef as __NR_wait4 doesn't exist on RV32.
> 
> Alistair

Acked.

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

* Re: [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined
  2019-11-14 14:47 ` [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined Adhemerval Zanella
  2019-11-15 18:27   ` Alistair Francis
@ 2019-11-21 17:52   ` Adhemerval Zanella
  2019-11-21 18:41     ` Alistair Francis
  1 sibling, 1 reply; 19+ messages in thread
From: Adhemerval Zanella @ 2019-11-21 17:52 UTC (permalink / raw)
  To: libc-alpha



On 14/11/2019 11:47, Adhemerval Zanella wrote:
> +pid_t
> +__wait4 (pid_t pid, int *stat_loc, int options, struct rusage *usage)
> +{
> +#if __NR_wait4
> +   return SYSCALL_CANCEL (wait4, pid, stat_loc, options, usage);
> +#elif defined (__ASSUME_WAITID_PID0_P_PGID)
[...]
> +# else
> +/* Linux waitid prior kernel 5.4 does not support waiting for the current
> +   process.  It would be possible to emulate it by calling getpgid for pid 0,
> +   however, it would require an additional syscall and it is inherent racy:
> +   after the current process group is received and before it is passed
> +   to waitid a signal could arrive causing the current process group to
> +   change.  */
> +# error "The kernel ABI does not provide a way to implement wait4"
> +#endif

So the only design here that I am not sure is if the best one is to trigger
a build error to avoid an architecture to not define __NR_wait4 and also 
support kernels older than 5.4 (which would not define 
__ASSUME_WAITID_PID0_P_PGID), or if it should do as generic implementation
and return ENOSYS along with a stub.

Thoughts?

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

* Re: [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined
  2019-11-21 17:52   ` Adhemerval Zanella
@ 2019-11-21 18:41     ` Alistair Francis
  2019-11-22 12:15       ` Adhemerval Zanella
  0 siblings, 1 reply; 19+ messages in thread
From: Alistair Francis @ 2019-11-21 18:41 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: GNU C Library

On Thu, Nov 21, 2019 at 9:53 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 14/11/2019 11:47, Adhemerval Zanella wrote:
> > +pid_t
> > +__wait4 (pid_t pid, int *stat_loc, int options, struct rusage *usage)
> > +{
> > +#if __NR_wait4
> > +   return SYSCALL_CANCEL (wait4, pid, stat_loc, options, usage);
> > +#elif defined (__ASSUME_WAITID_PID0_P_PGID)
> [...]
> > +# else
> > +/* Linux waitid prior kernel 5.4 does not support waiting for the current
> > +   process.  It would be possible to emulate it by calling getpgid for pid 0,
> > +   however, it would require an additional syscall and it is inherent racy:
> > +   after the current process group is received and before it is passed
> > +   to waitid a signal could arrive causing the current process group to
> > +   change.  */
> > +# error "The kernel ABI does not provide a way to implement wait4"
> > +#endif
>
> So the only design here that I am not sure is if the best one is to trigger
> a build error to avoid an architecture to not define __NR_wait4 and also
> support kernels older than 5.4 (which would not define
> __ASSUME_WAITID_PID0_P_PGID), or if it should do as generic implementation
> and return ENOSYS along with a stub.
>
> Thoughts?

I think a build error makes sense. Currently only RV32 doesn't have
__NR_wait4 (which isn't upstreamed) so you aren't breaking anything.

The only kernels that could possibly not have __NR_wait4 and be less
then 5.4 are 5.1, 5.2 and 5.3, non of which are stable so they will
slowly disappear anyway.

Not producing a build error could be very confusing for developers
that do get bitten by the missing implementation.

Alistair

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

* Re: [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined
  2019-11-21 18:41     ` Alistair Francis
@ 2019-11-22 12:15       ` Adhemerval Zanella
  2019-11-22 20:00         ` Alistair Francis
  0 siblings, 1 reply; 19+ messages in thread
From: Adhemerval Zanella @ 2019-11-22 12:15 UTC (permalink / raw)
  To: Alistair Francis; +Cc: GNU C Library



On 21/11/2019 15:41, Alistair Francis wrote:
> On Thu, Nov 21, 2019 at 9:53 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>>
>>
>> On 14/11/2019 11:47, Adhemerval Zanella wrote:
>>> +pid_t
>>> +__wait4 (pid_t pid, int *stat_loc, int options, struct rusage *usage)
>>> +{
>>> +#if __NR_wait4
>>> +   return SYSCALL_CANCEL (wait4, pid, stat_loc, options, usage);
>>> +#elif defined (__ASSUME_WAITID_PID0_P_PGID)
>> [...]
>>> +# else
>>> +/* Linux waitid prior kernel 5.4 does not support waiting for the current
>>> +   process.  It would be possible to emulate it by calling getpgid for pid 0,
>>> +   however, it would require an additional syscall and it is inherent racy:
>>> +   after the current process group is received and before it is passed
>>> +   to waitid a signal could arrive causing the current process group to
>>> +   change.  */
>>> +# error "The kernel ABI does not provide a way to implement wait4"
>>> +#endif
>>
>> So the only design here that I am not sure is if the best one is to trigger
>> a build error to avoid an architecture to not define __NR_wait4 and also
>> support kernels older than 5.4 (which would not define
>> __ASSUME_WAITID_PID0_P_PGID), or if it should do as generic implementation
>> and return ENOSYS along with a stub.
>>
>> Thoughts?
> 
> I think a build error makes sense. Currently only RV32 doesn't have
> __NR_wait4 (which isn't upstreamed) so you aren't breaking anything.
> 
> The only kernels that could possibly not have __NR_wait4 and be less
> then 5.4 are 5.1, 5.2 and 5.3, non of which are stable so they will
> slowly disappear anyway.
> 
> Not producing a build error could be very confusing for developers
> that do get bitten by the missing implementation.
> 

My point if if checking for kernel version to define __ASSUME_WAITID_PID0_P_PGID
does make, meaning it is possible with some config option in the kernel
to enable only waitid for kernels older than 5.3; or if we can assume
some configuration in always invalid and thus the kernel won't allow
enable it.

If the latter we can then remove the __ASSUME_WAITID_PID0_P_PGID and
add a comment on waitid implementation stating that if waitid is the
only syscall supported then it is suppose to be the superset of all
wait* functionalities.

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

* Re: [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined
  2019-11-22 12:15       ` Adhemerval Zanella
@ 2019-11-22 20:00         ` Alistair Francis
  2019-11-25 12:39           ` Adhemerval Zanella
  0 siblings, 1 reply; 19+ messages in thread
From: Alistair Francis @ 2019-11-22 20:00 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: GNU C Library

On Fri, Nov 22, 2019 at 4:15 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 21/11/2019 15:41, Alistair Francis wrote:
> > On Thu, Nov 21, 2019 at 9:53 AM Adhemerval Zanella
> > <adhemerval.zanella@linaro.org> wrote:
> >>
> >>
> >>
> >> On 14/11/2019 11:47, Adhemerval Zanella wrote:
> >>> +pid_t
> >>> +__wait4 (pid_t pid, int *stat_loc, int options, struct rusage *usage)
> >>> +{
> >>> +#if __NR_wait4
> >>> +   return SYSCALL_CANCEL (wait4, pid, stat_loc, options, usage);
> >>> +#elif defined (__ASSUME_WAITID_PID0_P_PGID)
> >> [...]
> >>> +# else
> >>> +/* Linux waitid prior kernel 5.4 does not support waiting for the current
> >>> +   process.  It would be possible to emulate it by calling getpgid for pid 0,
> >>> +   however, it would require an additional syscall and it is inherent racy:
> >>> +   after the current process group is received and before it is passed
> >>> +   to waitid a signal could arrive causing the current process group to
> >>> +   change.  */
> >>> +# error "The kernel ABI does not provide a way to implement wait4"
> >>> +#endif
> >>
> >> So the only design here that I am not sure is if the best one is to trigger
> >> a build error to avoid an architecture to not define __NR_wait4 and also
> >> support kernels older than 5.4 (which would not define
> >> __ASSUME_WAITID_PID0_P_PGID), or if it should do as generic implementation
> >> and return ENOSYS along with a stub.
> >>
> >> Thoughts?
> >
> > I think a build error makes sense. Currently only RV32 doesn't have
> > __NR_wait4 (which isn't upstreamed) so you aren't breaking anything.
> >
> > The only kernels that could possibly not have __NR_wait4 and be less
> > then 5.4 are 5.1, 5.2 and 5.3, non of which are stable so they will
> > slowly disappear anyway.
> >
> > Not producing a build error could be very confusing for developers
> > that do get bitten by the missing implementation.
> >
>
> My point if if checking for kernel version to define __ASSUME_WAITID_PID0_P_PGID
> does make, meaning it is possible with some config option in the kernel
> to enable only waitid for kernels older than 5.3; or if we can assume
> some configuration in always invalid and thus the kernel won't allow
> enable it.
>
> If the latter we can then remove the __ASSUME_WAITID_PID0_P_PGID and
> add a comment on waitid implementation stating that if waitid is the
> only syscall supported then it is suppose to be the superset of all
> wait* functionalities.

I think I understand what you are saying.

It is NOT the case that if waitid is the only syscall supported then
it is a superset of all wait* functions.

For RV32 the 5.1, 5.2 and 5.3 only support waitid but do not support
the PID0 P_PGID functionality. In these three kernel cases the call
will fail.

Alistair

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

* Re: [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined
  2019-11-22 20:00         ` Alistair Francis
@ 2019-11-25 12:39           ` Adhemerval Zanella
  2019-11-25 12:42             ` Adhemerval Zanella
  0 siblings, 1 reply; 19+ messages in thread
From: Adhemerval Zanella @ 2019-11-25 12:39 UTC (permalink / raw)
  To: Alistair Francis; +Cc: GNU C Library



On 22/11/2019 17:00, Alistair Francis wrote:
> On Fri, Nov 22, 2019 at 4:15 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>>
>>
>> On 21/11/2019 15:41, Alistair Francis wrote:
>>> On Thu, Nov 21, 2019 at 9:53 AM Adhemerval Zanella
>>> <adhemerval.zanella@linaro.org> wrote:
>>>>
>>>>
>>>>
>>>> On 14/11/2019 11:47, Adhemerval Zanella wrote:
>>>>> +pid_t
>>>>> +__wait4 (pid_t pid, int *stat_loc, int options, struct rusage *usage)
>>>>> +{
>>>>> +#if __NR_wait4
>>>>> +   return SYSCALL_CANCEL (wait4, pid, stat_loc, options, usage);
>>>>> +#elif defined (__ASSUME_WAITID_PID0_P_PGID)
>>>> [...]
>>>>> +# else
>>>>> +/* Linux waitid prior kernel 5.4 does not support waiting for the current
>>>>> +   process.  It would be possible to emulate it by calling getpgid for pid 0,
>>>>> +   however, it would require an additional syscall and it is inherent racy:
>>>>> +   after the current process group is received and before it is passed
>>>>> +   to waitid a signal could arrive causing the current process group to
>>>>> +   change.  */
>>>>> +# error "The kernel ABI does not provide a way to implement wait4"
>>>>> +#endif
>>>>
>>>> So the only design here that I am not sure is if the best one is to trigger
>>>> a build error to avoid an architecture to not define __NR_wait4 and also
>>>> support kernels older than 5.4 (which would not define
>>>> __ASSUME_WAITID_PID0_P_PGID), or if it should do as generic implementation
>>>> and return ENOSYS along with a stub.
>>>>
>>>> Thoughts?
>>>
>>> I think a build error makes sense. Currently only RV32 doesn't have
>>> __NR_wait4 (which isn't upstreamed) so you aren't breaking anything.
>>>
>>> The only kernels that could possibly not have __NR_wait4 and be less
>>> then 5.4 are 5.1, 5.2 and 5.3, non of which are stable so they will
>>> slowly disappear anyway.
>>>
>>> Not producing a build error could be very confusing for developers
>>> that do get bitten by the missing implementation.
>>>
>>
>> My point if if checking for kernel version to define __ASSUME_WAITID_PID0_P_PGID
>> does make, meaning it is possible with some config option in the kernel
>> to enable only waitid for kernels older than 5.3; or if we can assume
>> some configuration in always invalid and thus the kernel won't allow
>> enable it.
>>
>> If the latter we can then remove the __ASSUME_WAITID_PID0_P_PGID and
>> add a comment on waitid implementation stating that if waitid is the
>> only syscall supported then it is suppose to be the superset of all
>> wait* functionalities.
> 
> I think I understand what you are saying.
> 
> It is NOT the case that if waitid is the only syscall supported then
> it is a superset of all wait* functions.
> 
> For RV32 the 5.1, 5.2 and 5.3 only support waitid but do not support
> the PID0 P_PGID functionality. In these three kernel cases the call
> will fail.
> 

If it is the case (and it does seems linux support RV32 for kernel older
than v5.4), we will need to make the 5.4 the minimum supported kernel for
RV32 and any other architecture that only support waitid syscall.

The kernel check can be done at the configure level, but it does not
help on some kernel configuration for a architecture that explicit 
try to remove olds syscall to mimic the generic user API (not sure if
this is possible with current kernel configuration flags).

So it seems that __ASSUME_WAITID_PID0_P_PGID should be a safe call to
avoid such theoretical scenarios.  I will rework how the flag is used
to mimic other assume usage where newer kernel version undef the flag,
so it should be simpler to remove it once the minimum kernel is lifted.

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

* Re: [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined
  2019-11-25 12:39           ` Adhemerval Zanella
@ 2019-11-25 12:42             ` Adhemerval Zanella
  2019-12-03 18:58               ` Alistair Francis
  0 siblings, 1 reply; 19+ messages in thread
From: Adhemerval Zanella @ 2019-11-25 12:42 UTC (permalink / raw)
  To: Alistair Francis; +Cc: GNU C Library



On 25/11/2019 09:39, Adhemerval Zanella wrote:

> So it seems that __ASSUME_WAITID_PID0_P_PGID should be a safe call to
> avoid such theoretical scenarios.  I will rework how the flag is used
> to mimic other assume usage where newer kernel version undef the flag,
> so it should be simpler to remove it once the minimum kernel is lifted.
> 

In fact I think change the __ASSUME_WAITID_PID0_P_PGID won't be much
a improvement

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

* Re: [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined
  2019-11-25 12:42             ` Adhemerval Zanella
@ 2019-12-03 18:58               ` Alistair Francis
  2019-12-03 19:18                 ` Adhemerval Zanella
  0 siblings, 1 reply; 19+ messages in thread
From: Alistair Francis @ 2019-12-03 18:58 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: GNU C Library

On Mon, Nov 25, 2019 at 4:42 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 25/11/2019 09:39, Adhemerval Zanella wrote:
>
> > So it seems that __ASSUME_WAITID_PID0_P_PGID should be a safe call to
> > avoid such theoretical scenarios.  I will rework how the flag is used
> > to mimic other assume usage where newer kernel version undef the flag,
> > so it should be simpler to remove it once the minimum kernel is lifted.
> >
>
> In fact I think change the __ASSUME_WAITID_PID0_P_PGID won't be much
> a improvement

Any update on this series?

Alistair

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

* Re: [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined
  2019-12-03 18:58               ` Alistair Francis
@ 2019-12-03 19:18                 ` Adhemerval Zanella
  0 siblings, 0 replies; 19+ messages in thread
From: Adhemerval Zanella @ 2019-12-03 19:18 UTC (permalink / raw)
  To: Alistair Francis; +Cc: GNU C Library



On 03/12/2019 15:58, Alistair Francis wrote:
> On Mon, Nov 25, 2019 at 4:42 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>>
>>
>> On 25/11/2019 09:39, Adhemerval Zanella wrote:
>>
>>> So it seems that __ASSUME_WAITID_PID0_P_PGID should be a safe call to
>>> avoid such theoretical scenarios.  I will rework how the flag is used
>>> to mimic other assume usage where newer kernel version undef the flag,
>>> so it should be simpler to remove it once the minimum kernel is lifted.
>>>
>>
>> In fact I think change the __ASSUME_WAITID_PID0_P_PGID won't be much
>> a improvement
> 
> Any update on this series?

I am working on a libpthread-compat.c patch I plan to update, so I can
rebase against it.

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

* Re: [PATCH 7/7] Consolidate wait3 implementations
  2019-11-14 15:44   ` Alistair Francis
@ 2019-12-19 15:33     ` Adhemerval Zanella
  0 siblings, 0 replies; 19+ messages in thread
From: Adhemerval Zanella @ 2019-12-19 15:33 UTC (permalink / raw)
  To: Alistair Francis; +Cc: GNU C Library, Alistair Francis



On 14/11/2019 12:44, Alistair Francis wrote:
> On Thu, Nov 14, 2019 at 6:47 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> The generic one calls wait4.
>>
>> Checked on x86_64-linux-gnu.
>> ---
> 
> Thanks for doing this! This whole series looks good to me.
> 
> Alistair

I am running full check on x86, i386, powerpc*, aarch64, arm,
sparc*, and s390* and I plan to commit this shortly.

I also rebase the "ptl: Move wait implementation to libc"
on top of 0487ebed22, so there is changes on nptl/libpthread-compat.c
anymore.

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

end of thread, other threads:[~2019-12-19 15:33 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 14:46 [PATCH 1/7] Remove __waitpid_nocancel Adhemerval Zanella
2019-11-14 14:46 ` [PATCH 2/7] nptl: Move wait implementation to libc Adhemerval Zanella
2019-11-14 14:47 ` [PATCH 3/7] nptl: Move waitpid " Adhemerval Zanella
2019-11-14 14:47 ` [PATCH 4/7] Implement wait in terms of waitpid Adhemerval Zanella
2019-11-14 14:47 ` [PATCH 5/7] linux: Use waitid on wait4 if __NR_wait4 is not defined Adhemerval Zanella
2019-11-15 18:27   ` Alistair Francis
2019-11-21 17:48     ` Adhemerval Zanella
2019-11-21 17:52   ` Adhemerval Zanella
2019-11-21 18:41     ` Alistair Francis
2019-11-22 12:15       ` Adhemerval Zanella
2019-11-22 20:00         ` Alistair Francis
2019-11-25 12:39           ` Adhemerval Zanella
2019-11-25 12:42             ` Adhemerval Zanella
2019-12-03 18:58               ` Alistair Francis
2019-12-03 19:18                 ` Adhemerval Zanella
2019-11-14 14:47 ` [PATCH 6/7] Implement waitpid in terms of wait4 Adhemerval Zanella
2019-11-14 14:47 ` [PATCH 7/7] Consolidate wait3 implementations Adhemerval Zanella
2019-11-14 15:44   ` Alistair Francis
2019-12-19 15:33     ` 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).