vm: fix a null dereference on out-of-memory
[minix.git] / lib / libc / gen / minix / wait.c
blob2d639c8c2ecc4ea59a49f11c8889bfe4644b9423
1 #include <sys/cdefs.h>
2 #include <lib.h>
3 #include "namespace.h"
5 #include <sys/wait.h>
7 #ifdef __weak_alias
8 __weak_alias(wait, _wait)
9 #endif
11 pid_t wait(status)
12 int * status;
14 message m;
16 if (_syscall(PM_PROC_NR, WAIT, &m) < 0) return(-1);
17 if (status != 0) *status = m.m2_i1;
18 return(m.m_type);