X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fcompat%2Fcompat-epoll.c;h=794041726ad51226e331c511526c4ff95de128d5;hb=9f32e9bf43a6438c55f35d3c5ed1c378d0c715c4;hp=dbaf6823364eb5e4444ba536ac0291300a527a0a;hpb=f057dfc322670467e14c661d625cec0747ce8a31;p=lttng-tools.git diff --git a/src/common/compat/compat-epoll.c b/src/common/compat/compat-epoll.c index dbaf68233..794041726 100644 --- a/src/common/compat/compat-epoll.c +++ b/src/common/compat/compat-epoll.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -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; } @@ -301,7 +304,15 @@ int compat_epoll_set_max_size(void) fd = open(COMPAT_EPOLL_PROC_PATH, O_RDONLY); if (fd < 0) { - retval = -1; + /* + * Failing on opening [1] is not an error per see. [1] was + * introduced in Linux 2.6.28 but epoll is available since + * 2.5.44. Hence, goto end and set a default value without + * setting an error return value. + * + * [1] /proc/sys/fs/epoll/max_user_watches + */ + retval = 0; goto end; }