From ea6bf30f3684cf71633cb9f2c70ea0bc22b664c4 Mon Sep 17 00:00:00 2001 From: Yannick Lamarre Date: Thu, 25 Apr 2019 18:23:33 -0400 Subject: [PATCH] Clean code base from redundant verification MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Remove redundant verification for file descriptors with 0 revents in code base. Signed-off-by: Yannick Lamarre Signed-off-by: Jérémie Galarneau --- src/bin/lttng-consumerd/health-consumerd.c | 5 ----- src/bin/lttng-relayd/health-relayd.c | 5 ----- src/bin/lttng-relayd/live.c | 10 ---------- src/bin/lttng-relayd/main.c | 16 ---------------- src/bin/lttng-sessiond/agent-thread.c | 5 ----- src/bin/lttng-sessiond/client.c | 5 ----- src/bin/lttng-sessiond/dispatch.c | 5 ----- src/bin/lttng-sessiond/health.c | 5 ----- src/bin/lttng-sessiond/ht-cleanup.c | 5 ----- src/bin/lttng-sessiond/manage-apps.c | 5 ----- src/bin/lttng-sessiond/manage-consumer.c | 10 ---------- src/bin/lttng-sessiond/manage-kernel.c | 5 ----- src/bin/lttng-sessiond/notification-thread.c | 3 --- src/bin/lttng-sessiond/notify-apps.c | 5 ----- src/bin/lttng-sessiond/register.c | 5 ----- src/bin/lttng-sessiond/rotation-thread.c | 4 ---- src/common/consumer/consumer.c | 10 ---------- 17 files changed, 108 deletions(-) diff --git a/src/bin/lttng-consumerd/health-consumerd.c b/src/bin/lttng-consumerd/health-consumerd.c index 15b71a1ab..dc8b32aa8 100644 --- a/src/bin/lttng-consumerd/health-consumerd.c +++ b/src/bin/lttng-consumerd/health-consumerd.c @@ -266,11 +266,6 @@ restart: revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - /* Thread quit pipe has been closed. Killing thread. */ ret = check_health_quit_pipe(pollfd, revents); if (ret) { diff --git a/src/bin/lttng-relayd/health-relayd.c b/src/bin/lttng-relayd/health-relayd.c index 9b4eefcd5..4a2dc65a6 100644 --- a/src/bin/lttng-relayd/health-relayd.c +++ b/src/bin/lttng-relayd/health-relayd.c @@ -343,11 +343,6 @@ restart: revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - /* Thread quit pipe has been closed. Killing thread. */ ret = check_health_quit_pipe(pollfd, revents); if (ret) { diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c index 9efab8a73..9503ba470 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -543,11 +543,6 @@ restart: revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - /* Thread quit pipe has been closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, revents); if (ret) { @@ -2000,11 +1995,6 @@ restart: health_code_update(); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - /* Thread quit pipe has been closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, revents); if (ret) { diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index e81bdeffc..0ee27efce 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -858,14 +858,6 @@ restart: revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); - if (!revents) { - /* - * No activity for this FD (poll - * implementation). - */ - continue; - } - /* Thread quit pipe has been closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, revents); if (ret) { @@ -3813,14 +3805,6 @@ restart: health_code_update(); - if (!revents) { - /* - * No activity for this FD (poll - * implementation). - */ - continue; - } - /* Thread quit pipe has been closed. Killing thread. */ ret = check_thread_quit_pipe(pollfd, revents); if (ret) { diff --git a/src/bin/lttng-sessiond/agent-thread.c b/src/bin/lttng-sessiond/agent-thread.c index f7be1ef71..575f6aee9 100644 --- a/src/bin/lttng-sessiond/agent-thread.c +++ b/src/bin/lttng-sessiond/agent-thread.c @@ -404,11 +404,6 @@ restart: revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - /* Thread quit pipe has been closed. Killing thread. */ if (pollfd == quit_pipe_read_fd) { goto exit; diff --git a/src/bin/lttng-sessiond/client.c b/src/bin/lttng-sessiond/client.c index f3002f910..4565a18c3 100644 --- a/src/bin/lttng-sessiond/client.c +++ b/src/bin/lttng-sessiond/client.c @@ -2090,11 +2090,6 @@ static void *thread_manage_clients(void *data) health_code_update(); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - if (pollfd == thread_quit_pipe_fd) { err = 0; goto exit; diff --git a/src/bin/lttng-sessiond/dispatch.c b/src/bin/lttng-sessiond/dispatch.c index 04b3954c0..a637f23de 100644 --- a/src/bin/lttng-sessiond/dispatch.c +++ b/src/bin/lttng-sessiond/dispatch.c @@ -144,11 +144,6 @@ static void sanitize_wait_queue(struct ust_reg_wait_queue *wait_queue) uint32_t revents = LTTNG_POLL_GETEV(&events, i); int pollfd = LTTNG_POLL_GETFD(&events, i); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - cds_list_for_each_entry_safe(wait_node, tmp_wait_node, &wait_queue->head, head) { if (pollfd == wait_node->app->sock && diff --git a/src/bin/lttng-sessiond/health.c b/src/bin/lttng-sessiond/health.c index 9474a8560..9ff6bd1ae 100644 --- a/src/bin/lttng-sessiond/health.c +++ b/src/bin/lttng-sessiond/health.c @@ -165,11 +165,6 @@ restart: revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - /* Event on the registration socket */ if (pollfd == sock) { if (revents & LPOLLIN) { diff --git a/src/bin/lttng-sessiond/ht-cleanup.c b/src/bin/lttng-sessiond/ht-cleanup.c index 91c0544c3..02244f0ca 100644 --- a/src/bin/lttng-sessiond/ht-cleanup.c +++ b/src/bin/lttng-sessiond/ht-cleanup.c @@ -155,11 +155,6 @@ static void *thread_ht_cleanup(void *data) revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - if (pollfd != ht_cleanup_pipe[0]) { continue; } diff --git a/src/bin/lttng-sessiond/manage-apps.c b/src/bin/lttng-sessiond/manage-apps.c index f9ec356da..356c147aa 100644 --- a/src/bin/lttng-sessiond/manage-apps.c +++ b/src/bin/lttng-sessiond/manage-apps.c @@ -123,11 +123,6 @@ static void *thread_application_management(void *data) health_code_update(); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - if (pollfd == quit_pipe_read_fd) { err = 0; goto exit; diff --git a/src/bin/lttng-sessiond/manage-consumer.c b/src/bin/lttng-sessiond/manage-consumer.c index b710c61f8..fa802adc9 100644 --- a/src/bin/lttng-sessiond/manage-consumer.c +++ b/src/bin/lttng-sessiond/manage-consumer.c @@ -134,11 +134,6 @@ void *thread_consumer_management(void *data) health_code_update(); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - /* Thread quit pipe has been closed. Killing thread. */ if (pollfd == quit_pipe_read_fd) { err = 0; @@ -298,11 +293,6 @@ void *thread_consumer_management(void *data) health_code_update(); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - /* * Thread quit pipe has been triggered, flag that we should stop * but continue the current loop to handle potential data from diff --git a/src/bin/lttng-sessiond/manage-kernel.c b/src/bin/lttng-sessiond/manage-kernel.c index 34887d7b1..f656c9f5c 100644 --- a/src/bin/lttng-sessiond/manage-kernel.c +++ b/src/bin/lttng-sessiond/manage-kernel.c @@ -267,11 +267,6 @@ static void *thread_kernel_management(void *data) health_code_update(); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - if (pollfd == quit_pipe_read_fd) { err = 0; goto exit; diff --git a/src/bin/lttng-sessiond/notification-thread.c b/src/bin/lttng-sessiond/notification-thread.c index 7998f7e21..8c2892bda 100644 --- a/src/bin/lttng-sessiond/notification-thread.c +++ b/src/bin/lttng-sessiond/notification-thread.c @@ -570,9 +570,6 @@ void *thread_notification(void *data) int fd = LTTNG_POLL_GETFD(&state.events, i); uint32_t revents = LTTNG_POLL_GETEV(&state.events, i); - if (!revents) { - continue; - } DBG("[notification-thread] Handling fd (%i) activity (%u)", fd, revents); if (fd == state.notification_channel_socket) { diff --git a/src/bin/lttng-sessiond/notify-apps.c b/src/bin/lttng-sessiond/notify-apps.c index bc7405c7b..17f3cd0c8 100644 --- a/src/bin/lttng-sessiond/notify-apps.c +++ b/src/bin/lttng-sessiond/notify-apps.c @@ -109,11 +109,6 @@ restart: revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - /* Thread quit pipe has been closed. Killing thread. */ if (pollfd == quit_pipe_read_fd) { err = 0; diff --git a/src/bin/lttng-sessiond/register.c b/src/bin/lttng-sessiond/register.c index 6ce25ad0f..e809834fa 100644 --- a/src/bin/lttng-sessiond/register.c +++ b/src/bin/lttng-sessiond/register.c @@ -239,11 +239,6 @@ static void *thread_application_registration(void *data) revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - /* Thread quit pipe has been closed. Killing thread. */ if (pollfd == quit_pipe_read_fd) { err = 0; diff --git a/src/bin/lttng-sessiond/rotation-thread.c b/src/bin/lttng-sessiond/rotation-thread.c index b86b16689..6669372dd 100644 --- a/src/bin/lttng-sessiond/rotation-thread.c +++ b/src/bin/lttng-sessiond/rotation-thread.c @@ -974,10 +974,6 @@ void *thread_rotation(void *data) int fd = LTTNG_POLL_GETFD(&thread.events, i); uint32_t revents = LTTNG_POLL_GETEV(&thread.events, i); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } DBG("[rotation-thread] Handling fd (%i) activity (%u)", fd, revents); diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index 10273e66a..c70d95a58 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -2396,11 +2396,6 @@ restart: revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - if (pollfd == lttng_pipe_get_readfd(ctx->consumer_metadata_pipe)) { if (revents & LPOLLIN) { ssize_t pipe_len; @@ -2990,11 +2985,6 @@ restart: revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); - if (!revents) { - /* No activity for this FD (poll implementation). */ - continue; - } - if (pollfd == ctx->consumer_channel_pipe[0]) { if (revents & LPOLLIN) { enum consumer_channel_action action; -- 2.34.1