wait(2)
_________________________________________________________________
wait System Call
Wait for child process to stop or terminate.
_________________________________________________________________
SYNTAX
#include <sys/wait.h>
int wait (wait_status)
int * wait_status;
PARAMETERS
wait_status NULL or address of a status word.
DESCRIPTION
Wait() suspends the calling process until one of the immediate
children terminates or until a child that is being traced stops.
The wait system call returns immediately if a signal is received
or if a child process stopped or terminated prior to the call to
wait().
If *<wait_status> is non-zero, 16 bits of status are stored in
the low order 16 bits of the location pointed to by
<wait_status>. The <wait_status> can be used to differentiate
between stopped and terminated child processes. If the child
process terminated, <wait_status> identifies the cause of
termination and passes useful information to the parent. This is
accomplished in the following manner:
If the child process stopped, the high order 8 bits of
<wait_status> will contain the number of the signal that caused
the process to stop and the low order 8 bits will be set equal to
0177.
If the child process terminated due to an exit call, the high
order 8 bits of <wait_status> will contain the low order 8 bits
of the argument that the child process passed to exit(). The
low order 8 bits of <wait_status> will be zero.
If the child process terminated due to a signal, the high order 8
bits of <wait_status> will be zero. The low order 6 bits will
contain the number of the signal that caused the termination. In
addition, if the low order eighth bit (ie. bit 0200) is set, a
"core image" will have been produced.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
wait(2)
Wait(status) is equivalent to wait3(status,0,NULL).
ACCESS CONTROL
None
RETURN VALUE
<child-process-id>
Wait returns due to a stopped or terminated child
processes.
-1 An error occurred. Errno is set to indicate the
error.
EXCEPTIONS
Errno may be set to one of the following error codes:
ECHILD The calling process has no child processes. Also
returned if the caller has set the signal handler
for SIGCLD TO SIG_IGN.
EFAULT The <wait_status> pointer points to an illegal
address.
EINTR a signal was received by the calling process.
SEE ALSO
The related system calls: exec, exit, fork, ptrace, sigpause,
sigvec, wait3.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)