Are there any standard exit status codes in Linux?

后端 未结 10 1861
醉话见心
醉话见心 2020-11-22 06:46

A process is considered to have completed correctly in Linux if its exit status was 0.

I\'ve seen that segmentation faults often result in an exit status of 11, thou

10条回答
  •  感动是毒
    2020-11-22 07:09

    There are no standard exit codes, aside from 0 meaning success. Non-zero doesn't necessarily mean failure either.

    stdlib.h does define EXIT_FAILURE as 1 and EXIT_SUCCESS as 0, but that's about it.

    The 11 on segfault is interesting, as 11 is the signal number that the kernel uses to kill the process in the event of a segfault. There is likely some mechanism, either in the kernel or in the shell, that translates that into the exit code.

提交回复
热议问题