[commit: ghc] master: base: fdReady(): Add note about O_NONBLOCK requirement (8f468fe)

git at git.haskell.org git at git.haskell.org
Tue Sep 26 19:39:50 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8f468fe05cf81ca516b3a8cf66792f842dbfcf40/ghc

>---------------------------------------------------------------

commit 8f468fe05cf81ca516b3a8cf66792f842dbfcf40
Author: Niklas Hambüchen <mail at nh2.me>
Date:   Tue Sep 26 14:41:50 2017 -0400

    base: fdReady(): Add note about O_NONBLOCK requirement
    
    Reviewers: bgamari, austin, hvr
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3962


>---------------------------------------------------------------

8f468fe05cf81ca516b3a8cf66792f842dbfcf40
 libraries/base/cbits/inputReady.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c
index 481c9de..c0b1a49 100644
--- a/libraries/base/cbits/inputReady.c
+++ b/libraries/base/cbits/inputReady.c
@@ -32,7 +32,11 @@
  * inputReady(fd) checks to see whether input is available on the file
  * descriptor 'fd' within 'msecs' milliseconds (or indefinitely if 'msecs' is
  * negative). "Input is available" is defined as 'can I safely read at least a
- * *character* from this file object without blocking?'
+ * *character* from this file object without blocking?' (this does not work
+ * reliably on Linux when the fd is a not-O_NONBLOCK socket, so if you pass
+ * socket fds to this function, ensure they have O_NONBLOCK;
+ * see `man 2 poll` and `man 2 select`, and
+ * https://ghc.haskell.org/trac/ghc/ticket/13497#comment:26).
  *
  * This function blocks until either `msecs` have passed, or input is
  * available.



More information about the ghc-commits mailing list