X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=5fcd540e5314bd5ab80b522e2627f5e9d96ea81d;hp=bc3a6bb445735baf9937ab699be70cab02c3a11c;hb=25b397f9ccee70eb6f2968837702c50f22ad7bbf;hpb=4a15001e426da818990dc21f1d423fd04b6cd492 diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index bc3a6bb44..5fcd540e5 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -1090,6 +1090,11 @@ static void *thread_manage_kernel(void *data) health_code_update(); + if (!revents) { + /* No activity for this FD (poll implementation). */ + continue; + } + /* Thread quit pipe has been closed. Killing thread. */ ret = sessiond_check_thread_quit_pipe(pollfd, revents); if (ret) { @@ -1235,6 +1240,11 @@ restart: health_code_update(); + if (!revents) { + /* No activity for this FD (poll implementation). */ + continue; + } + /* Thread quit pipe has been closed. Killing thread. */ ret = sessiond_check_thread_quit_pipe(pollfd, revents); if (ret) { @@ -1362,6 +1372,11 @@ restart_poll: 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 @@ -1538,6 +1553,11 @@ static void *thread_manage_apps(void *data) health_code_update(); + if (!revents) { + /* No activity for this FD (poll implementation). */ + continue; + } + /* Thread quit pipe has been closed. Killing thread. */ ret = sessiond_check_thread_quit_pipe(pollfd, revents); if (ret) { @@ -1716,6 +1736,11 @@ 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 && @@ -2055,6 +2080,11 @@ static void *thread_registration_apps(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. */ ret = sessiond_check_thread_quit_pipe(pollfd, revents); if (ret) { @@ -3918,6 +3948,11 @@ 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 = sessiond_check_thread_quit_pipe(pollfd, revents); if (ret) { @@ -4090,6 +4125,11 @@ static void *thread_manage_clients(void *data) health_code_update(); + if (!revents) { + /* No activity for this FD (poll implementation). */ + continue; + } + /* Thread quit pipe has been closed. Killing thread. */ ret = sessiond_check_thread_quit_pipe(pollfd, revents); if (ret) { @@ -4363,7 +4403,7 @@ static int set_option(int opt, const char *arg, const char *optname) } tracing_group_name = strdup(arg); if (!tracing_group_name) { - perror("strdup"); + PERROR("strdup"); ret = -ENOMEM; } tracing_group_name_override = 1; @@ -4427,7 +4467,7 @@ static int set_option(int opt, const char *arg, const char *optname) } consumerd32_bin = strdup(arg); if (!consumerd32_bin) { - perror("strdup"); + PERROR("strdup"); ret = -ENOMEM; } consumerd32_bin_override = 1; @@ -4438,7 +4478,7 @@ static int set_option(int opt, const char *arg, const char *optname) } consumerd32_libdir = strdup(arg); if (!consumerd32_libdir) { - perror("strdup"); + PERROR("strdup"); ret = -ENOMEM; } consumerd32_libdir_override = 1; @@ -4449,7 +4489,7 @@ static int set_option(int opt, const char *arg, const char *optname) } consumerd64_bin = strdup(arg); if (!consumerd64_bin) { - perror("strdup"); + PERROR("strdup"); ret = -ENOMEM; } consumerd64_bin_override = 1; @@ -4460,7 +4500,7 @@ static int set_option(int opt, const char *arg, const char *optname) } consumerd64_libdir = strdup(arg); if (!consumerd64_libdir) { - perror("strdup"); + PERROR("strdup"); ret = -ENOMEM; } consumerd64_libdir_override = 1; @@ -4469,7 +4509,7 @@ static int set_option(int opt, const char *arg, const char *optname) free(opt_pidfile); opt_pidfile = strdup(arg); if (!opt_pidfile) { - perror("strdup"); + PERROR("strdup"); ret = -ENOMEM; } break; @@ -4495,7 +4535,7 @@ static int set_option(int opt, const char *arg, const char *optname) free(opt_load_session_path); opt_load_session_path = strdup(arg); if (!opt_load_session_path) { - perror("strdup"); + PERROR("strdup"); ret = -ENOMEM; } break; @@ -4503,7 +4543,7 @@ static int set_option(int opt, const char *arg, const char *optname) free(kmod_probes_list); kmod_probes_list = strdup(arg); if (!kmod_probes_list) { - perror("strdup"); + PERROR("strdup"); ret = -ENOMEM; } break; @@ -4511,7 +4551,7 @@ static int set_option(int opt, const char *arg, const char *optname) free(kmod_extra_probes_list); kmod_extra_probes_list = strdup(arg); if (!kmod_extra_probes_list) { - perror("strdup"); + PERROR("strdup"); ret = -ENOMEM; } break; @@ -5165,6 +5205,12 @@ int main(int argc, char **argv) goto exit_ht_cleanup_pipe; } + /* Set up max poll set size */ + if (lttng_poll_set_max_size()) { + retval = -1; + goto exit_set_max_size; + } + /* Create thread to clean up RCU hash tables */ ret = pthread_create(&ht_cleanup_thread, NULL, thread_ht_cleanup, (void *) NULL); @@ -5499,9 +5545,6 @@ int main(int argc, char **argv) */ session_list_ptr = session_get_list(); - /* Set up max poll set size */ - lttng_poll_set_max_size(); - cmd_init(); /* Check for the application socket timeout env variable. */ @@ -5731,6 +5774,7 @@ exit_init_data: retval = -1; } exit_ht_cleanup: +exit_set_max_size: utils_close_pipe(ht_cleanup_pipe); exit_ht_cleanup_pipe: