gtpc2m9nC/C++ Language Support User's Guide

WIFSIGNALED-Query Status to See If a Child Process Ended Abnormally

This macro queries the child termination status provided by the wait and waitpid functions. It determines if the child process exited because it raised a signal that caused it to exit. It is also used with the WTERMSIG macro to determine if the child process exited because of a system error.

Format

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

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

Normal Return

The WIFSIGNALED macro is always successful.

If the child process for which status was returned by the wait or waitpid function exited because it raised a signal that caused it to exit, the WIFSIGNALED macro evaluates to TRUE and the WTERMSIG macro can be used to determine which signal was raised by the child process. Otherwise, the WIFSIGNALED macro evaluates to FALSE.

Note:
See WTERMSIG-Determine Which Signal Caused the Child Process to Exit for more information about how to determine if the child process exited because of a system error.

Error Return

Not applicable.

Programming Considerations

None.

Examples

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

Related Information