From: Nadav Har'El <n...@scylladb.com>
Committer: Nadav Har'El <n...@scylladb.com>
epoll: don't pass unknown bits to poll()
Our epoll implementation is based on poll(). We should only pass to poll
the event bits we know are identical between epoll and poll(). In
EPOLLET and EPOLLONESHOT shouldn't be passed to poll().
Before this patch we passed EPOLLET and EPOLLONESHOT on to poll(), which
could confuse poll() inplementations, and in particular poll_no_poll()
which caused an assertion failure.
Signed-off-by: Nadav Har'El <n...@scylladb.com>
diff --git a/core/epoll.cc b/core/epoll.cc
@@ -33,20 +33,19 @@ TRACEPOINT(trace_epoll_ready, "fd=%d file=%p,
event=0x%x", int, file*, int);
// We implement epoll using poll(), and therefore need to convert epoll's
// event bits to and poll(). These are mostly the same, so the conversion
// is trivial, but we verify this here with static_asserts. We additionally
-// support the epoll-only EPOLLET and EPOLLONESHOT.
+// support the epoll-only EPOLLET and EPOLLONESHOT, but those are not
+// on to poll() who wouldn't know what to do with them.
static_assert(POLLIN == EPOLLIN, "POLLIN!=EPOLLIN");
static_assert(POLLOUT == EPOLLOUT, "POLLOUT!=EPOLLOUT");
static_assert(POLLRDHUP == EPOLLRDHUP, "POLLRDHUP!=EPOLLRDHUP");
static_assert(POLLPRI == EPOLLPRI, "POLLPRI!=EPOLLPRI");
static_assert(POLLERR == EPOLLERR, "POLLERR!=EPOLLERR");
static_assert(POLLHUP == EPOLLHUP, "POLLHUP!=EPOLLHUP");
constexpr int SUPPORTED_EVENTS =
- EPOLLIN | EPOLLOUT | EPOLLRDHUP | EPOLLPRI | EPOLLERR | EPOLLHUP |
- EPOLLET | EPOLLONESHOT;
+ EPOLLIN | EPOLLOUT | EPOLLRDHUP | EPOLLPRI | EPOLLERR | EPOLLHUP;
inline uint32_t events_epoll_to_poll(uint32_t e)
- assert (!(e & ~SUPPORTED_EVENTS));
- return e;
+ return e & SUPPORTED_EVENTS;
inline uint32_t events_poll_to_epoll(uint32_t e)
You received this message because you are subscribed to the Google Groups "OSv
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.