wait for child process to stop or terminate
cc . . . -lc
pid_t wait(int *stat_loc);
wait suspends the calling process until one of its
immediate children terminates or until a child that is being traced
stops because it has received a signal. The wait system
call returns prematurely if a signal is received. If any child
process has stopped or terminated prior to the call on
wait, return is immediate.
If wait returns because the status of a child process is
available, it returns the process ID of the child
process. If the calling process had specified a non-zero value for
stat_loc, the status of the child process will be stored
in the location pointed to by stat_loc. It may be
evaluated with the following macros:
for details of these macros.
If wait returns due to the status of a child process being
available, the process ID of the child is returned to the
calling process. If it returns because of the delivery of a signal
to the calling process, (pid)-1 is returned and
errno set to EINTR. Otherwise, wait
returns (pid_t)-1 and sets errno to identify
In the following conditions, wait fails and sets
The calling process has no existing unwaited-for child processes.
The function was interrupted by a signal.
wait is conformant with:
AT&T SVID Issue 3;
X/Open Portability Guide Issue 4, Version 2 (Spec-1170)
X/Open Portability Guide, Issue 3, 1989
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1)
NIST FIPS 151-1
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005