WAIT (II)                    9/4/72                     WAIT (II)

NAME            wait  --  wait for process to die

SYNOPSIS        sys wait  / wait = 7.

                (process ID in r0)

                (termination status/user status in r1)

DESCRIPTION     wait causes its caller to delay until one of its

                child processes terminates.  If any child has

                died since the last wait, return is immediate; if

                there are no children, return is immediate with

                the error bit set.  In the case of several chil-

                dren several waits are needed to learn of all the


                If the error bit is not set on return, the r1

                high byte contains the low byte of the child pro-

                cess r0 when it terminated.  The r1 low byte con-

                tains the termination status of the process from

                the following list:

                   0    exit

                   1    bus error

                   2    illegal instruction

                   3    trace trap

                   4    IOT trap

                   5    power fail trap

                   6    EMT trap

                   7    bad system call

                   8    PIR interrupt

                   9    floating point exception

                  10    memory violation

                  11    quit

                  12    interrupt

                  13    kill (see kill(II))

                  14    User I/O (not currently possible)

                 +16    core image produced

SEE ALSO        exit(II), fork(II)

DIAGNOSTICS     error bit (c-bit) on if no children not previ-

                ously waited for.

BUGS            A child which dies, but is never waited for con-

                sumes a slot in the process table.  When this

                table is full, the system is effectively hung.