Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

System Functions (w) wait(2)
Status Information
If the wait() function returns because the status of a child process is available, it returns the OSS
process ID of the child process. In this case, if the status_location parameter is not a null pointer,
information is stored in the location pointed to by status_location.
The value stored at the location pointed to by status_location is 0 (zero) if and only if the status
returned is from a terminated child process that either returned 0 (zero) from the main() function
or passed 0 (zero) as the status parameter to the _exit() or exit() function.
Regardless of its value, this status information can be interpreted using the following macros,
which are defined in the sys/wait.h header le and evaluate to integer expressions:
WCOMPLETION(status_location)
Evaluates to the 16-bit Guardian completion code issued on process termination.
WEXITSTATUS(status_location)
If the value of WIFEXITED(status_location) is nonzero, evaluates to one of
the following:
The lower 8 bits of the status parameter that the child process passed to
the _exit() or exit() function
The lower 8 bits of the completion code for a process that terminated
itself by calling the Guardian STOP or PROCESS_STOP_ procedure
The lower 8 bits of the value that the child process returned from the
main() function
WIFABENDED(status_location)
Evaluates to a nonzero value if the child process terminated abnormally. A
SIGABEND signal was received.
WIFEXITED(status_location)
Evaluates to a nonzero value if status was returned for a child process that ter-
minated normally whether the termination was due to the _exit() function, the
exit() function, the Guardian STOP procedure, or the Guardian
PROCESS_STOP_ procedure.
WIFSAVEABEND(status_location)
Evaluates to a nonzero value if the terminated process created a saveabend file.
WIFSIGNALED(status_location)
Evaluates to a nonzero value if status was returned for a child process that ter-
minated due to the receipt of a signal that was not caught. Such a signal occurs,
for example, when another process terminates the child process by calling the
kill() function, the Guardian STOP procedure, or the Guardian
PROCESS_STOP_ procedure, or when the process abnormally terminates.
WIFSTOPPED(status_location)
Evaluates to a nonzero value if status was returned for a child process that is
currently
stopped.
This macro is normally only useful with the waitpid( ) function.
527186-023 Hewlett-Packard Company 103