WAIT(2) DOMAIN/IX SYS5 WAIT(2)
NAME
wait - wait for child process to stop or terminate
USAGE
int wait(stat_loc)
int *stat_loc;
int wait ((int *)0)
DESCRIPTION
Wait suspends the calling process until one of its children
terminates. The wait system call will return prematurely if
a signal is received. If a child process stopped or ter-
minated before the call to wait, it returns immediately.
If stat_loc (taken as an integer) is non-zero, 16 bits of
"status," information are stored in the low order 16 bits of
the location pointed to by stat_loc. This status informa-
tion can be used to differentiate between stopped and ter-
minated child processes, and, when a child process has ter-
minated, to identify the cause of termination and pass use-
ful information to the parent. This is accomplished in the
following manner:
⊕ If the child process terminated because of an exit call,
the low order 8 bits of status will be zero and the high
order 8 bits will contain the low order 8 bits of the
argument that the child process passed to exit; see
exit(2).
⊕ If the child process terminated due to a signal, the high
order 8 bits of status will be zero and the low order 8
bits will contain the number of the signal that caused
the termination. On some implementations, the low order
seventh bit (i.e., bit 200) is set to indicate that a
"core image" has been produced. DOMAIN/IX programs do
not produce a core image. Instead, they leave a process
dump, which can be examined with the /com/fmpd command.
If a parent process terminates without waiting for its child
processes to terminate, the parent process ID of each child
process is set to 1. This means that the initialization
process inherits the child processes; see intro(2).
RETURN VALUE
If wait returns because it received a signal, a value of -1
is returned to the calling process and errno is set to
EINTR. If wait returns because of 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
Printed 12/4/86 WAIT-1
WAIT(2) DOMAIN/IX SYS5 WAIT(2)
and errno is set to indicate the error.
ERRORS
Wait will fail and return immediately, if one or more of the
following is true:
[ECHILD] The calling process has no existing unwaited-for
child processes.
[EFAULT] Stat_loc points to an illegal address.
RELATED INFORMATION
exec(2), exit(2), fork(2), pause(2), signal(2)
WAIT-2 Printed 12/4/86