diff options
| author | Jakob Kaivo <jkk@ung.org> | 2020-08-14 20:18:19 -0400 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2020-08-14 20:18:19 -0400 |
| commit | caaf42673377d87b05381d6c83eb0d073c919d4b (patch) | |
| tree | 6a880c26f405a3ccd3f33d6d8a355b818f707113 /src | |
| parent | 89ee9495e99748a36742828ae301819ff550ed56 (diff) | |
rought draft
Diffstat (limited to 'src')
| -rw-r--r-- | src/sys/wait/wait3.c | 15 |
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; } /* |
