X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.cpp;h=5001d94e05dabf96907aea9aacc7d62408649ca5;hb=37a5ef391d8d282fb8c8978e4761413b69d56072;hp=fe9656a89b8b59e1585f7693c3ca7db9cd3bf7ee;hpb=d7bfb9b0fa35679d3e728b9165699d9faf905539;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.cpp b/src/bin/lttng-sessiond/cmd.cpp index fe9656a89..5001d94e0 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); @@ -3294,7 +3316,7 @@ void cmd_destroy_session_reply(const struct ltt_session *session, struct lttcomm_session_destroy_command_header cmd_header; struct lttng_trace_archive_location *location = NULL; struct lttcomm_lttng_msg llm = { - .cmd_type = LTTNG_DESTROY_SESSION, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_DESTROY_SESSION, .ret_code = reply_context->destruction_status, .pid = UINT32_MAX, .cmd_header_size = @@ -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",