Go to the previous, next section.
pid_t wait4(pid_t pid, int *status, int options,
struct rusage *rusage);
pid: [in] the pid of the child.
status: [out] the return status of the child.
options: [in] options for the wait.
rusage: [out] the ressource usage of the dead child.
This call puts the calling task to sleep until the child specified by pid exits or a signal is caught. If a child that fits the request is already in a zombie state at the time of the call, the zombie is exorcised and the call retrurns immediately.
pid has different meanings according to the ranges of values it may take:
<-1
-1
0
>0
If status is not NULL
, then the return status of the child
is stored to the area pointed to by status.
options is one or more of the following values or'ed together:
WNOHANG
WUNTRACED
The pid of the child who exited. If WNOHANG
has been specified,
then the call may return zero. In case of error, the call returns zero
and errno
is set to one of the following values:
ECHILD
: the child does not exist.
EPERM
: the effective uid of the calling task is not equal
to the one of the child the task is waiting for and the calling task
does not have superuser privileges.
ERESTARTSYS
.
Go to the previous, next section.