pid_t wait(pid_t pid, int *status, int options);
This syscall suspends execution until the passed pid exits, to then store the
exit code in status
.
wait
allows the option WNOHANG(0b000010)
for non-blocking
waiting, if the process has not finished yet, 0
will be returned.
pid
can be a PID the callee is a parent of, or -1
to wait on all
the PIDs the callee has as children. 0
, which waits on all the children
of a process group, is not implemented yet.
This syscall returns the PID waited on or -1
on failure, along with the
following errno:
ECHILD
: The passed PID does not exist.
EINVAL
: The passed options are not correct or the passed PID is 0