Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (w) waitpid(2)
macro to determine whether the child process terminated abnormally. The parent process can
use the WCOMPLETION macro to read the completion code.
See the Guardian Procedure Calls Reference Manual for details on the Guardian ABEND,
STOP, and PROCESS_STOP_ procedures and on Guardian completion codes.
Process Stopped
If the WUNTRACED option is set in the waitpid( ) call, the call returns when the child process
is temporarily suspended because it received a SIGTTIN, SIGTTOU, SIGSTOP,or
SIGTSTOP signal.
The WIFSTOPPED macro evaluates to a nonzero value. The WSTOPSIG macro evaluates to
the number of the signal that caused the process to stop.
Saveabend File Creation
Whenever process termination is caused by signal delivery (that is, when the WIFSIGNALED
macro evaluates to a nonzero value), it is possible that the terminating process creates a
saveabend file.
A saveabend file is created for the process if the saveabend bit is set for the process in the pro-
cess control block (PCB). This bit is set in any of the following ways:
• The compiler, linker, or Binder sets the saveabend bit in the code file header.
• The tdm_fork( ), tdm_execve(), tdm_execvep(), tdm_spawn( ),ortdm_spawnp()
function sets the pe_debug_options field of the process_extensions_def structure.
• The shell command that executes the process sets the saveabend bit.
If a saveabend file is created, the core dump (CD) bit is set in the information returned in the
location pointed to by the status_location parameter. The parent process can use the
WIFSAVEABEND macro to detect the creation of a saveabend file;
WIFSAVEABEND evaluates to a nonzero value when the CD bit is set.
If a processor failure occurs, status about the terminated child processes in the failed processor is
returned to the parent process in the location pointed to by the status_location parameter. In this
case, no saveabend file is possible. WIFSAVEABEND evaluates to zero.
NOTES
If a parent process terminates without waiting for all of its child processes to terminate, the
remaining child processes are assigned a parent process ID of 1.
Suspending a process is not always the same as stopping it. A process is only stopped when a
job-control signal stops it.
To use the waitpid( ) functionality in a threaded application that uses the Standard POSIX
Threads library, see spt_waitpid(2).
To use this function in a threaded application that uses the POSIX User Thread Model library on
systems running H06.21 or later RVUs or J06.10 or later RVUs, you must perform all of the fol-
lowing tasks to make the function thread-aware in a multi-threaded application:
• Compile the application using the _PUT_MODEL_ feature test macro or equivalent
compiler command option.
• Link the application to the zputdll library (/G/system/zdllnnn/zputdll).
On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can use
this function with 32-bit or 64-bit threaded applications.
To use this function in a 32-bit threaded application on systems running H06.24 or later RVUs or
J06.13 or later RVUs, perform the same tasks (described above) used to make the function
527186-023 Hewlett-Packard Company 10−11