X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=b2745086f3860fab9062d5b24ed995d4cfab9325;hb=4149ace8fa7c7a8da39272f03923df46039c5ff6;hp=9cde946495436f04590339475e96f95b5ea7421c;hpb=b35308203f7844f48542978fd00aab21f2057c17;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 9cde94649..b2745086f 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -79,6 +79,14 @@ #define CONSUMERD_FILE "lttng-consumerd" +static const char *help_msg = +#ifdef LTTNG_EMBED_HELP +#include +#else +NULL +#endif +; + const char *progname; const char *tracing_group_name = DEFAULT_TRACING_GROUP; static int tracing_group_name_override; @@ -592,8 +600,7 @@ static void wait_consumer(struct consumer_data *consumer_data) ret = waitpid(consumer_data->pid, &status, 0); if (ret == -1) { PERROR("consumerd waitpid pid: %d", consumer_data->pid) - } - if (!WIFEXITED(status)) { + } else if (!WIFEXITED(status)) { ERR("consumerd termination with error: %d", WEXITSTATUS(ret)); } @@ -1927,12 +1934,16 @@ static void *thread_dispatch_ust_registration(void *data) DBG("[thread] Dispatch UST command started"); - while (!CMM_LOAD_SHARED(dispatch_thread_exit)) { + for (;;) { health_code_update(); /* Atomically prepare the queue futex */ futex_nto1_prepare(&ust_cmd_queue.futex); + if (CMM_LOAD_SHARED(dispatch_thread_exit)) { + break; + } + do { struct ust_app *app = NULL; ust_cmd = NULL; @@ -2786,6 +2797,18 @@ static int init_kernel_tracer(void) goto error_modules; } + ret = kernel_supports_ring_buffer_snapshot_sample_positions( + kernel_tracer_fd); + if (ret < 0) { + goto error_modules; + } + + if (ret < 1) { + WARN("Kernel tracer does not support buffer monitoring. " + "The monitoring timer of channels in the kernel domain " + "will be set to 0 (disabled)."); + } + DBG("Kernel tracer fd %d", kernel_tracer_fd); return 0; @@ -4757,9 +4780,9 @@ static int set_option(int opt, const char *arg, const char *optname) tracing_group_name_override = 1; } } else if (string_match(optname, "help") || opt == 'h') { - ret = utils_show_man_page(8, "lttng-sessiond"); + ret = utils_show_help(8, "lttng-sessiond", help_msg); if (ret) { - ERR("Cannot view man page lttng-sessiond(8)"); + ERR("Cannot show --help for `lttng-sessiond`"); perror("exec"); } exit(ret ? EXIT_FAILURE : EXIT_SUCCESS); @@ -5611,6 +5634,7 @@ int main(int argc, char **argv) struct lttng_pipe *ust32_channel_monitor_pipe = NULL, *ust64_channel_monitor_pipe = NULL, *kernel_channel_monitor_pipe = NULL; + bool notification_thread_running = false; init_kernel_workarounds(); @@ -6122,6 +6146,7 @@ int main(int argc, char **argv) stop_threads(); goto exit_notification; } + notification_thread_running = true; /* Create thread to manage the client socket */ ret = pthread_create(&client_thread, default_pthread_attr(), @@ -6325,17 +6350,19 @@ exit_init_data: * of the active session and channels at the moment of the teardown. */ if (notification_thread_handle) { - notification_thread_command_quit(notification_thread_handle); + if (notification_thread_running) { + notification_thread_command_quit( + notification_thread_handle); + ret = pthread_join(notification_thread, &status); + if (ret) { + errno = ret; + PERROR("pthread_join notification thread"); + retval = -1; + } + } notification_thread_handle_destroy(notification_thread_handle); } - ret = pthread_join(notification_thread, &status); - if (ret) { - errno = ret; - PERROR("pthread_join notification thread"); - retval = -1; - } - rcu_thread_offline(); rcu_unregister_thread();