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

waitpid(2) OSS System Calls Reference Manual
Normal Self Termination
When a process terminates itself, information is returned to the parent process in the location
pointed to by the status_location parameter. A process terminates itself in one of the following
ways:
Returning from its main() function. The return value is placed in status_location.
Calling the _exit() or exit() function. The exit status is placed in status_location.
Calling the Guardian STOP or PROCESS_STOP_ procedure with parameters set for
self-termination. The completion code is placed in status_location.
The parent process can use the WIFEXITED macro to detect a child process that terminates
itself; WIFEXITED evaluates to a nonzero value. The WEXITSTATUS macro evaluates to the
lower 8 bits of the return value, exit status, or completion code. The WCOMPLETION macro
evaluates to the full 16-bit completion code or to 16 bits of the 32-bit exit status code.
See the Guardian Procedure Calls Reference Manual for details on the Guardian STOP and
PROCESS_STOP_ procedures and on Guardian completion codes.
Termination by Another
The child process can be terminated by another process in one of the following ways:
Another process calls the kill() function with the OSS process ID of the child process.
Another process calls the Guardian STOP procedure with the Guardian process ID of the
child process or calls the Guardian PROCESS_STOP_ procedure with the Guardian pro-
cess handle of the child process.
In either case, the SIGKILL signal is delivered. The parent process can use the WIFSIG-
NALED macro to detect when a signal causes the child process to terminate; WIFSIGNALED
evaluates to a nonzero value. The WTERMSIG macro evaluates to the number of the signal
that caused the termination. The WCOMPLETION macro evaluates to the completion code.
See the Guardian Procedure Calls Reference Manual for details on the Guardian STOP and
PROCESS_STOP_ procedures and on Guardian completion codes.
Abnormal Termination
Abnormal termination can occur for several reasons, including the following:
The child process calls the Guardian ABEND procedure, or it calls the Guardian
PROCESS_STOP_ procedure with the parameters set for abnormal termination.
The processor in which the process was running fails.
Some critical system resource is exhausted.
One of the functions in the exec, tdm_exec,ortdm_spawn set of functions fails after the
caller of that function has already been overlaid by the child process, and there is no
caller to which it can return the error.
Two traps occur inside an area where a Guardian trap handler is installed by the Guar-
dian SETTRAP procedure.
In all cases of abnormal termination, the SIGABEND signal is delivered. Like the SIGKILL
signal, SIGABEND can neither be caught nor ignored. Its default action is to terminate the pro-
cess.
The WIFSIGNALED macro
evaluates to a nonzero value and the SIGABEND signal is indi-
cated by the WTERMSIG macro. Alternatively, the parent process can use the WIFABENDED
1010 Hewlett-Packard Company 527186-023