EWOULDBLOCK
EWOULDBLOCK is an errno value used by Unix-like systems to indicate that a non-blocking I/O operation would block if it were allowed to proceed. It is most commonly encountered when performing read or write operations on a file descriptor that has been opened with the O_NONBLOCK flag, or when working with non-blocking sockets, pipes, or fifos.
In practice, a non-blocking I/O call that cannot complete immediately returns an error of -1 with errno
Typical usage involves non-blocking I/O alongside readiness notifications. Programs may use mechanisms such as select, poll,
- EWOULDBLOCK is most relevant to non-blocking file descriptors, including sockets, pipes, and fifos.
- On regular files, operations typically do not produce EWOULDBLOCK because they are not constrained by readiness
- For portability, many code bases check for both EWOULDBLOCK and EAGAIN.