blob: 43c20ae786e22a084cb50d1c4d61cb367d8d69de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <bits/panic.h>
#include <camellia.h>
#include <camellia/syscalls.h>
#include <errno.h>
#include <sys/resource.h>
#include <sys/wait.h>
pid_t wait(int *wstatus) {
return wait3(wstatus, 0, NULL);
}
pid_t wait3(int *wstatus, int opts, struct rusage *rusage) {
struct sys_wait2 res;
if (opts || rusage) {
__libc_panic("unimplemented");
}
pid_t ret = _sys_wait2(-1, 0, &res);
if (ret < 0) {
errno = -ret;
return -1;
}
if (wstatus) {
*wstatus = res.status & 0xFF;
}
return ret;
}
|