Fix: poll: show the correct number of fds
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 5 Jan 2015 21:43:07 +0000 (16:43 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 8 Jan 2015 20:25:20 +0000 (15:25 -0500)
LTTNG_POLL_GETNB() uses wait nb_fd, which is only updated after
lttng_poll_wait returns.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/agent-thread.c
src/bin/lttng-sessiond/ht-cleanup.c
src/bin/lttng-sessiond/main.c
src/bin/lttng-sessiond/ust-thread.c
src/common/consumer.c

index a9cc6e735ae0ec4097d7a3a72df4793e06d7bc41..5f4815165fed49c113a8e9ce875c5a374890b7c6 100644 (file)
@@ -307,12 +307,14 @@ void *agent_thread_manage_registration(void *data)
        }
 
        while (1) {
-               DBG3("[agent-thread] Manage agent polling on %d fds",
+               DBG3("[agent-thread] Manage agent polling",
                                LTTNG_POLL_GETNB(&events));
 
                /* Inifinite blocking call, waiting for transmission */
 restart:
                ret = lttng_poll_wait(&events, -1);
+               DBG3("[agent-thread] Manage agent return from poll on %d fds",
+                               LTTNG_POLL_GETNB(&events));
                if (ret < 0) {
                        /*
                         * Restart interrupted system call.
index 373c913dccae1bbb484fefc8e518b9c3821ef255..e5a291609b2c21963d172d3615a36889f8d4c891 100644 (file)
@@ -66,14 +66,15 @@ void *thread_ht_cleanup(void *data)
        while (1) {
                int handled_event;
 
-               DBG3("[ht-thread] Polling on %d fds.",
-                       LTTNG_POLL_GETNB(&events));
+               DBG3("[ht-thread] Polling.");
 
                /* Inifinite blocking call, waiting for transmission */
 restart:
                handled_event = 0;
                health_poll_entry();
                ret = lttng_poll_wait(&events, -1);
+               DBG3("[ht-thread] Returning from poll on %d fds.",
+                       LTTNG_POLL_GETNB(&events));
                health_poll_exit();
                if (ret < 0) {
                        /*
index 5fcd540e5314bd5ab80b522e2627f5e9d96ea81d..e084aba61437961fe0f2d505bef57ed0f991c283 100644 (file)
@@ -1059,12 +1059,14 @@ static void *thread_manage_kernel(void *data)
                        update_poll_flag = 0;
                }
 
-               DBG("Thread kernel polling on %d fds", LTTNG_POLL_GETNB(&events));
+               DBG("Thread kernel polling");
 
                /* Poll infinite value of time */
        restart:
                health_poll_entry();
                ret = lttng_poll_wait(&events, -1);
+               DBG("Thread kernel return from poll on %d fds",
+                               LTTNG_POLL_GETNB(&events));
                health_poll_exit();
                if (ret < 0) {
                        /*
@@ -1527,12 +1529,14 @@ static void *thread_manage_apps(void *data)
        health_code_update();
 
        while (1) {
-               DBG("Apps thread polling on %d fds", LTTNG_POLL_GETNB(&events));
+               DBG("Apps thread polling");
 
                /* Inifinite blocking call, waiting for transmission */
        restart:
                health_poll_entry();
                ret = lttng_poll_wait(&events, -1);
+               DBG("Apps thread return from poll on %d fds",
+                               LTTNG_POLL_GETNB(&events));
                health_poll_exit();
                if (ret < 0) {
                        /*
index 6f4295db77833416893a16ce0b16288f04b87d3d..b421eb29560c2d780ddb705224ed52e382003f28 100644 (file)
@@ -65,13 +65,14 @@ void *ust_thread_manage_notify(void *data)
        health_code_update();
 
        while (1) {
-               DBG3("[ust-thread] Manage notify polling on %d fds",
-                               LTTNG_POLL_GETNB(&events));
+               DBG3("[ust-thread] Manage notify polling");
 
                /* Inifinite blocking call, waiting for transmission */
 restart:
                health_poll_entry();
                ret = lttng_poll_wait(&events, -1);
+               DBG3("[ust-thread] Manage notify return from poll on %d fds",
+                               LTTNG_POLL_GETNB(&events));
                health_poll_exit();
                if (ret < 0) {
                        /*
index 0035aae82d51e1afaa538fddfeb6e7463bfa53db..c741a1b8ec438925bf9da59edeef65b47652b444 100644 (file)
@@ -2190,9 +2190,12 @@ void *consumer_thread_metadata_poll(void *data)
                }
 
 restart:
-               DBG("Metadata poll wait with %d fd(s)", LTTNG_POLL_GETNB(&events));
+               health_code_update();
                health_poll_entry();
+               DBG("Metadata poll wait");
                ret = lttng_poll_wait(&events, -1);
+               DBG("Metadata poll return from wait with %d fd(s)",
+                               LTTNG_POLL_GETNB(&events));
                health_poll_exit();
                DBG("Metadata event catched in thread");
                if (ret < 0) {
@@ -2765,9 +2768,12 @@ void *consumer_thread_channel_poll(void *data)
                }
 
 restart:
-               DBG("Channel poll wait with %d fd(s)", LTTNG_POLL_GETNB(&events));
+               health_code_update();
+               DBG("Channel poll wait");
                health_poll_entry();
                ret = lttng_poll_wait(&events, -1);
+               DBG("Channel poll return from wait with %d fd(s)",
+                               LTTNG_POLL_GETNB(&events));
                health_poll_exit();
                DBG("Channel event catched in thread");
                if (ret < 0) {
This page took 0.02942 seconds and 4 git commands to generate.