summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sys/wait/wait3.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/sys/wait/wait3.c b/src/sys/wait/wait3.c
index c3f8c599..a530dfa8 100644
--- a/src/sys/wait/wait3.c
+++ b/src/sys/wait/wait3.c
@@ -1,8 +1,19 @@
+#include "sys/types.h"
+#include "sys/resource.h"
#include <sys/wait.h>
-pid_t wait3(int *state_loc, int options, struct rusage *resource_usage)
+pid_t wait3(int *stat_loc, int options, struct rusage *resource_usage)
{
- return -1;
+ pid_t ret = waitpid((pid_t)-1, stat_loc, options);
+ if (ret == (pid_t)-1) {
+ return (pid_t)-1;
+ }
+
+ if (getrusage(RUSAGE_CHILDREN, resource_usage) == -1) {
+ return (pid_t)-1;
+ }
+
+ return ret;
}
/*