about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/not-cancel.h7
-rw-r--r--sysdeps/unix/sysv/linux/waitpid.c12
2 files changed, 15 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index acf5775928..c4a60b8d67 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -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() \
diff --git a/sysdeps/unix/sysv/linux/waitpid.c b/sysdeps/unix/sysv/linux/waitpid.c
index 2fed421c90..efc4480b5b 100644
--- a/sysdeps/unix/sysv/linux/waitpid.c
+++ b/sysdeps/unix/sysv/linux/waitpid.c
@@ -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)