#define CONSUMERD_FILE "lttng-consumerd"
+static const char *help_msg =
+#ifdef LTTNG_EMBED_HELP
+#include <lttng-sessiond.8.h>
+#else
+NULL
+#endif
+;
+
const char *progname;
const char *tracing_group_name = DEFAULT_TRACING_GROUP;
static int tracing_group_name_override;
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));
}
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;
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);
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();
stop_threads();
goto exit_notification;
}
+ notification_thread_running = true;
/* Create thread to manage the client socket */
ret = pthread_create(&client_thread, default_pthread_attr(),
* 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();