HP-UX Reference (11i v1 05/09) - 2 System Calls (vol 5)
w
wait(2) wait(2)
ERRORS
The wait() function will fail if:
[ECHILD] The calling process has no existing unwaited-for child processes.
[EINTR] The function was interrupted by a signal. The value of the location pointed to by stat_loc is
undefined.
The
waitpid() function will fail if:
[ECHILD] The process or process group specified by pid does not exist or is not a child of the calling
process.
[EINTR] The function was interrupted by a signal. The value of the location pointed to by stat_loc is
undefined.
[EINVAL] The options argument is not valid.
APPLICATION USAGE
Threads Considerations
In a multi-threaded application, only the calling thread is suspended by
wait() or waitpid().
wait() and waitpid() will not return until all threads in the process have reached the desired state.
For example, wait() and waitpid() will not return until all threads have terminated. If the
WUN-
TRACED
or WCONTINUED options are specified for waitpid(), the function will not return until all
threads have stopped or continued respectively.
SEE ALSO
exec(2), exit(2), fork(2), wait3(2), waitid(2), <sys/types.h>, <sys/wait.h>.
CHANGE HISTORY
First released in Issue 1.
Derived from Issue 1 of the SVID.
Issue 4
The following change is incorporated for alignment with the ISO POSIX-1 standard:
• Text describing conditions under which 0 will be returned when WNOHANG is set in options is
added to the RETURN VALUE section.
Other changes are incorporated as follows:
• The header
<sys/types.h> is now marked as optional (OH); this header need not be included
on XSI-conformant systems.
• Error return values throughout the DESCRIPTION and RETURN VALUE sections are changed to
show the proper casting (that is, (pid_t)−1.
• The words "If the implementation supports job control" are removed from the description of
WUN-
TRACED
. This is because job control is defined as mandatory for Issue 4 conforming implementa-
tions.
Issue 4, Version 2
The following changes are incorporated in the DESCRIPTION for X/OPEN UNIX conformance:
• The WCONTINUED options flag and the WIFCONTINUED(stat_val) macro are added.
• Text following the list of options flags explains the implications of setting the
SA_NOCLDWAIT sig-
nal flag, or setting SIGCHILD to SIG_IGN.
• Text following the list of macros, which explains what macros return non-zero values in certain
cases, is expanded and the value of the WCONTINUED flag on the previous call to waitpid() is
taken into account.
HP-UX 11i Version 1: September 2005 − 3 − Hewlett-Packard Company Section 2−−473