Clean-up: modernize pretty_xml.cpp
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.cpp
index 413bb6500353ba6e72536e97513f66ef16e00cd8..b1e0c098594f26004bdf329567a6b6eb08731dac 100644 (file)
@@ -55,6 +55,7 @@
 #include <lttng/event-internal.hpp>
 #include <lttng/event-rule/event-rule-internal.hpp>
 #include <lttng/event-rule/event-rule.h>
+#include <lttng/kernel.h>
 #include <lttng/location-internal.hpp>
 #include <lttng/lttng-error.h>
 #include <lttng/rotate-internal.hpp>
@@ -484,14 +485,22 @@ static enum lttng_error_code list_lttng_ust_global_events(char *channel_name,
                        tmp_event->exclusion = 1;
                }
 
+               std::vector<const char *> exclusion_names;
+               if (uevent->exclusion) {
+                       for (int i = 0; i < uevent->exclusion->count; i++) {
+                               exclusion_names.emplace_back(
+                                       LTTNG_EVENT_EXCLUSION_NAME_AT(uevent->exclusion, i));
+                       }
+               }
+
                /*
                 * We do not care about the filter bytecode and the fd from the
                 * userspace_probe_location.
                 */
                ret = lttng_event_serialize(tmp_event,
-                                           uevent->exclusion ? uevent->exclusion->count : 0,
-                                           uevent->exclusion ? (char **) uevent->exclusion->names :
-                                                               nullptr,
+                                           exclusion_names.size(),
+                                           exclusion_names.size() ? exclusion_names.data() :
+                                                                    nullptr,
                                            uevent->filter_expression,
                                            0,
                                            nullptr,
@@ -2087,8 +2096,6 @@ static int _cmd_enable_event(struct ltt_session *session,
                }
        }
 
-       DBG("Enable event command for event \'%s\'", event->name);
-
        lttng::urcu::read_lock_guard read_lock;
 
        switch (domain->type) {
@@ -2330,6 +2337,7 @@ static int _cmd_enable_event(struct ltt_session *session,
                memset(&uevent, 0, sizeof(uevent));
                uevent.type = LTTNG_EVENT_TRACEPOINT;
                uevent.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
+               uevent.loglevel = -1;
                default_event_name = event_get_default_agent_ust_name(domain->type);
                if (!default_event_name) {
                        ret = LTTNG_ERR_FATAL;
@@ -3390,8 +3398,7 @@ error:
  *
  * Called with session lock held.
  */
-int cmd_destroy_session(struct ltt_session *session,
-                       int *sock_fd)
+int cmd_destroy_session(struct ltt_session *session, int *sock_fd)
 {
        int ret;
        enum lttng_error_code destruction_last_error = LTTNG_OK;
@@ -3436,7 +3443,7 @@ int cmd_destroy_session(struct ltt_session *session,
                try {
                        the_rotation_thread_handle->unsubscribe_session_consumed_size_rotation(
                                *session);
-               } catch (std::exception& e) {
+               } catch (const std::exception& e) {
                        /* Continue the destruction of the session anyway. */
                        ERR("Failed to unsubscribe rotation thread notification channel from consumed size condition during session destruction: %s",
                            e.what());
@@ -4011,6 +4018,19 @@ void cmd_list_lttng_sessions(struct lttng_session *sessions,
        }
 }
 
+/*
+ * Command LTTCOMM_SESSIOND_COMMAND_KERNEL_TRACER_STATUS
+ */
+enum lttng_error_code cmd_kernel_tracer_status(enum lttng_kernel_tracer_status *status)
+{
+       if (status == nullptr) {
+               return LTTNG_ERR_INVALID;
+       }
+
+       *status = get_kernel_tracer_status();
+       return LTTNG_OK;
+}
+
 /*
  * Command LTTNG_DATA_PENDING returning 0 if the data is NOT pending meaning
  * ready for trace analysis (or any kind of reader) or else 1 for pending data.
@@ -4469,6 +4489,8 @@ synchronize_tracer_notifier_register(struct notification_thread_handle *notifica
                                    (int) trigger_owner,
                                    ret_code);
                        }
+
+                       goto end_unlock_session_list;
                }
                break;
        }
@@ -5897,7 +5919,7 @@ int cmd_rotation_set_schedule(struct ltt_session *session,
                        try {
                                the_rotation_thread_handle->subscribe_session_consumed_size_rotation(
                                        *session, new_value);
-                       } catch (std::exception& e) {
+                       } catch (const std::exception& e) {
                                ERR("Failed to enable consumed-size notification in ROTATION_SET_SCHEDULE command: %s",
                                    e.what());
                                ret = LTTNG_ERR_UNK;
@@ -5907,7 +5929,7 @@ int cmd_rotation_set_schedule(struct ltt_session *session,
                        try {
                                the_rotation_thread_handle
                                        ->unsubscribe_session_consumed_size_rotation(*session);
-                       } catch (std::exception& e) {
+                       } catch (const std::exception& e) {
                                ERR("Failed to disable consumed-size notification in ROTATION_SET_SCHEDULE command: %s",
                                    e.what());
                                ret = LTTNG_ERR_UNK;
This page took 0.025008 seconds and 4 git commands to generate.