summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2011-04-21 22:31:08 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-06-15 14:00:41 +0200
commit08b258aeb96a6970b950eedc2dc2ab00b04011ee (patch)
tree38a9bd354003b1599f644e2eeadce0f589c18877 /libc/sysdeps/linux
parentc4b9ff234e2d18ee51f652467986ed0102667737 (diff)
waitpid.c: provide __waitpid_nocancel, use cancel.h
Use __wait4_nocancel since wait4 is not available all the time. Add a comment about not using waitpid syscall. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/common/waitpid.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/libc/sysdeps/linux/common/waitpid.c b/libc/sysdeps/linux/common/waitpid.c
index d0437194d..2309d5bb8 100644
--- a/libc/sysdeps/linux/common/waitpid.c
+++ b/libc/sysdeps/linux/common/waitpid.c
@@ -6,32 +6,16 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <stdlib.h>
-#include <sys/types.h>
#include <sys/wait.h>
-#include <sys/resource.h>
+#include <cancel.h>
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-#include "sysdep-cancel.h"
-#else
-#define SINGLE_THREAD_P 1
-#endif
-
-libc_hidden_proto(wait4)
-
-extern __typeof(waitpid) __libc_waitpid;
-__pid_t __libc_waitpid(__pid_t pid, int *wait_stat, int options)
+pid_t __NC(waitpid)(pid_t pid, int *wait_stat, int options)
{
- if (SINGLE_THREAD_P)
- return wait4(pid, wait_stat, options, NULL);
-
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
- int oldtype = LIBC_CANCEL_ASYNC ();
- int result = wait4(pid, wait_stat, options, NULL);
- LIBC_CANCEL_RESET (oldtype);
- return result;
+#if 1 /* kernel/exit.c says to avoid waitpid syscall */
+ return __wait4_nocancel(pid, wait_stat, options, NULL);
+#else
+ return INLINE_SYSCALL(waitpid, 3, pid, wait_stat, options);
#endif
}
-libc_hidden_proto(waitpid)
-weak_alias(__libc_waitpid,waitpid)
-libc_hidden_weak(waitpid)
+CANCELLABLE_SYSCALL(pid_t, waitpid, (pid_t pid, int *wait_stat, int options), (pid, wait_stat, options))
+lt_libc_hidden(waitpid)