This is a searchable, cross-platform errno reference — the integer error codes that Unix system calls set to explain a failure. It puts the Linux and macOS/BSD numeric values side by side, because while the low codes match, the two families diverge above 34 and assign different numbers to the same name.
How errno works in Unix programs
When a system call fails it returns −1 (or NULL for pointer-returning calls) and sets the thread-local errno to a value identifying the cause. Each value has a symbolic name (ENOENT, EACCES, EAGAIN) defined in errno.h, and a human-readable string you can fetch with strerror(errno) or perror().
Two important rules about errno:
- It is only meaningful immediately after a failed call. A successful call does not reset errno to zero, so checking errno after success reads stale data.
- It is thread-local in all modern implementations. Each thread has its own errno, so multi-threaded code can check it safely without a lock.
Where Linux and macOS diverge
Values 1 to 34 are nearly identical across Linux, macOS and BSD — they reflect the original POSIX base set. Above 34, the numbering diverges based on each system’s historical development. Some notable differences:
| Name | Linux | macOS/BSD | Meaning |
|---|---|---|---|
| EAGAIN / EWOULDBLOCK | 11 | 35 | Resource temporarily unavailable |
| EDEADLK | 35 | 11 | Resource deadlock avoided |
| ENOSYS | 38 | 78 | Function not implemented |
| ENOTSUP | — | 45 | Operation not supported |
This is why a program hard-coding if (err == 35) works on macOS (EAGAIN) but silently interprets EAGAIN as EDEADLK on Linux. Always compare against the symbolic constant (if (err == EAGAIN)), which the compiler resolves to the correct platform number.
The most common errno values and what they mean
ENOENT (2): No such file or directory. Either the path does not exist, or a directory component of the path is missing. The most frequent error in file-handling code.
EACCES (13): Permission denied. The process lacks the required permission (read, write, or execute) for the file or directory. Check file permissions and the effective user ID of the process.
EEXIST (17): File exists. A call used O_EXCL with O_CREAT and the file already exists, or mkdir was called on a path that exists.
ENOTDIR (20): Not a directory. A component of the pathname that should be a directory is instead a regular file.
EISDIR (21): Is a directory. An operation that requires a regular file (such as open with O_WRONLY) was attempted on a directory.
EAGAIN / EWOULDBLOCK (11/35): Resource temporarily unavailable. A non-blocking I/O call would have blocked — retry the call when the file descriptor is ready.
EBADF (9): Bad file descriptor. The file descriptor is not open, or the call required a readable descriptor and the descriptor was opened for writing (or vice versa).
EPIPE (32): Broken pipe. A write to a pipe or socket when the reading end is closed. Commonly triggers SIGPIPE, which terminates the process unless the signal is ignored.
Example: decoding a strace failure
openat(AT_FDCWD, "/etc/app.conf", O_RDONLY) = -1 ENOENT (No such file or directory)
ENOENT (2) tells you the file or a directory in its path does not exist — create the file, fix the path, or check the working directory. The numeric values in strace output are always the Linux values; when reading macOS ktrace output the numbers will differ for codes above 34. Everything in this tool runs in your browser; nothing is uploaded.