X-Git-Url: https://git.liburcu.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.cpp;fp=src%2Fbin%2Flttng-sessiond%2Fcmd.cpp;h=0b74920556d59230a5bf2a87adcef42590dd1627;hp=fe9656a89b8b59e1585f7693c3ca7db9cd3bf7ee;hb=139a8d250fb18f8ffc95b0936f7285f7b484b72f;hpb=9cc4ae91845c03b141af7ef58a86a2a9689dfafd diff --git a/src/bin/lttng-sessiond/cmd.cpp b/src/bin/lttng-sessiond/cmd.cpp index fe9656a89..0b7492055 100644 --- a/src/bin/lttng-sessiond/cmd.cpp +++ b/src/bin/lttng-sessiond/cmd.cpp @@ -3136,6 +3136,28 @@ enum lttng_error_code cmd_create_session_from_descriptor( goto end; } + ret_code = notification_thread_command_add_session(the_notification_thread_handle, + new_session->id, new_session->name, new_session->uid, new_session->gid); + if (ret_code != LTTNG_OK) { + goto end; + } + + /* Announce the session's destruction to the notification thread when it is destroyed. */ + ret = session_add_destroy_notifier( + new_session, + [](const struct ltt_session *session, + void *user_data __attribute__((unused))) { + (void) notification_thread_command_remove_session( + the_notification_thread_handle, session->id); + }, + NULL); + if (ret) { + PERROR("Failed to add notification thread command to session's destroy notifiers: session name = %s", + new_session->name); + ret = LTTNG_ERR_NOMEM; + goto end; + } + if (!session_name) { ret = lttng_session_descriptor_set_session_name(descriptor, new_session->name); @@ -5609,8 +5631,7 @@ int cmd_rotate_session(struct ltt_session *session, chunk_being_archived = NULL; if (!quiet_rotation) { ret = notification_thread_command_session_rotation_ongoing( - the_notification_thread_handle, session->name, - session->uid, session->gid, + the_notification_thread_handle, session->id, ongoing_rotation_chunk_id); if (ret != LTTNG_OK) { ERR("Failed to notify notification thread that a session rotation is ongoing for session %s",