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 21:51:05 +0000 (16:51 -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 d6f07d8693c4fc7de0c9c6859470025e2f50c0be..ff6832f9faeb001afa49f0bd4c936019df9b4cf7 100644 (file)
@@ -284,12 +284,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 cc880bacfc167bac16cbf589092369d335c8881d..2cf749a50b6257ac7acd3926073ebd5e66897dc3 100644 (file)
@@ -999,12 +999,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) {
                        /*
@@ -1467,12 +1469,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 72c5f3426f0cc4cbfce38d951eff38b0ee188418..129203fa5a9bb8ca655ae22c428d9531a1368adb 100644 (file)
@@ -2189,9 +2189,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) {
@@ -2764,9 +2767,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.030136 seconds and 4 git commands to generate.