The trivial poll_no_poll() returned POLLNVAL if it got a bit it doesn't
recognize. This is wrong: poll() should ignore bits it doesn't recognize
and poll(1) states that POLLNVAL is only to be returned if the file
descriptor isn't open. This patch just drops the wrong test.

Before this patch, adding an extra bit not listed, like EPOLLRDHUP,
caused POLLNVAL to be returned. Worse, when using epoll, it did not
expect to ever get back POLLNVAL from poll(), and caused an assertion
failure.

Refs #971.

Signed-off-by: Nadav Har'El <n...@scylladb.com>
---
 core/poll.cc | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/core/poll.cc b/core/poll.cc
index a036bac9..cd968e4f 100644
--- a/core/poll.cc
+++ b/core/poll.cc
@@ -67,16 +67,7 @@ using namespace std;
 
 int poll_no_poll(int events)
 {
-    /*
-     * Return true for read/write.  If the user asked for something
-     * special, return POLLNVAL, so that clients have a way of
-     * determining reliably whether or not the extended
-     * functionality is present without hard-coding knowledge
-     * of specific filesystem implementations.
-     */
-    if (events & ~POLLSTANDARD)
-        return (POLLNVAL);
-
+     // Return ready for read/write.
     return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
 }
 
-- 
2.14.3

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to