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.
What error code does a process that segfaults return? From my experiments, it seems
Share
The relevant syscall (giving the status of a terminated process) is waitpid(2). The 139 is for
WIFSIGNALEDandWTERMSIGetc… On Linux the actual bits are described in internal file/usr/include/bits/waitstatus.hwhich is included from<sys/wait.h>headerThe
wait,waitpidcall is standard in POSIX and so are the macro names (likeWTERMSIGetc…). 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.