]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Consolidate non cancellable waitpid call
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 3 Jul 2017 18:43:51 +0000 (15:43 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 21 Aug 2017 18:37:45 +0000 (15:37 -0300)
This patch consolidates all the non cancellable waitpid calls to use
the __waitpid_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

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

* libio/ioopen.c (_IO_waitpid): Replace waitpid_not_cancel with
__waitpid_nocancel.
* sysdeps/generic/not-cancel.h (waitpid_not_cancel): Remove macro.
(__waitpid_nocancel): New macro.
* sysdeps/unix/sysv/linux/not-cancel.h (waitpid_not_cancel): Remove
macro.
(__waitpid_nocancel): Replace macro with a function.
* sysdeps/unix/sysv/linux/waitpid.c (__waitpid_nocancel): New
function.

ChangeLog
libio/iopopen.c
sysdeps/generic/not-cancel.h
sysdeps/unix/sysv/linux/not-cancel.h
sysdeps/unix/sysv/linux/waitpid.c

index 759aa4bed45e5cb4ffbe44fa6766c5134902f463..3d2afd95efab97f3016ac10076f036c64570d91c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2017-08-21  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+       * libio/ioopen.c (_IO_waitpid): Replace waitpid_not_cancel with
+       __waitpid_nocancel.
+       * sysdeps/generic/not-cancel.h (waitpid_not_cancel): Remove macro.
+       (__waitpid_nocancel): New macro.
+       * sysdeps/unix/sysv/linux/not-cancel.h (waitpid_not_cancel): Remove
+       macro.
+       (__waitpid_nocancel): Replace macro with a function.
+       * sysdeps/unix/sysv/linux/waitpid.c (__waitpid_nocancel): New
+       function.
+
        * login/utmp_file.c (timeout_handler): Replace fcntl_not_cancel with
        __fcntl_nocancel.
        * sysdeps/generic/not-cancel.h (fcntl_not_cancel): Remove macro.
index 0c20cbbfe2b1182248d8e7f6ff801b49bbffec39..a2ddebb32b86449eede9bf6f0b615f94d8282d7a 100644 (file)
@@ -61,7 +61,7 @@ extern int _IO_dup2 (int fd, int fd2) __THROW;
 
 #ifndef _IO_waitpid
 #ifdef _LIBC
-#define _IO_waitpid waitpid_not_cancel
+#define _IO_waitpid __waitpid_nocancel
 #else
 #define _IO_waitpid waitpid
 #endif
index cf8455099d888aa4379fe65642a6c2b9e88cfc69..3f924c895db53ccab44ef72cd68a82eb069521dd 100644 (file)
@@ -36,7 +36,7 @@
   __write (fd, buf, n)
 #define __writev_nocancel_nostatus(fd, iov, n) \
   (void) __writev (fd, iov, n)
-# define waitpid_not_cancel(pid, stat_loc, options) \
+# define __waitpid_nocancel(pid, stat_loc, options) \
   __waitpid (pid, stat_loc, options)
 #define pause_not_cancel() \
   __pause ()
index acf5775928d92744f6d0990afa30685cacbe9c48..c4a60b8d6713510f14fe8f849cc73dda87f80383 100644 (file)
@@ -25,6 +25,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <sys/syscall.h>
+#include <sys/wait.h>
 
 /* Non cancellable open syscall.  */
 __typeof (open) __open_nocancel;
@@ -72,10 +73,8 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt)
 }
 
 /* Uncancelable waitpid.  */
-#define __waitpid_nocancel(pid, stat_loc, options) \
-  INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL)
-#define waitpid_not_cancel(pid, stat_loc, options) \
-  __waitpid_nocancel(pid, stat_loc, options)
+__typeof (waitpid) __waitpid_nocancel;
+libc_hidden_proto (__waitpid_nocancel)
 
 /* Uncancelable pause.  */
 #define pause_not_cancel() \
index 2fed421c901ef7c6918b2714fa715b1050d408cf..efc4480b5bc1d57300efb0af4ff4a61993ef1e42 100644 (file)
@@ -19,6 +19,7 @@
 #include <sysdep-cancel.h>
 #include <stdlib.h>
 #include <sys/wait.h>
+#include <not-cancel.h>
 
 __pid_t
 __waitpid (__pid_t pid, int *stat_loc, int options)
@@ -31,3 +32,14 @@ __waitpid (__pid_t pid, int *stat_loc, int options)
 }
 libc_hidden_def (__waitpid)
 weak_alias (__waitpid, waitpid)
+
+__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)