Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ wait(2) — SunOS 0.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exit(2)

wait3(2)

WAIT(2)  —  System Interface Manual — System Calls

NAME

wait − wait for process to terminate

SYNOPSIS

#include <wait.h>
 pid = wait(&status)
int pid;
union wait status;

pid = wait(0)
int pid;

DESCRIPTION

Wait delays its caller until a signal is received or one of its child processes terminates.  If any child has died since the last wait, return is immediate, returning the process id and exit status of one of the terminated children.  If there are no children, return is immediate with the a value of −1 returned. 

If status is nonzero, the high byte of the word pointed to receives the low byte of the argument of exit when the child terminated.  The low byte receives the termination status of the process.  A more precise definition of the status word is available as defined in <wait.h>. 

See signal(2) for a list of termination statuses (signals); 0 status indicates normal termination.  A special status (0177) is returned for a stopped process which has not terminated and can be restarted.  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 wait returns due to the receipt of a signal, a value of −1 is returned to the calling process and errno is set to EINTRY.  If wait returns due to a stopped or terminated child process, the process ID of the child is returned to the calling process.  Otherwise, a value of −1 is returned and errno is set to indicate the error. 

ERRORS

Wait will fail and return immediately if one or more of the following are true:

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

[EFAULT] The status argument points to an illegal address. 

SEE ALSO

exit(2), wait3(2)

Sun System Release 0.3  —  25 April 1983

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