.th WAIT II 8/5/73
.sh NAME
wait \*- wait for process to die
.sh SYNOPSIS
(wait = 7.)
.br
.ft B
sys  wait
.s3
wait(status)
.br
int *status;
.ft R
.sh DESCRIPTION
.it Wait
causes its caller to delay until one of its child
processes terminates.
If any child has died since the last
.it wait,
return is immediate;
if there are no children, return is immediate with
the error bit set
(resp. with a value of \*-1 returned).
In the case of several children several
.it wait
calls are needed
to learn of all the deaths.
.s3
If no error is indicated on return,
the r1 high byte (resp. the high byte stored into
.it status
) contains the low byte of the
child process r0 (resp. the argument of
.it exit
) when it terminated.
The r1 (resp.
.it status
) low byte contains the termination status
of the process.
See signal(II) for
a list of termination statuses (signals);
0 status indicates normal termination.
If the 040 bit of the termination status
is set,
a core image of the process was produced
by the system.
.sh "SEE ALSO"
exit(II), fork(II), signal(II)
.sh DIAGNOSTICS
The error bit
(c-bit) on if no children not previously waited for.
From C, a returned value of \*-1 indicates an error.
