What does EAGAIN mean?

CSocketsUnixPosix

C Problem Overview


As in the title what does EAGAIN mean?

C Solutions


Solution 1 - C

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 - C

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 - C

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.

Solution 4 - C

According to this, it means "Operation would have caused the process to be suspended."

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDavid van DugterenView Question on Stackoverflow
Solution 1 - CFrédéric HamidiView Answer on Stackoverflow
Solution 2 - CturfxView Answer on Stackoverflow
Solution 3 - CwildplasserView Answer on Stackoverflow
Solution 4 - CthelostView Answer on Stackoverflow