yohhoyの日記

技術的メモをしていきたい日記

プロセス終了コードの有効範囲

プロセス終了コードの有効範囲についてメモ。

  • POSIX: 0〜255。整数値のうち下位8ビットのみ有効。(例: 値257は終了コード1と解釈される)
  • Windows: 0〜4294967295。32ビット整数値。

POSIX規格(IEEE Std 1003.1-2008, 2016 Ed.)より一部引用。

If the new state is terminated:

  • The low-order 8 bits of the status argument that the process passed to _Exit(), _exit(), or exit(), or the low-order 8 bits of the value the process returned from main()
    Note that these 8 bits are part of the complete value that is used to set the si_status member of the siginfo_t structure provided by waitid()
  • Whether the process terminated due to the receipt of a signal that was not caught and, if so, the number of the signal that caused the termination of the process
2.13. Status Information

関連URL