X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fnotification-thread.c;h=8d69ef7c45919448d227056ad82880e21a476e48;hp=9809e6190cd60cbb453cea62b704a62e6da84cc5;hb=1f4962443f25c371e4b54e97f9eb867d67cbf88e;hpb=c8a9de5a85fb150d3ceaa5ca1a8b1b2b91d050d5 diff --git a/src/bin/lttng-sessiond/notification-thread.c b/src/bin/lttng-sessiond/notification-thread.c index 9809e6190..8d69ef7c4 100644 --- a/src/bin/lttng-sessiond/notification-thread.c +++ b/src/bin/lttng-sessiond/notification-thread.c @@ -172,7 +172,7 @@ char *get_notification_channel_sock_path(void) goto error; } } else { - char *home_path = utils_get_home_dir(); + const char *home_path = utils_get_home_dir(); if (!home_path) { ERR("Can't get HOME directory for socket creation"); @@ -239,8 +239,16 @@ int notification_channel_socket_create(void) } if (getuid() == 0) { - ret = chown(sock_path, 0, - utils_get_group_id(config.tracing_group_name.value)); + gid_t gid; + + ret = utils_get_group_id(config.tracing_group_name.value, true, + &gid); + if (ret) { + /* Default to root group. */ + gid = 0; + } + + ret = chown(sock_path, 0, gid); if (ret) { ERR("Failed to set the notification channel socket's group"); ret = -1; @@ -522,15 +530,15 @@ void *thread_notification(void *data) DBG("[notification-thread] Started notification thread"); + health_register(health_sessiond, HEALTH_SESSIOND_TYPE_NOTIFICATION); + rcu_register_thread(); + rcu_thread_online(); + if (!handle) { ERR("[notification-thread] Invalid thread context provided"); goto end; } - rcu_register_thread(); - rcu_thread_online(); - - health_register(health_sessiond, HEALTH_SESSIOND_TYPE_NOTIFICATION); health_code_update(); ret = init_thread_state(handle, &state); @@ -562,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) { @@ -637,10 +642,10 @@ void *thread_notification(void *data) exit: error: fini_thread_state(&state); - health_unregister(health_sessiond); +end: rcu_thread_offline(); rcu_unregister_thread(); -end: + health_unregister(health_sessiond); return NULL; } @@ -653,7 +658,8 @@ bool shutdown_notification_thread(void *thread_data) return true; } -bool launch_notification_thread(struct notification_thread_handle *handle) +struct lttng_thread *launch_notification_thread( + struct notification_thread_handle *handle) { struct lttng_thread *thread; @@ -672,8 +678,7 @@ bool launch_notification_thread(struct notification_thread_handle *handle) * (e.g. rotation thread). */ wait_until_thread_is_ready(handle); - lttng_thread_put(thread); - return true; + return thread; error: - return false; + return NULL; }