WIFEXITEDstatus
WIFEXITEDstatus is a term referring to the use of the WIFEXITED macro in the POSIX wait/status mechanism. In POSIX systems, a process can wait for child processes and obtain a status value that encodes how the child terminated. WIFEXITED(status) is a macro defined in sys/wait.h that tests whether the child terminated normally by calling exit or _Exit. If WIFEXITED(status) is true, the exit status is obtained with WEXITSTATUS(status), which yields the value passed to exit or _Exit, typically in the range 0 to 255.
The WIFEXITED macro is part of a family of status macros used with wait, waitpid, or similar
Usage pattern commonly involves calling waitpid (or wait) to obtain a status value, then testing with WIFEXITED(status).
- These macros are defined in <sys/wait.h> on POSIX-compliant systems.
- The status value is an int, and the interpretation of its bits is implementation-defined but standardized
- Windows and some non-POSIX environments may provide different mechanisms for child-process termination status.
See also: wait, waitpid, WIFSIGNALED, WIFSTOPPED, WEXITSTATUS, WTERMSIG.