WIFEXITED WEXITSTATUS WIFSIGNALED

子进程退出状态

If the exit status value (*note 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

Macro: int WIFEXITED (int STATUS)

This macro returns a nonzero value if the child process terminated normally with exit' or _exit’.

Macro: int WEXITSTATUS (int STATUS)

If WIFEXITED' is true of STATUS, this macro returns the low-order 8 bits of the exit status value from the child process.Note Exit Status`

Macro: int WIFSIGNALED (int STATUS)

This macro returns a nonzero value if the child process terminated because it received a signal that was not handled. Note Signal Handling

进程退出的 exitcode

参考

  • wait(2) — Linux manual page
  • WIFEXITED WEXITSTATUS WIFSIGNALED