From: Mathieu Desnoyers Date: Mon, 5 Jan 2015 21:43:07 +0000 (-0500) Subject: Fix: poll: show the correct number of fds X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=7fa2082ed250230b7823e01b144aa6b580d4b2f5 Fix: poll: show the correct number of fds LTTNG_POLL_GETNB() uses wait nb_fd, which is only updated after lttng_poll_wait returns. Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/agent-thread.c b/src/bin/lttng-sessiond/agent-thread.c index a9cc6e735..5f4815165 100644 --- a/src/bin/lttng-sessiond/agent-thread.c +++ b/src/bin/lttng-sessiond/agent-thread.c @@ -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. diff --git a/src/bin/lttng-sessiond/ht-cleanup.c b/src/bin/lttng-sessiond/ht-cleanup.c index 373c913dc..e5a291609 100644 --- a/src/bin/lttng-sessiond/ht-cleanup.c +++ b/src/bin/lttng-sessiond/ht-cleanup.c @@ -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) { /* diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 5fcd540e5..e084aba61 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -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) { /* diff --git a/src/bin/lttng-sessiond/ust-thread.c b/src/bin/lttng-sessiond/ust-thread.c index 6f4295db7..b421eb295 100644 --- a/src/bin/lttng-sessiond/ust-thread.c +++ b/src/bin/lttng-sessiond/ust-thread.c @@ -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) { /* diff --git a/src/common/consumer.c b/src/common/consumer.c index 0035aae82..c741a1b8e 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -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) {