What error code does a process that segfaults return?
c, linux, runtime-error, segmentation-fault, unix
Solution
The relevant syscall (giving the status of a terminated process) is waitpid(2). The 139 is for `WIFSIGNALED` and `WTERMSIG` etc... On Linux the actual bits are described in internal file `/usr/include/bits/waitstatus.h` which is included from `<sys/wait.h>` header
The `wait`, `waitpid` call is standard in POSIX and so are the macro names (like `WTERMSIG` etc...). The actual implementation of these macros, and the actual signal numbers, hence the code given by the shell, are implementation specific.
The signal(7) Linux man page gives the number of the signals.
Problem
What error code does a process that segfaults return? From my experiments, it seems to be "139", but I'd like to find why this is so and how standard it is.