I am wondering if there is a table or list of system call failure modes. A few examples: Can exit() fail due to the system being out of memory? Can open() fail due to the system reaching the max open files limit? Can system calls simply time out? What would various hardware failures look like manifested in system call failures?



As you've probably guessed, not every error can happen to every system call.

If you start with /usr/include/errno.h, you can probably track down the manifest constants like "EPERM" or "EINTR". I found them in:

/usr/include/asm-generic/errno-base.h and /usr/include/asm-generic/errno.h

but it looks to me like there could be some variation by distro or version of libc.

Linux seems to be really good at having the errors that any given system call can manifest in the man page for that system call: man 2 read or man 2 socket for example. This hasn't traditionally been true for the various Unix versions that are probably still out there. I don't have access to a *BSD system to check this for modern Unixes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.