From 37a5ef391d8d282fb8c8978e4761413b69d56072 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 13 Oct 2022 17:29:28 +0100 Subject: [PATCH] sessiond-comm: prefix lttcomm_sessiond_command entries MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add LTTCOMM_SESSIOND_COMMAND as the prefix of sessiond client commands to honor the usual namespacing convention. Signed-off-by: Jérémie Galarneau Change-Id: Ie0f9c5282d442e27bcdbbf390ab23d6076c413de --- include/lttng/rotate-internal.hpp | 4 +- src/bin/lttng-sessiond/clear.cpp | 2 +- src/bin/lttng-sessiond/client.cpp | 208 ++++++++-------- src/bin/lttng-sessiond/cmd.cpp | 2 +- src/common/sessiond-comm/sessiond-comm.hpp | 273 ++++++++++----------- src/lib/lttng-ctl/clear.cpp | 2 +- src/lib/lttng-ctl/destruction-handle.cpp | 2 +- src/lib/lttng-ctl/lttng-ctl.cpp | 50 ++-- src/lib/lttng-ctl/rotate.cpp | 8 +- src/lib/lttng-ctl/save.cpp | 2 +- src/lib/lttng-ctl/snapshot.cpp | 8 +- src/lib/lttng-ctl/tracker.cpp | 10 +- 12 files changed, 280 insertions(+), 291 deletions(-) diff --git a/include/lttng/rotate-internal.hpp b/include/lttng/rotate-internal.hpp index 076f50a9a..69b82b5f6 100644 --- a/include/lttng/rotate-internal.hpp +++ b/include/lttng/rotate-internal.hpp @@ -70,12 +70,12 @@ struct lttng_rotation_schedules { * are then copied to the user's lttng_rotation_handle object. */ -/* For the LTTNG_ROTATE_SESSION command. */ +/* For the LTTCOMM_SESSIOND_COMMAND_ROTATE_SESSION command. */ struct lttng_rotate_session_return { uint64_t rotation_id; } LTTNG_PACKED; -/* For the LTTNG_ROTATION_GET_INFO command. */ +/* For the LTTCOMM_SESSIOND_COMMAND_ROTATION_GET_INFO command. */ struct lttng_rotation_get_info_return { /* Represents values defined in enum lttng_rotation_state. */ int32_t status; diff --git a/src/bin/lttng-sessiond/clear.cpp b/src/bin/lttng-sessiond/clear.cpp index 38268edd2..524d545b3 100644 --- a/src/bin/lttng-sessiond/clear.cpp +++ b/src/bin/lttng-sessiond/clear.cpp @@ -35,7 +35,7 @@ void cmd_clear_session_reply(const struct ltt_session *session, const struct cmd_clear_session_reply_context *reply_context = (cmd_clear_session_reply_context *) _reply_context; struct lttcomm_lttng_msg llm = { - .cmd_type = LTTNG_CLEAR_SESSION, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_CLEAR_SESSION, .ret_code = LTTNG_OK, .pid = UINT32_MAX, .cmd_header_size = 0, diff --git a/src/bin/lttng-sessiond/client.cpp b/src/bin/lttng-sessiond/client.cpp index 97a6d9b72..3a83f06b9 100644 --- a/src/bin/lttng-sessiond/client.cpp +++ b/src/bin/lttng-sessiond/client.cpp @@ -772,9 +772,9 @@ static enum lttng_error_code receive_lttng_event(struct command_ctx *cmd_ctx, struct lttng_event_exclusion *local_exclusion = NULL; lttng_payload_init(&event_payload); - if (cmd_ctx->lsm.cmd_type == LTTNG_ENABLE_EVENT) { + if (cmd_ctx->lsm.cmd_type == LTTCOMM_SESSIOND_COMMAND_ENABLE_EVENT) { event_len = (size_t) cmd_ctx->lsm.u.enable.length; - } else if (cmd_ctx->lsm.cmd_type == LTTNG_DISABLE_EVENT) { + } else if (cmd_ctx->lsm.cmd_type == LTTCOMM_SESSIOND_COMMAND_DISABLE_EVENT) { event_len = (size_t) cmd_ctx->lsm.u.disable.length; } else { abort(); @@ -1017,28 +1017,28 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, *sock_error = 0; switch (cmd_ctx->lsm.cmd_type) { - case LTTNG_CREATE_SESSION_EXT: - case LTTNG_DESTROY_SESSION: - case LTTNG_LIST_SESSIONS: - case LTTNG_LIST_DOMAINS: - case LTTNG_START_TRACE: - case LTTNG_STOP_TRACE: - case LTTNG_DATA_PENDING: - case LTTNG_SNAPSHOT_ADD_OUTPUT: - case LTTNG_SNAPSHOT_DEL_OUTPUT: - case LTTNG_SNAPSHOT_LIST_OUTPUT: - case LTTNG_SNAPSHOT_RECORD: - case LTTNG_SAVE_SESSION: - case LTTNG_SET_SESSION_SHM_PATH: - case LTTNG_REGENERATE_METADATA: - case LTTNG_REGENERATE_STATEDUMP: - case LTTNG_ROTATE_SESSION: - case LTTNG_ROTATION_GET_INFO: - case LTTNG_ROTATION_SET_SCHEDULE: - case LTTNG_SESSION_LIST_ROTATION_SCHEDULES: - case LTTNG_CLEAR_SESSION: - case LTTNG_LIST_TRIGGERS: - case LTTNG_EXECUTE_ERROR_QUERY: + case LTTCOMM_SESSIOND_COMMAND_CREATE_SESSION_EXT: + case LTTCOMM_SESSIOND_COMMAND_DESTROY_SESSION: + case LTTCOMM_SESSIOND_COMMAND_LIST_SESSIONS: + case LTTCOMM_SESSIOND_COMMAND_LIST_DOMAINS: + case LTTCOMM_SESSIOND_COMMAND_START_TRACE: + case LTTCOMM_SESSIOND_COMMAND_STOP_TRACE: + case LTTCOMM_SESSIOND_COMMAND_DATA_PENDING: + case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_ADD_OUTPUT: + case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_DEL_OUTPUT: + case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_LIST_OUTPUT: + case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_RECORD: + case LTTCOMM_SESSIOND_COMMAND_SAVE_SESSION: + case LTTCOMM_SESSIOND_COMMAND_SET_SESSION_SHM_PATH: + case LTTCOMM_SESSIOND_COMMAND_REGENERATE_METADATA: + case LTTCOMM_SESSIOND_COMMAND_REGENERATE_STATEDUMP: + case LTTCOMM_SESSIOND_COMMAND_ROTATE_SESSION: + case LTTCOMM_SESSIOND_COMMAND_ROTATION_GET_INFO: + case LTTCOMM_SESSIOND_COMMAND_ROTATION_SET_SCHEDULE: + case LTTCOMM_SESSIOND_COMMAND_SESSION_LIST_ROTATION_SCHEDULES: + case LTTCOMM_SESSIOND_COMMAND_CLEAR_SESSION: + case LTTCOMM_SESSIOND_COMMAND_LIST_TRIGGERS: + case LTTCOMM_SESSIOND_COMMAND_EXECUTE_ERROR_QUERY: need_domain = false; break; default: @@ -1047,9 +1047,9 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, /* Needs a functioning consumerd? */ switch (cmd_ctx->lsm.cmd_type) { - case LTTNG_REGISTER_TRIGGER: - case LTTNG_UNREGISTER_TRIGGER: - case LTTNG_EXECUTE_ERROR_QUERY: + case LTTCOMM_SESSIOND_COMMAND_REGISTER_TRIGGER: + case LTTCOMM_SESSIOND_COMMAND_UNREGISTER_TRIGGER: + case LTTCOMM_SESSIOND_COMMAND_EXECUTE_ERROR_QUERY: need_consumerd = false; break; default: @@ -1068,7 +1068,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, } /* Deny register consumer if we already have a spawned consumer. */ - if (cmd_ctx->lsm.cmd_type == LTTNG_REGISTER_CONSUMER) { + if (cmd_ctx->lsm.cmd_type == LTTCOMM_SESSIOND_COMMAND_REGISTER_CONSUMER) { pthread_mutex_lock(&the_kconsumer_data.pid_mutex); if (the_kconsumer_data.pid > 0) { ret = LTTNG_ERR_KERN_CONSUMER_FAIL; @@ -1084,22 +1084,22 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, * command. */ switch(cmd_ctx->lsm.cmd_type) { - case LTTNG_LIST_SESSIONS: - case LTTNG_LIST_TRACEPOINTS: - case LTTNG_LIST_TRACEPOINT_FIELDS: - case LTTNG_LIST_DOMAINS: - case LTTNG_LIST_CHANNELS: - case LTTNG_LIST_EVENTS: - case LTTNG_LIST_SYSCALLS: - case LTTNG_SESSION_LIST_ROTATION_SCHEDULES: - case LTTNG_PROCESS_ATTR_TRACKER_GET_POLICY: - case LTTNG_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET: - case LTTNG_DATA_PENDING: - case LTTNG_ROTATE_SESSION: - case LTTNG_ROTATION_GET_INFO: - case LTTNG_REGISTER_TRIGGER: - case LTTNG_LIST_TRIGGERS: - case LTTNG_EXECUTE_ERROR_QUERY: + case LTTCOMM_SESSIOND_COMMAND_LIST_SESSIONS: + case LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINTS: + case LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINT_FIELDS: + case LTTCOMM_SESSIOND_COMMAND_LIST_DOMAINS: + case LTTCOMM_SESSIOND_COMMAND_LIST_CHANNELS: + case LTTCOMM_SESSIOND_COMMAND_LIST_EVENTS: + case LTTCOMM_SESSIOND_COMMAND_LIST_SYSCALLS: + case LTTCOMM_SESSIOND_COMMAND_SESSION_LIST_ROTATION_SCHEDULES: + case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_GET_POLICY: + case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET: + case LTTCOMM_SESSIOND_COMMAND_DATA_PENDING: + case LTTCOMM_SESSIOND_COMMAND_ROTATE_SESSION: + case LTTCOMM_SESSIOND_COMMAND_ROTATION_GET_INFO: + case LTTCOMM_SESSIOND_COMMAND_REGISTER_TRIGGER: + case LTTCOMM_SESSIOND_COMMAND_LIST_TRIGGERS: + case LTTCOMM_SESSIOND_COMMAND_EXECUTE_ERROR_QUERY: break; default: /* Setup lttng message with no payload */ @@ -1112,16 +1112,16 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, /* Commands that DO NOT need a session. */ switch (cmd_ctx->lsm.cmd_type) { - case LTTNG_CREATE_SESSION_EXT: - case LTTNG_LIST_SESSIONS: - case LTTNG_LIST_TRACEPOINTS: - case LTTNG_LIST_SYSCALLS: - case LTTNG_LIST_TRACEPOINT_FIELDS: - case LTTNG_SAVE_SESSION: - case LTTNG_REGISTER_TRIGGER: - case LTTNG_UNREGISTER_TRIGGER: - case LTTNG_LIST_TRIGGERS: - case LTTNG_EXECUTE_ERROR_QUERY: + case LTTCOMM_SESSIOND_COMMAND_CREATE_SESSION_EXT: + case LTTCOMM_SESSIOND_COMMAND_LIST_SESSIONS: + case LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINTS: + case LTTCOMM_SESSIOND_COMMAND_LIST_SYSCALLS: + case LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINT_FIELDS: + case LTTCOMM_SESSIOND_COMMAND_SAVE_SESSION: + case LTTCOMM_SESSIOND_COMMAND_REGISTER_TRIGGER: + case LTTCOMM_SESSIOND_COMMAND_UNREGISTER_TRIGGER: + case LTTCOMM_SESSIOND_COMMAND_LIST_TRIGGERS: + case LTTCOMM_SESSIOND_COMMAND_EXECUTE_ERROR_QUERY: need_tracing_session = false; break; default: @@ -1150,8 +1150,8 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, * code path. */ switch (cmd_ctx->lsm.cmd_type) { - case LTTNG_DISABLE_CHANNEL: - case LTTNG_DISABLE_EVENT: + case LTTCOMM_SESSIOND_COMMAND_DISABLE_CHANNEL: + case LTTCOMM_SESSIOND_COMMAND_DISABLE_EVENT: switch (cmd_ctx->lsm.domain.type) { case LTTNG_DOMAIN_KERNEL: if (!cmd_ctx->session->kernel_session) { @@ -1219,7 +1219,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, /* Start the kernel consumer daemon */ pthread_mutex_lock(&the_kconsumer_data.pid_mutex); if (the_kconsumer_data.pid == 0 && - cmd_ctx->lsm.cmd_type != LTTNG_REGISTER_CONSUMER) { + cmd_ctx->lsm.cmd_type != LTTCOMM_SESSIOND_COMMAND_REGISTER_CONSUMER) { pthread_mutex_unlock(&the_kconsumer_data.pid_mutex); ret = start_consumerd(&the_kconsumer_data); if (ret < 0) { @@ -1281,7 +1281,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, pthread_mutex_lock(&the_ustconsumer64_data.pid_mutex); if (the_config.consumerd64_bin_path.value && the_ustconsumer64_data.pid == 0 && - cmd_ctx->lsm.cmd_type != LTTNG_REGISTER_CONSUMER) { + cmd_ctx->lsm.cmd_type != LTTCOMM_SESSIOND_COMMAND_REGISTER_CONSUMER) { pthread_mutex_unlock(&the_ustconsumer64_data.pid_mutex); ret = start_consumerd(&the_ustconsumer64_data); if (ret < 0) { @@ -1310,7 +1310,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, pthread_mutex_lock(&the_ustconsumer32_data.pid_mutex); if (the_config.consumerd32_bin_path.value && the_ustconsumer32_data.pid == 0 && - cmd_ctx->lsm.cmd_type != LTTNG_REGISTER_CONSUMER) { + cmd_ctx->lsm.cmd_type != LTTCOMM_SESSIOND_COMMAND_REGISTER_CONSUMER) { pthread_mutex_unlock(&the_ustconsumer32_data.pid_mutex); ret = start_consumerd(&the_ustconsumer32_data); if (ret < 0) { @@ -1343,8 +1343,8 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, skip_domain: /* Validate consumer daemon state when start/stop trace command */ - if (cmd_ctx->lsm.cmd_type == LTTNG_START_TRACE || - cmd_ctx->lsm.cmd_type == LTTNG_STOP_TRACE) { + if (cmd_ctx->lsm.cmd_type == LTTCOMM_SESSIOND_COMMAND_START_TRACE || + cmd_ctx->lsm.cmd_type == LTTCOMM_SESSIOND_COMMAND_STOP_TRACE) { switch (cmd_ctx->lsm.domain.type) { case LTTNG_DOMAIN_NONE: break; @@ -1399,7 +1399,7 @@ skip_domain: /* Process by command type */ switch (cmd_ctx->lsm.cmd_type) { - case LTTNG_ADD_CONTEXT: + case LTTCOMM_SESSIOND_COMMAND_ADD_CONTEXT: { struct lttng_event_context *event_context = NULL; const enum lttng_error_code ret_code = @@ -1415,26 +1415,26 @@ skip_domain: lttng_event_context_destroy(event_context); break; } - case LTTNG_DISABLE_CHANNEL: + case LTTCOMM_SESSIOND_COMMAND_DISABLE_CHANNEL: { ret = cmd_disable_channel(cmd_ctx->session, cmd_ctx->lsm.domain.type, cmd_ctx->lsm.u.disable.channel_name); break; } - case LTTNG_ENABLE_CHANNEL: + case LTTCOMM_SESSIOND_COMMAND_ENABLE_CHANNEL: { ret = cmd_enable_channel( cmd_ctx, *sock, the_kernel_poll_pipe[1]); break; } - case LTTNG_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE: - case LTTNG_PROCESS_ATTR_TRACKER_REMOVE_INCLUDE_VALUE: + case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE: + case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_REMOVE_INCLUDE_VALUE: { struct lttng_dynamic_buffer payload; struct lttng_buffer_view payload_view; const bool add_value = cmd_ctx->lsm.cmd_type == - LTTNG_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE; + LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE; const size_t name_len = cmd_ctx->lsm.u.process_attr_tracker_add_remove_include_value .name_len; @@ -1538,7 +1538,7 @@ skip_domain: lttng_dynamic_buffer_reset(&payload); break; } - case LTTNG_PROCESS_ATTR_TRACKER_GET_POLICY: + case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_GET_POLICY: { enum lttng_tracking_policy tracking_policy; const enum lttng_domain_type domain_type = @@ -1566,7 +1566,7 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_PROCESS_ATTR_TRACKER_SET_POLICY: + case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_SET_POLICY: { const enum lttng_tracking_policy tracking_policy = (enum lttng_tracking_policy) cmd_ctx->lsm.u @@ -1588,7 +1588,7 @@ skip_domain: } break; } - case LTTNG_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET: + case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET: { struct lttng_process_attr_values *values; struct lttng_dynamic_buffer reply; @@ -1626,8 +1626,8 @@ skip_domain: lttng_dynamic_buffer_reset(&reply); break; } - case LTTNG_ENABLE_EVENT: - case LTTNG_DISABLE_EVENT: + case LTTCOMM_SESSIOND_COMMAND_ENABLE_EVENT: + case LTTCOMM_SESSIOND_COMMAND_DISABLE_EVENT: { struct lttng_event *event; char *filter_expression; @@ -1646,7 +1646,7 @@ skip_domain: * Ownership of filter_expression, exclusions, and bytecode is * always transferred. */ - ret = cmd_ctx->lsm.cmd_type == LTTNG_ENABLE_EVENT ? + ret = cmd_ctx->lsm.cmd_type == LTTCOMM_SESSIOND_COMMAND_ENABLE_EVENT ? cmd_enable_event(cmd_ctx, event, filter_expression, exclusions, bytecode, @@ -1657,7 +1657,7 @@ skip_domain: lttng_event_destroy(event); break; } - case LTTNG_LIST_TRACEPOINTS: + case LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINTS: { enum lttng_error_code ret_code; size_t original_payload_size; @@ -1688,7 +1688,7 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_LIST_TRACEPOINT_FIELDS: + case LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINT_FIELDS: { enum lttng_error_code ret_code; size_t original_payload_size; @@ -1719,7 +1719,7 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_LIST_SYSCALLS: + case LTTCOMM_SESSIOND_COMMAND_LIST_SYSCALLS: { enum lttng_error_code ret_code; size_t original_payload_size; @@ -1747,7 +1747,7 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_SET_CONSUMER_URI: + case LTTCOMM_SESSIOND_COMMAND_SET_CONSUMER_URI: { size_t nb_uri, len; struct lttng_uri *uris; @@ -1786,7 +1786,7 @@ skip_domain: break; } - case LTTNG_START_TRACE: + case LTTCOMM_SESSIOND_COMMAND_START_TRACE: { /* * On the first start, if we have a kernel session and we have @@ -1805,18 +1805,18 @@ skip_domain: ret = cmd_start_trace(cmd_ctx->session); break; } - case LTTNG_STOP_TRACE: + case LTTCOMM_SESSIOND_COMMAND_STOP_TRACE: { ret = cmd_stop_trace(cmd_ctx->session); break; } - case LTTNG_DESTROY_SESSION: + case LTTCOMM_SESSIOND_COMMAND_DESTROY_SESSION: { ret = cmd_destroy_session(cmd_ctx->session, the_notification_thread_handle, sock); break; } - case LTTNG_LIST_DOMAINS: + case LTTCOMM_SESSIOND_COMMAND_LIST_DOMAINS: { ssize_t nb_dom; struct lttng_domain *domains = NULL; @@ -1839,7 +1839,7 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_LIST_CHANNELS: + case LTTCOMM_SESSIOND_COMMAND_LIST_CHANNELS: { enum lttng_error_code ret_code; size_t original_payload_size; @@ -1868,7 +1868,7 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_LIST_EVENTS: + case LTTCOMM_SESSIOND_COMMAND_LIST_EVENTS: { enum lttng_error_code ret_code; size_t original_payload_size; @@ -1898,7 +1898,7 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_LIST_SESSIONS: + case LTTCOMM_SESSIOND_COMMAND_LIST_SESSIONS: { unsigned int nr_sessions; lttng_session *sessions_payload = nullptr; @@ -1939,7 +1939,7 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_REGISTER_CONSUMER: + case LTTCOMM_SESSIOND_COMMAND_REGISTER_CONSUMER: { struct consumer_data *cdata; @@ -1956,7 +1956,7 @@ skip_domain: cmd_ctx->lsm.u.reg.path, cdata); break; } - case LTTNG_DATA_PENDING: + case LTTCOMM_SESSIOND_COMMAND_DATA_PENDING: { int pending_ret; uint8_t pending_ret_byte; @@ -1998,7 +1998,7 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_SNAPSHOT_ADD_OUTPUT: + case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_ADD_OUTPUT: { uint32_t snapshot_id; struct lttcomm_lttng_output_id reply; @@ -2022,13 +2022,13 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_SNAPSHOT_DEL_OUTPUT: + case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_DEL_OUTPUT: { lttng_snapshot_output output = cmd_ctx->lsm.u.snapshot_output.output; ret = cmd_snapshot_del_output(cmd_ctx->session, &output); break; } - case LTTNG_SNAPSHOT_LIST_OUTPUT: + case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_LIST_OUTPUT: { ssize_t nb_output; struct lttng_snapshot_output *outputs = NULL; @@ -2051,14 +2051,14 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_SNAPSHOT_RECORD: + case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_RECORD: { lttng_snapshot_output output = cmd_ctx->lsm.u.snapshot_record.output; ret = cmd_snapshot_record(cmd_ctx->session, &output, 0); // RFC: set to zero since it's ignored by cmd_snapshot_record break; } - case LTTNG_CREATE_SESSION_EXT: + case LTTCOMM_SESSIOND_COMMAND_CREATE_SESSION_EXT: { struct lttng_dynamic_buffer payload; struct lttng_session_descriptor *return_descriptor = NULL; @@ -2089,29 +2089,29 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_SAVE_SESSION: + case LTTCOMM_SESSIOND_COMMAND_SAVE_SESSION: { ret = cmd_save_sessions(&cmd_ctx->lsm.u.save_session.attr, &cmd_ctx->creds); break; } - case LTTNG_SET_SESSION_SHM_PATH: + case LTTCOMM_SESSIOND_COMMAND_SET_SESSION_SHM_PATH: { ret = cmd_set_session_shm_path(cmd_ctx->session, cmd_ctx->lsm.u.set_shm_path.shm_path); break; } - case LTTNG_REGENERATE_METADATA: + case LTTCOMM_SESSIOND_COMMAND_REGENERATE_METADATA: { ret = cmd_regenerate_metadata(cmd_ctx->session); break; } - case LTTNG_REGENERATE_STATEDUMP: + case LTTCOMM_SESSIOND_COMMAND_REGENERATE_STATEDUMP: { ret = cmd_regenerate_statedump(cmd_ctx->session); break; } - case LTTNG_REGISTER_TRIGGER: + case LTTCOMM_SESSIOND_COMMAND_REGISTER_TRIGGER: { struct lttng_trigger *payload_trigger; struct lttng_trigger *return_trigger; @@ -2162,7 +2162,7 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_UNREGISTER_TRIGGER: + case LTTCOMM_SESSIOND_COMMAND_UNREGISTER_TRIGGER: { struct lttng_trigger *payload_trigger; const struct lttng_credentials cmd_creds = { @@ -2181,7 +2181,7 @@ skip_domain: lttng_trigger_put(payload_trigger); break; } - case LTTNG_ROTATE_SESSION: + case LTTCOMM_SESSIOND_COMMAND_ROTATE_SESSION: { struct lttng_rotate_session_return rotate_return; @@ -2212,7 +2212,7 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_ROTATION_GET_INFO: + case LTTCOMM_SESSIOND_COMMAND_ROTATION_GET_INFO: { struct lttng_rotation_get_info_return get_info_return; @@ -2234,7 +2234,7 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_ROTATION_SET_SCHEDULE: + case LTTCOMM_SESSIOND_COMMAND_ROTATION_SET_SCHEDULE: { bool set_schedule; enum lttng_rotation_schedule_type schedule_type; @@ -2259,7 +2259,7 @@ skip_domain: break; } - case LTTNG_SESSION_LIST_ROTATION_SCHEDULES: + case LTTCOMM_SESSIOND_COMMAND_SESSION_LIST_ROTATION_SCHEDULES: { lttng_session_list_schedules_return schedules; @@ -2278,12 +2278,12 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_CLEAR_SESSION: + case LTTCOMM_SESSIOND_COMMAND_CLEAR_SESSION: { ret = cmd_clear_session(cmd_ctx->session, sock); break; } - case LTTNG_LIST_TRIGGERS: + case LTTCOMM_SESSIOND_COMMAND_LIST_TRIGGERS: { struct lttng_triggers *return_triggers = NULL; size_t original_payload_size; @@ -2321,7 +2321,7 @@ skip_domain: ret = LTTNG_OK; break; } - case LTTNG_EXECUTE_ERROR_QUERY: + case LTTCOMM_SESSIOND_COMMAND_EXECUTE_ERROR_QUERY: { struct lttng_error_query *query; const struct lttng_credentials cmd_creds = { diff --git a/src/bin/lttng-sessiond/cmd.cpp b/src/bin/lttng-sessiond/cmd.cpp index 0b7492055..5001d94e0 100644 --- a/src/bin/lttng-sessiond/cmd.cpp +++ b/src/bin/lttng-sessiond/cmd.cpp @@ -3316,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 = diff --git a/src/common/sessiond-comm/sessiond-comm.hpp b/src/common/sessiond-comm/sessiond-comm.hpp index 9894e9ba9..31482350e 100644 --- a/src/common/sessiond-comm/sessiond-comm.hpp +++ b/src/common/sessiond-comm/sessiond-comm.hpp @@ -49,61 +49,50 @@ #endif enum lttcomm_sessiond_command { - LTTCOMM_SESSIOND_COMMAND_MIN = -1, - /* Tracer command */ - LTTNG_ADD_CONTEXT = 0, - /* LTTNG_CALIBRATE used to be here */ - LTTNG_DISABLE_CHANNEL = 2, - LTTNG_DISABLE_EVENT = 3, - LTTNG_LIST_SYSCALLS = 4, - LTTNG_ENABLE_CHANNEL = 5, - LTTNG_ENABLE_EVENT = 6, - /* 7 */ - /* Session daemon command */ - /* 8 */ - LTTNG_DESTROY_SESSION = 9, - LTTNG_LIST_CHANNELS = 10, - LTTNG_LIST_DOMAINS = 11, - LTTNG_LIST_EVENTS = 12, - LTTNG_LIST_SESSIONS = 13, - LTTNG_LIST_TRACEPOINTS = 14, - LTTNG_REGISTER_CONSUMER = 15, - LTTNG_START_TRACE = 16, - LTTNG_STOP_TRACE = 17, - LTTNG_LIST_TRACEPOINT_FIELDS = 18, - - /* Consumer */ - LTTNG_DISABLE_CONSUMER = 19, - LTTNG_ENABLE_CONSUMER = 20, - LTTNG_SET_CONSUMER_URI = 21, - /* 22 */ - /* 23 */ - LTTNG_DATA_PENDING = 24, - LTTNG_SNAPSHOT_ADD_OUTPUT = 25, - LTTNG_SNAPSHOT_DEL_OUTPUT = 26, - LTTNG_SNAPSHOT_LIST_OUTPUT = 27, - LTTNG_SNAPSHOT_RECORD = 28, - /* 29 */ - /* 30 */ - LTTNG_SAVE_SESSION = 31, - LTTNG_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE = 32, - LTTNG_PROCESS_ATTR_TRACKER_REMOVE_INCLUDE_VALUE = 33, - LTTNG_PROCESS_ATTR_TRACKER_GET_POLICY = 34, - LTTNG_PROCESS_ATTR_TRACKER_SET_POLICY = 35, - LTTNG_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET = 36, - LTTNG_SET_SESSION_SHM_PATH = 40, - LTTNG_REGENERATE_METADATA = 41, - LTTNG_REGENERATE_STATEDUMP = 42, - LTTNG_REGISTER_TRIGGER = 43, - LTTNG_UNREGISTER_TRIGGER = 44, - LTTNG_ROTATE_SESSION = 45, - LTTNG_ROTATION_GET_INFO = 46, - LTTNG_ROTATION_SET_SCHEDULE = 47, - LTTNG_SESSION_LIST_ROTATION_SCHEDULES = 48, - LTTNG_CREATE_SESSION_EXT = 49, - LTTNG_CLEAR_SESSION = 50, - LTTNG_LIST_TRIGGERS = 51, - LTTNG_EXECUTE_ERROR_QUERY = 52, + LTTCOMM_SESSIOND_COMMAND_MIN, + LTTCOMM_SESSIOND_COMMAND_ADD_CONTEXT, + LTTCOMM_SESSIOND_COMMAND_DISABLE_CHANNEL, + LTTCOMM_SESSIOND_COMMAND_DISABLE_EVENT, + LTTCOMM_SESSIOND_COMMAND_LIST_SYSCALLS, + LTTCOMM_SESSIOND_COMMAND_ENABLE_CHANNEL, + LTTCOMM_SESSIOND_COMMAND_ENABLE_EVENT, + LTTCOMM_SESSIOND_COMMAND_DESTROY_SESSION, + LTTCOMM_SESSIOND_COMMAND_LIST_CHANNELS, + LTTCOMM_SESSIOND_COMMAND_LIST_DOMAINS, + LTTCOMM_SESSIOND_COMMAND_LIST_EVENTS, + LTTCOMM_SESSIOND_COMMAND_LIST_SESSIONS, + LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINTS, + LTTCOMM_SESSIOND_COMMAND_REGISTER_CONSUMER, + LTTCOMM_SESSIOND_COMMAND_START_TRACE, + LTTCOMM_SESSIOND_COMMAND_STOP_TRACE, + LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINT_FIELDS, + LTTCOMM_SESSIOND_COMMAND_DISABLE_CONSUMER, + LTTCOMM_SESSIOND_COMMAND_ENABLE_CONSUMER, + LTTCOMM_SESSIOND_COMMAND_SET_CONSUMER_URI, + LTTCOMM_SESSIOND_COMMAND_DATA_PENDING, + LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_ADD_OUTPUT, + LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_DEL_OUTPUT, + LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_LIST_OUTPUT, + LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_RECORD, + LTTCOMM_SESSIOND_COMMAND_SAVE_SESSION, + LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE, + LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_REMOVE_INCLUDE_VALUE, + LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_GET_POLICY, + LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_SET_POLICY, + LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET, + LTTCOMM_SESSIOND_COMMAND_SET_SESSION_SHM_PATH, + LTTCOMM_SESSIOND_COMMAND_REGENERATE_METADATA, + LTTCOMM_SESSIOND_COMMAND_REGENERATE_STATEDUMP, + LTTCOMM_SESSIOND_COMMAND_REGISTER_TRIGGER, + LTTCOMM_SESSIOND_COMMAND_UNREGISTER_TRIGGER, + LTTCOMM_SESSIOND_COMMAND_ROTATE_SESSION, + LTTCOMM_SESSIOND_COMMAND_ROTATION_GET_INFO, + LTTCOMM_SESSIOND_COMMAND_ROTATION_SET_SCHEDULE, + LTTCOMM_SESSIOND_COMMAND_SESSION_LIST_ROTATION_SCHEDULES, + LTTCOMM_SESSIOND_COMMAND_CREATE_SESSION_EXT, + LTTCOMM_SESSIOND_COMMAND_CLEAR_SESSION, + LTTCOMM_SESSIOND_COMMAND_LIST_TRIGGERS, + LTTCOMM_SESSIOND_COMMAND_EXECUTE_ERROR_QUERY, LTTCOMM_SESSIOND_COMMAND_MAX, }; @@ -117,92 +106,92 @@ static inline const char *lttcomm_sessiond_command_str(enum lttcomm_sessiond_command cmd) { switch (cmd) { - case LTTNG_ADD_CONTEXT: - return "LTTNG_ADD_CONTEXT"; - case LTTNG_DISABLE_CHANNEL: - return "LTTNG_DISABLE_CHANNEL"; - case LTTNG_DISABLE_EVENT: - return "LTTNG_DISABLE_EVENT"; - case LTTNG_LIST_SYSCALLS: - return "LTTNG_LIST_SYSCALLS"; - case LTTNG_ENABLE_CHANNEL: - return "LTTNG_ENABLE_CHANNEL"; - case LTTNG_ENABLE_EVENT: - return "LTTNG_ENABLE_EVENT"; - case LTTNG_DESTROY_SESSION: - return "LTTNG_DESTROY_SESSION"; - case LTTNG_LIST_CHANNELS: - return "LTTNG_LIST_CHANNELS"; - case LTTNG_LIST_DOMAINS: - return "LTTNG_LIST_DOMAINS"; - case LTTNG_LIST_EVENTS: - return "LTTNG_LIST_EVENTS"; - case LTTNG_LIST_SESSIONS: - return "LTTNG_LIST_SESSIONS"; - case LTTNG_LIST_TRACEPOINTS: - return "LTTNG_LIST_TRACEPOINTS"; - case LTTNG_REGISTER_CONSUMER: - return "LTTNG_REGISTER_CONSUMER"; - case LTTNG_START_TRACE: - return "LTTNG_START_TRACE"; - case LTTNG_STOP_TRACE: - return "LTTNG_STOP_TRACE"; - case LTTNG_LIST_TRACEPOINT_FIELDS: - return "LTTNG_LIST_TRACEPOINT_FIELDS"; - case LTTNG_DISABLE_CONSUMER: - return "LTTNG_DISABLE_CONSUMER"; - case LTTNG_ENABLE_CONSUMER: - return "LTTNG_ENABLE_CONSUMER"; - case LTTNG_SET_CONSUMER_URI: - return "LTTNG_SET_CONSUMER_URI"; - case LTTNG_DATA_PENDING: - return "LTTNG_DATA_PENDING"; - case LTTNG_SNAPSHOT_ADD_OUTPUT: - return "LTTNG_SNAPSHOT_ADD_OUTPUT"; - case LTTNG_SNAPSHOT_DEL_OUTPUT: - return "LTTNG_SNAPSHOT_DEL_OUTPUT"; - case LTTNG_SNAPSHOT_LIST_OUTPUT: - return "LTTNG_SNAPSHOT_LIST_OUTPUT"; - case LTTNG_SNAPSHOT_RECORD: - return "LTTNG_SNAPSHOT_RECORD"; - case LTTNG_SAVE_SESSION: - return "LTTNG_SAVE_SESSION"; - case LTTNG_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE: - return "LTTNG_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE"; - case LTTNG_PROCESS_ATTR_TRACKER_REMOVE_INCLUDE_VALUE: - return "LTTNG_PROCESS_ATTR_TRACKER_REMOVE_INCLUDE_VALUE"; - case LTTNG_PROCESS_ATTR_TRACKER_GET_POLICY: - return "LTTNG_PROCESS_ATTR_TRACKER_GET_POLICY"; - case LTTNG_PROCESS_ATTR_TRACKER_SET_POLICY: - return "LTTNG_PROCESS_ATTR_TRACKER_SET_POLICY"; - case LTTNG_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET: - return "LTTNG_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET"; - case LTTNG_SET_SESSION_SHM_PATH: - return "LTTNG_SET_SESSION_SHM_PATH"; - case LTTNG_REGENERATE_METADATA: - return "LTTNG_REGENERATE_METADATA"; - case LTTNG_REGENERATE_STATEDUMP: - return "LTTNG_REGENERATE_STATEDUMP"; - case LTTNG_REGISTER_TRIGGER: - return "LTTNG_REGISTER_TRIGGER"; - case LTTNG_UNREGISTER_TRIGGER: - return "LTTNG_UNREGISTER_TRIGGER"; - case LTTNG_ROTATE_SESSION: - return "LTTNG_ROTATE_SESSION"; - case LTTNG_ROTATION_GET_INFO: - return "LTTNG_ROTATION_GET_INFO"; - case LTTNG_ROTATION_SET_SCHEDULE: - return "LTTNG_ROTATION_SET_SCHEDULE"; - case LTTNG_SESSION_LIST_ROTATION_SCHEDULES: - return "LTTNG_SESSION_LIST_ROTATION_SCHEDULES"; - case LTTNG_CREATE_SESSION_EXT: - return "LTTNG_CREATE_SESSION_EXT"; - case LTTNG_CLEAR_SESSION: - return "LTTNG_CLEAR_SESSION"; - case LTTNG_LIST_TRIGGERS: - return "LTTNG_LIST_TRIGGERS"; - case LTTNG_EXECUTE_ERROR_QUERY: - return "LTTNG_EXECUTE_ERROR_QUERY"; + case LTTCOMM_SESSIOND_COMMAND_ADD_CONTEXT: + return "ADD_CONTEXT"; + case LTTCOMM_SESSIOND_COMMAND_DISABLE_CHANNEL: + return "DISABLE_CHANNEL"; + case LTTCOMM_SESSIOND_COMMAND_DISABLE_EVENT: + return "DISABLE_EVENT"; + case LTTCOMM_SESSIOND_COMMAND_LIST_SYSCALLS: + return "LIST_SYSCALLS"; + case LTTCOMM_SESSIOND_COMMAND_ENABLE_CHANNEL: + return "ENABLE_CHANNEL"; + case LTTCOMM_SESSIOND_COMMAND_ENABLE_EVENT: + return "ENABLE_EVENT"; + case LTTCOMM_SESSIOND_COMMAND_DESTROY_SESSION: + return "DESTROY_SESSION"; + case LTTCOMM_SESSIOND_COMMAND_LIST_CHANNELS: + return "LIST_CHANNELS"; + case LTTCOMM_SESSIOND_COMMAND_LIST_DOMAINS: + return "LIST_DOMAINS"; + case LTTCOMM_SESSIOND_COMMAND_LIST_EVENTS: + return "LIST_EVENTS"; + case LTTCOMM_SESSIOND_COMMAND_LIST_SESSIONS: + return "LIST_SESSIONS"; + case LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINTS: + return "LIST_TRACEPOINTS"; + case LTTCOMM_SESSIOND_COMMAND_REGISTER_CONSUMER: + return "REGISTER_CONSUMER"; + case LTTCOMM_SESSIOND_COMMAND_START_TRACE: + return "START_TRACE"; + case LTTCOMM_SESSIOND_COMMAND_STOP_TRACE: + return "STOP_TRACE"; + case LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINT_FIELDS: + return "LIST_TRACEPOINT_FIELDS"; + case LTTCOMM_SESSIOND_COMMAND_DISABLE_CONSUMER: + return "DISABLE_CONSUMER"; + case LTTCOMM_SESSIOND_COMMAND_ENABLE_CONSUMER: + return "ENABLE_CONSUMER"; + case LTTCOMM_SESSIOND_COMMAND_SET_CONSUMER_URI: + return "SET_CONSUMER_URI"; + case LTTCOMM_SESSIOND_COMMAND_DATA_PENDING: + return "DATA_PENDING"; + case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_ADD_OUTPUT: + return "SNAPSHOT_ADD_OUTPUT"; + case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_DEL_OUTPUT: + return "SNAPSHOT_DEL_OUTPUT"; + case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_LIST_OUTPUT: + return "SNAPSHOT_LIST_OUTPUT"; + case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_RECORD: + return "SNAPSHOT_RECORD"; + case LTTCOMM_SESSIOND_COMMAND_SAVE_SESSION: + return "SAVE_SESSION"; + case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE: + return "PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE"; + case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_REMOVE_INCLUDE_VALUE: + return "PROCESS_ATTR_TRACKER_REMOVE_INCLUDE_VALUE"; + case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_GET_POLICY: + return "PROCESS_ATTR_TRACKER_GET_POLICY"; + case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_SET_POLICY: + return "PROCESS_ATTR_TRACKER_SET_POLICY"; + case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET: + return "PROCESS_ATTR_TRACKER_GET_INCLUSION_SET"; + case LTTCOMM_SESSIOND_COMMAND_SET_SESSION_SHM_PATH: + return "SET_SESSION_SHM_PATH"; + case LTTCOMM_SESSIOND_COMMAND_REGENERATE_METADATA: + return "REGENERATE_METADATA"; + case LTTCOMM_SESSIOND_COMMAND_REGENERATE_STATEDUMP: + return "REGENERATE_STATEDUMP"; + case LTTCOMM_SESSIOND_COMMAND_REGISTER_TRIGGER: + return "REGISTER_TRIGGER"; + case LTTCOMM_SESSIOND_COMMAND_UNREGISTER_TRIGGER: + return "UNREGISTER_TRIGGER"; + case LTTCOMM_SESSIOND_COMMAND_ROTATE_SESSION: + return "ROTATE_SESSION"; + case LTTCOMM_SESSIOND_COMMAND_ROTATION_GET_INFO: + return "ROTATION_GET_INFO"; + case LTTCOMM_SESSIOND_COMMAND_ROTATION_SET_SCHEDULE: + return "ROTATION_SET_SCHEDULE"; + case LTTCOMM_SESSIOND_COMMAND_SESSION_LIST_ROTATION_SCHEDULES: + return "SESSION_LIST_ROTATION_SCHEDULES"; + case LTTCOMM_SESSIOND_COMMAND_CREATE_SESSION_EXT: + return "CREATE_SESSION_EXT"; + case LTTCOMM_SESSIOND_COMMAND_CLEAR_SESSION: + return "CLEAR_SESSION"; + case LTTCOMM_SESSIOND_COMMAND_LIST_TRIGGERS: + return "LIST_TRIGGERS"; + case LTTCOMM_SESSIOND_COMMAND_EXECUTE_ERROR_QUERY: + return "EXECUTE_ERROR_QUERY"; default: abort(); } @@ -614,7 +603,7 @@ struct lttcomm_event_extended_header { } LTTNG_PACKED; /* - * Command header of the reply to an LTTNG_DESTROY_SESSION command. + * Command header of the reply to an LTTCOMM_SESSIOND_COMMAND_DESTROY_SESSION command. */ struct lttcomm_session_destroy_command_header { /* enum lttng_session */ diff --git a/src/lib/lttng-ctl/clear.cpp b/src/lib/lttng-ctl/clear.cpp index b7a312be5..b205ac8f2 100644 --- a/src/lib/lttng-ctl/clear.cpp +++ b/src/lib/lttng-ctl/clear.cpp @@ -282,7 +282,7 @@ enum lttng_error_code lttng_clear_session(const char *session_name, enum lttng_error_code ret_code = LTTNG_OK; struct lttng_clear_handle *handle = NULL; struct lttcomm_session_msg lsm = { - .cmd_type = LTTNG_CLEAR_SESSION, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_CLEAR_SESSION, .session = {}, .domain = {}, .u = {}, diff --git a/src/lib/lttng-ctl/destruction-handle.cpp b/src/lib/lttng-ctl/destruction-handle.cpp index 3882a587e..04cbd92a5 100644 --- a/src/lib/lttng-ctl/destruction-handle.cpp +++ b/src/lib/lttng-ctl/destruction-handle.cpp @@ -390,7 +390,7 @@ enum lttng_error_code lttng_destroy_session_ext(const char *session_name, ssize_t comm_ret; enum lttng_error_code ret_code = LTTNG_OK; struct lttcomm_session_msg lsm = { - .cmd_type = LTTNG_DESTROY_SESSION, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_DESTROY_SESSION, .session = {}, .domain = {}, .u = {}, diff --git a/src/lib/lttng-ctl/lttng-ctl.cpp b/src/lib/lttng-ctl/lttng-ctl.cpp index 3d0c8b412..c389243d9 100644 --- a/src/lib/lttng-ctl/lttng-ctl.cpp +++ b/src/lib/lttng-ctl/lttng-ctl.cpp @@ -779,7 +779,7 @@ int lttng_register_consumer(struct lttng_handle *handle, } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_REGISTER_CONSUMER; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_REGISTER_CONSUMER; ret = lttng_strncpy(lsm.session.name, handle->session_name, sizeof(lsm.session.name)); if (ret) { @@ -817,7 +817,7 @@ int lttng_start_tracing(const char *session_name) } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_START_TRACE; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_START_TRACE; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); @@ -845,7 +845,7 @@ static int _lttng_stop_tracing(const char *session_name, int wait) } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_STOP_TRACE; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_STOP_TRACE; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); @@ -917,7 +917,7 @@ int lttng_add_context(struct lttng_handle *handle, { int ret; struct lttcomm_session_msg lsm = { - .cmd_type = LTTNG_ADD_CONTEXT, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_ADD_CONTEXT, .session = {}, .domain = {}, .u = {}, @@ -1091,7 +1091,7 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle, int exclusion_count, char **exclusion_list) { struct lttcomm_session_msg lsm = { - .cmd_type = LTTNG_ENABLE_EVENT, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_ENABLE_EVENT, .session = {}, .domain = {}, .u = {}, @@ -1276,7 +1276,7 @@ int lttng_disable_event_ext(struct lttng_handle *handle, const char *original_filter_expression) { struct lttcomm_session_msg lsm = { - .cmd_type = LTTNG_DISABLE_EVENT, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_DISABLE_EVENT, .session = {}, .domain = {}, .u = {}, @@ -1591,7 +1591,7 @@ int lttng_enable_channel(struct lttng_handle *handle, /* Prepare the payload */ memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_ENABLE_CHANNEL; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_ENABLE_CHANNEL; COPY_DOMAIN_PACKED(lsm.domain, handle->domain); ret = lttng_strncpy(lsm.session.name, handle->session_name, @@ -1633,7 +1633,7 @@ int lttng_disable_channel(struct lttng_handle *handle, const char *name) memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_DISABLE_CHANNEL; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_DISABLE_CHANNEL; ret = lttng_strncpy(lsm.u.disable.channel_name, name, sizeof(lsm.u.disable.channel_name)); @@ -1669,7 +1669,7 @@ int lttng_list_tracepoints(struct lttng_handle *handle, int ret, total_payload_received; char *reception_buffer = NULL; struct lttcomm_session_msg lsm = { - .cmd_type = LTTNG_LIST_TRACEPOINTS, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINTS, .session = {}, .domain = {}, .u = {}, @@ -1755,7 +1755,7 @@ int lttng_list_tracepoint_fields(struct lttng_handle *handle, } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_LIST_TRACEPOINT_FIELDS; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINT_FIELDS; COPY_DOMAIN_PACKED(lsm.domain, handle->domain); { @@ -1833,7 +1833,7 @@ int lttng_list_syscalls(struct lttng_event **events) goto end; } - lsm.cmd_type = LTTNG_LIST_SYSCALLS; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_SYSCALLS; /* Force kernel domain for system calls. */ lsm.domain.type = LTTNG_DOMAIN_KERNEL; @@ -1899,7 +1899,7 @@ enum lttng_error_code lttng_create_session_ext( { enum lttng_error_code ret_code; struct lttcomm_session_msg lsm = { - .cmd_type = LTTNG_CREATE_SESSION_EXT, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_CREATE_SESSION_EXT, .session = {}, .domain = {}, .u = {}, @@ -2219,7 +2219,7 @@ int lttng_list_sessions(struct lttng_session **out_sessions) struct lttng_session *sessions = NULL; memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_LIST_SESSIONS; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_SESSIONS; /* * Initialize out_sessions to NULL so it is initialized when * lttng_list_sessions returns 0, thus allowing *out_sessions to @@ -2292,7 +2292,7 @@ int lttng_set_session_shm_path(const char *session_name, } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_SET_SESSION_SHM_PATH; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SET_SESSION_SHM_PATH; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); @@ -2331,7 +2331,7 @@ int lttng_list_domains(const char *session_name, } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_LIST_DOMAINS; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_DOMAINS; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); @@ -2374,7 +2374,7 @@ int lttng_list_channels(struct lttng_handle *handle, } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_LIST_CHANNELS; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_CHANNELS; ret = lttng_strncpy(lsm.session.name, handle->session_name, sizeof(lsm.session.name)); if (ret) { @@ -2455,7 +2455,7 @@ int lttng_list_events(struct lttng_handle *handle, } /* Initialize command parameters. */ - lsm.cmd_type = LTTNG_LIST_EVENTS; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_EVENTS; ret = lttng_strncpy(lsm.session.name, handle->session_name, sizeof(lsm.session.name)); if (ret) { @@ -2825,7 +2825,7 @@ int lttng_set_consumer_url(struct lttng_handle *handle, memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_SET_CONSUMER_URI; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SET_CONSUMER_URI; ret = lttng_strncpy(lsm.session.name, handle->session_name, sizeof(lsm.session.name)); @@ -2901,7 +2901,7 @@ int lttng_data_pending(const char *session_name) } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_DATA_PENDING; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_DATA_PENDING; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); @@ -2944,7 +2944,7 @@ int lttng_regenerate_metadata(const char *session_name) } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_REGENERATE_METADATA; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_REGENERATE_METADATA; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); @@ -2986,7 +2986,7 @@ int lttng_regenerate_statedump(const char *session_name) } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_REGENERATE_STATEDUMP; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_REGENERATE_STATEDUMP; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); @@ -3011,7 +3011,7 @@ int _lttng_register_trigger(struct lttng_trigger *trigger, const char *name, { int ret; struct lttcomm_session_msg lsm = { - .cmd_type = LTTNG_REGISTER_TRIGGER, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_REGISTER_TRIGGER, .session = {}, .domain = {}, .u = {}, @@ -3187,7 +3187,7 @@ enum lttng_error_code lttng_error_query_execute( int ret; enum lttng_error_code ret_code; struct lttcomm_session_msg lsm = { - .cmd_type = LTTNG_EXECUTE_ERROR_QUERY, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_EXECUTE_ERROR_QUERY, .session = {}, .domain = {}, .u = {}, @@ -3318,7 +3318,7 @@ int lttng_unregister_trigger(const struct lttng_trigger *trigger) } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_UNREGISTER_TRIGGER; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_UNREGISTER_TRIGGER; ret = lttng_dynamic_buffer_append(&message.buffer, &lsm, sizeof(lsm)); if (ret) { @@ -3377,7 +3377,7 @@ enum lttng_error_code lttng_list_triggers(struct lttng_triggers **triggers) int ret; enum lttng_error_code ret_code = LTTNG_OK; struct lttcomm_session_msg lsm = { - .cmd_type = LTTNG_LIST_TRIGGERS, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_TRIGGERS, .session = {}, .domain = {}, .u = {}, diff --git a/src/lib/lttng-ctl/rotate.cpp b/src/lib/lttng-ctl/rotate.cpp index 3f1848a80..240b8c9ad 100644 --- a/src/lib/lttng-ctl/rotate.cpp +++ b/src/lib/lttng-ctl/rotate.cpp @@ -33,7 +33,7 @@ enum lttng_rotation_status ask_rotation_info( } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_ROTATION_GET_INFO; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_ROTATION_GET_INFO; lsm.u.get_rotation_info.rotation_id = rotation_handle->rotation_id; ret = lttng_strncpy(lsm.session.name, rotation_handle->session_name, @@ -217,7 +217,7 @@ int lttng_rotate_session(const char *session_name, } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_ROTATE_SESSION; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_ROTATE_SESSION; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); @@ -283,7 +283,7 @@ enum lttng_rotation_status lttng_rotation_update_schedule( } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_ROTATION_SET_SCHEDULE; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_ROTATION_SET_SCHEDULE; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); /* Source length already validated. */ @@ -376,7 +376,7 @@ int get_schedules(const char *session_name, } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_SESSION_LIST_ROTATION_SCHEDULES; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SESSION_LIST_ROTATION_SCHEDULES; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); if (ret) { diff --git a/src/lib/lttng-ctl/save.cpp b/src/lib/lttng-ctl/save.cpp index 32fcb1c2d..dcbad45b3 100644 --- a/src/lib/lttng-ctl/save.cpp +++ b/src/lib/lttng-ctl/save.cpp @@ -207,7 +207,7 @@ int lttng_save_session(struct lttng_save_session_attr *attr) } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_SAVE_SESSION; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SAVE_SESSION; memcpy(&lsm.u.save_session.attr, attr, sizeof(struct lttng_save_session_attr)); diff --git a/src/lib/lttng-ctl/snapshot.cpp b/src/lib/lttng-ctl/snapshot.cpp index baec7357f..2814cc5ee 100644 --- a/src/lib/lttng-ctl/snapshot.cpp +++ b/src/lib/lttng-ctl/snapshot.cpp @@ -33,7 +33,7 @@ int lttng_snapshot_add_output(const char *session_name, } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_SNAPSHOT_ADD_OUTPUT; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_ADD_OUTPUT; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); @@ -74,7 +74,7 @@ int lttng_snapshot_del_output(const char *session_name, } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_SNAPSHOT_DEL_OUTPUT; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_DEL_OUTPUT; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); @@ -111,7 +111,7 @@ int lttng_snapshot_list_output(const char *session_name, } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_SNAPSHOT_LIST_OUTPUT; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_LIST_OUTPUT; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); @@ -208,7 +208,7 @@ int lttng_snapshot_record(const char *session_name, } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_SNAPSHOT_RECORD; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_RECORD; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); diff --git a/src/lib/lttng-ctl/tracker.cpp b/src/lib/lttng-ctl/tracker.cpp index 4930e94ce..47d8ecb5c 100644 --- a/src/lib/lttng-ctl/tracker.cpp +++ b/src/lib/lttng-ctl/tracker.cpp @@ -102,7 +102,7 @@ lttng_process_attr_tracker_handle_get_tracking_policy( enum lttng_process_attr_tracker_handle_status status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK; struct lttcomm_session_msg lsm = { - .cmd_type = LTTNG_PROCESS_ATTR_TRACKER_GET_POLICY, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_GET_POLICY, .session = {}, .domain = {}, .u = {}, @@ -153,7 +153,7 @@ lttng_process_attr_tracker_handle_set_tracking_policy( enum lttng_process_attr_tracker_handle_status status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK; struct lttcomm_session_msg lsm = { - .cmd_type = LTTNG_PROCESS_ATTR_TRACKER_SET_POLICY, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_SET_POLICY, .session = {}, .domain = {}, .u = {}, @@ -205,7 +205,7 @@ end: enum lttng_process_attr_tracker_handle_status status = \ LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK; \ struct lttcomm_session_msg lsm = { \ - .cmd_type = LTTNG_PROCESS_ATTR_TRACKER_##command_upper##_INCLUDE_VALUE, \ + .cmd_type = LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_##command_upper##_INCLUDE_VALUE, \ .session = {}, \ .domain = {}, \ .u = {}, \ @@ -273,7 +273,7 @@ end: enum lttng_process_attr_tracker_handle_status status = \ LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK; \ struct lttcomm_session_msg lsm = { \ - .cmd_type = LTTNG_PROCESS_ATTR_TRACKER_##command_upper##_INCLUDE_VALUE, \ + .cmd_type = LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_##command_upper##_INCLUDE_VALUE, \ .session = {}, \ .domain = {}, \ .u = {}, \ @@ -392,7 +392,7 @@ lttng_process_attr_tracker_handle_get_inclusion_set( enum lttng_process_attr_tracker_handle_status status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK; struct lttcomm_session_msg lsm = { - .cmd_type = LTTNG_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET, + .cmd_type = LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET, .session = {}, .domain = {}, .u = {}, -- 2.34.1