Node:Process Completion Status, Next:, Previous:Process Completion, Up:Processes



Process Completion Status

If the exit status value (see Program Termination) of the child process is zero, then the status value reported by waitpid or wait is also zero. You can test for other kinds of information encoded in the returned status value using the following macros. These macros are defined in the header file sys/wait.h.

int WIFEXITED (int status) Macro
This macro returns a nonzero value if the child process terminated normally with exit or _exit.

int WEXITSTATUS (int status) Macro
If WIFEXITED is true of status, this macro returns the low-order 8 bits of the exit status value from the child process. See Exit Status.

int WIFSIGNALED (int status) Macro
This macro returns a nonzero value if the child process terminated because it received a signal that was not handled. See Signal Handling.

int WTERMSIG (int status) Macro
If WIFSIGNALED is true of status, this macro returns the signal number of the signal that terminated the child process.

int WCOREDUMP (int status) Macro
This macro returns a nonzero value if the child process terminated and produced a core dump.

int WIFSTOPPED (int status) Macro
This macro returns a nonzero value if the child process is stopped.

int WSTOPSIG (int status) Macro
If WIFSTOPPED is true of status, this macro returns the signal number of the signal that caused the child process to stop.