gtpc2m9pC/C++ Language Support User's Guide

WTERMSIG-Determine Which Signal Caused the Child Process to Exit

This macro queries the termination status of a child process to determine which signal caused the child process to exit. Status is provided by the wait and waitpid functions.

Format

#include <sys/wait.h>
int WTERMSIG(int status);

status
The status field that was filled in by the wait or waitpid function.

Normal Return

The WTERMSIG macro is always successful.

If the WIFSIGNALED macro indicates that the child process exited because it raised a signal, the WTERMSIGmacro returns the numeric value of the signal that was raised by the child process. Signal values are defined in the sys/signals.h C header file. A signal value of SIGILL means the child process exited because of a system error rather than the raising of a particular signal. If the WIFEXITED macro indicates that the child process did not exit because it raised a signal, the value returned by the WTERMSIG macro has no meaning.

Error Return

Not applicable.

Programming Considerations

None.

Examples

See wait-Wait for Status Information from a Child Process for an example of the WTERMSIG macro.

Related Information