Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ wait(2) — Ultrix-11 3.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exit(2)

fork(2)

pause(2)

signal(2)

wait(2)

NAME

wait − wait for a process to terminate

SYNTAX

int wait(status)
int *status;

int wait(0)

DESCRIPTION

The wait system call causes its caller to delay until either a signal is received or one of its child processes terminates.  If a child process has died since the last wait call, return is immediate.  If there are no children, return is immediate with the error bit set and a value of −1 is returned.  The normal return yields the process ID of the terminated child.  In the case of several children, several wait calls are needed to learn of all the deaths. 

If status is nonzero, the high byte of the word pointed to receives the low byte of the argument of the exit call when the child terminated.  The low byte receives the termination status of the process.  For a list of termination statuses (signals), see signal(2).  0 status indicates normal termination.  A special status (0177) is returned for a stopped process which has not terminated and can be restarted.  For further information, see ptrace(2).  If the 0200 bit of the termination status is set, a core image of the process was produced by the system. 

If the parent process terminates without waiting on its children, the initialization process (process ID = 1) inherits the children. 

RETURN VALUE

If return is caused by the receipt of a signal, returns a −1, and the global variable errno is set to EINTR.  If return caused by a stopped or terminated child process, returns the process ID of the child.  Otherwise, if unsuccessful, returns a −1, and the global variable errno indicates the error code. 

DIAGNOSTICS

The wait call will fail if:

[ECHILD] The calling process has no unwaited-for child processes. 

[EFAULT] The specified status points to an address outside of the process’s allocated address space. 

ASSEMBLER

(wait = 7.) 
sys wait
(process ID in r0) (status in r1)
The high byte of the status is the low byte of r0 in the child at termination.

SEE ALSO

exit(2), fork(2), pause(2), signal(2),

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026