Fix: force the poll() return value to be nb_fd
authorDavid Goulet <dgoulet@efficios.com>
Mon, 17 Dec 2012 17:19:56 +0000 (12:19 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Mon, 17 Dec 2012 17:45:50 +0000 (12:45 -0500)
With poll(), we have to iterate over all fd in the pollset since it is
handled in user space where we don't have to with epoll.o

This is a first patch to fix the fact that we should iterate over the
number of fd the lttng_poll_wait() call returns which is for epoll the
number of returned events and with poll the whole set of fd.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/compat/compat-epoll.c
src/common/compat/compat-poll.c

index 939aaace3c7c30272bc70f894a0a1bde97a09157..e1672c4c3178afbbce32acddebf2b30cea66fe09 100644 (file)
@@ -188,6 +188,10 @@ int compat_epoll_wait(struct lttng_poll_event *events, int timeout)
                goto error;
        }
 
+       /*
+        * Since the returned events are set sequentially in the "events" structure
+        * we only need to return the epoll_wait value and iterate over it.
+        */
        return ret;
 
 error:
index 157a2d79de950a25e051df3875071586344f32b3..bacd96e842be04c0719f740205e42852972b5f8e 100644 (file)
@@ -164,7 +164,11 @@ int compat_poll_wait(struct lttng_poll_event *events, int timeout)
                goto error;
        }
 
-       return ret;
+       /*
+        * poll() should always iterate on all FDs since we handle the pollset in
+        * user space and after poll returns, we have to try every fd for a match.
+        */
+       return events->nb_fd;
 
 error:
        return -1;
This page took 0.027316 seconds and 5 git commands to generate.