Bug 196345

Summary: Ambiguity with select and EAGAIN in select_tut
Product: Documentation Reporter: Sergey Z. (zhurxx)
Component: man-pagesAssignee: documentation_man-pages (documentation_man-pages)
Status: RESOLVED CODE_FIX    
Severity: normal CC: mtk.manpages
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: Subsystem:
Regression: No Bisected commit-id:

Description Sergey Z. 2017-07-12 16:18:38 UTC
In select_tut, Select law #7 there is a following statement:

"The  functions  read(2), recv(2), write(2), and send(2) as well as the select() call can return -1 with errno set to EINTR, or with errno set to EAGAIN (EWOULDBLOCK)."

But in select man page EAGAIN is not listed as possible error.

This can lead to confusion, e.g.:
https://stackoverflow.com/questions/4193043/select-on-a-pipe-in-blocking-mode-returns-eagain
Comment 1 Michael Kerrisk 2017-07-22 07:46:55 UTC
Thanks. I changed the text of rule 7 to:

       7.  Calls to read(2), recv(2), write(2), send(2), and select() can
           fail with the error  EINTR,  and  calls  to  read(2),  recv(2)
           write(2),  and  send(2)  can  fail  with  errno  set to EAGAIN
           (EWOULDBLOCK).  These results must be  properly  managed  (not
           done properly above).  If your program is not going to receive
           any signals, then it is unlikely you will get EINTR.  If  your
           program does not set nonblocking I/O, you will not get EAGAIN.

I'll close this now. If you think something still needs fixing here, please reopen.