chiark / gitweb /
Remove the cap on epoll events
authorHannes Reinecke <hare@suse.de>
Wed, 4 Mar 2015 15:32:16 +0000 (16:32 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 5 Mar 2015 02:43:17 +0000 (21:43 -0500)
Currently the code will silently blank out events if there are more
then 512 epoll events, causing them never to be handled at all. This
patch removes the cap on the number of events for epoll_wait, thereby
avoiding this issue.

src/libsystemd/sd-event/sd-event.c

index 0c4e5179e3dfd36347cc3153a4c4bb76d8f584d5..bcf5887064838bf0f9888082b05e1af090437d26 100644 (file)
@@ -36,7 +36,6 @@
 
 #include "sd-event.h"
 
-#define EPOLL_QUEUE_MAX 512U
 #define DEFAULT_ACCURACY_USEC (250 * USEC_PER_MSEC)
 
 typedef enum EventSourceType {
@@ -2366,7 +2365,7 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
                 return 1;
         }
 
-        ev_queue_max = CLAMP(e->n_sources, 1U, EPOLL_QUEUE_MAX);
+        ev_queue_max = MAX(e->n_sources, 1u);
         ev_queue = newa(struct epoll_event, ev_queue_max);
 
         m = epoll_wait(e->epoll_fd, ev_queue, ev_queue_max,