What does EAGAIN mean?
84,550
Solution 1
EAGAIN is often raised when performing non-blocking I/O. It means "there is no data available right now, try again later".
It might (or might not) be the same as EWOULDBLOCK
, which means "your thread would have to block in order to do that".
Solution 2
Using man 2 intro | less -Ip EAGAIN
:
35 EAGAIN Resource temporarily unavailable. This is a temporary condi-
tion and later calls to the same routine may complete normally.
Solution 3
What it means is less important. What it implies:
- your system call failed
- nothing happened (system calls are atomic, and this one just did not happen)
- you could try it again (it could fail again, possibly with a different result)
- or you could choose otherwise.
The whole thing about EAGAIN
is that your process is not blocked inside the system call; it has the right to choose: either retry or do something useful.
Related videos on Youtube
![David van Dugteren](https://i.stack.imgur.com/N63k0.jpg?s=256&g=1)
Author by
David van Dugteren
Looking forward to the day we can outsource all jobs to robots...
Updated on July 05, 2022Comments
-
David van Dugteren almost 2 years
As in the title what does EAGAIN mean?
-
Fred Foo over 13 yearsAccording to IEEE 1003.1,
EAGAIN
may be the same asEWOULDBLOCK
. opengroup.org/onlinepubs/000095399/basedefs/errno.h.html -
Fred Foo over 13 yearsWhat I mean is: a portable program should not rely on them being distinct.
-
hookenz about 10 yearsOn Linux EAGAIN & EWOULDBLOCK are the same value but truly portable code should check both.
-
brunsgaard over 9 yearsDown to the core.. like it ;)
-
Buzut about 8 yearsIt might be because you reached a ulimit soft/hard resource such as threads, files or network connections.
-
sehe almost 6 yearsDo you have a source to support the "system calls are atomic" claim? I find contradictory results
-
rofrol about 3 yearslink gives HTTP 404