Errno
errno is a C library macro identifying a modifiable integer error indicator associated with the current thread or execution context.
Modern C, Third Edition
errno is a C library-provided modifiable object or macro designating an integer error indicator associated with the current thread or execution context.
- How it is used
- Supports C library error detection, diagnosis, recovery, and cleanup around operations that may fail.
- How deep it goes
- Explains error-state use, resetting, preservation, and portability constraints, but defers detailed thread semantics and implementation internals.
- Examples
- Uses puts with EOF and perror, puts_safe with reset state, and fprintnumbers with saved errno and cleanup.
- What you can do after
- Diagnose library failures, preserve error state during cleanup, and reset errno after handled recovery.
Modern C
errno is a C standard library macro identifying the thread-local integer error indicator set by library functions.
- How it is used
- Supports C library error checking by recording specific failure conditions alongside function return values.
- How deep it goes
- Explains errno's role, perror's dependence on it, state resetting, and assignments in a strtoul implementation.
- Examples
- Uses puts with EOF, perror, and exit, then implements strtoul overflow and invalid-base handling.
- What you can do after
- Diagnose library failures with return-value checks, perror, and errno values such as ERANGE and EINVAL.
Rust in Action: Systems programming concepts and techniques
errno is a C and POSIX process-global error indicator that system calls may set to identify a failure condition.
- How it is used
- Uses a global error code to signal failures from system calls such as read() and close().
- How deep it goes
- Explains return-value checking, symbolic failure codes, and global-state drawbacks without developing POSIX internals.
- Examples
- Uses read() and close(), with EINTR and EIO illustrating interruption and input/output failure.
- What you can do after
- Diagnose system-call failures by checking a global error value after an operation returns.
Read how Rust in Action: Systems programming concepts and techniques explains errno →
Related concepts
- perrorused by · perror is a C standard library function that writes a diagnostic message describing the error indicated by errno to the standard error stream.
- closeused by · Close is an operation that terminates access to an associated resource or interface and releases or finalizes related resources or pending work.
- failurealternative to · A failure is an unsuccessful outcome or condition in which an operation, process, or system does not achieve an expected result.
- exceptionused by · An exception is a runtime signal or object representing an abnormal condition that interrupts ordinary program flow and may be handled or propagated.
- strtoulused by · strtoul is a C standard library function that converts the initial portion of a string to an unsigned long value using a specified or inferred integer base.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


