wait.2 (2010 09)

w
wait(2) wait(2)
If the information pointed to by stat_loc was stored by a call to
waitpid() that specified the WUN-
TRACED and WCONTINUED flags, exactly one of the macros
WIFCONTINUED(*stat_loc
),
WIFEXITED(*stat_loc ), WIFSIGNALED(*
stat_loc ), and WIFSTOPPED(*stat_loc ) evaluates to a
nonzero value.
If the information pointed to by stat_loc was stored by a call to
waitpid() that did not specify the WUN-
TRACED or WCONTINUED flags, or by a call to the wait() function, exactly one of the macros
WIFEXITED(*stat_loc ) and WIFSIGNALED(*
stat_loc ) evaluates to a nonzero value.
If the information pointed to by stat_loc was stored by a call to
waitpid() that did not specify the WUN-
TRACED flag and specified the
WCONTINUED lag, or by a call to the wait() function, exactly one of the
macros
WIFCONTINUED(*
stat_loc ), WIFEXITED(*stat_loc ), and WIFSIGNALED(*
stat_loc ) evalu-
ates to a nonzero value.
There may be additional implementation-dependent circumstances under which
wait() and wait-
pid() report status . This does not occur unless the calling process or one of its child processes explicitly
makes use of a nonstandard extension. In these cases the interpretation of the reported status is
implementation-defined.
If a parent process terminates without waiting for all of its child processes to terminate, the remaining
child processes are assigned a new parent process ID corresponding to an implementation-defined system
process.
In earlier versions of HP-UX, the status interpretation macros
WIFEXITED, WIFSIGNALED, and WIFS-
TOPPED have the same definitions as the correspondingly named macros in BSD 4.3 and earlier systems,
so existing applications that depend on these definitions will continue to work correctly. However, if the
application is recompiled, the feature test macro _BSD must be turned on so that the old definitions of
these macros override the new definitions of these macros that are in effect by default. The only
difference between the old and new definitions is the argument typing. Type union
wait is used in the
BSD definitions while type int is used in the default definitions.
RETURN VALUE
If
wait() or waitpid() returns because the status of a child process is available, these functions
return a value equal to the process ID of the child process for which status is reported.
If
wait() or waitpid() returns due to the delivery of a signal to the calling process, -1
is returned
and
errno is set to [EINTR].
If
waitpid() was invoked with WNOHANG set in options , it has at least one child process specified by
pid for which status is not available, and status is not available for any process specified by pid,0is
returned. Otherwise,
(pid_t)-1 is returned, and errno is set to indicate the error.
ERRORS
If the
wait() call fails, errno is set to one of the following values:
[ECHILD] The calling process has no existing unwaited-for child processes.
[EFAULT] The stat_loc argument points to an illegal address or problems were encountered in the
reporting of the status information for the specified child process. Note that the reliable
detection of this error is implementation-dependent.
[EINTR] The function was interrupted by a signal. The value of the location pointed to by stat_loc
argument is undefined.
If the
waitpid() call fails, errno is set to one of the following values:
[ECHILD] The process specified by pid does not exist or is not a child of the calling process, or the
process group specified by pid does not exist or does not have any member process that is
a child of the calling process.
[EFAULT] The stat_loc argument points to an illegal address or problems were encountered in the
reporting of the status information for the specified child process. Note that the reliable
detection of this error is implementation-dependent.
[EINTR] The
waitpid() was interrupted by a signal. The value of the location pointed to by
stat_loc is undefined.
[EINVAL] The options argument is not valid.
HP-UX 11i Version 3: September 2010 3 Hewlett-Packard Company 3