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 22:10:52 +0000 (17:10 -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>
Conflicts:
src/bin/lttng-sessiond/ht-cleanup.c

Conflicts:
src/bin/lttng-sessiond/jul-thread.c

src/bin/lttng-sessiond/ht-cleanup.c
src/bin/lttng-sessiond/jul-thread.c
src/bin/lttng-sessiond/main.c
src/bin/lttng-sessiond/ust-thread.c
src/common/consumer.c

index f343d620b03e80b5b657ce1970892d34f3d7866b..57d6aec118bc6f5ac1df1df3057d63077b82b315 100644 (file)
@@ -60,13 +60,14 @@ void *thread_ht_cleanup(void *data)
        health_code_update();
 
        while (1) {
-               DBG3("[ht-thread] Polling on %d fds.",
-                       LTTNG_POLL_GETNB(&events));
+               DBG3("[ht-thread] Polling.");
 
                /* Inifinite blocking call, waiting for transmission */
 restart:
                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 ad9f9f49f966c2c28a7dae2b9774bdf1ffa91610..4a6fc2a849ed2f777daebd85fe56ba87a2d845cb 100644 (file)
@@ -282,12 +282,13 @@ void *jul_thread_manage_registration(void *data)
        }
 
        while (1) {
-               DBG3("[jul-thread] Manage JUL polling on %d fds",
-                               LTTNG_POLL_GETNB(&events));
+               DBG3("[jul-thread] Manage JUL polling");
 
                /* Inifinite blocking call, waiting for transmission */
 restart:
                ret = lttng_poll_wait(&events, -1);
+               DBG3("[jul-thread] Manage agent return from poll on %d fds",
+                               LTTNG_POLL_GETNB(&events));
                if (ret < 0) {
                        /*
                         * Restart interrupted system call.
index c7beed55d9a519e598164d352088dc8accfc53da..9b3828bd08feec5654c6a73cc1fdc3e01abfa672 100644 (file)
@@ -914,12 +914,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) {
                        /*
@@ -1382,12 +1384,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 d0ea32480892a4511685b2ea36ff98ac0f30085b..35f82e3914c2bde40fc9567ef40131eae7d14765 100644 (file)
@@ -64,13 +64,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 aec7ba693dae55676f79ced4bc6ff0a04038f43c..6754cee672b317453821407efeae7f174b39b68e 100644 (file)
@@ -2188,9 +2188,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) {
@@ -2763,9 +2766,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.035868 seconds and 4 git commands to generate.