[lttng-dev] [lttng-tools 1/2] Fix: sessiond: revents may be 0 when using poll()
Philippe Proulx
eeppeliteloop at gmail.com
Wed Nov 26 16:29:18 EST 2014
Fixes: #747
Signed-off-by: Philippe Proulx <eeppeliteloop at gmail.com>
---
src/bin/lttng-sessiond/ht-cleanup.c | 5 +++++
src/bin/lttng-sessiond/main.c | 10 ++++++++++
src/bin/lttng-sessiond/ust-thread.c | 5 +++++
3 files changed, 20 insertions(+)
diff --git a/src/bin/lttng-sessiond/ht-cleanup.c b/src/bin/lttng-sessiond/ht-cleanup.c
index 0469f92..8f841ed 100644
--- a/src/bin/lttng-sessiond/ht-cleanup.c
+++ b/src/bin/lttng-sessiond/ht-cleanup.c
@@ -90,6 +90,11 @@ restart:
revents = LTTNG_POLL_GETEV(&events, i);
pollfd = LTTNG_POLL_GETFD(&events, i);
+ /* Do not waste time if no returned events for this fd */
+ if (!revents) {
+ continue;
+ }
+
/* Thread quit pipe has been closed. Killing thread. */
ret = sessiond_check_thread_quit_pipe(pollfd, revents);
if (ret) {
diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
index 81b5e94..e97f560 100644
--- a/src/bin/lttng-sessiond/main.c
+++ b/src/bin/lttng-sessiond/main.c
@@ -1034,6 +1034,11 @@ static void *thread_manage_kernel(void *data)
health_code_update();
+ /* Do not waste time if no returned events for this fd */
+ if (!revents) {
+ continue;
+ }
+
/* Thread quit pipe has been closed. Killing thread. */
ret = sessiond_check_thread_quit_pipe(pollfd, revents);
if (ret) {
@@ -1482,6 +1487,11 @@ static void *thread_manage_apps(void *data)
health_code_update();
+ /* Do not waste time if no returned events for this fd */
+ if (!revents) {
+ continue;
+ }
+
/* Thread quit pipe has been closed. Killing thread. */
ret = sessiond_check_thread_quit_pipe(pollfd, revents);
if (ret) {
diff --git a/src/bin/lttng-sessiond/ust-thread.c b/src/bin/lttng-sessiond/ust-thread.c
index d92c1f9..2a87444 100644
--- a/src/bin/lttng-sessiond/ust-thread.c
+++ b/src/bin/lttng-sessiond/ust-thread.c
@@ -92,6 +92,11 @@ restart:
revents = LTTNG_POLL_GETEV(&events, i);
pollfd = LTTNG_POLL_GETFD(&events, i);
+ /* Do not waste time if no returned events for this fd */
+ if (!revents) {
+ continue;
+ }
+
/* Thread quit pipe has been closed. Killing thread. */
ret = sessiond_check_thread_quit_pipe(pollfd, revents);
if (ret) {
--
2.1.3
More information about the lttng-dev
mailing list