about summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-11-13 17:57:00 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-12-19 16:11:09 -0300
commit848791557bc4dbf783b03f2b8af77f71c909ed57 (patch)
tree19e9be29ab32a7bc648506bef0dd7020e5e49522 /posix
parent9b2cf9482a9397c4711c9e7f42f8d718b6306bdc (diff)
downloadglibc-848791557bc4dbf783b03f2b8af77f71c909ed57.tar.gz
glibc-848791557bc4dbf783b03f2b8af77f71c909ed57.tar.xz
glibc-848791557bc4dbf783b03f2b8af77f71c909ed57.zip
Implement waitpid in terms of wait4
This also consolidate all waitpid implementations.

Checked on x86_64-linux-gnu.
Diffstat (limited to 'posix')
-rw-r--r--posix/wait4.c1
-rw-r--r--posix/waitpid.c13
2 files changed, 3 insertions, 11 deletions
diff --git a/posix/wait4.c b/posix/wait4.c
index eb4f7fb6de..76cc590051 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 adae03918a..214c564623 100644
--- a/posix/waitpid.c
+++ b/posix/waitpid.c
@@ -16,8 +16,8 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
+#include <stdlib.h>
 #include <sys/wait.h>
-#include <sys/types.h>
 
 
 /* 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)