From 848791557bc4dbf783b03f2b8af77f71c909ed57 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Wed, 13 Nov 2019 17:57:00 -0300 Subject: Implement waitpid in terms of wait4 This also consolidate all waitpid implementations. Checked on x86_64-linux-gnu. --- posix/wait4.c | 1 + posix/waitpid.c | 13 ++----------- 2 files changed, 3 insertions(+), 11 deletions(-) (limited to 'posix') diff --git a/posix/wait4.c b/posix/wait4.c index eb4f7fb..76cc590 100644 --- a/posix/wait4.c +++ b/posix/wait4.c @@ -27,4 +27,5 @@ __wait4 (__pid_t pid, int *stat_loc, int options, struct rusage *usage) } stub_warning (wait4) +libc_hidden_def (__wait4) weak_alias (__wait4, wait4) diff --git a/posix/waitpid.c b/posix/waitpid.c index adae039..214c564 100644 --- a/posix/waitpid.c +++ b/posix/waitpid.c @@ -16,8 +16,8 @@ . */ #include +#include #include -#include /* Wait for a child matching PID to die. @@ -35,16 +35,7 @@ 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) -- cgit v1.1