summaryrefslogtreecommitdiff
path: root/src/user/lib/syswait.c
blob: ce80c7b3de677988c3c63c5bd37bf05838cb2775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <bits/panic.h>
#include <camellia.h>
#include <camellia/syscalls.h>
#include <errno.h>
#include <sys/resource.h>
#include <sys/wait.h>

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;
}