epoll/poll compat: expose interruptible API
[lttng-tools.git] / src / common / compat / compat-epoll.c
index 6a781c7ae04034f321f974c244df6e43e01e58b3..794041726ad51226e331c511526c4ff95de128d5 100644 (file)
@@ -23,6 +23,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <stdbool.h>
 
 #include <common/error.h>
 #include <common/defaults.h>
@@ -241,7 +242,8 @@ error:
 /*
  * Wait on epoll set. This is a blocking call of timeout value.
  */
-int compat_epoll_wait(struct lttng_poll_event *events, int timeout)
+int compat_epoll_wait(struct lttng_poll_event *events, int timeout,
+               bool interruptible)
 {
        int ret;
        uint32_t new_size;
@@ -273,10 +275,11 @@ int compat_epoll_wait(struct lttng_poll_event *events, int timeout)
 
        do {
                ret = epoll_wait(events->epfd, events->events, events->nb_fd, timeout);
-       } while (ret == -1 && errno == EINTR);
+       } while (!interruptible && ret == -1 && errno == EINTR);
        if (ret < 0) {
-               /* At this point, every error is fatal */
-               PERROR("epoll_wait");
+               if (errno != EINTR) {
+                       PERROR("epoll_wait");
+               }
                goto error;
        }
 
This page took 0.023651 seconds and 4 git commands to generate.