]> Savannah Git Hosting - gnulib.git/commitdiff
poll: fix for systems that can't recv() on a non-socket
authorJoachim Schmitz <jojo@schmitz-digital.de>
Thu, 13 Sep 2012 06:55:08 +0000 (08:55 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 13 Sep 2012 06:57:02 +0000 (08:57 +0200)
* lib/poll.c: if recv returns ENOTSOCK, assume the descriptor
is readable.  In this case POLLHUP will not be supported.
* doc/posix-functions/poll.texi: Document this.

Copyright-paperwork-exempt: yes

ChangeLog
doc/posix-functions/poll.texi
lib/poll.c

index ab09b0e6402cb898fd19fe4a0c4de3a28ef00542..9764b116d398b1fd1ed7ed28293bd80347a4edf2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-09-13  Joachim Schmitz <jojo@schmitz-digital.de>  (tiny change)
+           Paolo Bonzini <bonzini@gnu.org>
+
+       poll: fix for systems that can't recv() on a non-socket
+       * lib/poll.c: if recv returns ENOTSOCK, assume the descriptor
+       is readable.  In this case POLLHUP will not be supported.
+       * doc/posix-functions/poll.texi: Document this.
+
 2012-09-13  Paolo Bonzini  <bonzini@gnu.org>
 
        poll/select: document portability problems not fixed by Gnulib.
index da619b99ddf9153287196f66aafc48d3b66759ce..ec1bdda9cd7c635e7247e77dbafc2402e4aa1ff1 100644 (file)
@@ -10,7 +10,7 @@ Portability problems fixed by Gnulib:
 @itemize
 @item
 This function is missing on some platforms:
-mingw, MSVC 9, BeOS.
+mingw, MSVC 9, BeOS, HP NonStop.
 @item
 This function doesn't work on special files like @file{/dev/null} and ttys like
 @file{/dev/tty} on some platforms:
@@ -27,4 +27,8 @@ created by the @code{socket} function, not on regular file descriptors.
 Under Windows, when passing a pipe, Gnulib's @code{poll} replacement might
 return 0 even before the timeout has passed.  Programs using it with pipes can
 thus busy wait.
+
+@item
+Under HP NonStop, file descriptors other than sockets do not support
+POLLHUP; they will return a "readable" status instead.
 @end itemize
index 5ad9d866be13d44ad7f2fcb9c8bb6e1ba0ee3c21..b696dee0d63fa11db32626e2b1bff52f070fccf9 100644 (file)
@@ -303,6 +303,10 @@ compute_revents (int fd, int sought, fd_set *rfds, fd_set *wfds, fd_set *efds)
                || socket_errno == ECONNABORTED || socket_errno == ENETRESET)
         happened |= POLLHUP;
 
+      /* some systems can't use recv() on non-socket, including HP NonStop */
+      else if (socket_errno == ENOTSOCK)
+        happened |= (POLLIN | POLLRDNORM) & sought;
+
       else
         happened |= POLLERR;
     }