summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-14 05:08:15 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-14 05:10:25 +0100
commit9a800b5622b0feec879c3f5c81f7af5a8640e57c (patch)
treee2802ec141493cf8f1268eb4e0bf440a43d1f155
parent15b38f936e257d14854f38bf39357b0b2a5c1e66 (diff)
event: instead of reset the revents field when we get new revents data from epoll, OR it in
-rw-r--r--src/libsystemd-bus/sd-event.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c
index 94813950b8..bf8b0fcf64 100644
--- a/src/libsystemd-bus/sd-event.c
+++ b/src/libsystemd-bus/sd-event.c
@@ -1569,12 +1569,21 @@ static int event_arm_timer(
return 0;
}
-static int process_io(sd_event *e, sd_event_source *s, uint32_t events) {
+static int process_io(sd_event *e, sd_event_source *s, uint32_t revents) {
assert(e);
assert(s);
assert(s->type == SOURCE_IO);
- s->io.revents = events;
+ /* If the event source was already pending, we just OR in the
+ * new revents, otherwise we reset the value. The ORing is
+ * necessary to handle EPOLLONESHOT events properly where
+ * readability might happen independently of writability, and
+ * we need to keep track of both */
+
+ if (s->pending)
+ s->io.revents |= revents;
+ else
+ s->io.revents = revents;
return source_set_pending(s, true);
}