Run clang-format on the whole tree
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 13 Jan 2023 17:02:15 +0000 (12:02 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 16 Jan 2023 19:49:24 +0000 (14:49 -0500)
Generated by running:

find -not \( -path "./src/vendor*" -prune \) -iname "*.h" -o -iname "*.hpp" -o -iname "*.c" -o -iname "*.cpp" -exec clang-format -i {} \;

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9557e7d84e305187475ef88124857cf2f438bbb1

291 files changed:
doc/examples/trigger-condition-event-matches/notification-client.cpp
src/bin/lttng-consumerd/health-consumerd.cpp
src/bin/lttng-consumerd/lttng-consumerd.cpp
src/bin/lttng-crash/lttng-crash.cpp
src/bin/lttng-relayd/backward-compatibility-group-by.cpp
src/bin/lttng-relayd/cmd-2-1.cpp
src/bin/lttng-relayd/cmd-2-11.cpp
src/bin/lttng-relayd/cmd-2-2.cpp
src/bin/lttng-relayd/cmd-2-4.cpp
src/bin/lttng-relayd/connection.cpp
src/bin/lttng-relayd/ctf-trace.cpp
src/bin/lttng-relayd/health-relayd.cpp
src/bin/lttng-relayd/index.cpp
src/bin/lttng-relayd/live.cpp
src/bin/lttng-relayd/main.cpp
src/bin/lttng-relayd/session.cpp
src/bin/lttng-relayd/sessiond-trace-chunks.cpp
src/bin/lttng-relayd/stream.cpp
src/bin/lttng-relayd/tcp_keep_alive.cpp
src/bin/lttng-relayd/thread-utils.cpp
src/bin/lttng-relayd/tracefile-array.cpp
src/bin/lttng-relayd/utils.cpp
src/bin/lttng-relayd/viewer-session.cpp
src/bin/lttng-relayd/viewer-stream.cpp
src/bin/lttng-sessiond/action-executor.cpp
src/bin/lttng-sessiond/agent-thread.cpp
src/bin/lttng-sessiond/agent.cpp
src/bin/lttng-sessiond/buffer-registry.cpp
src/bin/lttng-sessiond/channel.cpp
src/bin/lttng-sessiond/clear.cpp
src/bin/lttng-sessiond/client.cpp
src/bin/lttng-sessiond/clock-class.cpp
src/bin/lttng-sessiond/cmd.cpp
src/bin/lttng-sessiond/condition-internal.cpp
src/bin/lttng-sessiond/consumer.cpp
src/bin/lttng-sessiond/context.cpp
src/bin/lttng-sessiond/ctf2-trace-class-visitor.cpp
src/bin/lttng-sessiond/dispatch.cpp
src/bin/lttng-sessiond/event-class.cpp
src/bin/lttng-sessiond/event-notifier-error-accounting.cpp
src/bin/lttng-sessiond/event.cpp
src/bin/lttng-sessiond/fd-limit.cpp
src/bin/lttng-sessiond/field.cpp
src/bin/lttng-sessiond/globals.cpp
src/bin/lttng-sessiond/health.cpp
src/bin/lttng-sessiond/kernel-consumer.cpp
src/bin/lttng-sessiond/kernel.cpp
src/bin/lttng-sessiond/lttng-syscall.cpp
src/bin/lttng-sessiond/main.cpp
src/bin/lttng-sessiond/manage-apps.cpp
src/bin/lttng-sessiond/manage-consumer.cpp
src/bin/lttng-sessiond/manage-kernel.cpp
src/bin/lttng-sessiond/modprobe.cpp
src/bin/lttng-sessiond/notification-thread-commands.cpp
src/bin/lttng-sessiond/notification-thread-events.cpp
src/bin/lttng-sessiond/notification-thread.cpp
src/bin/lttng-sessiond/notify-apps.cpp
src/bin/lttng-sessiond/process-utils.cpp
src/bin/lttng-sessiond/register.cpp
src/bin/lttng-sessiond/rotate.cpp
src/bin/lttng-sessiond/rotation-thread.cpp
src/bin/lttng-sessiond/save.cpp
src/bin/lttng-sessiond/session.cpp
src/bin/lttng-sessiond/sessiond-config.cpp
src/bin/lttng-sessiond/snapshot.cpp
src/bin/lttng-sessiond/stream-class.cpp
src/bin/lttng-sessiond/thread-utils.cpp
src/bin/lttng-sessiond/thread.cpp
src/bin/lttng-sessiond/timer.cpp
src/bin/lttng-sessiond/trace-class.cpp
src/bin/lttng-sessiond/trace-kernel.cpp
src/bin/lttng-sessiond/trace-ust.cpp
src/bin/lttng-sessiond/tracker.cpp
src/bin/lttng-sessiond/trigger-error-query.cpp
src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp
src/bin/lttng-sessiond/ust-app.cpp
src/bin/lttng-sessiond/ust-clock-class.cpp
src/bin/lttng-sessiond/ust-consumer.cpp
src/bin/lttng-sessiond/ust-field-convert.cpp
src/bin/lttng-sessiond/ust-metadata.cpp
src/bin/lttng-sessiond/ust-registry-channel.cpp
src/bin/lttng-sessiond/ust-registry-event.cpp
src/bin/lttng-sessiond/ust-registry-session-pid.cpp
src/bin/lttng-sessiond/ust-registry-session-uid.cpp
src/bin/lttng-sessiond/ust-registry-session.cpp
src/bin/lttng-sessiond/ust-registry.cpp
src/bin/lttng-sessiond/ust-sigbus.cpp
src/bin/lttng-sessiond/utils.cpp
src/bin/lttng/commands/add_context.cpp
src/bin/lttng/commands/add_trigger.cpp
src/bin/lttng/commands/clear.cpp
src/bin/lttng/commands/create.cpp
src/bin/lttng/commands/destroy.cpp
src/bin/lttng/commands/disable_channels.cpp
src/bin/lttng/commands/disable_events.cpp
src/bin/lttng/commands/disable_rotation.cpp
src/bin/lttng/commands/enable_channels.cpp
src/bin/lttng/commands/enable_events.cpp
src/bin/lttng/commands/enable_rotation.cpp
src/bin/lttng/commands/help.cpp
src/bin/lttng/commands/list.cpp
src/bin/lttng/commands/list_triggers.cpp
src/bin/lttng/commands/load.cpp
src/bin/lttng/commands/metadata.cpp
src/bin/lttng/commands/regenerate.cpp
src/bin/lttng/commands/remove_trigger.cpp
src/bin/lttng/commands/rotate.cpp
src/bin/lttng/commands/save.cpp
src/bin/lttng/commands/set_session.cpp
src/bin/lttng/commands/snapshot.cpp
src/bin/lttng/commands/start.cpp
src/bin/lttng/commands/status.cpp
src/bin/lttng/commands/stop.cpp
src/bin/lttng/commands/track-untrack.cpp
src/bin/lttng/commands/version.cpp
src/bin/lttng/commands/view.cpp
src/bin/lttng/conf.cpp
src/bin/lttng/loglevel.cpp
src/bin/lttng/lttng.cpp
src/bin/lttng/uprobe.cpp
src/bin/lttng/utils.cpp
src/common/actions/action.cpp
src/common/actions/list.cpp
src/common/actions/notify.cpp
src/common/actions/path.cpp
src/common/actions/rate-policy.cpp
src/common/actions/rotate-session.cpp
src/common/actions/snapshot-session.cpp
src/common/actions/start-session.cpp
src/common/actions/stop-session.cpp
src/common/argpar-utils/argpar-utils.cpp
src/common/buffer-view.cpp
src/common/bytecode/bytecode.cpp
src/common/channel.cpp
src/common/compat/compat-fcntl.cpp
src/common/compat/directory-handle.cpp
src/common/compat/poll.cpp
src/common/conditions/buffer-usage.cpp
src/common/conditions/condition.cpp
src/common/conditions/event-rule-matches.cpp
src/common/conditions/session-consumed-size.cpp
src/common/conditions/session-rotation.cpp
src/common/config/session-config.cpp
src/common/consumer/consumer-metadata-cache.cpp
src/common/consumer/consumer-stream.cpp
src/common/consumer/consumer-timer.cpp
src/common/consumer/consumer.cpp
src/common/consumer/metadata-bucket.cpp
src/common/context.cpp
src/common/credentials.cpp
src/common/daemonize.cpp
src/common/defaults.cpp
src/common/domain.cpp
src/common/dynamic-array.cpp
src/common/dynamic-buffer.cpp
src/common/endpoint.cpp
src/common/error-query.cpp
src/common/error.cpp
src/common/evaluation.cpp
src/common/event-expr/event-expr.cpp
src/common/event-field-value.cpp
src/common/event-rule/event-rule.cpp
src/common/event-rule/jul-logging.cpp
src/common/event-rule/kernel-kprobe.cpp
src/common/event-rule/kernel-syscall.cpp
src/common/event-rule/kernel-tracepoint.cpp
src/common/event-rule/kernel-uprobe.cpp
src/common/event-rule/log4j-logging.cpp
src/common/event-rule/python-logging.cpp
src/common/event-rule/user-tracepoint.cpp
src/common/event.cpp
src/common/exception.cpp
src/common/fd-handle.cpp
src/common/fd-tracker/fd-tracker.cpp
src/common/fd-tracker/inode.cpp
src/common/fd-tracker/utils-poll.cpp
src/common/fd-tracker/utils.cpp
src/common/filter-grammar-test.cpp
src/common/filter.cpp
src/common/filter/filter-visitor-generate-bytecode.cpp
src/common/filter/filter-visitor-generate-ir.cpp
src/common/filter/filter-visitor-ir-check-binary-comparator.cpp
src/common/filter/filter-visitor-ir-check-binary-op-nesting.cpp
src/common/filter/filter-visitor-ir-normalize-glob-patterns.cpp
src/common/filter/filter-visitor-ir-validate-globbing.cpp
src/common/filter/filter-visitor-ir-validate-string.cpp
src/common/filter/filter-visitor-xml.cpp
src/common/futex.cpp
src/common/hashtable/hashtable.cpp
src/common/hashtable/utils.cpp
src/common/health/health.cpp
src/common/index-allocator.cpp
src/common/index/index.cpp
src/common/ini-config/ini-config.cpp
src/common/ini-config/ini.cpp
src/common/kernel-consumer/kernel-consumer.cpp
src/common/kernel-ctl/kernel-ctl.cpp
src/common/kernel-probe.cpp
src/common/location.cpp
src/common/log-level-rule.cpp
src/common/lttng-elf.cpp
src/common/mi-lttng.cpp
src/common/notification.cpp
src/common/path.cpp
src/common/payload-view.cpp
src/common/payload.cpp
src/common/pipe.cpp
src/common/random.cpp
src/common/readwrite.cpp
src/common/relayd/relayd.cpp
src/common/runas.cpp
src/common/session-descriptor.cpp
src/common/sessiond-comm/inet.cpp
src/common/sessiond-comm/inet6.cpp
src/common/sessiond-comm/sessiond-comm.cpp
src/common/shm.cpp
src/common/snapshot.cpp
src/common/spawn-viewer.cpp
src/common/string-utils/string-utils.cpp
src/common/testpoint/testpoint.cpp
src/common/thread.cpp
src/common/time.cpp
src/common/trace-chunk.cpp
src/common/tracker.cpp
src/common/trigger.cpp
src/common/unix.cpp
src/common/uri.cpp
src/common/userspace-probe.cpp
src/common/ust-consumer/ust-consumer.cpp
src/common/utils.cpp
src/common/uuid.cpp
src/common/waiter.cpp
src/lib/lttng-ctl/channel.cpp
src/lib/lttng-ctl/clear.cpp
src/lib/lttng-ctl/deprecated-symbols.cpp
src/lib/lttng-ctl/destruction-handle.cpp
src/lib/lttng-ctl/event.cpp
src/lib/lttng-ctl/load.cpp
src/lib/lttng-ctl/lttng-ctl-health.cpp
src/lib/lttng-ctl/lttng-ctl.cpp
src/lib/lttng-ctl/rotate.cpp
src/lib/lttng-ctl/save.cpp
src/lib/lttng-ctl/snapshot.cpp
src/lib/lttng-ctl/tracker.cpp
tests/regression/kernel/select_poll_epoll.cpp
tests/regression/tools/live/live_test.cpp
tests/regression/tools/notification/consumer_testpoints.cpp
tests/regression/tools/notification/default_pipe_size_getter.cpp
tests/regression/tools/notification/notification.cpp
tests/regression/tools/notification/sessiond_testpoints.cpp
tests/regression/tools/trigger/hidden/hidden_trigger.cpp
tests/regression/tools/trigger/name/trigger_name.cpp
tests/regression/tools/trigger/utils/register-some-triggers.cpp
tests/unit/ini_config/ini_config.cpp
tests/unit/test_action.cpp
tests/unit/test_buffer_view.cpp
tests/unit/test_condition.cpp
tests/unit/test_directory_handle.cpp
tests/unit/test_event_expr_to_bytecode.cpp
tests/unit/test_event_rule.cpp
tests/unit/test_fd_tracker.cpp
tests/unit/test_kernel_data.cpp
tests/unit/test_kernel_probe.cpp
tests/unit/test_log_level_rule.cpp
tests/unit/test_notification.cpp
tests/unit/test_payload.cpp
tests/unit/test_rate_policy.cpp
tests/unit/test_relayd_backward_compat_group_by_session.cpp
tests/unit/test_session.cpp
tests/unit/test_string_utils.cpp
tests/unit/test_unix_socket.cpp
tests/unit/test_uri.cpp
tests/unit/test_ust_data.cpp
tests/unit/test_utils_compat_poll.cpp
tests/unit/test_utils_compat_pthread.cpp
tests/unit/test_utils_expand_path.cpp
tests/unit/test_utils_parse_size_suffix.cpp
tests/unit/test_utils_parse_time_suffix.cpp
tests/unit/test_uuid.cpp
tests/utils/testapp/gen-ns-events/gen-ns-events.cpp
tests/utils/testapp/gen-syscall-events/gen-syscall-events.cpp
tests/utils/testapp/gen-ust-events-ns/gen-ust-events-ns.cpp
tests/utils/testapp/gen-ust-events/gen-ust-events.cpp
tests/utils/testapp/gen-ust-nevents-str/gen-ust-nevents-str.cpp
tests/utils/testapp/gen-ust-nevents/gen-ust-nevents.cpp
tests/utils/testapp/gen-ust-tracef/gen-ust-tracef.cpp
tests/utils/testapp/userspace-probe-elf-cxx-binary/test_class.cpp
tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary.cpp
tests/utils/utils.cpp
tests/utils/xml-utils/extract_xml.cpp
tests/utils/xml-utils/validate_xml.cpp

index bce5d815d991590bde3a54ce60f0fde228894f29..91a1d0711a86fdca19657fed6e89306e45cb19b4 100644 (file)
@@ -5,6 +5,8 @@
  *
  */
 
+#include <common/macros.hpp>
+
 #include <lttng/lttng.h>
 
 #include <inttypes.h>
 #include <sys/time.h>
 #include <time.h>
 
-#include <common/macros.hpp>
-
 static int print_capture(const struct lttng_condition *condition,
-               const struct lttng_event_field_value *capture,
-               unsigned int indent_level);
+                        const struct lttng_event_field_value *capture,
+                        unsigned int indent_level);
 static int print_array(const struct lttng_condition *condition,
-               const struct lttng_event_field_value *array,
-               unsigned int indent_level);
+                      const struct lttng_event_field_value *array,
+                      unsigned int indent_level);
 
 static void indent(unsigned int indentation_level)
 {
@@ -44,8 +44,7 @@ static void print_one_event_expr(const struct lttng_event_expr *event_expr)
        {
                const char *name;
 
-               name = lttng_event_expr_event_payload_field_get_name(
-                               event_expr);
+               name = lttng_event_expr_event_payload_field_get_name(event_expr);
                printf("%s", name);
 
                break;
@@ -55,8 +54,7 @@ static void print_one_event_expr(const struct lttng_event_expr *event_expr)
        {
                const char *name;
 
-               name = lttng_event_expr_channel_context_field_get_name(
-                               event_expr);
+               name = lttng_event_expr_channel_context_field_get_name(event_expr);
                printf("$ctx.%s", name);
 
                break;
@@ -67,10 +65,9 @@ static void print_one_event_expr(const struct lttng_event_expr *event_expr)
                const char *provider_name;
                const char *type_name;
 
-               provider_name = lttng_event_expr_app_specific_context_field_get_provider_name(
-                               event_expr);
-               type_name = lttng_event_expr_app_specific_context_field_get_type_name(
-                               event_expr);
+               provider_name =
+                       lttng_event_expr_app_specific_context_field_get_provider_name(event_expr);
+               type_name = lttng_event_expr_app_specific_context_field_get_type_name(event_expr);
 
                printf("$app.%s:%s", provider_name, type_name);
 
@@ -83,14 +80,12 @@ static void print_one_event_expr(const struct lttng_event_expr *event_expr)
                const struct lttng_event_expr *parent_expr;
                enum lttng_event_expr_status status;
 
-               parent_expr = lttng_event_expr_array_field_element_get_parent_expr(
-                               event_expr);
+               parent_expr = lttng_event_expr_array_field_element_get_parent_expr(event_expr);
                LTTNG_ASSERT(parent_expr != NULL);
 
                print_one_event_expr(parent_expr);
 
-               status = lttng_event_expr_array_field_element_get_index(
-                               event_expr, &index);
+               status = lttng_event_expr_array_field_element_get_index(event_expr, &index);
                LTTNG_ASSERT(status == LTTNG_EVENT_EXPR_STATUS_OK);
 
                printf("[%u]", index);
@@ -103,12 +98,10 @@ static void print_one_event_expr(const struct lttng_event_expr *event_expr)
        }
 }
 
-static bool action_group_contains_notify(
-               const struct lttng_action *action_group)
+static bool action_group_contains_notify(const struct lttng_action *action_group)
 {
        unsigned int i, count;
-       enum lttng_action_status status =
-                       lttng_action_list_get_count(action_group, &count);
+       enum lttng_action_status status = lttng_action_list_get_count(action_group, &count);
 
        if (status != LTTNG_ACTION_STATUS_OK) {
                printf("Failed to get action count from action group\n");
@@ -116,10 +109,8 @@ static bool action_group_contains_notify(
        }
 
        for (i = 0; i < count; i++) {
-               const struct lttng_action *action =
-                               lttng_action_list_get_at_index(action_group, i);
-               const enum lttng_action_type action_type =
-                               lttng_action_get_type(action);
+               const struct lttng_action *action = lttng_action_list_get_at_index(action_group, i);
+               const enum lttng_action_type action_type = lttng_action_get_type(action);
 
                if (action_type == LTTNG_ACTION_TYPE_NOTIFY) {
                        return true;
@@ -129,8 +120,8 @@ static bool action_group_contains_notify(
 }
 
 static int print_capture(const struct lttng_condition *condition,
-               const struct lttng_event_field_value *capture,
-               unsigned int indent_level)
+                        const struct lttng_event_field_value *capture,
+                        unsigned int indent_level)
 {
        int ret = 0;
        enum lttng_event_field_value_status event_field_status;
@@ -143,8 +134,7 @@ static int print_capture(const struct lttng_condition *condition,
        case LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT:
        {
                event_field_status =
-                               lttng_event_field_value_unsigned_int_get_value(
-                                               capture, &u_val);
+                       lttng_event_field_value_unsigned_int_get_value(capture, &u_val);
                if (event_field_status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                        ret = 1;
                        goto end;
@@ -155,9 +145,7 @@ static int print_capture(const struct lttng_condition *condition,
        }
        case LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT:
        {
-               event_field_status =
-                               lttng_event_field_value_signed_int_get_value(
-                                               capture, &s_val);
+               event_field_status = lttng_event_field_value_signed_int_get_value(capture, &s_val);
                if (event_field_status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                        ret = 1;
                        goto end;
@@ -169,8 +157,7 @@ static int print_capture(const struct lttng_condition *condition,
        case LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM:
        {
                event_field_status =
-                               lttng_event_field_value_unsigned_int_get_value(
-                                               capture, &u_val);
+                       lttng_event_field_value_unsigned_int_get_value(capture, &u_val);
                if (event_field_status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                        ret = 1;
                        goto end;
@@ -181,9 +168,7 @@ static int print_capture(const struct lttng_condition *condition,
        }
        case LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM:
        {
-               event_field_status =
-                               lttng_event_field_value_signed_int_get_value(
-                                               capture, &s_val);
+               event_field_status = lttng_event_field_value_signed_int_get_value(capture, &s_val);
                if (event_field_status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                        ret = 1;
                        goto end;
@@ -194,8 +179,7 @@ static int print_capture(const struct lttng_condition *condition,
        }
        case LTTNG_EVENT_FIELD_VALUE_TYPE_REAL:
        {
-               event_field_status = lttng_event_field_value_real_get_value(
-                               capture, &d_val);
+               event_field_status = lttng_event_field_value_real_get_value(capture, &d_val);
                if (event_field_status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                        ret = 1;
                        goto end;
@@ -206,8 +190,7 @@ static int print_capture(const struct lttng_condition *condition,
        }
        case LTTNG_EVENT_FIELD_VALUE_TYPE_STRING:
        {
-               event_field_status = lttng_event_field_value_string_get_value(
-                               capture, &string_val);
+               event_field_status = lttng_event_field_value_string_get_value(capture, &string_val);
                if (event_field_status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                        ret = 1;
                        goto end;
@@ -239,15 +222,14 @@ static void print_unavailabe(void)
 }
 
 static int print_array(const struct lttng_condition *condition,
-               const struct lttng_event_field_value *array,
-               unsigned int indent_level)
+                      const struct lttng_event_field_value *array,
+                      unsigned int indent_level)
 {
        int ret = 0;
        enum lttng_event_field_value_status event_field_status;
        unsigned int captured_field_count;
 
-       event_field_status = lttng_event_field_value_array_get_length(
-                       array, &captured_field_count);
+       event_field_status = lttng_event_field_value_array_get_length(array, &captured_field_count);
        if (event_field_status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                ret = 1;
                goto end;
@@ -256,8 +238,8 @@ static int print_array(const struct lttng_condition *condition,
        for (unsigned int i = 0; i < captured_field_count; i++) {
                const struct lttng_event_field_value *captured_field = NULL;
                const struct lttng_event_expr *expr =
-                               lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
-                                               condition, i);
+                       lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
+                               condition, i);
                LTTNG_ASSERT(expr);
 
                indent(indent_level + 1);
@@ -266,20 +248,17 @@ static int print_array(const struct lttng_condition *condition,
                print_one_event_expr(expr);
                printf(" Value: ");
 
-               event_field_status =
-                               lttng_event_field_value_array_get_element_at_index(
-                                               array, i, &captured_field);
+               event_field_status = lttng_event_field_value_array_get_element_at_index(
+                       array, i, &captured_field);
                if (event_field_status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
-                       if (event_field_status ==
-                                       LTTNG_EVENT_FIELD_VALUE_STATUS_UNAVAILABLE) {
+                       if (event_field_status == LTTNG_EVENT_FIELD_VALUE_STATUS_UNAVAILABLE) {
                                print_unavailabe();
                        } else {
                                ret = 1;
                                goto end;
                        }
                } else {
-                       print_capture(condition, captured_field,
-                                       indent_level + 1);
+                       print_capture(condition, captured_field, indent_level + 1);
                }
 
                if (i + 1 < captured_field_count) {
@@ -297,10 +276,8 @@ end:
 static int print_captures(struct lttng_notification *notification)
 {
        int ret = 0;
-       const struct lttng_evaluation *evaluation =
-                       lttng_notification_get_evaluation(notification);
-       const struct lttng_condition *condition =
-                       lttng_notification_get_condition(notification);
+       const struct lttng_evaluation *evaluation = lttng_notification_get_evaluation(notification);
+       const struct lttng_condition *condition = lttng_notification_get_condition(notification);
 
        /* Status */
        enum lttng_condition_status condition_status;
@@ -310,12 +287,10 @@ static int print_captures(struct lttng_notification *notification)
        unsigned int expected_capture_field_count;
 
        LTTNG_ASSERT(lttng_evaluation_get_type(evaluation) ==
-                       LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
+                    LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
 
-       condition_status =
-                       lttng_condition_event_rule_matches_get_capture_descriptor_count(
-                                       condition,
-                                       &expected_capture_field_count);
+       condition_status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
+               condition, &expected_capture_field_count);
        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
                ret = 1;
                goto end;
@@ -326,9 +301,8 @@ static int print_captures(struct lttng_notification *notification)
                goto end;
        }
 
-       evaluation_status =
-                       lttng_evaluation_event_rule_matches_get_captured_values(
-                                       evaluation, &captured_field_array);
+       evaluation_status = lttng_evaluation_event_rule_matches_get_captured_values(
+               evaluation, &captured_field_array);
        if (evaluation_status != LTTNG_EVALUATION_EVENT_RULE_MATCHES_STATUS_OK) {
                ret = 1;
                goto end;
@@ -343,10 +317,8 @@ end:
 static int print_notification(struct lttng_notification *notification)
 {
        int ret = 0;
-       const struct lttng_evaluation *evaluation =
-                       lttng_notification_get_evaluation(notification);
-       const enum lttng_condition_type type =
-                       lttng_evaluation_get_type(evaluation);
+       const struct lttng_evaluation *evaluation = lttng_notification_get_evaluation(notification);
+       const enum lttng_condition_type type = lttng_evaluation_get_type(evaluation);
 
        switch (type) {
        case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE:
@@ -374,8 +346,7 @@ static int print_notification(struct lttng_notification *notification)
                gettimeofday(&tv, NULL);
                the_time = tv.tv_sec;
 
-               strftime(time_str, sizeof(time_str), "[%m-%d-%Y] %T",
-                               localtime(&the_time));
+               strftime(time_str, sizeof(time_str), "[%m-%d-%Y] %T", localtime(&the_time));
                printf("%s.%ld - ", time_str, tv.tv_usec);
 
                trigger = lttng_notification_get_trigger(notification);
@@ -391,7 +362,7 @@ static int print_notification(struct lttng_notification *notification)
                }
 
                printf("Received notification of event rule matches trigger \"%s\"\n",
-                               trigger_name);
+                      trigger_name);
                ret = print_captures(notification);
                break;
        }
@@ -420,8 +391,8 @@ int main(int argc, char **argv)
 
        trigger_count = argc - 1;
 
-       notification_channel = lttng_notification_channel_create(
-                       lttng_session_daemon_notification_endpoint);
+       notification_channel =
+               lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
        if (!notification_channel) {
                fprintf(stderr, "Failed to create notification channel\n");
                ret = -1;
@@ -442,14 +413,11 @@ int main(int argc, char **argv)
        }
 
        for (i = 0; i < count; i++) {
-               const struct lttng_trigger *trigger =
-                               lttng_triggers_get_at_index(triggers, i);
+               const struct lttng_trigger *trigger = lttng_triggers_get_at_index(triggers, i);
                const struct lttng_condition *condition =
-                               lttng_trigger_get_const_condition(trigger);
-               const struct lttng_action *action =
-                               lttng_trigger_get_const_action(trigger);
-               const enum lttng_action_type action_type =
-                               lttng_action_get_type(action);
+                       lttng_trigger_get_const_condition(trigger);
+               const struct lttng_action *action = lttng_trigger_get_const_action(trigger);
+               const enum lttng_action_type action_type = lttng_action_get_type(action);
                enum lttng_notification_channel_status channel_status;
                const char *trigger_name = NULL;
                bool subscribe = false;
@@ -467,28 +435,27 @@ int main(int argc, char **argv)
                }
 
                if (!((action_type == LTTNG_ACTION_TYPE_LIST &&
-                                     action_group_contains_notify(action)) ||
-                                   action_type == LTTNG_ACTION_TYPE_NOTIFY)) {
+                      action_group_contains_notify(action)) ||
+                     action_type == LTTNG_ACTION_TYPE_NOTIFY)) {
                        printf("The action of trigger \"%s\" is not \"notify\", skipping.\n",
-                                       trigger_name);
+                              trigger_name);
                        continue;
                }
 
-               channel_status = lttng_notification_channel_subscribe(
-                               notification_channel, condition);
-               if (channel_status ==
-                               LTTNG_NOTIFICATION_CHANNEL_STATUS_ALREADY_SUBSCRIBED) {
+               channel_status =
+                       lttng_notification_channel_subscribe(notification_channel, condition);
+               if (channel_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_ALREADY_SUBSCRIBED) {
                        continue;
                }
                if (channel_status) {
-                       fprintf(stderr, "Failed to subscribe to notifications of trigger \"%s\"\n",
-                                       trigger_name);
+                       fprintf(stderr,
+                               "Failed to subscribe to notifications of trigger \"%s\"\n",
+                               trigger_name);
                        ret = -1;
                        goto end;
                }
 
-               printf("Subscribed to notifications of trigger \"%s\"\n",
-                               trigger_name);
+               printf("Subscribed to notifications of trigger \"%s\"\n", trigger_name);
                subcription_count++;
        }
 
@@ -502,10 +469,8 @@ int main(int argc, char **argv)
                struct lttng_notification *notification;
                enum lttng_notification_channel_status channel_status;
 
-               channel_status =
-                               lttng_notification_channel_get_next_notification(
-                                               notification_channel,
-                                               &notification);
+               channel_status = lttng_notification_channel_get_next_notification(
+                       notification_channel, &notification);
                switch (channel_status) {
                case LTTNG_NOTIFICATION_CHANNEL_STATUS_NOTIFICATIONS_DROPPED:
                        printf("Dropped notification\n");
@@ -524,7 +489,8 @@ int main(int argc, char **argv)
                        printf("Notification channel was closed by peer.\n");
                        break;
                default:
-                       fprintf(stderr, "A communication error occurred on the notification channel.\n");
+                       fprintf(stderr,
+                               "A communication error occurred on the notification channel.\n");
                        ret = -1;
                        goto end;
                }
index f8be972c595986fae6c4aca3b3363a59dc39dcf3..fc4988d682e149f2ad5d774f2b683ff0627885a2 100644 (file)
@@ -6,44 +6,44 @@
  */
 
 #define _LGPL_SOURCE
+#include "health-consumerd.hpp"
+#include "lttng-consumerd.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/poll.hpp>
+#include <common/consumer/consumer-timer.hpp>
+#include <common/consumer/consumer.hpp>
+#include <common/defaults.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/utils.hpp>
+
 #include <fcntl.h>
 #include <getopt.h>
 #include <grp.h>
+#include <inttypes.h>
 #include <limits.h>
+#include <poll.h>
 #include <pthread.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ipc.h>
+#include <sys/mman.h>
 #include <sys/resource.h>
 #include <sys/shm.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <urcu/list.h>
-#include <poll.h>
+#include <ulimit.h>
 #include <unistd.h>
-#include <sys/mman.h>
 #include <urcu/compiler.h>
-#include <ulimit.h>
-#include <inttypes.h>
-
-#include <common/defaults.hpp>
-#include <common/common.hpp>
-#include <common/consumer/consumer.hpp>
-#include <common/consumer/consumer-timer.hpp>
-#include <common/compat/poll.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/utils.hpp>
-
-#include "lttng-consumerd.hpp"
-#include "health-consumerd.hpp"
+#include <urcu/list.h>
 
 /* Global health check unix path */
 static char health_unix_sock_path[PATH_MAX];
 
-int health_quit_pipe[2] = {-1, -1};
+int health_quit_pipe[2] = { -1, -1 };
 
 /*
  * Send data on a unix socket using the liblttsessiondcomm API.
@@ -60,8 +60,7 @@ static int send_unix_sock(int sock, void *buf, size_t len)
        return lttcomm_send_unix_sock(sock, buf, len);
 }
 
-static
-int setup_health_path(void)
+static int setup_health_path(void)
 {
        int is_root, ret = 0;
        enum lttng_consumer_type type;
@@ -76,16 +75,19 @@ int setup_health_path(void)
                }
                switch (type) {
                case LTTNG_CONSUMER_KERNEL:
-                       snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                               DEFAULT_GLOBAL_KCONSUMER_HEALTH_UNIX_SOCK);
+                       snprintf(health_unix_sock_path,
+                                sizeof(health_unix_sock_path),
+                                DEFAULT_GLOBAL_KCONSUMER_HEALTH_UNIX_SOCK);
                        break;
                case LTTNG_CONSUMER64_UST:
-                       snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                               DEFAULT_GLOBAL_USTCONSUMER64_HEALTH_UNIX_SOCK);
+                       snprintf(health_unix_sock_path,
+                                sizeof(health_unix_sock_path),
+                                DEFAULT_GLOBAL_USTCONSUMER64_HEALTH_UNIX_SOCK);
                        break;
                case LTTNG_CONSUMER32_UST:
-                       snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                               DEFAULT_GLOBAL_USTCONSUMER32_HEALTH_UNIX_SOCK);
+                       snprintf(health_unix_sock_path,
+                                sizeof(health_unix_sock_path),
+                                DEFAULT_GLOBAL_USTCONSUMER32_HEALTH_UNIX_SOCK);
                        break;
                default:
                        ret = -EINVAL;
@@ -106,16 +108,22 @@ int setup_health_path(void)
                }
                switch (type) {
                case LTTNG_CONSUMER_KERNEL:
-                       snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                               DEFAULT_HOME_KCONSUMER_HEALTH_UNIX_SOCK, home_path);
+                       snprintf(health_unix_sock_path,
+                                sizeof(health_unix_sock_path),
+                                DEFAULT_HOME_KCONSUMER_HEALTH_UNIX_SOCK,
+                                home_path);
                        break;
                case LTTNG_CONSUMER64_UST:
-                       snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                               DEFAULT_HOME_USTCONSUMER64_HEALTH_UNIX_SOCK, home_path);
+                       snprintf(health_unix_sock_path,
+                                sizeof(health_unix_sock_path),
+                                DEFAULT_HOME_USTCONSUMER64_HEALTH_UNIX_SOCK,
+                                home_path);
                        break;
                case LTTNG_CONSUMER32_UST:
-                       snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                               DEFAULT_HOME_USTCONSUMER32_HEALTH_UNIX_SOCK, home_path);
+                       snprintf(health_unix_sock_path,
+                                sizeof(health_unix_sock_path),
+                                DEFAULT_HOME_USTCONSUMER32_HEALTH_UNIX_SOCK,
+                                home_path);
                        break;
                default:
                        ret = -EINVAL;
@@ -174,8 +182,7 @@ void *thread_manage_health_consumerd(void *data __attribute__((unused)))
                        goto error;
                }
 
-               ret = chmod(health_unix_sock_path,
-                               S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+               ret = chmod(health_unix_sock_path, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
                if (ret < 0) {
                        ERR("Unable to set permissions on %s", health_unix_sock_path);
                        PERROR("chmod");
@@ -221,7 +228,7 @@ void *thread_manage_health_consumerd(void *data __attribute__((unused)))
                DBG("Health check ready");
 
                /* Inifinite blocking call, waiting for transmission */
-restart:
+       restart:
                ret = lttng_poll_wait(&events, -1);
                if (ret < 0) {
                        /*
@@ -249,8 +256,8 @@ restart:
 
                        /* Event on the registration socket */
                        if (pollfd == sock) {
-                               if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)
-                                               && !(revents & LPOLLIN)) {
+                               if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP) &&
+                                   !(revents & LPOLLIN)) {
                                        ERR("Health socket poll error");
                                        goto error;
                                }
@@ -269,7 +276,7 @@ restart:
                (void) utils_set_fd_cloexec(new_sock);
 
                DBG("Receiving data from client for health...");
-               ret = lttcomm_recv_unix_sock(new_sock, (void *)&msg, sizeof(msg));
+               ret = lttcomm_recv_unix_sock(new_sock, (void *) &msg, sizeof(msg));
                if (ret <= 0) {
                        DBG("Nothing recv() from client... continuing");
                        ret = close(new_sock);
index a8bda52ba7bdccf74ccea7e5339a0b7855bfc7c8..407545d8aa1ddc8821ea35155ba07ae96424fa90 100644 (file)
@@ -7,53 +7,53 @@
  */
 
 #define _LGPL_SOURCE
+#include "health-consumerd.hpp"
+#include "lttng-consumerd.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/getenv.hpp>
+#include <common/compat/poll.hpp>
+#include <common/consumer/consumer-timer.hpp>
+#include <common/consumer/consumer.hpp>
+#include <common/defaults.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/utils.hpp>
+
 #include <fcntl.h>
 #include <getopt.h>
 #include <grp.h>
 #include <limits.h>
+#include <poll.h>
 #include <pthread.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ipc.h>
+#include <sys/mman.h>
 #include <sys/resource.h>
 #include <sys/shm.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <urcu/list.h>
-#include <poll.h>
+#include <ulimit.h>
 #include <unistd.h>
-#include <sys/mman.h>
 #include <urcu/compiler.h>
-#include <ulimit.h>
-
-#include <common/defaults.hpp>
-#include <common/common.hpp>
-#include <common/consumer/consumer.hpp>
-#include <common/consumer/consumer-timer.hpp>
-#include <common/compat/poll.hpp>
-#include <common/compat/getenv.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/utils.hpp>
-
-#include "lttng-consumerd.hpp"
-#include "health-consumerd.hpp"
+#include <urcu/list.h>
 
 /* threads (channel handling, poll, metadata, sessiond) */
 
-static pthread_t channel_thread, data_thread, metadata_thread,
-               sessiond_thread, metadata_timer_thread, health_thread;
+static pthread_t channel_thread, data_thread, metadata_thread, sessiond_thread,
+       metadata_timer_thread, health_thread;
 static bool metadata_timer_thread_online;
 
 /* to count the number of times the user pressed ctrl+c */
 static int sigintcount = 0;
 
 /* Argument variables */
-int lttng_opt_quiet;    /* not static in error.h */
-int lttng_opt_verbose;  /* not static in error.h */
-int lttng_opt_mi;       /* not static in error.h */
+int lttng_opt_quiet; /* not static in error.h */
+int lttng_opt_verbose; /* not static in error.h */
+int lttng_opt_mi; /* not static in error.h */
 
 static int opt_daemon;
 static const char *progname;
@@ -82,8 +82,7 @@ enum lttng_consumer_type lttng_consumer_get_type(void)
 /*
  * Signal handler for the daemon
  */
-static void sighandler(int sig, siginfo_t *siginfo,
-               void *arg __attribute__((unused)))
+static void sighandler(int sig, siginfo_t *siginfo, void *arg __attribute__((unused)))
 {
        if (sig == SIGINT && sigintcount++ == 0) {
                DBG("ignoring first SIGINT");
@@ -162,32 +161,42 @@ static int set_signal_handler(void)
 static void usage(FILE *fp)
 {
        fprintf(fp, "Usage: %s OPTIONS\n\nOptions:\n", progname);
-       fprintf(fp, "  -h, --help                         "
-                       "Display this usage.\n");
-       fprintf(fp, "  -c, --consumerd-cmd-sock PATH      "
-                       "Specify path for the command socket\n");
-       fprintf(fp, "  -e, --consumerd-err-sock PATH      "
-                       "Specify path for the error socket\n");
-       fprintf(fp, "  -d, --daemonize                    "
-                       "Start as a daemon.\n");
-       fprintf(fp, "  -q, --quiet                        "
-                       "No output at all.\n");
-       fprintf(fp, "  -v, --verbose                      "
-                       "Verbose mode. Activate DBG() macro.\n");
-       fprintf(fp, "  -V, --version                      "
-                       "Show version number.\n");
-       fprintf(fp, "  -g, --group NAME                   "
-                       "Specify the tracing group name. (default: tracing)\n");
-       fprintf(fp, "  -k, --kernel                       "
-                       "Consumer kernel buffers (default).\n");
-       fprintf(fp, "  -u, --ust                          "
-                       "Consumer UST buffers.%s\n",
+       fprintf(fp,
+               "  -h, --help                         "
+               "Display this usage.\n");
+       fprintf(fp,
+               "  -c, --consumerd-cmd-sock PATH      "
+               "Specify path for the command socket\n");
+       fprintf(fp,
+               "  -e, --consumerd-err-sock PATH      "
+               "Specify path for the error socket\n");
+       fprintf(fp,
+               "  -d, --daemonize                    "
+               "Start as a daemon.\n");
+       fprintf(fp,
+               "  -q, --quiet                        "
+               "No output at all.\n");
+       fprintf(fp,
+               "  -v, --verbose                      "
+               "Verbose mode. Activate DBG() macro.\n");
+       fprintf(fp,
+               "  -V, --version                      "
+               "Show version number.\n");
+       fprintf(fp,
+               "  -g, --group NAME                   "
+               "Specify the tracing group name. (default: tracing)\n");
+       fprintf(fp,
+               "  -k, --kernel                       "
+               "Consumer kernel buffers (default).\n");
+       fprintf(fp,
+               "  -u, --ust                          "
+               "Consumer UST buffers.%s\n",
 #ifdef HAVE_LIBLTTNG_UST_CTL
-                       ""
+               ""
 #else
-                       " (support not compiled in)"
+               " (support not compiled in)"
 #endif
-                       );
+       );
 }
 
 /*
@@ -197,34 +206,35 @@ static int parse_args(int argc, char **argv)
 {
        int c, ret = 0;
 
-       static struct option long_options[] = {
-               { "consumerd-cmd-sock", 1, 0, 'c' },
-               { "consumerd-err-sock", 1, 0, 'e' },
-               { "daemonize", 0, 0, 'd' },
-               { "group", 1, 0, 'g' },
-               { "help", 0, 0, 'h' },
-               { "quiet", 0, 0, 'q' },
-               { "verbose", 0, 0, 'v' },
-               { "version", 0, 0, 'V' },
-               { "kernel", 0, 0, 'k' },
+       static struct option long_options[] = { { "consumerd-cmd-sock", 1, 0, 'c' },
+                                               { "consumerd-err-sock", 1, 0, 'e' },
+                                               { "daemonize", 0, 0, 'd' },
+                                               { "group", 1, 0, 'g' },
+                                               { "help", 0, 0, 'h' },
+                                               { "quiet", 0, 0, 'q' },
+                                               { "verbose", 0, 0, 'v' },
+                                               { "version", 0, 0, 'V' },
+                                               { "kernel", 0, 0, 'k' },
 #ifdef HAVE_LIBLTTNG_UST_CTL
-               { "ust", 0, 0, 'u' },
+                                               { "ust", 0, 0, 'u' },
 #endif
-               { NULL, 0, 0, 0 }
-       };
+                                               { NULL, 0, 0, 0 } };
 
        while (1) {
                int option_index = 0;
-               c = getopt_long(argc, argv, "dhqvVku" "c:e:g:",
-                               long_options, &option_index);
+               c = getopt_long(argc,
+                               argv,
+                               "dhqvVku"
+                               "c:e:g:",
+                               long_options,
+                               &option_index);
                if (c == -1) {
                        break;
                }
 
                switch (c) {
                case 0:
-                       fprintf(stderr, "option %s",
-                               long_options[option_index].name);
+                       fprintf(stderr, "option %s", long_options[option_index].name);
                        if (optarg) {
                                fprintf(stderr, " with arg %s\n", optarg);
                                ret = -1;
@@ -234,7 +244,7 @@ static int parse_args(int argc, char **argv)
                case 'c':
                        if (lttng_is_setuid_setgid()) {
                                WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                                       "-c, --consumerd-cmd-sock");
+                                    "-c, --consumerd-cmd-sock");
                        } else {
                                snprintf(command_sock_path, PATH_MAX, "%s", optarg);
                        }
@@ -242,7 +252,7 @@ static int parse_args(int argc, char **argv)
                case 'e':
                        if (lttng_is_setuid_setgid()) {
                                WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                                       "-e, --consumerd-err-sock");
+                                    "-e, --consumerd-err-sock");
                        } else {
                                snprintf(error_sock_path, PATH_MAX, "%s", optarg);
                        }
@@ -253,7 +263,7 @@ static int parse_args(int argc, char **argv)
                case 'g':
                        if (lttng_is_setuid_setgid()) {
                                WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                                       "-g, --group");
+                                    "-g, --group");
                        } else {
                                tracing_group_name = optarg;
                        }
@@ -275,13 +285,13 @@ static int parse_args(int argc, char **argv)
                        break;
 #ifdef HAVE_LIBLTTNG_UST_CTL
                case 'u':
-# if (CAA_BITS_PER_LONG == 64)
+#if (CAA_BITS_PER_LONG == 64)
                        opt_type = LTTNG_CONSUMER64_UST;
-# elif (CAA_BITS_PER_LONG == 32)
+#elif (CAA_BITS_PER_LONG == 32)
                        opt_type = LTTNG_CONSUMER32_UST;
-# else
-#  error "Unknown bitness"
-# endif
+#else
+#error "Unknown bitness"
+#endif
                        break;
 #endif
                default:
@@ -379,27 +389,30 @@ int main(int argc, char **argv)
        if (*command_sock_path == '\0') {
                switch (opt_type) {
                case LTTNG_CONSUMER_KERNEL:
-                       ret = snprintf(command_sock_path, PATH_MAX,
-                                       DEFAULT_KCONSUMERD_CMD_SOCK_PATH,
-                                       DEFAULT_LTTNG_RUNDIR);
+                       ret = snprintf(command_sock_path,
+                                      PATH_MAX,
+                                      DEFAULT_KCONSUMERD_CMD_SOCK_PATH,
+                                      DEFAULT_LTTNG_RUNDIR);
                        if (ret < 0) {
                                retval = -1;
                                goto exit_init_data;
                        }
                        break;
                case LTTNG_CONSUMER64_UST:
-                       ret = snprintf(command_sock_path, PATH_MAX,
-                                       DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH,
-                                       DEFAULT_LTTNG_RUNDIR);
+                       ret = snprintf(command_sock_path,
+                                      PATH_MAX,
+                                      DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH,
+                                      DEFAULT_LTTNG_RUNDIR);
                        if (ret < 0) {
                                retval = -1;
                                goto exit_init_data;
                        }
                        break;
                case LTTNG_CONSUMER32_UST:
-                       ret = snprintf(command_sock_path, PATH_MAX,
-                                       DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH,
-                                       DEFAULT_LTTNG_RUNDIR);
+                       ret = snprintf(command_sock_path,
+                                      PATH_MAX,
+                                      DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH,
+                                      DEFAULT_LTTNG_RUNDIR);
                        if (ret < 0) {
                                retval = -1;
                                goto exit_init_data;
@@ -429,8 +442,8 @@ int main(int argc, char **argv)
        }
 
        /* create the consumer instance with and assign the callbacks */
-       the_consumer_context = lttng_consumer_create(opt_type, lttng_consumer_read_subbuffer,
-               NULL, lttng_consumer_on_recv_stream, NULL);
+       the_consumer_context = lttng_consumer_create(
+               opt_type, lttng_consumer_read_subbuffer, NULL, lttng_consumer_on_recv_stream, NULL);
        if (!the_consumer_context) {
                retval = -1;
                goto exit_init_data;
@@ -440,27 +453,30 @@ int main(int argc, char **argv)
        if (*error_sock_path == '\0') {
                switch (opt_type) {
                case LTTNG_CONSUMER_KERNEL:
-                       ret = snprintf(error_sock_path, PATH_MAX,
-                                       DEFAULT_KCONSUMERD_ERR_SOCK_PATH,
-                                       DEFAULT_LTTNG_RUNDIR);
+                       ret = snprintf(error_sock_path,
+                                      PATH_MAX,
+                                      DEFAULT_KCONSUMERD_ERR_SOCK_PATH,
+                                      DEFAULT_LTTNG_RUNDIR);
                        if (ret < 0) {
                                retval = -1;
                                goto exit_init_data;
                        }
                        break;
                case LTTNG_CONSUMER64_UST:
-                       ret = snprintf(error_sock_path, PATH_MAX,
-                                       DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH,
-                                       DEFAULT_LTTNG_RUNDIR);
+                       ret = snprintf(error_sock_path,
+                                      PATH_MAX,
+                                      DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH,
+                                      DEFAULT_LTTNG_RUNDIR);
                        if (ret < 0) {
                                retval = -1;
                                goto exit_init_data;
                        }
                        break;
                case LTTNG_CONSUMER32_UST:
-                       ret = snprintf(error_sock_path, PATH_MAX,
-                                       DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH,
-                                       DEFAULT_LTTNG_RUNDIR);
+                       ret = snprintf(error_sock_path,
+                                      PATH_MAX,
+                                      DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH,
+                                      DEFAULT_LTTNG_RUNDIR);
                        if (ret < 0) {
                                retval = -1;
                                goto exit_init_data;
@@ -502,8 +518,10 @@ int main(int argc, char **argv)
        }
 
        /* Create thread to manage the client socket */
-       ret = pthread_create(&health_thread, default_pthread_attr(),
-                       thread_manage_health_consumerd, (void *) NULL);
+       ret = pthread_create(&health_thread,
+                            default_pthread_attr(),
+                            thread_manage_health_consumerd,
+                            (void *) NULL);
        if (ret) {
                errno = ret;
                PERROR("pthread_create health");
@@ -518,14 +536,14 @@ int main(int argc, char **argv)
        while (uatomic_read(&lttng_consumer_ready)) {
                usleep(100000);
        }
-       cmm_smp_mb();   /* Read ready before following operations */
+       cmm_smp_mb(); /* Read ready before following operations */
 
        /*
         * Create the thread to manage the UST metadata periodic timer and
         * live timer.
         */
-       ret = pthread_create(&metadata_timer_thread, NULL,
-                       consumer_timer_thread, (void *) the_consumer_context);
+       ret = pthread_create(
+               &metadata_timer_thread, NULL, consumer_timer_thread, (void *) the_consumer_context);
        if (ret) {
                errno = ret;
                PERROR("pthread_create");
@@ -535,9 +553,10 @@ int main(int argc, char **argv)
        metadata_timer_thread_online = true;
 
        /* Create thread to manage channels */
-       ret = pthread_create(&channel_thread, default_pthread_attr(),
-                       consumer_thread_channel_poll,
-                       (void *) the_consumer_context);
+       ret = pthread_create(&channel_thread,
+                            default_pthread_attr(),
+                            consumer_thread_channel_poll,
+                            (void *) the_consumer_context);
        if (ret) {
                errno = ret;
                PERROR("pthread_create");
@@ -546,9 +565,10 @@ int main(int argc, char **argv)
        }
 
        /* Create thread to manage the polling/writing of trace metadata */
-       ret = pthread_create(&metadata_thread, default_pthread_attr(),
-                       consumer_thread_metadata_poll,
-                       (void *) the_consumer_context);
+       ret = pthread_create(&metadata_thread,
+                            default_pthread_attr(),
+                            consumer_thread_metadata_poll,
+                            (void *) the_consumer_context);
        if (ret) {
                errno = ret;
                PERROR("pthread_create");
@@ -557,8 +577,10 @@ int main(int argc, char **argv)
        }
 
        /* Create thread to manage the polling/writing of trace data */
-       ret = pthread_create(&data_thread, default_pthread_attr(),
-                       consumer_thread_data_poll, (void *) the_consumer_context);
+       ret = pthread_create(&data_thread,
+                            default_pthread_attr(),
+                            consumer_thread_data_poll,
+                            (void *) the_consumer_context);
        if (ret) {
                errno = ret;
                PERROR("pthread_create");
@@ -567,9 +589,10 @@ int main(int argc, char **argv)
        }
 
        /* Create the thread to manage the reception of fds */
-       ret = pthread_create(&sessiond_thread, default_pthread_attr(),
-                       consumer_thread_sessiond_poll,
-                       (void *) the_consumer_context);
+       ret = pthread_create(&sessiond_thread,
+                            default_pthread_attr(),
+                            consumer_thread_sessiond_poll,
+                            (void *) the_consumer_context);
        if (ret) {
                errno = ret;
                PERROR("pthread_create");
@@ -577,7 +600,6 @@ int main(int argc, char **argv)
                goto exit_sessiond_thread;
        }
 
-
        /*
         * This is where we start awaiting program completion (e.g. through
         * signal that asks threads to teardown.
@@ -666,7 +688,7 @@ exit_init_data:
        }
        tmp_ctx = the_consumer_context;
        the_consumer_context = NULL;
-       cmm_barrier();  /* Clear ctx for signal handler. */
+       cmm_barrier(); /* Clear ctx for signal handler. */
        lttng_consumer_destroy(tmp_ctx);
 
        if (health_consumerd) {
index 3987a60ddac334d2e75fabf213102c7d4d1ea0f6..8b1e41be4409f9c8892ba179d9ccac75e65d4546 100644 (file)
@@ -6,34 +6,34 @@
  *
  */
 
+#include <common/common.hpp>
+#include <common/compat/endian.hpp>
+#include <common/spawn-viewer.hpp>
+#include <common/utils.hpp>
+
+#include <lttng/lttng.h>
+
+#include <ctype.h>
+#include <dirent.h>
+#include <fcntl.h>
 #include <getopt.h>
+#include <inttypes.h>
 #include <signal.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <fcntl.h>
 #include <sys/wait.h>
 #include <unistd.h>
-#include <ctype.h>
-#include <dirent.h>
-#include <common/compat/endian.hpp>
-#include <inttypes.h>
-#include <stdbool.h>
-
 #include <version.hpp>
-#include <lttng/lttng.h>
-#include <common/common.hpp>
-#include <common/spawn-viewer.hpp>
-#include <common/utils.hpp>
 
-#define COPY_BUFLEN            4096
-#define RB_CRASH_DUMP_ABI_LEN  32
+#define COPY_BUFLEN          4096
+#define RB_CRASH_DUMP_ABI_LEN 32
 
-#define RB_CRASH_DUMP_ABI_MAGIC_LEN    16
+#define RB_CRASH_DUMP_ABI_MAGIC_LEN 16
 
 /*
  * The 128-bit magic number is xor'd in the process data so it does not
  *   0x17, 0x7B, 0xF1, 0x77, 0xBF, 0x17, 0x7B, 0xF1,
  *   0x77, 0xBF, 0x17, 0x7B, 0xF1, 0x77, 0xBF, 0x17,
  */
-#define RB_CRASH_DUMP_ABI_MAGIC_XOR                                    \
-       {                                                               \
-               0x17 ^ 0xFF, 0x7B ^ 0xFF, 0xF1 ^ 0xFF, 0x77 ^ 0xFF,     \
-               0xBF ^ 0xFF, 0x17 ^ 0xFF, 0x7B ^ 0xFF, 0xF1 ^ 0xFF,     \
-               0x77 ^ 0xFF, 0xBF ^ 0xFF, 0x17 ^ 0xFF, 0x7B ^ 0xFF,     \
-               0xF1 ^ 0xFF, 0x77 ^ 0xFF, 0xBF ^ 0xFF, 0x17 ^ 0xFF,     \
+#define RB_CRASH_DUMP_ABI_MAGIC_XOR                                                           \
+       {                                                                                     \
+               0x17 ^ 0xFF, 0x7B ^ 0xFF, 0xF1 ^ 0xFF, 0x77 ^ 0xFF, 0xBF ^ 0xFF, 0x17 ^ 0xFF, \
+                       0x7B ^ 0xFF, 0xF1 ^ 0xFF, 0x77 ^ 0xFF, 0xBF ^ 0xFF, 0x17 ^ 0xFF,      \
+                       0x7B ^ 0xFF, 0xF1 ^ 0xFF, 0x77 ^ 0xFF, 0xBF ^ 0xFF, 0x17 ^ 0xFF,      \
        }
 
 static const char *help_msg =
 #ifdef LTTNG_EMBED_HELP
 #include <lttng-crash.1.h>
 #else
-NULL
+       NULL
 #endif
-;
+       ;
 
 /*
  * Non-static to ensure the compiler does not optimize away the xor.
  */
 uint8_t lttng_crash_expected_magic_xor[] = RB_CRASH_DUMP_ABI_MAGIC_XOR;
 
-#define RB_CRASH_ENDIAN                        0x1234
-#define RB_CRASH_ENDIAN_REVERSE                0x3412
+#define RB_CRASH_ENDIAN                0x1234
+#define RB_CRASH_ENDIAN_REVERSE 0x3412
 
 enum lttng_crash_type {
        LTTNG_CRASH_TYPE_UST = 0,
@@ -73,43 +72,43 @@ enum lttng_crash_type {
 
 /* LTTng ring buffer defines (copied) */
 
-#define HALF_ULONG_BITS(wl)    (((wl) * CHAR_BIT) >> 1)
+#define HALF_ULONG_BITS(wl) (((wl) *CHAR_BIT) >> 1)
 
-#define SB_ID_OFFSET_SHIFT(wl) (HALF_ULONG_BITS(wl) + 1)
-#define SB_ID_OFFSET_COUNT(wl) (1UL << SB_ID_OFFSET_SHIFT(wl))
-#define SB_ID_OFFSET_MASK(wl)  (~(SB_ID_OFFSET_COUNT(wl) - 1))
+#define SB_ID_OFFSET_SHIFT(wl) (HALF_ULONG_BITS(wl) + 1)
+#define SB_ID_OFFSET_COUNT(wl) (1UL << SB_ID_OFFSET_SHIFT(wl))
+#define SB_ID_OFFSET_MASK(wl)  (~(SB_ID_OFFSET_COUNT(wl) - 1))
 /*
  * Lowest bit of top word half belongs to noref. Used only for overwrite mode.
  */
-#define SB_ID_NOREF_SHIFT(wl)  (SB_ID_OFFSET_SHIFT(wl) - 1)
-#define SB_ID_NOREF_COUNT(wl)  (1UL << SB_ID_NOREF_SHIFT(wl))
-#define SB_ID_NOREF_MASK(wl)   SB_ID_NOREF_COUNT(wl)
+#define SB_ID_NOREF_SHIFT(wl) (SB_ID_OFFSET_SHIFT(wl) - 1)
+#define SB_ID_NOREF_COUNT(wl) (1UL << SB_ID_NOREF_SHIFT(wl))
+#define SB_ID_NOREF_MASK(wl)  SB_ID_NOREF_COUNT(wl)
 /*
  * In overwrite mode: lowest half of word is used for index.
  * Limit of 2^16 subbuffers per buffer on 32-bit, 2^32 on 64-bit.
  * In producer-consumer mode: whole word used for index.
  */
-#define SB_ID_INDEX_SHIFT(wl)  0
-#define SB_ID_INDEX_COUNT(wl)  (1UL << SB_ID_INDEX_SHIFT(wl))
-#define SB_ID_INDEX_MASK(wl)   (SB_ID_NOREF_COUNT(wl) - 1)
+#define SB_ID_INDEX_SHIFT(wl) 0
+#define SB_ID_INDEX_COUNT(wl) (1UL << SB_ID_INDEX_SHIFT(wl))
+#define SB_ID_INDEX_MASK(wl)  (SB_ID_NOREF_COUNT(wl) - 1)
 
 enum rb_modes {
-       RING_BUFFER_OVERWRITE = 0,      /* Overwrite when buffer full */
-       RING_BUFFER_DISCARD = 1,        /* Discard when buffer full */
+       RING_BUFFER_OVERWRITE = 0, /* Overwrite when buffer full */
+       RING_BUFFER_DISCARD = 1, /* Discard when buffer full */
 };
 
 namespace {
 struct crash_abi_unknown {
        uint8_t magic[RB_CRASH_DUMP_ABI_MAGIC_LEN];
-       uint64_t mmap_length;   /* Overall length of crash record */
-       uint16_t endian;        /*
-                                * { 0x12, 0x34 }: big endian
-                                * { 0x34, 0x12 }: little endian
-                                */
-       uint16_t major;         /* Major number. */
-       uint16_t minor;         /* Minor number. */
-       uint8_t word_size;      /* Word size (bytes). */
-       uint8_t layout_type;    /* enum lttng_crash_layout */
+       uint64_t mmap_length; /* Overall length of crash record */
+       uint16_t endian; /*
+                         * { 0x12, 0x34 }: big endian
+                         * { 0x34, 0x12 }: little endian
+                         */
+       uint16_t major; /* Major number. */
+       uint16_t minor; /* Minor number. */
+       uint8_t word_size; /* Word size (bytes). */
+       uint8_t layout_type; /* enum lttng_crash_layout */
 } __attribute__((packed));
 
 struct crash_abi_0_0 {
@@ -144,26 +143,21 @@ struct crash_abi_0_0 {
                uint32_t sb_array;
        } __attribute__((packed)) stride;
 
-       uint64_t buf_size;      /* Size of the buffer */
-       uint64_t subbuf_size;   /* Sub-buffer size */
-       uint64_t num_subbuf;    /* Number of sub-buffers for writer */
-       uint32_t mode;          /* Buffer mode: 0: overwrite, 1: discard */
+       uint64_t buf_size; /* Size of the buffer */
+       uint64_t subbuf_size; /* Sub-buffer size */
+       uint64_t num_subbuf; /* Number of sub-buffers for writer */
+       uint32_t mode; /* Buffer mode: 0: overwrite, 1: discard */
 } __attribute__((packed));
 
 struct lttng_crash_layout {
        struct {
-               int prod_offset, consumed_offset,
-                       commit_hot_array, commit_hot_seq,
-                       buf_wsb_array, buf_wsb_id,
-                       sb_array, sb_array_shmp_offset,
-                       sb_backend_p_offset, content_size,
-                       packet_size;
+               int prod_offset, consumed_offset, commit_hot_array, commit_hot_seq, buf_wsb_array,
+                       buf_wsb_id, sb_array, sb_array_shmp_offset, sb_backend_p_offset,
+                       content_size, packet_size;
        } offset;
        struct {
-               int prod_offset, consumed_offset,
-                       commit_hot_seq, buf_wsb_id,
-                       sb_array_shmp_offset, sb_backend_p_offset,
-                       content_size, packet_size;
+               int prod_offset, consumed_offset, commit_hot_seq, buf_wsb_id, sb_array_shmp_offset,
+                       sb_backend_p_offset, content_size, packet_size;
        } length;
        struct {
                int commit_hot_array, buf_wsb_array, sb_array;
@@ -172,11 +166,11 @@ struct lttng_crash_layout {
        int reverse_byte_order;
        int word_size;
 
-       uint64_t mmap_length;   /* Length of crash record */
-       uint64_t buf_size;      /* Size of the buffer */
-       uint64_t subbuf_size;   /* Sub-buffer size */
-       uint64_t num_subbuf;    /* Number of sub-buffers for writer */
-       uint32_t mode;          /* Buffer mode: 0: overwrite, 1: discard */
+       uint64_t mmap_length; /* Length of crash record */
+       uint64_t buf_size; /* Size of the buffer */
+       uint64_t subbuf_size; /* Sub-buffer size */
+       uint64_t num_subbuf; /* Number of sub-buffers for writer */
+       uint32_t mode; /* Buffer mode: 0: overwrite, 1: discard */
 };
 } /* namespace */
 
@@ -195,12 +189,9 @@ enum {
 
 /* Getopt options. No first level command. */
 static struct option long_options[] = {
-       { "version",            0, NULL, 'V' },
-       { "help",               0, NULL, 'h' },
-       { "verbose",            0, NULL, 'v' },
-       { "viewer",             1, NULL, 'e' },
-       { "extract",            1, NULL, 'x' },
-       { "list-options",       0, NULL, OPT_DUMP_OPTIONS },
+       { "version", 0, NULL, 'V' }, { "help", 0, NULL, 'h' },
+       { "verbose", 0, NULL, 'v' }, { "viewer", 1, NULL, 'e' },
+       { "extract", 1, NULL, 'x' }, { "list-options", 0, NULL, OPT_DUMP_OPTIONS },
        { NULL, 0, NULL, 0 },
 };
 
@@ -217,11 +208,11 @@ static void usage(void)
 
 static void version(FILE *ofp)
 {
-       fprintf(ofp, "%s (LTTng Crash Trace Viewer) " VERSION " - " VERSION_NAME
-                       "%s%s\n",
-                       progname,
-                       GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION,
-                       EXTRA_VERSION_NAME[0] == '\0' ? "" : " - " EXTRA_VERSION_NAME);
+       fprintf(ofp,
+               "%s (LTTng Crash Trace Viewer) " VERSION " - " VERSION_NAME "%s%s\n",
+               progname,
+               GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION,
+               EXTRA_VERSION_NAME[0] == '\0' ? "" : " - " EXTRA_VERSION_NAME);
 }
 
 /*
@@ -310,8 +301,7 @@ error:
        return -1;
 }
 
-static
-int copy_file(const char *file_dest, const char *file_src)
+static int copy_file(const char *file_dest, const char *file_src)
 {
        int fd_src = -1, fd_dest = -1;
        ssize_t readlen, writelen;
@@ -326,8 +316,7 @@ int copy_file(const char *file_dest, const char *file_src)
                ret = -errno;
                goto error;
        }
-       fd_dest = open(file_dest, O_RDWR | O_CREAT | O_EXCL,
-                       S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+       fd_dest = open(file_dest, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
        if (fd_dest < 0) {
                PERROR("Error opening %s for writing", file_dest);
                ret = -errno;
@@ -368,25 +357,26 @@ error:
        return ret;
 }
 
-static
-uint64_t _crash_get_field(const struct lttng_crash_layout *layout,
-               const char *ptr, size_t size)
+static uint64_t
+_crash_get_field(const struct lttng_crash_layout *layout, const char *ptr, size_t size)
 {
        switch (size) {
-       case 1: return *(uint8_t *) ptr;
-       case 2: if (layout->reverse_byte_order) {
+       case 1:
+               return *(uint8_t *) ptr;
+       case 2:
+               if (layout->reverse_byte_order) {
                        return bswap_16(*(uint16_t *) ptr);
                } else {
                        return *(uint16_t *) ptr;
-
                }
-       case 4: if (layout->reverse_byte_order) {
+       case 4:
+               if (layout->reverse_byte_order) {
                        return bswap_32(*(uint32_t *) ptr);
                } else {
                        return *(uint32_t *) ptr;
-
                }
-       case 8: if (layout->reverse_byte_order) {
+       case 8:
+               if (layout->reverse_byte_order) {
                        return bswap_64(*(uint64_t *) ptr);
                } else {
                        return *(uint64_t *) ptr;
@@ -395,37 +385,30 @@ uint64_t _crash_get_field(const struct lttng_crash_layout *layout,
                abort();
                return -1;
        }
-
 }
 
-#define crash_get_field(layout, map, name)                             \
-       _crash_get_field(layout, (map) + (layout)->offset.name,         \
-               layout->length.name)
-
-#define crash_get_array_field(layout, map, array_name, idx, field_name)        \
-       _crash_get_field(layout,                                        \
-               (map) + (layout)->offset.array_name                     \
-                       + (idx * (layout)->stride.array_name)           \
-                       + (layout)->offset.field_name,                  \
-               (layout)->length.field_name)
-
-#define crash_get_hdr_raw_field(layout, hdr, name)     ((hdr)->name)
-
-#define crash_get_hdr_field(layout, hdr, name)                         \
-       _crash_get_field(layout, (const char *) &(hdr)->name,           \
-               sizeof((hdr)->name))
-
-#define crash_get_layout(layout, hdr, name)                            \
-       do {                                                            \
-               (layout)->name = crash_get_hdr_field(layout, hdr,       \
-                                       name);                          \
-               DBG("layout.%s = %" PRIu64, #name,                      \
-                       (uint64_t) (layout)->name);                     \
+#define crash_get_field(layout, map, name) \
+       _crash_get_field(layout, (map) + (layout)->offset.name, layout->length.name)
+
+#define crash_get_array_field(layout, map, array_name, idx, field_name) \
+       _crash_get_field(layout,                                        \
+                        (map) + (layout)->offset.array_name +          \
+                                (idx * (layout)->stride.array_name) +  \
+                                (layout)->offset.field_name,           \
+                        (layout)->length.field_name)
+
+#define crash_get_hdr_raw_field(layout, hdr, name) ((hdr)->name)
+
+#define crash_get_hdr_field(layout, hdr, name) \
+       _crash_get_field(layout, (const char *) &(hdr)->name, sizeof((hdr)->name))
+
+#define crash_get_layout(layout, hdr, name)                                    \
+       do {                                                                   \
+               (layout)->name = crash_get_hdr_field(layout, hdr, name);       \
+               DBG("layout.%s = %" PRIu64, #name, (uint64_t) (layout)->name); \
        } while (0)
 
-static
-int get_crash_layout_0_0(struct lttng_crash_layout *layout,
-               char *map)
+static int get_crash_layout_0_0(struct lttng_crash_layout *layout, char *map)
 {
        const struct crash_abi_0_0 *abi = (const struct crash_abi_0_0 *) map;
 
@@ -462,18 +445,28 @@ int get_crash_layout_0_0(struct lttng_crash_layout *layout,
        return 0;
 }
 
-static
-void print_dbg_magic(const uint8_t *magic)
+static void print_dbg_magic(const uint8_t *magic)
 {
        DBG("magic: 0x%X%X%X%X%X%X%X%X%X%X%X%X%X%X%X%X",
-               magic[0], magic[1], magic[2], magic[3],
-               magic[4], magic[5], magic[6], magic[7],
-               magic[8], magic[9], magic[10], magic[11],
-               magic[12], magic[13], magic[14], magic[15]);
+           magic[0],
+           magic[1],
+           magic[2],
+           magic[3],
+           magic[4],
+           magic[5],
+           magic[6],
+           magic[7],
+           magic[8],
+           magic[9],
+           magic[10],
+           magic[11],
+           magic[12],
+           magic[13],
+           magic[14],
+           magic[15]);
 }
 
-static
-int check_magic(const uint8_t *magic)
+static int check_magic(const uint8_t *magic)
 {
        int i;
 
@@ -485,9 +478,7 @@ int check_magic(const uint8_t *magic)
        return 0;
 }
 
-static
-int get_crash_layout(struct lttng_crash_layout *layout, int fd,
-               const char *input_file)
+static int get_crash_layout(struct lttng_crash_layout *layout, int fd, const char *input_file)
 {
        char *map;
        int ret = 0, unmapret;
@@ -507,14 +498,14 @@ int get_crash_layout(struct lttng_crash_layout *layout, int fd,
        }
        if (stat.st_size < RB_CRASH_DUMP_ABI_LEN) {
                ERR("File '%s' truncated: file length of %" PRIi64
-                               " bytes does not meet the minimal expected "
-                               "length of %d bytes",
-                               input_file, (int64_t) stat.st_size,
-                               RB_CRASH_DUMP_ABI_LEN);
+                   " bytes does not meet the minimal expected "
+                   "length of %d bytes",
+                   input_file,
+                   (int64_t) stat.st_size,
+                   RB_CRASH_DUMP_ABI_LEN);
                return -1;
        }
-       map = (char *) mmap(NULL, RB_CRASH_DUMP_ABI_LEN, PROT_READ, MAP_PRIVATE,
-               fd, 0);
+       map = (char *) mmap(NULL, RB_CRASH_DUMP_ABI_LEN, PROT_READ, MAP_PRIVATE, fd, 0);
        if (map == MAP_FAILED) {
                PERROR("Mapping file");
                return -1;
@@ -524,7 +515,7 @@ int get_crash_layout(struct lttng_crash_layout *layout, int fd,
        print_dbg_magic(magic);
        if (check_magic(magic)) {
                DBG("Unknown magic number");
-               ret = 1;        /* positive return value, skip */
+               ret = 1; /* positive return value, skip */
                goto end;
        }
        endian = crash_get_hdr_field(layout, abi, endian);
@@ -536,7 +527,7 @@ int get_crash_layout(struct lttng_crash_layout *layout, int fd,
                break;
        default:
                DBG("Unknown endianness value: 0x%X", (unsigned int) endian);
-               ret = 1;        /* positive return value, skip */
+               ret = 1; /* positive return value, skip */
                goto end;
        }
        layout_type = (enum lttng_crash_type) crash_get_hdr_field(layout, abi, layout_type);
@@ -545,11 +536,11 @@ int get_crash_layout(struct lttng_crash_layout *layout, int fd,
                break;
        case LTTNG_CRASH_TYPE_KERNEL:
                ERR("lttng-modules buffer layout support not implemented");
-               ret = 1;        /* positive return value, skip */
+               ret = 1; /* positive return value, skip */
                goto end;
        default:
                ERR("Unknown layout type %u", (unsigned int) layout_type);
-               ret = 1;        /* positive return value, skip */
+               ret = 1; /* positive return value, skip */
                goto end;
        }
        mmap_length = crash_get_hdr_field(layout, abi, mmap_length);
@@ -590,43 +581,36 @@ end:
 }
 
 /* buf_trunc mask selects only the buffer number. */
-static inline
-uint64_t buf_trunc(uint64_t offset, uint64_t buf_size)
+static inline uint64_t buf_trunc(uint64_t offset, uint64_t buf_size)
 {
        return offset & ~(buf_size - 1);
 }
 
 /* subbuf_trunc mask selects the subbuffer number. */
-static inline
-uint64_t subbuf_trunc(uint64_t offset, uint64_t subbuf_size)
+static inline uint64_t subbuf_trunc(uint64_t offset, uint64_t subbuf_size)
 {
        return offset & ~(subbuf_size - 1);
 }
 
 /* buf_offset mask selects only the offset within the current buffer. */
-static inline
-uint64_t buf_offset(uint64_t offset, uint64_t buf_size)
+static inline uint64_t buf_offset(uint64_t offset, uint64_t buf_size)
 {
        return offset & (buf_size - 1);
 }
 
 /* subbuf_offset mask selects the offset within the current subbuffer. */
-static inline
-uint64_t subbuf_offset(uint64_t offset, uint64_t subbuf_size)
+static inline uint64_t subbuf_offset(uint64_t offset, uint64_t subbuf_size)
 {
        return offset & (subbuf_size - 1);
 }
 
 /* subbuf_index returns the index of the current subbuffer within the buffer. */
-static inline
-uint64_t subbuf_index(uint64_t offset, uint64_t buf_size, uint64_t subbuf_size)
+static inline uint64_t subbuf_index(uint64_t offset, uint64_t buf_size, uint64_t subbuf_size)
 {
        return buf_offset(offset, buf_size) / subbuf_size;
 }
 
-static inline
-uint64_t subbuffer_id_get_index(uint32_t mode, uint64_t id,
-               unsigned int wl)
+static inline uint64_t subbuffer_id_get_index(uint32_t mode, uint64_t id, unsigned int wl)
 {
        if (mode == RING_BUFFER_OVERWRITE)
                return id & SB_ID_INDEX_MASK(wl);
@@ -634,14 +618,11 @@ uint64_t subbuffer_id_get_index(uint32_t mode, uint64_t id,
                return id;
 }
 
-static
-int copy_crash_subbuf(const struct lttng_crash_layout *layout,
-               int fd_dest, char *buf, uint64_t offset)
+static int
+copy_crash_subbuf(const struct lttng_crash_layout *layout, int fd_dest, char *buf, uint64_t offset)
 {
-       uint64_t buf_size, subbuf_size, num_subbuf, sbidx, id,
-               sb_bindex, rpages_offset, p_offset, seq_cc,
-               committed, commit_count_mask, consumed_cur,
-               packet_size;
+       uint64_t buf_size, subbuf_size, num_subbuf, sbidx, id, sb_bindex, rpages_offset, p_offset,
+               seq_cc, committed, commit_count_mask, consumed_cur, packet_size;
        char *subbuf_ptr;
        ssize_t writelen;
 
@@ -656,13 +637,14 @@ int copy_crash_subbuf(const struct lttng_crash_layout *layout,
        num_subbuf = layout->num_subbuf;
 
        switch (layout->word_size) {
-       case 4: commit_count_mask = 0xFFFFFFFFULL / num_subbuf;
+       case 4:
+               commit_count_mask = 0xFFFFFFFFULL / num_subbuf;
                break;
-       case 8: commit_count_mask = 0xFFFFFFFFFFFFFFFFULL / num_subbuf;
+       case 8:
+               commit_count_mask = 0xFFFFFFFFFFFFFFFFULL / num_subbuf;
                break;
        default:
-               ERR("Unsupported word size: %u",
-                       (unsigned int) layout->word_size);
+               ERR("Unsupported word size: %u", (unsigned int) layout->word_size);
                return -EINVAL;
        }
 
@@ -673,16 +655,16 @@ int copy_crash_subbuf(const struct lttng_crash_layout *layout,
         * Find where the seq cc is located. Compute length of data to
         * copy.
         */
-       seq_cc = crash_get_array_field(layout, buf, commit_hot_array,
-               sbidx, commit_hot_seq);
+       seq_cc = crash_get_array_field(layout, buf, commit_hot_array, sbidx, commit_hot_seq);
        consumed_cur = crash_get_field(layout, buf, consumed_offset);
 
        /*
         * Check that the buffer we are getting is after or at
         * consumed_cur position.
         */
-       if ((long) subbuf_trunc(offset, subbuf_size)
-                       - (long) subbuf_trunc(consumed_cur, subbuf_size) < 0) {
+       if ((long) subbuf_trunc(offset, subbuf_size) -
+                   (long) subbuf_trunc(consumed_cur, subbuf_size) <
+           0) {
                DBG("No data: position is before consumed_cur");
                goto nodata;
        }
@@ -690,9 +672,9 @@ int copy_crash_subbuf(const struct lttng_crash_layout *layout,
        /*
         * Check if subbuffer has been fully committed.
         */
-       if (((seq_cc - subbuf_size) & commit_count_mask)
-                       - (buf_trunc(offset, buf_size) / num_subbuf)
-                       == 0) {
+       if (((seq_cc - subbuf_size) & commit_count_mask) -
+                   (buf_trunc(offset, buf_size) / num_subbuf) ==
+           0) {
                committed = subbuf_size;
        } else {
                committed = subbuf_offset(seq_cc, subbuf_size);
@@ -703,14 +685,11 @@ int copy_crash_subbuf(const struct lttng_crash_layout *layout,
        }
 
        /* Find actual physical offset in subbuffer table */
-       id = crash_get_array_field(layout, buf, buf_wsb_array,
-               sbidx, buf_wsb_id);
-       sb_bindex = subbuffer_id_get_index(layout->mode, id,
-               layout->word_size);
-       rpages_offset = crash_get_array_field(layout, buf, sb_array,
-               sb_bindex, sb_array_shmp_offset);
-       p_offset = crash_get_field(layout, buf + rpages_offset,
-               sb_backend_p_offset);
+       id = crash_get_array_field(layout, buf, buf_wsb_array, sbidx, buf_wsb_id);
+       sb_bindex = subbuffer_id_get_index(layout->mode, id, layout->word_size);
+       rpages_offset =
+               crash_get_array_field(layout, buf, sb_array, sb_bindex, sb_array_shmp_offset);
+       p_offset = crash_get_field(layout, buf + rpages_offset, sb_backend_p_offset);
        subbuf_ptr = buf + p_offset;
 
        if (committed == subbuf_size) {
@@ -719,8 +698,8 @@ int copy_crash_subbuf(const struct lttng_crash_layout *layout,
                 */
                if (layout->length.packet_size) {
                        memcpy(&packet_size,
-                               subbuf_ptr + layout->offset.packet_size,
-                               layout->length.packet_size);
+                              subbuf_ptr + layout->offset.packet_size,
+                              layout->length.packet_size);
                        if (layout->reverse_byte_order) {
                                packet_size = bswap_64(packet_size);
                        }
@@ -742,11 +721,13 @@ int copy_crash_subbuf(const struct lttng_crash_layout *layout,
                }
                if (layout->length.content_size) {
                        memcpy(subbuf_ptr + layout->offset.content_size,
-                               &patch_size, layout->length.content_size);
+                              &patch_size,
+                              layout->length.content_size);
                }
                if (layout->length.packet_size) {
                        memcpy(subbuf_ptr + layout->offset.packet_size,
-                               &patch_size, layout->length.packet_size);
+                              &patch_size,
+                              layout->length.packet_size);
                }
                packet_size = committed;
        }
@@ -766,9 +747,7 @@ nodata:
        return -ENODATA;
 }
 
-static
-int copy_crash_data(const struct lttng_crash_layout *layout, int fd_dest,
-               int fd_src)
+static int copy_crash_data(const struct lttng_crash_layout *layout, int fd_dest, int fd_src)
 {
        char *buf;
        int ret = 0, has_data = 0;
@@ -800,8 +779,7 @@ int copy_crash_data(const struct lttng_crash_layout *layout, int fd_dest,
        DBG("consumed_offset: 0x%" PRIx64, consumed_offset);
        subbuf_size = layout->subbuf_size;
 
-       for (offset = consumed_offset; offset < prod_offset;
-                       offset += subbuf_size) {
+       for (offset = consumed_offset; offset < prod_offset; offset += subbuf_size) {
                ret = copy_crash_subbuf(layout, fd_dest, buf, offset);
                if (!ret) {
                        has_data = 1;
@@ -822,20 +800,18 @@ end:
        }
 }
 
-static
-int extract_file(int output_dir_fd, const char *output_file,
-               int input_dir_fd, const char *input_file)
+static int
+extract_file(int output_dir_fd, const char *output_file, int input_dir_fd, const char *input_file)
 {
        int fd_dest, fd_src, ret = 0, closeret;
        struct lttng_crash_layout layout;
 
-       layout.reverse_byte_order = 0;  /* For reading magic number */
+       layout.reverse_byte_order = 0; /* For reading magic number */
 
        DBG("Extract file '%s'", input_file);
        fd_src = openat(input_dir_fd, input_file, O_RDONLY);
        if (fd_src < 0) {
-               PERROR("Error opening '%s' for reading",
-                       input_file);
+               PERROR("Error opening '%s' for reading", input_file);
                ret = -1;
                goto end;
        }
@@ -846,12 +822,12 @@ int extract_file(int output_dir_fd, const char *output_file,
                goto close_src;
        }
 
-       fd_dest = openat(output_dir_fd, output_file,
-                       O_RDWR | O_CREAT | O_EXCL,
-                       S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+       fd_dest = openat(output_dir_fd,
+                        output_file,
+                        O_RDWR | O_CREAT | O_EXCL,
+                        S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
        if (fd_dest < 0) {
-               PERROR("Error opening '%s' for writing",
-                       output_file);
+               PERROR("Error opening '%s' for writing", output_file);
                ret = -1;
                goto close_src;
        }
@@ -881,13 +857,11 @@ end:
        return ret;
 }
 
-static
-int extract_all_files(const char *output_path,
-               const char *input_path)
+static int extract_all_files(const char *output_path, const char *input_path)
 {
        DIR *input_dir, *output_dir;
        int input_dir_fd, output_dir_fd, ret = 0, closeret;
-       struct dirent *entry;   /* input */
+       struct dirent *entry; /* input */
 
        /* Open input directory */
        input_dir = opendir(input_path);
@@ -914,11 +888,9 @@ int extract_all_files(const char *output_path,
        }
 
        while ((entry = readdir(input_dir))) {
-               if (!strcmp(entry->d_name, ".")
-                               || !strcmp(entry->d_name, ".."))
+               if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, ".."))
                        continue;
-               ret = extract_file(output_dir_fd, entry->d_name,
-                       input_dir_fd, entry->d_name);
+               ret = extract_file(output_dir_fd, entry->d_name, input_dir_fd, entry->d_name);
                if (ret == -ENODATA) {
                        DBG("No data in file '%s', skipping", entry->d_name);
                        ret = 0;
@@ -942,9 +914,7 @@ int extract_all_files(const char *output_path,
        return ret;
 }
 
-static
-int extract_one_trace(const char *output_path,
-               const char *input_path)
+static int extract_one_trace(const char *output_path, const char *input_path)
 {
        char dest[PATH_MAX], src[PATH_MAX];
        int ret;
@@ -969,9 +939,7 @@ int extract_one_trace(const char *output_path,
        return extract_all_files(output_path, input_path);
 }
 
-static
-int extract_trace_recursive(const char *output_path,
-               const char *input_path)
+static int extract_trace_recursive(const char *output_path, const char *input_path)
 {
        DIR *dir;
        int dir_fd, ret = 0, closeret;
@@ -999,20 +967,19 @@ int extract_trace_recursive(const char *output_path,
                size_t name_len;
                char filename[PATH_MAX];
 
-               if (!strcmp(entry->d_name, ".")
-                               || !strcmp(entry->d_name, "..")) {
+               if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")) {
                        continue;
                }
 
                name_len = strlen(entry->d_name);
                if (path_len + name_len + 2 > sizeof(filename)) {
                        ERR("Failed to remove file: path name too long (%s/%s)",
-                               input_path, entry->d_name);
+                           input_path,
+                           entry->d_name);
                        continue;
                }
 
-               if (snprintf(filename, sizeof(filename), "%s/%s",
-                               input_path, entry->d_name) < 0) {
+               if (snprintf(filename, sizeof(filename), "%s/%s", input_path, entry->d_name) < 0) {
                        ERR("Failed to format path.");
                        continue;
                }
@@ -1026,12 +993,13 @@ int extract_trace_recursive(const char *output_path,
                        char output_subpath[PATH_MAX];
                        char input_subpath[PATH_MAX];
 
-                       strncpy(output_subpath, output_path,
-                               sizeof(output_subpath));
+                       strncpy(output_subpath, output_path, sizeof(output_subpath));
                        output_subpath[sizeof(output_subpath) - 1] = '\0';
-                       strncat(output_subpath, "/",
+                       strncat(output_subpath,
+                               "/",
                                sizeof(output_subpath) - strlen(output_subpath) - 1);
-                       strncat(output_subpath, entry->d_name,
+                       strncat(output_subpath,
+                               entry->d_name,
                                sizeof(output_subpath) - strlen(output_subpath) - 1);
 
                        ret = mkdir(output_subpath, S_IRWXU | S_IRWXG);
@@ -1041,26 +1009,25 @@ int extract_trace_recursive(const char *output_path,
                                goto end;
                        }
 
-                       strncpy(input_subpath, input_path,
-                               sizeof(input_subpath));
+                       strncpy(input_subpath, input_path, sizeof(input_subpath));
                        input_subpath[sizeof(input_subpath) - 1] = '\0';
-                       strncat(input_subpath, "/",
+                       strncat(input_subpath,
+                               "/",
                                sizeof(input_subpath) - strlen(input_subpath) - 1);
-                       strncat(input_subpath, entry->d_name,
+                       strncat(input_subpath,
+                               entry->d_name,
                                sizeof(input_subpath) - strlen(input_subpath) - 1);
 
-                       ret = extract_trace_recursive(output_subpath,
-                               input_subpath);
+                       ret = extract_trace_recursive(output_subpath, input_subpath);
                        if (ret) {
                                has_warning = 1;
                        }
                } else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
                        if (!strcmp(entry->d_name, "metadata")) {
-                               ret = extract_one_trace(output_path,
-                                       input_path);
+                               ret = extract_one_trace(output_path, input_path);
                                if (ret) {
                                        WARN("Error extracting trace '%s', continuing anyway.",
-                                               input_path);
+                                            input_path);
                                        has_warning = 1;
                                }
                        }
@@ -1077,8 +1044,7 @@ end:
        return has_warning;
 }
 
-static
-int delete_dir_recursive(const char *path)
+static int delete_dir_recursive(const char *path)
 {
        DIR *dir;
        int dir_fd, ret = 0, closeret;
@@ -1090,7 +1056,7 @@ int delete_dir_recursive(const char *path)
        if (!dir) {
                PERROR("Cannot open '%s' path", path);
                ret = -errno;
-               goto end_no_closedir;
+               goto end_no_closedir;
        }
 
        path_len = strlen(path);
@@ -1107,20 +1073,19 @@ int delete_dir_recursive(const char *path)
                size_t name_len;
                char filename[PATH_MAX];
 
-               if (!strcmp(entry->d_name, ".")
-                               || !strcmp(entry->d_name, "..")) {
+               if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")) {
                        continue;
                }
 
                name_len = strlen(entry->d_name);
                if (path_len + name_len + 2 > sizeof(filename)) {
                        ERR("Failed to remove file: path name too long (%s/%s)",
-                               path, entry->d_name);
+                           path,
+                           entry->d_name);
                        continue;
                }
 
-               if (snprintf(filename, sizeof(filename), "%s/%s",
-                               path, entry->d_name) < 0) {
+               if (snprintf(filename, sizeof(filename), "%s/%s", path, entry->d_name) < 0) {
                        ERR("Failed to format path.");
                        continue;
                }
@@ -1140,10 +1105,8 @@ int delete_dir_recursive(const char *path)
                        }
                        strncpy(subpath, path, PATH_MAX);
                        subpath[PATH_MAX - 1] = '\0';
-                       strncat(subpath, "/",
-                                       PATH_MAX - strlen(subpath) - 1);
-                       strncat(subpath, entry->d_name,
-                                       PATH_MAX - strlen(subpath) - 1);
+                       strncat(subpath, "/", PATH_MAX - strlen(subpath) - 1);
+                       strncat(subpath, entry->d_name, PATH_MAX - strlen(subpath) - 1);
 
                        ret = delete_dir_recursive(subpath);
                        free(subpath);
@@ -1177,8 +1140,7 @@ end_no_closedir:
        return ret;
 }
 
-static
-int view_trace(const char *trace_path, char *viewer_path)
+static int view_trace(const char *trace_path, char *viewer_path)
 {
        pid_t pid;
 
index 78f8a1971a190814919007e98f59ab33b6bb8ba9..c56742720066b74c86d8277d3e3eb973bfce6295 100644 (file)
@@ -5,20 +5,19 @@
  *
  */
 
+#include "backward-compatibility-group-by.hpp"
 #include "common/time.hpp"
-#include <regex.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 
 #include <common/common.hpp>
 #include <common/defaults.hpp>
 #include <common/utils.hpp>
 
-#include "backward-compatibility-group-by.hpp"
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
-#define DATETIME_REGEX \
-       ".*-[1-2][0-9][0-9][0-9][0-1][0-9][0-3][0-9]-[0-2][0-9][0-5][0-9][0-5][0-9]$"
+#define DATETIME_REGEX ".*-[1-2][0-9][0-9][0-9][0-1][0-9][0-3][0-9]-[0-2][0-9][0-5][0-9][0-5][0-9]$"
 
 /*
  * Provide support for --group-output-by-session for producer >= 2.4 and < 2.11.
@@ -28,8 +27,8 @@
  * Return the allocated string containing the new stream path or else NULL.
  */
 char *backward_compat_group_by_session(const char *path,
-               const char *local_session_name,
-               time_t relay_session_creation_time)
+                                      const char *local_session_name,
+                                      time_t relay_session_creation_time)
 {
        int ret;
        size_t len;
@@ -48,7 +47,8 @@ char *backward_compat_group_by_session(const char *path,
        LTTNG_ASSERT(local_session_name[0] != '\0');
 
        DBG("Parsing path \"%s\" of session \"%s\" to create a new path that is grouped by session",
-                       path, local_session_name);
+           path,
+           local_session_name);
 
        /* Get a local copy for strtok */
        local_copy = strdup(path);
@@ -74,15 +74,13 @@ char *backward_compat_group_by_session(const char *path,
         */
        hostname_ptr = strtok_r(local_copy, "/", &leftover_ptr);
        if (!hostname_ptr) {
-               ERR("Failed to parse session path \"%s\": couldn't identify hostname",
-                               path);
+               ERR("Failed to parse session path \"%s\": couldn't identify hostname", path);
                goto error;
        }
 
        second_token_ptr = strtok_r(NULL, "/", &leftover_ptr);
        if (!second_token_ptr) {
-               ERR("Failed to parse session path \"%s\": couldn't identify session name",
-                               path);
+               ERR("Failed to parse session path \"%s\": couldn't identify session name", path);
                goto error;
        }
 
@@ -100,8 +98,7 @@ char *backward_compat_group_by_session(const char *path,
         *            <session_name>-<date>-<time>
         *            <auto>-<date>-<time>
         */
-       if (strncmp(second_token_ptr, local_session_name,
-                           strlen(local_session_name)) != 0) {
+       if (strncmp(second_token_ptr, local_session_name, strlen(local_session_name)) != 0) {
                /*
                 * Token does not start with session name.
                 * This mean this is an extra path scenario.
@@ -150,8 +147,7 @@ char *backward_compat_group_by_session(const char *path,
                goto error;
        }
 
-       leftover_second_token_ptr =
-                       second_token_ptr + strlen(local_session_name);
+       leftover_second_token_ptr = second_token_ptr + strlen(local_session_name);
        len = strlen(leftover_second_token_ptr);
        if (len == 0) {
                /*
@@ -162,11 +158,10 @@ char *backward_compat_group_by_session(const char *path,
                ret = regexec(&regex, local_session_name, 0, NULL, 0);
                if (ret == 0) {
                        const ssize_t local_session_name_offset =
-                                       strlen(local_session_name) - DATETIME_STR_LEN + 1;
+                               strlen(local_session_name) - DATETIME_STR_LEN + 1;
 
                        LTTNG_ASSERT(local_session_name_offset >= 0);
-                       datetime = strdup(local_session_name +
-                                       local_session_name_offset);
+                       datetime = strdup(local_session_name + local_session_name_offset);
                        if (!datetime) {
                                PERROR("Failed to parse session path: couldn't copy datetime on regex match");
                                goto error_regex;
@@ -178,16 +173,15 @@ char *backward_compat_group_by_session(const char *path,
                                goto error;
                        }
 
-                       ret = time_to_datetime_str(relay_session_creation_time,
-                                       datetime, DATETIME_STR_LEN);
+                       ret = time_to_datetime_str(
+                               relay_session_creation_time, datetime, DATETIME_STR_LEN);
                        if (ret) {
                                /* time_to_datetime_str already logs errors. */
                                goto error;
                        }
                }
        } else if (len == DATETIME_STR_LEN &&
-                       !regexec(&regex, leftover_second_token_ptr, 0, NULL,
-                                       0)) {
+                  !regexec(&regex, leftover_second_token_ptr, 0, NULL, 0)) {
                /*
                 * The leftover from the second token is of format
                 * "-<datetime>", use it as the creation time.
@@ -216,11 +210,15 @@ char *backward_compat_group_by_session(const char *path,
                }
        }
 
-       ret = asprintf(&filepath_per_session, "%s/%s%s%s/%s%s%s",
-                       local_session_name, hostname_ptr, datetime ? "-" : "",
-                       datetime ? datetime : "",
-                       partial_base_path ? partial_base_path : "",
-                       partial_base_path ? "/" : "", leftover_ptr);
+       ret = asprintf(&filepath_per_session,
+                      "%s/%s%s%s/%s%s%s",
+                      local_session_name,
+                      hostname_ptr,
+                      datetime ? "-" : "",
+                      datetime ? datetime : "",
+                      partial_base_path ? partial_base_path : "",
+                      partial_base_path ? "/" : "",
+                      leftover_ptr);
        if (ret < 0) {
                filepath_per_session = NULL;
                goto error;
index 9befdd606ac6b8f0db8b7d0a36b2dc9148285f50..8894c4863c0b2feef898a823b6e62a427aa79193 100644 (file)
@@ -9,19 +9,21 @@
 
 #define _LGPL_SOURCE
 
+#include "cmd-2-1.hpp"
+#include "utils.hpp"
+
 #include <common/common.hpp>
-#include <common/sessiond-comm/relayd.hpp>
 #include <common/compat/string.hpp>
-#include <lttng/constant.h>
+#include <common/sessiond-comm/relayd.hpp>
 
-#include "cmd-2-1.hpp"
-#include "utils.hpp"
+#include <lttng/constant.h>
 
 /*
  * cmd_recv_stream_2_1 allocates path_name and channel_name.
  */
 int cmd_recv_stream_2_1(const struct lttng_buffer_view *payload,
-               char **ret_path_name, char **ret_channel_name)
+                       char **ret_path_name,
+                       char **ret_channel_name)
 {
        int ret;
        struct lttcomm_relayd_add_stream stream_info;
@@ -31,7 +33,8 @@ int cmd_recv_stream_2_1(const struct lttng_buffer_view *payload,
 
        if (payload->size < sizeof(stream_info)) {
                ERR("Unexpected payload size in \"cmd_recv_stream_2_1\": expected >= %zu bytes, got %zu bytes",
-                               sizeof(stream_info), payload->size);
+                   sizeof(stream_info),
+                   payload->size);
                ret = -1;
                goto error;
        }
index 73c3a3c513fadd563dc9052e6abfd670f08282f6..8b6a99723ef81ecf9add19e64e5901a55c9486c9 100644 (file)
@@ -6,26 +6,30 @@
  */
 
 #define _LGPL_SOURCE
-#include <inttypes.h>
+#include "cmd-2-11.hpp"
+#include "utils.hpp"
 
 #include <common/common.hpp>
-#include <common/sessiond-comm/relayd.hpp>
-
 #include <common/compat/endian.hpp>
 #include <common/compat/string.hpp>
+#include <common/sessiond-comm/relayd.hpp>
+
 #include <lttng/constant.h>
 
-#include "cmd-2-11.hpp"
-#include "utils.hpp"
+#include <inttypes.h>
 
 int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
-               char *session_name, char *hostname, char *base_path,
-               uint32_t *live_timer, bool *snapshot,
-               uint64_t *id_sessiond,
-               lttng_uuid& sessiond_uuid,
-               bool *has_current_chunk, uint64_t *current_chunk_id,
-               time_t *creation_time,
-               bool *session_name_contains_creation_time)
+                           char *session_name,
+                           char *hostname,
+                           char *base_path,
+                           uint32_t *live_timer,
+                           bool *snapshot,
+                           uint64_t *id_sessiond,
+                           lttng_uuid& sessiond_uuid,
+                           bool *has_current_chunk,
+                           uint64_t *current_chunk_id,
+                           time_t *creation_time,
+                           bool *session_name_contains_creation_time)
 {
        int ret;
        struct lttcomm_relayd_create_session_2_11 header;
@@ -38,7 +42,8 @@ int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
 
        if (payload->size < header_len) {
                ERR("Unexpected payload size in \"cmd_create_session_2_11\": expected >= %zu bytes, got %zu bytes",
-                               header_len, payload->size);
+                   header_len,
+                   payload->size);
                ret = -1;
                goto error;
        }
@@ -53,13 +58,15 @@ int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
        header.creation_time = be64toh(header.creation_time);
        header.session_id = be64toh(header.session_id);
 
-       std::copy(std::begin(header.sessiond_uuid), std::end(header.sessiond_uuid), sessiond_uuid.begin());
+       std::copy(std::begin(header.sessiond_uuid),
+                 std::end(header.sessiond_uuid),
+                 sessiond_uuid.begin());
 
-       received_names_size = header.session_name_len + header.hostname_len +
-                               header.base_path_len;
+       received_names_size = header.session_name_len + header.hostname_len + header.base_path_len;
        if (payload->size < header_len + received_names_size) {
                ERR("Unexpected payload size in \"cmd_create_session_2_11\": expected >= %zu bytes, got %zu bytes",
-                               header_len + received_names_size, payload->size);
+                   header_len + received_names_size,
+                   payload->size);
                ret = -1;
                goto error;
        }
@@ -67,7 +74,10 @@ int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
        /* Validate length against defined constant. */
        if (header.session_name_len > LTTNG_NAME_MAX) {
                ret = -ENAMETOOLONG;
-               ERR("Length of session name (%" PRIu32 " bytes) received in create_session command exceeds maximum length (%d bytes)", header.session_name_len, LTTNG_NAME_MAX);
+               ERR("Length of session name (%" PRIu32
+                   " bytes) received in create_session command exceeds maximum length (%d bytes)",
+                   header.session_name_len,
+                   LTTNG_NAME_MAX);
                goto error;
        } else if (header.session_name_len == 0) {
                ret = -EINVAL;
@@ -76,18 +86,23 @@ int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
        }
        if (header.hostname_len > LTTNG_HOST_NAME_MAX) {
                ret = -ENAMETOOLONG;
-               ERR("Length of hostname (%" PRIu32 " bytes) received in create_session command exceeds maximum length (%d bytes)", header.hostname_len, LTTNG_HOST_NAME_MAX);
+               ERR("Length of hostname (%" PRIu32
+                   " bytes) received in create_session command exceeds maximum length (%d bytes)",
+                   header.hostname_len,
+                   LTTNG_HOST_NAME_MAX);
                goto error;
        }
        if (header.base_path_len > LTTNG_PATH_MAX) {
                ret = -ENAMETOOLONG;
-               ERR("Length of base_path (%" PRIu32 " bytes) received in create_session command exceeds maximum length (%d bytes)", header.base_path_len, PATH_MAX);
+               ERR("Length of base_path (%" PRIu32
+                   " bytes) received in create_session command exceeds maximum length (%d bytes)",
+                   header.base_path_len,
+                   PATH_MAX);
                goto error;
        }
 
        offset = header_len;
-       session_name_view = lttng_buffer_view_from_view(payload, offset,
-                       header.session_name_len);
+       session_name_view = lttng_buffer_view_from_view(payload, offset, header.session_name_len);
        if (!lttng_buffer_view_is_valid(&session_name_view)) {
                ERR("Invalid payload in \"cmd_create_session_2_11\": buffer too short to contain session name");
                ret = -1;
@@ -95,8 +110,7 @@ int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
        }
 
        offset += header.session_name_len;
-       hostname_view = lttng_buffer_view_from_view(payload,
-                       offset, header.hostname_len);
+       hostname_view = lttng_buffer_view_from_view(payload, offset, header.hostname_len);
        if (!lttng_buffer_view_is_valid(&hostname_view)) {
                ERR("Invalid payload in \"cmd_create_session_2_11\": buffer too short to contain hostname");
                ret = -1;
@@ -104,8 +118,7 @@ int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
        }
 
        offset += header.hostname_len;
-       base_path_view = lttng_buffer_view_from_view(payload,
-                       offset, header.base_path_len);
+       base_path_view = lttng_buffer_view_from_view(payload, offset, header.base_path_len);
        if (header.base_path_len > 0 && !lttng_buffer_view_is_valid(&base_path_view)) {
                ERR("Invalid payload in \"cmd_create_session_2_11\": buffer too short to contain base path");
                ret = -1;
@@ -125,8 +138,7 @@ int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
                goto error;
        }
 
-       if (base_path_view.size != 0 &&
-                       base_path_view.data[base_path_view.size - 1] != '\0') {
+       if (base_path_view.size != 0 && base_path_view.data[base_path_view.size - 1] != '\0') {
                ERR("cmd_create_session_2_11 base_path is invalid (not NULL terminated)");
                ret = -1;
                goto error;
@@ -145,8 +157,7 @@ int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
        *current_chunk_id = header.current_chunk_id.value;
        *has_current_chunk = header.current_chunk_id.is_set;
        *creation_time = (time_t) header.creation_time;
-       *session_name_contains_creation_time =
-               header.session_name_contains_creation_time;
+       *session_name_contains_creation_time = header.session_name_contains_creation_time;
        *id_sessiond = header.session_id;
 
        ret = 0;
@@ -159,9 +170,11 @@ error:
  * cmd_recv_stream_2_11 allocates path_name and channel_name.
  */
 int cmd_recv_stream_2_11(const struct lttng_buffer_view *payload,
-               char **ret_path_name, char **ret_channel_name,
-               uint64_t *tracefile_size, uint64_t *tracefile_count,
-               uint64_t *trace_archive_id)
+                        char **ret_path_name,
+                        char **ret_channel_name,
+                        uint64_t *tracefile_size,
+                        uint64_t *tracefile_count,
+                        uint64_t *trace_archive_id)
 {
        int ret;
        struct lttcomm_relayd_add_stream_2_11 header;
@@ -175,7 +188,8 @@ int cmd_recv_stream_2_11(const struct lttng_buffer_view *payload,
 
        if (payload->size < header_len) {
                ERR("Unexpected payload size in \"cmd_recv_stream_2_11\": expected >= %zu bytes, got %zu bytes",
-                               header_len, payload->size);
+                   header_len,
+                   payload->size);
                ret = -1;
                goto error;
        }
@@ -190,7 +204,8 @@ int cmd_recv_stream_2_11(const struct lttng_buffer_view *payload,
        received_names_size = header.channel_name_len + header.pathname_len;
        if (payload->size < header_len + received_names_size) {
                ERR("Unexpected payload size in \"cmd_recv_stream_2_11\": expected >= %zu bytes, got %zu bytes",
-                               header_len + received_names_size, payload->size);
+                   header_len + received_names_size,
+                   payload->size);
                ret = -1;
                goto error;
        }
@@ -208,8 +223,8 @@ int cmd_recv_stream_2_11(const struct lttng_buffer_view *payload,
        }
 
        /* Validate that names are (NULL terminated. */
-       channel_name_view = lttng_buffer_view_from_view(payload, header_len,
-                       header.channel_name_len);
+       channel_name_view =
+               lttng_buffer_view_from_view(payload, header_len, header.channel_name_len);
        if (!lttng_buffer_view_is_valid(&channel_name_view)) {
                ERR("Invalid payload received in \"cmd_recv_stream_2_11\": buffer too short for channel name");
                ret = -1;
@@ -222,8 +237,8 @@ int cmd_recv_stream_2_11(const struct lttng_buffer_view *payload,
                goto error;
        }
 
-       pathname_view = lttng_buffer_view_from_view(payload,
-                       header_len + header.channel_name_len, header.pathname_len);
+       pathname_view = lttng_buffer_view_from_view(
+               payload, header_len + header.channel_name_len, header.pathname_len);
        if (!lttng_buffer_view_is_valid(&pathname_view)) {
                ERR("Invalid payload received in \"cmd_recv_stream_2_11\": buffer too short for path name");
                ret = -1;
index 3d9af63a313f5f2a9ff6bf9a6f451d62dcf25578..9b82b0f25073844c8b0d7bc8b742687bbeb31113 100644 (file)
@@ -9,23 +9,25 @@
 
 #define _LGPL_SOURCE
 
-#include <common/common.hpp>
-#include <common/sessiond-comm/relayd.hpp>
+#include "cmd-2-1.hpp"
+#include "cmd-2-2.hpp"
+#include "utils.hpp"
 
+#include <common/common.hpp>
 #include <common/compat/endian.hpp>
 #include <common/compat/string.hpp>
-#include <lttng/constant.h>
+#include <common/sessiond-comm/relayd.hpp>
 
-#include "cmd-2-2.hpp"
-#include "cmd-2-1.hpp"
-#include "utils.hpp"
+#include <lttng/constant.h>
 
 /*
  * cmd_recv_stream_2_2 allocates path_name and channel_name.
  */
 int cmd_recv_stream_2_2(const struct lttng_buffer_view *payload,
-               char **ret_path_name, char **ret_channel_name,
-               uint64_t *tracefile_size, uint64_t *tracefile_count)
+                       char **ret_path_name,
+                       char **ret_channel_name,
+                       uint64_t *tracefile_size,
+                       uint64_t *tracefile_count)
 {
        int ret;
        struct lttcomm_relayd_add_stream_2_2 stream_info;
@@ -35,7 +37,8 @@ int cmd_recv_stream_2_2(const struct lttng_buffer_view *payload,
 
        if (payload->size < sizeof(stream_info)) {
                ERR("Unexpected payload size in \"cmd_recv_stream_2_2\": expected >= %zu bytes, got %zu bytes",
-                               sizeof(stream_info), payload->size);
+                   sizeof(stream_info),
+                   payload->size);
                ret = -1;
                goto error;
        }
index 7b546c7f661d5babd2161c0e51abb98d0f250036..f67c05b892d9b939889833765e22965c8619741a 100644 (file)
@@ -9,19 +9,21 @@
 
 #define _LGPL_SOURCE
 
-#include <common/common.hpp>
-#include <common/sessiond-comm/relayd.hpp>
+#include "cmd-2-4.hpp"
+#include "lttng-relayd.hpp"
 
+#include <common/common.hpp>
 #include <common/compat/endian.hpp>
 #include <common/compat/string.hpp>
-#include <lttng/constant.h>
+#include <common/sessiond-comm/relayd.hpp>
 
-#include "cmd-2-4.hpp"
-#include "lttng-relayd.hpp"
+#include <lttng/constant.h>
 
 int cmd_create_session_2_4(const struct lttng_buffer_view *payload,
-               char *session_name, char *hostname,
-               uint32_t *live_timer, bool *snapshot)
+                          char *session_name,
+                          char *hostname,
+                          uint32_t *live_timer,
+                          bool *snapshot)
 {
        int ret;
        struct lttcomm_relayd_create_session_2_4 session_info;
@@ -29,7 +31,8 @@ int cmd_create_session_2_4(const struct lttng_buffer_view *payload,
 
        if (payload->size < sizeof(session_info)) {
                ERR("Unexpected payload size in \"cmd_create_session_2_4\": expected >= %zu bytes, got %zu bytes",
-                               sizeof(session_info), payload->size);
+                   sizeof(session_info),
+                   payload->size);
                ret = -1;
                goto error;
        }
index 711de3a5cff81a76a2ae3bd9fb8e1ca4cc6311bf..f8b364272e0374b0f43773de7903275d51d13cc2 100644 (file)
@@ -8,20 +8,20 @@
  */
 
 #define _LGPL_SOURCE
-#include <common/common.hpp>
-#include <urcu/rculist.h>
-
 #include "connection.hpp"
 #include "stream.hpp"
 #include "viewer-session.hpp"
 
+#include <common/common.hpp>
+
+#include <urcu/rculist.h>
+
 bool connection_get(struct relay_connection *conn)
 {
        return urcu_ref_get_unless_zero(&conn->ref);
 }
 
-struct relay_connection *connection_get_by_sock(struct lttng_ht *relay_connections_ht,
-               int sock)
+struct relay_connection *connection_get_by_sock(struct lttng_ht *relay_connections_ht, int sock)
 {
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
@@ -30,8 +30,7 @@ struct relay_connection *connection_get_by_sock(struct lttng_ht *relay_connectio
        LTTNG_ASSERT(sock >= 0);
 
        rcu_read_lock();
-       lttng_ht_lookup(relay_connections_ht, (void *)((unsigned long) sock),
-                       &iter);
+       lttng_ht_lookup(relay_connections_ht, (void *) ((unsigned long) sock), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
        if (!node) {
                DBG2("Relay connection by sock %d not found", sock);
@@ -52,41 +51,37 @@ int connection_reset_protocol_state(struct relay_connection *connection)
 
        switch (connection->type) {
        case RELAY_DATA:
-               connection->protocol.data.state_id =
-                               DATA_CONNECTION_STATE_RECEIVE_HEADER;
+               connection->protocol.data.state_id = DATA_CONNECTION_STATE_RECEIVE_HEADER;
                memset(&connection->protocol.data.state.receive_header,
-                               0,
-                               sizeof(connection->protocol.data.state.receive_header));
+                      0,
+                      sizeof(connection->protocol.data.state.receive_header));
                connection->protocol.data.state.receive_header.left_to_receive =
-                               sizeof(struct lttcomm_relayd_data_hdr);
+                       sizeof(struct lttcomm_relayd_data_hdr);
                break;
        case RELAY_CONTROL:
-               connection->protocol.ctrl.state_id =
-                               CTRL_CONNECTION_STATE_RECEIVE_HEADER;
+               connection->protocol.ctrl.state_id = CTRL_CONNECTION_STATE_RECEIVE_HEADER;
                memset(&connection->protocol.ctrl.state.receive_header,
-                               0,
-                               sizeof(connection->protocol.ctrl.state.receive_header));
+                      0,
+                      sizeof(connection->protocol.ctrl.state.receive_header));
                connection->protocol.data.state.receive_header.left_to_receive =
-                               sizeof(struct lttcomm_relayd_hdr);
-               ret = lttng_dynamic_buffer_set_size(
-                               &connection->protocol.ctrl.reception_buffer,
-                               sizeof(struct lttcomm_relayd_hdr));
+                       sizeof(struct lttcomm_relayd_hdr);
+               ret = lttng_dynamic_buffer_set_size(&connection->protocol.ctrl.reception_buffer,
+                                                   sizeof(struct lttcomm_relayd_hdr));
                if (ret) {
-                       ERR("Failed to reinitialize control connection reception buffer size to %zu bytes.", sizeof(struct lttcomm_relayd_hdr));
+                       ERR("Failed to reinitialize control connection reception buffer size to %zu bytes.",
+                           sizeof(struct lttcomm_relayd_hdr));
                        goto end;
                }
                break;
        default:
                goto end;
        }
-       DBG("Reset communication state of relay connection (fd = %i)",
-                       connection->sock->fd);
+       DBG("Reset communication state of relay connection (fd = %i)", connection->sock->fd);
 end:
        return ret;
 }
 
-struct relay_connection *connection_create(struct lttcomm_sock *sock,
-               enum connection_type type)
+struct relay_connection *connection_create(struct lttcomm_sock *sock, enum connection_type type)
 {
        struct relay_connection *conn;
 
@@ -118,8 +113,7 @@ static void rcu_free_connection(struct rcu_head *head)
                conn->viewer_session = NULL;
        }
        if (conn->type == RELAY_CONTROL) {
-               lttng_dynamic_buffer_reset(
-                               &conn->protocol.ctrl.reception_buffer);
+               lttng_dynamic_buffer_reset(&conn->protocol.ctrl.reception_buffer);
        }
        free(conn);
 }
@@ -131,8 +125,7 @@ static void destroy_connection(struct relay_connection *conn)
 
 static void connection_release(struct urcu_ref *ref)
 {
-       struct relay_connection *conn =
-               lttng::utils::container_of(ref, &relay_connection::ref);
+       struct relay_connection *conn = lttng::utils::container_of(ref, &relay_connection::ref);
 
        if (conn->in_socket_ht) {
                struct lttng_ht_iter iter;
@@ -162,8 +155,7 @@ void connection_put(struct relay_connection *conn)
        rcu_read_unlock();
 }
 
-void connection_ht_add(struct lttng_ht *relay_connections_ht,
-               struct relay_connection *conn)
+void connection_ht_add(struct lttng_ht *relay_connections_ht, struct relay_connection *conn)
 {
        LTTNG_ASSERT(!conn->in_socket_ht);
        lttng_ht_add_unique_ulong(relay_connections_ht, &conn->sock_n);
@@ -171,8 +163,7 @@ void connection_ht_add(struct lttng_ht *relay_connections_ht,
        conn->socket_ht = relay_connections_ht;
 }
 
-int connection_set_session(struct relay_connection *conn,
-               struct relay_session *session)
+int connection_set_session(struct relay_connection *conn, struct relay_session *session)
 {
        int ret = 0;
 
index 0ecb72f4593cc45932a1e0997814276e088426ee..9e8693333ebda098f02a8943c71016c2b8b2f9a2 100644 (file)
@@ -9,21 +9,21 @@
 
 #define _LGPL_SOURCE
 
-#include <common/common.hpp>
-#include <common/utils.hpp>
-#include <urcu/rculist.h>
-
 #include "ctf-trace.hpp"
 #include "lttng-relayd.hpp"
 #include "stream.hpp"
 
+#include <common/common.hpp>
+#include <common/utils.hpp>
+
+#include <urcu/rculist.h>
+
 static uint64_t last_relay_ctf_trace_id;
 static pthread_mutex_t last_relay_ctf_trace_id_lock = PTHREAD_MUTEX_INITIALIZER;
 
 static void rcu_destroy_ctf_trace(struct rcu_head *rcu_head)
 {
-       struct ctf_trace *trace =
-               lttng::utils::container_of(rcu_head, &ctf_trace::rcu_node);
+       struct ctf_trace *trace = lttng::utils::container_of(rcu_head, &ctf_trace::rcu_node);
 
        free(trace);
 }
@@ -52,8 +52,7 @@ static void ctf_trace_destroy(struct ctf_trace *trace)
 
 static void ctf_trace_release(struct urcu_ref *ref)
 {
-       struct ctf_trace *trace =
-               lttng::utils::container_of(ref, &ctf_trace::ref);
+       struct ctf_trace *trace = lttng::utils::container_of(ref, &ctf_trace::ref);
        int ret;
        struct lttng_ht_iter iter;
 
@@ -92,8 +91,7 @@ bool ctf_trace_get(struct ctf_trace *trace)
  * create and refcounting. Whenever all the streams belonging to a trace
  * put their reference, its refcount drops to 0.
  */
-static struct ctf_trace *ctf_trace_create(struct relay_session *session,
-               const char *subpath)
+static struct ctf_trace *ctf_trace_create(struct relay_session *session, const char *subpath)
 {
        struct ctf_trace *trace;
 
@@ -127,8 +125,10 @@ static struct ctf_trace *ctf_trace_create(struct relay_session *session,
        lttng_ht_add_str(session->ctf_traces_ht, &trace->node);
 
        DBG("Created ctf_trace %" PRIu64 " of session \"%s\" from host \"%s\" with path: %s",
-                       trace->id, session->session_name, session->hostname,
-                       subpath);
+           trace->id,
+           session->session_name,
+           session->hostname,
+           subpath);
 
 end:
        return trace;
@@ -143,7 +143,7 @@ error:
  * ctf_trace_put().
  */
 struct ctf_trace *ctf_trace_get_by_path_or_create(struct relay_session *session,
-               const char *subpath)
+                                                 const char *subpath)
 {
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
@@ -181,8 +181,8 @@ int ctf_trace_close(struct ctf_trace *trace)
        struct relay_stream *stream;
 
        rcu_read_lock();
-       cds_list_for_each_entry_rcu(stream, &trace->stream_list,
-                       stream_node) {
+       cds_list_for_each_entry_rcu(stream, &trace->stream_list, stream_node)
+       {
                /*
                 * Close stream since the connection owning the trace is being
                 * torn down.
index af8487bdb838dcc8490b4e4fde020993a2d5928f..a8f2899ea742ac7628cf645334c06a3f95268b4c 100644 (file)
@@ -6,44 +6,43 @@
  */
 
 #define _LGPL_SOURCE
+#include "health-relayd.hpp"
+#include "lttng-relayd.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/getenv.hpp>
+#include <common/compat/poll.hpp>
+#include <common/consumer/consumer-timer.hpp>
+#include <common/consumer/consumer.hpp>
+#include <common/defaults.hpp>
+#include <common/fd-tracker/utils.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/utils.hpp>
+
 #include <fcntl.h>
 #include <getopt.h>
 #include <grp.h>
+#include <inttypes.h>
 #include <limits.h>
+#include <poll.h>
 #include <pthread.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ipc.h>
+#include <sys/mman.h>
 #include <sys/resource.h>
 #include <sys/shm.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <urcu/list.h>
-#include <poll.h>
 #include <unistd.h>
-#include <sys/mman.h>
 #include <urcu/compiler.h>
-#include <inttypes.h>
-
-#include <common/defaults.hpp>
-#include <common/common.hpp>
-#include <common/consumer/consumer.hpp>
-#include <common/consumer/consumer-timer.hpp>
-#include <common/compat/poll.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/utils.hpp>
-#include <common/compat/getenv.hpp>
-#include <common/fd-tracker/utils.hpp>
-
-#include "lttng-relayd.hpp"
-#include "health-relayd.hpp"
+#include <urcu/list.h>
 
 /* Global health check unix path */
-static
-char health_unix_sock_path[PATH_MAX];
+static char health_unix_sock_path[PATH_MAX];
 
 int health_quit_pipe[2] = { -1, -1 };
 
@@ -97,7 +96,8 @@ static int create_lttng_rundir_with_perm(const char *rundir)
                        }
 
                        ret = chmod(rundir,
-                                       S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+                                   S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH |
+                                           S_IXOTH);
                        if (ret < 0) {
                                ERR("Unable to set permissions on %s", rundir);
                                PERROR("chmod");
@@ -111,23 +111,20 @@ error:
        return ret;
 }
 
-static
-int parse_health_env(void)
+static int parse_health_env(void)
 {
        const char *health_path;
 
        health_path = lttng_secure_getenv(LTTNG_RELAYD_HEALTH_ENV);
        if (health_path) {
-               strncpy(health_unix_sock_path, health_path,
-                       PATH_MAX);
+               strncpy(health_unix_sock_path, health_path, PATH_MAX);
                health_unix_sock_path[PATH_MAX - 1] = '\0';
        }
 
        return 0;
 }
 
-static
-int setup_health_path(void)
+static int setup_health_path(void)
 {
        int is_root, ret = 0;
        const char *home_path = NULL;
@@ -187,18 +184,21 @@ int setup_health_path(void)
                if (strlen(health_unix_sock_path) != 0) {
                        goto end;
                }
-               snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                       DEFAULT_GLOBAL_RELAY_HEALTH_UNIX_SOCK,
-                       (int) getpid());
+               snprintf(health_unix_sock_path,
+                        sizeof(health_unix_sock_path),
+                        DEFAULT_GLOBAL_RELAY_HEALTH_UNIX_SOCK,
+                        (int) getpid());
        } else {
                /* Set health check Unix path */
                if (strlen(health_unix_sock_path) != 0) {
                        goto end;
                }
 
-               snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
-                       DEFAULT_HOME_RELAY_HEALTH_UNIX_SOCK,
-                       home_path, (int) getpid());
+               snprintf(health_unix_sock_path,
+                        sizeof(health_unix_sock_path),
+                        DEFAULT_HOME_RELAY_HEALTH_UNIX_SOCK,
+                        home_path,
+                        (int) getpid());
        }
 
 end:
@@ -207,8 +207,7 @@ end:
        return ret;
 }
 
-static
-int accept_unix_socket(void *data, int *out_fd)
+static int accept_unix_socket(void *data, int *out_fd)
 {
        int ret;
        int accepting_sock = *((int *) data);
@@ -224,8 +223,7 @@ end:
        return ret;
 }
 
-static
-int open_unix_socket(void *data, int *out_fd)
+static int open_unix_socket(void *data, int *out_fd)
 {
        int ret;
        const char *path = (const char *) data;
@@ -270,9 +268,12 @@ void *thread_manage_health_relayd(void *data __attribute__((unused)))
                err = -1;
                goto error;
        }
-       ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker, &sock,
-                       (const char **) &sock_name, 1, open_unix_socket,
-                       health_unix_sock_path);
+       ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker,
+                                              &sock,
+                                              (const char **) &sock_name,
+                                              1,
+                                              open_unix_socket,
+                                              health_unix_sock_path);
        free(sock_name);
        if (ret < 0) {
                ERR("Unable to create health check Unix socket");
@@ -299,8 +300,7 @@ void *thread_manage_health_relayd(void *data __attribute__((unused)))
                        goto error;
                }
 
-               ret = chmod(health_unix_sock_path,
-                               S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+               ret = chmod(health_unix_sock_path, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
                if (ret < 0) {
                        ERR("Unable to set permissions on %s", health_unix_sock_path);
                        PERROR("chmod");
@@ -321,9 +321,8 @@ void *thread_manage_health_relayd(void *data __attribute__((unused)))
        }
 
        /* Size is set to 2 for the unix socket and quit pipe. */
-       ret = fd_tracker_util_poll_create(the_fd_tracker,
-                       "Health management thread epoll", &events, 2,
-                       LTTNG_CLOEXEC);
+       ret = fd_tracker_util_poll_create(
+               the_fd_tracker, "Health management thread epoll", &events, 2, LTTNG_CLOEXEC);
        if (ret < 0) {
                ERR("Poll set creation failed");
                goto error;
@@ -348,7 +347,7 @@ void *thread_manage_health_relayd(void *data __attribute__((unused)))
                DBG("Health check ready");
 
                /* Inifinite blocking call, waiting for transmission */
-restart:
+       restart:
                ret = lttng_poll_wait(&events, -1);
                if (ret < 0) {
                        /*
@@ -382,22 +381,28 @@ restart:
                                        ERR("Health socket poll error");
                                        goto error;
                                } else {
-                                       ERR("Unexpected poll events %u for sock %d", revents, pollfd);
+                                       ERR("Unexpected poll events %u for sock %d",
+                                           revents,
+                                           pollfd);
                                        goto error;
                                }
                        }
                }
 
-               ret = asprintf(&accepted_socket_name, "Socket accepted from unix socket @ %s",
-                               health_unix_sock_path);
+               ret = asprintf(&accepted_socket_name,
+                              "Socket accepted from unix socket @ %s",
+                              health_unix_sock_path);
                if (ret == -1) {
                        PERROR("Failed to allocate name of accepted socket from unix socket @ %s",
-                                       health_unix_sock_path);
+                              health_unix_sock_path);
                        goto error;
                }
-               ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker, &new_sock,
-                               (const char **) &accepted_socket_name, 1,
-                               accept_unix_socket, &sock);
+               ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker,
+                                                      &new_sock,
+                                                      (const char **) &accepted_socket_name,
+                                                      1,
+                                                      accept_unix_socket,
+                                                      &sock);
                free(accepted_socket_name);
                if (ret < 0) {
                        goto error;
@@ -410,12 +415,11 @@ restart:
                (void) utils_set_fd_cloexec(new_sock);
 
                DBG("Receiving data from client for health...");
-               ret = lttcomm_recv_unix_sock(new_sock, (void *)&msg, sizeof(msg));
+               ret = lttcomm_recv_unix_sock(new_sock, (void *) &msg, sizeof(msg));
                if (ret <= 0) {
                        DBG("Nothing recv() from client... continuing");
-                       ret = fd_tracker_close_unsuspendable_fd(the_fd_tracker,
-                                       &new_sock, 1, fd_tracker_util_close_fd,
-                                       NULL);
+                       ret = fd_tracker_close_unsuspendable_fd(
+                               the_fd_tracker, &new_sock, 1, fd_tracker_util_close_fd, NULL);
                        if (ret) {
                                PERROR("close");
                        }
@@ -446,9 +450,8 @@ restart:
                }
 
                /* End of transmission */
-               ret = fd_tracker_close_unsuspendable_fd(the_fd_tracker,
-                               &new_sock, 1, fd_tracker_util_close_fd,
-                               NULL);
+               ret = fd_tracker_close_unsuspendable_fd(
+                       the_fd_tracker, &new_sock, 1, fd_tracker_util_close_fd, NULL);
                if (ret) {
                        PERROR("close");
                }
@@ -464,8 +467,8 @@ exit:
        DBG("Health check thread dying");
        unlink(health_unix_sock_path);
        if (sock >= 0) {
-               ret = fd_tracker_close_unsuspendable_fd(the_fd_tracker, &sock,
-                               1, fd_tracker_util_close_fd, NULL);
+               ret = fd_tracker_close_unsuspendable_fd(
+                       the_fd_tracker, &sock, 1, fd_tracker_util_close_fd, NULL);
                if (ret) {
                        PERROR("close");
                }
index a20ae2658a505cfab8431546e458e960ac83f203..426a34b2470e3b7acf0053bbba60fd58edc9b751 100644 (file)
@@ -9,14 +9,14 @@
 
 #define _LGPL_SOURCE
 
-#include <common/common.hpp>
-#include <common/utils.hpp>
-#include <common/compat/endian.hpp>
-
+#include "connection.hpp"
+#include "index.hpp"
 #include "lttng-relayd.hpp"
 #include "stream.hpp"
-#include "index.hpp"
-#include "connection.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/endian.hpp>
+#include <common/utils.hpp>
 
 /*
  * Allocate a new relay index object. Pass the stream in which it is
  * Called with stream mutex held.
  * Return allocated object or else NULL on error.
  */
-static struct relay_index *relay_index_create(struct relay_stream *stream,
-               uint64_t net_seq_num)
+static struct relay_index *relay_index_create(struct relay_stream *stream, uint64_t net_seq_num)
 {
        struct relay_index *index;
 
        DBG2("Creating relay index for stream id %" PRIu64 " and seqnum %" PRIu64,
-                       stream->stream_handle, net_seq_num);
+            stream->stream_handle,
+            net_seq_num);
 
        index = zmalloc<relay_index>();
        if (!index) {
@@ -62,7 +62,7 @@ end:
  * RCU read side lock MUST be acquired.
  */
 static struct relay_index *relay_index_add_unique(struct relay_stream *stream,
-               struct relay_index *index)
+                                                 struct relay_index *index)
 {
        struct cds_lfht_node *node_ptr;
        struct relay_index *_index;
@@ -70,15 +70,16 @@ static struct relay_index *relay_index_add_unique(struct relay_stream *stream,
        ASSERT_RCU_READ_LOCKED();
 
        DBG2("Adding relay index with stream id %" PRIu64 " and seqnum %" PRIu64,
-                       stream->stream_handle, index->index_n.key);
+            stream->stream_handle,
+            index->index_n.key);
 
        node_ptr = cds_lfht_add_unique(stream->indexes_ht->ht,
-                       stream->indexes_ht->hash_fct(&index->index_n, lttng_ht_seed),
-                       stream->indexes_ht->match_fct, &index->index_n,
-                       &index->index_n.node);
+                                      stream->indexes_ht->hash_fct(&index->index_n, lttng_ht_seed),
+                                      stream->indexes_ht->match_fct,
+                                      &index->index_n,
+                                      &index->index_n.node);
        if (node_ptr != &index->index_n.node) {
-               _index = caa_container_of(node_ptr, struct relay_index,
-                               index_n.node);
+               _index = caa_container_of(node_ptr, struct relay_index, index_n.node);
        } else {
                _index = NULL;
        }
@@ -93,8 +94,9 @@ static bool relay_index_get(struct relay_index *index)
        ASSERT_RCU_READ_LOCKED();
 
        DBG2("index get for stream id %" PRIu64 " and seqnum %" PRIu64 " refcount %d",
-                       index->stream->stream_handle, index->index_n.key,
-                       (int) index->ref.refcount);
+            index->stream->stream_handle,
+            index->index_n.key,
+            (int) index->ref.refcount);
 
        return urcu_ref_get_unless_zero(&index->ref);
 }
@@ -107,14 +109,15 @@ static bool relay_index_get(struct relay_index *index)
  * Return index object or else NULL on error.
  */
 struct relay_index *relay_index_get_by_id_or_create(struct relay_stream *stream,
-                uint64_t net_seq_num)
+                                                   uint64_t net_seq_num)
 {
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
        struct relay_index *index = NULL;
 
        DBG3("Finding index for stream id %" PRIu64 " and seq_num %" PRIu64,
-                       stream->stream_handle, net_seq_num);
+            stream->stream_handle,
+            net_seq_num);
 
        rcu_read_lock();
        lttng_ht_lookup(stream->indexes_ht, &net_seq_num, &iter);
@@ -127,7 +130,8 @@ struct relay_index *relay_index_get_by_id_or_create(struct relay_stream *stream,
                index = relay_index_create(stream, net_seq_num);
                if (!index) {
                        ERR("Cannot create index for stream id %" PRIu64 " and seq_num %" PRIu64,
-                               stream->stream_handle, net_seq_num);
+                           stream->stream_handle,
+                           net_seq_num);
                        goto end;
                }
                oldindex = relay_index_add_unique(stream, index);
@@ -146,13 +150,15 @@ struct relay_index *relay_index_get_by_id_or_create(struct relay_stream *stream,
 end:
        rcu_read_unlock();
        DBG2("Index %sfound or created in HT for stream ID %" PRIu64 " and seqnum %" PRIu64,
-                       (index == NULL) ? "NOT " : "", stream->stream_handle, net_seq_num);
+            (index == NULL) ? "NOT " : "",
+            stream->stream_handle,
+            net_seq_num);
        return index;
 }
 
 int relay_index_set_file(struct relay_index *index,
-               struct lttng_index_file *index_file,
-               uint64_t data_offset)
+                        struct lttng_index_file *index_file,
+                        uint64_t data_offset)
 {
        int ret = 0;
 
@@ -169,8 +175,7 @@ end:
        return ret;
 }
 
-int relay_index_set_data(struct relay_index *index,
-               const struct ctf_packet_index *data)
+int relay_index_set_data(struct relay_index *index, const struct ctf_packet_index *data)
 {
        int ret = 0;
 
@@ -199,8 +204,7 @@ static void index_destroy(struct relay_index *index)
 
 static void index_destroy_rcu(struct rcu_head *rcu_head)
 {
-       struct relay_index *index =
-               lttng::utils::container_of(rcu_head, &relay_index::rcu_node);
+       struct relay_index *index = lttng::utils::container_of(rcu_head, &relay_index::rcu_node);
 
        index_destroy(index);
 }
@@ -239,8 +243,9 @@ static void index_release(struct urcu_ref *ref)
 void relay_index_put(struct relay_index *index)
 {
        DBG2("index put for stream id %" PRIu64 " and seqnum %" PRIu64 " refcount %d",
-                       index->stream->stream_handle, index->index_n.key,
-                       (int) index->ref.refcount);
+            index->stream->stream_handle,
+            index->index_n.key,
+            (int) index->ref.refcount);
        /*
         * Ensure existence of index->lock for index unlock.
         */
@@ -277,7 +282,8 @@ int relay_index_try_flush(struct relay_index *index)
        }
 
        DBG2("Writing index for stream ID %" PRIu64 " and seq num %" PRIu64,
-                       index->stream->stream_handle, index->index_n.key);
+            index->stream->stream_handle,
+            index->index_n.key);
        flushed = true;
        index->flushed = true;
        ret = lttng_index_file_write(index->index_file, &index->index_data);
@@ -301,8 +307,7 @@ void relay_index_close_all(struct relay_stream *stream)
        struct relay_index *index;
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(stream->indexes_ht->ht, &iter.iter,
-                       index, index_n.node) {
+       cds_lfht_for_each_entry (stream->indexes_ht->ht, &iter.iter, index, index_n.node) {
                /* Put self-ref from index. */
                relay_index_put(index);
        }
@@ -315,8 +320,7 @@ void relay_index_close_partial_fd(struct relay_stream *stream)
        struct relay_index *index;
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(stream->indexes_ht->ht, &iter.iter,
-                       index, index_n.node) {
+       cds_lfht_for_each_entry (stream->indexes_ht->ht, &iter.iter, index, index_n.node) {
                if (!index->index_file) {
                        continue;
                }
@@ -337,10 +341,8 @@ uint64_t relay_index_find_last(struct relay_stream *stream)
        uint64_t net_seq_num = -1ULL;
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(stream->indexes_ht->ht, &iter.iter,
-                       index, index_n.node) {
-               if (net_seq_num == -1ULL ||
-                               index->index_n.key > net_seq_num) {
+       cds_lfht_for_each_entry (stream->indexes_ht->ht, &iter.iter, index, index_n.node) {
+               if (net_seq_num == -1ULL || index->index_n.key > net_seq_num) {
                        net_seq_num = index->index_n.key;
                }
        }
@@ -352,10 +354,9 @@ uint64_t relay_index_find_last(struct relay_stream *stream)
  * Update the index file of an already existing relay_index.
  * Offsets by 'removed_data_count' the offset field of an index.
  */
-static
-int relay_index_switch_file(struct relay_index *index,
-               struct lttng_index_file *new_index_file,
-               uint64_t removed_data_count)
+static int relay_index_switch_file(struct relay_index *index,
+                                  struct lttng_index_file *new_index_file,
+                                  uint64_t removed_data_count)
 {
        int ret = 0;
        uint64_t offset;
@@ -390,10 +391,9 @@ int relay_index_switch_all_files(struct relay_stream *stream)
        int ret = 0;
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(stream->indexes_ht->ht, &iter.iter,
-                       index, index_n.node) {
-               ret = relay_index_switch_file(index, stream->index_file,
-                               stream->pos_after_last_complete_data_index);
+       cds_lfht_for_each_entry (stream->indexes_ht->ht, &iter.iter, index, index_n.node) {
+               ret = relay_index_switch_file(
+                       index, stream->index_file, stream->pos_after_last_complete_data_index);
                if (ret) {
                        goto end;
                }
@@ -407,11 +407,11 @@ end:
  * Set index data from the control port to a given index object.
  */
 int relay_index_set_control_data(struct relay_index *index,
-               const struct lttcomm_relayd_index *data,
-               unsigned int minor_version)
+                                const struct lttcomm_relayd_index *data,
+                                unsigned int minor_version)
 {
        /* The index on disk is encoded in big endian. */
-       ctf_packet_index index_data {};
+       ctf_packet_index index_data{};
 
        index_data.packet_size = htobe64(data->packet_size);
        index_data.content_size = htobe64(data->content_size);
index 4724a3adaab0bcbfe5d64dfc44245b57c0f202da..869c88d98b645d26783408efca8fff0cc07ae53a 100644 (file)
@@ -8,6 +8,36 @@
  */
 
 #define _LGPL_SOURCE
+#include "cmd.hpp"
+#include "connection.hpp"
+#include "ctf-trace.hpp"
+#include "health-relayd.hpp"
+#include "live.hpp"
+#include "lttng-relayd.hpp"
+#include "session.hpp"
+#include "stream.hpp"
+#include "testpoint.hpp"
+#include "utils.hpp"
+#include "viewer-session.hpp"
+#include "viewer-stream.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/endian.hpp>
+#include <common/compat/poll.hpp>
+#include <common/compat/socket.hpp>
+#include <common/defaults.hpp>
+#include <common/fd-tracker/utils.hpp>
+#include <common/fs-handle.hpp>
+#include <common/futex.hpp>
+#include <common/index/index.hpp>
+#include <common/sessiond-comm/inet.hpp>
+#include <common/sessiond-comm/relayd.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/uri.hpp>
+#include <common/utils.hpp>
+
+#include <lttng/lttng.h>
+
 #include <fcntl.h>
 #include <getopt.h>
 #include <grp.h>
@@ -18,6 +48,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <string>
 #include <sys/mman.h>
 #include <sys/mount.h>
 #include <sys/resource.h>
 #include <urcu/futex.h>
 #include <urcu/rculist.h>
 #include <urcu/uatomic.h>
-#include <string>
 
-#include <common/common.hpp>
-#include <common/compat/endian.hpp>
-#include <common/compat/poll.hpp>
-#include <common/compat/socket.hpp>
-#include <common/defaults.hpp>
-#include <common/fd-tracker/utils.hpp>
-#include <common/fs-handle.hpp>
-#include <common/futex.hpp>
-#include <common/index/index.hpp>
-#include <common/sessiond-comm/inet.hpp>
-#include <common/sessiond-comm/relayd.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/uri.hpp>
-#include <common/utils.hpp>
-#include <lttng/lttng.h>
-
-#include "cmd.hpp"
-#include "connection.hpp"
-#include "ctf-trace.hpp"
-#include "health-relayd.hpp"
-#include "live.hpp"
-#include "lttng-relayd.hpp"
-#include "session.hpp"
-#include "stream.hpp"
-#include "testpoint.hpp"
-#include "utils.hpp"
-#include "viewer-session.hpp"
-#include "viewer-stream.hpp"
-
-#define SESSION_BUF_DEFAULT_COUNT      16
+#define SESSION_BUF_DEFAULT_COUNT 16
 
 static struct lttng_uri *live_uri;
 
@@ -86,11 +87,9 @@ static pthread_t live_worker_thread;
 static struct relay_conn_queue viewer_conn_queue;
 
 static uint64_t last_relay_viewer_session_id;
-static pthread_mutex_t last_relay_viewer_session_id_lock =
-               PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t last_relay_viewer_session_id_lock = PTHREAD_MUTEX_INITIALIZER;
 
-static
-const char *lttng_viewer_command_str(lttng_viewer_command cmd)
+static const char *lttng_viewer_command_str(lttng_viewer_command cmd)
 {
        switch (cmd) {
        case LTTNG_VIEWER_CONNECT:
@@ -116,9 +115,8 @@ const char *lttng_viewer_command_str(lttng_viewer_command cmd)
        }
 }
 
-static
-const char *lttng_viewer_next_index_return_code_str(
-               enum lttng_viewer_next_index_return_code code)
+static const char *
+lttng_viewer_next_index_return_code_str(enum lttng_viewer_next_index_return_code code)
 {
        switch (code) {
        case LTTNG_VIEWER_INDEX_OK:
@@ -138,9 +136,7 @@ const char *lttng_viewer_next_index_return_code_str(
        }
 }
 
-static
-const char *lttng_viewer_attach_return_code_str(
-               enum lttng_viewer_attach_return_code code)
+static const char *lttng_viewer_attach_return_code_str(enum lttng_viewer_attach_return_code code)
 {
        switch (code) {
        case LTTNG_VIEWER_ATTACH_OK:
@@ -160,9 +156,8 @@ const char *lttng_viewer_attach_return_code_str(
        }
 };
 
-static
-const char *lttng_viewer_get_packet_return_code_str(
-               enum lttng_viewer_get_packet_return_code code)
+static const char *
+lttng_viewer_get_packet_return_code_str(enum lttng_viewer_get_packet_return_code code)
 {
        switch (code) {
        case LTTNG_VIEWER_GET_PACKET_OK:
@@ -181,8 +176,7 @@ const char *lttng_viewer_get_packet_return_code_str(
 /*
  * Cleanup the daemon
  */
-static
-void cleanup_relayd_live(void)
+static void cleanup_relayd_live(void)
 {
        DBG("Cleaning up");
 
@@ -196,8 +190,7 @@ void cleanup_relayd_live(void)
  * Return the size of the received message or else a negative value on error
  * with errno being set by recvmsg() syscall.
  */
-static
-ssize_t recv_request(struct lttcomm_sock *sock, void *buf, size_t size)
+static ssize_t recv_request(struct lttcomm_sock *sock, void *buf, size_t size)
 {
        ssize_t ret;
 
@@ -222,8 +215,7 @@ ssize_t recv_request(struct lttcomm_sock *sock, void *buf, size_t size)
  * Return the size of the sent message or else a negative value on error with
  * errno being set by sendmsg() syscall.
  */
-static
-ssize_t send_response(struct lttcomm_sock *sock, void *buf, size_t size)
+static ssize_t send_response(struct lttcomm_sock *sock, void *buf, size_t size)
 {
        ssize_t ret;
 
@@ -242,8 +234,7 @@ ssize_t send_response(struct lttcomm_sock *sock, void *buf, size_t size)
  * Returns 1 if new streams got added, 0 if nothing changed, a negative value
  * on error.
  */
-static
-int check_new_streams(struct relay_connection *conn)
+static int check_new_streams(struct relay_connection *conn)
 {
        struct relay_session *session;
        unsigned long current_val;
@@ -253,9 +244,9 @@ int check_new_streams(struct relay_connection *conn)
                goto end;
        }
        rcu_read_lock();
-       cds_list_for_each_entry_rcu(session,
-                       &conn->viewer_session->session_list,
-                       viewer_session_node) {
+       cds_list_for_each_entry_rcu(
+               session, &conn->viewer_session->session_list, viewer_session_node)
+       {
                if (!session_get(session)) {
                        continue;
                }
@@ -277,9 +268,8 @@ end:
  *
  * Return 0 on success or else a negative value.
  */
-static
-ssize_t send_viewer_streams(struct lttcomm_sock *sock,
-               uint64_t session_id, unsigned int ignore_sent_flag)
+static ssize_t
+send_viewer_streams(struct lttcomm_sock *sock, uint64_t session_id, unsigned int ignore_sent_flag)
 {
        ssize_t ret;
        struct lttng_ht_iter iter;
@@ -287,8 +277,7 @@ ssize_t send_viewer_streams(struct lttcomm_sock *sock,
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(viewer_streams_ht->ht, &iter.iter, vstream,
-                       stream_n.node) {
+       cds_lfht_for_each_entry (viewer_streams_ht->ht, &iter.iter, vstream, stream_n.node) {
                struct ctf_trace *ctf_trace;
                struct lttng_viewer_stream send_stream = {};
 
@@ -301,7 +290,7 @@ ssize_t send_viewer_streams(struct lttcomm_sock *sock,
                pthread_mutex_lock(&vstream->stream->lock);
                /* Ignore if not the same session. */
                if (vstream->stream->trace->session->id != session_id ||
-                               (!ignore_sent_flag && vstream->sent_flag)) {
+                   (!ignore_sent_flag && vstream->sent_flag)) {
                        pthread_mutex_unlock(&vstream->stream->lock);
                        viewer_stream_put(vstream);
                        continue;
@@ -310,26 +299,25 @@ ssize_t send_viewer_streams(struct lttcomm_sock *sock,
                ctf_trace = vstream->stream->trace;
                send_stream.id = htobe64(vstream->stream->stream_handle);
                send_stream.ctf_trace_id = htobe64(ctf_trace->id);
-               send_stream.metadata_flag = htobe32(
-                               vstream->stream->is_metadata);
-               if (lttng_strncpy(send_stream.path_name, vstream->path_name,
-                               sizeof(send_stream.path_name))) {
+               send_stream.metadata_flag = htobe32(vstream->stream->is_metadata);
+               if (lttng_strncpy(send_stream.path_name,
+                                 vstream->path_name,
+                                 sizeof(send_stream.path_name))) {
                        pthread_mutex_unlock(&vstream->stream->lock);
                        viewer_stream_put(vstream);
-                       ret = -1;       /* Error. */
+                       ret = -1; /* Error. */
                        goto end_unlock;
                }
                if (lttng_strncpy(send_stream.channel_name,
-                               vstream->channel_name,
-                               sizeof(send_stream.channel_name))) {
+                                 vstream->channel_name,
+                                 sizeof(send_stream.channel_name))) {
                        pthread_mutex_unlock(&vstream->stream->lock);
                        viewer_stream_put(vstream);
-                       ret = -1;       /* Error. */
+                       ret = -1; /* Error. */
                        goto end_unlock;
                }
 
-               DBG("Sending stream %" PRIu64 " to viewer",
-                               vstream->stream->stream_handle);
+               DBG("Sending stream %" PRIu64 " to viewer", vstream->stream->stream_handle);
                vstream->sent_flag = 1;
                pthread_mutex_unlock(&vstream->stream->lock);
 
@@ -359,12 +347,12 @@ end_unlock:
  * Return 0 on success or else a negative value.
  */
 static int make_viewer_streams(struct relay_session *relay_session,
-               struct relay_viewer_session *viewer_session,
-               enum lttng_viewer_seek seek_t,
-               uint32_t *nb_total,
-               uint32_t *nb_unsent,
-               uint32_t *nb_created,
-               bool *closed)
+                              struct relay_viewer_session *viewer_session,
+                              enum lttng_viewer_seek seek_t,
+                              uint32_t *nb_total,
+                              uint32_t *nb_unsent,
+                              uint32_t *nb_created,
+                              bool *closed)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -383,8 +371,8 @@ static int make_viewer_streams(struct relay_session *relay_session,
         * used for a the given session id only.
         */
        rcu_read_lock();
-       cds_lfht_for_each_entry (relay_session->ctf_traces_ht->ht, &iter.iter,
-                       ctf_trace, node.node) {
+       cds_lfht_for_each_entry (
+               relay_session->ctf_traces_ht->ht, &iter.iter, ctf_trace, node.node) {
                bool trace_has_metadata_stream = false;
 
                health_code_update();
@@ -397,8 +385,7 @@ static int make_viewer_streams(struct relay_session *relay_session,
                 * Iterate over all the streams of the trace to see if we have a
                 * metadata stream.
                 */
-               cds_list_for_each_entry_rcu(relay_stream,
-                               &ctf_trace->stream_list, stream_node)
+               cds_list_for_each_entry_rcu(relay_stream, &ctf_trace->stream_list, stream_node)
                {
                        bool is_metadata_stream;
 
@@ -419,14 +406,12 @@ static int make_viewer_streams(struct relay_session *relay_session,
                 * and we never sent one to the viewer, skip the trace. We
                 * accept that the viewer will not see this trace at all.
                 */
-               if (!trace_has_metadata_stream &&
-                               !ctf_trace->metadata_stream_sent_to_viewer) {
+               if (!trace_has_metadata_stream && !ctf_trace->metadata_stream_sent_to_viewer) {
                        ctf_trace_put(ctf_trace);
                        continue;
                }
 
-               cds_list_for_each_entry_rcu(relay_stream,
-                               &ctf_trace->stream_list, stream_node)
+               cds_list_for_each_entry_rcu(relay_stream, &ctf_trace->stream_list, stream_node)
                {
                        struct relay_viewer_stream *viewer_stream;
 
@@ -441,8 +426,7 @@ static int make_viewer_streams(struct relay_session *relay_session,
                        if (!relay_stream->published) {
                                goto next;
                        }
-                       viewer_stream = viewer_stream_get_by_id(
-                                       relay_stream->stream_handle);
+                       viewer_stream = viewer_stream_get_by_id(relay_stream->stream_handle);
                        if (!viewer_stream) {
                                struct lttng_trace_chunk *viewer_stream_trace_chunk = NULL;
 
@@ -464,10 +448,10 @@ static int make_viewer_streams(struct relay_session *relay_session,
                                 * chunk can be used safely.
                                 */
                                if ((relay_stream->ongoing_rotation.is_set ||
-                                               session_has_ongoing_rotation(relay_session)) &&
-                                               relay_stream->trace_chunk) {
-                                       viewer_stream_trace_chunk = lttng_trace_chunk_copy(
-                                                       relay_stream->trace_chunk);
+                                    session_has_ongoing_rotation(relay_session)) &&
+                                   relay_stream->trace_chunk) {
+                                       viewer_stream_trace_chunk =
+                                               lttng_trace_chunk_copy(relay_stream->trace_chunk);
                                        if (!viewer_stream_trace_chunk) {
                                                ret = -1;
                                                ctf_trace_put(ctf_trace);
@@ -475,14 +459,14 @@ static int make_viewer_streams(struct relay_session *relay_session,
                                        }
                                } else {
                                        /*
-                                        * Transition the viewer session into the newest trace chunk available.
+                                        * Transition the viewer session into the newest trace chunk
+                                        * available.
                                         */
-                                       if (!lttng_trace_chunk_ids_equal(viewer_session->current_trace_chunk,
-                                                       relay_stream->trace_chunk)) {
-
+                                       if (!lttng_trace_chunk_ids_equal(
+                                                   viewer_session->current_trace_chunk,
+                                                   relay_stream->trace_chunk)) {
                                                ret = viewer_session_set_trace_chunk_copy(
-                                                               viewer_session,
-                                                               relay_stream->trace_chunk);
+                                                       viewer_session, relay_stream->trace_chunk);
                                                if (ret) {
                                                        ret = -1;
                                                        ctf_trace_put(ctf_trace);
@@ -503,19 +487,18 @@ static int make_viewer_streams(struct relay_session *relay_session,
                                                 * clear against a stopped
                                                 * session).
                                                 */
-                                               const bool reference_acquired = lttng_trace_chunk_get(
+                                               const bool reference_acquired =
+                                                       lttng_trace_chunk_get(
                                                                viewer_session->current_trace_chunk);
 
                                                LTTNG_ASSERT(reference_acquired);
                                                viewer_stream_trace_chunk =
-                                                               viewer_session->current_trace_chunk;
+                                                       viewer_session->current_trace_chunk;
                                        }
                                }
 
                                viewer_stream = viewer_stream_create(
-                                               relay_stream,
-                                               viewer_stream_trace_chunk,
-                                               seek_t);
+                                       relay_stream, viewer_stream_trace_chunk, seek_t);
                                lttng_trace_chunk_put(viewer_stream_trace_chunk);
                                viewer_stream_trace_chunk = NULL;
                                if (!viewer_stream) {
@@ -546,15 +529,14 @@ static int make_viewer_streams(struct relay_session *relay_session,
                        if (nb_total) {
                                if (relay_stream->is_metadata) {
                                        if (!relay_stream->closed ||
-                                                       relay_stream->metadata_received >
-                                                                       viewer_stream->metadata_sent) {
+                                           relay_stream->metadata_received >
+                                                   viewer_stream->metadata_sent) {
                                                (*nb_total)++;
                                        }
                                } else {
                                        if (!relay_stream->closed ||
-                                                       !(((int64_t)(relay_stream->prev_data_seq -
-                                                                         relay_stream->last_net_seq_num)) >=
-                                                                       0)) {
+                                           !(((int64_t) (relay_stream->prev_data_seq -
+                                                         relay_stream->last_net_seq_num)) >= 0)) {
                                                (*nb_total)++;
                                        }
                                }
@@ -590,8 +572,7 @@ int relayd_live_stop(void)
        return 0;
 }
 
-static
-int create_sock(void *data, int *out_fd)
+static int create_sock(void *data, int *out_fd)
 {
        int ret;
        struct lttcomm_sock *sock = (lttcomm_sock *) data;
@@ -606,8 +587,7 @@ end:
        return ret;
 }
 
-static
-int close_sock(void *data, int *in_fd __attribute__((unused)))
+static int close_sock(void *data, int *in_fd __attribute__((unused)))
 {
        struct lttcomm_sock *sock = (lttcomm_sock *) data;
 
@@ -631,16 +611,14 @@ end:
        return ret;
 }
 
-static
-struct lttcomm_sock *accept_live_sock(struct lttcomm_sock *listening_sock,
-               const char *name)
+static struct lttcomm_sock *accept_live_sock(struct lttcomm_sock *listening_sock, const char *name)
 {
        int out_fd, ret;
        struct lttcomm_sock *socks[2] = { listening_sock, NULL };
        struct lttcomm_sock *new_sock = NULL;
 
-       ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker, &out_fd,
-                       (const char **) &name, 1, accept_sock, &socks);
+       ret = fd_tracker_open_unsuspendable_fd(
+               the_fd_tracker, &out_fd, (const char **) &name, 1, accept_sock, &socks);
        if (ret) {
                goto end;
        }
@@ -653,8 +631,7 @@ end:
 /*
  * Create and init socket from uri.
  */
-static
-struct lttcomm_sock *init_socket(struct lttng_uri *uri, const char *name)
+static struct lttcomm_sock *init_socket(struct lttng_uri *uri, const char *name)
 {
        int ret, sock_fd;
        struct lttcomm_sock *sock = NULL;
@@ -674,19 +651,21 @@ struct lttcomm_sock *init_socket(struct lttng_uri *uri, const char *name)
        ret = uri_to_str_url(uri, uri_str, sizeof(uri_str));
        uri_str[sizeof(uri_str) - 1] = '\0';
        if (ret >= 0) {
-               ret = asprintf(&formated_name, "%s socket @ %s", name,
-                               uri_str);
+               ret = asprintf(&formated_name, "%s socket @ %s", name, uri_str);
                if (ret < 0) {
                        formated_name = NULL;
                }
        }
 
-       ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker, &sock_fd,
-                       (const char **) (formated_name ? &formated_name : NULL),
-                       1, create_sock, sock);
+       ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker,
+                                              &sock_fd,
+                                              (const char **) (formated_name ? &formated_name :
+                                                                               NULL),
+                                              1,
+                                              create_sock,
+                                              sock);
        if (ret) {
-               PERROR("Failed to create \"%s\" socket",
-                               formated_name ?: "Unknown");
+               PERROR("Failed to create \"%s\" socket", formated_name ?: "Unknown");
                goto error;
        }
        DBG("Listening on %s socket %d", name, sock->fd);
@@ -700,7 +679,6 @@ struct lttcomm_sock *init_socket(struct lttng_uri *uri, const char *name)
        ret = sock->ops->listen(sock, -1);
        if (ret < 0) {
                goto error;
-
        }
 
        free(formated_name);
@@ -717,8 +695,7 @@ error:
 /*
  * This thread manages the listening for new connections on the network
  */
-static
-void *thread_listener(void *data __attribute__((unused)))
+static void *thread_listener(void *data __attribute__((unused)))
 {
        int i, ret, err = -1;
        uint32_t nb_fd;
@@ -738,8 +715,7 @@ void *thread_listener(void *data __attribute__((unused)))
        }
 
        /* Pass 2 as size here for the thread quit pipe and control sockets. */
-       ret = create_named_thread_poll_set(&events, 2,
-                       "Live listener thread epoll");
+       ret = create_named_thread_poll_set(&events, 2, "Live listener thread epoll");
        if (ret < 0) {
                goto error_create_poll;
        }
@@ -761,7 +737,7 @@ void *thread_listener(void *data __attribute__((unused)))
 
                DBG("Listener accepting live viewers connections");
 
-restart:
+       restart:
                health_poll_entry();
                ret = lttng_poll_wait(&events, -1);
                health_poll_exit();
@@ -803,15 +779,15 @@ restart:
                                struct lttcomm_sock *newsock;
 
                                newsock = accept_live_sock(live_control_sock,
-                                               "Live socket to client");
+                                                          "Live socket to client");
                                if (!newsock) {
                                        PERROR("accepting control sock");
                                        goto error;
                                }
                                DBG("Relay viewer connection accepted socket %d", newsock->fd);
 
-                               ret = setsockopt(newsock->fd, SOL_SOCKET, SO_REUSEADDR, &val,
-                                               sizeof(val));
+                               ret = setsockopt(
+                                       newsock->fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
                                if (ret < 0) {
                                        PERROR("setsockopt inet");
                                        lttcomm_destroy_sock(newsock);
@@ -828,8 +804,7 @@ restart:
                                /* Enqueue request for the dispatcher thread. */
                                cds_wfcq_head_ptr_t head;
                                head.h = &viewer_conn_queue.head;
-                               cds_wfcq_enqueue(head, &viewer_conn_queue.tail,
-                                                &new_conn->qnode);
+                               cds_wfcq_enqueue(head, &viewer_conn_queue.tail, &new_conn->qnode);
 
                                /*
                                 * Wake the dispatch queue futex.
@@ -856,9 +831,8 @@ error_create_poll:
        if (live_control_sock->fd >= 0) {
                int sock_fd = live_control_sock->fd;
 
-               ret = fd_tracker_close_unsuspendable_fd(the_fd_tracker,
-                               &sock_fd, 1, close_sock,
-                               live_control_sock);
+               ret = fd_tracker_close_unsuspendable_fd(
+                       the_fd_tracker, &sock_fd, 1, close_sock, live_control_sock);
                if (ret) {
                        PERROR("close");
                }
@@ -882,8 +856,7 @@ error_sock_control:
 /*
  * This thread manages the dispatching of the requests to worker threads
  */
-static
-void *thread_dispatcher(void *data __attribute__((unused)))
+static void *thread_dispatcher(void *data __attribute__((unused)))
 {
        int err = -1;
        ssize_t ret;
@@ -918,13 +891,12 @@ void *thread_dispatcher(void *data __attribute__((unused)))
                                                         &viewer_conn_queue.tail);
                        if (node == NULL) {
                                DBG("Woken up but nothing in the live-viewer "
-                                               "relay command queue");
+                                   "relay command queue");
                                /* Continue thread execution */
                                break;
                        }
                        conn = lttng::utils::container_of(node, &relay_connection::qnode);
-                       DBG("Dispatching viewer request waiting on sock %d",
-                                       conn->sock->fd);
+                       DBG("Dispatching viewer request waiting on sock %d", conn->sock->fd);
 
                        /*
                         * Inform worker thread of the new request. This
@@ -968,8 +940,7 @@ error_testpoint:
  *
  * Return 0 on success or else negative value.
  */
-static
-int viewer_connect(struct relay_connection *conn)
+static int viewer_connect(struct relay_connection *conn)
 {
        int ret;
        struct lttng_viewer_connect reply, msg;
@@ -992,7 +963,8 @@ int viewer_connect(struct relay_connection *conn)
        /* Major versions must be the same */
        if (reply.major != be32toh(msg.major)) {
                DBG("Incompatible major versions ([relayd] %u vs [client] %u)",
-                               reply.major, be32toh(msg.major));
+                   reply.major,
+                   be32toh(msg.major));
                ret = -1;
                goto end;
        }
@@ -1053,8 +1025,7 @@ end:
  *
  * Return 0 on success or else a negative value.
  */
-static
-int viewer_list_sessions(struct relay_connection *conn)
+static int viewer_list_sessions(struct relay_connection *conn)
 {
        int ret = 0;
        struct lttng_viewer_list_sessions session_list;
@@ -1070,8 +1041,7 @@ int viewer_list_sessions(struct relay_connection *conn)
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(sessions_ht->ht, &iter.iter, session,
-                       session_n.node) {
+       cds_lfht_for_each_entry (sessions_ht->ht, &iter.iter, session, session_n.node) {
                struct lttng_viewer_session *send_session;
 
                health_code_update();
@@ -1086,8 +1056,8 @@ int viewer_list_sessions(struct relay_connection *conn)
                        struct lttng_viewer_session *newbuf;
                        uint32_t new_buf_count = buf_count << 1;
 
-                       newbuf = (lttng_viewer_session *) realloc(send_session_buf,
-                               new_buf_count * sizeof(*send_session_buf));
+                       newbuf = (lttng_viewer_session *) realloc(
+                               send_session_buf, new_buf_count * sizeof(*send_session_buf));
                        if (!newbuf) {
                                ret = -1;
                                goto break_loop;
@@ -1097,13 +1067,14 @@ int viewer_list_sessions(struct relay_connection *conn)
                }
                send_session = &send_session_buf[count];
                if (lttng_strncpy(send_session->session_name,
-                               session->session_name,
-                               sizeof(send_session->session_name))) {
+                                 session->session_name,
+                                 sizeof(send_session->session_name))) {
                        ret = -1;
                        goto break_loop;
                }
-               if (lttng_strncpy(send_session->hostname, session->hostname,
-                               sizeof(send_session->hostname))) {
+               if (lttng_strncpy(send_session->hostname,
+                                 session->hostname,
+                                 sizeof(send_session->hostname))) {
                        ret = -1;
                        goto break_loop;
                }
@@ -1139,8 +1110,7 @@ int viewer_list_sessions(struct relay_connection *conn)
 
        health_code_update();
 
-       ret = send_response(conn->sock, send_session_buf,
-                       count * sizeof(*send_session_buf));
+       ret = send_response(conn->sock, send_session_buf, count * sizeof(*send_session_buf));
        if (ret < 0) {
                goto end_free;
        }
@@ -1155,8 +1125,7 @@ end_free:
 /*
  * Send the viewer the list of current streams.
  */
-static
-int viewer_get_new_streams(struct relay_connection *conn)
+static int viewer_get_new_streams(struct relay_connection *conn)
 {
        int ret, send_streams = 0;
        uint32_t nb_created = 0, nb_unsent = 0, nb_streams = 0, nb_total = 0;
@@ -1214,9 +1183,12 @@ int viewer_get_new_streams(struct relay_connection *conn)
                goto send_reply_unlock;
        }
        ret = make_viewer_streams(session,
-                       conn->viewer_session,
-                       LTTNG_VIEWER_SEEK_BEGINNING, &nb_total, &nb_unsent,
-                       &nb_created, &closed);
+                                 conn->viewer_session,
+                                 LTTNG_VIEWER_SEEK_BEGINNING,
+                                 &nb_total,
+                                 &nb_unsent,
+                                 &nb_created,
+                                 &closed);
        if (ret < 0) {
                /*
                 * This is caused by an internal error; propagate the negative
@@ -1283,8 +1255,7 @@ error:
 /*
  * Send the viewer the list of current sessions.
  */
-static
-int viewer_attach_session(struct relay_connection *conn)
+static int viewer_attach_session(struct relay_connection *conn)
 {
        int send_streams = 0;
        ssize_t ret;
@@ -1316,7 +1287,7 @@ int viewer_attach_session(struct relay_connection *conn)
        if (!conn->viewer_session) {
                viewer_attach_status = LTTNG_VIEWER_ATTACH_NO_SESSION;
                DBG("Client trying to attach before creating a live viewer session, returning status=%s",
-                               lttng_viewer_attach_return_code_str(viewer_attach_status));
+                   lttng_viewer_attach_return_code_str(viewer_attach_status));
                goto send_reply;
        }
 
@@ -1324,8 +1295,8 @@ int viewer_attach_session(struct relay_connection *conn)
        if (!session) {
                viewer_attach_status = LTTNG_VIEWER_ATTACH_UNK;
                DBG("Relay session %" PRIu64 " not found, returning status=%s",
-                               session_id,
-                               lttng_viewer_attach_return_code_str(viewer_attach_status));
+                   session_id,
+                   lttng_viewer_attach_return_code_str(viewer_attach_status));
                goto send_reply;
        }
        DBG("Attach relay session ID %" PRIu64 " received", session_id);
@@ -1334,18 +1305,17 @@ int viewer_attach_session(struct relay_connection *conn)
        if (session->live_timer == 0) {
                viewer_attach_status = LTTNG_VIEWER_ATTACH_NOT_LIVE;
                DBG("Relay session ID %" PRIu64 " is not a live session, returning status=%s",
-                               session_id,
-                               lttng_viewer_attach_return_code_str(viewer_attach_status));
+                   session_id,
+                   lttng_viewer_attach_return_code_str(viewer_attach_status));
                goto send_reply;
        }
 
        send_streams = 1;
-       viewer_attach_status = viewer_session_attach(conn->viewer_session,
-                       session);
+       viewer_attach_status = viewer_session_attach(conn->viewer_session, session);
        if (viewer_attach_status != LTTNG_VIEWER_ATTACH_OK) {
                DBG("Error attaching to relay session %" PRIu64 ", returning status=%s",
-                               session_id,
-                               lttng_viewer_attach_return_code_str(viewer_attach_status));
+                   session_id,
+                   lttng_viewer_attach_return_code_str(viewer_attach_status));
                goto send_reply;
        }
 
@@ -1356,9 +1326,9 @@ int viewer_attach_session(struct relay_connection *conn)
                seek_type = (lttng_viewer_seek) be32toh(request.seek);
                break;
        default:
-               ERR("Wrong seek parameter for relay session %" PRIu64
-                               ", returning status=%s", session_id,
-                               lttng_viewer_attach_return_code_str(viewer_attach_status));
+               ERR("Wrong seek parameter for relay session %" PRIu64 ", returning status=%s",
+                   session_id,
+                   lttng_viewer_attach_return_code_str(viewer_attach_status));
                viewer_attach_status = LTTNG_VIEWER_ATTACH_SEEK_ERR;
                send_streams = 0;
                goto send_reply;
@@ -1375,9 +1345,8 @@ int viewer_attach_session(struct relay_connection *conn)
                goto send_reply;
        }
 
-       ret = make_viewer_streams(session,
-                       conn->viewer_session, seek_type,
-                       &nb_streams, NULL, NULL, &closed);
+       ret = make_viewer_streams(
+               session, conn->viewer_session, seek_type, &nb_streams, NULL, NULL, &closed);
        if (ret < 0) {
                goto end_put_session;
        }
@@ -1397,8 +1366,8 @@ int viewer_attach_session(struct relay_connection *conn)
                response.streams_count = 0;
                viewer_attach_status = LTTNG_VIEWER_ATTACH_UNK;
                ERR("Session %" PRIu64 " is closed, returning status=%s",
-                               session_id,
-                               lttng_viewer_attach_return_code_str(viewer_attach_status));
+                   session_id,
+                   lttng_viewer_attach_return_code_str(viewer_attach_status));
                goto send_reply;
        }
 
@@ -1447,8 +1416,7 @@ error:
  *
  * Called with rstream lock held.
  */
-static int try_open_index(struct relay_viewer_stream *vstream,
-               struct relay_stream *rstream)
+static int try_open_index(struct relay_viewer_stream *vstream, struct relay_stream *rstream)
 {
        int ret = 0;
        const uint32_t connection_major = rstream->trace->session->major;
@@ -1462,19 +1430,21 @@ static int try_open_index(struct relay_viewer_stream *vstream,
        /*
         * First time, we open the index file and at least one index is ready.
         */
-       if (rstream->index_received_seqcount == 0 ||
-                       !vstream->stream_file.trace_chunk) {
+       if (rstream->index_received_seqcount == 0 || !vstream->stream_file.trace_chunk) {
                ret = -ENOENT;
                goto end;
        }
 
        chunk_status = lttng_index_file_create_from_trace_chunk_read_only(
-                       vstream->stream_file.trace_chunk, rstream->path_name,
-                       rstream->channel_name, rstream->tracefile_size,
-                       vstream->current_tracefile_id,
-                       lttng_to_index_major(connection_major, connection_minor),
-                       lttng_to_index_minor(connection_major, connection_minor),
-                       true, &vstream->index_file);
+               vstream->stream_file.trace_chunk,
+               rstream->path_name,
+               rstream->channel_name,
+               rstream->tracefile_size,
+               vstream->current_tracefile_id,
+               lttng_to_index_major(connection_major, connection_minor),
+               lttng_to_index_minor(connection_major, connection_minor),
+               true,
+               &vstream->index_file);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                if (chunk_status == LTTNG_TRACE_CHUNK_STATUS_NO_FILE) {
                        ret = -ENOENT;
@@ -1499,37 +1469,37 @@ end:
  * Called with rstream lock held.
  */
 static int check_index_status(struct relay_viewer_stream *vstream,
-               struct relay_stream *rstream, struct ctf_trace *trace,
-               struct lttng_viewer_index *index)
+                             struct relay_stream *rstream,
+                             struct ctf_trace *trace,
+                             struct lttng_viewer_index *index)
 {
        int ret;
 
        DBG("Check index status: index_received_seqcount %" PRIu64 " "
-                               "index_sent_seqcount %" PRIu64 " "
-                               "for stream %" PRIu64,
-                               rstream->index_received_seqcount,
-                               vstream->index_sent_seqcount,
-                               vstream->stream->stream_handle);
-       if ((trace->session->connection_closed || rstream->closed)
-                       && rstream->index_received_seqcount
-                               == vstream->index_sent_seqcount) {
+           "index_sent_seqcount %" PRIu64 " "
+           "for stream %" PRIu64,
+           rstream->index_received_seqcount,
+           vstream->index_sent_seqcount,
+           vstream->stream->stream_handle);
+       if ((trace->session->connection_closed || rstream->closed) &&
+           rstream->index_received_seqcount == vstream->index_sent_seqcount) {
                /*
                 * Last index sent and session connection or relay
                 * stream are closed.
                 */
                index->status = LTTNG_VIEWER_INDEX_HUP;
                DBG("Check index status: Connection or stream are closed, stream %" PRIu64
-                       ",connection-closed=%d, relay-stream-closed=%d, returning status=%s",
-                       vstream->stream->stream_handle,
-                       trace->session->connection_closed, rstream->closed,
-                       lttng_viewer_next_index_return_code_str(
-                               (enum lttng_viewer_next_index_return_code) index->status));
+                   ",connection-closed=%d, relay-stream-closed=%d, returning status=%s",
+                   vstream->stream->stream_handle,
+                   trace->session->connection_closed,
+                   rstream->closed,
+                   lttng_viewer_next_index_return_code_str(
+                           (enum lttng_viewer_next_index_return_code) index->status));
                goto hup;
        } else if (rstream->beacon_ts_end != -1ULL &&
-                       (rstream->index_received_seqcount == 0 ||
-                       (vstream->index_sent_seqcount != 0 &&
-                       rstream->index_received_seqcount
-                               <= vstream->index_sent_seqcount))) {
+                  (rstream->index_received_seqcount == 0 ||
+                   (vstream->index_sent_seqcount != 0 &&
+                    rstream->index_received_seqcount <= vstream->index_sent_seqcount))) {
                /*
                 * We've received a synchronization beacon and the last index
                 * available has been sent, the index for now is inactive.
@@ -1549,15 +1519,14 @@ static int check_index_status(struct relay_viewer_stream *vstream,
                index->timestamp_end = htobe64(rstream->beacon_ts_end);
                index->stream_id = htobe64(rstream->ctf_stream_id);
                DBG("Check index status: inactive with beacon, for stream %" PRIu64
-                       ", returning status=%s",
-                       vstream->stream->stream_handle,
-                       lttng_viewer_next_index_return_code_str(
-                               (enum lttng_viewer_next_index_return_code) index->status));
+                   ", returning status=%s",
+                   vstream->stream->stream_handle,
+                   lttng_viewer_next_index_return_code_str(
+                           (enum lttng_viewer_next_index_return_code) index->status));
                goto index_ready;
        } else if (rstream->index_received_seqcount == 0 ||
-                       (vstream->index_sent_seqcount != 0 &&
-                       rstream->index_received_seqcount
-                               <= vstream->index_sent_seqcount)) {
+                  (vstream->index_sent_seqcount != 0 &&
+                   rstream->index_received_seqcount <= vstream->index_sent_seqcount)) {
                /*
                 * This checks whether received <= sent seqcount. In
                 * this case, we have not received a beacon. Therefore,
@@ -1571,32 +1540,29 @@ static int check_index_status(struct relay_viewer_stream *vstream,
                 */
                index->status = LTTNG_VIEWER_INDEX_RETRY;
                DBG("Check index status:"
-                       "did not received beacon for stream %" PRIu64
-                       ", returning status=%s",
-                       vstream->stream->stream_handle,
-                       lttng_viewer_next_index_return_code_str(
-                               (enum lttng_viewer_next_index_return_code) index->status));
+                   "did not received beacon for stream %" PRIu64 ", returning status=%s",
+                   vstream->stream->stream_handle,
+                   lttng_viewer_next_index_return_code_str(
+                           (enum lttng_viewer_next_index_return_code) index->status));
                goto index_ready;
        } else if (!tracefile_array_seq_in_file(rstream->tfa,
-                       vstream->current_tracefile_id,
-                       vstream->index_sent_seqcount)) {
+                                               vstream->current_tracefile_id,
+                                               vstream->index_sent_seqcount)) {
                /*
                 * The next index we want to send cannot be read either
                 * because we need to perform a rotation, or due to
                 * the producer having overwritten its trace file.
                 */
-               DBG("Viewer stream %" PRIu64 " rotation",
-                               vstream->stream->stream_handle);
+               DBG("Viewer stream %" PRIu64 " rotation", vstream->stream->stream_handle);
                ret = viewer_stream_rotate(vstream);
                if (ret == 1) {
                        /* EOF across entire stream. */
                        index->status = LTTNG_VIEWER_INDEX_HUP;
                        DBG("Check index status:"
-                               "reached end of file for stream %" PRIu64
-                               ", returning status=%s",
-                               vstream->stream->stream_handle,
-                               lttng_viewer_next_index_return_code_str(
-                                       (enum lttng_viewer_next_index_return_code) index->status));
+                           "reached end of file for stream %" PRIu64 ", returning status=%s",
+                           vstream->stream->stream_handle,
+                           lttng_viewer_next_index_return_code_str(
+                                   (enum lttng_viewer_next_index_return_code) index->status));
                        goto hup;
                }
                /*
@@ -1614,24 +1580,21 @@ static int check_index_status(struct relay_viewer_stream *vstream,
                 * still unavailable.
                 */
                if (rstream->tracefile_count == 1 &&
-                               !tracefile_array_seq_in_file(
-                                       rstream->tfa,
-                                       vstream->current_tracefile_id,
-                                       vstream->index_sent_seqcount)) {
+                   !tracefile_array_seq_in_file(rstream->tfa,
+                                                vstream->current_tracefile_id,
+                                                vstream->index_sent_seqcount)) {
                        index->status = LTTNG_VIEWER_INDEX_RETRY;
                        DBG("Check index status:"
-                               "tracefile array sequence number %" PRIu64
-                               " not in file for stream %" PRIu64
-                               ", returning status=%s",
-                               vstream->index_sent_seqcount,
-                               vstream->stream->stream_handle,
-                               lttng_viewer_next_index_return_code_str(
-                                       (enum lttng_viewer_next_index_return_code) index->status));
+                           "tracefile array sequence number %" PRIu64
+                           " not in file for stream %" PRIu64 ", returning status=%s",
+                           vstream->index_sent_seqcount,
+                           vstream->stream->stream_handle,
+                           lttng_viewer_next_index_return_code_str(
+                                   (enum lttng_viewer_next_index_return_code) index->status));
                        goto index_ready;
                }
-               LTTNG_ASSERT(tracefile_array_seq_in_file(rstream->tfa,
-                               vstream->current_tracefile_id,
-                               vstream->index_sent_seqcount));
+               LTTNG_ASSERT(tracefile_array_seq_in_file(
+                       rstream->tfa, vstream->current_tracefile_id, vstream->index_sent_seqcount));
        }
        /* ret == 0 means successful so we continue. */
        ret = 0;
@@ -1643,15 +1606,13 @@ index_ready:
        return 1;
 }
 
-static
-void viewer_stream_rotate_to_trace_chunk(struct relay_viewer_stream *vstream,
-                struct lttng_trace_chunk *new_trace_chunk)
+static void viewer_stream_rotate_to_trace_chunk(struct relay_viewer_stream *vstream,
+                                               struct lttng_trace_chunk *new_trace_chunk)
 {
        lttng_trace_chunk_put(vstream->stream_file.trace_chunk);
 
        if (new_trace_chunk) {
-               const bool acquired_reference = lttng_trace_chunk_get(
-                               new_trace_chunk);
+               const bool acquired_reference = lttng_trace_chunk_get(new_trace_chunk);
 
                LTTNG_ASSERT(acquired_reference);
        }
@@ -1666,8 +1627,7 @@ void viewer_stream_rotate_to_trace_chunk(struct relay_viewer_stream *vstream,
  *
  * Return 0 on success or else a negative value.
  */
-static
-int viewer_get_next_index(struct relay_connection *conn)
+static int viewer_get_next_index(struct relay_connection *conn)
 {
        int ret;
        struct lttng_viewer_get_next_index request_index;
@@ -1695,10 +1655,10 @@ int viewer_get_next_index(struct relay_connection *conn)
        vstream = viewer_stream_get_by_id(be64toh(request_index.stream_id));
        if (!vstream) {
                viewer_index.status = LTTNG_VIEWER_INDEX_ERR;
-               DBG("Client requested index of unknown stream id %" PRIu64", returning status=%s",
-                               (uint64_t) be64toh(request_index.stream_id),
-                               lttng_viewer_next_index_return_code_str(
-                                       (enum lttng_viewer_next_index_return_code) viewer_index.status));
+               DBG("Client requested index of unknown stream id %" PRIu64 ", returning status=%s",
+                   (uint64_t) be64toh(request_index.stream_id),
+                   lttng_viewer_next_index_return_code_str(
+                           (enum lttng_viewer_next_index_return_code) viewer_index.status));
                goto send_reply;
        }
 
@@ -1707,8 +1667,7 @@ int viewer_get_next_index(struct relay_connection *conn)
        ctf_trace = rstream->trace;
 
        /* metadata_viewer_stream may be NULL. */
-       metadata_viewer_stream =
-                       ctf_trace_get_viewer_metadata_stream(ctf_trace);
+       metadata_viewer_stream = ctf_trace_get_viewer_metadata_stream(ctf_trace);
 
        /*
         * Hold the session lock to protect against concurrent changes
@@ -1724,51 +1683,52 @@ int viewer_get_next_index(struct relay_connection *conn)
         */
        if (rstream->is_metadata) {
                viewer_index.status = LTTNG_VIEWER_INDEX_HUP;
-               DBG("Client requested index of a metadata stream id %" PRIu64", returning status=%s",
-                               (uint64_t) be64toh(request_index.stream_id),
-                               lttng_viewer_next_index_return_code_str(
-                                       (enum lttng_viewer_next_index_return_code) viewer_index.status));
+               DBG("Client requested index of a metadata stream id %" PRIu64
+                   ", returning status=%s",
+                   (uint64_t) be64toh(request_index.stream_id),
+                   lttng_viewer_next_index_return_code_str(
+                           (enum lttng_viewer_next_index_return_code) viewer_index.status));
                goto send_reply;
        }
 
        if (rstream->ongoing_rotation.is_set) {
                /* Rotation is ongoing, try again later. */
                viewer_index.status = LTTNG_VIEWER_INDEX_RETRY;
-               DBG("Client requested index for stream id %" PRIu64" while a stream rotation is ongoing, returning status=%s",
-                               (uint64_t) be64toh(request_index.stream_id),
-                               lttng_viewer_next_index_return_code_str(
-                                       (enum lttng_viewer_next_index_return_code) viewer_index.status));
+               DBG("Client requested index for stream id %" PRIu64
+                   " while a stream rotation is ongoing, returning status=%s",
+                   (uint64_t) be64toh(request_index.stream_id),
+                   lttng_viewer_next_index_return_code_str(
+                           (enum lttng_viewer_next_index_return_code) viewer_index.status));
                goto send_reply;
        }
 
        if (session_has_ongoing_rotation(rstream->trace->session)) {
                /* Rotation is ongoing, try again later. */
                viewer_index.status = LTTNG_VIEWER_INDEX_RETRY;
-               DBG("Client requested index for stream id %" PRIu64" while a session rotation is ongoing, returning status=%s",
-                               (uint64_t) be64toh(request_index.stream_id),
-                               lttng_viewer_next_index_return_code_str(
-                                       (enum lttng_viewer_next_index_return_code) viewer_index.status));
+               DBG("Client requested index for stream id %" PRIu64
+                   " while a session rotation is ongoing, returning status=%s",
+                   (uint64_t) be64toh(request_index.stream_id),
+                   lttng_viewer_next_index_return_code_str(
+                           (enum lttng_viewer_next_index_return_code) viewer_index.status));
                goto send_reply;
        }
 
        /*
         * Transition the viewer session into the newest trace chunk available.
         */
-       if (!lttng_trace_chunk_ids_equal(
-                       conn->viewer_session->current_trace_chunk,
-                       rstream->trace_chunk)) {
+       if (!lttng_trace_chunk_ids_equal(conn->viewer_session->current_trace_chunk,
+                                        rstream->trace_chunk)) {
                DBG("Relay stream and viewer chunk ids differ");
 
-               ret = viewer_session_set_trace_chunk_copy(
-                               conn->viewer_session,
-                               rstream->trace_chunk);
+               ret = viewer_session_set_trace_chunk_copy(conn->viewer_session,
+                                                         rstream->trace_chunk);
                if (ret) {
                        viewer_index.status = LTTNG_VIEWER_INDEX_ERR;
                        ERR("Error copying trace chunk for stream id %" PRIu64
-                               ", returning status=%s",
-                               (uint64_t) be64toh(request_index.stream_id),
-                               lttng_viewer_next_index_return_code_str(
-                                       (enum lttng_viewer_next_index_return_code) viewer_index.status));
+                           ", returning status=%s",
+                           (uint64_t) be64toh(request_index.stream_id),
+                           lttng_viewer_next_index_return_code_str(
+                                   (enum lttng_viewer_next_index_return_code) viewer_index.status));
                        goto send_reply;
                }
        }
@@ -1785,53 +1745,49 @@ int viewer_get_next_index(struct relay_connection *conn)
         * after a session's destruction.
         */
        if (vstream->stream_file.trace_chunk) {
-               status = lttng_trace_chunk_get_id(
-                               vstream->stream_file.trace_chunk,
-                               &stream_file_chunk_id);
+               status = lttng_trace_chunk_get_id(vstream->stream_file.trace_chunk,
+                                                 &stream_file_chunk_id);
                LTTNG_ASSERT(status == LTTNG_TRACE_CHUNK_STATUS_OK);
        }
        if (conn->viewer_session->current_trace_chunk) {
-               status = lttng_trace_chunk_get_id(
-                               conn->viewer_session->current_trace_chunk,
-                               &viewer_session_chunk_id);
+               status = lttng_trace_chunk_get_id(conn->viewer_session->current_trace_chunk,
+                                                 &viewer_session_chunk_id);
                LTTNG_ASSERT(status == LTTNG_TRACE_CHUNK_STATUS_OK);
        }
 
        viewer_stream_and_session_in_same_chunk = lttng_trace_chunk_ids_equal(
-                       conn->viewer_session->current_trace_chunk,
-                       vstream->stream_file.trace_chunk);
+               conn->viewer_session->current_trace_chunk, vstream->stream_file.trace_chunk);
        viewer_stream_one_rotation_behind = rstream->completed_rotation_count ==
-                       vstream->last_seen_rotation_count + 1;
+               vstream->last_seen_rotation_count + 1;
 
        if (viewer_stream_and_session_in_same_chunk) {
                DBG("Transition to latest chunk check (%s -> %s): Same chunk, no need to rotate",
-                               vstream->stream_file.trace_chunk ?
-                                               std::to_string(stream_file_chunk_id).c_str() :
-                                               "None",
-                               conn->viewer_session->current_trace_chunk ?
-                                               std::to_string(viewer_session_chunk_id).c_str() :
-                                               "None");
+                   vstream->stream_file.trace_chunk ?
+                           std::to_string(stream_file_chunk_id).c_str() :
+                           "None",
+                   conn->viewer_session->current_trace_chunk ?
+                           std::to_string(viewer_session_chunk_id).c_str() :
+                           "None");
        } else if (viewer_stream_one_rotation_behind && !rstream->trace_chunk) {
                DBG("Transition to latest chunk check (%s -> %s): One chunk behind relay stream which is being destroyed, no need to rotate",
-                               vstream->stream_file.trace_chunk ?
-                                               std::to_string(stream_file_chunk_id).c_str() :
-                                               "None",
-                               conn->viewer_session->current_trace_chunk ?
-                                               std::to_string(viewer_session_chunk_id).c_str() :
-                                               "None");
+                   vstream->stream_file.trace_chunk ?
+                           std::to_string(stream_file_chunk_id).c_str() :
+                           "None",
+                   conn->viewer_session->current_trace_chunk ?
+                           std::to_string(viewer_session_chunk_id).c_str() :
+                           "None");
        } else {
                DBG("Transition to latest chunk check (%s -> %s): Viewer stream chunk ID and viewer session chunk ID differ, rotating viewer stream",
-                               vstream->stream_file.trace_chunk ?
-                                               std::to_string(stream_file_chunk_id).c_str() :
-                                               "None",
-                               conn->viewer_session->current_trace_chunk ?
-                                               std::to_string(viewer_session_chunk_id).c_str() :
-                                               "None");
+                   vstream->stream_file.trace_chunk ?
+                           std::to_string(stream_file_chunk_id).c_str() :
+                           "None",
+                   conn->viewer_session->current_trace_chunk ?
+                           std::to_string(viewer_session_chunk_id).c_str() :
+                           "None");
 
                viewer_stream_rotate_to_trace_chunk(vstream,
-                               conn->viewer_session->current_trace_chunk);
-               vstream->last_seen_rotation_count =
-                               rstream->completed_rotation_count;
+                                                   conn->viewer_session->current_trace_chunk);
+               vstream->last_seen_rotation_count = rstream->completed_rotation_count;
        }
 
        ret = check_index_status(vstream, rstream, ctf_trace, &viewer_index);
@@ -1850,31 +1806,29 @@ int viewer_get_next_index(struct relay_connection *conn)
        /* Try to open an index if one is needed for that stream. */
        ret = try_open_index(vstream, rstream);
        if (ret == -ENOENT) {
-              if (rstream->closed) {
+               if (rstream->closed) {
                        viewer_index.status = LTTNG_VIEWER_INDEX_HUP;
                        DBG("Cannot open index for stream id %" PRIu64
-                               "stream is closed, returning status=%s",
-                               (uint64_t) be64toh(request_index.stream_id),
-                               lttng_viewer_next_index_return_code_str(
-                                       (enum lttng_viewer_next_index_return_code) viewer_index.status));
+                           "stream is closed, returning status=%s",
+                           (uint64_t) be64toh(request_index.stream_id),
+                           lttng_viewer_next_index_return_code_str(
+                                   (enum lttng_viewer_next_index_return_code) viewer_index.status));
                        goto send_reply;
-              } else {
+               } else {
                        viewer_index.status = LTTNG_VIEWER_INDEX_RETRY;
-                       DBG("Cannot open index for stream id %" PRIu64
-                               ", returning status=%s",
-                               (uint64_t) be64toh(request_index.stream_id),
-                               lttng_viewer_next_index_return_code_str(
-                                       (enum lttng_viewer_next_index_return_code) viewer_index.status));
+                       DBG("Cannot open index for stream id %" PRIu64 ", returning status=%s",
+                           (uint64_t) be64toh(request_index.stream_id),
+                           lttng_viewer_next_index_return_code_str(
+                                   (enum lttng_viewer_next_index_return_code) viewer_index.status));
                        goto send_reply;
-              }
+               }
        }
        if (ret < 0) {
                viewer_index.status = LTTNG_VIEWER_INDEX_ERR;
-               ERR("Error opening index for stream id %" PRIu64
-                       ", returning status=%s",
-                       (uint64_t) be64toh(request_index.stream_id),
-                       lttng_viewer_next_index_return_code_str(
-                               (enum lttng_viewer_next_index_return_code) viewer_index.status));
+               ERR("Error opening index for stream id %" PRIu64 ", returning status=%s",
+                   (uint64_t) be64toh(request_index.stream_id),
+                   lttng_viewer_next_index_return_code_str(
+                           (enum lttng_viewer_next_index_return_code) viewer_index.status));
                goto send_reply;
        }
 
@@ -1890,9 +1844,12 @@ int viewer_get_next_index(struct relay_connection *conn)
                struct fs_handle *fs_handle;
 
                ret = utils_stream_file_path(rstream->path_name,
-                               rstream->channel_name, rstream->tracefile_size,
-                               vstream->current_tracefile_id, NULL, file_path,
-                               sizeof(file_path));
+                                            rstream->channel_name,
+                                            rstream->tracefile_size,
+                                            vstream->current_tracefile_id,
+                                            NULL,
+                                            file_path,
+                                            sizeof(file_path));
                if (ret < 0) {
                        goto error_put;
                }
@@ -1903,17 +1860,16 @@ int viewer_get_next_index(struct relay_connection *conn)
                 * per-pid buffers) and a clear command has been performed.
                 */
                status = lttng_trace_chunk_open_fs_handle(
-                               vstream->stream_file.trace_chunk,
-                               file_path, O_RDONLY, 0, &fs_handle, true);
+                       vstream->stream_file.trace_chunk, file_path, O_RDONLY, 0, &fs_handle, true);
                if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
-                       if (status == LTTNG_TRACE_CHUNK_STATUS_NO_FILE &&
-                                       rstream->closed) {
+                       if (status == LTTNG_TRACE_CHUNK_STATUS_NO_FILE && rstream->closed) {
                                viewer_index.status = LTTNG_VIEWER_INDEX_HUP;
                                DBG("Cannot find trace chunk file and stream is closed for stream id %" PRIu64
-                                       ", returning status=%s",
-                                       (uint64_t) be64toh(request_index.stream_id),
-                                       lttng_viewer_next_index_return_code_str(
-                                               (enum lttng_viewer_next_index_return_code) viewer_index.status));
+                                   ", returning status=%s",
+                                   (uint64_t) be64toh(request_index.stream_id),
+                                   lttng_viewer_next_index_return_code_str(
+                                           (enum lttng_viewer_next_index_return_code)
+                                                   viewer_index.status));
                                goto send_reply;
                        }
                        PERROR("Failed to open trace file for viewer stream");
@@ -1926,10 +1882,10 @@ int viewer_get_next_index(struct relay_connection *conn)
        if (ret < 0) {
                viewer_index.status = LTTNG_VIEWER_INDEX_ERR;
                ERR("Error checking for new streams before sending new index to stream id %" PRIu64
-                       ", returning status=%s",
-                       (uint64_t) be64toh(request_index.stream_id),
-                       lttng_viewer_next_index_return_code_str(
-                               (enum lttng_viewer_next_index_return_code) viewer_index.status));
+                   ", returning status=%s",
+                   (uint64_t) be64toh(request_index.stream_id),
+                   lttng_viewer_next_index_return_code_str(
+                           (enum lttng_viewer_next_index_return_code) viewer_index.status));
                goto send_reply;
        } else if (ret == 1) {
                viewer_index.flags |= LTTNG_VIEWER_FLAG_NEW_STREAM;
@@ -1938,19 +1894,17 @@ int viewer_get_next_index(struct relay_connection *conn)
        ret = lttng_index_file_read(vstream->index_file, &packet_index);
        if (ret) {
                viewer_index.status = LTTNG_VIEWER_INDEX_ERR;
-               ERR("Relay error reading index file for stream id %" PRIu64
-                       ", returning status=%s",
-                       (uint64_t) be64toh(request_index.stream_id),
-                       lttng_viewer_next_index_return_code_str(
-                               (enum lttng_viewer_next_index_return_code) viewer_index.status));
+               ERR("Relay error reading index file for stream id %" PRIu64 ", returning status=%s",
+                   (uint64_t) be64toh(request_index.stream_id),
+                   lttng_viewer_next_index_return_code_str(
+                           (enum lttng_viewer_next_index_return_code) viewer_index.status));
                goto send_reply;
        } else {
                viewer_index.status = LTTNG_VIEWER_INDEX_OK;
-               DBG("Read index file for stream id %" PRIu64
-                       ", returning status=%s",
-                       (uint64_t) be64toh(request_index.stream_id),
-                       lttng_viewer_next_index_return_code_str(
-                               (enum lttng_viewer_next_index_return_code) viewer_index.status));
+               DBG("Read index file for stream id %" PRIu64 ", returning status=%s",
+                   (uint64_t) be64toh(request_index.stream_id),
+                   lttng_viewer_next_index_return_code_str(
+                           (enum lttng_viewer_next_index_return_code) viewer_index.status));
                vstream->index_sent_seqcount++;
        }
 
@@ -1958,8 +1912,8 @@ int viewer_get_next_index(struct relay_connection *conn)
         * Indexes are stored in big endian, no need to switch before sending.
         */
        DBG("Sending viewer index for stream %" PRIu64 " offset %" PRIu64,
-               rstream->stream_handle,
-               (uint64_t) be64toh(packet_index.offset));
+           rstream->stream_handle,
+           (uint64_t) be64toh(packet_index.offset));
        viewer_index.offset = packet_index.offset;
        viewer_index.packet_size = packet_index.packet_size;
        viewer_index.content_size = packet_index.content_size;
@@ -1976,13 +1930,12 @@ send_reply:
 
        if (metadata_viewer_stream) {
                pthread_mutex_lock(&metadata_viewer_stream->stream->lock);
-               DBG("get next index metadata check: recv %" PRIu64
-                               " sent %" PRIu64,
-                       metadata_viewer_stream->stream->metadata_received,
-                       metadata_viewer_stream->metadata_sent);
+               DBG("get next index metadata check: recv %" PRIu64 " sent %" PRIu64,
+                   metadata_viewer_stream->stream->metadata_received,
+                   metadata_viewer_stream->metadata_sent);
                if (!metadata_viewer_stream->stream->metadata_received ||
-                               metadata_viewer_stream->stream->metadata_received >
-                                       metadata_viewer_stream->metadata_sent) {
+                   metadata_viewer_stream->stream->metadata_received >
+                           metadata_viewer_stream->metadata_sent) {
                        viewer_index.flags |= LTTNG_VIEWER_FLAG_NEW_METADATA;
                }
                pthread_mutex_unlock(&metadata_viewer_stream->stream->lock);
@@ -2000,8 +1953,8 @@ send_reply:
 
        if (vstream) {
                DBG("Index %" PRIu64 " for stream %" PRIu64 " sent",
-                               vstream->index_sent_seqcount,
-                               vstream->stream->stream_handle);
+                   vstream->index_sent_seqcount,
+                   vstream->stream->stream_handle);
        }
 end:
        if (metadata_viewer_stream) {
@@ -2027,8 +1980,7 @@ error_put:
  *
  * Return 0 on success or else a negative value.
  */
-static
-int viewer_get_packet(struct relay_connection *conn)
+static int viewer_get_packet(struct relay_connection *conn)
 {
        int ret;
        off_t lseek_ret;
@@ -2044,8 +1996,7 @@ int viewer_get_packet(struct relay_connection *conn)
 
        health_code_update();
 
-       ret = recv_request(conn->sock, &get_packet_info,
-                       sizeof(get_packet_info));
+       ret = recv_request(conn->sock, &get_packet_info, sizeof(get_packet_info));
        if (ret < 0) {
                goto end;
        }
@@ -2058,9 +2009,9 @@ int viewer_get_packet(struct relay_connection *conn)
        vstream = viewer_stream_get_by_id(stream_id);
        if (!vstream) {
                get_packet_status = LTTNG_VIEWER_GET_PACKET_ERR;
-               DBG("Client requested packet of unknown stream id %" PRIu64
-                       ", returning status=%s", stream_id,
-                       lttng_viewer_get_packet_return_code_str(get_packet_status));
+               DBG("Client requested packet of unknown stream id %" PRIu64 ", returning status=%s",
+                   stream_id,
+                   lttng_viewer_get_packet_return_code_str(get_packet_status));
                goto send_reply_nolock;
        } else {
                packet_data_len = be32toh(get_packet_info.len);
@@ -2071,29 +2022,31 @@ int viewer_get_packet(struct relay_connection *conn)
        if (!reply) {
                get_packet_status = LTTNG_VIEWER_GET_PACKET_ERR;
                PERROR("Falled to allocate reply, returning status=%s",
-                       lttng_viewer_get_packet_return_code_str(get_packet_status));
+                      lttng_viewer_get_packet_return_code_str(get_packet_status));
                goto error;
        }
 
        pthread_mutex_lock(&vstream->stream->lock);
-       lseek_ret = fs_handle_seek(vstream->stream_file.handle,
-                       be64toh(get_packet_info.offset), SEEK_SET);
+       lseek_ret = fs_handle_seek(
+               vstream->stream_file.handle, be64toh(get_packet_info.offset), SEEK_SET);
        if (lseek_ret < 0) {
                get_packet_status = LTTNG_VIEWER_GET_PACKET_ERR;
                PERROR("Failed to seek file system handle of viewer stream %" PRIu64
-                      " to offset %" PRIu64", returning status=%s", stream_id,
-                       (uint64_t) be64toh(get_packet_info.offset),
-                       lttng_viewer_get_packet_return_code_str(get_packet_status));
+                      " to offset %" PRIu64 ", returning status=%s",
+                      stream_id,
+                      (uint64_t) be64toh(get_packet_info.offset),
+                      lttng_viewer_get_packet_return_code_str(get_packet_status));
                goto error;
        }
-       read_len = fs_handle_read(vstream->stream_file.handle,
-                       reply + sizeof(reply_header), packet_data_len);
+       read_len = fs_handle_read(
+               vstream->stream_file.handle, reply + sizeof(reply_header), packet_data_len);
        if (read_len < packet_data_len) {
                get_packet_status = LTTNG_VIEWER_GET_PACKET_ERR;
                PERROR("Failed to read from file system handle of viewer stream id %" PRIu64
-                      ", offset: %" PRIu64 ", returning status=%s", stream_id,
+                      ", offset: %" PRIu64 ", returning status=%s",
+                      stream_id,
                       (uint64_t) be64toh(get_packet_info.offset),
-                       lttng_viewer_get_packet_return_code_str(get_packet_status));
+                      lttng_viewer_get_packet_return_code_str(get_packet_status));
                goto error;
        }
 
@@ -2119,8 +2072,7 @@ send_reply_nolock:
                ret = send_response(conn->sock, reply, reply_size);
        } else {
                /* No reply to send. */
-               ret = send_response(conn->sock, &reply_header,
-                               reply_size);
+               ret = send_response(conn->sock, &reply_header, reply_size);
        }
 
        health_code_update();
@@ -2145,8 +2097,7 @@ end:
  *
  * Return 0 on success else a negative value.
  */
-static
-int viewer_get_metadata(struct relay_connection *conn)
+static int viewer_get_metadata(struct relay_connection *conn)
 {
        int ret = 0;
        int fd = -1;
@@ -2180,7 +2131,7 @@ int viewer_get_metadata(struct relay_connection *conn)
                 * find it.
                 */
                DBG("Client requested metadata of unknown stream id %" PRIu64,
-                               (uint64_t) be64toh(request.stream_id));
+                   (uint64_t) be64toh(request.stream_id));
                reply.status = htobe32(LTTNG_VIEWER_METADATA_ERR);
                goto send_reply;
        }
@@ -2222,15 +2173,13 @@ int viewer_get_metadata(struct relay_connection *conn)
        }
 
        if (vstream->stream->trace_chunk &&
-                       !lttng_trace_chunk_ids_equal(
-                               conn->viewer_session->current_trace_chunk,
-                               vstream->stream->trace_chunk)) {
+           !lttng_trace_chunk_ids_equal(conn->viewer_session->current_trace_chunk,
+                                        vstream->stream->trace_chunk)) {
                /* A rotation has occurred on the relay stream. */
                DBG("Metadata relay stream and viewer chunk ids differ");
 
-               ret = viewer_session_set_trace_chunk_copy(
-                               conn->viewer_session,
-                               vstream->stream->trace_chunk);
+               ret = viewer_session_set_trace_chunk_copy(conn->viewer_session,
+                                                         vstream->stream->trace_chunk);
                if (ret) {
                        reply.status = htobe32(LTTNG_VIEWER_METADATA_ERR);
                        goto send_reply;
@@ -2238,19 +2187,19 @@ int viewer_get_metadata(struct relay_connection *conn)
        }
 
        if (conn->viewer_session->current_trace_chunk &&
-                       !lttng_trace_chunk_ids_equal(conn->viewer_session->current_trace_chunk,
-                                       vstream->stream_file.trace_chunk)) {
+           !lttng_trace_chunk_ids_equal(conn->viewer_session->current_trace_chunk,
+                                        vstream->stream_file.trace_chunk)) {
                bool acquired_reference;
 
                DBG("Viewer session and viewer stream chunk differ: "
-                               "vsession chunk %p vstream chunk %p",
-                               conn->viewer_session->current_trace_chunk,
-                               vstream->stream_file.trace_chunk);
+                   "vsession chunk %p vstream chunk %p",
+                   conn->viewer_session->current_trace_chunk,
+                   vstream->stream_file.trace_chunk);
                lttng_trace_chunk_put(vstream->stream_file.trace_chunk);
-               acquired_reference = lttng_trace_chunk_get(conn->viewer_session->current_trace_chunk);
+               acquired_reference =
+                       lttng_trace_chunk_get(conn->viewer_session->current_trace_chunk);
                LTTNG_ASSERT(acquired_reference);
-               vstream->stream_file.trace_chunk =
-                       conn->viewer_session->current_trace_chunk;
+               vstream->stream_file.trace_chunk = conn->viewer_session->current_trace_chunk;
                viewer_stream_close_files(vstream);
        }
 
@@ -2260,8 +2209,7 @@ int viewer_get_metadata(struct relay_connection *conn)
                reply.status = htobe32(LTTNG_VIEWER_NO_NEW_METADATA);
                len = 0;
                goto send_reply;
-       } else if (vstream->stream_file.trace_chunk &&
-                       !vstream->stream_file.handle && len > 0) {
+       } else if (vstream->stream_file.trace_chunk && !vstream->stream_file.handle && len > 0) {
                /*
                 * Either this is the first time the metadata file is read, or a
                 * rotation of the corresponding relay stream has occurred.
@@ -2272,9 +2220,12 @@ int viewer_get_metadata(struct relay_connection *conn)
                struct relay_stream *rstream = vstream->stream;
 
                ret = utils_stream_file_path(rstream->path_name,
-                               rstream->channel_name, rstream->tracefile_size,
-                               vstream->current_tracefile_id, NULL, file_path,
-                               sizeof(file_path));
+                                            rstream->channel_name,
+                                            rstream->tracefile_size,
+                                            vstream->current_tracefile_id,
+                                            NULL,
+                                            file_path,
+                                            sizeof(file_path));
                if (ret < 0) {
                        goto error;
                }
@@ -2285,8 +2236,7 @@ int viewer_get_metadata(struct relay_connection *conn)
                 * per-pid buffers) and a clear command has been performed.
                 */
                status = lttng_trace_chunk_open_fs_handle(
-                               vstream->stream_file.trace_chunk,
-                               file_path, O_RDONLY, 0, &fs_handle, true);
+                       vstream->stream_file.trace_chunk, file_path, O_RDONLY, 0, &fs_handle, true);
                if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        if (status == LTTNG_TRACE_CHUNK_STATUS_NO_FILE) {
                                reply.status = htobe32(LTTNG_VIEWER_NO_NEW_METADATA);
@@ -2317,12 +2267,12 @@ int viewer_get_metadata(struct relay_connection *conn)
                         * safe to assume that
                         * `metadata_received` > `metadata_sent`.
                         */
-                       const off_t seek_ret = fs_handle_seek(fs_handle,
-                                       vstream->metadata_sent, SEEK_SET);
+                       const off_t seek_ret =
+                               fs_handle_seek(fs_handle, vstream->metadata_sent, SEEK_SET);
 
                        if (seek_ret < 0) {
                                PERROR("Failed to seek metadata viewer stream file to `sent` position: pos = %" PRId64,
-                                               vstream->metadata_sent);
+                                      vstream->metadata_sent);
                                reply.status = htobe32(LTTNG_VIEWER_METADATA_ERR);
                                goto send_reply;
                        }
@@ -2359,12 +2309,12 @@ int viewer_get_metadata(struct relay_connection *conn)
                         * attempt to parse an incomplete (incoherent) metadata
                         * stream, which would result in an error.
                         */
-                       const off_t seek_ret = fs_handle_seek(
-                                       vstream->stream_file.handle, -read_len,
-                                       SEEK_CUR);
+                       const off_t seek_ret =
+                               fs_handle_seek(vstream->stream_file.handle, -read_len, SEEK_CUR);
 
                        DBG("Failed to read metadata: requested = %" PRIu64 ", got = %zd",
-                                       len, read_len);
+                           len,
+                           read_len);
                        read_len = 0;
                        len = 0;
                        if (seek_ret < 0) {
@@ -2400,8 +2350,9 @@ send_reply:
                }
        }
 
-       DBG("Sent %" PRIu64 " bytes of metadata for stream %" PRIu64, len,
-                       (uint64_t) be64toh(request.stream_id));
+       DBG("Sent %" PRIu64 " bytes of metadata for stream %" PRIu64,
+           len,
+           (uint64_t) be64toh(request.stream_id));
 
        DBG("Metadata sent");
 
@@ -2419,8 +2370,7 @@ end:
  *
  * Return 0 on success or else a negative value.
  */
-static
-int viewer_create_session(struct relay_connection *conn)
+static int viewer_create_session(struct relay_connection *conn)
 {
        int ret;
        struct lttng_viewer_create_session_response resp;
@@ -2452,8 +2402,7 @@ end:
  *
  * Return 0 on success or else a negative value.
  */
-static
-int viewer_detach_session(struct relay_connection *conn)
+static int viewer_detach_session(struct relay_connection *conn)
 {
        int ret;
        struct lttng_viewer_detach_session_response response;
@@ -2485,8 +2434,7 @@ int viewer_detach_session(struct relay_connection *conn)
 
        session = session_get_by_id(be64toh(request.session_id));
        if (!session) {
-               DBG("Relay session %" PRIu64 " not found",
-                               (uint64_t) be64toh(request.session_id));
+               DBG("Relay session %" PRIu64 " not found", (uint64_t) be64toh(request.session_id));
                response.status = htobe32(LTTNG_VIEWER_DETACH_SESSION_UNK);
                goto send_reply;
        }
@@ -2521,8 +2469,7 @@ end:
 /*
  * live_relay_unknown_command: send -1 if received unknown command
  */
-static
-void live_relay_unknown_command(struct relay_connection *conn)
+static void live_relay_unknown_command(struct relay_connection *conn)
 {
        struct lttcomm_relayd_generic_reply reply;
 
@@ -2534,13 +2481,10 @@ void live_relay_unknown_command(struct relay_connection *conn)
 /*
  * Process the commands received on the control socket
  */
-static
-int process_control(struct lttng_viewer_cmd *recv_hdr,
-               struct relay_connection *conn)
+static int process_control(struct lttng_viewer_cmd *recv_hdr, struct relay_connection *conn)
 {
        int ret = 0;
-       lttng_viewer_command cmd =
-                       (lttng_viewer_command) be32toh(recv_hdr->cmd);
+       lttng_viewer_command cmd = (lttng_viewer_command) be32toh(recv_hdr->cmd);
 
        /*
         * Make sure we've done the version check before any command other then
@@ -2548,13 +2492,15 @@ int process_control(struct lttng_viewer_cmd *recv_hdr,
         */
        if (cmd != LTTNG_VIEWER_CONNECT && !conn->version_check_done) {
                ERR("Viewer on connection %d requested %s command before version check",
-                       conn->sock->fd, lttng_viewer_command_str(cmd));
+                   conn->sock->fd,
+                   lttng_viewer_command_str(cmd));
                ret = -1;
                goto end;
        }
 
        DBG("Processing %s viewer command from connection %d",
-                       lttng_viewer_command_str(cmd), conn->sock->fd);
+           lttng_viewer_command_str(cmd),
+           conn->sock->fd);
 
        switch (cmd) {
        case LTTNG_VIEWER_CONNECT:
@@ -2585,8 +2531,7 @@ int process_control(struct lttng_viewer_cmd *recv_hdr,
                ret = viewer_detach_session(conn);
                break;
        default:
-               ERR("Received unknown viewer command (%u)",
-                               be32toh(recv_hdr->cmd));
+               ERR("Received unknown viewer command (%u)", be32toh(recv_hdr->cmd));
                live_relay_unknown_command(conn);
                ret = -1;
                goto end;
@@ -2596,15 +2541,14 @@ end:
        return ret;
 }
 
-static
-void cleanup_connection_pollfd(struct lttng_poll_event *events, int pollfd)
+static void cleanup_connection_pollfd(struct lttng_poll_event *events, int pollfd)
 {
        int ret;
 
        (void) lttng_poll_del(events, pollfd);
 
-       ret = fd_tracker_close_unsuspendable_fd(the_fd_tracker, &pollfd, 1,
-                       fd_tracker_util_close_fd, NULL);
+       ret = fd_tracker_close_unsuspendable_fd(
+               the_fd_tracker, &pollfd, 1, fd_tracker_util_close_fd, NULL);
        if (ret < 0) {
                ERR("Closing pollfd %d", pollfd);
        }
@@ -2613,8 +2557,7 @@ void cleanup_connection_pollfd(struct lttng_poll_event *events, int pollfd)
 /*
  * This thread does the actual work
  */
-static
-void *thread_worker(void *data __attribute__((unused)))
+static void *thread_worker(void *data __attribute__((unused)))
 {
        int ret, err = -1;
        uint32_t nb_fd;
@@ -2640,8 +2583,7 @@ void *thread_worker(void *data __attribute__((unused)))
                goto viewer_connections_ht_error;
        }
 
-       ret = create_named_thread_poll_set(&events, 2,
-                       "Live viewer worker thread epoll");
+       ret = create_named_thread_poll_set(&events, 2, "Live viewer worker thread epoll");
        if (ret < 0) {
                goto error_poll_create;
        }
@@ -2698,14 +2640,12 @@ restart:
                                if (revents & LPOLLIN) {
                                        struct relay_connection *conn;
 
-                                       ret = lttng_read(live_conn_pipe[0],
-                                                       &conn, sizeof(conn));
+                                       ret = lttng_read(live_conn_pipe[0], &conn, sizeof(conn));
                                        if (ret < 0) {
                                                goto error;
                                        }
-                                       ret = lttng_poll_add(&events,
-                                                       conn->sock->fd,
-                                                       LPOLLIN | LPOLLRDHUP);
+                                       ret = lttng_poll_add(
+                                               &events, conn->sock->fd, LPOLLIN | LPOLLRDHUP);
                                        if (ret) {
                                                ERR("Failed to add new live connection file descriptor to poll set");
                                                goto error;
@@ -2716,7 +2656,9 @@ restart:
                                        ERR("Relay live pipe error");
                                        goto error;
                                } else {
-                                       ERR("Unexpected poll events %u for sock %d", revents, pollfd);
+                                       ERR("Unexpected poll events %u for sock %d",
+                                           revents,
+                                           pollfd);
                                        goto error;
                                }
                        } else {
@@ -2729,8 +2671,8 @@ restart:
                                }
 
                                if (revents & LPOLLIN) {
-                                       ret = conn->sock->ops->recvmsg(conn->sock, &recv_hdr,
-                                                       sizeof(recv_hdr), 0);
+                                       ret = conn->sock->ops->recvmsg(
+                                               conn->sock, &recv_hdr, sizeof(recv_hdr), 0);
                                        if (ret <= 0) {
                                                /* Connection closed. */
                                                cleanup_connection_pollfd(&events, pollfd);
@@ -2744,7 +2686,8 @@ restart:
                                                        cleanup_connection_pollfd(&events, pollfd);
                                                        /* Put "create" ownership reference. */
                                                        connection_put(conn);
-                                                       DBG("Viewer connection closed with %d", pollfd);
+                                                       DBG("Viewer connection closed with %d",
+                                                           pollfd);
                                                }
                                        }
                                } else if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) {
@@ -2752,7 +2695,9 @@ restart:
                                        /* Put "create" ownership reference. */
                                        connection_put(conn);
                                } else {
-                                       ERR("Unexpected poll events %u for sock %d", revents, pollfd);
+                                       ERR("Unexpected poll events %u for sock %d",
+                                           revents,
+                                           pollfd);
                                        connection_put(conn);
                                        goto error;
                                }
@@ -2768,9 +2713,7 @@ error:
 
        /* Cleanup remaining connection object. */
        rcu_read_lock();
-       cds_lfht_for_each_entry(viewer_connections_ht->ht, &iter.iter,
-                       destroy_conn,
-                       sock_n.node) {
+       cds_lfht_for_each_entry (viewer_connections_ht->ht, &iter.iter, destroy_conn, sock_n.node) {
                health_code_update();
                connection_put(destroy_conn);
        }
@@ -2803,8 +2746,8 @@ error_testpoint:
  */
 static int create_conn_pipe(void)
 {
-       return fd_tracker_util_pipe_open_cloexec(the_fd_tracker,
-                       "Live connection pipe", live_conn_pipe);
+       return fd_tracker_util_pipe_open_cloexec(
+               the_fd_tracker, "Live connection pipe", live_conn_pipe);
 }
 
 int relayd_live_join(void)
@@ -2880,8 +2823,8 @@ int relayd_live_create(struct lttng_uri *uri)
        }
 
        /* Setup the dispatcher thread */
-       ret = pthread_create(&live_dispatcher_thread, default_pthread_attr(),
-                       thread_dispatcher, (void *) NULL);
+       ret = pthread_create(
+               &live_dispatcher_thread, default_pthread_attr(), thread_dispatcher, (void *) NULL);
        if (ret) {
                errno = ret;
                PERROR("pthread_create viewer dispatcher");
@@ -2890,8 +2833,7 @@ int relayd_live_create(struct lttng_uri *uri)
        }
 
        /* Setup the worker thread */
-       ret = pthread_create(&live_worker_thread, default_pthread_attr(),
-                       thread_worker, NULL);
+       ret = pthread_create(&live_worker_thread, default_pthread_attr(), thread_worker, NULL);
        if (ret) {
                errno = ret;
                PERROR("pthread_create viewer worker");
@@ -2900,8 +2842,8 @@ int relayd_live_create(struct lttng_uri *uri)
        }
 
        /* Setup the listener thread */
-       ret = pthread_create(&live_listener_thread, default_pthread_attr(),
-                       thread_listener, (void *) NULL);
+       ret = pthread_create(
+               &live_listener_thread, default_pthread_attr(), thread_listener, (void *) NULL);
        if (ret) {
                errno = ret;
                PERROR("pthread_create viewer listener");
index 528d1451cf769feea1a694550b5220d20f7d852d..10db7979852623cbe3611eb0114fde8eba5a654c 100644 (file)
@@ -9,55 +9,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <getopt.h>
-#include <grp.h>
-#include <limits.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/resource.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/resource.h>
-#include <inttypes.h>
-#include <urcu/futex.h>
-#include <urcu/uatomic.h>
-#include <urcu/rculist.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <strings.h>
-#include <ctype.h>
-#include <algorithm>
-
-#include <lttng/lttng.h>
-#include <common/common.hpp>
-#include <common/compat/poll.hpp>
-#include <common/compat/socket.hpp>
-#include <common/compat/endian.hpp>
-#include <common/compat/getenv.hpp>
-#include <common/defaults.hpp>
-#include <common/daemonize.hpp>
-#include <common/futex.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/sessiond-comm/inet.hpp>
-#include <common/sessiond-comm/relayd.hpp>
-#include <common/uri.hpp>
-#include <common/utils.hpp>
-#include <common/path.hpp>
-#include <common/align.hpp>
-#include <common/ini-config/ini-config.hpp>
-#include <common/dynamic-buffer.hpp>
-#include <common/buffer-view.hpp>
-#include <common/string-utils/format.hpp>
-#include <common/fd-tracker/fd-tracker.hpp>
-#include <common/fd-tracker/utils.hpp>
-
 #include "backward-compatibility-group-by.hpp"
 #include "cmd.hpp"
 #include "connection.hpp"
 #include "version.hpp"
 #include "viewer-stream.hpp"
 
+#include <common/align.hpp>
+#include <common/buffer-view.hpp>
+#include <common/common.hpp>
+#include <common/compat/endian.hpp>
+#include <common/compat/getenv.hpp>
+#include <common/compat/poll.hpp>
+#include <common/compat/socket.hpp>
+#include <common/daemonize.hpp>
+#include <common/defaults.hpp>
+#include <common/dynamic-buffer.hpp>
+#include <common/fd-tracker/fd-tracker.hpp>
+#include <common/fd-tracker/utils.hpp>
+#include <common/futex.hpp>
+#include <common/ini-config/ini-config.hpp>
+#include <common/path.hpp>
+#include <common/sessiond-comm/inet.hpp>
+#include <common/sessiond-comm/relayd.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/string-utils/format.hpp>
+#include <common/uri.hpp>
+#include <common/utils.hpp>
+
+#include <lttng/lttng.h>
+
+#include <algorithm>
+#include <ctype.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <grp.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/resource.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <urcu/futex.h>
+#include <urcu/rculist.h>
+#include <urcu/uatomic.h>
+
 static const char *help_msg =
 #ifdef LTTNG_EMBED_HELP
 #include <lttng-relayd.8.h>
 #else
-NULL
+       NULL
 #endif
-;
+       ;
 
 enum relay_connection_status {
        RELAY_CONNECTION_STATUS_OK,
@@ -98,22 +98,22 @@ static int opt_daemon, opt_background, opt_print_version, opt_allow_clear = 1;
 enum relay_group_output_by opt_group_output_by = RELAYD_GROUP_OUTPUT_BY_UNKNOWN;
 
 /* Argument variables */
-int lttng_opt_quiet;    /* not static in error.h */
-int lttng_opt_verbose;  /* not static in error.h */
-int lttng_opt_mi;       /* not static in error.h */
+int lttng_opt_quiet; /* not static in error.h */
+int lttng_opt_verbose; /* not static in error.h */
+int lttng_opt_mi; /* not static in error.h */
 
 /*
  * We need to wait for listener and live listener threads, as well as
  * health check thread, before being ready to signal readiness.
  */
-#define NR_LTTNG_RELAY_READY   3
+#define NR_LTTNG_RELAY_READY 3
 static int lttng_relay_ready = NR_LTTNG_RELAY_READY;
 
 /* Size of receive buffer. */
-#define RECV_DATA_BUFFER_SIZE          65536
+#define RECV_DATA_BUFFER_SIZE 65536
 
-static int recv_child_signal;  /* Set to 1 when a SIGUSR1 signal is received. */
-static pid_t child_ppid;       /* Internal parent PID use with daemonize. */
+static int recv_child_signal; /* Set to 1 when a SIGUSR1 signal is received. */
+static pid_t child_ppid; /* Internal parent PID use with daemonize. */
 
 static struct lttng_uri *control_uri;
 static struct lttng_uri *data_uri;
@@ -124,7 +124,7 @@ const char *progname;
 const char *tracing_group_name = DEFAULT_TRACING_GROUP;
 static int tracing_group_name_override;
 
-const char * const config_section_name = "relayd";
+const char *const config_section_name = "relayd";
 
 /*
  * This pipe is used to inform the worker thread that a command is queued and
@@ -176,36 +176,107 @@ struct sessiond_trace_chunk_registry *sessiond_trace_chunk_registry;
 struct fd_tracker *the_fd_tracker;
 
 static struct option long_options[] = {
-       { "control-port", 1, 0, 'C', },
-       { "data-port", 1, 0, 'D', },
-       { "live-port", 1, 0, 'L', },
-       { "daemonize", 0, 0, 'd', },
-       { "background", 0, 0, 'b', },
-       { "group", 1, 0, 'g', },
-       { "fd-pool-size", 1, 0, '\0', },
-       { "help", 0, 0, 'h', },
-       { "output", 1, 0, 'o', },
-       { "verbose", 0, 0, 'v', },
+       {
+               "control-port",
+               1,
+               0,
+               'C',
+       },
+       {
+               "data-port",
+               1,
+               0,
+               'D',
+       },
+       {
+               "live-port",
+               1,
+               0,
+               'L',
+       },
+       {
+               "daemonize",
+               0,
+               0,
+               'd',
+       },
+       {
+               "background",
+               0,
+               0,
+               'b',
+       },
+       {
+               "group",
+               1,
+               0,
+               'g',
+       },
+       {
+               "fd-pool-size",
+               1,
+               0,
+               '\0',
+       },
+       {
+               "help",
+               0,
+               0,
+               'h',
+       },
+       {
+               "output",
+               1,
+               0,
+               'o',
+       },
+       {
+               "verbose",
+               0,
+               0,
+               'v',
+       },
        { "config", 1, 0, 'f' },
        { "version", 0, 0, 'V' },
-       { "working-directory", 1, 0, 'w', },
-       { "group-output-by-session", 0, 0, 's', },
-       { "group-output-by-host", 0, 0, 'p', },
+       {
+               "working-directory",
+               1,
+               0,
+               'w',
+       },
+       {
+               "group-output-by-session",
+               0,
+               0,
+               's',
+       },
+       {
+               "group-output-by-host",
+               0,
+               0,
+               'p',
+       },
        { "disallow-clear", 0, 0, 'x' },
-       { NULL, 0, 0, 0, },
+       {
+               NULL,
+               0,
+               0,
+               0,
+       },
 };
 
 static const char *config_ignore_options[] = { "help", "config", "version" };
 
-static void print_version(void) {
+static void print_version(void)
+{
        fprintf(stdout, "%s\n", VERSION);
 }
 
 static void relayd_config_log(void)
 {
        DBG("LTTng-relayd " VERSION " - " VERSION_NAME "%s%s",
-                       GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION,
-                       EXTRA_VERSION_NAME[0] == '\0' ? "" : " - " EXTRA_VERSION_NAME);
+           GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION,
+           EXTRA_VERSION_NAME[0] == '\0' ? "" : " - " EXTRA_VERSION_NAME);
        if (EXTRA_VERSION_DESCRIPTION[0] != '\0') {
                DBG("LTTng-relayd extra version description:\n\t" EXTRA_VERSION_DESCRIPTION "\n");
        }
@@ -237,7 +308,8 @@ static int set_option(int opt, const char *arg, const char *optname)
                                goto end;
                        }
                        if (v >= UINT_MAX) {
-                               ERR("File descriptor cap overflow in --fd-pool-size parameter: %s", arg);
+                               ERR("File descriptor cap overflow in --fd-pool-size parameter: %s",
+                                   arg);
                                ret = -1;
                                goto end;
                        }
@@ -252,7 +324,7 @@ static int set_option(int opt, const char *arg, const char *optname)
        case 'C':
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "-C, --control-port");
+                            "-C, --control-port");
                } else {
                        ret = uri_parse(arg, &control_uri);
                        if (ret < 0) {
@@ -267,7 +339,7 @@ static int set_option(int opt, const char *arg, const char *optname)
        case 'D':
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "-D, -data-port");
+                            "-D, -data-port");
                } else {
                        ret = uri_parse(arg, &data_uri);
                        if (ret < 0) {
@@ -282,7 +354,7 @@ static int set_option(int opt, const char *arg, const char *optname)
        case 'L':
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "-L, -live-port");
+                            "-L, -live-port");
                } else {
                        ret = uri_parse(arg, &live_uri);
                        if (ret < 0) {
@@ -303,7 +375,7 @@ static int set_option(int opt, const char *arg, const char *optname)
        case 'g':
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "-g, --group");
+                            "-g, --group");
                } else {
                        tracing_group_name = strdup(arg);
                        if (tracing_group_name == NULL) {
@@ -327,7 +399,7 @@ static int set_option(int opt, const char *arg, const char *optname)
        case 'o':
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "-o, --output");
+                            "-o, --output");
                } else {
                        ret = asprintf(&opt_output_path, "%s", arg);
                        if (ret < 0) {
@@ -340,7 +412,7 @@ static int set_option(int opt, const char *arg, const char *optname)
        case 'w':
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "-w, --working-directory");
+                            "-w, --working-directory");
                } else {
                        ret = asprintf(&opt_working_directory, "%s", arg);
                        if (ret < 0) {
@@ -400,7 +472,7 @@ end:
  * return value conventions.
  */
 static int config_entry_handler(const struct config_entry *entry,
-               void *unused __attribute__((unused)))
+                               void *unused __attribute__((unused)))
 {
        int ret = 0, i;
 
@@ -432,7 +504,8 @@ static int config_entry_handler(const struct config_entry *entry,
                        if (ret <= 0) {
                                if (ret) {
                                        WARN("Invalid configuration value \"%s\" for option %s",
-                                                       entry->value, entry->name);
+                                            entry->value,
+                                            entry->name);
                                }
                                /* False, skip boolean config option. */
                                goto end;
@@ -443,8 +516,7 @@ static int config_entry_handler(const struct config_entry *entry,
                goto end;
        }
 
-       WARN("Unrecognized option \"%s\" in daemon configuration file.",
-                       entry->name);
+       WARN("Unrecognized option \"%s\" in daemon configuration file.", entry->name);
 
 end:
        return ret;
@@ -459,8 +531,7 @@ static int parse_env_options(void)
        if (value) {
                opt_working_directory = strdup(value);
                if (!opt_working_directory) {
-                       ERR("Failed to allocate working directory string (\"%s\")",
-                                       value);
+                       ERR("Failed to allocate working directory string (\"%s\")", value);
                        ret = -1;
                }
        }
@@ -480,38 +551,41 @@ static int set_fd_pool_size(void)
        }
 
        DBG("File descriptor count limits are %" PRIu64 " (soft) and %" PRIu64 " (hard)",
-                       (uint64_t) rlimit.rlim_cur,
-                       (uint64_t) rlimit.rlim_max);
+           (uint64_t) rlimit.rlim_cur,
+           (uint64_t) rlimit.rlim_max);
        if (lttng_opt_fd_pool_size == -1) {
                /* Use default value (soft limit - reserve). */
                if (rlimit.rlim_cur < DEFAULT_RELAYD_MIN_FD_POOL_SIZE) {
-                       ERR("The process' file number limit is too low (%" PRIu64 "). The process' file number limit must be set to at least %i.",
-                                       (uint64_t) rlimit.rlim_cur, DEFAULT_RELAYD_MIN_FD_POOL_SIZE);
+                       ERR("The process' file number limit is too low (%" PRIu64
+                           "). The process' file number limit must be set to at least %i.",
+                           (uint64_t) rlimit.rlim_cur,
+                           DEFAULT_RELAYD_MIN_FD_POOL_SIZE);
                        ret = -1;
                        goto end;
                }
-               lttng_opt_fd_pool_size = rlimit.rlim_cur -
-                               DEFAULT_RELAYD_FD_POOL_SIZE_RESERVE;
+               lttng_opt_fd_pool_size = rlimit.rlim_cur - DEFAULT_RELAYD_FD_POOL_SIZE_RESERVE;
                goto end;
        }
 
        if (lttng_opt_fd_pool_size < DEFAULT_RELAYD_MIN_FD_POOL_SIZE) {
                ERR("File descriptor pool size must be set to at least %d",
-                               DEFAULT_RELAYD_MIN_FD_POOL_SIZE);
+                   DEFAULT_RELAYD_MIN_FD_POOL_SIZE);
                ret = -1;
                goto end;
        }
 
        if (lttng_opt_fd_pool_size > rlimit.rlim_cur) {
-               ERR("File descriptor pool size argument (%u) exceeds the process' soft limit (%" PRIu64 ").",
-                               lttng_opt_fd_pool_size, (uint64_t) rlimit.rlim_cur);
+               ERR("File descriptor pool size argument (%u) exceeds the process' soft limit (%" PRIu64
+                   ").",
+                   lttng_opt_fd_pool_size,
+                   (uint64_t) rlimit.rlim_cur);
                ret = -1;
                goto end;
        }
 
        DBG("File descriptor pool size argument (%u) adjusted to %u to accommodates transient fd uses",
-                       lttng_opt_fd_pool_size,
-                       lttng_opt_fd_pool_size - DEFAULT_RELAYD_FD_POOL_SIZE_RESERVE);
+           lttng_opt_fd_pool_size,
+           lttng_opt_fd_pool_size - DEFAULT_RELAYD_FD_POOL_SIZE_RESERVE);
        lttng_opt_fd_pool_size -= DEFAULT_RELAYD_FD_POOL_SIZE_RESERVE;
 end:
        return ret;
@@ -525,7 +599,7 @@ static int set_options(int argc, char **argv)
        char *config_path = NULL;
 
        optstring = utils_generate_optstring(long_options,
-                       sizeof(long_options) / sizeof(struct option));
+                                            sizeof(long_options) / sizeof(struct option));
        if (!optstring) {
                retval = -ENOMEM;
                goto exit;
@@ -533,8 +607,7 @@ static int set_options(int argc, char **argv)
 
        /* Check for the --config option */
 
-       while ((c = getopt_long(argc, argv, optstring, long_options,
-                                       &option_index)) != -1) {
+       while ((c = getopt_long(argc, argv, optstring, long_options, &option_index)) != -1) {
                if (c == '?') {
                        retval = -EINVAL;
                        goto exit;
@@ -544,7 +617,7 @@ static int set_options(int argc, char **argv)
 
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "-f, --config");
+                            "-f, --config");
                } else {
                        free(config_path);
                        config_path = utils_expand_path(optarg);
@@ -554,8 +627,8 @@ static int set_options(int argc, char **argv)
                }
        }
 
-       ret = config_get_section_entries(config_path, config_section_name,
-                       config_entry_handler, NULL);
+       ret = config_get_section_entries(
+               config_path, config_section_name, config_entry_handler, NULL);
        if (ret) {
                if (ret > 0) {
                        ERR("Invalid configuration option at line %i", ret);
@@ -583,8 +656,8 @@ static int set_options(int argc, char **argv)
        /* assign default values */
        if (control_uri == NULL) {
                ret = asprintf(&default_address,
-                       "tcp://" DEFAULT_NETWORK_CONTROL_BIND_ADDRESS ":%d",
-                       DEFAULT_NETWORK_CONTROL_PORT);
+                              "tcp://" DEFAULT_NETWORK_CONTROL_BIND_ADDRESS ":%d",
+                              DEFAULT_NETWORK_CONTROL_PORT);
                if (ret < 0) {
                        PERROR("asprintf default data address");
                        retval = -1;
@@ -601,8 +674,8 @@ static int set_options(int argc, char **argv)
        }
        if (data_uri == NULL) {
                ret = asprintf(&default_address,
-                       "tcp://" DEFAULT_NETWORK_DATA_BIND_ADDRESS ":%d",
-                       DEFAULT_NETWORK_DATA_PORT);
+                              "tcp://" DEFAULT_NETWORK_DATA_BIND_ADDRESS ":%d",
+                              DEFAULT_NETWORK_DATA_PORT);
                if (ret < 0) {
                        PERROR("asprintf default data address");
                        retval = -1;
@@ -619,8 +692,8 @@ static int set_options(int argc, char **argv)
        }
        if (live_uri == NULL) {
                ret = asprintf(&default_address,
-                       "tcp://" DEFAULT_NETWORK_VIEWER_BIND_ADDRESS ":%d",
-                       DEFAULT_NETWORK_VIEWER_PORT);
+                              "tcp://" DEFAULT_NETWORK_VIEWER_BIND_ADDRESS ":%d",
+                              DEFAULT_NETWORK_VIEWER_PORT);
                if (ret < 0) {
                        PERROR("asprintf default viewer control address");
                        retval = -1;
@@ -650,7 +723,8 @@ static int set_options(int argc, char **argv)
                if (value) {
                        ret = config_parse_value(value);
                        if (ret < 0) {
-                               ERR("Invalid value for %s specified", DEFAULT_LTTNG_RELAYD_DISALLOW_CLEAR_ENV);
+                               ERR("Invalid value for %s specified",
+                                   DEFAULT_LTTNG_RELAYD_DISALLOW_CLEAR_ENV);
                                retval = -1;
                                goto exit;
                        }
@@ -671,8 +745,7 @@ static void print_global_objects(void)
        print_sessions();
 }
 
-static int noop_close(void *data __attribute__((unused)),
-               int *fds __attribute__((unused)))
+static int noop_close(void *data __attribute__((unused)), int *fds __attribute__((unused)))
 {
        return 0;
 }
@@ -685,8 +758,7 @@ static void untrack_stdio(void)
         * noop_close is used since we don't really want to close
         * the stdio output fds; we merely want to stop tracking them.
         */
-       (void) fd_tracker_close_unsuspendable_fd(the_fd_tracker,
-                       fds, 2, noop_close, NULL);
+       (void) fd_tracker_close_unsuspendable_fd(the_fd_tracker, fds, 2, noop_close, NULL);
 }
 
 /*
@@ -713,13 +785,11 @@ static void relayd_cleanup(void)
        }
        /* Close thread quit pipes */
        if (health_quit_pipe[0] != -1) {
-               (void) fd_tracker_util_pipe_close(
-                               the_fd_tracker, health_quit_pipe);
+               (void) fd_tracker_util_pipe_close(the_fd_tracker, health_quit_pipe);
        }
        relayd_close_thread_quit_pipe();
        if (sessiond_trace_chunk_registry) {
-               sessiond_trace_chunk_registry_destroy(
-                               sessiond_trace_chunk_registry);
+               sessiond_trace_chunk_registry_destroy(sessiond_trace_chunk_registry);
        }
        if (the_fd_tracker) {
                untrack_stdio();
@@ -873,8 +943,8 @@ void lttng_relay_notify_ready(void)
  */
 static int init_health_quit_pipe(void)
 {
-       return fd_tracker_util_pipe_open_cloexec(the_fd_tracker,
-                       "Health quit pipe", health_quit_pipe);
+       return fd_tracker_util_pipe_open_cloexec(
+               the_fd_tracker, "Health quit pipe", health_quit_pipe);
 }
 
 static int create_sock(void *data, int *out_fd)
@@ -919,8 +989,7 @@ end:
 /*
  * Create and init socket from uri.
  */
-static struct lttcomm_sock *relay_socket_create(struct lttng_uri *uri,
-               const char *name)
+static struct lttcomm_sock *relay_socket_create(struct lttng_uri *uri, const char *name)
 {
        int ret, sock_fd;
        struct lttcomm_sock *sock = NULL;
@@ -940,19 +1009,21 @@ static struct lttcomm_sock *relay_socket_create(struct lttng_uri *uri,
        ret = uri_to_str_url(uri, uri_str, sizeof(uri_str));
        uri_str[sizeof(uri_str) - 1] = '\0';
        if (ret >= 0) {
-               ret = asprintf(&formated_name, "%s socket @ %s", name,
-                               uri_str);
+               ret = asprintf(&formated_name, "%s socket @ %s", name, uri_str);
                if (ret < 0) {
                        formated_name = NULL;
                }
        }
 
-       ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker, &sock_fd,
-                       (const char **) (formated_name ? &formated_name : NULL),
-                       1, create_sock, sock);
+       ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker,
+                                              &sock_fd,
+                                              (const char **) (formated_name ? &formated_name :
+                                                                               NULL),
+                                              1,
+                                              create_sock,
+                                              sock);
        if (ret) {
-               PERROR("Failed to open \"%s\" relay socket",
-                               formated_name ?: "Unknown");
+               PERROR("Failed to open \"%s\" relay socket", formated_name ?: "Unknown");
                goto error;
        }
        DBG("Listening on %s socket %d", name, sock->fd);
@@ -966,7 +1037,6 @@ static struct lttcomm_sock *relay_socket_create(struct lttng_uri *uri,
        ret = sock->ops->listen(sock, -1);
        if (ret < 0) {
                goto error;
-
        }
 
        free(formated_name);
@@ -980,18 +1050,15 @@ error:
        return NULL;
 }
 
-static
-struct lttcomm_sock *accept_relayd_sock(struct lttcomm_sock *listening_sock,
-               const char *name)
+static struct lttcomm_sock *accept_relayd_sock(struct lttcomm_sock *listening_sock,
+                                              const char *name)
 {
        int out_fd, ret;
        struct lttcomm_sock *socks[2] = { listening_sock, NULL };
        struct lttcomm_sock *new_sock = NULL;
 
        ret = fd_tracker_open_unsuspendable_fd(
-                       the_fd_tracker, &out_fd,
-                       (const char **) &name,
-                       1, accept_sock, &socks);
+               the_fd_tracker, &out_fd, (const char **) &name, 1, accept_sock, &socks);
        if (ret) {
                goto end;
        }
@@ -1060,7 +1127,7 @@ static void *relay_thread_listener(void *data __attribute__((unused)))
 
                DBG("Listener accepting connections");
 
-restart:
+       restart:
                health_poll_entry();
                ret = lttng_poll_wait(&events, -1);
                health_poll_exit();
@@ -1106,20 +1173,20 @@ restart:
                                if (pollfd == data_sock->fd) {
                                        type = RELAY_DATA;
                                        newsock = accept_relayd_sock(data_sock,
-                                                       "Data socket to relayd");
+                                                                    "Data socket to relayd");
                                } else {
                                        LTTNG_ASSERT(pollfd == control_sock->fd);
                                        type = RELAY_CONTROL;
                                        newsock = accept_relayd_sock(control_sock,
-                                                       "Control socket to relayd");
+                                                                    "Control socket to relayd");
                                }
                                if (!newsock) {
                                        PERROR("accepting sock");
                                        goto error;
                                }
 
-                               ret = setsockopt(newsock->fd, SOL_SOCKET, SO_REUSEADDR, &val,
-                                               sizeof(val));
+                               ret = setsockopt(
+                                       newsock->fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
                                if (ret < 0) {
                                        PERROR("setsockopt inet");
                                        lttcomm_destroy_sock(newsock);
@@ -1129,7 +1196,7 @@ restart:
                                ret = socket_apply_keep_alive_config(newsock->fd);
                                if (ret < 0) {
                                        ERR("Failed to apply TCP keep-alive configuration on socket (%i)",
-                                                       newsock->fd);
+                                           newsock->fd);
                                        lttcomm_destroy_sock(newsock);
                                        goto error;
                                }
@@ -1143,8 +1210,7 @@ restart:
                                /* Enqueue request for the dispatcher thread. */
                                cds_wfcq_head_ptr_t head;
                                head.h = &relay_conn_queue.head;
-                               cds_wfcq_enqueue(head, &relay_conn_queue.tail,
-                                                &new_conn->qnode);
+                               cds_wfcq_enqueue(head, &relay_conn_queue.tail, &new_conn->qnode);
 
                                /*
                                 * Wake the dispatch queue futex.
@@ -1171,9 +1237,8 @@ error_create_poll:
        if (data_sock->fd >= 0) {
                int data_sock_fd = data_sock->fd;
 
-               ret = fd_tracker_close_unsuspendable_fd(the_fd_tracker,
-                               &data_sock_fd, 1, close_sock,
-                               data_sock);
+               ret = fd_tracker_close_unsuspendable_fd(
+                       the_fd_tracker, &data_sock_fd, 1, close_sock, data_sock);
                if (ret) {
                        PERROR("Failed to close the data listener socket file descriptor");
                }
@@ -1184,9 +1249,8 @@ error_sock_relay:
        if (control_sock->fd >= 0) {
                int control_sock_fd = control_sock->fd;
 
-               ret = fd_tracker_close_unsuspendable_fd(the_fd_tracker,
-                               &control_sock_fd, 1, close_sock,
-                               control_sock);
+               ret = fd_tracker_close_unsuspendable_fd(
+                       the_fd_tracker, &control_sock_fd, 1, close_sock, control_sock);
                if (ret) {
                        PERROR("Failed to close the control listener socket file descriptor");
                }
@@ -1295,10 +1359,9 @@ static bool session_streams_have_index(const struct relay_session *session)
  *
  * On success, send back the session id or else return a negative value.
  */
-static int relay_create_session(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_create_session(const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
+                               struct relay_connection *conn,
+                               const struct lttng_buffer_view *payload)
 {
        int ret = 0;
        ssize_t send_ret;
@@ -1324,8 +1387,8 @@ static int relay_create_session(
                ret = 0;
        } else if (conn->minor >= 4 && conn->minor < 11) {
                /* From 2.4 to 2.10 */
-               ret = cmd_create_session_2_4(payload, session_name,
-                       hostname, &live_timer, &snapshot);
+               ret = cmd_create_session_2_4(
+                       payload, session_name, hostname, &live_timer, &snapshot);
        } else {
                bool has_current_chunk;
                uint64_t current_chunk_id_value;
@@ -1333,11 +1396,18 @@ static int relay_create_session(
                uint64_t id_sessiond_value;
 
                /* From 2.11 to ... */
-               ret = cmd_create_session_2_11(payload, session_name, hostname,
-                               base_path, &live_timer, &snapshot, &id_sessiond_value,
-                               sessiond_uuid, &has_current_chunk,
-                               &current_chunk_id_value, &creation_time_value,
-                               &session_name_contains_creation_timestamp);
+               ret = cmd_create_session_2_11(payload,
+                                             session_name,
+                                             hostname,
+                                             base_path,
+                                             &live_timer,
+                                             &snapshot,
+                                             &id_sessiond_value,
+                                             sessiond_uuid,
+                                             &has_current_chunk,
+                                             &current_chunk_id_value,
+                                             &creation_time_value,
+                                             &session_name_contains_creation_timestamp);
                if (lttng_uuid_is_nil(sessiond_uuid)) {
                        /* The nil UUID is reserved for pre-2.11 clients. */
                        ERR("Illegal nil UUID announced by peer in create session command");
@@ -1347,8 +1417,7 @@ static int relay_create_session(
                LTTNG_OPTIONAL_SET(&id_sessiond, id_sessiond_value);
                LTTNG_OPTIONAL_SET(&creation_time, creation_time_value);
                if (has_current_chunk) {
-                       LTTNG_OPTIONAL_SET(&current_chunk_id,
-                                       current_chunk_id_value);
+                       LTTNG_OPTIONAL_SET(&current_chunk_id, current_chunk_id_value);
                }
        }
 
@@ -1356,13 +1425,18 @@ static int relay_create_session(
                goto send_reply;
        }
 
-       session = session_create(session_name, hostname, base_path, live_timer,
-                       snapshot, sessiond_uuid,
-                       id_sessiond.is_set ? &id_sessiond.value : NULL,
-                       current_chunk_id.is_set ? &current_chunk_id.value : NULL,
-                       creation_time.is_set ? &creation_time.value : NULL,
-                       conn->major, conn->minor,
-                       session_name_contains_creation_timestamp);
+       session = session_create(session_name,
+                                hostname,
+                                base_path,
+                                live_timer,
+                                snapshot,
+                                sessiond_uuid,
+                                id_sessiond.is_set ? &id_sessiond.value : NULL,
+                                current_chunk_id.is_set ? &current_chunk_id.value : NULL,
+                                creation_time.is_set ? &creation_time.value : NULL,
+                                conn->major,
+                                conn->minor,
+                                session_name_contains_creation_timestamp);
        if (!session) {
                ret = -1;
                goto send_reply;
@@ -1382,29 +1456,26 @@ send_reply:
 
        if (conn->minor < 11) {
                /* From 2.1 to 2.10 */
-               ret = lttng_dynamic_buffer_append(&reply_payload,
-                               &reply.generic, sizeof(reply.generic));
+               ret = lttng_dynamic_buffer_append(
+                       &reply_payload, &reply.generic, sizeof(reply.generic));
                if (ret) {
                        ERR("Failed to append \"create session\" command reply header to payload buffer");
                        ret = -1;
                        goto end;
                }
        } else {
-               const uint32_t output_path_length =
-                               session ? strlen(session->output_path) + 1 : 0;
+               const uint32_t output_path_length = session ? strlen(session->output_path) + 1 : 0;
 
                reply.output_path_length = htobe32(output_path_length);
-               ret = lttng_dynamic_buffer_append(
-                               &reply_payload, &reply, sizeof(reply));
+               ret = lttng_dynamic_buffer_append(&reply_payload, &reply, sizeof(reply));
                if (ret) {
                        ERR("Failed to append \"create session\" command reply header to payload buffer");
                        goto end;
                }
 
                if (output_path_length) {
-                       ret = lttng_dynamic_buffer_append(&reply_payload,
-                                       session->output_path,
-                                       output_path_length);
+                       ret = lttng_dynamic_buffer_append(
+                               &reply_payload, session->output_path, output_path_length);
                        if (ret) {
                                ERR("Failed to append \"create session\" command reply path to payload buffer");
                                goto end;
@@ -1412,11 +1483,11 @@ send_reply:
                }
        }
 
-       send_ret = conn->sock->ops->sendmsg(conn->sock, reply_payload.data,
-                       reply_payload.size, 0);
+       send_ret = conn->sock->ops->sendmsg(conn->sock, reply_payload.data, reply_payload.size, 0);
        if (send_ret < (ssize_t) reply_payload.size) {
                ERR("Failed to send \"create session\" command reply of %zu bytes (ret = %zd)",
-                               reply_payload.size, send_ret);
+                   reply_payload.size,
+                   send_ret);
                ret = -1;
        }
 end:
@@ -1442,8 +1513,8 @@ static void publish_connection_local_streams(struct relay_connection *conn)
         */
        pthread_mutex_lock(&session->lock);
        rcu_read_lock();
-       cds_list_for_each_entry_rcu(stream, &session->recv_list,
-                       recv_node) {
+       cds_list_for_each_entry_rcu(stream, &session->recv_list, recv_node)
+       {
                stream_publish(stream);
        }
        rcu_read_unlock();
@@ -1463,7 +1534,7 @@ static int conform_channel_path(char *channel_path)
 
        if (strstr("../", channel_path)) {
                ERR("Refusing channel path as it walks up the path hierarchy: \"%s\"",
-                               channel_path);
+                   channel_path);
                ret = -1;
                goto end;
        }
@@ -1488,10 +1559,9 @@ end:
 /*
  * relay_add_stream: allocate a new stream for a session
  */
-static int relay_add_stream(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_add_stream(const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
+                           struct relay_connection *conn,
+                           const struct lttng_buffer_view *payload)
 {
        int ret;
        ssize_t send_ret;
@@ -1512,17 +1582,19 @@ static int relay_add_stream(
 
        if (session->minor == 1) {
                /* For 2.1 */
-               ret = cmd_recv_stream_2_1(payload, &path_name,
-                       &channel_name);
+               ret = cmd_recv_stream_2_1(payload, &path_name, &channel_name);
        } else if (session->minor > 1 && session->minor < 11) {
                /* From 2.2 to 2.10 */
-               ret = cmd_recv_stream_2_2(payload, &path_name,
-                       &channel_name, &tracefile_size, &tracefile_count);
+               ret = cmd_recv_stream_2_2(
+                       payload, &path_name, &channel_name, &tracefile_size, &tracefile_count);
        } else {
                /* From 2.11 to ... */
-               ret = cmd_recv_stream_2_11(payload, &path_name,
-                       &channel_name, &tracefile_size, &tracefile_count,
-                       &stream_chunk_id.value);
+               ret = cmd_recv_stream_2_11(payload,
+                                          &path_name,
+                                          &channel_name,
+                                          &tracefile_size,
+                                          &tracefile_count,
+                                          &stream_chunk_id.value);
                stream_chunk_id.is_set = true;
        }
 
@@ -1555,25 +1627,24 @@ static int relay_add_stream(
                         */
                        WARN("Unable to perform a --group-by-session transformation for session %" PRIu64
                             " for stream with path \"%s\" as it is produced by a peer using a protocol older than v2.4",
-                                       session->id, path_name);
+                            session->id,
+                            path_name);
                } else if (conn->minor >= 4 && conn->minor < 11) {
                        char *group_by_session_path_name;
 
                        LTTNG_ASSERT(session->session_name[0] != '\0');
 
-                       group_by_session_path_name =
-                                       backward_compat_group_by_session(
-                                                       path_name,
-                                                       session->session_name,
-                                                       session->creation_time.value);
+                       group_by_session_path_name = backward_compat_group_by_session(
+                               path_name, session->session_name, session->creation_time.value);
                        if (!group_by_session_path_name) {
                                ERR("Failed to apply group by session to stream of session %" PRIu64,
-                                               session->id);
+                                   session->id);
                                goto send_reply;
                        }
 
                        DBG("Transformed session path from \"%s\" to \"%s\" to honor per-session name grouping",
-                                       path_name, group_by_session_path_name);
+                           path_name,
+                           group_by_session_path_name);
 
                        free(path_name);
                        path_name = group_by_session_path_name;
@@ -1591,8 +1662,8 @@ static int relay_add_stream(
        pthread_mutex_unlock(&last_relay_stream_id_lock);
 
        /* We pass ownership of path_name and channel_name. */
-       stream = stream_create(trace, stream_handle, path_name,
-               channel_name, tracefile_size, tracefile_count);
+       stream = stream_create(
+               trace, stream_handle, path_name, channel_name, tracefile_size, tracefile_count);
        path_name = NULL;
        channel_name = NULL;
 
@@ -1611,11 +1682,10 @@ send_reply:
                reply.ret_code = htobe32(LTTNG_OK);
        }
 
-       send_ret = conn->sock->ops->sendmsg(conn->sock, &reply,
-                       sizeof(struct lttcomm_relayd_status_stream), 0);
+       send_ret = conn->sock->ops->sendmsg(
+               conn->sock, &reply, sizeof(struct lttcomm_relayd_status_stream), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"add stream\" command reply (ret = %zd)",
-                               send_ret);
+               ERR("Failed to send \"add stream\" command reply (ret = %zd)", send_ret);
                ret = -1;
        }
 
@@ -1628,10 +1698,9 @@ end_no_session:
 /*
  * relay_close_stream: close a specific stream
  */
-static int relay_close_stream(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_close_stream(const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
+                             struct relay_connection *conn,
+                             const struct lttng_buffer_view *payload)
 {
        int ret;
        ssize_t send_ret;
@@ -1650,7 +1719,8 @@ static int relay_close_stream(
 
        if (payload->size < sizeof(stream_info)) {
                ERR("Unexpected payload size in \"relay_close_stream\": expected >= %zu bytes, got %zu bytes",
-                               sizeof(stream_info), payload->size);
+                   sizeof(stream_info),
+                   payload->size);
                ret = -1;
                goto end_no_session;
        }
@@ -1691,11 +1761,10 @@ end:
        } else {
                reply.ret_code = htobe32(LTTNG_OK);
        }
-       send_ret = conn->sock->ops->sendmsg(conn->sock, &reply,
-                       sizeof(struct lttcomm_relayd_generic_reply), 0);
+       send_ret = conn->sock->ops->sendmsg(
+               conn->sock, &reply, sizeof(struct lttcomm_relayd_generic_reply), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"close stream\" command reply (ret = %zd)",
-                               send_ret);
+               ERR("Failed to send \"close stream\" command reply (ret = %zd)", send_ret);
                ret = -1;
        }
 
@@ -1706,11 +1775,9 @@ end_no_session:
 /*
  * relay_reset_metadata: reset a metadata stream
  */
-static
-int relay_reset_metadata(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_reset_metadata(const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
+                               struct relay_connection *conn,
+                               const struct lttng_buffer_view *payload)
 {
        int ret;
        ssize_t send_ret;
@@ -1729,7 +1796,8 @@ int relay_reset_metadata(
 
        if (payload->size < sizeof(stream_info)) {
                ERR("Unexpected payload size in \"relay_reset_metadata\": expected >= %zu bytes, got %zu bytes",
-                               sizeof(stream_info), payload->size);
+                   sizeof(stream_info),
+                   payload->size);
                ret = -1;
                goto end_no_session;
        }
@@ -1758,10 +1826,10 @@ int relay_reset_metadata(
 
        ret = stream_reset_file(stream);
        if (ret < 0) {
-               ERR("Failed to reset metadata stream %" PRIu64
-                               ": stream_path = %s, channel = %s",
-                               stream->stream_handle, stream->path_name,
-                               stream->channel_name);
+               ERR("Failed to reset metadata stream %" PRIu64 ": stream_path = %s, channel = %s",
+                   stream->stream_handle,
+                   stream->path_name,
+                   stream->channel_name);
                goto end_unlock;
        }
 end_unlock:
@@ -1775,11 +1843,10 @@ end:
        } else {
                reply.ret_code = htobe32(LTTNG_OK);
        }
-       send_ret = conn->sock->ops->sendmsg(conn->sock, &reply,
-                       sizeof(struct lttcomm_relayd_generic_reply), 0);
+       send_ret = conn->sock->ops->sendmsg(
+               conn->sock, &reply, sizeof(struct lttcomm_relayd_generic_reply), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"reset metadata\" command reply (ret = %zd)",
-                               send_ret);
+               ERR("Failed to send \"reset metadata\" command reply (ret = %zd)", send_ret);
                ret = -1;
        }
 
@@ -1807,10 +1874,9 @@ static void relay_unknown_command(struct relay_connection *conn)
  * relay_start: send an acknowledgment to the client to tell if we are
  * ready to receive data. We are ready if a session is established.
  */
-static int relay_start(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload __attribute__((unused)))
+static int relay_start(const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
+                      struct relay_connection *conn,
+                      const struct lttng_buffer_view *payload __attribute__((unused)))
 {
        int ret = 0;
        ssize_t send_ret;
@@ -1824,11 +1890,9 @@ static int relay_start(
 
        memset(&reply, 0, sizeof(reply));
        reply.ret_code = htobe32(LTTNG_OK);
-       send_ret = conn->sock->ops->sendmsg(conn->sock, &reply,
-                       sizeof(reply), 0);
+       send_ret = conn->sock->ops->sendmsg(conn->sock, &reply, sizeof(reply), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"relay_start\" command reply (ret = %zd)",
-                               send_ret);
+               ERR("Failed to send \"relay_start\" command reply (ret = %zd)", send_ret);
                ret = -1;
        }
 
@@ -1839,8 +1903,8 @@ static int relay_start(
  * relay_recv_metadata: receive the metadata for the session.
  */
 static int relay_recv_metadata(const struct lttcomm_relayd_hdr *recv_hdr,
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+                              struct relay_connection *conn,
+                              const struct lttng_buffer_view *payload)
 {
        int ret = 0;
        struct relay_session *session = conn->session;
@@ -1860,15 +1924,12 @@ static int relay_recv_metadata(const struct lttcomm_relayd_hdr *recv_hdr,
                ret = -1;
                goto end;
        }
-       metadata_payload_size = recv_hdr->data_size -
-                       sizeof(struct lttcomm_relayd_metadata_payload);
+       metadata_payload_size =
+               recv_hdr->data_size - sizeof(struct lttcomm_relayd_metadata_payload);
 
-       memcpy(&metadata_payload_header, payload->data,
-                       sizeof(metadata_payload_header));
-       metadata_payload_header.stream_id = be64toh(
-                       metadata_payload_header.stream_id);
-       metadata_payload_header.padding_size = be32toh(
-                       metadata_payload_header.padding_size);
+       memcpy(&metadata_payload_header, payload->data, sizeof(metadata_payload_header));
+       metadata_payload_header.stream_id = be64toh(metadata_payload_header.stream_id);
+       metadata_payload_header.padding_size = be32toh(metadata_payload_header.padding_size);
 
        metadata_stream = stream_get_by_id(metadata_payload_header.stream_id);
        if (!metadata_stream) {
@@ -1876,8 +1937,8 @@ static int relay_recv_metadata(const struct lttcomm_relayd_hdr *recv_hdr,
                goto end;
        }
 
-       packet_view = lttng_buffer_view_from_view(payload,
-                       sizeof(metadata_payload_header), metadata_payload_size);
+       packet_view = lttng_buffer_view_from_view(
+               payload, sizeof(metadata_payload_header), metadata_payload_size);
        if (!lttng_buffer_view_is_valid(&packet_view)) {
                ERR("Invalid metadata packet length announced by header");
                ret = -1;
@@ -1885,10 +1946,9 @@ static int relay_recv_metadata(const struct lttcomm_relayd_hdr *recv_hdr,
        }
 
        pthread_mutex_lock(&metadata_stream->lock);
-       ret = stream_write(metadata_stream, &packet_view,
-                       metadata_payload_header.padding_size);
+       ret = stream_write(metadata_stream, &packet_view, metadata_payload_header.padding_size);
        pthread_mutex_unlock(&metadata_stream->lock);
-       if (ret){
+       if (ret) {
                ret = -1;
                goto end_put;
        }
@@ -1901,10 +1961,9 @@ end:
 /*
  * relay_send_version: send relayd version number
  */
-static int relay_send_version(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_send_version(const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
+                             struct relay_connection *conn,
+                             const struct lttng_buffer_view *payload)
 {
        int ret;
        ssize_t send_ret;
@@ -1916,7 +1975,8 @@ static int relay_send_version(
        /* Get version from the other side. */
        if (payload->size < sizeof(msg)) {
                ERR("Unexpected payload size in \"relay_send_version\": expected >= %zu bytes, got %zu bytes",
-                               sizeof(msg), payload->size);
+                   sizeof(msg),
+                   payload->size);
                ret = -1;
                goto end;
        }
@@ -1932,7 +1992,8 @@ static int relay_send_version(
        /* Major versions must be the same */
        if (reply.major != msg.major) {
                DBG("Incompatible major versions (%u vs %u), deleting session",
-                               reply.major, msg.major);
+                   reply.major,
+                   msg.major);
                compatible = false;
        }
 
@@ -1946,11 +2007,9 @@ static int relay_send_version(
 
        reply.major = htobe32(reply.major);
        reply.minor = htobe32(reply.minor);
-       send_ret = conn->sock->ops->sendmsg(conn->sock, &reply,
-                       sizeof(reply), 0);
+       send_ret = conn->sock->ops->sendmsg(conn->sock, &reply, sizeof(reply), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"send version\" command reply (ret = %zd)",
-                               send_ret);
+               ERR("Failed to send \"send version\" command reply (ret = %zd)", send_ret);
                ret = -1;
                goto end;
        } else {
@@ -1962,8 +2021,7 @@ static int relay_send_version(
                goto end;
        }
 
-       DBG("Version check done using protocol %u.%u", conn->major,
-                       conn->minor);
+       DBG("Version check done using protocol %u.%u", conn->major, conn->minor);
 
 end:
        return ret;
@@ -1972,10 +2030,9 @@ end:
 /*
  * Check for data pending for a given stream id from the session daemon.
  */
-static int relay_data_pending(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_data_pending(const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
+                             struct relay_connection *conn,
+                             const struct lttng_buffer_view *payload)
 {
        struct relay_session *session = conn->session;
        struct lttcomm_relayd_data_pending msg;
@@ -1995,7 +2052,8 @@ static int relay_data_pending(
 
        if (payload->size < sizeof(msg)) {
                ERR("Unexpected payload size in \"relay_data_pending\": expected >= %zu bytes, got %zu bytes",
-                               sizeof(msg), payload->size);
+                   sizeof(msg),
+                   payload->size);
                ret = -1;
                goto end_no_session;
        }
@@ -2021,10 +2079,11 @@ static int relay_data_pending(
                stream_seq = stream->prev_data_seq;
        }
        DBG("Data pending for stream id %" PRIu64 ": prev_data_seq %" PRIu64
-                       ", prev_index_seq %" PRIu64
-                       ", and last_seq %" PRIu64, msg.stream_id,
-                       stream->prev_data_seq, stream->prev_index_seq,
-                       msg.last_net_seq_num);
+           ", prev_index_seq %" PRIu64 ", and last_seq %" PRIu64,
+           msg.stream_id,
+           stream->prev_data_seq,
+           stream->prev_index_seq,
+           msg.last_net_seq_num);
 
        /* Avoid wrapping issue */
        if (((int64_t) (stream_seq - msg.last_net_seq_num)) >= 0) {
@@ -2045,8 +2104,7 @@ end:
        reply.ret_code = htobe32(ret);
        send_ret = conn->sock->ops->sendmsg(conn->sock, &reply, sizeof(reply), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"data pending\" command reply (ret = %zd)",
-                               send_ret);
+               ERR("Failed to send \"data pending\" command reply (ret = %zd)", send_ret);
                ret = -1;
        }
 
@@ -2062,10 +2120,10 @@ end_no_session:
  * the control socket has been handled. So, this is why we simply return
  * OK here.
  */
-static int relay_quiescent_control(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_quiescent_control(const struct lttcomm_relayd_hdr *recv_hdr
+                                  __attribute__((unused)),
+                                  struct relay_connection *conn,
+                                  const struct lttng_buffer_view *payload)
 {
        int ret;
        ssize_t send_ret;
@@ -2083,7 +2141,8 @@ static int relay_quiescent_control(
 
        if (payload->size < sizeof(msg)) {
                ERR("Unexpected payload size in \"relay_quiescent_control\": expected >= %zu bytes, got %zu bytes",
-                               sizeof(msg), payload->size);
+                   sizeof(msg),
+                   payload->size);
                ret = -1;
                goto end_no_session;
        }
@@ -2105,8 +2164,7 @@ reply:
        reply.ret_code = htobe32(LTTNG_OK);
        send_ret = conn->sock->ops->sendmsg(conn->sock, &reply, sizeof(reply), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"quiescent control\" command reply (ret = %zd)",
-                               send_ret);
+               ERR("Failed to send \"quiescent control\" command reply (ret = %zd)", send_ret);
                ret = -1;
        } else {
                ret = 0;
@@ -2124,8 +2182,8 @@ end_no_session:
  * This command returns to the client a LTTNG_OK code.
  */
 static int relay_begin_data_pending(const struct lttcomm_relayd_hdr *recv_hdr,
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+                                   struct relay_connection *conn,
+                                   const struct lttng_buffer_view *payload)
 {
        int ret;
        ssize_t send_ret;
@@ -2147,7 +2205,8 @@ static int relay_begin_data_pending(const struct lttcomm_relayd_hdr *recv_hdr,
 
        if (payload->size < sizeof(msg)) {
                ERR("Unexpected payload size in \"relay_begin_data_pending\": expected >= %zu bytes, got %zu bytes",
-                               sizeof(msg), payload->size);
+                   sizeof(msg),
+                   payload->size);
                ret = -1;
                goto end_no_session;
        }
@@ -2161,8 +2220,7 @@ static int relay_begin_data_pending(const struct lttcomm_relayd_hdr *recv_hdr,
         * the right session_id.
         */
        rcu_read_lock();
-       cds_lfht_for_each_entry(relay_streams_ht->ht, &iter.iter, stream,
-                       node.node) {
+       cds_lfht_for_each_entry (relay_streams_ht->ht, &iter.iter, stream, node.node) {
                if (!stream_get(stream)) {
                        continue;
                }
@@ -2171,7 +2229,7 @@ static int relay_begin_data_pending(const struct lttcomm_relayd_hdr *recv_hdr,
                        stream->data_pending_check_done = false;
                        pthread_mutex_unlock(&stream->lock);
                        DBG("Set begin data pending flag to stream %" PRIu64,
-                                       stream->stream_handle);
+                           stream->stream_handle);
                }
                stream_put(stream);
        }
@@ -2183,8 +2241,7 @@ static int relay_begin_data_pending(const struct lttcomm_relayd_hdr *recv_hdr,
 
        send_ret = conn->sock->ops->sendmsg(conn->sock, &reply, sizeof(reply), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"begin data pending\" command reply (ret = %zd)",
-                       send_ret);
+               ERR("Failed to send \"begin data pending\" command reply (ret = %zd)", send_ret);
                ret = -1;
        } else {
                ret = 0;
@@ -2203,10 +2260,9 @@ end_no_session:
  *
  * Return to the client if there is data in flight or not with a ret_code.
  */
-static int relay_end_data_pending(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_end_data_pending(const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
+                                 struct relay_connection *conn,
+                                 const struct lttng_buffer_view *payload)
 {
        int ret;
        ssize_t send_ret;
@@ -2226,7 +2282,8 @@ static int relay_end_data_pending(
 
        if (payload->size < sizeof(msg)) {
                ERR("Unexpected payload size in \"relay_end_data_pending\": expected >= %zu bytes, got %zu bytes",
-                               sizeof(msg), payload->size);
+                   sizeof(msg),
+                   payload->size);
                ret = -1;
                goto end_no_session;
        }
@@ -2238,8 +2295,7 @@ static int relay_end_data_pending(
         * flag is set.
         */
        rcu_read_lock();
-       cds_lfht_for_each_entry(relay_streams_ht->ht, &iter.iter, stream,
-                       node.node) {
+       cds_lfht_for_each_entry (relay_streams_ht->ht, &iter.iter, stream, node.node) {
                if (!stream_get(stream)) {
                        continue;
                }
@@ -2256,14 +2312,16 @@ static int relay_end_data_pending(
                                 * Ensure that both the index and stream data have been
                                 * flushed up to the requested point.
                                 */
-                               stream_seq = std::min(stream->prev_data_seq, stream->prev_index_seq);
+                               stream_seq =
+                                       std::min(stream->prev_data_seq, stream->prev_index_seq);
                        } else {
                                stream_seq = stream->prev_data_seq;
                        }
-                       if (!stream->closed || !(((int64_t) (stream_seq - stream->last_net_seq_num)) >= 0)) {
+                       if (!stream->closed ||
+                           !(((int64_t) (stream_seq - stream->last_net_seq_num)) >= 0)) {
                                is_data_inflight = 1;
                                DBG("Data is still in flight for stream %" PRIu64,
-                                               stream->stream_handle);
+                                   stream->stream_handle);
                                pthread_mutex_unlock(&stream->lock);
                                stream_put(stream);
                                break;
@@ -2280,8 +2338,7 @@ static int relay_end_data_pending(
 
        send_ret = conn->sock->ops->sendmsg(conn->sock, &reply, sizeof(reply), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"end data pending\" command reply (ret = %zd)",
-                       send_ret);
+               ERR("Failed to send \"end data pending\" command reply (ret = %zd)", send_ret);
                ret = -1;
        } else {
                ret = 0;
@@ -2296,10 +2353,9 @@ end_no_session:
  *
  * Return 0 on success else a negative value.
  */
-static int relay_recv_index(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_recv_index(const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
+                           struct relay_connection *conn,
+                           const struct lttng_buffer_view *payload)
 {
        int ret;
        ssize_t send_ret;
@@ -2319,12 +2375,12 @@ static int relay_recv_index(
                goto end_no_session;
        }
 
-       msg_len = lttcomm_relayd_index_len(
-                       lttng_to_index_major(conn->major, conn->minor),
-                       lttng_to_index_minor(conn->major, conn->minor));
+       msg_len = lttcomm_relayd_index_len(lttng_to_index_major(conn->major, conn->minor),
+                                          lttng_to_index_minor(conn->major, conn->minor));
        if (payload->size < msg_len) {
                ERR("Unexpected payload size in \"relay_recv_index\": expected >= %zu bytes, got %zu bytes",
-                               msg_len, payload->size);
+                   msg_len,
+                   payload->size);
                ret = -1;
                goto end_no_session;
        }
@@ -2339,8 +2395,7 @@ static int relay_recv_index(
        index_info.stream_id = be64toh(index_info.stream_id);
 
        if (conn->minor >= 8) {
-               index_info.stream_instance_id =
-                               be64toh(index_info.stream_instance_id);
+               index_info.stream_instance_id = be64toh(index_info.stream_instance_id);
                index_info.packet_seq_num = be64toh(index_info.packet_seq_num);
        } else {
                index_info.stream_instance_id = -1ULL;
@@ -2385,10 +2440,9 @@ end_no_session:
  *
  * Return 0 on success else a negative value.
  */
-static int relay_streams_sent(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload __attribute__((unused)))
+static int relay_streams_sent(const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
+                             struct relay_connection *conn,
+                             const struct lttng_buffer_view *payload __attribute__((unused)))
 {
        int ret;
        ssize_t send_ret;
@@ -2414,8 +2468,7 @@ static int relay_streams_sent(
        reply.ret_code = htobe32(LTTNG_OK);
        send_ret = conn->sock->ops->sendmsg(conn->sock, &reply, sizeof(reply), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"streams sent\" command reply (ret = %zd)",
-                       send_ret);
+               ERR("Failed to send \"streams sent\" command reply (ret = %zd)", send_ret);
                ret = -1;
        } else {
                /* Success. */
@@ -2426,9 +2479,9 @@ end_no_session:
        return ret;
 }
 
-static ssize_t relay_unpack_rotate_streams_header(
-               const struct lttng_buffer_view *payload,
-               struct lttcomm_relayd_rotate_streams *_rotate_streams)
+static ssize_t
+relay_unpack_rotate_streams_header(const struct lttng_buffer_view *payload,
+                                  struct lttcomm_relayd_rotate_streams *_rotate_streams)
 {
        struct lttcomm_relayd_rotate_streams rotate_streams;
        /*
@@ -2439,13 +2492,13 @@ static ssize_t relay_unpack_rotate_streams_header(
         * See comment at the declaration of this structure for more information.
         */
        ssize_t header_len = sizeof(struct lttcomm_relayd_rotate_streams_packed);
-       size_t expected_payload_size_no_padding,
-               expected_payload_size_3_bytes_padding,
+       size_t expected_payload_size_no_padding, expected_payload_size_3_bytes_padding,
                expected_payload_size_7_bytes_padding;
 
        if (payload->size < header_len) {
                ERR("Unexpected payload size in \"relay_rotate_session_stream\": expected >= %zu bytes, got %zu bytes",
-                               header_len, payload->size);
+                   header_len,
+                   payload->size);
                goto error;
        }
 
@@ -2469,14 +2522,14 @@ static ssize_t relay_unpack_rotate_streams_header(
         * Payload size expected given the possible padding lengths in
         * `struct lttcomm_relayd_rotate_streams`.
         */
-       expected_payload_size_no_padding = (rotate_streams.stream_count *
-               sizeof(*rotate_streams.rotation_positions)) +
+       expected_payload_size_no_padding =
+               (rotate_streams.stream_count * sizeof(*rotate_streams.rotation_positions)) +
                sizeof(lttcomm_relayd_rotate_streams_packed);
-       expected_payload_size_3_bytes_padding = (rotate_streams.stream_count *
-               sizeof(*rotate_streams.rotation_positions)) +
+       expected_payload_size_3_bytes_padding =
+               (rotate_streams.stream_count * sizeof(*rotate_streams.rotation_positions)) +
                sizeof(lttcomm_relayd_rotate_streams_3_bytes_padding);
-       expected_payload_size_7_bytes_padding = (rotate_streams.stream_count *
-               sizeof(*rotate_streams.rotation_positions)) +
+       expected_payload_size_7_bytes_padding =
+               (rotate_streams.stream_count * sizeof(*rotate_streams.rotation_positions)) +
                sizeof(lttcomm_relayd_rotate_streams_7_bytes_padding);
 
        if (payload->size == expected_payload_size_no_padding) {
@@ -2530,10 +2583,10 @@ static ssize_t relay_unpack_rotate_streams_header(
                header_len = sizeof(padded_rotate_streams);
        } else {
                ERR("Unexpected payload size in \"relay_rotate_session_stream\": expected %zu, %zu or %zu bytes, got %zu bytes",
-                               expected_payload_size_no_padding,
-                               expected_payload_size_3_bytes_padding,
-                               expected_payload_size_7_bytes_padding,
-                               payload->size);
+                   expected_payload_size_no_padding,
+                   expected_payload_size_3_bytes_padding,
+                   expected_payload_size_7_bytes_padding,
+                   payload->size);
                goto error;
        }
 
@@ -2546,10 +2599,10 @@ error:
  * relay_rotate_session_stream: rotate a stream to a new tracefile for the
  * session rotation feature (not the tracefile rotation feature).
  */
-static int relay_rotate_session_streams(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_rotate_session_streams(const struct lttcomm_relayd_hdr *recv_hdr
+                                       __attribute__((unused)),
+                                       struct relay_connection *conn,
+                                       const struct lttng_buffer_view *payload)
 {
        int ret = 0;
        uint32_t i;
@@ -2590,27 +2643,29 @@ static int relay_rotate_session_streams(
                 * before this command is received.
                 */
                next_trace_chunk = sessiond_trace_chunk_registry_get_chunk(
-                               sessiond_trace_chunk_registry,
-                               session->sessiond_uuid,
-                               conn->session->id_sessiond.is_set ?
-                                       conn->session->id_sessiond.value :
-                                       conn->session->id,
-                               rotate_streams.new_chunk_id.value);
+                       sessiond_trace_chunk_registry,
+                       session->sessiond_uuid,
+                       conn->session->id_sessiond.is_set ? conn->session->id_sessiond.value :
+                                                           conn->session->id,
+                       rotate_streams.new_chunk_id.value);
                if (!next_trace_chunk) {
                        char uuid_str[LTTNG_UUID_STR_LEN];
 
                        lttng_uuid_to_str(session->sessiond_uuid, uuid_str);
                        ERR("Unknown next trace chunk in ROTATE_STREAMS command: sessiond_uuid = {%s}, session_id = %" PRIu64
-                                       ", trace_chunk_id = %" PRIu64,
-                                       uuid_str, session->id,
-                                       rotate_streams.new_chunk_id.value);
+                           ", trace_chunk_id = %" PRIu64,
+                           uuid_str,
+                           session->id,
+                           rotate_streams.new_chunk_id.value);
                        reply_code = LTTNG_ERR_INVALID_PROTOCOL;
                        ret = -1;
                        goto end;
                }
 
-               ret = snprintf(chunk_id_buf, sizeof(chunk_id_buf), "%" PRIu64,
-                               rotate_streams.new_chunk_id.value);
+               ret = snprintf(chunk_id_buf,
+                              sizeof(chunk_id_buf),
+                              "%" PRIu64,
+                              rotate_streams.new_chunk_id.value);
                if (ret < 0 || ret >= sizeof(chunk_id_buf)) {
                        chunk_id_str = "formatting error";
                } else {
@@ -2619,15 +2674,14 @@ static int relay_rotate_session_streams(
        }
 
        DBG("Rotate %" PRIu32 " streams of session \"%s\" to chunk \"%s\"",
-                       rotate_streams.stream_count, session->session_name,
-                       chunk_id_str);
+           rotate_streams.stream_count,
+           session->session_name,
+           chunk_id_str);
 
-       stream_positions = lttng_buffer_view_from_view(payload,
-                       header_len, -1);
+       stream_positions = lttng_buffer_view_from_view(payload, header_len, -1);
        if (!stream_positions.data ||
-                       stream_positions.size <
-                                       (rotate_streams.stream_count *
-                                                       sizeof(struct lttcomm_relayd_stream_rotation_position))) {
+           stream_positions.size < (rotate_streams.stream_count *
+                                    sizeof(struct lttcomm_relayd_stream_rotation_position))) {
                reply_code = LTTNG_ERR_INVALID_PROTOCOL;
                ret = -1;
                goto end;
@@ -2635,11 +2689,10 @@ static int relay_rotate_session_streams(
 
        for (i = 0; i < rotate_streams.stream_count; i++) {
                struct lttcomm_relayd_stream_rotation_position *position_comm =
-                               &((typeof(position_comm)) stream_positions.data)[i];
+                       &((typeof(position_comm)) stream_positions.data)[i];
                const struct lttcomm_relayd_stream_rotation_position pos = {
                        .stream_id = be64toh(position_comm->stream_id),
-                       .rotate_at_seq_num = be64toh(
-                                       position_comm->rotate_at_seq_num),
+                       .rotate_at_seq_num = be64toh(position_comm->rotate_at_seq_num),
                };
 
                stream = stream_get_by_id(pos.stream_id);
@@ -2650,8 +2703,7 @@ static int relay_rotate_session_streams(
                }
 
                pthread_mutex_lock(&stream->lock);
-               ret = stream_set_pending_rotation(stream, next_trace_chunk,
-                               pos.rotate_at_seq_num);
+               ret = stream_set_pending_rotation(stream, next_trace_chunk, pos.rotate_at_seq_num);
                pthread_mutex_unlock(&stream->lock);
                if (ret) {
                        reply_code = LTTNG_ERR_FILE_CREATION_ERROR;
@@ -2670,11 +2722,10 @@ end:
        }
 
        reply.ret_code = htobe32((uint32_t) reply_code);
-       send_ret = conn->sock->ops->sendmsg(conn->sock, &reply,
-                       sizeof(struct lttcomm_relayd_generic_reply), 0);
+       send_ret = conn->sock->ops->sendmsg(
+               conn->sock, &reply, sizeof(struct lttcomm_relayd_generic_reply), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"rotate session stream\" command reply (ret = %zd)",
-                               send_ret);
+               ERR("Failed to send \"rotate session stream\" command reply (ret = %zd)", send_ret);
                ret = -1;
        }
 end_no_reply:
@@ -2685,10 +2736,10 @@ end_no_reply:
 /*
  * relay_create_trace_chunk: create a new trace chunk
  */
-static int relay_create_trace_chunk(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_create_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr
+                                   __attribute__((unused)),
+                                   struct relay_connection *conn,
+                                   const struct lttng_buffer_view *payload)
 {
        int ret = 0;
        ssize_t send_ret;
@@ -2729,9 +2780,9 @@ static int relay_create_trace_chunk(
        pthread_mutex_lock(&conn->session->lock);
        session->ongoing_rotation = true;
        if (session->current_trace_chunk &&
-                       !lttng_trace_chunk_get_name_overridden(session->current_trace_chunk)) {
+           !lttng_trace_chunk_get_name_overridden(session->current_trace_chunk)) {
                chunk_status = lttng_trace_chunk_rename_path(session->current_trace_chunk,
-                                       DEFAULT_CHUNK_TMP_OLD_DIRECTORY);
+                                                            DEFAULT_CHUNK_TMP_OLD_DIRECTORY);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ERR("Failed to rename old chunk");
                        ret = -1;
@@ -2748,8 +2799,7 @@ static int relay_create_trace_chunk(
        } else {
                new_path = DEFAULT_CHUNK_TMP_NEW_DIRECTORY;
        }
-       chunk = lttng_trace_chunk_create(
-                       msg->chunk_id, msg->creation_timestamp, new_path);
+       chunk = lttng_trace_chunk_create(msg->chunk_id, msg->creation_timestamp, new_path);
        if (!chunk) {
                ERR("Failed to create trace chunk in trace chunk creation command");
                ret = -1;
@@ -2760,10 +2810,8 @@ static int relay_create_trace_chunk(
 
        if (msg->override_name_length) {
                const char *name;
-               const struct lttng_buffer_view chunk_name_view =
-                               lttng_buffer_view_from_view(payload,
-                                               sizeof(*msg),
-                                               msg->override_name_length);
+               const struct lttng_buffer_view chunk_name_view = lttng_buffer_view_from_view(
+                       payload, sizeof(*msg), msg->override_name_length);
 
                if (!lttng_buffer_view_is_valid(&chunk_name_view)) {
                        ERR("Invalid payload of chunk creation command (protocol error): buffer too short for expected name length");
@@ -2780,8 +2828,7 @@ static int relay_create_trace_chunk(
                        goto end;
                }
 
-               chunk_status = lttng_trace_chunk_override_name(
-                               chunk, chunk_name_view.data);
+               chunk_status = lttng_trace_chunk_override_name(chunk, chunk_name_view.data);
                switch (chunk_status) {
                case LTTNG_TRACE_CHUNK_STATUS_OK:
                        break;
@@ -2806,8 +2853,7 @@ static int relay_create_trace_chunk(
        }
 
        LTTNG_ASSERT(conn->session->output_directory);
-       chunk_status = lttng_trace_chunk_set_as_owner(chunk,
-                       conn->session->output_directory);
+       chunk_status = lttng_trace_chunk_set_as_owner(chunk, conn->session->output_directory);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                reply_code = LTTNG_ERR_UNK;
                ret = -1;
@@ -2815,20 +2861,20 @@ static int relay_create_trace_chunk(
        }
 
        published_chunk = sessiond_trace_chunk_registry_publish_chunk(
-                       sessiond_trace_chunk_registry,
-                       conn->session->sessiond_uuid,
-                       conn->session->id_sessiond.is_set ?
-                               conn->session->id_sessiond.value :
-                               conn->session->id,
-                       chunk);
+               sessiond_trace_chunk_registry,
+               conn->session->sessiond_uuid,
+               conn->session->id_sessiond.is_set ? conn->session->id_sessiond.value :
+                                                   conn->session->id,
+               chunk);
        if (!published_chunk) {
                char uuid_str[LTTNG_UUID_STR_LEN];
 
                lttng_uuid_to_str(conn->session->sessiond_uuid, uuid_str);
-               ERR("Failed to publish chunk: sessiond_uuid = %s, session_id = %" PRIu64 ", chunk_id = %" PRIu64,
-                               uuid_str,
-                               conn->session->id,
-                               msg->chunk_id);
+               ERR("Failed to publish chunk: sessiond_uuid = %s, session_id = %" PRIu64
+                   ", chunk_id = %" PRIu64,
+                   uuid_str,
+                   conn->session->id,
+                   msg->chunk_id);
                ret = -1;
                reply_code = LTTNG_ERR_NOMEM;
                goto end;
@@ -2844,8 +2890,7 @@ static int relay_create_trace_chunk(
                ret = -1;
                goto end;
        }
-       conn->session->pending_closure_trace_chunk =
-                       conn->session->current_trace_chunk;
+       conn->session->pending_closure_trace_chunk = conn->session->current_trace_chunk;
        conn->session->current_trace_chunk = published_chunk;
        published_chunk = NULL;
        if (!conn->session->pending_closure_trace_chunk) {
@@ -2854,13 +2899,10 @@ static int relay_create_trace_chunk(
 end:
        pthread_mutex_unlock(&conn->session->lock);
        reply.ret_code = htobe32((uint32_t) reply_code);
-       send_ret = conn->sock->ops->sendmsg(conn->sock,
-                       &reply,
-                       sizeof(struct lttcomm_relayd_generic_reply),
-                       0);
+       send_ret = conn->sock->ops->sendmsg(
+               conn->sock, &reply, sizeof(struct lttcomm_relayd_generic_reply), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"create trace chunk\" command reply (ret = %zd)",
-                               send_ret);
+               ERR("Failed to send \"create trace chunk\" command reply (ret = %zd)", send_ret);
                ret = -1;
        }
 end_no_reply:
@@ -2872,10 +2914,10 @@ end_no_reply:
 /*
  * relay_close_trace_chunk: close a trace chunk
  */
-static int relay_close_trace_chunk(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_close_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr
+                                  __attribute__((unused)),
+                                  struct relay_connection *conn,
+                                  const struct lttng_buffer_view *payload)
 {
        int ret = 0, buf_ret;
        ssize_t send_ret;
@@ -2923,29 +2965,28 @@ static int relay_close_trace_chunk(
        close_command.value = (lttng_trace_chunk_command_type) be32toh(msg->close_command.value);
        close_command.is_set = msg->close_command.is_set;
 
-       chunk = sessiond_trace_chunk_registry_get_chunk(
-                       sessiond_trace_chunk_registry,
-                       conn->session->sessiond_uuid,
-                       conn->session->id_sessiond.is_set ?
-                               conn->session->id_sessiond.value :
-                               conn->session->id,
-                       chunk_id);
+       chunk = sessiond_trace_chunk_registry_get_chunk(sessiond_trace_chunk_registry,
+                                                       conn->session->sessiond_uuid,
+                                                       conn->session->id_sessiond.is_set ?
+                                                               conn->session->id_sessiond.value :
+                                                               conn->session->id,
+                                                       chunk_id);
        if (!chunk) {
                char uuid_str[LTTNG_UUID_STR_LEN];
 
                lttng_uuid_to_str(conn->session->sessiond_uuid, uuid_str);
-               ERR("Failed to find chunk to close: sessiond_uuid = %s, session_id = %" PRIu64 ", chunk_id = %" PRIu64,
-                               uuid_str,
-                               conn->session->id,
-                               msg->chunk_id);
+               ERR("Failed to find chunk to close: sessiond_uuid = %s, session_id = %" PRIu64
+                   ", chunk_id = %" PRIu64,
+                   uuid_str,
+                   conn->session->id,
+                   msg->chunk_id);
                ret = -1;
                reply_code = LTTNG_ERR_NOMEM;
                goto end;
        }
 
        pthread_mutex_lock(&session->lock);
-       if (close_command.is_set &&
-                       close_command.value == LTTNG_TRACE_CHUNK_COMMAND_TYPE_DELETE) {
+       if (close_command.is_set && close_command.value == LTTNG_TRACE_CHUNK_COMMAND_TYPE_DELETE) {
                /*
                 * Clear command. It is a protocol error to ask for a
                 * clear on a relay which does not allow it. Querying
@@ -2958,20 +2999,19 @@ static int relay_close_trace_chunk(
                        goto end_unlock_session;
                }
        }
-       if (session->pending_closure_trace_chunk &&
-                       session->pending_closure_trace_chunk != chunk) {
+       if (session->pending_closure_trace_chunk && session->pending_closure_trace_chunk != chunk) {
                ERR("Trace chunk close command for session \"%s\" does not target the trace chunk pending closure",
-                               session->session_name);
+                   session->session_name);
                reply_code = LTTNG_ERR_INVALID_PROTOCOL;
                ret = -1;
                goto end_unlock_session;
        }
 
        if (session->current_trace_chunk && session->current_trace_chunk != chunk &&
-                       !lttng_trace_chunk_get_name_overridden(session->current_trace_chunk)) {
+           !lttng_trace_chunk_get_name_overridden(session->current_trace_chunk)) {
                if (close_command.is_set &&
-                               close_command.value == LTTNG_TRACE_CHUNK_COMMAND_TYPE_DELETE &&
-                               !session->has_rotated) {
+                   close_command.value == LTTNG_TRACE_CHUNK_COMMAND_TYPE_DELETE &&
+                   !session->has_rotated) {
                        /* New chunk stays in session output directory. */
                        new_path = "";
                } else {
@@ -2979,8 +3019,8 @@ static int relay_close_trace_chunk(
                        new_path = NULL;
                }
                /* Rename new chunk path. */
-               chunk_status = lttng_trace_chunk_rename_path(session->current_trace_chunk,
-                               new_path);
+               chunk_status =
+                       lttng_trace_chunk_rename_path(session->current_trace_chunk, new_path);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ret = -1;
                        goto end_unlock_session;
@@ -2988,8 +3028,8 @@ static int relay_close_trace_chunk(
                session->ongoing_rotation = false;
        }
        if ((!close_command.is_set ||
-                       close_command.value == LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION) &&
-                       !lttng_trace_chunk_get_name_overridden(chunk)) {
+            close_command.value == LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION) &&
+           !lttng_trace_chunk_get_name_overridden(chunk)) {
                const char *old_path;
 
                if (!session->has_rotated) {
@@ -3004,8 +3044,7 @@ static int relay_close_trace_chunk(
                        goto end_unlock_session;
                }
        }
-       chunk_status = lttng_trace_chunk_set_close_timestamp(
-                       chunk, close_timestamp);
+       chunk_status = lttng_trace_chunk_set_close_timestamp(chunk, close_timestamp);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ERR("Failed to set trace chunk close timestamp");
                ret = -1;
@@ -3014,8 +3053,7 @@ static int relay_close_trace_chunk(
        }
 
        if (close_command.is_set) {
-               chunk_status = lttng_trace_chunk_set_close_command(
-                               chunk, close_command.value);
+               chunk_status = lttng_trace_chunk_set_close_command(chunk, close_command.value);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ret = -1;
                        reply_code = LTTNG_ERR_INVALID;
@@ -3031,12 +3069,12 @@ static int relay_close_trace_chunk(
        }
        if (!session->has_rotated && !session->snapshot) {
                ret = lttng_strncpy(closed_trace_chunk_path,
-                               session->output_path,
-                               sizeof(closed_trace_chunk_path));
+                                   session->output_path,
+                                   sizeof(closed_trace_chunk_path));
                if (ret) {
                        ERR("Failed to send trace chunk path: path length of %zu bytes exceeds the maximal allowed length of %zu bytes",
-                                       strlen(session->output_path),
-                                       sizeof(closed_trace_chunk_path));
+                           strlen(session->output_path),
+                           sizeof(closed_trace_chunk_path));
                        reply_code = LTTNG_ERR_NOMEM;
                        ret = -1;
                        goto end_unlock_session;
@@ -3044,15 +3082,16 @@ static int relay_close_trace_chunk(
        } else {
                if (session->snapshot) {
                        ret = snprintf(closed_trace_chunk_path,
-                                       sizeof(closed_trace_chunk_path),
-                                       "%s/%s", session->output_path,
-                                       chunk_name);
+                                      sizeof(closed_trace_chunk_path),
+                                      "%s/%s",
+                                      session->output_path,
+                                      chunk_name);
                } else {
                        ret = snprintf(closed_trace_chunk_path,
-                                       sizeof(closed_trace_chunk_path),
-                                       "%s/" DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY
-                                       "/%s",
-                                       session->output_path, chunk_name);
+                                      sizeof(closed_trace_chunk_path),
+                                      "%s/" DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY "/%s",
+                                      session->output_path,
+                                      chunk_name);
                }
                if (ret < 0 || ret == sizeof(closed_trace_chunk_path)) {
                        ERR("Failed to format closed trace chunk resulting path");
@@ -3062,7 +3101,7 @@ static int relay_close_trace_chunk(
                }
        }
        if (close_command.is_set &&
-                       close_command.value == LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED) {
+           close_command.value == LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED) {
                session->has_rotated = true;
        }
        DBG("Reply chunk path on close: %s", closed_trace_chunk_path);
@@ -3094,29 +3133,26 @@ end_unlock_session:
 end:
        reply.generic.ret_code = htobe32((uint32_t) reply_code);
        reply.path_length = htobe32((uint32_t) path_length);
-       buf_ret = lttng_dynamic_buffer_append(
-                       &reply_payload, &reply, sizeof(reply));
+       buf_ret = lttng_dynamic_buffer_append(&reply_payload, &reply, sizeof(reply));
        if (buf_ret) {
                ERR("Failed to append \"close trace chunk\" command reply header to payload buffer");
                goto end_no_reply;
        }
 
        if (reply_code == LTTNG_OK) {
-               buf_ret = lttng_dynamic_buffer_append(&reply_payload,
-                               closed_trace_chunk_path, path_length);
+               buf_ret = lttng_dynamic_buffer_append(
+                       &reply_payload, closed_trace_chunk_path, path_length);
                if (buf_ret) {
                        ERR("Failed to append \"close trace chunk\" command reply path to payload buffer");
                        goto end_no_reply;
                }
        }
 
-       send_ret = conn->sock->ops->sendmsg(conn->sock,
-                       reply_payload.data,
-                       reply_payload.size,
-                       0);
+       send_ret = conn->sock->ops->sendmsg(conn->sock, reply_payload.data, reply_payload.size, 0);
        if (send_ret < reply_payload.size) {
                ERR("Failed to send \"close trace chunk\" command reply of %zu bytes (ret = %zd)",
-                               reply_payload.size, send_ret);
+                   reply_payload.size,
+                   send_ret);
                ret = -1;
                goto end_no_reply;
        }
@@ -3129,10 +3165,10 @@ end_no_reply:
 /*
  * relay_trace_chunk_exists: check if a trace chunk exists
  */
-static int relay_trace_chunk_exists(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_trace_chunk_exists(const struct lttcomm_relayd_hdr *recv_hdr
+                                   __attribute__((unused)),
+                                   struct relay_connection *conn,
+                                   const struct lttng_buffer_view *payload)
 {
        int ret = 0;
        ssize_t send_ret;
@@ -3166,24 +3202,23 @@ static int relay_trace_chunk_exists(
        msg = (typeof(msg)) header_view.data;
        chunk_id = be64toh(msg->chunk_id);
 
-       ret = sessiond_trace_chunk_registry_chunk_exists(
-                       sessiond_trace_chunk_registry,
-                       conn->session->sessiond_uuid,
-                       conn->session->id,
-                       chunk_id, &chunk_exists);
+       ret = sessiond_trace_chunk_registry_chunk_exists(sessiond_trace_chunk_registry,
+                                                        conn->session->sessiond_uuid,
+                                                        conn->session->id,
+                                                        chunk_id,
+                                                        &chunk_exists);
        /*
         * If ret is not 0, send the reply and report the error to the caller.
         * It is a protocol (or internal) error and the session/connection
         * should be torn down.
         */
-       reply.generic.ret_code = htobe32((uint32_t) (ret == 0 ? LTTNG_OK : LTTNG_ERR_INVALID_PROTOCOL));
+       reply.generic.ret_code =
+               htobe32((uint32_t) (ret == 0 ? LTTNG_OK : LTTNG_ERR_INVALID_PROTOCOL));
        reply.trace_chunk_exists = ret == 0 ? chunk_exists : 0;
 
-       send_ret = conn->sock->ops->sendmsg(
-                       conn->sock, &reply, sizeof(reply), 0);
+       send_ret = conn->sock->ops->sendmsg(conn->sock, &reply, sizeof(reply), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"create trace chunk\" command reply (ret = %zd)",
-                               send_ret);
+               ERR("Failed to send \"create trace chunk\" command reply (ret = %zd)", send_ret);
                ret = -1;
        }
 end_no_reply:
@@ -3193,10 +3228,10 @@ end_no_reply:
 /*
  * relay_get_configuration: query whether feature is available
  */
-static int relay_get_configuration(
-               const struct lttcomm_relayd_hdr *recv_hdr __attribute__((unused)),
-               struct relay_connection *conn,
-               const struct lttng_buffer_view *payload)
+static int relay_get_configuration(const struct lttcomm_relayd_hdr *recv_hdr
+                                  __attribute__((unused)),
+                                  struct relay_connection *conn,
+                                  const struct lttng_buffer_view *payload)
 {
        int ret = 0;
        ssize_t send_ret;
@@ -3226,14 +3261,13 @@ static int relay_get_configuration(
        }
        ret = 0;
 reply:
-       reply.generic.ret_code = htobe32((uint32_t) (ret == 0 ? LTTNG_OK : LTTNG_ERR_INVALID_PROTOCOL));
+       reply.generic.ret_code =
+               htobe32((uint32_t) (ret == 0 ? LTTNG_OK : LTTNG_ERR_INVALID_PROTOCOL));
        reply.relayd_configuration_flags = htobe64(result_flags);
 
-       send_ret = conn->sock->ops->sendmsg(
-                       conn->sock, &reply, sizeof(reply), 0);
+       send_ret = conn->sock->ops->sendmsg(conn->sock, &reply, sizeof(reply), 0);
        if (send_ret < (ssize_t) sizeof(reply)) {
-               ERR("Failed to send \"get configuration\" command reply (ret = %zd)",
-                               send_ret);
+               ERR("Failed to send \"get configuration\" command reply (ret = %zd)", send_ret);
                ret = -1;
        }
 end_no_reply:
@@ -3241,14 +3275,14 @@ end_no_reply:
 }
 
 static int relay_process_control_command(struct relay_connection *conn,
-               const struct lttcomm_relayd_hdr *header,
-               const struct lttng_buffer_view *payload)
+                                        const struct lttcomm_relayd_hdr *header,
+                                        const struct lttng_buffer_view *payload)
 {
        int ret = 0;
 
        DBG3("Processing \"%s\" command for socket %i",
-                       lttcomm_relayd_command_str((lttcomm_relayd_command) header->cmd),
-                       conn->sock->fd);
+            lttcomm_relayd_command_str((lttcomm_relayd_command) header->cmd),
+            conn->sock->fd);
        switch (header->cmd) {
        case RELAYD_CREATE_SESSION:
                ret = relay_create_session(header, conn, payload);
@@ -3316,15 +3350,14 @@ end:
        return ret;
 }
 
-static enum relay_connection_status relay_process_control_receive_payload(
-               struct relay_connection *conn)
+static enum relay_connection_status
+relay_process_control_receive_payload(struct relay_connection *conn)
 {
        int ret = 0;
        enum relay_connection_status status = RELAY_CONNECTION_STATUS_OK;
-       struct lttng_dynamic_buffer *reception_buffer =
-                       &conn->protocol.ctrl.reception_buffer;
+       struct lttng_dynamic_buffer *reception_buffer = &conn->protocol.ctrl.reception_buffer;
        struct ctrl_connection_state_receive_payload *state =
-                       &conn->protocol.ctrl.state.receive_payload;
+               &conn->protocol.ctrl.state.receive_payload;
        struct lttng_buffer_view payload_view;
 
        if (state->left_to_receive == 0) {
@@ -3333,15 +3366,15 @@ static enum relay_connection_status relay_process_control_receive_payload(
        }
 
        ret = conn->sock->ops->recvmsg(conn->sock,
-                       reception_buffer->data + state->received,
-                       state->left_to_receive, MSG_DONTWAIT);
+                                      reception_buffer->data + state->received,
+                                      state->left_to_receive,
+                                      MSG_DONTWAIT);
        if (ret < 0) {
                DIAGNOSTIC_PUSH
                DIAGNOSTIC_IGNORE_LOGICAL_OP
                if (errno != EAGAIN && errno != EWOULDBLOCK) {
-               DIAGNOSTIC_POP
-                       PERROR("Unable to receive command payload on sock %d",
-                                       conn->sock->fd);
+                       DIAGNOSTIC_POP
+                       PERROR("Unable to receive command payload on sock %d", conn->sock->fd);
                        status = RELAY_CONNECTION_STATUS_ERROR;
                }
                goto end;
@@ -3362,15 +3395,18 @@ static enum relay_connection_status relay_process_control_receive_payload(
                 * Can't transition to the protocol's next state, wait to
                 * receive the rest of the header.
                 */
-               DBG3("Partial reception of control connection protocol payload (received %" PRIu64 " bytes, %" PRIu64 " bytes left to receive, fd = %i)",
-                               state->received, state->left_to_receive,
-                               conn->sock->fd);
+               DBG3("Partial reception of control connection protocol payload (received %" PRIu64
+                    " bytes, %" PRIu64 " bytes left to receive, fd = %i)",
+                    state->received,
+                    state->left_to_receive,
+                    conn->sock->fd);
                goto end;
        }
 
 reception_complete:
        DBG("Done receiving control command payload: fd = %i, payload size = %" PRIu64 " bytes",
-                       conn->sock->fd, state->received);
+           conn->sock->fd,
+           state->received);
        /*
         * The payload required to process the command has been received.
         * A view to the reception buffer is forwarded to the various
@@ -3378,10 +3414,8 @@ reception_complete:
         *
         * Commands are responsible for sending their reply to the peer.
         */
-       payload_view = lttng_buffer_view_from_dynamic_buffer(reception_buffer,
-                       0, -1);
-       ret = relay_process_control_command(conn,
-                       &state->header, &payload_view);
+       payload_view = lttng_buffer_view_from_dynamic_buffer(reception_buffer, 0, -1);
+       ret = relay_process_control_command(conn, &state->header, &payload_view);
        if (ret < 0) {
                status = RELAY_CONNECTION_STATUS_ERROR;
                goto end;
@@ -3395,29 +3429,29 @@ end:
        return status;
 }
 
-static enum relay_connection_status relay_process_control_receive_header(
-               struct relay_connection *conn)
+static enum relay_connection_status
+relay_process_control_receive_header(struct relay_connection *conn)
 {
        int ret = 0;
        enum relay_connection_status status = RELAY_CONNECTION_STATUS_OK;
        struct lttcomm_relayd_hdr header;
-       struct lttng_dynamic_buffer *reception_buffer =
-                       &conn->protocol.ctrl.reception_buffer;
+       struct lttng_dynamic_buffer *reception_buffer = &conn->protocol.ctrl.reception_buffer;
        struct ctrl_connection_state_receive_header *state =
-                       &conn->protocol.ctrl.state.receive_header;
+               &conn->protocol.ctrl.state.receive_header;
 
        LTTNG_ASSERT(state->left_to_receive != 0);
 
        ret = conn->sock->ops->recvmsg(conn->sock,
-                       reception_buffer->data + state->received,
-                       state->left_to_receive, MSG_DONTWAIT);
+                                      reception_buffer->data + state->received,
+                                      state->left_to_receive,
+                                      MSG_DONTWAIT);
        if (ret < 0) {
                DIAGNOSTIC_PUSH
                DIAGNOSTIC_IGNORE_LOGICAL_OP
                if (errno != EAGAIN && errno != EWOULDBLOCK) {
-               DIAGNOSTIC_POP
+                       DIAGNOSTIC_POP
                        PERROR("Unable to receive control command header on sock %d",
-                                       conn->sock->fd);
+                              conn->sock->fd);
                        status = RELAY_CONNECTION_STATUS_ERROR;
                }
                goto end;
@@ -3438,39 +3472,41 @@ static enum relay_connection_status relay_process_control_receive_header(
                 * Can't transition to the protocol's next state, wait to
                 * receive the rest of the header.
                 */
-               DBG3("Partial reception of control connection protocol header (received %" PRIu64 " bytes, %" PRIu64 " bytes left to receive, fd = %i)",
-                               state->received, state->left_to_receive,
-                               conn->sock->fd);
+               DBG3("Partial reception of control connection protocol header (received %" PRIu64
+                    " bytes, %" PRIu64 " bytes left to receive, fd = %i)",
+                    state->received,
+                    state->left_to_receive,
+                    conn->sock->fd);
                goto end;
        }
 
        /* Transition to next state: receiving the command's payload. */
-       conn->protocol.ctrl.state_id =
-                       CTRL_CONNECTION_STATE_RECEIVE_PAYLOAD;
+       conn->protocol.ctrl.state_id = CTRL_CONNECTION_STATE_RECEIVE_PAYLOAD;
        memcpy(&header, reception_buffer->data, sizeof(header));
        header.circuit_id = be64toh(header.circuit_id);
        header.data_size = be64toh(header.data_size);
        header.cmd = be32toh(header.cmd);
        header.cmd_version = be32toh(header.cmd_version);
-       memcpy(&conn->protocol.ctrl.state.receive_payload.header,
-                       &header, sizeof(header));
+       memcpy(&conn->protocol.ctrl.state.receive_payload.header, &header, sizeof(header));
 
-       DBG("Done receiving control command header: fd = %i, cmd = %s, cmd_version = %" PRIu32 ", payload size = %" PRIu64 " bytes",
-                       conn->sock->fd, lttcomm_relayd_command_str((enum lttcomm_relayd_command) header.cmd),
-                       header.cmd_version, header.data_size);
+       DBG("Done receiving control command header: fd = %i, cmd = %s, cmd_version = %" PRIu32
+           ", payload size = %" PRIu64 " bytes",
+           conn->sock->fd,
+           lttcomm_relayd_command_str((enum lttcomm_relayd_command) header.cmd),
+           header.cmd_version,
+           header.data_size);
 
        if (header.data_size > DEFAULT_NETWORK_RELAYD_CTRL_MAX_PAYLOAD_SIZE) {
-               ERR("Command header indicates a payload (%" PRIu64 " bytes) that exceeds the maximal payload size allowed on a control connection.",
-                               header.data_size);
+               ERR("Command header indicates a payload (%" PRIu64
+                   " bytes) that exceeds the maximal payload size allowed on a control connection.",
+                   header.data_size);
                status = RELAY_CONNECTION_STATUS_ERROR;
                goto end;
        }
 
-       conn->protocol.ctrl.state.receive_payload.left_to_receive =
-                       header.data_size;
+       conn->protocol.ctrl.state.receive_payload.left_to_receive = header.data_size;
        conn->protocol.ctrl.state.receive_payload.received = 0;
-       ret = lttng_dynamic_buffer_set_size(reception_buffer,
-                       header.data_size);
+       ret = lttng_dynamic_buffer_set_size(reception_buffer, header.data_size);
        if (ret) {
                status = RELAY_CONNECTION_STATUS_ERROR;
                goto end;
@@ -3490,8 +3526,7 @@ end:
 /*
  * Process the commands received on the control socket
  */
-static enum relay_connection_status relay_process_control(
-               struct relay_connection *conn)
+static enum relay_connection_status relay_process_control(struct relay_connection *conn)
 {
        enum relay_connection_status status;
 
@@ -3510,26 +3545,26 @@ static enum relay_connection_status relay_process_control(
        return status;
 }
 
-static enum relay_connection_status relay_process_data_receive_header(
-               struct relay_connection *conn)
+static enum relay_connection_status relay_process_data_receive_header(struct relay_connection *conn)
 {
        int ret;
        enum relay_connection_status status = RELAY_CONNECTION_STATUS_OK;
        struct data_connection_state_receive_header *state =
-                       &conn->protocol.data.state.receive_header;
+               &conn->protocol.data.state.receive_header;
        struct lttcomm_relayd_data_hdr header;
        struct relay_stream *stream;
 
        LTTNG_ASSERT(state->left_to_receive != 0);
 
        ret = conn->sock->ops->recvmsg(conn->sock,
-                       state->header_reception_buffer + state->received,
-                       state->left_to_receive, MSG_DONTWAIT);
+                                      state->header_reception_buffer + state->received,
+                                      state->left_to_receive,
+                                      MSG_DONTWAIT);
        if (ret < 0) {
                DIAGNOSTIC_PUSH
                DIAGNOSTIC_IGNORE_LOGICAL_OP
                if (errno != EAGAIN && errno != EWOULDBLOCK) {
-               DIAGNOSTIC_POP
+                       DIAGNOSTIC_POP
                        PERROR("Unable to receive data header on sock %d", conn->sock->fd);
                        status = RELAY_CONNECTION_STATUS_ERROR;
                }
@@ -3552,9 +3587,11 @@ static enum relay_connection_status relay_process_data_receive_header(
                 * Can't transition to the protocol's next state, wait to
                 * receive the rest of the header.
                 */
-               DBG3("Partial reception of data connection header (received %" PRIu64 " bytes, %" PRIu64 " bytes left to receive, fd = %i)",
-                               state->received, state->left_to_receive,
-                               conn->sock->fd);
+               DBG3("Partial reception of data connection header (received %" PRIu64
+                    " bytes, %" PRIu64 " bytes left to receive, fd = %i)",
+                    state->received,
+                    state->left_to_receive,
+                    conn->sock->fd);
                goto end;
        }
 
@@ -3569,20 +3606,24 @@ static enum relay_connection_status relay_process_data_receive_header(
        header.padding_size = be32toh(header.padding_size);
        memcpy(&conn->protocol.data.state.receive_payload.header, &header, sizeof(header));
 
-       conn->protocol.data.state.receive_payload.left_to_receive =
-                       header.data_size;
+       conn->protocol.data.state.receive_payload.left_to_receive = header.data_size;
        conn->protocol.data.state.receive_payload.received = 0;
        conn->protocol.data.state.receive_payload.rotate_index = false;
 
-       DBG("Received data connection header on fd %i: circuit_id = %" PRIu64 ", stream_id = %" PRIu64 ", data_size = %" PRIu32 ", net_seq_num = %" PRIu64 ", padding_size = %" PRIu32,
-                       conn->sock->fd, header.circuit_id,
-                       header.stream_id, header.data_size,
-                       header.net_seq_num, header.padding_size);
+       DBG("Received data connection header on fd %i: circuit_id = %" PRIu64
+           ", stream_id = %" PRIu64 ", data_size = %" PRIu32 ", net_seq_num = %" PRIu64
+           ", padding_size = %" PRIu32,
+           conn->sock->fd,
+           header.circuit_id,
+           header.stream_id,
+           header.data_size,
+           header.net_seq_num,
+           header.padding_size);
 
        stream = stream_get_by_id(header.stream_id);
        if (!stream) {
                DBG("relay_process_data_receive_payload: Cannot find stream %" PRIu64,
-                               header.stream_id);
+                   header.stream_id);
                /* Protocol error. */
                status = RELAY_CONNECTION_STATUS_ERROR;
                goto end;
@@ -3590,8 +3631,8 @@ static enum relay_connection_status relay_process_data_receive_header(
 
        pthread_mutex_lock(&stream->lock);
        /* Prepare stream for the reception of a new packet. */
-       ret = stream_init_packet(stream, header.data_size,
-                       &conn->protocol.data.state.receive_payload.rotate_index);
+       ret = stream_init_packet(
+               stream, header.data_size, &conn->protocol.data.state.receive_payload.rotate_index);
        pthread_mutex_unlock(&stream->lock);
        if (ret) {
                ERR("Failed to rotate stream output file");
@@ -3605,14 +3646,14 @@ end:
        return status;
 }
 
-static enum relay_connection_status relay_process_data_receive_payload(
-               struct relay_connection *conn)
+static enum relay_connection_status
+relay_process_data_receive_payload(struct relay_connection *conn)
 {
        int ret;
        enum relay_connection_status status = RELAY_CONNECTION_STATUS_OK;
        struct relay_stream *stream;
        struct data_connection_state_receive_payload *state =
-                       &conn->protocol.data.state.receive_payload;
+               &conn->protocol.data.state.receive_payload;
        const size_t chunk_size = RECV_DATA_BUFFER_SIZE;
        char data_buffer[chunk_size];
        bool partial_recv = false;
@@ -3620,15 +3661,18 @@ static enum relay_connection_status relay_process_data_receive_payload(
        uint64_t left_to_receive = state->left_to_receive;
        struct relay_session *session;
 
-       DBG3("Receiving data for stream id %" PRIu64 " seqnum %" PRIu64 ", %" PRIu64" bytes received, %" PRIu64 " bytes left to receive",
-                       state->header.stream_id, state->header.net_seq_num,
-                       state->received, left_to_receive);
+       DBG3("Receiving data for stream id %" PRIu64 " seqnum %" PRIu64 ", %" PRIu64
+            " bytes received, %" PRIu64 " bytes left to receive",
+            state->header.stream_id,
+            state->header.net_seq_num,
+            state->received,
+            left_to_receive);
 
        stream = stream_get_by_id(state->header.stream_id);
        if (!stream) {
                /* Protocol error. */
                ERR("relay_process_data_receive_payload: cannot find stream %" PRIu64,
-                               state->header.stream_id);
+                   state->header.stream_id);
                status = RELAY_CONNECTION_STATUS_ERROR;
                goto end;
        }
@@ -3653,13 +3697,12 @@ static enum relay_connection_status relay_process_data_receive_payload(
                size_t recv_size = std::min<uint64_t>(left_to_receive, chunk_size);
                struct lttng_buffer_view packet_chunk;
 
-               ret = conn->sock->ops->recvmsg(conn->sock, data_buffer,
-                               recv_size, MSG_DONTWAIT);
+               ret = conn->sock->ops->recvmsg(conn->sock, data_buffer, recv_size, MSG_DONTWAIT);
                if (ret < 0) {
                        DIAGNOSTIC_PUSH
                        DIAGNOSTIC_IGNORE_LOGICAL_OP
                        if (errno != EAGAIN && errno != EWOULDBLOCK) {
-                       DIAGNOSTIC_POP
+                               DIAGNOSTIC_POP
                                PERROR("Socket %d error", conn->sock->fd);
                                status = RELAY_CONNECTION_STATUS_ERROR;
                        }
@@ -3667,7 +3710,7 @@ static enum relay_connection_status relay_process_data_receive_payload(
                } else if (ret == 0) {
                        /* No more data ready to be consumed on socket. */
                        DBG3("No more data ready for consumption on data socket of stream id %" PRIu64,
-                                       state->header.stream_id);
+                            state->header.stream_id);
                        status = RELAY_CONNECTION_STATUS_CLOSED;
                        break;
                } else if (ret < (int) recv_size) {
@@ -3679,8 +3722,7 @@ static enum relay_connection_status relay_process_data_receive_payload(
                        recv_size = ret;
                }
 
-               packet_chunk = lttng_buffer_view_init(data_buffer,
-                               0, recv_size);
+               packet_chunk = lttng_buffer_view_init(data_buffer, 0, recv_size);
                LTTNG_ASSERT(packet_chunk.data);
 
                ret = stream_write(stream, &packet_chunk, 0);
@@ -3700,9 +3742,11 @@ static enum relay_connection_status relay_process_data_receive_payload(
                 * Did not receive all the data expected, wait for more data to
                 * become available on the socket.
                 */
-               DBG3("Partial receive on data connection of stream id %" PRIu64 ", %" PRIu64 " bytes received, %" PRIu64 " bytes left to receive",
-                               state->header.stream_id, state->received,
-                               state->left_to_receive);
+               DBG3("Partial receive on data connection of stream id %" PRIu64 ", %" PRIu64
+                    " bytes received, %" PRIu64 " bytes left to receive",
+                    state->header.stream_id,
+                    state->received,
+                    state->left_to_receive);
                goto end_stream_unlock;
        }
 
@@ -3713,13 +3757,17 @@ static enum relay_connection_status relay_process_data_receive_payload(
        }
 
        if (session_streams_have_index(session)) {
-               ret = stream_update_index(stream, state->header.net_seq_num,
-                               state->rotate_index, &index_flushed,
-                               state->header.data_size + state->header.padding_size);
+               ret = stream_update_index(stream,
+                                         state->header.net_seq_num,
+                                         state->rotate_index,
+                                         &index_flushed,
+                                         state->header.data_size + state->header.padding_size);
                if (ret < 0) {
-                       ERR("Failed to update index: stream %" PRIu64 " net_seq_num %" PRIu64 " ret %d",
-                                       stream->stream_handle,
-                                       state->header.net_seq_num, ret);
+                       ERR("Failed to update index: stream %" PRIu64 " net_seq_num %" PRIu64
+                           " ret %d",
+                           stream->stream_handle,
+                           state->header.net_seq_num,
+                           ret);
                        status = RELAY_CONNECTION_STATUS_ERROR;
                        goto end_stream_unlock;
                }
@@ -3729,9 +3777,10 @@ static enum relay_connection_status relay_process_data_receive_payload(
                new_stream = true;
        }
 
-       ret = stream_complete_packet(stream, state->header.data_size +
-                       state->header.padding_size, state->header.net_seq_num,
-                       index_flushed);
+       ret = stream_complete_packet(stream,
+                                    state->header.data_size + state->header.padding_size,
+                                    state->header.net_seq_num,
+                                    index_flushed);
        if (ret) {
                status = RELAY_CONNECTION_STATUS_ERROR;
                goto end_stream_unlock;
@@ -3766,8 +3815,7 @@ end:
 /*
  * relay_process_data: Process the data received on the data socket
  */
-static enum relay_connection_status relay_process_data(
-               struct relay_connection *conn)
+static enum relay_connection_status relay_process_data(struct relay_connection *conn)
 {
        enum relay_connection_status status;
 
@@ -3792,15 +3840,16 @@ static void cleanup_connection_pollfd(struct lttng_poll_event *events, int pollf
 
        (void) lttng_poll_del(events, pollfd);
 
-       ret = fd_tracker_close_unsuspendable_fd(the_fd_tracker, &pollfd, 1,
-                       fd_tracker_util_close_fd, NULL);
+       ret = fd_tracker_close_unsuspendable_fd(
+               the_fd_tracker, &pollfd, 1, fd_tracker_util_close_fd, NULL);
        if (ret < 0) {
                ERR("Closing pollfd %d", pollfd);
        }
 }
 
 static void relay_thread_close_connection(struct lttng_poll_event *events,
-               int pollfd, struct relay_connection *conn)
+                                         int pollfd,
+                                         struct relay_connection *conn)
 {
        const char *type_str;
 
@@ -3916,9 +3965,8 @@ restart:
                                        if (ret < 0) {
                                                goto error;
                                        }
-                                       ret = lttng_poll_add(&events,
-                                                       conn->sock->fd,
-                                                       LPOLLIN | LPOLLRDHUP);
+                                       ret = lttng_poll_add(
+                                               &events, conn->sock->fd, LPOLLIN | LPOLLRDHUP);
                                        if (ret) {
                                                ERR("Failed to add new connection file descriptor to poll set");
                                                goto error;
@@ -3929,7 +3977,9 @@ restart:
                                        ERR("Relay connection pipe error");
                                        goto error;
                                } else {
-                                       ERR("Unexpected poll events %u for sock %d", revents, pollfd);
+                                       ERR("Unexpected poll events %u for sock %d",
+                                           revents,
+                                           pollfd);
                                        goto error;
                                }
                        } else {
@@ -3942,9 +3992,9 @@ restart:
                                if (ctrl_conn->type == RELAY_DATA) {
                                        if (revents & LPOLLIN) {
                                                /*
-                                                * Flag the last seen data fd not deleted. It will be
-                                                * used as the last seen fd if any fd gets deleted in
-                                                * this first loop.
+                                                * Flag the last seen data fd not deleted. It will
+                                                * be used as the last seen fd if any fd gets
+                                                * deleted in this first loop.
                                                 */
                                                last_notdel_data_fd = pollfd;
                                        }
@@ -3958,40 +4008,39 @@ restart:
                                        status = relay_process_control(ctrl_conn);
                                        if (status != RELAY_CONNECTION_STATUS_OK) {
                                                /*
-                                                * On socket error flag the session as aborted to force
-                                                * the cleanup of its stream otherwise it can leak
-                                                * during the lifetime of the relayd.
+                                                * On socket error flag the session as aborted to
+                                                * force the cleanup of its stream otherwise it can
+                                                * leak during the lifetime of the relayd.
                                                 *
                                                 * This prevents situations in which streams can be
                                                 * left opened because an index was received, the
                                                 * control connection is closed, and the data
-                                                * connection is closed (uncleanly) before the packet's
-                                                * data provided.
+                                                * connection is closed (uncleanly) before the
+                                                * packet's data provided.
                                                 *
-                                                * Since the control connection encountered an error,
-                                                * it is okay to be conservative and close the
-                                                * session right now as we can't rely on the protocol
-                                                * being respected anymore.
+                                                * Since the control connection encountered an
+                                                * error, it is okay to be conservative and close
+                                                * the session right now as we can't rely on the
+                                                * protocol being respected anymore.
                                                 */
                                                if (status == RELAY_CONNECTION_STATUS_ERROR) {
                                                        session_abort(ctrl_conn->session);
                                                }
 
                                                /* Clear the connection on error or close. */
-                                               relay_thread_close_connection(&events,
-                                                               pollfd,
-                                                               ctrl_conn);
+                                               relay_thread_close_connection(
+                                                       &events, pollfd, ctrl_conn);
                                        }
                                        seen_control = 1;
                                } else if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) {
-                                       relay_thread_close_connection(&events,
-                                                       pollfd, ctrl_conn);
+                                       relay_thread_close_connection(&events, pollfd, ctrl_conn);
                                        if (last_seen_data_fd == pollfd) {
                                                last_seen_data_fd = last_notdel_data_fd;
                                        }
                                } else {
                                        ERR("Unexpected poll events %u for control sock %d",
-                                                       revents, pollfd);
+                                           revents,
+                                           pollfd);
                                        connection_put(ctrl_conn);
                                        goto error;
                                }
@@ -4075,8 +4124,7 @@ restart:
                                        if (status == RELAY_CONNECTION_STATUS_ERROR) {
                                                session_abort(data_conn->session);
                                        }
-                                       relay_thread_close_connection(&events, pollfd,
-                                                       data_conn);
+                                       relay_thread_close_connection(&events, pollfd, data_conn);
                                        /*
                                         * Every goto restart call sets the last seen fd where
                                         * here we don't really care since we gracefully
@@ -4089,11 +4137,9 @@ restart:
                                        goto restart;
                                }
                        } else if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) {
-                               relay_thread_close_connection(&events, pollfd,
-                                               data_conn);
+                               relay_thread_close_connection(&events, pollfd, data_conn);
                        } else {
-                               ERR("Unknown poll events %u for data sock %d",
-                                               revents, pollfd);
+                               ERR("Unknown poll events %u for data sock %d", revents, pollfd);
                        }
                put_data_connection:
                        connection_put(data_conn);
@@ -4108,9 +4154,7 @@ exit:
 error:
        /* Cleanup remaining connection object. */
        rcu_read_lock();
-       cds_lfht_for_each_entry(relay_connections_ht->ht, &iter.iter,
-                       destroy_conn,
-                       sock_n.node) {
+       cds_lfht_for_each_entry (relay_connections_ht->ht, &iter.iter, destroy_conn, sock_n.node) {
                health_code_update();
 
                session_abort(destroy_conn->session);
@@ -4119,8 +4163,7 @@ error:
                 * No need to grab another ref, because we own
                 * destroy_conn.
                 */
-               relay_thread_close_connection(&events, destroy_conn->sock->fd,
-                               destroy_conn);
+               relay_thread_close_connection(&events, destroy_conn->sock->fd, destroy_conn);
        }
        rcu_read_unlock();
 
@@ -4129,8 +4172,7 @@ error_poll_create:
        lttng_ht_destroy(relay_connections_ht);
 relay_connections_ht_error:
        /* Close relay conn pipes */
-       (void) fd_tracker_util_pipe_close(the_fd_tracker,
-                       relay_conn_pipe);
+       (void) fd_tracker_util_pipe_close(the_fd_tracker, relay_conn_pipe);
        if (err) {
                DBG("Thread exited with error");
        }
@@ -4152,8 +4194,8 @@ error_testpoint:
  */
 static int create_relay_conn_pipe(void)
 {
-       return fd_tracker_util_pipe_open_cloexec(the_fd_tracker,
-                       "Relayd connection pipe", relay_conn_pipe);
+       return fd_tracker_util_pipe_open_cloexec(
+               the_fd_tracker, "Relayd connection pipe", relay_conn_pipe);
 }
 
 static int stdio_open(void *data __attribute__((unused)), int *fds)
@@ -4168,8 +4210,7 @@ static int track_stdio(void)
        int fds[2];
        const char *names[] = { "stdout", "stderr" };
 
-       return fd_tracker_open_unsuspendable_fd(the_fd_tracker, fds,
-                       names, 2, stdio_open, NULL);
+       return fd_tracker_open_unsuspendable_fd(the_fd_tracker, fds, names, 2, stdio_open, NULL);
 }
 
 /*
@@ -4228,8 +4269,7 @@ int main(int argc, char **argv)
                        goto exit_options;
                }
 
-               ret = utils_mkdir_recursive(opt_output_path, S_IRWXU | S_IRWXG,
-                               -1, -1);
+               ret = utils_mkdir_recursive(opt_output_path, S_IRWXU | S_IRWXG, -1, -1);
                if (ret < 0) {
                        ERR("Unable to create %s", opt_output_path);
                        retval = -1;
@@ -4239,8 +4279,7 @@ int main(int argc, char **argv)
 
        /* Daemonize */
        if (opt_daemon || opt_background) {
-               ret = lttng_daemonize(&child_ppid, &recv_child_signal,
-                       !opt_background);
+               ret = lttng_daemonize(&child_ppid, &recv_child_signal, !opt_background);
                if (ret < 0) {
                        retval = -1;
                        goto exit_options;
@@ -4277,16 +4316,17 @@ int main(int argc, char **argv)
                retval = -1;
                goto exit_options;
        }
-       ret = asprintf(&unlinked_file_directory_path, "%s/%s", output_path,
-                       DEFAULT_UNLINKED_FILES_DIRECTORY);
+       ret = asprintf(&unlinked_file_directory_path,
+                      "%s/%s",
+                      output_path,
+                      DEFAULT_UNLINKED_FILES_DIRECTORY);
        free(output_path);
        if (ret < 0) {
                ERR("Failed to format unlinked file directory path");
                retval = -1;
                goto exit_options;
        }
-       the_fd_tracker = fd_tracker_create(
-                       unlinked_file_directory_path, lttng_opt_fd_pool_size);
+       the_fd_tracker = fd_tracker_create(unlinked_file_directory_path, lttng_opt_fd_pool_size);
        free(unlinked_file_directory_path);
        if (!the_fd_tracker) {
                retval = -1;
@@ -4354,8 +4394,8 @@ int main(int argc, char **argv)
        }
 
        /* Create thread to manage the client socket */
-       ret = pthread_create(&health_thread, default_pthread_attr(),
-                       thread_manage_health_relayd, (void *) NULL);
+       ret = pthread_create(
+               &health_thread, default_pthread_attr(), thread_manage_health_relayd, (void *) NULL);
        if (ret) {
                errno = ret;
                PERROR("pthread_create health");
@@ -4364,8 +4404,8 @@ int main(int argc, char **argv)
        }
 
        /* Setup the dispatcher thread */
-       ret = pthread_create(&dispatcher_thread, default_pthread_attr(),
-                       relay_thread_dispatcher, (void *) NULL);
+       ret = pthread_create(
+               &dispatcher_thread, default_pthread_attr(), relay_thread_dispatcher, (void *) NULL);
        if (ret) {
                errno = ret;
                PERROR("pthread_create dispatcher");
@@ -4374,8 +4414,7 @@ int main(int argc, char **argv)
        }
 
        /* Setup the worker thread */
-       ret = pthread_create(&worker_thread, default_pthread_attr(),
-                       relay_thread_worker, NULL);
+       ret = pthread_create(&worker_thread, default_pthread_attr(), relay_thread_worker, NULL);
        if (ret) {
                errno = ret;
                PERROR("pthread_create worker");
@@ -4384,8 +4423,8 @@ int main(int argc, char **argv)
        }
 
        /* Setup the listener thread */
-       ret = pthread_create(&listener_thread, default_pthread_attr(),
-                       relay_thread_listener, (void *) NULL);
+       ret = pthread_create(
+               &listener_thread, default_pthread_attr(), relay_thread_listener, (void *) NULL);
        if (ret) {
                errno = ret;
                PERROR("pthread_create listener");
index 6e29fbc741afd1efe32723f7342f8cc809fa9a3c..677769ace1c8fd3b38709dbd4d6a084a1cf1d470 100644 (file)
@@ -8,23 +8,23 @@
  */
 
 #define _LGPL_SOURCE
+#include "ctf-trace.hpp"
+#include "lttng-relayd.hpp"
+#include "session.hpp"
+#include "sessiond-trace-chunks.hpp"
+#include "stream.hpp"
+#include "utils.hpp"
+
 #include <common/common.hpp>
 #include <common/compat/path.hpp>
+#include <common/defaults.hpp>
 #include <common/fd-tracker/utils.hpp>
 #include <common/time.hpp>
 #include <common/utils.hpp>
 #include <common/uuid.hpp>
-#include <urcu/rculist.h>
 
 #include <sys/stat.h>
-
-#include "ctf-trace.hpp"
-#include "lttng-relayd.hpp"
-#include "session.hpp"
-#include "sessiond-trace-chunks.hpp"
-#include "stream.hpp"
-#include <common/defaults.hpp>
-#include "utils.hpp"
+#include <urcu/rculist.h>
 
 /* Global session id used in the session creation. */
 static uint64_t last_relay_session_id;
@@ -58,27 +58,27 @@ static int init_session_output_path_group_by_host(struct relay_session *session)
         * Otherwise, generate the path with session_name-<timestamp>.
         */
        if (session->base_path[0] != '\0') {
-               ret = asprintf(&session_directory, "%s/%s", session->hostname,
-                               session->base_path);
+               ret = asprintf(&session_directory, "%s/%s", session->hostname, session->base_path);
        } else if (session->session_name_contains_creation_time) {
-               ret = asprintf(&session_directory, "%s/%s", session->hostname,
-                               session->session_name);
+               ret = asprintf(
+                       &session_directory, "%s/%s", session->hostname, session->session_name);
        } else {
                char session_creation_datetime[DATETIME_STR_LEN];
 
-               ret = time_to_datetime_str(
-                               LTTNG_OPTIONAL_GET(session->creation_time),
-                               session_creation_datetime,
-                               sizeof(session_creation_datetime));
+               ret = time_to_datetime_str(LTTNG_OPTIONAL_GET(session->creation_time),
+                                          session_creation_datetime,
+                                          sizeof(session_creation_datetime));
                if (ret) {
                        ERR("Failed to format session creation timestamp while initializing session output directory handle");
                        ret = -1;
                        goto end;
                }
 
-               ret = asprintf(&session_directory, "%s/%s-%s",
-                               session->hostname, session->session_name,
-                               session_creation_datetime);
+               ret = asprintf(&session_directory,
+                              "%s/%s-%s",
+                              session->hostname,
+                              session->session_name,
+                              session_creation_datetime);
        }
        if (ret < 0) {
                PERROR("Failed to format session directory name");
@@ -98,8 +98,7 @@ end:
        return ret;
 }
 
-static int init_session_output_path_group_by_session(
-               struct relay_session *session)
+static int init_session_output_path_group_by_session(struct relay_session *session)
 {
        /*
         * session_directory:
@@ -120,18 +119,21 @@ static int init_session_output_path_group_by_session(
        }
 
        ret = time_to_datetime_str(LTTNG_OPTIONAL_GET(session->creation_time),
-                       creation_datetime, sizeof(creation_datetime));
+                                  creation_datetime,
+                                  sizeof(creation_datetime));
        if (ret) {
                ERR("Failed to format session creation timestamp while initializing session output directory handle");
                ret = -1;
                goto end;
        }
 
-       ret = asprintf(&session_directory, "%s/%s-%s%s%s",
-                       session->session_name, session->hostname,
-                       creation_datetime,
-                       session->base_path[0] != '\0' ? "/" : "",
-                       session->base_path);
+       ret = asprintf(&session_directory,
+                      "%s/%s-%s%s%s",
+                      session->session_name,
+                      session->hostname,
+                      creation_datetime,
+                      session->base_path[0] != '\0' ? "/" : "",
+                      session->base_path);
        if (ret < 0) {
                PERROR("Failed to format session directory name");
                goto end;
@@ -171,8 +173,8 @@ static int init_session_output_path(struct relay_session *session)
        return ret;
 }
 
-static struct lttng_directory_handle *session_create_output_directory_handle(
-               struct relay_session *session)
+static struct lttng_directory_handle *
+session_create_output_directory_handle(struct relay_session *session)
 {
        int ret;
        /*
@@ -188,11 +190,9 @@ static struct lttng_directory_handle *session_create_output_directory_handle(
                goto end;
        }
 
-       ret = utils_mkdir_recursive(
-                       full_session_path, S_IRWXU | S_IRWXG, -1, -1);
+       ret = utils_mkdir_recursive(full_session_path, S_IRWXU | S_IRWXG, -1, -1);
        if (ret) {
-               ERR("Failed to create session output path \"%s\"",
-                               full_session_path);
+               ERR("Failed to create session output path \"%s\"", full_session_path);
                goto end;
        }
 
@@ -260,12 +260,14 @@ static bool is_name_path_safe(const char *name)
        }
        /* Does not start with '.'. */
        if (name[0] == '.') {
-               WARN("Name \"%s\" is not allowed to be used in a path since it starts with '.'", name);
+               WARN("Name \"%s\" is not allowed to be used in a path since it starts with '.'",
+                    name);
                return false;
        }
        /* Does not contain a path-separator. */
        if (strchr(name, LTTNG_PATH_SEPARATOR)) {
-               WARN("Name \"%s\" is not allowed to be used in a path since it contains a path separator", name);
+               WARN("Name \"%s\" is not allowed to be used in a path since it contains a path separator",
+                    name);
                return false;
        }
 
@@ -278,16 +280,17 @@ static bool is_name_path_safe(const char *name)
  * Return allocated session or else NULL.
  */
 struct relay_session *session_create(const char *session_name,
-               const char *hostname, const char *base_path,
-               uint32_t live_timer,
-               bool snapshot,
-               const lttng_uuid& sessiond_uuid,
-               const uint64_t *id_sessiond,
-               const uint64_t *current_chunk_id,
-               const time_t *creation_time,
-               uint32_t major,
-               uint32_t minor,
-               bool session_name_contains_creation_time)
+                                    const char *hostname,
+                                    const char *base_path,
+                                    uint32_t live_timer,
+                                    bool snapshot,
+                                    const lttng_uuid& sessiond_uuid,
+                                    const uint64_t *id_sessiond,
+                                    const uint64_t *current_chunk_id,
+                                    const time_t *creation_time,
+                                    uint32_t major,
+                                    uint32_t minor,
+                                    bool session_name_contains_creation_time)
 {
        int ret;
        struct relay_session *session = NULL;
@@ -305,8 +308,7 @@ struct relay_session *session_create(const char *session_name,
                goto error;
        }
        if (strstr(base_path, "../")) {
-               ERR("Invalid session base path walks up the path hierarchy: \"%s\"",
-                               base_path);
+               ERR("Invalid session base path walks up the path hierarchy: \"%s\"", base_path);
                goto error;
        }
 
@@ -326,18 +328,15 @@ struct relay_session *session_create(const char *session_name,
        pthread_mutex_init(&session->lock, NULL);
        pthread_mutex_init(&session->recv_list_lock, NULL);
 
-       if (lttng_strncpy(session->session_name, session_name,
-                       sizeof(session->session_name))) {
+       if (lttng_strncpy(session->session_name, session_name, sizeof(session->session_name))) {
                WARN("Session name exceeds maximal allowed length");
                goto error;
        }
-       if (lttng_strncpy(session->hostname, hostname,
-                       sizeof(session->hostname))) {
+       if (lttng_strncpy(session->hostname, hostname, sizeof(session->hostname))) {
                WARN("Hostname exceeds maximal allowed length");
                goto error;
        }
-       if (lttng_strncpy(session->base_path, base_path,
-                       sizeof(session->base_path))) {
+       if (lttng_strncpy(session->base_path, base_path, sizeof(session->base_path))) {
                WARN("Base path exceeds maximal allowed length");
                goto error;
        }
@@ -350,8 +349,7 @@ struct relay_session *session_create(const char *session_name,
                        goto error;
                }
        }
-       session->session_name_contains_creation_time =
-                       session_name_contains_creation_time;
+       session->session_name_contains_creation_time = session_name_contains_creation_time;
 
        session->ctf_traces_ht = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
        if (!session->ctf_traces_ht) {
@@ -377,8 +375,8 @@ struct relay_session *session_create(const char *session_name,
                }
        }
 
-       ret = sessiond_trace_chunk_registry_session_created(
-                       sessiond_trace_chunk_registry, sessiond_uuid);
+       ret = sessiond_trace_chunk_registry_session_created(sessiond_trace_chunk_registry,
+                                                           sessiond_uuid);
        if (ret) {
                goto error;
        }
@@ -388,24 +386,24 @@ struct relay_session *session_create(const char *session_name,
                struct lttng_directory_handle *session_output_directory;
 
                session->current_trace_chunk =
-                               sessiond_trace_chunk_registry_get_chunk(
-                                       sessiond_trace_chunk_registry,
-                                       session->sessiond_uuid,
-                                       session->id_sessiond.value,
-                                       *current_chunk_id);
+                       sessiond_trace_chunk_registry_get_chunk(sessiond_trace_chunk_registry,
+                                                               session->sessiond_uuid,
+                                                               session->id_sessiond.value,
+                                                               *current_chunk_id);
                if (!session->current_trace_chunk) {
                        char uuid_str[LTTNG_UUID_STR_LEN];
 
                        lttng_uuid_to_str(sessiond_uuid, uuid_str);
-                       ERR("Could not find trace chunk: sessiond = {%s}, sessiond session id = %" PRIu64 ", trace chunk id = %" PRIu64,
-                                       uuid_str, *id_sessiond,
-                                       *current_chunk_id);
+                       ERR("Could not find trace chunk: sessiond = {%s}, sessiond session id = %" PRIu64
+                           ", trace chunk id = %" PRIu64,
+                           uuid_str,
+                           *id_sessiond,
+                           *current_chunk_id);
                        goto error;
                }
 
                chunk_status = lttng_trace_chunk_get_session_output_directory_handle(
-                               session->current_trace_chunk,
-                               &session_output_directory);
+                       session->current_trace_chunk, &session_output_directory);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        goto error;
                }
@@ -423,8 +421,7 @@ struct relay_session *session_create(const char *session_name,
                        goto error;
                }
        } else {
-               session->output_directory =
-                               session_create_output_directory_handle(session);
+               session->output_directory = session_create_output_directory_handle(session);
                if (!session->output_directory) {
                        goto error;
                }
@@ -506,8 +503,7 @@ bool session_has_ongoing_rotation(const struct relay_session *session)
         * Sample the 'ongoing_rotation' status of all relay sessions that
         * originate from the same session daemon session.
         */
-       cds_lfht_for_each_entry(sessions_ht->ht, &iter.iter, iterated_session,
-                       session_n.node) {
+       cds_lfht_for_each_entry (sessions_ht->ht, &iter.iter, iterated_session, session_n.node) {
                if (!session_get(iterated_session)) {
                        continue;
                }
@@ -533,7 +529,7 @@ bool session_has_ongoing_rotation(const struct relay_session *session)
                }
 
                if (LTTNG_OPTIONAL_GET(session->id_sessiond) !=
-                               LTTNG_OPTIONAL_GET(iterated_session->id_sessiond)) {
+                   LTTNG_OPTIONAL_GET(iterated_session->id_sessiond)) {
                        /*
                         * Sessions do not originate from the same sessiond
                         * session.
@@ -543,9 +539,9 @@ bool session_has_ongoing_rotation(const struct relay_session *session)
 
                ongoing_rotation = iterated_session->ongoing_rotation;
 
-next_session:
+       next_session:
                pthread_mutex_unlock(&iterated_session->lock);
-next_session_no_unlock:
+       next_session_no_unlock:
                session_put(iterated_session);
 
                if (ongoing_rotation) {
@@ -560,9 +556,7 @@ end:
 
 static void rcu_destroy_session(struct rcu_head *rcu_head)
 {
-       struct relay_session *session =
-                       caa_container_of(rcu_head, struct relay_session,
-                               rcu_node);
+       struct relay_session *session = caa_container_of(rcu_head, struct relay_session, rcu_node);
        /*
         * Since each trace has a reference on the session, it means
         * that if we are at the point where we teardown the session, no
@@ -587,7 +581,6 @@ static int session_delete(struct relay_session *session)
        return lttng_ht_del(sessions_ht, &iter);
 }
 
-
 static void destroy_session(struct relay_session *session)
 {
        int ret;
@@ -598,8 +591,8 @@ static void destroy_session(struct relay_session *session)
        session->current_trace_chunk = NULL;
        lttng_trace_chunk_put(session->pending_closure_trace_chunk);
        session->pending_closure_trace_chunk = NULL;
-       ret = sessiond_trace_chunk_registry_session_destroyed(
-                       sessiond_trace_chunk_registry, session->sessiond_uuid);
+       ret = sessiond_trace_chunk_registry_session_destroyed(sessiond_trace_chunk_registry,
+                                                             session->sessiond_uuid);
        LTTNG_ASSERT(!ret);
        lttng_directory_handle_put(session->output_directory);
        session->output_directory = NULL;
@@ -608,8 +601,7 @@ static void destroy_session(struct relay_session *session)
 
 static void session_release(struct urcu_ref *ref)
 {
-       struct relay_session *session =
-                       lttng::utils::container_of(ref, &relay_session::ref);
+       struct relay_session *session = lttng::utils::container_of(ref, &relay_session::ref);
 
        destroy_session(session);
 }
@@ -633,20 +625,20 @@ int session_close(struct relay_session *session)
 
        pthread_mutex_lock(&session->lock);
        DBG("closing session %" PRIu64 ": is conn already closed %d",
-                       session->id, session->connection_closed);
+           session->id,
+           session->connection_closed);
        session->connection_closed = true;
        pthread_mutex_unlock(&session->lock);
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(session->ctf_traces_ht->ht,
-                       &iter.iter, trace, node.node) {
+       cds_lfht_for_each_entry (session->ctf_traces_ht->ht, &iter.iter, trace, node.node) {
                ret = ctf_trace_close(trace);
                if (ret) {
                        goto rcu_unlock;
                }
        }
-       cds_list_for_each_entry_rcu(stream, &session->recv_list,
-                       recv_node) {
+       cds_list_for_each_entry_rcu(stream, &session->recv_list, recv_node)
+       {
                /* Close streams which have not been published yet. */
                try_stream_close(stream);
        }
@@ -685,15 +677,14 @@ void print_sessions(void)
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(sessions_ht->ht, &iter.iter, session,
-                       session_n.node) {
+       cds_lfht_for_each_entry (sessions_ht->ht, &iter.iter, session, session_n.node) {
                if (!session_get(session)) {
                        continue;
                }
                DBG("session %p refcount %ld session %" PRIu64,
-                       session,
-                       session->ref.refcount,
-                       session->id);
+                   session,
+                   session->ref.refcount,
+                   session->id);
                session_put(session);
        }
        rcu_read_unlock();
index eba9a1989ab07fd2cf21c5865e089d6ca72099db..7201daed1ef74bb27c9c3d7b51464c659dc2e217 100644 (file)
@@ -6,18 +6,20 @@
  */
 
 #include "sessiond-trace-chunks.hpp"
-#include <urcu.h>
-#include <urcu/rculfhash.h>
-#include <urcu/ref.h>
-#include <common/macros.hpp>
-#include <common/hashtable/hashtable.hpp>
-#include <common/hashtable/utils.hpp>
-#include <common/trace-chunk-registry.hpp>
+
 #include <common/defaults.hpp>
 #include <common/error.hpp>
+#include <common/hashtable/hashtable.hpp>
+#include <common/hashtable/utils.hpp>
+#include <common/macros.hpp>
 #include <common/string-utils/format.hpp>
-#include <stdio.h>
+#include <common/trace-chunk-registry.hpp>
+
 #include <inttypes.h>
+#include <stdio.h>
+#include <urcu.h>
+#include <urcu/rculfhash.h>
+#include <urcu/ref.h>
 
 /*
  * Lifetime of trace chunks within the relay daemon.
@@ -73,55 +75,45 @@ struct trace_chunk_registry_ht_element {
 };
 } /* namespace */
 
-static
-unsigned long trace_chunk_registry_ht_key_hash(
-               const struct trace_chunk_registry_ht_key *key)
+static unsigned long trace_chunk_registry_ht_key_hash(const struct trace_chunk_registry_ht_key *key)
 {
        const uint64_t uuid_h1 = *reinterpret_cast<const uint64_t *>(&key->sessiond_uuid[0]);
        const uint64_t uuid_h2 = *reinterpret_cast<const uint64_t *>(&key->sessiond_uuid[1]);
 
-       return hash_key_u64(&uuid_h1, lttng_ht_seed) ^
-                       hash_key_u64(&uuid_h2, lttng_ht_seed);
+       return hash_key_u64(&uuid_h1, lttng_ht_seed) ^ hash_key_u64(&uuid_h2, lttng_ht_seed);
 }
 
 /* cds_lfht match function */
-static
-int trace_chunk_registry_ht_key_match(struct cds_lfht_node *node,
-               const void *_key)
+static int trace_chunk_registry_ht_key_match(struct cds_lfht_node *node, const void *_key)
 {
-       const struct trace_chunk_registry_ht_key *key =
-                       (struct trace_chunk_registry_ht_key *) _key;
+       const struct trace_chunk_registry_ht_key *key = (struct trace_chunk_registry_ht_key *) _key;
        struct trace_chunk_registry_ht_element *registry;
 
        registry = lttng::utils::container_of(node, &trace_chunk_registry_ht_element::ht_node);
        return key->sessiond_uuid == registry->key.sessiond_uuid;
 }
 
-static
-void trace_chunk_registry_ht_element_free(struct rcu_head *node)
+static void trace_chunk_registry_ht_element_free(struct rcu_head *node)
 {
-       struct trace_chunk_registry_ht_element *element = lttng::utils::container_of(
-                       node, &trace_chunk_registry_ht_element::rcu_node);
+       struct trace_chunk_registry_ht_element *element =
+               lttng::utils::container_of(node, &trace_chunk_registry_ht_element::rcu_node);
 
        free(element);
 }
 
-static
-void trace_chunk_registry_ht_element_release(struct urcu_ref *ref)
+static void trace_chunk_registry_ht_element_release(struct urcu_ref *ref)
 {
        struct trace_chunk_registry_ht_element *element =
-                       lttng::utils::container_of(ref, &trace_chunk_registry_ht_element::ref);
+               lttng::utils::container_of(ref, &trace_chunk_registry_ht_element::ref);
        char uuid_str[LTTNG_UUID_STR_LEN];
 
        lttng_uuid_to_str(element->key.sessiond_uuid, uuid_str);
 
-       DBG("Destroying trace chunk registry associated to sessiond {%s}",
-                       uuid_str);
+       DBG("Destroying trace chunk registry associated to sessiond {%s}", uuid_str);
        if (element->sessiond_trace_chunk_registry) {
                /* Unpublish. */
                rcu_read_lock();
-               cds_lfht_del(element->sessiond_trace_chunk_registry->ht,
-                               &element->ht_node);
+               cds_lfht_del(element->sessiond_trace_chunk_registry->ht, &element->ht_node);
                rcu_read_unlock();
                element->sessiond_trace_chunk_registry = NULL;
        }
@@ -131,16 +123,12 @@ void trace_chunk_registry_ht_element_release(struct urcu_ref *ref)
        call_rcu(&element->rcu_node, trace_chunk_registry_ht_element_free);
 }
 
-static
-bool trace_chunk_registry_ht_element_get(
-               struct trace_chunk_registry_ht_element *element)
+static bool trace_chunk_registry_ht_element_get(struct trace_chunk_registry_ht_element *element)
 {
        return urcu_ref_get_unless_zero(&element->ref);
 }
 
-static
-void trace_chunk_registry_ht_element_put(
-               struct trace_chunk_registry_ht_element *element)
+static void trace_chunk_registry_ht_element_put(struct trace_chunk_registry_ht_element *element)
 {
        if (!element) {
                return;
@@ -150,10 +138,9 @@ void trace_chunk_registry_ht_element_put(
 }
 
 /* Acquires a reference to the returned element on behalf of the caller. */
-static
-struct trace_chunk_registry_ht_element *trace_chunk_registry_ht_element_find(
-               struct sessiond_trace_chunk_registry *sessiond_registry,
-               const struct trace_chunk_registry_ht_key *key)
+static struct trace_chunk_registry_ht_element *
+trace_chunk_registry_ht_element_find(struct sessiond_trace_chunk_registry *sessiond_registry,
+                                    const struct trace_chunk_registry_ht_key *key)
 {
        struct trace_chunk_registry_ht_element *element = NULL;
        struct cds_lfht_node *node;
@@ -167,8 +154,8 @@ struct trace_chunk_registry_ht_element *trace_chunk_registry_ht_element_find(
                        &iter);
        node = cds_lfht_iter_get_node(&iter);
        if (node) {
-               element = lttng::utils::container_of(
-                               node, &trace_chunk_registry_ht_element::ht_node);
+               element =
+                       lttng::utils::container_of(node, &trace_chunk_registry_ht_element::ht_node);
                /*
                 * Only consider the look-up as successful if a reference
                 * could be acquired.
@@ -181,10 +168,9 @@ struct trace_chunk_registry_ht_element *trace_chunk_registry_ht_element_find(
        return element;
 }
 
-static
-int trace_chunk_registry_ht_element_create(
-               struct sessiond_trace_chunk_registry *sessiond_registry,
-               const struct trace_chunk_registry_ht_key *key)
+static int
+trace_chunk_registry_ht_element_create(struct sessiond_trace_chunk_registry *sessiond_registry,
+                                      const struct trace_chunk_registry_ht_key *key)
 {
        int ret = 0;
        struct trace_chunk_registry_ht_element *new_element;
@@ -217,17 +203,16 @@ int trace_chunk_registry_ht_element_create(
                struct cds_lfht_node *published_node;
                struct trace_chunk_registry_ht_element *published_element;
 
-               published_node = cds_lfht_add_unique(sessiond_registry->ht,
-                               trace_chunk_registry_ht_key_hash(&new_element->key),
-                               trace_chunk_registry_ht_key_match,
-                               &new_element->key,
-                               &new_element->ht_node);
+               published_node =
+                       cds_lfht_add_unique(sessiond_registry->ht,
+                                           trace_chunk_registry_ht_key_hash(&new_element->key),
+                                           trace_chunk_registry_ht_key_match,
+                                           &new_element->key,
+                                           &new_element->ht_node);
                if (published_node == &new_element->ht_node) {
                        /* New element published successfully. */
-                       DBG("Created trace chunk registry for sessiond {%s}",
-                                       uuid_str);
-                       new_element->sessiond_trace_chunk_registry =
-                                       sessiond_registry;
+                       DBG("Created trace chunk registry for sessiond {%s}", uuid_str);
+                       new_element->sessiond_trace_chunk_registry = sessiond_registry;
                        break;
                }
 
@@ -237,11 +222,11 @@ int trace_chunk_registry_ht_element_create(
                 * was already published and release the reference to the copy
                 * we created if successful.
                 */
-               published_element = lttng::utils::container_of(published_node,
-                               &trace_chunk_registry_ht_element::ht_node);
+               published_element = lttng::utils::container_of(
+                       published_node, &trace_chunk_registry_ht_element::ht_node);
                if (trace_chunk_registry_ht_element_get(published_element)) {
                        DBG("Acquired reference to trace chunk registry of sessiond {%s}",
-                                       uuid_str);
+                           uuid_str);
                        trace_chunk_registry_ht_element_put(new_element);
                        new_element = NULL;
                        break;
@@ -255,8 +240,7 @@ int trace_chunk_registry_ht_element_create(
        rcu_read_unlock();
 end:
        if (ret < 0) {
-               ERR("Failed to create trace chunk registry for session daemon {%s}",
-                               uuid_str);
+               ERR("Failed to create trace chunk registry for session daemon {%s}", uuid_str);
        }
        lttng_trace_chunk_registry_destroy(trace_chunk_registry);
        return ret;
@@ -265,14 +249,14 @@ end:
 struct sessiond_trace_chunk_registry *sessiond_trace_chunk_registry_create(void)
 {
        struct sessiond_trace_chunk_registry *sessiond_registry =
-                       zmalloc<sessiond_trace_chunk_registry>();
+               zmalloc<sessiond_trace_chunk_registry>();
 
        if (!sessiond_registry) {
                goto end;
        }
 
-       sessiond_registry->ht = cds_lfht_new(DEFAULT_HT_SIZE,
-                       1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       sessiond_registry->ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!sessiond_registry->ht) {
                goto error;
        }
@@ -284,8 +268,7 @@ error:
        return NULL;
 }
 
-void sessiond_trace_chunk_registry_destroy(
-               struct sessiond_trace_chunk_registry *sessiond_registry)
+void sessiond_trace_chunk_registry_destroy(struct sessiond_trace_chunk_registry *sessiond_registry)
 {
        int ret = cds_lfht_destroy(sessiond_registry->ht, NULL);
 
@@ -294,8 +277,7 @@ void sessiond_trace_chunk_registry_destroy(
 }
 
 int sessiond_trace_chunk_registry_session_created(
-               struct sessiond_trace_chunk_registry *sessiond_registry,
-               const lttng_uuid& sessiond_uuid)
+       struct sessiond_trace_chunk_registry *sessiond_registry, const lttng_uuid& sessiond_uuid)
 {
        int ret = 0;
        struct trace_chunk_registry_ht_key key;
@@ -308,20 +290,17 @@ int sessiond_trace_chunk_registry_session_created(
                char uuid_str[LTTNG_UUID_STR_LEN];
 
                lttng_uuid_to_str(sessiond_uuid, uuid_str);
-               DBG("Acquired reference to trace chunk registry of sessiond {%s}",
-                               uuid_str);
+               DBG("Acquired reference to trace chunk registry of sessiond {%s}", uuid_str);
                goto end;
        } else {
-               ret = trace_chunk_registry_ht_element_create(
-                               sessiond_registry, &key);
+               ret = trace_chunk_registry_ht_element_create(sessiond_registry, &key);
        }
 end:
        return ret;
 }
 
 int sessiond_trace_chunk_registry_session_destroyed(
-               struct sessiond_trace_chunk_registry *sessiond_registry,
-               const lttng_uuid& sessiond_uuid)
+       struct sessiond_trace_chunk_registry *sessiond_registry, const lttng_uuid& sessiond_uuid)
 {
        int ret = 0;
        struct trace_chunk_registry_ht_key key;
@@ -333,8 +312,7 @@ int sessiond_trace_chunk_registry_session_destroyed(
 
        element = trace_chunk_registry_ht_element_find(sessiond_registry, &key);
        if (element) {
-               DBG("Releasing reference to trace chunk registry of sessiond {%s}",
-                               uuid_str);
+               DBG("Releasing reference to trace chunk registry of sessiond {%s}", uuid_str);
                /*
                 * Release the reference held by the session and the reference
                 * acquired through the "find" operation.
@@ -342,17 +320,17 @@ int sessiond_trace_chunk_registry_session_destroyed(
                trace_chunk_registry_ht_element_put(element);
                trace_chunk_registry_ht_element_put(element);
        } else {
-               ERR("Failed to find trace chunk registry of sessiond {%s}",
-                               uuid_str);
+               ERR("Failed to find trace chunk registry of sessiond {%s}", uuid_str);
                ret = -1;
        }
        return ret;
 }
 
-struct lttng_trace_chunk *sessiond_trace_chunk_registry_publish_chunk(
-               struct sessiond_trace_chunk_registry *sessiond_registry,
-               const lttng_uuid& sessiond_uuid, uint64_t session_id,
-               struct lttng_trace_chunk *new_chunk)
+struct lttng_trace_chunk *
+sessiond_trace_chunk_registry_publish_chunk(struct sessiond_trace_chunk_registry *sessiond_registry,
+                                           const lttng_uuid& sessiond_uuid,
+                                           uint64_t session_id,
+                                           struct lttng_trace_chunk *new_chunk)
 {
        enum lttng_trace_chunk_status status;
        uint64_t chunk_id;
@@ -371,8 +349,7 @@ struct lttng_trace_chunk *sessiond_trace_chunk_registry_publish_chunk(
        if (status == LTTNG_TRACE_CHUNK_STATUS_OK) {
                int ret;
 
-               ret = snprintf(chunk_id_str, sizeof(chunk_id_str), "%" PRIu64,
-                               chunk_id);
+               ret = snprintf(chunk_id_str, sizeof(chunk_id_str), "%" PRIu64, chunk_id);
                if (ret < 0) {
                        lttng_strncpy(chunk_id_str, "-1", sizeof(chunk_id_str));
                        WARN("Failed to format trace chunk id");
@@ -386,9 +363,10 @@ struct lttng_trace_chunk *sessiond_trace_chunk_registry_publish_chunk(
        }
 
        DBG("Attempting to publish trace chunk: sessiond {%s}, session_id = "
-                       "%" PRIu64 ", chunk_id = %s",
-                       uuid_str, session_id,
-                       is_anonymous_chunk ? "anonymous" : chunk_id_str);
+           "%" PRIu64 ", chunk_id = %s",
+           uuid_str,
+           session_id,
+           is_anonymous_chunk ? "anonymous" : chunk_id_str);
 
        element = trace_chunk_registry_ht_element_find(sessiond_registry, &key);
        if (!element) {
@@ -396,9 +374,10 @@ struct lttng_trace_chunk *sessiond_trace_chunk_registry_publish_chunk(
                goto end;
        }
 
-       published_chunk = lttng_trace_chunk_registry_publish_chunk(
-                       element->trace_chunk_registry, session_id, new_chunk,
-                       &trace_chunk_already_published);
+       published_chunk = lttng_trace_chunk_registry_publish_chunk(element->trace_chunk_registry,
+                                                                  session_id,
+                                                                  new_chunk,
+                                                                  &trace_chunk_already_published);
        /*
         * When the trace chunk is first published, two references to the
         * published chunks exist. One is taken by the registry while the other
@@ -425,11 +404,10 @@ end:
        return published_chunk;
 }
 
-struct lttng_trace_chunk *
-sessiond_trace_chunk_registry_get_anonymous_chunk(
-               struct sessiond_trace_chunk_registry *sessiond_registry,
-               const lttng_uuid& sessiond_uuid,
-               uint64_t session_id)
+struct lttng_trace_chunk *sessiond_trace_chunk_registry_get_anonymous_chunk(
+       struct sessiond_trace_chunk_registry *sessiond_registry,
+       const lttng_uuid& sessiond_uuid,
+       uint64_t session_id)
 {
        struct lttng_trace_chunk *chunk = NULL;
        struct trace_chunk_registry_ht_element *element;
@@ -441,24 +419,22 @@ sessiond_trace_chunk_registry_get_anonymous_chunk(
        key.sessiond_uuid = sessiond_uuid;
        element = trace_chunk_registry_ht_element_find(sessiond_registry, &key);
        if (!element) {
-               ERR("Failed to find trace chunk registry of sessiond {%s}",
-                               uuid_str);
+               ERR("Failed to find trace chunk registry of sessiond {%s}", uuid_str);
                goto end;
        }
 
-       chunk = lttng_trace_chunk_registry_find_anonymous_chunk(
-                       element->trace_chunk_registry,
-                       session_id);
+       chunk = lttng_trace_chunk_registry_find_anonymous_chunk(element->trace_chunk_registry,
+                                                               session_id);
        trace_chunk_registry_ht_element_put(element);
 end:
        return chunk;
 }
 
 struct lttng_trace_chunk *
-sessiond_trace_chunk_registry_get_chunk(
-               struct sessiond_trace_chunk_registry *sessiond_registry,
-               const lttng_uuid& sessiond_uuid,
-               uint64_t session_id, uint64_t chunk_id)
+sessiond_trace_chunk_registry_get_chunk(struct sessiond_trace_chunk_registry *sessiond_registry,
+                                       const lttng_uuid& sessiond_uuid,
+                                       uint64_t session_id,
+                                       uint64_t chunk_id)
 {
        struct lttng_trace_chunk *chunk = NULL;
        struct trace_chunk_registry_ht_element *element;
@@ -470,23 +446,23 @@ sessiond_trace_chunk_registry_get_chunk(
        key.sessiond_uuid = sessiond_uuid;
        element = trace_chunk_registry_ht_element_find(sessiond_registry, &key);
        if (!element) {
-               ERR("Failed to find trace chunk registry of sessiond {%s}",
-                               uuid_str);
+               ERR("Failed to find trace chunk registry of sessiond {%s}", uuid_str);
                goto end;
        }
 
        chunk = lttng_trace_chunk_registry_find_chunk(
-                       element->trace_chunk_registry,
-                       session_id, chunk_id);
+               element->trace_chunk_registry, session_id, chunk_id);
        trace_chunk_registry_ht_element_put(element);
 end:
        return chunk;
 }
 
 int sessiond_trace_chunk_registry_chunk_exists(
-               struct sessiond_trace_chunk_registry *sessiond_registry,
-               const lttng_uuid& sessiond_uuid,
-               uint64_t session_id, uint64_t chunk_id, bool *chunk_exists)
+       struct sessiond_trace_chunk_registry *sessiond_registry,
+       const lttng_uuid& sessiond_uuid,
+       uint64_t session_id,
+       uint64_t chunk_id,
+       bool *chunk_exists)
 {
        int ret;
        struct trace_chunk_registry_ht_element *element;
@@ -505,15 +481,13 @@ int sessiond_trace_chunk_registry_chunk_exists(
                 * connection/registry. This would indicate a protocol
                 * (or internal) error.
                 */
-               ERR("Failed to find trace chunk registry of sessiond {%s}",
-                               uuid_str);
+               ERR("Failed to find trace chunk registry of sessiond {%s}", uuid_str);
                ret = -1;
                goto end;
        }
 
        ret = lttng_trace_chunk_registry_chunk_exists(
-                       element->trace_chunk_registry,
-                       session_id, chunk_id, chunk_exists);
+               element->trace_chunk_registry, session_id, chunk_id, chunk_exists);
        trace_chunk_registry_ht_element_put(element);
 end:
        return ret;
index fbecdc55804acdc151732a17188b13fa1b969186..9df6e52fb52204abfa3bce423503394b72a41b35 100644 (file)
@@ -9,24 +9,24 @@
  */
 
 #define _LGPL_SOURCE
-#include <algorithm>
+#include "index.hpp"
+#include "lttng-relayd.hpp"
+#include "stream.hpp"
+#include "viewer-stream.hpp"
+
 #include <common/common.hpp>
 #include <common/defaults.hpp>
 #include <common/fs-handle.hpp>
 #include <common/sessiond-comm/relayd.hpp>
 #include <common/utils.hpp>
-#include <sys/stat.h>
-#include <urcu/rculist.h>
-
-#include "lttng-relayd.hpp"
-#include "index.hpp"
-#include "stream.hpp"
-#include "viewer-stream.hpp"
 
-#include <sys/types.h>
+#include <algorithm>
 #include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <urcu/rculist.h>
 
-#define FILE_IO_STACK_BUFFER_SIZE              65536
+#define FILE_IO_STACK_BUFFER_SIZE 65536
 
 /* Should be called with RCU read-side lock held. */
 bool stream_get(struct relay_stream *stream)
@@ -68,8 +68,7 @@ static void stream_complete_rotation(struct relay_stream *stream)
        DBG("Rotation completed for stream %" PRIu64, stream->stream_handle);
        if (stream->ongoing_rotation.value.next_trace_chunk) {
                tracefile_array_reset(stream->tfa);
-               tracefile_array_commit_seq(stream->tfa,
-                               stream->index_received_seqcount);
+               tracefile_array_commit_seq(stream->tfa, stream->index_received_seqcount);
        }
        lttng_trace_chunk_put(stream->trace_chunk);
        stream->trace_chunk = stream->ongoing_rotation.value.next_trace_chunk;
@@ -77,11 +76,10 @@ static void stream_complete_rotation(struct relay_stream *stream)
        stream->completed_rotation_count++;
 }
 
-static int stream_create_data_output_file_from_trace_chunk(
-               struct relay_stream *stream,
-               struct lttng_trace_chunk *trace_chunk,
-               bool force_unlink,
-               struct fs_handle **out_file)
+static int stream_create_data_output_file_from_trace_chunk(struct relay_stream *stream,
+                                                          struct lttng_trace_chunk *trace_chunk,
+                                                          bool force_unlink,
+                                                          struct fs_handle **out_file)
 {
        int ret;
        char stream_path[LTTNG_PATH_MAX];
@@ -91,9 +89,13 @@ static int stream_create_data_output_file_from_trace_chunk(
 
        ASSERT_LOCKED(stream->lock);
 
-       ret = utils_stream_file_path(stream->path_name, stream->channel_name,
-                       stream->tracefile_size, stream->tracefile_current_index,
-                       NULL, stream_path, sizeof(stream_path));
+       ret = utils_stream_file_path(stream->path_name,
+                                    stream->channel_name,
+                                    stream->tracefile_size,
+                                    stream->tracefile_current_index,
+                                    NULL,
+                                    stream_path,
+                                    sizeof(stream_path));
        if (ret < 0) {
                goto end;
        }
@@ -107,10 +109,10 @@ static int stream_create_data_output_file_from_trace_chunk(
                 * content.
                 */
                status = (lttng_trace_chunk_status) lttng_trace_chunk_unlink_file(trace_chunk,
-                               stream_path);
+                                                                                 stream_path);
                if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        PERROR("Failed to unlink stream file \"%s\" during trace file rotation",
-                                       stream_path);
+                              stream_path);
                        /*
                         * Don't abort if the file doesn't exist, it is
                         * unexpected, but should not be a fatal error.
@@ -122,8 +124,8 @@ static int stream_create_data_output_file_from_trace_chunk(
                }
        }
 
-       status = lttng_trace_chunk_open_fs_handle(trace_chunk, stream_path,
-                       flags, mode, out_file, false);
+       status = lttng_trace_chunk_open_fs_handle(
+               trace_chunk, stream_path, flags, mode, out_file, false);
        if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ERR("Failed to open stream file \"%s\"", stream->channel_name);
                ret = -1;
@@ -138,7 +140,8 @@ static int stream_rotate_data_file(struct relay_stream *stream)
        int ret = 0;
 
        DBG("Rotating stream %" PRIu64 " data file with size %" PRIu64,
-                       stream->stream_handle, stream->tracefile_size_current);
+           stream->stream_handle,
+           stream->tracefile_size_current);
 
        if (stream->file) {
                fs_handle_close(stream->file);
@@ -152,24 +155,27 @@ static int stream_rotate_data_file(struct relay_stream *stream)
                enum lttng_trace_chunk_status chunk_status;
 
                chunk_status = lttng_trace_chunk_create_subdirectory(
-                               stream->ongoing_rotation.value.next_trace_chunk,
-                               stream->path_name);
+                       stream->ongoing_rotation.value.next_trace_chunk, stream->path_name);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
 
                /* Rotate the data file. */
-               ret = stream_create_data_output_file_from_trace_chunk(stream,
-                               stream->ongoing_rotation.value.next_trace_chunk,
-                               false, &stream->file);
+               ret = stream_create_data_output_file_from_trace_chunk(
+                       stream,
+                       stream->ongoing_rotation.value.next_trace_chunk,
+                       false,
+                       &stream->file);
                if (ret < 0) {
                        ERR("Failed to rotate stream data file");
                        goto end;
                }
        }
        DBG("%s: reset tracefile_size_current for stream %" PRIu64 " was %" PRIu64,
-                       __func__, stream->stream_handle, stream->tracefile_size_current);
+           __func__,
+           stream->stream_handle,
+           stream->tracefile_size_current);
        stream->tracefile_size_current = 0;
        stream->pos_after_last_complete_data_index = 0;
        stream->ongoing_rotation.value.data_rotated = true;
@@ -202,10 +208,10 @@ static int rotate_truncate_stream(struct relay_stream *stream)
 
        if (!LTTNG_OPTIONAL_GET(stream->ongoing_rotation).next_trace_chunk) {
                ERR("Protocol error encoutered in %s(): stream rotation "
-                       "sequence number is before the current sequence number "
-                       "and the next trace chunk is unset. Honoring this "
-                       "rotation command would result in data loss",
-                               __FUNCTION__);
+                   "sequence number is before the current sequence number "
+                   "and the next trace chunk is unset. Honoring this "
+                   "rotation command would result in data loss",
+                   __FUNCTION__);
                ret = -1;
                goto end;
        }
@@ -233,10 +239,9 @@ static int rotate_truncate_stream(struct relay_stream *stream)
        stream->file = NULL;
 
        LTTNG_ASSERT(!stream->is_metadata);
-       LTTNG_ASSERT(stream->tracefile_size_current >
-                       stream->pos_after_last_complete_data_index);
-       misplaced_data_size = stream->tracefile_size_current -
-                             stream->pos_after_last_complete_data_index;
+       LTTNG_ASSERT(stream->tracefile_size_current > stream->pos_after_last_complete_data_index);
+       misplaced_data_size =
+               stream->tracefile_size_current - stream->pos_after_last_complete_data_index;
        copy_bytes_left = misplaced_data_size;
        previous_stream_copy_origin = stream->pos_after_last_complete_data_index;
 
@@ -254,7 +259,7 @@ static int rotate_truncate_stream(struct relay_stream *stream)
        if (lseek_ret < 0) {
                PERROR("Failed to seek to offset %" PRIu64
                       " while copying extra data received before a stream rotation",
-                               (uint64_t) previous_stream_copy_origin);
+                      (uint64_t) previous_stream_copy_origin);
                ret = -1;
                goto end;
        }
@@ -263,43 +268,46 @@ static int rotate_truncate_stream(struct relay_stream *stream)
        while (copy_bytes_left) {
                ssize_t io_ret;
                char copy_buffer[FILE_IO_STACK_BUFFER_SIZE];
-               const off_t copy_size_this_pass = std::min<uint64_t>(copy_bytes_left, sizeof(copy_buffer));
+               const off_t copy_size_this_pass =
+                       std::min<uint64_t>(copy_bytes_left, sizeof(copy_buffer));
 
-               io_ret = fs_handle_read(previous_stream_file, copy_buffer,
-                               copy_size_this_pass);
+               io_ret = fs_handle_read(previous_stream_file, copy_buffer, copy_size_this_pass);
                if (io_ret < (ssize_t) copy_size_this_pass) {
                        if (io_ret == -1) {
                                PERROR("Failed to read %" PRIu64
                                       " bytes from previous stream file in %s(), returned %zi: stream id = %" PRIu64,
-                                               copy_size_this_pass,
-                                               __FUNCTION__, io_ret,
-                                               stream->stream_handle);
+                                      copy_size_this_pass,
+                                      __FUNCTION__,
+                                      io_ret,
+                                      stream->stream_handle);
                        } else {
                                ERR("Failed to read %" PRIu64
-                                      " bytes from previous stream file in %s(), returned %zi: stream id = %" PRIu64,
-                                               copy_size_this_pass,
-                                               __FUNCTION__, io_ret,
-                                               stream->stream_handle);
+                                   " bytes from previous stream file in %s(), returned %zi: stream id = %" PRIu64,
+                                   copy_size_this_pass,
+                                   __FUNCTION__,
+                                   io_ret,
+                                   stream->stream_handle);
                        }
                        ret = -1;
                        goto end;
                }
 
-               io_ret = fs_handle_write(
-                               stream->file, copy_buffer, copy_size_this_pass);
+               io_ret = fs_handle_write(stream->file, copy_buffer, copy_size_this_pass);
                if (io_ret < (ssize_t) copy_size_this_pass) {
                        if (io_ret == -1) {
                                PERROR("Failed to write %" PRIu64
                                       " bytes from previous stream file in %s(), returned %zi: stream id = %" PRIu64,
-                                               copy_size_this_pass,
-                                               __FUNCTION__, io_ret,
-                                               stream->stream_handle);
+                                      copy_size_this_pass,
+                                      __FUNCTION__,
+                                      io_ret,
+                                      stream->stream_handle);
                        } else {
                                ERR("Failed to write %" PRIu64
-                                      " bytes from previous stream file in %s(), returned %zi: stream id = %" PRIu64,
-                                               copy_size_this_pass,
-                                               __FUNCTION__, io_ret,
-                                               stream->stream_handle);
+                                   " bytes from previous stream file in %s(), returned %zi: stream id = %" PRIu64,
+                                   copy_size_this_pass,
+                                   __FUNCTION__,
+                                   io_ret,
+                                   stream->stream_handle);
                        }
                        ret = -1;
                        goto end;
@@ -308,11 +316,10 @@ static int rotate_truncate_stream(struct relay_stream *stream)
        }
 
        /* Truncate the file to get rid of the excess data. */
-       ret = fs_handle_truncate(
-                       previous_stream_file, previous_stream_copy_origin);
+       ret = fs_handle_truncate(previous_stream_file, previous_stream_copy_origin);
        if (ret) {
                PERROR("Failed to truncate current stream file to offset %" PRIu64,
-                               previous_stream_copy_origin);
+                      previous_stream_copy_origin);
                goto end;
        }
 
@@ -356,31 +363,28 @@ static int try_rotate_stream_data(struct relay_stream *stream)
                goto end;
        }
 
-       DBG("%s: Stream %" PRIu64
-                               " (rotate_at_index_packet_seq_num = %" PRIu64
-                               ", rotate_at_prev_data_net_seq = %" PRIu64
-                               ", prev_data_seq = %" PRIu64 ")",
-                               __func__, stream->stream_handle,
-                               stream->ongoing_rotation.value.packet_seq_num,
-                               stream->ongoing_rotation.value.prev_data_net_seq,
-                               stream->prev_data_seq);
+       DBG("%s: Stream %" PRIu64 " (rotate_at_index_packet_seq_num = %" PRIu64
+           ", rotate_at_prev_data_net_seq = %" PRIu64 ", prev_data_seq = %" PRIu64 ")",
+           __func__,
+           stream->stream_handle,
+           stream->ongoing_rotation.value.packet_seq_num,
+           stream->ongoing_rotation.value.prev_data_net_seq,
+           stream->prev_data_seq);
 
        if (stream->prev_data_seq == -1ULL ||
-                       stream->ongoing_rotation.value.prev_data_net_seq == -1ULL ||
-                       stream->prev_data_seq <
-                       stream->ongoing_rotation.value.prev_data_net_seq) {
+           stream->ongoing_rotation.value.prev_data_net_seq == -1ULL ||
+           stream->prev_data_seq < stream->ongoing_rotation.value.prev_data_net_seq) {
                /*
                 * The next packet that will be written is not part of the next
                 * chunk yet.
                 */
                DBG("Stream %" PRIu64 " data not yet ready for rotation "
-                               "(rotate_at_index_packet_seq_num = %" PRIu64
-                               ", rotate_at_prev_data_net_seq = %" PRIu64
-                               ", prev_data_seq = %" PRIu64 ")",
-                               stream->stream_handle,
-                               stream->ongoing_rotation.value.packet_seq_num,
-                               stream->ongoing_rotation.value.prev_data_net_seq,
-                               stream->prev_data_seq);
+                   "(rotate_at_index_packet_seq_num = %" PRIu64
+                   ", rotate_at_prev_data_net_seq = %" PRIu64 ", prev_data_seq = %" PRIu64 ")",
+                   stream->stream_handle,
+                   stream->ongoing_rotation.value.packet_seq_num,
+                   stream->ongoing_rotation.value.prev_data_net_seq,
+                   stream->prev_data_seq);
                goto end;
        } else if (stream->prev_data_seq > stream->ongoing_rotation.value.prev_data_net_seq) {
                /*
@@ -388,8 +392,9 @@ static int try_rotate_stream_data(struct relay_stream *stream)
                 * commands are serialized with respect to each other.
                 */
                DBG("Rotation after too much data has been written in tracefile "
-                               "for stream %" PRIu64 ", need to truncate before "
-                               "rotating", stream->stream_handle);
+                   "for stream %" PRIu64 ", need to truncate before "
+                   "rotating",
+                   stream->stream_handle);
                ret = rotate_truncate_stream(stream);
                if (ret) {
                        ERR("Failed to truncate stream");
@@ -408,8 +413,7 @@ end:
  *
  * Return 0 on success, -1 on error.
  */
-static int create_index_file(struct relay_stream *stream,
-               struct lttng_trace_chunk *chunk)
+static int create_index_file(struct relay_stream *stream, struct lttng_trace_chunk *chunk)
 {
        int ret;
        uint32_t major, minor;
@@ -430,26 +434,26 @@ static int create_index_file(struct relay_stream *stream,
                ret = 0;
                goto end;
        }
-       ret = asprintf(&index_subpath, "%s/%s", stream->path_name,
-                       DEFAULT_INDEX_DIR);
+       ret = asprintf(&index_subpath, "%s/%s", stream->path_name, DEFAULT_INDEX_DIR);
        if (ret < 0) {
                goto end;
        }
 
-       status = lttng_trace_chunk_create_subdirectory(chunk,
-                       index_subpath);
+       status = lttng_trace_chunk_create_subdirectory(chunk, index_subpath);
        free(index_subpath);
        if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ret = -1;
                goto end;
        }
-       status = lttng_index_file_create_from_trace_chunk(
-                       chunk, stream->path_name,
-                       stream->channel_name, stream->tracefile_size,
-                       stream->tracefile_current_index,
-                       lttng_to_index_major(major, minor),
-                       lttng_to_index_minor(major, minor), true,
-                       &stream->index_file);
+       status = lttng_index_file_create_from_trace_chunk(chunk,
+                                                         stream->path_name,
+                                                         stream->channel_name,
+                                                         stream->tracefile_size,
+                                                         stream->tracefile_current_index,
+                                                         lttng_to_index_major(major, minor),
+                                                         lttng_to_index_minor(major, minor),
+                                                         true,
+                                                         &stream->index_file);
        if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ret = -1;
                goto end;
@@ -481,26 +485,25 @@ static int try_rotate_stream_index(struct relay_stream *stream)
                goto end;
        }
 
-       DBG("%s: Stream %" PRIu64
-                       " (rotate_at_packet_seq_num = %" PRIu64
-                       ", received_packet_seq_num = "
-                       "(value = %" PRIu64 ", is_set = %" PRIu8 "))",
-                       __func__, stream->stream_handle,
-                       stream->ongoing_rotation.value.packet_seq_num,
-                       stream->received_packet_seq_num.value,
-                       stream->received_packet_seq_num.is_set);
+       DBG("%s: Stream %" PRIu64 " (rotate_at_packet_seq_num = %" PRIu64
+           ", received_packet_seq_num = "
+           "(value = %" PRIu64 ", is_set = %" PRIu8 "))",
+           __func__,
+           stream->stream_handle,
+           stream->ongoing_rotation.value.packet_seq_num,
+           stream->received_packet_seq_num.value,
+           stream->received_packet_seq_num.is_set);
 
        if (!stream->received_packet_seq_num.is_set ||
-                       LTTNG_OPTIONAL_GET(stream->received_packet_seq_num) + 1 <
-                       stream->ongoing_rotation.value.packet_seq_num) {
+           LTTNG_OPTIONAL_GET(stream->received_packet_seq_num) + 1 <
+                   stream->ongoing_rotation.value.packet_seq_num) {
                DBG("Stream %" PRIu64 " index not yet ready for rotation "
-                               "(rotate_at_packet_seq_num = %" PRIu64
-                               ", received_packet_seq_num = "
-                               "(value = %" PRIu64 ", is_set = %" PRIu8 "))",
-                               stream->stream_handle,
-                               stream->ongoing_rotation.value.packet_seq_num,
-                               stream->received_packet_seq_num.value,
-                               stream->received_packet_seq_num.is_set);
+                   "(rotate_at_packet_seq_num = %" PRIu64 ", received_packet_seq_num = "
+                   "(value = %" PRIu64 ", is_set = %" PRIu8 "))",
+                   stream->stream_handle,
+                   stream->ongoing_rotation.value.packet_seq_num,
+                   stream->received_packet_seq_num.value,
+                   stream->received_packet_seq_num.is_set);
                goto end;
        } else {
                /*
@@ -509,9 +512,8 @@ static int try_rotate_stream_index(struct relay_stream *stream)
                 * rotation position.
                 */
                LTTNG_ASSERT(LTTNG_OPTIONAL_GET(stream->received_packet_seq_num) + 1 >=
-                               stream->ongoing_rotation.value.packet_seq_num);
-               DBG("Rotating stream %" PRIu64 " index file",
-                               stream->stream_handle);
+                            stream->ongoing_rotation.value.packet_seq_num);
+               DBG("Rotating stream %" PRIu64 " index file", stream->stream_handle);
                if (stream->index_file) {
                        lttng_index_file_put(stream->index_file);
                        stream->index_file = NULL;
@@ -522,13 +524,11 @@ static int try_rotate_stream_index(struct relay_stream *stream)
                 * Set the rotation pivot position for the data, now that we have the
                 * net_seq_num matching the packet_seq_num index pivot position.
                 */
-               stream->ongoing_rotation.value.prev_data_net_seq =
-                       stream->prev_index_seq;
+               stream->ongoing_rotation.value.prev_data_net_seq = stream->prev_index_seq;
                if (stream->ongoing_rotation.value.data_rotated &&
-                               stream->ongoing_rotation.value.index_rotated) {
+                   stream->ongoing_rotation.value.index_rotated) {
                        /* Rotation completed; reset its state. */
-                       DBG("Rotation completed for stream %" PRIu64,
-                                       stream->stream_handle);
+                       DBG("Rotation completed for stream %" PRIu64, stream->stream_handle);
                        stream_complete_rotation(stream);
                }
        }
@@ -537,15 +537,13 @@ end:
        return ret;
 }
 
-static int stream_set_trace_chunk(struct relay_stream *stream,
-               struct lttng_trace_chunk *chunk)
+static int stream_set_trace_chunk(struct relay_stream *stream, struct lttng_trace_chunk *chunk)
 {
        int ret = 0;
        enum lttng_trace_chunk_status status;
        bool acquired_reference;
 
-       status = lttng_trace_chunk_create_subdirectory(chunk,
-                       stream->path_name);
+       status = lttng_trace_chunk_create_subdirectory(chunk, stream->path_name);
        if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ret = -1;
                goto end;
@@ -560,8 +558,7 @@ static int stream_set_trace_chunk(struct relay_stream *stream,
                fs_handle_close(stream->file);
                stream->file = NULL;
        }
-       ret = stream_create_data_output_file_from_trace_chunk(stream, chunk,
-                       false, &stream->file);
+       ret = stream_create_data_output_file_from_trace_chunk(stream, chunk, false, &stream->file);
 end:
        return ret;
 }
@@ -570,9 +567,11 @@ end:
  * We keep ownership of path_name and channel_name.
  */
 struct relay_stream *stream_create(struct ctf_trace *trace,
-       uint64_t stream_handle, char *path_name,
-       char *channel_name, uint64_t tracefile_size,
-       uint64_t tracefile_count)
+                                  uint64_t stream_handle,
+                                  char *path_name,
+                                  char *channel_name,
+                                  uint64_t tracefile_size,
+                                  uint64_t tracefile_count)
 {
        int ret;
        struct relay_stream *stream = NULL;
@@ -610,7 +609,7 @@ struct relay_stream *stream_create(struct ctf_trace *trace,
        pthread_mutex_unlock(&trace->session->lock);
        if (!acquired_reference) {
                ERR("Cannot create stream for channel \"%s\" as a reference to the session's current trace chunk could not be acquired",
-                               channel_name);
+                   channel_name);
                ret = -1;
                goto end;
        }
@@ -627,8 +626,8 @@ struct relay_stream *stream_create(struct ctf_trace *trace,
        pthread_mutex_unlock(&stream->lock);
        if (ret) {
                ERR("Failed to set the current trace chunk of session \"%s\" on newly created stream of channel \"%s\"",
-                               trace->session->session_name,
-                               stream->channel_name);
+                   trace->session->session_name,
+                   stream->channel_name);
                ret = -1;
                goto end;
        }
@@ -638,8 +637,7 @@ struct relay_stream *stream_create(struct ctf_trace *trace,
                goto end;
        }
 
-       stream->is_metadata = !strcmp(stream->channel_name,
-                       DEFAULT_METADATA_NAME);
+       stream->is_metadata = !strcmp(stream->channel_name, DEFAULT_METADATA_NAME);
        stream->in_recv_list = true;
 
        /*
@@ -658,14 +656,15 @@ struct relay_stream *stream_create(struct ctf_trace *trace,
        lttng_ht_add_unique_u64(relay_streams_ht, &stream->node);
        stream->in_stream_ht = true;
 
-       DBG("Relay new stream added %s with ID %" PRIu64, stream->channel_name,
-                       stream->stream_handle);
+       DBG("Relay new stream added %s with ID %" PRIu64,
+           stream->channel_name,
+           stream->stream_handle);
        ret = 0;
 
 end:
        if (ret) {
                if (stream->file) {
-                       fs_handle_close(stream->file);
+                       fs_handle_close(stream->file);
                        stream->file = NULL;
                }
                stream_put(stream);
@@ -759,8 +758,7 @@ static void stream_destroy(struct relay_stream *stream)
 
 static void stream_destroy_rcu(struct rcu_head *rcu_head)
 {
-       struct relay_stream *stream =
-               lttng::utils::container_of(rcu_head, &relay_stream::rcu_node);
+       struct relay_stream *stream = lttng::utils::container_of(rcu_head, &relay_stream::rcu_node);
 
        stream_destroy(stream);
 }
@@ -771,8 +769,7 @@ static void stream_destroy_rcu(struct rcu_head *rcu_head)
  */
 static void stream_release(struct urcu_ref *ref)
 {
-       struct relay_stream *stream =
-               lttng::utils::container_of(ref, &relay_stream::ref);
+       struct relay_stream *stream = lttng::utils::container_of(ref, &relay_stream::ref);
        struct relay_session *session;
 
        session = stream->trace->session;
@@ -821,8 +818,8 @@ void stream_put(struct relay_stream *stream)
 }
 
 int stream_set_pending_rotation(struct relay_stream *stream,
-               struct lttng_trace_chunk *next_trace_chunk,
-               uint64_t rotation_sequence_number)
+                               struct lttng_trace_chunk *next_trace_chunk,
+                               uint64_t rotation_sequence_number)
 {
        int ret = 0;
        const struct relay_stream_rotation rotation = {
@@ -840,16 +837,16 @@ int stream_set_pending_rotation(struct relay_stream *stream,
        }
 
        if (next_trace_chunk) {
-               const bool reference_acquired =
-                               lttng_trace_chunk_get(next_trace_chunk);
+               const bool reference_acquired = lttng_trace_chunk_get(next_trace_chunk);
 
                LTTNG_ASSERT(reference_acquired);
        }
        LTTNG_OPTIONAL_SET(&stream->ongoing_rotation, rotation);
 
        DBG("Setting pending rotation: stream_id = %" PRIu64
-                       ", rotate_at_packet_seq_num = %" PRIu64,
-                       stream->stream_handle, rotation_sequence_number);
+           ", rotate_at_packet_seq_num = %" PRIu64,
+           stream->stream_handle,
+           rotation_sequence_number);
        if (stream->is_metadata) {
                /*
                 * A metadata stream has no index; consider it already rotated.
@@ -895,7 +892,8 @@ void try_stream_close(struct relay_stream *stream)
         */
        if (stream->closed) {
                pthread_mutex_unlock(&stream->lock);
-               DBG("closing stream %" PRIu64 " aborted since it is already marked as closed", stream->stream_handle);
+               DBG("closing stream %" PRIu64 " aborted since it is already marked as closed",
+                   stream->stream_handle);
                return;
        }
 
@@ -931,8 +929,8 @@ void try_stream_close(struct relay_stream *stream)
        }
 
        if (stream->last_net_seq_num != -1ULL &&
-                       ((int64_t) (stream->prev_data_seq - stream->last_net_seq_num)) < 0
-                       && !session_aborted) {
+           ((int64_t) (stream->prev_data_seq - stream->last_net_seq_num)) < 0 &&
+           !session_aborted) {
                /*
                 * Don't close since we still have data pending. This
                 * handles cases where an explicit close command has
@@ -950,7 +948,8 @@ void try_stream_close(struct relay_stream *stream)
                 * expected behavior.
                 */
                pthread_mutex_unlock(&stream->lock);
-               DBG("closing stream %" PRIu64 " aborted since it still has data pending", stream->stream_handle);
+               DBG("closing stream %" PRIu64 " aborted since it still has data pending",
+                   stream->stream_handle);
                return;
        }
        /*
@@ -986,16 +985,17 @@ void try_stream_close(struct relay_stream *stream)
        stream_put(stream);
 }
 
-int stream_init_packet(struct relay_stream *stream, size_t packet_size,
-               bool *file_rotated)
+int stream_init_packet(struct relay_stream *stream, size_t packet_size, bool *file_rotated)
 {
        int ret = 0;
 
        ASSERT_LOCKED(stream->lock);
 
        if (!stream->file || !stream->trace_chunk) {
-               ERR("Protocol error: received a packet for a stream that doesn't have a current trace chunk: stream_id = %" PRIu64 ", channel_name = %s",
-                               stream->stream_handle, stream->channel_name);
+               ERR("Protocol error: received a packet for a stream that doesn't have a current trace chunk: stream_id = %" PRIu64
+                   ", channel_name = %s",
+                   stream->stream_handle,
+                   stream->channel_name);
                ret = -1;
                goto end;
        }
@@ -1008,34 +1008,34 @@ int stream_init_packet(struct relay_stream *stream, size_t packet_size,
        /*
         * Check if writing the new packet would exceed the maximal file size.
         */
-       if (caa_unlikely((stream->tracefile_size_current + packet_size) >
-                       stream->tracefile_size)) {
+       if (caa_unlikely((stream->tracefile_size_current + packet_size) > stream->tracefile_size)) {
                const uint64_t new_file_index =
-                               (stream->tracefile_current_index + 1) %
-                               stream->tracefile_count;
+                       (stream->tracefile_current_index + 1) % stream->tracefile_count;
 
                if (new_file_index < stream->tracefile_current_index) {
                        stream->tracefile_wrapped_around = true;
                }
                DBG("New stream packet causes stream file rotation: stream_id = %" PRIu64
-                               ", current_file_size = %" PRIu64
-                               ", packet_size = %zu, current_file_index = %" PRIu64
-                               " new_file_index = %" PRIu64,
-                               stream->stream_handle,
-                               stream->tracefile_size_current, packet_size,
-                               stream->tracefile_current_index, new_file_index);
+                   ", current_file_size = %" PRIu64
+                   ", packet_size = %zu, current_file_index = %" PRIu64
+                   " new_file_index = %" PRIu64,
+                   stream->stream_handle,
+                   stream->tracefile_size_current,
+                   packet_size,
+                   stream->tracefile_current_index,
+                   new_file_index);
                tracefile_array_file_rotate(stream->tfa, TRACEFILE_ROTATE_WRITE);
                stream->tracefile_current_index = new_file_index;
 
                if (stream->file) {
-                       fs_handle_close(stream->file);
+                       fs_handle_close(stream->file);
                        stream->file = NULL;
                }
-               ret = stream_create_data_output_file_from_trace_chunk(stream,
-                               stream->trace_chunk, false, &stream->file);
+               ret = stream_create_data_output_file_from_trace_chunk(
+                       stream, stream->trace_chunk, false, &stream->file);
                if (ret) {
                        ERR("Failed to perform trace file rotation of stream %" PRIu64,
-                                       stream->stream_handle);
+                           stream->stream_handle);
                        goto end;
                }
 
@@ -1044,7 +1044,9 @@ int stream_init_packet(struct relay_stream *stream, size_t packet_size,
                 * rotation.
                 */
                DBG("%s: reset tracefile_size_current for stream %" PRIu64 " was %" PRIu64,
-                       __func__, stream->stream_handle, stream->tracefile_size_current);
+                   __func__,
+                   stream->stream_handle,
+                   stream->tracefile_size_current);
                stream->tracefile_size_current = 0;
                *file_rotated = true;
        } else {
@@ -1056,7 +1058,8 @@ end:
 
 /* Note that the packet is not necessarily complete. */
 int stream_write(struct relay_stream *stream,
-               const struct lttng_buffer_view *packet, size_t padding_len)
+                const struct lttng_buffer_view *packet,
+                size_t padding_len)
 {
        int ret = 0;
        ssize_t write_ret;
@@ -1064,22 +1067,22 @@ int stream_write(struct relay_stream *stream,
        char padding_buffer[FILE_IO_STACK_BUFFER_SIZE];
 
        ASSERT_LOCKED(stream->lock);
-       memset(padding_buffer, 0,
-                       std::min(sizeof(padding_buffer), padding_to_write));
+       memset(padding_buffer, 0, std::min(sizeof(padding_buffer), padding_to_write));
 
        if (!stream->file || !stream->trace_chunk) {
-               ERR("Protocol error: received a packet for a stream that doesn't have a current trace chunk: stream_id = %" PRIu64 ", channel_name = %s",
-                               stream->stream_handle, stream->channel_name);
+               ERR("Protocol error: received a packet for a stream that doesn't have a current trace chunk: stream_id = %" PRIu64
+                   ", channel_name = %s",
+                   stream->stream_handle,
+                   stream->channel_name);
                ret = -1;
                goto end;
        }
        if (packet) {
-               write_ret = fs_handle_write(
-                               stream->file, packet->data, packet->size);
+               write_ret = fs_handle_write(stream->file, packet->data, packet->size);
                if (write_ret != packet->size) {
                        PERROR("Failed to write to stream file of %sstream %" PRIu64,
-                                       stream->is_metadata ? "metadata " : "",
-                                       stream->stream_handle);
+                              stream->is_metadata ? "metadata " : "",
+                              stream->stream_handle);
                        ret = -1;
                        goto end;
                }
@@ -1087,14 +1090,14 @@ int stream_write(struct relay_stream *stream,
 
        while (padding_to_write > 0) {
                const size_t padding_to_write_this_pass =
-                               std::min(padding_to_write, sizeof(padding_buffer));
+                       std::min(padding_to_write, sizeof(padding_buffer));
 
-               write_ret = fs_handle_write(stream->file, padding_buffer,
-                               padding_to_write_this_pass);
+               write_ret =
+                       fs_handle_write(stream->file, padding_buffer, padding_to_write_this_pass);
                if (write_ret != padding_to_write_this_pass) {
                        PERROR("Failed to write padding to file of %sstream %" PRIu64,
-                                       stream->is_metadata ? "metadata " : "",
-                                       stream->stream_handle);
+                              stream->is_metadata ? "metadata " : "",
+                              stream->stream_handle);
                        ret = -1;
                        goto end;
                }
@@ -1113,9 +1116,10 @@ int stream_write(struct relay_stream *stream,
        }
 
        DBG("Wrote to %sstream %" PRIu64 ": data_length = %zu, padding_length = %zu",
-                       stream->is_metadata ? "metadata " : "",
-                       stream->stream_handle,
-                       packet ? packet->size : (size_t) 0, padding_len);
+           stream->is_metadata ? "metadata " : "",
+           stream->stream_handle,
+           packet ? packet->size : (size_t) 0,
+           padding_len);
 end:
        return ret;
 }
@@ -1127,8 +1131,11 @@ end:
  *
  * Return 0 on success else a negative value.
  */
-int stream_update_index(struct relay_stream *stream, uint64_t net_seq_num,
-               bool rotate_index, bool *flushed, uint64_t total_size)
+int stream_update_index(struct relay_stream *stream,
+                       uint64_t net_seq_num,
+                       bool rotate_index,
+                       bool *flushed,
+                       uint64_t total_size)
 {
        int ret = 0;
        uint64_t data_offset;
@@ -1140,7 +1147,9 @@ int stream_update_index(struct relay_stream *stream, uint64_t net_seq_num,
        data_offset = htobe64(stream->tracefile_size_current);
 
        DBG("handle_index_data: stream %" PRIu64 " net_seq_num %" PRIu64 " data offset %" PRIu64,
-                       stream->stream_handle, net_seq_num, stream->tracefile_size_current);
+           stream->stream_handle,
+           net_seq_num,
+           stream->tracefile_size_current);
 
        /*
         * Lookup for an existing index for that stream id/sequence
@@ -1157,7 +1166,7 @@ int stream_update_index(struct relay_stream *stream, uint64_t net_seq_num,
                ret = create_index_file(stream, stream->trace_chunk);
                if (ret) {
                        ERR("Failed to create index file for stream %" PRIu64,
-                                       stream->stream_handle);
+                           stream->stream_handle);
                        /* Put self-ref for this index due to error. */
                        relay_index_put(index);
                        index = NULL;
@@ -1179,7 +1188,7 @@ int stream_update_index(struct relay_stream *stream, uint64_t net_seq_num,
                tracefile_array_commit_seq(stream->tfa, stream->index_received_seqcount);
                stream->index_received_seqcount++;
                LTTNG_OPTIONAL_SET(&stream->received_packet_seq_num,
-                       be64toh(index->index_data.packet_seq_num));
+                                  be64toh(index->index_data.packet_seq_num));
                *flushed = true;
        } else if (ret > 0) {
                index->total_size = total_size;
@@ -1199,8 +1208,10 @@ end:
        return ret;
 }
 
-int stream_complete_packet(struct relay_stream *stream, size_t packet_total_size,
-               uint64_t sequence_number, bool index_flushed)
+int stream_complete_packet(struct relay_stream *stream,
+                          size_t packet_total_size,
+                          uint64_t sequence_number,
+                          bool index_flushed)
 {
        int ret = 0;
 
@@ -1208,8 +1219,7 @@ int stream_complete_packet(struct relay_stream *stream, size_t packet_total_size
 
        stream->tracefile_size_current += packet_total_size;
        if (index_flushed) {
-               stream->pos_after_last_complete_data_index =
-                               stream->tracefile_size_current;
+               stream->pos_after_last_complete_data_index = stream->tracefile_size_current;
                stream->prev_index_seq = sequence_number;
                ret = try_rotate_stream_index(stream);
                if (ret < 0) {
@@ -1224,8 +1234,7 @@ end:
        return ret;
 }
 
-int stream_add_index(struct relay_stream *stream,
-               const struct lttcomm_relayd_index *index_info)
+int stream_add_index(struct relay_stream *stream, const struct lttcomm_relayd_index *index_info)
 {
        int ret = 0;
        struct relay_index *index;
@@ -1236,15 +1245,13 @@ int stream_add_index(struct relay_stream *stream,
 
        /* Live beacon handling */
        if (index_info->packet_size == 0) {
-               DBG("Received live beacon for stream %" PRIu64,
-                               stream->stream_handle);
+               DBG("Received live beacon for stream %" PRIu64, stream->stream_handle);
 
                /*
                 * Only flag a stream inactive when it has already
                 * received data and no indexes are in flight.
                 */
-               if (stream->index_received_seqcount > 0
-                               && stream->indexes_in_flight == 0) {
+               if (stream->index_received_seqcount > 0 && stream->indexes_in_flight == 0) {
                        stream->beacon_ts_end = index_info->timestamp_end;
                }
                ret = 0;
@@ -1260,12 +1267,10 @@ int stream_add_index(struct relay_stream *stream,
        index = relay_index_get_by_id_or_create(stream, index_info->net_seq_num);
        if (!index) {
                ret = -1;
-               ERR("Failed to get or create index %" PRIu64,
-                               index_info->net_seq_num);
+               ERR("Failed to get or create index %" PRIu64, index_info->net_seq_num);
                goto end;
        }
-       if (relay_index_set_control_data(index, index_info,
-                       stream->trace->session->minor)) {
+       if (relay_index_set_control_data(index, index_info, stream->trace->session->minor)) {
                ERR("set_index_control_data error");
                relay_index_put(index);
                ret = -1;
@@ -1278,8 +1283,7 @@ int stream_add_index(struct relay_stream *stream,
                stream->index_received_seqcount++;
                stream->pos_after_last_complete_data_index += index->total_size;
                stream->prev_index_seq = index_info->net_seq_num;
-               LTTNG_OPTIONAL_SET(&stream->received_packet_seq_num,
-                               index_info->packet_seq_num);
+               LTTNG_OPTIONAL_SET(&stream->received_packet_seq_num, index_info->packet_seq_num);
 
                ret = try_rotate_stream_index(stream);
                if (ret < 0) {
@@ -1312,17 +1316,15 @@ static void print_stream_indexes(struct relay_stream *stream)
        struct relay_index *index;
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(stream->indexes_ht->ht, &iter.iter, index,
-                       index_n.node) {
+       cds_lfht_for_each_entry (stream->indexes_ht->ht, &iter.iter, index, index_n.node) {
                DBG("index %p net_seq_num %" PRIu64 " refcount %ld"
-                               " stream %" PRIu64 " trace %" PRIu64
-                               " session %" PRIu64,
-                               index,
-                               index->index_n.key,
-                               stream->ref.refcount,
-                               index->stream->stream_handle,
-                               index->stream->trace->id,
-                               index->stream->trace->session->id);
+                   " stream %" PRIu64 " trace %" PRIu64 " session %" PRIu64,
+                   index,
+                   index->index_n.key,
+                   stream->ref.refcount,
+                   index->stream->stream_handle,
+                   index->stream->trace->id,
+                   index->stream->trace->session->id);
        }
        rcu_read_unlock();
 }
@@ -1337,14 +1339,16 @@ int stream_reset_file(struct relay_stream *stream)
                ret = fs_handle_close(stream->file);
                if (ret) {
                        ERR("Failed to close stream file handle: channel name = \"%s\", id = %" PRIu64,
-                                       stream->channel_name,
-                                       stream->stream_handle);
+                           stream->channel_name,
+                           stream->stream_handle);
                }
                stream->file = NULL;
        }
 
        DBG("%s: reset tracefile_size_current for stream %" PRIu64 " was %" PRIu64,
-                       __func__, stream->stream_handle, stream->tracefile_size_current);
+           __func__,
+           stream->stream_handle,
+           stream->tracefile_size_current);
        stream->tracefile_size_current = 0;
        stream->prev_data_seq = 0;
        stream->prev_index_seq = 0;
@@ -1352,8 +1356,8 @@ int stream_reset_file(struct relay_stream *stream)
        stream->tracefile_current_index = 0;
        stream->pos_after_last_complete_data_index = 0;
 
-       return stream_create_data_output_file_from_trace_chunk(stream,
-                       stream->trace_chunk, true, &stream->file);
+       return stream_create_data_output_file_from_trace_chunk(
+               stream, stream->trace_chunk, true, &stream->file);
 }
 
 void print_relay_streams(void)
@@ -1366,18 +1370,16 @@ void print_relay_streams(void)
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(relay_streams_ht->ht, &iter.iter, stream,
-                       node.node) {
+       cds_lfht_for_each_entry (relay_streams_ht->ht, &iter.iter, stream, node.node) {
                if (!stream_get(stream)) {
                        continue;
                }
-               DBG("stream %p refcount %ld stream %" PRIu64 " trace %" PRIu64
-                               " session %" PRIu64,
-                               stream,
-                               stream->ref.refcount,
-                               stream->stream_handle,
-                               stream->trace->id,
-                               stream->trace->session->id);
+               DBG("stream %p refcount %ld stream %" PRIu64 " trace %" PRIu64 " session %" PRIu64,
+                   stream,
+                   stream->ref.refcount,
+                   stream->stream_handle,
+                   stream->trace->id,
+                   stream->trace->session->id);
                print_stream_indexes(stream);
                stream_put(stream);
        }
index d632b77426966c7bbc80c7659e93b88cf3660455..dec536ed1f6385dd8c25a2e8a53a9cb192d193ca 100644 (file)
@@ -5,34 +5,34 @@
  *
  */
 
-#include <sys/types.h>
-#include <netinet/tcp.h>
-#include <stdbool.h>
-#include <sys/socket.h>
-#include <limits.h>
+#include "tcp_keep_alive.hpp"
 
 #include <common/compat/getenv.hpp>
-#include <common/time.hpp>
 #include <common/defaults.hpp>
 #include <common/ini-config/ini-config.hpp>
+#include <common/time.hpp>
 
-#include "tcp_keep_alive.hpp"
+#include <limits.h>
+#include <netinet/tcp.h>
+#include <stdbool.h>
+#include <sys/socket.h>
+#include <sys/types.h>
 
-#define SOLARIS_IDLE_TIME_MIN_S 10
-#define SOLARIS_IDLE_TIME_MAX_S 864000 /* 10 days */
+#define SOLARIS_IDLE_TIME_MIN_S              10
+#define SOLARIS_IDLE_TIME_MAX_S              864000 /* 10 days */
 #define SOLARIS_ABORT_THRESHOLD_MIN_S 1
 #define SOLARIS_ABORT_THRESHOLD_MAX_S 480 /* 8 minutes */
 
 /* Per-platform definitions of TCP socket options. */
-#if defined (__linux__)
+#if defined(__linux__)
 
-#define COMPAT_TCP_LEVEL SOL_TCP
+#define COMPAT_TCP_LEVEL          SOL_TCP
 #define COMPAT_TCP_ABORT_THRESHOLD 0 /* Does not exist on linux. */
-#define COMPAT_TCP_KEEPIDLE TCP_KEEPIDLE
-#define COMPAT_TCP_KEEPINTVL TCP_KEEPINTVL
-#define COMPAT_TCP_KEEPCNT TCP_KEEPCNT
+#define COMPAT_TCP_KEEPIDLE       TCP_KEEPIDLE
+#define COMPAT_TCP_KEEPINTVL      TCP_KEEPINTVL
+#define COMPAT_TCP_KEEPCNT        TCP_KEEPCNT
 
-#elif defined (__sun__) /* ! defined (__linux__) */
+#elif defined(__sun__) /* ! defined (__linux__) */
 
 #define COMPAT_TCP_LEVEL IPPROTO_TCP
 
 #endif /* TCP_KEEPALIVE_ABORT_THRESHOLD */
 
 #define COMPAT_TCP_KEEPINTVL 0 /* Does not exist on Solaris. */
-#define COMPAT_TCP_KEEPCNT 0 /* Does not exist on Solaris. */
+#define COMPAT_TCP_KEEPCNT   0 /* Does not exist on Solaris. */
 
 #else /* ! defined (__linux__) && ! defined (__sun__) */
 
-#define COMPAT_TCP_LEVEL 0
+#define COMPAT_TCP_LEVEL          0
 #define COMPAT_TCP_ABORT_THRESHOLD 0
-#define COMPAT_TCP_KEEPIDLE 0
-#define COMPAT_TCP_KEEPINTVL 0
-#define COMPAT_TCP_KEEPCNT 0
+#define COMPAT_TCP_KEEPIDLE       0
+#define COMPAT_TCP_KEEPINTVL      0
+#define COMPAT_TCP_KEEPCNT        0
 
 #endif /* ! defined (__linux__) && ! defined (__sun__) */
 
@@ -106,17 +106,17 @@ struct tcp_keep_alive_config {
        int abort_threshold;
 };
 
-struct tcp_keep_alive_config the_config = {.enabled = false,
-               .idle_time = -1,
-               .probe_interval = -1,
-               .max_probe_count = -1,
-               .abort_threshold = -1};
-
-struct tcp_keep_alive_support the_support = {.supported = false,
-               .idle_time_supported = false,
-               .probe_interval_supported = false,
-               .max_probe_count_supported = false,
-               .abort_threshold_supported = false};
+struct tcp_keep_alive_config the_config = { .enabled = false,
+                                           .idle_time = -1,
+                                           .probe_interval = -1,
+                                           .max_probe_count = -1,
+                                           .abort_threshold = -1 };
+
+struct tcp_keep_alive_support the_support = { .supported = false,
+                                             .idle_time_supported = false,
+                                             .probe_interval_supported = false,
+                                             .max_probe_count_supported = false,
+                                             .abort_threshold_supported = false };
 } /* namespace */
 
 /*
@@ -125,9 +125,7 @@ struct tcp_keep_alive_support the_support = {.supported = false,
  *
  * Returns -2 on invalid value.
  */
-static
-int get_env_int(const char *env_var,
-               const char *value)
+static int get_env_int(const char *env_var, const char *value)
 {
        int ret;
        long tmp;
@@ -143,9 +141,9 @@ int get_env_int(const char *env_var,
        }
 
        if (endptr == value || *endptr != '\0') {
-           ERR("%s is not a valid number", env_var);
-           ret = -1;
-           goto end;
+               ERR("%s is not a valid number", env_var);
+               ret = -1;
+               goto end;
        }
 
        if (tmp < -1) {
@@ -153,7 +151,7 @@ int get_env_int(const char *env_var,
                ret = -2;
                goto end;
        }
-       if (tmp > INT_MAX){
+       if (tmp > INT_MAX) {
                ERR("%s is too big. Maximum value is %d", env_var, INT_MAX);
                ret = -2;
                goto end;
@@ -170,8 +168,7 @@ end:
  */
 #ifdef __sun__
 
-static
-int convert_idle_time(int value)
+static int convert_idle_time(int value)
 {
        int ret;
        unsigned int tmp_ms;
@@ -193,26 +190,24 @@ int convert_idle_time(int value)
         * Minimum 10s, maximum 10 days. Defined by
         * https://docs.oracle.com/cd/E23824_01/html/821-1475/tcp-7p.html#REFMAN7tcp-7p
         */
-       if ((value < SOLARIS_IDLE_TIME_MIN_S ||
-                       value > SOLARIS_IDLE_TIME_MAX_S)) {
+       if ((value < SOLARIS_IDLE_TIME_MIN_S || value > SOLARIS_IDLE_TIME_MAX_S)) {
                ERR("%s must be comprised between %d and %d inclusively on Solaris",
-                               DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME_ENV,
-                               SOLARIS_IDLE_TIME_MIN_S,
-                               SOLARIS_IDLE_TIME_MAX_S);
+                   DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME_ENV,
+                   SOLARIS_IDLE_TIME_MIN_S,
+                   SOLARIS_IDLE_TIME_MAX_S);
                ret = -2;
                goto end;
        }
 
        /* On Solaris idle time is given in milliseconds. */
        tmp_ms = ((unsigned int) value) * MSEC_PER_SEC;
-       if ((value != 0 && (tmp_ms / ((unsigned int) value)) != MSEC_PER_SEC)
-                       || tmp_ms > INT_MAX) {
+       if ((value != 0 && (tmp_ms / ((unsigned int) value)) != MSEC_PER_SEC) || tmp_ms > INT_MAX) {
                /* Overflow. */
                const int max_value = INT_MAX / MSEC_PER_SEC;
 
                ERR("%s is too big: maximum supported value is %d",
-                               DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME_ENV,
-                               max_value);
+                   DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME_ENV,
+                   max_value);
                ret = -2;
                goto end;
        }
@@ -225,8 +220,7 @@ end:
 
 #else /* ! defined(__sun__) */
 
-static
-int convert_idle_time(int value)
+static int convert_idle_time(int value)
 {
        return value;
 }
@@ -234,10 +228,9 @@ int convert_idle_time(int value)
 #endif /* ! defined(__sun__) */
 
 /* Per-platform support of tcp_keep_alive functionality. */
-#if defined (__linux__)
+#if defined(__linux__)
 
-static
-void tcp_keep_alive_init_support(struct tcp_keep_alive_support *support)
+static void tcp_keep_alive_init_support(struct tcp_keep_alive_support *support)
 {
        support->supported = true;
        support->idle_time_supported = true;
@@ -249,14 +242,14 @@ void tcp_keep_alive_init_support(struct tcp_keep_alive_support *support)
 
 #elif defined(__sun__) /* ! defined (__linux__) */
 
-static
-void tcp_keep_alive_init_support(struct tcp_keep_alive_support *support)
+static void tcp_keep_alive_init_support(struct tcp_keep_alive_support *support)
 {
        support->supported = true;
 #ifdef TCP_KEEPALIVE_THRESHOLD
        support->idle_time_supported = true;
 #else
-       support->idle_time_supported = false;;
+       support->idle_time_supported = false;
+       ;
 #endif /* TCP_KEEPALIVE_THRESHOLD */
 
        /*
@@ -282,8 +275,7 @@ void tcp_keep_alive_init_support(struct tcp_keep_alive_support *support)
 #else /* ! defined(__sun__) && ! defined(__linux__) */
 
 /* Assume nothing is supported on other platforms. */
-static
-void tcp_keep_alive_init_support(struct tcp_keep_alive_support *support)
+static void tcp_keep_alive_init_support(struct tcp_keep_alive_support *support)
 {
        support->supported = false;
        support->idle_time_supported = false;
@@ -300,8 +292,7 @@ void tcp_keep_alive_init_support(struct tcp_keep_alive_support *support)
  * Solaris specific modifier for abort threshold.
  * Return -2 on error.
  */
-static
-int convert_abort_threshold(int value)
+static int convert_abort_threshold(int value)
 {
        int ret;
        unsigned int tmp_ms;
@@ -330,23 +321,22 @@ int convert_abort_threshold(int value)
         */
        if ((value < SOLARIS_ABORT_THRESHOLD_MIN_S || value > SOLARIS_ABORT_THRESHOLD_MAX_S)) {
                ERR("%s must be comprised between %d and %d inclusively on Solaris",
-                               DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV,
-                               SOLARIS_ABORT_THRESHOLD_MIN_S,
-                               SOLARIS_ABORT_THRESHOLD_MAX_S);
+                   DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV,
+                   SOLARIS_ABORT_THRESHOLD_MIN_S,
+                   SOLARIS_ABORT_THRESHOLD_MAX_S);
                ret = -2;
                goto end;
        }
 
        /* Abort threshold is given in milliseconds. */
        tmp_ms = ((unsigned int) value) * MSEC_PER_SEC;
-       if ((value != 0 && (tmp_ms / ((unsigned int) value)) != MSEC_PER_SEC)
-                       || tmp_ms > INT_MAX) {
+       if ((value != 0 && (tmp_ms / ((unsigned int) value)) != MSEC_PER_SEC) || tmp_ms > INT_MAX) {
                /* Overflow */
                const int max_value = INT_MAX / MSEC_PER_SEC;
 
                ERR("%s is too big: maximum supported value is %d",
-                               DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV,
-                               max_value);
+                   DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV,
+                   max_value);
                ret = -2;
                goto end;
        }
@@ -359,8 +349,7 @@ end:
 
 #else
 
-static
-int convert_abort_threshold(int value)
+static int convert_abort_threshold(int value)
 {
        return value;
 }
@@ -371,9 +360,8 @@ int convert_abort_threshold(int value)
  * Retrieve settings from environment variables and warn for settings not
  * supported by the platform.
  */
-static
-int tcp_keep_alive_init_config(struct tcp_keep_alive_support *support,
-               struct tcp_keep_alive_config *config)
+static int tcp_keep_alive_init_config(struct tcp_keep_alive_support *support,
+                                     struct tcp_keep_alive_config *config)
 {
        int ret;
        const char *value;
@@ -382,7 +370,7 @@ int tcp_keep_alive_init_config(struct tcp_keep_alive_support *support,
        if (!support->supported) {
                if (value) {
                        WARN("Using per-socket TCP keep-alive mechanism is not supported by this platform. Ignoring the %s environment variable.",
-                                       DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ENV);
+                            DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ENV);
                }
                config->enabled = false;
        } else if (value) {
@@ -394,21 +382,20 @@ int tcp_keep_alive_init_config(struct tcp_keep_alive_support *support,
                }
                config->enabled = ret;
        }
-       DBG("TCP keep-alive mechanism %s", config->enabled ? "enabled": "disabled");
+       DBG("TCP keep-alive mechanism %s", config->enabled ? "enabled" : "disabled");
 
        /* Get value for tcp_keepalive_time in seconds. */
        value = lttng_secure_getenv(DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME_ENV);
        if (!support->idle_time_supported && value) {
                WARN("Overriding the TCP keep-alive idle time threshold per-socket is not supported by this platform. Ignoring the %s environment variable.",
-                               DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME_ENV);
+                    DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME_ENV);
                config->idle_time = -1;
        } else if (value) {
                int idle_time_platform;
                int idle_time_seconds;
 
-               idle_time_seconds = get_env_int(
-                               DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME_ENV,
-                               value);
+               idle_time_seconds =
+                       get_env_int(DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME_ENV, value);
                if (idle_time_seconds < -1) {
                        ret = 1;
                        goto error;
@@ -422,22 +409,21 @@ int tcp_keep_alive_init_config(struct tcp_keep_alive_support *support,
 
                config->idle_time = idle_time_platform;
                DBG("Overriding %s to %d",
-                               DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME_ENV,
-                               idle_time_seconds);
+                   DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME_ENV,
+                   idle_time_seconds);
        }
 
        /* Get value for tcp_keepalive_intvl in seconds. */
-       value = lttng_secure_getenv(
-                       DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL_ENV);
+       value = lttng_secure_getenv(DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL_ENV);
        if (!support->probe_interval_supported && value) {
                WARN("Overriding the TCP keep-alive probe interval time per-socket is not supported by this platform. Ignoring the %s environment variable.",
-                               DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL_ENV);
+                    DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL_ENV);
                config->probe_interval = -1;
        } else if (value) {
                int probe_interval;
 
-               probe_interval = get_env_int(DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL_ENV,
-                               value);
+               probe_interval =
+                       get_env_int(DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL_ENV, value);
                if (probe_interval < -1) {
                        ret = 1;
                        goto error;
@@ -445,21 +431,21 @@ int tcp_keep_alive_init_config(struct tcp_keep_alive_support *support,
 
                config->probe_interval = probe_interval;
                DBG("Overriding %s to %d",
-                               DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL_ENV,
-                               config->probe_interval);
+                   DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL_ENV,
+                   config->probe_interval);
        }
 
        /* Get value for tcp_keepalive_probes. */
        value = lttng_secure_getenv(DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT_ENV);
        if (!support->max_probe_count_supported && value) {
                WARN("Overriding the TCP keep-alive maximum probe count per-socket is not supported by this platform. Ignoring the %s environment variable.",
-                                DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT_ENV);
+                    DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT_ENV);
                config->max_probe_count = -1;
        } else if (value) {
                int max_probe_count;
 
-               max_probe_count = get_env_int(DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT_ENV,
-                               value);
+               max_probe_count =
+                       get_env_int(DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT_ENV, value);
                if (max_probe_count < -1) {
                        ret = 1;
                        goto error;
@@ -467,31 +453,28 @@ int tcp_keep_alive_init_config(struct tcp_keep_alive_support *support,
 
                config->max_probe_count = max_probe_count;
                DBG("Overriding %s to %d",
-                               DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT_ENV,
-                               config->max_probe_count);
+                   DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT_ENV,
+                   config->max_probe_count);
        }
 
        /* Get value for tcp_keepalive_abort_interval. */
-       value = lttng_secure_getenv(
-                       DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV);
+       value = lttng_secure_getenv(DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV);
        if (!support->abort_threshold_supported && value) {
                WARN("Overriding the TCP keep-alive abort threshold per-socket is not supported by this platform. Ignoring the %s environment variable.",
-                               DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV);
+                    DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV);
                config->abort_threshold = -1;
        } else if (value) {
                int abort_threshold_platform;
                int abort_threshold_seconds;
 
-               abort_threshold_seconds = get_env_int(
-                               DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT_ENV,
-                               value);
+               abort_threshold_seconds =
+                       get_env_int(DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT_ENV, value);
                if (abort_threshold_seconds < -1) {
                        ret = 1;
                        goto error;
                }
 
-               abort_threshold_platform = convert_abort_threshold(
-                               abort_threshold_seconds);
+               abort_threshold_platform = convert_abort_threshold(abort_threshold_seconds);
                if (abort_threshold_platform < -1) {
                        ret = 1;
                        goto error;
@@ -499,8 +482,8 @@ int tcp_keep_alive_init_config(struct tcp_keep_alive_support *support,
 
                config->abort_threshold = abort_threshold_platform;
                DBG("Overriding %s to %d",
-                               DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV,
-                               config->abort_threshold);
+                   DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV,
+                   config->abort_threshold);
        }
 
        ret = 0;
@@ -510,8 +493,7 @@ error:
 }
 
 /* Initialize the TCP keep-alive configuration. */
-__attribute__((constructor)) static
-void tcp_keep_alive_init(void)
+__attribute__((constructor)) static void tcp_keep_alive_init(void)
 {
        tcp_keep_alive_init_support(&the_support);
        (void) tcp_keep_alive_init_config(&the_support, &the_config);
@@ -532,8 +514,7 @@ int socket_apply_keep_alive_config(int socket_fd)
        }
 
        DBG("TCP keep-alive enabled for socket %d", socket_fd);
-       ret = setsockopt(socket_fd, SOL_SOCKET, SO_KEEPALIVE, &val,
-                       sizeof(val));
+       ret = setsockopt(socket_fd, SOL_SOCKET, SO_KEEPALIVE, &val, sizeof(val));
        if (ret < 0) {
                PERROR("setsockopt so_keepalive");
                goto end;
@@ -542,24 +523,28 @@ int socket_apply_keep_alive_config(int socket_fd)
        /* TCP keep-alive idle time */
        if (the_support.idle_time_supported && the_config.idle_time > 0) {
                DBG("TCP keep-alive keep idle: %d enabled for socket %d",
-                               the_config.idle_time, socket_fd);
-               ret = setsockopt(socket_fd, COMPAT_TCP_LEVEL,
-                               COMPAT_TCP_KEEPIDLE, &the_config.idle_time,
-                               sizeof(the_config.idle_time));
+                   the_config.idle_time,
+                   socket_fd);
+               ret = setsockopt(socket_fd,
+                                COMPAT_TCP_LEVEL,
+                                COMPAT_TCP_KEEPIDLE,
+                                &the_config.idle_time,
+                                sizeof(the_config.idle_time));
                if (ret < 0) {
                        PERROR("setsockopt TCP_KEEPIDLE");
                        goto end;
                }
        }
        /* TCP keep-alive probe interval */
-       if (the_support.probe_interval_supported &&
-                       the_config.probe_interval > 0) {
+       if (the_support.probe_interval_supported && the_config.probe_interval > 0) {
                DBG("TCP keep-alive probe_interval: %d enabled for socket %d",
-                               the_config.probe_interval, socket_fd);
-               ret = setsockopt(socket_fd, COMPAT_TCP_LEVEL,
-                               COMPAT_TCP_KEEPINTVL,
-                               &the_config.probe_interval,
-                               sizeof(the_config.probe_interval));
+                   the_config.probe_interval,
+                   socket_fd);
+               ret = setsockopt(socket_fd,
+                                COMPAT_TCP_LEVEL,
+                                COMPAT_TCP_KEEPINTVL,
+                                &the_config.probe_interval,
+                                sizeof(the_config.probe_interval));
                if (ret < 0) {
                        PERROR("setsockopt TCP_KEEPINTVL");
                        goto end;
@@ -567,13 +552,15 @@ int socket_apply_keep_alive_config(int socket_fd)
        }
 
        /* TCP keep-alive max probe count */
-       if (the_support.max_probe_count_supported &&
-                       the_config.max_probe_count > 0) {
+       if (the_support.max_probe_count_supported && the_config.max_probe_count > 0) {
                DBG("TCP keep-alive max_probe: %d enabled for socket %d",
-                               the_config.max_probe_count, socket_fd);
-               ret = setsockopt(socket_fd, COMPAT_TCP_LEVEL,
-                               COMPAT_TCP_KEEPCNT, &the_config.max_probe_count,
-                               sizeof(the_config.max_probe_count));
+                   the_config.max_probe_count,
+                   socket_fd);
+               ret = setsockopt(socket_fd,
+                                COMPAT_TCP_LEVEL,
+                                COMPAT_TCP_KEEPCNT,
+                                &the_config.max_probe_count,
+                                sizeof(the_config.max_probe_count));
                if (ret < 0) {
                        PERROR("setsockopt TCP_KEEPCNT");
                        goto end;
@@ -581,14 +568,15 @@ int socket_apply_keep_alive_config(int socket_fd)
        }
 
        /* TCP keep-alive abort threshold */
-       if (the_support.abort_threshold_supported &&
-                       the_config.abort_threshold > 0) {
+       if (the_support.abort_threshold_supported && the_config.abort_threshold > 0) {
                DBG("TCP keep-alive abort threshold: %d enabled for socket %d",
-                               the_config.abort_threshold, socket_fd);
-               ret = setsockopt(socket_fd, COMPAT_TCP_LEVEL,
-                               COMPAT_TCP_ABORT_THRESHOLD,
-                               &the_config.abort_threshold,
-                               sizeof(the_config.max_probe_count));
+                   the_config.abort_threshold,
+                   socket_fd);
+               ret = setsockopt(socket_fd,
+                                COMPAT_TCP_LEVEL,
+                                COMPAT_TCP_ABORT_THRESHOLD,
+                                &the_config.abort_threshold,
+                                sizeof(the_config.max_probe_count));
                if (ret < 0) {
                        PERROR("setsockopt TCP_KEEPALIVE_ABORT_THRESHOLD");
                        goto end;
index 25ea256d5a31100d1b6c9429f89d04744abeb5bb..fc6c64dbd55cf47b17dbd6e56b31bc53c9a5b5d8 100644 (file)
@@ -42,7 +42,7 @@ static int notify_thread_pipe(int wpipe)
 int relayd_init_thread_quit_pipe(void)
 {
        return fd_tracker_util_pipe_open_cloexec(
-                       the_fd_tracker, "Thread quit pipe", thread_quit_pipe);
+               the_fd_tracker, "Thread quit pipe", thread_quit_pipe);
 }
 
 /*
@@ -61,8 +61,7 @@ int relayd_notify_thread_quit_pipe(void)
 void relayd_close_thread_quit_pipe(void)
 {
        if (thread_quit_pipe[0] != -1) {
-               (void) fd_tracker_util_pipe_close(
-                               the_fd_tracker, thread_quit_pipe);
+               (void) fd_tracker_util_pipe_close(the_fd_tracker, thread_quit_pipe);
        }
 }
 
@@ -77,15 +76,14 @@ bool relayd_is_thread_quit_pipe(const int fd)
 /*
  * Create a poll set with O_CLOEXEC and add the thread quit pipe to the set.
  */
-int create_named_thread_poll_set(struct lttng_poll_event *events,
-               int size, const char *name)
+int create_named_thread_poll_set(struct lttng_poll_event *events, int size, const char *name)
 {
        if (events == NULL || size == 0) {
                return -1;
        }
 
-       const auto create_ret = fd_tracker_util_poll_create(the_fd_tracker,
-                       name, events, 1, LTTNG_CLOEXEC);
+       const auto create_ret =
+               fd_tracker_util_poll_create(the_fd_tracker, name, events, 1, LTTNG_CLOEXEC);
        if (create_ret) {
                PERROR("Failed to create \"%s\" poll file descriptor", name);
                return -1;
index 73a2887941517275c4a860e89f71dab92585f3c8..07d5ee17f2f2c7a3f97eba57b4bfa76171569e45 100644 (file)
@@ -6,11 +6,11 @@
  */
 
 #define _LGPL_SOURCE
+#include "tracefile-array.hpp"
+
 #include <common/common.hpp>
-#include <common/utils.hpp>
 #include <common/defaults.hpp>
-
-#include "tracefile-array.hpp"
+#include <common/utils.hpp>
 
 struct tracefile_array *tracefile_array_create(size_t count)
 {
@@ -67,8 +67,7 @@ void tracefile_array_reset(struct tracefile_array *tfa)
        tfa->file_tail = 0;
 }
 
-void tracefile_array_file_rotate(struct tracefile_array *tfa,
-               enum tracefile_rotate_type type)
+void tracefile_array_file_rotate(struct tracefile_array *tfa, enum tracefile_rotate_type type)
 {
        uint64_t *headp, *tailp;
 
@@ -109,8 +108,7 @@ void tracefile_array_file_rotate(struct tracefile_array *tfa,
        }
 }
 
-void tracefile_array_commit_seq(struct tracefile_array *tfa,
-               uint64_t new_seq_head)
+void tracefile_array_commit_seq(struct tracefile_array *tfa, uint64_t new_seq_head)
 {
        uint64_t *headp, *tailp;
 
@@ -157,8 +155,7 @@ uint64_t tracefile_array_get_seq_tail(struct tracefile_array *tfa)
        return tfa->seq_tail;
 }
 
-bool tracefile_array_seq_in_file(struct tracefile_array *tfa,
-               uint64_t file_index, uint64_t seq)
+bool tracefile_array_seq_in_file(struct tracefile_array *tfa, uint64_t file_index, uint64_t seq)
 {
        if (!tfa->count) {
                /*
@@ -171,8 +168,7 @@ bool tracefile_array_seq_in_file(struct tracefile_array *tfa,
        if (seq == -1ULL) {
                return false;
        }
-       if (seq >= tfa->tf[file_index].seq_tail
-                       && seq <= tfa->tf[file_index].seq_head) {
+       if (seq >= tfa->tf[file_index].seq_tail && seq <= tfa->tf[file_index].seq_head) {
                return true;
        } else {
                return false;
index ccfc3a92a745f85a68848556f78529f47ebc2a9e..6ea98ec7cea8ea15c59b05a283764a3ce4d44982 100644 (file)
@@ -7,17 +7,17 @@
  */
 
 #define _LGPL_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "lttng-relayd.hpp"
+#include "utils.hpp"
 
 #include <common/common.hpp>
 #include <common/defaults.hpp>
-#include <common/utils.hpp>
 #include <common/path.hpp>
+#include <common/utils.hpp>
 
-#include "lttng-relayd.hpp"
-#include "utils.hpp"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 static char *create_output_path_auto(const char *path_name)
 {
@@ -31,8 +31,7 @@ static char *create_output_path_auto(const char *path_name)
                                Please specify an output path using -o, --output PATH");
                goto exit;
        }
-       ret = asprintf(&traces_path, "%s/" DEFAULT_TRACE_DIR_NAME
-                       "/%s", default_path, path_name);
+       ret = asprintf(&traces_path, "%s/" DEFAULT_TRACE_DIR_NAME "/%s", default_path, path_name);
        if (ret < 0) {
                PERROR("asprintf trace dir name");
                goto exit;
index 194073f598783e011cf8b852515e34dba05950a3..9d067577a04caedcaf6a90af8825365ec1bd9dc3 100644 (file)
@@ -8,15 +8,16 @@
  */
 
 #define _LGPL_SOURCE
-#include <common/common.hpp>
-#include <urcu/rculist.h>
-
-#include "lttng-relayd.hpp"
 #include "ctf-trace.hpp"
+#include "lttng-relayd.hpp"
 #include "session.hpp"
+#include "stream.hpp"
 #include "viewer-session.hpp"
 #include "viewer-stream.hpp"
-#include "stream.hpp"
+
+#include <common/common.hpp>
+
+#include <urcu/rculist.h>
 
 struct relay_viewer_session *viewer_session_create(void)
 {
@@ -32,7 +33,7 @@ end:
 }
 
 int viewer_session_set_trace_chunk_copy(struct relay_viewer_session *vsession,
-               struct lttng_trace_chunk *relay_session_trace_chunk)
+                                       struct lttng_trace_chunk *relay_session_trace_chunk)
 {
        int ret = 0;
        struct lttng_trace_chunk *viewer_chunk;
@@ -58,12 +59,10 @@ end:
 }
 
 /* The existence of session must be guaranteed by the caller. */
-enum lttng_viewer_attach_return_code viewer_session_attach(
-               struct relay_viewer_session *vsession,
-               struct relay_session *session)
+enum lttng_viewer_attach_return_code viewer_session_attach(struct relay_viewer_session *vsession,
+                                                          struct relay_session *session)
 {
-       enum lttng_viewer_attach_return_code viewer_attach_status =
-                       LTTNG_VIEWER_ATTACH_OK;
+       enum lttng_viewer_attach_return_code viewer_attach_status = LTTNG_VIEWER_ATTACH_OK;
 
        ASSERT_LOCKED(session->lock);
 
@@ -79,8 +78,7 @@ enum lttng_viewer_attach_return_code viewer_session_attach(
 
                session->viewer_attached = true;
 
-               ret = viewer_session_set_trace_chunk_copy(vsession,
-                               session->current_trace_chunk);
+               ret = viewer_session_set_trace_chunk_copy(vsession, session->current_trace_chunk);
                if (ret) {
                        /*
                         * The live protocol does not define a generic error
@@ -89,7 +87,7 @@ enum lttng_viewer_attach_return_code viewer_session_attach(
                         * failure as if the session didn't exist anymore.
                         */
                        DBG("Failed to create a viewer trace chunk from the current trace chunk of session \"%s\", returning LTTNG_VIEWER_ATTACH_UNK",
-                                       session->session_name);
+                           session->session_name);
                        viewer_attach_status = LTTNG_VIEWER_ATTACH_UNK;
                }
        }
@@ -97,8 +95,7 @@ enum lttng_viewer_attach_return_code viewer_session_attach(
        if (viewer_attach_status == LTTNG_VIEWER_ATTACH_OK) {
                pthread_mutex_lock(&vsession->session_list_lock);
                /* Ownership is transfered to the list. */
-               cds_list_add_rcu(&session->viewer_session_node,
-                               &vsession->session_list);
+               cds_list_add_rcu(&session->viewer_session_node, &vsession->session_list);
                pthread_mutex_unlock(&vsession->session_list_lock);
        } else {
                /* Put our local ref. */
@@ -110,7 +107,7 @@ end:
 
 /* The existence of session must be guaranteed by the caller. */
 static int viewer_session_detach(struct relay_viewer_session *vsession,
-               struct relay_session *session)
+                                struct relay_session *session)
 {
        int ret = 0;
 
@@ -143,7 +140,7 @@ void viewer_session_destroy(struct relay_viewer_session *vsession)
  * Release ownership of all the streams of one session and detach the viewer.
  */
 void viewer_session_close_one_session(struct relay_viewer_session *vsession,
-               struct relay_session *session)
+                                     struct relay_session *session)
 {
        struct lttng_ht_iter iter;
        struct relay_viewer_stream *vstream;
@@ -152,8 +149,7 @@ void viewer_session_close_one_session(struct relay_viewer_session *vsession,
         * TODO: improvement: create more efficient list of
         * vstream per session.
         */
-       cds_lfht_for_each_entry(viewer_streams_ht->ht, &iter.iter,
-                       vstream, stream_n.node) {
+       cds_lfht_for_each_entry (viewer_streams_ht->ht, &iter.iter, vstream, stream_n.node) {
                if (!viewer_stream_get(vstream)) {
                        continue;
                }
@@ -180,8 +176,8 @@ void viewer_session_close(struct relay_viewer_session *vsession)
        struct relay_session *session;
 
        rcu_read_lock();
-       cds_list_for_each_entry_rcu(session,
-                       &vsession->session_list, viewer_session_node) {
+       cds_list_for_each_entry_rcu(session, &vsession->session_list, viewer_session_node)
+       {
                viewer_session_close_one_session(vsession, session);
        }
        rcu_read_unlock();
@@ -191,8 +187,7 @@ void viewer_session_close(struct relay_viewer_session *vsession)
  * Check if a connection is attached to a session.
  * Return 1 if attached, 0 if not attached, a negative value on error.
  */
-int viewer_session_is_attached(struct relay_viewer_session *vsession,
-               struct relay_session *session)
+int viewer_session_is_attached(struct relay_viewer_session *vsession, struct relay_session *session)
 {
        struct relay_session *iter;
        int found = 0;
@@ -205,9 +200,8 @@ int viewer_session_is_attached(struct relay_viewer_session *vsession,
                goto end;
        }
        rcu_read_lock();
-       cds_list_for_each_entry_rcu(iter,
-                       &vsession->session_list,
-                       viewer_session_node) {
+       cds_list_for_each_entry_rcu(iter, &vsession->session_list, viewer_session_node)
+       {
                if (session == iter) {
                        found = 1;
                        goto end_rcu_unlock;
index f37d8e33040d991d7ea3ecd818508d1d9ac1f3f2..92be53e4f8b102de4f7c6b44ebe038eb90cf99e0 100644 (file)
@@ -8,17 +8,18 @@
  */
 
 #define _LGPL_SOURCE
+#include "lttng-relayd.hpp"
+#include "viewer-stream.hpp"
+
 #include <common/common.hpp>
-#include <common/index/index.hpp>
 #include <common/compat/string.hpp>
+#include <common/index/index.hpp>
 #include <common/utils.hpp>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <algorithm>
 
-#include "lttng-relayd.hpp"
-#include "viewer-stream.hpp"
+#include <algorithm>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 
 static void viewer_stream_release_composite_objects(struct relay_viewer_stream *vstream)
 {
@@ -55,8 +56,8 @@ static void viewer_stream_destroy_rcu(struct rcu_head *head)
 
 /* Relay stream's lock must be held by the caller. */
 struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
-               struct lttng_trace_chunk *trace_chunk,
-               enum lttng_viewer_seek seek_t)
+                                                struct lttng_trace_chunk *trace_chunk,
+                                                enum lttng_viewer_seek seek_t)
 {
        struct relay_viewer_stream *vstream = NULL;
 
@@ -69,8 +70,7 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
        }
 
        if (trace_chunk) {
-               const bool acquired_reference = lttng_trace_chunk_get(
-                               trace_chunk);
+               const bool acquired_reference = lttng_trace_chunk_get(trace_chunk);
 
                LTTNG_ASSERT(acquired_reference);
        }
@@ -81,8 +81,7 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
                PERROR("relay viewer path_name alloc");
                goto error;
        }
-       vstream->channel_name = lttng_strndup(stream->channel_name,
-                       LTTNG_VIEWER_NAME_MAX);
+       vstream->channel_name = lttng_strndup(stream->channel_name, LTTNG_VIEWER_NAME_MAX);
        if (vstream->channel_name == NULL) {
                PERROR("relay viewer channel_name alloc");
                goto error;
@@ -112,8 +111,7 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
                         */
                        seq_tail = 0;
                }
-               vstream->current_tracefile_id =
-                       tracefile_array_get_file_index_tail(stream->tfa);
+               vstream->current_tracefile_id = tracefile_array_get_file_index_tail(stream->tfa);
                vstream->index_sent_seqcount = seq_tail;
                break;
        }
@@ -127,8 +125,7 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
                 * We don't need to check the head position for -1ULL since the
                 * increment will set it to 0.
                 */
-               vstream->index_sent_seqcount =
-                               tracefile_array_get_seq_head(stream->tfa) + 1;
+               vstream->index_sent_seqcount = tracefile_array_get_seq_head(stream->tfa) + 1;
                break;
        default:
                goto error;
@@ -146,15 +143,15 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
                enum lttng_trace_chunk_status chunk_status;
 
                chunk_status = lttng_index_file_create_from_trace_chunk_read_only(
-                               vstream->stream_file.trace_chunk,
-                               stream->path_name,
-                               stream->channel_name, stream->tracefile_size,
-                               vstream->current_tracefile_id,
-                               lttng_to_index_major(connection_major,
-                                               connection_minor),
-                               lttng_to_index_minor(connection_major,
-                                               connection_minor),
-                               true, &vstream->index_file);
+                       vstream->stream_file.trace_chunk,
+                       stream->path_name,
+                       stream->channel_name,
+                       stream->tracefile_size,
+                       vstream->current_tracefile_id,
+                       lttng_to_index_major(connection_major, connection_minor),
+                       lttng_to_index_minor(connection_major, connection_minor),
+                       true,
+                       &vstream->index_file);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        if (chunk_status == LTTNG_TRACE_CHUNK_STATUS_NO_FILE) {
                                vstream->index_file = NULL;
@@ -174,17 +171,22 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
                enum lttng_trace_chunk_status status;
 
                ret = utils_stream_file_path(stream->path_name,
-                               stream->channel_name, stream->tracefile_size,
-                               vstream->current_tracefile_id, NULL, file_path,
-                               sizeof(file_path));
+                                            stream->channel_name,
+                                            stream->tracefile_size,
+                                            vstream->current_tracefile_id,
+                                            NULL,
+                                            file_path,
+                                            sizeof(file_path));
                if (ret < 0) {
                        goto error;
                }
 
-               status = lttng_trace_chunk_open_fs_handle(
-                               vstream->stream_file.trace_chunk, file_path,
-                               O_RDONLY, 0, &vstream->stream_file.handle,
-                               true);
+               status = lttng_trace_chunk_open_fs_handle(vstream->stream_file.trace_chunk,
+                                                         file_path,
+                                                         O_RDONLY,
+                                                         0,
+                                                         &vstream->stream_file.handle,
+                                                         true);
                if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        goto error;
                }
@@ -193,15 +195,13 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
        if (seek_t == LTTNG_VIEWER_SEEK_LAST && vstream->index_file) {
                off_t lseek_ret;
 
-               lseek_ret = fs_handle_seek(
-                               vstream->index_file->file, 0, SEEK_END);
+               lseek_ret = fs_handle_seek(vstream->index_file->file, 0, SEEK_END);
                if (lseek_ret < 0) {
                        goto error;
                }
        }
        if (stream->is_metadata) {
-               rcu_assign_pointer(stream->trace->viewer_metadata_stream,
-                               vstream);
+               rcu_assign_pointer(stream->trace->viewer_metadata_stream, vstream);
        }
 
        vstream->last_seen_rotation_count = stream->completed_rotation_count;
@@ -234,8 +234,8 @@ static void viewer_stream_unpublish(struct relay_viewer_stream *vstream)
 
 static void viewer_stream_release(struct urcu_ref *ref)
 {
-       struct relay_viewer_stream *vstream = caa_container_of(ref,
-                       struct relay_viewer_stream, ref);
+       struct relay_viewer_stream *vstream =
+               caa_container_of(ref, struct relay_viewer_stream, ref);
 
        if (vstream->stream->is_metadata) {
                rcu_assign_pointer(vstream->stream->trace->viewer_metadata_stream, NULL);
@@ -292,7 +292,7 @@ void viewer_stream_close_files(struct relay_viewer_stream *vstream)
                vstream->index_file = NULL;
        }
        if (vstream->stream_file.handle) {
-               fs_handle_close(vstream->stream_file.handle);
+               fs_handle_close(vstream->stream_file.handle);
                vstream->stream_file.handle = NULL;
        }
 }
@@ -314,8 +314,7 @@ void viewer_stream_sync_tracefile_array_tail(struct relay_viewer_stream *vstream
         * index_sent_seqcount is already further than the tracefile
         * array tail position, keep its current position.
         */
-       vstream->index_sent_seqcount =
-                       std::max(seq_tail, vstream->index_sent_seqcount);
+       vstream->index_sent_seqcount = std::max(seq_tail, vstream->index_sent_seqcount);
 }
 
 /*
@@ -331,9 +330,8 @@ int viewer_stream_rotate(struct relay_viewer_stream *vstream)
        const struct relay_stream *stream = vstream->stream;
 
        /* Detect the last tracefile to open. */
-       if (stream->index_received_seqcount
-                       == vstream->index_sent_seqcount
-                       && stream->trace->session->connection_closed) {
+       if (stream->index_received_seqcount == vstream->index_sent_seqcount &&
+           stream->trace->session->connection_closed) {
                ret = 1;
                goto end;
        }
@@ -347,10 +345,8 @@ int viewer_stream_rotate(struct relay_viewer_stream *vstream)
        /*
         * Try to move to the next file.
         */
-       new_id = (vstream->current_tracefile_id + 1)
-                       % stream->tracefile_count;
-       if (tracefile_array_seq_in_file(stream->tfa, new_id,
-                       vstream->index_sent_seqcount)) {
+       new_id = (vstream->current_tracefile_id + 1) % stream->tracefile_count;
+       if (tracefile_array_seq_in_file(stream->tfa, new_id, vstream->index_sent_seqcount)) {
                vstream->current_tracefile_id = new_id;
        } else {
                uint64_t seq_tail = tracefile_array_get_seq_tail(stream->tfa);
@@ -364,8 +360,7 @@ int viewer_stream_rotate(struct relay_viewer_stream *vstream)
                /*
                 * We need to resync because we lag behind tail.
                 */
-               vstream->current_tracefile_id =
-                       tracefile_array_get_file_index_tail(stream->tfa);
+               vstream->current_tracefile_id = tracefile_array_get_file_index_tail(stream->tfa);
                vstream->index_sent_seqcount = seq_tail;
        }
        viewer_stream_close_files(vstream);
@@ -384,18 +379,16 @@ void print_viewer_streams(void)
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(viewer_streams_ht->ht, &iter.iter, vstream,
-                       stream_n.node) {
+       cds_lfht_for_each_entry (viewer_streams_ht->ht, &iter.iter, vstream, stream_n.node) {
                if (!viewer_stream_get(vstream)) {
                        continue;
                }
-               DBG("vstream %p refcount %ld stream %" PRIu64 " trace %" PRIu64
-                       " session %" PRIu64,
-                       vstream,
-                       vstream->ref.refcount,
-                       vstream->stream->stream_handle,
-                       vstream->stream->trace->id,
-                       vstream->stream->trace->session->id);
+               DBG("vstream %p refcount %ld stream %" PRIu64 " trace %" PRIu64 " session %" PRIu64,
+                   vstream,
+                   vstream->ref.refcount,
+                   vstream->stream->stream_handle,
+                   vstream->stream->trace->id,
+                   vstream->stream->trace->session->id);
                viewer_stream_put(vstream);
        }
        rcu_read_unlock();
index 23a99a1acbbb7ec94458ad79a5dc7d9a85ba68ee..e7dfa845d0fa8e80988ef28fcf4d9a4de1828e24 100644 (file)
 #include "notification-thread-internal.hpp"
 #include "session.hpp"
 #include "thread.hpp"
+
 #include <common/dynamic-array.hpp>
 #include <common/macros.hpp>
 #include <common/optional.hpp>
+
 #include <lttng/action/action-internal.hpp>
 #include <lttng/action/list-internal.hpp>
 #include <lttng/action/list.h>
 #include <lttng/condition/event-rule-matches-internal.hpp>
 #include <lttng/lttng-error.h>
 #include <lttng/trigger/trigger-internal.hpp>
+
 #include <pthread.h>
 #include <stdbool.h>
 #include <stddef.h>
 #include <urcu/list.h>
 
-#define THREAD_NAME "Action Executor"
+#define THREAD_NAME          "Action Executor"
 #define MAX_QUEUED_WORK_COUNT 8192
 
 struct action_executor {
@@ -109,56 +112,48 @@ struct action_work_subitem {
 };
 } /* namespace */
 
-
 /*
  * Only return non-zero on a fatal error that should shut down the action
  * executor.
  */
 typedef int (*action_executor_handler)(struct action_executor *executor,
-               const struct action_work_item *,
-               struct action_work_subitem *item);
+                                      const struct action_work_item *,
+                                      struct action_work_subitem *item);
 
 static int action_executor_notify_handler(struct action_executor *executor,
-               const struct action_work_item *,
-               struct action_work_subitem *);
-static int action_executor_start_session_handler(
-               struct action_executor *executor,
-               const struct action_work_item *,
-               struct action_work_subitem *);
-static int action_executor_stop_session_handler(
-               struct action_executor *executor,
-               const struct action_work_item *,
-               struct action_work_subitem *);
-static int action_executor_rotate_session_handler(
-               struct action_executor *executor,
-               const struct action_work_item *,
-               struct action_work_subitem *);
-static int action_executor_snapshot_session_handler(
-               struct action_executor *executor,
-               const struct action_work_item *,
-               struct action_work_subitem *);
+                                         const struct action_work_item *,
+                                         struct action_work_subitem *);
+static int action_executor_start_session_handler(struct action_executor *executor,
+                                                const struct action_work_item *,
+                                                struct action_work_subitem *);
+static int action_executor_stop_session_handler(struct action_executor *executor,
+                                               const struct action_work_item *,
+                                               struct action_work_subitem *);
+static int action_executor_rotate_session_handler(struct action_executor *executor,
+                                                 const struct action_work_item *,
+                                                 struct action_work_subitem *);
+static int action_executor_snapshot_session_handler(struct action_executor *executor,
+                                                   const struct action_work_item *,
+                                                   struct action_work_subitem *);
 static int action_executor_list_handler(struct action_executor *executor,
-               const struct action_work_item *,
-               struct action_work_subitem *);
+                                       const struct action_work_item *,
+                                       struct action_work_subitem *);
 static int action_executor_generic_handler(struct action_executor *executor,
-               const struct action_work_item *,
-               struct action_work_subitem *);
+                                          const struct action_work_item *,
+                                          struct action_work_subitem *);
 
 static const action_executor_handler action_executors[] = {
-       action_executor_notify_handler,
-       action_executor_start_session_handler,
-       action_executor_stop_session_handler,
-       action_executor_rotate_session_handler,
-       action_executor_snapshot_session_handler,
-       action_executor_list_handler,
+       action_executor_notify_handler,           action_executor_start_session_handler,
+       action_executor_stop_session_handler,     action_executor_rotate_session_handler,
+       action_executor_snapshot_session_handler, action_executor_list_handler,
 };
 
 /* Forward declaration */
 static int add_action_to_subitem_array(struct lttng_action *action,
-               struct lttng_dynamic_array *subitems);
+                                      struct lttng_dynamic_array *subitems);
 
 static int populate_subitem_array_from_trigger(struct lttng_trigger *trigger,
-               struct lttng_dynamic_array *subitems);
+                                              struct lttng_dynamic_array *subitems);
 
 static void action_work_subitem_destructor(void *element)
 {
@@ -178,7 +173,7 @@ static const char *get_action_name(const struct lttng_action *action)
 
 /* Check if this trigger allowed to interect with a given session. */
 static bool is_trigger_allowed_for_session(const struct lttng_trigger *trigger,
-               struct ltt_session *session)
+                                          struct ltt_session *session)
 {
        bool is_allowed = false;
        const struct lttng_credentials session_creds = {
@@ -186,17 +181,16 @@ static bool is_trigger_allowed_for_session(const struct lttng_trigger *trigger,
                .gid = LTTNG_OPTIONAL_INIT_VALUE(session->gid),
        };
        /* Can never be NULL. */
-       const struct lttng_credentials *trigger_creds =
-                       lttng_trigger_get_credentials(trigger);
+       const struct lttng_credentials *trigger_creds = lttng_trigger_get_credentials(trigger);
 
        is_allowed = (lttng_credentials_is_equal_uid(trigger_creds, &session_creds)) ||
-                       (lttng_credentials_get_uid(trigger_creds) == 0);
+               (lttng_credentials_get_uid(trigger_creds) == 0);
        if (!is_allowed) {
                WARN("Trigger is not allowed to interact with session `%s`: session uid = %ld, session gid = %ld, trigger uid = %ld",
-                               session->name,
-                               (long int) session->uid,
-                               (long int) session->gid,
-                               (long int) lttng_credentials_get_uid(trigger_creds));
+                    session->name,
+                    (long int) session->uid,
+                    (long int) session->gid,
+                    (long int) lttng_credentials_get_uid(trigger_creds));
        }
 
        return is_allowed;
@@ -222,10 +216,9 @@ static const char *get_trigger_name(const struct lttng_trigger *trigger)
        return trigger_name;
 }
 
-static int client_handle_transmission_status(
-               struct notification_client *client,
-               enum client_transmission_status status,
-               void *user_data)
+static int client_handle_transmission_status(struct notification_client *client,
+                                            enum client_transmission_status status,
+                                            void *user_data)
 {
        int ret = 0;
        struct action_executor *executor = (action_executor *) user_data;
@@ -234,7 +227,7 @@ static int client_handle_transmission_status(
        switch (status) {
        case CLIENT_TRANSMISSION_STATUS_COMPLETE:
                DBG("Successfully sent full notification to client, client_id = %" PRIu64,
-                               client->id);
+                   client->id);
                /*
                 * There is no need to wake the (e)poll thread. If it was waiting for
                 * "out" events on the client's socket, it will see that no payload
@@ -248,15 +241,15 @@ static int client_handle_transmission_status(
                break;
        case CLIENT_TRANSMISSION_STATUS_QUEUED:
                DBG("Queued notification in client outgoing buffer, client_id = %" PRIu64,
-                               client->id);
+                   client->id);
                break;
        case CLIENT_TRANSMISSION_STATUS_FAIL:
                DBG("Communication error occurred while sending notification to client, client_id = %" PRIu64,
-                               client->id);
+                   client->id);
                break;
        default:
                ERR("Fatal error encoutered while sending notification to client, client_id = %" PRIu64,
-                               client->id);
+                   client->id);
                ret = -1;
                goto end;
        }
@@ -267,29 +260,28 @@ static int client_handle_transmission_status(
 
        /* Safe to read client's id without locking as it is immutable. */
        ret = notification_thread_client_communication_update(
-                       executor->notification_thread_handle, client->id,
-                       status);
+               executor->notification_thread_handle, client->id, status);
 end:
        return ret;
 }
 
 static int action_executor_notify_handler(struct action_executor *executor,
-               const struct action_work_item *work_item,
-               struct action_work_subitem *item __attribute__((unused)))
+                                         const struct action_work_item *work_item,
+                                         struct action_work_subitem *item __attribute__((unused)))
 {
-       return notification_client_list_send_evaluation(work_item->client_list,
-                       work_item->trigger,
-                       work_item->evaluation,
-                       work_item->object_creds.is_set ?
-                                       &(work_item->object_creds.value) :
-                                       NULL,
-                       client_handle_transmission_status, executor);
+       return notification_client_list_send_evaluation(
+               work_item->client_list,
+               work_item->trigger,
+               work_item->evaluation,
+               work_item->object_creds.is_set ? &(work_item->object_creds.value) : NULL,
+               client_handle_transmission_status,
+               executor);
 }
 
-static int action_executor_start_session_handler(
-               struct action_executor *executor __attribute__((unused)),
-               const struct action_work_item *work_item,
-               struct action_work_subitem *item)
+static int action_executor_start_session_handler(struct action_executor *executor
+                                                __attribute__((unused)),
+                                                const struct action_work_item *work_item,
+                                                struct action_work_subitem *item)
 {
        int ret = 0;
        const char *session_name;
@@ -298,11 +290,9 @@ static int action_executor_start_session_handler(
        enum lttng_error_code cmd_ret;
        struct lttng_action *action = item->action;
 
-       action_status = lttng_action_start_session_get_session_name(
-                       action, &session_name);
+       action_status = lttng_action_start_session_get_session_name(action, &session_name);
        if (action_status != LTTNG_ACTION_STATUS_OK) {
-               ERR("Failed to get session name from `%s` action",
-                               get_action_name(action));
+               ERR("Failed to get session name from `%s` action", get_action_name(action));
                ret = -1;
                goto end;
        }
@@ -313,8 +303,9 @@ static int action_executor_start_session_handler(
         */
        if (!item->context.session_id.is_set) {
                DBG("Session `%s` was not present at the moment the work item was enqueued for `%s` action of trigger `%s`",
-                               session_name, get_action_name(action),
-                               get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_action_name(action),
+                   get_trigger_name(work_item->trigger));
                lttng_action_increase_execution_failure_count(action);
                goto end;
        }
@@ -324,18 +315,21 @@ static int action_executor_start_session_handler(
        session = session_find_by_id(LTTNG_OPTIONAL_GET(item->context.session_id));
        if (!session) {
                DBG("Failed to find session `%s` by name while executing `%s` action of trigger `%s`",
-                               session_name, get_action_name(action),
-                               get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_action_name(action),
+                   get_trigger_name(work_item->trigger));
                lttng_action_increase_execution_failure_count(action);
                goto error_unlock_list;
        }
 
        session_lock(session);
        if (session->destroyed) {
-               DBG("Session `%s` with id = %" PRIu64 " is flagged as destroyed. Skipping: action = `%s`, trigger = `%s`",
-                               session->name, session->id,
-                               get_action_name(action),
-                               get_trigger_name(work_item->trigger));
+               DBG("Session `%s` with id = %" PRIu64
+                   " is flagged as destroyed. Skipping: action = `%s`, trigger = `%s`",
+                   session->name,
+                   session->id,
+                   get_action_name(action),
+                   get_trigger_name(work_item->trigger));
                goto error_unlock_session;
        }
 
@@ -347,16 +341,19 @@ static int action_executor_start_session_handler(
        switch (cmd_ret) {
        case LTTNG_OK:
                DBG("Successfully started session `%s` on behalf of trigger `%s`",
-                               session_name, get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_trigger_name(work_item->trigger));
                break;
        case LTTNG_ERR_TRACE_ALREADY_STARTED:
                DBG("Attempted to start session `%s` on behalf of trigger `%s` but it was already started",
-                               session_name, get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_trigger_name(work_item->trigger));
                break;
        default:
                WARN("Failed to start session `%s` on behalf of trigger `%s`: %s",
-                               session_name, get_trigger_name(work_item->trigger),
-                               lttng_strerror(-cmd_ret));
+                    session_name,
+                    get_trigger_name(work_item->trigger),
+                    lttng_strerror(-cmd_ret));
                lttng_action_increase_execution_failure_count(action);
                break;
        }
@@ -371,10 +368,10 @@ end:
        return ret;
 }
 
-static int action_executor_stop_session_handler(
-               struct action_executor *executor __attribute__((unused)),
-               const struct action_work_item *work_item,
-               struct action_work_subitem *item)
+static int action_executor_stop_session_handler(struct action_executor *executor
+                                               __attribute__((unused)),
+                                               const struct action_work_item *work_item,
+                                               struct action_work_subitem *item)
 {
        int ret = 0;
        const char *session_name;
@@ -383,11 +380,9 @@ static int action_executor_stop_session_handler(
        enum lttng_error_code cmd_ret;
        struct lttng_action *action = item->action;
 
-       action_status = lttng_action_stop_session_get_session_name(
-                       action, &session_name);
+       action_status = lttng_action_stop_session_get_session_name(action, &session_name);
        if (action_status != LTTNG_ACTION_STATUS_OK) {
-               ERR("Failed to get session name from `%s` action",
-                               get_action_name(action));
+               ERR("Failed to get session name from `%s` action", get_action_name(action));
                ret = -1;
                goto end;
        }
@@ -398,8 +393,9 @@ static int action_executor_stop_session_handler(
         */
        if (!item->context.session_id.is_set) {
                DBG("Session `%s` was not present at the moment the work item was enqueued for `%s` action of trigger `%s`",
-                               session_name, get_action_name(action),
-                               get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_action_name(action),
+                   get_trigger_name(work_item->trigger));
                lttng_action_increase_execution_failure_count(action);
                goto end;
        }
@@ -409,18 +405,21 @@ static int action_executor_stop_session_handler(
        session = session_find_by_id(LTTNG_OPTIONAL_GET(item->context.session_id));
        if (!session) {
                DBG("Failed to find session `%s` by name while executing `%s` action of trigger `%s`",
-                               session_name, get_action_name(action),
-                               get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_action_name(action),
+                   get_trigger_name(work_item->trigger));
                lttng_action_increase_execution_failure_count(action);
                goto error_unlock_list;
        }
 
        session_lock(session);
        if (session->destroyed) {
-               DBG("Session `%s` with id = %" PRIu64 " is flagged as destroyed. Skipping: action = `%s`, trigger = `%s`",
-                               session->name, session->id,
-                               get_action_name(action),
-                               get_trigger_name(work_item->trigger));
+               DBG("Session `%s` with id = %" PRIu64
+                   " is flagged as destroyed. Skipping: action = `%s`, trigger = `%s`",
+                   session->name,
+                   session->id,
+                   get_action_name(action),
+                   get_trigger_name(work_item->trigger));
                goto error_unlock_session;
        }
 
@@ -432,16 +431,19 @@ static int action_executor_stop_session_handler(
        switch (cmd_ret) {
        case LTTNG_OK:
                DBG("Successfully stopped session `%s` on behalf of trigger `%s`",
-                               session_name, get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_trigger_name(work_item->trigger));
                break;
        case LTTNG_ERR_TRACE_ALREADY_STOPPED:
                DBG("Attempted to stop session `%s` on behalf of trigger `%s` but it was already stopped",
-                               session_name, get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_trigger_name(work_item->trigger));
                break;
        default:
                WARN("Failed to stop session `%s` on behalf of trigger `%s`: %s",
-                               session_name, get_trigger_name(work_item->trigger),
-                               lttng_strerror(-cmd_ret));
+                    session_name,
+                    get_trigger_name(work_item->trigger),
+                    lttng_strerror(-cmd_ret));
                lttng_action_increase_execution_failure_count(action);
                break;
        }
@@ -456,10 +458,10 @@ end:
        return ret;
 }
 
-static int action_executor_rotate_session_handler(
-               struct action_executor *executor __attribute__((unused)),
-               const struct action_work_item *work_item,
-               struct action_work_subitem *item)
+static int action_executor_rotate_session_handler(struct action_executor *executor
+                                                 __attribute__((unused)),
+                                                 const struct action_work_item *work_item,
+                                                 struct action_work_subitem *item)
 {
        int ret = 0;
        const char *session_name;
@@ -468,11 +470,9 @@ static int action_executor_rotate_session_handler(
        enum lttng_error_code cmd_ret;
        struct lttng_action *action = item->action;
 
-       action_status = lttng_action_rotate_session_get_session_name(
-                       action, &session_name);
+       action_status = lttng_action_rotate_session_get_session_name(action, &session_name);
        if (action_status != LTTNG_ACTION_STATUS_OK) {
-               ERR("Failed to get session name from `%s` action",
-                               get_action_name(action));
+               ERR("Failed to get session name from `%s` action", get_action_name(action));
                ret = -1;
                goto end;
        }
@@ -483,8 +483,9 @@ static int action_executor_rotate_session_handler(
         */
        if (!item->context.session_id.is_set) {
                DBG("Session `%s` was not present at the moment the work item was enqueued for `%s` action of trigger `%s`",
-                               session_name, get_action_name(action),
-                               get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_action_name(action),
+                   get_trigger_name(work_item->trigger));
                lttng_action_increase_execution_failure_count(action);
                goto end;
        }
@@ -494,18 +495,21 @@ static int action_executor_rotate_session_handler(
        session = session_find_by_id(LTTNG_OPTIONAL_GET(item->context.session_id));
        if (!session) {
                DBG("Failed to find session `%s` by name while executing `%s` action of trigger `%s`",
-                               session_name, get_action_name(action),
-                               get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_action_name(action),
+                   get_trigger_name(work_item->trigger));
                lttng_action_increase_execution_failure_count(action);
                goto error_unlock_list;
        }
 
        session_lock(session);
        if (session->destroyed) {
-               DBG("Session `%s` with id = %" PRIu64 " is flagged as destroyed. Skipping: action = `%s`, trigger = `%s`",
-                               session->name, session->id,
-                               get_action_name(action),
-                               get_trigger_name(work_item->trigger));
+               DBG("Session `%s` with id = %" PRIu64
+                   " is flagged as destroyed. Skipping: action = `%s`, trigger = `%s`",
+                   session->name,
+                   session->id,
+                   get_action_name(action),
+                   get_trigger_name(work_item->trigger));
                goto error_unlock_session;
        }
 
@@ -513,27 +517,31 @@ static int action_executor_rotate_session_handler(
                goto error_unlock_session;
        }
 
-       cmd_ret = (lttng_error_code) cmd_rotate_session(session, NULL, false,
-                       LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
+       cmd_ret = (lttng_error_code) cmd_rotate_session(
+               session, NULL, false, LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
        switch (cmd_ret) {
        case LTTNG_OK:
                DBG("Successfully started rotation of session `%s` on behalf of trigger `%s`",
-                               session_name, get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_trigger_name(work_item->trigger));
                break;
        case LTTNG_ERR_ROTATION_PENDING:
                DBG("Attempted to start a rotation of session `%s` on behalf of trigger `%s` but a rotation is already ongoing",
-                               session_name, get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_trigger_name(work_item->trigger));
                lttng_action_increase_execution_failure_count(action);
                break;
        case LTTNG_ERR_ROTATION_MULTIPLE_AFTER_STOP:
        case LTTNG_ERR_ROTATION_AFTER_STOP_CLEAR:
                DBG("Attempted to start a rotation of session `%s` on behalf of trigger `%s` but a rotation has already been completed since the last stop or clear",
-                               session_name, get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_trigger_name(work_item->trigger));
                break;
        default:
                WARN("Failed to start a rotation of session `%s` on behalf of trigger `%s`: %s",
-                               session_name, get_trigger_name(work_item->trigger),
-                               lttng_strerror(-cmd_ret));
+                    session_name,
+                    get_trigger_name(work_item->trigger),
+                    lttng_strerror(-cmd_ret));
                lttng_action_increase_execution_failure_count(action);
                break;
        }
@@ -548,18 +556,17 @@ end:
        return ret;
 }
 
-static int action_executor_snapshot_session_handler(
-               struct action_executor *executor __attribute__((unused)),
-               const struct action_work_item *work_item,
-               struct action_work_subitem *item)
+static int action_executor_snapshot_session_handler(struct action_executor *executor
+                                                   __attribute__((unused)),
+                                                   const struct action_work_item *work_item,
+                                                   struct action_work_subitem *item)
 {
        int ret = 0;
        const char *session_name;
        enum lttng_action_status action_status;
        struct ltt_session *session;
        lttng_snapshot_output default_snapshot_output;
-       const struct lttng_snapshot_output *snapshot_output =
-                       &default_snapshot_output;
+       const struct lttng_snapshot_output *snapshot_output = &default_snapshot_output;
        enum lttng_error_code cmd_ret;
        struct lttng_action *action = item->action;
 
@@ -571,27 +578,22 @@ static int action_executor_snapshot_session_handler(
         */
        if (!item->context.session_id.is_set) {
                DBG("Session was not present at the moment the work item was enqueued for `%s` action of trigger `%s`",
-                               get_action_name(action),
-                               get_trigger_name(work_item->trigger));
+                   get_action_name(action),
+                   get_trigger_name(work_item->trigger));
                lttng_action_increase_execution_failure_count(action);
                goto end;
        }
 
-       action_status = lttng_action_snapshot_session_get_session_name(
-                       action, &session_name);
+       action_status = lttng_action_snapshot_session_get_session_name(action, &session_name);
        if (action_status != LTTNG_ACTION_STATUS_OK) {
-               ERR("Failed to get session name from `%s` action",
-                               get_action_name(action));
+               ERR("Failed to get session name from `%s` action", get_action_name(action));
                ret = -1;
                goto end;
        }
 
-       action_status = lttng_action_snapshot_session_get_output(
-                       action, &snapshot_output);
-       if (action_status != LTTNG_ACTION_STATUS_OK &&
-                       action_status != LTTNG_ACTION_STATUS_UNSET) {
-               ERR("Failed to get output from `%s` action",
-                               get_action_name(action));
+       action_status = lttng_action_snapshot_session_get_output(action, &snapshot_output);
+       if (action_status != LTTNG_ACTION_STATUS_OK && action_status != LTTNG_ACTION_STATUS_UNSET) {
+               ERR("Failed to get output from `%s` action", get_action_name(action));
                ret = -1;
                goto end;
        }
@@ -601,18 +603,21 @@ static int action_executor_snapshot_session_handler(
        session = session_find_by_id(LTTNG_OPTIONAL_GET(item->context.session_id));
        if (!session) {
                DBG("Failed to find session `%s` by name while executing `%s` action of trigger `%s`",
-                               session_name, get_action_name(action),
-                               get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_action_name(action),
+                   get_trigger_name(work_item->trigger));
                lttng_action_increase_execution_failure_count(action);
                goto error_unlock_list;
        }
 
        session_lock(session);
        if (session->destroyed) {
-               DBG("Session `%s` with id = %" PRIu64 " is flagged as destroyed. Skipping: action = `%s`, trigger = `%s`",
-                               session->name, session->id,
-                               get_action_name(action),
-                               get_trigger_name(work_item->trigger));
+               DBG("Session `%s` with id = %" PRIu64
+                   " is flagged as destroyed. Skipping: action = `%s`, trigger = `%s`",
+                   session->name,
+                   session->id,
+                   get_action_name(action),
+                   get_trigger_name(work_item->trigger));
                goto error_unlock_session;
        }
 
@@ -624,12 +629,14 @@ static int action_executor_snapshot_session_handler(
        switch (cmd_ret) {
        case LTTNG_OK:
                DBG("Successfully recorded snapshot of session `%s` on behalf of trigger `%s`",
-                               session_name, get_trigger_name(work_item->trigger));
+                   session_name,
+                   get_trigger_name(work_item->trigger));
                break;
        default:
                WARN("Failed to record snapshot of session `%s` on behalf of trigger `%s`: %s",
-                               session_name, get_trigger_name(work_item->trigger),
-                               lttng_strerror(-cmd_ret));
+                    session_name,
+                    get_trigger_name(work_item->trigger),
+                    lttng_strerror(-cmd_ret));
                lttng_action_increase_execution_failure_count(action);
                break;
        }
@@ -644,18 +651,18 @@ end:
        return ret;
 }
 
-static int action_executor_list_handler(
-               struct action_executor *executor __attribute__((unused)),
-               const struct action_work_item *work_item __attribute__((unused)),
-               struct action_work_subitem *item __attribute__((unused)))
+static int action_executor_list_handler(struct action_executor *executor __attribute__((unused)),
+                                       const struct action_work_item *work_item
+                                       __attribute__((unused)),
+                                       struct action_work_subitem *item __attribute__((unused)))
 {
        ERR("Execution of a list action by the action executor should never occur");
        abort();
 }
 
 static int action_executor_generic_handler(struct action_executor *executor,
-               const struct action_work_item *work_item,
-               struct action_work_subitem *item)
+                                          const struct action_work_item *work_item,
+                                          struct action_work_subitem *item)
 {
        int ret;
        struct lttng_action *action = item->action;
@@ -666,46 +673,48 @@ static int action_executor_generic_handler(struct action_executor *executor,
        lttng_action_increase_execution_request_count(action);
        if (!lttng_action_should_execute(action)) {
                DBG("Policy prevented execution of action `%s` of trigger `%s` action work item %" PRIu64,
-                               get_action_name(action),
-                               get_trigger_name(work_item->trigger),
-                               work_item->id);
+                   get_action_name(action),
+                   get_trigger_name(work_item->trigger),
+                   work_item->id);
                ret = 0;
                goto end;
        }
 
        lttng_action_increase_execution_count(action);
        DBG("Executing action `%s` of trigger `%s` action work item %" PRIu64,
-                       get_action_name(action),
-                       get_trigger_name(work_item->trigger),
-                       work_item->id);
+           get_action_name(action),
+           get_trigger_name(work_item->trigger),
+           work_item->id);
        ret = action_executors[action_type](executor, work_item, item);
 end:
        return ret;
 }
 
 static int action_work_item_execute(struct action_executor *executor,
-               struct action_work_item *work_item)
+                                   struct action_work_item *work_item)
 {
        int ret;
        size_t count, i;
 
        DBG("Starting execution of action work item %" PRIu64 " of trigger `%s`",
-                       work_item->id, get_trigger_name(work_item->trigger));
+           work_item->id,
+           get_trigger_name(work_item->trigger));
 
        count = lttng_dynamic_array_get_count(&work_item->subitems);
        for (i = 0; i < count; i++) {
                struct action_work_subitem *item;
 
-               item = (action_work_subitem *) lttng_dynamic_array_get_element(&work_item->subitems, i);
-               ret = action_executor_generic_handler(
-                               executor, work_item, item);
+               item = (action_work_subitem *) lttng_dynamic_array_get_element(&work_item->subitems,
+                                                                              i);
+               ret = action_executor_generic_handler(executor, work_item, item);
                if (ret) {
                        goto end;
                }
        }
 end:
        DBG("Completed execution of action work item %" PRIu64 " of trigger `%s`",
-                       work_item->id, get_trigger_name(work_item->trigger));
+           work_item->id,
+           get_trigger_name(work_item->trigger));
        return ret;
 }
 
@@ -724,8 +733,7 @@ static void *action_executor_thread(void *_data)
 
        LTTNG_ASSERT(executor);
 
-       health_register(the_health_sessiond,
-                       HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR);
+       health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR);
 
        rcu_register_thread();
        rcu_thread_online();
@@ -740,16 +748,15 @@ static void *action_executor_thread(void *_data)
                if (executor->work.pending_count == 0) {
                        health_poll_entry();
                        DBG("No work items enqueued, entering wait");
-                       pthread_cond_wait(&executor->work.cond,
-                                       &executor->work.lock);
+                       pthread_cond_wait(&executor->work.cond, &executor->work.lock);
                        DBG("Woke-up from wait");
                        health_poll_exit();
                        continue;
                }
 
                /* Pop item from front of the list with work lock held. */
-               work_item = cds_list_first_entry(&executor->work.list,
-                               struct action_work_item, list_node);
+               work_item = cds_list_first_entry(
+                       &executor->work.list, struct action_work_item, list_node);
                cds_list_del(&work_item->list_node);
                executor->work.pending_count--;
 
@@ -768,13 +775,15 @@ static void *action_executor_thread(void *_data)
 
                        trigger_name = get_trigger_name(work_item->trigger);
 
-                       trigger_status = lttng_trigger_get_owner_uid(
-                                       work_item->trigger, &trigger_owner_uid);
+                       trigger_status =
+                               lttng_trigger_get_owner_uid(work_item->trigger, &trigger_owner_uid);
                        LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
-                       DBG("Work item skipped since the associated trigger is no longer registered: work item id = %" PRIu64 ", trigger name = `%s`, trigger owner uid = %d",
-                                       work_item->id, trigger_name,
-                                       (int) trigger_owner_uid);
+                       DBG("Work item skipped since the associated trigger is no longer registered: work item id = %" PRIu64
+                           ", trigger name = `%s`, trigger owner uid = %d",
+                           work_item->id,
+                           trigger_name,
+                           (int) trigger_owner_uid);
                        ret = 0;
                        goto skip_execute;
                }
@@ -829,8 +838,7 @@ static void clean_up_action_executor_thread(void *_data)
        free(executor);
 }
 
-struct action_executor *action_executor_create(
-               struct notification_thread_handle *handle)
+struct action_executor *action_executor_create(struct notification_thread_handle *handle)
 {
        struct action_executor *executor = zmalloc<action_executor>();
 
@@ -844,8 +852,10 @@ struct action_executor *action_executor_create(
        executor->notification_thread_handle = handle;
 
        executor->thread = lttng_thread_create(THREAD_NAME,
-                       action_executor_thread, shutdown_action_executor_thread,
-                       clean_up_action_executor_thread, executor);
+                                              action_executor_thread,
+                                              shutdown_action_executor_thread,
+                                              clean_up_action_executor_thread,
+                                              executor);
 end:
        return executor;
 }
@@ -859,17 +869,15 @@ void action_executor_destroy(struct action_executor *executor)
        pthread_mutex_lock(&executor->work.lock);
        if (executor->work.pending_count != 0) {
                WARN("%" PRIu64
-                       " trigger action%s still queued for execution and will be discarded",
-                               executor->work.pending_count,
-                               executor->work.pending_count == 1 ? " is" :
-                                                                   "s are");
+                    " trigger action%s still queued for execution and will be discarded",
+                    executor->work.pending_count,
+                    executor->work.pending_count == 1 ? " is" : "s are");
        }
 
-       cds_list_for_each_entry_safe (
-                       work_item, tmp, &executor->work.list, list_node) {
-               WARN("Discarding action work item %" PRIu64
-                               " associated to trigger `%s`",
-                               work_item->id, get_trigger_name(work_item->trigger));
+       cds_list_for_each_entry_safe (work_item, tmp, &executor->work.list, list_node) {
+               WARN("Discarding action work item %" PRIu64 " associated to trigger `%s`",
+                    work_item->id,
+                    get_trigger_name(work_item->trigger));
                cds_list_del(&work_item->list_node);
                action_work_item_destroy(work_item);
        }
@@ -878,12 +886,12 @@ void action_executor_destroy(struct action_executor *executor)
 }
 
 /* RCU read-lock must be held by the caller. */
-enum action_executor_status action_executor_enqueue_trigger(
-               struct action_executor *executor,
-               struct lttng_trigger *trigger,
-               struct lttng_evaluation *evaluation,
-               const struct lttng_credentials *object_creds,
-               struct notification_client_list *client_list)
+enum action_executor_status
+action_executor_enqueue_trigger(struct action_executor *executor,
+                               struct lttng_trigger *trigger,
+                               struct lttng_evaluation *evaluation,
+                               const struct lttng_credentials *object_creds,
+                               struct notification_client_list *client_list)
 {
        int ret;
        enum action_executor_status executor_status = ACTION_EXECUTOR_STATUS_OK;
@@ -899,7 +907,8 @@ enum action_executor_status action_executor_enqueue_trigger(
        if (executor->work.pending_count >= MAX_QUEUED_WORK_COUNT) {
                /* Most likely spammy, remove if it is the case. */
                DBG("Refusing to enqueue action for trigger (overflow): trigger name = `%s`, work item id = %" PRIu64,
-                               get_trigger_name(trigger), work_item_id);
+                   get_trigger_name(trigger),
+                   work_item_id);
                executor_status = ACTION_EXECUTOR_STATUS_OVERFLOW;
                goto error_unlock;
        }
@@ -907,15 +916,14 @@ enum action_executor_status action_executor_enqueue_trigger(
        work_item = zmalloc<action_work_item>();
        if (!work_item) {
                PERROR("Failed to allocate action executor work item: trigger name = `%s`",
-                               get_trigger_name(trigger));
+                      get_trigger_name(trigger));
                executor_status = ACTION_EXECUTOR_STATUS_ERROR;
                goto error_unlock;
        }
 
        lttng_trigger_get(trigger);
        if (client_list) {
-               const bool reference_acquired =
-                               notification_client_list_get(client_list);
+               const bool reference_acquired = notification_client_list_get(client_list);
 
                LTTNG_ASSERT(reference_acquired);
        }
@@ -937,14 +945,13 @@ enum action_executor_status action_executor_enqueue_trigger(
 
        /* Build the array of action work subitems for the passed trigger. */
        lttng_dynamic_array_init(&work_item->subitems,
-                       sizeof(struct action_work_subitem),
-                       action_work_subitem_destructor);
+                                sizeof(struct action_work_subitem),
+                                action_work_subitem_destructor);
 
-       ret = populate_subitem_array_from_trigger(
-                       trigger, &work_item->subitems);
+       ret = populate_subitem_array_from_trigger(trigger, &work_item->subitems);
        if (ret) {
                ERR("Failed to populate work item sub items on behalf of trigger: trigger name = `%s`",
-                               get_trigger_name(trigger));
+                   get_trigger_name(trigger));
                executor_status = ACTION_EXECUTOR_STATUS_ERROR;
                goto error_unlock;
        }
@@ -952,7 +959,8 @@ enum action_executor_status action_executor_enqueue_trigger(
        cds_list_add_tail(&work_item->list_node, &executor->work.list);
        executor->work.pending_count++;
        DBG("Enqueued action for trigger: trigger name = `%s`, work item id = %" PRIu64,
-                       get_trigger_name(trigger), work_item_id);
+           get_trigger_name(trigger),
+           work_item_id);
        signal = true;
 
 error_unlock:
@@ -966,7 +974,7 @@ error_unlock:
 }
 
 static int add_action_to_subitem_array(struct lttng_action *action,
-               struct lttng_dynamic_array *subitems)
+                                      struct lttng_dynamic_array *subitems)
 {
        int ret = 0;
        enum lttng_action_type type = lttng_action_get_type(action);
@@ -991,11 +999,9 @@ static int add_action_to_subitem_array(struct lttng_action *action,
                for (i = 0; i < count; i++) {
                        struct lttng_action *inner_action = NULL;
 
-                       inner_action = lttng_action_list_borrow_mutable_at_index(
-                                       action, i);
+                       inner_action = lttng_action_list_borrow_mutable_at_index(action, i);
                        LTTNG_ASSERT(inner_action);
-                       ret = add_action_to_subitem_array(
-                                       inner_action, subitems);
+                       ret = add_action_to_subitem_array(inner_action, subitems);
                        if (ret) {
                                goto end;
                        }
@@ -1013,23 +1019,19 @@ static int add_action_to_subitem_array(struct lttng_action *action,
        case LTTNG_ACTION_TYPE_NOTIFY:
                break;
        case LTTNG_ACTION_TYPE_START_SESSION:
-               status = lttng_action_start_session_get_session_name(
-                               action, &session_name);
+               status = lttng_action_start_session_get_session_name(action, &session_name);
                LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
                break;
        case LTTNG_ACTION_TYPE_STOP_SESSION:
-               status = lttng_action_stop_session_get_session_name(
-                               action, &session_name);
+               status = lttng_action_stop_session_get_session_name(action, &session_name);
                LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
                break;
        case LTTNG_ACTION_TYPE_ROTATE_SESSION:
-               status = lttng_action_rotate_session_get_session_name(
-                               action, &session_name);
+               status = lttng_action_rotate_session_get_session_name(action, &session_name);
                LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
                break;
        case LTTNG_ACTION_TYPE_SNAPSHOT_SESSION:
-               status = lttng_action_snapshot_session_get_session_name(
-                               action, &session_name);
+               status = lttng_action_snapshot_session_get_session_name(action, &session_name);
                LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
                break;
        case LTTNG_ACTION_TYPE_LIST:
@@ -1065,8 +1067,7 @@ static int add_action_to_subitem_array(struct lttng_action *action,
                 * execution time.
                 */
                if (sample_session_id_by_name(session_name, &session_id)) {
-                       LTTNG_OPTIONAL_SET(&subitem.context.session_id,
-                                       session_id);
+                       LTTNG_OPTIONAL_SET(&subitem.context.session_id, session_id);
                }
        }
 
@@ -1087,7 +1088,7 @@ end:
 }
 
 static int populate_subitem_array_from_trigger(struct lttng_trigger *trigger,
-               struct lttng_dynamic_array *subitems)
+                                              struct lttng_dynamic_array *subitems)
 {
        struct lttng_action *action;
 
index e54a7cecf6f450ec1e1594b42e9edb2e01a45b8b..c3d76896cdbf54b0fdf2e55acb44519e6a30af17 100644 (file)
@@ -7,20 +7,19 @@
 
 #define _LGPL_SOURCE
 
-#include <common/common.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/uri.hpp>
-#include <common/utils.hpp>
-
-#include <common/compat/endian.hpp>
-
-#include "fd-limit.hpp"
 #include "agent-thread.hpp"
 #include "agent.hpp"
+#include "fd-limit.hpp"
 #include "lttng-sessiond.hpp"
 #include "session.hpp"
-#include "utils.hpp"
 #include "thread.hpp"
+#include "utils.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/endian.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/uri.hpp>
+#include <common/utils.hpp>
 
 namespace {
 struct thread_notifiers {
@@ -65,7 +64,7 @@ static void update_agent_app(const struct agent_app *app)
        list = session_get_list();
        LTTNG_ASSERT(list);
 
-       cds_list_for_each_entry_safe(session, stmp, &list->head, list) {
+       cds_list_for_each_entry_safe (session, stmp, &list->head, list) {
                if (!session_get(session)) {
                        continue;
                }
@@ -90,8 +89,8 @@ static void update_agent_app(const struct agent_app *app)
         * We are protected against the addition of new events by the session
         * list lock being held.
         */
-       cds_lfht_for_each_entry(the_trigger_agents_ht_by_domain->ht,
-                       &iter.iter, trigger_agent, node.node) {
+       cds_lfht_for_each_entry (
+               the_trigger_agents_ht_by_domain->ht, &iter.iter, trigger_agent, node.node) {
                agent_update(trigger_agent, app);
        }
        rcu_read_unlock();
@@ -129,12 +128,11 @@ static struct lttcomm_sock *init_tcp_socket(void)
                goto error;
        }
 
-       for (port = the_config.agent_tcp_port.begin;
-                       port <= the_config.agent_tcp_port.end; port++) {
+       for (port = the_config.agent_tcp_port.begin; port <= the_config.agent_tcp_port.end;
+            port++) {
                ret = lttcomm_sock_set_port(sock, (uint16_t) port);
                if (ret) {
-                       ERR("Failed to set port %u on socket",
-                                       port);
+                       ERR("Failed to set port %u on socket", port);
                        goto error;
                }
                DBG3("Trying to bind on port %u", port);
@@ -145,8 +143,7 @@ static struct lttcomm_sock *init_tcp_socket(void)
                }
 
                if (errno == EADDRINUSE) {
-                       DBG("Failed to bind to port %u since it is already in use",
-                                       port);
+                       DBG("Failed to bind to port %u since it is already in use", port);
                } else {
                        PERROR("Failed to bind to port %u", port);
                        goto error;
@@ -154,17 +151,16 @@ static struct lttcomm_sock *init_tcp_socket(void)
        }
 
        if (!bind_succeeded) {
-               if (the_config.agent_tcp_port.begin ==
-                               the_config.agent_tcp_port.end) {
+               if (the_config.agent_tcp_port.begin == the_config.agent_tcp_port.end) {
                        WARN("Another process is already using the agent port %i. "
                             "Agent support will be deactivated.",
-                                       the_config.agent_tcp_port.begin);
+                            the_config.agent_tcp_port.begin);
                        goto error;
                } else {
                        WARN("All ports in the range [%i, %i] are already in use. "
                             "Agent support will be deactivated.",
-                                       the_config.agent_tcp_port.begin,
-                                       the_config.agent_tcp_port.end);
+                            the_config.agent_tcp_port.begin,
+                            the_config.agent_tcp_port.end);
                        goto error;
                }
        }
@@ -174,8 +170,7 @@ static struct lttcomm_sock *init_tcp_socket(void)
                goto error;
        }
 
-       DBG("Listening on TCP port %u and socket %d",
-                       port, sock->fd);
+       DBG("Listening on TCP port %u and socket %d", port, sock->fd);
 
        return sock;
 
@@ -202,8 +197,7 @@ static void destroy_tcp_socket(struct lttcomm_sock *sock)
                port = 0;
        }
 
-       DBG3("Destroy TCP socket on port %" PRIu16,
-                       port);
+       DBG3("Destroy TCP socket on port %" PRIu16, port);
 
        /* This will return gracefully if fd is invalid. */
        sock->ops->close(sock);
@@ -230,16 +224,17 @@ static const char *domain_type_str(enum lttng_domain_type domain_type)
        }
 }
 
-static bool is_agent_protocol_version_supported(
-               const struct agent_protocol_version *version)
+static bool is_agent_protocol_version_supported(const struct agent_protocol_version *version)
 {
        const bool is_supported = version->major == AGENT_MAJOR_VERSION &&
-                       version->minor == AGENT_MINOR_VERSION;
+               version->minor == AGENT_MINOR_VERSION;
 
        if (!is_supported) {
                WARN("Refusing agent connection: unsupported protocol version %ui.%ui, expected %i.%i",
-                               version->major, version->minor,
-                               AGENT_MAJOR_VERSION, AGENT_MINOR_VERSION);
+                    version->major,
+                    version->minor,
+                    AGENT_MAJOR_VERSION,
+                    AGENT_MINOR_VERSION);
        }
 
        return is_supported;
@@ -252,10 +247,9 @@ static bool is_agent_protocol_version_supported(
  * On success, the resulting socket is returned through `agent_app_socket`
  * and the application's reported id is updated through `agent_app_id`.
  */
-static int accept_agent_connection(
-               struct lttcomm_sock *reg_sock,
-               struct agent_app_id *agent_app_id,
-               struct lttcomm_sock **agent_app_socket)
+static int accept_agent_connection(struct lttcomm_sock *reg_sock,
+                                  struct agent_app_id *agent_app_id,
+                                  struct lttcomm_sock **agent_app_socket)
 {
        int ret;
        struct agent_protocol_version agent_version;
@@ -277,7 +271,8 @@ static int accept_agent_connection(
                        PERROR("Failed to register new agent application");
                } else if (size != 0) {
                        ERR("Failed to register new agent application: invalid registration message length: expected length = %zu, message length = %zd",
-                                       sizeof(msg), size);
+                           sizeof(msg),
+                           size);
                } else {
                        DBG("Failed to register new agent application: connection closed");
                }
@@ -285,7 +280,7 @@ static int accept_agent_connection(
                goto error_close_socket;
        }
 
-       agent_version = (struct agent_protocol_version) {
+       agent_version = (struct agent_protocol_version){
                be32toh(msg.major_version),
                be32toh(msg.minor_version),
        };
@@ -296,14 +291,15 @@ static int accept_agent_connection(
                goto error_close_socket;
        }
 
-       *agent_app_id = (struct agent_app_id) {
+       *agent_app_id = (struct agent_app_id){
                .pid = (pid_t) be32toh(msg.pid),
                .domain = (lttng_domain_type) be32toh(msg.domain),
        };
 
        DBG2("New registration for agent application: pid = %ld, domain = %s, socket fd = %d",
-                       (long) agent_app_id->pid,
-                       domain_type_str(agent_app_id->domain), new_sock->fd);
+            (long) agent_app_id->pid,
+            domain_type_str(agent_app_id->domain),
+            new_sock->fd);
 
        *agent_app_socket = new_sock;
        new_sock = NULL;
@@ -331,19 +327,16 @@ bool agent_tracing_is_enabled(void)
  */
 static int write_agent_port(uint16_t port)
 {
-       return utils_create_pid_file(
-                       (pid_t) port, the_config.agent_port_file_path.value);
+       return utils_create_pid_file((pid_t) port, the_config.agent_port_file_path.value);
 }
 
-static
-void mark_thread_as_ready(struct thread_notifiers *notifiers)
+static void mark_thread_as_ready(struct thread_notifiers *notifiers)
 {
        DBG("Marking agent management thread as ready");
        sem_post(&notifiers->ready);
 }
 
-static
-void wait_until_thread_is_ready(struct thread_notifiers *notifiers)
+static void wait_until_thread_is_ready(struct thread_notifiers *notifiers)
 {
        DBG("Waiting for agent management thread to be ready");
        sem_wait(&notifiers->ready);
@@ -360,8 +353,7 @@ static void *thread_agent_management(void *data)
        struct lttng_poll_event events;
        struct lttcomm_sock *reg_sock;
        struct thread_notifiers *notifiers = (thread_notifiers *) data;
-       const auto thread_quit_pipe_fd = lttng_pipe_get_readfd(
-                       notifiers->quit_pipe);
+       const auto thread_quit_pipe_fd = lttng_pipe_get_readfd(notifiers->quit_pipe);
 
        DBG("Manage agent application registration.");
 
@@ -419,10 +411,9 @@ static void *thread_agent_management(void *data)
                DBG3("Manage agent polling");
 
                /* Inifinite blocking call, waiting for transmission */
-restart:
+       restart:
                ret = lttng_poll_wait(&events, -1);
-               DBG3("Manage agent return from poll on %d fds",
-                               LTTNG_POLL_GETNB(&events));
+               DBG3("Manage agent return from poll on %d fds", LTTNG_POLL_GETNB(&events));
                if (ret < 0) {
                        /*
                         * Restart interrupted system call.
@@ -466,12 +457,10 @@ restart:
                                 * new_app_socket's ownership has been
                                 * transferred to the new agent app.
                                 */
-                               new_app = agent_create_app(new_app_id.pid,
-                                               new_app_id.domain,
-                                               new_app_socket);
+                               new_app = agent_create_app(
+                                       new_app_id.pid, new_app_id.domain, new_app_socket);
                                if (!new_app) {
-                                       new_app_socket->ops->close(
-                                                       new_app_socket);
+                                       new_app_socket->ops->close(new_app_socket);
                                        continue;
                                }
                                new_app_socket_fd = new_app_socket->fd;
@@ -505,8 +494,7 @@ restart:
                                if (ret < 0) {
                                        agent_destroy_app(new_app);
                                        /* Removing from the poll set. */
-                                       ret = lttng_poll_del(&events,
-                                                       new_app_socket_fd);
+                                       ret = lttng_poll_del(&events, new_app_socket_fd);
                                        if (ret < 0) {
                                                session_unlock_list();
                                                goto error;
@@ -580,10 +568,10 @@ bool launch_agent_management_thread(void)
                goto error;
        }
        thread = lttng_thread_create("Agent management",
-                       thread_agent_management,
-                       shutdown_agent_management_thread,
-                       cleanup_agent_management_thread,
-                       notifiers);
+                                    thread_agent_management,
+                                    shutdown_agent_management_thread,
+                                    cleanup_agent_management_thread,
+                                    notifiers);
        if (!thread) {
                goto error;
        }
index 31f1634bd70b70a681b6479433e0eb743fe72492..15b3b9db97e0c15117162e37814fe1db65da9ec3 100644 (file)
@@ -7,34 +7,32 @@
  */
 
 #define _LGPL_SOURCE
-#include <urcu/uatomic.h>
-#include <urcu/rculist.h>
+#include "agent.hpp"
+#include "common/error.hpp"
+#include "ust-app.hpp"
+#include "utils.hpp"
 
-#include <lttng/event-rule/event-rule.h>
+#include <common/common.hpp>
+#include <common/compat/endian.hpp>
+#include <common/sessiond-comm/agent.hpp>
+
+#include <lttng/condition/condition.h>
+#include <lttng/condition/event-rule-matches.h>
+#include <lttng/domain-internal.hpp>
 #include <lttng/event-rule/event-rule-internal.hpp>
+#include <lttng/event-rule/event-rule.h>
 #include <lttng/event-rule/jul-logging.h>
 #include <lttng/event-rule/log4j-logging.h>
 #include <lttng/event-rule/python-logging.h>
-#include <lttng/condition/condition.h>
-#include <lttng/condition/event-rule-matches.h>
-#include <lttng/domain-internal.hpp>
 #include <lttng/log-level-rule-internal.hpp>
 
-#include <common/common.hpp>
-#include <common/sessiond-comm/agent.hpp>
-
-#include <common/compat/endian.hpp>
-
-#include "agent.hpp"
-#include "ust-app.hpp"
-#include "utils.hpp"
-#include "common/error.hpp"
+#include <urcu/rculist.h>
+#include <urcu/uatomic.h>
 
 typedef enum lttng_event_rule_status (*event_rule_logging_get_name_pattern)(
-               const struct lttng_event_rule *rule, const char **pattern);
+       const struct lttng_event_rule *rule, const char **pattern);
 typedef enum lttng_event_rule_status (*event_rule_logging_get_log_level_rule)(
-               const struct lttng_event_rule *rule,
-               const struct lttng_log_level_rule **log_level_rule);
+       const struct lttng_event_rule *rule, const struct lttng_log_level_rule **log_level_rule);
 
 /*
  * Agent application context representation.
@@ -55,8 +53,7 @@ struct agent_app_ctx {
 /*
  * Human readable agent return code.
  */
-static
-const char *lttcomm_agent_ret_code_str(lttcomm_agent_ret_code code)
+static const char *lttcomm_agent_ret_code_str(lttcomm_agent_ret_code code)
 {
        switch (code) {
        case AGENT_RET_CODE_SUCCESS:
@@ -70,8 +67,7 @@ const char *lttcomm_agent_ret_code_str(lttcomm_agent_ret_code code)
        }
 };
 
-static
-void log_reply_code(uint32_t in_reply_ret_code)
+static void log_reply_code(uint32_t in_reply_ret_code)
 {
        int level = PRINT_DBG3;
        /*
@@ -81,22 +77,21 @@ void log_reply_code(uint32_t in_reply_ret_code)
         */
        uint32_t reply_ret_code = in_reply_ret_code;
 
-       if (reply_ret_code < AGENT_RET_CODE_SUCCESS ||
-                       reply_ret_code >= AGENT_RET_CODE_NR) {
+       if (reply_ret_code < AGENT_RET_CODE_SUCCESS || reply_ret_code >= AGENT_RET_CODE_NR) {
                reply_ret_code = AGENT_RET_CODE_NR;
                level = PRINT_ERR;
        }
 
-       LOG(level, "Agent replied with retcode: %s (%" PRIu32 ")",
-                       lttcomm_agent_ret_code_str((lttcomm_agent_ret_code) reply_ret_code),
-                       in_reply_ret_code);
+       LOG(level,
+           "Agent replied with retcode: %s (%" PRIu32 ")",
+           lttcomm_agent_ret_code_str((lttcomm_agent_ret_code) reply_ret_code),
+           in_reply_ret_code);
 }
 
 /*
  * Match function for the events hash table lookup by name.
  */
-static int ht_match_event_by_name(struct cds_lfht_node *node,
-               const void *_key)
+static int ht_match_event_by_name(struct cds_lfht_node *node, const void *_key)
 {
        struct agent_event *event;
        const struct agent_ht_key *key;
@@ -124,8 +119,7 @@ no_match:
  * Match function for the events hash table lookup by name, log level and
  * filter expression.
  */
-static int ht_match_event(struct cds_lfht_node *node,
-               const void *_key)
+static int ht_match_event(struct cds_lfht_node *node, const void *_key)
 {
        struct agent_event *event;
        const struct agent_ht_key *key;
@@ -146,8 +140,10 @@ static int ht_match_event(struct cds_lfht_node *node,
 
        /* Event loglevel value and type. */
        ll_match = loglevels_match(event->loglevel_type,
-               event->loglevel_value, key->loglevel_type,
-               key->loglevel_value, LTTNG_EVENT_LOGLEVEL_ALL);
+                                  event->loglevel_value,
+                                  key->loglevel_type,
+                                  key->loglevel_value,
+                                  LTTNG_EVENT_LOGLEVEL_ALL);
 
        if (!ll_match) {
                goto no_match;
@@ -160,8 +156,9 @@ static int ht_match_event(struct cds_lfht_node *node,
        }
 
        if (event->filter_expression) {
-               if (strncmp(event->filter_expression, key->filter_expression,
-                               strlen(event->filter_expression)) != 0) {
+               if (strncmp(event->filter_expression,
+                           key->filter_expression,
+                           strlen(event->filter_expression)) != 0) {
                        goto no_match;
                }
        }
@@ -175,8 +172,7 @@ no_match:
 /*
  * Add unique agent event based on the event name and loglevel.
  */
-static void add_unique_agent_event(struct lttng_ht *ht,
-               struct agent_event *event)
+static void add_unique_agent_event(struct lttng_ht *ht, struct agent_event *event)
 {
        struct cds_lfht_node *node_ptr;
        struct agent_ht_key key;
@@ -191,8 +187,10 @@ static void add_unique_agent_event(struct lttng_ht *ht,
        key.filter_expression = event->filter_expression;
 
        node_ptr = cds_lfht_add_unique(ht->ht,
-                       ht->hash_fct(event->node.key, lttng_ht_seed),
-                       ht_match_event, &key, &event->node.node);
+                                      ht->hash_fct(event->node.key, lttng_ht_seed),
+                                      ht_match_event,
+                                      &key,
+                                      &event->node.node);
        LTTNG_ASSERT(node_ptr == &event->node.node);
 }
 
@@ -201,10 +199,8 @@ static void add_unique_agent_event(struct lttng_ht *ht,
  */
 static void destroy_event_agent_rcu(struct rcu_head *head)
 {
-       struct lttng_ht_node_str *node =
-               lttng::utils::container_of(head, &lttng_ht_node_str::head);
-       struct agent_event *event =
-               lttng::utils::container_of(node, &agent_event::node);
+       struct lttng_ht_node_str *node = lttng::utils::container_of(head, &lttng_ht_node_str::head);
+       struct agent_event *event = lttng::utils::container_of(node, &agent_event::node);
 
        agent_destroy_event(event);
 }
@@ -216,8 +212,7 @@ static void destroy_app_agent_rcu(struct rcu_head *head)
 {
        struct lttng_ht_node_ulong *node =
                lttng::utils::container_of(head, &lttng_ht_node_ulong::head);
-       struct agent_app *app =
-               lttng::utils::container_of(node, &agent_app::node);
+       struct agent_app *app = lttng::utils::container_of(node, &agent_app::node);
 
        free(app);
 }
@@ -228,8 +223,8 @@ static void destroy_app_agent_rcu(struct rcu_head *head)
  *
  * Return 0 on success or else a negative errno message of sendmsg() op.
  */
-static int send_header(struct lttcomm_sock *sock, uint64_t data_size,
-               uint32_t cmd, uint32_t cmd_version)
+static int
+send_header(struct lttcomm_sock *sock, uint64_t data_size, uint32_t cmd, uint32_t cmd_version)
 {
        int ret;
        ssize_t size;
@@ -259,8 +254,7 @@ error:
  *
  * Return 0 on success or else a negative errno value of sendmsg() op.
  */
-static int send_payload(struct lttcomm_sock *sock, const void *data,
-               size_t size)
+static int send_payload(struct lttcomm_sock *sock, const void *data, size_t size)
 {
        int ret;
        ssize_t len;
@@ -325,8 +319,7 @@ static ssize_t list_events(struct agent_app *app, struct lttng_event **events)
        LTTNG_ASSERT(app->sock);
        LTTNG_ASSERT(events);
 
-       DBG2("Agent listing events for app pid: %d and socket %d", app->pid,
-                       app->sock->fd);
+       DBG2("Agent listing events for app pid: %d and socket %d", app->pid, app->sock->fd);
 
        ret = send_header(app->sock, 0, AGENT_CMD_LIST, 0);
        if (ret < 0) {
@@ -371,8 +364,9 @@ static ssize_t list_events(struct agent_app *app, struct lttng_event **events)
 
        for (i = 0; i < nb_event; i++) {
                offset += len;
-               if (lttng_strncpy(tmp_events[i].name, reply->payload + offset,
-                               sizeof(tmp_events[i].name))) {
+               if (lttng_strncpy(tmp_events[i].name,
+                                 reply->payload + offset,
+                                 sizeof(tmp_events[i].name))) {
                        ret = LTTNG_ERR_INVALID;
                        goto error;
                }
@@ -392,7 +386,6 @@ error:
        free(reply);
        free(tmp_events);
        return -ret;
-
 }
 
 /*
@@ -415,8 +408,10 @@ static int enable_event(const struct agent_app *app, struct agent_event *event)
        LTTNG_ASSERT(app->sock);
        LTTNG_ASSERT(event);
 
-       DBG2("Agent enabling event %s for app pid: %d and socket %d", event->name,
-                       app->pid, app->sock->fd);
+       DBG2("Agent enabling event %s for app pid: %d and socket %d",
+            event->name,
+            app->pid,
+            app->sock->fd);
 
        /*
         * Calculate the payload's size, which is the fixed-size struct followed
@@ -451,8 +446,9 @@ static int enable_event(const struct agent_app *app, struct agent_event *event)
 
        memcpy(bytes_to_send, &msg, sizeof(msg));
        if (filter_expression_length > 0) {
-               memcpy(bytes_to_send + sizeof(msg), event->filter_expression,
-                               filter_expression_length);
+               memcpy(bytes_to_send + sizeof(msg),
+                      event->filter_expression,
+                      filter_expression_length);
        }
 
        ret = send_payload(app->sock, bytes_to_send, data_size);
@@ -490,8 +486,7 @@ error:
 /*
  * Send Pascal-style string. Size is sent as a 32-bit big endian integer.
  */
-static
-int send_pstring(struct lttcomm_sock *sock, const char *str, uint32_t len)
+static int send_pstring(struct lttcomm_sock *sock, const char *str, uint32_t len)
 {
        int ret;
        uint32_t len_be;
@@ -517,7 +512,8 @@ end:
  * Return LTTNG_OK on success or else a LTTNG_ERR* code.
  */
 static int app_context_op(const struct agent_app *app,
-               const struct agent_app_ctx *ctx, enum lttcomm_agent_command cmd)
+                         const struct agent_app_ctx *ctx,
+                         enum lttcomm_agent_command cmd)
 {
        int ret;
        uint32_t reply_ret_code;
@@ -527,13 +523,14 @@ static int app_context_op(const struct agent_app *app,
        LTTNG_ASSERT(app);
        LTTNG_ASSERT(app->sock);
        LTTNG_ASSERT(ctx);
-       LTTNG_ASSERT(cmd == AGENT_CMD_APP_CTX_ENABLE ||
-                       cmd == AGENT_CMD_APP_CTX_DISABLE);
+       LTTNG_ASSERT(cmd == AGENT_CMD_APP_CTX_ENABLE || cmd == AGENT_CMD_APP_CTX_DISABLE);
 
        DBG2("Agent %s application %s:%s for app pid: %d and socket %d",
-                       cmd == AGENT_CMD_APP_CTX_ENABLE ? "enabling" : "disabling",
-                       ctx->provider_name, ctx->ctx_name,
-                       app->pid, app->sock->fd);
+            cmd == AGENT_CMD_APP_CTX_ENABLE ? "enabling" : "disabling",
+            ctx->provider_name,
+            ctx->ctx_name,
+            app->pid,
+            app->sock->fd);
 
        /*
         * Calculate the payload's size, which consists of the size (u32, BE)
@@ -543,29 +540,26 @@ static int app_context_op(const struct agent_app *app,
         */
        app_ctx_provider_name_len = strlen(ctx->provider_name) + 1;
        app_ctx_name_len = strlen(ctx->ctx_name) + 1;
-       data_size = sizeof(uint32_t) + app_ctx_provider_name_len +
-                       sizeof(uint32_t) + app_ctx_name_len;
+       data_size =
+               sizeof(uint32_t) + app_ctx_provider_name_len + sizeof(uint32_t) + app_ctx_name_len;
 
        ret = send_header(app->sock, data_size, cmd, 0);
        if (ret < 0) {
                goto error_io;
        }
 
-       if (app_ctx_provider_name_len > UINT32_MAX ||
-                       app_ctx_name_len > UINT32_MAX) {
+       if (app_ctx_provider_name_len > UINT32_MAX || app_ctx_name_len > UINT32_MAX) {
                ERR("Application context name > MAX_UINT32");
                ret = LTTNG_ERR_INVALID;
                goto error;
        }
 
-       ret = send_pstring(app->sock, ctx->provider_name,
-                       (uint32_t) app_ctx_provider_name_len);
+       ret = send_pstring(app->sock, ctx->provider_name, (uint32_t) app_ctx_provider_name_len);
        if (ret < 0) {
                goto error_io;
        }
 
-       ret = send_pstring(app->sock, ctx->ctx_name,
-                       (uint32_t) app_ctx_name_len);
+       ret = send_pstring(app->sock, ctx->ctx_name, (uint32_t) app_ctx_name_len);
        if (ret < 0) {
                goto error_io;
        }
@@ -611,8 +605,10 @@ static int disable_event(struct agent_app *app, struct agent_event *event)
        LTTNG_ASSERT(app->sock);
        LTTNG_ASSERT(event);
 
-       DBG2("Agent disabling event %s for app pid: %d and socket %d", event->name,
-                       app->pid, app->sock->fd);
+       DBG2("Agent disabling event %s for app pid: %d and socket %d",
+            event->name,
+            app->pid,
+            app->sock->fd);
 
        data_size = sizeof(msg);
        memset(&msg, 0, sizeof(msg));
@@ -678,8 +674,7 @@ int agent_send_registration_done(struct agent_app *app)
  *
  * Return LTTNG_OK on success or else a LTTNG_ERR* code.
  */
-int agent_enable_event(struct agent_event *event,
-               enum lttng_domain_type domain)
+int agent_enable_event(struct agent_event *event, enum lttng_domain_type domain)
 {
        int ret;
        struct agent_app *app;
@@ -689,8 +684,7 @@ int agent_enable_event(struct agent_event *event,
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(the_agent_apps_ht_by_sock->ht, &iter.iter, app,
-                       node.node) {
+       cds_lfht_for_each_entry (the_agent_apps_ht_by_sock->ht, &iter.iter, app, node.node) {
                if (app->domain != domain) {
                        continue;
                }
@@ -710,16 +704,14 @@ error:
        return ret;
 }
 
-static
-void destroy_app_ctx(struct agent_app_ctx *ctx)
+static void destroy_app_ctx(struct agent_app_ctx *ctx)
 {
        free(ctx->provider_name);
        free(ctx->ctx_name);
        free(ctx);
 }
 
-static
-struct agent_app_ctx *create_app_ctx(const struct lttng_event_context *ctx)
+static struct agent_app_ctx *create_app_ctx(const struct lttng_event_context *ctx)
 {
        struct agent_app_ctx *agent_ctx = NULL;
 
@@ -749,8 +741,7 @@ end:
  *
  * Return LTTNG_OK on success or else a LTTNG_ERR* code.
  */
-int agent_enable_context(const struct lttng_event_context *ctx,
-               enum lttng_domain_type domain)
+int agent_enable_context(const struct lttng_event_context *ctx, enum lttng_domain_type domain)
 {
        int ret;
        struct agent_app *app;
@@ -764,8 +755,7 @@ int agent_enable_context(const struct lttng_event_context *ctx,
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(the_agent_apps_ht_by_sock->ht, &iter.iter, app,
-                       node.node) {
+       cds_lfht_for_each_entry (the_agent_apps_ht_by_sock->ht, &iter.iter, app, node.node) {
                struct agent_app_ctx *agent_ctx;
 
                if (app->domain != domain) {
@@ -800,8 +790,7 @@ error:
  *
  * Return LTTNG_OK on success or else a LTTNG_ERR* code.
  */
-int agent_disable_event(struct agent_event *event,
-               enum lttng_domain_type domain)
+int agent_disable_event(struct agent_event *event, enum lttng_domain_type domain)
 {
        int ret = LTTNG_OK;
        struct agent_app *app;
@@ -824,8 +813,7 @@ int agent_disable_event(struct agent_event *event,
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(the_agent_apps_ht_by_sock->ht, &iter.iter, app,
-                       node.node) {
+       cds_lfht_for_each_entry (the_agent_apps_ht_by_sock->ht, &iter.iter, app, node.node) {
                if (app->domain != domain) {
                        continue;
                }
@@ -852,8 +840,7 @@ end:
  *
  * Return LTTNG_OK on success or else a LTTNG_ERR* code.
  */
-static int disable_context(struct agent_app_ctx *ctx,
-               enum lttng_domain_type domain)
+static int disable_context(struct agent_app_ctx *ctx, enum lttng_domain_type domain)
 {
        int ret = LTTNG_OK;
        struct agent_app *app;
@@ -862,10 +849,8 @@ static int disable_context(struct agent_app_ctx *ctx,
        LTTNG_ASSERT(ctx);
 
        rcu_read_lock();
-       DBG2("Disabling agent application context %s:%s",
-                       ctx->provider_name, ctx->ctx_name);
-       cds_lfht_for_each_entry(the_agent_apps_ht_by_sock->ht, &iter.iter, app,
-                       node.node) {
+       DBG2("Disabling agent application context %s:%s", ctx->provider_name, ctx->ctx_name);
+       cds_lfht_for_each_entry (the_agent_apps_ht_by_sock->ht, &iter.iter, app, node.node) {
                if (app->domain != domain) {
                        continue;
                }
@@ -886,8 +871,7 @@ end:
  *
  * Return the number of events or else a negative value.
  */
-int agent_list_events(struct lttng_event **events,
-               enum lttng_domain_type domain)
+int agent_list_events(struct lttng_event **events, enum lttng_domain_type domain)
 {
        int ret;
        size_t nbmem, count = 0;
@@ -908,8 +892,7 @@ int agent_list_events(struct lttng_event **events,
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(the_agent_apps_ht_by_sock->ht, &iter.iter, app,
-                       node.node) {
+       cds_lfht_for_each_entry (the_agent_apps_ht_by_sock->ht, &iter.iter, app, node.node) {
                ssize_t nb_ev;
                struct lttng_event *agent_events;
 
@@ -931,9 +914,10 @@ int agent_list_events(struct lttng_event **events,
 
                        new_nbmem = std::max(count + nb_ev, nbmem << 1);
                        DBG2("Reallocating agent event list from %zu to %zu entries",
-                                       nbmem, new_nbmem);
-                       new_tmp_events = (lttng_event *) realloc(tmp_events,
-                               new_nbmem * sizeof(*new_tmp_events));
+                            nbmem,
+                            new_nbmem);
+                       new_tmp_events = (lttng_event *) realloc(
+                               tmp_events, new_nbmem * sizeof(*new_tmp_events));
                        if (!new_tmp_events) {
                                PERROR("realloc agent events");
                                ret = -ENOMEM;
@@ -941,13 +925,13 @@ int agent_list_events(struct lttng_event **events,
                                goto error_unlock;
                        }
                        /* Zero the new memory */
-                       memset(new_tmp_events + nbmem, 0,
-                               (new_nbmem - nbmem) * sizeof(*new_tmp_events));
+                       memset(new_tmp_events + nbmem,
+                              0,
+                              (new_nbmem - nbmem) * sizeof(*new_tmp_events));
                        nbmem = new_nbmem;
                        tmp_events = new_tmp_events;
                }
-               memcpy(tmp_events + count, agent_events,
-                       nb_ev * sizeof(*tmp_events));
+               memcpy(tmp_events + count, agent_events, nb_ev * sizeof(*tmp_events));
                free(agent_events);
                count += nb_ev;
        }
@@ -969,8 +953,8 @@ error:
  *
  * Return newly allocated object or else NULL on error.
  */
-struct agent_app *agent_create_app(pid_t pid, enum lttng_domain_type domain,
-               struct lttcomm_sock *sock)
+struct agent_app *
+agent_create_app(pid_t pid, enum lttng_domain_type domain, struct lttcomm_sock *sock)
 {
        struct agent_app *app;
 
@@ -1007,8 +991,7 @@ struct agent_app *agent_find_app_by_sock(int sock)
        LTTNG_ASSERT(sock >= 0);
        ASSERT_RCU_READ_LOCKED();
 
-       lttng_ht_lookup(the_agent_apps_ht_by_sock,
-                       (void *) ((unsigned long) sock), &iter);
+       lttng_ht_lookup(the_agent_apps_ht_by_sock, (void *) ((unsigned long) sock), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
        if (node == NULL) {
                goto error;
@@ -1143,15 +1126,19 @@ error:
  * Return a new object else NULL on error.
  */
 struct agent_event *agent_create_event(const char *name,
-               enum lttng_loglevel_type loglevel_type, int loglevel_value,
-               struct lttng_bytecode *filter, char *filter_expression)
+                                      enum lttng_loglevel_type loglevel_type,
+                                      int loglevel_value,
+                                      struct lttng_bytecode *filter,
+                                      char *filter_expression)
 {
        struct agent_event *event = NULL;
 
        DBG3("Agent create new event with name %s, loglevel type %d, \
                        loglevel value %d and filter %s",
-                       name, loglevel_type, loglevel_value,
-                       filter_expression ? filter_expression : "NULL");
+            name,
+            loglevel_type,
+            loglevel_value,
+            filter_expression ? filter_expression : "NULL");
 
        if (!name) {
                ERR("Failed to create agent event; no name provided.");
@@ -1208,8 +1195,7 @@ int agent_add_context(const struct lttng_event_context *ctx, struct agent *agt)
                goto end;
        }
 
-       DBG3("Agent adding context %s:%s", ctx->u.app_ctx.provider_name,
-                       ctx->u.app_ctx.ctx_name);
+       DBG3("Agent adding context %s:%s", ctx->u.app_ctx.provider_name, ctx->u.app_ctx.ctx_name);
        cds_list_add_tail_rcu(&agent_ctx->list_node, &agt->app_ctx_list);
 end:
        return ret;
@@ -1223,8 +1209,7 @@ end:
  *
  * Sets the given iterator.
  */
-void agent_find_events_by_name(const char *name, struct agent *agt,
-               struct lttng_ht_iter* iter)
+void agent_find_events_by_name(const char *name, struct agent *agt, struct lttng_ht_iter *iter)
 {
        struct lttng_ht *ht;
        struct agent_ht_key key;
@@ -1238,8 +1223,11 @@ void agent_find_events_by_name(const char *name, struct agent *agt,
        ht = agt->events;
        key.name = name;
 
-       cds_lfht_lookup(ht->ht, ht->hash_fct((void *) name, lttng_ht_seed),
-                       ht_match_event_by_name, &key, &iter->iter);
+       cds_lfht_lookup(ht->ht,
+                       ht->hash_fct((void *) name, lttng_ht_seed),
+                       ht_match_event_by_name,
+                       &key,
+                       &iter->iter);
 }
 
 /*
@@ -1250,8 +1238,8 @@ void agent_find_events_by_name(const char *name, struct agent *agt,
  *
  * Return object if found else NULL.
  */
-struct agent_event *agent_find_event_by_trigger(
-               const struct lttng_trigger *trigger, struct agent *agt)
+struct agent_event *agent_find_event_by_trigger(const struct lttng_trigger *trigger,
+                                               struct agent *agt)
 {
        enum lttng_condition_status c_status;
        enum lttng_event_rule_status er_status;
@@ -1274,30 +1262,23 @@ struct agent_event *agent_find_event_by_trigger(
        condition = lttng_trigger_get_const_condition(trigger);
 
        LTTNG_ASSERT(lttng_condition_get_type(condition) ==
-                       LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
+                    LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
 
-       c_status = lttng_condition_event_rule_matches_get_rule(
-                       condition, &rule);
+       c_status = lttng_condition_event_rule_matches_get_rule(condition, &rule);
        LTTNG_ASSERT(c_status == LTTNG_CONDITION_STATUS_OK);
 
        switch (lttng_event_rule_get_type(rule)) {
        case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
-               logging_get_name_pattern =
-                               lttng_event_rule_jul_logging_get_name_pattern;
-               logging_get_log_level_rule =
-                               lttng_event_rule_jul_logging_get_log_level_rule;
+               logging_get_name_pattern = lttng_event_rule_jul_logging_get_name_pattern;
+               logging_get_log_level_rule = lttng_event_rule_jul_logging_get_log_level_rule;
                break;
        case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
-               logging_get_name_pattern =
-                               lttng_event_rule_log4j_logging_get_name_pattern;
-               logging_get_log_level_rule =
-                               lttng_event_rule_log4j_logging_get_log_level_rule;
+               logging_get_name_pattern = lttng_event_rule_log4j_logging_get_name_pattern;
+               logging_get_log_level_rule = lttng_event_rule_log4j_logging_get_log_level_rule;
                break;
        case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
-               logging_get_name_pattern =
-                               lttng_event_rule_python_logging_get_name_pattern;
-               logging_get_log_level_rule =
-                               lttng_event_rule_python_logging_get_log_level_rule;
+               logging_get_name_pattern = lttng_event_rule_python_logging_get_name_pattern;
+               logging_get_log_level_rule = lttng_event_rule_python_logging_get_log_level_rule;
                break;
        default:
                abort();
@@ -1306,7 +1287,7 @@ struct agent_event *agent_find_event_by_trigger(
 
        domain = lttng_event_rule_get_domain_type(rule);
        LTTNG_ASSERT(domain == LTTNG_DOMAIN_JUL || domain == LTTNG_DOMAIN_LOG4J ||
-                       domain == LTTNG_DOMAIN_PYTHON);
+                    domain == LTTNG_DOMAIN_PYTHON);
 
        /* Get the event's pattern name ('name' in the legacy terminology). */
        er_status = logging_get_name_pattern(rule, &name);
@@ -1326,8 +1307,7 @@ struct agent_event *agent_find_event_by_trigger(
                abort();
        }
 
-       return agent_find_event(name, loglevel_type, loglevel_value,
-                       filter_expression, agt);
+       return agent_find_event(name, loglevel_type, loglevel_value, filter_expression, agt);
 }
 
 /*
@@ -1337,8 +1317,7 @@ struct agent_event *agent_find_event_by_trigger(
  * The RCU read lock must be held during the iteration and for as long
  * as the object the iterator points to remains in use.
  */
-void agent_event_next_duplicate(const char *name,
-               struct agent *agt, struct lttng_ht_iter* iter)
+void agent_event_next_duplicate(const char *name, struct agent *agt, struct lttng_ht_iter *iter)
 {
        struct agent_ht_key key;
 
@@ -1346,8 +1325,7 @@ void agent_event_next_duplicate(const char *name,
 
        key.name = name;
 
-       cds_lfht_next_duplicate(agt->events->ht, ht_match_event_by_name,
-               &key, &iter->iter);
+       cds_lfht_next_duplicate(agt->events->ht, ht_match_event_by_name, &key, &iter->iter);
 }
 
 /*
@@ -1359,10 +1337,10 @@ void agent_event_next_duplicate(const char *name,
  * Return object if found else NULL.
  */
 struct agent_event *agent_find_event(const char *name,
-               enum lttng_loglevel_type loglevel_type,
-               int loglevel_value,
-               const char *filter_expression,
-               struct agent *agt)
+                                    enum lttng_loglevel_type loglevel_type,
+                                    int loglevel_value,
+                                    const char *filter_expression,
+                                    struct agent *agt)
 {
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
@@ -1380,8 +1358,11 @@ struct agent_event *agent_find_event(const char *name,
        key.loglevel_type = loglevel_type;
        key.filter_expression = filter_expression;
 
-       cds_lfht_lookup(ht->ht, ht->hash_fct((void *) name, lttng_ht_seed),
-                       ht_match_event, &key, &iter.iter);
+       cds_lfht_lookup(ht->ht,
+                       ht->hash_fct((void *) name, lttng_ht_seed),
+                       ht_match_event,
+                       &key,
+                       &iter.iter);
        node = lttng_ht_iter_get_node_str(&iter);
        if (node == NULL) {
                goto error;
@@ -1410,11 +1391,9 @@ void agent_destroy_event(struct agent_event *event)
        free(event);
 }
 
-static
-void destroy_app_ctx_rcu(struct rcu_head *head)
+static void destroy_app_ctx_rcu(struct rcu_head *head)
 {
-       struct agent_app_ctx *ctx =
-                       lttng::utils::container_of(head, &agent_app_ctx::rcu_node);
+       struct agent_app_ctx *ctx = lttng::utils::container_of(head, &agent_app_ctx::rcu_node);
 
        destroy_app_ctx(ctx);
 }
@@ -1433,7 +1412,7 @@ void agent_destroy(struct agent *agt)
        DBG3("Agent destroy");
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(agt->events->ht, &iter.iter, node, node) {
+       cds_lfht_for_each_entry (agt->events->ht, &iter.iter, node, node) {
                int ret;
                struct agent_event *event;
 
@@ -1451,7 +1430,8 @@ void agent_destroy(struct agent *agt)
                call_rcu(&node->head, destroy_event_agent_rcu);
        }
 
-       cds_list_for_each_entry_rcu(ctx, &agt->app_ctx_list, list_node) {
+       cds_list_for_each_entry_rcu(ctx, &agt->app_ctx_list, list_node)
+       {
                (void) disable_context(ctx, agt->domain);
                cds_list_del(&ctx->list_node);
                call_rcu(&ctx->rcu_node, destroy_app_ctx_rcu);
@@ -1508,8 +1488,7 @@ void agent_app_ht_clean(void)
                return;
        }
        rcu_read_lock();
-       cds_lfht_for_each_entry(
-                       the_agent_apps_ht_by_sock->ht, &iter.iter, node, node) {
+       cds_lfht_for_each_entry (the_agent_apps_ht_by_sock->ht, &iter.iter, node, node) {
                struct agent_app *app;
 
                app = lttng::utils::container_of(node, &agent_app::node);
@@ -1544,7 +1523,7 @@ void agent_update(const struct agent *agt, const struct agent_app *app)
         * there is a serious code flow error.
         */
 
-       cds_lfht_for_each_entry(agt->events->ht, &iter.iter, event, node.node) {
+       cds_lfht_for_each_entry (agt->events->ht, &iter.iter, event, node.node) {
                /* Skip event if disabled. */
                if (!AGENT_EVENT_IS_ENABLED(event)) {
                        continue;
@@ -1553,18 +1532,23 @@ void agent_update(const struct agent *agt, const struct agent_app *app)
                ret = enable_event(app, event);
                if (ret != LTTNG_OK) {
                        DBG2("Agent update unable to enable event %s on app pid: %d sock %d",
-                                       event->name, app->pid, app->sock->fd);
+                            event->name,
+                            app->pid,
+                            app->sock->fd);
                        /* Let's try the others here and don't assume the app is dead. */
                        continue;
                }
        }
 
-       cds_list_for_each_entry_rcu(ctx, &agt->app_ctx_list, list_node) {
+       cds_list_for_each_entry_rcu(ctx, &agt->app_ctx_list, list_node)
+       {
                ret = app_context_op(app, ctx, AGENT_CMD_APP_CTX_ENABLE);
                if (ret != LTTNG_OK) {
                        DBG2("Agent update unable to add application context %s:%s on app pid: %d sock %d",
-                                       ctx->provider_name, ctx->ctx_name,
-                                       app->pid, app->sock->fd);
+                            ctx->provider_name,
+                            ctx->ctx_name,
+                            app->pid,
+                            app->sock->fd);
                        continue;
                }
        }
@@ -1595,12 +1579,9 @@ void agent_by_event_notifier_domain_ht_destroy(void)
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(the_trigger_agents_ht_by_domain->ht,
-                       &iter.iter, node, node) {
-               struct agent *agent =
-                               lttng::utils::container_of(node, &agent::node);
-               const int ret = lttng_ht_del(
-                               the_trigger_agents_ht_by_domain, &iter);
+       cds_lfht_for_each_entry (the_trigger_agents_ht_by_domain->ht, &iter.iter, node, node) {
+               struct agent *agent = lttng::utils::container_of(node, &agent::node);
+               const int ret = lttng_ht_del(the_trigger_agents_ht_by_domain, &iter);
 
                LTTNG_ASSERT(ret == 0);
                agent_destroy(agent);
@@ -1610,8 +1591,7 @@ void agent_by_event_notifier_domain_ht_destroy(void)
        lttng_ht_destroy(the_trigger_agents_ht_by_domain);
 }
 
-struct agent *agent_find_by_event_notifier_domain(
-               enum lttng_domain_type domain_type)
+struct agent *agent_find_by_event_notifier_domain(enum lttng_domain_type domain_type)
 {
        struct agent *agt = NULL;
        struct lttng_ht_node_u64 *node;
@@ -1621,7 +1601,7 @@ struct agent *agent_find_by_event_notifier_domain(
        LTTNG_ASSERT(the_trigger_agents_ht_by_domain);
 
        DBG3("Per-event notifier domain agent lookup for domain '%s'",
-                       lttng_domain_type_str(domain_type));
+            lttng_domain_type_str(domain_type));
 
        lttng_ht_lookup(the_trigger_agents_ht_by_domain, &key, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
index ab7d11ae4f51f093c4907f74a23377034cff3cf5..7d00b435d7e05b10b453783fc61b5c2242ca6ed7 100644 (file)
@@ -6,18 +6,18 @@
  */
 
 #define _LGPL_SOURCE
-#include <inttypes.h>
-
-#include <common/common.hpp>
-#include <common/hashtable/utils.hpp>
-
 #include "buffer-registry.hpp"
 #include "fd-limit.hpp"
-#include "ust-consumer.hpp"
 #include "lttng-ust-ctl.hpp"
 #include "lttng-ust-error.hpp"
+#include "ust-consumer.hpp"
 #include "utils.hpp"
 
+#include <common/common.hpp>
+#include <common/hashtable/utils.hpp>
+
+#include <inttypes.h>
+
 /*
  * Set in main.c during initialization process of the daemon. This contains
  * buffer_reg_uid object which are global registry for per UID buffer. Object
@@ -48,9 +48,8 @@ static int ht_match_reg_uid(struct cds_lfht_node *node, const void *_key)
        LTTNG_ASSERT(reg);
        key = (buffer_reg_uid *) _key;
 
-       if (key->session_id != reg->session_id ||
-                       key->bits_per_long != reg->bits_per_long ||
-                       key->uid != reg->uid) {
+       if (key->session_id != reg->session_id || key->bits_per_long != reg->bits_per_long ||
+           key->uid != reg->uid) {
                goto no_match;
        }
 
@@ -71,7 +70,7 @@ static unsigned long ht_hash_reg_uid(const void *_key, unsigned long seed)
 
        LTTNG_ASSERT(key);
 
-       xored_key = (uint64_t)(key->session_id ^ key->bits_per_long ^ key->uid);
+       xored_key = (uint64_t) (key->session_id ^ key->bits_per_long ^ key->uid);
        return hash_key_u64(&xored_key, seed);
 }
 
@@ -95,9 +94,13 @@ void buffer_reg_init_uid_registry(void)
  *
  * Return 0 on success else a negative value and regp is untouched.
  */
-int buffer_reg_uid_create(uint64_t session_id, uint32_t bits_per_long, uid_t uid,
-               enum lttng_domain_type domain, struct buffer_reg_uid **regp,
-               const char *root_shm_path, const char *shm_path)
+int buffer_reg_uid_create(uint64_t session_id,
+                         uint32_t bits_per_long,
+                         uid_t uid,
+                         enum lttng_domain_type domain,
+                         struct buffer_reg_uid **regp,
+                         const char *root_shm_path,
+                         const char *shm_path)
 {
        int ret = 0;
        struct buffer_reg_uid *reg = NULL;
@@ -128,7 +131,8 @@ int buffer_reg_uid_create(uint64_t session_id, uint32_t bits_per_long, uid_t uid
                strncpy(reg->shm_path, shm_path, sizeof(reg->shm_path));
                reg->shm_path[sizeof(reg->shm_path) - 1] = '\0';
                DBG3("shm path '%s' is assigned to uid buffer registry for session id %" PRIu64,
-                       reg->shm_path, session_id);
+                    reg->shm_path,
+                    session_id);
        }
        reg->registry->channels = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
        if (!reg->registry->channels) {
@@ -140,7 +144,10 @@ int buffer_reg_uid_create(uint64_t session_id, uint32_t bits_per_long, uid_t uid
        *regp = reg;
 
        DBG3("Buffer registry per UID created id: %" PRIu64 ", ABI: %u, uid: %d, domain: %d",
-                       session_id, bits_per_long, uid, domain);
+            session_id,
+            bits_per_long,
+            uid,
+            domain);
 
        return 0;
 
@@ -161,12 +168,12 @@ void buffer_reg_uid_add(struct buffer_reg_uid *reg)
 
        LTTNG_ASSERT(reg);
 
-       DBG3("Buffer registry per UID adding to global registry with id: %" PRIu64 ,
-                       reg->session_id);
+       DBG3("Buffer registry per UID adding to global registry with id: %" PRIu64,
+            reg->session_id);
 
        rcu_read_lock();
-       nodep = cds_lfht_add_unique(ht->ht, ht->hash_fct(reg, lttng_ht_seed),
-                       ht->match_fct, reg, &reg->node.node);
+       nodep = cds_lfht_add_unique(
+               ht->ht, ht->hash_fct(reg, lttng_ht_seed), ht->match_fct, reg, &reg->node.node);
        LTTNG_ASSERT(nodep == &reg->node.node);
        rcu_read_unlock();
 }
@@ -177,8 +184,7 @@ void buffer_reg_uid_add(struct buffer_reg_uid *reg)
  *
  * Return the object pointer or NULL on error.
  */
-struct buffer_reg_uid *buffer_reg_uid_find(uint64_t session_id,
-               uint32_t bits_per_long, uid_t uid)
+struct buffer_reg_uid *buffer_reg_uid_find(uint64_t session_id, uint32_t bits_per_long, uid_t uid)
 {
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
@@ -193,11 +199,12 @@ struct buffer_reg_uid *buffer_reg_uid_find(uint64_t session_id,
        key.uid = uid;
 
        DBG3("Buffer registry per UID find id: %" PRIu64 ", ABI: %u, uid: %d",
-                       session_id, bits_per_long, uid);
+            session_id,
+            bits_per_long,
+            uid);
 
        /* Custom lookup function since it's a different key. */
-       cds_lfht_lookup(ht->ht, ht->hash_fct(&key, lttng_ht_seed), ht->match_fct,
-                       &key, &iter.iter);
+       cds_lfht_lookup(ht->ht, ht->hash_fct(&key, lttng_ht_seed), ht->match_fct, &key, &iter.iter);
        node = lttng_ht_iter_get_node_u64(&iter);
        if (!node) {
                goto end;
@@ -226,8 +233,10 @@ void buffer_reg_init_pid_registry(void)
  *
  * Return 0 on success else a negative value and regp is untouched.
  */
-int buffer_reg_pid_create(uint64_t session_id, struct buffer_reg_pid **regp,
-               const char *root_shm_path, const char *shm_path)
+int buffer_reg_pid_create(uint64_t session_id,
+                         struct buffer_reg_pid **regp,
+                         const char *root_shm_path,
+                         const char *shm_path)
 {
        int ret = 0;
        struct buffer_reg_pid *reg = NULL;
@@ -256,7 +265,8 @@ int buffer_reg_pid_create(uint64_t session_id, struct buffer_reg_pid **regp,
                strncpy(reg->shm_path, shm_path, sizeof(reg->shm_path));
                reg->shm_path[sizeof(reg->shm_path) - 1] = '\0';
                DBG3("shm path '%s' is assigned to pid buffer registry for session id %" PRIu64,
-                               reg->shm_path, session_id);
+                    reg->shm_path,
+                    session_id);
        }
        reg->registry->channels = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
        if (!reg->registry->channels) {
@@ -267,8 +277,7 @@ int buffer_reg_pid_create(uint64_t session_id, struct buffer_reg_pid **regp,
        lttng_ht_node_init_u64(&reg->node, reg->session_id);
        *regp = reg;
 
-       DBG3("Buffer registry per PID created with session id: %" PRIu64,
-                       session_id);
+       DBG3("Buffer registry per PID created with session id: %" PRIu64, session_id);
 
        return 0;
 
@@ -287,7 +296,7 @@ void buffer_reg_pid_add(struct buffer_reg_pid *reg)
        LTTNG_ASSERT(reg);
 
        DBG3("Buffer registry per PID adding to global registry with id: %" PRIu64,
-                       reg->session_id);
+            reg->session_id);
 
        rcu_read_lock();
        lttng_ht_add_unique_u64(buffer_registry_pid, &reg->node);
@@ -325,9 +334,9 @@ end:
  *
  * Return the matching key or -1 if not found.
  */
-int buffer_reg_uid_consumer_channel_key(
-               struct cds_list_head *buffer_reg_uid_list,
-               uint64_t chan_key, uint64_t *consumer_chan_key)
+int buffer_reg_uid_consumer_channel_key(struct cds_list_head *buffer_reg_uid_list,
+                                       uint64_t chan_key,
+                                       uint64_t *consumer_chan_key)
 {
        struct lttng_ht_iter iter;
        struct buffer_reg_uid *uid_reg = NULL;
@@ -340,10 +349,10 @@ int buffer_reg_uid_consumer_channel_key(
         * For the per-uid registry, we have to iterate since we don't have the
         * uid and bitness key.
         */
-       cds_list_for_each_entry(uid_reg, buffer_reg_uid_list, lnode) {
+       cds_list_for_each_entry (uid_reg, buffer_reg_uid_list, lnode) {
                session_reg = uid_reg->registry;
-               cds_lfht_for_each_entry(session_reg->channels->ht,
-                               &iter.iter, reg_chan, node.node) {
+               cds_lfht_for_each_entry (
+                       session_reg->channels->ht, &iter.iter, reg_chan, node.node) {
                        if (reg_chan->key == chan_key) {
                                *consumer_chan_key = reg_chan->consumer_key;
                                ret = 0;
@@ -415,8 +424,7 @@ int buffer_reg_stream_create(struct buffer_reg_stream **regp)
 /*
  * Add stream to the list in the channel.
  */
-void buffer_reg_stream_add(struct buffer_reg_stream *stream,
-               struct buffer_reg_channel *channel)
+void buffer_reg_stream_add(struct buffer_reg_stream *stream, struct buffer_reg_channel *channel)
 {
        LTTNG_ASSERT(stream);
        LTTNG_ASSERT(channel);
@@ -430,8 +438,7 @@ void buffer_reg_stream_add(struct buffer_reg_stream *stream,
 /*
  * Add a buffer registry channel object to the given session.
  */
-void buffer_reg_channel_add(struct buffer_reg_session *session,
-               struct buffer_reg_channel *channel)
+void buffer_reg_channel_add(struct buffer_reg_session *session, struct buffer_reg_channel *channel)
 {
        LTTNG_ASSERT(session);
        LTTNG_ASSERT(channel);
@@ -448,8 +455,7 @@ void buffer_reg_channel_add(struct buffer_reg_session *session,
  *
  * Return the object pointer or NULL on error.
  */
-struct buffer_reg_channel *buffer_reg_channel_find(uint64_t key,
-               struct buffer_reg_uid *reg)
+struct buffer_reg_channel *buffer_reg_channel_find(uint64_t key, struct buffer_reg_uid *reg)
 {
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
@@ -481,15 +487,13 @@ end:
 /*
  * Destroy a buffer registry stream with the given domain.
  */
-void buffer_reg_stream_destroy(struct buffer_reg_stream *regp,
-               enum lttng_domain_type domain)
+void buffer_reg_stream_destroy(struct buffer_reg_stream *regp, enum lttng_domain_type domain)
 {
        if (!regp) {
                return;
        }
 
-       DBG3("Buffer registry stream destroy with handle %d",
-                       regp->obj.ust->handle);
+       DBG3("Buffer registry stream destroy with handle %d", regp->obj.ust->handle);
 
        switch (domain) {
        case LTTNG_DOMAIN_UST:
@@ -499,7 +503,8 @@ void buffer_reg_stream_destroy(struct buffer_reg_stream *regp,
                ret = ust_app_release_object(NULL, regp->obj.ust);
                if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
                        ERR("Buffer reg stream release obj handle %d failed with ret %d",
-                                       regp->obj.ust->handle, ret);
+                           regp->obj.ust->handle,
+                           ret);
                }
                free(regp->obj.ust);
                lttng_fd_put(LTTNG_FD_APPS, 2);
@@ -517,8 +522,7 @@ void buffer_reg_stream_destroy(struct buffer_reg_stream *regp,
  * Remove buffer registry channel object from the session hash table. RCU read
  * side lock MUST be acquired before calling this.
  */
-void buffer_reg_channel_remove(struct buffer_reg_session *session,
-               struct buffer_reg_channel *regp)
+void buffer_reg_channel_remove(struct buffer_reg_session *session, struct buffer_reg_channel *regp)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -534,8 +538,7 @@ void buffer_reg_channel_remove(struct buffer_reg_session *session,
 /*
  * Destroy a buffer registry channel with the given domain.
  */
-void buffer_reg_channel_destroy(struct buffer_reg_channel *regp,
-               enum lttng_domain_type domain)
+void buffer_reg_channel_destroy(struct buffer_reg_channel *regp, enum lttng_domain_type domain)
 {
        if (!regp) {
                return;
@@ -549,7 +552,7 @@ void buffer_reg_channel_destroy(struct buffer_reg_channel *regp,
                int ret;
                struct buffer_reg_stream *sreg, *stmp;
                /* Wipe stream */
-               cds_list_for_each_entry_safe(sreg, stmp, &regp->streams, lnode) {
+               cds_list_for_each_entry_safe (sreg, stmp, &regp->streams, lnode) {
                        cds_list_del(&sreg->lnode);
                        regp->stream_count--;
                        buffer_reg_stream_destroy(sreg, domain);
@@ -559,7 +562,8 @@ void buffer_reg_channel_destroy(struct buffer_reg_channel *regp,
                        ret = ust_app_release_object(NULL, regp->obj.ust);
                        if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
                                ERR("Buffer reg channel release obj handle %d failed with ret %d",
-                                               regp->obj.ust->handle, ret);
+                                   regp->obj.ust->handle,
+                                   ret);
                        }
                        free(regp->obj.ust);
                }
@@ -578,7 +582,7 @@ void buffer_reg_channel_destroy(struct buffer_reg_channel *regp,
  * Destroy a buffer registry session with the given domain.
  */
 static void buffer_reg_session_destroy(struct buffer_reg_session *regp,
-               enum lttng_domain_type domain)
+                                      enum lttng_domain_type domain)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -588,8 +592,7 @@ static void buffer_reg_session_destroy(struct buffer_reg_session *regp,
 
        /* Destroy all channels. */
        rcu_read_lock();
-       cds_lfht_for_each_entry(regp->channels->ht, &iter.iter, reg_chan,
-                       node.node) {
+       cds_lfht_for_each_entry (regp->channels->ht, &iter.iter, reg_chan, node.node) {
                ret = lttng_ht_del(regp->channels, &iter);
                LTTNG_ASSERT(!ret);
                buffer_reg_channel_destroy(reg_chan, domain);
@@ -629,10 +632,8 @@ void buffer_reg_uid_remove(struct buffer_reg_uid *regp)
 
 static void rcu_free_buffer_reg_uid(struct rcu_head *head)
 {
-       struct lttng_ht_node_u64 *node =
-               lttng::utils::container_of(head, &lttng_ht_node_u64::head);
-       struct buffer_reg_uid *reg =
-               lttng::utils::container_of(node, &buffer_reg_uid::node);
+       struct lttng_ht_node_u64 *node = lttng::utils::container_of(head, &lttng_ht_node_u64::head);
+       struct buffer_reg_uid *reg = lttng::utils::container_of(node, &buffer_reg_uid::node);
 
        buffer_reg_session_destroy(reg->registry, reg->domain);
        free(reg);
@@ -640,10 +641,8 @@ static void rcu_free_buffer_reg_uid(struct rcu_head *head)
 
 static void rcu_free_buffer_reg_pid(struct rcu_head *head)
 {
-       struct lttng_ht_node_u64 *node =
-               lttng::utils::container_of(head, &lttng_ht_node_u64::head);
-       struct buffer_reg_pid *reg =
-               lttng::utils::container_of(node, &buffer_reg_pid::node);
+       struct lttng_ht_node_u64 *node = lttng::utils::container_of(head, &lttng_ht_node_u64::head);
+       struct buffer_reg_pid *reg = lttng::utils::container_of(node, &buffer_reg_pid::node);
 
        buffer_reg_session_destroy(reg->registry, LTTNG_DOMAIN_UST);
        free(reg);
@@ -654,8 +653,7 @@ static void rcu_free_buffer_reg_pid(struct rcu_head *head)
  * list or hash table. Use buffer_reg_pid_remove() before calling this function
  * for the case that the object is in the global hash table.
  */
-void buffer_reg_uid_destroy(struct buffer_reg_uid *regp,
-               struct consumer_output *consumer)
+void buffer_reg_uid_destroy(struct buffer_reg_uid *regp, struct consumer_output *consumer)
 {
        struct consumer_socket *socket;
 
@@ -664,7 +662,9 @@ void buffer_reg_uid_destroy(struct buffer_reg_uid *regp,
        }
 
        DBG3("Buffer registry per UID destroy with id: %" PRIu64 ", ABI: %u, uid: %d",
-                       regp->session_id, regp->bits_per_long, regp->uid);
+            regp->session_id,
+            regp->bits_per_long,
+            regp->uid);
 
        if (!consumer) {
                goto destroy;
@@ -672,8 +672,7 @@ void buffer_reg_uid_destroy(struct buffer_reg_uid *regp,
 
        rcu_read_lock();
        /* Get the right socket from the consumer object. */
-       socket = consumer_find_socket_by_bitness(regp->bits_per_long,
-                       consumer);
+       socket = consumer_find_socket_by_bitness(regp->bits_per_long, consumer);
        if (!socket) {
                goto unlock;
        }
@@ -683,7 +682,7 @@ void buffer_reg_uid_destroy(struct buffer_reg_uid *regp,
                if (regp->registry->reg.ust->_metadata_key) {
                        /* Return value does not matter. This call will print errors. */
                        (void) consumer_close_metadata(socket,
-                                       regp->registry->reg.ust->_metadata_key);
+                                                      regp->registry->reg.ust->_metadata_key);
                }
                break;
        default:
@@ -725,8 +724,7 @@ void buffer_reg_pid_destroy(struct buffer_reg_pid *regp)
                return;
        }
 
-       DBG3("Buffer registry per PID destroy with id: %" PRIu64,
-                       regp->session_id);
+       DBG3("Buffer registry per PID destroy with id: %" PRIu64, regp->session_id);
 
        /* This registry is only used by UST. */
        call_rcu(&regp->node.head, rcu_free_buffer_reg_pid);
index 540fc973405de16ebcc4d3fddf450827e9018f03..44c3fd0cf6beda8a394edc117f48c880133a0b44 100644 (file)
@@ -7,28 +7,27 @@
  */
 
 #define _LGPL_SOURCE
-#include <inttypes.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <common/common.hpp>
-#include <common/defaults.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-
+#include "agent.hpp"
 #include "channel.hpp"
-#include "lttng-sessiond.hpp"
 #include "kernel.hpp"
+#include "lttng-sessiond.hpp"
 #include "lttng-ust-ctl.hpp"
 #include "lttng-ust-error.hpp"
-#include "utils.hpp"
 #include "ust-app.hpp"
-#include "agent.hpp"
+#include "utils.hpp"
+
+#include <common/common.hpp>
+#include <common/defaults.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+
+#include <inttypes.h>
+#include <string.h>
+#include <unistd.h>
 
 /*
  * Return allocated channel attributes.
  */
-struct lttng_channel *channel_new_default_attr(int dom,
-               enum lttng_buffer_type type)
+struct lttng_channel *channel_new_default_attr(int dom, enum lttng_buffer_type type)
 {
        struct lttng_channel *chan;
        const char *channel_name = DEFAULT_CHANNEL_NAME;
@@ -56,16 +55,14 @@ struct lttng_channel *channel_new_default_attr(int dom,
        switch (dom) {
        case LTTNG_DOMAIN_KERNEL:
                LTTNG_ASSERT(type == LTTNG_BUFFER_GLOBAL);
-               chan->attr.subbuf_size =
-                       default_get_kernel_channel_subbuf_size();
+               chan->attr.subbuf_size = default_get_kernel_channel_subbuf_size();
                chan->attr.num_subbuf = DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM;
                chan->attr.output = DEFAULT_KERNEL_CHANNEL_OUTPUT;
                chan->attr.switch_timer_interval = DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER;
                chan->attr.read_timer_interval = DEFAULT_KERNEL_CHANNEL_READ_TIMER;
                chan->attr.live_timer_interval = DEFAULT_KERNEL_CHANNEL_LIVE_TIMER;
                extended_attr->blocking_timeout = DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT;
-               extended_attr->monitor_timer_interval =
-                       DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER;
+               extended_attr->monitor_timer_interval = DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER;
                break;
        case LTTNG_DOMAIN_JUL:
                channel_name = DEFAULT_JUL_CHANNEL_NAME;
@@ -77,18 +74,15 @@ struct lttng_channel *channel_new_default_attr(int dom,
                channel_name = DEFAULT_PYTHON_CHANNEL_NAME;
                goto common_ust;
        case LTTNG_DOMAIN_UST:
-common_ust:
+       common_ust:
                switch (type) {
                case LTTNG_BUFFER_PER_UID:
                        chan->attr.subbuf_size = default_get_ust_uid_channel_subbuf_size();
                        chan->attr.num_subbuf = DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM;
                        chan->attr.output = DEFAULT_UST_UID_CHANNEL_OUTPUT;
-                       chan->attr.switch_timer_interval =
-                               DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER;
-                       chan->attr.read_timer_interval =
-                               DEFAULT_UST_UID_CHANNEL_READ_TIMER;
-                       chan->attr.live_timer_interval =
-                               DEFAULT_UST_UID_CHANNEL_LIVE_TIMER;
+                       chan->attr.switch_timer_interval = DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER;
+                       chan->attr.read_timer_interval = DEFAULT_UST_UID_CHANNEL_READ_TIMER;
+                       chan->attr.live_timer_interval = DEFAULT_UST_UID_CHANNEL_LIVE_TIMER;
                        extended_attr->blocking_timeout = DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT;
                        extended_attr->monitor_timer_interval =
                                DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER;
@@ -98,12 +92,9 @@ common_ust:
                        chan->attr.subbuf_size = default_get_ust_pid_channel_subbuf_size();
                        chan->attr.num_subbuf = DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM;
                        chan->attr.output = DEFAULT_UST_PID_CHANNEL_OUTPUT;
-                       chan->attr.switch_timer_interval =
-                               DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER;
-                       chan->attr.read_timer_interval =
-                               DEFAULT_UST_PID_CHANNEL_READ_TIMER;
-                       chan->attr.live_timer_interval =
-                               DEFAULT_UST_PID_CHANNEL_LIVE_TIMER;
+                       chan->attr.switch_timer_interval = DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER;
+                       chan->attr.read_timer_interval = DEFAULT_UST_PID_CHANNEL_READ_TIMER;
+                       chan->attr.live_timer_interval = DEFAULT_UST_PID_CHANNEL_LIVE_TIMER;
                        extended_attr->blocking_timeout = DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT;
                        extended_attr->monitor_timer_interval =
                                DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER;
@@ -111,11 +102,10 @@ common_ust:
                }
                break;
        default:
-               goto error;     /* Not implemented */
+               goto error; /* Not implemented */
        }
 
-       if (snprintf(chan->name, sizeof(chan->name), "%s",
-                       channel_name) < 0) {
+       if (snprintf(chan->name, sizeof(chan->name), "%s", channel_name) < 0) {
                PERROR("snprintf default channel name");
                goto error;
        }
@@ -140,8 +130,7 @@ void channel_attr_destroy(struct lttng_channel *channel)
 /*
  * Disable kernel channel of the kernel session.
  */
-int channel_kernel_disable(struct ltt_kernel_session *ksession,
-               char *channel_name)
+int channel_kernel_disable(struct ltt_kernel_session *ksession, char *channel_name)
 {
        int ret;
        struct ltt_kernel_channel *kchan;
@@ -174,7 +163,7 @@ error:
  * Enable kernel channel of the kernel session.
  */
 enum lttng_error_code channel_kernel_enable(struct ltt_kernel_session *ksession,
-               struct ltt_kernel_channel *kchan)
+                                           struct ltt_kernel_channel *kchan)
 {
        enum lttng_error_code ret_code;
 
@@ -213,7 +202,7 @@ static int channel_validate(struct lttng_channel *attr)
 static int channel_validate_kernel(struct lttng_channel *attr)
 {
        /* Kernel channels do not support blocking timeout. */
-       if (((struct lttng_channel_extended *)attr->attr.extended.ptr)->blocking_timeout) {
+       if (((struct lttng_channel_extended *) attr->attr.extended.ptr)->blocking_timeout) {
                return -1;
        }
        return 0;
@@ -223,7 +212,8 @@ static int channel_validate_kernel(struct lttng_channel *attr)
  * Create kernel channel of the kernel session and notify kernel thread.
  */
 enum lttng_error_code channel_kernel_create(struct ltt_kernel_session *ksession,
-               struct lttng_channel *attr, int kernel_pipe)
+                                           struct lttng_channel *attr,
+                                           int kernel_pipe)
 {
        enum lttng_error_code ret_code;
        struct lttng_channel *defattr = NULL;
@@ -232,8 +222,7 @@ enum lttng_error_code channel_kernel_create(struct ltt_kernel_session *ksession,
 
        /* Creating channel attributes if needed */
        if (attr == NULL) {
-               defattr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL,
-                               LTTNG_BUFFER_GLOBAL);
+               defattr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL, LTTNG_BUFFER_GLOBAL);
                if (defattr == NULL) {
                        ret_code = LTTNG_ERR_FATAL;
                        goto error;
@@ -282,7 +271,7 @@ error:
  * Enable UST channel for session and domain.
  */
 enum lttng_error_code channel_ust_enable(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan)
+                                        struct ltt_ust_channel *uchan)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
 
@@ -320,7 +309,6 @@ enum lttng_error_code channel_ust_enable(struct ltt_ust_session *usess,
         */
        (void) ust_app_enable_channel_glb(usess, uchan);
 
-
 end:
        return ret_code;
 }
@@ -329,7 +317,8 @@ end:
  * Create UST channel for session and domain.
  */
 enum lttng_error_code channel_ust_create(struct ltt_ust_session *usess,
-               struct lttng_channel *attr, enum lttng_buffer_type type)
+                                        struct lttng_channel *attr,
+                                        enum lttng_buffer_type type)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
        struct ltt_ust_channel *uchan = NULL;
@@ -385,8 +374,7 @@ enum lttng_error_code channel_ust_create(struct ltt_ust_session *usess,
         * and nonzero. We validate right here for UST, because applications will
         * not report the error to the user (unlike kernel tracing).
         */
-       if (!attr->attr.subbuf_size ||
-                       (attr->attr.subbuf_size & (attr->attr.subbuf_size - 1))) {
+       if (!attr->attr.subbuf_size || (attr->attr.subbuf_size & (attr->attr.subbuf_size - 1))) {
                ret_code = LTTNG_ERR_INVALID;
                goto error;
        }
@@ -399,8 +387,7 @@ enum lttng_error_code channel_ust_create(struct ltt_ust_session *usess,
                goto error;
        }
 
-       if (!attr->attr.num_subbuf ||
-                       (attr->attr.num_subbuf & (attr->attr.num_subbuf - 1))) {
+       if (!attr->attr.num_subbuf || (attr->attr.num_subbuf & (attr->attr.num_subbuf - 1))) {
                ret_code = LTTNG_ERR_INVALID;
                goto error;
        }
@@ -415,7 +402,7 @@ enum lttng_error_code channel_ust_create(struct ltt_ust_session *usess,
         * we won't be able to write the packets on disk
         */
        if ((attr->attr.tracefile_size > 0) &&
-                       (attr->attr.tracefile_size < attr->attr.subbuf_size)) {
+           (attr->attr.tracefile_size < attr->attr.subbuf_size)) {
                ret_code = LTTNG_ERR_INVALID;
                goto error;
        }
@@ -446,7 +433,9 @@ enum lttng_error_code channel_ust_create(struct ltt_ust_session *usess,
        uchan->id = trace_ust_get_next_chan_id(usess);
 
        DBG2("Channel %s is being created for UST with buffer %d and id %" PRIu64,
-                       uchan->name, type, uchan->id);
+            uchan->name,
+            type,
+            uchan->id);
 
        /* Flag session buffer type. */
        if (!usess->buffer_type_changed) {
@@ -460,8 +449,7 @@ enum lttng_error_code channel_ust_create(struct ltt_ust_session *usess,
 
        /* Adding the channel to the channel hash table. */
        rcu_read_lock();
-       if (strncmp(uchan->name, DEFAULT_METADATA_NAME,
-                               sizeof(uchan->name))) {
+       if (strncmp(uchan->name, DEFAULT_METADATA_NAME, sizeof(uchan->name))) {
                lttng_ht_add_unique_str(usess->domain_global.channels, &uchan->node);
                chan_published = true;
        } else {
@@ -470,8 +458,7 @@ enum lttng_error_code channel_ust_create(struct ltt_ust_session *usess,
                 * application exists we can access that data in the shadow copy during
                 * the global update of newly registered application.
                 */
-               memcpy(&usess->metadata_attr, &uchan->attr,
-                               sizeof(usess->metadata_attr));
+               memcpy(&usess->metadata_attr, &uchan->attr, sizeof(usess->metadata_attr));
        }
        rcu_read_unlock();
 
@@ -506,8 +493,7 @@ error:
 /*
  * Disable UST channel for session and domain.
  */
-int channel_ust_disable(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan)
+int channel_ust_disable(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan)
 {
        int ret = LTTNG_OK;
 
@@ -547,8 +533,7 @@ error:
        return ret;
 }
 
-struct lttng_channel *trace_ust_channel_to_lttng_channel(
-               const struct ltt_ust_channel *uchan)
+struct lttng_channel *trace_ust_channel_to_lttng_channel(const struct ltt_ust_channel *uchan)
 {
        struct lttng_channel *channel = NULL, *ret = NULL;
 
@@ -588,10 +573,8 @@ struct lttng_channel *trace_ust_channel_to_lttng_channel(
                break;
        }
 
-       lttng_channel_set_blocking_timeout(
-                       channel, uchan->attr.u.s.blocking_timeout);
-       lttng_channel_set_monitor_timer_interval(
-                       channel, uchan->monitor_timer_interval);
+       lttng_channel_set_blocking_timeout(channel, uchan->attr.u.s.blocking_timeout);
+       lttng_channel_set_monitor_timer_interval(channel, uchan->monitor_timer_interval);
 
        ret = channel;
        channel = NULL;
index 524d545b3bcbfa67d12bcec20b6648943a3ba0b7..03be82d65f1ae370a2fe55c69053de5038e84fd6 100644 (file)
@@ -6,19 +6,19 @@
  */
 
 #define _LGPL_SOURCE
-#include <inttypes.h>
-#include <string.h>
-#include <unistd.h>
+#include "clear.hpp"
+#include "cmd.hpp"
+#include "kernel.hpp"
+#include "session.hpp"
+#include "ust-app.hpp"
 
 #include <common/defaults.hpp>
 #include <common/error.hpp>
 #include <common/utils.hpp>
 
-#include "clear.hpp"
-#include "session.hpp"
-#include "ust-app.hpp"
-#include "kernel.hpp"
-#include "cmd.hpp"
+#include <inttypes.h>
+#include <string.h>
+#include <unistd.h>
 
 namespace {
 struct cmd_clear_session_reply_context {
@@ -26,14 +26,12 @@ struct cmd_clear_session_reply_context {
 };
 } /* namespace */
 
-static
-void cmd_clear_session_reply(const struct ltt_session *session,
-               void *_reply_context)
+static void cmd_clear_session_reply(const struct ltt_session *session, void *_reply_context)
 {
        int ret;
        ssize_t comm_ret;
        const struct cmd_clear_session_reply_context *reply_context =
-                       (cmd_clear_session_reply_context *) _reply_context;
+               (cmd_clear_session_reply_context *) _reply_context;
        struct lttcomm_lttng_msg llm = {
                .cmd_type = LTTCOMM_SESSIOND_COMMAND_CLEAR_SESSION,
                .ret_code = LTTNG_OK,
@@ -44,11 +42,9 @@ void cmd_clear_session_reply(const struct ltt_session *session,
        };
 
        DBG("End of clear command: replying to client");
-       comm_ret = lttcomm_send_unix_sock(reply_context->reply_sock_fd,
-                       &llm, sizeof(llm));
+       comm_ret = lttcomm_send_unix_sock(reply_context->reply_sock_fd, &llm, sizeof(llm));
        if (comm_ret != (ssize_t) sizeof(llm)) {
-               ERR("Failed to send result of session \"%s\" clear to client",
-                               session->name);
+               ERR("Failed to send result of session \"%s\" clear to client", session->name);
        }
        ret = close(reply_context->reply_sock_fd);
        if (ret) {
@@ -78,23 +74,22 @@ int cmd_clear_session(struct ltt_session *session, int *sock_fd)
        }
 
        if (!session->has_been_started) {
-                /*
-                 * Nothing to be cleared, this is not an error: there is
-                 * indeed nothing to do, and there is no reason why we
-                 * should return an error to the user.
-                 */
-                goto end;
+               /*
+                * Nothing to be cleared, this is not an error: there is
+                * indeed nothing to do, and there is no reason why we
+                * should return an error to the user.
+                */
+               goto end;
        }
 
        /* Unsupported feature in lttng-relayd before 2.11. */
        if (session->consumer->type == CONSUMER_DST_NET &&
-                       (session->consumer->relay_major_version == 2 &&
-                       session->consumer->relay_minor_version < 12)) {
+           (session->consumer->relay_major_version == 2 &&
+            session->consumer->relay_minor_version < 12)) {
                ret = LTTNG_ERR_CLEAR_NOT_AVAILABLE_RELAY;
                goto end;
        }
-       if (session->consumer->type == CONSUMER_DST_NET &&
-                       !session->consumer->relay_allows_clear) {
+       if (session->consumer->type == CONSUMER_DST_NET && !session->consumer->relay_allows_clear) {
                ret = LTTNG_ERR_CLEAR_NOT_AVAILABLE_RELAY;
                goto end;
        }
@@ -153,9 +148,8 @@ int cmd_clear_session(struct ltt_session *session, int *sock_fd)
                 * Use rotation to delete local and remote stream files.
                 */
                if (reply_context) {
-                       ret = session_add_clear_notifier(session,
-                                       cmd_clear_session_reply,
-                                       (void *) reply_context);
+                       ret = session_add_clear_notifier(
+                               session, cmd_clear_session_reply, (void *) reply_context);
                        if (ret) {
                                ret = LTTNG_ERR_FATAL;
                                goto end;
@@ -167,8 +161,8 @@ int cmd_clear_session(struct ltt_session *session, int *sock_fd)
                        reply_context = NULL;
                        *sock_fd = -1;
                }
-               ret = cmd_rotate_session(session, NULL, true,
-                       LTTNG_TRACE_CHUNK_COMMAND_TYPE_DELETE);
+               ret = cmd_rotate_session(
+                       session, NULL, true, LTTNG_TRACE_CHUNK_COMMAND_TYPE_DELETE);
                if (ret != LTTNG_OK) {
                        goto end;
                }
@@ -179,8 +173,7 @@ int cmd_clear_session(struct ltt_session *session, int *sock_fd)
        if (session_was_active) {
                /* Kernel tracing */
                if (ksession != NULL) {
-                       DBG("Start kernel tracing session \"%s\"",
-                                       session->name);
+                       DBG("Start kernel tracing session \"%s\"", session->name);
                        ret = start_kernel_session(ksession);
                        if (ret != LTTNG_OK) {
                                goto end;
index f33648fcc3b1541bb5970905c601ebd074ad22bd..43201c71d5e0cb28ed5a5544886c755e3d694623 100644 (file)
@@ -7,6 +7,10 @@
  *
  */
 
+#include "agent-thread.hpp"
+#include "clear.hpp"
+#include "client.hpp"
+#include "cmd.hpp"
 #include "common/buffer-view.hpp"
 #include "common/compat/socket.hpp"
 #include "common/dynamic-array.hpp"
 #include "common/payload-view.hpp"
 #include "common/payload.hpp"
 #include "common/sessiond-comm/sessiond-comm.hpp"
+#include "health-sessiond.hpp"
+#include "kernel.hpp"
+#include "lttng-sessiond.hpp"
 #include "lttng/lttng-error.h"
 #include "lttng/tracker.h"
+#include "manage-consumer.hpp"
+#include "save.hpp"
+#include "testpoint.hpp"
+#include "utils.hpp"
+
 #include <common/compat/getenv.hpp>
 #include <common/tracker.hpp>
 #include <common/unix.hpp>
 #include <common/utils.hpp>
+
 #include <lttng/error-query-internal.hpp>
 #include <lttng/event-internal.hpp>
 #include <lttng/session-descriptor-internal.hpp>
 #include <lttng/session-internal.hpp>
 #include <lttng/userspace-probe-internal.hpp>
+
 #include <pthread.h>
 #include <signal.h>
 #include <stddef.h>
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "agent-thread.hpp"
-#include "clear.hpp"
-#include "client.hpp"
-#include "cmd.hpp"
-#include "health-sessiond.hpp"
-#include "kernel.hpp"
-#include "lttng-sessiond.hpp"
-#include "manage-consumer.hpp"
-#include "save.hpp"
-#include "testpoint.hpp"
-#include "utils.hpp"
-
 namespace {
 bool is_root;
 
@@ -83,13 +85,15 @@ static bool wait_thread_status(void)
  * Return 0 on success, negative value on error.
  */
 static int setup_lttng_msg(struct command_ctx *cmd_ctx,
-       const void *payload_buf, size_t payload_len,
-       const void *cmd_header_buf, size_t cmd_header_len)
+                          const void *payload_buf,
+                          size_t payload_len,
+                          const void *cmd_header_buf,
+                          size_t cmd_header_len)
 {
        int ret = 0;
        const size_t header_len = sizeof(struct lttcomm_lttng_msg);
        const size_t total_msg_size = header_len + cmd_header_len + payload_len;
-       lttcomm_lttng_msg llm {};
+       lttcomm_lttng_msg llm{};
 
        llm.cmd_type = cmd_ctx->lsm.cmd_type;
        llm.pid = (uint32_t) cmd_ctx->lsm.domain.attr.pid;
@@ -106,8 +110,7 @@ static int setup_lttng_msg(struct command_ctx *cmd_ctx,
        cmd_ctx->lttng_msg_size = total_msg_size;
 
        /* Append reply header. */
-       ret = lttng_dynamic_buffer_append(
-                       &cmd_ctx->reply_payload.buffer, &llm, sizeof(llm));
+       ret = lttng_dynamic_buffer_append(&cmd_ctx->reply_payload.buffer, &llm, sizeof(llm));
        if (ret) {
                goto end;
        }
@@ -115,8 +118,7 @@ static int setup_lttng_msg(struct command_ctx *cmd_ctx,
        /* Append command header. */
        if (cmd_header_len) {
                ret = lttng_dynamic_buffer_append(
-                               &cmd_ctx->reply_payload.buffer, cmd_header_buf,
-                               cmd_header_len);
+                       &cmd_ctx->reply_payload.buffer, cmd_header_buf, cmd_header_len);
                if (ret) {
                        goto end;
                }
@@ -125,8 +127,7 @@ static int setup_lttng_msg(struct command_ctx *cmd_ctx,
        /* Append payload. */
        if (payload_len) {
                ret = lttng_dynamic_buffer_append(
-                               &cmd_ctx->reply_payload.buffer, payload_buf,
-                               payload_len);
+                       &cmd_ctx->reply_payload.buffer, payload_buf, payload_len);
                if (ret) {
                        goto end;
                }
@@ -147,8 +148,7 @@ static int setup_empty_lttng_msg(struct command_ctx *cmd_ctx)
        }
 
        /* Append place-holder reply header. */
-       ret = lttng_dynamic_buffer_append(
-                       &cmd_ctx->reply_payload.buffer, &llm, sizeof(llm));
+       ret = lttng_dynamic_buffer_append(&cmd_ctx->reply_payload.buffer, &llm, sizeof(llm));
        if (ret) {
                goto end;
        }
@@ -158,13 +158,12 @@ end:
        return ret;
 }
 
-static void update_lttng_msg(struct command_ctx *cmd_ctx, size_t cmd_header_len,
-               size_t payload_len)
+static void update_lttng_msg(struct command_ctx *cmd_ctx, size_t cmd_header_len, size_t payload_len)
 {
        const size_t header_len = sizeof(struct lttcomm_lttng_msg);
        const size_t total_msg_size = header_len + cmd_header_len + payload_len;
        struct lttcomm_lttng_msg *p_llm;
-       lttcomm_lttng_msg llm {};
+       lttcomm_lttng_msg llm{};
 
        llm.cmd_type = cmd_ctx->lsm.cmd_type;
        llm.pid = (uint32_t) cmd_ctx->lsm.domain.attr.pid;
@@ -226,9 +225,9 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                         * fallback on the 32-bit one,
                         */
                        DBG3("Looking for a kernel consumer at these locations:");
-                       DBG3("  1) %s", the_config.consumerd64_bin_path.value ? : "NULL");
+                       DBG3("  1) %s", the_config.consumerd64_bin_path.value ?: "NULL");
                        DBG3("  2) %s/%s", INSTALL_BIN_PATH, DEFAULT_CONSUMERD_FILE);
-                       DBG3("  3) %s", the_config.consumerd32_bin_path.value ? : "NULL");
+                       DBG3("  3) %s", the_config.consumerd32_bin_path.value ?: "NULL");
                        if (stat(the_config.consumerd64_bin_path.value, &st) == 0) {
                                DBG3("Found location #1");
                                consumer_to_use = the_config.consumerd64_bin_path.value;
@@ -236,7 +235,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                DBG3("Found location #2");
                                consumer_to_use = INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE;
                        } else if (the_config.consumerd32_bin_path.value &&
-                                       stat(the_config.consumerd32_bin_path.value, &st) == 0) {
+                                  stat(the_config.consumerd32_bin_path.value, &st) == 0) {
                                DBG3("Found location #3");
                                consumer_to_use = the_config.consumerd32_bin_path.value;
                        } else {
@@ -244,15 +243,18 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                ret = -EINVAL;
                                goto error;
                        }
-                       DBG("Using kernel consumer at: %s",  consumer_to_use);
-                       (void) execl(consumer_to_use, "lttng-consumerd",
-                                       verbosity, "-k", "--consumerd-cmd-sock",
-                                       consumer_data->cmd_unix_sock_path,
-                                       "--consumerd-err-sock",
-                                       consumer_data->err_unix_sock_path,
-                                       "--group",
-                                       the_config.tracing_group_name.value,
-                                       NULL);
+                       DBG("Using kernel consumer at: %s", consumer_to_use);
+                       (void) execl(consumer_to_use,
+                                    "lttng-consumerd",
+                                    verbosity,
+                                    "-k",
+                                    "--consumerd-cmd-sock",
+                                    consumer_data->cmd_unix_sock_path,
+                                    "--consumerd-err-sock",
+                                    consumer_data->err_unix_sock_path,
+                                    "--group",
+                                    the_config.tracing_group_name.value,
+                                    NULL);
                        break;
                case LTTNG_CONSUMER64_UST:
                {
@@ -265,7 +267,8 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                if (!tmp) {
                                        tmp = "";
                                }
-                               tmplen = strlen(the_config.consumerd64_lib_dir.value) + 1 /* : */ + strlen(tmp);
+                               tmplen = strlen(the_config.consumerd64_lib_dir.value) + 1 /* : */ +
+                                       strlen(tmp);
                                tmpnew = zmalloc<char>(tmplen + 1 /* \0 */);
                                if (!tmpnew) {
                                        ret = -ENOMEM;
@@ -284,16 +287,18 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                }
                        }
                        DBG("Using 64-bit UST consumer at: %s",
-                                       the_config.consumerd64_bin_path.value);
+                           the_config.consumerd64_bin_path.value);
                        (void) execl(the_config.consumerd64_bin_path.value,
-                                       "lttng-consumerd", verbosity, "-u",
-                                       "--consumerd-cmd-sock",
-                                       consumer_data->cmd_unix_sock_path,
-                                       "--consumerd-err-sock",
-                                       consumer_data->err_unix_sock_path,
-                                       "--group",
-                                       the_config.tracing_group_name.value,
-                                       NULL);
+                                    "lttng-consumerd",
+                                    verbosity,
+                                    "-u",
+                                    "--consumerd-cmd-sock",
+                                    consumer_data->cmd_unix_sock_path,
+                                    "--consumerd-err-sock",
+                                    consumer_data->err_unix_sock_path,
+                                    "--group",
+                                    the_config.tracing_group_name.value,
+                                    NULL);
                        break;
                }
                case LTTNG_CONSUMER32_UST:
@@ -307,7 +312,8 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                if (!tmp) {
                                        tmp = "";
                                }
-                               tmplen = strlen(the_config.consumerd32_lib_dir.value) + 1 /* : */ + strlen(tmp);
+                               tmplen = strlen(the_config.consumerd32_lib_dir.value) + 1 /* : */ +
+                                       strlen(tmp);
                                tmpnew = zmalloc<char>(tmplen + 1 /* \0 */);
                                if (!tmpnew) {
                                        ret = -ENOMEM;
@@ -326,16 +332,18 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                }
                        }
                        DBG("Using 32-bit UST consumer at: %s",
-                                       the_config.consumerd32_bin_path.value);
+                           the_config.consumerd32_bin_path.value);
                        (void) execl(the_config.consumerd32_bin_path.value,
-                                       "lttng-consumerd", verbosity, "-u",
-                                       "--consumerd-cmd-sock",
-                                       consumer_data->cmd_unix_sock_path,
-                                       "--consumerd-err-sock",
-                                       consumer_data->err_unix_sock_path,
-                                       "--group",
-                                       the_config.tracing_group_name.value,
-                                       NULL);
+                                    "lttng-consumerd",
+                                    verbosity,
+                                    "-u",
+                                    "--consumerd-cmd-sock",
+                                    consumer_data->cmd_unix_sock_path,
+                                    "--consumerd-err-sock",
+                                    consumer_data->err_unix_sock_path,
+                                    "--group",
+                                    the_config.tracing_group_name.value,
+                                    NULL);
                        break;
                }
                default:
@@ -441,8 +449,7 @@ static int copy_session_consumer(int domain, struct ltt_session *session)
                if (session->kernel_session->consumer) {
                        consumer_output_put(session->kernel_session->consumer);
                }
-               session->kernel_session->consumer =
-                       consumer_copy_output(session->consumer);
+               session->kernel_session->consumer = consumer_copy_output(session->consumer);
                /* Ease our life a bit for the next part */
                consumer = session->kernel_session->consumer;
                dir_name = DEFAULT_KERNEL_TRACE_DIR;
@@ -455,8 +462,7 @@ static int copy_session_consumer(int domain, struct ltt_session *session)
                if (session->ust_session->consumer) {
                        consumer_output_put(session->ust_session->consumer);
                }
-               session->ust_session->consumer =
-                       consumer_copy_output(session->consumer);
+               session->ust_session->consumer = consumer_copy_output(session->consumer);
                /* Ease our life a bit for the next part */
                consumer = session->ust_session->consumer;
                dir_name = DEFAULT_UST_TRACE_DIR;
@@ -467,8 +473,7 @@ static int copy_session_consumer(int domain, struct ltt_session *session)
        }
 
        /* Append correct directory to subdir */
-       ret = lttng_strncpy(consumer->domain_subdir, dir_name,
-                       sizeof(consumer->domain_subdir));
+       ret = lttng_strncpy(consumer->domain_subdir, dir_name, sizeof(consumer->domain_subdir));
        if (ret) {
                ret = LTTNG_ERR_UNK;
                goto error;
@@ -483,8 +488,7 @@ error:
 /*
  * Create an UST session and add it to the session ust list.
  */
-static int create_ust_session(struct ltt_session *session,
-               const struct lttng_domain *domain)
+static int create_ust_session(struct ltt_session *session, const struct lttng_domain *domain)
 {
        int ret;
        struct ltt_ust_session *lus = NULL;
@@ -520,14 +524,11 @@ static int create_ust_session(struct ltt_session *session,
        lus->live_timer_interval = session->live_timer;
        session->ust_session = lus;
        if (session->shm_path[0]) {
-               strncpy(lus->root_shm_path, session->shm_path,
-                       sizeof(lus->root_shm_path));
+               strncpy(lus->root_shm_path, session->shm_path, sizeof(lus->root_shm_path));
                lus->root_shm_path[sizeof(lus->root_shm_path) - 1] = '\0';
-               strncpy(lus->shm_path, session->shm_path,
-                       sizeof(lus->shm_path));
+               strncpy(lus->shm_path, session->shm_path, sizeof(lus->shm_path));
                lus->shm_path[sizeof(lus->shm_path) - 1] = '\0';
-               strncat(lus->shm_path, "/ust",
-                       sizeof(lus->shm_path) - strlen(lus->shm_path) - 1);
+               strncat(lus->shm_path, "/ust", sizeof(lus->shm_path) - strlen(lus->shm_path) - 1);
        }
        /* Copy session output to the newly created UST session */
        ret = copy_session_consumer(domain->type, session);
@@ -585,22 +586,20 @@ error_create:
 /*
  * Count number of session permitted by uid/gid.
  */
-static unsigned int lttng_sessions_count(uid_t uid,
-               gid_t gid __attribute__((unused)))
+static unsigned int lttng_sessions_count(uid_t uid, gid_t gid __attribute__((unused)))
 {
        unsigned int i = 0;
        struct ltt_session *session;
        const struct ltt_session_list *session_list = session_get_list();
 
        DBG("Counting number of available session for UID %d", uid);
-       cds_list_for_each_entry(session, &session_list->head, list) {
+       cds_list_for_each_entry (session, &session_list->head, list) {
                if (!session_get(session)) {
                        continue;
                }
                session_lock(session);
                /* Only count the sessions the user can control. */
-               if (session_access_ok(session, uid) &&
-                               !session->destroyed) {
+               if (session_access_ok(session, uid) && !session->destroyed) {
                        i++;
                }
                session_unlock(session);
@@ -610,9 +609,9 @@ static unsigned int lttng_sessions_count(uid_t uid,
 }
 
 static enum lttng_error_code receive_lttng_trigger(struct command_ctx *cmd_ctx,
-               int sock,
-               int *sock_error,
-               struct lttng_trigger **_trigger)
+                                                  int sock,
+                                                  int *sock_error,
+                                                  struct lttng_trigger **_trigger)
 {
        int ret;
        size_t trigger_len;
@@ -623,15 +622,13 @@ static enum lttng_error_code receive_lttng_trigger(struct command_ctx *cmd_ctx,
 
        lttng_payload_init(&trigger_payload);
        trigger_len = (size_t) cmd_ctx->lsm.u.trigger.length;
-       ret = lttng_dynamic_buffer_set_size(
-                       &trigger_payload.buffer, trigger_len);
+       ret = lttng_dynamic_buffer_set_size(&trigger_payload.buffer, trigger_len);
        if (ret) {
                ret_code = LTTNG_ERR_NOMEM;
                goto end;
        }
 
-       sock_recv_len = lttcomm_recv_unix_sock(
-                       sock, trigger_payload.buffer.data, trigger_len);
+       sock_recv_len = lttcomm_recv_unix_sock(sock, trigger_payload.buffer.data, trigger_len);
        if (sock_recv_len < 0 || sock_recv_len != trigger_len) {
                ERR("Failed to receive trigger in command payload");
                *sock_error = 1;
@@ -642,17 +639,18 @@ static enum lttng_error_code receive_lttng_trigger(struct command_ctx *cmd_ctx,
        /* Receive fds, if any. */
        if (cmd_ctx->lsm.fd_count > 0) {
                sock_recv_len = lttcomm_recv_payload_fds_unix_sock(
-                               sock, cmd_ctx->lsm.fd_count, &trigger_payload);
-               if (sock_recv_len > 0 &&
-                               sock_recv_len != cmd_ctx->lsm.fd_count * sizeof(int)) {
+                       sock, cmd_ctx->lsm.fd_count, &trigger_payload);
+               if (sock_recv_len > 0 && sock_recv_len != cmd_ctx->lsm.fd_count * sizeof(int)) {
                        ERR("Failed to receive all file descriptors for trigger in command payload: expected fd count = %u, ret = %d",
-                                       cmd_ctx->lsm.fd_count, (int) ret);
+                           cmd_ctx->lsm.fd_count,
+                           (int) ret);
                        ret_code = LTTNG_ERR_INVALID_PROTOCOL;
                        *sock_error = 1;
                        goto end;
                } else if (sock_recv_len <= 0) {
                        ERR("Failed to receive file descriptors for trigger in command payload: expected fd count = %u, ret = %d",
-                                       cmd_ctx->lsm.fd_count, (int) ret);
+                           cmd_ctx->lsm.fd_count,
+                           (int) ret);
                        ret_code = LTTNG_ERR_FATAL;
                        *sock_error = 1;
                        goto end;
@@ -662,11 +660,9 @@ static enum lttng_error_code receive_lttng_trigger(struct command_ctx *cmd_ctx,
        /* Deserialize trigger. */
        {
                struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &trigger_payload, 0, -1);
+                       lttng_payload_view_from_payload(&trigger_payload, 0, -1);
 
-               if (lttng_trigger_create_from_payload(&view, &trigger) !=
-                               trigger_len) {
+               if (lttng_trigger_create_from_payload(&view, &trigger) != trigger_len) {
                        ERR("Invalid trigger received as part of command payload");
                        ret_code = LTTNG_ERR_INVALID_TRIGGER;
                        lttng_trigger_put(trigger);
@@ -683,9 +679,9 @@ end:
 }
 
 static enum lttng_error_code receive_lttng_error_query(struct command_ctx *cmd_ctx,
-               int sock,
-               int *sock_error,
-               struct lttng_error_query **_query)
+                                                      int sock,
+                                                      int *sock_error,
+                                                      struct lttng_error_query **_query)
 {
        int ret;
        size_t query_len;
@@ -702,8 +698,7 @@ static enum lttng_error_code receive_lttng_error_query(struct command_ctx *cmd_c
                goto end;
        }
 
-       sock_recv_len = lttcomm_recv_unix_sock(
-                       sock, query_payload.buffer.data, query_len);
+       sock_recv_len = lttcomm_recv_unix_sock(sock, query_payload.buffer.data, query_len);
        if (sock_recv_len < 0 || sock_recv_len != query_len) {
                ERR("Failed to receive error query in command payload");
                *sock_error = 1;
@@ -714,17 +709,18 @@ static enum lttng_error_code receive_lttng_error_query(struct command_ctx *cmd_c
        /* Receive fds, if any. */
        if (cmd_ctx->lsm.fd_count > 0) {
                sock_recv_len = lttcomm_recv_payload_fds_unix_sock(
-                               sock, cmd_ctx->lsm.fd_count, &query_payload);
-               if (sock_recv_len > 0 &&
-                               sock_recv_len != cmd_ctx->lsm.fd_count * sizeof(int)) {
+                       sock, cmd_ctx->lsm.fd_count, &query_payload);
+               if (sock_recv_len > 0 && sock_recv_len != cmd_ctx->lsm.fd_count * sizeof(int)) {
                        ERR("Failed to receive all file descriptors for error query in command payload: expected fd count = %u, ret = %d",
-                                       cmd_ctx->lsm.fd_count, (int) ret);
+                           cmd_ctx->lsm.fd_count,
+                           (int) ret);
                        ret_code = LTTNG_ERR_INVALID_PROTOCOL;
                        *sock_error = 1;
                        goto end;
                } else if (sock_recv_len <= 0) {
                        ERR("Failed to receive file descriptors for error query in command payload: expected fd count = %u, ret = %d",
-                                       cmd_ctx->lsm.fd_count, (int) ret);
+                           cmd_ctx->lsm.fd_count,
+                           (int) ret);
                        ret_code = LTTNG_ERR_FATAL;
                        *sock_error = 1;
                        goto end;
@@ -734,11 +730,9 @@ static enum lttng_error_code receive_lttng_error_query(struct command_ctx *cmd_c
        /* Deserialize error query. */
        {
                struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &query_payload, 0, -1);
+                       lttng_payload_view_from_payload(&query_payload, 0, -1);
 
-               if (lttng_error_query_create_from_payload(&view, &query) !=
-                               query_len) {
+               if (lttng_error_query_create_from_payload(&view, &query) != query_len) {
                        ERR("Invalid error query received as part of command payload");
                        ret_code = LTTNG_ERR_INVALID_PROTOCOL;
                        goto end;
@@ -754,12 +748,12 @@ end:
 }
 
 static enum lttng_error_code receive_lttng_event(struct command_ctx *cmd_ctx,
-               int sock,
-               int *sock_error,
-               struct lttng_event **out_event,
-               char **out_filter_expression,
-               struct lttng_bytecode **out_bytecode,
-               struct lttng_event_exclusion **out_exclusion)
+                                                int sock,
+                                                int *sock_error,
+                                                struct lttng_event **out_event,
+                                                char **out_filter_expression,
+                                                struct lttng_bytecode **out_bytecode,
+                                                struct lttng_event_exclusion **out_exclusion)
 {
        int ret;
        size_t event_len;
@@ -786,8 +780,7 @@ static enum lttng_error_code receive_lttng_event(struct command_ctx *cmd_ctx,
                goto end;
        }
 
-       sock_recv_len = lttcomm_recv_unix_sock(
-                       sock, event_payload.buffer.data, event_len);
+       sock_recv_len = lttcomm_recv_unix_sock(sock, event_payload.buffer.data, event_len);
        if (sock_recv_len < 0 || sock_recv_len != event_len) {
                ERR("Failed to receive event in command payload");
                *sock_error = 1;
@@ -798,17 +791,18 @@ static enum lttng_error_code receive_lttng_event(struct command_ctx *cmd_ctx,
        /* Receive fds, if any. */
        if (cmd_ctx->lsm.fd_count > 0) {
                sock_recv_len = lttcomm_recv_payload_fds_unix_sock(
-                               sock, cmd_ctx->lsm.fd_count, &event_payload);
-               if (sock_recv_len > 0 &&
-                               sock_recv_len != cmd_ctx->lsm.fd_count * sizeof(int)) {
+                       sock, cmd_ctx->lsm.fd_count, &event_payload);
+               if (sock_recv_len > 0 && sock_recv_len != cmd_ctx->lsm.fd_count * sizeof(int)) {
                        ERR("Failed to receive all file descriptors for event in command payload: expected fd count = %u, ret = %d",
-                                       cmd_ctx->lsm.fd_count, (int) ret);
+                           cmd_ctx->lsm.fd_count,
+                           (int) ret);
                        ret_code = LTTNG_ERR_INVALID_PROTOCOL;
                        *sock_error = 1;
                        goto end;
                } else if (sock_recv_len <= 0) {
                        ERR("Failed to receive file descriptors for event in command payload: expected fd count = %u, ret = %d",
-                                       cmd_ctx->lsm.fd_count, (int) ret);
+                           cmd_ctx->lsm.fd_count,
+                           (int) ret);
                        ret_code = LTTNG_ERR_FATAL;
                        *sock_error = 1;
                        goto end;
@@ -819,12 +813,13 @@ static enum lttng_error_code receive_lttng_event(struct command_ctx *cmd_ctx,
        {
                ssize_t len;
                struct lttng_payload_view event_view =
-                               lttng_payload_view_from_payload(
-                                               &event_payload, 0, -1);
+                       lttng_payload_view_from_payload(&event_payload, 0, -1);
 
-               len = lttng_event_create_from_payload(&event_view, &local_event,
-                                   &local_exclusion, &local_filter_expression,
-                                   &local_bytecode);
+               len = lttng_event_create_from_payload(&event_view,
+                                                     &local_event,
+                                                     &local_exclusion,
+                                                     &local_filter_expression,
+                                                     &local_bytecode);
 
                if (len < 0) {
                        ERR("Failed to create an event from the received buffer");
@@ -833,7 +828,10 @@ static enum lttng_error_code receive_lttng_event(struct command_ctx *cmd_ctx,
                }
 
                if (len != event_len) {
-                       ERR("Userspace probe location from the received buffer is not the advertised length: header length = %zu" PRIu32 ", payload length = %zd", event_len, len);
+                       ERR("Userspace probe location from the received buffer is not the advertised length: header length = %zu" PRIu32
+                           ", payload length = %zd",
+                           event_len,
+                           len);
                        ret_code = LTTNG_ERR_INVALID_PROTOCOL;
                        goto end;
                }
@@ -859,15 +857,14 @@ end:
        return ret_code;
 }
 
-static enum lttng_error_code receive_lttng_event_context(
-               const struct command_ctx *cmd_ctx,
-               int sock,
-               int *sock_error,
-               struct lttng_event_context **out_event_context)
+static enum lttng_error_code
+receive_lttng_event_context(const struct command_ctx *cmd_ctx,
+                           int sock,
+                           int *sock_error,
+                           struct lttng_event_context **out_event_context)
 {
        int ret;
-       const size_t event_context_len =
-                       (size_t) cmd_ctx->lsm.u.context.length;
+       const size_t event_context_len = (size_t) cmd_ctx->lsm.u.context.length;
        ssize_t sock_recv_len;
        enum lttng_error_code ret_code;
        struct lttng_payload event_context_payload;
@@ -875,16 +872,14 @@ static enum lttng_error_code receive_lttng_event_context(
 
        lttng_payload_init(&event_context_payload);
 
-       ret = lttng_dynamic_buffer_set_size(&event_context_payload.buffer,
-                       event_context_len);
+       ret = lttng_dynamic_buffer_set_size(&event_context_payload.buffer, event_context_len);
        if (ret) {
                ret_code = LTTNG_ERR_NOMEM;
                goto end;
        }
 
-       sock_recv_len = lttcomm_recv_unix_sock(
-                       sock, event_context_payload.buffer.data,
-                       event_context_len);
+       sock_recv_len =
+               lttcomm_recv_unix_sock(sock, event_context_payload.buffer.data, event_context_len);
        if (sock_recv_len < 0 || sock_recv_len != event_context_len) {
                ERR("Failed to receive event context in command payload");
                *sock_error = 1;
@@ -896,11 +891,9 @@ static enum lttng_error_code receive_lttng_event_context(
        {
                ssize_t len;
                struct lttng_payload_view event_context_view =
-                               lttng_payload_view_from_payload(
-                                               &event_context_payload, 0, -1);
+                       lttng_payload_view_from_payload(&event_context_payload, 0, -1);
 
-               len = lttng_event_context_create_from_payload(
-                               &event_context_view, &context);
+               len = lttng_event_context_create_from_payload(&event_context_view, &context);
 
                if (len < 0) {
                        ERR("Failed to create a event context from the received buffer");
@@ -909,7 +902,9 @@ static enum lttng_error_code receive_lttng_event_context(
                }
 
                if (len != event_context_len) {
-                       ERR("Event context from the received buffer is not the advertised length: expected length = %zu, payload length = %zd", event_context_len, len);
+                       ERR("Event context from the received buffer is not the advertised length: expected length = %zu, payload length = %zd",
+                           event_context_len,
+                           len);
                        ret_code = LTTNG_ERR_INVALID_PROTOCOL;
                        goto end;
                }
@@ -928,8 +923,8 @@ end:
 /*
  * Version of setup_lttng_msg() without command header.
  */
-static int setup_lttng_msg_no_cmd_header(struct command_ctx *cmd_ctx,
-       void *payload_buf, size_t payload_len)
+static int
+setup_lttng_msg_no_cmd_header(struct command_ctx *cmd_ctx, void *payload_buf, size_t payload_len)
 {
        return setup_lttng_msg(cmd_ctx, payload_buf, payload_len, NULL, 0);
 }
@@ -942,8 +937,7 @@ static int check_rotate_compatible(void)
 {
        int ret = 1;
 
-       if (the_kernel_tracer_version.major != 2 ||
-                       the_kernel_tracer_version.minor < 11) {
+       if (the_kernel_tracer_version.major != 2 || the_kernel_tracer_version.minor < 11) {
                DBG("Kernel tracer version is not compatible with the rotation feature");
                ret = 0;
        }
@@ -967,8 +961,7 @@ static int send_unix_sock(int sock, struct lttng_payload_view *view)
                goto end;
        }
 
-       ret = lttcomm_send_unix_sock(
-                       sock, view->buffer.data, view->buffer.size);
+       ret = lttcomm_send_unix_sock(sock, view->buffer.data, view->buffer.size);
        if (ret < 0) {
                goto end;
        }
@@ -995,8 +988,7 @@ end:
  * A command may assume the ownership of the socket, in which case its value
  * should be set to -1.
  */
-static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
-               int *sock_error)
+static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, int *sock_error)
 {
        int ret = LTTNG_OK;
        bool need_tracing_session = true;
@@ -1005,14 +997,14 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
 
        if (!lttcomm_sessiond_command_is_valid((lttcomm_sessiond_command) cmd_ctx->lsm.cmd_type)) {
                ERR("Unknown client command received: command id = %" PRIu32,
-                               cmd_ctx->lsm.cmd_type);
+                   cmd_ctx->lsm.cmd_type);
                ret = LTTNG_ERR_UND;
                goto error;
        }
 
        DBG("Processing client command '%s\' (%d)",
-               lttcomm_sessiond_command_str((lttcomm_sessiond_command) cmd_ctx->lsm.cmd_type),
-               cmd_ctx->lsm.cmd_type);
+           lttcomm_sessiond_command_str((lttcomm_sessiond_command) cmd_ctx->lsm.cmd_type),
+           cmd_ctx->lsm.cmd_type);
 
        *sock_error = 0;
 
@@ -1058,7 +1050,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
        }
 
        if (the_config.no_kernel && need_domain &&
-                       cmd_ctx->lsm.domain.type == LTTNG_DOMAIN_KERNEL) {
+           cmd_ctx->lsm.domain.type == LTTNG_DOMAIN_KERNEL) {
                if (!is_root) {
                        ret = LTTNG_ERR_NEED_ROOT_SESSIOND;
                } else {
@@ -1083,7 +1075,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
         * this here so we don't have to make the call for no payload at each
         * command.
         */
-       switch(cmd_ctx->lsm.cmd_type) {
+       switch (cmd_ctx->lsm.cmd_type) {
        case LTTCOMM_SESSIOND_COMMAND_LIST_SESSIONS:
        case LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINTS:
        case LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINT_FIELDS:
@@ -1200,8 +1192,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                }
 
                /* Consumer is in an ERROR state. Report back to client */
-               if (need_consumerd && uatomic_read(&the_kernel_consumerd_state) ==
-                                               CONSUMER_ERROR) {
+               if (need_consumerd && uatomic_read(&the_kernel_consumerd_state) == CONSUMER_ERROR) {
                        ret = LTTNG_ERR_NO_KERNCONSUMERD;
                        goto error;
                }
@@ -1219,7 +1210,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 != LTTCOMM_SESSIOND_COMMAND_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) {
@@ -1236,7 +1227,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                         * the consumer output of the session if exist.
                         */
                        ret = consumer_create_socket(&the_kconsumer_data,
-                                       cmd_ctx->session->kernel_session->consumer);
+                                                    cmd_ctx->session->kernel_session->consumer);
                        if (ret < 0) {
                                goto error;
                        }
@@ -1259,9 +1250,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                }
 
                /* Consumer is in an ERROR state. Report back to client */
-               if (need_consumerd &&
-                               uatomic_read(&the_ust_consumerd_state) ==
-                                               CONSUMER_ERROR) {
+               if (need_consumerd && uatomic_read(&the_ust_consumerd_state) == CONSUMER_ERROR) {
                        ret = LTTNG_ERR_NO_USTCONSUMERD;
                        goto error;
                }
@@ -1280,8 +1269,8 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                        /* 64-bit */
                        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 != LTTCOMM_SESSIOND_COMMAND_REGISTER_CONSUMER) {
+                           the_ustconsumer64_data.pid == 0 &&
+                           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) {
@@ -1290,7 +1279,8 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                                        goto error;
                                }
 
-                               uatomic_set(&the_ust_consumerd64_fd, the_ustconsumer64_data.cmd_sock);
+                               uatomic_set(&the_ust_consumerd64_fd,
+                                           the_ustconsumer64_data.cmd_sock);
                                uatomic_set(&the_ust_consumerd_state, CONSUMER_STARTED);
                        } else {
                                pthread_mutex_unlock(&the_ustconsumer64_data.pid_mutex);
@@ -1301,7 +1291,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                         * since it was set above and can ONLY be set in this thread.
                         */
                        ret = consumer_create_socket(&the_ustconsumer64_data,
-                                       cmd_ctx->session->ust_session->consumer);
+                                                    cmd_ctx->session->ust_session->consumer);
                        if (ret < 0) {
                                goto error;
                        }
@@ -1309,8 +1299,8 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                        /* 32-bit */
                        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 != LTTCOMM_SESSIOND_COMMAND_REGISTER_CONSUMER) {
+                           the_ustconsumer32_data.pid == 0 &&
+                           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) {
@@ -1319,7 +1309,8 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                                        goto error;
                                }
 
-                               uatomic_set(&the_ust_consumerd32_fd, the_ustconsumer32_data.cmd_sock);
+                               uatomic_set(&the_ust_consumerd32_fd,
+                                           the_ustconsumer32_data.cmd_sock);
                                uatomic_set(&the_ust_consumerd_state, CONSUMER_STARTED);
                        } else {
                                pthread_mutex_unlock(&the_ustconsumer32_data.pid_mutex);
@@ -1330,7 +1321,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                         * since it was set above and can ONLY be set in this thread.
                         */
                        ret = consumer_create_socket(&the_ustconsumer32_data,
-                                       cmd_ctx->session->ust_session->consumer);
+                                                    cmd_ctx->session->ust_session->consumer);
                        if (ret < 0) {
                                goto error;
                        }
@@ -1344,7 +1335,7 @@ skip_domain:
 
        /* Validate consumer daemon state when start/stop trace command */
        if (cmd_ctx->lsm.cmd_type == LTTCOMM_SESSIOND_COMMAND_START_TRACE ||
-                       cmd_ctx->lsm.cmd_type == LTTCOMM_SESSIOND_COMMAND_STOP_TRACE) {
+           cmd_ctx->lsm.cmd_type == LTTCOMM_SESSIOND_COMMAND_STOP_TRACE) {
                switch (cmd_ctx->lsm.domain.type) {
                case LTTNG_DOMAIN_NONE:
                        break;
@@ -1375,8 +1366,8 @@ skip_domain:
         */
        if (need_tracing_session) {
                if (!session_access_ok(cmd_ctx->session,
-                               LTTNG_SOCK_GET_UID_CRED(&cmd_ctx->creds)) ||
-                               cmd_ctx->session->destroyed) {
+                                      LTTNG_SOCK_GET_UID_CRED(&cmd_ctx->creds)) ||
+                   cmd_ctx->session->destroyed) {
                        ret = LTTNG_ERR_EPERM;
                        goto error;
                }
@@ -1403,8 +1394,7 @@ skip_domain:
        {
                struct lttng_event_context *event_context = NULL;
                const enum lttng_error_code ret_code =
-                       receive_lttng_event_context(
-                               cmd_ctx, *sock, sock_error, &event_context);
+                       receive_lttng_event_context(cmd_ctx, *sock, sock_error, &event_context);
 
                if (ret_code != LTTNG_OK) {
                        ret = (int) ret_code;
@@ -1417,14 +1407,14 @@ skip_domain:
        }
        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);
+               ret = cmd_disable_channel(cmd_ctx->session,
+                                         cmd_ctx->lsm.domain.type,
+                                         cmd_ctx->lsm.u.disable.channel_name);
                break;
        }
        case LTTCOMM_SESSIOND_COMMAND_ENABLE_CHANNEL:
        {
-               ret = cmd_enable_channel(
-                               cmd_ctx, *sock, the_kernel_poll_pipe[1]);
+               ret = cmd_enable_channel(cmd_ctx, *sock, the_kernel_poll_pipe[1]);
                break;
        }
        case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE:
@@ -1432,24 +1422,18 @@ skip_domain:
        {
                struct lttng_dynamic_buffer payload;
                struct lttng_buffer_view payload_view;
-               const bool add_value =
-                               cmd_ctx->lsm.cmd_type ==
-                               LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE;
+               const bool add_value = cmd_ctx->lsm.cmd_type ==
+                       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;
+                       cmd_ctx->lsm.u.process_attr_tracker_add_remove_include_value.name_len;
                const enum lttng_domain_type domain_type =
-                               (enum lttng_domain_type)
-                                               cmd_ctx->lsm.domain.type;
+                       (enum lttng_domain_type) cmd_ctx->lsm.domain.type;
                const enum lttng_process_attr process_attr =
-                               (enum lttng_process_attr) cmd_ctx->lsm.u
-                                               .process_attr_tracker_add_remove_include_value
-                                               .process_attr;
+                       (enum lttng_process_attr) cmd_ctx->lsm.u
+                               .process_attr_tracker_add_remove_include_value.process_attr;
                const enum lttng_process_attr_value_type value_type =
-                               (enum lttng_process_attr_value_type) cmd_ctx
-                                               ->lsm.u
-                                               .process_attr_tracker_add_remove_include_value
-                                               .value_type;
+                       (enum lttng_process_attr_value_type) cmd_ctx->lsm.u
+                               .process_attr_tracker_add_remove_include_value.value_type;
                struct process_attr_value *value;
                enum lttng_error_code ret_code;
                long login_name_max;
@@ -1471,8 +1455,9 @@ skip_domain:
                         * LOGIN_NAME_MAX is defined to 256.
                         */
                        ERR("Rejecting process attribute tracker value %s as the provided exceeds the maximal allowed length: argument length = %zu, maximal length = %ld",
-                                       add_value ? "addition" : "removal",
-                                       name_len, login_name_max);
+                           add_value ? "addition" : "removal",
+                           name_len,
+                           login_name_max);
                        ret = LTTNG_ERR_INVALID;
                        goto error;
                }
@@ -1486,24 +1471,22 @@ skip_domain:
                        ret = lttng_dynamic_buffer_set_size(&payload, name_len);
                        if (ret) {
                                ERR("Failed to allocate buffer to receive payload of %s process attribute tracker value argument",
-                                               add_value ? "add" : "remove");
+                                   add_value ? "add" : "remove");
                                ret = LTTNG_ERR_NOMEM;
                                goto error_add_remove_tracker_value;
                        }
 
-                       ret = lttcomm_recv_unix_sock(
-                                       *sock, payload.data, name_len);
+                       ret = lttcomm_recv_unix_sock(*sock, payload.data, name_len);
                        if (ret <= 0) {
                                ERR("Failed to receive payload of %s process attribute tracker value argument",
-                                               add_value ? "add" : "remove");
+                                   add_value ? "add" : "remove");
                                *sock_error = 1;
                                ret = LTTNG_ERR_INVALID_PROTOCOL;
                                goto error_add_remove_tracker_value;
                        }
                }
 
-               payload_view = lttng_buffer_view_from_dynamic_buffer(
-                               &payload, 0, name_len);
+               payload_view = lttng_buffer_view_from_dynamic_buffer(&payload, 0, name_len);
                if (name_len > 0 && !lttng_buffer_view_is_valid(&payload_view)) {
                        ret = LTTNG_ERR_INVALID_PROTOCOL;
                        goto error_add_remove_tracker_value;
@@ -1514,11 +1497,13 @@ skip_domain:
                 * attribute tracker that is specified and convert the value to
                 * add/remove to the internal sessiond representation.
                 */
-               ret_code = process_attr_value_from_comm(domain_type,
-                               process_attr, value_type,
-                               &cmd_ctx->lsm.u.process_attr_tracker_add_remove_include_value
-                                                .integral_value,
-                               &payload_view, &value);
+               ret_code = process_attr_value_from_comm(
+                       domain_type,
+                       process_attr,
+                       value_type,
+                       &cmd_ctx->lsm.u.process_attr_tracker_add_remove_include_value.integral_value,
+                       &payload_view,
+                       &value);
                if (ret_code != LTTNG_OK) {
                        ret = ret_code;
                        goto error_add_remove_tracker_value;
@@ -1526,12 +1511,10 @@ skip_domain:
 
                if (add_value) {
                        ret = cmd_process_attr_tracker_inclusion_set_add_value(
-                                       cmd_ctx->session, domain_type,
-                                       process_attr, value);
+                               cmd_ctx->session, domain_type, process_attr, value);
                } else {
                        ret = cmd_process_attr_tracker_inclusion_set_remove_value(
-                                       cmd_ctx->session, domain_type,
-                                       process_attr, value);
+                               cmd_ctx->session, domain_type, process_attr, value);
                }
                process_attr_value_destroy(value);
        error_add_remove_tracker_value:
@@ -1542,23 +1525,20 @@ skip_domain:
        {
                enum lttng_tracking_policy tracking_policy;
                const enum lttng_domain_type domain_type =
-                               (enum lttng_domain_type)
-                                               cmd_ctx->lsm.domain.type;
+                       (enum lttng_domain_type) cmd_ctx->lsm.domain.type;
                const enum lttng_process_attr process_attr =
-                               (enum lttng_process_attr) cmd_ctx->lsm.u
-                                               .process_attr_tracker_get_tracking_policy
-                                               .process_attr;
+                       (enum lttng_process_attr) cmd_ctx->lsm.u
+                               .process_attr_tracker_get_tracking_policy.process_attr;
 
                ret = cmd_process_attr_tracker_get_tracking_policy(
-                               cmd_ctx->session, domain_type, process_attr,
-                               &tracking_policy);
+                       cmd_ctx->session, domain_type, process_attr, &tracking_policy);
                if (ret != LTTNG_OK) {
                        goto error;
                }
 
                uint32_t tracking_policy_u32 = tracking_policy;
-               ret = setup_lttng_msg_no_cmd_header(cmd_ctx,
-                               &tracking_policy_u32, sizeof(uint32_t));
+               ret = setup_lttng_msg_no_cmd_header(
+                       cmd_ctx, &tracking_policy_u32, sizeof(uint32_t));
                if (ret < 0) {
                        ret = LTTNG_ERR_NOMEM;
                        goto error;
@@ -1569,20 +1549,16 @@ skip_domain:
        case LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_SET_POLICY:
        {
                const enum lttng_tracking_policy tracking_policy =
-                               (enum lttng_tracking_policy) cmd_ctx->lsm.u
-                                               .process_attr_tracker_set_tracking_policy
-                                               .tracking_policy;
+                       (enum lttng_tracking_policy) cmd_ctx->lsm.u
+                               .process_attr_tracker_set_tracking_policy.tracking_policy;
                const enum lttng_domain_type domain_type =
-                               (enum lttng_domain_type)
-                                               cmd_ctx->lsm.domain.type;
+                       (enum lttng_domain_type) cmd_ctx->lsm.domain.type;
                const enum lttng_process_attr process_attr =
-                               (enum lttng_process_attr) cmd_ctx->lsm.u
-                                               .process_attr_tracker_set_tracking_policy
-                                               .process_attr;
+                       (enum lttng_process_attr) cmd_ctx->lsm.u
+                               .process_attr_tracker_set_tracking_policy.process_attr;
 
                ret = cmd_process_attr_tracker_set_tracking_policy(
-                               cmd_ctx->session, domain_type, process_attr,
-                               tracking_policy);
+                       cmd_ctx->session, domain_type, process_attr, tracking_policy);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -1593,16 +1569,13 @@ skip_domain:
                struct lttng_process_attr_values *values;
                struct lttng_dynamic_buffer reply;
                const enum lttng_domain_type domain_type =
-                               (enum lttng_domain_type)
-                                               cmd_ctx->lsm.domain.type;
+                       (enum lttng_domain_type) cmd_ctx->lsm.domain.type;
                const enum lttng_process_attr process_attr =
-                               (enum lttng_process_attr) cmd_ctx->lsm.u
-                                               .process_attr_tracker_get_inclusion_set
-                                               .process_attr;
+                       (enum lttng_process_attr)
+                               cmd_ctx->lsm.u.process_attr_tracker_get_inclusion_set.process_attr;
 
                ret = cmd_process_attr_tracker_get_inclusion_set(
-                               cmd_ctx->session, domain_type, process_attr,
-                               &values);
+                       cmd_ctx->session, domain_type, process_attr, &values);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -1613,8 +1586,7 @@ skip_domain:
                        goto error_tracker_get_inclusion_set;
                }
 
-               ret = setup_lttng_msg_no_cmd_header(
-                               cmd_ctx, reply.data, reply.size);
+               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, reply.data, reply.size);
                if (ret < 0) {
                        ret = LTTNG_ERR_NOMEM;
                        goto error_tracker_get_inclusion_set;
@@ -1633,9 +1605,13 @@ skip_domain:
                char *filter_expression;
                struct lttng_event_exclusion *exclusions;
                struct lttng_bytecode *bytecode;
-               const enum lttng_error_code ret_code = receive_lttng_event(
-                               cmd_ctx, *sock, sock_error, &event,
-                               &filter_expression, &bytecode, &exclusions);
+               const enum lttng_error_code ret_code = receive_lttng_event(cmd_ctx,
+                                                                          *sock,
+                                                                          sock_error,
+                                                                          &event,
+                                                                          &filter_expression,
+                                                                          &bytecode,
+                                                                          &exclusions);
 
                if (ret_code != LTTNG_OK) {
                        ret = (int) ret_code;
@@ -1647,13 +1623,13 @@ skip_domain:
                 * always transferred.
                 */
                ret = cmd_ctx->lsm.cmd_type == LTTCOMM_SESSIOND_COMMAND_ENABLE_EVENT ?
-                               cmd_enable_event(cmd_ctx, event,
-                                               filter_expression, exclusions,
-                                               bytecode,
-                                               the_kernel_poll_pipe[1]) :
-                               cmd_disable_event(cmd_ctx, event,
-                                               filter_expression, bytecode,
-                                               exclusions);
+                       cmd_enable_event(cmd_ctx,
+                                        event,
+                                        filter_expression,
+                                        exclusions,
+                                        bytecode,
+                                        the_kernel_poll_pipe[1]) :
+                       cmd_disable_event(cmd_ctx, event, filter_expression, bytecode, exclusions);
                lttng_event_destroy(event);
                break;
        }
@@ -1673,16 +1649,15 @@ skip_domain:
                original_payload_size = cmd_ctx->reply_payload.buffer.size;
 
                session_lock_list();
-               ret_code = cmd_list_tracepoints(cmd_ctx->lsm.domain.type,
-                               &cmd_ctx->reply_payload);
+               ret_code = cmd_list_tracepoints(cmd_ctx->lsm.domain.type, &cmd_ctx->reply_payload);
                session_unlock_list();
                if (ret_code != LTTNG_OK) {
                        ret = (int) ret_code;
                        goto error;
                }
 
-               payload_size = cmd_ctx->reply_payload.buffer.size -
-                               command_header_size - original_payload_size;
+               payload_size = cmd_ctx->reply_payload.buffer.size - command_header_size -
+                       original_payload_size;
                update_lttng_msg(cmd_ctx, command_header_size, payload_size);
 
                ret = LTTNG_OK;
@@ -1704,16 +1679,16 @@ skip_domain:
                original_payload_size = cmd_ctx->reply_payload.buffer.size;
 
                session_lock_list();
-               ret_code = cmd_list_tracepoint_fields(
-                               cmd_ctx->lsm.domain.type, &cmd_ctx->reply_payload);
+               ret_code = cmd_list_tracepoint_fields(cmd_ctx->lsm.domain.type,
+                                                     &cmd_ctx->reply_payload);
                session_unlock_list();
                if (ret_code != LTTNG_OK) {
                        ret = (int) ret_code;
                        goto error;
                }
 
-               payload_size = cmd_ctx->reply_payload.buffer.size -
-                               command_header_size - original_payload_size;
+               payload_size = cmd_ctx->reply_payload.buffer.size - command_header_size -
+                       original_payload_size;
                update_lttng_msg(cmd_ctx, command_header_size, payload_size);
 
                ret = LTTNG_OK;
@@ -1740,8 +1715,8 @@ skip_domain:
                        goto error;
                }
 
-               payload_size = cmd_ctx->reply_payload.buffer.size -
-                               command_header_size - original_payload_size;
+               payload_size = cmd_ctx->reply_payload.buffer.size - command_header_size -
+                       original_payload_size;
                update_lttng_msg(cmd_ctx, command_header_size, payload_size);
 
                ret = LTTNG_OK;
@@ -1783,7 +1758,6 @@ skip_domain:
                        goto error;
                }
 
-
                break;
        }
        case LTTCOMM_SESSIOND_COMMAND_START_TRACE:
@@ -1793,11 +1767,9 @@ skip_domain:
                 * enabled time or size-based rotations, we have to make sure
                 * the kernel tracer supports it.
                 */
-               if (!cmd_ctx->session->has_been_started && \
-                               cmd_ctx->session->kernel_session && \
-                               (cmd_ctx->session->rotate_timer_period || \
-                                       cmd_ctx->session->rotate_size) && \
-                               !check_rotate_compatible()) {
+               if (!cmd_ctx->session->has_been_started && cmd_ctx->session->kernel_session &&
+                   (cmd_ctx->session->rotate_timer_period || cmd_ctx->session->rotate_size) &&
+                   !check_rotate_compatible()) {
                        DBG("Kernel tracer version is not compatible with the rotation feature");
                        ret = LTTNG_ERR_ROTATION_WRONG_VERSION;
                        goto error;
@@ -1812,8 +1784,7 @@ skip_domain:
        }
        case LTTCOMM_SESSIOND_COMMAND_DESTROY_SESSION:
        {
-               ret = cmd_destroy_session(cmd_ctx->session,
-                               the_notification_thread_handle, sock);
+               ret = cmd_destroy_session(cmd_ctx->session, the_notification_thread_handle, sock);
                break;
        }
        case LTTCOMM_SESSIOND_COMMAND_LIST_DOMAINS:
@@ -1828,8 +1799,8 @@ skip_domain:
                        goto error;
                }
 
-               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, domains,
-                       nb_dom * sizeof(struct lttng_domain));
+               ret = setup_lttng_msg_no_cmd_header(
+                       cmd_ctx, domains, nb_dom * sizeof(struct lttng_domain));
                free(domains);
 
                if (ret < 0) {
@@ -1854,15 +1825,15 @@ skip_domain:
 
                original_payload_size = cmd_ctx->reply_payload.buffer.size;
 
-               ret_code = cmd_list_channels(cmd_ctx->lsm.domain.type,
-                               cmd_ctx->session, &cmd_ctx->reply_payload);
+               ret_code = cmd_list_channels(
+                       cmd_ctx->lsm.domain.type, cmd_ctx->session, &cmd_ctx->reply_payload);
                if (ret_code != LTTNG_OK) {
                        ret = (int) ret_code;
                        goto error;
                }
 
-               payload_size = cmd_ctx->reply_payload.buffer.size -
-                               command_header_size - original_payload_size;
+               payload_size = cmd_ctx->reply_payload.buffer.size - command_header_size -
+                       original_payload_size;
                update_lttng_msg(cmd_ctx, command_header_size, payload_size);
 
                ret = LTTNG_OK;
@@ -1884,15 +1855,16 @@ skip_domain:
                original_payload_size = cmd_ctx->reply_payload.buffer.size;
 
                ret_code = cmd_list_events(cmd_ctx->lsm.domain.type,
-                               cmd_ctx->session,
-                               cmd_ctx->lsm.u.list.channel_name, &cmd_ctx->reply_payload);
+                                          cmd_ctx->session,
+                                          cmd_ctx->lsm.u.list.channel_name,
+                                          &cmd_ctx->reply_payload);
                if (ret_code != LTTNG_OK) {
                        ret = (int) ret_code;
                        goto error;
                }
 
-               payload_size = cmd_ctx->reply_payload.buffer.size -
-                               command_header_size - original_payload_size;
+               payload_size = cmd_ctx->reply_payload.buffer.size - command_header_size -
+                       original_payload_size;
                update_lttng_msg(cmd_ctx, command_header_size, payload_size);
 
                ret = LTTNG_OK;
@@ -1905,15 +1877,12 @@ skip_domain:
                size_t payload_len = 0;
 
                session_lock_list();
-               nr_sessions = lttng_sessions_count(
-                               LTTNG_SOCK_GET_UID_CRED(&cmd_ctx->creds),
-                               LTTNG_SOCK_GET_GID_CRED(&cmd_ctx->creds));
+               nr_sessions = lttng_sessions_count(LTTNG_SOCK_GET_UID_CRED(&cmd_ctx->creds),
+                                                  LTTNG_SOCK_GET_GID_CRED(&cmd_ctx->creds));
 
                if (nr_sessions > 0) {
-                       payload_len = (sizeof(struct lttng_session) *
-                                                     nr_sessions) +
-                                       (sizeof(struct lttng_session_extended) *
-                                                       nr_sessions);
+                       payload_len = (sizeof(struct lttng_session) * nr_sessions) +
+                               (sizeof(struct lttng_session_extended) * nr_sessions);
                        sessions_payload = zmalloc<lttng_session>(payload_len);
                        if (!sessions_payload) {
                                session_unlock_list();
@@ -1921,15 +1890,15 @@ skip_domain:
                                goto setup_error;
                        }
 
-                       cmd_list_lttng_sessions(sessions_payload, nr_sessions,
-                                       LTTNG_SOCK_GET_UID_CRED(&cmd_ctx->creds),
-                                       LTTNG_SOCK_GET_GID_CRED(&cmd_ctx->creds));
+                       cmd_list_lttng_sessions(sessions_payload,
+                                               nr_sessions,
+                                               LTTNG_SOCK_GET_UID_CRED(&cmd_ctx->creds),
+                                               LTTNG_SOCK_GET_GID_CRED(&cmd_ctx->creds));
                }
 
                session_unlock_list();
 
-               ret = setup_lttng_msg_no_cmd_header(
-                               cmd_ctx, sessions_payload, payload_len);
+               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, sessions_payload, payload_len);
                free(sessions_payload);
 
                if (ret < 0) {
@@ -1952,8 +1921,8 @@ skip_domain:
                        goto error;
                }
 
-               ret = cmd_register_consumer(cmd_ctx->session, cmd_ctx->lsm.domain.type,
-                               cmd_ctx->lsm.u.reg.path, cdata);
+               ret = cmd_register_consumer(
+                       cmd_ctx->session, cmd_ctx->lsm.domain.type, cmd_ctx->lsm.u.reg.path, cdata);
                break;
        }
        case LTTCOMM_SESSIOND_COMMAND_DATA_PENDING:
@@ -1988,8 +1957,7 @@ skip_domain:
                pending_ret_byte = (uint8_t) pending_ret;
 
                /* 1 byte to return whether or not data is pending */
-               ret = setup_lttng_msg_no_cmd_header(cmd_ctx,
-                       &pending_ret_byte, 1);
+               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, &pending_ret_byte, 1);
 
                if (ret < 0) {
                        goto setup_error;
@@ -2004,16 +1972,13 @@ skip_domain:
                struct lttcomm_lttng_output_id reply;
                lttng_snapshot_output output = cmd_ctx->lsm.u.snapshot_output.output;
 
-               ret = cmd_snapshot_add_output(cmd_ctx->session,
-                               &output,
-                               &snapshot_id);
+               ret = cmd_snapshot_add_output(cmd_ctx->session, &output, &snapshot_id);
                if (ret != LTTNG_OK) {
                        goto error;
                }
                reply.id = snapshot_id;
 
-               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, &reply,
-                       sizeof(reply));
+               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, &reply, sizeof(reply));
                if (ret < 0) {
                        goto setup_error;
                }
@@ -2040,8 +2005,8 @@ skip_domain:
                }
 
                LTTNG_ASSERT((nb_output > 0 && outputs) || nb_output == 0);
-               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, outputs,
-                               nb_output * sizeof(struct lttng_snapshot_output));
+               ret = setup_lttng_msg_no_cmd_header(
+                       cmd_ctx, outputs, nb_output * sizeof(struct lttng_snapshot_output));
                free(outputs);
 
                if (ret < 0) {
@@ -2054,8 +2019,9 @@ skip_domain:
        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
+               ret = cmd_snapshot_record(cmd_ctx->session, &output, 0); // RFC: set to zero since
+                                                                        // it's ignored by
+                                                                        // cmd_snapshot_record
                break;
        }
        case LTTCOMM_SESSIOND_COMMAND_CREATE_SESSION_EXT:
@@ -2069,16 +2035,14 @@ skip_domain:
                        goto error;
                }
 
-               ret = lttng_session_descriptor_serialize(return_descriptor,
-                               &payload);
+               ret = lttng_session_descriptor_serialize(return_descriptor, &payload);
                if (ret) {
                        ERR("Failed to serialize session descriptor in reply to \"create session\" command");
                        lttng_session_descriptor_destroy(return_descriptor);
                        ret = LTTNG_ERR_NOMEM;
                        goto error;
                }
-               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, payload.data,
-                               payload.size);
+               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, payload.data, payload.size);
                if (ret) {
                        lttng_session_descriptor_destroy(return_descriptor);
                        ret = LTTNG_ERR_NOMEM;
@@ -2091,14 +2055,13 @@ skip_domain:
        }
        case LTTCOMM_SESSIOND_COMMAND_SAVE_SESSION:
        {
-               ret = cmd_save_sessions(&cmd_ctx->lsm.u.save_session.attr,
-                       &cmd_ctx->creds);
+               ret = cmd_save_sessions(&cmd_ctx->lsm.u.save_session.attr, &cmd_ctx->creds);
                break;
        }
        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);
+                                              cmd_ctx->lsm.u.set_shm_path.shm_path);
                break;
        }
        case LTTCOMM_SESSIOND_COMMAND_REGENERATE_METADATA:
@@ -2128,18 +2091,18 @@ skip_domain:
                        goto setup_error;
                }
 
-               ret = receive_lttng_trigger(
-                               cmd_ctx, *sock, sock_error, &payload_trigger);
+               ret = receive_lttng_trigger(cmd_ctx, *sock, sock_error, &payload_trigger);
                if (ret != LTTNG_OK) {
                        goto error;
                }
 
                original_reply_payload_size = cmd_ctx->reply_payload.buffer.size;
 
-               ret = cmd_register_trigger(&cmd_creds, payload_trigger,
-                               cmd_ctx->lsm.u.trigger.is_trigger_anonymous,
-                               the_notification_thread_handle,
-                               &return_trigger);
+               ret = cmd_register_trigger(&cmd_creds,
+                                          payload_trigger,
+                                          cmd_ctx->lsm.u.trigger.is_trigger_anonymous,
+                                          the_notification_thread_handle,
+                                          &return_trigger);
                if (ret != LTTNG_OK) {
                        lttng_trigger_put(payload_trigger);
                        goto error;
@@ -2154,8 +2117,8 @@ skip_domain:
                        goto error;
                }
 
-               reply_payload_size = cmd_ctx->reply_payload.buffer.size -
-                       original_reply_payload_size;
+               reply_payload_size =
+                       cmd_ctx->reply_payload.buffer.size - original_reply_payload_size;
 
                update_lttng_msg(cmd_ctx, 0, reply_payload_size);
 
@@ -2170,14 +2133,13 @@ skip_domain:
                        .gid = LTTNG_OPTIONAL_INIT_VALUE(cmd_ctx->creds.gid),
                };
 
-               ret = receive_lttng_trigger(
-                               cmd_ctx, *sock, sock_error, &payload_trigger);
+               ret = receive_lttng_trigger(cmd_ctx, *sock, sock_error, &payload_trigger);
                if (ret != LTTNG_OK) {
                        goto error;
                }
 
-               ret = cmd_unregister_trigger(&cmd_creds, payload_trigger,
-                               the_notification_thread_handle);
+               ret = cmd_unregister_trigger(
+                       &cmd_creds, payload_trigger, the_notification_thread_handle);
                lttng_trigger_put(payload_trigger);
                break;
        }
@@ -2194,16 +2156,16 @@ skip_domain:
                        goto error;
                }
 
-               ret = cmd_rotate_session(cmd_ctx->session, &rotate_return,
-                       false,
-                       LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
+               ret = cmd_rotate_session(cmd_ctx->session,
+                                        &rotate_return,
+                                        false,
+                                        LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
                if (ret < 0) {
                        ret = -ret;
                        goto error;
                }
 
-               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, &rotate_return,
-                               sizeof(rotate_return));
+               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, &rotate_return, sizeof(rotate_return));
                if (ret < 0) {
                        ret = -ret;
                        goto error;
@@ -2217,15 +2179,16 @@ skip_domain:
                struct lttng_rotation_get_info_return get_info_return;
 
                memset(&get_info_return, 0, sizeof(get_info_return));
-               ret = cmd_rotate_get_info(cmd_ctx->session, &get_info_return,
-                               cmd_ctx->lsm.u.get_rotation_info.rotation_id);
+               ret = cmd_rotate_get_info(cmd_ctx->session,
+                                         &get_info_return,
+                                         cmd_ctx->lsm.u.get_rotation_info.rotation_id);
                if (ret < 0) {
                        ret = -ret;
                        goto error;
                }
 
-               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, &get_info_return,
-                               sizeof(get_info_return));
+               ret = setup_lttng_msg_no_cmd_header(
+                       cmd_ctx, &get_info_return, sizeof(get_info_return));
                if (ret < 0) {
                        ret = -ret;
                        goto error;
@@ -2247,12 +2210,15 @@ skip_domain:
                }
 
                set_schedule = cmd_ctx->lsm.u.rotation_set_schedule.set == 1;
-               schedule_type = (enum lttng_rotation_schedule_type) cmd_ctx->lsm.u.rotation_set_schedule.type;
+               schedule_type = (enum lttng_rotation_schedule_type)
+                                       cmd_ctx->lsm.u.rotation_set_schedule.type;
                value = cmd_ctx->lsm.u.rotation_set_schedule.value;
 
-               ret = cmd_rotation_set_schedule(cmd_ctx->session, set_schedule,
-                               schedule_type, value,
-                               the_notification_thread_handle);
+               ret = cmd_rotation_set_schedule(cmd_ctx->session,
+                                               set_schedule,
+                                               schedule_type,
+                                               value,
+                                               the_notification_thread_handle);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -2268,8 +2234,7 @@ skip_domain:
                schedules.size.set = !!cmd_ctx->session->rotate_size;
                schedules.size.value = cmd_ctx->session->rotate_size;
 
-               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, &schedules,
-                               sizeof(schedules));
+               ret = setup_lttng_msg_no_cmd_header(cmd_ctx, &schedules, sizeof(schedules));
                if (ret < 0) {
                        ret = -ret;
                        goto error;
@@ -2297,15 +2262,13 @@ skip_domain:
 
                original_payload_size = cmd_ctx->reply_payload.buffer.size;
 
-               ret = cmd_list_triggers(cmd_ctx, the_notification_thread_handle,
-                               &return_triggers);
+               ret = cmd_list_triggers(cmd_ctx, the_notification_thread_handle, &return_triggers);
                if (ret != LTTNG_OK) {
                        goto error;
                }
 
                LTTNG_ASSERT(return_triggers);
-               ret = lttng_triggers_serialize(
-                               return_triggers, &cmd_ctx->reply_payload);
+               ret = lttng_triggers_serialize(return_triggers, &cmd_ctx->reply_payload);
                lttng_triggers_destroy(return_triggers);
                if (ret) {
                        ERR("Failed to serialize triggers in reply to `list triggers` command");
@@ -2313,8 +2276,7 @@ skip_domain:
                        goto error;
                }
 
-               payload_size = cmd_ctx->reply_payload.buffer.size -
-                       original_payload_size;
+               payload_size = cmd_ctx->reply_payload.buffer.size - original_payload_size;
 
                update_lttng_msg(cmd_ctx, 0, payload_size);
 
@@ -2340,22 +2302,20 @@ skip_domain:
 
                original_payload_size = cmd_ctx->reply_payload.buffer.size;
 
-               ret = receive_lttng_error_query(
-                               cmd_ctx, *sock, sock_error, &query);
+               ret = receive_lttng_error_query(cmd_ctx, *sock, sock_error, &query);
                if (ret != LTTNG_OK) {
                        goto error;
                }
 
-               ret = cmd_execute_error_query(&cmd_creds, query, &results,
-                               the_notification_thread_handle);
+               ret = cmd_execute_error_query(
+                       &cmd_creds, query, &results, the_notification_thread_handle);
                lttng_error_query_destroy(query);
                if (ret != LTTNG_OK) {
                        goto error;
                }
 
                LTTNG_ASSERT(results);
-               ret = lttng_error_query_results_serialize(
-                               results, &cmd_ctx->reply_payload);
+               ret = lttng_error_query_results_serialize(results, &cmd_ctx->reply_payload);
                lttng_error_query_results_destroy(results);
                if (ret) {
                        ERR("Failed to serialize error query result set in reply to `execute error query` command");
@@ -2363,8 +2323,7 @@ skip_domain:
                        goto error;
                }
 
-               payload_size = cmd_ctx->reply_payload.buffer.size -
-                       original_payload_size;
+               payload_size = cmd_ctx->reply_payload.buffer.size - original_payload_size;
 
                update_lttng_msg(cmd_ctx, 0, payload_size);
 
@@ -2405,11 +2364,9 @@ static int create_client_sock(void)
        int ret, client_sock;
 
        /* Create client tool unix socket */
-       client_sock = lttcomm_create_unix_sock(
-                       the_config.client_unix_sock_path.value);
+       client_sock = lttcomm_create_unix_sock(the_config.client_unix_sock_path.value);
        if (client_sock < 0) {
-               ERR("Create unix sock failed: %s",
-                               the_config.client_unix_sock_path.value);
+               ERR("Create unix sock failed: %s", the_config.client_unix_sock_path.value);
                ret = -1;
                goto end;
        }
@@ -2418,16 +2375,15 @@ static int create_client_sock(void)
        ret = utils_set_fd_cloexec(client_sock);
        if (ret < 0) {
                ERR("Unable to set CLOEXEC flag to the client Unix socket (fd: %d). "
-                               "Continuing but note that the consumer daemon will have a "
-                               "reference to this socket on exec()", client_sock);
+                   "Continuing but note that the consumer daemon will have a "
+                   "reference to this socket on exec()",
+                   client_sock);
        }
 
        /* File permission MUST be 660 */
-       ret = chmod(the_config.client_unix_sock_path.value,
-                       S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+       ret = chmod(the_config.client_unix_sock_path.value, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
        if (ret < 0) {
-               ERR("Set file permissions failed: %s",
-                               the_config.client_unix_sock_path.value);
+               ERR("Set file permissions failed: %s", the_config.client_unix_sock_path.value);
                PERROR("chmod");
                (void) lttcomm_close_unix_sock(client_sock);
                ret = -1;
@@ -2605,8 +2561,8 @@ static void *thread_manage_clients(void *data)
                 * the client.
                 */
                DBG("Receiving data from client ...");
-               ret = lttcomm_recv_creds_unix_sock(sock, &cmd_ctx.lsm,
-                               sizeof(struct lttcomm_session_msg), &cmd_ctx.creds);
+               ret = lttcomm_recv_creds_unix_sock(
+                       sock, &cmd_ctx.lsm, sizeof(struct lttcomm_session_msg), &cmd_ctx.creds);
                if (ret != sizeof(struct lttcomm_session_msg)) {
                        DBG("Incomplete recv() from client... continuing");
                        ret = close(sock);
@@ -2651,9 +2607,11 @@ static void *thread_manage_clients(void *data)
 
                if (ret < LTTNG_OK || ret >= LTTNG_ERR_NR) {
                        WARN("Command returned an invalid status code, returning unknown error: "
-                                       "command type = %s (%d), ret = %d",
-                                       lttcomm_sessiond_command_str((lttcomm_sessiond_command) cmd_ctx.lsm.cmd_type),
-                                       cmd_ctx.lsm.cmd_type, ret);
+                            "command type = %s (%d), ret = %d",
+                            lttcomm_sessiond_command_str(
+                                    (lttcomm_sessiond_command) cmd_ctx.lsm.cmd_type),
+                            cmd_ctx.lsm.cmd_type,
+                            ret);
                        ret = LTTNG_ERR_UNK;
                }
 
@@ -2661,8 +2619,7 @@ static void *thread_manage_clients(void *data)
                if (cmd_completion_handler) {
                        enum lttng_error_code completion_code;
 
-                       completion_code = cmd_completion_handler->run(
-                                       cmd_completion_handler->data);
+                       completion_code = cmd_completion_handler->run(cmd_completion_handler->data);
                        if (completion_code != LTTNG_OK) {
                                continue;
                        }
@@ -2672,11 +2629,9 @@ static void *thread_manage_clients(void *data)
 
                if (sock >= 0) {
                        struct lttng_payload_view view =
-                                       lttng_payload_view_from_payload(
-                                                       &cmd_ctx.reply_payload,
-                                                       0, -1);
-                       struct lttcomm_lttng_msg *llm = (typeof(
-                                       llm)) cmd_ctx.reply_payload.buffer.data;
+                               lttng_payload_view_from_payload(&cmd_ctx.reply_payload, 0, -1);
+                       struct lttcomm_lttng_msg *llm =
+                               (typeof(llm)) cmd_ctx.reply_payload.buffer.data;
 
                        LTTNG_ASSERT(cmd_ctx.reply_payload.buffer.size >= sizeof(*llm));
                        LTTNG_ASSERT(cmd_ctx.lttng_msg_size == cmd_ctx.reply_payload.buffer.size);
@@ -2684,9 +2639,9 @@ static void *thread_manage_clients(void *data)
                        llm->fd_count = lttng_payload_view_get_fd_handle_count(&view);
 
                        DBG("Sending response (size: %d, retcode: %s (%d))",
-                                       cmd_ctx.lttng_msg_size,
-                                       lttng_strerror(-llm->ret_code),
-                                       llm->ret_code);
+                           cmd_ctx.lttng_msg_size,
+                           lttng_strerror(-llm->ret_code),
+                           llm->ret_code);
                        ret = send_unix_sock(sock, &view);
                        if (ret < 0) {
                                ERR("Failed to send data back to client");
@@ -2735,8 +2690,7 @@ error_create_poll:
        return NULL;
 }
 
-static
-bool shutdown_client_thread(void *thread_data)
+static bool shutdown_client_thread(void *thread_data)
 {
        struct lttng_pipe *client_quit_pipe = (lttng_pipe *) thread_data;
        const int write_fd = lttng_pipe_get_writefd(client_quit_pipe);
@@ -2764,10 +2718,10 @@ struct lttng_thread *launch_client_thread(void)
 
        thread_state.client_sock = client_sock_fd;
        thread = lttng_thread_create("Client management",
-                       thread_manage_clients,
-                       shutdown_client_thread,
-                       cleanup_client_thread,
-                       client_quit_pipe);
+                                    thread_manage_clients,
+                                    shutdown_client_thread,
+                                    cleanup_client_thread,
+                                    client_quit_pipe);
        if (!thread) {
                goto error;
        }
index d81a487e940ebeb5bac1b7c58aa0e19ef8a7ef11..bca451ba194d9dcdfb1ae917c5ee790b1ba30838 100644 (file)
@@ -9,15 +9,15 @@
 #include "trace-class.hpp"
 
 lttng::sessiond::trace::clock_class::clock_class(std::string in_name,
-               std::string in_description,
-               nonstd::optional<lttng_uuid> in_uuid,
-               scycles_t in_offset,
-               cycles_t in_frequency) :
-       name{std::move(in_name)},
-       description{std::move(in_description)},
-       uuid{std::move(in_uuid)},
-       offset{in_offset},
-       frequency{in_frequency}
+                                                std::string in_description,
+                                                nonstd::optional<lttng_uuid> in_uuid,
+                                                scycles_t in_offset,
+                                                cycles_t in_frequency) :
+       name{ std::move(in_name) },
+       description{ std::move(in_description) },
+       uuid{ std::move(in_uuid) },
+       offset{ in_offset },
+       frequency{ in_frequency }
 {
 }
 
index 5001d94e05dabf96907aea9aacc7d62408649ca5..30e771e1cc21f14c61e60fa3e9c4bf0d4ccdb7c5 100644 (file)
@@ -6,14 +6,28 @@
  *
  */
 
-
 #define _LGPL_SOURCE
-#include <algorithm>
-#include <inttypes.h>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <urcu/list.h>
-#include <urcu/uatomic.h>
+#include "agent-thread.hpp"
+#include "agent.hpp"
+#include "buffer-registry.hpp"
+#include "channel.hpp"
+#include "cmd.hpp"
+#include "consumer.hpp"
+#include "event-notifier-error-accounting.hpp"
+#include "event.hpp"
+#include "health-sessiond.hpp"
+#include "kernel-consumer.hpp"
+#include "kernel.hpp"
+#include "lttng-sessiond.hpp"
+#include "lttng-syscall.hpp"
+#include "notification-thread-commands.hpp"
+#include "notification-thread.hpp"
+#include "rotate.hpp"
+#include "rotation-thread.hpp"
+#include "session.hpp"
+#include "timer.hpp"
+#include "tracker.hpp"
+#include "utils.hpp"
 
 #include <common/buffer-view.hpp>
 #include <common/common.hpp>
@@ -28,6 +42,7 @@
 #include <common/string-utils/string-utils.hpp>
 #include <common/trace-chunk.hpp>
 #include <common/utils.hpp>
+
 #include <lttng/action/action-internal.hpp>
 #include <lttng/action/action.h>
 #include <lttng/channel-internal.hpp>
 #include <lttng/trigger/trigger-internal.hpp>
 #include <lttng/userspace-probe-internal.hpp>
 
-#include "agent-thread.hpp"
-#include "agent.hpp"
-#include "buffer-registry.hpp"
-#include "channel.hpp"
-#include "cmd.hpp"
-#include "consumer.hpp"
-#include "event-notifier-error-accounting.hpp"
-#include "event.hpp"
-#include "health-sessiond.hpp"
-#include "kernel-consumer.hpp"
-#include "kernel.hpp"
-#include "lttng-sessiond.hpp"
-#include "lttng-syscall.hpp"
-#include "notification-thread-commands.hpp"
-#include "notification-thread.hpp"
-#include "rotate.hpp"
-#include "rotation-thread.hpp"
-#include "session.hpp"
-#include "timer.hpp"
-#include "tracker.hpp"
-#include "utils.hpp"
+#include <algorithm>
+#include <inttypes.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <urcu/list.h>
+#include <urcu/uatomic.h>
 
 /* Sleep for 100ms between each check for the shm path's deletion. */
 #define SESSION_DESTROY_SHM_PATH_CHECK_DELAY_US 100000
@@ -99,10 +99,7 @@ struct destroy_completion_handler {
        struct cmd_completion_handler handler;
        char shm_path[member_sizeof(struct ltt_session, shm_path)];
 } destroy_completion_handler = {
-       .handler = {
-               .run = wait_on_path,
-               .data = destroy_completion_handler.shm_path
-       },
+       .handler = { .run = wait_on_path, .data = destroy_completion_handler.shm_path },
        .shm_path = { 0 },
 };
 
@@ -119,24 +116,23 @@ uint64_t relayd_net_seq_idx;
 static struct cmd_completion_handler *current_completion_handler;
 static int validate_ust_event_name(const char *);
 static int cmd_enable_event_internal(struct ltt_session *session,
-               const struct lttng_domain *domain,
-               char *channel_name, struct lttng_event *event,
-               char *filter_expression,
-               struct lttng_bytecode *filter,
-               struct lttng_event_exclusion *exclusion,
-               int wpipe);
-static enum lttng_error_code cmd_enable_channel_internal(
-               struct ltt_session *session,
-               const struct lttng_domain *domain,
-               const struct lttng_channel *_attr,
-               int wpipe);
+                                    const struct lttng_domain *domain,
+                                    char *channel_name,
+                                    struct lttng_event *event,
+                                    char *filter_expression,
+                                    struct lttng_bytecode *filter,
+                                    struct lttng_event_exclusion *exclusion,
+                                    int wpipe);
+static enum lttng_error_code cmd_enable_channel_internal(struct ltt_session *session,
+                                                        const struct lttng_domain *domain,
+                                                        const struct lttng_channel *_attr,
+                                                        int wpipe);
 
 /*
  * Create a session path used by list_lttng_sessions for the case that the
  * session consumer is on the network.
  */
-static int build_network_session_path(char *dst, size_t size,
-               struct ltt_session *session)
+static int build_network_session_path(char *dst, size_t size, struct ltt_session *session)
 {
        int ret, kdata_port, udata_port;
        struct lttng_uri *kuri = NULL, *uuri = NULL, *uri = NULL;
@@ -192,8 +188,13 @@ static int build_network_session_path(char *dst, size_t size,
         * to print.
         */
        if (*tmp_uurl != '\0') {
-               ret = snprintf(dst, size, "[K]: %s [data: %d] -- [U]: %s [data: %d]",
-                               tmp_urls, kdata_port, tmp_uurl, udata_port);
+               ret = snprintf(dst,
+                              size,
+                              "[K]: %s [data: %d] -- [U]: %s [data: %d]",
+                              tmp_urls,
+                              kdata_port,
+                              tmp_uurl,
+                              udata_port);
        } else {
                int dport;
                if (kuri || (!kuri && !uuri)) {
@@ -214,8 +215,9 @@ error:
  * lost packets).
  */
 static int get_kernel_runtime_stats(struct ltt_session *session,
-               struct ltt_kernel_channel *kchan, uint64_t *discarded_events,
-               uint64_t *lost_packets)
+                                   struct ltt_kernel_channel *kchan,
+                                   uint64_t *discarded_events,
+                                   uint64_t *lost_packets)
 {
        int ret;
 
@@ -226,16 +228,14 @@ static int get_kernel_runtime_stats(struct ltt_session *session,
                goto end;
        }
 
-       ret = consumer_get_discarded_events(session->id, kchan->key,
-                       session->kernel_session->consumer,
-                       discarded_events);
+       ret = consumer_get_discarded_events(
+               session->id, kchan->key, session->kernel_session->consumer, discarded_events);
        if (ret < 0) {
                goto end;
        }
 
-       ret = consumer_get_lost_packets(session->id, kchan->key,
-                       session->kernel_session->consumer,
-                       lost_packets);
+       ret = consumer_get_lost_packets(
+               session->id, kchan->key, session->kernel_session->consumer, lost_packets);
        if (ret < 0) {
                goto end;
        }
@@ -249,8 +249,9 @@ end:
  * lost packets).
  */
 static int get_ust_runtime_stats(struct ltt_session *session,
-               struct ltt_ust_channel *uchan, uint64_t *discarded_events,
-               uint64_t *lost_packets)
+                                struct ltt_ust_channel *uchan,
+                                uint64_t *discarded_events,
+                                uint64_t *lost_packets)
 {
        int ret;
        struct ltt_ust_session *usess;
@@ -273,17 +274,19 @@ static int get_ust_runtime_stats(struct ltt_session *session,
 
        if (usess->buffer_type == LTTNG_BUFFER_PER_UID) {
                ret = ust_app_uid_get_channel_runtime_stats(usess->id,
-                               &usess->buffer_reg_uid_list,
-                               usess->consumer, uchan->id,
-                               uchan->attr.overwrite,
-                               discarded_events,
-                               lost_packets);
+                                                           &usess->buffer_reg_uid_list,
+                                                           usess->consumer,
+                                                           uchan->id,
+                                                           uchan->attr.overwrite,
+                                                           discarded_events,
+                                                           lost_packets);
        } else if (usess->buffer_type == LTTNG_BUFFER_PER_PID) {
                ret = ust_app_pid_get_channel_runtime_stats(usess,
-                               uchan, usess->consumer,
-                               uchan->attr.overwrite,
-                               discarded_events,
-                               lost_packets);
+                                                           uchan,
+                                                           usess->consumer,
+                                                           uchan->attr.overwrite,
+                                                           discarded_events,
+                                                           lost_packets);
                if (ret < 0) {
                        goto end;
                }
@@ -305,9 +308,9 @@ end:
  *
  * Return number of events in list on success or else a negative value.
  */
-static enum lttng_error_code list_lttng_agent_events(
-               struct agent *agt, struct lttng_payload *reply_payload,
-               unsigned int *nb_events)
+static enum lttng_error_code list_lttng_agent_events(struct agent *agt,
+                                                    struct lttng_payload *reply_payload,
+                                                    unsigned int *nb_events)
 {
        enum lttng_error_code ret_code;
        int ret = 0;
@@ -335,7 +338,7 @@ static enum lttng_error_code list_lttng_agent_events(
 
        local_nb_events = (unsigned int) agent_event_count;
 
-       cds_lfht_for_each_entry(agt->events->ht, &iter.iter, event, node.node) {
+       cds_lfht_for_each_entry (agt->events->ht, &iter.iter, event, node.node) {
                struct lttng_event *tmp_event = lttng_event_create();
 
                if (!tmp_event) {
@@ -348,14 +351,14 @@ static enum lttng_error_code list_lttng_agent_events(
                        ret_code = LTTNG_ERR_FATAL;
                        goto error;
                }
-               
+
                tmp_event->name[sizeof(tmp_event->name) - 1] = '\0';
                tmp_event->enabled = !!event->enabled_count;
                tmp_event->loglevel = event->loglevel_value;
                tmp_event->loglevel_type = event->loglevel_type;
 
-               ret = lttng_event_serialize(tmp_event, 0, NULL,
-                               event->filter_expression, 0, NULL, reply_payload);
+               ret = lttng_event_serialize(
+                       tmp_event, 0, NULL, event->filter_expression, 0, NULL, reply_payload);
                lttng_event_destroy(tmp_event);
                if (ret) {
                        ret_code = LTTNG_ERR_FATAL;
@@ -375,9 +378,9 @@ error:
  * Create a list of ust global domain events.
  */
 static enum lttng_error_code list_lttng_ust_global_events(char *channel_name,
-               struct ltt_ust_domain_global *ust_global,
-               struct lttng_payload *reply_payload,
-               unsigned int *nb_events)
+                                                         struct ltt_ust_domain_global *ust_global,
+                                                         struct lttng_payload *reply_payload,
+                                                         unsigned int *nb_events)
 {
        enum lttng_error_code ret_code;
        int ret;
@@ -420,7 +423,7 @@ static enum lttng_error_code list_lttng_ust_global_events(char *channel_name,
 
        DBG3("Listing UST global %d events", *nb_events);
 
-       cds_lfht_for_each_entry(uchan->events->ht, &iter.iter, uevent, node.node) {
+       cds_lfht_for_each_entry (uchan->events->ht, &iter.iter, uevent, node.node) {
                struct lttng_event *tmp_event = NULL;
 
                if (uevent->internal) {
@@ -435,8 +438,7 @@ static enum lttng_error_code list_lttng_ust_global_events(char *channel_name,
                        goto error;
                }
 
-               if (lttng_strncpy(tmp_event->name, uevent->attr.name,
-                               LTTNG_SYMBOL_NAME_LEN)) {
+               if (lttng_strncpy(tmp_event->name, uevent->attr.name, LTTNG_SYMBOL_NAME_LEN)) {
                        ret_code = LTTNG_ERR_FATAL;
                        lttng_event_destroy(tmp_event);
                        goto error;
@@ -480,9 +482,14 @@ static enum lttng_error_code list_lttng_ust_global_events(char *channel_name,
                 * 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 : NULL,
-                               uevent->filter_expression, 0, NULL, reply_payload);
+               ret = lttng_event_serialize(tmp_event,
+                                           uevent->exclusion ? uevent->exclusion->count : 0,
+                                           uevent->exclusion ? (char **) uevent->exclusion->names :
+                                                               NULL,
+                                           uevent->filter_expression,
+                                           0,
+                                           NULL,
+                                           reply_payload);
                lttng_event_destroy(tmp_event);
                if (ret) {
                        ret_code = LTTNG_ERR_FATAL;
@@ -503,9 +510,9 @@ error:
  * Fill lttng_event array of all kernel events in the channel.
  */
 static enum lttng_error_code list_lttng_kernel_events(char *channel_name,
-               struct ltt_kernel_session *kernel_session,
-               struct lttng_payload *reply_payload,
-               unsigned int *nb_events)
+                                                     struct ltt_kernel_session *kernel_session,
+                                                     struct lttng_payload *reply_payload,
+                                                     unsigned int *nb_events)
 {
        enum lttng_error_code ret_code;
        int ret;
@@ -530,7 +537,7 @@ static enum lttng_error_code list_lttng_kernel_events(char *channel_name,
        }
 
        /* Kernel channels */
-       cds_list_for_each_entry(event, &kchan->events_list.head , list) {
+       cds_list_for_each_entry (event, &kchan->events_list.head, list) {
                struct lttng_event *tmp_event = lttng_event_create();
 
                if (!tmp_event) {
@@ -542,7 +549,6 @@ static enum lttng_error_code list_lttng_kernel_events(char *channel_name,
                        lttng_event_destroy(tmp_event);
                        ret_code = LTTNG_ERR_FATAL;
                        goto end;
-
                }
 
                tmp_event->name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
@@ -555,21 +561,24 @@ static enum lttng_error_code list_lttng_kernel_events(char *channel_name,
                        break;
                case LTTNG_KERNEL_ABI_KRETPROBE:
                        tmp_event->type = LTTNG_EVENT_FUNCTION;
-                       memcpy(&tmp_event->attr.probe, &event->event->u.kprobe,
-                                       sizeof(struct lttng_kernel_abi_kprobe));
+                       memcpy(&tmp_event->attr.probe,
+                              &event->event->u.kprobe,
+                              sizeof(struct lttng_kernel_abi_kprobe));
                        break;
                case LTTNG_KERNEL_ABI_KPROBE:
                        tmp_event->type = LTTNG_EVENT_PROBE;
-                       memcpy(&tmp_event->attr.probe, &event->event->u.kprobe,
-                                       sizeof(struct lttng_kernel_abi_kprobe));
+                       memcpy(&tmp_event->attr.probe,
+                              &event->event->u.kprobe,
+                              sizeof(struct lttng_kernel_abi_kprobe));
                        break;
                case LTTNG_KERNEL_ABI_UPROBE:
                        tmp_event->type = LTTNG_EVENT_USERSPACE_PROBE;
                        break;
                case LTTNG_KERNEL_ABI_FUNCTION:
                        tmp_event->type = LTTNG_EVENT_FUNCTION;
-                       memcpy(&(tmp_event->attr.ftrace), &event->event->u.ftrace,
-                                       sizeof(struct lttng_kernel_abi_function));
+                       memcpy(&(tmp_event->attr.ftrace),
+                              &event->event->u.ftrace,
+                              sizeof(struct lttng_kernel_abi_function));
                        break;
                case LTTNG_KERNEL_ABI_NOOP:
                        tmp_event->type = LTTNG_EVENT_NOOP;
@@ -586,8 +595,8 @@ static enum lttng_error_code list_lttng_kernel_events(char *channel_name,
 
                if (event->userspace_probe_location) {
                        struct lttng_userspace_probe_location *location_copy =
-                                       lttng_userspace_probe_location_copy(
-                                                       event->userspace_probe_location);
+                               lttng_userspace_probe_location_copy(
+                                       event->userspace_probe_location);
 
                        if (!location_copy) {
                                lttng_event_destroy(tmp_event);
@@ -595,19 +604,17 @@ static enum lttng_error_code list_lttng_kernel_events(char *channel_name,
                                goto end;
                        }
 
-                       ret = lttng_event_set_userspace_probe_location(
-                                       tmp_event, location_copy);
+                       ret = lttng_event_set_userspace_probe_location(tmp_event, location_copy);
                        if (ret) {
                                lttng_event_destroy(tmp_event);
-                               lttng_userspace_probe_location_destroy(
-                                               location_copy);
+                               lttng_userspace_probe_location_destroy(location_copy);
                                ret_code = LTTNG_ERR_INVALID;
                                goto end;
                        }
                }
 
-               ret = lttng_event_serialize(tmp_event, 0, NULL,
-                               event->filter_expression, 0, NULL, reply_payload);
+               ret = lttng_event_serialize(
+                       tmp_event, 0, NULL, event->filter_expression, 0, NULL, reply_payload);
                lttng_event_destroy(tmp_event);
                if (ret) {
                        ret_code = LTTNG_ERR_FATAL;
@@ -624,10 +631,10 @@ end:
  * Add URI so the consumer output object. Set the correct path depending on the
  * domain adding the default trace directory.
  */
-static enum lttng_error_code add_uri_to_consumer(
-               const struct ltt_session *session,
-               struct consumer_output *consumer,
-               struct lttng_uri *uri, enum lttng_domain_type domain)
+static enum lttng_error_code add_uri_to_consumer(const struct ltt_session *session,
+                                                struct consumer_output *consumer,
+                                                struct lttng_uri *uri,
+                                                enum lttng_domain_type domain)
 {
        int ret;
        enum lttng_error_code ret_code = LTTNG_OK;
@@ -643,13 +650,13 @@ static enum lttng_error_code add_uri_to_consumer(
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
                ret = lttng_strncpy(consumer->domain_subdir,
-                               DEFAULT_KERNEL_TRACE_DIR,
-                               sizeof(consumer->domain_subdir));
+                                   DEFAULT_KERNEL_TRACE_DIR,
+                                   sizeof(consumer->domain_subdir));
                break;
        case LTTNG_DOMAIN_UST:
                ret = lttng_strncpy(consumer->domain_subdir,
-                               DEFAULT_UST_TRACE_DIR,
-                               sizeof(consumer->domain_subdir));
+                                   DEFAULT_UST_TRACE_DIR,
+                                   sizeof(consumer->domain_subdir));
                break;
        default:
                /*
@@ -657,8 +664,7 @@ static enum lttng_error_code add_uri_to_consumer(
                 * tracing session consumer object which in this case there is
                 * no subdir.
                 */
-               memset(consumer->domain_subdir, 0,
-                               sizeof(consumer->domain_subdir));
+               memset(consumer->domain_subdir, 0, sizeof(consumer->domain_subdir));
                ret = 0;
        }
        if (ret) {
@@ -674,9 +680,8 @@ static enum lttng_error_code add_uri_to_consumer(
 
                if (consumer->type == CONSUMER_DST_NET) {
                        if ((uri->stype == LTTNG_STREAM_CONTROL &&
-                               consumer->dst.net.control_isset) ||
-                               (uri->stype == LTTNG_STREAM_DATA &&
-                               consumer->dst.net.data_isset)) {
+                            consumer->dst.net.control_isset) ||
+                           (uri->stype == LTTNG_STREAM_DATA && consumer->dst.net.data_isset)) {
                                ret_code = LTTNG_ERR_URL_EXIST;
                                goto error;
                        }
@@ -703,13 +708,12 @@ static enum lttng_error_code add_uri_to_consumer(
                        ret_code = LTTNG_ERR_INVALID;
                        goto error;
                }
-               DBG2("Setting trace directory path from URI to %s",
-                               uri->dst.path);
+               DBG2("Setting trace directory path from URI to %s", uri->dst.path);
                memset(&consumer->dst, 0, sizeof(consumer->dst));
 
                ret = lttng_strncpy(consumer->dst.session_root_path,
-                               uri->dst.path,
-                               sizeof(consumer->dst.session_root_path));
+                                   uri->dst.path,
+                                   sizeof(consumer->dst.session_root_path));
                if (ret) {
                        ret_code = LTTNG_ERR_FATAL;
                        goto error;
@@ -737,8 +741,8 @@ static int init_kernel_tracing(struct ltt_kernel_session *session)
        rcu_read_lock();
 
        if (session->consumer_fds_sent == 0 && session->consumer != NULL) {
-               cds_lfht_for_each_entry(session->consumer->socks->ht, &iter.iter,
-                               socket, node.node) {
+               cds_lfht_for_each_entry (
+                       session->consumer->socks->ht, &iter.iter, socket, node.node) {
                        pthread_mutex_lock(socket->lock);
                        ret = kernel_consumer_send_session(socket, session);
                        pthread_mutex_unlock(socket->lock);
@@ -761,15 +765,15 @@ error:
  * Else, it remains untouched and an LTTng error code is returned.
  */
 static enum lttng_error_code create_connect_relayd(struct lttng_uri *uri,
-               struct lttcomm_relayd_sock **relayd_sock,
-               struct consumer_output *consumer)
+                                                  struct lttcomm_relayd_sock **relayd_sock,
+                                                  struct consumer_output *consumer)
 {
        int ret;
        enum lttng_error_code status = LTTNG_OK;
        struct lttcomm_relayd_sock *rsock;
 
-       rsock = lttcomm_alloc_relayd_sock(uri, RELAYD_VERSION_COMM_MAJOR,
-                       RELAYD_VERSION_COMM_MINOR);
+       rsock = lttcomm_alloc_relayd_sock(
+               uri, RELAYD_VERSION_COMM_MAJOR, RELAYD_VERSION_COMM_MINOR);
        if (!rsock) {
                status = LTTNG_ERR_FATAL;
                goto error;
@@ -807,8 +811,7 @@ static enum lttng_error_code create_connect_relayd(struct lttng_uri *uri,
                }
                consumer->relay_major_version = rsock->major;
                consumer->relay_minor_version = rsock->minor;
-               ret = relayd_get_configuration(rsock, 0,
-                               &result_flags);
+               ret = relayd_get_configuration(rsock, 0, &result_flags);
                if (ret < 0) {
                        ERR("Unable to get relayd configuration");
                        status = LTTNG_ERR_RELAYD_CONNECT_FAIL;
@@ -846,16 +849,17 @@ error:
  *
  * Returns LTTNG_OK on success or an LTTng error code on failure.
  */
-static enum lttng_error_code send_consumer_relayd_socket(
-               unsigned int session_id,
-               struct lttng_uri *relayd_uri,
-               struct consumer_output *consumer,
-               struct consumer_socket *consumer_sock,
-               const char *session_name, const char *hostname,
-               const char *base_path, int session_live_timer,
-               const uint64_t *current_chunk_id,
-               time_t session_creation_time,
-               bool session_name_contains_creation_time)
+static enum lttng_error_code send_consumer_relayd_socket(unsigned int session_id,
+                                                        struct lttng_uri *relayd_uri,
+                                                        struct consumer_output *consumer,
+                                                        struct consumer_socket *consumer_sock,
+                                                        const char *session_name,
+                                                        const char *hostname,
+                                                        const char *base_path,
+                                                        int session_live_timer,
+                                                        const uint64_t *current_chunk_id,
+                                                        time_t session_creation_time,
+                                                        bool session_name_contains_creation_time)
 {
        int ret;
        struct lttcomm_relayd_sock *rsock = NULL;
@@ -881,11 +885,18 @@ static enum lttng_error_code send_consumer_relayd_socket(
        }
 
        /* Send relayd socket to consumer. */
-       ret = consumer_send_relayd_socket(consumer_sock, rsock, consumer,
-                       relayd_uri->stype, session_id,
-                       session_name, hostname, base_path,
-                       session_live_timer, current_chunk_id,
-                       session_creation_time, session_name_contains_creation_time);
+       ret = consumer_send_relayd_socket(consumer_sock,
+                                         rsock,
+                                         consumer,
+                                         relayd_uri->stype,
+                                         session_id,
+                                         session_name,
+                                         hostname,
+                                         base_path,
+                                         session_live_timer,
+                                         current_chunk_id,
+                                         session_creation_time,
+                                         session_name_contains_creation_time);
        if (ret < 0) {
                status = LTTNG_ERR_ENABLE_CONSUMER_FAIL;
                goto close_sock;
@@ -928,12 +939,16 @@ relayd_comm_error:
  *
  * Returns LTTNG_OK, or an LTTng error code on failure.
  */
-static enum lttng_error_code send_consumer_relayd_sockets(
-               unsigned int session_id, struct consumer_output *consumer,
-               struct consumer_socket *sock, const char *session_name,
-               const char *hostname, const char *base_path, int session_live_timer,
-               const uint64_t *current_chunk_id, time_t session_creation_time,
-               bool session_name_contains_creation_time)
+static enum lttng_error_code send_consumer_relayd_sockets(unsigned int session_id,
+                                                         struct consumer_output *consumer,
+                                                         struct consumer_socket *sock,
+                                                         const char *session_name,
+                                                         const char *hostname,
+                                                         const char *base_path,
+                                                         int session_live_timer,
+                                                         const uint64_t *current_chunk_id,
+                                                         time_t session_creation_time,
+                                                         bool session_name_contains_creation_time)
 {
        enum lttng_error_code status = LTTNG_OK;
 
@@ -943,10 +958,16 @@ static enum lttng_error_code send_consumer_relayd_sockets(
        /* Sending control relayd socket. */
        if (!sock->control_sock_sent) {
                status = send_consumer_relayd_socket(session_id,
-                               &consumer->dst.net.control, consumer, sock,
-                               session_name, hostname, base_path, session_live_timer,
-                               current_chunk_id, session_creation_time,
-                               session_name_contains_creation_time);
+                                                    &consumer->dst.net.control,
+                                                    consumer,
+                                                    sock,
+                                                    session_name,
+                                                    hostname,
+                                                    base_path,
+                                                    session_live_timer,
+                                                    current_chunk_id,
+                                                    session_creation_time,
+                                                    session_name_contains_creation_time);
                if (status != LTTNG_OK) {
                        goto error;
                }
@@ -955,10 +976,16 @@ static enum lttng_error_code send_consumer_relayd_sockets(
        /* Sending data relayd socket. */
        if (!sock->data_sock_sent) {
                status = send_consumer_relayd_socket(session_id,
-                               &consumer->dst.net.data, consumer, sock,
-                               session_name, hostname, base_path, session_live_timer,
-                               current_chunk_id, session_creation_time,
-                               session_name_contains_creation_time);
+                                                    &consumer->dst.net.data,
+                                                    consumer,
+                                                    sock,
+                                                    session_name,
+                                                    hostname,
+                                                    base_path,
+                                                    session_live_timer,
+                                                    current_chunk_id,
+                                                    session_creation_time,
+                                                    session_name_contains_creation_time);
                if (status != LTTNG_OK) {
                        goto error;
                }
@@ -992,7 +1019,7 @@ int cmd_setup_relayd(struct ltt_session *session)
        rcu_read_lock();
        if (session->current_trace_chunk) {
                enum lttng_trace_chunk_status status = lttng_trace_chunk_get_id(
-                               session->current_trace_chunk, &current_chunk_id.value);
+                       session->current_trace_chunk, &current_chunk_id.value);
 
                if (status == LTTNG_TRACE_CHUNK_STATUS_OK) {
                        current_chunk_id.is_set = true;
@@ -1003,20 +1030,23 @@ int cmd_setup_relayd(struct ltt_session *session)
                }
        }
 
-       if (usess && usess->consumer && usess->consumer->type == CONSUMER_DST_NET
-                       && usess->consumer->enabled) {
+       if (usess && usess->consumer && usess->consumer->type == CONSUMER_DST_NET &&
+           usess->consumer->enabled) {
                /* For each consumer socket, send relayd sockets */
-               cds_lfht_for_each_entry(usess->consumer->socks->ht, &iter.iter,
-                               socket, node.node) {
+               cds_lfht_for_each_entry (
+                       usess->consumer->socks->ht, &iter.iter, socket, node.node) {
                        pthread_mutex_lock(socket->lock);
-                       ret = send_consumer_relayd_sockets(session->id,
-                                       usess->consumer, socket,
-                                       session->name, session->hostname,
-                                       session->base_path,
-                                       session->live_timer,
-                                       current_chunk_id.is_set ? &current_chunk_id.value : NULL,
-                                       session->creation_time,
-                                       session->name_contains_creation_time);
+                       ret = send_consumer_relayd_sockets(
+                               session->id,
+                               usess->consumer,
+                               socket,
+                               session->name,
+                               session->hostname,
+                               session->base_path,
+                               session->live_timer,
+                               current_chunk_id.is_set ? &current_chunk_id.value : NULL,
+                               session->creation_time,
+                               session->name_contains_creation_time);
                        pthread_mutex_unlock(socket->lock);
                        if (ret != LTTNG_OK) {
                                goto error;
@@ -1024,27 +1054,27 @@ int cmd_setup_relayd(struct ltt_session *session)
                        /* Session is now ready for network streaming. */
                        session->net_handle = 1;
                }
-               session->consumer->relay_major_version =
-                       usess->consumer->relay_major_version;
-               session->consumer->relay_minor_version =
-                       usess->consumer->relay_minor_version;
-               session->consumer->relay_allows_clear =
-                       usess->consumer->relay_allows_clear;
+               session->consumer->relay_major_version = usess->consumer->relay_major_version;
+               session->consumer->relay_minor_version = usess->consumer->relay_minor_version;
+               session->consumer->relay_allows_clear = usess->consumer->relay_allows_clear;
        }
 
-       if (ksess && ksess->consumer && ksess->consumer->type == CONSUMER_DST_NET
-                       && ksess->consumer->enabled) {
-               cds_lfht_for_each_entry(ksess->consumer->socks->ht, &iter.iter,
-                               socket, node.node) {
+       if (ksess && ksess->consumer && ksess->consumer->type == CONSUMER_DST_NET &&
+           ksess->consumer->enabled) {
+               cds_lfht_for_each_entry (
+                       ksess->consumer->socks->ht, &iter.iter, socket, node.node) {
                        pthread_mutex_lock(socket->lock);
-                       ret = send_consumer_relayd_sockets(session->id,
-                                       ksess->consumer, socket,
-                                       session->name, session->hostname,
-                                       session->base_path,
-                                       session->live_timer,
-                                       current_chunk_id.is_set ? &current_chunk_id.value : NULL,
-                                       session->creation_time,
-                                       session->name_contains_creation_time);
+                       ret = send_consumer_relayd_sockets(
+                               session->id,
+                               ksess->consumer,
+                               socket,
+                               session->name,
+                               session->hostname,
+                               session->base_path,
+                               session->live_timer,
+                               current_chunk_id.is_set ? &current_chunk_id.value : NULL,
+                               session->creation_time,
+                               session->name_contains_creation_time);
                        pthread_mutex_unlock(socket->lock);
                        if (ret != LTTNG_OK) {
                                goto error;
@@ -1052,12 +1082,9 @@ int cmd_setup_relayd(struct ltt_session *session)
                        /* Session is now ready for network streaming. */
                        session->net_handle = 1;
                }
-               session->consumer->relay_major_version =
-                       ksess->consumer->relay_major_version;
-               session->consumer->relay_minor_version =
-                       ksess->consumer->relay_minor_version;
-               session->consumer->relay_allows_clear =
-                       ksess->consumer->relay_allows_clear;
+               session->consumer->relay_major_version = ksess->consumer->relay_major_version;
+               session->consumer->relay_minor_version = ksess->consumer->relay_minor_version;
+               session->consumer->relay_allows_clear = ksess->consumer->relay_allows_clear;
        }
 
 error:
@@ -1093,7 +1120,7 @@ int start_kernel_session(struct ltt_kernel_session *ksess)
        }
 
        /* For each channel */
-       cds_list_for_each_entry(kchan, &ksess->channel_list.head, list) {
+       cds_list_for_each_entry (kchan, &ksess->channel_list.head, list) {
                if (kchan->stream_count == 0) {
                        ret = kernel_open_channel_stream(kchan);
                        if (ret < 0) {
@@ -1159,7 +1186,7 @@ int stop_kernel_session(struct ltt_kernel_session *ksess)
        }
 
        /* Flush all buffers after stopping */
-       cds_list_for_each_entry(kchan, &ksess->channel_list.head, list) {
+       cds_list_for_each_entry (kchan, &ksess->channel_list.head, list) {
                ret = kernel_flush_buffer(kchan);
                if (ret < 0) {
                        ERR("Kernel flush buffer error");
@@ -1181,7 +1208,8 @@ error:
  * Command LTTNG_DISABLE_CHANNEL processed by the client thread.
  */
 int cmd_disable_channel(struct ltt_session *session,
-               enum lttng_domain_type domain, char *channel_name)
+                       enum lttng_domain_type domain,
+                       char *channel_name)
 {
        int ret;
        struct ltt_ust_session *usess;
@@ -1193,8 +1221,7 @@ int cmd_disable_channel(struct ltt_session *session,
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
        {
-               ret = channel_kernel_disable(session->kernel_session,
-                               channel_name);
+               ret = channel_kernel_disable(session->kernel_session, channel_name);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -1256,8 +1283,7 @@ int cmd_enable_channel(struct command_ctx *cmd_ctx, int sock, int wpipe)
                goto end;
        }
 
-       sock_recv_len = lttcomm_recv_unix_sock(sock, channel_buffer.data,
-                       channel_len);
+       sock_recv_len = lttcomm_recv_unix_sock(sock, channel_buffer.data, channel_len);
        if (sock_recv_len < 0 || sock_recv_len != channel_len) {
                ERR("Failed to receive \"enable channel\" command payload");
                ret = LTTNG_ERR_INVALID;
@@ -1276,8 +1302,7 @@ int cmd_enable_channel(struct command_ctx *cmd_ctx, int sock, int wpipe)
                goto end;
        }
 
-       ret = cmd_enable_channel_internal(
-                       cmd_ctx->session, &command_domain, channel, wpipe);
+       ret = cmd_enable_channel_internal(cmd_ctx->session, &command_domain, channel, wpipe);
 
 end:
        lttng_dynamic_buffer_reset(&channel_buffer);
@@ -1285,11 +1310,10 @@ end:
        return ret;
 }
 
-static enum lttng_error_code cmd_enable_channel_internal(
-               struct ltt_session *session,
-               const struct lttng_domain *domain,
-               const struct lttng_channel *_attr,
-               int wpipe)
+static enum lttng_error_code cmd_enable_channel_internal(struct ltt_session *session,
+                                                        const struct lttng_domain *domain,
+                                                        const struct lttng_channel *_attr,
+                                                        int wpipe)
 {
        enum lttng_error_code ret_code;
        struct ltt_ust_session *usess = session->ust_session;
@@ -1310,8 +1334,7 @@ static enum lttng_error_code cmd_enable_channel_internal(
        len = lttng_strnlen(attr->name, sizeof(attr->name));
 
        /* Validate channel name */
-       if (attr->name[0] == '.' ||
-               memchr(attr->name, '/', len) != NULL) {
+       if (attr->name[0] == '.' || memchr(attr->name, '/', len) != NULL) {
                ret_code = LTTNG_ERR_INVALID_CHANNEL_NAME;
                goto end;
        }
@@ -1337,9 +1360,10 @@ static enum lttng_error_code cmd_enable_channel_internal(
                if (kernel_supports_ring_buffer_snapshot_sample_positions() != 1) {
                        /* Sampling position of buffer is not supported */
                        WARN("Kernel tracer does not support buffer monitoring. "
-                                       "Setting the monitor interval timer to 0 "
-                                       "(disabled) for channel '%s' of session '%s'",
-                                       attr->name, session->name);
+                            "Setting the monitor interval timer to 0 "
+                            "(disabled) for channel '%s' of session '%s'",
+                            attr->name,
+                            session->name);
                        lttng_channel_set_monitor_timer_interval(attr, 0);
                }
                break;
@@ -1365,8 +1389,7 @@ static enum lttng_error_code cmd_enable_channel_internal(
        {
                struct ltt_kernel_channel *kchan;
 
-               kchan = trace_kernel_get_channel_by_name(
-                               attr->name, session->kernel_session);
+               kchan = trace_kernel_get_channel_by_name(attr->name, session->kernel_session);
                if (kchan == NULL) {
                        /*
                         * Don't try to create a channel if the session has been started at
@@ -1377,13 +1400,11 @@ static enum lttng_error_code cmd_enable_channel_internal(
                                goto error;
                        }
 
-                       if (session->snapshot.nb_output > 0 ||
-                                       session->snapshot_mode) {
+                       if (session->snapshot.nb_output > 0 || session->snapshot_mode) {
                                /* Enforce mmap output for snapshot sessions. */
                                attr->attr.output = LTTNG_EVENT_MMAP;
                        }
-                       ret_code = channel_kernel_create(
-                                       session->kernel_session, attr, wpipe);
+                       ret_code = channel_kernel_create(session->kernel_session, attr, wpipe);
                        if (attr->name[0] != '\0') {
                                session->kernel_session->has_non_default_channel = 1;
                        }
@@ -1414,20 +1435,19 @@ static enum lttng_error_code cmd_enable_channel_internal(
                 * adhered to.
                 */
                if (domain->type == LTTNG_DOMAIN_JUL) {
-                       if (strncmp(attr->name, DEFAULT_JUL_CHANNEL_NAME,
-                                       LTTNG_SYMBOL_NAME_LEN)) {
+                       if (strncmp(attr->name, DEFAULT_JUL_CHANNEL_NAME, LTTNG_SYMBOL_NAME_LEN)) {
                                ret_code = LTTNG_ERR_INVALID_CHANNEL_NAME;
                                goto error;
                        }
                } else if (domain->type == LTTNG_DOMAIN_LOG4J) {
-                       if (strncmp(attr->name, DEFAULT_LOG4J_CHANNEL_NAME,
-                                       LTTNG_SYMBOL_NAME_LEN)) {
+                       if (strncmp(attr->name, DEFAULT_LOG4J_CHANNEL_NAME, LTTNG_SYMBOL_NAME_LEN)) {
                                ret_code = LTTNG_ERR_INVALID_CHANNEL_NAME;
                                goto error;
                        }
                } else if (domain->type == LTTNG_DOMAIN_PYTHON) {
-                       if (strncmp(attr->name, DEFAULT_PYTHON_CHANNEL_NAME,
-                                       LTTNG_SYMBOL_NAME_LEN)) {
+                       if (strncmp(attr->name,
+                                   DEFAULT_PYTHON_CHANNEL_NAME,
+                                   LTTNG_SYMBOL_NAME_LEN)) {
                                ret_code = LTTNG_ERR_INVALID_CHANNEL_NAME;
                                goto error;
                        }
@@ -1470,11 +1490,11 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code cmd_process_attr_tracker_get_tracking_policy(
-               struct ltt_session *session,
-               enum lttng_domain_type domain,
-               enum lttng_process_attr process_attr,
-               enum lttng_tracking_policy *policy)
+enum lttng_error_code
+cmd_process_attr_tracker_get_tracking_policy(struct ltt_session *session,
+                                            enum lttng_domain_type domain,
+                                            enum lttng_process_attr process_attr,
+                                            enum lttng_tracking_policy *policy)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
        const struct process_attr_tracker *tracker;
@@ -1485,16 +1505,14 @@ enum lttng_error_code cmd_process_attr_tracker_get_tracking_policy(
                        ret_code = LTTNG_ERR_INVALID;
                        goto end;
                }
-               tracker = kernel_get_process_attr_tracker(
-                               session->kernel_session, process_attr);
+               tracker = kernel_get_process_attr_tracker(session->kernel_session, process_attr);
                break;
        case LTTNG_DOMAIN_UST:
                if (!session->ust_session) {
                        ret_code = LTTNG_ERR_INVALID;
                        goto end;
                }
-               tracker = trace_ust_get_process_attr_tracker(
-                               session->ust_session, process_attr);
+               tracker = trace_ust_get_process_attr_tracker(session->ust_session, process_attr);
                break;
        default:
                ret_code = LTTNG_ERR_UNSUPPORTED_DOMAIN;
@@ -1509,11 +1527,11 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code cmd_process_attr_tracker_set_tracking_policy(
-               struct ltt_session *session,
-               enum lttng_domain_type domain,
-               enum lttng_process_attr process_attr,
-               enum lttng_tracking_policy policy)
+enum lttng_error_code
+cmd_process_attr_tracker_set_tracking_policy(struct ltt_session *session,
+                                            enum lttng_domain_type domain,
+                                            enum lttng_process_attr process_attr,
+                                            enum lttng_tracking_policy policy)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
 
@@ -1534,7 +1552,7 @@ enum lttng_error_code cmd_process_attr_tracker_set_tracking_policy(
                        goto end;
                }
                ret_code = kernel_process_attr_tracker_set_tracking_policy(
-                               session->kernel_session, process_attr, policy);
+                       session->kernel_session, process_attr, policy);
                break;
        case LTTNG_DOMAIN_UST:
                if (!session->ust_session) {
@@ -1542,7 +1560,7 @@ enum lttng_error_code cmd_process_attr_tracker_set_tracking_policy(
                        goto end;
                }
                ret_code = trace_ust_process_attr_tracker_set_tracking_policy(
-                               session->ust_session, process_attr, policy);
+                       session->ust_session, process_attr, policy);
                break;
        default:
                ret_code = LTTNG_ERR_UNSUPPORTED_DOMAIN;
@@ -1552,11 +1570,11 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code cmd_process_attr_tracker_inclusion_set_add_value(
-               struct ltt_session *session,
-               enum lttng_domain_type domain,
-               enum lttng_process_attr process_attr,
-               const struct process_attr_value *value)
+enum lttng_error_code
+cmd_process_attr_tracker_inclusion_set_add_value(struct ltt_session *session,
+                                                enum lttng_domain_type domain,
+                                                enum lttng_process_attr process_attr,
+                                                const struct process_attr_value *value)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
 
@@ -1567,7 +1585,7 @@ enum lttng_error_code cmd_process_attr_tracker_inclusion_set_add_value(
                        goto end;
                }
                ret_code = kernel_process_attr_tracker_inclusion_set_add_value(
-                               session->kernel_session, process_attr, value);
+                       session->kernel_session, process_attr, value);
                break;
        case LTTNG_DOMAIN_UST:
                if (!session->ust_session) {
@@ -1575,7 +1593,7 @@ enum lttng_error_code cmd_process_attr_tracker_inclusion_set_add_value(
                        goto end;
                }
                ret_code = trace_ust_process_attr_tracker_inclusion_set_add_value(
-                               session->ust_session, process_attr, value);
+                       session->ust_session, process_attr, value);
                break;
        default:
                ret_code = LTTNG_ERR_UNSUPPORTED_DOMAIN;
@@ -1585,11 +1603,11 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code cmd_process_attr_tracker_inclusion_set_remove_value(
-               struct ltt_session *session,
-               enum lttng_domain_type domain,
-               enum lttng_process_attr process_attr,
-               const struct process_attr_value *value)
+enum lttng_error_code
+cmd_process_attr_tracker_inclusion_set_remove_value(struct ltt_session *session,
+                                                   enum lttng_domain_type domain,
+                                                   enum lttng_process_attr process_attr,
+                                                   const struct process_attr_value *value)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
 
@@ -1600,7 +1618,7 @@ enum lttng_error_code cmd_process_attr_tracker_inclusion_set_remove_value(
                        goto end;
                }
                ret_code = kernel_process_attr_tracker_inclusion_set_remove_value(
-                               session->kernel_session, process_attr, value);
+                       session->kernel_session, process_attr, value);
                break;
        case LTTNG_DOMAIN_UST:
                if (!session->ust_session) {
@@ -1608,7 +1626,7 @@ enum lttng_error_code cmd_process_attr_tracker_inclusion_set_remove_value(
                        goto end;
                }
                ret_code = trace_ust_process_attr_tracker_inclusion_set_remove_value(
-                               session->ust_session, process_attr, value);
+                       session->ust_session, process_attr, value);
                break;
        default:
                ret_code = LTTNG_ERR_UNSUPPORTED_DOMAIN;
@@ -1618,11 +1636,11 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code cmd_process_attr_tracker_get_inclusion_set(
-               struct ltt_session *session,
-               enum lttng_domain_type domain,
-               enum lttng_process_attr process_attr,
-               struct lttng_process_attr_values **values)
+enum lttng_error_code
+cmd_process_attr_tracker_get_inclusion_set(struct ltt_session *session,
+                                          enum lttng_domain_type domain,
+                                          enum lttng_process_attr process_attr,
+                                          struct lttng_process_attr_values **values)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
        const struct process_attr_tracker *tracker;
@@ -1634,16 +1652,14 @@ enum lttng_error_code cmd_process_attr_tracker_get_inclusion_set(
                        ret_code = LTTNG_ERR_INVALID;
                        goto end;
                }
-               tracker = kernel_get_process_attr_tracker(
-                               session->kernel_session, process_attr);
+               tracker = kernel_get_process_attr_tracker(session->kernel_session, process_attr);
                break;
        case LTTNG_DOMAIN_UST:
                if (!session->ust_session) {
                        ret_code = LTTNG_ERR_INVALID;
                        goto end;
                }
-               tracker = trace_ust_get_process_attr_tracker(
-                               session->ust_session, process_attr);
+               tracker = trace_ust_get_process_attr_tracker(session->ust_session, process_attr);
                break;
        default:
                ret_code = LTTNG_ERR_UNSUPPORTED_DOMAIN;
@@ -1679,10 +1695,10 @@ end:
  * Command LTTNG_DISABLE_EVENT processed by the client thread.
  */
 int cmd_disable_event(struct command_ctx *cmd_ctx,
-               struct lttng_event *event,
-               char *filter_expression,
-               struct lttng_bytecode *bytecode,
-               struct lttng_event_exclusion *exclusion)
+                     struct lttng_event *event,
+                     char *filter_expression,
+                     struct lttng_bytecode *bytecode,
+                     struct lttng_event_exclusion *exclusion)
 {
        int ret;
        const char *event_name;
@@ -1708,8 +1724,8 @@ int cmd_disable_event(struct command_ctx *cmd_ctx,
        event_name = event->name;
 
        /* Error out on unhandled search criteria */
-       if (event->loglevel_type || event->loglevel != -1 || event->enabled
-                       || event->pid || event->filter || event->exclusion) {
+       if (event->loglevel_type || event->loglevel != -1 || event->enabled || event->pid ||
+           event->filter || event->exclusion) {
                ret = LTTNG_ERR_UNK;
                goto error;
        }
@@ -1746,13 +1762,11 @@ int cmd_disable_event(struct command_ctx *cmd_ctx,
                case LTTNG_EVENT_SYSCALL:
                case LTTNG_EVENT_PROBE:
                case LTTNG_EVENT_FUNCTION:
-               case LTTNG_EVENT_FUNCTION_ENTRY:/* fall-through */
+               case LTTNG_EVENT_FUNCTION_ENTRY: /* fall-through */
                        if (event_name[0] == '\0') {
-                               ret = event_kernel_disable_event(kchan,
-                                       NULL, event->type);
+                               ret = event_kernel_disable_event(kchan, NULL, event->type);
                        } else {
-                               ret = event_kernel_disable_event(kchan,
-                                       event_name, event->type);
+                               ret = event_kernel_disable_event(kchan, event_name, event->type);
                        }
                        if (ret != LTTNG_OK) {
                                goto error_unlock;
@@ -1788,8 +1802,7 @@ int cmd_disable_event(struct command_ctx *cmd_ctx,
                        goto error_unlock;
                }
 
-               uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
-                               channel_name);
+               uchan = trace_ust_find_channel_by_name(usess->domain_global.channels, channel_name);
                if (uchan == NULL) {
                        ret = LTTNG_ERR_UST_CHAN_NOT_FOUND;
                        goto error_unlock;
@@ -1804,8 +1817,7 @@ int cmd_disable_event(struct command_ctx *cmd_ctx,
                        if (event->name[0] == '\0') {
                                ret = event_ust_disable_all_tracepoints(usess, uchan);
                        } else {
-                               ret = event_ust_disable_tracepoint(usess, uchan,
-                                               event_name);
+                               ret = event_ust_disable_tracepoint(usess, uchan, event_name);
                        }
                        if (ret != LTTNG_OK) {
                                goto error_unlock;
@@ -1816,8 +1828,7 @@ int cmd_disable_event(struct command_ctx *cmd_ctx,
                        goto error_unlock;
                }
 
-               DBG3("Disable UST event %s in channel %s completed", event_name,
-                               channel_name);
+               DBG3("Disable UST event %s in channel %s completed", event_name, channel_name);
                break;
        }
        case LTTNG_DOMAIN_LOG4J:
@@ -1877,7 +1888,8 @@ error:
  * Command LTTNG_ADD_CONTEXT processed by the client thread.
  */
 int cmd_add_context(struct command_ctx *cmd_ctx,
-       const struct lttng_event_context *event_context, int kwpipe)
+                   const struct lttng_event_context *event_context,
+                   int kwpipe)
 {
        int ret, chan_kern_created = 0, chan_ust_created = 0;
        const enum lttng_domain_type domain = cmd_ctx->lsm.domain.type;
@@ -1907,8 +1919,7 @@ int cmd_add_context(struct command_ctx *cmd_ctx,
                        chan_kern_created = 1;
                }
                /* Add kernel context to kernel tracer */
-               ret = context_kernel_add(session->kernel_session,
-                               event_context, channel_name);
+               ret = context_kernel_add(session->kernel_session, event_context, channel_name);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -1924,13 +1935,11 @@ int cmd_add_context(struct command_ctx *cmd_ctx,
                 * name, return an error.
                 */
                if (domain == LTTNG_DOMAIN_JUL && *channel_name &&
-                               strcmp(channel_name,
-                               DEFAULT_JUL_CHANNEL_NAME)) {
+                   strcmp(channel_name, DEFAULT_JUL_CHANNEL_NAME)) {
                        ret = LTTNG_ERR_UST_CHAN_NOT_FOUND;
                        goto error;
                } else if (domain == LTTNG_DOMAIN_LOG4J && *channel_name &&
-                               strcmp(channel_name,
-                               DEFAULT_LOG4J_CHANNEL_NAME)) {
+                          strcmp(channel_name, DEFAULT_LOG4J_CHANNEL_NAME)) {
                        ret = LTTNG_ERR_UST_CHAN_NOT_FOUND;
                        goto error;
                }
@@ -1962,8 +1971,7 @@ int cmd_add_context(struct command_ctx *cmd_ctx,
                        chan_ust_created = 1;
                }
 
-               ret = context_ust_add(usess, domain, event_context,
-                               channel_name);
+               ret = context_ust_add(usess, domain, event_context, channel_name);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -1979,24 +1987,20 @@ int cmd_add_context(struct command_ctx *cmd_ctx,
 
 error:
        if (chan_kern_created) {
-               struct ltt_kernel_channel *kchan =
-                       trace_kernel_get_channel_by_name(DEFAULT_CHANNEL_NAME,
-                                       session->kernel_session);
+               struct ltt_kernel_channel *kchan = trace_kernel_get_channel_by_name(
+                       DEFAULT_CHANNEL_NAME, session->kernel_session);
                /* Created previously, this should NOT fail. */
                LTTNG_ASSERT(kchan);
                kernel_destroy_channel(kchan);
        }
 
        if (chan_ust_created) {
-               struct ltt_ust_channel *uchan =
-                       trace_ust_find_channel_by_name(
-                                       session->ust_session->domain_global.channels,
-                                       DEFAULT_CHANNEL_NAME);
+               struct ltt_ust_channel *uchan = trace_ust_find_channel_by_name(
+                       session->ust_session->domain_global.channels, DEFAULT_CHANNEL_NAME);
                /* Created previously, this should NOT fail. */
                LTTNG_ASSERT(uchan);
                /* Remove from the channel list of the session. */
-               trace_ust_delete_channel(session->ust_session->domain_global.channels,
-                               uchan);
+               trace_ust_delete_channel(session->ust_session->domain_global.channels, uchan);
                trace_ust_destroy_channel(uchan);
        }
 end:
@@ -2025,8 +2029,8 @@ static int validate_ust_event_name(const char *name)
         * by the agents.
         */
        if (name_starts_with(name, DEFAULT_JUL_EVENT_COMPONENT) ||
-               name_starts_with(name, DEFAULT_LOG4J_EVENT_COMPONENT) ||
-               name_starts_with(name, DEFAULT_PYTHON_EVENT_COMPONENT)) {
+           name_starts_with(name, DEFAULT_LOG4J_EVENT_COMPONENT) ||
+           name_starts_with(name, DEFAULT_PYTHON_EVENT_COMPONENT)) {
                ret = -1;
        }
 
@@ -2041,12 +2045,14 @@ end:
  * enable the events through which all "agent" events are funeled.
  */
 static int _cmd_enable_event(struct ltt_session *session,
-               const struct lttng_domain *domain,
-               char *channel_name, struct lttng_event *event,
-               char *filter_expression,
-               struct lttng_bytecode *filter,
-               struct lttng_event_exclusion *exclusion,
-               int wpipe, bool internal_event)
+                            const struct lttng_domain *domain,
+                            char *channel_name,
+                            struct lttng_event *event,
+                            char *filter_expression,
+                            struct lttng_bytecode *filter,
+                            struct lttng_event_exclusion *exclusion,
+                            int wpipe,
+                            bool internal_event)
 {
        int ret = 0, channel_created = 0;
        struct lttng_channel *attr = NULL;
@@ -2086,29 +2092,24 @@ static int _cmd_enable_event(struct ltt_session *session,
                 * session, explicitely require that -c chan_name needs
                 * to be provided.
                 */
-               if (session->kernel_session->has_non_default_channel
-                               && channel_name[0] == '\0') {
+               if (session->kernel_session->has_non_default_channel && channel_name[0] == '\0') {
                        ret = LTTNG_ERR_NEED_CHANNEL_NAME;
                        goto error;
                }
 
-               kchan = trace_kernel_get_channel_by_name(channel_name,
-                               session->kernel_session);
+               kchan = trace_kernel_get_channel_by_name(channel_name, session->kernel_session);
                if (kchan == NULL) {
-                       attr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL,
-                                       LTTNG_BUFFER_GLOBAL);
+                       attr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL, LTTNG_BUFFER_GLOBAL);
                        if (attr == NULL) {
                                ret = LTTNG_ERR_FATAL;
                                goto error;
                        }
-                       if (lttng_strncpy(attr->name, channel_name,
-                                       sizeof(attr->name))) {
+                       if (lttng_strncpy(attr->name, channel_name, sizeof(attr->name))) {
                                ret = LTTNG_ERR_INVALID;
                                goto error;
                        }
 
-                       ret = cmd_enable_channel_internal(
-                                       session, domain, attr, wpipe);
+                       ret = cmd_enable_channel_internal(session, domain, attr, wpipe);
                        if (ret != LTTNG_OK) {
                                goto error;
                        }
@@ -2116,8 +2117,7 @@ static int _cmd_enable_event(struct ltt_session *session,
                }
 
                /* Get the newly created kernel channel pointer */
-               kchan = trace_kernel_get_channel_by_name(channel_name,
-                               session->kernel_session);
+               kchan = trace_kernel_get_channel_by_name(channel_name, session->kernel_session);
                if (kchan == NULL) {
                        /* This sould not happen... */
                        ret = LTTNG_ERR_FATAL;
@@ -2151,9 +2151,8 @@ static int _cmd_enable_event(struct ltt_session *session,
                                }
                                memcpy(filter_a, filter, sizeof(*filter_a) + filter->len);
                        }
-                       event->type = LTTNG_EVENT_TRACEPOINT;   /* Hack */
-                       ret = event_kernel_enable_event(kchan, event,
-                               filter_expression, filter);
+                       event->type = LTTNG_EVENT_TRACEPOINT; /* Hack */
+                       ret = event_kernel_enable_event(kchan, event, filter_expression, filter);
                        /* We have passed ownership */
                        filter_expression = NULL;
                        filter = NULL;
@@ -2166,9 +2165,9 @@ static int _cmd_enable_event(struct ltt_session *session,
                                free(filter_a);
                                goto error;
                        }
-                       event->type = LTTNG_EVENT_SYSCALL;      /* Hack */
-                       ret = event_kernel_enable_event(kchan, event,
-                               filter_expression_a, filter_a);
+                       event->type = LTTNG_EVENT_SYSCALL; /* Hack */
+                       ret = event_kernel_enable_event(
+                               kchan, event, filter_expression_a, filter_a);
                        /* We have passed ownership */
                        filter_expression_a = NULL;
                        filter_a = NULL;
@@ -2182,8 +2181,7 @@ static int _cmd_enable_event(struct ltt_session *session,
                case LTTNG_EVENT_FUNCTION:
                case LTTNG_EVENT_FUNCTION_ENTRY:
                case LTTNG_EVENT_TRACEPOINT:
-                       ret = event_kernel_enable_event(kchan, event,
-                               filter_expression, filter);
+                       ret = event_kernel_enable_event(kchan, event, filter_expression, filter);
                        /* We have passed ownership */
                        filter_expression = NULL;
                        filter = NULL;
@@ -2196,8 +2194,7 @@ static int _cmd_enable_event(struct ltt_session *session,
                        }
                        break;
                case LTTNG_EVENT_SYSCALL:
-                       ret = event_kernel_enable_event(kchan, event,
-                               filter_expression, filter);
+                       ret = event_kernel_enable_event(kchan, event, filter_expression, filter);
                        /* We have passed ownership */
                        filter_expression = NULL;
                        filter = NULL;
@@ -2231,31 +2228,27 @@ static int _cmd_enable_event(struct ltt_session *session,
                }
 
                /* Get channel from global UST domain */
-               uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
-                               channel_name);
+               uchan = trace_ust_find_channel_by_name(usess->domain_global.channels, channel_name);
                if (uchan == NULL) {
                        /* Create default channel */
-                       attr = channel_new_default_attr(LTTNG_DOMAIN_UST,
-                                       usess->buffer_type);
+                       attr = channel_new_default_attr(LTTNG_DOMAIN_UST, usess->buffer_type);
                        if (attr == NULL) {
                                ret = LTTNG_ERR_FATAL;
                                goto error;
                        }
-                       if (lttng_strncpy(attr->name, channel_name,
-                                       sizeof(attr->name))) {
+                       if (lttng_strncpy(attr->name, channel_name, sizeof(attr->name))) {
                                ret = LTTNG_ERR_INVALID;
                                goto error;
                        }
 
-                       ret = cmd_enable_channel_internal(
-                                       session, domain, attr, wpipe);
+                       ret = cmd_enable_channel_internal(session, domain, attr, wpipe);
                        if (ret != LTTNG_OK) {
                                goto error;
                        }
 
                        /* Get the newly created channel reference back */
-                       uchan = trace_ust_find_channel_by_name(
-                                       usess->domain_global.channels, channel_name);
+                       uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
+                                                              channel_name);
                        LTTNG_ASSERT(uchan);
                }
 
@@ -2276,17 +2269,15 @@ static int _cmd_enable_event(struct ltt_session *session,
                         */
                        ret = validate_ust_event_name(event->name);
                        if (ret) {
-                               WARN("Userspace event name %s failed validation.",
-                                               event->name);
+                               WARN("Userspace event name %s failed validation.", event->name);
                                ret = LTTNG_ERR_INVALID_EVENT_NAME;
                                goto error;
                        }
                }
 
                /* At this point, the session and channel exist on the tracer */
-               ret = event_ust_enable_tracepoint(usess, uchan, event,
-                               filter_expression, filter, exclusion,
-                               internal_event);
+               ret = event_ust_enable_tracepoint(
+                       usess, uchan, event, filter_expression, filter, exclusion, internal_event);
                /* We have passed ownership */
                filter_expression = NULL;
                filter = NULL;
@@ -2330,8 +2321,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;
-               default_event_name = event_get_default_agent_ust_name(
-                               domain->type);
+               default_event_name = event_get_default_agent_ust_name(domain->type);
                if (!default_event_name) {
                        ret = LTTNG_ERR_FATAL;
                        goto error;
@@ -2367,9 +2357,8 @@ static int _cmd_enable_event(struct ltt_session *session,
                        struct lttng_bytecode *filter_copy = NULL;
 
                        if (filter) {
-                               const size_t filter_size = sizeof(
-                                               struct lttng_bytecode)
-                                               + filter->len;
+                               const size_t filter_size =
+                                       sizeof(struct lttng_bytecode) + filter->len;
 
                                filter_copy = zmalloc<lttng_bytecode>(filter_size);
                                if (!filter_copy) {
@@ -2378,8 +2367,7 @@ static int _cmd_enable_event(struct ltt_session *session,
                                }
                                memcpy(filter_copy, filter, filter_size);
 
-                               filter_expression_copy =
-                                               strdup(filter_expression);
+                               filter_expression_copy = strdup(filter_expression);
                                if (!filter_expression) {
                                        ret = LTTNG_ERR_NOMEM;
                                }
@@ -2391,10 +2379,14 @@ static int _cmd_enable_event(struct ltt_session *session,
                                }
                        }
 
-                       ret = cmd_enable_event_internal(session, &tmp_dom,
-                                       (char *) default_chan_name,
-                                       &uevent, filter_expression_copy,
-                                       filter_copy, NULL, wpipe);
+                       ret = cmd_enable_event_internal(session,
+                                                       &tmp_dom,
+                                                       (char *) default_chan_name,
+                                                       &uevent,
+                                                       filter_expression_copy,
+                                                       filter_copy,
+                                                       NULL,
+                                                       wpipe);
                }
 
                if (ret == LTTNG_ERR_UST_EVENT_ENABLED) {
@@ -2405,11 +2397,9 @@ static int _cmd_enable_event(struct ltt_session *session,
 
                /* The wild card * means that everything should be enabled. */
                if (strncmp(event->name, "*", 1) == 0 && strlen(event->name) == 1) {
-                       ret = event_agent_enable_all(usess, agt, event, filter,
-                                       filter_expression);
+                       ret = event_agent_enable_all(usess, agt, event, filter, filter_expression);
                } else {
-                       ret = event_agent_enable(usess, agt, event, filter,
-                                       filter_expression);
+                       ret = event_agent_enable(usess, agt, event, filter, filter_expression);
                }
                filter = NULL;
                filter_expression = NULL;
@@ -2441,11 +2431,11 @@ error:
  * We own filter, exclusion, and filter_expression.
  */
 int cmd_enable_event(struct command_ctx *cmd_ctx,
-               struct lttng_event *event,
-               char *filter_expression,
-               struct lttng_event_exclusion *exclusion,
-               struct lttng_bytecode *bytecode,
-               int wpipe)
+                    struct lttng_event *event,
+                    char *filter_expression,
+                    struct lttng_event_exclusion *exclusion,
+                    struct lttng_bytecode *bytecode,
+                    int wpipe)
 {
        int ret;
        /*
@@ -2462,9 +2452,14 @@ int cmd_enable_event(struct command_ctx *cmd_ctx,
         *  - exclusion
         */
        ret = _cmd_enable_event(cmd_ctx->session,
-                       &command_domain,
-                       cmd_ctx->lsm.u.enable.channel_name, event,
-                       filter_expression, bytecode, exclusion, wpipe, false);
+                               &command_domain,
+                               cmd_ctx->lsm.u.enable.channel_name,
+                               event,
+                               filter_expression,
+                               bytecode,
+                               exclusion,
+                               wpipe,
+                               false);
        filter_expression = NULL;
        bytecode = NULL;
        exclusion = NULL;
@@ -2477,22 +2472,30 @@ int cmd_enable_event(struct command_ctx *cmd_ctx,
  * reserved names.
  */
 static int cmd_enable_event_internal(struct ltt_session *session,
-               const struct lttng_domain *domain,
-               char *channel_name, struct lttng_event *event,
-               char *filter_expression,
-               struct lttng_bytecode *filter,
-               struct lttng_event_exclusion *exclusion,
-               int wpipe)
+                                    const struct lttng_domain *domain,
+                                    char *channel_name,
+                                    struct lttng_event *event,
+                                    char *filter_expression,
+                                    struct lttng_bytecode *filter,
+                                    struct lttng_event_exclusion *exclusion,
+                                    int wpipe)
 {
-       return _cmd_enable_event(session, domain, channel_name, event,
-                       filter_expression, filter, exclusion, wpipe, true);
+       return _cmd_enable_event(session,
+                                domain,
+                                channel_name,
+                                event,
+                                filter_expression,
+                                filter,
+                                exclusion,
+                                wpipe,
+                                true);
 }
 
 /*
  * Command LTTNG_LIST_TRACEPOINTS processed by the client thread.
  */
 enum lttng_error_code cmd_list_tracepoints(enum lttng_domain_type domain,
-               struct lttng_payload *reply_payload)
+                                          struct lttng_payload *reply_payload)
 {
        enum lttng_error_code ret_code;
        int ret;
@@ -2506,8 +2509,8 @@ enum lttng_error_code cmd_list_tracepoints(enum lttng_domain_type domain,
        /* Reserve space for command reply header. */
        reply_command_header_offset = reply_payload->buffer.size;
        ret = lttng_dynamic_buffer_set_size(&reply_payload->buffer,
-                       reply_command_header_offset +
-                                       sizeof(struct lttcomm_list_command_header));
+                                           reply_command_header_offset +
+                                                   sizeof(struct lttcomm_list_command_header));
        if (ret) {
                ret_code = LTTNG_ERR_NOMEM;
                goto error;
@@ -2543,8 +2546,7 @@ enum lttng_error_code cmd_list_tracepoints(enum lttng_domain_type domain,
        }
 
        for (i = 0; i < nb_events; i++) {
-               ret = lttng_event_serialize(&events[i], 0, NULL, NULL, 0, NULL,
-                               reply_payload);
+               ret = lttng_event_serialize(&events[i], 0, NULL, NULL, 0, NULL, reply_payload);
                if (ret) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto error;
@@ -2559,8 +2561,9 @@ enum lttng_error_code cmd_list_tracepoints(enum lttng_domain_type domain,
 
        /* Update command reply header. */
        reply_command_header.count = (uint32_t) nb_events;
-       memcpy(reply_payload->buffer.data + reply_command_header_offset, &reply_command_header,
-                       sizeof(reply_command_header));
+       memcpy(reply_payload->buffer.data + reply_command_header_offset,
+              &reply_command_header,
+              sizeof(reply_command_header));
 
        ret_code = LTTNG_OK;
 error:
@@ -2572,7 +2575,7 @@ error:
  * Command LTTNG_LIST_TRACEPOINT_FIELDS processed by the client thread.
  */
 enum lttng_error_code cmd_list_tracepoint_fields(enum lttng_domain_type domain,
-               struct lttng_payload *reply)
+                                                struct lttng_payload *reply)
 {
        enum lttng_error_code ret_code;
        int ret;
@@ -2586,8 +2589,8 @@ enum lttng_error_code cmd_list_tracepoint_fields(enum lttng_domain_type domain,
        /* Reserve space for command reply header. */
        reply_command_header_offset = reply->buffer.size;
        ret = lttng_dynamic_buffer_set_size(&reply->buffer,
-                       reply_command_header_offset +
-                               sizeof(struct lttcomm_list_command_header));
+                                           reply_command_header_offset +
+                                                   sizeof(struct lttcomm_list_command_header));
        if (ret) {
                ret_code = LTTNG_ERR_NOMEM;
                goto error;
@@ -2603,7 +2606,7 @@ enum lttng_error_code cmd_list_tracepoint_fields(enum lttng_domain_type domain,
 
                break;
        case LTTNG_DOMAIN_KERNEL:
-       default:        /* fall-through */
+       default: /* fall-through */
                ret_code = LTTNG_ERR_UND;
                goto error;
        }
@@ -2627,8 +2630,9 @@ enum lttng_error_code cmd_list_tracepoint_fields(enum lttng_domain_type domain,
        /* Update command reply header. */
        reply_command_header.count = (uint32_t) nb_fields;
 
-       memcpy(reply->buffer.data + reply_command_header_offset, &reply_command_header,
-                       sizeof(reply_command_header));
+       memcpy(reply->buffer.data + reply_command_header_offset,
+              &reply_command_header,
+              sizeof(reply_command_header));
 
        ret_code = LTTNG_OK;
 
@@ -2637,8 +2641,7 @@ error:
        return ret_code;
 }
 
-enum lttng_error_code cmd_list_syscalls(
-               struct lttng_payload *reply_payload)
+enum lttng_error_code cmd_list_syscalls(struct lttng_payload *reply_payload)
 {
        enum lttng_error_code ret_code;
        ssize_t nb_events, i;
@@ -2652,8 +2655,8 @@ enum lttng_error_code cmd_list_syscalls(
        /* Reserve space for command reply header. */
        reply_command_header_offset = reply_payload->buffer.size;
        ret = lttng_dynamic_buffer_set_size(&reply_payload->buffer,
-                       reply_command_header_offset +
-                                       sizeof(struct lttcomm_list_command_header));
+                                           reply_command_header_offset +
+                                                   sizeof(struct lttcomm_list_command_header));
        if (ret) {
                ret_code = LTTNG_ERR_NOMEM;
                goto end;
@@ -2661,13 +2664,12 @@ enum lttng_error_code cmd_list_syscalls(
 
        nb_events = syscall_table_list(&events);
        if (nb_events < 0) {
-               ret_code = (enum lttng_error_code) -nb_events;
+               ret_code = (enum lttng_error_code) - nb_events;
                goto end;
        }
 
        for (i = 0; i < nb_events; i++) {
-               ret = lttng_event_serialize(&events[i], 0, NULL, NULL, 0, NULL,
-                               reply_payload);
+               ret = lttng_event_serialize(&events[i], 0, NULL, NULL, 0, NULL, reply_payload);
                if (ret) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto end;
@@ -2682,8 +2684,9 @@ enum lttng_error_code cmd_list_syscalls(
 
        /* Update command reply header. */
        reply_command_header.count = (uint32_t) nb_events;
-       memcpy(reply_payload->buffer.data + reply_command_header_offset, &reply_command_header,
-                       sizeof(reply_command_header));
+       memcpy(reply_payload->buffer.data + reply_command_header_offset,
+              &reply_command_header,
+              sizeof(reply_command_header));
 
        ret_code = LTTNG_OK;
 end:
@@ -2702,10 +2705,8 @@ int cmd_start_trace(struct ltt_session *session)
        unsigned long nb_chan = 0;
        struct ltt_kernel_session *ksession;
        struct ltt_ust_session *usess;
-       const bool session_rotated_after_last_stop =
-                       session->rotated_after_last_stop;
-       const bool session_cleared_after_last_stop =
-                       session->cleared_after_last_stop;
+       const bool session_rotated_after_last_stop = session->rotated_after_last_stop;
+       const bool session_cleared_after_last_stop = session->cleared_after_last_stop;
 
        LTTNG_ASSERT(session);
 
@@ -2721,7 +2722,7 @@ int cmd_start_trace(struct ltt_session *session)
        }
 
        if (session->rotation_state == LTTNG_ROTATION_STATE_ONGOING &&
-                       !session->current_trace_chunk) {
+           !session->current_trace_chunk) {
                /*
                 * A rotation was launched while the session was stopped and
                 * it has not been completed yet. It is not possible to start
@@ -2731,7 +2732,7 @@ int cmd_start_trace(struct ltt_session *session)
                 * supported.
                 */
                WARN("Refusing to start session \"%s\" as a rotation launched after the last \"stop\" is still ongoing",
-                               session->name);
+                    session->name);
                ret = LTTNG_ERR_ROTATION_PENDING;
                goto error;
        }
@@ -2758,17 +2759,15 @@ int cmd_start_trace(struct ltt_session *session)
                if (!session->has_been_started) {
                        struct lttng_trace_chunk *trace_chunk;
 
-                       DBG("Creating initial trace chunk of session \"%s\"",
-                                       session->name);
-                       trace_chunk = session_create_new_trace_chunk(
-                                       session, NULL, NULL, NULL);
+                       DBG("Creating initial trace chunk of session \"%s\"", session->name);
+                       trace_chunk = session_create_new_trace_chunk(session, NULL, NULL, NULL);
                        if (!trace_chunk) {
                                ret = LTTNG_ERR_CREATE_DIR_FAIL;
                                goto error;
                        }
                        LTTNG_ASSERT(!session->current_trace_chunk);
-                       ret = (lttng_error_code) session_set_trace_chunk(session, trace_chunk,
-                                       NULL);
+                       ret = (lttng_error_code) session_set_trace_chunk(
+                               session, trace_chunk, NULL);
                        lttng_trace_chunk_put(trace_chunk);
                        if (ret) {
                                ret = LTTNG_ERR_CREATE_TRACE_CHUNK_FAIL_CONSUMER;
@@ -2776,7 +2775,7 @@ int cmd_start_trace(struct ltt_session *session)
                        }
                } else {
                        DBG("Rotating session \"%s\" from its current \"NULL\" trace chunk to a new chunk",
-                                       session->name);
+                           session->name);
                        /*
                         * Rotate existing streams into the new chunk.
                         * This is a "quiet" rotation has no client has
@@ -2787,8 +2786,8 @@ int cmd_start_trace(struct ltt_session *session)
                         * was produced as the session was stopped, so the
                         * rotation should happen on reception of the command.
                         */
-                       ret = (lttng_error_code) cmd_rotate_session(session, NULL, true,
-                                       LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION);
+                       ret = (lttng_error_code) cmd_rotate_session(
+                               session, NULL, true, LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION);
                        if (ret != LTTNG_OK) {
                                goto error;
                        }
@@ -2832,7 +2831,7 @@ int cmd_start_trace(struct ltt_session *session)
 
        if (session->rotate_timer_period && !session->rotation_schedule_timer_enabled) {
                int int_ret = timer_session_rotation_schedule_timer_start(
-                               session, session->rotate_timer_period);
+                       session, session->rotate_timer_period);
 
                if (int_ret < 0) {
                        ERR("Failed to enable rotate timer");
@@ -2850,10 +2849,8 @@ error:
        } else {
                session->active = 0;
                /* Restore initial state on error. */
-               session->rotated_after_last_stop =
-                               session_rotated_after_last_stop;
-               session->cleared_after_last_stop =
-                               session_cleared_after_last_stop;
+               session->rotated_after_last_stop = session_rotated_after_last_stop;
+               session->cleared_after_last_stop = session_cleared_after_last_stop;
        }
 end:
        return ret;
@@ -2894,8 +2891,7 @@ int cmd_stop_trace(struct ltt_session *session)
                }
        }
 
-       DBG("Completed stop session \"%s\" (id %" PRIu64 ")", session->name,
-                       session->id);
+       DBG("Completed stop session \"%s\" (id %" PRIu64 ")", session->name, session->id);
        /* Flag inactive after a successful stop. */
        session->active = 0;
        ret = LTTNG_OK;
@@ -2908,16 +2904,14 @@ error:
  * Set the base_path of the session only if subdir of a control uris is set.
  * Return LTTNG_OK on success, otherwise LTTNG_ERR_*.
  */
-static int set_session_base_path_from_uris(struct ltt_session *session,
-               size_t nb_uri,
-               struct lttng_uri *uris)
+static int
+set_session_base_path_from_uris(struct ltt_session *session, size_t nb_uri, struct lttng_uri *uris)
 {
        int ret;
        size_t i;
 
        for (i = 0; i < nb_uri; i++) {
-               if (uris[i].stype != LTTNG_STREAM_CONTROL ||
-                               uris[i].subdir[0] == '\0') {
+               if (uris[i].stype != LTTNG_STREAM_CONTROL || uris[i].subdir[0] == '\0') {
                        /* Not interested in these URIs */
                        continue;
                }
@@ -2931,12 +2925,14 @@ static int set_session_base_path_from_uris(struct ltt_session *session,
                session->base_path = strdup(uris[i].subdir);
                if (!session->base_path) {
                        PERROR("Failed to copy base path \"%s\" to session \"%s\"",
-                                       uris[i].subdir, session->name);
+                              uris[i].subdir,
+                              session->name);
                        ret = LTTNG_ERR_NOMEM;
                        goto error;
                }
                DBG2("Setting base path \"%s\" for session \"%s\"",
-                               session->base_path, session->name);
+                    session->base_path,
+                    session->name);
        }
        ret = LTTNG_OK;
 error:
@@ -2946,8 +2942,7 @@ error:
 /*
  * Command LTTNG_SET_CONSUMER_URI processed by the client thread.
  */
-int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri,
-               struct lttng_uri *uris)
+int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri, struct lttng_uri *uris)
 {
        int ret, i;
        struct ltt_kernel_session *ksess = session->kernel_session;
@@ -2975,8 +2970,7 @@ int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri,
 
        /* Set the "global" consumer URIs */
        for (i = 0; i < nb_uri; i++) {
-               ret = add_uri_to_consumer(session, session->consumer, &uris[i],
-                               LTTNG_DOMAIN_NONE);
+               ret = add_uri_to_consumer(session, session->consumer, &uris[i], LTTNG_DOMAIN_NONE);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -2986,8 +2980,9 @@ int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri,
        if (session->ust_session) {
                for (i = 0; i < nb_uri; i++) {
                        ret = add_uri_to_consumer(session,
-                                       session->ust_session->consumer,
-                                       &uris[i], LTTNG_DOMAIN_UST);
+                                                 session->ust_session->consumer,
+                                                 &uris[i],
+                                                 LTTNG_DOMAIN_UST);
                        if (ret != LTTNG_OK) {
                                goto error;
                        }
@@ -2998,8 +2993,9 @@ int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri,
        if (session->kernel_session) {
                for (i = 0; i < nb_uri; i++) {
                        ret = add_uri_to_consumer(session,
-                                       session->kernel_session->consumer,
-                                       &uris[i], LTTNG_DOMAIN_KERNEL);
+                                                 session->kernel_session->consumer,
+                                                 &uris[i],
+                                                 LTTNG_DOMAIN_KERNEL);
                        if (ret != LTTNG_OK) {
                                goto error;
                        }
@@ -3026,17 +3022,16 @@ error:
        return ret;
 }
 
-static
-enum lttng_error_code set_session_output_from_descriptor(
-               struct ltt_session *session,
-               const struct lttng_session_descriptor *descriptor)
+static enum lttng_error_code
+set_session_output_from_descriptor(struct ltt_session *session,
+                                  const struct lttng_session_descriptor *descriptor)
 {
        int ret;
        enum lttng_error_code ret_code = LTTNG_OK;
        enum lttng_session_descriptor_type session_type =
-                       lttng_session_descriptor_get_type(descriptor);
+               lttng_session_descriptor_get_type(descriptor);
        enum lttng_session_descriptor_output_type output_type =
-                       lttng_session_descriptor_get_output_type(descriptor);
+               lttng_session_descriptor_get_output_type(descriptor);
        struct lttng_uri uris[2] = {};
        size_t uri_count = 0;
 
@@ -3044,13 +3039,11 @@ enum lttng_error_code set_session_output_from_descriptor(
        case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE:
                goto end;
        case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_LOCAL:
-               lttng_session_descriptor_get_local_output_uri(descriptor,
-                               &uris[0]);
+               lttng_session_descriptor_get_local_output_uri(descriptor, &uris[0]);
                uri_count = 1;
                break;
        case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK:
-               lttng_session_descriptor_get_network_output_uris(descriptor,
-                               &uris[0], &uris[1]);
+               lttng_session_descriptor_get_network_output_uris(descriptor, &uris[0], &uris[1]);
                uri_count = 2;
                break;
        default:
@@ -3070,12 +3063,15 @@ enum lttng_error_code set_session_output_from_descriptor(
                }
 
                ret = snapshot_output_init_with_uri(session,
-                               DEFAULT_SNAPSHOT_MAX_SIZE,
-                               NULL, uris, uri_count, session->consumer,
-                               new_output, &session->snapshot);
+                                                   DEFAULT_SNAPSHOT_MAX_SIZE,
+                                                   NULL,
+                                                   uris,
+                                                   uri_count,
+                                                   session->consumer,
+                                                   new_output,
+                                                   &session->snapshot);
                if (ret < 0) {
-                       ret_code = (ret == -ENOMEM) ?
-                                       LTTNG_ERR_NOMEM : LTTNG_ERR_INVALID;
+                       ret_code = (ret == -ENOMEM) ? LTTNG_ERR_NOMEM : LTTNG_ERR_INVALID;
                        snapshot_output_destroy(new_output);
                        goto end;
                }
@@ -3096,11 +3092,10 @@ end:
        return ret_code;
 }
 
-static
-enum lttng_error_code cmd_create_session_from_descriptor(
-               struct lttng_session_descriptor *descriptor,
-               const lttng_sock_cred *creds,
-               const char *home_path)
+static enum lttng_error_code
+cmd_create_session_from_descriptor(struct lttng_session_descriptor *descriptor,
+                                  const lttng_sock_cred *creds,
+                                  const char *home_path)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -3117,8 +3112,7 @@ enum lttng_error_code cmd_create_session_from_descriptor(
                }
        }
 
-       descriptor_status = lttng_session_descriptor_get_session_name(
-                       descriptor, &session_name);
+       descriptor_status = lttng_session_descriptor_get_session_name(descriptor, &session_name);
        switch (descriptor_status) {
        case LTTNG_SESSION_DESCRIPTOR_STATUS_OK:
                break;
@@ -3130,61 +3124,57 @@ enum lttng_error_code cmd_create_session_from_descriptor(
                goto end;
        }
 
-       ret_code = session_create(session_name, creds->uid, creds->gid,
-                       &new_session);
+       ret_code = session_create(session_name, creds->uid, creds->gid, &new_session);
        if (ret_code != LTTNG_OK) {
                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);
+                                                          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);
+               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);
+                      new_session->name);
                ret = LTTNG_ERR_NOMEM;
                goto end;
        }
 
        if (!session_name) {
-               ret = lttng_session_descriptor_set_session_name(descriptor,
-                               new_session->name);
+               ret = lttng_session_descriptor_set_session_name(descriptor, new_session->name);
                if (ret) {
                        ret_code = LTTNG_ERR_SESSION_FAIL;
                        goto end;
                }
        }
 
-       if (!lttng_session_descriptor_is_output_destination_initialized(
-                       descriptor)) {
+       if (!lttng_session_descriptor_is_output_destination_initialized(descriptor)) {
                /*
                 * Only include the session's creation time in the output
                 * destination if the name of the session itself was
                 * not auto-generated.
                 */
                ret_code = lttng_session_descriptor_set_default_output(
-                               descriptor,
-                               session_name ? &new_session->creation_time : NULL,
-                               home_path);
+                       descriptor, session_name ? &new_session->creation_time : NULL, home_path);
                if (ret_code != LTTNG_OK) {
                        goto end;
                }
        } else {
                new_session->has_user_specified_directory =
-                               lttng_session_descriptor_has_output_directory(
-                                       descriptor);
+                       lttng_session_descriptor_has_output_directory(descriptor);
        }
 
        switch (lttng_session_descriptor_get_type(descriptor)) {
@@ -3193,8 +3183,7 @@ enum lttng_error_code cmd_create_session_from_descriptor(
                break;
        case LTTNG_SESSION_DESCRIPTOR_TYPE_LIVE:
                new_session->live_timer =
-                               lttng_session_descriptor_live_get_timer_interval(
-                                       descriptor);
+                       lttng_session_descriptor_live_get_timer_interval(descriptor);
                break;
        default:
                break;
@@ -3217,8 +3206,9 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx, int sock,
-               struct lttng_session_descriptor **return_descriptor)
+enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx,
+                                        int sock,
+                                        struct lttng_session_descriptor **return_descriptor)
 {
        int ret;
        size_t payload_size;
@@ -3229,19 +3219,18 @@ enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx, int sock,
        enum lttng_error_code ret_code;
 
        lttng_dynamic_buffer_init(&payload);
-       if (cmd_ctx->lsm.u.create_session.home_dir_size >=
-                       LTTNG_PATH_MAX) {
+       if (cmd_ctx->lsm.u.create_session.home_dir_size >= LTTNG_PATH_MAX) {
                ret_code = LTTNG_ERR_INVALID;
                goto error;
        }
        if (cmd_ctx->lsm.u.create_session.session_descriptor_size >
-                       LTTNG_SESSION_DESCRIPTOR_MAX_LEN) {
+           LTTNG_SESSION_DESCRIPTOR_MAX_LEN) {
                ret_code = LTTNG_ERR_INVALID;
                goto error;
        }
 
        payload_size = cmd_ctx->lsm.u.create_session.home_dir_size +
-                       cmd_ctx->lsm.u.create_session.session_descriptor_size;
+               cmd_ctx->lsm.u.create_session.session_descriptor_size;
        ret = lttng_dynamic_buffer_set_size(&payload, payload_size);
        if (ret) {
                ret_code = LTTNG_ERR_NOMEM;
@@ -3256,28 +3245,26 @@ enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx, int sock,
        }
 
        home_dir_view = lttng_buffer_view_from_dynamic_buffer(
-                       &payload,
-                       0,
-                       cmd_ctx->lsm.u.create_session.home_dir_size);
+               &payload, 0, cmd_ctx->lsm.u.create_session.home_dir_size);
        if (cmd_ctx->lsm.u.create_session.home_dir_size > 0 &&
-                       !lttng_buffer_view_is_valid(&home_dir_view)) {
+           !lttng_buffer_view_is_valid(&home_dir_view)) {
                ERR("Invalid payload in \"create session\" command: buffer too short to contain home directory");
                ret_code = LTTNG_ERR_INVALID_PROTOCOL;
                goto error;
        }
 
        session_descriptor_view = lttng_buffer_view_from_dynamic_buffer(
-                       &payload,
-                       cmd_ctx->lsm.u.create_session.home_dir_size,
-                       cmd_ctx->lsm.u.create_session.session_descriptor_size);
+               &payload,
+               cmd_ctx->lsm.u.create_session.home_dir_size,
+               cmd_ctx->lsm.u.create_session.session_descriptor_size);
        if (!lttng_buffer_view_is_valid(&session_descriptor_view)) {
                ERR("Invalid payload in \"create session\" command: buffer too short to contain session descriptor");
                ret_code = LTTNG_ERR_INVALID_PROTOCOL;
                goto error;
        }
 
-       ret = lttng_session_descriptor_create_from_buffer(
-                       &session_descriptor_view, &session_descriptor);
+       ret = lttng_session_descriptor_create_from_buffer(&session_descriptor_view,
+                                                         &session_descriptor);
        if (ret < 0) {
                ERR("Failed to create session descriptor from payload of \"create session\" command");
                ret_code = LTTNG_ERR_INVALID;
@@ -3288,9 +3275,10 @@ enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx, int sock,
         * Sets the descriptor's auto-generated properties (name, output) if
         * needed.
         */
-       ret_code = cmd_create_session_from_descriptor(session_descriptor,
-                       &cmd_ctx->creds,
-                       home_dir_view.size ? home_dir_view.data : NULL);
+       ret_code =
+               cmd_create_session_from_descriptor(session_descriptor,
+                                                  &cmd_ctx->creds,
+                                                  home_dir_view.size ? home_dir_view.data : NULL);
        if (ret_code != LTTNG_OK) {
                goto error;
        }
@@ -3304,14 +3292,12 @@ error:
        return ret_code;
 }
 
-static
-void cmd_destroy_session_reply(const struct ltt_session *session,
-               void *_reply_context)
+static void cmd_destroy_session_reply(const struct ltt_session *session, void *_reply_context)
 {
        int ret;
        ssize_t comm_ret;
        const struct cmd_destroy_session_reply_context *reply_context =
-                       (cmd_destroy_session_reply_context *) _reply_context;
+               (cmd_destroy_session_reply_context *) _reply_context;
        struct lttng_dynamic_buffer payload;
        struct lttcomm_session_destroy_command_header cmd_header;
        struct lttng_trace_archive_location *location = NULL;
@@ -3319,8 +3305,7 @@ void cmd_destroy_session_reply(const struct ltt_session *session,
                .cmd_type = LTTCOMM_SESSIOND_COMMAND_DESTROY_SESSION,
                .ret_code = reply_context->destruction_status,
                .pid = UINT32_MAX,
-               .cmd_header_size =
-                       sizeof(struct lttcomm_session_destroy_command_header),
+               .cmd_header_size = sizeof(struct lttcomm_session_destroy_command_header),
                .data_size = 0,
                .fd_count = 0,
        };
@@ -3334,12 +3319,10 @@ void cmd_destroy_session_reply(const struct ltt_session *session,
                goto error;
        }
 
-       cmd_header.rotation_state =
-                       (int32_t) (reply_context->implicit_rotation_on_destroy ?
-                               session->rotation_state :
-                               LTTNG_ROTATION_STATE_NO_ROTATION);
-       ret = lttng_dynamic_buffer_append(&payload, &cmd_header,
-                       sizeof(cmd_header));
+       cmd_header.rotation_state = (int32_t) (reply_context->implicit_rotation_on_destroy ?
+                                                      session->rotation_state :
+                                                      LTTNG_ROTATION_STATE_NO_ROTATION);
+       ret = lttng_dynamic_buffer_append(&payload, &cmd_header, sizeof(cmd_header));
        if (ret) {
                ERR("Failed to append session destruction command header");
                goto error;
@@ -3347,40 +3330,38 @@ void cmd_destroy_session_reply(const struct ltt_session *session,
 
        if (!reply_context->implicit_rotation_on_destroy) {
                DBG("No implicit rotation performed during the destruction of session \"%s\", sending reply",
-                               session->name);
+                   session->name);
                goto send_reply;
        }
        if (session->rotation_state != LTTNG_ROTATION_STATE_COMPLETED) {
                DBG("Rotation state of session \"%s\" is not \"completed\", sending session destruction reply",
-                               session->name);
+                   session->name);
                goto send_reply;
        }
 
        location = session_get_trace_archive_location(session);
        if (!location) {
                ERR("Failed to get the location of the trace archive produced during the destruction of session \"%s\"",
-                               session->name);
+                   session->name);
                goto error;
        }
 
        payload_size_before_location = payload.size;
-       comm_ret = lttng_trace_archive_location_serialize(location,
-                       &payload);
+       comm_ret = lttng_trace_archive_location_serialize(location, &payload);
        lttng_trace_archive_location_put(location);
        if (comm_ret < 0) {
                ERR("Failed to serialize the location of the trace archive produced during the destruction of session \"%s\"",
-                               session->name);
+                   session->name);
                goto error;
        }
        /* Update the message to indicate the location's length. */
        ((struct lttcomm_lttng_msg *) payload.data)->data_size =
-                       payload.size - payload_size_before_location;
+               payload.size - payload_size_before_location;
 send_reply:
-       comm_ret = lttcomm_send_unix_sock(reply_context->reply_sock_fd,
-                       payload.data, payload.size);
+       comm_ret = lttcomm_send_unix_sock(reply_context->reply_sock_fd, payload.data, payload.size);
        if (comm_ret != (ssize_t) payload.size) {
                ERR("Failed to send result of the destruction of session \"%s\" to client",
-                               session->name);
+                   session->name);
        }
 error:
        ret = close(reply_context->reply_sock_fd);
@@ -3397,8 +3378,8 @@ error:
  * Called with session lock held.
  */
 int cmd_destroy_session(struct ltt_session *session,
-               struct notification_thread_handle *notification_thread_handle,
-               int *sock_fd)
+                       struct notification_thread_handle *notification_thread_handle,
+                       int *sock_fd)
 {
        int ret;
        enum lttng_error_code destruction_last_error = LTTNG_OK;
@@ -3417,25 +3398,24 @@ int cmd_destroy_session(struct ltt_session *session,
        /* Safety net */
        LTTNG_ASSERT(session);
 
-       DBG("Begin destroy session %s (id %" PRIu64 ")", session->name,
-                       session->id);
+       DBG("Begin destroy session %s (id %" PRIu64 ")", session->name, session->id);
        if (session->active) {
                DBG("Session \"%s\" is active, attempting to stop it before destroying it",
-                               session->name);
+                   session->name);
                ret = cmd_stop_trace(session);
                if (ret != LTTNG_OK && ret != LTTNG_ERR_TRACE_ALREADY_STOPPED) {
                        /* Carry on with the destruction of the session. */
                        ERR("Failed to stop session \"%s\" as part of its destruction: %s",
-                                       session->name, lttng_strerror(-ret));
+                           session->name,
+                           lttng_strerror(-ret));
                        destruction_last_error = (lttng_error_code) ret;
                }
        }
 
        if (session->rotation_schedule_timer_enabled) {
-               if (timer_session_rotation_schedule_timer_stop(
-                               session)) {
+               if (timer_session_rotation_schedule_timer_stop(session)) {
                        ERR("Failed to stop the \"rotation schedule\" timer of session %s",
-                                       session->name);
+                           session->name);
                        destruction_last_error = LTTNG_ERR_TIMER_STOP_ERROR;
                }
        }
@@ -3450,11 +3430,12 @@ int cmd_destroy_session(struct ltt_session *session,
                 * Perform a last rotation on destruction if rotations have
                 * occurred during the session's lifetime.
                 */
-               ret = cmd_rotate_session(session, NULL, false,
-                       LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
+               ret = cmd_rotate_session(
+                       session, NULL, false, LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
                if (ret != LTTNG_OK) {
                        ERR("Failed to perform an implicit rotation as part of the destruction of session \"%s\": %s",
-                                       session->name, lttng_strerror(-ret));
+                           session->name,
+                           lttng_strerror(-ret));
                        destruction_last_error = (lttng_error_code) -ret;
                }
                if (reply_context) {
@@ -3470,8 +3451,8 @@ int cmd_destroy_session(struct ltt_session *session,
                 * emitted and no renaming of the current trace chunk takes
                 * place.
                 */
-               ret = cmd_rotate_session(session, NULL, true,
-                       LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION);
+               ret = cmd_rotate_session(
+                       session, NULL, true, LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION);
                /*
                 * Rotation operations may not be supported by the kernel
                 * tracer. Hence, do not consider this implicit rotation as
@@ -3479,10 +3460,10 @@ int cmd_destroy_session(struct ltt_session *session,
                 * the session and waited for pending data; there is nothing
                 * left to do but complete the destruction of the session.
                 */
-               if (ret != LTTNG_OK &&
-                               ret != -LTTNG_ERR_ROTATION_NOT_AVAILABLE_KERNEL) {
+               if (ret != LTTNG_OK && ret != -LTTNG_ERR_ROTATION_NOT_AVAILABLE_KERNEL) {
                        ERR("Failed to perform a quiet rotation as part of the destruction of session \"%s\": %s",
-                           session->name, lttng_strerror(ret));
+                           session->name,
+                           lttng_strerror(ret));
                        destruction_last_error = (lttng_error_code) -ret;
                }
        }
@@ -3536,8 +3517,8 @@ int cmd_destroy_session(struct ltt_session *session,
                 */
                current_completion_handler = &destroy_completion_handler.handler;
                ret = lttng_strncpy(destroy_completion_handler.shm_path,
-                               session->shm_path,
-                               sizeof(destroy_completion_handler.shm_path));
+                                   session->shm_path,
+                                   sizeof(destroy_completion_handler.shm_path));
                LTTNG_ASSERT(!ret);
        }
 
@@ -3549,9 +3530,8 @@ int cmd_destroy_session(struct ltt_session *session,
        session_destroy(session);
        if (reply_context) {
                reply_context->destruction_status = destruction_last_error;
-               ret = session_add_destroy_notifier(session,
-                               cmd_destroy_session_reply,
-                               (void *) reply_context);
+               ret = session_add_destroy_notifier(
+                       session, cmd_destroy_session_reply, (void *) reply_context);
                if (ret) {
                        ret = LTTNG_ERR_FATAL;
                        goto end;
@@ -3568,8 +3548,9 @@ end:
  * Command LTTNG_REGISTER_CONSUMER processed by the client thread.
  */
 int cmd_register_consumer(struct ltt_session *session,
-               enum lttng_domain_type domain, const char *sock_path,
-               struct consumer_data *cdata)
+                         enum lttng_domain_type domain,
+                         const char *sock_path,
+                         struct consumer_data *cdata)
 {
        int ret, sock;
        struct consumer_socket *socket = NULL;
@@ -3647,8 +3628,7 @@ error:
 /*
  * Command LTTNG_LIST_DOMAINS processed by the client thread.
  */
-ssize_t cmd_list_domains(struct ltt_session *session,
-               struct lttng_domain **domains)
+ssize_t cmd_list_domains(struct ltt_session *session, struct lttng_domain **domains)
 {
        int ret, index = 0;
        ssize_t nb_dom = 0;
@@ -3665,8 +3645,8 @@ ssize_t cmd_list_domains(struct ltt_session *session,
                nb_dom++;
 
                rcu_read_lock();
-               cds_lfht_for_each_entry(session->ust_session->agents->ht, &iter.iter,
-                               agt, node.node) {
+               cds_lfht_for_each_entry (
+                       session->ust_session->agents->ht, &iter.iter, agt, node.node) {
                        if (agt->being_used) {
                                nb_dom++;
                        }
@@ -3699,8 +3679,8 @@ ssize_t cmd_list_domains(struct ltt_session *session,
                index++;
 
                rcu_read_lock();
-               cds_lfht_for_each_entry(session->ust_session->agents->ht, &iter.iter,
-                               agt, node.node) {
+               cds_lfht_for_each_entry (
+                       session->ust_session->agents->ht, &iter.iter, agt, node.node) {
                        if (agt->being_used) {
                                (*domains)[index].type = agt->domain;
                                (*domains)[index].buf_type = session->ust_session->buffer_type;
@@ -3717,13 +3697,12 @@ error:
        return -ret;
 }
 
-
 /*
  * Command LTTNG_LIST_CHANNELS processed by the client thread.
  */
 enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
-               struct ltt_session *session,
-               struct lttng_payload *payload)
+                                       struct ltt_session *session,
+                                       struct lttng_payload *payload)
 {
        int ret = 0;
        unsigned int i = 0;
@@ -3740,7 +3719,7 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
 
        /* Reserve space for command reply header. */
        ret = lttng_dynamic_buffer_set_size(&payload->buffer,
-                       cmd_header_offset + sizeof(cmd_header));
+                                           cmd_header_offset + sizeof(cmd_header));
        if (ret) {
                ret_code = LTTNG_ERR_NOMEM;
                goto end;
@@ -3752,16 +3731,16 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
                /* Kernel channels */
                struct ltt_kernel_channel *kchan;
                if (session->kernel_session != NULL) {
-                       cds_list_for_each_entry(kchan,
-                                       &session->kernel_session->channel_list.head, list) {
+                       cds_list_for_each_entry (
+                               kchan, &session->kernel_session->channel_list.head, list) {
                                uint64_t discarded_events, lost_packets;
                                struct lttng_channel_extended *extended;
 
                                extended = (struct lttng_channel_extended *)
-                                               kchan->channel->attr.extended.ptr;
+                                                  kchan->channel->attr.extended.ptr;
 
-                               ret = get_kernel_runtime_stats(session, kchan,
-                                               &discarded_events, &lost_packets);
+                               ret = get_kernel_runtime_stats(
+                                       session, kchan, &discarded_events, &lost_packets);
                                if (ret < 0) {
                                        ret_code = LTTNG_ERR_UNK;
                                        goto end;
@@ -3774,11 +3753,10 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
                                extended->discarded_events = discarded_events;
                                extended->lost_packets = lost_packets;
 
-                               ret = lttng_channel_serialize(
-                                               kchan->channel, &payload->buffer);
+                               ret = lttng_channel_serialize(kchan->channel, &payload->buffer);
                                if (ret) {
                                        ERR("Failed to serialize lttng_channel: channel name = '%s'",
-                                                       kchan->channel->name);
+                                           kchan->channel->name);
                                        ret_code = LTTNG_ERR_UNK;
                                        goto end;
                                }
@@ -3794,8 +3772,10 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
                struct ltt_ust_channel *uchan;
 
                rcu_read_lock();
-               cds_lfht_for_each_entry(session->ust_session->domain_global.channels->ht,
-                               &iter.iter, uchan, node.node) {
+               cds_lfht_for_each_entry (session->ust_session->domain_global.channels->ht,
+                                        &iter.iter,
+                                        uchan,
+                                        node.node) {
                        uint64_t discarded_events = 0, lost_packets = 0;
                        struct lttng_channel *channel = NULL;
                        struct lttng_channel_extended *extended;
@@ -3806,11 +3786,10 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
                                goto end;
                        }
 
-                       extended = (struct lttng_channel_extended *)
-                                                  channel->attr.extended.ptr;
+                       extended = (struct lttng_channel_extended *) channel->attr.extended.ptr;
 
-                       ret = get_ust_runtime_stats(session, uchan,
-                                       &discarded_events, &lost_packets);
+                       ret = get_ust_runtime_stats(
+                               session, uchan, &discarded_events, &lost_packets);
                        if (ret < 0) {
                                lttng_channel_destroy(channel);
                                ret_code = LTTNG_ERR_UNK;
@@ -3820,11 +3799,10 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
                        extended->discarded_events = discarded_events;
                        extended->lost_packets = lost_packets;
 
-                       ret = lttng_channel_serialize(
-                                       channel, &payload->buffer);
+                       ret = lttng_channel_serialize(channel, &payload->buffer);
                        if (ret) {
                                ERR("Failed to serialize lttng_channel: channel name = '%s'",
-                                               channel->name);
+                                   channel->name);
                                lttng_channel_destroy(channel);
                                ret_code = LTTNG_ERR_UNK;
                                goto end;
@@ -3848,8 +3826,7 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
 
        /* Update command reply header. */
        cmd_header.count = (uint32_t) i;
-       memcpy(payload->buffer.data + cmd_header_offset, &cmd_header,
-                       sizeof(cmd_header));
+       memcpy(payload->buffer.data + cmd_header_offset, &cmd_header, sizeof(cmd_header));
        ret_code = LTTNG_OK;
 
 end:
@@ -3860,9 +3837,9 @@ end:
  * Command LTTNG_LIST_EVENTS processed by the client thread.
  */
 enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
-               struct ltt_session *session,
-               char *channel_name,
-               struct lttng_payload *reply_payload)
+                                     struct ltt_session *session,
+                                     char *channel_name,
+                                     struct lttng_payload *reply_payload)
 {
        int buffer_resize_ret;
        enum lttng_error_code ret_code = LTTNG_OK;
@@ -3874,9 +3851,9 @@ enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
 
        /* Reserve space for command reply header. */
        reply_command_header_offset = reply_payload->buffer.size;
-       buffer_resize_ret = lttng_dynamic_buffer_set_size(&reply_payload->buffer,
-                       reply_command_header_offset +
-                                       sizeof(struct lttcomm_list_command_header));
+       buffer_resize_ret = lttng_dynamic_buffer_set_size(
+               &reply_payload->buffer,
+               reply_command_header_offset + sizeof(struct lttcomm_list_command_header));
        if (buffer_resize_ret) {
                ret_code = LTTNG_ERR_NOMEM;
                goto end;
@@ -3885,17 +3862,19 @@ enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
                if (session->kernel_session != NULL) {
-                       ret_code = list_lttng_kernel_events(channel_name,
-                                       session->kernel_session, reply_payload, &nb_events);
+                       ret_code = list_lttng_kernel_events(
+                               channel_name, session->kernel_session, reply_payload, &nb_events);
                }
 
                break;
        case LTTNG_DOMAIN_UST:
        {
                if (session->ust_session != NULL) {
-                       ret_code = list_lttng_ust_global_events(channel_name,
-                                       &session->ust_session->domain_global,
-                                       reply_payload, &nb_events);
+                       ret_code =
+                               list_lttng_ust_global_events(channel_name,
+                                                            &session->ust_session->domain_global,
+                                                            reply_payload,
+                                                            &nb_events);
                }
 
                break;
@@ -3908,11 +3887,11 @@ enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
                        struct agent *agt;
 
                        rcu_read_lock();
-                       cds_lfht_for_each_entry(session->ust_session->agents->ht,
-                                       &iter.iter, agt, node.node) {
+                       cds_lfht_for_each_entry (
+                               session->ust_session->agents->ht, &iter.iter, agt, node.node) {
                                if (agt->domain == domain) {
                                        ret_code = list_lttng_agent_events(
-                                                       agt, reply_payload, &nb_events);
+                                               agt, reply_payload, &nb_events);
                                        break;
                                }
                        }
@@ -3932,8 +3911,9 @@ enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
 
        /* Update command reply header. */
        reply_command_header.count = (uint32_t) nb_events;
-       memcpy(reply_payload->buffer.data + reply_command_header_offset, &reply_command_header,
-                       sizeof(reply_command_header));
+       memcpy(reply_payload->buffer.data + reply_command_header_offset,
+              &reply_command_header,
+              sizeof(reply_command_header));
 
 end:
        return ret_code;
@@ -3947,30 +3927,29 @@ end:
  * session_lock_list() and session_unlock_list().
  */
 void cmd_list_lttng_sessions(struct lttng_session *sessions,
-               size_t session_count, uid_t uid, gid_t gid)
+                            size_t session_count,
+                            uid_t uid,
+                            gid_t gid)
 {
        int ret;
        unsigned int i = 0;
        struct ltt_session *session;
        struct ltt_session_list *list = session_get_list();
-       struct lttng_session_extended *extended =
-                       (typeof(extended)) (&sessions[session_count]);
+       struct lttng_session_extended *extended = (typeof(extended)) (&sessions[session_count]);
 
-       DBG("Getting all available session for UID %d GID %d",
-                       uid, gid);
+       DBG("Getting all available session for UID %d GID %d", uid, gid);
        /*
         * Iterate over session list and append data after the control struct in
         * the buffer.
         */
-       cds_list_for_each_entry(session, &list->head, list) {
+       cds_list_for_each_entry (session, &list->head, list) {
                if (!session_get(session)) {
                        continue;
                }
                /*
                 * Only list the sessions the user can control.
                 */
-               if (!session_access_ok(session, uid) ||
-                               session->destroyed) {
+               if (!session_access_ok(session, uid) || session->destroyed) {
                        session_put(session);
                        continue;
                }
@@ -3979,13 +3958,15 @@ void cmd_list_lttng_sessions(struct lttng_session *sessions,
                struct ltt_ust_session *usess = session->ust_session;
 
                if (session->consumer->type == CONSUMER_DST_NET ||
-                               (ksess && ksess->consumer->type == CONSUMER_DST_NET) ||
-                               (usess && usess->consumer->type == CONSUMER_DST_NET)) {
-                       ret = build_network_session_path(sessions[i].path,
-                                       sizeof(sessions[i].path), session);
+                   (ksess && ksess->consumer->type == CONSUMER_DST_NET) ||
+                   (usess && usess->consumer->type == CONSUMER_DST_NET)) {
+                       ret = build_network_session_path(
+                               sessions[i].path, sizeof(sessions[i].path), session);
                } else {
-                       ret = snprintf(sessions[i].path, sizeof(sessions[i].path), "%s",
-                                       session->consumer->dst.session_root_path);
+                       ret = snprintf(sessions[i].path,
+                                      sizeof(sessions[i].path),
+                                      "%s",
+                                      session->consumer->dst.session_root_path);
                }
                if (ret < 0) {
                        PERROR("snprintf session path");
@@ -4076,7 +4057,8 @@ error:
  * Return LTTNG_OK on success or else a LTTNG_ERR code.
  */
 int cmd_snapshot_add_output(struct ltt_session *session,
-               const struct lttng_snapshot_output *output, uint32_t *id)
+                           const struct lttng_snapshot_output *output,
+                           uint32_t *id)
 {
        int ret;
        struct snapshot_output *new_output;
@@ -4111,9 +4093,14 @@ int cmd_snapshot_add_output(struct ltt_session *session,
                goto error;
        }
 
-       ret = snapshot_output_init(session, output->max_size, output->name,
-                       output->ctrl_url, output->data_url, session->consumer, new_output,
-                       &session->snapshot);
+       ret = snapshot_output_init(session,
+                                  output->max_size,
+                                  output->name,
+                                  output->ctrl_url,
+                                  output->data_url,
+                                  session->consumer,
+                                  new_output,
+                                  &session->snapshot);
        if (ret < 0) {
                if (ret == -ENOMEM) {
                        ret = LTTNG_ERR_NOMEM;
@@ -4143,8 +4130,7 @@ error:
  *
  * Return LTTNG_OK on success or else a LTTNG_ERR code.
  */
-int cmd_snapshot_del_output(struct ltt_session *session,
-               const struct lttng_snapshot_output *output)
+int cmd_snapshot_del_output(struct ltt_session *session, const struct lttng_snapshot_output *output)
 {
        int ret;
        struct snapshot_output *sout = NULL;
@@ -4164,12 +4150,12 @@ int cmd_snapshot_del_output(struct ltt_session *session,
        }
 
        if (output->id) {
-               DBG("Cmd snapshot del output id %" PRIu32 " for session %s", output->id,
-                               session->name);
+               DBG("Cmd snapshot del output id %" PRIu32 " for session %s",
+                   output->id,
+                   session->name);
                sout = snapshot_find_output_by_id(output->id, &session->snapshot);
        } else if (*output->name != '\0') {
-               DBG("Cmd snapshot del output name %s for session %s", output->name,
-                               session->name);
+               DBG("Cmd snapshot del output name %s for session %s", output->name, session->name);
                sout = snapshot_find_output_by_name(output->name, &session->snapshot);
        }
        if (!sout) {
@@ -4194,7 +4180,7 @@ error:
  * Return the size of the newly allocated outputs or a negative LTTNG_ERR code.
  */
 ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
-               struct lttng_snapshot_output **outputs)
+                                 struct lttng_snapshot_output **outputs)
 {
        int ret, idx = 0;
        struct lttng_snapshot_output *list = NULL;
@@ -4228,27 +4214,26 @@ ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
 
        /* Copy list from session to the new list object. */
        rcu_read_lock();
-       cds_lfht_for_each_entry(session->snapshot.output_ht->ht, &iter.iter,
-                       output, node.node) {
+       cds_lfht_for_each_entry (session->snapshot.output_ht->ht, &iter.iter, output, node.node) {
                LTTNG_ASSERT(output->consumer);
                list[idx].id = output->id;
                list[idx].max_size = output->max_size;
-               if (lttng_strncpy(list[idx].name, output->name,
-                               sizeof(list[idx].name))) {
+               if (lttng_strncpy(list[idx].name, output->name, sizeof(list[idx].name))) {
                        ret = -LTTNG_ERR_INVALID;
                        goto error;
                }
                if (output->consumer->type == CONSUMER_DST_LOCAL) {
                        if (lttng_strncpy(list[idx].ctrl_url,
-                                       output->consumer->dst.session_root_path,
-                                       sizeof(list[idx].ctrl_url))) {
+                                         output->consumer->dst.session_root_path,
+                                         sizeof(list[idx].ctrl_url))) {
                                ret = -LTTNG_ERR_INVALID;
                                goto error;
                        }
                } else {
                        /* Control URI. */
                        ret = uri_to_str_url(&output->consumer->dst.net.control,
-                                       list[idx].ctrl_url, sizeof(list[idx].ctrl_url));
+                                            list[idx].ctrl_url,
+                                            sizeof(list[idx].ctrl_url));
                        if (ret < 0) {
                                ret = -LTTNG_ERR_NOMEM;
                                goto error;
@@ -4256,7 +4241,8 @@ ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
 
                        /* Data URI. */
                        ret = uri_to_str_url(&output->consumer->dst.net.data,
-                                       list[idx].data_url, sizeof(list[idx].data_url));
+                                            list[idx].data_url,
+                                            sizeof(list[idx].data_url));
                        if (ret < 0) {
                                ret = -LTTNG_ERR_NOMEM;
                                goto error;
@@ -4281,8 +4267,7 @@ end:
  *
  * Return 0 if the metadata can be generated, a LTTNG_ERR code otherwise.
  */
-static
-int check_regenerate_metadata_support(struct ltt_session *session)
+static int check_regenerate_metadata_support(struct ltt_session *session)
 {
        int ret;
 
@@ -4310,7 +4295,7 @@ int check_regenerate_metadata_support(struct ltt_session *session)
                }
        }
        if (session->consumer->type == CONSUMER_DST_NET &&
-                       session->consumer->relay_minor_version < 8) {
+           session->consumer->relay_minor_version < 8) {
                ret = LTTNG_ERR_RELAYD_VERSION_FAIL;
                goto end;
        }
@@ -4341,8 +4326,7 @@ int cmd_regenerate_metadata(struct ltt_session *session)
        }
 
        if (session->kernel_session) {
-               ret = kernctl_session_regenerate_metadata(
-                               session->kernel_session->fd);
+               ret = kernctl_session_regenerate_metadata(session->kernel_session->fd);
                if (ret < 0) {
                        ERR("Failed to regenerate the kernel metadata");
                        goto end;
@@ -4382,8 +4366,7 @@ int cmd_regenerate_statedump(struct ltt_session *session)
        }
 
        if (session->kernel_session) {
-               ret = kernctl_session_regenerate_statedump(
-                               session->kernel_session->fd);
+               ret = kernctl_session_regenerate_statedump(session->kernel_session->fd);
                /*
                 * Currently, the statedump in kernel can only fail if out
                 * of memory.
@@ -4417,31 +4400,28 @@ end:
        return ret;
 }
 
-static
-enum lttng_error_code synchronize_tracer_notifier_register(
-               struct notification_thread_handle *notification_thread,
-               struct lttng_trigger *trigger, const struct lttng_credentials *cmd_creds)
+static enum lttng_error_code
+synchronize_tracer_notifier_register(struct notification_thread_handle *notification_thread,
+                                    struct lttng_trigger *trigger,
+                                    const struct lttng_credentials *cmd_creds)
 {
        enum lttng_error_code ret_code;
-       const struct lttng_condition *condition =
-                       lttng_trigger_get_const_condition(trigger);
+       const struct lttng_condition *condition = lttng_trigger_get_const_condition(trigger);
        const char *trigger_name;
        uid_t trigger_owner;
        enum lttng_trigger_status trigger_status;
        const enum lttng_domain_type trigger_domain =
-                       lttng_trigger_get_underlying_domain_type_restriction(
-                                       trigger);
+               lttng_trigger_get_underlying_domain_type_restriction(trigger);
 
        trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_owner);
        LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
        LTTNG_ASSERT(condition);
        LTTNG_ASSERT(lttng_condition_get_type(condition) ==
-                       LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
+                    LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
 
        trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
-       trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ?
-                       trigger_name : "(anonymous)";
+       trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ? trigger_name : "(anonymous)";
 
        session_lock_list();
        switch (trigger_domain) {
@@ -4452,15 +4432,15 @@ enum lttng_error_code synchronize_tracer_notifier_register(
                        enum lttng_error_code notif_thread_unregister_ret;
 
                        notif_thread_unregister_ret =
-                                       notification_thread_command_unregister_trigger(
-                                               notification_thread, trigger);
+                               notification_thread_command_unregister_trigger(notification_thread,
+                                                                              trigger);
 
                        if (notif_thread_unregister_ret != LTTNG_OK) {
                                /* Return the original error code. */
                                ERR("Failed to unregister trigger from notification thread during error recovery: trigger name = '%s', trigger owner uid = %d, error code = %d",
-                                               trigger_name,
-                                               (int) trigger_owner,
-                                               ret_code);
+                                   trigger_name,
+                                   (int) trigger_owner,
+                                   ret_code);
                        }
                }
                break;
@@ -4473,8 +4453,7 @@ enum lttng_error_code synchronize_tracer_notifier_register(
        case LTTNG_DOMAIN_PYTHON:
        {
                /* Agent domains. */
-               struct agent *agt = agent_find_by_event_notifier_domain(
-                               trigger_domain);
+               struct agent *agt = agent_find_by_event_notifier_domain(trigger_domain);
 
                if (!agt) {
                        agt = agent_create(trigger_domain);
@@ -4505,10 +4484,10 @@ end_unlock_session_list:
 }
 
 enum lttng_error_code cmd_register_trigger(const struct lttng_credentials *cmd_creds,
-               struct lttng_trigger *trigger,
-               bool is_trigger_anonymous,
-               struct notification_thread_handle *notification_thread,
-               struct lttng_trigger **return_trigger)
+                                          struct lttng_trigger *trigger,
+                                          bool is_trigger_anonymous,
+                                          struct notification_thread_handle *notification_thread,
+                                          struct lttng_trigger **return_trigger)
 {
        enum lttng_error_code ret_code;
        const char *trigger_name;
@@ -4516,29 +4495,27 @@ enum lttng_error_code cmd_register_trigger(const struct lttng_credentials *cmd_c
        enum lttng_trigger_status trigger_status;
 
        trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
-       trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ?
-                       trigger_name : "(anonymous)";
+       trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ? trigger_name : "(anonymous)";
 
-       trigger_status = lttng_trigger_get_owner_uid(
-               trigger, &trigger_owner);
+       trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_owner);
        LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
        DBG("Running register trigger command: trigger name = '%s', trigger owner uid = %d, command creds uid = %d",
-                       trigger_name, (int) trigger_owner,
-                       (int) lttng_credentials_get_uid(cmd_creds));
+           trigger_name,
+           (int) trigger_owner,
+           (int) lttng_credentials_get_uid(cmd_creds));
 
        /*
         * Validate the trigger credentials against the command credentials.
         * Only the root user can register a trigger with non-matching
         * credentials.
         */
-       if (!lttng_credentials_is_equal_uid(
-                       lttng_trigger_get_credentials(trigger),
-                       cmd_creds)) {
+       if (!lttng_credentials_is_equal_uid(lttng_trigger_get_credentials(trigger), cmd_creds)) {
                if (lttng_credentials_get_uid(cmd_creds) != 0) {
                        ERR("Trigger credentials do not match the command credentials: trigger name = '%s', trigger owner uid = %d, command creds uid = %d",
-                                       trigger_name, (int) trigger_owner,
-                                       (int) lttng_credentials_get_uid(cmd_creds));
+                           trigger_name,
+                           (int) trigger_owner,
+                           (int) lttng_credentials_get_uid(cmd_creds));
                        ret_code = LTTNG_ERR_INVALID_TRIGGER;
                        goto end;
                }
@@ -4551,7 +4528,9 @@ enum lttng_error_code cmd_register_trigger(const struct lttng_credentials *cmd_c
        ret_code = lttng_trigger_generate_bytecode(trigger, cmd_creds);
        if (ret_code != LTTNG_OK) {
                ERR("Failed to generate bytecode of trigger: trigger name = '%s', trigger owner uid = %d, error code = %d",
-                               trigger_name, (int) trigger_owner, ret_code);
+                   trigger_name,
+                   (int) trigger_owner,
+                   ret_code);
                goto end;
        }
 
@@ -4566,26 +4545,26 @@ enum lttng_error_code cmd_register_trigger(const struct lttng_credentials *cmd_c
         * immutable.
         */
        ret_code = notification_thread_command_register_trigger(
-                       notification_thread, trigger, is_trigger_anonymous);
+               notification_thread, trigger, is_trigger_anonymous);
        if (ret_code != LTTNG_OK) {
                DBG("Failed to register trigger to notification thread: trigger name = '%s', trigger owner uid = %d, error code = %d",
-                               trigger_name, (int) trigger_owner, ret_code);
+                   trigger_name,
+                   (int) trigger_owner,
+                   ret_code);
                goto end;
        }
 
        trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
-       trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ?
-                       trigger_name : "(anonymous)";
+       trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ? trigger_name : "(anonymous)";
 
        /*
         * Synchronize tracers if the trigger adds an event notifier.
         */
        if (lttng_trigger_needs_tracer_notifier(trigger)) {
-               ret_code = synchronize_tracer_notifier_register(notification_thread,
-                               trigger, cmd_creds);
+               ret_code = synchronize_tracer_notifier_register(
+                       notification_thread, trigger, cmd_creds);
                if (ret_code != LTTNG_OK) {
-                       ERR("Error registering tracer notifier: %s",
-                                       lttng_strerror(-ret_code));
+                       ERR("Error registering tracer notifier: %s", lttng_strerror(-ret_code));
                        goto end;
                }
        }
@@ -4607,20 +4586,17 @@ end:
        return ret_code;
 }
 
-static
-enum lttng_error_code synchronize_tracer_notifier_unregister(
-               const struct lttng_trigger *trigger)
+static enum lttng_error_code
+synchronize_tracer_notifier_unregister(const struct lttng_trigger *trigger)
 {
        enum lttng_error_code ret_code;
-       const struct lttng_condition *condition =
-                       lttng_trigger_get_const_condition(trigger);
+       const struct lttng_condition *condition = lttng_trigger_get_const_condition(trigger);
        const enum lttng_domain_type trigger_domain =
-                       lttng_trigger_get_underlying_domain_type_restriction(
-                                       trigger);
+               lttng_trigger_get_underlying_domain_type_restriction(trigger);
 
        LTTNG_ASSERT(condition);
        LTTNG_ASSERT(lttng_condition_get_type(condition) ==
-                       LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
+                    LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
 
        session_lock_list();
        switch (trigger_domain) {
@@ -4639,8 +4615,7 @@ enum lttng_error_code synchronize_tracer_notifier_unregister(
        case LTTNG_DOMAIN_PYTHON:
        {
                /* Agent domains. */
-               struct agent *agt = agent_find_by_event_notifier_domain(
-                               trigger_domain);
+               struct agent *agt = agent_find_by_event_notifier_domain(trigger_domain);
 
                /*
                 * This trigger was never registered in the first place. Calling
@@ -4667,8 +4642,8 @@ end_unlock_session_list:
 }
 
 enum lttng_error_code cmd_unregister_trigger(const struct lttng_credentials *cmd_creds,
-               const struct lttng_trigger *trigger,
-               struct notification_thread_handle *notification_thread)
+                                            const struct lttng_trigger *trigger,
+                                            struct notification_thread_handle *notification_thread)
 {
        enum lttng_error_code ret_code;
        const char *trigger_name;
@@ -4682,21 +4657,21 @@ enum lttng_error_code cmd_unregister_trigger(const struct lttng_credentials *cmd
        LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
        DBG("Running unregister trigger command: trigger name = '%s', trigger owner uid = %d, command creds uid = %d",
-                       trigger_name, (int) trigger_owner,
-                       (int) lttng_credentials_get_uid(cmd_creds));
+           trigger_name,
+           (int) trigger_owner,
+           (int) lttng_credentials_get_uid(cmd_creds));
 
        /*
         * Validate the trigger credentials against the command credentials.
         * Only the root user can unregister a trigger with non-matching
         * credentials.
         */
-       if (!lttng_credentials_is_equal_uid(
-                       lttng_trigger_get_credentials(trigger),
-                       cmd_creds)) {
+       if (!lttng_credentials_is_equal_uid(lttng_trigger_get_credentials(trigger), cmd_creds)) {
                if (lttng_credentials_get_uid(cmd_creds) != 0) {
                        ERR("Trigger credentials do not match the command credentials: trigger name = '%s', trigger owner uid = %d, command creds uid = %d",
-                                       trigger_name, (int) trigger_owner,
-                                       (int) lttng_credentials_get_uid(cmd_creds));
+                           trigger_name,
+                           (int) trigger_owner,
+                           (int) lttng_credentials_get_uid(cmd_creds));
                        ret_code = LTTNG_ERR_INVALID_TRIGGER;
                        goto end;
                }
@@ -4704,10 +4679,12 @@ enum lttng_error_code cmd_unregister_trigger(const struct lttng_credentials *cmd
 
        /* Fetch the sessiond side trigger object. */
        ret_code = notification_thread_command_get_trigger(
-                       notification_thread, trigger, &sessiond_trigger);
+               notification_thread, trigger, &sessiond_trigger);
        if (ret_code != LTTNG_OK) {
                DBG("Failed to get trigger from notification thread during unregister: trigger name = '%s', trigger owner uid = %d, error code = %d",
-                               trigger_name, (int) trigger_owner, ret_code);
+                   trigger_name,
+                   (int) trigger_owner,
+                   ret_code);
                goto end;
        }
 
@@ -4724,11 +4701,12 @@ enum lttng_error_code cmd_unregister_trigger(const struct lttng_credentials *cmd
         */
        lttng_trigger_set_as_unregistered(sessiond_trigger);
 
-       ret_code = notification_thread_command_unregister_trigger(notification_thread,
-                                                                 trigger);
+       ret_code = notification_thread_command_unregister_trigger(notification_thread, trigger);
        if (ret_code != LTTNG_OK) {
                DBG("Failed to unregister trigger from notification thread: trigger name = '%s', trigger owner uid = %d, error code = %d",
-                               trigger_name, (int) trigger_owner, ret_code);
+                   trigger_name,
+                   (int) trigger_owner,
+                   ret_code);
                goto end;
        }
 
@@ -4744,7 +4722,6 @@ enum lttng_error_code cmd_unregister_trigger(const struct lttng_credentials *cmd
                        ERR("Error unregistering trigger to tracer.");
                        goto end;
                }
-
        }
 
 end:
@@ -4753,8 +4730,8 @@ end:
 }
 
 enum lttng_error_code cmd_list_triggers(struct command_ctx *cmd_ctx,
-               struct notification_thread_handle *notification_thread,
-               struct lttng_triggers **return_triggers)
+                                       struct notification_thread_handle *notification_thread,
+                                       struct lttng_triggers **return_triggers)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -4762,7 +4739,7 @@ enum lttng_error_code cmd_list_triggers(struct command_ctx *cmd_ctx,
 
        /* Get the set of triggers from the notification thread. */
        ret_code = notification_thread_command_list_triggers(
-                       notification_thread, cmd_ctx->creds.uid, &triggers);
+               notification_thread, cmd_ctx->creds.uid, &triggers);
        if (ret_code != LTTNG_OK) {
                goto end;
        }
@@ -4781,10 +4758,11 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cmd_creds,
-               const struct lttng_error_query *query,
-               struct lttng_error_query_results **_results,
-               struct notification_thread_handle *notification_thread)
+enum lttng_error_code
+cmd_execute_error_query(const struct lttng_credentials *cmd_creds,
+                       const struct lttng_error_query *query,
+                       struct lttng_error_query_results **_results,
+                       struct notification_thread_handle *notification_thread)
 {
        enum lttng_error_code ret_code;
        const struct lttng_trigger *query_target_trigger;
@@ -4800,12 +4778,10 @@ enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cm
                query_target_trigger = lttng_error_query_trigger_borrow_target(query);
                break;
        case LTTNG_ERROR_QUERY_TARGET_TYPE_CONDITION:
-               query_target_trigger =
-                               lttng_error_query_condition_borrow_target(query);
+               query_target_trigger = lttng_error_query_condition_borrow_target(query);
                break;
        case LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION:
-               query_target_trigger = lttng_error_query_action_borrow_trigger_target(
-                               query);
+               query_target_trigger = lttng_error_query_action_borrow_trigger_target(query);
                break;
        default:
                abort();
@@ -4813,8 +4789,8 @@ enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cm
 
        LTTNG_ASSERT(query_target_trigger);
 
-       ret_code = notification_thread_command_get_trigger(notification_thread,
-                       query_target_trigger, &matching_trigger);
+       ret_code = notification_thread_command_get_trigger(
+               notification_thread, query_target_trigger, &matching_trigger);
        if (ret_code != LTTNG_OK) {
                goto end;
        }
@@ -4822,19 +4798,15 @@ enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cm
        /* No longer needed. */
        query_target_trigger = NULL;
 
-       if (lttng_error_query_get_target_type(query) ==
-                       LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION) {
+       if (lttng_error_query_get_target_type(query) == LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION) {
                /* Get the sessiond-side version of the target action. */
                query_target_action =
-                               lttng_error_query_action_borrow_action_target(
-                                               query, matching_trigger);
+                       lttng_error_query_action_borrow_action_target(query, matching_trigger);
        }
 
        trigger_status = lttng_trigger_get_name(matching_trigger, &trigger_name);
-       trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ?
-                       trigger_name : "(anonymous)";
-       trigger_status = lttng_trigger_get_owner_uid(matching_trigger,
-                       &trigger_owner);
+       trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ? trigger_name : "(anonymous)";
+       trigger_status = lttng_trigger_get_owner_uid(matching_trigger, &trigger_owner);
        LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
        results = lttng_error_query_results_create();
@@ -4844,21 +4816,22 @@ enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cm
        }
 
        DBG("Running \"execute error query\" command: trigger name = '%s', trigger owner uid = %d, command creds uid = %d",
-                       trigger_name, (int) trigger_owner,
-                       (int) lttng_credentials_get_uid(cmd_creds));
+           trigger_name,
+           (int) trigger_owner,
+           (int) lttng_credentials_get_uid(cmd_creds));
 
        /*
         * Validate the trigger credentials against the command credentials.
         * Only the root user can target a trigger with non-matching
         * credentials.
         */
-       if (!lttng_credentials_is_equal_uid(
-                       lttng_trigger_get_credentials(matching_trigger),
-                       cmd_creds)) {
+       if (!lttng_credentials_is_equal_uid(lttng_trigger_get_credentials(matching_trigger),
+                                           cmd_creds)) {
                if (lttng_credentials_get_uid(cmd_creds) != 0) {
                        ERR("Trigger credentials do not match the command credentials: trigger name = '%s', trigger owner uid = %d, command creds uid = %d",
-                                       trigger_name, (int) trigger_owner,
-                                       (int) lttng_credentials_get_uid(cmd_creds));
+                           trigger_name,
+                           (int) trigger_owner,
+                           (int) lttng_credentials_get_uid(cmd_creds));
                        ret_code = LTTNG_ERR_INVALID_TRIGGER;
                        goto end;
                }
@@ -4866,8 +4839,7 @@ enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cm
 
        switch (lttng_error_query_get_target_type(query)) {
        case LTTNG_ERROR_QUERY_TARGET_TYPE_TRIGGER:
-               trigger_status = lttng_trigger_add_error_results(
-                               matching_trigger, results);
+               trigger_status = lttng_trigger_add_error_results(matching_trigger, results);
 
                switch (trigger_status) {
                case LTTNG_TRIGGER_STATUS_OK:
@@ -4880,8 +4852,8 @@ enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cm
                break;
        case LTTNG_ERROR_QUERY_TARGET_TYPE_CONDITION:
        {
-               trigger_status = lttng_trigger_condition_add_error_results(
-                               matching_trigger, results);
+               trigger_status =
+                       lttng_trigger_condition_add_error_results(matching_trigger, results);
 
                switch (trigger_status) {
                case LTTNG_TRIGGER_STATUS_OK:
@@ -4896,8 +4868,7 @@ enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cm
        case LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION:
        {
                const enum lttng_action_status action_status =
-                               lttng_action_add_error_query_results(
-                                               query_target_action, results);
+                       lttng_action_add_error_query_results(query_target_action, results);
 
                switch (action_status) {
                case LTTNG_ACTION_STATUS_OK:
@@ -4929,9 +4900,8 @@ end:
  *
  * Return LTTNG_OK on success or a LTTNG_ERR code.
  */
-static enum lttng_error_code set_relayd_for_snapshot(
-               struct consumer_output *output,
-               const struct ltt_session *session)
+static enum lttng_error_code set_relayd_for_snapshot(struct consumer_output *output,
+                                                    const struct ltt_session *session)
 {
        enum lttng_error_code status = LTTNG_OK;
        struct lttng_ht_iter iter;
@@ -4945,10 +4915,8 @@ static enum lttng_error_code set_relayd_for_snapshot(
        DBG2("Set relayd object from snapshot output");
 
        if (session->current_trace_chunk) {
-               enum lttng_trace_chunk_status chunk_status =
-                               lttng_trace_chunk_get_id(
-                                               session->current_trace_chunk,
-                                               &current_chunk_id.value);
+               enum lttng_trace_chunk_status chunk_status = lttng_trace_chunk_get_id(
+                       session->current_trace_chunk, &current_chunk_id.value);
 
                if (chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK) {
                        current_chunk_id.is_set = true;
@@ -4979,17 +4947,19 @@ static enum lttng_error_code set_relayd_for_snapshot(
         * snapshot output.
         */
        rcu_read_lock();
-       cds_lfht_for_each_entry(output->socks->ht, &iter.iter,
-                       socket, node.node) {
+       cds_lfht_for_each_entry (output->socks->ht, &iter.iter, socket, node.node) {
                pthread_mutex_lock(socket->lock);
-               status = send_consumer_relayd_sockets(session->id,
-                               output, socket,
-                               session->name, session->hostname,
-                               base_path,
-                               session->live_timer,
-                               current_chunk_id.is_set ? &current_chunk_id.value : NULL,
-                               session->creation_time,
-                               session->name_contains_creation_time);
+               status = send_consumer_relayd_sockets(
+                       session->id,
+                       output,
+                       socket,
+                       session->name,
+                       session->hostname,
+                       base_path,
+                       session->live_timer,
+                       current_chunk_id.is_set ? &current_chunk_id.value : NULL,
+                       session->creation_time,
+                       session->name_contains_creation_time);
                pthread_mutex_unlock(socket->lock);
                if (status != LTTNG_OK) {
                        rcu_read_unlock();
@@ -5007,11 +4977,10 @@ error:
  *
  * Return LTTNG_OK on success or a LTTNG_ERR code.
  */
-static enum lttng_error_code record_kernel_snapshot(
-               struct ltt_kernel_session *ksess,
-               const struct consumer_output *output,
-               const struct ltt_session *session,
-               uint64_t nb_packets_per_stream)
+static enum lttng_error_code record_kernel_snapshot(struct ltt_kernel_session *ksess,
+                                                   const struct consumer_output *output,
+                                                   const struct ltt_session *session,
+                                                   uint64_t nb_packets_per_stream)
 {
        enum lttng_error_code status;
 
@@ -5019,8 +4988,7 @@ static enum lttng_error_code record_kernel_snapshot(
        LTTNG_ASSERT(output);
        LTTNG_ASSERT(session);
 
-       status = kernel_snapshot_record(
-                       ksess, output, nb_packets_per_stream);
+       status = kernel_snapshot_record(ksess, output, nb_packets_per_stream);
        return status;
 }
 
@@ -5030,9 +4998,9 @@ static enum lttng_error_code record_kernel_snapshot(
  * Returns LTTNG_OK on success or a LTTNG_ERR error code.
  */
 static enum lttng_error_code record_ust_snapshot(struct ltt_ust_session *usess,
-               const struct consumer_output *output,
-               const struct ltt_session *session,
-               uint64_t nb_packets_per_stream)
+                                                const struct consumer_output *output,
+                                                const struct ltt_session *session,
+                                                uint64_t nb_packets_per_stream)
 {
        enum lttng_error_code status;
 
@@ -5040,23 +5008,20 @@ static enum lttng_error_code record_ust_snapshot(struct ltt_ust_session *usess,
        LTTNG_ASSERT(output);
        LTTNG_ASSERT(session);
 
-       status = ust_app_snapshot_record(
-                       usess, output, nb_packets_per_stream);
+       status = ust_app_snapshot_record(usess, output, nb_packets_per_stream);
        return status;
 }
 
-static
-uint64_t get_session_size_one_more_packet_per_stream(
-               const struct ltt_session *session, uint64_t cur_nr_packets)
+static uint64_t get_session_size_one_more_packet_per_stream(const struct ltt_session *session,
+                                                           uint64_t cur_nr_packets)
 {
        uint64_t tot_size = 0;
 
        if (session->kernel_session) {
                struct ltt_kernel_channel *chan;
-               const struct ltt_kernel_session *ksess =
-                               session->kernel_session;
+               const struct ltt_kernel_session *ksess = session->kernel_session;
 
-               cds_list_for_each_entry(chan, &ksess->channel_list.head, list) {
+               cds_list_for_each_entry (chan, &ksess->channel_list.head, list) {
                        if (cur_nr_packets >= chan->channel->attr.num_subbuf) {
                                /*
                                 * Don't take channel into account if we
@@ -5064,16 +5029,14 @@ uint64_t get_session_size_one_more_packet_per_stream(
                                 */
                                continue;
                        }
-                       tot_size += chan->channel->attr.subbuf_size
-                               * chan->stream_count;
+                       tot_size += chan->channel->attr.subbuf_size * chan->stream_count;
                }
        }
 
        if (session->ust_session) {
                const struct ltt_ust_session *usess = session->ust_session;
 
-               tot_size += ust_app_get_size_one_more_packet_per_stream(usess,
-                               cur_nr_packets);
+               tot_size += ust_app_get_size_one_more_packet_per_stream(usess, cur_nr_packets);
        }
 
        return tot_size;
@@ -5099,23 +5062,22 @@ uint64_t get_session_size_one_more_packet_per_stream(
  * an approximation: for instance, applications could appear/disappear
  * in between this call and actually grabbing data.
  */
-static
-int64_t get_session_nb_packets_per_stream(const struct ltt_session *session,
-               uint64_t max_size)
+static int64_t get_session_nb_packets_per_stream(const struct ltt_session *session,
+                                                uint64_t max_size)
 {
        int64_t size_left;
        uint64_t cur_nb_packets = 0;
 
        if (!max_size) {
-               return 0;       /* Infinite */
+               return 0; /* Infinite */
        }
 
        size_left = max_size;
        for (;;) {
                uint64_t one_more_packet_tot_size;
 
-               one_more_packet_tot_size = get_session_size_one_more_packet_per_stream(
-                               session, cur_nb_packets);
+               one_more_packet_tot_size =
+                       get_session_size_one_more_packet_per_stream(session, cur_nb_packets);
                if (!one_more_packet_tot_size) {
                        /* We are already grabbing all packets. */
                        break;
@@ -5133,9 +5095,8 @@ int64_t get_session_nb_packets_per_stream(const struct ltt_session *session,
        return cur_nb_packets;
 }
 
-static
-enum lttng_error_code snapshot_record(struct ltt_session *session,
-               const struct snapshot_output *snapshot_output)
+static enum lttng_error_code snapshot_record(struct ltt_session *session,
+                                            const struct snapshot_output *snapshot_output)
 {
        int64_t nb_packets_per_stream;
        char snapshot_chunk_name[LTTNG_NAME_MAX];
@@ -5147,19 +5108,21 @@ enum lttng_error_code snapshot_record(struct ltt_session *session,
        struct consumer_output *snapshot_ust_consumer_output = NULL;
        struct consumer_output *snapshot_kernel_consumer_output = NULL;
 
-       ret = snprintf(snapshot_chunk_name, sizeof(snapshot_chunk_name),
-                       "%s-%s-%" PRIu64,
-                       snapshot_output->name,
-                       snapshot_output->datetime,
-                       snapshot_output->nb_snapshot);
+       ret = snprintf(snapshot_chunk_name,
+                      sizeof(snapshot_chunk_name),
+                      "%s-%s-%" PRIu64,
+                      snapshot_output->name,
+                      snapshot_output->datetime,
+                      snapshot_output->nb_snapshot);
        if (ret < 0 || ret >= sizeof(snapshot_chunk_name)) {
                ERR("Failed to format snapshot name");
                ret_code = LTTNG_ERR_INVALID;
                goto error;
        }
        DBG("Recording snapshot \"%s\" for session \"%s\" with chunk name \"%s\"",
-                       snapshot_output->name, session->name,
-                       snapshot_chunk_name);
+           snapshot_output->name,
+           session->name,
+           snapshot_chunk_name);
        if (!session->kernel_session && !session->ust_session) {
                ERR("Failed to record snapshot as no channels exist");
                ret_code = LTTNG_ERR_NO_CHANNEL;
@@ -5167,70 +5130,60 @@ enum lttng_error_code snapshot_record(struct ltt_session *session,
        }
 
        if (session->kernel_session) {
-               original_kernel_consumer_output =
-                               session->kernel_session->consumer;
-               snapshot_kernel_consumer_output =
-                               consumer_copy_output(snapshot_output->consumer);
-               strcpy(snapshot_kernel_consumer_output->chunk_path,
-                       snapshot_chunk_name);
+               original_kernel_consumer_output = session->kernel_session->consumer;
+               snapshot_kernel_consumer_output = consumer_copy_output(snapshot_output->consumer);
+               strcpy(snapshot_kernel_consumer_output->chunk_path, snapshot_chunk_name);
 
                /* Copy the original domain subdir. */
                strcpy(snapshot_kernel_consumer_output->domain_subdir,
-                               original_kernel_consumer_output->domain_subdir);
+                      original_kernel_consumer_output->domain_subdir);
 
                ret = consumer_copy_sockets(snapshot_kernel_consumer_output,
-                               original_kernel_consumer_output);
+                                           original_kernel_consumer_output);
                if (ret < 0) {
                        ERR("Failed to copy consumer sockets from snapshot output configuration");
                        ret_code = LTTNG_ERR_NOMEM;
                        goto error;
                }
-               ret_code = set_relayd_for_snapshot(
-                               snapshot_kernel_consumer_output, session);
+               ret_code = set_relayd_for_snapshot(snapshot_kernel_consumer_output, session);
                if (ret_code != LTTNG_OK) {
                        ERR("Failed to setup relay daemon for kernel tracer snapshot");
                        goto error;
                }
-               session->kernel_session->consumer =
-                               snapshot_kernel_consumer_output;
+               session->kernel_session->consumer = snapshot_kernel_consumer_output;
        }
        if (session->ust_session) {
                original_ust_consumer_output = session->ust_session->consumer;
-               snapshot_ust_consumer_output =
-                               consumer_copy_output(snapshot_output->consumer);
-               strcpy(snapshot_ust_consumer_output->chunk_path,
-                       snapshot_chunk_name);
+               snapshot_ust_consumer_output = consumer_copy_output(snapshot_output->consumer);
+               strcpy(snapshot_ust_consumer_output->chunk_path, snapshot_chunk_name);
 
                /* Copy the original domain subdir. */
                strcpy(snapshot_ust_consumer_output->domain_subdir,
-                               original_ust_consumer_output->domain_subdir);
+                      original_ust_consumer_output->domain_subdir);
 
                ret = consumer_copy_sockets(snapshot_ust_consumer_output,
-                               original_ust_consumer_output);
+                                           original_ust_consumer_output);
                if (ret < 0) {
                        ERR("Failed to copy consumer sockets from snapshot output configuration");
                        ret_code = LTTNG_ERR_NOMEM;
                        goto error;
                }
-               ret_code = set_relayd_for_snapshot(
-                               snapshot_ust_consumer_output, session);
+               ret_code = set_relayd_for_snapshot(snapshot_ust_consumer_output, session);
                if (ret_code != LTTNG_OK) {
                        ERR("Failed to setup relay daemon for userspace tracer snapshot");
                        goto error;
                }
-               session->ust_session->consumer =
-                               snapshot_ust_consumer_output;
+               session->ust_session->consumer = snapshot_ust_consumer_output;
        }
 
-       snapshot_trace_chunk = session_create_new_trace_chunk(session,
-                       snapshot_kernel_consumer_output ?:
-                                       snapshot_ust_consumer_output,
-                       consumer_output_get_base_path(
-                                       snapshot_output->consumer),
-                       snapshot_chunk_name);
+       snapshot_trace_chunk = session_create_new_trace_chunk(
+               session,
+               snapshot_kernel_consumer_output ?: snapshot_ust_consumer_output,
+               consumer_output_get_base_path(snapshot_output->consumer),
+               snapshot_chunk_name);
        if (!snapshot_trace_chunk) {
                ERR("Failed to create temporary trace chunk to record a snapshot of session \"%s\"",
-                               session->name);
+                   session->name);
                ret_code = LTTNG_ERR_CREATE_DIR_FAIL;
                goto error;
        }
@@ -5240,13 +5193,13 @@ enum lttng_error_code snapshot_record(struct ltt_session *session,
        snapshot_trace_chunk = NULL;
        if (ret) {
                ERR("Failed to set temporary trace chunk to record a snapshot of session \"%s\"",
-                               session->name);
+                   session->name);
                ret_code = LTTNG_ERR_CREATE_TRACE_CHUNK_FAIL_CONSUMER;
                goto error;
        }
 
-       nb_packets_per_stream = get_session_nb_packets_per_stream(session,
-                       snapshot_output->max_size);
+       nb_packets_per_stream =
+               get_session_nb_packets_per_stream(session, snapshot_output->max_size);
        if (nb_packets_per_stream < 0) {
                ret_code = LTTNG_ERR_MAX_SIZE_INVALID;
                goto error_close_trace_chunk;
@@ -5254,8 +5207,9 @@ enum lttng_error_code snapshot_record(struct ltt_session *session,
 
        if (session->kernel_session) {
                ret_code = record_kernel_snapshot(session->kernel_session,
-                               snapshot_kernel_consumer_output, session,
-                               nb_packets_per_stream);
+                                                 snapshot_kernel_consumer_output,
+                                                 session,
+                                                 nb_packets_per_stream);
                if (ret_code != LTTNG_OK) {
                        goto error_close_trace_chunk;
                }
@@ -5263,8 +5217,9 @@ enum lttng_error_code snapshot_record(struct ltt_session *session,
 
        if (session->ust_session) {
                ret_code = record_ust_snapshot(session->ust_session,
-                               snapshot_ust_consumer_output, session,
-                               nb_packets_per_stream);
+                                              snapshot_ust_consumer_output,
+                                              session,
+                                              nb_packets_per_stream);
                if (ret_code != LTTNG_OK) {
                        goto error_close_trace_chunk;
                }
@@ -5272,19 +5227,19 @@ enum lttng_error_code snapshot_record(struct ltt_session *session,
 
 error_close_trace_chunk:
        if (session_set_trace_chunk(session, NULL, &snapshot_trace_chunk)) {
-               ERR("Failed to release the current trace chunk of session \"%s\"",
-                               session->name);
+               ERR("Failed to release the current trace chunk of session \"%s\"", session->name);
                ret_code = LTTNG_ERR_UNK;
        }
 
-       if (session_close_trace_chunk(session, snapshot_trace_chunk,
-                       LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION, NULL)) {
+       if (session_close_trace_chunk(session,
+                                     snapshot_trace_chunk,
+                                     LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION,
+                                     NULL)) {
                /*
                 * Don't goto end; make sure the chunk is closed for the session
                 * to allow future snapshots.
                 */
-               ERR("Failed to close snapshot trace chunk of session \"%s\"",
-                               session->name);
+               ERR("Failed to close snapshot trace chunk of session \"%s\"", session->name);
                ret_code = LTTNG_ERR_CLOSE_TRACE_CHUNK_FAIL_CONSUMER;
        }
 
@@ -5295,8 +5250,7 @@ error:
                session->ust_session->consumer = original_ust_consumer_output;
        }
        if (original_kernel_consumer_output) {
-               session->kernel_session->consumer =
-                               original_kernel_consumer_output;
+               session->kernel_session->consumer = original_kernel_consumer_output;
        }
        consumer_output_put(snapshot_ust_consumer_output);
        consumer_output_put(snapshot_kernel_consumer_output);
@@ -5312,8 +5266,8 @@ error:
  * Return LTTNG_OK on success or else a LTTNG_ERR code.
  */
 int cmd_snapshot_record(struct ltt_session *session,
-               const struct lttng_snapshot_output *output,
-               int wait __attribute__((unused)))
+                       const struct lttng_snapshot_output *output,
+                       int wait __attribute__((unused)))
 {
        enum lttng_error_code cmd_ret = LTTNG_OK;
        int ret;
@@ -5327,8 +5281,7 @@ int cmd_snapshot_record(struct ltt_session *session,
        DBG("Cmd snapshot record for session %s", session->name);
 
        /* Get the datetime for the snapshot output directory. */
-       ret = utils_get_current_time_str("%Y%m%d-%H%M%S", datetime,
-                       sizeof(datetime));
+       ret = utils_get_current_time_str("%Y%m%d-%H%M%S", datetime, sizeof(datetime));
        if (!ret) {
                cmd_ret = LTTNG_ERR_INVALID;
                goto error;
@@ -5357,11 +5310,14 @@ int cmd_snapshot_record(struct ltt_session *session,
                        goto error;
                }
 
-               ret = snapshot_output_init(session, output->max_size,
-                               output->name,
-                               output->ctrl_url, output->data_url,
-                               session->consumer,
-                               tmp_output, NULL);
+               ret = snapshot_output_init(session,
+                                          output->max_size,
+                                          output->name,
+                                          output->ctrl_url,
+                                          output->data_url,
+                                          session->consumer,
+                                          tmp_output,
+                                          NULL);
                if (ret < 0) {
                        if (ret == -ENOMEM) {
                                cmd_ret = LTTNG_ERR_NOMEM;
@@ -5385,8 +5341,8 @@ int cmd_snapshot_record(struct ltt_session *session,
                struct lttng_ht_iter iter;
 
                rcu_read_lock();
-               cds_lfht_for_each_entry(session->snapshot.output_ht->ht,
-                               &iter.iter, sout, node.node) {
+               cds_lfht_for_each_entry (
+                       session->snapshot.output_ht->ht, &iter.iter, sout, node.node) {
                        struct snapshot_output output_copy;
 
                        /*
@@ -5401,14 +5357,13 @@ int cmd_snapshot_record(struct ltt_session *session,
                        }
 
                        output_copy.nb_snapshot = session->snapshot.nb_snapshot;
-                       memcpy(output_copy.datetime, datetime,
-                                       sizeof(datetime));
+                       memcpy(output_copy.datetime, datetime, sizeof(datetime));
 
                        /* Use temporary name. */
                        if (*output->name != '\0') {
                                if (lttng_strncpy(output_copy.name,
-                                               output->name,
-                                               sizeof(output_copy.name))) {
+                                                 output->name,
+                                                 sizeof(output_copy.name))) {
                                        cmd_ret = LTTNG_ERR_INVALID;
                                        rcu_read_unlock();
                                        goto error;
@@ -5441,8 +5396,7 @@ error:
 /*
  * Command LTTNG_SET_SESSION_SHM_PATH processed by the client thread.
  */
-int cmd_set_session_shm_path(struct ltt_session *session,
-               const char *shm_path)
+int cmd_set_session_shm_path(struct ltt_session *session, const char *shm_path)
 {
        /* Safety net */
        LTTNG_ASSERT(session);
@@ -5454,8 +5408,7 @@ int cmd_set_session_shm_path(struct ltt_session *session,
                return LTTNG_ERR_SESSION_STARTED;
        }
 
-       strncpy(session->shm_path, shm_path,
-               sizeof(session->shm_path));
+       strncpy(session->shm_path, shm_path, sizeof(session->shm_path));
        session->shm_path[sizeof(session->shm_path) - 1] = '\0';
 
        return LTTNG_OK;
@@ -5470,9 +5423,9 @@ int cmd_set_session_shm_path(struct ltt_session *session,
  * Returns LTTNG_OK on success or else a negative LTTng error code.
  */
 int cmd_rotate_session(struct ltt_session *session,
-               struct lttng_rotate_session_return *rotate_return,
-               bool quiet_rotation,
-               enum lttng_trace_chunk_command_type command)
+                      struct lttng_rotate_session_return *rotate_return,
+                      bool quiet_rotation,
+                      enum lttng_trace_chunk_command_type command)
 {
        int ret;
        uint64_t ongoing_rotation_chunk_id;
@@ -5496,16 +5449,15 @@ int cmd_rotate_session(struct ltt_session *session,
         * destroy.
         * Rotation is not supported for snapshot traces (no output).
         */
-       if ((!quiet_rotation && session->live_timer) ||
-                       !session->output_traces) {
+       if ((!quiet_rotation && session->live_timer) || !session->output_traces) {
                cmd_ret = LTTNG_ERR_ROTATION_NOT_AVAILABLE;
                goto end;
        }
 
        /* Unsupported feature in lttng-relayd before 2.11. */
        if (!quiet_rotation && session->consumer->type == CONSUMER_DST_NET &&
-                       (session->consumer->relay_major_version == 2 &&
-                       session->consumer->relay_minor_version < 11)) {
+           (session->consumer->relay_major_version == 2 &&
+            session->consumer->relay_minor_version < 11)) {
                cmd_ret = LTTNG_ERR_ROTATION_NOT_AVAILABLE_RELAY;
                goto end;
        }
@@ -5518,7 +5470,7 @@ int cmd_rotate_session(struct ltt_session *session,
 
        if (session->rotation_state == LTTNG_ROTATION_STATE_ONGOING) {
                DBG("Refusing to launch a rotation; a rotation is already in progress for session %s",
-                               session->name);
+                   session->name);
                cmd_ret = LTTNG_ERR_ROTATION_PENDING;
                goto end;
        }
@@ -5529,7 +5481,7 @@ int cmd_rotate_session(struct ltt_session *session,
         */
        if (session->rotated_after_last_stop) {
                DBG("Session \"%s\" was already rotated after stop, refusing rotation",
-                               session->name);
+                   session->name);
                cmd_ret = LTTNG_ERR_ROTATION_MULTIPLE_AFTER_STOP;
                goto end;
        }
@@ -5540,14 +5492,13 @@ int cmd_rotate_session(struct ltt_session *session,
         */
        if (session->cleared_after_last_stop) {
                DBG("Session \"%s\" was already cleared after stop, refusing rotation",
-                               session->name);
+                   session->name);
                cmd_ret = LTTNG_ERR_ROTATION_AFTER_STOP_CLEAR;
                goto end;
        }
 
        if (session->active) {
-               new_trace_chunk = session_create_new_trace_chunk(session, NULL,
-                               NULL, NULL);
+               new_trace_chunk = session_create_new_trace_chunk(session, NULL, NULL, NULL);
                if (!new_trace_chunk) {
                        cmd_ret = LTTNG_ERR_CREATE_DIR_FAIL;
                        goto error;
@@ -5561,8 +5512,7 @@ int cmd_rotate_session(struct ltt_session *session,
         * be closed on the consumer(s), otherwise it will never be
         * cleaned-up, which will result in a leak.
         */
-       ret = session_set_trace_chunk(session, new_trace_chunk,
-                       &chunk_being_archived);
+       ret = session_set_trace_chunk(session, new_trace_chunk, &chunk_being_archived);
        if (ret) {
                cmd_ret = LTTNG_ERR_CREATE_TRACE_CHUNK_FAIL_CONSUMER;
                goto error;
@@ -5589,7 +5539,7 @@ int cmd_rotate_session(struct ltt_session *session,
 
        if (!chunk_being_archived) {
                DBG("Rotating session \"%s\" from a \"NULL\" trace chunk to a new trace chunk, skipping completion check",
-                               session->name);
+                   session->name);
                if (failed_to_rotate) {
                        cmd_ret = rotation_fail_code;
                        goto error;
@@ -5599,12 +5549,11 @@ int cmd_rotate_session(struct ltt_session *session,
        }
 
        session->rotation_state = LTTNG_ROTATION_STATE_ONGOING;
-       chunk_status = lttng_trace_chunk_get_id(chunk_being_archived,
-                       &ongoing_rotation_chunk_id);
+       chunk_status = lttng_trace_chunk_get_id(chunk_being_archived, &ongoing_rotation_chunk_id);
        LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
 
-       ret = session_close_trace_chunk(session, chunk_being_archived,
-               command, session->last_chunk_path);
+       ret = session_close_trace_chunk(
+               session, chunk_being_archived, command, session->last_chunk_path);
        if (ret) {
                cmd_ret = LTTNG_ERR_CLOSE_TRACE_CHUNK_FAIL_CONSUMER;
                goto error;
@@ -5616,8 +5565,7 @@ int cmd_rotate_session(struct ltt_session *session,
        }
 
        session->quiet_rotation = quiet_rotation;
-       ret = timer_session_rotation_pending_check_start(session,
-                       DEFAULT_ROTATE_PENDING_TIMER);
+       ret = timer_session_rotation_pending_check_start(session, DEFAULT_ROTATE_PENDING_TIMER);
        if (ret) {
                cmd_ret = LTTNG_ERR_UNK;
                goto error;
@@ -5631,27 +5579,25 @@ 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->id,
-                               ongoing_rotation_chunk_id);
+                       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",
-                                       session->name);
+                           session->name);
                        cmd_ret = (lttng_error_code) ret;
                }
        }
 
        DBG("Cmd rotate session %s, archive_id %" PRIu64 " sent",
-                       session->name, ongoing_rotation_chunk_id);
+           session->name,
+           ongoing_rotation_chunk_id);
 end:
        lttng_trace_chunk_put(new_trace_chunk);
        lttng_trace_chunk_put(chunk_being_archived);
        ret = (cmd_ret == LTTNG_OK) ? cmd_ret : -((int) cmd_ret);
        return ret;
 error:
-       if (session_reset_rotation_state(session,
-                       LTTNG_ROTATION_STATE_ERROR)) {
-               ERR("Failed to reset rotation state of session \"%s\"",
-                               session->name);
+       if (session_reset_rotation_state(session, LTTNG_ROTATION_STATE_ERROR)) {
+               ERR("Failed to reset rotation state of session \"%s\"", session->name);
        }
        goto end;
 }
@@ -5664,30 +5610,28 @@ error:
  * Return LTTNG_OK on success or else an LTTNG_ERR code.
  */
 int cmd_rotate_get_info(struct ltt_session *session,
-               struct lttng_rotation_get_info_return *info_return,
-               uint64_t rotation_id)
+                       struct lttng_rotation_get_info_return *info_return,
+                       uint64_t rotation_id)
 {
        enum lttng_error_code cmd_ret = LTTNG_OK;
        enum lttng_rotation_state rotation_state;
 
-       DBG("Cmd rotate_get_info session %s, rotation id %" PRIu64, session->name,
-                       session->most_recent_chunk_id.value);
+       DBG("Cmd rotate_get_info session %s, rotation id %" PRIu64,
+           session->name,
+           session->most_recent_chunk_id.value);
 
        if (session->chunk_being_archived) {
                enum lttng_trace_chunk_status chunk_status;
                uint64_t chunk_id;
 
-               chunk_status = lttng_trace_chunk_get_id(
-                               session->chunk_being_archived,
-                               &chunk_id);
+               chunk_status = lttng_trace_chunk_get_id(session->chunk_being_archived, &chunk_id);
                LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
 
-               rotation_state = rotation_id == chunk_id ?
-                               LTTNG_ROTATION_STATE_ONGOING :
-                               LTTNG_ROTATION_STATE_EXPIRED;
+               rotation_state = rotation_id == chunk_id ? LTTNG_ROTATION_STATE_ONGOING :
+                                                          LTTNG_ROTATION_STATE_EXPIRED;
        } else {
                if (session->last_archived_chunk_id.is_set &&
-                               rotation_id != session->last_archived_chunk_id.value) {
+                   rotation_id != session->last_archived_chunk_id.value) {
                        rotation_state = LTTNG_ROTATION_STATE_EXPIRED;
                } else {
                        rotation_state = session->rotation_state;
@@ -5697,15 +5641,18 @@ int cmd_rotate_get_info(struct ltt_session *session,
        switch (rotation_state) {
        case LTTNG_ROTATION_STATE_NO_ROTATION:
                DBG("Reporting that no rotation has occurred within the lifetime of session \"%s\"",
-                               session->name);
+                   session->name);
                goto end;
        case LTTNG_ROTATION_STATE_EXPIRED:
-               DBG("Reporting that the rotation state of rotation id %" PRIu64 " of session \"%s\" has expired",
-                               rotation_id, session->name);
+               DBG("Reporting that the rotation state of rotation id %" PRIu64
+                   " of session \"%s\" has expired",
+                   rotation_id,
+                   session->name);
                break;
        case LTTNG_ROTATION_STATE_ONGOING:
                DBG("Reporting that rotation id %" PRIu64 " of session \"%s\" is still pending",
-                               rotation_id, session->name);
+                   rotation_id,
+                   session->name);
                break;
        case LTTNG_ROTATION_STATE_COMPLETED:
        {
@@ -5715,20 +5662,20 @@ int cmd_rotate_get_info(struct ltt_session *session,
                size_t current_tracing_path_reply_len;
 
                DBG("Reporting that rotation id %" PRIu64 " of session \"%s\" is completed",
-                               rotation_id, session->name);
+                   rotation_id,
+                   session->name);
 
                switch (session_get_consumer_destination_type(session)) {
                case CONSUMER_DST_LOCAL:
-                       current_tracing_path_reply =
-                                       info_return->location.local.absolute_path;
+                       current_tracing_path_reply = info_return->location.local.absolute_path;
                        current_tracing_path_reply_len =
-                                       sizeof(info_return->location.local.absolute_path);
+                               sizeof(info_return->location.local.absolute_path);
                        info_return->location_type =
-                                       (int8_t) LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL;
+                               (int8_t) LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL;
                        fmt_ret = asprintf(&chunk_path,
-                                       "%s/" DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY "/%s",
-                                       session_get_base_path(session),
-                                       session->last_archived_chunk_name);
+                                          "%s/" DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY "/%s",
+                                          session_get_base_path(session),
+                                          session->last_archived_chunk_name);
                        if (fmt_ret == -1) {
                                PERROR("Failed to format the path of the last archived trace chunk");
                                info_return->status = LTTNG_ROTATION_STATUS_ERROR;
@@ -5740,17 +5687,16 @@ int cmd_rotate_get_info(struct ltt_session *session,
                {
                        uint16_t ctrl_port, data_port;
 
-                       current_tracing_path_reply =
-                                       info_return->location.relay.relative_path;
+                       current_tracing_path_reply = info_return->location.relay.relative_path;
                        current_tracing_path_reply_len =
-                                       sizeof(info_return->location.relay.relative_path);
+                               sizeof(info_return->location.relay.relative_path);
                        /* Currently the only supported relay protocol. */
                        info_return->location.relay.protocol =
-                                       (int8_t) LTTNG_TRACE_ARCHIVE_LOCATION_RELAY_PROTOCOL_TYPE_TCP;
+                               (int8_t) LTTNG_TRACE_ARCHIVE_LOCATION_RELAY_PROTOCOL_TYPE_TCP;
 
                        fmt_ret = lttng_strncpy(info_return->location.relay.host,
-                                       session_get_net_consumer_hostname(session),
-                                       sizeof(info_return->location.relay.host));
+                                               session_get_net_consumer_hostname(session),
+                                               sizeof(info_return->location.relay.host));
                        if (fmt_ret) {
                                ERR("Failed to copy host name to rotate_get_info reply");
                                info_return->status = LTTNG_ROTATION_STATUS_ERROR;
@@ -5762,7 +5708,7 @@ int cmd_rotate_get_info(struct ltt_session *session,
                        info_return->location.relay.ports.control = ctrl_port;
                        info_return->location.relay.ports.data = data_port;
                        info_return->location_type =
-                                       (int8_t) LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY;
+                               (int8_t) LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY;
                        chunk_path = strdup(session->last_chunk_path);
                        if (!chunk_path) {
                                ERR("Failed to allocate the path of the last archived trace chunk");
@@ -5776,8 +5722,8 @@ int cmd_rotate_get_info(struct ltt_session *session,
                        abort();
                }
 
-               fmt_ret = lttng_strncpy(current_tracing_path_reply,
-                               chunk_path, current_tracing_path_reply_len);
+               fmt_ret = lttng_strncpy(
+                       current_tracing_path_reply, chunk_path, current_tracing_path_reply_len);
                free(chunk_path);
                if (fmt_ret) {
                        ERR("Failed to copy path of the last archived trace chunk to rotate_get_info reply");
@@ -5789,8 +5735,10 @@ int cmd_rotate_get_info(struct ltt_session *session,
                break;
        }
        case LTTNG_ROTATION_STATE_ERROR:
-               DBG("Reporting that an error occurred during rotation %" PRIu64 " of session \"%s\"",
-                               rotation_id, session->name);
+               DBG("Reporting that an error occurred during rotation %" PRIu64
+                   " of session \"%s\"",
+                   rotation_id,
+                   session->name);
                break;
        default:
                abort();
@@ -5813,9 +5761,10 @@ end:
  * Return LTTNG_OK on success or else a positive LTTNG_ERR code.
  */
 int cmd_rotation_set_schedule(struct ltt_session *session,
-               bool activate, enum lttng_rotation_schedule_type schedule_type,
-               uint64_t new_value,
-               struct notification_thread_handle *notification_thread_handle)
+                             bool activate,
+                             enum lttng_rotation_schedule_type schedule_type,
+                             uint64_t new_value,
+                             struct notification_thread_handle *notification_thread_handle)
 {
        int ret;
        uint64_t *parameter_value;
@@ -5837,8 +5786,10 @@ int cmd_rotation_set_schedule(struct ltt_session *session,
        case LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC:
                parameter_value = &session->rotate_timer_period;
                if (new_value >= UINT_MAX) {
-                       DBG("Failing ROTATION_SET_SCHEDULE command as the value requested for a periodic rotation schedule is invalid: %" PRIu64 " > %u (UINT_MAX)",
-                                       new_value, UINT_MAX);
+                       DBG("Failing ROTATION_SET_SCHEDULE command as the value requested for a periodic rotation schedule is invalid: %" PRIu64
+                           " > %u (UINT_MAX)",
+                           new_value,
+                           UINT_MAX);
                        ret = LTTNG_ERR_INVALID;
                        goto end;
                }
@@ -5898,16 +5849,14 @@ int cmd_rotation_set_schedule(struct ltt_session *session,
                         * Only start the timer if the session is active,
                         * otherwise it will be started when the session starts.
                         */
-                       ret = timer_session_rotation_schedule_timer_start(
-                                       session, new_value);
+                       ret = timer_session_rotation_schedule_timer_start(session, new_value);
                        if (ret) {
                                ERR("Failed to enable session rotation timer in ROTATION_SET_SCHEDULE command");
                                ret = LTTNG_ERR_UNK;
                                goto end;
                        }
                } else {
-                       ret = timer_session_rotation_schedule_timer_stop(
-                                       session);
+                       ret = timer_session_rotation_schedule_timer_stop(session);
                        if (ret) {
                                ERR("Failed to disable session rotation timer in ROTATION_SET_SCHEDULE command");
                                ret = LTTNG_ERR_UNK;
@@ -5917,22 +5866,21 @@ int cmd_rotation_set_schedule(struct ltt_session *session,
                break;
        case LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD:
                if (activate) {
-                       ret = subscribe_session_consumed_size_rotation(session,
-                                       new_value, notification_thread_handle);
+                       ret = subscribe_session_consumed_size_rotation(
+                               session, new_value, notification_thread_handle);
                        if (ret) {
                                ERR("Failed to enable consumed-size notification in ROTATION_SET_SCHEDULE command");
                                ret = LTTNG_ERR_UNK;
                                goto end;
                        }
                } else {
-                       ret = unsubscribe_session_consumed_size_rotation(session,
-                                       notification_thread_handle);
+                       ret = unsubscribe_session_consumed_size_rotation(
+                               session, notification_thread_handle);
                        if (ret) {
                                ERR("Failed to disable consumed-size notification in ROTATION_SET_SCHEDULE command");
                                ret = LTTNG_ERR_UNK;
                                goto end;
                        }
-
                }
                break;
        default:
@@ -5954,7 +5902,7 @@ static enum lttng_error_code wait_on_path(void *path_data)
        const char *shm_path = (const char *) path_data;
 
        DBG("Waiting for the shm path at %s to be removed before completing session destruction",
-                       shm_path);
+           shm_path);
        while (true) {
                int ret;
                struct stat st;
@@ -5970,7 +5918,7 @@ static enum lttng_error_code wait_on_path(void *path_data)
                } else {
                        if (!S_ISDIR(st.st_mode)) {
                                ERR("The type of shm path %s returned by stat() is not a directory; aborting the wait for shm path removal",
-                                               shm_path);
+                                   shm_path);
                                break;
                        }
                }
index d932fac13bd139c723c3b1ef4aca1a3866245045..daf2bd37168d883efaeca6af2d528202af50394b 100644 (file)
@@ -5,30 +5,27 @@
  *
  */
 
-#include <common/hashtable/utils.hpp>
+#include "condition-internal.hpp"
+
 #include <common/hashtable/hashtable.hpp>
+#include <common/hashtable/utils.hpp>
 
-#include <lttng/condition/condition.h>
-#include <lttng/condition/condition-internal.hpp>
 #include <lttng/condition/buffer-usage-internal.hpp>
-#include <lttng/condition/session-consumed-size-internal.hpp>
-#include <lttng/condition/session-rotation-internal.hpp>
+#include <lttng/condition/condition-internal.hpp>
+#include <lttng/condition/condition.h>
 #include <lttng/condition/event-rule-matches-internal.hpp>
 #include <lttng/condition/event-rule-matches.h>
+#include <lttng/condition/session-consumed-size-internal.hpp>
+#include <lttng/condition/session-rotation-internal.hpp>
 #include <lttng/event-rule/event-rule-internal.hpp>
-#include <lttng/condition/event-rule-matches-internal.hpp>
-#include "condition-internal.hpp"
 
-static
-unsigned long lttng_condition_buffer_usage_hash(
-       const struct lttng_condition *_condition)
+static unsigned long lttng_condition_buffer_usage_hash(const struct lttng_condition *_condition)
 {
        unsigned long hash;
        unsigned long condition_type;
        struct lttng_condition_buffer_usage *condition;
 
-       condition = lttng::utils::container_of(_condition,
-                       &lttng_condition_buffer_usage::parent);
+       condition = lttng::utils::container_of(_condition, &lttng_condition_buffer_usage::parent);
 
        condition_type = (unsigned long) condition->parent.type;
        hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
@@ -39,9 +36,7 @@ unsigned long lttng_condition_buffer_usage_hash(
                hash ^= hash_key_str(condition->channel_name, lttng_ht_seed);
        }
        if (condition->domain.set) {
-               hash ^= hash_key_ulong(
-                               (void *) condition->domain.type,
-                               lttng_ht_seed);
+               hash ^= hash_key_ulong((void *) condition->domain.type, lttng_ht_seed);
        }
        if (condition->threshold_ratio.set) {
                hash ^= hash_key_u64(&condition->threshold_ratio.value, lttng_ht_seed);
@@ -54,18 +49,16 @@ unsigned long lttng_condition_buffer_usage_hash(
        return hash;
 }
 
-static
-unsigned long lttng_condition_session_consumed_size_hash(
-       const struct lttng_condition *_condition)
+static unsigned long
+lttng_condition_session_consumed_size_hash(const struct lttng_condition *_condition)
 {
        unsigned long hash;
-       unsigned long condition_type =
-                       (unsigned long) LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE;
+       unsigned long condition_type = (unsigned long) LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE;
        struct lttng_condition_session_consumed_size *condition;
        uint64_t val;
 
        condition = lttng::utils::container_of(_condition,
-                       &lttng_condition_session_consumed_size::parent);
+                                              &lttng_condition_session_consumed_size::parent);
 
        hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
        if (condition->session_name) {
@@ -76,15 +69,13 @@ unsigned long lttng_condition_session_consumed_size_hash(
        return hash;
 }
 
-static
-unsigned long lttng_condition_session_rotation_hash(
-       const struct lttng_condition *_condition)
+static unsigned long lttng_condition_session_rotation_hash(const struct lttng_condition *_condition)
 {
        unsigned long hash, condition_type;
        struct lttng_condition_session_rotation *condition;
 
-       condition = lttng::utils::container_of(_condition,
-                       &lttng_condition_session_rotation::parent);
+       condition =
+               lttng::utils::container_of(_condition, &lttng_condition_session_rotation::parent);
        condition_type = (unsigned long) condition->parent.type;
        hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
        LTTNG_ASSERT(condition->session_name);
@@ -92,16 +83,15 @@ unsigned long lttng_condition_session_rotation_hash(
        return hash;
 }
 
-static unsigned long lttng_condition_event_rule_matches_hash(
-               const struct lttng_condition *condition)
+static unsigned long
+lttng_condition_event_rule_matches_hash(const struct lttng_condition *condition)
 {
        unsigned long hash, condition_type;
        enum lttng_condition_status condition_status;
        const struct lttng_event_rule *event_rule;
 
        condition_type = (unsigned long) condition->type;
-       condition_status = lttng_condition_event_rule_matches_get_rule(
-                       condition, &event_rule);
+       condition_status = lttng_condition_event_rule_matches_get_rule(condition, &event_rule);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
        hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
@@ -146,11 +136,9 @@ struct lttng_condition *lttng_condition_copy(const struct lttng_condition *condi
 
        {
                struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &copy_buffer, 0, -1);
+                       lttng_payload_view_from_payload(&copy_buffer, 0, -1);
 
-               ret = lttng_condition_create_from_payload(
-                               &view, &copy);
+               ret = lttng_condition_create_from_payload(&view, &copy);
                if (ret < 0) {
                        copy = NULL;
                        goto end;
index c0f8eb5894e8fae8cb070109d4820ebec62ddff2..17d2248bec8f9f2c35a1bb6e90f92b694867335c 100644 (file)
@@ -7,25 +7,25 @@
  */
 
 #define _LGPL_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <inttypes.h>
+#include "consumer.hpp"
+#include "health-sessiond.hpp"
+#include "lttng-sessiond.hpp"
+#include "ust-app.hpp"
+#include "utils.hpp"
 
 #include <common/common.hpp>
 #include <common/defaults.hpp>
-#include <common/uri.hpp>
 #include <common/relayd/relayd.hpp>
 #include <common/string-utils/format.hpp>
+#include <common/uri.hpp>
 
-#include "consumer.hpp"
-#include "health-sessiond.hpp"
-#include "ust-app.hpp"
-#include "utils.hpp"
-#include "lttng-sessiond.hpp"
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 /*
  * Return allocated full pathname of the session using the consumer trace path
@@ -35,7 +35,8 @@
  * returned.
  */
 char *setup_channel_trace_path(struct consumer_output *consumer,
-               const char *session_path, size_t *consumer_path_offset)
+                              const char *session_path,
+                              size_t *consumer_path_offset)
 {
        int ret;
        char *pathname;
@@ -55,21 +56,22 @@ char *setup_channel_trace_path(struct consumer_output *consumer,
        }
 
        /* Get correct path name destination */
-       if (consumer->type == CONSUMER_DST_NET &&
-                       consumer->relay_major_version == 2 &&
-                       consumer->relay_minor_version < 11) {
-               ret = snprintf(pathname, LTTNG_PATH_MAX, "%s%s/%s/%s",
-                               consumer->dst.net.base_dir,
-                               consumer->chunk_path, consumer->domain_subdir,
-                               session_path);
+       if (consumer->type == CONSUMER_DST_NET && consumer->relay_major_version == 2 &&
+           consumer->relay_minor_version < 11) {
+               ret = snprintf(pathname,
+                              LTTNG_PATH_MAX,
+                              "%s%s/%s/%s",
+                              consumer->dst.net.base_dir,
+                              consumer->chunk_path,
+                              consumer->domain_subdir,
+                              session_path);
                *consumer_path_offset = 0;
        } else {
-               ret = snprintf(pathname, LTTNG_PATH_MAX, "%s/%s",
-                               consumer->domain_subdir, session_path);
+               ret = snprintf(
+                       pathname, LTTNG_PATH_MAX, "%s/%s", consumer->domain_subdir, session_path);
                *consumer_path_offset = strlen(consumer->domain_subdir) + 1;
        }
-       DBG3("Consumer trace path relative to current trace chunk: \"%s\"",
-                       pathname);
+       DBG3("Consumer trace path relative to current trace chunk: \"%s\"", pathname);
        if (ret < 0) {
                PERROR("Failed to format channel path");
                goto error;
@@ -92,8 +94,7 @@ error:
  *
  * Return 0 on success else a negative value on error.
  */
-int consumer_socket_send(
-               struct consumer_socket *socket, const void *msg, size_t len)
+int consumer_socket_send(struct consumer_socket *socket, const void *msg, size_t len)
 {
        int fd;
        ssize_t size;
@@ -213,7 +214,8 @@ end:
  * negative value is sent back and both parameters are untouched.
  */
 int consumer_recv_status_channel(struct consumer_socket *sock,
-               uint64_t *key, unsigned int *stream_count)
+                                uint64_t *key,
+                                unsigned int *stream_count)
 {
        int ret;
        struct lttcomm_consumer_status_channel reply;
@@ -246,8 +248,7 @@ end:
  *
  * On success return positive value. On error, negative value.
  */
-int consumer_send_destroy_relayd(struct consumer_socket *sock,
-               struct consumer_output *consumer)
+int consumer_send_destroy_relayd(struct consumer_socket *sock, struct consumer_output *consumer)
 {
        int ret;
        struct lttcomm_consumer_msg msg;
@@ -291,8 +292,7 @@ void consumer_output_send_destroy_relayd(struct consumer_output *consumer)
        /* Destroy any relayd connection */
        if (consumer->type == CONSUMER_DST_NET) {
                rcu_read_lock();
-               cds_lfht_for_each_entry(consumer->socks->ht, &iter.iter, socket,
-                               node.node) {
+               cds_lfht_for_each_entry (consumer->socks->ht, &iter.iter, socket, node.node) {
                        int ret;
 
                        /* Send destroy relayd command */
@@ -312,8 +312,7 @@ void consumer_output_send_destroy_relayd(struct consumer_output *consumer)
  *
  * Return 0 on success, else negative value on error
  */
-int consumer_create_socket(struct consumer_data *data,
-               struct consumer_output *output)
+int consumer_create_socket(struct consumer_data *data, struct consumer_output *output)
 {
        int ret = 0;
        struct consumer_socket *socket;
@@ -347,8 +346,7 @@ int consumer_create_socket(struct consumer_data *data,
 
        socket->type = data->type;
 
-       DBG3("Consumer socket created (fd: %d) and added to output",
-                       data->cmd_sock);
+       DBG3("Consumer socket created (fd: %d) and added to output", data->cmd_sock);
 
 error:
        return ret;
@@ -362,7 +360,7 @@ error:
  * object reference is not needed anymore.
  */
 struct consumer_socket *consumer_find_socket_by_bitness(int bits,
-               const struct consumer_output *consumer)
+                                                       const struct consumer_output *consumer)
 {
        int consumer_fd;
        struct consumer_socket *socket = NULL;
@@ -383,8 +381,7 @@ struct consumer_socket *consumer_find_socket_by_bitness(int bits,
 
        socket = consumer_find_socket(consumer_fd, consumer);
        if (!socket) {
-               ERR("Consumer socket fd %d not found in consumer obj %p",
-                               consumer_fd, consumer);
+               ERR("Consumer socket fd %d not found in consumer obj %p", consumer_fd, consumer);
        }
 
 end:
@@ -396,8 +393,7 @@ end:
  * be acquired before calling this function and across use of the
  * returned consumer_socket.
  */
-struct consumer_socket *consumer_find_socket(int key,
-               const struct consumer_output *consumer)
+struct consumer_socket *consumer_find_socket(int key, const struct consumer_output *consumer)
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_ulong *node;
@@ -410,8 +406,7 @@ struct consumer_socket *consumer_find_socket(int key,
                return NULL;
        }
 
-       lttng_ht_lookup(consumer->socks, (void *)((unsigned long) key),
-                       &iter);
+       lttng_ht_lookup(consumer->socks, (void *) ((unsigned long) key), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
        if (node != NULL) {
                socket = lttng::utils::container_of(node, &consumer_socket::node);
@@ -446,8 +441,7 @@ error:
  * Add consumer socket to consumer output object. Read side lock must be
  * acquired before calling this function.
  */
-void consumer_add_socket(struct consumer_socket *sock,
-               struct consumer_output *consumer)
+void consumer_add_socket(struct consumer_socket *sock, struct consumer_output *consumer)
 {
        LTTNG_ASSERT(sock);
        LTTNG_ASSERT(consumer);
@@ -460,8 +454,7 @@ void consumer_add_socket(struct consumer_socket *sock,
  * Delete consumer socket to consumer output object. Read side lock must be
  * acquired before calling this function.
  */
-void consumer_del_socket(struct consumer_socket *sock,
-               struct consumer_output *consumer)
+void consumer_del_socket(struct consumer_socket *sock, struct consumer_output *consumer)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -482,8 +475,7 @@ static void destroy_socket_rcu(struct rcu_head *head)
 {
        struct lttng_ht_node_ulong *node =
                lttng::utils::container_of(head, &lttng_ht_node_ulong::head);
-       struct consumer_socket *socket =
-               lttng::utils::container_of(node, &consumer_socket::node);
+       struct consumer_socket *socket = lttng::utils::container_of(node, &consumer_socket::node);
 
        free(socket);
 }
@@ -553,7 +545,7 @@ void consumer_destroy_output_sockets(struct consumer_output *obj)
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(obj->socks->ht, &iter.iter, socket, node.node) {
+       cds_lfht_for_each_entry (obj->socks->ht, &iter.iter, socket, node.node) {
                consumer_del_socket(socket, obj);
                consumer_destroy_socket(socket);
        }
@@ -565,8 +557,7 @@ void consumer_destroy_output_sockets(struct consumer_output *obj)
  */
 static void consumer_release_output(struct urcu_ref *ref)
 {
-       struct consumer_output *obj =
-               lttng::utils::container_of(ref, &consumer_output::ref);
+       struct consumer_output *obj = lttng::utils::container_of(ref, &consumer_output::ref);
 
        consumer_destroy_output_sockets(obj);
 
@@ -613,8 +604,7 @@ struct consumer_output *consumer_copy_output(struct consumer_output *src)
        }
        output->enabled = src->enabled;
        output->net_seq_index = src->net_seq_index;
-       memcpy(output->domain_subdir, src->domain_subdir,
-                       sizeof(output->domain_subdir));
+       memcpy(output->domain_subdir, src->domain_subdir, sizeof(output->domain_subdir));
        output->snapshot = src->snapshot;
        output->relay_major_version = src->relay_major_version;
        output->relay_minor_version = src->relay_minor_version;
@@ -637,8 +627,7 @@ error_put:
  *
  * Return 0 on success or else a negative value.
  */
-int consumer_copy_sockets(struct consumer_output *dst,
-               struct consumer_output *src)
+int consumer_copy_sockets(struct consumer_output *dst, struct consumer_output *src)
 {
        int ret = 0;
        struct lttng_ht_iter iter;
@@ -648,7 +637,7 @@ int consumer_copy_sockets(struct consumer_output *dst,
        LTTNG_ASSERT(src);
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(src->socks->ht, &iter.iter, socket, node.node) {
+       cds_lfht_for_each_entry (src->socks->ht, &iter.iter, socket, node.node) {
                /* Ignore socket that are already there. */
                copy_sock = consumer_find_socket(*socket->fd_ptr, dst);
                if (copy_sock) {
@@ -685,8 +674,8 @@ error:
  * error.
  */
 int consumer_set_network_uri(const struct ltt_session *session,
-               struct consumer_output *output,
-               struct lttng_uri *uri)
+                            struct consumer_output *output,
+                            struct lttng_uri *uri)
 {
        int ret;
        struct lttng_uri *dst_uri = NULL;
@@ -703,8 +692,7 @@ int consumer_set_network_uri(const struct ltt_session *session,
                        /* Assign default port. */
                        uri->port = DEFAULT_NETWORK_CONTROL_PORT;
                } else {
-                       if (output->dst.net.data_isset && uri->port ==
-                                       output->dst.net.data.port) {
+                       if (output->dst.net.data_isset && uri->port == output->dst.net.data.port) {
                                ret = -LTTNG_ERR_INVALID;
                                goto error;
                        }
@@ -718,8 +706,8 @@ int consumer_set_network_uri(const struct ltt_session *session,
                        /* Assign default port. */
                        uri->port = DEFAULT_NETWORK_DATA_PORT;
                } else {
-                       if (output->dst.net.control_isset && uri->port ==
-                                       output->dst.net.control.port) {
+                       if (output->dst.net.control_isset &&
+                           uri->port == output->dst.net.control.port) {
                                ret = -LTTNG_ERR_INVALID;
                                goto error;
                        }
@@ -776,14 +764,17 @@ int consumer_set_network_uri(const struct ltt_session *session,
                        goto error;
                }
                ret = snprintf(output->dst.net.base_dir,
-                               sizeof(output->dst.net.base_dir),
-                               "/%s/%s/", session->hostname, uri->subdir);
+                              sizeof(output->dst.net.base_dir),
+                              "/%s/%s/",
+                              session->hostname,
+                              uri->subdir);
        } else {
                if (session->has_auto_generated_name) {
                        ret = snprintf(output->dst.net.base_dir,
-                                       sizeof(output->dst.net.base_dir),
-                                       "/%s/%s/", session->hostname,
-                                       session->name);
+                                      sizeof(output->dst.net.base_dir),
+                                      "/%s/%s/",
+                                      session->hostname,
+                                      session->name);
                } else {
                        char session_creation_datetime[16];
                        size_t strftime_ret;
@@ -795,18 +786,20 @@ int consumer_set_network_uri(const struct ltt_session *session,
                                goto error;
                        }
                        strftime_ret = strftime(session_creation_datetime,
-                                       sizeof(session_creation_datetime),
-                                       "%Y%m%d-%H%M%S", timeinfo);
+                                               sizeof(session_creation_datetime),
+                                               "%Y%m%d-%H%M%S",
+                                               timeinfo);
                        if (strftime_ret == 0) {
                                ERR("Failed to format session creation timestamp while setting network URI");
                                ret = -LTTNG_ERR_FATAL;
                                goto error;
                        }
                        ret = snprintf(output->dst.net.base_dir,
-                                       sizeof(output->dst.net.base_dir),
-                                       "/%s/%s-%s/", session->hostname,
-                                       session->name,
-                                       session_creation_datetime);
+                                      sizeof(output->dst.net.base_dir),
+                                      "/%s/%s-%s/",
+                                      session->hostname,
+                                      session->name,
+                                      session_creation_datetime);
                }
        }
        if (ret >= sizeof(output->dst.net.base_dir)) {
@@ -819,8 +812,7 @@ int consumer_set_network_uri(const struct ltt_session *session,
                goto error;
        }
 
-       DBG3("Consumer set network uri base_dir path %s",
-                       output->dst.net.base_dir);
+       DBG3("Consumer set network uri base_dir path %s", output->dst.net.base_dir);
 
 end:
        return 0;
@@ -835,8 +827,7 @@ error:
  *
  * The consumer socket lock must be held by the caller.
  */
-int consumer_send_fds(struct consumer_socket *sock, const int *fds,
-               size_t nb_fd)
+int consumer_send_fds(struct consumer_socket *sock, const int *fds, size_t nb_fd)
 {
        int ret;
 
@@ -862,8 +853,7 @@ error:
  *
  * The consumer socket lock must be held by the caller.
  */
-int consumer_send_msg(struct consumer_socket *sock,
-               const struct lttcomm_consumer_msg *msg)
+int consumer_send_msg(struct consumer_socket *sock, const struct lttcomm_consumer_msg *msg)
 {
        int ret;
 
@@ -887,8 +877,7 @@ error:
  *
  * The consumer socket lock must be held by the caller.
  */
-int consumer_send_channel(struct consumer_socket *sock,
-               struct lttcomm_consumer_msg *msg)
+int consumer_send_channel(struct consumer_socket *sock, struct lttcomm_consumer_msg *msg)
 {
        int ret;
 
@@ -909,33 +898,33 @@ error:
  * information.
  */
 void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
-               uint64_t subbuf_size,
-               uint64_t num_subbuf,
-               int overwrite,
-               unsigned int switch_timer_interval,
-               unsigned int read_timer_interval,
-               unsigned int live_timer_interval,
-               bool is_in_live_session,
-               unsigned int monitor_timer_interval,
-               int output,
-               int type,
-               uint64_t session_id,
-               const char *pathname,
-               const char *name,
-               uint64_t relayd_id,
-               uint64_t key,
-               const lttng_uuid& uuid,
-               uint32_t chan_id,
-               uint64_t tracefile_size,
-               uint64_t tracefile_count,
-               uint64_t session_id_per_pid,
-               unsigned int monitor,
-               uint32_t ust_app_uid,
-               int64_t blocking_timeout,
-               const char *root_shm_path,
-               const char *shm_path,
-               struct lttng_trace_chunk *trace_chunk,
-               const struct lttng_credentials *buffer_credentials)
+                                       uint64_t subbuf_size,
+                                       uint64_t num_subbuf,
+                                       int overwrite,
+                                       unsigned int switch_timer_interval,
+                                       unsigned int read_timer_interval,
+                                       unsigned int live_timer_interval,
+                                       bool is_in_live_session,
+                                       unsigned int monitor_timer_interval,
+                                       int output,
+                                       int type,
+                                       uint64_t session_id,
+                                       const char *pathname,
+                                       const char *name,
+                                       uint64_t relayd_id,
+                                       uint64_t key,
+                                       const lttng_uuid& uuid,
+                                       uint32_t chan_id,
+                                       uint64_t tracefile_size,
+                                       uint64_t tracefile_count,
+                                       uint64_t session_id_per_pid,
+                                       unsigned int monitor,
+                                       uint32_t ust_app_uid,
+                                       int64_t blocking_timeout,
+                                       const char *root_shm_path,
+                                       const char *shm_path,
+                                       struct lttng_trace_chunk *trace_chunk,
+                                       const struct lttng_credentials *buffer_credentials)
 {
        LTTNG_ASSERT(msg);
 
@@ -952,14 +941,12 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
                LTTNG_OPTIONAL_SET(&msg->u.ask_channel.chunk_id, chunk_id);
        }
-       msg->u.ask_channel.buffer_credentials.uid =
-                       lttng_credentials_get_uid(buffer_credentials);
-       msg->u.ask_channel.buffer_credentials.gid =
-                       lttng_credentials_get_gid(buffer_credentials);
+       msg->u.ask_channel.buffer_credentials.uid = lttng_credentials_get_uid(buffer_credentials);
+       msg->u.ask_channel.buffer_credentials.gid = lttng_credentials_get_gid(buffer_credentials);
 
        msg->cmd_type = LTTNG_CONSUMER_ASK_CHANNEL_CREATION;
        msg->u.ask_channel.subbuf_size = subbuf_size;
-       msg->u.ask_channel.num_subbuf = num_subbuf ;
+       msg->u.ask_channel.num_subbuf = num_subbuf;
        msg->u.ask_channel.overwrite = overwrite;
        msg->u.ask_channel.switch_timer_interval = switch_timer_interval;
        msg->u.ask_channel.read_timer_interval = read_timer_interval;
@@ -982,22 +969,22 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
        std::copy(uuid.begin(), uuid.end(), msg->u.ask_channel.uuid);
 
        if (pathname) {
-               strncpy(msg->u.ask_channel.pathname, pathname,
-                               sizeof(msg->u.ask_channel.pathname));
-               msg->u.ask_channel.pathname[sizeof(msg->u.ask_channel.pathname)-1] = '\0';
+               strncpy(msg->u.ask_channel.pathname, pathname, sizeof(msg->u.ask_channel.pathname));
+               msg->u.ask_channel.pathname[sizeof(msg->u.ask_channel.pathname) - 1] = '\0';
        }
 
        strncpy(msg->u.ask_channel.name, name, sizeof(msg->u.ask_channel.name));
        msg->u.ask_channel.name[sizeof(msg->u.ask_channel.name) - 1] = '\0';
 
        if (root_shm_path) {
-               strncpy(msg->u.ask_channel.root_shm_path, root_shm_path,
+               strncpy(msg->u.ask_channel.root_shm_path,
+                       root_shm_path,
                        sizeof(msg->u.ask_channel.root_shm_path));
-               msg->u.ask_channel.root_shm_path[sizeof(msg->u.ask_channel.root_shm_path) - 1] = '\0';
+               msg->u.ask_channel.root_shm_path[sizeof(msg->u.ask_channel.root_shm_path) - 1] =
+                       '\0';
        }
        if (shm_path) {
-               strncpy(msg->u.ask_channel.shm_path, shm_path,
-                       sizeof(msg->u.ask_channel.shm_path));
+               strncpy(msg->u.ask_channel.shm_path, shm_path, sizeof(msg->u.ask_channel.shm_path));
                msg->u.ask_channel.shm_path[sizeof(msg->u.ask_channel.shm_path) - 1] = '\0';
        }
 }
@@ -1006,21 +993,21 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
  * Init channel communication message structure.
  */
 void consumer_init_add_channel_comm_msg(struct lttcomm_consumer_msg *msg,
-               uint64_t channel_key,
-               uint64_t session_id,
-               const char *pathname,
-               uint64_t relayd_id,
-               const char *name,
-               unsigned int nb_init_streams,
-               enum lttng_event_output output,
-               int type,
-               uint64_t tracefile_size,
-               uint64_t tracefile_count,
-               unsigned int monitor,
-               unsigned int live_timer_interval,
-               bool is_in_live_session,
-               unsigned int monitor_timer_interval,
-               struct lttng_trace_chunk *trace_chunk)
+                                       uint64_t channel_key,
+                                       uint64_t session_id,
+                                       const char *pathname,
+                                       uint64_t relayd_id,
+                                       const char *name,
+                                       unsigned int nb_init_streams,
+                                       enum lttng_event_output output,
+                                       int type,
+                                       uint64_t tracefile_size,
+                                       uint64_t tracefile_count,
+                                       unsigned int monitor,
+                                       unsigned int live_timer_interval,
+                                       bool is_in_live_session,
+                                       unsigned int monitor_timer_interval,
+                                       struct lttng_trace_chunk *trace_chunk)
 {
        LTTNG_ASSERT(msg);
 
@@ -1051,8 +1038,7 @@ void consumer_init_add_channel_comm_msg(struct lttcomm_consumer_msg *msg,
        msg->u.channel.is_live = is_in_live_session;
        msg->u.channel.monitor_timer_interval = monitor_timer_interval;
 
-       strncpy(msg->u.channel.pathname, pathname,
-                       sizeof(msg->u.channel.pathname));
+       strncpy(msg->u.channel.pathname, pathname, sizeof(msg->u.channel.pathname));
        msg->u.channel.pathname[sizeof(msg->u.channel.pathname) - 1] = '\0';
 
        strncpy(msg->u.channel.name, name, sizeof(msg->u.channel.name));
@@ -1063,9 +1049,9 @@ void consumer_init_add_channel_comm_msg(struct lttcomm_consumer_msg *msg,
  * Init stream communication message structure.
  */
 void consumer_init_add_stream_comm_msg(struct lttcomm_consumer_msg *msg,
-               uint64_t channel_key,
-               uint64_t stream_key,
-               int32_t cpu)
+                                      uint64_t channel_key,
+                                      uint64_t stream_key,
+                                      int32_t cpu)
 {
        LTTNG_ASSERT(msg);
 
@@ -1078,8 +1064,9 @@ void consumer_init_add_stream_comm_msg(struct lttcomm_consumer_msg *msg,
 }
 
 void consumer_init_streams_sent_comm_msg(struct lttcomm_consumer_msg *msg,
-               enum lttng_consumer_command cmd,
-               uint64_t channel_key, uint64_t net_seq_idx)
+                                        enum lttng_consumer_command cmd,
+                                        uint64_t channel_key,
+                                        uint64_t net_seq_idx)
 {
        LTTNG_ASSERT(msg);
 
@@ -1094,8 +1081,10 @@ void consumer_init_streams_sent_comm_msg(struct lttcomm_consumer_msg *msg,
  * Send stream communication structure to the consumer.
  */
 int consumer_send_stream(struct consumer_socket *sock,
-               struct consumer_output *dst, struct lttcomm_consumer_msg *msg,
-               const int *fds, size_t nb_fd)
+                        struct consumer_output *dst,
+                        struct lttcomm_consumer_msg *msg,
+                        const int *fds,
+                        size_t nb_fd)
 {
        int ret;
 
@@ -1126,12 +1115,17 @@ error:
  * On success return positive value. On error, negative value.
  */
 int consumer_send_relayd_socket(struct consumer_socket *consumer_sock,
-               struct lttcomm_relayd_sock *rsock, struct consumer_output *consumer,
-               enum lttng_stream_type type, uint64_t session_id,
-               const char *session_name, const char *hostname,
-               const char *base_path, int session_live_timer,
-               const uint64_t *current_chunk_id, time_t session_creation_time,
-               bool session_name_contains_creation_time)
+                               struct lttcomm_relayd_sock *rsock,
+                               struct consumer_output *consumer,
+                               enum lttng_stream_type type,
+                               uint64_t session_id,
+                               const char *session_name,
+                               const char *hostname,
+                               const char *base_path,
+                               int session_live_timer,
+                               const uint64_t *current_chunk_id,
+                               time_t session_creation_time,
+                               bool session_name_contains_creation_time)
 {
        int ret;
        int fd;
@@ -1153,21 +1147,26 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock,
                char output_path[LTTNG_PATH_MAX] = {};
                uint64_t relayd_session_id;
 
-               ret = relayd_create_session(rsock, &relayd_session_id,
-                               session_name, hostname, base_path,
-                               session_live_timer, consumer->snapshot,
-                               session_id, the_sessiond_uuid, current_chunk_id,
-                               session_creation_time,
-                               session_name_contains_creation_time,
-                               output_path);
+               ret = relayd_create_session(rsock,
+                                           &relayd_session_id,
+                                           session_name,
+                                           hostname,
+                                           base_path,
+                                           session_live_timer,
+                                           consumer->snapshot,
+                                           session_id,
+                                           the_sessiond_uuid,
+                                           current_chunk_id,
+                                           session_creation_time,
+                                           session_name_contains_creation_time,
+                                           output_path);
                if (ret < 0) {
                        /* Close the control socket. */
                        (void) relayd_close(rsock);
                        goto error;
                }
                msg.u.relayd_sock.relayd_session_id = relayd_session_id;
-               DBG("Created session on relay, output path reply: %s",
-                       output_path);
+               DBG("Created session on relay, output path reply: %s", output_path);
        }
 
        msg.cmd_type = LTTNG_CONSUMER_ADD_RELAYD_SOCKET;
@@ -1202,9 +1201,8 @@ error:
        return ret;
 }
 
-static
-int consumer_send_pipe(struct consumer_socket *consumer_sock,
-               enum lttng_consumer_command cmd, int pipe)
+static int
+consumer_send_pipe(struct consumer_socket *consumer_sock, enum lttng_consumer_command cmd, int pipe)
 {
        int ret;
        struct lttcomm_consumer_msg msg;
@@ -1217,8 +1215,7 @@ int consumer_send_pipe(struct consumer_socket *consumer_sock,
                command_name = "SET_CHANNEL_MONITOR_PIPE";
                break;
        default:
-               ERR("Unexpected command received in %s (cmd = %d)", __func__,
-                               (int) cmd);
+               ERR("Unexpected command received in %s (cmd = %d)", __func__, (int) cmd);
                abort();
        }
 
@@ -1234,9 +1231,7 @@ int consumer_send_pipe(struct consumer_socket *consumer_sock,
                goto error;
        }
 
-       DBG3("Sending %s pipe %d to consumer on socket %d",
-                       pipe_name,
-                       pipe, *consumer_sock->fd_ptr);
+       DBG3("Sending %s pipe %d to consumer on socket %d", pipe_name, pipe, *consumer_sock->fd_ptr);
        ret = consumer_send_fds(consumer_sock, &pipe, 1);
        if (ret < 0) {
                goto error;
@@ -1248,22 +1243,19 @@ error:
        return ret;
 }
 
-int consumer_send_channel_monitor_pipe(struct consumer_socket *consumer_sock,
-               int pipe)
+int consumer_send_channel_monitor_pipe(struct consumer_socket *consumer_sock, int pipe)
 {
-       return consumer_send_pipe(consumer_sock,
-                       LTTNG_CONSUMER_SET_CHANNEL_MONITOR_PIPE, pipe);
+       return consumer_send_pipe(consumer_sock, LTTNG_CONSUMER_SET_CHANNEL_MONITOR_PIPE, pipe);
 }
 
 /*
  * Ask the consumer if the data is pending for the specific session id.
  * Returns 1 if data is pending, 0 otherwise, or < 0 on error.
  */
-int consumer_is_data_pending(uint64_t session_id,
-               struct consumer_output *consumer)
+int consumer_is_data_pending(uint64_t session_id, struct consumer_output *consumer)
 {
        int ret;
-       int32_t ret_code = 0;  /* Default is that the data is NOT pending */
+       int32_t ret_code = 0; /* Default is that the data is NOT pending */
        struct consumer_socket *socket;
        struct lttng_ht_iter iter;
        struct lttcomm_consumer_msg msg;
@@ -1278,8 +1270,7 @@ int consumer_is_data_pending(uint64_t session_id,
 
        /* Send command for each consumer */
        rcu_read_lock();
-       cds_lfht_for_each_entry(consumer->socks->ht, &iter.iter, socket,
-                       node.node) {
+       cds_lfht_for_each_entry (consumer->socks->ht, &iter.iter, socket, node.node) {
                pthread_mutex_lock(socket->lock);
                ret = consumer_socket_send(socket, &msg, sizeof(msg));
                if (ret < 0) {
@@ -1306,7 +1297,8 @@ int consumer_is_data_pending(uint64_t session_id,
        rcu_read_unlock();
 
        DBG("Consumer data is %s pending for session id %" PRIu64,
-                       ret_code == 1 ? "" : "NOT", session_id);
+           ret_code == 1 ? "" : "NOT",
+           session_id);
        return ret_code;
 
 error_unlock:
@@ -1384,8 +1376,7 @@ end:
  *
  * Return 0 on success else a negative value.
  */
-int consumer_close_metadata(struct consumer_socket *socket,
-               uint64_t metadata_key)
+int consumer_close_metadata(struct consumer_socket *socket, uint64_t metadata_key)
 {
        int ret;
        struct lttcomm_consumer_msg msg;
@@ -1417,8 +1408,7 @@ end:
  *
  * Return 0 on success else a negative value.
  */
-int consumer_setup_metadata(struct consumer_socket *socket,
-               uint64_t metadata_key)
+int consumer_setup_metadata(struct consumer_socket *socket, uint64_t metadata_key)
 {
        int ret;
        struct lttcomm_consumer_msg msg;
@@ -1452,8 +1442,11 @@ end:
  * Return 0 on success else a negative value.
  */
 int consumer_push_metadata(struct consumer_socket *socket,
-               uint64_t metadata_key, char *metadata_str, size_t len,
-               size_t target_offset, uint64_t version)
+                          uint64_t metadata_key,
+                          char *metadata_str,
+                          size_t len,
+                          size_t target_offset,
+                          uint64_t version)
 {
        int ret;
        struct lttcomm_consumer_msg msg;
@@ -1478,8 +1471,7 @@ int consumer_push_metadata(struct consumer_socket *socket,
                goto end;
        }
 
-       DBG3("Consumer pushing metadata on sock %d of len %zu", *socket->fd_ptr,
-                       len);
+       DBG3("Consumer pushing metadata on sock %d of len %zu", *socket->fd_ptr, len);
 
        ret = consumer_socket_send(socket, metadata_str, len);
        if (ret < 0) {
@@ -1504,9 +1496,11 @@ end:
  * Returns LTTNG_OK on success or else an LTTng error code.
  */
 enum lttng_error_code consumer_snapshot_channel(struct consumer_socket *socket,
-               uint64_t key, const struct consumer_output *output, int metadata,
-               const char *channel_path,
-               uint64_t nb_packets_per_stream)
+                                               uint64_t key,
+                                               const struct consumer_output *output,
+                                               int metadata,
+                                               const char *channel_path,
+                                               uint64_t nb_packets_per_stream)
 {
        int ret;
        enum lttng_error_code status = LTTNG_OK;
@@ -1524,20 +1518,19 @@ enum lttng_error_code consumer_snapshot_channel(struct consumer_socket *socket,
        msg.u.snapshot_channel.metadata = metadata;
 
        if (output->type == CONSUMER_DST_NET) {
-               msg.u.snapshot_channel.relayd_id =
-                               output->net_seq_index;
+               msg.u.snapshot_channel.relayd_id = output->net_seq_index;
                msg.u.snapshot_channel.use_relayd = 1;
        } else {
                msg.u.snapshot_channel.relayd_id = (uint64_t) -1ULL;
        }
        ret = lttng_strncpy(msg.u.snapshot_channel.pathname,
-                       channel_path,
-                       sizeof(msg.u.snapshot_channel.pathname));
+                           channel_path,
+                           sizeof(msg.u.snapshot_channel.pathname));
        if (ret < 0) {
                ERR("Snapshot path exceeds the maximal allowed length of %zu bytes (%zu bytes required) with path \"%s\"",
-                               sizeof(msg.u.snapshot_channel.pathname),
-                               strlen(channel_path),
-                               channel_path);
+                   sizeof(msg.u.snapshot_channel.pathname),
+                   strlen(channel_path),
+                   channel_path);
                status = LTTNG_ERR_SNAPSHOT_FAIL;
                goto error;
        }
@@ -1566,8 +1559,10 @@ error:
 /*
  * Ask the consumer the number of discarded events for a channel.
  */
-int consumer_get_discarded_events(uint64_t session_id, uint64_t channel_key,
-               struct consumer_output *consumer, uint64_t *discarded)
+int consumer_get_discarded_events(uint64_t session_id,
+                                 uint64_t channel_key,
+                                 struct consumer_output *consumer,
+                                 uint64_t *discarded)
 {
        int ret;
        struct consumer_socket *socket;
@@ -1587,8 +1582,7 @@ int consumer_get_discarded_events(uint64_t session_id, uint64_t channel_key,
 
        /* Send command for each consumer */
        rcu_read_lock();
-       cds_lfht_for_each_entry(consumer->socks->ht, &iter.iter, socket,
-                       node.node) {
+       cds_lfht_for_each_entry (consumer->socks->ht, &iter.iter, socket, node.node) {
                uint64_t consumer_discarded = 0;
                pthread_mutex_lock(socket->lock);
                ret = consumer_socket_send(socket, &msg, sizeof(msg));
@@ -1601,8 +1595,7 @@ int consumer_get_discarded_events(uint64_t session_id, uint64_t channel_key,
                 * No need for a recv reply status because the answer to the
                 * command is the reply status message.
                 */
-               ret = consumer_socket_recv(socket, &consumer_discarded,
-                               sizeof(consumer_discarded));
+               ret = consumer_socket_recv(socket, &consumer_discarded, sizeof(consumer_discarded));
                if (ret < 0) {
                        ERR("get discarded events");
                        pthread_mutex_unlock(socket->lock);
@@ -1612,8 +1605,7 @@ int consumer_get_discarded_events(uint64_t session_id, uint64_t channel_key,
                *discarded += consumer_discarded;
        }
        ret = 0;
-       DBG("Consumer discarded %" PRIu64 " events in session id %" PRIu64,
-                       *discarded, session_id);
+       DBG("Consumer discarded %" PRIu64 " events in session id %" PRIu64, *discarded, session_id);
 
 end:
        rcu_read_unlock();
@@ -1623,8 +1615,10 @@ end:
 /*
  * Ask the consumer the number of lost packets for a channel.
  */
-int consumer_get_lost_packets(uint64_t session_id, uint64_t channel_key,
-               struct consumer_output *consumer, uint64_t *lost)
+int consumer_get_lost_packets(uint64_t session_id,
+                             uint64_t channel_key,
+                             struct consumer_output *consumer,
+                             uint64_t *lost)
 {
        int ret;
        struct consumer_socket *socket;
@@ -1644,8 +1638,7 @@ int consumer_get_lost_packets(uint64_t session_id, uint64_t channel_key,
 
        /* Send command for each consumer */
        rcu_read_lock();
-       cds_lfht_for_each_entry(consumer->socks->ht, &iter.iter, socket,
-                       node.node) {
+       cds_lfht_for_each_entry (consumer->socks->ht, &iter.iter, socket, node.node) {
                uint64_t consumer_lost = 0;
                pthread_mutex_lock(socket->lock);
                ret = consumer_socket_send(socket, &msg, sizeof(msg));
@@ -1658,8 +1651,7 @@ int consumer_get_lost_packets(uint64_t session_id, uint64_t channel_key,
                 * No need for a recv reply status because the answer to the
                 * command is the reply status message.
                 */
-               ret = consumer_socket_recv(socket, &consumer_lost,
-                               sizeof(consumer_lost));
+               ret = consumer_socket_recv(socket, &consumer_lost, sizeof(consumer_lost));
                if (ret < 0) {
                        ERR("get lost packets");
                        pthread_mutex_unlock(socket->lock);
@@ -1669,8 +1661,7 @@ int consumer_get_lost_packets(uint64_t session_id, uint64_t channel_key,
                *lost += consumer_lost;
        }
        ret = 0;
-       DBG("Consumer lost %" PRIu64 " packets in session id %" PRIu64,
-                       *lost, session_id);
+       DBG("Consumer lost %" PRIu64 " packets in session id %" PRIu64, *lost, session_id);
 
 end:
        rcu_read_unlock();
@@ -1684,9 +1675,10 @@ end:
  * when the rotation started. On the relay, this allows to keep track in which
  * chunk each stream is currently writing to (for the rotate_pending operation).
  */
-int consumer_rotate_channel(struct consumer_socket *socket, uint64_t key,
-               struct consumer_output *output,
-               bool is_metadata_channel)
+int consumer_rotate_channel(struct consumer_socket *socket,
+                           uint64_t key,
+                           struct consumer_output *output,
+                           bool is_metadata_channel)
 {
        int ret;
        struct lttcomm_consumer_msg msg;
@@ -1781,8 +1773,7 @@ error_socket:
        return ret;
 }
 
-int consumer_init(struct consumer_socket *socket,
-               const lttng_uuid& sessiond_uuid)
+int consumer_init(struct consumer_socket *socket, const lttng_uuid& sessiond_uuid)
 {
        int ret;
        struct lttcomm_consumer_msg msg = {
@@ -1812,9 +1803,10 @@ error:
  * Called with the consumer socket lock held.
  */
 int consumer_create_trace_chunk(struct consumer_socket *socket,
-               uint64_t relayd_id, uint64_t session_id,
-               struct lttng_trace_chunk *chunk,
-               const char *domain_subdir)
+                               uint64_t relayd_id,
+                               uint64_t session_id,
+                               struct lttng_trace_chunk *chunk,
+                               const char *domain_subdir)
 {
        int ret;
        enum lttng_trace_chunk_status chunk_status;
@@ -1840,44 +1832,38 @@ int consumer_create_trace_chunk(struct consumer_socket *socket,
        LTTNG_ASSERT(chunk);
 
        if (relayd_id != -1ULL) {
-               LTTNG_OPTIONAL_SET(&msg.u.create_trace_chunk.relayd_id,
-                               relayd_id);
+               LTTNG_OPTIONAL_SET(&msg.u.create_trace_chunk.relayd_id, relayd_id);
        }
 
-       chunk_status = lttng_trace_chunk_get_name(chunk, &chunk_name,
-                       &chunk_name_overridden);
+       chunk_status = lttng_trace_chunk_get_name(chunk, &chunk_name, &chunk_name_overridden);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK &&
-                       chunk_status != LTTNG_TRACE_CHUNK_STATUS_NONE) {
+           chunk_status != LTTNG_TRACE_CHUNK_STATUS_NONE) {
                ERR("Failed to get name of trace chunk");
                ret = -LTTNG_ERR_FATAL;
                goto error;
        }
        if (chunk_name_overridden) {
                ret = lttng_strncpy(msg.u.create_trace_chunk.override_name,
-                               chunk_name,
-                               sizeof(msg.u.create_trace_chunk.override_name));
+                                   chunk_name,
+                                   sizeof(msg.u.create_trace_chunk.override_name));
                if (ret) {
                        ERR("Trace chunk name \"%s\" exceeds the maximal length allowed by the consumer protocol",
-                                       chunk_name);
+                           chunk_name);
                        ret = -LTTNG_ERR_FATAL;
                        goto error;
                }
        }
 
-       chunk_status = lttng_trace_chunk_get_creation_timestamp(chunk,
-                       &creation_timestamp);
+       chunk_status = lttng_trace_chunk_get_creation_timestamp(chunk, &creation_timestamp);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ret = -LTTNG_ERR_FATAL;
                goto error;
        }
-       msg.u.create_trace_chunk.creation_timestamp =
-                       (uint64_t) creation_timestamp;
+       msg.u.create_trace_chunk.creation_timestamp = (uint64_t) creation_timestamp;
        /* Only used for logging purposes. */
-       ret = time_to_iso8601_str(creation_timestamp,
-                       creation_timestamp_buffer,
-                       sizeof(creation_timestamp_buffer));
-       creation_timestamp_str = !ret ? creation_timestamp_buffer :
-                       "(formatting error)";
+       ret = time_to_iso8601_str(
+               creation_timestamp, creation_timestamp_buffer, sizeof(creation_timestamp_buffer));
+       creation_timestamp_str = !ret ? creation_timestamp_buffer : "(formatting error)";
 
        chunk_status = lttng_trace_chunk_get_id(chunk, &chunk_id);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
@@ -1893,13 +1879,12 @@ int consumer_create_trace_chunk(struct consumer_socket *socket,
 
        if (chunk_has_local_output) {
                chunk_status = lttng_trace_chunk_borrow_chunk_directory_handle(
-                               chunk, &chunk_directory_handle);
+                       chunk, &chunk_directory_handle);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ret = -LTTNG_ERR_FATAL;
                        goto error;
                }
-               chunk_status = lttng_trace_chunk_get_credentials(
-                               chunk, &chunk_credentials);
+               chunk_status = lttng_trace_chunk_get_credentials(chunk, &chunk_credentials);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        /*
                         * Not associating credentials to a sessiond chunk is a
@@ -1908,17 +1893,15 @@ int consumer_create_trace_chunk(struct consumer_socket *socket,
                        ret = -LTTNG_ERR_FATAL;
                        goto error;
                }
-               tc_status = lttng_trace_chunk_create_subdirectory(
-                               chunk, domain_subdir);
+               tc_status = lttng_trace_chunk_create_subdirectory(chunk, domain_subdir);
                if (tc_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        PERROR("Failed to create chunk domain output directory \"%s\"",
-                               domain_subdir);
+                              domain_subdir);
                        ret = -LTTNG_ERR_FATAL;
                        goto error;
                }
-               domain_handle = lttng_directory_handle_create_from_handle(
-                               domain_subdir,
-                               chunk_directory_handle);
+               domain_handle = lttng_directory_handle_create_from_handle(domain_subdir,
+                                                                         chunk_directory_handle);
                if (!domain_handle) {
                        ret = -LTTNG_ERR_FATAL;
                        goto error;
@@ -1932,22 +1915,22 @@ int consumer_create_trace_chunk(struct consumer_socket *socket,
                 * The ownership of the chunk directory handle's is maintained
                 * by the trace chunk.
                 */
-               domain_dirfd = lttng_directory_handle_get_dirfd(
-                               domain_handle);
+               domain_dirfd = lttng_directory_handle_get_dirfd(domain_handle);
                LTTNG_ASSERT(domain_dirfd >= 0);
 
                msg.u.create_trace_chunk.credentials.value.uid =
-                               lttng_credentials_get_uid(&chunk_credentials);
+                       lttng_credentials_get_uid(&chunk_credentials);
                msg.u.create_trace_chunk.credentials.value.gid =
-                               lttng_credentials_get_gid(&chunk_credentials);
+                       lttng_credentials_get_gid(&chunk_credentials);
                msg.u.create_trace_chunk.credentials.is_set = 1;
        }
 
        DBG("Sending consumer create trace chunk command: relayd_id = %" PRId64
-                       ", session_id = %" PRIu64 ", chunk_id = %" PRIu64
-                       ", creation_timestamp = %s",
-                       relayd_id, session_id, chunk_id,
-                       creation_timestamp_str);
+           ", session_id = %" PRIu64 ", chunk_id = %" PRIu64 ", creation_timestamp = %s",
+           relayd_id,
+           session_id,
+           chunk_id,
+           creation_timestamp_str);
        health_code_update();
        ret = consumer_send_msg(socket, &msg);
        health_code_update();
@@ -1979,9 +1962,10 @@ error:
  * Called with the consumer socket lock held.
  */
 int consumer_close_trace_chunk(struct consumer_socket *socket,
-               uint64_t relayd_id, uint64_t session_id,
-               struct lttng_trace_chunk *chunk,
-               char *closed_trace_chunk_path)
+                              uint64_t relayd_id,
+                              uint64_t session_id,
+                              struct lttng_trace_chunk *chunk,
+                              char *closed_trace_chunk_path)
 {
        int ret;
        enum lttng_trace_chunk_status chunk_status;
@@ -2002,16 +1986,14 @@ int consumer_close_trace_chunk(struct consumer_socket *socket,
        lttng_dynamic_buffer_init(&path_reception_buffer);
 
        if (relayd_id != -1ULL) {
-               LTTNG_OPTIONAL_SET(
-                               &msg.u.close_trace_chunk.relayd_id, relayd_id);
+               LTTNG_OPTIONAL_SET(&msg.u.close_trace_chunk.relayd_id, relayd_id);
        }
 
-       chunk_status = lttng_trace_chunk_get_close_command(
-                       chunk, &close_command);
+       chunk_status = lttng_trace_chunk_get_close_command(chunk, &close_command);
        switch (chunk_status) {
        case LTTNG_TRACE_CHUNK_STATUS_OK:
                LTTNG_OPTIONAL_SET(&msg.u.close_trace_chunk.close_command,
-                               (uint32_t) close_command);
+                                  (uint32_t) close_command);
                break;
        case LTTNG_TRACE_CHUNK_STATUS_NONE:
                break;
@@ -2030,8 +2012,7 @@ int consumer_close_trace_chunk(struct consumer_socket *socket,
        LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
        msg.u.close_trace_chunk.chunk_id = chunk_id;
 
-       chunk_status = lttng_trace_chunk_get_close_timestamp(chunk,
-                       &close_timestamp);
+       chunk_status = lttng_trace_chunk_get_close_timestamp(chunk, &close_timestamp);
        /*
         * A trace chunk should be closed locally before being closed remotely.
         * Otherwise, the close timestamp would never be transmitted to the
@@ -2041,13 +2022,14 @@ int consumer_close_trace_chunk(struct consumer_socket *socket,
        msg.u.close_trace_chunk.close_timestamp = (uint64_t) close_timestamp;
 
        if (msg.u.close_trace_chunk.close_command.is_set) {
-               close_command_name = lttng_trace_chunk_command_type_get_name(
-                               close_command);
+               close_command_name = lttng_trace_chunk_command_type_get_name(close_command);
        }
        DBG("Sending consumer close trace chunk command: relayd_id = %" PRId64
-                       ", session_id = %" PRIu64 ", chunk_id = %" PRIu64
-                       ", close command = \"%s\"",
-                       relayd_id, session_id, chunk_id, close_command_name);
+           ", session_id = %" PRIu64 ", chunk_id = %" PRIu64 ", close command = \"%s\"",
+           relayd_id,
+           session_id,
+           chunk_id,
+           close_command_name);
 
        health_code_update();
        ret = consumer_socket_send(socket, &msg, sizeof(struct lttcomm_consumer_msg));
@@ -2061,20 +2043,20 @@ int consumer_close_trace_chunk(struct consumer_socket *socket,
                goto error;
        }
        if (reply.path_length >= LTTNG_PATH_MAX) {
-               ERR("Invalid path returned by relay daemon: %" PRIu32 "bytes exceeds maximal allowed length of %d bytes",
-                               reply.path_length, LTTNG_PATH_MAX);
+               ERR("Invalid path returned by relay daemon: %" PRIu32
+                   "bytes exceeds maximal allowed length of %d bytes",
+                   reply.path_length,
+                   LTTNG_PATH_MAX);
                ret = -LTTNG_ERR_INVALID_PROTOCOL;
                goto error;
        }
-       ret = lttng_dynamic_buffer_set_size(&path_reception_buffer,
-                       reply.path_length);
+       ret = lttng_dynamic_buffer_set_size(&path_reception_buffer, reply.path_length);
        if (ret) {
                ERR("Failed to allocate reception buffer of path returned by the \"close trace chunk\" command");
                ret = -LTTNG_ERR_NOMEM;
                goto error;
        }
-       ret = consumer_socket_recv(socket, path_reception_buffer.data,
-                       path_reception_buffer.size);
+       ret = consumer_socket_recv(socket, path_reception_buffer.data, path_reception_buffer.size);
        if (ret < 0) {
                ERR("Communication error while receiving path of closed trace chunk");
                ret = -LTTNG_ERR_CLOSE_TRACE_CHUNK_FAIL_CONSUMER;
@@ -2090,8 +2072,9 @@ int consumer_close_trace_chunk(struct consumer_socket *socket,
                 * closed_trace_chunk_path is assumed to have a length >=
                 * LTTNG_PATH_MAX
                 */
-               memcpy(closed_trace_chunk_path, path_reception_buffer.data,
-                               path_reception_buffer.size);
+               memcpy(closed_trace_chunk_path,
+                      path_reception_buffer.data,
+                      path_reception_buffer.size);
        }
 error:
        lttng_dynamic_buffer_reset(&path_reception_buffer);
@@ -2106,9 +2089,10 @@ error:
  * Returns 0 on success, or a negative value on error.
  */
 int consumer_trace_chunk_exists(struct consumer_socket *socket,
-               uint64_t relayd_id, uint64_t session_id,
-               struct lttng_trace_chunk *chunk,
-               enum consumer_trace_chunk_exists_status *result)
+                               uint64_t relayd_id,
+                               uint64_t session_id,
+                               struct lttng_trace_chunk *chunk,
+                               enum consumer_trace_chunk_exists_status *result)
 {
        int ret;
        enum lttng_trace_chunk_status chunk_status;
@@ -2124,8 +2108,7 @@ int consumer_trace_chunk_exists(struct consumer_socket *socket,
        LTTNG_ASSERT(socket);
 
        if (relayd_id != -1ULL) {
-               LTTNG_OPTIONAL_SET(&msg.u.trace_chunk_exists.relayd_id,
-                               relayd_id);
+               LTTNG_OPTIONAL_SET(&msg.u.trace_chunk_exists.relayd_id, relayd_id);
        }
 
        chunk_status = lttng_trace_chunk_get_id(chunk, &chunk_id);
@@ -2141,8 +2124,10 @@ int consumer_trace_chunk_exists(struct consumer_socket *socket,
        msg.u.trace_chunk_exists.chunk_id = chunk_id;
 
        DBG("Sending consumer trace chunk exists command: relayd_id = %" PRId64
-                       ", session_id = %" PRIu64
-                       ", chunk_id = %" PRIu64, relayd_id, session_id, chunk_id);
+           ", session_id = %" PRIu64 ", chunk_id = %" PRIu64,
+           relayd_id,
+           session_id,
+           chunk_id);
 
        health_code_update();
        ret = consumer_send_msg(socket, &msg);
@@ -2164,8 +2149,7 @@ int consumer_trace_chunk_exists(struct consumer_socket *socket,
                ret = -1;
                goto error;
        }
-       DBG("Consumer reply to TRACE_CHUNK_EXISTS command: %s",
-                       consumer_reply_str);
+       DBG("Consumer reply to TRACE_CHUNK_EXISTS command: %s", consumer_reply_str);
        ret = 0;
 error:
        health_code_update();
index 8dc82fbe82e70b538d41c2df88a1deb377df9412..cccf1c0d51b0bf80a3cad888ebae128cd4102c4c 100644 (file)
@@ -7,28 +7,28 @@
  */
 
 #define _LGPL_SOURCE
+#include "agent.hpp"
+#include "context.hpp"
+#include "kernel.hpp"
+#include "trace-ust.hpp"
+#include "ust-app.hpp"
+
+#include <common/error.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <urcu/list.h>
 
-#include <common/error.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-
-#include "context.hpp"
-#include "kernel.hpp"
-#include "ust-app.hpp"
-#include "trace-ust.hpp"
-#include "agent.hpp"
-
 /*
  * Add kernel context to all channel.
  *
  * Assumes the ownership of kctx.
  */
 static int add_kctx_all_channels(struct ltt_kernel_session *ksession,
-               struct ltt_kernel_context *kctx)
+                                struct ltt_kernel_context *kctx)
 {
        int ret;
        struct ltt_kernel_channel *kchan;
@@ -39,7 +39,7 @@ static int add_kctx_all_channels(struct ltt_kernel_session *ksession,
        DBG("Adding kernel context to all channels");
 
        /* Go over all channels */
-       cds_list_for_each_entry(kchan, &ksession->channel_list.head, list) {
+       cds_list_for_each_entry (kchan, &ksession->channel_list.head, list) {
                struct ltt_kernel_context *kctx_copy;
 
                kctx_copy = trace_kernel_copy_context(kctx);
@@ -69,8 +69,7 @@ error:
  *
  * Assumes the ownership of kctx.
  */
-static int add_kctx_to_channel(struct ltt_kernel_context *kctx,
-               struct ltt_kernel_channel *kchan)
+static int add_kctx_to_channel(struct ltt_kernel_context *kctx, struct ltt_kernel_channel *kchan)
 {
        int ret;
 
@@ -96,9 +95,9 @@ error:
  * Add UST context to channel.
  */
 static int add_uctx_to_channel(struct ltt_ust_session *usess,
-               enum lttng_domain_type domain,
-               struct ltt_ust_channel *uchan,
-               const struct lttng_event_context *ctx)
+                              enum lttng_domain_type domain,
+                              struct ltt_ust_channel *uchan,
+                              const struct lttng_event_context *ctx)
 {
        int ret;
        struct ltt_ust_context *uctx = NULL;
@@ -108,7 +107,7 @@ static int add_uctx_to_channel(struct ltt_ust_session *usess,
        LTTNG_ASSERT(ctx);
 
        /* Check if context is duplicate */
-       cds_list_for_each_entry(uctx, &uchan->ctx_list, list) {
+       cds_list_for_each_entry (uctx, &uchan->ctx_list, list) {
                if (trace_ust_match_context(uctx, ctx)) {
                        ret = LTTNG_ERR_UST_CONTEXT_EXIST;
                        goto duplicate;
@@ -187,8 +186,8 @@ duplicate:
  * Add kernel context to tracer.
  */
 int context_kernel_add(struct ltt_kernel_session *ksession,
-               const struct lttng_event_context *ctx,
-               const char *channel_name)
+                      const struct lttng_event_context *ctx,
+                      const char *channel_name)
 {
        int ret;
        struct ltt_kernel_channel *kchan;
@@ -325,8 +324,7 @@ int context_kernel_add(struct ltt_kernel_session *ksession,
 
        kctx->ctx.u.perf_counter.type = ctx->u.perf_counter.type;
        kctx->ctx.u.perf_counter.config = ctx->u.perf_counter.config;
-       strncpy(kctx->ctx.u.perf_counter.name, ctx->u.perf_counter.name,
-                       LTTNG_SYMBOL_NAME_LEN);
+       strncpy(kctx->ctx.u.perf_counter.name, ctx->u.perf_counter.name, LTTNG_SYMBOL_NAME_LEN);
        kctx->ctx.u.perf_counter.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
 
        if (*channel_name == '\0') {
@@ -365,9 +363,9 @@ error:
  * Add UST context to tracer.
  */
 int context_ust_add(struct ltt_ust_session *usess,
-               enum lttng_domain_type domain,
-               const struct lttng_event_context *ctx,
-               const char *channel_name)
+                   enum lttng_domain_type domain,
+                   const struct lttng_event_context *ctx,
+                   const char *channel_name)
 {
        int ret = LTTNG_OK;
        struct lttng_ht_iter iter;
@@ -397,11 +395,10 @@ int context_ust_add(struct ltt_ust_session *usess,
        } else {
                rcu_read_lock();
                /* Add ctx all events, all channels */
-               cds_lfht_for_each_entry(chan_ht->ht, &iter.iter, uchan, node.node) {
+               cds_lfht_for_each_entry (chan_ht->ht, &iter.iter, uchan, node.node) {
                        ret = add_uctx_to_channel(usess, domain, uchan, ctx);
                        if (ret) {
-                               ERR("Failed to add context to channel %s",
-                                               uchan->name);
+                               ERR("Failed to add context to channel %s", uchan->name);
                                continue;
                        }
                }
index 6a6248504d8a86152ab3c14973ebe0ded438959c..2f583cdf89525d382a5d5a9d9b13efc33af4b0b8 100644 (file)
@@ -6,8 +6,8 @@
  *
  */
 
-#include "ctf2-trace-class-visitor.hpp"
 #include "clock-class.hpp"
+#include "ctf2-trace-class-visitor.hpp"
 
 #include <common/exception.hpp>
 #include <common/format.hpp>
@@ -27,10 +27,10 @@ const std::string record_separator = "\x1e";
 
 json::json make_json_fragment(const char *type)
 {
-       return {{"type", type}};
+       return { { "type", type } };
 }
 
-json::json to_json(const lst::field_location &location)
+json::json to_json(const lst::field_locationlocation)
 {
        json::json location_array;
 
@@ -55,8 +55,9 @@ json::json to_json(const lst::field_location &location)
                break;
        }
 
-       std::copy(location.elements_.begin(), location.elements_.end(),
-                       std::back_inserter(location_array));
+       std::copy(location.elements_.begin(),
+                 location.elements_.end(),
+                 std::back_inserter(location_array));
        return location_array;
 }
 
@@ -157,12 +158,12 @@ private:
        virtual void visit(const lst::integer_type& type) override final
        {
                _fragment["type"] = type.signedness_ == lst::integer_type::signedness::SIGNED ?
-                               "fixed-length-signed-integer" :
-                               "fixed-length-unsigned-integer";
+                       "fixed-length-signed-integer" :
+                       "fixed-length-unsigned-integer";
                _fragment["length"] = type.size;
                _fragment["byte-order"] = type.byte_order == lst::byte_order::BIG_ENDIAN_ ?
-                               "big-endian" :
-                               "little-endian";
+                       "big-endian" :
+                       "little-endian";
                _fragment["alignment"] = type.alignment;
                _fragment["preferred-display-base"] = (unsigned int) type.base_;
 
@@ -182,30 +183,32 @@ private:
                _fragment["type"] = "fixed-length-floating-point-number";
                _fragment["length"] = type.exponent_digits + type.mantissa_digits;
                _fragment["byte-order"] = type.byte_order == lst::byte_order::BIG_ENDIAN_ ?
-                               "big-endian" :
-                               "little-endian";
+                       "big-endian" :
+                       "little-endian";
                _fragment["alignment"] = type.alignment;
        }
 
        template <class EnumerationType>
        void visit_enumeration(const EnumerationType& type)
        {
-               _fragment["type"] = std::is_signed<typename EnumerationType::mapping::range_t::range_integer_t>::value ?
-                               "fixed-length-signed-enumeration" :
-                               "fixed-length-unsigned-enumeration";
+               _fragment["type"] =
+                       std::is_signed<
+                               typename EnumerationType::mapping::range_t::range_integer_t>::value ?
+                       "fixed-length-signed-enumeration" :
+                       "fixed-length-unsigned-enumeration";
                _fragment["length"] = type.size;
                _fragment["byte-order"] = type.byte_order == lst::byte_order::BIG_ENDIAN_ ?
-                               "big-endian" :
-                               "little-endian";
+                       "big-endian" :
+                       "little-endian";
                _fragment["alignment"] = type.alignment;
                _fragment["preferred-display-base"] = (unsigned int) type.base_;
 
                if (type.roles_.size() > 0) {
                        if (std::is_signed<typename EnumerationType::mapping::range_t::
-                                                           range_integer_t>::value) {
-                               LTTNG_THROW_ERROR(fmt::format(
-                                               "Failed to serialize {}: unexpected role",
-                                               _fragment["type"]));
+                                                  range_integer_t>::value) {
+                               LTTNG_THROW_ERROR(
+                                       fmt::format("Failed to serialize {}: unexpected role",
+                                                   _fragment["type"]));
                        }
 
                        auto role_array = json::json::array();
@@ -219,13 +222,14 @@ private:
 
                if (type.mappings_->size() < 1) {
                        LTTNG_THROW_ERROR(fmt::format(
-                                       "Failed to serialize {}: enumeration must have at least one mapping",
-                                       _fragment["type"]));
+                               "Failed to serialize {}: enumeration must have at least one mapping",
+                               _fragment["type"]));
                }
 
                json::json mappings_value;
-               for (const auto &mapping : *type.mappings_) {
-                       mappings_value[mapping.name] = {{mapping.range.begin, mapping.range.end}};
+               for (const auto& mapping : *type.mappings_) {
+                       mappings_value[mapping.name] = { { mapping.range.begin,
+                                                          mapping.range.end } };
                }
 
                _fragment["mappings"] = std::move(mappings_value);
@@ -294,7 +298,7 @@ private:
        }
 
        virtual void visit(const lst::null_terminated_string_type& type
-                       __attribute__((unused))) override final
+                          __attribute__((unused))) override final
        {
                _fragment["type"] = "null-terminated-string";
        }
@@ -308,7 +312,7 @@ private:
                }
 
                auto member_classes_value = json::json::array();
-               for (const auto &field : type.fields_) {
+               for (const autofield : type.fields_) {
                        ::ctf2::field_visitor member_visitor;
                        json::json member_class;
 
@@ -331,7 +335,8 @@ private:
                        json::json member_class;
 
                        /* TODO missing selector-field-range. */
-                       member_class["selector-field-ranges"] = {{option.first.range.begin, option.first.range.end}};
+                       member_class["selector-field-ranges"] = { { option.first.range.begin,
+                                                                   option.first.range.end } };
                        option.second->accept(option_visitor);
                        member_class["field-class"] = option_visitor.move_fragment();
                        options_value.emplace_back(std::move(member_class));
@@ -369,7 +374,7 @@ private:
 }; /* namespace */
 
 lsc::trace_class_visitor::trace_class_visitor(
-               lsc::append_metadata_fragment_function append_metadata_fragment) :
+       lsc::append_metadata_fragment_function append_metadata_fragment) :
        _append_metadata_fragment(append_metadata_fragment)
 {
 }
@@ -403,17 +408,16 @@ void lsc::trace_class_visitor::visit(const lst::trace_class& trace_class)
 
 void lsc::trace_class_visitor::visit(const lst::clock_class& clock_class)
 {
-        auto clock_class_fragment = make_json_fragment("clock-class");
+       auto clock_class_fragment = make_json_fragment("clock-class");
 
        json::json offset;
-       offset.update({{"seconds", clock_class.offset / clock_class.frequency},
-                       {"cycles", clock_class.offset % clock_class.frequency}});
+       offset.update({ { "seconds", clock_class.offset / clock_class.frequency },
+                       { "cycles", clock_class.offset % clock_class.frequency } });
 
-       clock_class_fragment.update({
-               {"name", clock_class.name},
-               {"description", clock_class.description},
-               {"frequency", clock_class.frequency},
-               {"offset", std::move(offset)}});
+       clock_class_fragment.update({ { "name", clock_class.name },
+                                     { "description", clock_class.description },
+                                     { "frequency", clock_class.frequency },
+                                     { "offset", std::move(offset) } });
 
        if (clock_class.uuid) {
                clock_class_fragment["uuid"] = *clock_class.uuid;
@@ -429,7 +433,7 @@ void lsc::trace_class_visitor::visit(const lst::stream_class& stream_class)
        stream_class_fragment["id"] = stream_class.id;
        if (stream_class.default_clock_class_name) {
                stream_class_fragment["default-clock-class-name"] =
-                               *stream_class.default_clock_class_name;
+                       *stream_class.default_clock_class_name;
        }
 
        const auto packet_context = stream_class.packet_context();
@@ -445,8 +449,7 @@ void lsc::trace_class_visitor::visit(const lst::stream_class& stream_class)
                ::ctf2::field_visitor visitor;
 
                event_header->accept(visitor);
-               stream_class_fragment["event-record-header-field-class"] =
-                               visitor.move_fragment();
+               stream_class_fragment["event-record-header-field-class"] = visitor.move_fragment();
        }
 
        const auto event_context = stream_class.event_context();
@@ -455,7 +458,7 @@ void lsc::trace_class_visitor::visit(const lst::stream_class& stream_class)
 
                event_context->accept(visitor);
                stream_class_fragment["event-record-common-context-field-class"] =
-                               visitor.move_fragment();
+                       visitor.move_fragment();
        }
 
        append_metadata_fragment(stream_class_fragment);
index a8e8d6c8d44d48f3b712ceac08129fc86d0ac316..cc2c7eb0ddb51aa18d74384c827f8e97a8b59012 100644 (file)
@@ -7,19 +7,20 @@
  *
  */
 
-#include <stddef.h>
-#include <stdlib.h>
-#include <urcu.h>
-#include <common/futex.hpp>
-#include <common/macros.hpp>
-
 #include "dispatch.hpp"
-#include "ust-app.hpp"
-#include "testpoint.hpp"
 #include "fd-limit.hpp"
 #include "health-sessiond.hpp"
 #include "lttng-sessiond.hpp"
+#include "testpoint.hpp"
 #include "thread.hpp"
+#include "ust-app.hpp"
+
+#include <common/futex.hpp>
+#include <common/macros.hpp>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <urcu.h>
 
 namespace {
 struct thread_notifiers {
@@ -55,8 +56,7 @@ static void update_ust_app(int app_sock)
                 * this is possible hence simply stopping the
                 * update.
                 */
-               DBG3("UST app update failed to find app sock %d",
-                       app_sock);
+               DBG3("UST app update failed to find app sock %d", app_sock);
                goto unlock_rcu;
        }
 
@@ -64,13 +64,12 @@ static void update_ust_app(int app_sock)
        ust_app_global_update_event_notifier_rules(app);
 
        /* For all tracing session(s) */
-       cds_list_for_each_entry_safe(sess, stmp, &session_list->head, list) {
+       cds_list_for_each_entry_safe (sess, stmp, &session_list->head, list) {
                if (!session_get(sess)) {
                        continue;
                }
                session_lock(sess);
-               if (!sess->active || !sess->ust_session ||
-                               !sess->ust_session->active) {
+               if (!sess->active || !sess->ust_session || !sess->ust_session->active) {
                        goto unlock_session;
                }
 
@@ -110,8 +109,7 @@ static void sanitize_wait_queue(struct ust_reg_wait_queue *wait_queue)
                goto error_create;
        }
 
-       cds_list_for_each_entry_safe(wait_node, tmp_wait_node,
-                       &wait_queue->head, head) {
+       cds_list_for_each_entry_safe (wait_node, tmp_wait_node, &wait_queue->head, head) {
                LTTNG_ASSERT(wait_node->app);
                ret = lttng_poll_add(&events, wait_node->app->sock, LPOLLIN);
                if (ret < 0) {
@@ -140,10 +138,8 @@ static void sanitize_wait_queue(struct ust_reg_wait_queue *wait_queue)
                uint32_t revents = LTTNG_POLL_GETEV(&events, i);
                int pollfd = LTTNG_POLL_GETFD(&events, i);
 
-               cds_list_for_each_entry_safe(wait_node, tmp_wait_node,
-                               &wait_queue->head, head) {
-                       if (pollfd == wait_node->app->sock &&
-                                       (revents & (LPOLLHUP | LPOLLERR))) {
+               cds_list_for_each_entry_safe (wait_node, tmp_wait_node, &wait_queue->head, head) {
+                       if (pollfd == wait_node->app->sock && (revents & (LPOLLHUP | LPOLLERR))) {
                                cds_list_del(&wait_node->head);
                                wait_queue->count--;
                                ust_app_destroy(wait_node->app);
@@ -238,8 +234,7 @@ static void *thread_dispatch_ust_registration(void *data)
 
        rcu_register_thread();
 
-       health_register(the_health_sessiond,
-                       HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH);
+       health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH);
 
        if (testpoint(sessiond_thread_app_reg_dispatch)) {
                goto error_testpoint;
@@ -274,9 +269,8 @@ static void *thread_dispatch_ust_registration(void *data)
 
                        health_code_update();
                        /* Dequeue command for registration */
-                       node = cds_wfcq_dequeue_blocking(
-                                       &notifiers->ust_cmd_queue->head,
-                                       &notifiers->ust_cmd_queue->tail);
+                       node = cds_wfcq_dequeue_blocking(&notifiers->ust_cmd_queue->head,
+                                                        &notifiers->ust_cmd_queue->tail);
                        if (node == NULL) {
                                DBG("Woken up but nothing in the UST command queue");
                                /* Continue thread execution */
@@ -286,11 +280,15 @@ static void *thread_dispatch_ust_registration(void *data)
                        ust_cmd = lttng::utils::container_of(node, &ust_command::node);
 
                        DBG("Dispatching UST registration pid:%d ppid:%d uid:%d"
-                                       " gid:%d sock:%d name:%s (version %d.%d)",
-                                       ust_cmd->reg_msg.pid, ust_cmd->reg_msg.ppid,
-                                       ust_cmd->reg_msg.uid, ust_cmd->reg_msg.gid,
-                                       ust_cmd->sock, ust_cmd->reg_msg.name,
-                                       ust_cmd->reg_msg.major, ust_cmd->reg_msg.minor);
+                           " gid:%d sock:%d name:%s (version %d.%d)",
+                           ust_cmd->reg_msg.pid,
+                           ust_cmd->reg_msg.ppid,
+                           ust_cmd->reg_msg.uid,
+                           ust_cmd->reg_msg.gid,
+                           ust_cmd->sock,
+                           ust_cmd->reg_msg.name,
+                           ust_cmd->reg_msg.major,
+                           ust_cmd->reg_msg.minor);
 
                        if (ust_cmd->reg_msg.type == LTTNG_UST_CTL_SOCKET_CMD) {
                                wait_node = zmalloc<ust_reg_wait_node>();
@@ -308,8 +306,7 @@ static void *thread_dispatch_ust_registration(void *data)
                                CDS_INIT_LIST_HEAD(&wait_node->head);
 
                                /* Create application object if socket is CMD. */
-                               wait_node->app = ust_app_create(&ust_cmd->reg_msg,
-                                               ust_cmd->sock);
+                               wait_node->app = ust_app_create(&ust_cmd->reg_msg, ust_cmd->sock);
                                if (!wait_node->app) {
                                        ret = close(ust_cmd->sock);
                                        if (ret < 0) {
@@ -342,8 +339,8 @@ static void *thread_dispatch_ust_registration(void *data)
                                 * Look for the application in the local wait queue and set the
                                 * notify socket if found.
                                 */
-                               cds_list_for_each_entry_safe(wait_node, tmp_wait_node,
-                                               &wait_queue.head, head) {
+                               cds_list_for_each_entry_safe (
+                                       wait_node, tmp_wait_node, &wait_queue.head, head) {
                                        health_code_update();
                                        if (wait_node->app->pid == ust_cmd->reg_msg.pid) {
                                                wait_node->app->notify_sock = ust_cmd->sock;
@@ -352,7 +349,8 @@ static void *thread_dispatch_ust_registration(void *data)
                                                app = wait_node->app;
                                                free(wait_node);
                                                wait_node = NULL;
-                                               DBG3("UST app notify socket %d is set", ust_cmd->sock);
+                                               DBG3("UST app notify socket %d is set",
+                                                    ust_cmd->sock);
                                                break;
                                        }
                                }
@@ -398,8 +396,7 @@ static void *thread_dispatch_ust_registration(void *data)
 
                                /* Send notify socket through the notify pipe. */
                                ret = send_socket_to_thread(
-                                               notifiers->apps_cmd_notify_pipe_write_fd,
-                                               app->notify_sock);
+                                       notifiers->apps_cmd_notify_pipe_write_fd, app->notify_sock);
                                if (ret < 0) {
                                        rcu_read_unlock();
                                        session_unlock_list();
@@ -429,9 +426,8 @@ static void *thread_dispatch_ust_registration(void *data)
                                 * to the thread and unregistration will take place at that
                                 * place.
                                 */
-                               ret = send_socket_to_thread(
-                                               notifiers->apps_cmd_pipe_write_fd,
-                                               app->sock);
+                               ret = send_socket_to_thread(notifiers->apps_cmd_pipe_write_fd,
+                                                           app->sock);
                                if (ret < 0) {
                                        rcu_read_unlock();
                                        session_unlock_list();
@@ -459,8 +455,7 @@ static void *thread_dispatch_ust_registration(void *data)
 
 error:
        /* Clean up wait queue. */
-       cds_list_for_each_entry_safe(wait_node, tmp_wait_node,
-                       &wait_queue.head, head) {
+       cds_list_for_each_entry_safe (wait_node, tmp_wait_node, &wait_queue.head, head) {
                cds_list_del(&wait_node->head);
                wait_queue.count--;
                free(wait_node);
@@ -469,9 +464,8 @@ error:
        /* Empty command queue. */
        for (;;) {
                /* Dequeue command for registration */
-               node = cds_wfcq_dequeue_blocking(
-                               &notifiers->ust_cmd_queue->head,
-                               &notifiers->ust_cmd_queue->tail);
+               node = cds_wfcq_dequeue_blocking(&notifiers->ust_cmd_queue->head,
+                                                &notifiers->ust_cmd_queue->tail);
                if (node == NULL) {
                        break;
                }
@@ -505,8 +499,8 @@ static bool shutdown_ust_dispatch_thread(void *data)
 }
 
 bool launch_ust_dispatch_thread(struct ust_cmd_queue *cmd_queue,
-               int apps_cmd_pipe_write_fd,
-               int apps_cmd_notify_pipe_write_fd)
+                               int apps_cmd_pipe_write_fd,
+                               int apps_cmd_notify_pipe_write_fd)
 {
        struct lttng_thread *thread;
        struct thread_notifiers *notifiers;
@@ -520,10 +514,10 @@ bool launch_ust_dispatch_thread(struct ust_cmd_queue *cmd_queue,
        notifiers->apps_cmd_notify_pipe_write_fd = apps_cmd_notify_pipe_write_fd;
 
        thread = lttng_thread_create("UST registration dispatch",
-                       thread_dispatch_ust_registration,
-                       shutdown_ust_dispatch_thread,
-                       cleanup_ust_dispatch_thread,
-                       notifiers);
+                                    thread_dispatch_ust_registration,
+                                    shutdown_ust_dispatch_thread,
+                                    cleanup_ust_dispatch_thread,
+                                    notifiers);
        if (!thread) {
                goto error;
        }
index f5c7341b6799f3eef94ae721820d3397e647f744..19dceb4ad9d4806827ca8874dbe3c8dffab38862 100644 (file)
 namespace lst = lttng::sessiond::trace;
 
 lst::event_class::event_class(unsigned int in_id,
-               unsigned int in_stream_class_id,
-               int in_log_level,
-               std::string in_name,
-               nonstd::optional<std::string> in_model_emf_uri,
-               lttng::sessiond::trace::type::cuptr in_payload) :
-       id{in_id},
-       stream_class_id{in_stream_class_id},
-       log_level{in_log_level},
-       name{std::move(in_name)},
-       model_emf_uri{std::move(in_model_emf_uri)},
-       payload{std::move(in_payload)}
+                             unsigned int in_stream_class_id,
+                             int in_log_level,
+                             std::string in_name,
+                             nonstd::optional<std::string> in_model_emf_uri,
+                             lttng::sessiond::trace::type::cuptr in_payload) :
+       id{ in_id },
+       stream_class_id{ in_stream_class_id },
+       log_level{ in_log_level },
+       name{ std::move(in_name) },
+       model_emf_uri{ std::move(in_model_emf_uri) },
+       payload{ std::move(in_payload) }
 {
 }
 
index 85327c2167b648d38541dcb282cdf2ca613f7908..93ecca853af7a4ecdf76f841f499d7a9072273a1 100644 (file)
@@ -5,23 +5,24 @@
  *
  */
 
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <urcu/compiler.h>
-#include <pthread.h>
+#include "event-notifier-error-accounting.hpp"
+#include "lttng-ust-error.hpp"
+#include "ust-app.hpp"
 
 #include <common/error.hpp>
 #include <common/hashtable/hashtable.hpp>
 #include <common/index-allocator.hpp>
 #include <common/kernel-ctl/kernel-ctl.hpp>
 #include <common/shm.hpp>
+
 #include <lttng/trigger/trigger-internal.hpp>
 
-#include "event-notifier-error-accounting.hpp"
-#include "lttng-ust-error.hpp"
-#include "ust-app.hpp"
+#include <fcntl.h>
+#include <pthread.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <urcu/compiler.h>
 
 #define ERROR_COUNTER_INDEX_HT_INITIAL_SIZE 16
 
@@ -71,8 +72,8 @@ struct error_accounting_state kernel_state;
 } /* namespace */
 
 static inline void get_trigger_info_for_log(const struct lttng_trigger *trigger,
-               const char **trigger_name,
-               uid_t *trigger_owner_uid)
+                                           const char **trigger_name,
+                                           uid_t *trigger_owner_uid)
 {
        enum lttng_trigger_status trigger_status;
 
@@ -87,14 +88,12 @@ static inline void get_trigger_info_for_log(const struct lttng_trigger *trigger,
                abort();
        }
 
-       trigger_status = lttng_trigger_get_owner_uid(trigger,
-                       trigger_owner_uid);
+       trigger_status = lttng_trigger_get_owner_uid(trigger, trigger_owner_uid);
        LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 }
 
-static inline
-const char *error_accounting_status_str(
-               enum event_notifier_error_accounting_status status)
+static inline const char *
+error_accounting_status_str(enum event_notifier_error_accounting_status status)
 {
        switch (status) {
        case EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK:
@@ -128,7 +127,7 @@ static void free_ust_error_accounting_entry(struct rcu_head *head)
 {
        int i;
        struct ust_error_accounting_entry *entry =
-                       lttng::utils::container_of(head, &ust_error_accounting_entry::rcu_head);
+               lttng::utils::container_of(head, &ust_error_accounting_entry::rcu_head);
 
        for (i = 0; i < entry->nr_counter_cpu_fds; i++) {
                lttng_ust_ctl_release_object(-1, entry->cpu_counters[i]);
@@ -145,17 +144,15 @@ static void free_ust_error_accounting_entry(struct rcu_head *head)
        free(entry);
 }
 
-static
-bool ust_error_accounting_entry_get(struct ust_error_accounting_entry *entry)
+static bool ust_error_accounting_entry_get(struct ust_error_accounting_entry *entry)
 {
        return urcu_ref_get_unless_zero(&entry->ref);
 }
 
-static
-void ust_error_accounting_entry_release(struct urcu_ref *entry_ref)
+static void ust_error_accounting_entry_release(struct urcu_ref *entry_ref)
 {
        struct ust_error_accounting_entry *entry =
-                       lttng::utils::container_of(entry_ref, &ust_error_accounting_entry::ref);
+               lttng::utils::container_of(entry_ref, &ust_error_accounting_entry::ref);
 
        rcu_read_lock();
        cds_lfht_del(error_counter_uid_ht->ht, &entry->node.node);
@@ -163,9 +160,7 @@ void ust_error_accounting_entry_release(struct urcu_ref *entry_ref)
        rcu_read_unlock();
 }
 
-
-static
-void ust_error_accounting_entry_put(struct ust_error_accounting_entry *entry)
+static void ust_error_accounting_entry_put(struct ust_error_accounting_entry *entry)
 {
        if (!entry) {
                return;
@@ -177,8 +172,7 @@ void ust_error_accounting_entry_put(struct ust_error_accounting_entry *entry)
 /*
  * Put one reference to every UID entries.
  */
-static
-void put_ref_all_ust_error_accounting_entry(void)
+static void put_ref_all_ust_error_accounting_entry(void)
 {
        struct lttng_ht_iter iter;
        struct ust_error_accounting_entry *uid_entry;
@@ -186,9 +180,8 @@ void put_ref_all_ust_error_accounting_entry(void)
        ASSERT_LOCKED(the_event_notifier_counter.lock);
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(error_counter_uid_ht->ht, &iter.iter,
-                       uid_entry, node.node) {
-               ust_error_accounting_entry_put(uid_entry);
+       cds_lfht_for_each_entry (error_counter_uid_ht->ht, &iter.iter, uid_entry, node.node) {
+               ust_error_accounting_entry_put(uid_entry);
        }
 
        rcu_read_unlock();
@@ -197,8 +190,7 @@ void put_ref_all_ust_error_accounting_entry(void)
 /*
  * Get one reference to every UID entries.
  */
-static
-void get_ref_all_ust_error_accounting_entry(void)
+static void get_ref_all_ust_error_accounting_entry(void)
 {
        struct lttng_ht_iter iter;
        struct ust_error_accounting_entry *uid_entry;
@@ -206,9 +198,8 @@ void get_ref_all_ust_error_accounting_entry(void)
        ASSERT_LOCKED(the_event_notifier_counter.lock);
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(error_counter_uid_ht->ht, &iter.iter,
-                       uid_entry, node.node) {
-               ust_error_accounting_entry_get(uid_entry);
+       cds_lfht_for_each_entry (error_counter_uid_ht->ht, &iter.iter, uid_entry, node.node) {
+               ust_error_accounting_entry_get(uid_entry);
        }
 
        rcu_read_unlock();
@@ -216,10 +207,8 @@ void get_ref_all_ust_error_accounting_entry(void)
 
 #endif /* HAVE_LIBLTTNG_UST_CTL */
 
-static
-enum event_notifier_error_accounting_status
-init_error_accounting_state(struct error_accounting_state *state,
-               uint64_t index_count)
+static enum event_notifier_error_accounting_status
+init_error_accounting_state(struct error_accounting_state *state, uint64_t index_count)
 {
        enum event_notifier_error_accounting_status status;
 
@@ -234,8 +223,7 @@ init_error_accounting_state(struct error_accounting_state *state,
                goto end;
        }
 
-       state->indices_ht = lttng_ht_new(ERROR_COUNTER_INDEX_HT_INITIAL_SIZE,
-                       LTTNG_HT_TYPE_U64);
+       state->indices_ht = lttng_ht_new(ERROR_COUNTER_INDEX_HT_INITIAL_SIZE, LTTNG_HT_TYPE_U64);
        if (!state->indices_ht) {
                ERR("Failed to allocate error counter indices hash table");
                status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NOMEM;
@@ -252,8 +240,7 @@ end:
        return status;
 }
 
-static
-void fini_error_accounting_state(struct error_accounting_state *state)
+static void fini_error_accounting_state(struct error_accounting_state *state)
 {
        LTTNG_ASSERT(state);
 
@@ -266,27 +253,25 @@ void fini_error_accounting_state(struct error_accounting_state *state)
 }
 
 enum event_notifier_error_accounting_status
-event_notifier_error_accounting_init(uint64_t buffer_size_kernel,
-               uint64_t buffer_size_ust)
+event_notifier_error_accounting_init(uint64_t buffer_size_kernel, uint64_t buffer_size_ust)
 {
        enum event_notifier_error_accounting_status status;
 
        status = init_error_accounting_state(&kernel_state, buffer_size_kernel);
        if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
                ERR("Failed to initialize kernel event notifier accounting state: status = %s",
-                               error_accounting_status_str(status));
+                   error_accounting_status_str(status));
                goto end;
        }
 
        status = init_error_accounting_state(&ust_state, buffer_size_ust);
        if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
                ERR("Failed to initialize UST event notifier accounting state: status = %s",
-                               error_accounting_status_str(status));
+                   error_accounting_status_str(status));
                goto error_ust_state;
        }
 
-       error_counter_uid_ht = lttng_ht_new(
-                       ERROR_COUNTER_INDEX_HT_INITIAL_SIZE, LTTNG_HT_TYPE_U64);
+       error_counter_uid_ht = lttng_ht_new(ERROR_COUNTER_INDEX_HT_INITIAL_SIZE, LTTNG_HT_TYPE_U64);
        if (!error_counter_uid_ht) {
                ERR("Failed to allocate UID to error counter accountant hash table");
                status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NOMEM;
@@ -308,10 +293,8 @@ end:
  * Return the error counteur index associated to this event notifier tracer
  * token. Returns _STATUS_OK if found and _STATUS_NOT_FOUND otherwise.
  */
-static
-enum event_notifier_error_accounting_status get_error_counter_index_for_token(
-               struct error_accounting_state *state, uint64_t tracer_token,
-               uint64_t *error_counter_index)
+static enum event_notifier_error_accounting_status get_error_counter_index_for_token(
+       struct error_accounting_state *state, uint64_t tracer_token, uint64_t *error_counter_index)
 {
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
@@ -338,9 +321,8 @@ enum event_notifier_error_accounting_status get_error_counter_index_for_token(
  * Find the entry for this app's UID, the caller acquires a reference if the
  * entry is found.
  */
-static
-struct ust_error_accounting_entry *ust_error_accounting_entry_find(
-               struct lttng_ht *uid_ht, const struct ust_app *app)
+static struct ust_error_accounting_entry *ust_error_accounting_entry_find(struct lttng_ht *uid_ht,
+                                                                         const struct ust_app *app)
 {
        struct ust_error_accounting_entry *entry;
        struct lttng_ht_node_u64 *node;
@@ -349,13 +331,12 @@ struct ust_error_accounting_entry *ust_error_accounting_entry_find(
 
        lttng_ht_lookup(uid_ht, &key, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
-       if(node == NULL) {
+       if (node == NULL) {
                entry = NULL;
        } else {
                bool got_ref;
 
-               entry = caa_container_of(node,
-                               struct ust_error_accounting_entry, node);
+               entry = caa_container_of(node, struct ust_error_accounting_entry, node);
 
                got_ref = ust_error_accounting_entry_get(entry);
                if (!got_ref) {
@@ -370,9 +351,8 @@ struct ust_error_accounting_entry *ust_error_accounting_entry_find(
  * Create the entry for this app's UID, the caller acquires a reference to the
  * entry,
  */
-static
-struct ust_error_accounting_entry *ust_error_accounting_entry_create(
-               const struct ust_app *app)
+static struct ust_error_accounting_entry *
+ust_error_accounting_entry_create(const struct ust_app *app)
 {
        int i, ret, *cpu_counter_fds = NULL;
        struct lttng_ust_ctl_daemon_counter *daemon_counter;
@@ -386,7 +366,8 @@ struct ust_error_accounting_entry *ust_error_accounting_entry_create(
 
        if (!ust_app_supports_counters(app)) {
                DBG("Refusing to create accounting entry for application (unsupported feature): app name = '%s', app ppid = %d",
-                               app->name, (int) app->ppid);
+                   app->name,
+                   (int) app->ppid);
                goto error;
        }
 
@@ -403,8 +384,10 @@ struct ust_error_accounting_entry *ust_error_accounting_entry_create(
        cpu_counter_fds = calloc<int>(entry->nr_counter_cpu_fds);
        if (!cpu_counter_fds) {
                PERROR("Failed to allocate event notifier error counter file descriptors array: application uid = %d, application name = '%s', pid = %d, allocation size = %zu",
-                               (int) app->uid, app->name, (int) app->pid,
-                               entry->nr_counter_cpu_fds * sizeof(*cpu_counter_fds));
+                      (int) app->uid,
+                      app->name,
+                      (int) app->pid,
+                      entry->nr_counter_cpu_fds * sizeof(*cpu_counter_fds));
                goto error_counter_cpu_fds_alloc;
        }
 
@@ -416,8 +399,10 @@ struct ust_error_accounting_entry *ust_error_accounting_entry_create(
        cpu_counters = calloc<lttng_ust_abi_object_data *>(entry->nr_counter_cpu_fds);
        if (!cpu_counters) {
                PERROR("Failed to allocate event notifier error counter lttng_ust_abi_object_data array: application uid = %d, application name = '%s', pid = %d, allocation size = %zu",
-                               (int) app->uid, app->name, (int) app->pid,
-                               entry->nr_counter_cpu_fds * sizeof(struct lttng_ust_abi_object_data *));
+                      (int) app->uid,
+                      app->name,
+                      (int) app->pid,
+                      entry->nr_counter_cpu_fds * sizeof(struct lttng_ust_abi_object_data *));
                goto error_counter_cpus_alloc;
        }
 
@@ -425,7 +410,9 @@ struct ust_error_accounting_entry *ust_error_accounting_entry_create(
                cpu_counter_fds[i] = shm_create_anonymous("event-notifier-error-accounting");
                if (cpu_counter_fds[i] == -1) {
                        ERR("Failed to create event notifier error accounting shared memory for application user: application uid = %d, pid = %d, application name = '%s'",
-                                       (int) app->uid, (int) app->pid, app->name);
+                           (int) app->uid,
+                           (int) app->pid,
+                           app->name);
                        goto error_shm_alloc;
                }
        }
@@ -433,12 +420,16 @@ struct ust_error_accounting_entry *ust_error_accounting_entry_create(
        /*
         * Ownership of the file descriptors transferred to the ustctl object.
         */
-       daemon_counter = lttng_ust_ctl_create_counter(1, &dimension, 0, -1,
-                       entry->nr_counter_cpu_fds, cpu_counter_fds,
-                       LTTNG_UST_CTL_COUNTER_BITNESS_32,
-                       LTTNG_UST_CTL_COUNTER_ARITHMETIC_MODULAR,
-                       LTTNG_UST_CTL_COUNTER_ALLOC_PER_CPU,
-                       false);
+       daemon_counter = lttng_ust_ctl_create_counter(1,
+                                                     &dimension,
+                                                     0,
+                                                     -1,
+                                                     entry->nr_counter_cpu_fds,
+                                                     cpu_counter_fds,
+                                                     LTTNG_UST_CTL_COUNTER_BITNESS_32,
+                                                     LTTNG_UST_CTL_COUNTER_ARITHMETIC_MODULAR,
+                                                     LTTNG_UST_CTL_COUNTER_ALLOC_PER_CPU,
+                                                     false);
        if (!daemon_counter) {
                goto error_create_daemon_counter;
        }
@@ -446,17 +437,19 @@ struct ust_error_accounting_entry *ust_error_accounting_entry_create(
        ret = lttng_ust_ctl_create_counter_data(daemon_counter, &counter);
        if (ret) {
                ERR("Failed to create userspace tracer counter data for application user: uid = %d, pid = %d, application name = '%s'",
-                               (int) app->uid, (int) app->pid, app->name);
+                   (int) app->uid,
+                   (int) app->pid,
+                   app->name);
                goto error_create_counter_data;
        }
 
        for (i = 0; i < entry->nr_counter_cpu_fds; i++) {
-               ret = lttng_ust_ctl_create_counter_cpu_data(daemon_counter, i,
-                               &cpu_counters[i]);
+               ret = lttng_ust_ctl_create_counter_cpu_data(daemon_counter, i, &cpu_counters[i]);
                if (ret) {
                        ERR("Failed to create userspace tracer counter cpu data for application user: uid = %d, pid = %d, application name = '%s'",
-                                       (int) app->uid, (int) app->pid,
-                                       app->name);
+                           (int) app->uid,
+                           (int) app->pid,
+                           app->name);
                        goto error_create_counter_cpu_data;
                }
        }
@@ -505,7 +498,7 @@ error_shm_alloc:
                        ret = close(cpu_counter_fds[i]);
                        if (ret) {
                                PERROR("Failed to close error counter per-CPU shm file descriptor: fd = %d",
-                                               cpu_counter_fds[i]);
+                                      cpu_counter_fds[i]);
                        }
                }
        }
@@ -521,27 +514,29 @@ end:
        return entry;
 }
 
-static
-enum event_notifier_error_accounting_status send_counter_data_to_ust(
-               struct ust_app *app,
-               struct lttng_ust_abi_object_data *new_counter)
+static enum event_notifier_error_accounting_status
+send_counter_data_to_ust(struct ust_app *app, struct lttng_ust_abi_object_data *new_counter)
 {
        int ret;
        enum event_notifier_error_accounting_status status;
 
        /* Attach counter to trigger group. */
        pthread_mutex_lock(&app->sock_lock);
-       ret = lttng_ust_ctl_send_counter_data_to_ust(app->sock,
-                       app->event_notifier_group.object->handle, new_counter);
+       ret = lttng_ust_ctl_send_counter_data_to_ust(
+               app->sock, app->event_notifier_group.object->handle, new_counter);
        pthread_mutex_unlock(&app->sock_lock);
        if (ret < 0) {
                if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
                        ERR("Failed to send counter data to application: application name = '%s', pid = %d, ret = %d",
-                                       app->name, app->pid, ret);
+                           app->name,
+                           app->pid,
+                           ret);
                        status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR;
                } else {
                        DBG3("Failed to send counter data to application (application is dead): application name = '%s', pid = %d, ret = %d",
-                                       app->name, app->pid, ret);
+                            app->name,
+                            app->pid,
+                            ret);
                        status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD;
                }
 
@@ -553,27 +548,29 @@ end:
        return status;
 }
 
-static
-enum event_notifier_error_accounting_status send_counter_cpu_data_to_ust(
-               struct ust_app *app,
-               struct lttng_ust_abi_object_data *counter,
-               struct lttng_ust_abi_object_data *counter_cpu)
+static enum event_notifier_error_accounting_status
+send_counter_cpu_data_to_ust(struct ust_app *app,
+                            struct lttng_ust_abi_object_data *counter,
+                            struct lttng_ust_abi_object_data *counter_cpu)
 {
        int ret;
        enum event_notifier_error_accounting_status status;
 
        pthread_mutex_lock(&app->sock_lock);
-       ret = lttng_ust_ctl_send_counter_cpu_data_to_ust(app->sock,
-                       counter, counter_cpu);
+       ret = lttng_ust_ctl_send_counter_cpu_data_to_ust(app->sock, counter, counter_cpu);
        pthread_mutex_unlock(&app->sock_lock);
        if (ret < 0) {
                if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
                        ERR("Failed to send counter CPU data to application: application name = '%s', pid = %d, ret = %d",
-                                       app->name, app->pid, ret);
+                           app->name,
+                           app->pid,
+                           ret);
                        status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR;
                } else {
                        DBG3("Failed to send counter CPU data to application: application name = '%s', pid = %d, ret = %d",
-                                       app->name, app->pid, ret);
+                            app->name,
+                            app->pid,
+                            ret);
                        status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD;
                }
 
@@ -634,11 +631,12 @@ event_notifier_error_accounting_register_app(struct ust_app *app)
        }
 
        /* Duplicate counter object data. */
-       ret = lttng_ust_ctl_duplicate_ust_object_data(&new_counter,
-                       entry->counter);
+       ret = lttng_ust_ctl_duplicate_ust_object_data(&new_counter, entry->counter);
        if (ret) {
                ERR("Failed to duplicate event notifier error accounting counter for application user: application uid = %d, pid = %d, application name = '%s'",
-                               (int) app->uid, (int) app->pid, app->name);
+                   (int) app->uid,
+                   (int) app->pid,
+                   app->name);
                status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR;
                goto error_duplicate_counter;
        }
@@ -650,8 +648,10 @@ event_notifier_error_accounting_register_app(struct ust_app *app)
                }
 
                ERR("Failed to send counter data to application tracer: status = %s, application uid = %d, pid = %d, application name = '%s'",
-                               error_accounting_status_str(status),
-                               (int) app->uid, (int) app->pid, app->name);
+                   error_accounting_status_str(status),
+                   (int) app->uid,
+                   (int) app->pid,
+                   app->name);
                status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR;
                goto error_send_counter_data;
        }
@@ -659,8 +659,10 @@ event_notifier_error_accounting_register_app(struct ust_app *app)
        cpu_counters = calloc<lttng_ust_abi_object_data *>(entry->nr_counter_cpu_fds);
        if (!cpu_counters) {
                PERROR("Failed to allocate event notifier error counter lttng_ust_abi_object_data array: application uid = %d, application name = '%s', pid = %d, allocation size = %zu",
-                               (int) app->uid, app->name, (int) app->pid,
-                               entry->nr_counter_cpu_fds * sizeof(**cpu_counters));
+                      (int) app->uid,
+                      app->name,
+                      (int) app->pid,
+                      entry->nr_counter_cpu_fds * sizeof(**cpu_counters));
                status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NOMEM;
                goto error_allocate_cpu_counters;
        }
@@ -669,28 +671,29 @@ event_notifier_error_accounting_register_app(struct ust_app *app)
                struct lttng_ust_abi_object_data *new_counter_cpu = NULL;
 
                ret = lttng_ust_ctl_duplicate_ust_object_data(&new_counter_cpu,
-                               entry->cpu_counters[i]);
+                                                             entry->cpu_counters[i]);
                if (ret) {
                        ERR("Failed to duplicate userspace tracer counter cpu data for application user: uid = %d, pid = %d, application name = '%s'",
-                                       (int) app->uid, (int) app->pid,
-                                       app->name);
+                           (int) app->uid,
+                           (int) app->pid,
+                           app->name);
                        status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NOMEM;
                        goto error_duplicate_cpu_counter;
                }
 
                cpu_counters[i] = new_counter_cpu;
 
-               status = send_counter_cpu_data_to_ust(app, new_counter,
-                               new_counter_cpu);
+               status = send_counter_cpu_data_to_ust(app, new_counter, new_counter_cpu);
                if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
                        if (status == EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD) {
                                goto error_send_cpu_counter_data;
                        }
 
                        ERR("Failed to send counter cpu data to application tracer: status = %s, application uid = %d, pid = %d, application name = '%s'",
-                                       error_accounting_status_str(status),
-                                       (int) app->uid, (int) app->pid,
-                                       app->name);
+                           error_accounting_status_str(status),
+                           (int) app->uid,
+                           (int) app->pid,
+                           app->name);
                        status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR;
                        goto error_send_cpu_counter_data;
                }
@@ -753,7 +756,8 @@ event_notifier_error_accounting_unregister_app(struct ust_app *app)
        entry = ust_error_accounting_entry_find(error_counter_uid_ht, app);
        if (entry == NULL) {
                ERR("Failed to find event notitifier error accounting entry on application teardown: pid = %d, application name = '%s'",
-                               app->pid, app->name);
+                   app->pid,
+                   app->name);
                status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR;
                goto end;
        } else {
@@ -766,8 +770,7 @@ event_notifier_error_accounting_unregister_app(struct ust_app *app)
        }
 
        for (i = 0; i < app->event_notifier_group.nr_counter_cpu; i++) {
-               lttng_ust_ctl_release_object(app->sock,
-                               app->event_notifier_group.counter_cpu[i]);
+               lttng_ust_ctl_release_object(app->sock, app->event_notifier_group.counter_cpu[i]);
                free(app->event_notifier_group.counter_cpu[i]);
        }
 
@@ -782,10 +785,8 @@ end:
        return status;
 }
 
-static
-enum event_notifier_error_accounting_status
-event_notifier_error_accounting_ust_get_count(
-               const struct lttng_trigger *trigger, uint64_t *count)
+static enum event_notifier_error_accounting_status
+event_notifier_error_accounting_ust_get_count(const struct lttng_trigger *trigger, uint64_t *count)
 {
        struct lttng_ht_iter iter;
        struct ust_error_accounting_entry *uid_entry;
@@ -796,19 +797,18 @@ event_notifier_error_accounting_ust_get_count(
        uid_t trigger_owner_uid;
        const char *trigger_name;
 
-
        rcu_read_lock();
 
        get_trigger_info_for_log(trigger, &trigger_name, &trigger_owner_uid);
 
-       status = get_error_counter_index_for_token(&ust_state, tracer_token,
-                       &error_counter_index);
+       status = get_error_counter_index_for_token(&ust_state, tracer_token, &error_counter_index);
        if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
-
-               ERR("Failed to retrieve index for tracer token: token = %" PRIu64 ", trigger name = '%s', trigger owner uid = %d, status = %s",
-                               tracer_token, trigger_name,
-                               (int) trigger_owner_uid,
-                               error_accounting_status_str(status));
+               ERR("Failed to retrieve index for tracer token: token = %" PRIu64
+                   ", trigger name = '%s', trigger owner uid = %d, status = %s",
+                   tracer_token,
+                   trigger_name,
+                   (int) trigger_owner_uid,
+                   error_accounting_status_str(status));
                goto end;
        }
 
@@ -821,25 +821,26 @@ event_notifier_error_accounting_ust_get_count(
         * a trigger to a given sessiond is also allowed to create an event
         * notifier on all apps that this sessiond is aware of.
         */
-       cds_lfht_for_each_entry(error_counter_uid_ht->ht, &iter.iter,
-                       uid_entry, node.node) {
+       cds_lfht_for_each_entry (error_counter_uid_ht->ht, &iter.iter, uid_entry, node.node) {
                int ret;
                int64_t local_value = 0;
                bool overflow = false, underflow = false;
 
                ret = lttng_ust_ctl_counter_aggregate(uid_entry->daemon_counter,
-                               dimension_indexes, &local_value, &overflow,
-                               &underflow);
+                                                     dimension_indexes,
+                                                     &local_value,
+                                                     &overflow,
+                                                     &underflow);
                if (ret || local_value < 0) {
                        if (ret) {
                                ERR("Failed to aggregate event notifier error counter values of trigger: trigger name = '%s', trigger owner uid = %d",
-                                               trigger_name,
-                                               (int) trigger_owner_uid);
+                                   trigger_name,
+                                   (int) trigger_owner_uid);
                        } else if (local_value < 0) {
                                ERR("Negative event notifier error counter value encountered during aggregation: trigger name = '%s', trigger owner uid = %d, value = %" PRId64,
-                                               trigger_name,
-                                               (int) trigger_owner_uid,
-                                               local_value);
+                                   trigger_name,
+                                   (int) trigger_owner_uid,
+                                   local_value);
                        } else {
                                abort();
                        }
@@ -860,9 +861,8 @@ end:
        return status;
 }
 
-static
-enum event_notifier_error_accounting_status event_notifier_error_accounting_ust_clear(
-               const struct lttng_trigger *trigger)
+static enum event_notifier_error_accounting_status
+event_notifier_error_accounting_ust_clear(const struct lttng_trigger *trigger)
 {
        struct lttng_ht_iter iter;
        struct ust_error_accounting_entry *uid_entry;
@@ -872,19 +872,19 @@ enum event_notifier_error_accounting_status event_notifier_error_accounting_ust_
        const uint64_t tracer_token = lttng_trigger_get_tracer_token(trigger);
 
        rcu_read_lock();
-       status = get_error_counter_index_for_token(&ust_state, tracer_token,
-                       &error_counter_index);
+       status = get_error_counter_index_for_token(&ust_state, tracer_token, &error_counter_index);
        if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
                uid_t trigger_owner_uid;
                const char *trigger_name;
 
-               get_trigger_info_for_log(trigger, &trigger_name,
-                                        &trigger_owner_uid);
+               get_trigger_info_for_log(trigger, &trigger_name, &trigger_owner_uid);
 
-               ERR("Failed to retrieve index for tracer token: token = %" PRIu64 ", trigger name = '%s', trigger owner uid = %d, status = %s",
-                               tracer_token, trigger_name,
-                               (int) trigger_owner_uid,
-                               error_accounting_status_str(status));
+               ERR("Failed to retrieve index for tracer token: token = %" PRIu64
+                   ", trigger name = '%s', trigger owner uid = %d, status = %s",
+                   tracer_token,
+                   trigger_name,
+                   (int) trigger_owner_uid,
+                   error_accounting_status_str(status));
                goto end;
        }
 
@@ -895,20 +895,19 @@ enum event_notifier_error_accounting_status event_notifier_error_accounting_ust_
         * errors) can be generated from any applications that this session
         * daemon is managing.
         */
-       cds_lfht_for_each_entry(error_counter_uid_ht->ht, &iter.iter,
-                       uid_entry, node.node) {
-               const int ret = lttng_ust_ctl_counter_clear(uid_entry->daemon_counter,
-                               &dimension_index);
+       cds_lfht_for_each_entry (error_counter_uid_ht->ht, &iter.iter, uid_entry, node.node) {
+               const int ret =
+                       lttng_ust_ctl_counter_clear(uid_entry->daemon_counter, &dimension_index);
 
                if (ret) {
                        uid_t trigger_owner_uid;
                        const char *trigger_name;
 
-                       get_trigger_info_for_log(trigger, &trigger_name,
-                                                &trigger_owner_uid);
+                       get_trigger_info_for_log(trigger, &trigger_name, &trigger_owner_uid);
                        ERR("Failed to clear event notifier counter value for trigger: counter uid = %d, trigger name = '%s', trigger owner uid = %d",
-                                       (int) uid_entry->node.key, trigger_name,
-                                       (int) trigger_owner_uid);
+                           (int) uid_entry->node.key,
+                           trigger_name,
+                           (int) trigger_owner_uid);
                        status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR;
                        goto end;
                }
@@ -921,47 +920,42 @@ end:
 }
 #endif /* HAVE_LIBLTTNG_UST_CTL */
 
-static
-enum event_notifier_error_accounting_status
-event_notifier_error_accounting_kernel_clear(
-               const struct lttng_trigger *trigger)
+static enum event_notifier_error_accounting_status
+event_notifier_error_accounting_kernel_clear(const struct lttng_trigger *trigger)
 {
        int ret;
        uint64_t error_counter_index;
        enum event_notifier_error_accounting_status status;
        struct lttng_kernel_abi_counter_clear counter_clear = {};
 
-       status = get_error_counter_index_for_token(&kernel_state,
-                       lttng_trigger_get_tracer_token(trigger),
-                       &error_counter_index);
+       status = get_error_counter_index_for_token(
+               &kernel_state, lttng_trigger_get_tracer_token(trigger), &error_counter_index);
        if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
                uid_t trigger_owner_uid;
                const char *trigger_name;
 
-               get_trigger_info_for_log(
-                               trigger, &trigger_name, &trigger_owner_uid);
+               get_trigger_info_for_log(trigger, &trigger_name, &trigger_owner_uid);
 
                ERR("Failed to get event notifier error counter index: trigger owner uid = %d, trigger name = '%s', status = '%s'",
-                               trigger_owner_uid, trigger_name,
-                               error_accounting_status_str(status));
+                   trigger_owner_uid,
+                   trigger_name,
+                   error_accounting_status_str(status));
                goto end;
        }
 
        counter_clear.index.number_dimensions = 1;
        counter_clear.index.dimension_indexes[0] = error_counter_index;
 
-       ret = kernctl_counter_clear(
-                       kernel_error_accounting_entry.error_counter_fd,
-                       &counter_clear);
+       ret = kernctl_counter_clear(kernel_error_accounting_entry.error_counter_fd, &counter_clear);
        if (ret) {
                uid_t trigger_owner_uid;
                const char *trigger_name;
 
-               get_trigger_info_for_log(
-                               trigger, &trigger_name, &trigger_owner_uid);
+               get_trigger_info_for_log(trigger, &trigger_name, &trigger_owner_uid);
 
                ERR("Failed to clear kernel event notifier error counter: trigger owner uid = %d, trigger name = '%s'",
-                               trigger_owner_uid, trigger_name);
+                   trigger_owner_uid,
+                   trigger_name);
                status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR;
                goto end;
        }
@@ -972,16 +966,15 @@ end:
 }
 
 enum event_notifier_error_accounting_status
-event_notifier_error_accounting_register_kernel(
-               int kernel_event_notifier_group_fd)
+event_notifier_error_accounting_register_kernel(int kernel_event_notifier_group_fd)
 {
        int error_counter_fd = -1, ret;
        enum event_notifier_error_accounting_status status;
        lttng_kernel_abi_counter_conf error_counter_conf = {
                .arithmetic = LTTNG_KERNEL_ABI_COUNTER_ARITHMETIC_MODULAR,
                .bitness = sizeof(void *) == sizeof(uint32_t) ?
-                               LTTNG_KERNEL_ABI_COUNTER_BITNESS_32 :
-                               LTTNG_KERNEL_ABI_COUNTER_BITNESS_64,
+                       LTTNG_KERNEL_ABI_COUNTER_BITNESS_32 :
+                       LTTNG_KERNEL_ABI_COUNTER_BITNESS_64,
                .number_dimensions = 1,
                .global_sum_step = 0,
                .dimensions = {},
@@ -992,11 +985,11 @@ event_notifier_error_accounting_register_kernel(
        error_counter_conf.dimensions[0].has_underflow = false;
        error_counter_conf.dimensions[0].has_overflow = false;
 
-       ret = kernctl_create_event_notifier_group_error_counter(
-                       kernel_event_notifier_group_fd, &error_counter_conf);
+       ret = kernctl_create_event_notifier_group_error_counter(kernel_event_notifier_group_fd,
+                                                               &error_counter_conf);
        if (ret < 0) {
                PERROR("Failed to create event notifier group error counter through kernel ioctl: kernel_event_notifier_group_fd = %d",
-                               kernel_event_notifier_group_fd);
+                      kernel_event_notifier_group_fd);
                status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR;
                goto error;
        }
@@ -1007,26 +1000,22 @@ event_notifier_error_accounting_register_kernel(
        ret = fcntl(error_counter_fd, F_SETFD, FD_CLOEXEC);
        if (ret < 0) {
                PERROR("Failed to set FD_CLOEXEC flag on event notifier error counter file descriptor: error_counter_fd = %d",
-                               error_counter_fd);
+                      error_counter_fd);
                status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR;
                goto error;
        }
 
-       DBG("Created kernel event notifier group error counter: fd = %d",
-                       error_counter_fd);
+       DBG("Created kernel event notifier group error counter: fd = %d", error_counter_fd);
 
-       kernel_error_accounting_entry.error_counter_fd =
-                       error_counter_fd;
+       kernel_error_accounting_entry.error_counter_fd = error_counter_fd;
        status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
 
 error:
        return status;
 }
 
-static
-enum event_notifier_error_accounting_status create_error_counter_index_for_token(
-               struct error_accounting_state *state, uint64_t tracer_token,
-               uint64_t *error_counter_index)
+static enum event_notifier_error_accounting_status create_error_counter_index_for_token(
+       struct error_accounting_state *state, uint64_t tracer_token, uint64_t *error_counter_index)
 {
        struct index_ht_entry *index_entry;
        enum lttng_index_allocator_status index_alloc_status;
@@ -1036,14 +1025,13 @@ enum event_notifier_error_accounting_status create_error_counter_index_for_token
        LTTNG_ASSERT(state);
 
        /* Allocate a new index for that counter. */
-       index_alloc_status = lttng_index_allocator_alloc(state->index_allocator,
-                       &local_error_counter_index);
+       index_alloc_status =
+               lttng_index_allocator_alloc(state->index_allocator, &local_error_counter_index);
        switch (index_alloc_status) {
        case LTTNG_INDEX_ALLOCATOR_STATUS_EMPTY:
                DBG("No indices left in the configured event notifier error counter: "
-                               "number-of-indices = %" PRIu64,
-                               lttng_index_allocator_get_index_count(
-                                       state->index_allocator));
+                   "number-of-indices = %" PRIu64,
+                   lttng_index_allocator_get_index_count(state->index_allocator));
                status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NO_INDEX_AVAILABLE;
                goto end;
        case LTTNG_INDEX_ALLOCATOR_STATUS_OK:
@@ -1064,8 +1052,10 @@ enum event_notifier_error_accounting_status create_error_counter_index_for_token
        lttng_ht_node_init_u64(&index_entry->node, tracer_token);
        lttng_ht_add_unique_u64(state->indices_ht, &index_entry->node);
 
-       DBG("Allocated error counter index for tracer token: tracer token = %" PRIu64 ", index = %" PRIu64,
-                       tracer_token, local_error_counter_index);
+       DBG("Allocated error counter index for tracer token: tracer token = %" PRIu64
+           ", index = %" PRIu64,
+           tracer_token,
+           local_error_counter_index);
        *error_counter_index = local_error_counter_index;
        status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
 end:
@@ -1073,9 +1063,8 @@ end:
 }
 
 enum event_notifier_error_accounting_status
-event_notifier_error_accounting_register_event_notifier(
-               const struct lttng_trigger *trigger,
-               uint64_t *error_counter_index)
+event_notifier_error_accounting_register_event_notifier(const struct lttng_trigger *trigger,
+                                                       uint64_t *error_counter_index)
 {
        enum event_notifier_error_accounting_status status;
        uint64_t local_error_counter_index;
@@ -1099,29 +1088,28 @@ event_notifier_error_accounting_register_event_notifier(
         * Check if this event notifier already has a error counter index
         * assigned.
         */
-       status = get_error_counter_index_for_token(state,
-                       lttng_trigger_get_tracer_token(trigger),
-                       &local_error_counter_index);
+       status = get_error_counter_index_for_token(
+               state, lttng_trigger_get_tracer_token(trigger), &local_error_counter_index);
        switch (status) {
        case EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NOT_FOUND:
        {
                uid_t trigger_owner_uid;
                const char *trigger_name;
 
-               get_trigger_info_for_log(
-                               trigger, &trigger_name, &trigger_owner_uid);
+               get_trigger_info_for_log(trigger, &trigger_name, &trigger_owner_uid);
 
                DBG("Event notifier error counter index not found for tracer token (allocating a new one): trigger name = '%s', trigger owner uid = %d, tracer token = %" PRIu64,
-                               trigger_name, trigger_owner_uid,
-                               lttng_trigger_get_tracer_token(trigger));
+                   trigger_name,
+                   trigger_owner_uid,
+                   lttng_trigger_get_tracer_token(trigger));
 
-               status = create_error_counter_index_for_token(state,
-                               lttng_trigger_get_tracer_token(trigger),
-                               &local_error_counter_index);
+               status = create_error_counter_index_for_token(
+                       state, lttng_trigger_get_tracer_token(trigger), &local_error_counter_index);
                if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
                        ERR("Error creating index for token: status = %s, trigger name = '%s', trigger owner uid = %d",
-                                       error_accounting_status_str(status),
-                                       trigger_name, trigger_owner_uid);
+                           error_accounting_status_str(status),
+                           trigger_name,
+                           trigger_owner_uid);
                        goto end;
                }
        }
@@ -1158,27 +1146,24 @@ event_notifier_error_accounting_register_event_notifier(
        }
 #endif /* HAVE_LIBLTTNG_UST_CTL */
 
-
 end:
        return status;
 }
 
-static
-enum event_notifier_error_accounting_status
-event_notifier_error_accounting_kernel_get_count(
-               const struct lttng_trigger *trigger, uint64_t *count)
+static enum event_notifier_error_accounting_status
+event_notifier_error_accounting_kernel_get_count(const struct lttng_trigger *trigger,
+                                                uint64_t *count)
 {
        struct lttng_kernel_abi_counter_aggregate counter_aggregate = {};
        enum event_notifier_error_accounting_status status;
        uint64_t error_counter_index;
        int ret;
 
-       status = get_error_counter_index_for_token(&kernel_state,
-                       lttng_trigger_get_tracer_token(trigger),
-                       &error_counter_index);
+       status = get_error_counter_index_for_token(
+               &kernel_state, lttng_trigger_get_tracer_token(trigger), &error_counter_index);
        if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
                ERR("Error getting index for token: status=%s",
-                               error_accounting_status_str(status));
+                   error_accounting_status_str(status));
                goto end;
        }
 
@@ -1187,23 +1172,24 @@ event_notifier_error_accounting_kernel_get_count(
 
        LTTNG_ASSERT(kernel_error_accounting_entry.error_counter_fd);
 
-       ret = kernctl_counter_get_aggregate_value(
-                       kernel_error_accounting_entry.error_counter_fd,
-                       &counter_aggregate);
+       ret = kernctl_counter_get_aggregate_value(kernel_error_accounting_entry.error_counter_fd,
+                                                 &counter_aggregate);
        if (ret || counter_aggregate.value.value < 0) {
                uid_t trigger_owner_uid;
                const char *trigger_name;
 
-               get_trigger_info_for_log(trigger, &trigger_name,
-                               &trigger_owner_uid);
+               get_trigger_info_for_log(trigger, &trigger_name, &trigger_owner_uid);
 
                if (counter_aggregate.value.value < 0) {
                        ERR("Invalid negative event notifier error counter value: trigger owner = %d, trigger name = '%s', value = %" PRId64,
-                                       trigger_owner_uid, trigger_name,
-                                       counter_aggregate.value.value);
+                           trigger_owner_uid,
+                           trigger_name,
+                           counter_aggregate.value.value);
                } else {
                        ERR("Failed to getting event notifier error count: trigger owner = %d, trigger name = '%s', ret = %d",
-                                       trigger_owner_uid, trigger_name, ret);
+                           trigger_owner_uid,
+                           trigger_name,
+                           ret);
                }
 
                status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR;
@@ -1221,20 +1207,17 @@ end:
 }
 
 enum event_notifier_error_accounting_status
-event_notifier_error_accounting_get_count(
-               const struct lttng_trigger *trigger, uint64_t *count)
+event_notifier_error_accounting_get_count(const struct lttng_trigger *trigger, uint64_t *count)
 {
        switch (lttng_trigger_get_underlying_domain_type_restriction(trigger)) {
        case LTTNG_DOMAIN_KERNEL:
-               return event_notifier_error_accounting_kernel_get_count(
-                               trigger, count);
+               return event_notifier_error_accounting_kernel_get_count(trigger, count);
        case LTTNG_DOMAIN_UST:
        case LTTNG_DOMAIN_PYTHON:
        case LTTNG_DOMAIN_JUL:
        case LTTNG_DOMAIN_LOG4J:
 #ifdef HAVE_LIBLTTNG_UST_CTL
-               return event_notifier_error_accounting_ust_get_count(trigger,
-                               count);
+               return event_notifier_error_accounting_ust_get_count(trigger, count);
 #else
                *count = 0;
                return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
@@ -1244,8 +1227,7 @@ event_notifier_error_accounting_get_count(
        }
 }
 
-static
-enum event_notifier_error_accounting_status
+static enum event_notifier_error_accounting_status
 event_notifier_error_accounting_clear(const struct lttng_trigger *trigger)
 {
        switch (lttng_trigger_get_underlying_domain_type_restriction(trigger)) {
@@ -1267,14 +1249,12 @@ event_notifier_error_accounting_clear(const struct lttng_trigger *trigger)
 
 static void free_index_ht_entry(struct rcu_head *head)
 {
-       struct index_ht_entry *entry = caa_container_of(head,
-                       struct index_ht_entry, rcu_head);
+       struct index_ht_entry *entry = caa_container_of(head, struct index_ht_entry, rcu_head);
 
        free(entry);
 }
 
-void event_notifier_error_accounting_unregister_event_notifier(
-               const struct lttng_trigger *trigger)
+void event_notifier_error_accounting_unregister_event_notifier(const struct lttng_trigger *trigger)
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_u64 *node;
@@ -1286,7 +1266,7 @@ void event_notifier_error_accounting_unregister_event_notifier(
        if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
                /* Trigger details already logged by callee on error. */
                ERR("Failed to clear event notifier error counter during unregistration of event notifier: status = '%s'",
-                               error_accounting_status_str(status));
+                   error_accounting_status_str(status));
                goto end;
        }
 
@@ -1306,7 +1286,6 @@ void event_notifier_error_accounting_unregister_event_notifier(
                pthread_mutex_lock(&the_event_notifier_counter.lock);
                the_event_notifier_counter.count--;
                if (the_event_notifier_counter.count == 0) {
-
                        /*
                         * When unregistering the last event notifier, put one
                         * reference to every uid entries on the behalf of all
@@ -1328,22 +1307,22 @@ void event_notifier_error_accounting_unregister_event_notifier(
        if (node) {
                int del_ret;
                struct index_ht_entry *index_entry =
-                               lttng::utils::container_of(node, &index_ht_entry::node);
+                       lttng::utils::container_of(node, &index_ht_entry::node);
                enum lttng_index_allocator_status index_alloc_status;
 
                index_alloc_status = lttng_index_allocator_release(
-                               state->index_allocator,
-                               index_entry->error_counter_index);
+                       state->index_allocator, index_entry->error_counter_index);
                if (index_alloc_status != LTTNG_INDEX_ALLOCATOR_STATUS_OK) {
                        uid_t trigger_owner_uid;
                        const char *trigger_name;
 
-                       get_trigger_info_for_log(trigger, &trigger_name,
-                                       &trigger_owner_uid);
+                       get_trigger_info_for_log(trigger, &trigger_name, &trigger_owner_uid);
 
-                       ERR("Failed to release event notifier error counter index: index = %" PRIu64 ", trigger name = '%s', trigger owner uid = %d",
-                                       index_entry->error_counter_index,
-                                       trigger_name, (int) trigger_owner_uid);
+                       ERR("Failed to release event notifier error counter index: index = %" PRIu64
+                           ", trigger name = '%s', trigger owner uid = %d",
+                           index_entry->error_counter_index,
+                           trigger_name,
+                           (int) trigger_owner_uid);
                        /* Don't exit, perform the rest of the clean-up. */
                }
 
index 65b7220ef13603ad1d84f9952e1bde0854dd80de..4e52dfa9d5145882f48635cb399cf4aafff8ca78 100644 (file)
@@ -7,38 +7,38 @@
  */
 
 #define _LGPL_SOURCE
-#include <urcu/list.h>
-#include <string.h>
-
-#include <common/compat/errno.hpp>
-#include <lttng/lttng.h>
-#include <lttng/condition/condition.h>
-#include <lttng/condition/event-rule-matches.h>
-#include <lttng/event-rule/event-rule.h>
-#include <lttng/event-rule/event-rule-internal.hpp>
-#include <common/bytecode/bytecode.hpp>
-#include <common/error.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/filter.hpp>
-#include <common/context.hpp>
-
+#include "agent.hpp"
 #include "channel.hpp"
 #include "event.hpp"
 #include "kernel.hpp"
 #include "lttng-sessiond.hpp"
 #include "lttng-ust-ctl.hpp"
 #include "lttng-ust-error.hpp"
-#include "ust-app.hpp"
 #include "trace-kernel.hpp"
 #include "trace-ust.hpp"
-#include "agent.hpp"
+#include "ust-app.hpp"
 #include "utils.hpp"
 
+#include <common/bytecode/bytecode.hpp>
+#include <common/compat/errno.hpp>
+#include <common/context.hpp>
+#include <common/error.hpp>
+#include <common/filter.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+
+#include <lttng/condition/condition.h>
+#include <lttng/condition/event-rule-matches.h>
+#include <lttng/event-rule/event-rule-internal.hpp>
+#include <lttng/event-rule/event-rule.h>
+#include <lttng/lttng.h>
+
+#include <string.h>
+#include <urcu/list.h>
+
 /*
  * Add unique UST event based on the event name, filter bytecode and loglevel.
  */
-static void add_unique_ust_event(struct lttng_ht *ht,
-               struct ltt_ust_event *event)
+static void add_unique_ust_event(struct lttng_ht *ht, struct ltt_ust_event *event)
 {
        struct cds_lfht_node *node_ptr;
        struct ltt_ust_ht_key key;
@@ -54,8 +54,10 @@ static void add_unique_ust_event(struct lttng_ht *ht,
        key.exclusion = event->exclusion;
 
        node_ptr = cds_lfht_add_unique(ht->ht,
-                       ht->hash_fct(event->node.key, lttng_ht_seed),
-                       trace_ust_ht_match_event, &key, &event->node.node);
+                                      ht->hash_fct(event->node.key, lttng_ht_seed),
+                                      trace_ust_ht_match_event,
+                                      &key,
+                                      &event->node.node);
        LTTNG_ASSERT(node_ptr == &event->node.node);
 }
 
@@ -66,7 +68,8 @@ static void add_unique_ust_event(struct lttng_ht *ht,
  * If event_name is NULL all events of the specified type are disabled.
  */
 int event_kernel_disable_event(struct ltt_kernel_channel *kchan,
-               const char *event_name, enum lttng_event_type type)
+                              const char *event_name,
+                              enum lttng_event_type type)
 {
        int ret, error = 0, found = 0;
        struct ltt_kernel_event *kevent;
@@ -74,7 +77,7 @@ int event_kernel_disable_event(struct ltt_kernel_channel *kchan,
        LTTNG_ASSERT(kchan);
 
        /* For each event in the kernel session */
-       cds_list_for_each_entry(kevent, &kchan->events_list.head, list) {
+       cds_list_for_each_entry (kevent, &kchan->events_list.head, list) {
                if (type != LTTNG_EVENT_ALL && kevent->type != type)
                        continue;
                if (event_name != NULL && strcmp(event_name, kevent->event->name)) {
@@ -88,7 +91,9 @@ int event_kernel_disable_event(struct ltt_kernel_channel *kchan,
                }
        }
        DBG("Disable kernel event: found %d events with name: %s and type: %d",
-                       found, event_name ? event_name : "NULL", type);
+           found,
+           event_name ? event_name : "NULL",
+           type);
 
        if (event_name != NULL && !found) {
                ret = LTTNG_ERR_NO_EVENT;
@@ -104,8 +109,9 @@ int event_kernel_disable_event(struct ltt_kernel_channel *kchan,
  * We own filter_expression and filter.
  */
 int event_kernel_enable_event(struct ltt_kernel_channel *kchan,
-               struct lttng_event *event, char *filter_expression,
-               struct lttng_bytecode *filter)
+                             struct lttng_event *event,
+                             char *filter_expression,
+                             struct lttng_bytecode *filter)
 {
        int ret;
        struct ltt_kernel_event *kevent;
@@ -113,8 +119,7 @@ int event_kernel_enable_event(struct ltt_kernel_channel *kchan,
        LTTNG_ASSERT(kchan);
        LTTNG_ASSERT(event);
 
-       kevent = trace_kernel_find_event(event->name, kchan,
-                       event->type, filter);
+       kevent = trace_kernel_find_event(event->name, kchan, event->type, filter);
        if (kevent == NULL) {
                ret = kernel_create_event(event, kchan, filter_expression, filter);
                /* We have passed ownership */
@@ -153,11 +158,12 @@ end:
  * We own filter_expression, filter, and exclusion.
  */
 int event_ust_enable_tracepoint(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, struct lttng_event *event,
-               char *filter_expression,
-               struct lttng_bytecode *filter,
-               struct lttng_event_exclusion *exclusion,
-               bool internal_event)
+                               struct ltt_ust_channel *uchan,
+                               struct lttng_event *event,
+                               char *filter_expression,
+                               struct lttng_bytecode *filter,
+                               struct lttng_event_exclusion *exclusion,
+                               bool internal_event)
 {
        int ret = LTTNG_OK, to_create = 0;
        struct ltt_ust_event *uevent;
@@ -168,12 +174,15 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess,
 
        rcu_read_lock();
 
-       uevent = trace_ust_find_event(uchan->events, event->name, filter,
-                       (enum lttng_ust_abi_loglevel_type) event->loglevel_type,
-                       event->loglevel, exclusion);
+       uevent = trace_ust_find_event(uchan->events,
+                                     event->name,
+                                     filter,
+                                     (enum lttng_ust_abi_loglevel_type) event->loglevel_type,
+                                     event->loglevel,
+                                     exclusion);
        if (!uevent) {
-               ret = trace_ust_create_event(event, filter_expression,
-                               filter, exclusion, internal_event, &uevent);
+               ret = trace_ust_create_event(
+                       event, filter_expression, filter, exclusion, internal_event, &uevent);
                /* We have passed ownership */
                filter_expression = NULL;
                filter = NULL;
@@ -220,8 +229,10 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess,
                goto end;
        }
 
-       DBG("Event UST %s %s in channel %s", uevent->attr.name,
-                       to_create ? "created" : "enabled", uchan->name);
+       DBG("Event UST %s %s in channel %s",
+           uevent->attr.name,
+           to_create ? "created" : "enabled",
+           uchan->name);
 
        ret = LTTNG_OK;
 
@@ -237,7 +248,8 @@ end:
  * Disable UST tracepoint of a channel from a UST session.
  */
 int event_ust_disable_tracepoint(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, const char *event_name)
+                                struct ltt_ust_channel *uchan,
+                                const char *event_name)
 {
        int ret;
        struct ltt_ust_event *uevent;
@@ -257,8 +269,11 @@ int event_ust_disable_tracepoint(struct ltt_ust_session *usess,
         * We use a custom lookup since we need the iterator for the next_duplicate
         * call in the do while loop below.
         */
-       cds_lfht_lookup(ht->ht, ht->hash_fct((void *) event_name, lttng_ht_seed),
-                       trace_ust_ht_match_event_by_name, event_name, &iter.iter);
+       cds_lfht_lookup(ht->ht,
+                       ht->hash_fct((void *) event_name, lttng_ht_seed),
+                       trace_ust_ht_match_event_by_name,
+                       event_name,
+                       &iter.iter);
        node = lttng_ht_iter_get_node_str(&iter);
        if (node == NULL) {
                DBG2("Trace UST event NOT found by name %s", event_name);
@@ -275,8 +290,7 @@ int event_ust_disable_tracepoint(struct ltt_ust_session *usess,
                        goto next;
                }
                uevent->enabled = 0;
-               DBG2("Event UST %s disabled in channel %s", uevent->attr.name,
-                               uchan->name);
+               DBG2("Event UST %s disabled in channel %s", uevent->attr.name, uchan->name);
 
                if (!usess->active) {
                        goto next;
@@ -286,10 +300,10 @@ int event_ust_disable_tracepoint(struct ltt_ust_session *usess,
                        ret = LTTNG_ERR_UST_DISABLE_FAIL;
                        goto error;
                }
-next:
+       next:
                /* Get next duplicate event by name. */
-               cds_lfht_next_duplicate(ht->ht, trace_ust_ht_match_event_by_name,
-                               event_name, &iter.iter);
+               cds_lfht_next_duplicate(
+                       ht->ht, trace_ust_ht_match_event_by_name, event_name, &iter.iter);
                node = lttng_ht_iter_get_node_str(&iter);
        } while (node);
 
@@ -303,8 +317,7 @@ error:
 /*
  * Disable all UST tracepoints for a channel from a UST session.
  */
-int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan)
+int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan)
 {
        int ret, i, size, error = 0;
        struct lttng_ht_iter iter;
@@ -317,11 +330,9 @@ int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess,
        rcu_read_lock();
 
        /* Disabling existing events */
-       cds_lfht_for_each_entry(uchan->events->ht, &iter.iter, uevent,
-                       node.node) {
+       cds_lfht_for_each_entry (uchan->events->ht, &iter.iter, uevent, node.node) {
                if (uevent->enabled == 1) {
-                       ret = event_ust_disable_tracepoint(usess, uchan,
-                                       uevent->attr.name);
+                       ret = event_ust_disable_tracepoint(usess, uchan, uevent->attr.name);
                        if (ret < 0) {
                                error = LTTNG_ERR_UST_DISABLE_FAIL;
                                continue;
@@ -337,8 +348,7 @@ int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess,
        }
 
        for (i = 0; i < size; i++) {
-               ret = event_ust_disable_tracepoint(usess, uchan,
-                               events[i].name);
+               ret = event_ust_disable_tracepoint(usess, uchan, events[i].name);
                if (ret < 0) {
                        /* Continue to disable the rest... */
                        error = LTTNG_ERR_UST_DISABLE_FAIL;
@@ -360,8 +370,7 @@ static void agent_enable_all(struct agent *agt)
 
        /* Flag every event as enabled. */
        rcu_read_lock();
-       cds_lfht_for_each_entry (
-                       agt->events->ht, &iter.iter, aevent, node.node) {
+       cds_lfht_for_each_entry (agt->events->ht, &iter.iter, aevent, node.node) {
                aevent->enabled_count++;
        }
        rcu_read_unlock();
@@ -373,8 +382,10 @@ static void agent_enable_all(struct agent *agt)
  * Return LTTNG_OK on success or else a LTTNG_ERR* code.
  */
 int event_agent_enable_all(struct ltt_ust_session *usess,
-               struct agent *agt, struct lttng_event *event,
-               struct lttng_bytecode *filter ,char *filter_expression)
+                          struct agent *agt,
+                          struct lttng_event *event,
+                          struct lttng_bytecode *filter,
+                          char *filter_expression)
 {
        int ret;
 
@@ -404,12 +415,12 @@ error:
  * the lttng-ctl library.
  */
 static int add_filter_app_ctx(struct lttng_bytecode *bytecode,
-               const char *filter_expression, struct agent *agt)
+                             const char *filter_expression,
+                             struct agent *agt)
 {
        int ret = LTTNG_OK;
        char *provider_name = NULL, *ctx_name = NULL;
-       struct bytecode_symbol_iterator *it =
-                       bytecode_symbol_iterator_create(bytecode);
+       struct bytecode_symbol_iterator *it = bytecode_symbol_iterator_create(bytecode);
 
        if (!it) {
                ret = LTTNG_ERR_NOMEM;
@@ -418,11 +429,9 @@ static int add_filter_app_ctx(struct lttng_bytecode *bytecode,
 
        do {
                struct lttng_event_context ctx;
-               const char *symbol_name =
-                               bytecode_symbol_iterator_get_name(it);
+               const char *symbol_name = bytecode_symbol_iterator_get_name(it);
 
-               if (parse_application_context(symbol_name, &provider_name,
-                               &ctx_name)) {
+               if (parse_application_context(symbol_name, &provider_name, &ctx_name)) {
                        /* Not an application context. */
                        continue;
                }
@@ -433,19 +442,19 @@ static int add_filter_app_ctx(struct lttng_bytecode *bytecode,
 
                /* Recognized an application context. */
                DBG("Enabling event with filter expression \"%s\" requires enabling the %s:%s application context.",
-                               filter_expression, provider_name, ctx_name);
+                   filter_expression,
+                   provider_name,
+                   ctx_name);
 
                ret = agent_add_context(&ctx, agt);
                if (ret != LTTNG_OK) {
-                       ERR("Failed to add application context %s:%s.",
-                                       provider_name, ctx_name);
+                       ERR("Failed to add application context %s:%s.", provider_name, ctx_name);
                        goto end;
                }
 
                ret = agent_enable_context(&ctx, agt->domain);
                if (ret != LTTNG_OK) {
-                       ERR("Failed to enable application context %s:%s.",
-                                       provider_name, ctx_name);
+                       ERR("Failed to enable application context %s:%s.", provider_name, ctx_name);
                        goto end;
                }
 
@@ -461,9 +470,9 @@ end:
 }
 
 static int agent_enable(struct agent *agt,
-               struct lttng_event *event,
-               struct lttng_bytecode *filter,
-               char *filter_expression)
+                       struct lttng_event *event,
+                       struct lttng_bytecode *filter,
+                       char *filter_expression)
 {
        int ret, created = 0;
        struct agent_event *aevent;
@@ -472,12 +481,14 @@ static int agent_enable(struct agent *agt,
        LTTNG_ASSERT(agt);
 
        rcu_read_lock();
-       aevent = agent_find_event(event->name, event->loglevel_type,
-                       event->loglevel, filter_expression, agt);
+       aevent = agent_find_event(
+               event->name, event->loglevel_type, event->loglevel, filter_expression, agt);
        if (!aevent) {
-               aevent = agent_create_event(event->name, event->loglevel_type,
-                               event->loglevel, filter,
-                               filter_expression);
+               aevent = agent_create_event(event->name,
+                                           event->loglevel_type,
+                                           event->loglevel,
+                                           filter,
+                                           filter_expression);
                if (!aevent) {
                        ret = LTTNG_ERR_NOMEM;
                        goto error;
@@ -489,8 +500,7 @@ static int agent_enable(struct agent *agt,
        }
 
        if (created && aevent->filter) {
-               ret = add_filter_app_ctx(
-                               aevent->filter, aevent->filter_expression, agt);
+               ret = add_filter_app_ctx(aevent->filter, aevent->filter_expression, agt);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -532,19 +542,22 @@ end:
  * Return LTTNG_OK on success or else a LTTNG_ERR* code.
  */
 int event_agent_enable(struct ltt_ust_session *usess,
-               struct agent *agt,
-               struct lttng_event *event,
-               struct lttng_bytecode *filter,
-               char *filter_expression)
+                      struct agent *agt,
+                      struct lttng_event *event,
+                      struct lttng_bytecode *filter,
+                      char *filter_expression)
 {
        LTTNG_ASSERT(usess);
        LTTNG_ASSERT(event);
        LTTNG_ASSERT(agt);
 
-       DBG("Enabling agent event: event pattern = '%s', session id = %" PRIu64 ", loglevel type = %d, loglevel = %d, filter expression = '%s'",
-                       event->name, usess->id, event->loglevel_type,
-                       event->loglevel,
-                       filter_expression ? filter_expression : "(none)");
+       DBG("Enabling agent event: event pattern = '%s', session id = %" PRIu64
+           ", loglevel type = %d, loglevel = %d, filter expression = '%s'",
+           event->name,
+           usess->id,
+           event->loglevel_type,
+           event->loglevel,
+           filter_expression ? filter_expression : "(none)");
 
        return agent_enable(agt, event, filter, filter_expression);
 }
@@ -584,10 +597,9 @@ int trigger_agent_enable(const struct lttng_trigger *trigger, struct agent *agt)
        condition = lttng_trigger_get_const_condition(trigger);
 
        LTTNG_ASSERT(lttng_condition_get_type(condition) ==
-                       LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
+                    LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
 
-       c_status = lttng_condition_event_rule_matches_get_rule(
-                       condition, &rule);
+       c_status = lttng_condition_event_rule_matches_get_rule(condition, &rule);
        LTTNG_ASSERT(c_status == LTTNG_CONDITION_STATUS_OK);
 
        switch (lttng_event_rule_get_type(rule)) {
@@ -621,8 +633,7 @@ int trigger_agent_enable(const struct lttng_trigger *trigger, struct agent *agt)
                /* Get the filter bytecode */
                filter_bytecode = lttng_event_rule_get_filter_bytecode(rule);
                if (filter_bytecode) {
-                       filter_bytecode_copy =
-                                       lttng_bytecode_copy(filter_bytecode);
+                       filter_bytecode_copy = lttng_bytecode_copy(filter_bytecode);
                        if (!filter_bytecode_copy) {
                                ret = LTTNG_ERR_NOMEM;
                                goto end;
@@ -631,11 +642,11 @@ int trigger_agent_enable(const struct lttng_trigger *trigger, struct agent *agt)
        }
 
        DBG("Enabling agent event from trigger: trigger name = '%s', trigger owner uid = %d, token = %" PRIu64,
-                       trigger_name, trigger_owner_uid,
-                       lttng_trigger_get_tracer_token(trigger));
+           trigger_name,
+           trigger_owner_uid,
+           lttng_trigger_get_tracer_token(trigger));
 
-       ret = agent_enable(agt, event, filter_bytecode_copy,
-                       filter_expression_copy);
+       ret = agent_enable(agt, event, filter_bytecode_copy, filter_expression_copy);
        /* Ownership was passed even in case of error. */
        filter_expression_copy = NULL;
        filter_bytecode_copy = NULL;
@@ -673,8 +684,8 @@ const char *event_get_default_agent_ust_name(enum lttng_domain_type domain)
 }
 
 static int trigger_agent_disable_one(const struct lttng_trigger *trigger,
-               struct agent *agt,
-               struct agent_event *aevent)
+                                    struct agent *agt,
+                                    struct agent_event *aevent)
 
 {
        int ret;
@@ -689,8 +700,10 @@ static int trigger_agent_disable_one(const struct lttng_trigger *trigger,
         */
 
        DBG("Event agent disabling %s (loglevel type %d, loglevel value %d) for trigger %" PRIu64,
-                       aevent->name, aevent->loglevel_type,
-                       aevent->loglevel_value, lttng_trigger_get_tracer_token(trigger));
+           aevent->name,
+           aevent->loglevel_type,
+           aevent->loglevel_value,
+           lttng_trigger_get_tracer_token(trigger));
 
        /* Already disabled? */
        if (!AGENT_EVENT_IS_ENABLED(aevent)) {
@@ -716,7 +729,8 @@ error:
  * Return LTTNG_OK on success or else a LTTNG_ERR* code.
  */
 static int event_agent_disable_one(struct ltt_ust_session *usess,
-               struct agent *agt, struct agent_event *aevent)
+                                  struct agent *agt,
+                                  struct agent_event *aevent)
 {
        int ret;
        struct ltt_ust_event *uevent = NULL;
@@ -728,8 +742,10 @@ static int event_agent_disable_one(struct ltt_ust_session *usess,
        LTTNG_ASSERT(aevent);
 
        DBG("Event agent disabling %s (loglevel type %d, loglevel value %d) for session %" PRIu64,
-               aevent->name, aevent->loglevel_type, aevent->loglevel_value,
-               usess->id);
+           aevent->name,
+           aevent->loglevel_type,
+           aevent->loglevel_value,
+           usess->id);
 
        /* Already disabled? */
        if (!AGENT_EVENT_IS_ENABLED(aevent)) {
@@ -752,7 +768,7 @@ static int event_agent_disable_one(struct ltt_ust_session *usess,
         * the event and finally disable it.
         */
        uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
-                       (char *) ust_channel_name);
+                                              (char *) ust_channel_name);
        if (!uchan) {
                ret = LTTNG_ERR_UST_CHAN_NOT_FOUND;
                goto error;
@@ -770,8 +786,12 @@ static int event_agent_disable_one(struct ltt_ust_session *usess,
         * happens thanks to an UST filter. The following -1 is actually
         * ignored since the type is LTTNG_UST_LOGLEVEL_ALL.
         */
-       uevent = trace_ust_find_event(uchan->events, (char *) ust_event_name,
-                       aevent->filter, LTTNG_UST_ABI_LOGLEVEL_ALL, -1, NULL);
+       uevent = trace_ust_find_event(uchan->events,
+                                     (char *) ust_event_name,
+                                     aevent->filter,
+                                     LTTNG_UST_ABI_LOGLEVEL_ALL,
+                                     -1,
+                                     NULL);
        /* If the agent event exists, it must be available on the UST side. */
        LTTNG_ASSERT(uevent);
 
@@ -806,8 +826,7 @@ error:
  *
  * Return LTTNG_OK on success or else a LTTNG_ERR* code.
  */
-int trigger_agent_disable(
-               const struct lttng_trigger *trigger, struct agent *agt)
+int trigger_agent_disable(const struct lttng_trigger *trigger, struct agent *agt)
 {
        int ret = LTTNG_OK;
        struct agent_event *aevent;
@@ -815,15 +834,14 @@ int trigger_agent_disable(
        LTTNG_ASSERT(trigger);
        LTTNG_ASSERT(agt);
 
-       DBG("Event agent disabling for trigger %" PRIu64,
-                       lttng_trigger_get_tracer_token(trigger));
+       DBG("Event agent disabling for trigger %" PRIu64, lttng_trigger_get_tracer_token(trigger));
 
        rcu_read_lock();
        aevent = agent_find_event_by_trigger(trigger, agt);
 
        if (aevent == NULL) {
                DBG2("Event agent NOT found by trigger %" PRIu64,
-                               lttng_trigger_get_tracer_token(trigger));
+                    lttng_trigger_get_tracer_token(trigger));
                ret = LTTNG_ERR_UST_EVENT_NOT_FOUND;
                goto end;
        }
@@ -844,8 +862,7 @@ end:
  *
  * Return LTTNG_OK on success or else a LTTNG_ERR* code.
  */
-int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt,
-               const char *event_name)
+int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt, const char *event_name)
 {
        int ret = LTTNG_OK;
        struct agent_event *aevent;
@@ -889,8 +906,7 @@ end:
  *
  * Return LTTNG_OK on success or else a LTTNG_ERR* code.
  */
-int event_agent_disable_all(struct ltt_ust_session *usess,
-               struct agent *agt)
+int event_agent_disable_all(struct ltt_ust_session *usess, struct agent *agt)
 {
        int ret;
        struct agent_event *aevent;
@@ -910,8 +926,7 @@ int event_agent_disable_all(struct ltt_ust_session *usess,
 
        /* Disable every event. */
        rcu_read_lock();
-       cds_lfht_for_each_entry(agt->events->ht, &iter.iter, aevent,
-                       node.node) {
+       cds_lfht_for_each_entry (agt->events->ht, &iter.iter, aevent, node.node) {
                if (!AGENT_EVENT_IS_ENABLED(aevent)) {
                        continue;
                }
index ac5c83f4b19775beed137606c483d20dadb3ecd9..361b5c6b58bdda0b856154c4ff2bb59dd8dc76e7 100644 (file)
@@ -6,13 +6,15 @@
  */
 
 #define _LGPL_SOURCE
-#include <urcu/uatomic.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <stdio.h>
 #include "fd-limit.hpp"
-#include <common/error.hpp>
+
 #include <common/compat/errno.hpp>
+#include <common/error.hpp>
+
+#include <stdio.h>
+#include <sys/resource.h>
+#include <sys/time.h>
+#include <urcu/uatomic.h>
 
 /* total count of fd. */
 static long fd_count;
@@ -35,16 +37,14 @@ int lttng_fd_get(enum lttng_fd_type type, unsigned int nr)
        }
 
        newval = uatomic_add_return(&fd_count, (long) nr);
-       if ((long) (newval * 100)
-                       - (long) (max_nr_fd * fd_threshold[type]) > 0) {
+       if ((long) (newval * 100) - (long) (max_nr_fd * fd_threshold[type]) > 0) {
                uatomic_sub(&fd_count, (long) nr);
                return -EPERM;
        }
        return 0;
 }
 
-void lttng_fd_put(enum lttng_fd_type type __attribute__((unused)),
-               unsigned int nr)
+void lttng_fd_put(enum lttng_fd_type type __attribute__((unused)), unsigned int nr)
 {
        uatomic_sub(&fd_count, (long) nr);
 }
index e46e06631eae121b4736547b31995839783bd381..5a0c584f22813197ac9a7e3686aee29e6536fa75 100644 (file)
@@ -22,27 +22,28 @@ bool fields_are_equal(const FieldTypeSet& a, const FieldTypeSet& b)
                return false;
        }
 
-       return std::equal(a.cbegin(), a.cend(), b.cbegin(),
-                       [](typename FieldTypeSet::const_reference field_a,
-                                       typename FieldTypeSet::const_reference field_b) {
-                               return *field_a == *field_b;
-                       });
+       return std::equal(a.cbegin(),
+                         a.cend(),
+                         b.cbegin(),
+                         [](typename FieldTypeSet::const_reference field_a,
+                            typename FieldTypeSet::const_reference field_b) {
+                                 return *field_a == *field_b;
+                         });
 }
 } /* namespace */
 
 lst::field_location::field_location(lst::field_location::root in_lookup_root,
-               lst::field_location::elements in_elements) :
-       root_{in_lookup_root}, elements_{std::move(in_elements)}
+                                   lst::field_location::elements in_elements) :
+       root_{ in_lookup_root }, elements_{ std::move(in_elements) }
 {
 }
 
 bool lst::field_location::operator==(const lst::field_location& other) const noexcept
 {
-       return root_ == other.root_ &&
-                       elements_ == other.elements_;
+       return root_ == other.root_ && elements_ == other.elements_;
 }
 
-lst::type::type(unsigned int in_alignment) : alignment{in_alignment}
+lst::type::type(unsigned int in_alignment) : alignment{ in_alignment }
 {
 }
 
@@ -52,8 +53,7 @@ lst::type::~type()
 
 bool lst::type::operator==(const lst::type& other) const noexcept
 {
-       return typeid(*this) == typeid(other) &&
-               alignment == other.alignment &&
+       return typeid(*this) == typeid(other) && alignment == other.alignment &&
                /* defer to concrete type comparison */
                this->_is_equal(other);
 }
@@ -64,10 +64,11 @@ bool lst::type::operator!=(const lst::type& other) const noexcept
 }
 
 lst::field::field(std::string in_name, lst::type::cuptr in_type) :
-       name{std::move(in_name)}, _type{std::move(in_type)}
+       name{ std::move(in_name) }, _type{ std::move(in_type) }
 {
        if (!_type) {
-               LTTNG_THROW_ERROR(fmt::format("Invalid type used to create field: field name = `{}`", name));
+               LTTNG_THROW_ERROR(
+                       fmt::format("Invalid type used to create field: field name = `{}`", name));
        }
 }
 
@@ -86,44 +87,44 @@ lst::type::cuptr lst::field::move_type() noexcept
        return std::move(_type);
 }
 
-const lst::type &lst::field::get_type() const
+const lst::typelst::field::get_type() const
 {
        if (_type) {
                return *_type;
        } else {
-               LTTNG_THROW_ERROR(fmt::format("Invalid attempt to access field type after transfer: field name = `{}`", name));
+               LTTNG_THROW_ERROR(fmt::format(
+                       "Invalid attempt to access field type after transfer: field name = `{}`",
+                       name));
        }
 }
 
 lst::integer_type::integer_type(unsigned int in_alignment,
-               enum lst::byte_order in_byte_order,
-               unsigned int in_size,
-               enum lst::integer_type::signedness in_signedness,
-               enum lst::integer_type::base in_base,
-               roles in_roles) :
+                               enum lst::byte_order in_byte_order,
+                               unsigned int in_size,
+                               enum lst::integer_type::signedness in_signedness,
+                               enum lst::integer_type::base in_base,
+                               roles in_roles) :
        type(in_alignment),
-       byte_order{in_byte_order},
-       size{in_size},
-       signedness_{in_signedness},
-       base_{in_base},
-       roles_{std::move(in_roles)}
+       byte_order{ in_byte_order },
+       size{ in_size },
+       signedness_{ in_signedness },
+       base_{ in_base },
+       roles_{ std::move(in_roles) }
 {
 }
 
 lst::type::cuptr lst::integer_type::copy() const
 {
        return lttng::make_unique<integer_type>(
-                       alignment, byte_order, size, signedness_, base_, roles_);
+               alignment, byte_order, size, signedness_, base_, roles_);
 }
 
-bool lst::integer_type::_is_equal(const type &base_other) const noexcept
+bool lst::integer_type::_is_equal(const typebase_other) const noexcept
 {
        const auto& other = static_cast<decltype(*this)&>(base_other);
 
-       return this->byte_order == other.byte_order &&
-               this->size == other.size &&
-               this->signedness_ == other.signedness_ &&
-               this->base_ == other.base_ &&
+       return this->byte_order == other.byte_order && this->size == other.size &&
+               this->signedness_ == other.signedness_ && this->base_ == other.base_ &&
                this->roles_ == other.roles_;
 }
 
@@ -142,36 +143,35 @@ lst::byte_order lst::type::reverse_byte_order(lst::byte_order byte_order) noexce
 }
 
 lst::floating_point_type::floating_point_type(unsigned int in_alignment,
-               lst::byte_order in_byte_order,
-               unsigned int in_exponent_digits,
-               unsigned int in_mantissa_digits) :
+                                             lst::byte_order in_byte_order,
+                                             unsigned int in_exponent_digits,
+                                             unsigned int in_mantissa_digits) :
        type(in_alignment),
        byte_order(in_byte_order),
-       exponent_digits{in_exponent_digits},
+       exponent_digits{ in_exponent_digits },
        mantissa_digits(in_mantissa_digits)
 {
        /* Allowed (exponent, mantissa) pairs. */
        static const std::set<std::pair<unsigned int, unsigned int>> allowed_pairs{
-                       {5, 11}, /* binary16 */
-                       {8, 24}, /* binary32 */
-                       {11, 53}, /* binary64 */
-                       {15, 113}, /* binary128 */
+               { 5, 11 }, /* binary16 */
+               { 8, 24 }, /* binary32 */
+               { 11, 53 }, /* binary64 */
+               { 15, 113 }, /* binary128 */
        };
 
-       if (allowed_pairs.find({exponent_digits, mantissa_digits}) != allowed_pairs.end()) {
+       if (allowed_pairs.find({ exponent_digits, mantissa_digits }) != allowed_pairs.end()) {
                /* mantissa and exponent digits is a valid pair. */
                return;
        }
 
-       LTTNG_THROW_INVALID_ARGUMENT_ERROR(
-                       fmt::format("Invalid exponent/mantissa values provided while creating {}",
-                                       typeid(*this)));
+       LTTNG_THROW_INVALID_ARGUMENT_ERROR(fmt::format(
+               "Invalid exponent/mantissa values provided while creating {}", typeid(*this)));
 }
 
 lst::type::cuptr lst::floating_point_type::copy() const
 {
        return lttng::make_unique<floating_point_type>(
-                       alignment, byte_order, exponent_digits, mantissa_digits);
+               alignment, byte_order, exponent_digits, mantissa_digits);
 }
 
 void lst::floating_point_type::accept(type_visitor& visitor) const
@@ -184,22 +184,18 @@ bool lst::floating_point_type::_is_equal(const type& base_other) const noexcept
        const auto& other = static_cast<decltype(*this)&>(base_other);
 
        return this->byte_order == other.byte_order &&
-                       this->exponent_digits == other.exponent_digits &&
-                       this->mantissa_digits == other.mantissa_digits;
+               this->exponent_digits == other.exponent_digits &&
+               this->mantissa_digits == other.mantissa_digits;
 }
 
 lst::enumeration_type::enumeration_type(unsigned int in_alignment,
-               enum lst::byte_order in_byte_order,
-               unsigned int in_size,
-               enum signedness in_signedness,
-               enum base in_base,
-               lst::integer_type::roles in_roles) :
-       integer_type(in_alignment,
-                       in_byte_order,
-                       in_size,
-                       in_signedness,
-                       in_base,
-                       std::move(in_roles))
+                                       enum lst::byte_order in_byte_order,
+                                       unsigned int in_size,
+                                       enum signedness in_signedness,
+                                       enum base in_base,
+                                       lst::integer_type::roles in_roles) :
+       integer_type(
+               in_alignment, in_byte_order, in_size, in_signedness, in_base, std::move(in_roles))
 {
 }
 
@@ -225,14 +221,14 @@ void unsigned_enumeration_type::accept(type_visitor& visitor) const
 
 template <>
 void variant_type<lst::signed_enumeration_type::mapping::range_t::range_integer_t>::accept(
-               lst::type_visitor& visitor) const
+       lst::type_visitor& visitor) const
 {
        visitor.visit(*this);
 }
 
 template <>
 void variant_type<lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>::accept(
-               lst::type_visitor& visitor) const
+       lst::type_visitor& visitor) const
 {
        visitor.visit(*this);
 }
@@ -241,7 +237,7 @@ void variant_type<lst::unsigned_enumeration_type::mapping::range_t::range_intege
 } /* namespace lttng */
 
 lst::array_type::array_type(unsigned int in_alignment, type::cuptr in_element_type) :
-       type(in_alignment), element_type{std::move(in_element_type)}
+       type(in_alignment), element_type{ std::move(in_element_type) }
 {
 }
 
@@ -253,10 +249,9 @@ bool lst::array_type::_is_equal(const type& base_other) const noexcept
 }
 
 lst::static_length_array_type::static_length_array_type(unsigned int in_alignment,
-               type::cuptr in_element_type,
-               uint64_t in_length) :
-       array_type(in_alignment, std::move(in_element_type)),
-       length{in_length}
+                                                       type::cuptr in_element_type,
+                                                       uint64_t in_length) :
+       array_type(in_alignment, std::move(in_element_type)), length{ in_length }
 {
 }
 
@@ -270,7 +265,7 @@ bool lst::static_length_array_type::_is_equal(const type& base_other) const noex
 lst::type::cuptr lst::static_length_array_type::copy() const
 {
        return lttng::make_unique<static_length_array_type>(
-                       alignment, element_type->copy(), length);
+               alignment, element_type->copy(), length);
 }
 
 void lst::static_length_array_type::accept(type_visitor& visitor) const
@@ -278,11 +273,12 @@ void lst::static_length_array_type::accept(type_visitor& visitor) const
        visitor.visit(*this);
 }
 
-lst::dynamic_length_array_type::dynamic_length_array_type(unsigned int in_alignment,
-               type::cuptr in_element_type,
-               lst::field_location in_length_field_location) :
+lst::dynamic_length_array_type::dynamic_length_array_type(
+       unsigned int in_alignment,
+       type::cuptr in_element_type,
+       lst::field_location in_length_field_location) :
        array_type(in_alignment, std::move(in_element_type)),
-       length_field_location{std::move(in_length_field_location)}
+       length_field_location{ std::move(in_length_field_location) }
 {
 }
 
@@ -291,13 +287,13 @@ bool lst::dynamic_length_array_type::_is_equal(const type& base_other) const noe
        const auto& other = static_cast<decltype(*this)&>(base_other);
 
        return array_type::_is_equal(base_other) &&
-                       this->length_field_location == other.length_field_location;
+               this->length_field_location == other.length_field_location;
 }
 
 lst::type::cuptr lst::dynamic_length_array_type::copy() const
 {
        return lttng::make_unique<dynamic_length_array_type>(
-                       alignment, element_type->copy(), length_field_location);
+               alignment, element_type->copy(), length_field_location);
 }
 
 void lst::dynamic_length_array_type::accept(type_visitor& visitor) const
@@ -305,9 +301,10 @@ void lst::dynamic_length_array_type::accept(type_visitor& visitor) const
        visitor.visit(*this);
 }
 
-lst::static_length_blob_type::static_length_blob_type(
-               unsigned int in_alignment, uint64_t in_length_bytes, roles in_roles) :
-       type(in_alignment), length_bytes{in_length_bytes}, roles_{std::move(in_roles)}
+lst::static_length_blob_type::static_length_blob_type(unsigned int in_alignment,
+                                                     uint64_t in_length_bytes,
+                                                     roles in_roles) :
+       type(in_alignment), length_bytes{ in_length_bytes }, roles_{ std::move(in_roles) }
 {
 }
 
@@ -329,8 +326,8 @@ void lst::static_length_blob_type::accept(type_visitor& visitor) const
 }
 
 lst::dynamic_length_blob_type::dynamic_length_blob_type(
-               unsigned int in_alignment, lst::field_location in_length_field_location) :
-       type(in_alignment), length_field_location{std::move(in_length_field_location)}
+       unsigned int in_alignment, lst::field_location in_length_field_location) :
+       type(in_alignment), length_field_location{ std::move(in_length_field_location) }
 {
 }
 
@@ -352,7 +349,7 @@ void lst::dynamic_length_blob_type::accept(type_visitor& visitor) const
 }
 
 lst::string_type::string_type(unsigned int in_alignment, enum encoding in_encoding) :
-       type(in_alignment), encoding_{in_encoding}
+       type(in_alignment), encoding_{ in_encoding }
 {
 }
 
@@ -363,9 +360,10 @@ bool lst::string_type::_is_equal(const type& base_other) const noexcept
        return this->encoding_ == other.encoding_;
 }
 
-lst::static_length_string_type::static_length_string_type(
-               unsigned int in_alignment, enum encoding in_encoding, uint64_t in_length) :
-       string_type(in_alignment, in_encoding), length{in_length}
+lst::static_length_string_type::static_length_string_type(unsigned int in_alignment,
+                                                         enum encoding in_encoding,
+                                                         uint64_t in_length) :
+       string_type(in_alignment, in_encoding), length{ in_length }
 {
 }
 
@@ -386,11 +384,12 @@ void lst::static_length_string_type::accept(type_visitor& visitor) const
        visitor.visit(*this);
 }
 
-lst::dynamic_length_string_type::dynamic_length_string_type(unsigned int in_alignment,
-               enum encoding in_encoding,
-               field_location in_length_field_location) :
+lst::dynamic_length_string_type::dynamic_length_string_type(
+       unsigned int in_alignment,
+       enum encoding in_encoding,
+       field_location in_length_field_location) :
        string_type(in_alignment, in_encoding),
-       length_field_location{std::move(in_length_field_location)}
+       length_field_location{ std::move(in_length_field_location) }
 {
 }
 
@@ -399,13 +398,13 @@ bool lst::dynamic_length_string_type::_is_equal(const type& base_other) const no
        const auto& other = static_cast<decltype(*this)&>(base_other);
 
        return string_type::_is_equal(base_other) &&
-                       this->length_field_location == other.length_field_location;
+               this->length_field_location == other.length_field_location;
 }
 
 lst::type::cuptr lst::dynamic_length_string_type::copy() const
 {
        return lttng::make_unique<dynamic_length_string_type>(
-                       alignment, encoding_, length_field_location);
+               alignment, encoding_, length_field_location);
 }
 
 void lst::dynamic_length_string_type::accept(type_visitor& visitor) const
@@ -414,7 +413,7 @@ void lst::dynamic_length_string_type::accept(type_visitor& visitor) const
 }
 
 lst::null_terminated_string_type::null_terminated_string_type(unsigned int in_alignment,
-               enum encoding in_encoding) :
+                                                             enum encoding in_encoding) :
        string_type(in_alignment, in_encoding)
 {
 }
@@ -430,13 +429,13 @@ void lst::null_terminated_string_type::accept(type_visitor& visitor) const
 }
 
 lst::structure_type::structure_type(unsigned int in_alignment, fields in_fields) :
-       type(in_alignment), fields_{std::move(in_fields)}
+       type(in_alignment), fields_{ std::move(in_fields) }
 {
 }
 
 bool lst::structure_type::_is_equal(const type& base_other) const noexcept
 {
-       const auto &other = static_cast<decltype(*this)&>(base_other);
+       const autoother = static_cast<decltype(*this)&>(base_other);
 
        return fields_are_equal(this->fields_, other.fields_);
 }
@@ -447,8 +446,8 @@ lst::type::cuptr lst::structure_type::copy() const
 
        copy_of_fields.reserve(fields_.size());
        for (const auto& field : fields_) {
-               copy_of_fields.emplace_back(lttng::make_unique<lst::field>(
-                               field->name, field->get_type().copy()));
+               copy_of_fields.emplace_back(
+                       lttng::make_unique<lst::field>(field->name, field->get_type().copy()));
        }
 
        return lttng::make_unique<structure_type>(alignment, std::move(copy_of_fields));
index c8710d62abeac9764e31c2b04d3d98139ba77d5d..2df5b1df0c047f7e15e29727d408a437d04dc719 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include "lttng-sessiond.hpp"
+
 #include <common/uuid.hpp>
 
 lttng_uuid the_sessiond_uuid;
@@ -27,7 +28,7 @@ struct lttng_ht *the_trigger_agents_ht_by_domain = NULL;
 struct lttng_kernel_abi_tracer_version the_kernel_tracer_version;
 struct lttng_kernel_abi_tracer_abi_version the_kernel_tracer_abi_version;
 
-int the_kernel_poll_pipe[2] = {-1, -1};
+int the_kernel_poll_pipe[2] = { -1, -1 };
 
 pid_t the_ppid;
 pid_t the_child_ppid;
index 6457cb31b12d8e4d6bb525863c01b83757703c2a..bd9d46bb6dc0f06b8197e6fe0dc2c8740893c683 100644 (file)
@@ -6,16 +6,18 @@
  *
  */
 
-#include "lttng-sessiond.hpp"
 #include "health-sessiond.hpp"
-#include <common/macros.hpp>
+#include "lttng-sessiond.hpp"
+#include "thread.hpp"
+#include "utils.hpp"
+
 #include <common/error.hpp>
-#include <common/utils.hpp>
+#include <common/macros.hpp>
 #include <common/pipe.hpp>
+#include <common/utils.hpp>
+
 #include <inttypes.h>
 #include <sys/stat.h>
-#include "utils.hpp"
-#include "thread.hpp"
 
 namespace {
 struct thread_notifiers {
@@ -24,15 +26,13 @@ struct thread_notifiers {
 };
 } /* namespace */
 
-static
-void mark_thread_as_ready(struct thread_notifiers *notifiers)
+static void mark_thread_as_ready(struct thread_notifiers *notifiers)
 {
        DBG("Marking health management thread as ready");
        sem_post(&notifiers->ready);
 }
 
-static
-void wait_until_thread_is_ready(struct thread_notifiers *notifiers)
+static void wait_until_thread_is_ready(struct thread_notifiers *notifiers)
 {
        DBG("Waiting for health management thread to be ready");
        sem_wait(&notifiers->ready);
@@ -61,8 +61,7 @@ static void *thread_manage_health(void *data)
        struct health_comm_reply reply;
        /* Thread-specific quit pipe. */
        struct thread_notifiers *notifiers = (thread_notifiers *) data;
-       const auto thread_quit_pipe_fd = lttng_pipe_get_readfd(
-                       notifiers->quit_pipe);
+       const auto thread_quit_pipe_fd = lttng_pipe_get_readfd(notifiers->quit_pipe);
 
        DBG("[thread] Manage health check started");
 
@@ -103,9 +102,10 @@ static void *thread_manage_health(void *data)
                }
 
                ret = chmod(the_config.health_unix_sock_path.value,
-                               S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+                           S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
                if (ret < 0) {
-                       ERR("Unable to set permissions on %s", the_config.health_unix_sock_path.value);
+                       ERR("Unable to set permissions on %s",
+                           the_config.health_unix_sock_path.value);
                        PERROR("chmod");
                        goto error;
                }
@@ -138,7 +138,7 @@ static void *thread_manage_health(void *data)
                DBG("Health check ready");
 
                /* Infinite blocking call, waiting for transmission */
-restart:
+       restart:
                ret = lttng_poll_wait(&events, -1);
                if (ret < 0) {
                        /*
@@ -188,7 +188,7 @@ restart:
                (void) utils_set_fd_cloexec(new_sock);
 
                DBG("Receiving data from client for health...");
-               ret = lttcomm_recv_unix_sock(new_sock, (void *)&msg, sizeof(msg));
+               ret = lttcomm_recv_unix_sock(new_sock, (void *) &msg, sizeof(msg));
                if (ret <= 0) {
                        DBG("Nothing recv() from client... continuing");
                        ret = close(new_sock);
@@ -213,8 +213,7 @@ restart:
 
                DBG2("Health check return value %" PRIx64, reply.ret_code);
 
-               ret = lttcomm_send_unix_sock(new_sock, (void *) &reply,
-                               sizeof(reply));
+               ret = lttcomm_send_unix_sock(new_sock, (void *) &reply, sizeof(reply));
                if (ret < 0) {
                        ERR("Failed to send health data back to client");
                }
@@ -247,7 +246,7 @@ error:
 
 static bool shutdown_health_management_thread(void *data)
 {
-       struct thread_notifiers *notifiers = ( thread_notifiers *) data;
+       struct thread_notifiers *notifiers = (thread_notifiers *) data;
        const int write_fd = lttng_pipe_get_writefd(notifiers->quit_pipe);
 
        return notify_thread_pipe(write_fd) == 1;
@@ -269,10 +268,10 @@ bool launch_health_management_thread(void)
                goto error;
        }
        thread = lttng_thread_create("Health management",
-                       thread_manage_health,
-                       shutdown_health_management_thread,
-                       cleanup_health_management_thread,
-                       notifiers);
+                                    thread_manage_health,
+                                    shutdown_health_management_thread,
+                                    cleanup_health_management_thread,
+                                    notifiers);
        if (!thread) {
                goto error;
        }
index b51b56c3e772e2e1a213853266f10b79f30591ab..15558f207c219d9294d318c40261c86d882dc7ec 100644 (file)
@@ -6,25 +6,24 @@
  */
 
 #define _LGPL_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <inttypes.h>
-
-#include <common/common.hpp>
-#include <common/defaults.hpp>
-#include <common/compat/string.hpp>
-
 #include "consumer.hpp"
 #include "health-sessiond.hpp"
 #include "kernel-consumer.hpp"
+#include "lttng-sessiond.hpp"
 #include "notification-thread-commands.hpp"
 #include "session.hpp"
-#include "lttng-sessiond.hpp"
 
-static char *create_channel_path(struct consumer_output *consumer,
-               size_t *consumer_path_offset)
+#include <common/common.hpp>
+#include <common/compat/string.hpp>
+#include <common/defaults.hpp>
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+static char *create_channel_path(struct consumer_output *consumer, size_t *consumer_path_offset)
 {
        int ret;
        char tmp_path[PATH_MAX];
@@ -34,31 +33,33 @@ static char *create_channel_path(struct consumer_output *consumer,
 
        /* Get the right path name destination */
        if (consumer->type == CONSUMER_DST_LOCAL ||
-                       (consumer->type == CONSUMER_DST_NET &&
-                                       consumer->relay_major_version == 2 &&
-                                       consumer->relay_minor_version >= 11)) {
+           (consumer->type == CONSUMER_DST_NET && consumer->relay_major_version == 2 &&
+            consumer->relay_minor_version >= 11)) {
                pathname = strdup(consumer->domain_subdir);
                if (!pathname) {
                        PERROR("Failed to copy domain subdirectory string %s",
-                                       consumer->domain_subdir);
+                              consumer->domain_subdir);
                        goto error;
                }
                *consumer_path_offset = strlen(consumer->domain_subdir);
                DBG3("Kernel local consumer trace path relative to current trace chunk: \"%s\"",
-                               pathname);
+                    pathname);
        } else {
                /* Network output, relayd < 2.11. */
-               ret = snprintf(tmp_path, sizeof(tmp_path), "%s%s",
-                               consumer->dst.net.base_dir,
-                               consumer->domain_subdir);
+               ret = snprintf(tmp_path,
+                              sizeof(tmp_path),
+                              "%s%s",
+                              consumer->dst.net.base_dir,
+                              consumer->domain_subdir);
                if (ret < 0) {
                        PERROR("snprintf kernel metadata path");
                        goto error;
                } else if (ret >= sizeof(tmp_path)) {
                        ERR("Kernel channel path exceeds the maximal allowed length of of %zu bytes (%i bytes required) with path \"%s%s\"",
-                                       sizeof(tmp_path), ret,
-                                       consumer->dst.net.base_dir,
-                                       consumer->domain_subdir);
+                           sizeof(tmp_path),
+                           ret,
+                           consumer->dst.net.base_dir,
+                           consumer->domain_subdir);
                        goto error;
                }
                pathname = lttng_strndup(tmp_path, sizeof(tmp_path));
@@ -80,11 +81,10 @@ error:
 /*
  * Sending a single channel to the consumer with command ADD_CHANNEL.
  */
-static
-int kernel_consumer_add_channel(struct consumer_socket *sock,
-               struct ltt_kernel_channel *channel,
-               struct ltt_kernel_session *ksession,
-               unsigned int monitor)
+static int kernel_consumer_add_channel(struct consumer_socket *sock,
+                                      struct ltt_kernel_channel *channel,
+                                      struct ltt_kernel_session *ksession,
+                                      unsigned int monitor)
 {
        int ret;
        char *pathname = NULL;
@@ -102,11 +102,10 @@ int kernel_consumer_add_channel(struct consumer_socket *sock,
        LTTNG_ASSERT(ksession->consumer);
 
        consumer = ksession->consumer;
-       channel_attr_extended = (struct lttng_channel_extended *)
-                       channel->channel->attr.extended.ptr;
+       channel_attr_extended =
+               (struct lttng_channel_extended *) channel->channel->attr.extended.ptr;
 
-       DBG("Kernel consumer adding channel %s to kernel consumer",
-                       channel->channel->name);
+       DBG("Kernel consumer adding channel %s to kernel consumer", channel->channel->name);
        is_local_trace = consumer->net_seq_index == -1ULL;
 
        pathname = create_channel_path(consumer, &consumer_path_offset);
@@ -119,8 +118,7 @@ int kernel_consumer_add_channel(struct consumer_socket *sock,
                enum lttng_trace_chunk_status chunk_status;
                char *pathname_index;
 
-               ret = asprintf(&pathname_index, "%s/" DEFAULT_INDEX_DIR,
-                               pathname);
+               ret = asprintf(&pathname_index, "%s/" DEFAULT_INDEX_DIR, pathname);
                if (ret < 0) {
                        ERR("Failed to format channel index directory");
                        ret = -1;
@@ -131,8 +129,8 @@ int kernel_consumer_add_channel(struct consumer_socket *sock,
                 * Create the index subdirectory which will take care
                 * of implicitly creating the channel's path.
                 */
-               chunk_status = lttng_trace_chunk_create_subdirectory(
-                               ksession->current_trace_chunk, pathname_index);
+               chunk_status = lttng_trace_chunk_create_subdirectory(ksession->current_trace_chunk,
+                                                                    pathname_index);
                free(pathname_index);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ret = -1;
@@ -142,21 +140,21 @@ int kernel_consumer_add_channel(struct consumer_socket *sock,
 
        /* Prep channel message structure */
        consumer_init_add_channel_comm_msg(&lkm,
-                       channel->key,
-                       ksession->id,
-                       &pathname[consumer_path_offset],
-                       consumer->net_seq_index,
-                       channel->channel->name,
-                       channel->stream_count,
-                       channel->channel->attr.output,
-                       CONSUMER_CHANNEL_TYPE_DATA,
-                       channel->channel->attr.tracefile_size,
-                       channel->channel->attr.tracefile_count,
-                       monitor,
-                       channel->channel->attr.live_timer_interval,
-                       ksession->is_live_session,
-                       channel_attr_extended->monitor_timer_interval,
-                       ksession->current_trace_chunk);
+                                          channel->key,
+                                          ksession->id,
+                                          &pathname[consumer_path_offset],
+                                          consumer->net_seq_index,
+                                          channel->channel->name,
+                                          channel->stream_count,
+                                          channel->channel->attr.output,
+                                          CONSUMER_CHANNEL_TYPE_DATA,
+                                          channel->channel->attr.tracefile_size,
+                                          channel->channel->attr.tracefile_count,
+                                          monitor,
+                                          channel->channel->attr.live_timer_interval,
+                                          ksession->is_live_session,
+                                          channel_attr_extended->monitor_timer_interval,
+                                          ksession->current_trace_chunk);
 
        health_code_update();
 
@@ -173,8 +171,12 @@ int kernel_consumer_add_channel(struct consumer_socket *sock,
        ASSERT_SESSION_LIST_LOCKED();
 
        status = notification_thread_command_add_channel(the_notification_thread_handle,
-                       session->id, channel->channel->name, channel->key, LTTNG_DOMAIN_KERNEL,
-                       channel->channel->attr.subbuf_size * channel->channel->attr.num_subbuf);
+                                                        session->id,
+                                                        channel->channel->name,
+                                                        channel->key,
+                                                        LTTNG_DOMAIN_KERNEL,
+                                                        channel->channel->attr.subbuf_size *
+                                                                channel->channel->attr.num_subbuf);
        rcu_read_unlock();
        if (status != LTTNG_OK) {
                ret = -1;
@@ -197,7 +199,8 @@ error:
  * The consumer socket lock must be held by the caller.
  */
 int kernel_consumer_add_metadata(struct consumer_socket *sock,
-               struct ltt_kernel_session *ksession, unsigned int monitor)
+                                struct ltt_kernel_session *ksession,
+                                unsigned int monitor)
 {
        int ret;
        struct lttcomm_consumer_msg lkm;
@@ -210,29 +213,28 @@ int kernel_consumer_add_metadata(struct consumer_socket *sock,
        LTTNG_ASSERT(ksession->consumer);
        LTTNG_ASSERT(sock);
 
-       DBG("Sending metadata %d to kernel consumer",
-                       ksession->metadata_stream_fd);
+       DBG("Sending metadata %d to kernel consumer", ksession->metadata_stream_fd);
 
        /* Get consumer output pointer */
        consumer = ksession->consumer;
 
        /* Prep channel message structure */
        consumer_init_add_channel_comm_msg(&lkm,
-                       ksession->metadata->key,
-                       ksession->id,
-                       "",
-                       consumer->net_seq_index,
-                       ksession->metadata->conf->name,
-                       1,
-                       ksession->metadata->conf->attr.output,
-                       CONSUMER_CHANNEL_TYPE_METADATA,
-                       ksession->metadata->conf->attr.tracefile_size,
-                       ksession->metadata->conf->attr.tracefile_count,
-                       monitor,
-                       ksession->metadata->conf->attr.live_timer_interval,
-                       ksession->is_live_session,
-                       0,
-                       ksession->current_trace_chunk);
+                                          ksession->metadata->key,
+                                          ksession->id,
+                                          "",
+                                          consumer->net_seq_index,
+                                          ksession->metadata->conf->name,
+                                          1,
+                                          ksession->metadata->conf->attr.output,
+                                          CONSUMER_CHANNEL_TYPE_METADATA,
+                                          ksession->metadata->conf->attr.tracefile_size,
+                                          ksession->metadata->conf->attr.tracefile_count,
+                                          monitor,
+                                          ksession->metadata->conf->attr.live_timer_interval,
+                                          ksession->is_live_session,
+                                          0,
+                                          ksession->current_trace_chunk);
 
        health_code_update();
 
@@ -245,15 +247,14 @@ int kernel_consumer_add_metadata(struct consumer_socket *sock,
 
        /* Prep stream message structure */
        consumer_init_add_stream_comm_msg(&lkm,
-                       ksession->metadata->key,
-                       ksession->metadata_stream_fd,
-                       0 /* CPU: 0 for metadata. */);
+                                         ksession->metadata->key,
+                                         ksession->metadata_stream_fd,
+                                         0 /* CPU: 0 for metadata. */);
 
        health_code_update();
 
        /* Send stream and file descriptor */
-       ret = consumer_send_stream(sock, consumer, &lkm,
-                       &ksession->metadata_stream_fd, 1);
+       ret = consumer_send_stream(sock, consumer, &lkm, &ksession->metadata_stream_fd, 1);
        if (ret < 0) {
                goto error;
        }
@@ -268,11 +269,10 @@ error:
 /*
  * Sending a single stream to the consumer with command ADD_STREAM.
  */
-static
-int kernel_consumer_add_stream(struct consumer_socket *sock,
-               struct ltt_kernel_channel *channel,
-               struct ltt_kernel_stream *stream,
-               struct ltt_kernel_session *session)
+static int kernel_consumer_add_stream(struct consumer_socket *sock,
+                                     struct ltt_kernel_channel *channel,
+                                     struct ltt_kernel_stream *stream,
+                                     struct ltt_kernel_session *session)
 {
        int ret;
        struct lttcomm_consumer_msg lkm;
@@ -285,16 +285,14 @@ int kernel_consumer_add_stream(struct consumer_socket *sock,
        LTTNG_ASSERT(sock);
 
        DBG("Sending stream %d of channel %s to kernel consumer",
-                       stream->fd, channel->channel->name);
+           stream->fd,
+           channel->channel->name);
 
        /* Get consumer output pointer */
        consumer = session->consumer;
 
        /* Prep stream consumer message */
-       consumer_init_add_stream_comm_msg(&lkm,
-                       channel->key,
-                       stream->fd,
-                       stream->cpu);
+       consumer_init_add_stream_comm_msg(&lkm, channel->key, stream->fd, stream->cpu);
 
        health_code_update();
 
@@ -314,7 +312,8 @@ error:
  * Sending the notification that all streams were sent with STREAMS_SENT.
  */
 int kernel_consumer_streams_sent(struct consumer_socket *sock,
-               struct ltt_kernel_session *session, uint64_t channel_key)
+                                struct ltt_kernel_session *session,
+                                uint64_t channel_key)
 {
        int ret;
        struct lttcomm_consumer_msg lkm;
@@ -328,9 +327,8 @@ int kernel_consumer_streams_sent(struct consumer_socket *sock,
        consumer = session->consumer;
 
        /* Prep stream consumer message */
-       consumer_init_streams_sent_comm_msg(&lkm,
-                       LTTNG_CONSUMER_STREAMS_SENT,
-                       channel_key, consumer->net_seq_index);
+       consumer_init_streams_sent_comm_msg(
+               &lkm, LTTNG_CONSUMER_STREAMS_SENT, channel_key, consumer->net_seq_index);
 
        health_code_update();
 
@@ -350,8 +348,9 @@ error:
  * The consumer socket lock must be held by the caller.
  */
 int kernel_consumer_send_channel_streams(struct consumer_socket *sock,
-               struct ltt_kernel_channel *channel, struct ltt_kernel_session *ksession,
-               unsigned int monitor)
+                                        struct ltt_kernel_channel *channel,
+                                        struct ltt_kernel_session *ksession,
+                                        unsigned int monitor)
 {
        int ret = LTTNG_OK;
        struct ltt_kernel_stream *stream;
@@ -370,8 +369,7 @@ int kernel_consumer_send_channel_streams(struct consumer_socket *sock,
                goto error;
        }
 
-       DBG("Sending streams of channel %s to kernel consumer",
-                       channel->channel->name);
+       DBG("Sending streams of channel %s to kernel consumer", channel->channel->name);
 
        if (!channel->sent_to_consumer) {
                ret = kernel_consumer_add_channel(sock, channel, ksession, monitor);
@@ -382,14 +380,13 @@ int kernel_consumer_send_channel_streams(struct consumer_socket *sock,
        }
 
        /* Send streams */
-       cds_list_for_each_entry(stream, &channel->stream_list.head, list) {
+       cds_list_for_each_entry (stream, &channel->stream_list.head, list) {
                if (!stream->fd || stream->sent_to_consumer) {
                        continue;
                }
 
                /* Add stream on the kernel consumer side. */
-               ret = kernel_consumer_add_stream(sock, channel, stream,
-                               ksession);
+               ret = kernel_consumer_add_stream(sock, channel, stream, ksession);
                if (ret < 0) {
                        goto error;
                }
@@ -406,8 +403,7 @@ error:
  *
  * The consumer socket lock must be held by the caller.
  */
-int kernel_consumer_send_session(struct consumer_socket *sock,
-               struct ltt_kernel_session *session)
+int kernel_consumer_send_session(struct consumer_socket *sock, struct ltt_kernel_session *session)
 {
        int ret, monitor = 0;
        struct ltt_kernel_channel *chan;
@@ -438,9 +434,8 @@ int kernel_consumer_send_session(struct consumer_socket *sock,
        }
 
        /* Send channel and streams of it */
-       cds_list_for_each_entry(chan, &session->channel_list.head, list) {
-               ret = kernel_consumer_send_channel_streams(sock, chan, session,
-                               monitor);
+       cds_list_for_each_entry (chan, &session->channel_list.head, list) {
+               ret = kernel_consumer_send_channel_streams(sock, chan, session, monitor);
                if (ret < 0) {
                        goto error;
                }
@@ -466,7 +461,7 @@ error:
 }
 
 int kernel_consumer_destroy_channel(struct consumer_socket *socket,
-               struct ltt_kernel_channel *channel)
+                                   struct ltt_kernel_channel *channel)
 {
        int ret;
        struct lttcomm_consumer_msg msg;
@@ -495,7 +490,7 @@ error:
 }
 
 int kernel_consumer_destroy_metadata(struct consumer_socket *socket,
-               struct ltt_kernel_metadata *metadata)
+                                    struct ltt_kernel_metadata *metadata)
 {
        int ret;
        struct lttcomm_consumer_msg msg;
index f7d232ffc01aadb346b5fdf6d8c4928ea5163727..b4b8dab278caa8235e373d0f7b69aacacd062504 100644 (file)
@@ -6,48 +6,48 @@
  */
 
 #define _LGPL_SOURCE
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <inttypes.h>
-#include <sys/types.h>
+#include "condition-internal.hpp"
+#include "consumer.hpp"
+#include "event-notifier-error-accounting.hpp"
+#include "kern-modules.hpp"
+#include "kernel-consumer.hpp"
+#include "kernel.hpp"
+#include "lttng-sessiond.hpp"
+#include "lttng-syscall.hpp"
+#include "modprobe.hpp"
+#include "notification-thread-commands.hpp"
+#include "rotate.hpp"
+#include "sessiond-config.hpp"
+#include "tracker.hpp"
+#include "utils.hpp"
 
 #include <common/common.hpp>
 #include <common/hashtable/utils.hpp>
-#include <common/trace-chunk.hpp>
 #include <common/kernel-ctl/kernel-ctl.hpp>
 #include <common/kernel-ctl/kernel-ioctl.hpp>
 #include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/trace-chunk.hpp>
 #include <common/tracker.hpp>
 #include <common/utils.hpp>
-#include <lttng/event.h>
-#include <lttng/lttng-error.h>
-#include <lttng/tracker.h>
 
-#include <lttng/userspace-probe.h>
-#include <lttng/userspace-probe-internal.hpp>
-#include <lttng/condition/event-rule-matches.h>
 #include <lttng/condition/event-rule-matches-internal.hpp>
-#include <lttng/event-rule/event-rule.h>
+#include <lttng/condition/event-rule-matches.h>
 #include <lttng/event-rule/event-rule-internal.hpp>
+#include <lttng/event-rule/event-rule.h>
 #include <lttng/event-rule/kernel-uprobe-internal.hpp>
+#include <lttng/event.h>
+#include <lttng/lttng-error.h>
+#include <lttng/tracker.h>
+#include <lttng/userspace-probe-internal.hpp>
+#include <lttng/userspace-probe.h>
 
-#include "event-notifier-error-accounting.hpp"
-#include "lttng-sessiond.hpp"
-#include "lttng-syscall.hpp"
-#include "condition-internal.hpp"
-#include "consumer.hpp"
-#include "kernel.hpp"
-#include "kernel-consumer.hpp"
-#include "kern-modules.hpp"
-#include "sessiond-config.hpp"
-#include "utils.hpp"
-#include "rotate.hpp"
-#include "modprobe.hpp"
-#include "tracker.hpp"
-#include "notification-thread-commands.hpp"
+#include <fcntl.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 /*
  * Key used to reference a channel between the sessiond and the consumer. This
@@ -67,8 +67,7 @@ static struct cds_lfht *kernel_token_to_event_notifier_rule_ht;
  *
  * Assumes the ownership of ctx.
  */
-int kernel_add_channel_context(struct ltt_kernel_channel *chan,
-               struct ltt_kernel_context *ctx)
+int kernel_add_channel_context(struct ltt_kernel_channel *chan, struct ltt_kernel_context *ctx)
 {
        int ret;
 
@@ -155,13 +154,15 @@ int kernel_create_session(struct ltt_session *session)
        }
        if (ret) {
                WARN("Could not set kernel session name for session %" PRIu64 " name: %s",
-                       session->id, session->name);
+                    session->id,
+                    session->name);
        }
 
        ret = kernctl_session_set_creation_time(lks->fd, session->creation_time);
        if (ret) {
                WARN("Could not set kernel session creation time for session %" PRIu64 " name: %s",
-                       session->id, session->name);
+                    session->id,
+                    session->name);
        }
 
        return 0;
@@ -178,8 +179,7 @@ error:
  * Create a kernel channel, register it to the kernel tracer and add it to the
  * kernel session.
  */
-int kernel_create_channel(struct ltt_kernel_session *session,
-               struct lttng_channel *chan)
+int kernel_create_channel(struct ltt_kernel_session *session, struct lttng_channel *chan)
 {
        int ret;
        struct ltt_kernel_channel *lkc;
@@ -194,10 +194,14 @@ int kernel_create_channel(struct ltt_kernel_session *session,
        }
 
        DBG3("Kernel create channel %s with attr: %d, %" PRIu64 ", %" PRIu64 ", %u, %u, %d, %d",
-                       chan->name, lkc->channel->attr.overwrite,
-                       lkc->channel->attr.subbuf_size, lkc->channel->attr.num_subbuf,
-                       lkc->channel->attr.switch_timer_interval, lkc->channel->attr.read_timer_interval,
-                       lkc->channel->attr.live_timer_interval, lkc->channel->attr.output);
+            chan->name,
+            lkc->channel->attr.overwrite,
+            lkc->channel->attr.subbuf_size,
+            lkc->channel->attr.num_subbuf,
+            lkc->channel->attr.switch_timer_interval,
+            lkc->channel->attr.read_timer_interval,
+            lkc->channel->attr.live_timer_interval,
+            lkc->channel->attr.output);
 
        /* Kernel tracer channel creation */
        ret = kernctl_create_channel(session->fd, &lkc->channel->attr);
@@ -221,7 +225,9 @@ int kernel_create_channel(struct ltt_kernel_session *session,
        lkc->key = ++next_kernel_channel_key;
 
        DBG("Kernel channel %s created (fd: %d, key: %" PRIu64 ")",
-                       lkc->channel->name, lkc->fd, lkc->key);
+           lkc->channel->name,
+           lkc->fd,
+           lkc->key);
 
        return 0;
 
@@ -258,7 +264,7 @@ static int kernel_create_event_notifier_group(int *event_notifier_group_fd)
        ret = fcntl(local_fd, F_SETFD, FD_CLOEXEC);
        if (ret < 0) {
                PERROR("Failed to set FD_CLOEXEC on kernel event notifier group file descriptor: fd = %d",
-                               local_fd);
+                      local_fd);
                goto error;
        }
 
@@ -271,7 +277,7 @@ error:
                ret = close(local_fd);
                if (ret) {
                        PERROR("Failed to close kernel event notifier group file descriptor: fd = %d",
-                                       local_fd);
+                              local_fd);
                }
        }
 
@@ -286,10 +292,11 @@ error:
  * elf symbol
  * Returns -1 on error
  */
-static
-int extract_userspace_probe_offset_function_elf(
-               const struct lttng_userspace_probe_location *probe_location,
-               uid_t uid, gid_t gid, uint64_t *offset)
+static int extract_userspace_probe_offset_function_elf(
+       const struct lttng_userspace_probe_location *probe_location,
+       uid_t uid,
+       gid_t gid,
+       uint64_t *offset)
 {
        int fd;
        int ret = 0;
@@ -298,23 +305,20 @@ int extract_userspace_probe_offset_function_elf(
        enum lttng_userspace_probe_location_lookup_method_type lookup_method_type;
 
        LTTNG_ASSERT(lttng_userspace_probe_location_get_type(probe_location) ==
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
+                    LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
 
-       lookup = lttng_userspace_probe_location_get_lookup_method(
-                       probe_location);
+       lookup = lttng_userspace_probe_location_get_lookup_method(probe_location);
        if (!lookup) {
                ret = -1;
                goto end;
        }
 
-       lookup_method_type =
-                       lttng_userspace_probe_location_lookup_method_get_type(lookup);
+       lookup_method_type = lttng_userspace_probe_location_lookup_method_get_type(lookup);
 
        LTTNG_ASSERT(lookup_method_type ==
-                       LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF);
+                    LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF);
 
-       symbol = lttng_userspace_probe_location_function_get_function_name(
-                       probe_location);
+       symbol = lttng_userspace_probe_location_function_get_function_name(probe_location);
        if (!symbol) {
                ret = -1;
                goto end;
@@ -329,11 +333,12 @@ int extract_userspace_probe_offset_function_elf(
        ret = run_as_extract_elf_symbol_offset(fd, symbol, uid, gid, offset);
        if (ret < 0) {
                DBG("userspace probe offset calculation failed for "
-                               "function %s", symbol);
+                   "function %s",
+                   symbol);
                goto end;
        }
 
-       DBG("userspace probe elf offset for %s is 0x%jd", symbol, (intmax_t)(*offset));
+       DBG("userspace probe elf offset for %s is 0x%jd", symbol, (intmax_t) (*offset));
 end:
        return ret;
 }
@@ -347,11 +352,12 @@ end:
  * SDT tracepoint.
  * Returns -1 on error.
  */
-static
-int extract_userspace_probe_offset_tracepoint_sdt(
-               const struct lttng_userspace_probe_location *probe_location,
-               uid_t uid, gid_t gid, uint64_t **offsets,
-               uint32_t *offsets_count)
+static int extract_userspace_probe_offset_tracepoint_sdt(
+       const struct lttng_userspace_probe_location *probe_location,
+       uid_t uid,
+       gid_t gid,
+       uint64_t **offsets,
+       uint32_t *offsets_count)
 {
        enum lttng_userspace_probe_location_lookup_method_type lookup_method_type;
        const struct lttng_userspace_probe_location_lookup_method *lookup = NULL;
@@ -360,7 +366,7 @@ int extract_userspace_probe_offset_tracepoint_sdt(
        int fd, i;
 
        LTTNG_ASSERT(lttng_userspace_probe_location_get_type(probe_location) ==
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
+                    LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
 
        lookup = lttng_userspace_probe_location_get_lookup_method(probe_location);
        if (!lookup) {
@@ -368,22 +374,18 @@ int extract_userspace_probe_offset_tracepoint_sdt(
                goto end;
        }
 
-       lookup_method_type =
-                       lttng_userspace_probe_location_lookup_method_get_type(lookup);
+       lookup_method_type = lttng_userspace_probe_location_lookup_method_get_type(lookup);
 
        LTTNG_ASSERT(lookup_method_type ==
-                       LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT);
-
+                    LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT);
 
-       probe_name = lttng_userspace_probe_location_tracepoint_get_probe_name(
-                       probe_location);
+       probe_name = lttng_userspace_probe_location_tracepoint_get_probe_name(probe_location);
        if (!probe_name) {
                ret = -1;
                goto end;
        }
 
-       provider_name = lttng_userspace_probe_location_tracepoint_get_provider_name(
-                       probe_location);
+       provider_name = lttng_userspace_probe_location_tracepoint_get_provider_name(probe_location);
        if (!provider_name) {
                ret = -1;
                goto end;
@@ -395,11 +397,13 @@ int extract_userspace_probe_offset_tracepoint_sdt(
                goto end;
        }
 
-       ret = run_as_extract_sdt_probe_offsets(fd, provider_name, probe_name,
-                       uid, gid, offsets, offsets_count);
+       ret = run_as_extract_sdt_probe_offsets(
+               fd, provider_name, probe_name, uid, gid, offsets, offsets_count);
        if (ret < 0) {
                DBG("userspace probe offset calculation failed for sdt "
-                               "probe %s:%s", provider_name, probe_name);
+                   "probe %s:%s",
+                   provider_name,
+                   probe_name);
                goto end;
        }
 
@@ -409,18 +413,20 @@ int extract_userspace_probe_offset_tracepoint_sdt(
        }
 
        DBG("%u userspace probe SDT offsets found for %s:%s at:",
-                       *offsets_count, provider_name, probe_name);
+           *offsets_count,
+           provider_name,
+           probe_name);
        for (i = 0; i < *offsets_count; i++) {
-               DBG("\t0x%jd", (intmax_t)((*offsets)[i]));
+               DBG("\t0x%jd", (intmax_t) ((*offsets)[i]));
        }
 end:
        return ret;
 }
 
-static
-int userspace_probe_add_callsite(
-               const struct lttng_userspace_probe_location *location,
-               uid_t uid, gid_t gid, int fd)
+static int userspace_probe_add_callsite(const struct lttng_userspace_probe_location *location,
+                                       uid_t uid,
+                                       gid_t gid,
+                                       int fd)
 {
        const struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
        enum lttng_userspace_probe_location_lookup_method_type type;
@@ -439,8 +445,7 @@ int userspace_probe_add_callsite(
                struct lttng_kernel_abi_event_callsite callsite;
                uint64_t offset;
 
-               ret = extract_userspace_probe_offset_function_elf(location,
-                               uid, gid, &offset);
+               ret = extract_userspace_probe_offset_function_elf(location, uid, gid, &offset);
                if (ret) {
                        ret = LTTNG_ERR_PROBE_LOCATION_INVAL;
                        goto end;
@@ -466,8 +471,8 @@ int userspace_probe_add_callsite(
                 * This call allocates the offsets buffer. This buffer must be freed
                 * by the caller
                 */
-               ret = extract_userspace_probe_offset_tracepoint_sdt(location,
-                               uid, gid, &offsets, &offsets_count);
+               ret = extract_userspace_probe_offset_tracepoint_sdt(
+                       location, uid, gid, &offsets, &offsets_count);
                if (ret) {
                        ret = LTTNG_ERR_PROBE_LOCATION_INVAL;
                        goto end;
@@ -497,9 +502,9 @@ end:
  * Extract the offsets of the instrumentation point for the different lookup
  * methods.
  */
-static
-int userspace_probe_event_add_callsites(struct lttng_event *ev,
-                       struct ltt_kernel_session *session, int fd)
+static int userspace_probe_event_add_callsites(struct lttng_event *ev,
+                                              struct ltt_kernel_session *session,
+                                              int fd)
 {
        int ret;
        const struct lttng_userspace_probe_location *location = NULL;
@@ -513,11 +518,9 @@ int userspace_probe_event_add_callsites(struct lttng_event *ev,
                goto end;
        }
 
-       ret = userspace_probe_add_callsite(location, session->uid, session->gid,
-               fd);
+       ret = userspace_probe_add_callsite(location, session->uid, session->gid, fd);
        if (ret) {
-               WARN("Failed to add callsite to userspace probe event '%s'",
-                               ev->name);
+               WARN("Failed to add callsite to userspace probe event '%s'", ev->name);
        }
 
 end:
@@ -528,10 +531,9 @@ end:
  * Extract the offsets of the instrumentation point for the different look-up
  * methods.
  */
-static int userspace_probe_event_rule_add_callsites(
-               const struct lttng_event_rule *rule,
-               const struct lttng_credentials *creds,
-               int fd)
+static int userspace_probe_event_rule_add_callsites(const struct lttng_event_rule *rule,
+                                                   const struct lttng_credentials *creds,
+                                                   int fd)
 {
        int ret;
        enum lttng_event_rule_status status;
@@ -550,12 +552,10 @@ static int userspace_probe_event_rule_add_callsites(
                goto end;
        }
 
-       ret = userspace_probe_add_callsite(location,
-                       lttng_credentials_get_uid(creds),
-                       lttng_credentials_get_gid(creds), fd);
+       ret = userspace_probe_add_callsite(
+               location, lttng_credentials_get_uid(creds), lttng_credentials_get_gid(creds), fd);
        if (ret) {
-               WARN("Failed to add callsite to user space probe object: fd = %d",
-                               fd);
+               WARN("Failed to add callsite to user space probe object: fd = %d", fd);
        }
 
 end:
@@ -568,9 +568,9 @@ end:
  * We own filter_expression and filter.
  */
 int kernel_create_event(struct lttng_event *ev,
-               struct ltt_kernel_channel *channel,
-               char *filter_expression,
-               struct lttng_bytecode *filter)
+                       struct ltt_kernel_channel *channel,
+                       char *filter_expression,
+                       struct lttng_bytecode *filter)
 {
        int err, fd;
        enum lttng_error_code ret;
@@ -580,8 +580,7 @@ int kernel_create_event(struct lttng_event *ev,
        LTTNG_ASSERT(channel);
 
        /* We pass ownership of filter_expression and filter */
-       ret = trace_kernel_create_event(ev, filter_expression,
-                       filter, &event);
+       ret = trace_kernel_create_event(ev, filter_expression, filter, &event);
        if (ret != LTTNG_OK) {
                goto error;
        }
@@ -631,8 +630,8 @@ int kernel_create_event(struct lttng_event *ev,
        }
 
        if (ev->type == LTTNG_EVENT_USERSPACE_PROBE) {
-               ret = (lttng_error_code) userspace_probe_event_add_callsites(ev, channel->session,
-                               event->fd);
+               ret = (lttng_error_code) userspace_probe_event_add_callsites(
+                       ev, channel->session, event->fd);
                if (ret) {
                        goto add_callsite_error;
                }
@@ -663,14 +662,14 @@ int kernel_create_event(struct lttng_event *ev,
 add_callsite_error:
 enable_error:
 filter_error:
-       {
-               int closeret;
+{
+       int closeret;
 
-               closeret = close(event->fd);
-               if (closeret) {
-                       PERROR("close event fd");
-               }
+       closeret = close(event->fd);
+       if (closeret) {
+               PERROR("close event fd");
        }
+}
 free_event:
        free(event);
 error:
@@ -694,7 +693,9 @@ int kernel_disable_channel(struct ltt_kernel_channel *chan)
 
        chan->enabled = 0;
        DBG("Kernel channel %s disabled (fd: %d, key: %" PRIu64 ")",
-                       chan->channel->name, chan->fd, chan->key);
+           chan->channel->name,
+           chan->fd,
+           chan->key);
 
        return 0;
 
@@ -719,7 +720,9 @@ int kernel_enable_channel(struct ltt_kernel_channel *chan)
 
        chan->enabled = 1;
        DBG("Kernel channel %s enabled (fd: %d, key: %" PRIu64 ")",
-                       chan->channel->name, chan->fd, chan->key);
+           chan->channel->name,
+           chan->fd,
+           chan->key);
 
        return 0;
 
@@ -770,7 +773,8 @@ int kernel_disable_event(struct ltt_kernel_event *event)
        ret = kernctl_disable(event->fd);
        if (ret < 0) {
                PERROR("Failed to disable kernel event: name = '%s', fd = %d",
-                               event->event->name, event->fd);
+                      event->event->name,
+                      event->fd);
                goto error;
        }
 
@@ -786,8 +790,7 @@ error:
 /*
  * Disable a kernel event notifier.
  */
-static
-int kernel_disable_event_notifier_rule(struct ltt_kernel_event_notifier_rule *event)
+static int kernel_disable_event_notifier_rule(struct ltt_kernel_event_notifier_rule *event)
 {
        int ret;
 
@@ -800,22 +803,21 @@ int kernel_disable_event_notifier_rule(struct ltt_kernel_event_notifier_rule *ev
        ret = kernctl_disable(event->fd);
        if (ret < 0) {
                PERROR("Failed to disable kernel event notifier: fd = %d, token = %" PRIu64,
-                               event->fd, event->token);
+                      event->fd,
+                      event->token);
                goto error;
        }
 
        event->enabled = 0;
-       DBG("Disabled kernel event notifier: fd = %d, token = %" PRIu64,
-                       event->fd, event->token);
+       DBG("Disabled kernel event notifier: fd = %d, token = %" PRIu64, event->fd, event->token);
 
 error:
        return ret;
 }
 
-static
-struct process_attr_tracker *_kernel_get_process_attr_tracker(
-               struct ltt_kernel_session *session,
-               enum lttng_process_attr process_attr)
+static struct process_attr_tracker *
+_kernel_get_process_attr_tracker(struct ltt_kernel_session *session,
+                                enum lttng_process_attr process_attr)
 {
        switch (process_attr) {
        case LTTNG_PROCESS_ATTR_PROCESS_ID:
@@ -835,23 +837,23 @@ struct process_attr_tracker *_kernel_get_process_attr_tracker(
        }
 }
 
-const struct process_attr_tracker *kernel_get_process_attr_tracker(
-               struct ltt_kernel_session *session,
-               enum lttng_process_attr process_attr)
+const struct process_attr_tracker *
+kernel_get_process_attr_tracker(struct ltt_kernel_session *session,
+                               enum lttng_process_attr process_attr)
 {
-       return (const struct process_attr_tracker *)
-                       _kernel_get_process_attr_tracker(session, process_attr);
+       return (const struct process_attr_tracker *) _kernel_get_process_attr_tracker(session,
+                                                                                     process_attr);
 }
 
-enum lttng_error_code kernel_process_attr_tracker_set_tracking_policy(
-               struct ltt_kernel_session *session,
-               enum lttng_process_attr process_attr,
-               enum lttng_tracking_policy policy)
+enum lttng_error_code
+kernel_process_attr_tracker_set_tracking_policy(struct ltt_kernel_session *session,
+                                               enum lttng_process_attr process_attr,
+                                               enum lttng_tracking_policy policy)
 {
        int ret;
        enum lttng_error_code ret_code = LTTNG_OK;
        struct process_attr_tracker *tracker =
-                       _kernel_get_process_attr_tracker(session, process_attr);
+               _kernel_get_process_attr_tracker(session, process_attr);
        enum lttng_tracking_policy previous_policy;
 
        if (!tracker) {
@@ -922,10 +924,10 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code kernel_process_attr_tracker_inclusion_set_add_value(
-               struct ltt_kernel_session *session,
-               enum lttng_process_attr process_attr,
-               const struct process_attr_value *value)
+enum lttng_error_code
+kernel_process_attr_tracker_inclusion_set_add_value(struct ltt_kernel_session *session,
+                                                   enum lttng_process_attr process_attr,
+                                                   const struct process_attr_value *value)
 {
        int ret, integral_value;
        enum lttng_error_code ret_code;
@@ -946,8 +948,7 @@ enum lttng_error_code kernel_process_attr_tracker_inclusion_set_add_value(
                if (value->type == LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME) {
                        uid_t uid;
 
-                       ret_code = utils_user_id_from_name(
-                                       value->value.user_name, &uid);
+                       ret_code = utils_user_id_from_name(value->value.user_name, &uid);
                        if (ret_code != LTTNG_OK) {
                                goto end;
                        }
@@ -961,8 +962,7 @@ enum lttng_error_code kernel_process_attr_tracker_inclusion_set_add_value(
                if (value->type == LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME) {
                        gid_t gid;
 
-                       ret_code = utils_group_id_from_name(
-                                       value->value.group_name, &gid);
+                       ret_code = utils_group_id_from_name(value->value.group_name, &gid);
                        if (ret_code != LTTNG_OK) {
                                goto end;
                        }
@@ -1000,8 +1000,9 @@ enum lttng_error_code kernel_process_attr_tracker_inclusion_set_add_value(
        }
 
        DBG("Kernel track %s %d for session id %" PRIu64,
-                       lttng_process_attr_to_string(process_attr),
-                       integral_value, session->id);
+           lttng_process_attr_to_string(process_attr),
+           integral_value,
+           session->id);
        if (process_attr == LTTNG_PROCESS_ATTR_PROCESS_ID) {
                /*
                 * Maintain a special case for the process ID process attribute
@@ -1009,8 +1010,7 @@ enum lttng_error_code kernel_process_attr_tracker_inclusion_set_add_value(
                 */
                ret = kernctl_track_pid(session->fd, integral_value);
        } else {
-               ret = kernctl_track_id(
-                               session->fd, process_attr, integral_value);
+               ret = kernctl_track_id(session->fd, process_attr, integral_value);
        }
        if (ret == 0) {
                ret_code = LTTNG_OK;
@@ -1039,21 +1039,20 @@ enum lttng_error_code kernel_process_attr_tracker_inclusion_set_add_value(
        }
 
        /* Attempt to remove the value from the tracker. */
-       status = process_attr_tracker_inclusion_set_remove_value(
-                       tracker, value);
+       status = process_attr_tracker_inclusion_set_remove_value(tracker, value);
        if (status != PROCESS_ATTR_TRACKER_STATUS_OK) {
                ERR("Failed to roll-back the tracking of kernel %s process attribute %d while handling a kern-ctl error",
-                               lttng_process_attr_to_string(process_attr),
-                               integral_value);
+                   lttng_process_attr_to_string(process_attr),
+                   integral_value);
        }
 end:
        return ret_code;
 }
 
-enum lttng_error_code kernel_process_attr_tracker_inclusion_set_remove_value(
-               struct ltt_kernel_session *session,
-               enum lttng_process_attr process_attr,
-               const struct process_attr_value *value)
+enum lttng_error_code
+kernel_process_attr_tracker_inclusion_set_remove_value(struct ltt_kernel_session *session,
+                                                      enum lttng_process_attr process_attr,
+                                                      const struct process_attr_value *value)
 {
        int ret, integral_value;
        enum lttng_error_code ret_code;
@@ -1074,8 +1073,7 @@ enum lttng_error_code kernel_process_attr_tracker_inclusion_set_remove_value(
                if (value->type == LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME) {
                        uid_t uid;
 
-                       ret_code = utils_user_id_from_name(
-                                       value->value.user_name, &uid);
+                       ret_code = utils_user_id_from_name(value->value.user_name, &uid);
                        if (ret_code != LTTNG_OK) {
                                goto end;
                        }
@@ -1089,8 +1087,7 @@ enum lttng_error_code kernel_process_attr_tracker_inclusion_set_remove_value(
                if (value->type == LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME) {
                        gid_t gid;
 
-                       ret_code = utils_group_id_from_name(
-                                       value->value.group_name, &gid);
+                       ret_code = utils_group_id_from_name(value->value.group_name, &gid);
                        if (ret_code != LTTNG_OK) {
                                goto end;
                        }
@@ -1110,8 +1107,7 @@ enum lttng_error_code kernel_process_attr_tracker_inclusion_set_remove_value(
                goto end;
        }
 
-       status = process_attr_tracker_inclusion_set_remove_value(
-                       tracker, value);
+       status = process_attr_tracker_inclusion_set_remove_value(tracker, value);
        if (status != PROCESS_ATTR_TRACKER_STATUS_OK) {
                switch (status) {
                case PROCESS_ATTR_TRACKER_STATUS_MISSING:
@@ -1129,8 +1125,9 @@ enum lttng_error_code kernel_process_attr_tracker_inclusion_set_remove_value(
        }
 
        DBG("Kernel track %s %d for session id %" PRIu64,
-                       lttng_process_attr_to_string(process_attr),
-                       integral_value, session->id);
+           lttng_process_attr_to_string(process_attr),
+           integral_value,
+           session->id);
        if (process_attr == LTTNG_PROCESS_ATTR_PROCESS_ID) {
                /*
                 * Maintain a special case for the process ID process attribute
@@ -1138,8 +1135,7 @@ enum lttng_error_code kernel_process_attr_tracker_inclusion_set_remove_value(
                 */
                ret = kernctl_untrack_pid(session->fd, integral_value);
        } else {
-               ret = kernctl_untrack_id(
-                               session->fd, process_attr, integral_value);
+               ret = kernctl_untrack_id(session->fd, process_attr, integral_value);
        }
        if (ret == 0) {
                ret_code = LTTNG_OK;
@@ -1167,12 +1163,11 @@ enum lttng_error_code kernel_process_attr_tracker_inclusion_set_remove_value(
        }
 
        /* Attempt to add the value to the tracker. */
-       status = process_attr_tracker_inclusion_set_add_value(
-                       tracker, value);
+       status = process_attr_tracker_inclusion_set_add_value(tracker, value);
        if (status != PROCESS_ATTR_TRACKER_STATUS_OK) {
                ERR("Failed to roll-back the tracking of kernel %s process attribute %d while handling a kern-ctl error",
-                               lttng_process_attr_to_string(process_attr),
-                               integral_value);
+                   lttng_process_attr_to_string(process_attr),
+                   integral_value);
        }
 end:
        return ret_code;
@@ -1290,13 +1285,12 @@ int kernel_flush_buffer(struct ltt_kernel_channel *channel)
 
        DBG("Flush buffer for channel %s", channel->channel->name);
 
-       cds_list_for_each_entry(stream, &channel->stream_list.head, list) {
+       cds_list_for_each_entry (stream, &channel->stream_list.head, list) {
                DBG("Flushing channel stream %d", stream->fd);
                ret = kernctl_buffer_flush(stream->fd);
                if (ret < 0) {
                        PERROR("ioctl");
-                       ERR("Fail to flush buffer for stream %d (ret: %d)",
-                                       stream->fd, ret);
+                       ERR("Fail to flush buffer for stream %d (ret: %d)", stream->fd, ret);
                }
        }
 
@@ -1343,8 +1337,7 @@ int kernel_open_channel_stream(struct ltt_kernel_channel *channel)
        LTTNG_ASSERT(channel);
 
        while ((ret = kernctl_create_stream(channel->fd)) >= 0) {
-               lks = trace_kernel_create_stream(channel->channel->name,
-                               channel->stream_count);
+               lks = trace_kernel_create_stream(channel->channel->name, channel->stream_count);
                if (lks == NULL) {
                        ret = close(ret);
                        if (ret) {
@@ -1367,8 +1360,7 @@ int kernel_open_channel_stream(struct ltt_kernel_channel *channel)
                cds_list_add(&lks->list, &channel->stream_list.head);
                channel->stream_count++;
 
-               DBG("Kernel stream %s created (fd: %d, state: %d)", lks->name, lks->fd,
-                               lks->state);
+               DBG("Kernel stream %s created (fd: %d, state: %d)", lks->name, lks->fd, lks->state);
        }
 
        return channel->stream_count;
@@ -1449,9 +1441,9 @@ ssize_t kernel_list_events(struct lttng_event **events)
                        size_t new_nbmem;
 
                        new_nbmem = nbmem << 1;
-                       DBG("Reallocating event list from %zu to %zu bytes",
-                                       nbmem, new_nbmem);
-                       new_elist = (lttng_event *) realloc(elist, new_nbmem * sizeof(struct lttng_event));
+                       DBG("Reallocating event list from %zu to %zu bytes", nbmem, new_nbmem);
+                       new_elist = (lttng_event *) realloc(elist,
+                                                           new_nbmem * sizeof(struct lttng_event));
                        if (new_elist == NULL) {
                                PERROR("realloc list events");
                                free(event);
@@ -1460,8 +1452,9 @@ ssize_t kernel_list_events(struct lttng_event **events)
                                goto end;
                        }
                        /* Zero the new memory */
-                       memset(new_elist + nbmem, 0,
-                               (new_nbmem - nbmem) * sizeof(struct lttng_event));
+                       memset(new_elist + nbmem,
+                              0,
+                              (new_nbmem - nbmem) * sizeof(struct lttng_event));
                        nbmem = new_nbmem;
                        elist = new_elist;
                }
@@ -1475,7 +1468,7 @@ ssize_t kernel_list_events(struct lttng_event **events)
        *events = elist;
        DBG("Kernel list events done (%zu events)", count);
 end:
-       ret = fclose(fp);       /* closes both fp and fd */
+       ret = fclose(fp); /* closes both fp and fd */
        if (ret) {
                PERROR("fclose");
        }
@@ -1494,7 +1487,7 @@ error:
  * Get kernel version and validate it.
  */
 int kernel_validate_version(struct lttng_kernel_abi_tracer_version *version,
-               struct lttng_kernel_abi_tracer_abi_version *abi_version)
+                           struct lttng_kernel_abi_tracer_abi_version *abi_version)
 {
        int ret;
 
@@ -1507,7 +1500,8 @@ int kernel_validate_version(struct lttng_kernel_abi_tracer_version *version,
        /* Validate version */
        if (version->major != VERSION_MAJOR) {
                ERR("Kernel tracer major version (%d) is not compatible with lttng-tools major version (%d)",
-                       version->major, VERSION_MAJOR);
+                   version->major,
+                   VERSION_MAJOR);
                goto error_version;
        }
        ret = kernctl_tracer_abi_version(kernel_tracer_fd, abi_version);
@@ -1517,13 +1511,16 @@ int kernel_validate_version(struct lttng_kernel_abi_tracer_version *version,
        }
        if (abi_version->major != LTTNG_KERNEL_ABI_MAJOR_VERSION) {
                ERR("Kernel tracer ABI version (%d.%d) does not match the expected ABI major version (%d.*)",
-                       abi_version->major, abi_version->minor,
-                       LTTNG_KERNEL_ABI_MAJOR_VERSION);
+                   abi_version->major,
+                   abi_version->minor,
+                   LTTNG_KERNEL_ABI_MAJOR_VERSION);
                goto error;
        }
        DBG2("Kernel tracer version validated (%d.%d, ABI %d.%d)",
-                       version->major, version->minor,
-                       abi_version->major, abi_version->minor);
+            version->major,
+            version->minor,
+            abi_version->major,
+            abi_version->minor);
        return 0;
 
 error_version:
@@ -1594,12 +1591,12 @@ void kernel_destroy_session(struct ltt_kernel_session *ksess)
 
                /* For each consumer socket. */
                rcu_read_lock();
-               cds_lfht_for_each_entry(ksess->consumer->socks->ht, &iter.iter,
-                               socket, node.node) {
+               cds_lfht_for_each_entry (
+                       ksess->consumer->socks->ht, &iter.iter, socket, node.node) {
                        struct ltt_kernel_channel *chan;
 
                        /* For each channel, ask the consumer to destroy it. */
-                       cds_list_for_each_entry(chan, &ksess->channel_list.head, list) {
+                       cds_list_for_each_entry (chan, &ksess->channel_list.head, list) {
                                ret = kernel_consumer_destroy_channel(socket, chan);
                                if (ret < 0) {
                                        /* Consumer is probably dead. Use next socket. */
@@ -1661,10 +1658,9 @@ void kernel_destroy_channel(struct ltt_kernel_channel *kchan)
  *
  * Return LTTNG_OK on success or else return a LTTNG_ERR code.
  */
-enum lttng_error_code kernel_snapshot_record(
-               struct ltt_kernel_session *ksess,
-               const struct consumer_output *output,
-               uint64_t nb_packets_per_stream)
+enum lttng_error_code kernel_snapshot_record(struct ltt_kernel_session *ksess,
+                                            const struct consumer_output *output,
+                                            uint64_t nb_packets_per_stream)
 {
        int err, ret, saved_metadata_fd;
        enum lttng_error_code status = LTTNG_OK;
@@ -1698,15 +1694,13 @@ enum lttng_error_code kernel_snapshot_record(
                goto error_open_stream;
        }
 
-       trace_path = setup_channel_trace_path(ksess->consumer,
-                       "", &consumer_path_offset);
+       trace_path = setup_channel_trace_path(ksess->consumer, "", &consumer_path_offset);
        if (!trace_path) {
                status = LTTNG_ERR_INVALID;
                goto error;
        }
        /* Send metadata to consumer and snapshot everything. */
-       cds_lfht_for_each_entry(output->socks->ht, &iter.iter,
-                       socket, node.node) {
+       cds_lfht_for_each_entry (output->socks->ht, &iter.iter, socket, node.node) {
                struct ltt_kernel_channel *chan;
 
                pthread_mutex_lock(socket->lock);
@@ -1719,20 +1713,26 @@ enum lttng_error_code kernel_snapshot_record(
                }
 
                /* For each channel, ask the consumer to snapshot it. */
-               cds_list_for_each_entry(chan, &ksess->channel_list.head, list) {
-                       status = consumer_snapshot_channel(socket, chan->key, output, 0,
-                                       &trace_path[consumer_path_offset],
-                                       nb_packets_per_stream);
+               cds_list_for_each_entry (chan, &ksess->channel_list.head, list) {
+                       status = consumer_snapshot_channel(socket,
+                                                          chan->key,
+                                                          output,
+                                                          0,
+                                                          &trace_path[consumer_path_offset],
+                                                          nb_packets_per_stream);
                        if (status != LTTNG_OK) {
-                               (void) kernel_consumer_destroy_metadata(socket,
-                                               ksess->metadata);
+                               (void) kernel_consumer_destroy_metadata(socket, ksess->metadata);
                                goto error_consumer;
                        }
                }
 
                /* Snapshot metadata, */
-               status = consumer_snapshot_channel(socket, ksess->metadata->key, output,
-                               1, &trace_path[consumer_path_offset], 0);
+               status = consumer_snapshot_channel(socket,
+                                                  ksess->metadata->key,
+                                                  output,
+                                                  1,
+                                                  &trace_path[consumer_path_offset],
+                                                  0);
                if (status != LTTNG_OK) {
                        goto error_consumer;
                }
@@ -1776,8 +1776,7 @@ int kernel_syscall_mask(int chan_fd, char **syscall_mask, uint32_t *nr_bits)
        return kernctl_syscall_mask(chan_fd, syscall_mask, nr_bits);
 }
 
-static
-int kernel_tracer_abi_greater_or_equal(unsigned int major, unsigned int minor)
+static int kernel_tracer_abi_greater_or_equal(unsigned int major, unsigned int minor)
 {
        int ret;
        struct lttng_kernel_abi_tracer_abi_version abi;
@@ -1853,8 +1852,7 @@ enum lttng_error_code kernel_rotate_session(struct ltt_session *session)
        LTTNG_ASSERT(ksess);
        LTTNG_ASSERT(ksess->consumer);
 
-       DBG("Rotate kernel session %s started (session %" PRIu64 ")",
-                       session->name, session->id);
+       DBG("Rotate kernel session %s started (session %" PRIu64 ")", session->name, session->id);
 
        rcu_read_lock();
 
@@ -1862,17 +1860,18 @@ enum lttng_error_code kernel_rotate_session(struct ltt_session *session)
         * Note that this loop will end after one iteration given that there is
         * only one kernel consumer.
         */
-       cds_lfht_for_each_entry(ksess->consumer->socks->ht, &iter.iter,
-                       socket, node.node) {
+       cds_lfht_for_each_entry (ksess->consumer->socks->ht, &iter.iter, socket, node.node) {
                struct ltt_kernel_channel *chan;
 
                /* For each channel, ask the consumer to rotate it. */
-               cds_list_for_each_entry(chan, &ksess->channel_list.head, list) {
+               cds_list_for_each_entry (chan, &ksess->channel_list.head, list) {
                        DBG("Rotate kernel channel %" PRIu64 ", session %s",
-                                       chan->key, session->name);
-                       ret = consumer_rotate_channel(socket, chan->key,
-                                       ksess->consumer,
-                                       /* is_metadata_channel */ false);
+                           chan->key,
+                           session->name);
+                       ret = consumer_rotate_channel(socket,
+                                                     chan->key,
+                                                     ksess->consumer,
+                                                     /* is_metadata_channel */ false);
                        if (ret < 0) {
                                status = LTTNG_ERR_ROTATION_FAIL_CONSUMER;
                                goto error;
@@ -1882,9 +1881,10 @@ enum lttng_error_code kernel_rotate_session(struct ltt_session *session)
                /*
                 * Rotate the metadata channel.
                 */
-               ret = consumer_rotate_channel(socket, ksess->metadata->key,
-                               ksess->consumer,
-                               /* is_metadata_channel */ true);
+               ret = consumer_rotate_channel(socket,
+                                             ksess->metadata->key,
+                                             ksess->consumer,
+                                             /* is_metadata_channel */ true);
                if (ret < 0) {
                        status = LTTNG_ERR_ROTATION_FAIL_CONSUMER;
                        goto error;
@@ -1896,8 +1896,7 @@ error:
        return status;
 }
 
-enum lttng_error_code kernel_create_channel_subdirectories(
-               const struct ltt_kernel_session *ksess)
+enum lttng_error_code kernel_create_channel_subdirectories(const struct ltt_kernel_session *ksess)
 {
        enum lttng_error_code ret = LTTNG_OK;
        enum lttng_trace_chunk_status chunk_status;
@@ -1910,8 +1909,7 @@ enum lttng_error_code kernel_create_channel_subdirectories(
         * of implicitly creating the channel's path.
         */
        chunk_status = lttng_trace_chunk_create_subdirectory(
-                       ksess->current_trace_chunk,
-                       DEFAULT_KERNEL_TRACE_DIR "/" DEFAULT_INDEX_DIR);
+               ksess->current_trace_chunk, DEFAULT_KERNEL_TRACE_DIR "/" DEFAULT_INDEX_DIR);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ret = LTTNG_ERR_CREATE_DIR_FAIL;
                goto error;
@@ -1943,8 +1941,7 @@ int init_kernel_tracer(void)
        }
 
        /* Validate kernel version */
-       ret = kernel_validate_version(&the_kernel_tracer_version,
-                       &the_kernel_tracer_abi_version);
+       ret = kernel_validate_version(&the_kernel_tracer_version, &the_kernel_tracer_abi_version);
        if (ret < 0) {
                goto error_version;
        }
@@ -1960,8 +1957,8 @@ int init_kernel_tracer(void)
        }
        if (ret < 1) {
                WARN("Kernel tracer does not support buffer monitoring. "
-                       "The monitoring timer of channels in the kernel domain "
-                       "will be set to 0 (disabled).");
+                    "The monitoring timer of channels in the kernel domain "
+                    "will be set to 0 (disabled).");
        }
 
        ret = kernel_supports_event_notifiers();
@@ -1977,15 +1974,15 @@ int init_kernel_tracer(void)
        } else {
                enum event_notifier_error_accounting_status error_accounting_status;
                enum lttng_error_code error_code_ret =
-                               kernel_create_event_notifier_group_notification_fd(
-                                               &kernel_tracer_event_notifier_group_notification_fd);
+                       kernel_create_event_notifier_group_notification_fd(
+                               &kernel_tracer_event_notifier_group_notification_fd);
 
                if (error_code_ret != LTTNG_OK) {
                        goto error_modules;
                }
 
                error_accounting_status = event_notifier_error_accounting_register_kernel(
-                               kernel_tracer_event_notifier_group_fd);
+                       kernel_tracer_event_notifier_group_fd);
                if (error_accounting_status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
                        ERR("Failed to initialize event notifier error accounting for kernel tracer");
                        error_code_ret = LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING;
@@ -1993,22 +1990,21 @@ int init_kernel_tracer(void)
                }
 
                kernel_token_to_event_notifier_rule_ht = cds_lfht_new(
-                               DEFAULT_HT_SIZE, 1, 0,
-                               CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING,
-                               NULL);
+                       DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
                if (!kernel_token_to_event_notifier_rule_ht) {
                        goto error_token_ht;
                }
        }
 
        DBG("Kernel tracer initialized: kernel tracer fd = %d, event notifier group fd = %d, event notifier group notification fd = %d",
-                       kernel_tracer_fd, kernel_tracer_event_notifier_group_fd,
-                       kernel_tracer_event_notifier_group_notification_fd);
+           kernel_tracer_fd,
+           kernel_tracer_event_notifier_group_fd,
+           kernel_tracer_event_notifier_group_notification_fd);
 
        ret = syscall_init_table(kernel_tracer_fd);
        if (ret < 0) {
                ERR("Unable to populate syscall table. Syscall tracing won't "
-                       "work for this session daemon.");
+                   "work for this session daemon.");
        }
 
        return 0;
@@ -2017,19 +2013,17 @@ error_version:
        modprobe_remove_lttng_control();
        ret = close(kernel_tracer_fd);
        if (ret) {
-               PERROR("Failed to close kernel tracer file descriptor: fd = %d",
-                               kernel_tracer_fd);
+               PERROR("Failed to close kernel tracer file descriptor: fd = %d", kernel_tracer_fd);
        }
 
        kernel_tracer_fd = -1;
        return LTTNG_ERR_KERN_VERSION;
 
-
 error_token_ht:
        ret = close(kernel_tracer_event_notifier_group_notification_fd);
        if (ret) {
                PERROR("Failed to close kernel tracer event notifier group notification file descriptor: fd = %d",
-                               kernel_tracer_event_notifier_group_notification_fd);
+                      kernel_tracer_event_notifier_group_notification_fd);
        }
 
        kernel_tracer_event_notifier_group_notification_fd = -1;
@@ -2038,15 +2032,14 @@ error_modules:
        ret = close(kernel_tracer_event_notifier_group_fd);
        if (ret) {
                PERROR("Failed to close kernel tracer event notifier group file descriptor: fd = %d",
-                               kernel_tracer_event_notifier_group_fd);
+                      kernel_tracer_event_notifier_group_fd);
        }
 
        kernel_tracer_event_notifier_group_fd = -1;
 
        ret = close(kernel_tracer_fd);
        if (ret) {
-               PERROR("Failed to close kernel tracer file descriptor: fd = %d",
-                               kernel_tracer_fd);
+               PERROR("Failed to close kernel tracer file descriptor: fd = %d", kernel_tracer_fd);
        }
 
        kernel_tracer_fd = -1;
@@ -2069,8 +2062,8 @@ void cleanup_kernel_tracer(void)
        DBG2("Closing kernel event notifier group notification file descriptor");
        if (kernel_tracer_event_notifier_group_notification_fd >= 0) {
                int ret = notification_thread_command_remove_tracer_event_source(
-                               the_notification_thread_handle,
-                               kernel_tracer_event_notifier_group_notification_fd);
+                       the_notification_thread_handle,
+                       kernel_tracer_event_notifier_group_notification_fd);
                if (ret != LTTNG_OK) {
                        ERR("Failed to remove kernel event notifier notification from notification thread");
                }
@@ -2078,15 +2071,14 @@ void cleanup_kernel_tracer(void)
                ret = close(kernel_tracer_event_notifier_group_notification_fd);
                if (ret) {
                        PERROR("Failed to close kernel event notifier group notification file descriptor: fd = %d",
-                                       kernel_tracer_event_notifier_group_notification_fd);
+                              kernel_tracer_event_notifier_group_notification_fd);
                }
 
                kernel_tracer_event_notifier_group_notification_fd = -1;
        }
 
        if (kernel_token_to_event_notifier_rule_ht) {
-               const int ret = cds_lfht_destroy(
-                               kernel_token_to_event_notifier_rule_ht, NULL);
+               const int ret = cds_lfht_destroy(kernel_token_to_event_notifier_rule_ht, NULL);
                LTTNG_ASSERT(ret == 0);
        }
 
@@ -2096,7 +2088,7 @@ void cleanup_kernel_tracer(void)
 
                if (ret) {
                        PERROR("Failed to close kernel event notifier group file descriptor: fd = %d",
-                                       kernel_tracer_event_notifier_group_fd);
+                              kernel_tracer_event_notifier_group_fd);
                }
 
                kernel_tracer_event_notifier_group_fd = -1;
@@ -2108,7 +2100,7 @@ void cleanup_kernel_tracer(void)
 
                if (ret) {
                        PERROR("Failed to close kernel tracer file descriptor: fd = %d",
-                                       kernel_tracer_fd);
+                              kernel_tracer_fd);
                }
 
                kernel_tracer_fd = -1;
@@ -2138,8 +2130,7 @@ enum lttng_error_code kernel_clear_session(struct ltt_session *session)
        LTTNG_ASSERT(ksess);
        LTTNG_ASSERT(ksess->consumer);
 
-       DBG("Clear kernel session %s (session %" PRIu64 ")",
-                       session->name, session->id);
+       DBG("Clear kernel session %s (session %" PRIu64 ")", session->name, session->id);
 
        rcu_read_lock();
 
@@ -2153,14 +2144,14 @@ enum lttng_error_code kernel_clear_session(struct ltt_session *session)
         * Note that this loop will end after one iteration given that there is
         * only one kernel consumer.
         */
-       cds_lfht_for_each_entry(ksess->consumer->socks->ht, &iter.iter,
-                       socket, node.node) {
+       cds_lfht_for_each_entry (ksess->consumer->socks->ht, &iter.iter, socket, node.node) {
                struct ltt_kernel_channel *chan;
 
                /* For each channel, ask the consumer to clear it. */
-               cds_list_for_each_entry(chan, &ksess->channel_list.head, list) {
+               cds_list_for_each_entry (chan, &ksess->channel_list.head, list) {
                        DBG("Clear kernel channel %" PRIu64 ", session %s",
-                                       chan->key, session->name);
+                           chan->key,
+                           session->name);
                        ret = consumer_clear_channel(socket, chan->key);
                        if (ret < 0) {
                                goto error;
@@ -2191,19 +2182,19 @@ enum lttng_error_code kernel_clear_session(struct ltt_session *session)
 error:
        switch (-ret) {
        case LTTCOMM_CONSUMERD_RELAYD_CLEAR_DISALLOWED:
-             status = LTTNG_ERR_CLEAR_RELAY_DISALLOWED;
-             break;
+               status = LTTNG_ERR_CLEAR_RELAY_DISALLOWED;
+               break;
        default:
-             status = LTTNG_ERR_CLEAR_FAIL_CONSUMER;
-             break;
+               status = LTTNG_ERR_CLEAR_FAIL_CONSUMER;
+               break;
        }
 end:
        rcu_read_unlock();
        return status;
 }
 
-enum lttng_error_code kernel_create_event_notifier_group_notification_fd(
-               int *event_notifier_group_notification_fd)
+enum lttng_error_code
+kernel_create_event_notifier_group_notification_fd(int *event_notifier_group_notification_fd)
 {
        int local_fd = -1, ret;
        enum lttng_error_code error_code_ret;
@@ -2211,7 +2202,7 @@ enum lttng_error_code kernel_create_event_notifier_group_notification_fd(
        LTTNG_ASSERT(event_notifier_group_notification_fd);
 
        ret = kernctl_create_event_notifier_group_notification_fd(
-                       kernel_tracer_event_notifier_group_fd);
+               kernel_tracer_event_notifier_group_fd);
        if (ret < 0) {
                PERROR("Failed to create kernel event notifier group notification file descriptor");
                error_code_ret = LTTNG_ERR_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD;
@@ -2224,13 +2215,12 @@ enum lttng_error_code kernel_create_event_notifier_group_notification_fd(
        ret = fcntl(local_fd, F_SETFD, FD_CLOEXEC);
        if (ret < 0) {
                PERROR("Failed to set FD_CLOEXEC on kernel event notifier group notification file descriptor: fd = %d",
-                               local_fd);
+                      local_fd);
                error_code_ret = LTTNG_ERR_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD;
                goto error;
        }
 
-       DBG("Created kernel notifier group notification file descriptor: fd = %d",
-                       local_fd);
+       DBG("Created kernel notifier group notification file descriptor: fd = %d", local_fd);
        error_code_ret = LTTNG_OK;
        *event_notifier_group_notification_fd = local_fd;
        local_fd = -1;
@@ -2240,55 +2230,51 @@ error:
                ret = close(local_fd);
                if (ret) {
                        PERROR("Failed to close kernel event notifier group notification file descriptor: fd = %d",
-                                       local_fd);
+                              local_fd);
                }
        }
 
        return error_code_ret;
 }
 
-enum lttng_error_code kernel_destroy_event_notifier_group_notification_fd(
-               int event_notifier_group_notification_fd)
+enum lttng_error_code
+kernel_destroy_event_notifier_group_notification_fd(int event_notifier_group_notification_fd)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
 
        DBG("Closing event notifier group notification file descriptor: fd = %d",
-                       event_notifier_group_notification_fd);
+           event_notifier_group_notification_fd);
        if (event_notifier_group_notification_fd >= 0) {
                const int ret = close(event_notifier_group_notification_fd);
                if (ret) {
                        PERROR("Failed to close event notifier group notification file descriptor: fd = %d",
-                                       event_notifier_group_notification_fd);
+                              event_notifier_group_notification_fd);
                }
        }
 
        return ret_code;
 }
 
-static
-unsigned long hash_trigger(const struct lttng_trigger *trigger)
+static unsigned long hash_trigger(const struct lttng_trigger *trigger)
 {
-       const struct lttng_condition *condition =
-                       lttng_trigger_get_const_condition(trigger);
+       const struct lttng_condition *condition = lttng_trigger_get_const_condition(trigger);
 
        return lttng_condition_hash(condition);
 }
 
-static
-int match_trigger(struct cds_lfht_node *node, const void *key)
+static int match_trigger(struct cds_lfht_node *node, const void *key)
 {
        const struct ltt_kernel_event_notifier_rule *event_notifier_rule;
        const struct lttng_trigger *trigger = (lttng_trigger *) key;
 
-       event_notifier_rule = caa_container_of(node,
-                       const struct ltt_kernel_event_notifier_rule, ht_node);
+       event_notifier_rule =
+               caa_container_of(node, const struct ltt_kernel_event_notifier_rule, ht_node);
 
        return lttng_trigger_is_equal(trigger, event_notifier_rule->trigger);
 }
 
 static enum lttng_error_code kernel_create_event_notifier_rule(
-               struct lttng_trigger *trigger,
-               const struct lttng_credentials *creds, uint64_t token)
+       struct lttng_trigger *trigger, const struct lttng_credentials *creds, uint64_t token)
 {
        int err, fd, ret = 0;
        enum lttng_error_code error_code_ret;
@@ -2311,36 +2297,34 @@ static enum lttng_error_code kernel_create_event_notifier_rule(
        LTTNG_ASSERT(condition_type == LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
 
        /* Does not acquire a reference. */
-       condition_status = lttng_condition_event_rule_matches_get_rule(
-                       condition, &event_rule);
+       condition_status = lttng_condition_event_rule_matches_get_rule(condition, &event_rule);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
        LTTNG_ASSERT(event_rule);
 
        event_rule_type = lttng_event_rule_get_type(event_rule);
        LTTNG_ASSERT(event_rule_type != LTTNG_EVENT_RULE_TYPE_UNKNOWN);
 
-       error_code_ret = trace_kernel_create_event_notifier_rule(trigger, token,
-                       lttng_condition_event_rule_matches_get_error_counter_index(
-                                       condition),
-                       &event_notifier_rule);
+       error_code_ret = trace_kernel_create_event_notifier_rule(
+               trigger,
+               token,
+               lttng_condition_event_rule_matches_get_error_counter_index(condition),
+               &event_notifier_rule);
        if (error_code_ret != LTTNG_OK) {
                goto error;
        }
 
-       error_code_ret = trace_kernel_init_event_notifier_from_event_rule(
-                       event_rule, &kernel_event_notifier);
+       error_code_ret = trace_kernel_init_event_notifier_from_event_rule(event_rule,
+                                                                         &kernel_event_notifier);
        if (error_code_ret != LTTNG_OK) {
                goto free_event;
        }
 
        kernel_event_notifier.event.token = event_notifier_rule->token;
        kernel_event_notifier.error_counter_idx =
-                       lttng_condition_event_rule_matches_get_error_counter_index(
-                                       condition);
+               lttng_condition_event_rule_matches_get_error_counter_index(condition);
 
-       fd = kernctl_create_event_notifier(
-                       kernel_tracer_event_notifier_group_fd,
-                       &kernel_event_notifier);
+       fd = kernctl_create_event_notifier(kernel_tracer_event_notifier_group_fd,
+                                          &kernel_event_notifier);
        if (fd < 0) {
                switch (-fd) {
                case EEXIST:
@@ -2352,12 +2336,13 @@ static enum lttng_error_code kernel_create_event_notifier_rule(
                        break;
                case ENOENT:
                        WARN("Failed to create kernel event notifier: not found: name = '%s'",
-                                       kernel_event_notifier.event.name);
+                            kernel_event_notifier.event.name);
                        error_code_ret = LTTNG_ERR_KERN_ENABLE_FAIL;
                        break;
                default:
                        PERROR("Failed to create kernel event notifier: error code = %d, name = '%s'",
-                                       fd, kernel_event_notifier.event.name);
+                              fd,
+                              kernel_event_notifier.event.name);
                        error_code_ret = LTTNG_ERR_KERN_ENABLE_FAIL;
                }
                goto free_event;
@@ -2368,7 +2353,7 @@ static enum lttng_error_code kernel_create_event_notifier_rule(
        err = fcntl(event_notifier_rule->fd, F_SETFD, FD_CLOEXEC);
        if (err < 0) {
                PERROR("Failed to set FD_CLOEXEC on kernel event notifier file descriptor: fd = %d",
-                               fd);
+                      fd);
                error_code_ret = LTTNG_ERR_FATAL;
                goto set_cloexec_error;
        }
@@ -2388,10 +2373,9 @@ static enum lttng_error_code kernel_create_event_notifier_rule(
                }
        }
 
-       if (lttng_event_rule_get_type(event_rule) ==
-                       LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE) {
+       if (lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE) {
                ret = userspace_probe_event_rule_add_callsites(
-                               event_rule, creds, event_notifier_rule->fd);
+                       event_rule, creds, event_notifier_rule->fd);
                if (ret) {
                        error_code_ret = LTTNG_ERR_KERN_ENABLE_FAIL;
                        goto add_callsite_error;
@@ -2400,13 +2384,13 @@ static enum lttng_error_code kernel_create_event_notifier_rule(
 
        /* Set the capture bytecode if any. */
        cond_status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
-                       condition, &capture_bytecode_count);
+               condition, &capture_bytecode_count);
        LTTNG_ASSERT(cond_status == LTTNG_CONDITION_STATUS_OK);
 
        for (i = 0; i < capture_bytecode_count; i++) {
                const struct lttng_bytecode *capture_bytecode =
-                               lttng_condition_event_rule_matches_get_capture_bytecode_at_index(
-                                               condition, i);
+                       lttng_condition_event_rule_matches_get_capture_bytecode_at_index(condition,
+                                                                                        i);
 
                if (capture_bytecode == NULL) {
                        ERR("Unexpected NULL capture bytecode on condition");
@@ -2417,7 +2401,7 @@ static enum lttng_error_code kernel_create_event_notifier_rule(
                ret = kernctl_capture(event_notifier_rule->fd, capture_bytecode);
                if (ret < 0) {
                        ERR("Failed to set capture bytecode on event notifier rule fd: fd = %d",
-                                       event_notifier_rule->fd);
+                           event_notifier_rule->fd);
                        error_code_ret = LTTNG_ERR_KERN_ENABLE_FAIL;
                        goto capture_error;
                }
@@ -2439,13 +2423,14 @@ static enum lttng_error_code kernel_create_event_notifier_rule(
 
        /* Add trigger to kernel token mapping in the hash table. */
        rcu_read_lock();
-       cds_lfht_add(kernel_token_to_event_notifier_rule_ht, hash_trigger(trigger),
-                       &event_notifier_rule->ht_node);
+       cds_lfht_add(kernel_token_to_event_notifier_rule_ht,
+                    hash_trigger(trigger),
+                    &event_notifier_rule->ht_node);
        rcu_read_unlock();
 
        DBG("Created kernel event notifier: name = '%s', fd = %d",
-                       kernel_event_notifier.event.name,
-                       event_notifier_rule->fd);
+           kernel_event_notifier.event.name,
+           event_notifier_rule->fd);
 
        return LTTNG_OK;
 
@@ -2454,37 +2439,34 @@ add_callsite_error:
 enable_error:
 set_cloexec_error:
 filter_error:
-       {
-               const int close_ret = close(event_notifier_rule->fd);
+{
+       const int close_ret = close(event_notifier_rule->fd);
 
-               if (close_ret) {
-                       PERROR("Failed to close kernel event notifier file descriptor: fd = %d",
-                                       event_notifier_rule->fd);
-               }
+       if (close_ret) {
+               PERROR("Failed to close kernel event notifier file descriptor: fd = %d",
+                      event_notifier_rule->fd);
        }
+}
 free_event:
        free(event_notifier_rule);
 error:
        return error_code_ret;
 }
 
-enum lttng_error_code kernel_register_event_notifier(
-               struct lttng_trigger *trigger,
-               const struct lttng_credentials *cmd_creds)
+enum lttng_error_code kernel_register_event_notifier(struct lttng_trigger *trigger,
+                                                    const struct lttng_credentials *cmd_creds)
 {
        enum lttng_error_code ret;
        enum lttng_condition_status status;
        enum lttng_domain_type domain_type;
        const struct lttng_event_rule *event_rule;
-       const struct lttng_condition *const condition =
-                       lttng_trigger_get_const_condition(trigger);
+       const struct lttng_condition *const condition = lttng_trigger_get_const_condition(trigger);
        const uint64_t token = lttng_trigger_get_tracer_token(trigger);
 
        LTTNG_ASSERT(condition);
 
        /* Does not acquire a reference to the event rule. */
-       status = lttng_condition_event_rule_matches_get_rule(
-                       condition, &event_rule);
+       status = lttng_condition_event_rule_matches_get_rule(condition, &event_rule);
        LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
 
        domain_type = lttng_event_rule_get_domain_type(event_rule);
@@ -2498,8 +2480,7 @@ enum lttng_error_code kernel_register_event_notifier(
        return ret;
 }
 
-enum lttng_error_code kernel_unregister_event_notifier(
-               const struct lttng_trigger *trigger)
+enum lttng_error_code kernel_unregister_event_notifier(const struct lttng_trigger *trigger)
 {
        struct ltt_kernel_event_notifier_rule *token_event_rule_element;
        struct cds_lfht_node *node;
@@ -2510,7 +2491,10 @@ enum lttng_error_code kernel_unregister_event_notifier(
        rcu_read_lock();
 
        cds_lfht_lookup(kernel_token_to_event_notifier_rule_ht,
-                       hash_trigger(trigger), match_trigger, trigger, &iter);
+                       hash_trigger(trigger),
+                       match_trigger,
+                       trigger,
+                       &iter);
 
        node = cds_lfht_iter_get_node(&iter);
        if (!node) {
@@ -2518,8 +2502,8 @@ enum lttng_error_code kernel_unregister_event_notifier(
                goto error;
        }
 
-       token_event_rule_element = caa_container_of(node,
-                       struct ltt_kernel_event_notifier_rule, ht_node);
+       token_event_rule_element =
+               caa_container_of(node, struct ltt_kernel_event_notifier_rule, ht_node);
 
        ret = kernel_disable_event_notifier_rule(token_event_rule_element);
        if (ret) {
index 8a4ce39ea8e6bcd6b9fbf71d9cd39f02d2f99ad1..3f09090cb37a6821fe61e6a1de68e3a049c46467 100644 (file)
@@ -6,15 +6,15 @@
  */
 
 #define _LGPL_SOURCE
-#include <stdbool.h>
+#include "kernel.hpp"
+#include "lttng-sessiond.hpp"
+#include "lttng-syscall.hpp"
+#include "utils.hpp"
 
 #include <common/common.hpp>
 #include <common/kernel-ctl/kernel-ctl.hpp>
 
-#include "lttng-sessiond.hpp"
-#include "kernel.hpp"
-#include "lttng-syscall.hpp"
-#include "utils.hpp"
+#include <stdbool.h>
 
 /* Global syscall table. */
 struct syscall *syscall_table;
@@ -40,7 +40,7 @@ int syscall_init_table(int tracer_fd)
        char name[SYSCALL_NAME_LEN];
 
 #if (SYSCALL_NAME_LEN == 255)
-#define SYSCALL_NAME_LEN_SCANF_IS_A_BROKEN_API "254"
+#define SYSCALL_NAME_LEN_SCANF_IS_A_BROKEN_API "254"
 #endif
 
        DBG3("Syscall init system call table");
@@ -68,10 +68,12 @@ int syscall_init_table(int tracer_fd)
        }
 
        while (fscanf(fp,
-                               "syscall { index = %zu; \
+                     "syscall { index = %zu; \
                                name = %" SYSCALL_NAME_LEN_SCANF_IS_A_BROKEN_API "[^;]; \
                                bitness = %u; };\n",
-                               &index, name, &bitness) == 3) {
+                     &index,
+                     name,
+                     &bitness) == 3) {
                at_least_one_syscall = true;
                if (index >= nbmem) {
                        struct syscall *new_list;
@@ -88,9 +90,9 @@ int syscall_init_table(int tracer_fd)
                                goto error;
                        }
 
-                       DBG("Reallocating syscall table from %zu to %zu entries", nbmem,
-                                       new_nbmem);
-                       new_list = (struct syscall *) realloc(syscall_table, new_nbmem * sizeof(*new_list));
+                       DBG("Reallocating syscall table from %zu to %zu entries", nbmem, new_nbmem);
+                       new_list = (struct syscall *) realloc(syscall_table,
+                                                             new_nbmem * sizeof(*new_list));
                        if (!new_list) {
                                ret = -errno;
                                PERROR("syscall list realloc");
@@ -98,15 +100,14 @@ int syscall_init_table(int tracer_fd)
                        }
 
                        /* Zero out the new memory. */
-                       memset(new_list + nbmem, 0,
-                                       (new_nbmem - nbmem) * sizeof(*new_list));
+                       memset(new_list + nbmem, 0, (new_nbmem - nbmem) * sizeof(*new_list));
                        nbmem = new_nbmem;
                        syscall_table = new_list;
                }
                syscall_table[index].index = index;
                syscall_table[index].bitness = bitness;
-               if (lttng_strncpy(syscall_table[index].name, name,
-                               sizeof(syscall_table[index].name))) {
+               if (lttng_strncpy(
+                           syscall_table[index].name, name, sizeof(syscall_table[index].name))) {
                        ret = -EINVAL;
                        free(syscall_table);
                        syscall_table = NULL;
@@ -164,7 +165,7 @@ static void destroy_syscall_ht(struct lttng_ht *ht)
                return;
        }
 
-       cds_lfht_for_each_entry(ht->ht, &iter.iter, ksyscall, node.node) {
+       cds_lfht_for_each_entry (ht->ht, &iter.iter, ksyscall, node.node) {
                int ret;
 
                ret = lttng_ht_del(ht, &iter);
@@ -221,14 +222,17 @@ static struct syscall *lookup_syscall(struct lttng_ht *ht, const char *name)
  * syscall at index in the syscall table.
  */
 static void update_event_syscall_bitness(struct lttng_event *events,
-               unsigned int index, unsigned int syscall_index)
+                                        unsigned int index,
+                                        unsigned int syscall_index)
 {
        LTTNG_ASSERT(events);
 
        if (syscall_table[index].bitness == 32) {
-               events[syscall_index].flags = (lttng_event_flag) (events[syscall_index].flags | LTTNG_EVENT_FLAG_SYSCALL_32);
+               events[syscall_index].flags = (lttng_event_flag) (events[syscall_index].flags |
+                                                                 LTTNG_EVENT_FLAG_SYSCALL_32);
        } else {
-               events[syscall_index].flags = (lttng_event_flag) (events[syscall_index].flags | LTTNG_EVENT_FLAG_SYSCALL_64);
+               events[syscall_index].flags = (lttng_event_flag) (events[syscall_index].flags |
+                                                                 LTTNG_EVENT_FLAG_SYSCALL_64);
        }
 }
 
@@ -237,8 +241,7 @@ static void update_event_syscall_bitness(struct lttng_event *events,
  *
  * Return 0 on success else -LTTNG_ERR_NOMEM.
  */
-static int add_syscall_to_ht(struct lttng_ht *ht, unsigned int index,
-               unsigned int syscall_index)
+static int add_syscall_to_ht(struct lttng_ht *ht, unsigned int index, unsigned int syscall_index)
 {
        int ret;
        struct syscall *ksyscall;
@@ -251,8 +254,7 @@ static int add_syscall_to_ht(struct lttng_ht *ht, unsigned int index,
                goto error;
        }
 
-       strncpy(ksyscall->name, syscall_table[index].name,
-                       sizeof(ksyscall->name));
+       strncpy(ksyscall->name, syscall_table[index].name, sizeof(ksyscall->name));
        ksyscall->bitness = syscall_table[index].bitness;
        ksyscall->index = syscall_index;
        lttng_ht_node_init_str(&ksyscall->node, ksyscall->name);
@@ -320,8 +322,7 @@ ssize_t syscall_table_list(struct lttng_event **_events)
                }
 
                /* Copy the event information in the event's array. */
-               strncpy(events[index].name, syscall_table[i].name,
-                               sizeof(events[index].name));
+               strncpy(events[index].name, syscall_table[i].name, sizeof(events[index].name));
                update_event_syscall_bitness(events, i, index);
                events[index].type = LTTNG_EVENT_SYSCALL;
                /* This makes the command line not print the enabled/disabled field. */
index 5d6e03775bf36cbd519744b3b76b671775272231..0037d9e71bc3afc1554530835130f7a934856680 100644 (file)
@@ -8,8 +8,61 @@
  */
 
 #define _LGPL_SOURCE
+#include "agent-thread.hpp"
+#include "agent.hpp"
+#include "buffer-registry.hpp"
+#include "channel.hpp"
+#include "client.hpp"
+#include "cmd.hpp"
+#include "consumer.hpp"
+#include "context.hpp"
+#include "dispatch.hpp"
+#include "event-notifier-error-accounting.hpp"
+#include "event.hpp"
+#include "fd-limit.hpp"
+#include "health-sessiond.hpp"
+#include "kernel-consumer.hpp"
+#include "kernel.hpp"
+#include "lttng-sessiond.hpp"
+#include "lttng-ust-ctl.hpp"
+#include "manage-apps.hpp"
+#include "manage-kernel.hpp"
+#include "modprobe.hpp"
+#include "notification-thread-commands.hpp"
+#include "notification-thread.hpp"
+#include "notify-apps.hpp"
+#include "register.hpp"
+#include "rotation-thread.hpp"
+#include "save.hpp"
+#include "sessiond-config.hpp"
+#include "testpoint.hpp"
+#include "thread.hpp"
+#include "timer.hpp"
+#include "ust-consumer.hpp"
+#include "ust-sigbus.hpp"
+#include "utils.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/getenv.hpp>
+#include <common/compat/socket.hpp>
+#include <common/config/session-config.hpp>
+#include <common/daemonize.hpp>
+#include <common/defaults.hpp>
+#include <common/dynamic-buffer.hpp>
+#include <common/futex.hpp>
+#include <common/ini-config/ini-config.hpp>
+#include <common/kernel-consumer/kernel-consumer.hpp>
+#include <common/logging-utils.hpp>
+#include <common/path.hpp>
+#include <common/relayd/relayd.hpp>
+#include <common/utils.hpp>
+
+#include <lttng/event-internal.hpp>
+
+#include <ctype.h>
 #include <getopt.h>
 #include <grp.h>
+#include <inttypes.h>
 #include <limits.h>
 #include <paths.h>
 #include <pthread.h>
@@ -17,7 +70,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
 #include <sys/mman.h>
 #include <sys/mount.h>
 #include <sys/resource.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <urcu/uatomic.h>
 #include <unistd.h>
-#include <ctype.h>
-
-#include <common/common.hpp>
-#include <common/compat/socket.hpp>
-#include <common/compat/getenv.hpp>
-#include <common/defaults.hpp>
-#include <common/kernel-consumer/kernel-consumer.hpp>
-#include <common/futex.hpp>
-#include <common/relayd/relayd.hpp>
-#include <common/utils.hpp>
-#include <common/path.hpp>
-#include <common/daemonize.hpp>
-#include <common/config/session-config.hpp>
-#include <common/ini-config/ini-config.hpp>
-#include <common/dynamic-buffer.hpp>
-#include <common/logging-utils.hpp>
-
-#include <lttng/event-internal.hpp>
-#include "lttng-sessiond.hpp"
-#include "buffer-registry.hpp"
-#include "channel.hpp"
-#include "cmd.hpp"
-#include "consumer.hpp"
-#include "context.hpp"
-#include "event.hpp"
-#include "event-notifier-error-accounting.hpp"
-#include "kernel.hpp"
-#include "kernel-consumer.hpp"
-#include "lttng-ust-ctl.hpp"
-#include "ust-consumer.hpp"
-#include "utils.hpp"
-#include "fd-limit.hpp"
-#include "health-sessiond.hpp"
-#include "testpoint.hpp"
-#include "notify-apps.hpp"
-#include "agent-thread.hpp"
-#include "save.hpp"
-#include "notification-thread.hpp"
-#include "notification-thread-commands.hpp"
-#include "rotation-thread.hpp"
-#include "agent.hpp"
-#include "sessiond-config.hpp"
-#include "timer.hpp"
-#include "thread.hpp"
-#include "client.hpp"
-#include "dispatch.hpp"
-#include "register.hpp"
-#include "manage-apps.hpp"
-#include "manage-kernel.hpp"
-#include "modprobe.hpp"
-#include "ust-sigbus.hpp"
+#include <urcu/uatomic.h>
 
 static const char *help_msg =
 #ifdef LTTNG_EMBED_HELP
 #include <lttng-sessiond.8.h>
 #else
-NULL
+       NULL
 #endif
-;
+       ;
 
 #define EVENT_NOTIFIER_ERROR_COUNTER_NUMBER_OF_BUCKET_MAX 65535
-#define EVENT_NOTIFIER_ERROR_BUFFER_SIZE_BASE_OPTION_STR \
-               "event-notifier-error-buffer-size"
+#define EVENT_NOTIFIER_ERROR_BUFFER_SIZE_BASE_OPTION_STR  "event-notifier-error-buffer-size"
 #define EVENT_NOTIFIER_ERROR_BUFFER_SIZE_KERNEL_OPTION_STR \
-               EVENT_NOTIFIER_ERROR_BUFFER_SIZE_BASE_OPTION_STR "-kernel"
+       EVENT_NOTIFIER_ERROR_BUFFER_SIZE_BASE_OPTION_STR "-kernel"
 #define EVENT_NOTIFIER_ERROR_BUFFER_SIZE_USERSPACE_OPTION_STR \
-               EVENT_NOTIFIER_ERROR_BUFFER_SIZE_BASE_OPTION_STR "-userspace"
-
+       EVENT_NOTIFIER_ERROR_BUFFER_SIZE_BASE_OPTION_STR "-userspace"
 
 const char *progname;
 static int lockfile_fd = -1;
@@ -162,7 +161,7 @@ static struct ust_cmd_queue ust_cmd_queue;
 /*
  * Section name to look for in the daemon configuration file.
  */
-static const char * const config_section_name = "sessiond";
+static const char *const config_section_name = "sessiond";
 
 /* Am I root or not. Set to 1 if the daemon is running as root */
 static int is_root;
@@ -261,14 +260,12 @@ static void wait_consumer(struct consumer_data *consumer_data)
                return;
        }
 
-       DBG("Waiting for complete teardown of consumerd (PID: %d)",
-                       consumer_data->pid);
+       DBG("Waiting for complete teardown of consumerd (PID: %d)", consumer_data->pid);
        ret = waitpid(consumer_data->pid, &status, 0);
        if (ret == -1) {
                PERROR("consumerd waitpid pid: %d", consumer_data->pid)
-       } else  if (!WIFEXITED(status)) {
-               ERR("consumerd termination with error: %d",
-                               WEXITSTATUS(ret));
+       } else if (!WIFEXITED(status)) {
+               ERR("consumerd termination with error: %d", WEXITSTATUS(ret));
        }
        consumer_data->pid = 0;
 }
@@ -299,8 +296,7 @@ static void sessiond_cleanup(void)
                PERROR("remove pidfile %s", the_config.pid_file_path.value);
        }
 
-       DBG("Removing sessiond and consumerd content of directory %s",
-                       the_config.rundir.value);
+       DBG("Removing sessiond and consumerd content of directory %s", the_config.rundir.value);
 
        /* sessiond */
        DBG("Removing %s", the_config.pid_file_path.value);
@@ -392,10 +388,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "-c, --client-sock");
+                            "-c, --client-sock");
                } else {
-                       config_string_set(&the_config.client_unix_sock_path,
-                                       strdup(arg));
+                       config_string_set(&the_config.client_unix_sock_path, strdup(arg));
                        if (!the_config.client_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
@@ -408,10 +403,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "-a, --apps-sock");
+                            "-a, --apps-sock");
                } else {
-                       config_string_set(&the_config.apps_unix_sock_path,
-                                       strdup(arg));
+                       config_string_set(&the_config.apps_unix_sock_path, strdup(arg));
                        if (!the_config.apps_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
@@ -428,10 +422,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "-g, --group");
+                            "-g, --group");
                } else {
-                       config_string_set(&the_config.tracing_group_name,
-                                       strdup(arg));
+                       config_string_set(&the_config.tracing_group_name, strdup(arg));
                        if (!the_config.tracing_group_name.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
@@ -455,11 +448,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "--kconsumerd-err-sock");
+                            "--kconsumerd-err-sock");
                } else {
-                       config_string_set(
-                                       &the_config.kconsumerd_err_unix_sock_path,
-                                       strdup(arg));
+                       config_string_set(&the_config.kconsumerd_err_unix_sock_path, strdup(arg));
                        if (!the_config.kconsumerd_err_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
@@ -472,11 +463,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "--kconsumerd-cmd-sock");
+                            "--kconsumerd-cmd-sock");
                } else {
-                       config_string_set(
-                                       &the_config.kconsumerd_cmd_unix_sock_path,
-                                       strdup(arg));
+                       config_string_set(&the_config.kconsumerd_cmd_unix_sock_path, strdup(arg));
                        if (!the_config.kconsumerd_cmd_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
@@ -489,11 +478,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "--ustconsumerd64-err-sock");
+                            "--ustconsumerd64-err-sock");
                } else {
-                       config_string_set(
-                                       &the_config.consumerd64_err_unix_sock_path,
-                                       strdup(arg));
+                       config_string_set(&the_config.consumerd64_err_unix_sock_path, strdup(arg));
                        if (!the_config.consumerd64_err_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
@@ -506,11 +493,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "--ustconsumerd64-cmd-sock");
+                            "--ustconsumerd64-cmd-sock");
                } else {
-                       config_string_set(
-                                       &the_config.consumerd64_cmd_unix_sock_path,
-                                       strdup(arg));
+                       config_string_set(&the_config.consumerd64_cmd_unix_sock_path, strdup(arg));
                        if (!the_config.consumerd64_cmd_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
@@ -523,11 +508,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "--ustconsumerd32-err-sock");
+                            "--ustconsumerd32-err-sock");
                } else {
-                       config_string_set(
-                                       &the_config.consumerd32_err_unix_sock_path,
-                                       strdup(arg));
+                       config_string_set(&the_config.consumerd32_err_unix_sock_path, strdup(arg));
                        if (!the_config.consumerd32_err_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
@@ -540,11 +523,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "--ustconsumerd32-cmd-sock");
+                            "--ustconsumerd32-cmd-sock");
                } else {
-                       config_string_set(
-                                       &the_config.consumerd32_cmd_unix_sock_path,
-                                       strdup(arg));
+                       config_string_set(&the_config.consumerd32_cmd_unix_sock_path, strdup(arg));
                        if (!the_config.consumerd32_cmd_unix_sock_path.value) {
                                ret = -ENOMEM;
                                PERROR("strdup");
@@ -565,9 +546,8 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                /* Clamp value to [0, 3] */
                the_config.verbose = the_config.verbose < 0 ?
-                                     0 :
-                                     (the_config.verbose <= 3 ? the_config.verbose :
-                                                                3);
+                       0 :
+                       (the_config.verbose <= 3 ? the_config.verbose : 3);
        } else if (string_match(optname, "verbose-consumer")) {
                if (arg) {
                        the_config.verbose_consumer = config_parse_value(arg);
@@ -581,10 +561,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "--consumerd32-path");
+                            "--consumerd32-path");
                } else {
-                       config_string_set(&the_config.consumerd32_bin_path,
-                                       strdup(arg));
+                       config_string_set(&the_config.consumerd32_bin_path, strdup(arg));
                        if (!the_config.consumerd32_bin_path.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
@@ -597,10 +576,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "--consumerd32-libdir");
+                            "--consumerd32-libdir");
                } else {
-                       config_string_set(&the_config.consumerd32_lib_dir,
-                                       strdup(arg));
+                       config_string_set(&the_config.consumerd32_lib_dir, strdup(arg));
                        if (!the_config.consumerd32_lib_dir.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
@@ -613,10 +591,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "--consumerd64-path");
+                            "--consumerd64-path");
                } else {
-                       config_string_set(&the_config.consumerd64_bin_path,
-                                       strdup(arg));
+                       config_string_set(&the_config.consumerd64_bin_path, strdup(arg));
                        if (!the_config.consumerd64_bin_path.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
@@ -629,10 +606,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "--consumerd64-libdir");
+                            "--consumerd64-libdir");
                } else {
-                       config_string_set(&the_config.consumerd64_lib_dir,
-                                       strdup(arg));
+                       config_string_set(&the_config.consumerd64_lib_dir, strdup(arg));
                        if (!the_config.consumerd64_lib_dir.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
@@ -645,10 +621,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "-p, --pidfile");
+                            "-p, --pidfile");
                } else {
-                       config_string_set(
-                                       &the_config.pid_file_path, strdup(arg));
+                       config_string_set(&the_config.pid_file_path, strdup(arg));
                        if (!the_config.pid_file_path.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
@@ -661,7 +636,7 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "--agent-tcp-port");
+                            "--agent-tcp-port");
                } else {
                        unsigned long v;
 
@@ -675,8 +650,7 @@ static int set_option(int opt, const char *arg, const char *optname)
                                ERR("Port overflow in --agent-tcp-port parameter: %s", arg);
                                return -1;
                        }
-                       the_config.agent_tcp_port.begin =
-                                       the_config.agent_tcp_port.end = (int) v;
+                       the_config.agent_tcp_port.begin = the_config.agent_tcp_port.end = (int) v;
                        DBG3("Agent TCP port set to non default: %i", (int) v);
                }
        } else if (string_match(optname, "load") || opt == 'l') {
@@ -686,10 +660,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "-l, --load");
+                            "-l, --load");
                } else {
-                       config_string_set(&the_config.load_session_path,
-                                       strdup(arg));
+                       config_string_set(&the_config.load_session_path, strdup(arg));
                        if (!the_config.load_session_path.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
@@ -702,10 +675,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "--kmod-probes");
+                            "--kmod-probes");
                } else {
-                       config_string_set(&the_config.kmod_probes_list,
-                                       strdup(arg));
+                       config_string_set(&the_config.kmod_probes_list, strdup(arg));
                        if (!the_config.kmod_probes_list.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
@@ -718,10 +690,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                }
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "--extra-kmod-probes");
+                            "--extra-kmod-probes");
                } else {
-                       config_string_set(&the_config.kmod_extra_probes_list,
-                                       strdup(arg));
+                       config_string_set(&the_config.kmod_extra_probes_list, strdup(arg));
                        if (!the_config.kmod_extra_probes_list.value) {
                                PERROR("strdup");
                                ret = -ENOMEM;
@@ -734,17 +705,19 @@ static int set_option(int opt, const char *arg, const char *optname)
                v = strtoul(arg, NULL, 0);
                if (errno != 0 || !isdigit(arg[0])) {
                        ERR("Wrong value in --%s parameter: %s",
-                                       EVENT_NOTIFIER_ERROR_BUFFER_SIZE_KERNEL_OPTION_STR, arg);
+                           EVENT_NOTIFIER_ERROR_BUFFER_SIZE_KERNEL_OPTION_STR,
+                           arg);
                        return -1;
                }
                if (v == 0 || v >= EVENT_NOTIFIER_ERROR_COUNTER_NUMBER_OF_BUCKET_MAX) {
                        ERR("Value out of range for --%s parameter: %s",
-                                       EVENT_NOTIFIER_ERROR_BUFFER_SIZE_KERNEL_OPTION_STR, arg);
+                           EVENT_NOTIFIER_ERROR_BUFFER_SIZE_KERNEL_OPTION_STR,
+                           arg);
                        return -1;
                }
                the_config.event_notifier_buffer_size_kernel = (int) v;
                DBG3("Number of event notifier error buffer kernel size to non default: %i",
-                               the_config.event_notifier_buffer_size_kernel);
+                    the_config.event_notifier_buffer_size_kernel);
                goto end;
        } else if (string_match(optname, EVENT_NOTIFIER_ERROR_BUFFER_SIZE_USERSPACE_OPTION_STR)) {
                unsigned long v;
@@ -753,17 +726,19 @@ static int set_option(int opt, const char *arg, const char *optname)
                v = strtoul(arg, NULL, 0);
                if (errno != 0 || !isdigit(arg[0])) {
                        ERR("Wrong value in --%s parameter: %s",
-                                       EVENT_NOTIFIER_ERROR_BUFFER_SIZE_USERSPACE_OPTION_STR, arg);
+                           EVENT_NOTIFIER_ERROR_BUFFER_SIZE_USERSPACE_OPTION_STR,
+                           arg);
                        return -1;
                }
                if (v == 0 || v >= EVENT_NOTIFIER_ERROR_COUNTER_NUMBER_OF_BUCKET_MAX) {
                        ERR("Value out of range for --%s parameter: %s",
-                                       EVENT_NOTIFIER_ERROR_BUFFER_SIZE_USERSPACE_OPTION_STR, arg);
+                           EVENT_NOTIFIER_ERROR_BUFFER_SIZE_USERSPACE_OPTION_STR,
+                           arg);
                        return -1;
                }
                the_config.event_notifier_buffer_size_userspace = (int) v;
                DBG3("Number of event notifier error buffer userspace size to non default: %i",
-                               the_config.event_notifier_buffer_size_userspace);
+                    the_config.event_notifier_buffer_size_userspace);
                goto end;
        } else if (string_match(optname, "config") || opt == 'f') {
                /* This is handled in set_options() thus silent skip. */
@@ -779,16 +754,14 @@ end:
                const char *opt_name = "unknown";
                int i;
 
-               for (i = 0; i < sizeof(long_options) / sizeof(struct option);
-                       i++) {
+               for (i = 0; i < sizeof(long_options) / sizeof(struct option); i++) {
                        if (opt == long_options[i].val) {
                                opt_name = long_options[i].name;
                                break;
                        }
                }
 
-               WARN("Invalid argument provided for option \"%s\", using default value.",
-                       opt_name);
+               WARN("Invalid argument provided for option \"%s\", using default value.", opt_name);
        }
 
        return ret;
@@ -800,7 +773,7 @@ end:
  * return value conventions.
  */
 static int config_entry_handler(const struct config_entry *entry,
-               void *unused __attribute__((unused)))
+                               void *unused __attribute__((unused)))
 {
        int ret = 0, i;
 
@@ -816,9 +789,7 @@ static int config_entry_handler(const struct config_entry *entry,
                }
        }
 
-       for (i = 0; i < (sizeof(long_options) / sizeof(struct option)) - 1;
-               i++) {
-
+       for (i = 0; i < (sizeof(long_options) / sizeof(struct option)) - 1; i++) {
                /* Ignore if not fully matched. */
                if (strcmp(entry->name, long_options[i].name)) {
                        continue;
@@ -834,7 +805,8 @@ static int config_entry_handler(const struct config_entry *entry,
                        if (ret <= 0) {
                                if (ret) {
                                        WARN("Invalid configuration value \"%s\" for option %s",
-                                                       entry->value, entry->name);
+                                            entry->value,
+                                            entry->name);
                                }
                                /* False, skip boolean config option. */
                                goto end;
@@ -851,7 +823,8 @@ end:
        return ret;
 }
 
-static void print_version(void) {
+static void print_version(void)
+{
        fprintf(stdout, "%s\n", VERSION);
 }
 
@@ -866,15 +839,14 @@ static int set_options(int argc, char **argv)
        char *config_path = NULL;
 
        optstring = utils_generate_optstring(long_options,
-                       sizeof(long_options) / sizeof(struct option));
+                                            sizeof(long_options) / sizeof(struct option));
        if (!optstring) {
                ret = -ENOMEM;
                goto end;
        }
 
        /* Check for the --config option */
-       while ((c = getopt_long(argc, argv, optstring, long_options,
-                                       &option_index)) != -1) {
+       while ((c = getopt_long(argc, argv, optstring, long_options, &option_index)) != -1) {
                if (c == '?') {
                        ret = -EINVAL;
                        goto end;
@@ -885,7 +857,7 @@ static int set_options(int argc, char **argv)
 
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
-                               "-f, --config");
+                            "-f, --config");
                } else {
                        free(config_path);
                        config_path = utils_expand_path(optarg);
@@ -895,8 +867,8 @@ static int set_options(int argc, char **argv)
                }
        }
 
-       ret = config_get_section_entries(config_path, config_section_name,
-                       config_entry_handler, NULL);
+       ret = config_get_section_entries(
+               config_path, config_section_name, config_entry_handler, NULL);
        if (ret) {
                if (ret > 0) {
                        ERR("Invalid configuration option at line %i", ret);
@@ -914,8 +886,7 @@ static int set_options(int argc, char **argv)
                 * getopt_long() will not set option_index if it encounters a
                 * short option.
                 */
-               c = getopt_long(argc, argv, optstring, long_options,
-                               &option_index);
+               c = getopt_long(argc, argv, optstring, long_options, &option_index);
                if (c == -1) {
                        break;
                }
@@ -924,9 +895,8 @@ static int set_options(int argc, char **argv)
                 * Pass NULL as the long option name if popt left the index
                 * unset.
                 */
-               ret = set_option(c, optarg,
-                               option_index < 0 ? NULL :
-                               long_options[option_index].name);
+               ret = set_option(
+                       c, optarg, option_index < 0 ? NULL : long_options[option_index].name);
                if (ret < 0) {
                        break;
                }
@@ -1002,8 +972,7 @@ static int set_permissions(char *rundir)
        int ret;
        gid_t gid;
 
-       ret = utils_get_group_id(
-                       the_config.tracing_group_name.value, true, &gid);
+       ret = utils_get_group_id(the_config.tracing_group_name.value, true, &gid);
        if (ret) {
                /* Default to root group. */
                gid = 0;
@@ -1030,32 +999,28 @@ static int set_permissions(char *rundir)
        /* lttng client socket path */
        ret = chown(the_config.client_unix_sock_path.value, 0, gid);
        if (ret < 0) {
-               ERR("Unable to set group on %s",
-                               the_config.client_unix_sock_path.value);
+               ERR("Unable to set group on %s", the_config.client_unix_sock_path.value);
                PERROR("chown");
        }
 
        /* kconsumer error socket path */
        ret = chown(the_kconsumer_data.err_unix_sock_path, 0, 0);
        if (ret < 0) {
-               ERR("Unable to set group on %s",
-                               the_kconsumer_data.err_unix_sock_path);
+               ERR("Unable to set group on %s", the_kconsumer_data.err_unix_sock_path);
                PERROR("chown");
        }
 
        /* 64-bit ustconsumer error socket path */
        ret = chown(the_ustconsumer64_data.err_unix_sock_path, 0, 0);
        if (ret < 0) {
-               ERR("Unable to set group on %s",
-                               the_ustconsumer64_data.err_unix_sock_path);
+               ERR("Unable to set group on %s", the_ustconsumer64_data.err_unix_sock_path);
                PERROR("chown");
        }
 
        /* 32-bit ustconsumer compat32 error socket path */
        ret = chown(the_ustconsumer32_data.err_unix_sock_path, 0, 0);
        if (ret < 0) {
-               ERR("Unable to set group on %s",
-                               the_ustconsumer32_data.err_unix_sock_path);
+               ERR("Unable to set group on %s", the_ustconsumer32_data.err_unix_sock_path);
                PERROR("chown");
        }
 
@@ -1124,8 +1089,7 @@ static int set_consumer_sockets(struct consumer_data *consumer_data)
        if (is_root) {
                gid_t gid;
 
-               ret = utils_get_group_id(the_config.tracing_group_name.value,
-                               true, &gid);
+               ret = utils_get_group_id(the_config.tracing_group_name.value, true, &gid);
                if (ret) {
                        /* Default to root group. */
                        gid = 0;
@@ -1140,8 +1104,7 @@ static int set_consumer_sockets(struct consumer_data *consumer_data)
        }
 
        /* Create the consumerd error unix socket */
-       consumer_data->err_sock =
-               lttcomm_create_unix_sock(consumer_data->err_unix_sock_path);
+       consumer_data->err_sock = lttcomm_create_unix_sock(consumer_data->err_unix_sock_path);
        if (consumer_data->err_sock < 0) {
                ERR("Create unix sock failed: %s", consumer_data->err_unix_sock_path);
                ret = -1;
@@ -1159,8 +1122,7 @@ static int set_consumer_sockets(struct consumer_data *consumer_data)
        }
 
        /* File permission MUST be 660 */
-       ret = chmod(consumer_data->err_unix_sock_path,
-                       S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+       ret = chmod(consumer_data->err_unix_sock_path, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
        if (ret < 0) {
                ERR("Set file permissions failed: %s", consumer_data->err_unix_sock_path);
                PERROR("chmod");
@@ -1177,8 +1139,7 @@ error:
  * Simply stop all worker threads, leaving main() return gracefully after
  * joining all threads and calling cleanup().
  */
-static void sighandler(int sig, siginfo_t *siginfo,
-               void *arg __attribute__((unused)))
+static void sighandler(int sig, siginfo_t *siginfo, void *arg __attribute__((unused)))
 {
        switch (sig) {
        case SIGINT:
@@ -1298,8 +1259,8 @@ static int set_clock_plugin_env(void)
                goto end;
        }
 
-       ret = asprintf(&env_value, "LTTNG_UST_CLOCK_PLUGIN=%s",
-                       the_config.lttng_ust_clock_plugin.value);
+       ret = asprintf(
+               &env_value, "LTTNG_UST_CLOCK_PLUGIN=%s", the_config.lttng_ust_clock_plugin.value);
        if (ret < 0) {
                PERROR("asprintf");
                goto end;
@@ -1313,7 +1274,7 @@ static int set_clock_plugin_env(void)
        }
 
        DBG("Updated LTTNG_UST_CLOCK_PLUGIN environment variable to \"%s\"",
-                       the_config.lttng_ust_clock_plugin.value);
+           the_config.lttng_ust_clock_plugin.value);
 end:
        return ret;
 }
@@ -1332,8 +1293,7 @@ static void destroy_all_sessions_and_wait(void)
 
        session_lock_list();
        /* Initiate the destruction of all sessions. */
-       cds_list_for_each_entry_safe(session, tmp,
-                       &session_list->head, list) {
+       cds_list_for_each_entry_safe (session, tmp, &session_list->head, list) {
                if (!session_get(session)) {
                        continue;
                }
@@ -1343,8 +1303,7 @@ static void destroy_all_sessions_and_wait(void)
                        goto unlock_session;
                }
                (void) cmd_stop_trace(session);
-               (void) cmd_destroy_session(
-                               session, the_notification_thread_handle, NULL);
+               (void) cmd_destroy_session(session, the_notification_thread_handle, NULL);
        unlock_session:
                session_unlock(session);
                session_put(session);
@@ -1374,8 +1333,7 @@ static void unregister_all_triggers(void)
         * List all triggers as "root" since we wish to unregister all triggers.
         */
        ret_code = notification_thread_command_list_triggers(
-                       the_notification_thread_handle, creds.uid.value,
-                       &triggers);
+               the_notification_thread_handle, creds.uid.value, &triggers);
        if (ret_code != LTTNG_OK) {
                ERR("Failed to list triggers while unregistering all triggers");
                goto end;
@@ -1387,28 +1345,27 @@ static void unregister_all_triggers(void)
        for (i = 0; i < trigger_count; i++) {
                uid_t trigger_owner;
                const char *trigger_name;
-               const struct lttng_trigger *trigger =
-                               lttng_triggers_get_at_index(triggers, i);
+               const struct lttng_trigger *trigger = lttng_triggers_get_at_index(triggers, i);
 
                LTTNG_ASSERT(trigger);
 
-               trigger_status = lttng_trigger_get_owner_uid(
-                               trigger, &trigger_owner);
+               trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_owner);
                LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
                trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
-               trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ?
-                               trigger_name : "(anonymous)";
+               trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ? trigger_name :
+                                                                          "(anonymous)";
 
                DBG("Unregistering trigger: trigger owner uid = %d, trigger name = '%s'",
-                               (int) trigger_owner, trigger_name);
+                   (int) trigger_owner,
+                   trigger_name);
 
-               ret_code = cmd_unregister_trigger(&creds, trigger,
-                               the_notification_thread_handle);
+               ret_code = cmd_unregister_trigger(&creds, trigger, the_notification_thread_handle);
                if (ret_code != LTTNG_OK) {
                        ERR("Failed to unregister trigger: trigger owner uid = %d, trigger name = '%s', error: '%s'",
-                                       (int) trigger_owner, trigger_name,
-                                       lttng_strerror(-ret_code));
+                           (int) trigger_owner,
+                           trigger_name,
+                           lttng_strerror(-ret_code));
                        /* Continue to unregister the remaining triggers. */
                }
        }
@@ -1432,8 +1389,7 @@ static int launch_run_as_worker(const char *procname)
         * be leaked as the process forks a run-as worker (and performs
         * no exec*()). The same would apply to any opened fd.
         */
-       return run_as_create_worker(
-                       procname, run_as_worker_post_fork_cleanup, &the_config);
+       return run_as_create_worker(procname, run_as_worker_post_fork_cleanup, &the_config);
 }
 
 static void sessiond_uuid_log(void)
@@ -1451,9 +1407,8 @@ int main(int argc, char **argv)
 {
        int ret = 0, retval = 0;
        const char *env_app_timeout;
-       struct lttng_pipe *ust32_channel_monitor_pipe = NULL,
-                       *ust64_channel_monitor_pipe = NULL,
-                       *kernel_channel_monitor_pipe = NULL;
+       struct lttng_pipe *ust32_channel_monitor_pipe = NULL, *ust64_channel_monitor_pipe = NULL,
+                         *kernel_channel_monitor_pipe = NULL;
        struct timer_thread_parameters timer_thread_parameters;
        /* Rotation thread handle. */
        struct rotation_thread_handle *rotation_thread_handle = NULL;
@@ -1524,18 +1479,12 @@ int main(int argc, char **argv)
        /* Apply config. */
        lttng_opt_verbose = the_config.verbose;
        lttng_opt_quiet = the_config.quiet;
-       the_kconsumer_data.err_unix_sock_path =
-                       the_config.kconsumerd_err_unix_sock_path.value;
-       the_kconsumer_data.cmd_unix_sock_path =
-                       the_config.kconsumerd_cmd_unix_sock_path.value;
-       the_ustconsumer32_data.err_unix_sock_path =
-                       the_config.consumerd32_err_unix_sock_path.value;
-       the_ustconsumer32_data.cmd_unix_sock_path =
-                       the_config.consumerd32_cmd_unix_sock_path.value;
-       the_ustconsumer64_data.err_unix_sock_path =
-                       the_config.consumerd64_err_unix_sock_path.value;
-       the_ustconsumer64_data.cmd_unix_sock_path =
-                       the_config.consumerd64_cmd_unix_sock_path.value;
+       the_kconsumer_data.err_unix_sock_path = the_config.kconsumerd_err_unix_sock_path.value;
+       the_kconsumer_data.cmd_unix_sock_path = the_config.kconsumerd_cmd_unix_sock_path.value;
+       the_ustconsumer32_data.err_unix_sock_path = the_config.consumerd32_err_unix_sock_path.value;
+       the_ustconsumer32_data.cmd_unix_sock_path = the_config.consumerd32_cmd_unix_sock_path.value;
+       the_ustconsumer64_data.err_unix_sock_path = the_config.consumerd64_err_unix_sock_path.value;
+       the_ustconsumer64_data.cmd_unix_sock_path = the_config.consumerd64_cmd_unix_sock_path.value;
        set_clock_plugin_env();
 
        sessiond_config_log(&the_config);
@@ -1564,8 +1513,7 @@ int main(int argc, char **argv)
        if (the_config.daemonize || the_config.background) {
                int i;
 
-               ret = lttng_daemonize(&the_child_ppid, &recv_child_signal,
-                               !the_config.background);
+               ret = lttng_daemonize(&the_child_ppid, &recv_child_signal, !the_config.background);
                if (ret < 0) {
                        retval = -1;
                        goto exit_options;
@@ -1622,8 +1570,7 @@ int main(int argc, char **argv)
                        goto stop_threads;
                }
                the_kconsumer_data.channel_monitor_pipe =
-                               lttng_pipe_release_writefd(
-                                               kernel_channel_monitor_pipe);
+                       lttng_pipe_release_writefd(kernel_channel_monitor_pipe);
                if (the_kconsumer_data.channel_monitor_pipe < 0) {
                        retval = -1;
                        goto stop_threads;
@@ -1641,7 +1588,7 @@ int main(int argc, char **argv)
                goto stop_threads;
        }
        the_ustconsumer32_data.channel_monitor_pipe =
-                       lttng_pipe_release_writefd(ust32_channel_monitor_pipe);
+               lttng_pipe_release_writefd(ust32_channel_monitor_pipe);
        if (the_ustconsumer32_data.channel_monitor_pipe < 0) {
                retval = -1;
                goto stop_threads;
@@ -1657,8 +1604,7 @@ int main(int argc, char **argv)
                retval = -1;
                goto stop_threads;
        }
-       timer_thread_parameters.rotation_thread_job_queue =
-                       rotation_timer_queue;
+       timer_thread_parameters.rotation_thread_job_queue = rotation_timer_queue;
 
        ust64_channel_monitor_pipe = lttng_pipe_open(0);
        if (!ust64_channel_monitor_pipe) {
@@ -1667,7 +1613,7 @@ int main(int argc, char **argv)
                goto stop_threads;
        }
        the_ustconsumer64_data.channel_monitor_pipe =
-                       lttng_pipe_release_writefd(ust64_channel_monitor_pipe);
+               lttng_pipe_release_writefd(ust64_channel_monitor_pipe);
        if (the_ustconsumer64_data.channel_monitor_pipe < 0) {
                retval = -1;
                goto stop_threads;
@@ -1684,8 +1630,8 @@ int main(int argc, char **argv)
        }
 
        event_notifier_error_accounting_status = event_notifier_error_accounting_init(
-                       the_config.event_notifier_buffer_size_kernel,
-                       the_config.event_notifier_buffer_size_userspace);
+               the_config.event_notifier_buffer_size_kernel,
+               the_config.event_notifier_buffer_size_userspace);
        if (event_notifier_error_accounting_status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
                ERR("Failed to initialize event notifier error accounting system");
                retval = -1;
@@ -1801,9 +1747,10 @@ int main(int argc, char **argv)
        }
 
        /* notification_thread_data acquires the pipes' read side. */
-       the_notification_thread_handle = notification_thread_handle_create(
-                       ust32_channel_monitor_pipe, ust64_channel_monitor_pipe,
-                       kernel_channel_monitor_pipe);
+       the_notification_thread_handle =
+               notification_thread_handle_create(ust32_channel_monitor_pipe,
+                                                 ust64_channel_monitor_pipe,
+                                                 kernel_channel_monitor_pipe);
        if (!the_notification_thread_handle) {
                retval = -1;
                ERR("Failed to create notification thread shared data");
@@ -1811,8 +1758,7 @@ int main(int argc, char **argv)
        }
 
        /* Create notification thread. */
-       notification_thread = launch_notification_thread(
-                       the_notification_thread_handle);
+       notification_thread = launch_notification_thread(the_notification_thread_handle);
        if (!notification_thread) {
                retval = -1;
                goto stop_threads;
@@ -1825,8 +1771,8 @@ int main(int argc, char **argv)
        }
 
        /* rotation_thread_data acquires the pipes' read side. */
-       rotation_thread_handle = rotation_thread_handle_create(
-                       rotation_timer_queue, the_notification_thread_handle);
+       rotation_thread_handle =
+               rotation_thread_handle_create(rotation_timer_queue, the_notification_thread_handle);
        if (!rotation_thread_handle) {
                retval = -1;
                ERR("Failed to create rotation thread shared data");
@@ -1852,15 +1798,13 @@ int main(int argc, char **argv)
                goto stop_threads;
        }
 
-       if (!launch_ust_dispatch_thread(&ust_cmd_queue, apps_cmd_pipe[1],
-                       apps_cmd_notify_pipe[1])) {
+       if (!launch_ust_dispatch_thread(&ust_cmd_queue, apps_cmd_pipe[1], apps_cmd_notify_pipe[1])) {
                retval = -1;
                goto stop_threads;
        }
 
        /* Create thread to manage application registration. */
-       register_apps_thread = launch_application_registration_thread(
-                       &ust_cmd_queue);
+       register_apps_thread = launch_application_registration_thread(&ust_cmd_queue);
        if (!register_apps_thread) {
                retval = -1;
                goto stop_threads;
@@ -1894,9 +1838,9 @@ int main(int argc, char **argv)
 
                if (kernel_get_notification_fd() >= 0) {
                        ret = notification_thread_command_add_tracer_event_source(
-                                       the_notification_thread_handle,
-                                       kernel_get_notification_fd(),
-                                       LTTNG_DOMAIN_KERNEL);
+                               the_notification_thread_handle,
+                               kernel_get_notification_fd(),
+                               LTTNG_DOMAIN_KERNEL);
                        if (ret != LTTNG_OK) {
                                ERR("Failed to add kernel trigger event source to notification thread");
                                retval = -1;
@@ -1906,8 +1850,7 @@ int main(int argc, char **argv)
        }
 
        /* Load sessions. */
-       ret = config_load_session(
-                       the_config.load_session_path.value, NULL, 1, 1, NULL);
+       ret = config_load_session(the_config.load_session_path.value, NULL, 1, 1, NULL);
        if (ret) {
                ERR("Session load failed: %s", error_get_str(ret));
                retval = -1;
@@ -1993,7 +1936,7 @@ stop_threads:
         */
        if (is_root && !the_config.no_kernel) {
                DBG("Unloading kernel modules");
-               modprobe_remove_lttng_all();
+               modprobe_remove_lttng_all();
        }
 
        rcu_thread_offline();
@@ -2014,8 +1957,7 @@ stop_threads:
         * of the active session and channels at the moment of the teardown.
         */
        if (the_notification_thread_handle) {
-               notification_thread_handle_destroy(
-                               the_notification_thread_handle);
+               notification_thread_handle_destroy(the_notification_thread_handle);
        }
        lttng_pipe_destroy(ust32_channel_monitor_pipe);
        lttng_pipe_destroy(ust64_channel_monitor_pipe);
index ea46f05277ca9aad79297afda111a2d1be461181..8e7f50900bc32bbdf66816f132d89ebad775ff82 100644 (file)
@@ -7,11 +7,11 @@
  *
  */
 
+#include "health-sessiond.hpp"
 #include "manage-apps.hpp"
 #include "testpoint.hpp"
-#include "health-sessiond.hpp"
-#include "utils.hpp"
 #include "thread.hpp"
+#include "utils.hpp"
 
 namespace {
 struct thread_notifiers {
@@ -48,8 +48,7 @@ static void *thread_application_management(void *data)
        uint32_t nb_fd;
        struct lttng_poll_event events;
        struct thread_notifiers *notifiers = (thread_notifiers *) data;
-       const auto thread_quit_pipe_fd = lttng_pipe_get_readfd(
-                       notifiers->quit_pipe);
+       const auto thread_quit_pipe_fd = lttng_pipe_get_readfd(notifiers->quit_pipe);
 
        DBG("[thread] Manage application started");
 
@@ -69,8 +68,7 @@ static void *thread_application_management(void *data)
                goto error_poll_create;
        }
 
-       ret = lttng_poll_add(&events, notifiers->apps_cmd_pipe_read_fd,
-                       LPOLLIN | LPOLLRDHUP);
+       ret = lttng_poll_add(&events, notifiers->apps_cmd_pipe_read_fd, LPOLLIN | LPOLLRDHUP);
        if (ret < 0) {
                goto error;
        }
@@ -93,8 +91,7 @@ static void *thread_application_management(void *data)
        restart:
                health_poll_entry();
                ret = lttng_poll_wait(&events, -1);
-               DBG("Apps thread return from poll on %d fds",
-                               LTTNG_POLL_GETNB(&events));
+               DBG("Apps thread return from poll on %d fds", LTTNG_POLL_GETNB(&events));
                health_poll_exit();
                if (ret < 0) {
                        /*
@@ -128,9 +125,9 @@ static void *thread_application_management(void *data)
                                        int sock;
 
                                        /* Empty pipe */
-                                       size_ret = lttng_read(
-                                                       notifiers->apps_cmd_pipe_read_fd,
-                                                       &sock, sizeof(sock));
+                                       size_ret = lttng_read(notifiers->apps_cmd_pipe_read_fd,
+                                                             &sock,
+                                                             sizeof(sock));
                                        if (size_ret < sizeof(sock)) {
                                                PERROR("read apps cmd pipe");
                                                goto error;
@@ -170,7 +167,9 @@ static void *thread_application_management(void *data)
                                        /* Socket closed on remote end. */
                                        ust_app_unregister(pollfd);
                                } else {
-                                       ERR("Unexpected poll events %u for sock %d", revents, pollfd);
+                                       ERR("Unexpected poll events %u for sock %d",
+                                           revents,
+                                           pollfd);
                                        goto error;
                                }
                        }
@@ -228,10 +227,10 @@ bool launch_application_management_thread(int apps_cmd_pipe_read_fd)
        notifiers->apps_cmd_pipe_read_fd = apps_cmd_pipe_read_fd;
 
        thread = lttng_thread_create("UST application management",
-                       thread_application_management,
-                       shutdown_application_management_thread,
-                       cleanup_application_management_thread,
-                       notifiers);
+                                    thread_application_management,
+                                    shutdown_application_management_thread,
+                                    cleanup_application_management_thread,
+                                    notifiers);
        if (!thread) {
                goto error;
        }
index ae1529e9be5a76c851db52a8aad28e0d5cfd5b7f..1c8e08e18d95107490c979051ce418cbb3b104fb 100644 (file)
@@ -7,17 +7,17 @@
  *
  */
 
-#include <signal.h>
-
-#include <common/pipe.hpp>
-#include <common/utils.hpp>
-
+#include "health-sessiond.hpp"
 #include "manage-consumer.hpp"
 #include "testpoint.hpp"
-#include "health-sessiond.hpp"
-#include "utils.hpp"
 #include "thread.hpp"
 #include "ust-consumer.hpp"
+#include "utils.hpp"
+
+#include <common/pipe.hpp>
+#include <common/utils.hpp>
+
+#include <signal.h>
 
 namespace {
 struct thread_notifiers {
@@ -35,8 +35,7 @@ static void mark_thread_as_ready(struct thread_notifiers *notifiers)
        sem_post(&notifiers->ready);
 }
 
-static void mark_thread_intialization_as_failed(
-               struct thread_notifiers *notifiers)
+static void mark_thread_intialization_as_failed(struct thread_notifiers *notifiers)
 {
        ERR("Consumer management thread entering error state");
        notifiers->initialization_result = -1;
@@ -165,8 +164,7 @@ static void *thread_consumer_management(void *data)
        DBG2("Receiving code from consumer err_sock");
 
        /* Getting status code from kconsumerd */
-       ret = lttcomm_recv_unix_sock(sock, &code,
-                       sizeof(enum lttcomm_return_code));
+       ret = lttcomm_recv_unix_sock(sock, &code, sizeof(enum lttcomm_return_code));
        if (ret <= 0) {
                mark_thread_intialization_as_failed(notifiers);
                goto error;
@@ -175,18 +173,14 @@ static void *thread_consumer_management(void *data)
        health_code_update();
        if (code != LTTCOMM_CONSUMERD_COMMAND_SOCK_READY) {
                ERR("consumer error when waiting for SOCK_READY : %s",
-                               lttcomm_get_readable_code((lttcomm_return_code) -code));
+                   lttcomm_get_readable_code((lttcomm_return_code) -code));
                mark_thread_intialization_as_failed(notifiers);
                goto error;
        }
 
        /* Connect both command and metadata sockets. */
-       consumer_data->cmd_sock =
-                       lttcomm_connect_unix_sock(
-                               consumer_data->cmd_unix_sock_path);
-       consumer_data->metadata_fd =
-                       lttcomm_connect_unix_sock(
-                               consumer_data->cmd_unix_sock_path);
+       consumer_data->cmd_sock = lttcomm_connect_unix_sock(consumer_data->cmd_unix_sock_path);
+       consumer_data->metadata_fd = lttcomm_connect_unix_sock(consumer_data->cmd_unix_sock_path);
        if (consumer_data->cmd_sock < 0 || consumer_data->metadata_fd < 0) {
                PERROR("consumer connect cmd socket");
                mark_thread_intialization_as_failed(notifiers);
@@ -205,8 +199,7 @@ static void *thread_consumer_management(void *data)
        pthread_mutex_init(consumer_data->metadata_sock.lock, NULL);
 
        DBG("Consumer command socket ready (fd: %d)", consumer_data->cmd_sock);
-       DBG("Consumer metadata socket ready (fd: %d)",
-                       consumer_data->metadata_fd);
+       DBG("Consumer metadata socket ready (fd: %d)", consumer_data->metadata_fd);
 
        /*
         * Remove the consumerd error sock since we've established a connection.
@@ -225,8 +218,7 @@ static void *thread_consumer_management(void *data)
        }
 
        /* Add metadata socket that is successfully connected. */
-       ret = lttng_poll_add(&events, consumer_data->metadata_fd,
-                       LPOLLIN | LPOLLRDHUP);
+       ret = lttng_poll_add(&events, consumer_data->metadata_fd, LPOLLIN | LPOLLRDHUP);
        if (ret < 0) {
                mark_thread_intialization_as_failed(notifiers);
                goto error;
@@ -256,7 +248,7 @@ static void *thread_consumer_management(void *data)
        pthread_mutex_unlock(cmd_socket_wrapper->lock);
 
        ret = consumer_send_channel_monitor_pipe(cmd_socket_wrapper,
-                       consumer_data->channel_monitor_pipe);
+                                                consumer_data->channel_monitor_pipe);
        if (ret) {
                mark_thread_intialization_as_failed(notifiers);
                goto error;
@@ -305,33 +297,32 @@ static void *thread_consumer_management(void *data)
                                should_quit = 1;
                        } else if (pollfd == sock) {
                                /* Event on the consumerd socket */
-                               if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)
-                                               && !(revents & LPOLLIN)) {
+                               if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP) &&
+                                   !(revents & LPOLLIN)) {
                                        ERR("consumer err socket second poll error");
                                        goto error;
                                }
                                health_code_update();
                                /* Wait for any kconsumerd error */
-                               ret = lttcomm_recv_unix_sock(sock, &code,
-                                               sizeof(enum lttcomm_return_code));
+                               ret = lttcomm_recv_unix_sock(
+                                       sock, &code, sizeof(enum lttcomm_return_code));
                                if (ret <= 0) {
                                        ERR("consumer closed the command socket");
                                        goto error;
                                }
 
                                ERR("consumer return code : %s",
-                                               lttcomm_get_readable_code((lttcomm_return_code) -code));
+                                   lttcomm_get_readable_code((lttcomm_return_code) -code));
 
                                goto exit;
                        } else if (pollfd == consumer_data->metadata_fd) {
-                               if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)
-                                               && !(revents & LPOLLIN)) {
+                               if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP) &&
+                                   !(revents & LPOLLIN)) {
                                        ERR("consumer err metadata socket second poll error");
                                        goto error;
                                }
                                /* UST metadata requests */
-                               ret = ust_consumer_metadata_request(
-                                               &consumer_data->metadata_sock);
+                               ret = ust_consumer_metadata_request(&consumer_data->metadata_sock);
                                if (ret < 0) {
                                        ERR("Handling metadata request");
                                        goto error;
@@ -355,7 +346,7 @@ error:
        if (consumer_data->type == LTTNG_CONSUMER_KERNEL) {
                uatomic_set(&the_kernel_consumerd_state, CONSUMER_ERROR);
        } else if (consumer_data->type == LTTNG_CONSUMER64_UST ||
-                       consumer_data->type == LTTNG_CONSUMER32_UST) {
+                  consumer_data->type == LTTNG_CONSUMER32_UST) {
                uatomic_set(&the_ust_consumerd_state, CONSUMER_ERROR);
        } else {
                /* Code flow error... */
@@ -376,8 +367,7 @@ error:
                }
                consumer_data->cmd_sock = -1;
        }
-       if (consumer_data->metadata_sock.fd_ptr &&
-           *consumer_data->metadata_sock.fd_ptr >= 0) {
+       if (consumer_data->metadata_sock.fd_ptr && *consumer_data->metadata_sock.fd_ptr >= 0) {
                ret = close(*consumer_data->metadata_sock.fd_ptr);
                if (ret) {
                        PERROR("close");
@@ -454,10 +444,10 @@ bool launch_consumer_management_thread(struct consumer_data *consumer_data)
        sem_init(&notifiers->ready, 0, 0);
 
        thread = lttng_thread_create("Consumer management",
-                       thread_consumer_management,
-                       shutdown_consumer_management_thread,
-                       cleanup_consumer_management_thread,
-                       notifiers);
+                                    thread_consumer_management,
+                                    shutdown_consumer_management_thread,
+                                    cleanup_consumer_management_thread,
+                                    notifiers);
        if (!thread) {
                goto error;
        }
index 0920852501d486e2d1a6bbdf7ba07189a54a6423..ac5c819666b652abe442d0c1d54ba412a0b29c17 100644 (file)
@@ -7,16 +7,16 @@
  *
  */
 
-#include <common/pipe.hpp>
-#include <common/utils.hpp>
-
+#include "health-sessiond.hpp"
+#include "kernel-consumer.hpp"
+#include "kernel.hpp"
 #include "manage-kernel.hpp"
 #include "testpoint.hpp"
-#include "health-sessiond.hpp"
-#include "utils.hpp"
 #include "thread.hpp"
-#include "kernel.hpp"
-#include "kernel-consumer.hpp"
+#include "utils.hpp"
+
+#include <common/pipe.hpp>
+#include <common/utils.hpp>
 
 namespace {
 struct thread_notifiers {
@@ -39,7 +39,7 @@ static int update_kernel_poll(struct lttng_poll_event *events)
        DBG("Updating kernel poll set");
 
        session_lock_list();
-       cds_list_for_each_entry(session, &session_list->head, list) {
+       cds_list_for_each_entry (session, &session_list->head, list) {
                if (!session_get(session)) {
                        continue;
                }
@@ -50,8 +50,8 @@ static int update_kernel_poll(struct lttng_poll_event *events)
                        continue;
                }
 
-               cds_list_for_each_entry(channel,
-                               &session->kernel_session->channel_list.head, list) {
+               cds_list_for_each_entry (
+                       channel, &session->kernel_session->channel_list.head, list) {
                        /* Add channel fd to the kernel poll set */
                        ret = lttng_poll_add(events, channel->fd, LPOLLIN | LPOLLRDNORM);
                        if (ret < 0) {
@@ -90,7 +90,7 @@ static int update_kernel_stream(int fd)
        DBG("Updating kernel streams for channel fd %d", fd);
 
        session_lock_list();
-       cds_list_for_each_entry(session, &session_list->head, list) {
+       cds_list_for_each_entry (session, &session_list->head, list) {
                if (!session_get(session)) {
                        continue;
                }
@@ -102,8 +102,7 @@ static int update_kernel_stream(int fd)
                }
                ksess = session->kernel_session;
 
-               cds_list_for_each_entry(channel,
-                               &ksess->channel_list.head, list) {
+               cds_list_for_each_entry (channel, &ksess->channel_list.head, list) {
                        struct lttng_ht_iter iter;
                        struct consumer_socket *socket;
 
@@ -123,19 +122,17 @@ static int update_kernel_stream(int fd)
                         * means that tracing is started so it is safe to send
                         * our updated stream fds.
                         */
-                       if (ksess->consumer_fds_sent != 1
-                                       || ksess->consumer == NULL) {
+                       if (ksess->consumer_fds_sent != 1 || ksess->consumer == NULL) {
                                ret = -1;
                                goto error;
                        }
 
                        rcu_read_lock();
-                       cds_lfht_for_each_entry(ksess->consumer->socks->ht,
-                                       &iter.iter, socket, node.node) {
+                       cds_lfht_for_each_entry (
+                               ksess->consumer->socks->ht, &iter.iter, socket, node.node) {
                                pthread_mutex_lock(socket->lock);
-                               ret = kernel_consumer_send_channel_streams(socket,
-                                               channel, ksess,
-                                               session->output_traces ? 1 : 0);
+                               ret = kernel_consumer_send_channel_streams(
+                                       socket, channel, ksess, session->output_traces ? 1 : 0);
                                pthread_mutex_unlock(socket->lock);
                                if (ret < 0) {
                                        rcu_read_unlock();
@@ -204,16 +201,12 @@ static void *thread_kernel_management(void *data)
                                goto error_poll_create;
                        }
 
-                       ret = lttng_poll_add(&events,
-                                       notifiers->kernel_poll_pipe_read_fd,
-                                       LPOLLIN);
+                       ret = lttng_poll_add(&events, notifiers->kernel_poll_pipe_read_fd, LPOLLIN);
                        if (ret < 0) {
                                goto error;
                        }
 
-                       ret = lttng_poll_add(&events,
-                                       thread_quit_pipe_fd,
-                                       LPOLLIN);
+                       ret = lttng_poll_add(&events, thread_quit_pipe_fd, LPOLLIN);
                        if (ret < 0) {
                                goto error;
                        }
@@ -232,8 +225,7 @@ static void *thread_kernel_management(void *data)
        restart:
                health_poll_entry();
                ret = lttng_poll_wait(&events, -1);
-               DBG("Thread kernel return from poll on %d fds",
-                               LTTNG_POLL_GETNB(&events));
+               DBG("Thread kernel return from poll on %d fds", LTTNG_POLL_GETNB(&events));
                health_poll_exit();
                if (ret < 0) {
                        /*
@@ -246,7 +238,7 @@ static void *thread_kernel_management(void *data)
                } else if (ret == 0) {
                        /* Should not happen since timeout is infinite */
                        ERR("Return value of poll is 0 with an infinite timeout.\n"
-                               "This should not have happened! Continuing...");
+                           "This should not have happened! Continuing...");
                        continue;
                }
 
@@ -269,11 +261,11 @@ static void *thread_kernel_management(void *data)
                        /* Check for data on kernel pipe */
                        if (revents & LPOLLIN) {
                                if (pollfd == notifiers->kernel_poll_pipe_read_fd) {
-                                       (void) lttng_read(notifiers->kernel_poll_pipe_read_fd,
-                                               &tmp, 1);
+                                       (void) lttng_read(
+                                               notifiers->kernel_poll_pipe_read_fd, &tmp, 1);
                                        /*
-                                        * Ret value is useless here, if this pipe gets any actions an
-                                        * update is required anyway.
+                                        * Ret value is useless here, if this pipe gets any actions
+                                        * an update is required anyway.
                                         */
                                        update_poll_flag = 1;
                                        continue;
@@ -307,7 +299,7 @@ error_testpoint:
                health_error();
                ERR("Health error occurred in %s", __func__);
                WARN("Kernel thread died unexpectedly. "
-                               "Kernel tracing can continue but CPU hotplug is disabled.");
+                    "Kernel tracing can continue but CPU hotplug is disabled.");
        }
        health_unregister(the_health_sessiond);
        DBG("Kernel thread dying");
@@ -348,10 +340,10 @@ bool launch_kernel_management_thread(int kernel_poll_pipe_read_fd)
        notifiers->kernel_poll_pipe_read_fd = kernel_poll_pipe_read_fd;
 
        thread = lttng_thread_create("Kernel management",
-                       thread_kernel_management,
-                       shutdown_kernel_management_thread,
-                       cleanup_kernel_management_thread,
-                       notifiers);
+                                    thread_kernel_management,
+                                    shutdown_kernel_management_thread,
+                                    cleanup_kernel_management_thread,
+                                    notifiers);
        if (!thread) {
                goto error;
        }
index 90ed3ff14479b43a9dcdbf43ad5440358d311923..0a6d8973e065267c85cb054e572f6ef6cb12d007 100644 (file)
  */
 
 #define _LGPL_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/wait.h>
+#include "kern-modules.hpp"
+#include "lttng-sessiond.hpp"
+#include "modprobe.hpp"
 
 #include <common/common.hpp>
 #include <common/utils.hpp>
 
-#include "modprobe.hpp"
-#include "kern-modules.hpp"
-#include "lttng-sessiond.hpp"
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/wait.h>
 
 /* LTTng kernel tracer mandatory core modules list */
 struct kern_modules_param kern_modules_control_core[] = {
@@ -299,13 +299,13 @@ static int probes_capacity;
 /**
  * @brief Logging function for libkmod integration.
  */
-static ATTR_FORMAT_PRINTF(6, 0)
-void log_kmod(void *data __attribute__((unused)),
-               int priority __attribute__((unused)),
-               const char *file __attribute__((unused)),
-               int line __attribute__((unused)),
-               const char *fn __attribute__((unused)),
-               const char *format, va_list args)
+static ATTR_FORMAT_PRINTF(6, 0) void log_kmod(void *data __attribute__((unused)),
+                                             int priority __attribute__((unused)),
+                                             const char *file __attribute__((unused)),
+                                             int line __attribute__((unused)),
+                                             const char *fn __attribute__((unused)),
+                                             const char *format,
+                                             va_list args)
 {
        char *str;
 
@@ -368,8 +368,7 @@ error:
  * @returns            \c 0 on success
  *                     \c < 0 on error
  */
-static int modprobe_lttng(struct kern_modules_param *modules,
-               int entries)
+static int modprobe_lttng(struct kern_modules_param *modules, int entries)
 {
        int ret = 0, i;
        struct kmod_ctx *ctx;
@@ -388,19 +387,17 @@ static int modprobe_lttng(struct kern_modules_param *modules,
                        goto error;
                }
 
-               ret = kmod_module_probe_insert_module(mod, 0,
-                               NULL, NULL, NULL, NULL);
+               ret = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, NULL);
                if (ret == -EEXIST) {
                        DBG("Module %s is already loaded", modules[i].name);
                        ret = 0;
                } else if (ret < 0) {
                        if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED) {
-                               ERR("Unable to load required module %s",
-                                               modules[i].name);
+                               ERR("Unable to load required module %s", modules[i].name);
                                goto error;
                        } else {
                                DBG("Unable to load optional module %s; continuing",
-                                               modules[i].name);
+                                   modules[i].name);
                                ret = 0;
                        }
                } else {
@@ -430,7 +427,8 @@ error:
  * @returns            \c 0 on success
  *                     \c < 0 on error
  */
-static int rmmod_recurse(struct kmod_module *mod) {
+static int rmmod_recurse(struct kmod_module *mod)
+{
        int ret = 0;
        struct kmod_list *deps, *itr;
 
@@ -443,11 +441,11 @@ static int rmmod_recurse(struct kmod_module *mod) {
 
        deps = kmod_module_get_dependencies(mod);
        if (deps != NULL) {
-               kmod_list_foreach(itr, deps) {
+               kmod_list_foreach(itr, deps)
+               {
                        struct kmod_module *dep = kmod_module_get_module(itr);
                        if (kmod_module_get_refcnt(dep) == 0) {
-                               DBG("Recursive remove module %s",
-                                               kmod_module_get_name(dep));
+                               DBG("Recursive remove module %s", kmod_module_get_name(dep));
                                rmmod_recurse(dep);
                        }
                        kmod_module_unref(dep);
@@ -465,8 +463,7 @@ static int rmmod_recurse(struct kmod_module *mod) {
  * @param entries      Number of modules in the list
  *
  */
-static void modprobe_remove_lttng(const struct kern_modules_param *modules,
-               int entries)
+static void modprobe_remove_lttng(const struct kern_modules_param *modules, int entries)
 {
        int ret = 0, i;
        struct kmod_ctx *ctx;
@@ -492,11 +489,11 @@ static void modprobe_remove_lttng(const struct kern_modules_param *modules,
                ret = rmmod_recurse(mod);
                if (ret == -EEXIST) {
                        DBG("Module %s is not in kernel.", modules[i].name);
-               } else if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED && ret < 0) {
+               } else if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED &&
+                          ret < 0) {
                        ERR("Unable to remove module %s", modules[i].name);
                } else {
-                       DBG("Modprobe removal successful %s",
-                               modules[i].name);
+                       DBG("Modprobe removal successful %s", modules[i].name);
                }
 
                kmod_module_unref(mod);
@@ -510,17 +507,20 @@ error:
 
 #else /* HAVE_KMOD */
 
-static int modprobe_lttng(struct kern_modules_param *modules,
-               int entries)
+static int modprobe_lttng(struct kern_modules_param *modules, int entries)
 {
        int ret = 0, i;
        char modprobe[256];
 
        for (i = 0; i < entries; i++) {
-               ret = snprintf(modprobe, sizeof(modprobe),
-                               "/sbin/modprobe %s%s",
-                               modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED ? "" : "-q ",
-                               modules[i].name);
+               ret = snprintf(modprobe,
+                              sizeof(modprobe),
+                              "/sbin/modprobe %s%s",
+                              modules[i].load_policy ==
+                                              KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED ?
+                                      "" :
+                                      "-q ",
+                              modules[i].name);
                if (ret < 0) {
                        PERROR("snprintf modprobe");
                        goto error;
@@ -530,21 +530,20 @@ static int modprobe_lttng(struct kern_modules_param *modules,
                if (ret == -1) {
                        if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED) {
                                ERR("Unable to launch modprobe for required module %s",
-                                               modules[i].name);
+                                   modules[i].name);
                                goto error;
                        } else {
                                DBG("Unable to launch modprobe for optional module %s; continuing",
-                                               modules[i].name);
+                                   modules[i].name);
                                ret = 0;
                        }
                } else if (WEXITSTATUS(ret) != 0) {
                        if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED) {
-                               ERR("Unable to load required module %s",
-                                               modules[i].name);
+                               ERR("Unable to load required module %s", modules[i].name);
                                goto error;
                        } else {
                                DBG("Unable to load optional module %s; continuing",
-                                               modules[i].name);
+                                   modules[i].name);
                                ret = 0;
                        }
                } else {
@@ -557,8 +556,7 @@ error:
        return ret;
 }
 
-static void modprobe_remove_lttng(const struct kern_modules_param *modules,
-               int entries)
+static void modprobe_remove_lttng(const struct kern_modules_param *modules, int entries)
 {
        int ret = 0, i;
        char modprobe[256];
@@ -567,9 +565,8 @@ static void modprobe_remove_lttng(const struct kern_modules_param *modules,
                if (!modules[i].loaded) {
                        continue;
                }
-               ret = snprintf(modprobe, sizeof(modprobe),
-                               "/sbin/modprobe -r -q %s",
-                               modules[i].name);
+               ret = snprintf(
+                       modprobe, sizeof(modprobe), "/sbin/modprobe -r -q %s", modules[i].name);
                if (ret < 0) {
                        PERROR("snprintf modprobe -r");
                        return;
@@ -579,18 +576,16 @@ static void modprobe_remove_lttng(const struct kern_modules_param *modules,
                if (ret == -1) {
                        if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED) {
                                ERR("Unable to launch modprobe -r for required module %s",
-                                               modules[i].name);
+                                   modules[i].name);
                        } else {
                                DBG("Unable to launch modprobe -r for optional module %s",
-                                               modules[i].name);
+                                   modules[i].name);
                        }
                } else if (WEXITSTATUS(ret) != 0) {
                        if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED) {
-                               ERR("Unable to remove required module %s",
-                                               modules[i].name);
+                               ERR("Unable to remove required module %s", modules[i].name);
                        } else {
-                               DBG("Unable to remove optional module %s",
-                                               modules[i].name);
+                               DBG("Unable to remove optional module %s", modules[i].name);
                        }
                } else {
                        DBG("Modprobe removal successful %s", modules[i].name);
@@ -605,8 +600,7 @@ static void modprobe_remove_lttng(const struct kern_modules_param *modules,
  */
 void modprobe_remove_lttng_control(void)
 {
-       modprobe_remove_lttng(kern_modules_control_core,
-                       ARRAY_SIZE(kern_modules_control_core));
+       modprobe_remove_lttng(kern_modules_control_core, ARRAY_SIZE(kern_modules_control_core));
 }
 
 static void free_probes(void)
@@ -651,8 +645,7 @@ void modprobe_remove_lttng_all(void)
  */
 int modprobe_lttng_control(void)
 {
-       return modprobe_lttng(kern_modules_control_core,
-                       ARRAY_SIZE(kern_modules_control_core));
+       return modprobe_lttng(kern_modules_control_core, ARRAY_SIZE(kern_modules_control_core));
 }
 
 /**
@@ -801,7 +794,7 @@ int modprobe_lttng_data(void)
                nr_probes = probes_capacity = def_len;
 
                for (i = 0; i < def_len; ++i) {
-                       charname = strdup(kern_modules_probes_default[i].name);
+                       char *name = strdup(kern_modules_probes_default[i].name);
 
                        if (!name) {
                                PERROR("strdup probe item");
index 25c987b67fcb1f6cc11cab7846982a1f1c5da864..b51acaf6747169e3f50de35b1d90d514c2932200 100644 (file)
@@ -5,36 +5,36 @@
  *
  */
 
-#include <lttng/trigger/trigger.h>
-#include <lttng/lttng-error.h>
-#include "notification-thread.hpp"
 #include "notification-thread-commands.hpp"
+#include "notification-thread.hpp"
+
 #include <common/error.hpp>
-#include <unistd.h>
-#include <stdint.h>
+
+#include <lttng/lttng-error.h>
+#include <lttng/trigger/trigger.h>
+
 #include <inttypes.h>
+#include <stdint.h>
+#include <unistd.h>
 
-static
-void init_notification_thread_command(struct notification_thread_command *cmd)
+static void init_notification_thread_command(struct notification_thread_command *cmd)
 {
        CDS_INIT_LIST_HEAD(&cmd->cmd_list_node);
        lttng_waiter_init(&cmd->reply_waiter);
 }
 
-static
-int run_command_wait(struct notification_thread_handle *handle,
-               struct notification_thread_command *cmd)
+static int run_command_wait(struct notification_thread_handle *handle,
+                           struct notification_thread_command *cmd)
 {
        int ret;
        uint64_t notification_counter = 1;
 
        pthread_mutex_lock(&handle->cmd_queue.lock);
        /* Add to queue. */
-       cds_list_add_tail(&cmd->cmd_list_node,
-                       &handle->cmd_queue.list);
+       cds_list_add_tail(&cmd->cmd_list_node, &handle->cmd_queue.list);
        /* Wake-up thread. */
-       ret = lttng_write(handle->cmd_queue.event_fd,
-                       &notification_counter, sizeof(notification_counter));
+       ret = lttng_write(
+               handle->cmd_queue.event_fd, &notification_counter, sizeof(notification_counter));
        if (ret != sizeof(notification_counter)) {
                PERROR("write to notification thread's queue event fd");
                /*
@@ -53,9 +53,8 @@ error_unlock_queue:
        return -1;
 }
 
-static
-struct notification_thread_command *notification_thread_command_copy(
-       const struct notification_thread_command *original_cmd)
+static struct notification_thread_command *
+notification_thread_command_copy(const struct notification_thread_command *original_cmd)
 {
        struct notification_thread_command *new_cmd;
 
@@ -70,14 +69,12 @@ end:
        return new_cmd;
 }
 
-static
-int run_command_no_wait(struct notification_thread_handle *handle,
-               const struct notification_thread_command *in_cmd)
+static int run_command_no_wait(struct notification_thread_handle *handle,
+                              const struct notification_thread_command *in_cmd)
 {
        int ret;
        uint64_t notification_counter = 1;
-       struct notification_thread_command *new_cmd =
-                       notification_thread_command_copy(in_cmd);
+       struct notification_thread_command *new_cmd = notification_thread_command_copy(in_cmd);
 
        if (!new_cmd) {
                goto error;
@@ -86,11 +83,10 @@ int run_command_no_wait(struct notification_thread_handle *handle,
 
        pthread_mutex_lock(&handle->cmd_queue.lock);
        /* Add to queue. */
-       cds_list_add_tail(&new_cmd->cmd_list_node,
-                       &handle->cmd_queue.list);
+       cds_list_add_tail(&new_cmd->cmd_list_node, &handle->cmd_queue.list);
        /* Wake-up thread. */
-       ret = lttng_write(handle->cmd_queue.event_fd,
-                       &notification_counter, sizeof(notification_counter));
+       ret = lttng_write(
+               handle->cmd_queue.event_fd, &notification_counter, sizeof(notification_counter));
        if (ret != sizeof(notification_counter)) {
                PERROR("write to notification thread's queue event fd");
                /*
@@ -109,10 +105,10 @@ error:
        return -1;
 }
 
-enum lttng_error_code notification_thread_command_register_trigger(
-               struct notification_thread_handle *handle,
-               struct lttng_trigger *trigger,
-               bool is_trigger_anonymous)
+enum lttng_error_code
+notification_thread_command_register_trigger(struct notification_thread_handle *handle,
+                                            struct lttng_trigger *trigger,
+                                            bool is_trigger_anonymous)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -124,8 +120,7 @@ enum lttng_error_code notification_thread_command_register_trigger(
        cmd.type = NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER;
        lttng_trigger_get(trigger);
        cmd.parameters.register_trigger.trigger = trigger;
-       cmd.parameters.register_trigger.is_trigger_anonymous =
-                       is_trigger_anonymous;
+       cmd.parameters.register_trigger.is_trigger_anonymous = is_trigger_anonymous;
 
        ret = run_command_wait(handle, &cmd);
        if (ret) {
@@ -137,9 +132,9 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code notification_thread_command_unregister_trigger(
-               struct notification_thread_handle *handle,
-               const struct lttng_trigger *trigger)
+enum lttng_error_code
+notification_thread_command_unregister_trigger(struct notification_thread_handle *handle,
+                                              const struct lttng_trigger *trigger)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -160,9 +155,12 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code notification_thread_command_add_session(
-               struct notification_thread_handle *handle,
-               uint64_t session_id, const char *session_name, uid_t session_uid, gid_t session_gid)
+enum lttng_error_code
+notification_thread_command_add_session(struct notification_thread_handle *handle,
+                                       uint64_t session_id,
+                                       const char *session_name,
+                                       uid_t session_uid,
+                                       gid_t session_gid)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -186,9 +184,9 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code notification_thread_command_remove_session(
-               struct notification_thread_handle *handle,
-               uint64_t session_id)
+enum lttng_error_code
+notification_thread_command_remove_session(struct notification_thread_handle *handle,
+                                          uint64_t session_id)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -209,11 +207,13 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code notification_thread_command_add_channel(
-               struct notification_thread_handle *handle,
-               uint64_t session_id,
-               char *channel_name, uint64_t key,
-               enum lttng_domain_type domain, uint64_t capacity)
+enum lttng_error_code
+notification_thread_command_add_channel(struct notification_thread_handle *handle,
+                                       uint64_t session_id,
+                                       char *channel_name,
+                                       uint64_t key,
+                                       enum lttng_domain_type domain,
+                                       uint64_t capacity)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -239,8 +239,7 @@ end:
 }
 
 enum lttng_error_code notification_thread_command_remove_channel(
-               struct notification_thread_handle *handle,
-               uint64_t key, enum lttng_domain_type domain)
+       struct notification_thread_handle *handle, uint64_t key, enum lttng_domain_type domain)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -262,10 +261,10 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code notification_thread_command_session_rotation_ongoing(
-               struct notification_thread_handle *handle,
-               uint64_t session_id,
-               uint64_t trace_archive_chunk_id)
+enum lttng_error_code
+notification_thread_command_session_rotation_ongoing(struct notification_thread_handle *handle,
+                                                    uint64_t session_id,
+                                                    uint64_t trace_archive_chunk_id)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -275,8 +274,7 @@ enum lttng_error_code notification_thread_command_session_rotation_ongoing(
 
        cmd.type = NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_ONGOING;
        cmd.parameters.session_rotation.session_id = session_id;
-       cmd.parameters.session_rotation.trace_archive_chunk_id =
-                       trace_archive_chunk_id;
+       cmd.parameters.session_rotation.trace_archive_chunk_id = trace_archive_chunk_id;
 
        ret = run_command_wait(handle, &cmd);
        if (ret) {
@@ -289,10 +287,10 @@ end:
 }
 
 enum lttng_error_code notification_thread_command_session_rotation_completed(
-               struct notification_thread_handle *handle,
-               uint64_t session_id,
-               uint64_t trace_archive_chunk_id,
-               struct lttng_trace_archive_location *location)
+       struct notification_thread_handle *handle,
+       uint64_t session_id,
+       uint64_t trace_archive_chunk_id,
+       struct lttng_trace_archive_location *location)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -302,8 +300,7 @@ enum lttng_error_code notification_thread_command_session_rotation_completed(
 
        cmd.type = NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_COMPLETED;
        cmd.parameters.session_rotation.session_id = session_id;
-       cmd.parameters.session_rotation.trace_archive_chunk_id =
-                       trace_archive_chunk_id;
+       cmd.parameters.session_rotation.trace_archive_chunk_id = trace_archive_chunk_id;
        cmd.parameters.session_rotation.location = location;
 
        ret = run_command_wait(handle, &cmd);
@@ -316,10 +313,10 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code notification_thread_command_add_tracer_event_source(
-               struct notification_thread_handle *handle,
-               int tracer_event_source_fd,
-               enum lttng_domain_type domain)
+enum lttng_error_code
+notification_thread_command_add_tracer_event_source(struct notification_thread_handle *handle,
+                                                   int tracer_event_source_fd,
+                                                   enum lttng_domain_type domain)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -330,8 +327,7 @@ enum lttng_error_code notification_thread_command_add_tracer_event_source(
        init_notification_thread_command(&cmd);
 
        cmd.type = NOTIFICATION_COMMAND_TYPE_ADD_TRACER_EVENT_SOURCE;
-       cmd.parameters.tracer_event_source.tracer_event_source_fd =
-                       tracer_event_source_fd;
+       cmd.parameters.tracer_event_source.tracer_event_source_fd = tracer_event_source_fd;
        cmd.parameters.tracer_event_source.domain = domain;
 
        ret = run_command_wait(handle, &cmd);
@@ -345,9 +341,9 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code notification_thread_command_remove_tracer_event_source(
-               struct notification_thread_handle *handle,
-               int tracer_event_source_fd)
+enum lttng_error_code
+notification_thread_command_remove_tracer_event_source(struct notification_thread_handle *handle,
+                                                      int tracer_event_source_fd)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -356,8 +352,7 @@ enum lttng_error_code notification_thread_command_remove_tracer_event_source(
        init_notification_thread_command(&cmd);
 
        cmd.type = NOTIFICATION_COMMAND_TYPE_REMOVE_TRACER_EVENT_SOURCE;
-       cmd.parameters.tracer_event_source.tracer_event_source_fd =
-                       tracer_event_source_fd;
+       cmd.parameters.tracer_event_source.tracer_event_source_fd = tracer_event_source_fd;
 
        ret = run_command_wait(handle, &cmd);
        if (ret) {
@@ -371,9 +366,7 @@ end:
 }
 
 enum lttng_error_code notification_thread_command_list_triggers(
-               struct notification_thread_handle *handle,
-               uid_t uid,
-               struct lttng_triggers **triggers)
+       struct notification_thread_handle *handle, uid_t uid, struct lttng_triggers **triggers)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -400,8 +393,7 @@ end:
        return ret_code;
 }
 
-void notification_thread_command_quit(
-               struct notification_thread_handle *handle)
+void notification_thread_command_quit(struct notification_thread_handle *handle)
 {
        int ret;
        struct notification_thread_command cmd = {};
@@ -414,9 +406,9 @@ void notification_thread_command_quit(
 }
 
 int notification_thread_client_communication_update(
-               struct notification_thread_handle *handle,
-               notification_client_id id,
-               enum client_transmission_status transmission_status)
+       struct notification_thread_handle *handle,
+       notification_client_id id,
+       enum client_transmission_status transmission_status)
 {
        struct notification_thread_command cmd = {};
 
@@ -428,10 +420,10 @@ int notification_thread_client_communication_update(
        return run_command_no_wait(handle, &cmd);
 }
 
-enum lttng_error_code notification_thread_command_get_trigger(
-               struct notification_thread_handle *handle,
-               const struct lttng_trigger *trigger,
-               struct lttng_trigger **real_trigger)
+enum lttng_error_code
+notification_thread_command_get_trigger(struct notification_thread_handle *handle,
+                                       const struct lttng_trigger *trigger,
+                                       struct lttng_trigger **real_trigger)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -458,10 +450,7 @@ end:
  * Takes ownership of the payload if present.
  */
 struct lttng_event_notifier_notification *lttng_event_notifier_notification_create(
-               uint64_t tracer_token,
-               enum lttng_domain_type domain,
-               char *payload,
-               size_t payload_size)
+       uint64_t tracer_token, enum lttng_domain_type domain, char *payload, size_t payload_size)
 {
        struct lttng_event_notifier_notification *notification = NULL;
 
@@ -484,7 +473,7 @@ end:
 }
 
 void lttng_event_notifier_notification_destroy(
-               struct lttng_event_notifier_notification *notification)
+       struct lttng_event_notifier_notification *notification)
 {
        if (!notification) {
                return;
index 64c3fc4f3f03d1d1116b04237a03cbbb4c8cbd83..8c009f748cc39f28129759ff46a1fc2bccfb2303 100644 (file)
@@ -8,47 +8,46 @@
 #include "lttng/action/action.h"
 #include "lttng/trigger/trigger-internal.hpp"
 #define _LGPL_SOURCE
-#include <urcu.h>
-#include <urcu/rculfhash.h>
+#include "condition-internal.hpp"
+#include "event-notifier-error-accounting.hpp"
+#include "kernel.hpp"
+#include "lttng-sessiond.hpp"
+#include "notification-thread-commands.hpp"
+#include "notification-thread-events.hpp"
+#include "notification-thread.hpp"
 
 #include <common/defaults.hpp>
+#include <common/dynamic-buffer.hpp>
 #include <common/error.hpp>
 #include <common/futex.hpp>
-#include <common/unix.hpp>
-#include <common/dynamic-buffer.hpp>
 #include <common/hashtable/utils.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
 #include <common/macros.hpp>
-#include <lttng/condition/condition.h>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/unix.hpp>
+
 #include <lttng/action/action-internal.hpp>
 #include <lttng/action/list-internal.hpp>
-#include <lttng/domain-internal.hpp>
-#include <lttng/notification/notification-internal.hpp>
-#include <lttng/condition/condition-internal.hpp>
 #include <lttng/condition/buffer-usage-internal.hpp>
+#include <lttng/condition/condition-internal.hpp>
+#include <lttng/condition/condition.h>
+#include <lttng/condition/event-rule-matches-internal.hpp>
 #include <lttng/condition/session-consumed-size-internal.hpp>
 #include <lttng/condition/session-rotation-internal.hpp>
-#include <lttng/condition/event-rule-matches-internal.hpp>
 #include <lttng/domain-internal.hpp>
-#include <lttng/notification/channel-internal.hpp>
-#include <lttng/trigger/trigger-internal.hpp>
 #include <lttng/event-rule/event-rule-internal.hpp>
 #include <lttng/location-internal.hpp>
+#include <lttng/notification/channel-internal.hpp>
+#include <lttng/notification/notification-internal.hpp>
+#include <lttng/trigger/trigger-internal.hpp>
 
+#include <fcntl.h>
+#include <inttypes.h>
 #include <time.h>
 #include <unistd.h>
-#include <inttypes.h>
-#include <fcntl.h>
-
-#include "condition-internal.hpp"
-#include "event-notifier-error-accounting.hpp"
-#include "notification-thread.hpp"
-#include "notification-thread-events.hpp"
-#include "notification-thread-commands.hpp"
-#include "lttng-sessiond.hpp"
-#include "kernel.hpp"
+#include <urcu.h>
+#include <urcu/rculfhash.h>
 
-#define CLIENT_POLL_EVENTS_IN (LPOLLIN | LPOLLRDHUP)
+#define CLIENT_POLL_EVENTS_IN    (LPOLLIN | LPOLLRDHUP)
 #define CLIENT_POLL_EVENTS_IN_OUT (CLIENT_POLL_EVENTS_IN | LPOLLOUT)
 
 /* The tracers currently limit the capture size to PIPE_BUF (4kb on linux). */
@@ -141,167 +140,138 @@ struct channel_state_sample {
 
 static unsigned long hash_channel_key(struct channel_key *key);
 static int evaluate_buffer_condition(const struct lttng_condition *condition,
-               struct lttng_evaluation **evaluation,
-               const struct notification_thread_state *state,
-               const struct channel_state_sample *previous_sample,
-               const struct channel_state_sample *latest_sample,
-               struct channel_info *channel_info);
-static
-int send_evaluation_to_clients(const struct lttng_trigger *trigger,
-               const struct lttng_evaluation *evaluation,
-               struct notification_client_list *client_list,
-               struct notification_thread_state *state,
-               uid_t channel_uid, gid_t channel_gid);
-
+                                    struct lttng_evaluation **evaluation,
+                                    const struct notification_thread_state *state,
+                                    const struct channel_state_sample *previous_sample,
+                                    const struct channel_state_sample *latest_sample,
+                                    struct channel_info *channel_info);
+static int send_evaluation_to_clients(const struct lttng_trigger *trigger,
+                                     const struct lttng_evaluation *evaluation,
+                                     struct notification_client_list *client_list,
+                                     struct notification_thread_state *state,
+                                     uid_t channel_uid,
+                                     gid_t channel_gid);
 
 /* session_info API */
-static
-void session_info_destroy(void *_data);
-static
-void session_info_get(struct session_info *session_info);
-static
-void session_info_put(struct session_info *session_info);
-static
-struct session_info *session_info_create(uint64_t id,
-               const char *name,
-               uid_t uid,
-               gid_t gid,
-               struct lttng_session_trigger_list *trigger_list,
-               struct cds_lfht *sessions_ht);
-static void session_info_add_channel(
-               struct session_info *session_info, struct channel_info *channel_info);
-static
-void session_info_remove_channel(struct session_info *session_info,
-               struct channel_info *channel_info);
+static void session_info_destroy(void *_data);
+static void session_info_get(struct session_info *session_info);
+static void session_info_put(struct session_info *session_info);
+static struct session_info *session_info_create(uint64_t id,
+                                               const char *name,
+                                               uid_t uid,
+                                               gid_t gid,
+                                               struct lttng_session_trigger_list *trigger_list,
+                                               struct cds_lfht *sessions_ht);
+static void session_info_add_channel(struct session_info *session_info,
+                                    struct channel_info *channel_info);
+static void session_info_remove_channel(struct session_info *session_info,
+                                       struct channel_info *channel_info);
 
 /* lttng_session_trigger_list API */
-static
-struct lttng_session_trigger_list *lttng_session_trigger_list_create(
-               const char *session_name,
-               struct cds_lfht *session_triggers_ht);
-static
-struct lttng_session_trigger_list *lttng_session_trigger_list_build(
-               const struct notification_thread_state *state,
-               const char *session_name);
-static
-void lttng_session_trigger_list_destroy(
-               struct lttng_session_trigger_list *list);
-static
-int lttng_session_trigger_list_add(struct lttng_session_trigger_list *list,
-               struct lttng_trigger *trigger);
-
-static
-int client_handle_transmission_status(
-               struct notification_client *client,
-               enum client_transmission_status transmission_status,
-               struct notification_thread_state *state);
-
-static
-int handle_one_event_notifier_notification(
-               struct notification_thread_state *state,
-               int pipe, enum lttng_domain_type domain);
-
-static
-void free_lttng_trigger_ht_element_rcu(struct rcu_head *node);
-
-static
-int match_client_socket(struct cds_lfht_node *node, const void *key)
+static struct lttng_session_trigger_list *
+lttng_session_trigger_list_create(const char *session_name, struct cds_lfht *session_triggers_ht);
+static struct lttng_session_trigger_list *
+lttng_session_trigger_list_build(const struct notification_thread_state *state,
+                                const char *session_name);
+static void lttng_session_trigger_list_destroy(struct lttng_session_trigger_list *list);
+static int lttng_session_trigger_list_add(struct lttng_session_trigger_list *list,
+                                         struct lttng_trigger *trigger);
+
+static int client_handle_transmission_status(struct notification_client *client,
+                                            enum client_transmission_status transmission_status,
+                                            struct notification_thread_state *state);
+
+static int handle_one_event_notifier_notification(struct notification_thread_state *state,
+                                                 int pipe,
+                                                 enum lttng_domain_type domain);
+
+static void free_lttng_trigger_ht_element_rcu(struct rcu_head *node);
+
+static int match_client_socket(struct cds_lfht_node *node, const void *key)
 {
        /* This double-cast is intended to supress pointer-to-cast warning. */
        const int socket = (int) (intptr_t) key;
-       const struct notification_client *client = caa_container_of(node,
-                       struct notification_client, client_socket_ht_node);
+       const struct notification_client *client =
+               caa_container_of(node, struct notification_client, client_socket_ht_node);
 
        return client->socket == socket;
 }
 
-static
-int match_client_id(struct cds_lfht_node *node, const void *key)
+static int match_client_id(struct cds_lfht_node *node, const void *key)
 {
        /* This double-cast is intended to supress pointer-to-cast warning. */
        const notification_client_id id = *((notification_client_id *) key);
-       const struct notification_client *client = lttng::utils::container_of(
-                       node, &notification_client::client_id_ht_node);
+       const struct notification_client *client =
+               lttng::utils::container_of(node, &notification_client::client_id_ht_node);
 
        return client->id == id;
 }
 
-static
-int match_channel_trigger_list(struct cds_lfht_node *node, const void *key)
+static int match_channel_trigger_list(struct cds_lfht_node *node, const void *key)
 {
        struct channel_key *channel_key = (struct channel_key *) key;
        struct lttng_channel_trigger_list *trigger_list;
 
-       trigger_list = caa_container_of(node, struct lttng_channel_trigger_list,
-                       channel_triggers_ht_node);
+       trigger_list =
+               caa_container_of(node, struct lttng_channel_trigger_list, channel_triggers_ht_node);
 
        return !!((channel_key->key == trigger_list->channel_key.key) &&
-                       (channel_key->domain == trigger_list->channel_key.domain));
+                 (channel_key->domain == trigger_list->channel_key.domain));
 }
 
-static
-int match_session_trigger_list(struct cds_lfht_node *node, const void *key)
+static int match_session_trigger_list(struct cds_lfht_node *node, const void *key)
 {
        const char *session_name = (const char *) key;
        struct lttng_session_trigger_list *trigger_list;
 
-       trigger_list = caa_container_of(node, struct lttng_session_trigger_list,
-                       session_triggers_ht_node);
+       trigger_list =
+               caa_container_of(node, struct lttng_session_trigger_list, session_triggers_ht_node);
 
        return !!(strcmp(trigger_list->session_name, session_name) == 0);
 }
 
-static
-int match_channel_state_sample(struct cds_lfht_node *node, const void *key)
+static int match_channel_state_sample(struct cds_lfht_node *node, const void *key)
 {
        struct channel_key *channel_key = (struct channel_key *) key;
        struct channel_state_sample *sample;
 
-       sample = caa_container_of(node, struct channel_state_sample,
-                       channel_state_ht_node);
+       sample = caa_container_of(node, struct channel_state_sample, channel_state_ht_node);
 
        return !!((channel_key->key == sample->key.key) &&
-                       (channel_key->domain == sample->key.domain));
+                 (channel_key->domain == sample->key.domain));
 }
 
-static
-int match_channel_info(struct cds_lfht_node *node, const void *key)
+static int match_channel_info(struct cds_lfht_node *node, const void *key)
 {
        struct channel_key *channel_key = (struct channel_key *) key;
        struct channel_info *channel_info;
 
-       channel_info = caa_container_of(node, struct channel_info,
-                       channels_ht_node);
+       channel_info = caa_container_of(node, struct channel_info, channels_ht_node);
 
        return !!((channel_key->key == channel_info->key.key) &&
-                       (channel_key->domain == channel_info->key.domain));
+                 (channel_key->domain == channel_info->key.domain));
 }
 
-static
-int match_trigger(struct cds_lfht_node *node, const void *key)
+static int match_trigger(struct cds_lfht_node *node, const void *key)
 {
        struct lttng_trigger *trigger_key = (struct lttng_trigger *) key;
        struct lttng_trigger_ht_element *trigger_ht_element;
 
-       trigger_ht_element = caa_container_of(node, struct lttng_trigger_ht_element,
-                       node);
+       trigger_ht_element = caa_container_of(node, struct lttng_trigger_ht_element, node);
 
        return !!lttng_trigger_is_equal(trigger_key, trigger_ht_element->trigger);
 }
 
-static
-int match_trigger_token(struct cds_lfht_node *node, const void *key)
+static int match_trigger_token(struct cds_lfht_node *node, const void *key)
 {
        const uint64_t *_key = (uint64_t *) key;
        struct notification_trigger_tokens_ht_element *element;
 
-       element = caa_container_of(node,
-                       struct notification_trigger_tokens_ht_element, node);
+       element = caa_container_of(node, struct notification_trigger_tokens_ht_element, node);
        return *_key == element->token;
 }
 
-static
-int match_client_list_condition(struct cds_lfht_node *node, const void *key)
+static int match_client_list_condition(struct cds_lfht_node *node, const void *key)
 {
        struct lttng_condition *condition_key = (struct lttng_condition *) key;
        struct notification_client_list *client_list;
@@ -309,52 +279,46 @@ int match_client_list_condition(struct cds_lfht_node *node, const void *key)
 
        LTTNG_ASSERT(condition_key);
 
-       client_list = caa_container_of(node, struct notification_client_list,
-                       notification_trigger_clients_ht_node);
+       client_list = caa_container_of(
+               node, struct notification_client_list, notification_trigger_clients_ht_node);
        condition = client_list->condition;
 
        return !!lttng_condition_is_equal(condition_key, condition);
 }
 
-static
-int match_session_info(struct cds_lfht_node *node, const void *key)
+static int match_session_info(struct cds_lfht_node *node, const void *key)
 {
        const auto session_id = *((uint64_t *) key);
-       const auto *session_info = lttng::utils::container_of(
-               node, &session_info::sessions_ht_node);
+       const auto *session_info =
+               lttng::utils::container_of(node, &session_info::sessions_ht_node);
 
        return session_id == session_info->id;
 }
 
-static
-unsigned long hash_session_info_id(uint64_t id)
+static unsigned long hash_session_info_id(uint64_t id)
 {
        return hash_key_u64(&id, lttng_ht_seed);
 }
 
-static
-unsigned long hash_session_info(const struct session_info *session_info)
+static unsigned long hash_session_info(const struct session_info *session_info)
 {
        return hash_session_info_id(session_info->id);
 }
 
-static
-struct session_info *get_session_info_by_id(
-               const struct notification_thread_state *state, uint64_t id)
+static struct session_info *get_session_info_by_id(const struct notification_thread_state *state,
+                                                  uint64_t id)
 {
        struct cds_lfht_iter iter;
        struct cds_lfht_node *node;
        lttng::urcu::read_lock_guard read_lock_guard;
 
-       cds_lfht_lookup(state->sessions_ht,
-                       hash_session_info_id(id),
-                       match_session_info,
-                       &id,
-                       &iter);
+       cds_lfht_lookup(
+               state->sessions_ht, hash_session_info_id(id), match_session_info, &id, &iter);
        node = cds_lfht_iter_get_node(&iter);
 
        if (node) {
-               auto session_info = lttng::utils::container_of(node, &session_info::sessions_ht_node);
+               auto session_info =
+                       lttng::utils::container_of(node, &session_info::sessions_ht_node);
 
                session_info_get(session_info);
                return session_info;
@@ -363,9 +327,8 @@ struct session_info *get_session_info_by_id(
        return NULL;
 }
 
-static
-struct session_info *get_session_info_by_name(
-               const struct notification_thread_state *state, const char *name)
+static struct session_info *get_session_info_by_name(const struct notification_thread_state *state,
+                                                    const char *name)
 {
        uint64_t session_id;
        const auto found = sample_session_id_by_name(name, &session_id);
@@ -373,9 +336,7 @@ struct session_info *get_session_info_by_name(
        return found ? get_session_info_by_id(state, session_id) : NULL;
 }
 
-static
-const char *notification_command_type_str(
-               enum notification_thread_command_type type)
+static const char *notification_command_type_str(enum notification_thread_command_type type)
 {
        switch (type) {
        case NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER:
@@ -415,9 +376,7 @@ const char *notification_command_type_str(
  * Match trigger based on name and credentials only.
  * Name duplication is NOT allowed for the same uid.
  */
-static
-int match_trigger_by_name_uid(struct cds_lfht_node *node,
-               const void *key)
+static int match_trigger_by_name_uid(struct cds_lfht_node *node, const void *key)
 {
        bool match = false;
        const char *element_trigger_name;
@@ -425,17 +384,12 @@ int match_trigger_by_name_uid(struct cds_lfht_node *node,
        enum lttng_trigger_status status;
        const struct lttng_credentials *key_creds;
        const struct lttng_credentials *node_creds;
-       const struct lttng_trigger *trigger_key =
-                       (const struct lttng_trigger *) key;
+       const struct lttng_trigger *trigger_key = (const struct lttng_trigger *) key;
        const struct lttng_trigger_ht_element *trigger_ht_element =
-                       caa_container_of(node,
-                               struct lttng_trigger_ht_element,
-                               node_by_name_uid);
+               caa_container_of(node, struct lttng_trigger_ht_element, node_by_name_uid);
 
-       status = lttng_trigger_get_name(trigger_ht_element->trigger,
-                       &element_trigger_name);
-       element_trigger_name = status == LTTNG_TRIGGER_STATUS_OK ?
-                       element_trigger_name : NULL;
+       status = lttng_trigger_get_name(trigger_ht_element->trigger, &element_trigger_name);
+       element_trigger_name = status == LTTNG_TRIGGER_STATUS_OK ? element_trigger_name : NULL;
 
        status = lttng_trigger_get_name(trigger_key, &key_name);
        key_name = status == LTTNG_TRIGGER_STATUS_OK ? key_name : NULL;
@@ -467,8 +421,7 @@ end:
 /*
  * Hash trigger based on name and credentials only.
  */
-static
-unsigned long hash_trigger_by_name_uid(const struct lttng_trigger *trigger)
+static unsigned long hash_trigger_by_name_uid(const struct lttng_trigger *trigger)
 {
        unsigned long hash = 0;
        const struct lttng_credentials *trigger_creds;
@@ -482,29 +435,26 @@ unsigned long hash_trigger_by_name_uid(const struct lttng_trigger *trigger)
 
        trigger_creds = lttng_trigger_get_credentials(trigger);
        hash ^= hash_key_ulong((void *) (unsigned long) LTTNG_OPTIONAL_GET(trigger_creds->uid),
-                       lttng_ht_seed);
+                              lttng_ht_seed);
 
        return hash;
 }
 
-static
-unsigned long hash_channel_key(struct channel_key *key)
+static unsigned long hash_channel_key(struct channel_key *key)
 {
        unsigned long key_hash = hash_key_u64(&key->key, lttng_ht_seed);
-       unsigned long domain_hash = hash_key_ulong(
-               (void *) (unsigned long) key->domain, lttng_ht_seed);
+       unsigned long domain_hash =
+               hash_key_ulong((void *) (unsigned long) key->domain, lttng_ht_seed);
 
        return key_hash ^ domain_hash;
 }
 
-static
-unsigned long hash_client_socket(int socket)
+static unsigned long hash_client_socket(int socket)
 {
        return hash_key_ulong((void *) (unsigned long) socket, lttng_ht_seed);
 }
 
-static
-unsigned long hash_client_id(notification_client_id id)
+static unsigned long hash_client_id(notification_client_id id)
 {
        return hash_key_u64(&id, lttng_ht_seed);
 }
@@ -517,9 +467,7 @@ unsigned long hash_client_id(notification_client_id id)
  * For instance, a condition bound to a channel will be evaluated everytime
  * the channel's state is changed by a channel monitoring sample.
  */
-static
-enum lttng_object_type get_condition_binding_object(
-               const struct lttng_condition *condition)
+static enum lttng_object_type get_condition_binding_object(const struct lttng_condition *condition)
 {
        switch (lttng_condition_get_type(condition)) {
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW:
@@ -536,22 +484,19 @@ enum lttng_object_type get_condition_binding_object(
        }
 }
 
-static
-void free_channel_info_rcu(struct rcu_head *node)
+static void free_channel_info_rcu(struct rcu_head *node)
 {
        free(lttng::utils::container_of(node, &channel_info::rcu_node));
 }
 
-static
-void channel_info_destroy(struct channel_info *channel_info)
+static void channel_info_destroy(struct channel_info *channel_info)
 {
        if (!channel_info) {
                return;
        }
 
        if (channel_info->session_info) {
-               session_info_remove_channel(channel_info->session_info,
-                               channel_info);
+               session_info_remove_channel(channel_info->session_info, channel_info);
                session_info_put(channel_info->session_info);
        }
        if (channel_info->name) {
@@ -560,15 +505,13 @@ void channel_info_destroy(struct channel_info *channel_info)
        call_rcu(&channel_info->rcu_node, free_channel_info_rcu);
 }
 
-static
-void free_session_info_rcu(struct rcu_head *node)
+static void free_session_info_rcu(struct rcu_head *node)
 {
        free(lttng::utils::container_of(node, &session_info::rcu_node));
 }
 
 /* Don't call directly, use the ref-counting mechanism. */
-static
-void session_info_destroy(void *_data)
+static void session_info_destroy(void *_data)
 {
        struct session_info *session_info = (struct session_info *) _data;
        int ret;
@@ -583,16 +526,14 @@ void session_info_destroy(void *_data)
        lttng_session_trigger_list_destroy(session_info->trigger_list);
 
        rcu_read_lock();
-       cds_lfht_del(session_info->sessions_ht,
-                       &session_info->sessions_ht_node);
+       cds_lfht_del(session_info->sessions_ht, &session_info->sessions_ht_node);
        rcu_read_unlock();
        free(session_info->name);
        lttng_trace_archive_location_put(session_info->last_state_sample.rotation.location);
        call_rcu(&session_info->rcu_node, free_session_info_rcu);
 }
 
-static
-void session_info_get(struct session_info *session_info)
+static void session_info_get(struct session_info *session_info)
 {
        if (!session_info) {
                return;
@@ -600,8 +541,7 @@ void session_info_get(struct session_info *session_info)
        lttng_ref_get(&session_info->ref);
 }
 
-static
-void session_info_put(struct session_info *session_info)
+static void session_info_put(struct session_info *session_info)
 {
        if (!session_info) {
                return;
@@ -609,13 +549,12 @@ void session_info_put(struct session_info *session_info)
        lttng_ref_put(&session_info->ref);
 }
 
-static
-struct session_info *session_info_create(uint64_t id,
-               const char *name,
-               uid_t uid,
-               gid_t gid,
-               struct lttng_session_trigger_list *trigger_list,
-               struct cds_lfht *sessions_ht)
+static struct session_info *session_info_create(uint64_t id,
+                                               const char *name,
+                                               uid_t uid,
+                                               gid_t gid,
+                                               struct lttng_session_trigger_list *trigger_list,
+                                               struct cds_lfht *sessions_ht)
 {
        struct session_info *session_info;
 
@@ -628,8 +567,8 @@ struct session_info *session_info_create(uint64_t id,
 
        lttng_ref_init(&session_info->ref, session_info_destroy);
 
-       session_info->channel_infos_ht = cds_lfht_new(DEFAULT_HT_SIZE,
-                       1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       session_info->channel_infos_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!session_info->channel_infos_ht) {
                goto error;
        }
@@ -652,31 +591,28 @@ error:
        return NULL;
 }
 
-static
-void session_info_add_channel(struct session_info *session_info,
-               struct channel_info *channel_info)
+static void session_info_add_channel(struct session_info *session_info,
+                                    struct channel_info *channel_info)
 {
        rcu_read_lock();
        cds_lfht_add(session_info->channel_infos_ht,
-                       hash_channel_key(&channel_info->key),
-                       &channel_info->session_info_channels_ht_node);
+                    hash_channel_key(&channel_info->key),
+                    &channel_info->session_info_channels_ht_node);
        rcu_read_unlock();
 }
 
-static
-void session_info_remove_channel(struct session_info *session_info,
-               struct channel_info *channel_info)
+static void session_info_remove_channel(struct session_info *session_info,
+                                       struct channel_info *channel_info)
 {
        rcu_read_lock();
-       cds_lfht_del(session_info->channel_infos_ht,
-                       &channel_info->session_info_channels_ht_node);
+       cds_lfht_del(session_info->channel_infos_ht, &channel_info->session_info_channels_ht_node);
        rcu_read_unlock();
 }
 
-static
-struct channel_info *channel_info_create(const char *channel_name,
-               struct channel_key *channel_key, uint64_t channel_capacity,
-               struct session_info *session_info)
+static struct channel_info *channel_info_create(const char *channel_name,
+                                               struct channel_key *channel_key,
+                                               uint64_t channel_capacity,
+                                               struct session_info *session_info)
 {
        struct channel_info *channel_info = zmalloc<struct channel_info>();
 
@@ -714,18 +650,15 @@ bool notification_client_list_get(struct notification_client_list *list)
        return urcu_ref_get_unless_zero(&list->ref);
 }
 
-static
-void free_notification_client_list_rcu(struct rcu_head *node)
+static void free_notification_client_list_rcu(struct rcu_head *node)
 {
-       free(caa_container_of(node, struct notification_client_list,
-                       rcu_node));
+       free(caa_container_of(node, struct notification_client_list, rcu_node));
 }
 
-static
-void notification_client_list_release(struct urcu_ref *list_ref)
+static void notification_client_list_release(struct urcu_ref *list_ref)
 {
        struct notification_client_list *list =
-                       lttng::utils::container_of(list_ref, &notification_client_list::ref);
+               lttng::utils::container_of(list_ref, &notification_client_list::ref);
        struct notification_client_list_element *client_list_element, *tmp;
 
        lttng_condition_put(list->condition);
@@ -734,12 +667,11 @@ void notification_client_list_release(struct urcu_ref *list_ref)
                rcu_read_lock();
 
                cds_lfht_del(list->notification_trigger_clients_ht,
-                               &list->notification_trigger_clients_ht_node);
+                            &list->notification_trigger_clients_ht_node);
                rcu_read_unlock();
                list->notification_trigger_clients_ht = NULL;
        }
-       cds_list_for_each_entry_safe(client_list_element, tmp,
-                                    &list->clients_list, node) {
+       cds_list_for_each_entry_safe (client_list_element, tmp, &list->clients_list, node) {
                free(client_list_element);
        }
 
@@ -749,18 +681,14 @@ void notification_client_list_release(struct urcu_ref *list_ref)
        call_rcu(&list->rcu_node, free_notification_client_list_rcu);
 }
 
-static
-bool condition_applies_to_client(const struct lttng_condition *condition,
-               struct notification_client *client)
+static bool condition_applies_to_client(const struct lttng_condition *condition,
+                                       struct notification_client *client)
 {
        bool applies = false;
        struct lttng_condition_list_element *condition_list_element;
 
-       cds_list_for_each_entry(condition_list_element, &client->condition_list,
-                       node) {
-               applies = lttng_condition_is_equal(
-                               condition_list_element->condition,
-                               condition);
+       cds_list_for_each_entry (condition_list_element, &client->condition_list, node) {
+               applies = lttng_condition_is_equal(condition_list_element->condition, condition);
                if (applies) {
                        break;
                }
@@ -769,10 +697,9 @@ bool condition_applies_to_client(const struct lttng_condition *condition,
        return applies;
 }
 
-static
-struct notification_client_list *notification_client_list_create(
-               struct notification_thread_state *state,
-               const struct lttng_condition *condition)
+static struct notification_client_list *
+notification_client_list_create(struct notification_thread_state *state,
+                               const struct lttng_condition *condition)
 {
        struct notification_client *client;
        struct cds_lfht_iter iter;
@@ -802,8 +729,7 @@ struct notification_client_list *notification_client_list_create(
        client_list->condition = lttng_condition_copy(condition);
 
        /* Build a list of clients to which this new condition applies. */
-       cds_lfht_for_each_entry (state->client_socket_ht, &iter, client,
-                       client_socket_ht_node) {
+       cds_lfht_for_each_entry (state->client_socket_ht, &iter, client, client_socket_ht_node) {
                struct notification_client_list_element *client_list_element;
 
                if (!condition_applies_to_client(condition, client)) {
@@ -820,18 +746,17 @@ struct notification_client_list *notification_client_list_create(
                cds_list_add(&client_list_element->node, &client_list->clients_list);
        }
 
-       client_list->notification_trigger_clients_ht =
-                       state->notification_trigger_clients_ht;
+       client_list->notification_trigger_clients_ht = state->notification_trigger_clients_ht;
 
        rcu_read_lock();
        /*
         * Add the client list to the global list of client list.
         */
        cds_lfht_add_unique(state->notification_trigger_clients_ht,
-                       lttng_condition_hash(client_list->condition),
-                       match_client_list_condition,
-                       client_list->condition,
-                       &client_list->notification_trigger_clients_ht_node);
+                           lttng_condition_hash(client_list->condition),
+                           match_client_list_condition,
+                           client_list->condition,
+                           &client_list->notification_trigger_clients_ht_node);
        rcu_read_unlock();
        goto end;
 
@@ -852,10 +777,9 @@ void notification_client_list_put(struct notification_client_list *list)
 }
 
 /* Provides a reference to the returned list. */
-static
-struct notification_client_list *get_client_list_from_condition(
-       struct notification_thread_state *state,
-       const struct lttng_condition *condition)
+static struct notification_client_list *
+get_client_list_from_condition(struct notification_thread_state *state,
+                              const struct lttng_condition *condition)
 {
        struct cds_lfht_node *node;
        struct cds_lfht_iter iter;
@@ -869,8 +793,8 @@ struct notification_client_list *get_client_list_from_condition(
                        &iter);
        node = cds_lfht_iter_get_node(&iter);
        if (node) {
-               list = lttng::utils::container_of(node,
-                               &notification_client_list::notification_trigger_clients_ht_node);
+               list = lttng::utils::container_of(
+                       node, &notification_client_list::notification_trigger_clients_ht_node);
                list = notification_client_list_get(list) ? list : NULL;
        }
 
@@ -878,12 +802,11 @@ struct notification_client_list *get_client_list_from_condition(
        return list;
 }
 
-static
-int evaluate_channel_condition_for_client(
-               const struct lttng_condition *condition,
-               struct notification_thread_state *state,
-               struct lttng_evaluation **evaluation,
-               uid_t *session_uid, gid_t *session_gid)
+static int evaluate_channel_condition_for_client(const struct lttng_condition *condition,
+                                                struct notification_thread_state *state,
+                                                struct lttng_evaluation **evaluation,
+                                                uid_t *session_uid,
+                                                gid_t *session_gid)
 {
        int ret;
        struct cds_lfht_iter iter;
@@ -896,18 +819,16 @@ int evaluate_channel_condition_for_client(
        rcu_read_lock();
 
        /* Find the channel associated with the condition. */
-       cds_lfht_for_each_entry(state->channel_triggers_ht, &iter,
-                       channel_trigger_list, channel_triggers_ht_node) {
+       cds_lfht_for_each_entry (
+               state->channel_triggers_ht, &iter, channel_trigger_list, channel_triggers_ht_node) {
                struct lttng_trigger_list_element *element;
 
-               cds_list_for_each_entry(element, &channel_trigger_list->list, node) {
+               cds_list_for_each_entry (element, &channel_trigger_list->list, node) {
                        const struct lttng_condition *current_condition =
-                                       lttng_trigger_get_const_condition(
-                                               element->trigger);
+                               lttng_trigger_get_const_condition(element->trigger);
 
                        LTTNG_ASSERT(current_condition);
-                       if (!lttng_condition_is_equal(condition,
-                                       current_condition)) {
+                       if (!lttng_condition_is_equal(condition, current_condition)) {
                                continue;
                        }
 
@@ -921,7 +842,7 @@ int evaluate_channel_condition_for_client(
                }
        }
 
-       if (!channel_key){
+       if (!channel_key) {
                /* No channel found; normal exit. */
                DBG("No known channel associated with newly subscribed-to condition");
                ret = 0;
@@ -936,8 +857,7 @@ int evaluate_channel_condition_for_client(
                        &iter);
        node = cds_lfht_iter_get_node(&iter);
        LTTNG_ASSERT(node);
-       channel_info = caa_container_of(node, struct channel_info,
-                       channels_ht_node);
+       channel_info = caa_container_of(node, struct channel_info, channels_ht_node);
 
        /* Retrieve the channel's last sample, if it exists. */
        cds_lfht_lookup(state->channel_state_ht,
@@ -947,9 +867,8 @@ int evaluate_channel_condition_for_client(
                        &iter);
        node = cds_lfht_iter_get_node(&iter);
        if (node) {
-               last_sample = caa_container_of(node,
-                               struct channel_state_sample,
-                               channel_state_ht_node);
+               last_sample =
+                       caa_container_of(node, struct channel_state_sample, channel_state_ht_node);
        } else {
                /* Nothing to evaluate, no sample was ever taken. Normal exit */
                DBG("No channel sample associated with newly subscribed-to condition");
@@ -957,9 +876,8 @@ int evaluate_channel_condition_for_client(
                goto end;
        }
 
-       ret = evaluate_buffer_condition(condition, evaluation, state,
-                       NULL, last_sample,
-                       channel_info);
+       ret = evaluate_buffer_condition(
+               condition, evaluation, state, NULL, last_sample, channel_info);
        if (ret) {
                WARN("Fatal error occurred while evaluating a newly subscribed-to condition");
                goto end;
@@ -972,8 +890,7 @@ end:
        return ret;
 }
 
-static
-const char *get_condition_session_name(const struct lttng_condition *condition)
+static const char *get_condition_session_name(const struct lttng_condition *condition)
 {
        const char *session_name = NULL;
        enum lttng_condition_status status;
@@ -981,17 +898,16 @@ const char *get_condition_session_name(const struct lttng_condition *condition)
        switch (lttng_condition_get_type(condition)) {
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW:
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH:
-               status = lttng_condition_buffer_usage_get_session_name(
-                               condition, &session_name);
+               status = lttng_condition_buffer_usage_get_session_name(condition, &session_name);
                break;
        case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE:
-               status = lttng_condition_session_consumed_size_get_session_name(
-                               condition, &session_name);
+               status = lttng_condition_session_consumed_size_get_session_name(condition,
+                                                                               &session_name);
                break;
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING:
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED:
-               status = lttng_condition_session_rotation_get_session_name(
-                               condition, &session_name);
+               status =
+                       lttng_condition_session_rotation_get_session_name(condition, &session_name);
                break;
        default:
                abort();
@@ -1004,27 +920,26 @@ end:
        return session_name;
 }
 
-static
-bool evaluate_session_rotation_ongoing_condition(const struct lttng_condition *condition
-               __attribute__((unused)),
-               const struct session_state_sample *sample)
+static bool evaluate_session_rotation_ongoing_condition(const struct lttng_condition *condition
+                                                       __attribute__((unused)),
+                                                       const struct session_state_sample *sample)
 {
        return sample->rotation.ongoing;
 }
 
-static
-bool evaluate_session_consumed_size_condition(
-               const struct lttng_condition *condition,
-               const struct session_state_sample *sample)
+static bool evaluate_session_consumed_size_condition(const struct lttng_condition *condition,
+                                                    const struct session_state_sample *sample)
 {
        uint64_t threshold;
        const struct lttng_condition_session_consumed_size *size_condition =
-                       lttng::utils::container_of(condition,
-                               &lttng_condition_session_consumed_size::parent);
+               lttng::utils::container_of(condition,
+                                          &lttng_condition_session_consumed_size::parent);
 
        threshold = size_condition->consumed_threshold_bytes.value;
-       DBG("Session consumed size condition being evaluated: threshold = %" PRIu64 ", current size = %" PRIu64,
-                       threshold, sample->consumed_data_size);
+       DBG("Session consumed size condition being evaluated: threshold = %" PRIu64
+           ", current size = %" PRIu64,
+           threshold,
+           sample->consumed_data_size);
        return sample->consumed_data_size >= threshold;
 }
 
@@ -1033,12 +948,10 @@ bool evaluate_session_consumed_size_condition(
  * state transition. A client subscribed or a trigger was registered and
  * we wish to perform an initial evaluation.
  */
-static
-int evaluate_session_condition(
-               const struct lttng_condition *condition,
-               const struct session_info *session_info,
-               const struct session_state_sample *new_state,
-               struct lttng_evaluation **evaluation)
+static int evaluate_session_condition(const struct lttng_condition *condition,
+                                     const struct session_info *session_info,
+                                     const struct session_state_sample *new_state,
+                                     struct lttng_evaluation **evaluation)
 {
        int ret;
        bool previous_result, newest_result;
@@ -1047,25 +960,25 @@ int evaluate_session_condition(
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING:
                if (new_state) {
                        previous_result = evaluate_session_rotation_ongoing_condition(
-                                       condition, &session_info->last_state_sample);
-                       newest_result = evaluate_session_rotation_ongoing_condition(
-                                       condition, new_state);
+                               condition, &session_info->last_state_sample);
+                       newest_result =
+                               evaluate_session_rotation_ongoing_condition(condition, new_state);
                } else {
                        previous_result = false;
                        newest_result = evaluate_session_rotation_ongoing_condition(
-                                       condition, &session_info->last_state_sample);
+                               condition, &session_info->last_state_sample);
                }
                break;
        case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE:
                if (new_state) {
                        previous_result = evaluate_session_consumed_size_condition(
-                                       condition, &session_info->last_state_sample);
-                       newest_result = evaluate_session_consumed_size_condition(
-                                       condition, new_state);
+                               condition, &session_info->last_state_sample);
+                       newest_result =
+                               evaluate_session_consumed_size_condition(condition, new_state);
                } else {
                        previous_result = false;
                        newest_result = evaluate_session_consumed_size_condition(
-                                       condition, &session_info->last_state_sample);
+                               condition, &session_info->last_state_sample);
                }
                break;
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED:
@@ -1098,9 +1011,8 @@ int evaluate_session_condition(
        switch (lttng_condition_get_type(condition)) {
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING:
        {
-               const auto rotation_id = new_state ?
-                               new_state->rotation.id :
-                                     session_info->last_state_sample.rotation.id;
+               const auto rotation_id = new_state ? new_state->rotation.id :
+                                                    session_info->last_state_sample.rotation.id;
 
                *evaluation = lttng_evaluation_session_rotation_ongoing_create(rotation_id);
                break;
@@ -1112,17 +1024,17 @@ int evaluate_session_condition(
 
                /* Callee acquires a reference to location. */
                *evaluation = lttng_evaluation_session_rotation_completed_create(
-                               rotation_id, sample.rotation.location);
+                       rotation_id, sample.rotation.location);
                break;
        }
        case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE:
        {
                const auto latest_session_consumed_total = new_state ?
-                               new_state->consumed_data_size :
-                                     session_info->last_state_sample.consumed_data_size;
+                       new_state->consumed_data_size :
+                       session_info->last_state_sample.consumed_data_size;
 
                *evaluation = lttng_evaluation_session_consumed_size_create(
-                               latest_session_consumed_total);
+                       latest_session_consumed_total);
                break;
        }
        default:
@@ -1132,7 +1044,7 @@ int evaluate_session_condition(
        if (!*evaluation) {
                /* Fatal error. */
                ERR("Failed to create session condition evaluation: session name = `%s`",
-                               session_info->name);
+                   session_info->name);
                ret = -1;
                goto end;
        }
@@ -1142,11 +1054,10 @@ end:
        return ret;
 }
 
-static
-int evaluate_condition_for_client(const struct lttng_trigger *trigger,
-               const struct lttng_condition *condition,
-               struct notification_client *client,
-               struct notification_thread_state *state)
+static int evaluate_condition_for_client(const struct lttng_trigger *trigger,
+                                        const struct lttng_condition *condition,
+                                        struct notification_client *client,
+                                        struct notification_thread_state *state)
 {
        int ret;
        struct lttng_evaluation *evaluation = NULL;
@@ -1178,7 +1089,7 @@ int evaluate_condition_for_client(const struct lttng_trigger *trigger,
                if (!session_info) {
                        /* Not an error, the session doesn't exist yet. */
                        DBG("Session not found while evaluating session condition for client: session name = `%s`",
-                                       session_name);
+                           session_name);
                        ret = 0;
                        goto end;
                }
@@ -1191,8 +1102,8 @@ int evaluate_condition_for_client(const struct lttng_trigger *trigger,
                break;
        }
        case LTTNG_OBJECT_TYPE_CHANNEL:
-               ret = evaluate_channel_condition_for_client(condition, state,
-                               &evaluation, &object_uid, &object_gid);
+               ret = evaluate_channel_condition_for_client(
+                       condition, state, &evaluation, &object_uid, &object_gid);
                break;
        case LTTNG_OBJECT_TYPE_NONE:
                DBG("Newly subscribed-to condition not bound to object, nothing to evaluate");
@@ -1227,34 +1138,31 @@ int evaluate_condition_for_client(const struct lttng_trigger *trigger,
 
        /* Send evaluation result to the newly-subscribed client. */
        DBG("Newly subscribed-to condition evaluated to true, notifying client");
-       ret = send_evaluation_to_clients(trigger, evaluation, &client_list,
-                       state, object_uid, object_gid);
+       ret = send_evaluation_to_clients(
+               trigger, evaluation, &client_list, state, object_uid, object_gid);
 
 end:
        return ret;
 }
 
-static
-int notification_thread_client_subscribe(struct notification_client *client,
-               struct lttng_condition *condition,
-               struct notification_thread_state *state,
-               enum lttng_notification_channel_status *_status)
+static int notification_thread_client_subscribe(struct notification_client *client,
+                                               struct lttng_condition *condition,
+                                               struct notification_thread_state *state,
+                                               enum lttng_notification_channel_status *_status)
 {
        int ret = 0;
        struct notification_client_list *client_list = NULL;
        struct lttng_condition_list_element *condition_list_element = NULL;
        struct notification_client_list_element *client_list_element = NULL;
        struct lttng_trigger_ht_element *trigger_ht_element;
-       enum lttng_notification_channel_status status =
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
+       enum lttng_notification_channel_status status = LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
 
        /*
         * Ensure that the client has not already subscribed to this condition
         * before.
         */
-       cds_list_for_each_entry(condition_list_element, &client->condition_list, node) {
-               if (lttng_condition_is_equal(condition_list_element->condition,
-                               condition)) {
+       cds_list_for_each_entry (condition_list_element, &client->condition_list, node) {
+               if (lttng_condition_is_equal(condition_list_element->condition, condition)) {
                        status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ALREADY_SUBSCRIBED;
                        goto end;
                }
@@ -1279,8 +1187,7 @@ int notification_thread_client_subscribe(struct notification_client *client,
        condition = NULL;
        cds_list_add(&condition_list_element->node, &client->condition_list);
 
-       client_list = get_client_list_from_condition(
-                       state, condition_list_element->condition);
+       client_list = get_client_list_from_condition(state, condition_list_element->condition);
        if (!client_list) {
                /*
                 * No notification-emiting trigger registered with this
@@ -1302,10 +1209,12 @@ int notification_thread_client_subscribe(struct notification_client *client,
         * all triggers that have a `notify` action that have this condition.
         */
        pthread_mutex_lock(&client_list->lock);
-       cds_list_for_each_entry(trigger_ht_element,
-                       &client_list->triggers_list, client_list_trigger_node) {
-               if (evaluate_condition_for_client(trigger_ht_element->trigger, condition_list_element->condition,
-                               client, state)) {
+       cds_list_for_each_entry (
+               trigger_ht_element, &client_list->triggers_list, client_list_trigger_node) {
+               if (evaluate_condition_for_client(trigger_ht_element->trigger,
+                                                 condition_list_element->condition,
+                                                 client,
+                                                 state)) {
                        WARN("Evaluation of a condition on client subscription failed, aborting.");
                        ret = -1;
                        free(client_list_element);
@@ -1342,27 +1251,21 @@ error:
        return ret;
 }
 
-static
-int notification_thread_client_unsubscribe(
-               struct notification_client *client,
-               struct lttng_condition *condition,
-               struct notification_thread_state *state,
-               enum lttng_notification_channel_status *_status)
+static int notification_thread_client_unsubscribe(struct notification_client *client,
+                                                 struct lttng_condition *condition,
+                                                 struct notification_thread_state *state,
+                                                 enum lttng_notification_channel_status *_status)
 {
        struct notification_client_list *client_list;
-       struct lttng_condition_list_element *condition_list_element,
-                       *condition_tmp;
-       struct notification_client_list_element *client_list_element,
-                       *client_tmp;
+       struct lttng_condition_list_element *condition_list_element, *condition_tmp;
+       struct notification_client_list_element *client_list_element, *client_tmp;
        bool condition_found = false;
-       enum lttng_notification_channel_status status =
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
+       enum lttng_notification_channel_status status = LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
 
        /* Remove the condition from the client's condition list. */
-       cds_list_for_each_entry_safe(condition_list_element, condition_tmp,
-                       &client->condition_list, node) {
-               if (!lttng_condition_is_equal(condition_list_element->condition,
-                               condition)) {
+       cds_list_for_each_entry_safe (
+               condition_list_element, condition_tmp, &client->condition_list, node) {
+               if (!lttng_condition_is_equal(condition_list_element->condition, condition)) {
                        continue;
                }
 
@@ -1373,8 +1276,7 @@ int notification_thread_client_unsubscribe(
                 * will be destroyed at the end.
                 */
                if (condition != condition_list_element->condition) {
-                       lttng_condition_destroy(
-                                       condition_list_element->condition);
+                       lttng_condition_destroy(condition_list_element->condition);
                }
                free(condition_list_element);
                condition_found = true;
@@ -1396,8 +1298,8 @@ int notification_thread_client_unsubscribe(
        }
 
        pthread_mutex_lock(&client_list->lock);
-       cds_list_for_each_entry_safe(client_list_element, client_tmp,
-                       &client_list->clients_list, node) {
+       cds_list_for_each_entry_safe (
+               client_list_element, client_tmp, &client_list->clients_list, node) {
                if (client_list_element->client->id != client->id) {
                        continue;
                }
@@ -1416,14 +1318,12 @@ end:
        return 0;
 }
 
-static
-void free_notification_client_rcu(struct rcu_head *node)
+static void free_notification_client_rcu(struct rcu_head *node)
 {
        free(lttng::utils::container_of(node, &notification_client::rcu_node));
 }
 
-static
-void notification_client_destroy(struct notification_client *client)
+static void notification_client_destroy(struct notification_client *client)
 {
        if (!client) {
                return;
@@ -1448,9 +1348,8 @@ void notification_client_destroy(struct notification_client *client)
  * Call with rcu_read_lock held (and hold for the lifetime of the returned
  * client pointer).
  */
-static
-struct notification_client *get_client_from_socket(int socket,
-               struct notification_thread_state *state)
+static struct notification_client *get_client_from_socket(int socket,
+                                                         struct notification_thread_state *state)
 {
        struct cds_lfht_iter iter;
        struct cds_lfht_node *node;
@@ -1468,8 +1367,7 @@ struct notification_client *get_client_from_socket(int socket,
                goto end;
        }
 
-       client = caa_container_of(node, struct notification_client,
-                       client_socket_ht_node);
+       client = caa_container_of(node, struct notification_client, client_socket_ht_node);
 end:
        return client;
 }
@@ -1478,9 +1376,8 @@ end:
  * Call with rcu_read_lock held (and hold for the lifetime of the returned
  * client pointer).
  */
-static
-struct notification_client *get_client_from_id(notification_client_id id,
-               struct notification_thread_state *state)
+static struct notification_client *get_client_from_id(notification_client_id id,
+                                                     struct notification_thread_state *state)
 {
        struct cds_lfht_iter iter;
        struct cds_lfht_node *node;
@@ -1488,45 +1385,35 @@ struct notification_client *get_client_from_id(notification_client_id id,
 
        ASSERT_RCU_READ_LOCKED();
 
-       cds_lfht_lookup(state->client_id_ht,
-                       hash_client_id(id),
-                       match_client_id,
-                       &id,
-                       &iter);
+       cds_lfht_lookup(state->client_id_ht, hash_client_id(id), match_client_id, &id, &iter);
        node = cds_lfht_iter_get_node(&iter);
        if (!node) {
                goto end;
        }
 
-       client = caa_container_of(node, struct notification_client,
-                       client_id_ht_node);
+       client = caa_container_of(node, struct notification_client, client_id_ht_node);
 end:
        return client;
 }
 
-static
-bool buffer_usage_condition_applies_to_channel(
-               const struct lttng_condition *condition,
-               const struct channel_info *channel_info)
+static bool buffer_usage_condition_applies_to_channel(const struct lttng_condition *condition,
+                                                     const struct channel_info *channel_info)
 {
        enum lttng_condition_status status;
        enum lttng_domain_type condition_domain;
        const char *condition_session_name = NULL;
        const char *condition_channel_name = NULL;
 
-       status = lttng_condition_buffer_usage_get_domain_type(condition,
-                       &condition_domain);
+       status = lttng_condition_buffer_usage_get_domain_type(condition, &condition_domain);
        LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
        if (channel_info->key.domain != condition_domain) {
                goto fail;
        }
 
-       status = lttng_condition_buffer_usage_get_session_name(
-                       condition, &condition_session_name);
+       status = lttng_condition_buffer_usage_get_session_name(condition, &condition_session_name);
        LTTNG_ASSERT((status == LTTNG_CONDITION_STATUS_OK) && condition_session_name);
 
-       status = lttng_condition_buffer_usage_get_channel_name(
-                       condition, &condition_channel_name);
+       status = lttng_condition_buffer_usage_get_channel_name(condition, &condition_channel_name);
        LTTNG_ASSERT((status == LTTNG_CONDITION_STATUS_OK) && condition_channel_name);
 
        if (strcmp(channel_info->session_info->name, condition_session_name)) {
@@ -1541,9 +1428,8 @@ fail:
        return false;
 }
 
-static
-bool trigger_applies_to_channel(const struct lttng_trigger *trigger,
-               const struct channel_info *channel_info)
+static bool trigger_applies_to_channel(const struct lttng_trigger *trigger,
+                                      const struct channel_info *channel_info)
 {
        const struct lttng_condition *condition;
        bool trigger_applies;
@@ -1556,8 +1442,8 @@ bool trigger_applies_to_channel(const struct lttng_trigger *trigger,
        switch (lttng_condition_get_type(condition)) {
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW:
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH:
-               trigger_applies = buffer_usage_condition_applies_to_channel(
-                               condition, channel_info);
+               trigger_applies =
+                       buffer_usage_condition_applies_to_channel(condition, channel_info);
                break;
        default:
                goto fail;
@@ -1569,10 +1455,8 @@ fail:
 }
 
 /* Must be called with RCU read lock held. */
-static
-struct lttng_session_trigger_list *get_session_trigger_list(
-               struct notification_thread_state *state,
-               const char *session_name)
+static struct lttng_session_trigger_list *
+get_session_trigger_list(struct notification_thread_state *state, const char *session_name)
 {
        struct lttng_session_trigger_list *list = NULL;
        struct cds_lfht_node *node;
@@ -1592,13 +1476,11 @@ struct lttng_session_trigger_list *get_session_trigger_list(
                 * will be initialized when the session is created.
                 */
                DBG("No trigger list found for session \"%s\" as it is not yet known to the notification system",
-                               session_name);
+                   session_name);
                goto end;
        }
 
-       list = caa_container_of(node,
-                       struct lttng_session_trigger_list,
-                       session_triggers_ht_node);
+       list = caa_container_of(node, struct lttng_session_trigger_list, session_triggers_ht_node);
 end:
        return list;
 }
@@ -1607,10 +1489,8 @@ end:
  * Allocate an empty lttng_session_trigger_list for the session named
  * 'session_name'.
  */
-static
-struct lttng_session_trigger_list *lttng_session_trigger_list_create(
-               const char *session_name,
-               struct cds_lfht *session_triggers_ht)
+static struct lttng_session_trigger_list *
+lttng_session_trigger_list_create(const char *session_name, struct cds_lfht *session_triggers_ht)
 {
        struct lttng_session_trigger_list *list = NULL;
        char *session_name_copy = strdup(session_name);
@@ -1634,49 +1514,43 @@ struct lttng_session_trigger_list *lttng_session_trigger_list_create(
        rcu_read_lock();
        /* Publish the list through the session_triggers_ht. */
        cds_lfht_add(session_triggers_ht,
-                       hash_key_str(session_name, lttng_ht_seed),
-                       &list->session_triggers_ht_node);
+                    hash_key_str(session_name, lttng_ht_seed),
+                    &list->session_triggers_ht_node);
        rcu_read_unlock();
 end:
        return list;
 }
 
-static
-void free_session_trigger_list_rcu(struct rcu_head *node)
+static void free_session_trigger_list_rcu(struct rcu_head *node)
 {
        struct lttng_session_trigger_list *list =
-                       caa_container_of(node, struct lttng_session_trigger_list, rcu_node);
+               caa_container_of(node, struct lttng_session_trigger_list, rcu_node);
 
        free(list->session_name);
        free(list);
 }
 
-static
-void lttng_session_trigger_list_destroy(struct lttng_session_trigger_list *list)
+static void lttng_session_trigger_list_destroy(struct lttng_session_trigger_list *list)
 {
        struct lttng_trigger_list_element *trigger_list_element, *tmp;
 
        /* Empty the list element by element, and then free the list itself. */
-       cds_list_for_each_entry_safe(trigger_list_element, tmp,
-                       &list->list, node) {
+       cds_list_for_each_entry_safe (trigger_list_element, tmp, &list->list, node) {
                cds_list_del(&trigger_list_element->node);
                free(trigger_list_element);
        }
        rcu_read_lock();
        /* Unpublish the list from the session_triggers_ht. */
-       cds_lfht_del(list->session_triggers_ht,
-                       &list->session_triggers_ht_node);
+       cds_lfht_del(list->session_triggers_ht, &list->session_triggers_ht_node);
        rcu_read_unlock();
        call_rcu(&list->rcu_node, free_session_trigger_list_rcu);
 }
 
-static
-int lttng_session_trigger_list_add(struct lttng_session_trigger_list *list,
-               struct lttng_trigger *trigger)
+static int lttng_session_trigger_list_add(struct lttng_session_trigger_list *list,
+                                         struct lttng_trigger *trigger)
 {
        int ret = 0;
-       struct lttng_trigger_list_element *new_element =
-                       zmalloc<lttng_trigger_list_element>();
+       struct lttng_trigger_list_element *new_element = zmalloc<lttng_trigger_list_element>();
 
        if (!new_element) {
                ret = -1;
@@ -1689,9 +1563,8 @@ end:
        return ret;
 }
 
-static
-bool trigger_applies_to_session(const struct lttng_trigger *trigger,
-               const char *session_name)
+static bool trigger_applies_to_session(const struct lttng_trigger *trigger,
+                                      const char *session_name)
 {
        bool applies = false;
        const struct lttng_condition *condition;
@@ -1720,31 +1593,28 @@ end:
  * Allocate and initialize an lttng_session_trigger_list which contains
  * all triggers that apply to the session named 'session_name'.
  */
-static
-struct lttng_session_trigger_list *lttng_session_trigger_list_build(
-               const struct notification_thread_state *state,
-               const char *session_name)
+static struct lttng_session_trigger_list *
+lttng_session_trigger_list_build(const struct notification_thread_state *state,
+                                const char *session_name)
 {
        int trigger_count = 0;
        struct lttng_session_trigger_list *session_trigger_list = NULL;
        struct lttng_trigger_ht_element *trigger_ht_element = NULL;
        struct cds_lfht_iter iter;
 
-       session_trigger_list = lttng_session_trigger_list_create(session_name,
-                       state->session_triggers_ht);
+       session_trigger_list =
+               lttng_session_trigger_list_create(session_name, state->session_triggers_ht);
 
        /* Add all triggers applying to the session named 'session_name'. */
-       cds_lfht_for_each_entry(state->triggers_ht, &iter, trigger_ht_element,
-                       node) {
+       cds_lfht_for_each_entry (state->triggers_ht, &iter, trigger_ht_element, node) {
                int ret;
 
-               if (!trigger_applies_to_session(trigger_ht_element->trigger,
-                               session_name)) {
+               if (!trigger_applies_to_session(trigger_ht_element->trigger, session_name)) {
                        continue;
                }
 
                ret = lttng_session_trigger_list_add(session_trigger_list,
-                               trigger_ht_element->trigger);
+                                                    trigger_ht_element->trigger);
                if (ret) {
                        goto error;
                }
@@ -1752,20 +1622,18 @@ struct lttng_session_trigger_list *lttng_session_trigger_list_build(
                trigger_count++;
        }
 
-       DBG("Found %i triggers that apply to newly created session",
-                       trigger_count);
+       DBG("Found %i triggers that apply to newly created session", trigger_count);
        return session_trigger_list;
 error:
        lttng_session_trigger_list_destroy(session_trigger_list);
        return NULL;
 }
 
-static
-struct session_info *create_and_publish_session_info(struct notification_thread_state *state,
-               uint64_t id,
-               const char *name,
-               uid_t uid,
-               gid_t gid)
+static struct session_info *create_and_publish_session_info(struct notification_thread_state *state,
+                                                           uint64_t id,
+                                                           const char *name,
+                                                           uid_t uid,
+                                                           gid_t gid)
 {
        struct session_info *session = NULL;
        struct lttng_session_trigger_list *trigger_list;
@@ -1776,11 +1644,12 @@ struct session_info *create_and_publish_session_info(struct notification_thread_
                goto error;
        }
 
-       session = session_info_create(id, name, uid, gid, trigger_list,
-                       state->sessions_ht);
+       session = session_info_create(id, name, uid, gid, trigger_list, state->sessions_ht);
        if (!session) {
                ERR("Failed to allocation session info for session \"%s\" (uid = %i, gid = %i)",
-                               name, uid, gid);
+                   name,
+                   uid,
+                   gid);
                lttng_session_trigger_list_destroy(trigger_list);
                goto error;
        }
@@ -1788,8 +1657,11 @@ struct session_info *create_and_publish_session_info(struct notification_thread_
        /* Transferred ownership to the new session. */
        trigger_list = NULL;
 
-       if (cds_lfht_add_unique(state->sessions_ht, hash_session_info(session), match_session_info,
-                           &id, &session->sessions_ht_node) != &session->sessions_ht_node) {
+       if (cds_lfht_add_unique(state->sessions_ht,
+                               hash_session_info(session),
+                               match_session_info,
+                               &id,
+                               &session->sessions_ht_node) != &session->sessions_ht_node) {
                ERR("Duplicate session found: name = `%s`, id = %" PRIu64, name, id);
                goto error;
        }
@@ -1802,14 +1674,13 @@ error:
        return NULL;
 }
 
-static
-int handle_notification_thread_command_add_channel(struct notification_thread_state *state,
-               uint64_t session_id,
-               const char *channel_name,
-               enum lttng_domain_type channel_domain,
-               uint64_t channel_key_int,
-               uint64_t channel_capacity,
-               enum lttng_error_code *cmd_result)
+static int handle_notification_thread_command_add_channel(struct notification_thread_state *state,
+                                                         uint64_t session_id,
+                                                         const char *channel_name,
+                                                         enum lttng_domain_type channel_domain,
+                                                         uint64_t channel_key_int,
+                                                         uint64_t channel_capacity,
+                                                         enum lttng_error_code *cmd_result)
 {
        struct cds_list_head trigger_list;
        struct channel_info *new_channel_info = NULL;
@@ -1823,9 +1694,12 @@ int handle_notification_thread_command_add_channel(struct notification_thread_st
        struct cds_lfht_iter iter;
        struct session_info *session_info = NULL;
 
-       DBG("Adding channel: channel name = `%s`, session id = %" PRIu64 ", channel key = %" PRIu64 ", domain = %s",
-                       channel_name, session_id, channel_key_int,
-                       lttng_domain_type_str(channel_domain));
+       DBG("Adding channel: channel name = `%s`, session id = %" PRIu64 ", channel key = %" PRIu64
+           ", domain = %s",
+           channel_name,
+           session_id,
+           channel_key_int,
+           lttng_domain_type_str(channel_domain));
 
        CDS_INIT_LIST_HEAD(&trigger_list);
 
@@ -1833,24 +1707,22 @@ int handle_notification_thread_command_add_channel(struct notification_thread_st
        if (!session_info) {
                /* Fatal logic error. */
                ERR("Failed to find session while adding channel: session id = %" PRIu64,
-                               session_id);
+                   session_id);
                goto error;
        }
 
-       new_channel_info = channel_info_create(channel_name, &channel_key,
-                       channel_capacity, session_info);
+       new_channel_info =
+               channel_info_create(channel_name, &channel_key, channel_capacity, session_info);
        if (!new_channel_info) {
                goto error;
        }
 
        rcu_read_lock();
        /* Build a list of all triggers applying to the new channel. */
-       cds_lfht_for_each_entry(state->triggers_ht, &iter, trigger_ht_element,
-                       node) {
+       cds_lfht_for_each_entry (state->triggers_ht, &iter, trigger_ht_element, node) {
                struct lttng_trigger_list_element *new_element;
 
-               if (!trigger_applies_to_channel(trigger_ht_element->trigger,
-                               new_channel_info)) {
+               if (!trigger_applies_to_channel(trigger_ht_element->trigger, new_channel_info)) {
                        continue;
                }
 
@@ -1866,8 +1738,7 @@ int handle_notification_thread_command_add_channel(struct notification_thread_st
        }
        rcu_read_unlock();
 
-       DBG("Found %i triggers that apply to newly added channel",
-                       trigger_count);
+       DBG("Found %i triggers that apply to newly added channel", trigger_count);
        channel_trigger_list = zmalloc<lttng_channel_trigger_list>();
        if (!channel_trigger_list) {
                goto error;
@@ -1880,15 +1751,15 @@ int handle_notification_thread_command_add_channel(struct notification_thread_st
        rcu_read_lock();
        /* Add channel to the channel_ht which owns the channel_infos. */
        cds_lfht_add(state->channels_ht,
-                       hash_channel_key(&new_channel_info->key),
-                       &new_channel_info->channels_ht_node);
+                    hash_channel_key(&new_channel_info->key),
+                    &new_channel_info->channels_ht_node);
        /*
         * Add the list of triggers associated with this channel to the
         * channel_triggers_ht.
         */
        cds_lfht_add(state->channel_triggers_ht,
-                       hash_channel_key(&new_channel_info->key),
-                       &channel_trigger_list->channel_triggers_ht_node);
+                    hash_channel_key(&new_channel_info->key),
+                    &channel_trigger_list->channel_triggers_ht_node);
        rcu_read_unlock();
        session_info_put(session_info);
        *cmd_result = LTTNG_OK;
@@ -1899,23 +1770,31 @@ error:
        return 1;
 }
 
-static
-int handle_notification_thread_command_add_session(struct notification_thread_state *state,
-               uint64_t session_id,
-               const char *session_name,
-               uid_t session_uid,
-               gid_t session_gid,
-               enum lttng_error_code *cmd_result)
+static int handle_notification_thread_command_add_session(struct notification_thread_state *state,
+                                                         uint64_t session_id,
+                                                         const char *session_name,
+                                                         uid_t session_uid,
+                                                         gid_t session_gid,
+                                                         enum lttng_error_code *cmd_result)
 {
        int ret;
 
-       DBG("Adding session: session name = `%s`, session id = %" PRIu64 ", session uid = %d, session gid = %d",
-                       session_name, session_id, session_uid, session_gid);
+       DBG("Adding session: session name = `%s`, session id = %" PRIu64
+           ", session uid = %d, session gid = %d",
+           session_name,
+           session_id,
+           session_uid,
+           session_gid);
 
-       auto session = create_and_publish_session_info(state, session_id, session_name, session_uid, session_gid);
+       auto session = create_and_publish_session_info(
+               state, session_id, session_name, session_uid, session_gid);
        if (!session) {
-               PERROR("Failed to add session: session name = `%s`, session id = %" PRIu64 ", session uid = %d, session gid = %d",
-                               session_name, session_id, session_uid, session_gid);
+               PERROR("Failed to add session: session name = `%s`, session id = %" PRIu64
+                      ", session uid = %d, session gid = %d",
+                      session_name,
+                      session_id,
+                      session_uid,
+                      session_gid);
                ret = -1;
                *cmd_result = LTTNG_ERR_NOMEM;
                goto end;
@@ -1933,11 +1812,10 @@ end:
        return ret;
 }
 
-static
-int handle_notification_thread_command_remove_session(
-               struct notification_thread_state *state,
-               uint64_t session_id,
-               enum lttng_error_code *cmd_result)
+static int
+handle_notification_thread_command_remove_session(struct notification_thread_state *state,
+                                                 uint64_t session_id,
+                                                 enum lttng_error_code *cmd_result)
 {
        int ret;
 
@@ -1960,25 +1838,21 @@ end:
        return ret;
 }
 
-static
-void free_channel_trigger_list_rcu(struct rcu_head *node)
+static void free_channel_trigger_list_rcu(struct rcu_head *node)
 {
-       free(caa_container_of(node, struct lttng_channel_trigger_list,
-                       rcu_node));
+       free(caa_container_of(node, struct lttng_channel_trigger_list, rcu_node));
 }
 
-static
-void free_channel_state_sample_rcu(struct rcu_head *node)
+static void free_channel_state_sample_rcu(struct rcu_head *node)
 {
-       free(caa_container_of(node, struct channel_state_sample,
-                       rcu_node));
+       free(caa_container_of(node, struct channel_state_sample, rcu_node));
 }
 
-static
-int handle_notification_thread_command_remove_channel(
-       struct notification_thread_state *state,
-       uint64_t channel_key, enum lttng_domain_type domain,
-       enum lttng_error_code *cmd_result)
+static int
+handle_notification_thread_command_remove_channel(struct notification_thread_state *state,
+                                                 uint64_t channel_key,
+                                                 enum lttng_domain_type domain,
+                                                 enum lttng_error_code *cmd_result)
 {
        struct cds_lfht_node *node;
        struct cds_lfht_iter iter;
@@ -1988,7 +1862,8 @@ int handle_notification_thread_command_remove_channel(
        struct channel_info *channel_info;
 
        DBG("Removing channel key = %" PRIu64 " in %s domain",
-                       channel_key, lttng_domain_type_str(domain));
+           channel_key,
+           lttng_domain_type_str(domain));
 
        rcu_read_lock();
 
@@ -2008,10 +1883,9 @@ int handle_notification_thread_command_remove_channel(
        }
 
        /* Free the list of triggers associated with this channel. */
-       trigger_list = caa_container_of(node, struct lttng_channel_trigger_list,
-                       channel_triggers_ht_node);
-       cds_list_for_each_entry_safe(trigger_list_element, tmp,
-                       &trigger_list->list, node) {
+       trigger_list =
+               caa_container_of(node, struct lttng_channel_trigger_list, channel_triggers_ht_node);
+       cds_list_for_each_entry_safe (trigger_list_element, tmp, &trigger_list->list, node) {
                cds_list_del(&trigger_list_element->node);
                free(trigger_list_element);
        }
@@ -2030,24 +1904,19 @@ int handle_notification_thread_command_remove_channel(
         * received a sample.
         */
        if (node) {
-               struct channel_state_sample *sample = caa_container_of(node,
-                               struct channel_state_sample,
-                               channel_state_ht_node);
+               struct channel_state_sample *sample =
+                       caa_container_of(node, struct channel_state_sample, channel_state_ht_node);
 
                cds_lfht_del(state->channel_state_ht, node);
                call_rcu(&sample->rcu_node, free_channel_state_sample_rcu);
        }
 
        /* Remove the channel from the channels_ht and free it. */
-       cds_lfht_lookup(state->channels_ht,
-                       hash_channel_key(&key),
-                       match_channel_info,
-                       &key,
-                       &iter);
+       cds_lfht_lookup(
+               state->channels_ht, hash_channel_key(&key), match_channel_info, &key, &iter);
        node = cds_lfht_iter_get_node(&iter);
        LTTNG_ASSERT(node);
-       channel_info = caa_container_of(node, struct channel_info,
-                       channels_ht_node);
+       channel_info = caa_container_of(node, struct channel_info, channels_ht_node);
        cds_lfht_del(state->channels_ht, node);
        channel_info_destroy(channel_info);
 end:
@@ -2056,14 +1925,13 @@ end:
        return 0;
 }
 
-static
-int handle_notification_thread_command_session_rotation(
-       struct notification_thread_state *state,
-       enum notification_thread_command_type cmd_type,
-       uint64_t session_id,
-       uint64_t trace_archive_chunk_id,
-       struct lttng_trace_archive_location *location,
-       enum lttng_error_code *_cmd_result)
+static int
+handle_notification_thread_command_session_rotation(struct notification_thread_state *state,
+                                                   enum notification_thread_command_type cmd_type,
+                                                   uint64_t session_id,
+                                                   uint64_t trace_archive_chunk_id,
+                                                   struct lttng_trace_archive_location *location,
+                                                   enum lttng_error_code *_cmd_result)
 {
        int ret = 0;
        enum lttng_error_code cmd_result = LTTNG_OK;
@@ -2079,7 +1947,7 @@ int handle_notification_thread_command_session_rotation(
        if (!session_info) {
                /* Fatal logic error. */
                ERR("Failed to find session while handling rotation state change: session id = %" PRIu64,
-                               session_id);
+                   session_id);
                ret = -1;
                cmd_result = LTTNG_ERR_FATAL;
                goto end;
@@ -2099,14 +1967,13 @@ int handle_notification_thread_command_session_rotation(
        };
 
        new_session_state.rotation.ongoing = cmd_type ==
-                       NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_ONGOING;
+               NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_ONGOING;
        new_session_state.rotation.id = trace_archive_chunk_id;
 
        trigger_list = get_session_trigger_list(state, session_info->name);
        LTTNG_ASSERT(trigger_list);
 
-       cds_list_for_each_entry(trigger_list_element, &trigger_list->list,
-                       node) {
+       cds_list_for_each_entry (trigger_list_element, &trigger_list->list, node) {
                const struct lttng_condition *condition;
                struct lttng_trigger *trigger;
                struct notification_client_list *client_list;
@@ -2118,7 +1985,7 @@ int handle_notification_thread_command_session_rotation(
                LTTNG_ASSERT(condition);
 
                ret = evaluate_session_condition(
-                               condition, session_info, &new_session_state, &evaluation);
+                       condition, session_info, &new_session_state, &evaluation);
                if (ret) {
                        ret = -1;
                        cmd_result = LTTNG_ERR_NOMEM;
@@ -2136,8 +2003,7 @@ int handle_notification_thread_command_session_rotation(
                 */
                client_list = get_client_list_from_condition(state, condition);
                executor_status = action_executor_enqueue_trigger(
-                               state->executor, trigger, evaluation,
-                               &session_creds, client_list);
+                       state->executor, trigger, evaluation, &session_creds, client_list);
                notification_client_list_put(client_list);
                evaluation = NULL;
                switch (executor_status) {
@@ -2180,12 +2046,11 @@ end:
        return ret;
 }
 
-static
-int handle_notification_thread_command_add_tracer_event_source(
-               struct notification_thread_state *state,
-               int tracer_event_source_fd,
-               enum lttng_domain_type domain_type,
-               enum lttng_error_code *_cmd_result)
+static int
+handle_notification_thread_command_add_tracer_event_source(struct notification_thread_state *state,
+                                                          int tracer_event_source_fd,
+                                                          enum lttng_domain_type domain_type,
+                                                          enum lttng_error_code *_cmd_result)
 {
        int ret = 0;
        enum lttng_error_code cmd_result = LTTNG_OK;
@@ -2204,15 +2069,15 @@ int handle_notification_thread_command_add_tracer_event_source(
        cds_list_add(&element->node, &state->tracer_event_sources_list);
 
        DBG3("Adding tracer event source fd to poll set: tracer_event_source_fd = %d, domain = '%s'",
-                       tracer_event_source_fd,
-                       lttng_domain_type_str(domain_type));
+            tracer_event_source_fd,
+            lttng_domain_type_str(domain_type));
 
        /* Adding the read side pipe to the event poll. */
        ret = lttng_poll_add(&state->events, tracer_event_source_fd, LPOLLPRI | LPOLLIN);
        if (ret < 0) {
                ERR("Failed to add tracer event source to poll set: tracer_event_source_fd = %d, domain = '%s'",
-                               tracer_event_source_fd,
-                               lttng_domain_type_str(element->domain));
+                   tracer_event_source_fd,
+                   lttng_domain_type_str(element->domain));
                cds_list_del(&element->node);
                free(element);
                goto end;
@@ -2225,10 +2090,9 @@ end:
        return ret;
 }
 
-static
-int drain_event_notifier_notification_pipe(
-               struct notification_thread_state *state,
-               int pipe, enum lttng_domain_type domain)
+static int drain_event_notifier_notification_pipe(struct notification_thread_state *state,
+                                                 int pipe,
+                                                 enum lttng_domain_type domain)
 {
        struct lttng_poll_event events = {};
        int ret;
@@ -2242,7 +2106,7 @@ int drain_event_notifier_notification_pipe(
        ret = lttng_poll_add(&events, pipe, LPOLLIN);
        if (ret < 0) {
                ERR("Error adding fd event notifier notification pipe to lttng_poll_event: fd = %d",
-                               pipe);
+                   pipe);
                goto end;
        }
 
@@ -2270,7 +2134,7 @@ int drain_event_notifier_notification_pipe(
                ret = handle_one_event_notifier_notification(state, pipe, domain);
                if (ret) {
                        ERR("Error consuming an event notifier notification from pipe: fd = %d",
-                                       pipe);
+                           pipe);
                }
        }
 end:
@@ -2278,15 +2142,13 @@ end:
        return ret;
 }
 
-static
-struct notification_event_tracer_event_source_element *
+static struct notification_event_tracer_event_source_element *
 find_tracer_event_source_element(struct notification_thread_state *state,
-               int tracer_event_source_fd)
+                                int tracer_event_source_fd)
 {
        struct notification_event_tracer_event_source_element *source_element;
 
-       cds_list_for_each_entry(source_element,
-                       &state->tracer_event_sources_list, node) {
+       cds_list_for_each_entry (source_element, &state->tracer_event_sources_list, node) {
                if (source_element->fd == tracer_event_source_fd) {
                        goto end;
                }
@@ -2297,25 +2159,24 @@ end:
        return source_element;
 }
 
-static
-int remove_tracer_event_source_from_pollset(
-               struct notification_thread_state *state,
-               struct notification_event_tracer_event_source_element *source_element)
+static int remove_tracer_event_source_from_pollset(
+       struct notification_thread_state *state,
+       struct notification_event_tracer_event_source_element *source_element)
 {
        int ret = 0;
 
        LTTNG_ASSERT(source_element->is_fd_in_poll_set);
 
        DBG3("Removing tracer event source from poll set: tracer_event_source_fd = %d, domain = '%s'",
-                       source_element->fd,
-                       lttng_domain_type_str(source_element->domain));
+            source_element->fd,
+            lttng_domain_type_str(source_element->domain));
 
        /* Removing the fd from the event poll set. */
        ret = lttng_poll_del(&state->events, source_element->fd);
        if (ret < 0) {
                ERR("Failed to remove tracer event source from poll set: tracer_event_source_fd = %d, domain = '%s'",
-                               source_element->fd,
-                               lttng_domain_type_str(source_element->domain));
+                   source_element->fd,
+                   lttng_domain_type_str(source_element->domain));
                ret = -1;
                goto end;
        }
@@ -2328,12 +2189,12 @@ int remove_tracer_event_source_from_pollset(
         */
        state->restart_poll = true;
 
-       ret = drain_event_notifier_notification_pipe(state, source_element->fd,
-                       source_element->domain);
+       ret = drain_event_notifier_notification_pipe(
+               state, source_element->fd, source_element->domain);
        if (ret) {
                ERR("Error draining event notifier notification: tracer_event_source_fd = %d, domain = %s",
-                               source_element->fd,
-                               lttng_domain_type_str(source_element->domain));
+                   source_element->fd,
+                   lttng_domain_type_str(source_element->domain));
                ret = -1;
                goto end;
        }
@@ -2342,15 +2203,13 @@ end:
        return ret;
 }
 
-int handle_notification_thread_tracer_event_source_died(
-               struct notification_thread_state *state,
-               int tracer_event_source_fd)
+int handle_notification_thread_tracer_event_source_died(struct notification_thread_state *state,
+                                                       int tracer_event_source_fd)
 {
        int ret = 0;
        struct notification_event_tracer_event_source_element *source_element;
 
-       source_element = find_tracer_event_source_element(state,
-                       tracer_event_source_fd);
+       source_element = find_tracer_event_source_element(state, tracer_event_source_fd);
 
        LTTNG_ASSERT(source_element);
 
@@ -2362,18 +2221,16 @@ int handle_notification_thread_tracer_event_source_died(
        return ret;
 }
 
-static
-int handle_notification_thread_command_remove_tracer_event_source(
-               struct notification_thread_state *state,
-               int tracer_event_source_fd,
-               enum lttng_error_code *_cmd_result)
+static int handle_notification_thread_command_remove_tracer_event_source(
+       struct notification_thread_state *state,
+       int tracer_event_source_fd,
+       enum lttng_error_code *_cmd_result)
 {
        int ret = 0;
        enum lttng_error_code cmd_result = LTTNG_OK;
        struct notification_event_tracer_event_source_element *source_element = NULL;
 
-       source_element = find_tracer_event_source_element(state,
-                       tracer_event_source_fd);
+       source_element = find_tracer_event_source_element(state, tracer_event_source_fd);
 
        LTTNG_ASSERT(source_element);
 
@@ -2397,12 +2254,13 @@ end:
        return ret;
 }
 
-static int handle_notification_thread_command_list_triggers(
-               struct notification_thread_handle *handle __attribute__((unused)),
-               struct notification_thread_state *state,
-               uid_t client_uid,
-               struct lttng_triggers **triggers,
-               enum lttng_error_code *_cmd_result)
+static int
+handle_notification_thread_command_list_triggers(struct notification_thread_handle *handle
+                                                __attribute__((unused)),
+                                                struct notification_thread_state *state,
+                                                uid_t client_uid,
+                                                struct lttng_triggers **triggers,
+                                                enum lttng_error_code *_cmd_result)
 {
        int ret = 0;
        enum lttng_error_code cmd_result = LTTNG_OK;
@@ -2420,8 +2278,7 @@ static int handle_notification_thread_command_list_triggers(
                goto end;
        }
 
-       cds_lfht_for_each_entry(state->triggers_ht, &iter,
-                       trigger_ht_element, node) {
+       cds_lfht_for_each_entry (state->triggers_ht, &iter, trigger_ht_element, node) {
                /*
                 * Only return the triggers to which the client has access.
                 * The root user has visibility over all triggers.
@@ -2431,8 +2288,7 @@ static int handle_notification_thread_command_list_triggers(
                        continue;
                }
 
-               ret = lttng_triggers_add(local_triggers,
-                               trigger_ht_element->trigger);
+               ret = lttng_triggers_add(local_triggers, trigger_ht_element->trigger);
                if (ret < 0) {
                        /* Not a fatal error. */
                        ret = 0;
@@ -2453,8 +2309,8 @@ end:
 }
 
 static inline void get_trigger_info_for_log(const struct lttng_trigger *trigger,
-               const char **trigger_name,
-               uid_t *trigger_owner_uid)
+                                           const char **trigger_name,
+                                           uid_t *trigger_owner_uid)
 {
        enum lttng_trigger_status trigger_status;
 
@@ -2469,16 +2325,14 @@ static inline void get_trigger_info_for_log(const struct lttng_trigger *trigger,
                abort();
        }
 
-       trigger_status = lttng_trigger_get_owner_uid(trigger,
-                       trigger_owner_uid);
+       trigger_status = lttng_trigger_get_owner_uid(trigger, trigger_owner_uid);
        LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 }
 
-static int handle_notification_thread_command_get_trigger(
-               struct notification_thread_state *state,
-               const struct lttng_trigger *trigger,
-               struct lttng_trigger **registered_trigger,
-               enum lttng_error_code *_cmd_result)
+static int handle_notification_thread_command_get_trigger(struct notification_thread_state *state,
+                                                         const struct lttng_trigger *trigger,
+                                                         struct lttng_trigger **registered_trigger,
+                                                         enum lttng_error_code *_cmd_result)
 {
        int ret = -1;
        struct cds_lfht_iter iter;
@@ -2489,10 +2343,8 @@ static int handle_notification_thread_command_get_trigger(
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(
-                       state->triggers_ht, &iter, trigger_ht_element, node) {
-               if (lttng_trigger_is_equal(
-                                   trigger, trigger_ht_element->trigger)) {
+       cds_lfht_for_each_entry (state->triggers_ht, &iter, trigger_ht_element, node) {
+               if (lttng_trigger_is_equal(trigger, trigger_ht_element->trigger)) {
                        /* Take one reference on the return trigger. */
                        *registered_trigger = trigger_ht_element->trigger;
                        lttng_trigger_get(*registered_trigger);
@@ -2505,7 +2357,8 @@ static int handle_notification_thread_command_get_trigger(
        /* Not a fatal error if the trigger is not found. */
        get_trigger_info_for_log(trigger, &trigger_name, &trigger_owner_uid);
        DBG("Failed to retrieve registered version of trigger: trigger name = '%s', trigger owner uid = %d",
-                       trigger_name, (int) trigger_owner_uid);
+           trigger_name,
+           (int) trigger_owner_uid);
 
        ret = 0;
 
@@ -2515,8 +2368,7 @@ end:
        return ret;
 }
 
-static
-bool condition_is_supported(struct lttng_condition *condition)
+static bool condition_is_supported(struct lttng_condition *condition)
 {
        bool is_supported;
 
@@ -2527,8 +2379,7 @@ bool condition_is_supported(struct lttng_condition *condition)
                int ret;
                enum lttng_domain_type domain;
 
-               ret = lttng_condition_buffer_usage_get_domain_type(condition,
-                               &domain);
+               ret = lttng_condition_buffer_usage_get_domain_type(condition, &domain);
                LTTNG_ASSERT(ret == 0);
 
                if (domain != LTTNG_DOMAIN_KERNEL) {
@@ -2551,8 +2402,7 @@ bool condition_is_supported(struct lttng_condition *condition)
                const struct lttng_event_rule *event_rule;
                enum lttng_domain_type domain;
                const enum lttng_condition_status status =
-                               lttng_condition_event_rule_matches_get_rule(
-                                               condition, &event_rule);
+                       lttng_condition_event_rule_matches_get_rule(condition, &event_rule);
 
                LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
 
@@ -2580,9 +2430,8 @@ end:
 }
 
 /* Must be called with RCU read lock held. */
-static
-int bind_trigger_to_matching_session(struct lttng_trigger *trigger,
-               struct notification_thread_state *state)
+static int bind_trigger_to_matching_session(struct lttng_trigger *trigger,
+                                           struct notification_thread_state *state)
 {
        int ret = 0;
        const struct lttng_condition *condition;
@@ -2597,22 +2446,19 @@ int bind_trigger_to_matching_session(struct lttng_trigger *trigger,
        trigger_list = get_session_trigger_list(state, session_name);
        if (!trigger_list) {
                DBG("Unable to bind trigger applying to session \"%s\" as it is not yet known to the notification system",
-                               session_name);
+                   session_name);
                goto end;
-
        }
 
-       DBG("Newly registered trigger bound to session \"%s\"",
-                       session_name);
+       DBG("Newly registered trigger bound to session \"%s\"", session_name);
        ret = lttng_session_trigger_list_add(trigger_list, trigger);
 end:
        return ret;
 }
 
 /* Must be called with RCU read lock held. */
-static
-int bind_trigger_to_matching_channels(struct lttng_trigger *trigger,
-               struct notification_thread_state *state)
+static int bind_trigger_to_matching_channels(struct lttng_trigger *trigger,
+                                            struct notification_thread_state *state)
 {
        int ret = 0;
        struct cds_lfht_node *node;
@@ -2621,8 +2467,7 @@ int bind_trigger_to_matching_channels(struct lttng_trigger *trigger,
 
        ASSERT_RCU_READ_LOCKED();
 
-       cds_lfht_for_each_entry(state->channels_ht, &iter, channel,
-                       channels_ht_node) {
+       cds_lfht_for_each_entry (state->channels_ht, &iter, channel, channels_ht_node) {
                struct lttng_trigger_list_element *trigger_list_element;
                struct lttng_channel_trigger_list *trigger_list;
                struct cds_lfht_iter lookup_iter;
@@ -2638,9 +2483,8 @@ int bind_trigger_to_matching_channels(struct lttng_trigger *trigger,
                                &lookup_iter);
                node = cds_lfht_iter_get_node(&lookup_iter);
                LTTNG_ASSERT(node);
-               trigger_list = caa_container_of(node,
-                               struct lttng_channel_trigger_list,
-                               channel_triggers_ht_node);
+               trigger_list = caa_container_of(
+                       node, struct lttng_channel_trigger_list, channel_triggers_ht_node);
 
                trigger_list_element = zmalloc<lttng_trigger_list_element>();
                if (!trigger_list_element) {
@@ -2650,21 +2494,18 @@ int bind_trigger_to_matching_channels(struct lttng_trigger *trigger,
                CDS_INIT_LIST_HEAD(&trigger_list_element->node);
                trigger_list_element->trigger = trigger;
                cds_list_add(&trigger_list_element->node, &trigger_list->list);
-               DBG("Newly registered trigger bound to channel \"%s\"",
-                               channel->name);
+               DBG("Newly registered trigger bound to channel \"%s\"", channel->name);
        }
 end:
        return ret;
 }
 
-static
-bool is_trigger_action_notify(const struct lttng_trigger *trigger)
+static bool is_trigger_action_notify(const struct lttng_trigger *trigger)
 {
        bool is_notify = false;
        unsigned int i, count;
        enum lttng_action_status action_status;
-       const struct lttng_action *action =
-                       lttng_trigger_get_const_action(trigger);
+       const struct lttng_action *action = lttng_trigger_get_const_action(trigger);
        enum lttng_action_type action_type;
 
        LTTNG_ASSERT(action);
@@ -2680,9 +2521,7 @@ bool is_trigger_action_notify(const struct lttng_trigger *trigger)
        LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
 
        for (i = 0; i < count; i++) {
-               const struct lttng_action *inner_action =
-                               lttng_action_list_get_at_index(
-                                               action, i);
+               const struct lttng_action *inner_action = lttng_action_list_get_at_index(action, i);
 
                action_type = lttng_action_get_type(inner_action);
                if (action_type == LTTNG_ACTION_TYPE_NOTIFY) {
@@ -2696,7 +2535,7 @@ end:
 }
 
 static bool trigger_name_taken(struct notification_thread_state *state,
-               const struct lttng_trigger *trigger)
+                              const struct lttng_trigger *trigger)
 {
        struct cds_lfht_iter iter;
 
@@ -2712,18 +2551,17 @@ static bool trigger_name_taken(struct notification_thread_state *state,
        return !!cds_lfht_iter_get_node(&iter);
 }
 
-static
-enum lttng_error_code generate_trigger_name(
-               struct notification_thread_state *state,
-               struct lttng_trigger *trigger, const char **name)
+static enum lttng_error_code generate_trigger_name(struct notification_thread_state *state,
+                                                  struct lttng_trigger *trigger,
+                                                  const char **name)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
        bool taken = false;
        enum lttng_trigger_status status;
 
        do {
-               const int ret = lttng_trigger_generate_name(trigger,
-                               state->trigger_id.name_offset++);
+               const int ret =
+                       lttng_trigger_generate_name(trigger, state->trigger_id.name_offset++);
                if (ret) {
                        /* The only reason this can fail right now. */
                        ret_code = LTTNG_ERR_NOMEM;
@@ -2739,10 +2577,9 @@ enum lttng_error_code generate_trigger_name(
        return ret_code;
 }
 
-static inline
-void notif_thread_state_remove_trigger_ht_elem(
-               struct notification_thread_state *state,
-               struct lttng_trigger_ht_element *trigger_ht_element)
+static inline void
+notif_thread_state_remove_trigger_ht_elem(struct notification_thread_state *state,
+                                         struct lttng_trigger_ht_element *trigger_ht_element)
 {
        LTTNG_ASSERT(state);
        LTTNG_ASSERT(trigger_ht_element);
@@ -2751,10 +2588,8 @@ void notif_thread_state_remove_trigger_ht_elem(
        cds_lfht_del(state->triggers_by_name_uid_ht, &trigger_ht_element->node_by_name_uid);
 }
 
-static
-enum lttng_error_code setup_tracer_notifier(
-               struct notification_thread_state *state,
-               struct lttng_trigger *trigger)
+static enum lttng_error_code setup_tracer_notifier(struct notification_thread_state *state,
+                                                  struct lttng_trigger *trigger)
 {
        enum lttng_error_code ret;
        enum event_notifier_error_accounting_status error_accounting_status;
@@ -2775,19 +2610,20 @@ enum lttng_error_code setup_tracer_notifier(
        trigger_tokens_ht_element->trigger = trigger;
 
        node = cds_lfht_add_unique(state->trigger_tokens_ht,
-                       hash_key_u64(&trigger_tokens_ht_element->token, lttng_ht_seed),
-                       match_trigger_token,
-                       &trigger_tokens_ht_element->token,
-                       &trigger_tokens_ht_element->node);
+                                  hash_key_u64(&trigger_tokens_ht_element->token, lttng_ht_seed),
+                                  match_trigger_token,
+                                  &trigger_tokens_ht_element->token,
+                                  &trigger_tokens_ht_element->node);
        if (node != &trigger_tokens_ht_element->node) {
                ret = LTTNG_ERR_TRIGGER_EXISTS;
                goto error_free_ht_element;
        }
 
        error_accounting_status = event_notifier_error_accounting_register_event_notifier(
-                       trigger, &error_counter_index);
+               trigger, &error_counter_index);
        if (error_accounting_status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
-               if (error_accounting_status == EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NO_INDEX_AVAILABLE) {
+               if (error_accounting_status ==
+                   EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NO_INDEX_AVAILABLE) {
                        DBG("Trigger list error accounting counter full.");
                        ret = LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING_FULL;
                } else {
@@ -2798,8 +2634,7 @@ enum lttng_error_code setup_tracer_notifier(
                goto error_remove_ht_element;
        }
 
-       lttng_condition_event_rule_matches_set_error_counter_index(
-                       condition, error_counter_index);
+       lttng_condition_event_rule_matches_set_error_counter_index(condition, error_counter_index);
 
        ret = LTTNG_OK;
        goto end;
@@ -2827,27 +2662,25 @@ end:
  * If a non-fatal error occurs, just set the cmd_result to the appropriate
  * error code.
  */
-static
-int handle_notification_thread_command_register_trigger(
-               struct notification_thread_state *state,
-               struct lttng_trigger *trigger,
-               bool is_trigger_anonymous,
-               enum lttng_error_code *cmd_result)
+static int
+handle_notification_thread_command_register_trigger(struct notification_thread_state *state,
+                                                   struct lttng_trigger *trigger,
+                                                   bool is_trigger_anonymous,
+                                                   enum lttng_error_code *cmd_result)
 {
        int ret = 0;
        struct lttng_condition *condition;
        struct notification_client_list *client_list = NULL;
        struct lttng_trigger_ht_element *trigger_ht_element = NULL;
        struct cds_lfht_node *node;
-       const chartrigger_name;
+       const char *trigger_name;
        bool free_trigger = true;
        struct lttng_evaluation *evaluation = NULL;
        struct lttng_credentials object_creds;
        uid_t object_uid;
        gid_t object_gid;
        enum action_executor_status executor_status;
-       const uint64_t trigger_tracer_token =
-                       state->trigger_id.next_tracer_token++;
+       const uint64_t trigger_tracer_token = state->trigger_id.next_tracer_token++;
 
        rcu_read_lock();
 
@@ -2855,11 +2688,9 @@ int handle_notification_thread_command_register_trigger(
        lttng_trigger_set_tracer_token(trigger, trigger_tracer_token);
 
        if (!is_trigger_anonymous) {
-               if (lttng_trigger_get_name(trigger, &trigger_name) ==
-                               LTTNG_TRIGGER_STATUS_UNSET) {
+               if (lttng_trigger_get_name(trigger, &trigger_name) == LTTNG_TRIGGER_STATUS_UNSET) {
                        const enum lttng_error_code ret_code =
-                                       generate_trigger_name(state, trigger,
-                                                       &trigger_name);
+                               generate_trigger_name(state, trigger, &trigger_name);
 
                        if (ret_code != LTTNG_OK) {
                                /* Fatal error. */
@@ -2898,10 +2729,10 @@ int handle_notification_thread_command_register_trigger(
        trigger_ht_element->trigger = trigger;
 
        node = cds_lfht_add_unique(state->triggers_ht,
-                       lttng_condition_hash(condition),
-                       match_trigger,
-                       trigger,
-                       &trigger_ht_element->node);
+                                  lttng_condition_hash(condition),
+                                  match_trigger,
+                                  trigger,
+                                  &trigger_ht_element->node);
        if (node != &trigger_ht_element->node) {
                /* Not a fatal error, simply report it to the client. */
                *cmd_result = LTTNG_ERR_TRIGGER_EXISTS;
@@ -2909,10 +2740,10 @@ int handle_notification_thread_command_register_trigger(
        }
 
        node = cds_lfht_add_unique(state->triggers_by_name_uid_ht,
-                       hash_trigger_by_name_uid(trigger),
-                       match_trigger_by_name_uid,
-                       trigger,
-                       &trigger_ht_element->node_by_name_uid);
+                                  hash_trigger_by_name_uid(trigger),
+                                  match_trigger_by_name_uid,
+                                  trigger,
+                                  &trigger_ht_element->node_by_name_uid);
        if (node != &trigger_ht_element->node_by_name_uid) {
                /* Internal error: add to triggers_ht should have failed. */
                ret = -1;
@@ -2931,8 +2762,7 @@ int handle_notification_thread_command_register_trigger(
 
                error_code = setup_tracer_notifier(state, trigger);
                if (error_code != LTTNG_OK) {
-                       notif_thread_state_remove_trigger_ht_elem(state,
-                                       trigger_ht_element);
+                       notif_thread_state_remove_trigger_ht_elem(state, trigger_ht_element);
                        if (error_code == LTTNG_ERR_NOMEM) {
                                ret = -1;
                        } else {
@@ -2963,7 +2793,8 @@ int handle_notification_thread_command_register_trigger(
                         */
                        client_list = notification_client_list_create(state, condition);
                        if (!client_list) {
-                               ERR("Error creating notification client list for trigger %s", trigger->name);
+                               ERR("Error creating notification client list for trigger %s",
+                                   trigger->name);
                                ret = -1;
                                goto error_free_ht_element;
                        }
@@ -2972,7 +2803,8 @@ int handle_notification_thread_command_register_trigger(
                CDS_INIT_LIST_HEAD(&trigger_ht_element->client_list_trigger_node);
 
                pthread_mutex_lock(&client_list->lock);
-               cds_list_add(&trigger_ht_element->client_list_trigger_node, &client_list->triggers_list);
+               cds_list_add(&trigger_ht_element->client_list_trigger_node,
+                            &client_list->triggers_list);
                pthread_mutex_unlock(&client_list->lock);
        }
 
@@ -3047,7 +2879,7 @@ int handle_notification_thread_command_register_trigger(
                if (!session_info) {
                        /* Not an error, the session doesn't exist yet. */
                        DBG("Session not found while evaluating session condition during registration of trigger: session name = `%s`",
-                                       session_name);
+                           session_name);
                        ret = 0;
                        goto success;
                }
@@ -3060,9 +2892,8 @@ int handle_notification_thread_command_register_trigger(
                break;
        }
        case LTTNG_OBJECT_TYPE_CHANNEL:
-               ret = evaluate_channel_condition_for_client(condition, state,
-                               &evaluation, &object_uid,
-                               &object_gid);
+               ret = evaluate_channel_condition_for_client(
+                       condition, state, &evaluation, &object_uid, &object_gid);
                LTTNG_OPTIONAL_SET(&object_creds.uid, object_uid);
                LTTNG_OPTIONAL_SET(&object_creds.gid, object_gid);
                break;
@@ -3080,8 +2911,7 @@ int handle_notification_thread_command_register_trigger(
                goto error_free_ht_element;
        }
 
-       DBG("Newly registered trigger's condition evaluated to %s",
-                       evaluation ? "true" : "false");
+       DBG("Newly registered trigger's condition evaluated to %s", evaluation ? "true" : "false");
        if (!evaluation) {
                /* Evaluation yielded nothing. Normal exit. */
                ret = 0;
@@ -3092,8 +2922,8 @@ int handle_notification_thread_command_register_trigger(
         * Ownership of `evaluation` transferred to the action executor
         * no matter the result.
         */
-       executor_status = action_executor_enqueue_trigger(state->executor,
-                       trigger, evaluation, &object_creds, client_list);
+       executor_status = action_executor_enqueue_trigger(
+               state->executor, trigger, evaluation, &object_creds, client_list);
        evaluation = NULL;
        switch (executor_status) {
        case ACTION_EXECUTOR_STATUS_OK:
@@ -3124,14 +2954,14 @@ int handle_notification_thread_command_register_trigger(
 success:
        *cmd_result = LTTNG_OK;
        DBG("Registered trigger: name = `%s`, tracer token = %" PRIu64,
-                       trigger_name, trigger_tracer_token);
+           trigger_name,
+           trigger_tracer_token);
        goto end;
 
 error_free_ht_element:
        if (trigger_ht_element) {
                /* Delayed removal due to RCU constraint on delete. */
-               call_rcu(&trigger_ht_element->rcu_node,
-                               free_lttng_trigger_ht_element_rcu);
+               call_rcu(&trigger_ht_element->rcu_node, free_lttng_trigger_ht_element_rcu);
        }
 error:
        if (free_trigger) {
@@ -3147,54 +2977,44 @@ end:
        return ret;
 }
 
-static
-void free_lttng_trigger_ht_element_rcu(struct rcu_head *node)
+static void free_lttng_trigger_ht_element_rcu(struct rcu_head *node)
 {
-       free(caa_container_of(node, struct lttng_trigger_ht_element,
-                       rcu_node));
+       free(caa_container_of(node, struct lttng_trigger_ht_element, rcu_node));
 }
 
-static
-void free_notification_trigger_tokens_ht_element_rcu(struct rcu_head *node)
+static void free_notification_trigger_tokens_ht_element_rcu(struct rcu_head *node)
 {
-       free(caa_container_of(node, struct notification_trigger_tokens_ht_element,
-                       rcu_node));
+       free(caa_container_of(node, struct notification_trigger_tokens_ht_element, rcu_node));
 }
 
-static
-void teardown_tracer_notifier(struct notification_thread_state *state,
-               const struct lttng_trigger *trigger)
+static void teardown_tracer_notifier(struct notification_thread_state *state,
+                                    const struct lttng_trigger *trigger)
 {
        struct cds_lfht_iter iter;
        struct notification_trigger_tokens_ht_element *trigger_tokens_ht_element;
 
-       cds_lfht_for_each_entry(state->trigger_tokens_ht, &iter,
-                       trigger_tokens_ht_element, node) {
-
-               if (!lttng_trigger_is_equal(trigger,
-                                       trigger_tokens_ht_element->trigger)) {
+       cds_lfht_for_each_entry (state->trigger_tokens_ht, &iter, trigger_tokens_ht_element, node) {
+               if (!lttng_trigger_is_equal(trigger, trigger_tokens_ht_element->trigger)) {
                        continue;
                }
 
                event_notifier_error_accounting_unregister_event_notifier(
-                               trigger_tokens_ht_element->trigger);
+                       trigger_tokens_ht_element->trigger);
 
                /* TODO talk to all app and remove it */
                DBG("Removed trigger from tokens_ht");
-               cds_lfht_del(state->trigger_tokens_ht,
-                               &trigger_tokens_ht_element->node);
+               cds_lfht_del(state->trigger_tokens_ht, &trigger_tokens_ht_element->node);
 
                call_rcu(&trigger_tokens_ht_element->rcu_node,
-                               free_notification_trigger_tokens_ht_element_rcu);
+                        free_notification_trigger_tokens_ht_element_rcu);
 
                break;
        }
 }
 
-static
-void remove_trigger_from_session_trigger_list(
-       struct lttng_session_trigger_list *trigger_list,
-       const struct lttng_trigger *trigger)
+static void
+remove_trigger_from_session_trigger_list(struct lttng_session_trigger_list *trigger_list,
+                                        const struct lttng_trigger *trigger)
 {
        bool found = false;
        struct lttng_trigger_list_element *trigger_element, *tmp;
@@ -3214,33 +3034,28 @@ void remove_trigger_from_session_trigger_list(
 
        if (!found) {
                ERR("Failed to find trigger associated with session: session name = `%s`",
-                               trigger_list->session_name);
+                   trigger_list->session_name);
        }
 
        LTTNG_ASSERT(found);
 }
 
-static
-int handle_notification_thread_command_unregister_trigger(
-               struct notification_thread_state *state,
-               const struct lttng_trigger *trigger,
-               enum lttng_error_code *_cmd_reply)
+static int
+handle_notification_thread_command_unregister_trigger(struct notification_thread_state *state,
+                                                     const struct lttng_trigger *trigger,
+                                                     enum lttng_error_code *_cmd_reply)
 {
        struct cds_lfht_iter iter;
        struct cds_lfht_node *triggers_ht_node;
        struct notification_client_list *client_list;
        struct lttng_trigger_ht_element *trigger_ht_element = NULL;
-       const struct lttng_condition *condition = lttng_trigger_get_const_condition(
-                       trigger);
+       const struct lttng_condition *condition = lttng_trigger_get_const_condition(trigger);
        enum lttng_error_code cmd_reply;
 
        rcu_read_lock();
 
-       cds_lfht_lookup(state->triggers_ht,
-                       lttng_condition_hash(condition),
-                       match_trigger,
-                       trigger,
-                       &iter);
+       cds_lfht_lookup(
+               state->triggers_ht, lttng_condition_hash(condition), match_trigger, trigger, &iter);
        triggers_ht_node = cds_lfht_iter_get_node(&iter);
        if (!triggers_ht_node) {
                cmd_reply = LTTNG_ERR_TRIGGER_NOT_FOUND;
@@ -3249,8 +3064,8 @@ int handle_notification_thread_command_unregister_trigger(
                cmd_reply = LTTNG_OK;
        }
 
-       trigger_ht_element = caa_container_of(triggers_ht_node,
-                       struct lttng_trigger_ht_element, node);
+       trigger_ht_element =
+               caa_container_of(triggers_ht_node, struct lttng_trigger_ht_element, node);
 
        switch (get_condition_binding_object(condition)) {
        case LTTNG_OBJECT_TYPE_CHANNEL:
@@ -3266,12 +3081,12 @@ int handle_notification_thread_command_unregister_trigger(
                 *
                 * Iterate on all lists since we don't know the target channels' keys.
                 */
-               cds_lfht_for_each_entry(state->channel_triggers_ht, &iter, trigger_list,
-                               channel_triggers_ht_node) {
+               cds_lfht_for_each_entry (
+                       state->channel_triggers_ht, &iter, trigger_list, channel_triggers_ht_node) {
                        struct lttng_trigger_list_element *trigger_element, *tmp;
 
-                       cds_list_for_each_entry_safe(
-                                       trigger_element, tmp, &trigger_list->list, node) {
+                       cds_list_for_each_entry_safe (
+                               trigger_element, tmp, &trigger_list->list, node) {
                                if (!lttng_trigger_is_equal(trigger, trigger_element->trigger)) {
                                        continue;
                                }
@@ -3287,8 +3102,8 @@ int handle_notification_thread_command_unregister_trigger(
        }
        case LTTNG_OBJECT_TYPE_SESSION:
        {
-               auto session = get_session_info_by_name(
-                               state, get_condition_session_name(condition));
+               auto session =
+                       get_session_info_by_name(state, get_condition_session_name(condition));
 
                /* Session doesn't exist, no trigger to remove. */
                if (!session) {
@@ -3341,9 +3156,8 @@ end:
        return 0;
 }
 
-static
-int pop_cmd_queue(struct notification_thread_handle *handle,
-               struct notification_thread_command **cmd)
+static int pop_cmd_queue(struct notification_thread_handle *handle,
+                        struct notification_thread_command **cmd)
 {
        int ret;
        uint64_t counter;
@@ -3355,8 +3169,8 @@ int pop_cmd_queue(struct notification_thread_handle *handle,
                goto error_unlock;
        }
 
-       *cmd = cds_list_first_entry(&handle->cmd_queue.list,
-                       struct notification_thread_command, cmd_list_node);
+       *cmd = cds_list_first_entry(
+               &handle->cmd_queue.list, struct notification_thread_command, cmd_list_node);
        cds_list_del(&((*cmd)->cmd_list_node));
        ret = 0;
 
@@ -3366,9 +3180,8 @@ error_unlock:
 }
 
 /* Returns 0 on success, 1 on exit requested, negative value on error. */
-int handle_notification_thread_command(
-               struct notification_thread_handle *handle,
-               struct notification_thread_state *state)
+int handle_notification_thread_command(struct notification_thread_handle *handle,
+                                      struct notification_thread_state *state)
 {
        int ret;
        struct notification_thread_command *cmd;
@@ -3378,81 +3191,82 @@ int handle_notification_thread_command(
                goto error;
        }
 
-       DBG("Received `%s` command",
-                       notification_command_type_str(cmd->type));
+       DBG("Received `%s` command", notification_command_type_str(cmd->type));
        switch (cmd->type) {
        case NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER:
-               ret = handle_notification_thread_command_register_trigger(state,
-                               cmd->parameters.register_trigger.trigger,
-                               cmd->parameters.register_trigger.is_trigger_anonymous,
-                               &cmd->reply_code);
+               ret = handle_notification_thread_command_register_trigger(
+                       state,
+                       cmd->parameters.register_trigger.trigger,
+                       cmd->parameters.register_trigger.is_trigger_anonymous,
+                       &cmd->reply_code);
                break;
        case NOTIFICATION_COMMAND_TYPE_UNREGISTER_TRIGGER:
                ret = handle_notification_thread_command_unregister_trigger(
-                               state,
-                               cmd->parameters.unregister_trigger.trigger,
-                               &cmd->reply_code);
+                       state, cmd->parameters.unregister_trigger.trigger, &cmd->reply_code);
                break;
        case NOTIFICATION_COMMAND_TYPE_ADD_CHANNEL:
                ret = handle_notification_thread_command_add_channel(
-                               state,
-                               cmd->parameters.add_channel.session.id,
-                               cmd->parameters.add_channel.channel.name,
-                               cmd->parameters.add_channel.channel.domain,
-                               cmd->parameters.add_channel.channel.key,
-                               cmd->parameters.add_channel.channel.capacity,
-                               &cmd->reply_code);
+                       state,
+                       cmd->parameters.add_channel.session.id,
+                       cmd->parameters.add_channel.channel.name,
+                       cmd->parameters.add_channel.channel.domain,
+                       cmd->parameters.add_channel.channel.key,
+                       cmd->parameters.add_channel.channel.capacity,
+                       &cmd->reply_code);
                break;
        case NOTIFICATION_COMMAND_TYPE_REMOVE_CHANNEL:
                ret = handle_notification_thread_command_remove_channel(
-                               state, cmd->parameters.remove_channel.key,
-                               cmd->parameters.remove_channel.domain,
-                               &cmd->reply_code);
+                       state,
+                       cmd->parameters.remove_channel.key,
+                       cmd->parameters.remove_channel.domain,
+                       &cmd->reply_code);
                break;
        case NOTIFICATION_COMMAND_TYPE_ADD_SESSION:
-               ret = handle_notification_thread_command_add_session(state,
-                               cmd->parameters.add_session.session_id,
-                               cmd->parameters.add_session.session_name,
-                               cmd->parameters.add_session.session_uid,
-                               cmd->parameters.add_session.session_gid, &cmd->reply_code);
+               ret = handle_notification_thread_command_add_session(
+                       state,
+                       cmd->parameters.add_session.session_id,
+                       cmd->parameters.add_session.session_name,
+                       cmd->parameters.add_session.session_uid,
+                       cmd->parameters.add_session.session_gid,
+                       &cmd->reply_code);
                break;
        case NOTIFICATION_COMMAND_TYPE_REMOVE_SESSION:
                ret = handle_notification_thread_command_remove_session(
-                               state, cmd->parameters.remove_session.session_id, &cmd->reply_code);
+                       state, cmd->parameters.remove_session.session_id, &cmd->reply_code);
                break;
        case NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_ONGOING:
        case NOTIFICATION_COMMAND_TYPE_SESSION_ROTATION_COMPLETED:
                ret = handle_notification_thread_command_session_rotation(
-                               state,
-                               cmd->type,
-                               cmd->parameters.session_rotation.session_id,
-                               cmd->parameters.session_rotation.trace_archive_chunk_id,
-                               cmd->parameters.session_rotation.location,
-                               &cmd->reply_code);
+                       state,
+                       cmd->type,
+                       cmd->parameters.session_rotation.session_id,
+                       cmd->parameters.session_rotation.trace_archive_chunk_id,
+                       cmd->parameters.session_rotation.location,
+                       &cmd->reply_code);
                break;
        case NOTIFICATION_COMMAND_TYPE_ADD_TRACER_EVENT_SOURCE:
                ret = handle_notification_thread_command_add_tracer_event_source(
-                               state,
-                               cmd->parameters.tracer_event_source.tracer_event_source_fd,
-                               cmd->parameters.tracer_event_source.domain,
-                               &cmd->reply_code);
+                       state,
+                       cmd->parameters.tracer_event_source.tracer_event_source_fd,
+                       cmd->parameters.tracer_event_source.domain,
+                       &cmd->reply_code);
                break;
        case NOTIFICATION_COMMAND_TYPE_REMOVE_TRACER_EVENT_SOURCE:
                ret = handle_notification_thread_command_remove_tracer_event_source(
-                               state,
-                               cmd->parameters.tracer_event_source.tracer_event_source_fd,
-                               &cmd->reply_code);
+                       state,
+                       cmd->parameters.tracer_event_source.tracer_event_source_fd,
+                       &cmd->reply_code);
                break;
        case NOTIFICATION_COMMAND_TYPE_LIST_TRIGGERS:
        {
                struct lttng_triggers *triggers = NULL;
 
                ret = handle_notification_thread_command_list_triggers(
-                               handle,
-                               state,
-                               cmd->parameters.list_triggers.uid,
-                               &triggers,
-                               &cmd->reply_code);
+                       handle,
+                       state,
+                       cmd->parameters.list_triggers.uid,
+                       &triggers,
+                       &cmd->reply_code);
                cmd->reply.list_triggers.triggers = triggers;
                ret = 0;
                break;
@@ -3465,19 +3279,17 @@ int handle_notification_thread_command(
        {
                struct lttng_trigger *trigger = NULL;
 
-               ret = handle_notification_thread_command_get_trigger(state,
-                               cmd->parameters.get_trigger.trigger, &trigger,
-                               &cmd->reply_code);
+               ret = handle_notification_thread_command_get_trigger(
+                       state, cmd->parameters.get_trigger.trigger, &trigger, &cmd->reply_code);
                cmd->reply.get_trigger.trigger = trigger;
                break;
        }
        case NOTIFICATION_COMMAND_TYPE_CLIENT_COMMUNICATION_UPDATE:
        {
                const enum client_transmission_status client_status =
-                               cmd->parameters.client_communication_update
-                                               .status;
+                       cmd->parameters.client_communication_update.status;
                const notification_client_id client_id =
-                               cmd->parameters.client_communication_update.id;
+                       cmd->parameters.client_communication_update.id;
                struct notification_client *client;
 
                rcu_read_lock();
@@ -3490,11 +3302,10 @@ int handle_notification_thread_command(
                         * gracefully while this command was queued.
                         */
                        DBG("Failed to find notification client to update communication status, client id = %" PRIu64,
-                                       client_id);
+                           client_id);
                        ret = 0;
                } else {
-                       ret = client_handle_transmission_status(
-                                       client, client_status, state);
+                       ret = client_handle_transmission_status(client, client_status, state);
                }
                rcu_read_unlock();
                break;
@@ -3524,8 +3335,7 @@ error:
        return -1;
 }
 
-static
-int socket_set_non_blocking(int socket)
+static int socket_set_non_blocking(int socket)
 {
        int ret, flags;
 
@@ -3547,29 +3357,24 @@ end:
        return ret;
 }
 
-static
-int client_reset_inbound_state(struct notification_client *client)
+static int client_reset_inbound_state(struct notification_client *client)
 {
        int ret;
 
-
        lttng_payload_clear(&client->communication.inbound.payload);
 
        client->communication.inbound.bytes_to_receive =
-                       sizeof(struct lttng_notification_channel_message);
-       client->communication.inbound.msg_type =
-                       LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNKNOWN;
+               sizeof(struct lttng_notification_channel_message);
+       client->communication.inbound.msg_type = LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNKNOWN;
        LTTNG_SOCK_SET_UID_CRED(&client->communication.inbound.creds, -1);
        LTTNG_SOCK_SET_GID_CRED(&client->communication.inbound.creds, -1);
-       ret = lttng_dynamic_buffer_set_size(
-                       &client->communication.inbound.payload.buffer,
-                       client->communication.inbound.bytes_to_receive);
+       ret = lttng_dynamic_buffer_set_size(&client->communication.inbound.payload.buffer,
+                                           client->communication.inbound.bytes_to_receive);
 
        return ret;
 }
 
-int handle_notification_thread_client_connect(
-               struct notification_thread_state *state)
+int handle_notification_thread_client_connect(struct notification_thread_state *state)
 {
        int ret;
        struct notification_client *client;
@@ -3620,23 +3425,20 @@ int handle_notification_thread_client_connect(
        }
 
        client->communication.current_poll_events = CLIENT_POLL_EVENTS_IN;
-       ret = lttng_poll_add(&state->events, client->socket,
-                       client->communication.current_poll_events);
+       ret = lttng_poll_add(
+               &state->events, client->socket, client->communication.current_poll_events);
        if (ret < 0) {
                ERR("Failed to add notification channel client socket to poll set");
                ret = 0;
                goto error;
        }
-       DBG("Added new notification channel client socket (%i) to poll set",
-                       client->socket);
+       DBG("Added new notification channel client socket (%i) to poll set", client->socket);
 
        rcu_read_lock();
        cds_lfht_add(state->client_socket_ht,
-                       hash_client_socket(client->socket),
-                       &client->client_socket_ht_node);
-       cds_lfht_add(state->client_id_ht,
-                       hash_client_id(client->id),
-                       &client->client_id_ht_node);
+                    hash_client_socket(client->socket),
+                    &client->client_socket_ht_node);
+       cds_lfht_add(state->client_id_ht, hash_client_id(client->id), &client->client_id_ht_node);
        rcu_read_unlock();
 
        return ret;
@@ -3650,10 +3452,8 @@ error:
  * RCU read-lock must be held by the caller.
  * Client lock must _not_ be held by the caller.
  */
-static
-int notification_thread_client_disconnect(
-               struct notification_client *client,
-               struct notification_thread_state *state)
+static int notification_thread_client_disconnect(struct notification_client *client,
+                                                struct notification_thread_state *state)
 {
        int ret;
        struct lttng_condition_list_element *condition_list_element, *tmp;
@@ -3669,15 +3469,13 @@ int notification_thread_client_disconnect(
 
        ret = lttng_poll_del(&state->events, client->socket);
        if (ret) {
-               ERR("Failed to remove client socket %d from poll set",
-                               client->socket);
+               ERR("Failed to remove client socket %d from poll set", client->socket);
        }
 
        /* Release all conditions to which the client was subscribed. */
-       cds_list_for_each_entry_safe(condition_list_element, tmp,
-                       &client->condition_list, node) {
-               (void) notification_thread_client_unsubscribe(client,
-                               condition_list_element->condition, state, NULL);
+       cds_list_for_each_entry_safe (condition_list_element, tmp, &client->condition_list, node) {
+               (void) notification_thread_client_unsubscribe(
+                       client, condition_list_element->condition, state, NULL);
        }
 
        /*
@@ -3688,20 +3486,18 @@ int notification_thread_client_disconnect(
        return ret;
 }
 
-int handle_notification_thread_client_disconnect(
-               int client_socket, struct notification_thread_state *state)
+int handle_notification_thread_client_disconnect(int client_socket,
+                                                struct notification_thread_state *state)
 {
        int ret = 0;
        struct notification_client *client;
 
        rcu_read_lock();
-       DBG("Closing client connection (socket fd = %i)",
-                       client_socket);
+       DBG("Closing client connection (socket fd = %i)", client_socket);
        client = get_client_from_socket(client_socket, state);
        if (!client) {
                /* Internal state corruption, fatal error. */
-               ERR("Unable to find client (socket fd = %i)",
-                               client_socket);
+               ERR("Unable to find client (socket fd = %i)", client_socket);
                ret = -1;
                goto end;
        }
@@ -3712,8 +3508,7 @@ end:
        return ret;
 }
 
-int handle_notification_thread_client_disconnect_all(
-               struct notification_thread_state *state)
+int handle_notification_thread_client_disconnect_all(struct notification_thread_state *state)
 {
        struct cds_lfht_iter iter;
        struct notification_client *client;
@@ -3721,12 +3516,10 @@ int handle_notification_thread_client_disconnect_all(
 
        rcu_read_lock();
        DBG("Closing all client connections");
-       cds_lfht_for_each_entry(state->client_socket_ht, &iter, client,
-                       client_socket_ht_node) {
+       cds_lfht_for_each_entry (state->client_socket_ht, &iter, client, client_socket_ht_node) {
                int ret;
 
-               ret = notification_thread_client_disconnect(
-                               client, state);
+               ret = notification_thread_client_disconnect(client, state);
                if (ret) {
                        error_encoutered = true;
                }
@@ -3735,18 +3528,16 @@ int handle_notification_thread_client_disconnect_all(
        return error_encoutered ? 1 : 0;
 }
 
-int handle_notification_thread_trigger_unregister_all(
-               struct notification_thread_state *state)
+int handle_notification_thread_trigger_unregister_all(struct notification_thread_state *state)
 {
        bool error_occurred = false;
        struct cds_lfht_iter iter;
        struct lttng_trigger_ht_element *trigger_ht_element;
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(state->triggers_ht, &iter, trigger_ht_element,
-                       node) {
+       cds_lfht_for_each_entry (state->triggers_ht, &iter, trigger_ht_element, node) {
                int ret = handle_notification_thread_command_unregister_trigger(
-                               state, trigger_ht_element->trigger, NULL);
+                       state, trigger_ht_element->trigger, NULL);
                if (ret) {
                        error_occurred = true;
                }
@@ -3755,23 +3546,19 @@ int handle_notification_thread_trigger_unregister_all(
        return error_occurred ? -1 : 0;
 }
 
-static
-bool client_has_outbound_data_left(
-               const struct notification_client *client)
+static bool client_has_outbound_data_left(const struct notification_client *client)
 {
-       const struct lttng_payload_view pv = lttng_payload_view_from_payload(
-                       &client->communication.outbound.payload, 0, -1);
+       const struct lttng_payload_view pv =
+               lttng_payload_view_from_payload(&client->communication.outbound.payload, 0, -1);
        const bool has_data = pv.buffer.size != 0;
        const bool has_fds = lttng_payload_view_get_fd_handle_count(&pv);
 
        return has_data || has_fds;
 }
 
-static
-int client_handle_transmission_status(
-               struct notification_client *client,
-               enum client_transmission_status transmission_status,
-               struct notification_thread_state *state)
+static int client_handle_transmission_status(struct notification_client *client,
+                                            enum client_transmission_status transmission_status,
+                                            struct notification_thread_state *state)
 {
        int ret = 0;
 
@@ -3806,15 +3593,14 @@ int client_handle_transmission_status(
                pthread_mutex_lock(&client->lock);
                current_poll_events = client->communication.current_poll_events;
                new_poll_events = client_has_outbound_data_left(client) ?
-                               CLIENT_POLL_EVENTS_IN_OUT :
-                                     CLIENT_POLL_EVENTS_IN;
+                       CLIENT_POLL_EVENTS_IN_OUT :
+                       CLIENT_POLL_EVENTS_IN;
                client->communication.current_poll_events = new_poll_events;
                pthread_mutex_unlock(&client->lock);
 
                /* Update the monitored event set only if it changed. */
                if (current_poll_events != new_poll_events) {
-                       ret = lttng_poll_mod(&state->events, client->socket,
-                                       new_poll_events);
+                       ret = lttng_poll_mod(&state->events, client->socket, new_poll_events);
                        if (ret) {
                                goto end;
                        }
@@ -3839,17 +3625,15 @@ end:
 }
 
 /* Client lock must be acquired by caller. */
-static
-enum client_transmission_status client_flush_outgoing_queue(
-               struct notification_client *client)
+static enum client_transmission_status
+client_flush_outgoing_queue(struct notification_client *client)
 {
        ssize_t ret;
        size_t to_send_count;
        enum client_transmission_status status;
-       struct lttng_payload_view pv = lttng_payload_view_from_payload(
-                       &client->communication.outbound.payload, 0, -1);
-       const int fds_to_send_count =
-                       lttng_payload_view_get_fd_handle_count(&pv);
+       struct lttng_payload_view pv =
+               lttng_payload_view_from_payload(&client->communication.outbound.payload, 0, -1);
+       const int fds_to_send_count = lttng_payload_view_get_fd_handle_count(&pv);
 
        ASSERT_LOCKED(client->lock);
 
@@ -3869,24 +3653,19 @@ enum client_transmission_status client_flush_outgoing_queue(
 
        /* Send data. */
        to_send_count = pv.buffer.size;
-       DBG("Flushing client (socket fd = %i) outgoing queue",
-                       client->socket);
+       DBG("Flushing client (socket fd = %i) outgoing queue", client->socket);
 
-       ret = lttcomm_send_unix_sock_non_block(client->socket,
-                       pv.buffer.data,
-                       to_send_count);
+       ret = lttcomm_send_unix_sock_non_block(client->socket, pv.buffer.data, to_send_count);
        if ((ret >= 0 && ret < to_send_count)) {
                DBG("Client (socket fd = %i) outgoing queue could not be completely flushed",
-                               client->socket);
+                   client->socket);
                to_send_count -= std::max(ret, (ssize_t) 0);
 
                memmove(client->communication.outbound.payload.buffer.data,
-                               pv.buffer.data +
-                               pv.buffer.size - to_send_count,
-                               to_send_count);
-               ret = lttng_dynamic_buffer_set_size(
-                               &client->communication.outbound.payload.buffer,
-                               to_send_count);
+                       pv.buffer.data + pv.buffer.size - to_send_count,
+                       to_send_count);
+               ret = lttng_dynamic_buffer_set_size(&client->communication.outbound.payload.buffer,
+                                                   to_send_count);
                if (ret) {
                        goto error;
                }
@@ -3896,7 +3675,7 @@ enum client_transmission_status client_flush_outgoing_queue(
        } else if (ret < 0) {
                /* Generic error, disable the client's communication. */
                ERR("Failed to flush outgoing queue, disconnecting client (socket fd = %i)",
-                               client->socket);
+                   client->socket);
                client->communication.active = false;
                status = CLIENT_TRANSMISSION_STATUS_FAIL;
                goto end;
@@ -3909,8 +3688,8 @@ enum client_transmission_status client_flush_outgoing_queue(
                 * direct caller knows that the transmission is complete, we
                 * need to set the buffer size to zero.
                 */
-               ret = lttng_dynamic_buffer_set_size(
-                               &client->communication.outbound.payload.buffer, 0);
+               ret = lttng_dynamic_buffer_set_size(&client->communication.outbound.payload.buffer,
+                                                   0);
                if (ret) {
                        goto error;
                }
@@ -3923,12 +3702,11 @@ send_fds:
                goto end;
        }
 
-       ret = lttcomm_send_payload_view_fds_unix_sock_non_block(
-                       client->socket, &pv);
+       ret = lttcomm_send_payload_view_fds_unix_sock_non_block(client->socket, &pv);
        if (ret < 0) {
                /* Generic error, disable the client's communication. */
                ERR("Failed to flush outgoing fds queue, disconnecting client (socket fd = %i)",
-                               client->socket);
+                   client->socket);
                client->communication.active = false;
                status = CLIENT_TRANSMISSION_STATUS_FAIL;
                goto end;
@@ -3945,8 +3723,7 @@ send_fds:
                 * need to clear the _fd_array for the queuing check.
                 */
                lttng_dynamic_pointer_array_clear(
-                               &client->communication.outbound.payload
-                                                ._fd_handles);
+                       &client->communication.outbound.payload._fd_handles);
        }
 
 end:
@@ -3962,10 +3739,9 @@ error:
 }
 
 /* Client lock must _not_ be held by the caller. */
-static
-int client_send_command_reply(struct notification_client *client,
-               struct notification_thread_state *state,
-               enum lttng_notification_channel_status status)
+static int client_send_command_reply(struct notification_client *client,
+                                    struct notification_thread_state *state,
+                                    enum lttng_notification_channel_status status)
 {
        int ret;
        struct lttng_notification_channel_command_reply reply = {
@@ -3991,8 +3767,7 @@ int client_send_command_reply(struct notification_client *client,
 
        /* Enqueue buffer to outgoing queue and flush it. */
        ret = lttng_dynamic_buffer_append(
-                       &client->communication.outbound.payload.buffer,
-                       buffer, sizeof(buffer));
+               &client->communication.outbound.payload.buffer, buffer, sizeof(buffer));
        if (ret) {
                goto error_unlock;
        }
@@ -4005,8 +3780,7 @@ int client_send_command_reply(struct notification_client *client,
        }
 
        pthread_mutex_unlock(&client->lock);
-       ret = client_handle_transmission_status(
-                       client, transmission_status, state);
+       ret = client_handle_transmission_status(client, transmission_status, state);
        if (ret) {
                goto error;
        }
@@ -4018,9 +3792,9 @@ error:
        return -1;
 }
 
-static
-int client_handle_message_unknown(struct notification_client *client,
-               struct notification_thread_state *state __attribute__((unused)))
+static int client_handle_message_unknown(struct notification_client *client,
+                                        struct notification_thread_state *state
+                                        __attribute__((unused)))
 {
        int ret;
        /*
@@ -4032,12 +3806,10 @@ int client_handle_message_unknown(struct notification_client *client,
 
        LTTNG_ASSERT(sizeof(*msg) == client->communication.inbound.payload.buffer.size);
        msg = (const struct lttng_notification_channel_message *)
-                             client->communication.inbound.payload.buffer.data;
+                     client->communication.inbound.payload.buffer.data;
 
-       if (msg->size == 0 ||
-                       msg->size > DEFAULT_MAX_NOTIFICATION_CLIENT_MESSAGE_PAYLOAD_SIZE) {
-               ERR("Invalid notification channel message: length = %u",
-                               msg->size);
+       if (msg->size == 0 || msg->size > DEFAULT_MAX_NOTIFICATION_CLIENT_MESSAGE_PAYLOAD_SIZE) {
+               ERR("Invalid notification channel message: length = %u", msg->size);
                ret = -1;
                goto end;
        }
@@ -4056,9 +3828,9 @@ int client_handle_message_unknown(struct notification_client *client,
        client->communication.inbound.bytes_to_receive = msg->size;
        client->communication.inbound.fds_to_receive = msg->fds;
        client->communication.inbound.msg_type =
-                       (enum lttng_notification_channel_message_type) msg->type;
-       ret = lttng_dynamic_buffer_set_size(
-                       &client->communication.inbound.payload.buffer, msg->size);
+               (enum lttng_notification_channel_message_type) msg->type;
+       ret = lttng_dynamic_buffer_set_size(&client->communication.inbound.payload.buffer,
+                                           msg->size);
 
        /* msg is not valid anymore due to lttng_dynamic_buffer_set_size. */
        msg = NULL;
@@ -4066,19 +3838,17 @@ end:
        return ret;
 }
 
-static
-int client_handle_message_handshake(struct notification_client *client,
-               struct notification_thread_state *state)
+static int client_handle_message_handshake(struct notification_client *client,
+                                          struct notification_thread_state *state)
 {
        int ret;
        struct lttng_notification_channel_command_handshake *handshake_client;
        const struct lttng_notification_channel_command_handshake handshake_reply = {
-                       .major = LTTNG_NOTIFICATION_CHANNEL_VERSION_MAJOR,
-                       .minor = LTTNG_NOTIFICATION_CHANNEL_VERSION_MINOR,
+               .major = LTTNG_NOTIFICATION_CHANNEL_VERSION_MAJOR,
+               .minor = LTTNG_NOTIFICATION_CHANNEL_VERSION_MINOR,
        };
        struct lttng_notification_channel_message msg_header;
-       enum lttng_notification_channel_status status =
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
+       enum lttng_notification_channel_status status = LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
        char send_buffer[sizeof(msg_header) + sizeof(handshake_reply)];
 
        msg_header.type = LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_HANDSHAKE;
@@ -4086,13 +3856,10 @@ int client_handle_message_handshake(struct notification_client *client,
        msg_header.fds = 0;
 
        memcpy(send_buffer, &msg_header, sizeof(msg_header));
-       memcpy(send_buffer + sizeof(msg_header), &handshake_reply,
-                       sizeof(handshake_reply));
+       memcpy(send_buffer + sizeof(msg_header), &handshake_reply, sizeof(handshake_reply));
 
-       handshake_client =
-                       (struct lttng_notification_channel_command_handshake *)
-                                       client->communication.inbound.payload.buffer
-                                                       .data;
+       handshake_client = (struct lttng_notification_channel_command_handshake *)
+                                  client->communication.inbound.payload.buffer.data;
        client->major = handshake_client->major;
        client->minor = handshake_client->minor;
        if (!client->communication.inbound.creds_received) {
@@ -4101,26 +3868,25 @@ int client_handle_message_handshake(struct notification_client *client,
                goto end;
        }
 
-       client->uid = LTTNG_SOCK_GET_UID_CRED(
-                       &client->communication.inbound.creds);
-       client->gid = LTTNG_SOCK_GET_GID_CRED(
-                       &client->communication.inbound.creds);
-       client->is_sessiond = LTTNG_SOCK_GET_PID_CRED(&client->communication.inbound.creds) == getpid();
+       client->uid = LTTNG_SOCK_GET_UID_CRED(&client->communication.inbound.creds);
+       client->gid = LTTNG_SOCK_GET_GID_CRED(&client->communication.inbound.creds);
+       client->is_sessiond = LTTNG_SOCK_GET_PID_CRED(&client->communication.inbound.creds) ==
+               getpid();
        DBG("Received handshake from client: uid = %u, gid = %u, protocol version = %i.%i, client is sessiond = %s",
-                       client->uid, client->gid, (int) client->major,
-                       (int) client->minor,
-                       client->is_sessiond ? "true" : "false");
+           client->uid,
+           client->gid,
+           (int) client->major,
+           (int) client->minor,
+           client->is_sessiond ? "true" : "false");
 
-       if (handshake_client->major !=
-                       LTTNG_NOTIFICATION_CHANNEL_VERSION_MAJOR) {
+       if (handshake_client->major != LTTNG_NOTIFICATION_CHANNEL_VERSION_MAJOR) {
                status = LTTNG_NOTIFICATION_CHANNEL_STATUS_UNSUPPORTED_VERSION;
        }
 
        pthread_mutex_lock(&client->lock);
        /* Outgoing queue will be flushed when the command reply is sent. */
        ret = lttng_dynamic_buffer_append(
-                       &client->communication.outbound.payload.buffer, send_buffer,
-                       sizeof(send_buffer));
+               &client->communication.outbound.payload.buffer, send_buffer, sizeof(send_buffer));
        if (ret) {
                ERR("Failed to send protocol version to notification channel client");
                goto end_unlock;
@@ -4151,20 +3917,15 @@ end:
        return ret;
 }
 
-static
-int client_handle_message_subscription(
-               struct notification_client *client,
-               enum lttng_notification_channel_message_type msg_type,
-               struct notification_thread_state *state)
+static int client_handle_message_subscription(struct notification_client *client,
+                                             enum lttng_notification_channel_message_type msg_type,
+                                             struct notification_thread_state *state)
 {
        int ret;
        struct lttng_condition *condition;
-       enum lttng_notification_channel_status status =
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
+       enum lttng_notification_channel_status status = LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
        struct lttng_payload_view condition_view =
-                       lttng_payload_view_from_payload(
-                                       &client->communication.inbound.payload,
-                                       0, -1);
+               lttng_payload_view_from_payload(&client->communication.inbound.payload, 0, -1);
        size_t expected_condition_size;
 
        /*
@@ -4181,11 +3942,9 @@ int client_handle_message_subscription(
 
        /* Ownership of condition is always transferred. */
        if (msg_type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE) {
-               ret = notification_thread_client_subscribe(
-                               client, condition, state, &status);
+               ret = notification_thread_client_subscribe(client, condition, state, &status);
        } else {
-               ret = notification_thread_client_unsubscribe(
-                               client, condition, state, &status);
+               ret = notification_thread_client_unsubscribe(client, condition, state, &status);
        }
 
        if (ret) {
@@ -4209,17 +3968,16 @@ end:
        return ret;
 }
 
-static
-int client_dispatch_message(struct notification_client *client,
-               struct notification_thread_state *state)
+static int client_dispatch_message(struct notification_client *client,
+                                  struct notification_thread_state *state)
 {
        int ret = 0;
 
        if (client->communication.inbound.msg_type !=
-                       LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_HANDSHAKE &&
-                       client->communication.inbound.msg_type !=
-                               LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNKNOWN &&
-                       !client->validated) {
+                   LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_HANDSHAKE &&
+           client->communication.inbound.msg_type !=
+                   LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNKNOWN &&
+           !client->validated) {
                WARN("client attempted a command before handshake");
                ret = -1;
                goto end;
@@ -4239,8 +3997,8 @@ int client_dispatch_message(struct notification_client *client,
        case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE:
        case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNSUBSCRIBE:
        {
-               ret = client_handle_message_subscription(client,
-                               client->communication.inbound.msg_type, state);
+               ret = client_handle_message_subscription(
+                       client, client->communication.inbound.msg_type, state);
                break;
        }
        default:
@@ -4251,8 +4009,7 @@ end:
 }
 
 /* Incoming data from client. */
-int handle_notification_thread_client_in(
-               struct notification_thread_state *state, int socket)
+int handle_notification_thread_client_in(struct notification_thread_state *state, int socket)
 {
        int ret = 0;
        struct notification_client *client;
@@ -4268,26 +4025,28 @@ int handle_notification_thread_client_in(
        }
 
        if (client->communication.inbound.bytes_to_receive == 0 &&
-                       client->communication.inbound.fds_to_receive != 0) {
+           client->communication.inbound.fds_to_receive != 0) {
                /* Only FDs left to receive. */
                goto receive_fds;
        }
 
        offset = client->communication.inbound.payload.buffer.size -
-                       client->communication.inbound.bytes_to_receive;
+               client->communication.inbound.bytes_to_receive;
        if (client->communication.inbound.expect_creds) {
-               recv_ret = lttcomm_recv_creds_unix_sock(socket,
-                               client->communication.inbound.payload.buffer.data + offset,
-                               client->communication.inbound.bytes_to_receive,
-                               &client->communication.inbound.creds);
+               recv_ret = lttcomm_recv_creds_unix_sock(
+                       socket,
+                       client->communication.inbound.payload.buffer.data + offset,
+                       client->communication.inbound.bytes_to_receive,
+                       &client->communication.inbound.creds);
                if (recv_ret > 0) {
                        client->communication.inbound.expect_creds = false;
                        client->communication.inbound.creds_received = true;
                }
        } else {
-               recv_ret = lttcomm_recv_unix_sock_non_block(socket,
-                               client->communication.inbound.payload.buffer.data + offset,
-                               client->communication.inbound.bytes_to_receive);
+               recv_ret = lttcomm_recv_unix_sock_non_block(
+                       socket,
+                       client->communication.inbound.payload.buffer.data + offset,
+                       client->communication.inbound.bytes_to_receive);
        }
        if (recv_ret >= 0) {
                client->communication.inbound.bytes_to_receive -= recv_ret;
@@ -4307,9 +4066,9 @@ receive_fds:
        /* Receive fds. */
        if (client->communication.inbound.fds_to_receive != 0) {
                ret = lttcomm_recv_payload_fds_unix_sock_non_block(
-                               client->socket,
-                               client->communication.inbound.fds_to_receive,
-                               &client->communication.inbound.payload);
+                       client->socket,
+                       client->communication.inbound.fds_to_receive,
+                       &client->communication.inbound.payload);
                if (ret > 0) {
                        /*
                         * Fds received. non blocking fds passing is all
@@ -4317,9 +4076,7 @@ receive_fds:
                         */
                        ssize_t expected_size;
 
-                       expected_size = sizeof(int) *
-                                       client->communication.inbound
-                                                       .fds_to_receive;
+                       expected_size = sizeof(int) * client->communication.inbound.fds_to_receive;
                        LTTNG_ASSERT(ret == expected_size);
                        client->communication.inbound.fds_to_receive = 0;
                } else if (ret == 0) {
@@ -4333,7 +4090,7 @@ receive_fds:
 
        /* At this point the message is complete.*/
        LTTNG_ASSERT(client->communication.inbound.bytes_to_receive == 0 &&
-                       client->communication.inbound.fds_to_receive == 0);
+                    client->communication.inbound.fds_to_receive == 0);
        ret = client_dispatch_message(client, state);
        if (ret) {
                /*
@@ -4353,8 +4110,7 @@ error_disconnect_client:
 }
 
 /* Client ready to receive outgoing data. */
-int handle_notification_thread_client_out(
-               struct notification_thread_state *state, int socket)
+int handle_notification_thread_client_out(struct notification_thread_state *state, int socket)
 {
        int ret;
        struct notification_client *client;
@@ -4412,8 +4168,7 @@ int handle_notification_thread_client_out(
        }
        pthread_mutex_unlock(&client->lock);
 
-       ret = client_handle_transmission_status(
-                       client, transmission_status, state);
+       ret = client_handle_transmission_status(client, transmission_status, state);
        if (ret) {
                goto end;
        }
@@ -4422,16 +4177,15 @@ end:
        return ret;
 }
 
-static
-bool evaluate_buffer_usage_condition(const struct lttng_condition *condition,
-               const struct channel_state_sample *sample,
-               uint64_t buffer_capacity)
+static bool evaluate_buffer_usage_condition(const struct lttng_condition *condition,
+                                           const struct channel_state_sample *sample,
+                                           uint64_t buffer_capacity)
 {
        bool result = false;
        uint64_t threshold;
        enum lttng_condition_type condition_type;
-       const struct lttng_condition_buffer_usage *use_condition = lttng::utils::container_of(
-                       condition, &lttng_condition_buffer_usage::parent);
+       const struct lttng_condition_buffer_usage *use_condition =
+               lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
 
        if (use_condition->threshold_bytes.set) {
                threshold = use_condition->threshold_bytes.value;
@@ -4449,13 +4203,15 @@ bool evaluate_buffer_usage_condition(const struct lttng_condition *condition,
                 * that all channels matching my_chann* have the same size...)
                 */
                threshold = (uint64_t) (use_condition->threshold_ratio.value *
-                               (double) buffer_capacity);
+                                       (double) buffer_capacity);
        }
 
        condition_type = lttng_condition_get_type(condition);
        if (condition_type == LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW) {
-               DBG("Low buffer usage condition being evaluated: threshold = %" PRIu64 ", highest usage = %" PRIu64,
-                               threshold, sample->highest_usage);
+               DBG("Low buffer usage condition being evaluated: threshold = %" PRIu64
+                   ", highest usage = %" PRIu64,
+                   threshold,
+                   sample->highest_usage);
 
                /*
                 * The low condition should only be triggered once _all_ of the
@@ -4465,8 +4221,10 @@ bool evaluate_buffer_usage_condition(const struct lttng_condition *condition,
                        result = true;
                }
        } else {
-               DBG("High buffer usage condition being evaluated: threshold = %" PRIu64 ", highest usage = %" PRIu64,
-                               threshold, sample->highest_usage);
+               DBG("High buffer usage condition being evaluated: threshold = %" PRIu64
+                   ", highest usage = %" PRIu64,
+                   threshold,
+                   sample->highest_usage);
 
                /*
                 * For high buffer usage scenarios, we want to trigger whenever
@@ -4480,13 +4238,13 @@ bool evaluate_buffer_usage_condition(const struct lttng_condition *condition,
        return result;
 }
 
-static
-int evaluate_buffer_condition(const struct lttng_condition *condition,
-               struct lttng_evaluation **evaluation,
-               const struct notification_thread_state *state __attribute__((unused)),
-               const struct channel_state_sample *previous_sample,
-               const struct channel_state_sample *latest_sample,
-               struct channel_info *channel_info)
+static int evaluate_buffer_condition(const struct lttng_condition *condition,
+                                    struct lttng_evaluation **evaluation,
+                                    const struct notification_thread_state *state
+                                    __attribute__((unused)),
+                                    const struct channel_state_sample *previous_sample,
+                                    const struct channel_state_sample *latest_sample,
+                                    struct channel_info *channel_info)
 {
        int ret = 0;
        enum lttng_condition_type condition_type;
@@ -4500,21 +4258,18 @@ int evaluate_buffer_condition(const struct lttng_condition *condition,
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW:
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH:
                if (caa_likely(previous_sample_available)) {
-                       previous_sample_result =
-                               evaluate_buffer_usage_condition(condition,
-                                       previous_sample, channel_info->capacity);
+                       previous_sample_result = evaluate_buffer_usage_condition(
+                               condition, previous_sample, channel_info->capacity);
                }
                latest_sample_result = evaluate_buffer_usage_condition(
-                               condition, latest_sample,
-                               channel_info->capacity);
+                       condition, latest_sample, channel_info->capacity);
                break;
        default:
                /* Unknown condition type; internal error. */
                abort();
        }
 
-       if (!latest_sample_result ||
-                       (previous_sample_result == latest_sample_result)) {
+       if (!latest_sample_result || (previous_sample_result == latest_sample_result)) {
                /*
                 * Only trigger on a condition evaluation transition.
                 *
@@ -4532,9 +4287,7 @@ int evaluate_buffer_condition(const struct lttng_condition *condition,
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW:
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH:
                *evaluation = lttng_evaluation_buffer_usage_create(
-                               condition_type,
-                               latest_sample->highest_usage,
-                               channel_info->capacity);
+                       condition_type, latest_sample->highest_usage, channel_info->capacity);
                break;
        default:
                abort();
@@ -4548,8 +4301,7 @@ end:
        return ret;
 }
 
-static
-int client_notification_overflow(struct notification_client *client)
+static int client_notification_overflow(struct notification_client *client)
 {
        int ret = 0;
        struct lttng_notification_channel_message msg;
@@ -4560,8 +4312,7 @@ int client_notification_overflow(struct notification_client *client)
 
        ASSERT_LOCKED(client->lock);
 
-       DBG("Dropping notification addressed to client (socket fd = %i)",
-                       client->socket);
+       DBG("Dropping notification addressed to client (socket fd = %i)", client->socket);
        if (client->communication.outbound.dropped_notification) {
                /*
                 * The client already has a "notification dropped" message
@@ -4573,31 +4324,29 @@ int client_notification_overflow(struct notification_client *client)
 
        client->communication.outbound.dropped_notification = true;
        ret = lttng_dynamic_buffer_append(
-                       &client->communication.outbound.payload.buffer, &msg,
-                       sizeof(msg));
+               &client->communication.outbound.payload.buffer, &msg, sizeof(msg));
        if (ret) {
                PERROR("Failed to enqueue \"dropped notification\" message in client's (socket fd = %i) outgoing queue",
-                               client->socket);
+                      client->socket);
        }
 end:
        return ret;
 }
 
-static int client_handle_transmission_status_wrapper(
-               struct notification_client *client,
-               enum client_transmission_status status,
-               void *user_data)
+static int client_handle_transmission_status_wrapper(struct notification_client *client,
+                                                    enum client_transmission_status status,
+                                                    void *user_data)
 {
-       return client_handle_transmission_status(client, status,
-                       (struct notification_thread_state *) user_data);
+       return client_handle_transmission_status(
+               client, status, (struct notification_thread_state *) user_data);
 }
 
-static
-int send_evaluation_to_clients(const struct lttng_trigger *trigger,
-               const struct lttng_evaluation *evaluation,
-               struct notification_client_list* client_list,
-               struct notification_thread_state *state,
-               uid_t object_uid, gid_t object_gid)
+static int send_evaluation_to_clients(const struct lttng_trigger *trigger,
+                                     const struct lttng_evaluation *evaluation,
+                                     struct notification_client_list *client_list,
+                                     struct notification_thread_state *state,
+                                     uid_t object_uid,
+                                     gid_t object_gid)
 {
        const struct lttng_credentials creds = {
                .uid = LTTNG_OPTIONAL_INIT_VALUE(object_uid),
@@ -4605,9 +4354,11 @@ int send_evaluation_to_clients(const struct lttng_trigger *trigger,
        };
 
        return notification_client_list_send_evaluation(client_list,
-                       trigger, evaluation,
-                       &creds,
-                       client_handle_transmission_status_wrapper, state);
+                                                       trigger,
+                                                       evaluation,
+                                                       &creds,
+                                                       client_handle_transmission_status_wrapper,
+                                                       state);
 }
 
 /*
@@ -4643,13 +4394,12 @@ int send_evaluation_to_clients(const struct lttng_trigger *trigger,
  * interference from external users (those could, for instance, unregister
  * their triggers).
  */
-int notification_client_list_send_evaluation(
-               struct notification_client_list *client_list,
-               const struct lttng_trigger *trigger,
-               const struct lttng_evaluation *evaluation,
-               const struct lttng_credentials *source_object_creds,
-               report_client_transmission_result_cb client_report,
-               void *user_data)
+int notification_client_list_send_evaluation(struct notification_client_list *client_list,
+                                            const struct lttng_trigger *trigger,
+                                            const struct lttng_evaluation *evaluation,
+                                            const struct lttng_credentials *source_object_creds,
+                                            report_client_transmission_result_cb client_report,
+                                            void *user_data)
 {
        int ret = 0;
        struct lttng_payload msg_payload;
@@ -4659,8 +4409,7 @@ int notification_client_list_send_evaluation(
                .evaluation = (struct lttng_evaluation *) evaluation,
        };
        struct lttng_notification_channel_message msg_header;
-       const struct lttng_credentials *trigger_creds =
-                       lttng_trigger_get_credentials(trigger);
+       const struct lttng_credentials *trigger_creds = lttng_trigger_get_credentials(trigger);
 
        lttng_payload_init(&msg_payload);
 
@@ -4668,8 +4417,7 @@ int notification_client_list_send_evaluation(
        msg_header.size = 0;
        msg_header.fds = 0;
 
-       ret = lttng_dynamic_buffer_append(&msg_payload.buffer, &msg_header,
-                       sizeof(msg_header));
+       ret = lttng_dynamic_buffer_append(&msg_payload.buffer, &msg_header, sizeof(msg_header));
        if (ret) {
                goto end;
        }
@@ -4682,26 +4430,22 @@ int notification_client_list_send_evaluation(
        }
 
        /* Update payload size. */
-       ((struct lttng_notification_channel_message *) msg_payload.buffer.data)
-                       ->size = (uint32_t)(
-                       msg_payload.buffer.size - sizeof(msg_header));
+       ((struct lttng_notification_channel_message *) msg_payload.buffer.data)->size =
+               (uint32_t) (msg_payload.buffer.size - sizeof(msg_header));
 
        /* Update the payload number of fds. */
        {
-               const struct lttng_payload_view pv = lttng_payload_view_from_payload(
-                               &msg_payload, 0, -1);
+               const struct lttng_payload_view pv =
+                       lttng_payload_view_from_payload(&msg_payload, 0, -1);
 
-               ((struct lttng_notification_channel_message *)
-                               msg_payload.buffer.data)->fds = (uint32_t)
-                               lttng_payload_view_get_fd_handle_count(&pv);
+               ((struct lttng_notification_channel_message *) msg_payload.buffer.data)->fds =
+                       (uint32_t) lttng_payload_view_get_fd_handle_count(&pv);
        }
 
        pthread_mutex_lock(&client_list->lock);
-       cds_list_for_each_entry_safe(client_list_element, tmp,
-                       &client_list->clients_list, node) {
+       cds_list_for_each_entry_safe (client_list_element, tmp, &client_list->clients_list, node) {
                enum client_transmission_status transmission_status;
-               struct notification_client *client =
-                               client_list_element->client;
+               struct notification_client *client = client_list_element->client;
 
                ret = 0;
                pthread_mutex_lock(&client->lock);
@@ -4725,8 +4469,8 @@ int notification_client_list_send_evaluation(
 
                if (source_object_creds) {
                        if (client->uid != lttng_credentials_get_uid(source_object_creds) &&
-                                       client->gid != lttng_credentials_get_gid(source_object_creds) &&
-                                       client->uid != 0) {
+                           client->gid != lttng_credentials_get_gid(source_object_creds) &&
+                           client->uid != 0) {
                                /*
                                 * Client is not allowed to monitor this
                                 * object.
@@ -4742,7 +4486,8 @@ int notification_client_list_send_evaluation(
                }
 
                DBG("Sending notification to client (fd = %i, %zu bytes)",
-                               client->socket, msg_payload.buffer.size);
+                   client->socket,
+                   msg_payload.buffer.size);
 
                if (client_has_outbound_data_left(client)) {
                        /*
@@ -4775,7 +4520,7 @@ int notification_client_list_send_evaluation(
 
                continue;
 
-skip_client:
+       skip_client:
                pthread_mutex_unlock(&client->lock);
                if (ret) {
                        /* Fatal error. */
@@ -4791,9 +4536,8 @@ end:
        return ret;
 }
 
-static
-struct lttng_event_notifier_notification *recv_one_event_notifier_notification(
-               int notification_pipe_read_fd, enum lttng_domain_type domain)
+static struct lttng_event_notifier_notification *
+recv_one_event_notifier_notification(int notification_pipe_read_fd, enum lttng_domain_type domain)
 {
        int ret;
        uint64_t token;
@@ -4807,7 +4551,7 @@ struct lttng_event_notifier_notification *recv_one_event_notifier_notification(
        struct lttng_kernel_abi_event_notifier_notification kernel_notification;
 
        /* Init lttng_event_notifier_notification */
-       switch(domain) {
+       switch (domain) {
        case LTTNG_DOMAIN_UST:
                reception_buffer = (void *) &ust_notification;
                reception_size = sizeof(ust_notification);
@@ -4824,16 +4568,17 @@ struct lttng_event_notifier_notification *recv_one_event_notifier_notification(
         * The monitoring pipe only holds messages smaller than PIPE_BUF,
         * ensuring that read/write of tracer notifications are atomic.
         */
-       ret = lttng_read(notification_pipe_read_fd, reception_buffer,
-                       reception_size);
+       ret = lttng_read(notification_pipe_read_fd, reception_buffer, reception_size);
        if (ret != reception_size) {
                PERROR("Failed to read from event source notification pipe: fd = %d, size to read = %zu, ret = %d",
-                               notification_pipe_read_fd, reception_size, ret);
+                      notification_pipe_read_fd,
+                      reception_size,
+                      ret);
                ret = -1;
                goto end;
        }
 
-       switch(domain) {
+       switch (domain) {
        case LTTNG_DOMAIN_UST:
                token = ust_notification.token;
                capture_buffer_size = ust_notification.capture_buf_size;
@@ -4853,7 +4598,8 @@ struct lttng_event_notifier_notification *recv_one_event_notifier_notification(
 
        if (capture_buffer_size > MAX_CAPTURE_SIZE) {
                ERR("Event notifier has a capture payload size which exceeds the maximum allowed size: capture_payload_size = %zu bytes, max allowed size = %d bytes",
-                               capture_buffer_size, MAX_CAPTURE_SIZE);
+                   capture_buffer_size,
+                   MAX_CAPTURE_SIZE);
                goto end;
        }
 
@@ -4866,14 +4612,13 @@ struct lttng_event_notifier_notification *recv_one_event_notifier_notification(
        /* Fetch additional payload (capture). */
        ret = lttng_read(notification_pipe_read_fd, capture_buffer, capture_buffer_size);
        if (ret != capture_buffer_size) {
-               ERR("Failed to read from event source pipe (fd = %i)",
-                               notification_pipe_read_fd);
+               ERR("Failed to read from event source pipe (fd = %i)", notification_pipe_read_fd);
                goto end;
        }
 
 skip_capture:
-       notification = lttng_event_notifier_notification_create(token, domain,
-                       capture_buffer, capture_buffer_size);
+       notification = lttng_event_notifier_notification_create(
+               token, domain, capture_buffer, capture_buffer_size);
        if (notification == NULL) {
                goto end;
        }
@@ -4888,9 +4633,9 @@ end:
        return notification;
 }
 
-static
-int dispatch_one_event_notifier_notification(struct notification_thread_state *state,
-               struct lttng_event_notifier_notification *notification)
+static int
+dispatch_one_event_notifier_notification(struct notification_thread_state *state,
+                                        struct lttng_event_notifier_notification *notification)
 {
        struct cds_lfht_node *node;
        struct cds_lfht_iter iter;
@@ -4905,7 +4650,9 @@ int dispatch_one_event_notifier_notification(struct notification_thread_state *s
        rcu_read_lock();
        cds_lfht_lookup(state->trigger_tokens_ht,
                        hash_key_u64(&notification->tracer_token, lttng_ht_seed),
-                       match_trigger_token, &notification->tracer_token, &iter);
+                       match_trigger_token,
+                       &notification->tracer_token,
+                       &iter);
        node = cds_lfht_iter_get_node(&iter);
        if (caa_unlikely(!node)) {
                /*
@@ -4918,13 +4665,11 @@ int dispatch_one_event_notifier_notification(struct notification_thread_state *s
                goto end_unlock;
        }
 
-       element = caa_container_of(node,
-                       struct notification_trigger_tokens_ht_element,
-                       node);
+       element = caa_container_of(node, struct notification_trigger_tokens_ht_element, node);
 
        if (lttng_condition_event_rule_matches_get_capture_descriptor_count(
-                           lttng_trigger_get_const_condition(element->trigger),
-                           &capture_count) != LTTNG_CONDITION_STATUS_OK) {
+                   lttng_trigger_get_const_condition(element->trigger), &capture_count) !=
+           LTTNG_CONDITION_STATUS_OK) {
                ERR("Failed to get capture count");
                ret = -1;
                goto end;
@@ -4937,11 +4682,11 @@ int dispatch_one_event_notifier_notification(struct notification_thread_state *s
        }
 
        evaluation = lttng_evaluation_event_rule_matches_create(
-                       lttng::utils::container_of(lttng_trigger_get_const_condition(
-                                                    element->trigger),
-                                       &lttng_condition_event_rule_matches::parent),
-                       notification->capture_buffer,
-                       notification->capture_buf_size, false);
+               lttng::utils::container_of(lttng_trigger_get_const_condition(element->trigger),
+                                          &lttng_condition_event_rule_matches::parent),
+               notification->capture_buffer,
+               notification->capture_buf_size,
+               false);
 
        if (evaluation == NULL) {
                ERR("Failed to create event rule matches evaluation while creating and enqueuing action executor job");
@@ -4949,18 +4694,17 @@ int dispatch_one_event_notifier_notification(struct notification_thread_state *s
                goto end_unlock;
        }
 
-       client_list = get_client_list_from_condition(state,
-                       lttng_trigger_get_const_condition(element->trigger));
-       executor_status = action_executor_enqueue_trigger(state->executor,
-                       element->trigger, evaluation, NULL, client_list);
+       client_list = get_client_list_from_condition(
+               state, lttng_trigger_get_const_condition(element->trigger));
+       executor_status = action_executor_enqueue_trigger(
+               state->executor, element->trigger, evaluation, NULL, client_list);
        switch (executor_status) {
        case ACTION_EXECUTOR_STATUS_OK:
                ret = 0;
                break;
        case ACTION_EXECUTOR_STATUS_OVERFLOW:
        {
-               struct notification_client_list_element *client_list_element,
-                               *tmp;
+               struct notification_client_list_element *client_list_element, *tmp;
 
                /*
                 * Not a fatal error; this is expected and simply means the
@@ -4975,11 +4719,10 @@ int dispatch_one_event_notifier_notification(struct notification_thread_state *s
 
                /* Warn clients that a notification (or more) was dropped. */
                pthread_mutex_lock(&client_list->lock);
-               cds_list_for_each_entry_safe(client_list_element, tmp,
-                               &client_list->clients_list, node) {
+               cds_list_for_each_entry_safe (
+                       client_list_element, tmp, &client_list->clients_list, node) {
                        enum client_transmission_status transmission_status;
-                       struct notification_client *client =
-                                       client_list_element->client;
+                       struct notification_client *client = client_list_element->client;
 
                        pthread_mutex_lock(&client->lock);
                        ret = client_notification_overflow(client);
@@ -4988,15 +4731,13 @@ int dispatch_one_event_notifier_notification(struct notification_thread_state *s
                                goto next_client;
                        }
 
-                       transmission_status =
-                                       client_flush_outgoing_queue(client);
-                       ret = client_handle_transmission_status(
-                                       client, transmission_status, state);
+                       transmission_status = client_flush_outgoing_queue(client);
+                       ret = client_handle_transmission_status(client, transmission_status, state);
                        if (ret) {
                                /* Fatal error. */
                                goto next_client;
                        }
-next_client:
+               next_client:
                        pthread_mutex_unlock(&client->lock);
                        if (ret) {
                                break;
@@ -5024,10 +4765,9 @@ end:
        return ret;
 }
 
-static
-int handle_one_event_notifier_notification(
-               struct notification_thread_state *state,
-               int pipe, enum lttng_domain_type domain)
+static int handle_one_event_notifier_notification(struct notification_thread_state *state,
+                                                 int pipe,
+                                                 enum lttng_domain_type domain)
 {
        int ret = 0;
        struct lttng_event_notifier_notification *notification = NULL;
@@ -5036,14 +4776,16 @@ int handle_one_event_notifier_notification(
        if (notification == NULL) {
                /* Reception failed, don't consider it fatal. */
                ERR("Error receiving an event notifier notification from tracer: fd = %i, domain = %s",
-                               pipe, lttng_domain_type_str(domain));
+                   pipe,
+                   lttng_domain_type_str(domain));
                goto end;
        }
 
        ret = dispatch_one_event_notifier_notification(state, notification);
        if (ret) {
                ERR("Error dispatching an event notifier notification from tracer: fd = %i, domain = %s",
-                               pipe, lttng_domain_type_str(domain));
+                   pipe,
+                   lttng_domain_type_str(domain));
                goto end;
        }
 
@@ -5053,14 +4795,15 @@ end:
 }
 
 int handle_notification_thread_event_notification(struct notification_thread_state *state,
-               int pipe, enum lttng_domain_type domain)
+                                                 int pipe,
+                                                 enum lttng_domain_type domain)
 {
        return handle_one_event_notifier_notification(state, pipe, domain);
 }
 
-int handle_notification_thread_channel_sample(
-               struct notification_thread_state *state, int pipe,
-               enum lttng_domain_type domain)
+int handle_notification_thread_channel_sample(struct notification_thread_state *state,
+                                             int pipe,
+                                             enum lttng_domain_type domain)
 {
        int ret = 0;
        struct lttcomm_consumer_channel_monitor_msg sample_msg;
@@ -5083,8 +4826,7 @@ int handle_notification_thread_channel_sample(
         */
        ret = lttng_read(pipe, &sample_msg, sizeof(sample_msg));
        if (ret != sizeof(sample_msg)) {
-               ERR("Failed to read from monitoring pipe (fd = %i)",
-                               pipe);
+               ERR("Failed to read from monitoring pipe (fd = %i)", pipe);
                ret = -1;
                goto end;
        }
@@ -5100,7 +4842,7 @@ int handle_notification_thread_channel_sample(
        session = get_session_info_by_id(state, sample_msg.session_id);
        if (!session) {
                DBG("Received a sample for an unknown session from consumerd: session id = %" PRIu64,
-                               sample_msg.session_id);
+                   sample_msg.session_id);
                goto end_unlock;
        }
 
@@ -5113,8 +4855,7 @@ int handle_notification_thread_channel_sample(
 
        session_trigger_list = get_session_trigger_list(state, session->name);
        LTTNG_ASSERT(session_trigger_list);
-       cds_list_for_each_entry(trigger_list_element, &session_trigger_list->list,
-                       node) {
+       cds_list_for_each_entry (trigger_list_element, &session_trigger_list->list, node) {
                const struct lttng_condition *condition;
                struct lttng_trigger *trigger;
                struct notification_client_list *client_list = NULL;
@@ -5127,7 +4868,7 @@ int handle_notification_thread_channel_sample(
                LTTNG_ASSERT(condition);
 
                ret = evaluate_session_condition(
-                               condition, session, &session_new_sample, &evaluation);
+                       condition, session, &session_new_sample, &evaluation);
                if (caa_unlikely(ret)) {
                        break;
                }
@@ -5143,8 +4884,7 @@ int handle_notification_thread_channel_sample(
                 */
                client_list = get_client_list_from_condition(state, condition);
                executor_status = action_executor_enqueue_trigger(
-                               state->executor, trigger, evaluation,
-                               &session_creds, client_list);
+                       state->executor, trigger, evaluation, &session_creds, client_list);
                notification_client_list_put(client_list);
                evaluation = NULL;
                switch (executor_status) {
@@ -5188,21 +4928,23 @@ int handle_notification_thread_channel_sample(
                 * channel's destruction before we get a chance to process that
                 * sample.
                 */
-               DBG("Received a sample for an unknown channel from consumerd, key = %" PRIu64 " in %s domain",
-                               channel_new_sample.key.key,
-                               lttng_domain_type_str(domain));
+               DBG("Received a sample for an unknown channel from consumerd, key = %" PRIu64
+                   " in %s domain",
+                   channel_new_sample.key.key,
+                   lttng_domain_type_str(domain));
                goto end_unlock;
        }
 
-       channel_info = caa_container_of(node, struct channel_info,
-                       channels_ht_node);
-       DBG("Handling channel sample for channel %s (key = %" PRIu64 ") in session %s (highest usage = %" PRIu64 ", lowest usage = %" PRIu64", consumed since last sample = %" PRIu64")",
-                       channel_info->name,
-                       channel_new_sample.key.key,
-                       channel_info->session_info->name,
-                       channel_new_sample.highest_usage,
-                       channel_new_sample.lowest_usage,
-                       sample_msg.consumed_since_last_sample);
+       channel_info = caa_container_of(node, struct channel_info, channels_ht_node);
+       DBG("Handling channel sample for channel %s (key = %" PRIu64
+           ") in session %s (highest usage = %" PRIu64 ", lowest usage = %" PRIu64
+           ", consumed since last sample = %" PRIu64 ")",
+           channel_info->name,
+           channel_new_sample.key.key,
+           channel_info->session_info->name,
+           channel_new_sample.highest_usage,
+           channel_new_sample.lowest_usage,
+           sample_msg.consumed_since_last_sample);
 
        /* Retrieve the channel's last sample, if it exists, and update it. */
        cds_lfht_lookup(state->channel_state_ht,
@@ -5215,12 +4957,10 @@ int handle_notification_thread_channel_sample(
                struct channel_state_sample *stored_sample;
 
                /* Update the sample stored. */
-               stored_sample = caa_container_of(node,
-                               struct channel_state_sample,
-                               channel_state_ht_node);
+               stored_sample =
+                       caa_container_of(node, struct channel_state_sample, channel_state_ht_node);
 
-               memcpy(&channel_previous_sample, stored_sample,
-                               sizeof(channel_previous_sample));
+               memcpy(&channel_previous_sample, stored_sample, sizeof(channel_previous_sample));
                stored_sample->highest_usage = channel_new_sample.highest_usage;
                stored_sample->lowest_usage = channel_new_sample.lowest_usage;
                previous_sample_available = true;
@@ -5240,8 +4980,8 @@ int handle_notification_thread_channel_sample(
                memcpy(stored_sample, &channel_new_sample, sizeof(*stored_sample));
                cds_lfht_node_init(&stored_sample->channel_state_ht_node);
                cds_lfht_add(state->channel_state_ht,
-                               hash_channel_key(&stored_sample->key),
-                               &stored_sample->channel_state_ht_node);
+                            hash_channel_key(&stored_sample->key),
+                            &stored_sample->channel_state_ht_node);
        }
 
        /* Find triggers associated with this channel. */
@@ -5253,15 +4993,14 @@ int handle_notification_thread_channel_sample(
        node = cds_lfht_iter_get_node(&iter);
        LTTNG_ASSERT(node);
 
-       channel_creds = (typeof(channel_creds)) {
+       channel_creds = (typeof(channel_creds)){
                .uid = LTTNG_OPTIONAL_INIT_VALUE(channel_info->session_info->uid),
                .gid = LTTNG_OPTIONAL_INIT_VALUE(channel_info->session_info->gid),
        };
 
-       channel_trigger_list = caa_container_of(node, struct lttng_channel_trigger_list,
-                       channel_triggers_ht_node);
-       cds_list_for_each_entry(trigger_list_element, &channel_trigger_list->list,
-                       node) {
+       channel_trigger_list =
+               caa_container_of(node, struct lttng_channel_trigger_list, channel_triggers_ht_node);
+       cds_list_for_each_entry (trigger_list_element, &channel_trigger_list->list, node) {
                const struct lttng_condition *condition;
                struct lttng_trigger *trigger;
                struct notification_client_list *client_list = NULL;
@@ -5273,10 +5012,13 @@ int handle_notification_thread_channel_sample(
                condition = lttng_trigger_get_const_condition(trigger);
                LTTNG_ASSERT(condition);
 
-               ret = evaluate_buffer_condition(condition, &evaluation, state,
-                               previous_sample_available ? &channel_previous_sample : NULL,
-                               &channel_new_sample,
-                               channel_info);
+               ret = evaluate_buffer_condition(
+                       condition,
+                       &evaluation,
+                       state,
+                       previous_sample_available ? &channel_previous_sample : NULL,
+                       &channel_new_sample,
+                       channel_info);
                if (caa_unlikely(ret)) {
                        break;
                }
@@ -5292,8 +5034,7 @@ int handle_notification_thread_channel_sample(
                 */
                client_list = get_client_list_from_condition(state, condition);
                executor_status = action_executor_enqueue_trigger(
-                               state->executor, trigger, evaluation,
-                               &channel_creds, client_list);
+                       state->executor, trigger, evaluation, &channel_creds, client_list);
                notification_client_list_put(client_list);
                evaluation = NULL;
                switch (executor_status) {
index 320e639d0468bf917af7e3327c868c211e10a48d..bd3ba44ded5f5f10ecb7c6a76aa4d5b4ae09bb15 100644 (file)
@@ -6,33 +6,33 @@
  */
 
 #define _LGPL_SOURCE
-#include <lttng/trigger/trigger.h>
-#include <lttng/notification/channel-internal.hpp>
-#include <lttng/notification/notification-internal.hpp>
-#include <lttng/condition/condition-internal.hpp>
-#include <lttng/condition/buffer-usage-internal.hpp>
-#include <common/error.hpp>
-#include <common/config/session-config.hpp>
-#include <common/defaults.hpp>
-#include <common/utils.hpp>
-#include <common/align.hpp>
-#include <common/time.hpp>
-#include <sys/stat.h>
-#include <sys/eventfd.h>
-#include <time.h>
-#include <signal.h>
-
-#include "notification-thread.hpp"
-#include "notification-thread-events.hpp"
-#include "notification-thread-commands.hpp"
-#include "lttng-sessiond.hpp"
 #include "health-sessiond.hpp"
-#include "thread.hpp"
+#include "kernel.hpp"
+#include "lttng-sessiond.hpp"
+#include "notification-thread-commands.hpp"
+#include "notification-thread-events.hpp"
+#include "notification-thread.hpp"
 #include "testpoint.hpp"
+#include "thread.hpp"
 
-#include "kernel.hpp"
+#include <common/align.hpp>
+#include <common/config/session-config.hpp>
+#include <common/defaults.hpp>
+#include <common/error.hpp>
 #include <common/kernel-ctl/kernel-ctl.hpp>
+#include <common/time.hpp>
+#include <common/utils.hpp>
 
+#include <lttng/condition/buffer-usage-internal.hpp>
+#include <lttng/condition/condition-internal.hpp>
+#include <lttng/notification/channel-internal.hpp>
+#include <lttng/notification/notification-internal.hpp>
+#include <lttng/trigger/trigger.h>
+
+#include <signal.h>
+#include <sys/eventfd.h>
+#include <sys/stat.h>
+#include <time.h>
 #include <urcu.h>
 #include <urcu/list.h>
 #include <urcu/rculfhash.h>
@@ -47,8 +47,7 @@ LTTNG_EXPORT int notifier_consumption_paused;
 /*
  * Destroy the thread data previously created by the init function.
  */
-void notification_thread_handle_destroy(
-               struct notification_thread_handle *handle)
+void notification_thread_handle_destroy(struct notification_thread_handle *handle)
 {
        int ret;
 
@@ -89,10 +88,10 @@ end:
        free(handle);
 }
 
-struct notification_thread_handle *notification_thread_handle_create(
-               struct lttng_pipe *ust32_channel_monitor_pipe,
-               struct lttng_pipe *ust64_channel_monitor_pipe,
-               struct lttng_pipe *kernel_channel_monitor_pipe)
+struct notification_thread_handle *
+notification_thread_handle_create(struct lttng_pipe *ust32_channel_monitor_pipe,
+                                 struct lttng_pipe *ust64_channel_monitor_pipe,
+                                 struct lttng_pipe *kernel_channel_monitor_pipe)
 {
        int ret;
        struct notification_thread_handle *handle;
@@ -105,7 +104,7 @@ struct notification_thread_handle *notification_thread_handle_create(
 
        sem_init(&handle->ready, 0, 0);
 
-       event_fd =  eventfd(0, EFD_CLOEXEC | EFD_SEMAPHORE);
+       event_fd = eventfd(0, EFD_CLOEXEC | EFD_SEMAPHORE);
        if (event_fd < 0) {
                PERROR("event_fd creation");
                goto error;
@@ -121,8 +120,7 @@ struct notification_thread_handle *notification_thread_handle_create(
 
        if (ust32_channel_monitor_pipe) {
                handle->channel_monitoring_pipes.ust32_consumer =
-                               lttng_pipe_release_readfd(
-                                       ust32_channel_monitor_pipe);
+                       lttng_pipe_release_readfd(ust32_channel_monitor_pipe);
                if (handle->channel_monitoring_pipes.ust32_consumer < 0) {
                        goto error;
                }
@@ -131,8 +129,7 @@ struct notification_thread_handle *notification_thread_handle_create(
        }
        if (ust64_channel_monitor_pipe) {
                handle->channel_monitoring_pipes.ust64_consumer =
-                               lttng_pipe_release_readfd(
-                                       ust64_channel_monitor_pipe);
+                       lttng_pipe_release_readfd(ust64_channel_monitor_pipe);
                if (handle->channel_monitoring_pipes.ust64_consumer < 0) {
                        goto error;
                }
@@ -141,8 +138,7 @@ struct notification_thread_handle *notification_thread_handle_create(
        }
        if (kernel_channel_monitor_pipe) {
                handle->channel_monitoring_pipes.kernel_consumer =
-                               lttng_pipe_release_readfd(
-                                       kernel_channel_monitor_pipe);
+                       lttng_pipe_release_readfd(kernel_channel_monitor_pipe);
                if (handle->channel_monitoring_pipes.kernel_consumer < 0) {
                        goto error;
                }
@@ -157,8 +153,7 @@ error:
        return NULL;
 }
 
-static
-char *get_notification_channel_sock_path(void)
+static char *get_notification_channel_sock_path(void)
 {
        int ret;
        bool is_root = !getuid();
@@ -170,8 +165,8 @@ char *get_notification_channel_sock_path(void)
        }
 
        if (is_root) {
-               ret = snprintf(sock_path, LTTNG_PATH_MAX,
-                               DEFAULT_GLOBAL_NOTIFICATION_CHANNEL_UNIX_SOCK);
+               ret = snprintf(
+                       sock_path, LTTNG_PATH_MAX, DEFAULT_GLOBAL_NOTIFICATION_CHANNEL_UNIX_SOCK);
                if (ret < 0) {
                        goto error;
                }
@@ -183,9 +178,10 @@ char *get_notification_channel_sock_path(void)
                        goto error;
                }
 
-               ret = snprintf(sock_path, LTTNG_PATH_MAX,
-                               DEFAULT_HOME_NOTIFICATION_CHANNEL_UNIX_SOCK,
-                               home_path);
+               ret = snprintf(sock_path,
+                              LTTNG_PATH_MAX,
+                              DEFAULT_HOME_NOTIFICATION_CHANNEL_UNIX_SOCK,
+                              home_path);
                if (ret < 0) {
                        goto error;
                }
@@ -197,8 +193,7 @@ error:
        return NULL;
 }
 
-static
-void notification_channel_socket_destroy(int fd)
+static void notification_channel_socket_destroy(int fd)
 {
        int ret;
        char *sock_path = get_notification_channel_sock_path();
@@ -219,14 +214,12 @@ void notification_channel_socket_destroy(int fd)
        }
 }
 
-static
-int notification_channel_socket_create(void)
+static int notification_channel_socket_create(void)
 {
        int fd = -1, ret;
        char *sock_path = get_notification_channel_sock_path();
 
-       DBG("Creating notification channel UNIX socket at %s",
-                       sock_path);
+       DBG("Creating notification channel UNIX socket at %s", sock_path);
 
        ret = lttcomm_create_unix_sock(sock_path);
        if (ret < 0) {
@@ -245,8 +238,7 @@ int notification_channel_socket_create(void)
        if (getuid() == 0) {
                gid_t gid;
 
-               ret = utils_get_group_id(the_config.tracing_group_name.value,
-                               true, &gid);
+               ret = utils_get_group_id(the_config.tracing_group_name.value, true, &gid);
                if (ret) {
                        /* Default to root group. */
                        gid = 0;
@@ -260,8 +252,7 @@ int notification_channel_socket_create(void)
                }
        }
 
-       DBG("Notification channel UNIX socket created (fd = %i)",
-                       fd);
+       DBG("Notification channel UNIX socket created (fd = %i)", fd);
        free(sock_path);
        return fd;
 error:
@@ -272,10 +263,9 @@ error:
        return ret;
 }
 
-static
-int init_poll_set(struct lttng_poll_event *poll_set,
-               struct notification_thread_handle *handle,
-               int notification_channel_socket)
+static int init_poll_set(struct lttng_poll_event *poll_set,
+                        struct notification_thread_handle *handle,
+                        int notification_channel_socket)
 {
        int ret;
 
@@ -302,14 +292,12 @@ int init_poll_set(struct lttng_poll_event *poll_set,
                ERR("Failed to add notification command queue event fd to pollset");
                goto error;
        }
-       ret = lttng_poll_add(poll_set,
-                       handle->channel_monitoring_pipes.ust32_consumer, LPOLLIN);
+       ret = lttng_poll_add(poll_set, handle->channel_monitoring_pipes.ust32_consumer, LPOLLIN);
        if (ret < 0) {
                ERR("Failed to add ust-32 channel monitoring pipe fd to pollset");
                goto error;
        }
-       ret = lttng_poll_add(poll_set,
-                       handle->channel_monitoring_pipes.ust64_consumer, LPOLLIN);
+       ret = lttng_poll_add(poll_set, handle->channel_monitoring_pipes.ust64_consumer, LPOLLIN);
        if (ret < 0) {
                ERR("Failed to add ust-64 channel monitoring pipe fd to pollset");
                goto error;
@@ -317,8 +305,7 @@ int init_poll_set(struct lttng_poll_event *poll_set,
        if (handle->channel_monitoring_pipes.kernel_consumer < 0) {
                goto end;
        }
-       ret = lttng_poll_add(poll_set,
-                       handle->channel_monitoring_pipes.kernel_consumer, LPOLLIN);
+       ret = lttng_poll_add(poll_set, handle->channel_monitoring_pipes.kernel_consumer, LPOLLIN);
        if (ret < 0) {
                ERR("Failed to add kernel channel monitoring pipe fd to pollset");
                goto error;
@@ -330,8 +317,7 @@ error:
        return ret;
 }
 
-static
-void fini_thread_state(struct notification_thread_state *state)
+static void fini_thread_state(struct notification_thread_state *state)
 {
        int ret;
 
@@ -360,8 +346,7 @@ void fini_thread_state(struct notification_thread_state *state)
                LTTNG_ASSERT(!ret);
        }
        if (state->notification_trigger_clients_ht) {
-               ret = cds_lfht_destroy(state->notification_trigger_clients_ht,
-                               NULL);
+               ret = cds_lfht_destroy(state->notification_trigger_clients_ht, NULL);
                LTTNG_ASSERT(!ret);
        }
        if (state->channels_ht) {
@@ -389,8 +374,7 @@ void fini_thread_state(struct notification_thread_state *state)
                LTTNG_ASSERT(!ret);
        }
        if (state->notification_channel_socket >= 0) {
-               notification_channel_socket_destroy(
-                               state->notification_channel_socket);
+               notification_channel_socket_destroy(state->notification_channel_socket);
        }
 
        LTTNG_ASSERT(cds_list_empty(&state->tracer_event_sources_list));
@@ -401,24 +385,21 @@ void fini_thread_state(struct notification_thread_state *state)
        lttng_poll_clean(&state->events);
 }
 
-static
-void mark_thread_as_ready(struct notification_thread_handle *handle)
+static void mark_thread_as_ready(struct notification_thread_handle *handle)
 {
        DBG("Marking notification thread as ready");
        sem_post(&handle->ready);
 }
 
-static
-void wait_until_thread_is_ready(struct notification_thread_handle *handle)
+static void wait_until_thread_is_ready(struct notification_thread_handle *handle)
 {
        DBG("Waiting for notification thread to be ready");
        sem_wait(&handle->ready);
        DBG("Notification thread is ready");
 }
 
-static
-int init_thread_state(struct notification_thread_handle *handle,
-               struct notification_thread_state *state)
+static int init_thread_state(struct notification_thread_handle *handle,
+                            struct notification_thread_state *state)
 {
        int ret;
 
@@ -433,8 +414,7 @@ int init_thread_state(struct notification_thread_handle *handle,
        }
        state->notification_channel_socket = ret;
 
-       ret = init_poll_set(&state->events, handle,
-                       state->notification_channel_socket);
+       ret = init_poll_set(&state->events, handle, state->notification_channel_socket);
        if (ret) {
                goto end;
        }
@@ -446,65 +426,65 @@ int init_thread_state(struct notification_thread_handle *handle,
                goto error;
        }
 
-       state->client_socket_ht = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0,
-                       CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       state->client_socket_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!state->client_socket_ht) {
                goto error;
        }
 
-       state->client_id_ht = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0,
-                       CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       state->client_id_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!state->client_id_ht) {
                goto error;
        }
 
-       state->channel_triggers_ht = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0,
-                       CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       state->channel_triggers_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!state->channel_triggers_ht) {
                goto error;
        }
 
-       state->session_triggers_ht = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0,
-                       CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       state->session_triggers_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!state->session_triggers_ht) {
                goto error;
        }
 
-       state->channel_state_ht = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0,
-                       CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       state->channel_state_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!state->channel_state_ht) {
                goto error;
        }
 
-       state->notification_trigger_clients_ht = cds_lfht_new(DEFAULT_HT_SIZE,
-                       1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       state->notification_trigger_clients_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!state->notification_trigger_clients_ht) {
                goto error;
        }
 
-       state->channels_ht = cds_lfht_new(DEFAULT_HT_SIZE,
-                       1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       state->channels_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!state->channels_ht) {
                goto error;
        }
-       state->sessions_ht = cds_lfht_new(DEFAULT_HT_SIZE,
-                       1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       state->sessions_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!state->sessions_ht) {
                goto error;
        }
-       state->triggers_ht = cds_lfht_new(DEFAULT_HT_SIZE,
-                       1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       state->triggers_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!state->triggers_ht) {
                goto error;
        }
-       state->triggers_by_name_uid_ht = cds_lfht_new(DEFAULT_HT_SIZE,
-                       1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       state->triggers_by_name_uid_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!state->triggers_by_name_uid_ht) {
                goto error;
        }
 
-       state->trigger_tokens_ht = cds_lfht_new(DEFAULT_HT_SIZE,
-                       1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       state->trigger_tokens_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!state->trigger_tokens_ht) {
                goto error;
        }
@@ -526,16 +506,16 @@ error:
        return -1;
 }
 
-static
-int handle_channel_monitoring_pipe(int fd, uint32_t revents,
-               struct notification_thread_handle *handle,
-               struct notification_thread_state *state)
+static int handle_channel_monitoring_pipe(int fd,
+                                         uint32_t revents,
+                                         struct notification_thread_handle *handle,
+                                         struct notification_thread_state *state)
 {
        int ret = 0;
        enum lttng_domain_type domain;
 
        if (fd == handle->channel_monitoring_pipes.ust32_consumer ||
-                       fd == handle->channel_monitoring_pipes.ust64_consumer) {
+           fd == handle->channel_monitoring_pipes.ust64_consumer) {
                domain = LTTNG_DOMAIN_UST;
        } else if (fd == handle->channel_monitoring_pipes.kernel_consumer) {
                domain = LTTNG_DOMAIN_KERNEL;
@@ -551,8 +531,7 @@ int handle_channel_monitoring_pipe(int fd, uint32_t revents,
                goto end;
        }
 
-       ret = handle_notification_thread_channel_sample(
-                       state, fd, domain);
+       ret = handle_notification_thread_channel_sample(state, fd, domain);
        if (ret) {
                ERR("Consumer sample handling error occurred");
                ret = -1;
@@ -563,18 +542,17 @@ end:
 }
 
 static int handle_event_notification_pipe(int event_source_fd,
-               enum lttng_domain_type domain,
-               uint32_t revents,
-               struct notification_thread_state *state)
+                                         enum lttng_domain_type domain,
+                                         uint32_t revents,
+                                         struct notification_thread_state *state)
 {
        int ret = 0;
 
        if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) {
-               ret = handle_notification_thread_tracer_event_source_died(
-                               state, event_source_fd);
+               ret = handle_notification_thread_tracer_event_source_died(state, event_source_fd);
                if (ret) {
                        ERR("Failed to remove event notification pipe from poll set: fd = %d",
-                                       event_source_fd);
+                           event_source_fd);
                }
                goto end;
        }
@@ -590,11 +568,9 @@ static int handle_event_notification_pipe(int event_source_fd,
                goto end;
        }
 
-       ret = handle_notification_thread_event_notification(
-                       state, event_source_fd, domain);
+       ret = handle_notification_thread_event_notification(state, event_source_fd, domain);
        if (ret) {
-               ERR("Event notification handling error occurred for fd: %d",
-                               event_source_fd);
+               ERR("Event notification handling error occurred for fd: %d", event_source_fd);
                ret = -1;
                goto end;
        }
@@ -607,15 +583,14 @@ end:
  * Return the event source domain type via parameter.
  */
 static bool fd_is_event_notification_source(const struct notification_thread_state *state,
-               int fd,
-               enum lttng_domain_type *domain)
+                                           int fd,
+                                           enum lttng_domain_type *domain)
 {
        struct notification_event_tracer_event_source_element *source_element;
 
        LTTNG_ASSERT(domain);
 
-       cds_list_for_each_entry(source_element,
-                       &state->tracer_event_sources_list, node) {
+       cds_list_for_each_entry (source_element, &state->tracer_event_sources_list, node) {
                if (source_element->fd != fd) {
                        continue;
                }
@@ -631,8 +606,7 @@ static bool fd_is_event_notification_source(const struct notification_thread_sta
  * This thread services notification channel clients and commands received
  * from various lttng-sessiond components over a command queue.
  */
-static
-void *thread_notification(void *data)
+static void *thread_notification(void *data)
 {
        int ret;
        struct notification_thread_handle *handle = (notification_thread_handle *) data;
@@ -695,22 +669,21 @@ void *thread_notification(void *data)
 
                        if (fd == state.notification_channel_socket) {
                                if (revents & LPOLLIN) {
-                                       ret = handle_notification_thread_client_connect(
-                                                       &state);
+                                       ret = handle_notification_thread_client_connect(&state);
                                        if (ret < 0) {
                                                goto error;
                                        }
-                               } else if (revents &
-                                               (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) {
+                               } else if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) {
                                        ERR("Notification socket poll error");
                                        goto error;
                                } else {
-                                       ERR("Unexpected poll events %u for notification socket %i", revents, fd);
+                                       ERR("Unexpected poll events %u for notification socket %i",
+                                           revents,
+                                           fd);
                                        goto error;
                                }
                        } else if (fd == handle->cmd_queue.event_fd) {
-                               ret = handle_notification_thread_command(handle,
-                                               &state);
+                               ret = handle_notification_thread_command(handle, &state);
                                if (ret < 0) {
                                        DBG("Error encountered while servicing command queue");
                                        goto error;
@@ -718,10 +691,9 @@ void *thread_notification(void *data)
                                        goto exit;
                                }
                        } else if (fd == handle->channel_monitoring_pipes.ust32_consumer ||
-                                       fd == handle->channel_monitoring_pipes.ust64_consumer ||
-                                       fd == handle->channel_monitoring_pipes.kernel_consumer) {
-                               ret = handle_channel_monitoring_pipe(fd,
-                                               revents, handle, &state);
+                                  fd == handle->channel_monitoring_pipes.ust64_consumer ||
+                                  fd == handle->channel_monitoring_pipes.kernel_consumer) {
+                               ret = handle_channel_monitoring_pipe(fd, revents, handle, &state);
                                if (ret) {
                                        goto error;
                                }
@@ -740,23 +712,23 @@ void *thread_notification(void *data)
                                         * receive the notifications to which
                                         * it was subscribing or unsubscribing.
                                         */
-                                       ret = handle_notification_thread_client_disconnect(
-                                                       fd, &state);
+                                       ret = handle_notification_thread_client_disconnect(fd,
+                                                                                          &state);
                                        if (ret) {
                                                goto error;
                                        }
                                } else {
                                        if (revents & LPOLLIN) {
-                                               ret = handle_notification_thread_client_in(
-                                                       &state, fd);
+                                               ret = handle_notification_thread_client_in(&state,
+                                                                                          fd);
                                                if (ret) {
                                                        goto error;
                                                }
                                        }
 
                                        if (revents & LPOLLOUT) {
-                                               ret = handle_notification_thread_client_out(
-                                                       &state, fd);
+                                               ret = handle_notification_thread_client_out(&state,
+                                                                                           fd);
                                                if (ret) {
                                                        goto error;
                                                }
@@ -784,8 +756,7 @@ end:
        return NULL;
 }
 
-static
-bool shutdown_notification_thread(void *thread_data)
+static bool shutdown_notification_thread(void *thread_data)
 {
        struct notification_thread_handle *handle = (notification_thread_handle *) thread_data;
 
@@ -793,16 +764,12 @@ bool shutdown_notification_thread(void *thread_data)
        return true;
 }
 
-struct lttng_thread *launch_notification_thread(
-               struct notification_thread_handle *handle)
+struct lttng_thread *launch_notification_thread(struct notification_thread_handle *handle)
 {
        struct lttng_thread *thread;
 
-       thread = lttng_thread_create("Notification",
-                       thread_notification,
-                       shutdown_notification_thread,
-                       NULL,
-                       handle);
+       thread = lttng_thread_create(
+               "Notification", thread_notification, shutdown_notification_thread, NULL, handle);
        if (!thread) {
                goto error;
        }
index ff70ac187dcaff606ee0e8e73b97c18d99e53a7b..5d67a914f8ecbc6abefba99b8a6709bd33efd61c 100644 (file)
@@ -7,16 +7,16 @@
 
 #define _LGPL_SOURCE
 
-#include <common/common.hpp>
-#include <common/utils.hpp>
-
 #include "fd-limit.hpp"
+#include "health-sessiond.hpp"
 #include "lttng-sessiond.hpp"
 #include "notify-apps.hpp"
-#include "health-sessiond.hpp"
 #include "testpoint.hpp"
-#include "utils.hpp"
 #include "thread.hpp"
+#include "utils.hpp"
+
+#include <common/common.hpp>
+#include <common/utils.hpp>
 
 namespace {
 struct thread_notifiers {
@@ -42,8 +42,7 @@ static void *thread_application_notification(void *data)
        rcu_register_thread();
        rcu_thread_online();
 
-       health_register(the_health_sessiond,
-                       HEALTH_SESSIOND_TYPE_APP_MANAGE_NOTIFY);
+       health_register(the_health_sessiond, HEALTH_SESSIOND_TYPE_APP_MANAGE_NOTIFY);
 
        if (testpoint(sessiond_thread_app_manage_notify)) {
                goto error_testpoint;
@@ -57,8 +56,8 @@ static void *thread_application_notification(void *data)
        }
 
        /* Add notify pipe to the pollset. */
-       ret = lttng_poll_add(&events, notifiers->apps_cmd_notify_pipe_read_fd,
-                       LPOLLIN | LPOLLRDHUP);
+       ret = lttng_poll_add(
+               &events, notifiers->apps_cmd_notify_pipe_read_fd, LPOLLIN | LPOLLRDHUP);
        if (ret < 0) {
                goto error;
        }
@@ -74,11 +73,11 @@ static void *thread_application_notification(void *data)
                DBG3("[ust-thread] Manage notify polling");
 
                /* Inifinite blocking call, waiting for transmission */
-restart:
+       restart:
                health_poll_entry();
                ret = lttng_poll_wait(&events, -1);
                DBG3("[ust-thread] Manage notify return from poll on %d fds",
-                               LTTNG_POLL_GETNB(&events));
+                    LTTNG_POLL_GETNB(&events));
                health_poll_exit();
                if (ret < 0) {
                        /*
@@ -112,8 +111,10 @@ restart:
 
                                if (revents & LPOLLIN) {
                                        /* Get socket from dispatch thread. */
-                                       size_ret = lttng_read(notifiers->apps_cmd_notify_pipe_read_fd,
-                                                       &sock, sizeof(sock));
+                                       size_ret =
+                                               lttng_read(notifiers->apps_cmd_notify_pipe_read_fd,
+                                                          &sock,
+                                                          sizeof(sock));
                                        if (size_ret < sizeof(sock)) {
                                                PERROR("read apps notify pipe");
                                                goto error;
@@ -123,8 +124,9 @@ restart:
                                        ret = lttng_poll_add(&events, sock, LPOLLIN | LPOLLRDHUP);
                                        if (ret < 0) {
                                                /*
-                                                * It's possible we've reached the max poll fd allowed.
-                                                * Let's close the socket but continue normal execution.
+                                                * It's possible we've reached the max poll fd
+                                                * allowed. Let's close the socket but continue
+                                                * normal execution.
                                                 */
                                                ret = close(sock);
                                                if (ret) {
@@ -138,7 +140,9 @@ restart:
                                        ERR("Apps notify command pipe error");
                                        goto error;
                                } else {
-                                       ERR("Unexpected poll events %u for sock %d", revents, pollfd);
+                                       ERR("Unexpected poll events %u for sock %d",
+                                           revents,
+                                           pollfd);
                                        goto error;
                                }
                        } else {
@@ -155,7 +159,8 @@ restart:
                                                        goto error;
                                                }
 
-                                               /* The socket is closed after a grace period here. */
+                                               /* The socket is closed after a grace period here.
+                                                */
                                                ust_app_notify_sock_unregister(pollfd);
                                        }
                                } else if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) {
@@ -168,7 +173,9 @@ restart:
                                        /* The socket is closed after a grace period here. */
                                        ust_app_notify_sock_unregister(pollfd);
                                } else {
-                                       ERR("Unexpected poll events %u for sock %d", revents, pollfd);
+                                       ERR("Unexpected poll events %u for sock %d",
+                                           revents,
+                                           pollfd);
                                        goto error;
                                }
                                health_code_update();
@@ -228,10 +235,10 @@ bool launch_application_notification_thread(int apps_cmd_notify_pipe_read_fd)
        notifiers->quit_pipe = quit_pipe;
 
        thread = lttng_thread_create("Application notification",
-                       thread_application_notification,
-                       shutdown_application_notification_thread,
-                       cleanup_application_notification_thread,
-                       notifiers);
+                                    thread_application_notification,
+                                    shutdown_application_notification_thread,
+                                    cleanup_application_notification_thread,
+                                    notifiers);
        if (!thread) {
                goto error;
        }
index a3122da758395bb4a3a0db341e0f6df81a72c03f..518536e21ac31430d6171e7d740687787ce660b0 100644 (file)
@@ -7,9 +7,10 @@
  *
  */
 
-#include <signal.h>
 #include "lttng-sessiond.hpp"
 
+#include <signal.h>
+
 /* Notify parents that we are ready for cmd and health check */
 void sessiond_signal_parents(void)
 {
index 4478221ff530092307ac563fcda14157fe6818c5..039e54d6f7abd045ac1b0b5c9471a45fd00d5ad7 100644 (file)
@@ -7,22 +7,23 @@
  *
  */
 
-#include <stddef.h>
-#include <stdlib.h>
-#include <urcu.h>
+#include "fd-limit.hpp"
+#include "health-sessiond.hpp"
+#include "lttng-sessiond.hpp"
+#include "register.hpp"
+#include "testpoint.hpp"
+#include "thread.hpp"
+#include "utils.hpp"
+
 #include <common/futex.hpp>
 #include <common/macros.hpp>
 #include <common/shm.hpp>
 #include <common/utils.hpp>
-#include <sys/stat.h>
 
-#include "register.hpp"
-#include "lttng-sessiond.hpp"
-#include "testpoint.hpp"
-#include "health-sessiond.hpp"
-#include "fd-limit.hpp"
-#include "utils.hpp"
-#include "thread.hpp"
+#include <stddef.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <urcu.h>
 
 namespace {
 struct thread_state {
@@ -43,11 +44,9 @@ static int create_application_socket(void)
        int apps_sock;
 
        /* Create the application unix socket */
-       apps_sock = lttcomm_create_unix_sock(
-                       the_config.apps_unix_sock_path.value);
+       apps_sock = lttcomm_create_unix_sock(the_config.apps_unix_sock_path.value);
        if (apps_sock < 0) {
-               ERR("Create unix sock failed: %s",
-                               the_config.apps_unix_sock_path.value);
+               ERR("Create unix sock failed: %s", the_config.apps_unix_sock_path.value);
                ret = -1;
                goto end;
        }
@@ -56,17 +55,16 @@ static int create_application_socket(void)
        ret = utils_set_fd_cloexec(apps_sock);
        if (ret < 0) {
                ERR("Unable to set CLOEXEC flag to the app Unix socket (fd: %d). "
-                               "Continuing but note that the consumer daemon will have a "
-                               "reference to this socket on exec()", apps_sock);
+                   "Continuing but note that the consumer daemon will have a "
+                   "reference to this socket on exec()",
+                   apps_sock);
        }
 
        /* File permission MUST be 666 */
        ret = chmod(the_config.apps_unix_sock_path.value,
-                       S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |
-                                       S_IWOTH);
+                   S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
        if (ret < 0) {
-               PERROR("Set file permissions failed on %s",
-                               the_config.apps_unix_sock_path.value);
+               PERROR("Set file permissions failed on %s", the_config.apps_unix_sock_path.value);
                goto error_close_socket;
        }
 
@@ -93,8 +91,7 @@ static int notify_ust_apps(int active, bool is_root)
        DBG("Notifying applications of session daemon state: %d", active);
 
        /* See shm.c for this call implying mmap, shm and futex calls */
-       wait_shm_mmap = shm_ust_get_mmap(
-                       the_config.wait_shm_path.value, is_root);
+       wait_shm_mmap = shm_ust_get_mmap(the_config.wait_shm_path.value, is_root);
        if (wait_shm_mmap == NULL) {
                goto error;
        }
@@ -164,8 +161,7 @@ static void *thread_application_registration(void *data)
        const bool is_root = (getuid() == 0);
        struct thread_state *thread_state = (struct thread_state *) data;
        const int application_socket = thread_state->application_socket;
-       const auto thread_quit_pipe_fd = lttng_pipe_get_readfd(
-                       thread_state->quit_pipe);
+       const auto thread_quit_pipe_fd = lttng_pipe_get_readfd(thread_state->quit_pipe);
 
        DBG("[thread] Manage application registration started");
 
@@ -253,10 +249,10 @@ static void *thread_application_registration(void *data)
                                 * parameter.
                                 */
                                if (the_config.app_socket_timeout >= 0) {
-                                       (void) lttcomm_setsockopt_rcv_timeout(sock,
-                                                       the_config.app_socket_timeout * 1000);
-                                       (void) lttcomm_setsockopt_snd_timeout(sock,
-                                                       the_config.app_socket_timeout * 1000);
+                                       (void) lttcomm_setsockopt_rcv_timeout(
+                                               sock, the_config.app_socket_timeout * 1000);
+                                       (void) lttcomm_setsockopt_snd_timeout(
+                                               sock, the_config.app_socket_timeout * 1000);
                                }
 
                                /*
@@ -312,11 +308,15 @@ static void *thread_application_registration(void *data)
                                sock = -1;
 
                                DBG("UST registration received with pid:%d ppid:%d uid:%d"
-                                               " gid:%d sock:%d name:%s (version %d.%d)",
-                                               ust_cmd->reg_msg.pid, ust_cmd->reg_msg.ppid,
-                                               ust_cmd->reg_msg.uid, ust_cmd->reg_msg.gid,
-                                               ust_cmd->sock, ust_cmd->reg_msg.name,
-                                               ust_cmd->reg_msg.major, ust_cmd->reg_msg.minor);
+                                   " gid:%d sock:%d name:%s (version %d.%d)",
+                                   ust_cmd->reg_msg.pid,
+                                   ust_cmd->reg_msg.ppid,
+                                   ust_cmd->reg_msg.uid,
+                                   ust_cmd->reg_msg.gid,
+                                   ust_cmd->sock,
+                                   ust_cmd->reg_msg.name,
+                                   ust_cmd->reg_msg.major,
+                                   ust_cmd->reg_msg.minor);
 
                                /*
                                 * Lock free enqueue the registration request. The red pill
@@ -324,9 +324,8 @@ static void *thread_application_registration(void *data)
                                 */
                                cds_wfcq_head_ptr_t head;
                                head.h = &thread_state->ust_cmd_queue->head;
-                               cds_wfcq_enqueue(head,
-                                               &thread_state->ust_cmd_queue->tail,
-                                               &ust_cmd->node);
+                               cds_wfcq_enqueue(
+                                       head, &thread_state->ust_cmd_queue->tail, &ust_cmd->node);
 
                                /*
                                 * Wake the registration queue futex. Implicit memory
@@ -382,8 +381,7 @@ static bool shutdown_application_registration_thread(void *data)
        return notify_thread_pipe(write_fd) == 1;
 }
 
-struct lttng_thread *launch_application_registration_thread(
-               struct ust_cmd_queue *cmd_queue)
+struct lttng_thread *launch_application_registration_thread(struct ust_cmd_queue *cmd_queue)
 {
        int ret;
        struct lttng_pipe *quit_pipe;
@@ -410,10 +408,10 @@ struct lttng_thread *launch_application_registration_thread(
        sem_init(&thread_state->ready, 0, 0);
 
        thread = lttng_thread_create("UST application registration",
-                       thread_application_registration,
-                       shutdown_application_registration_thread,
-                       cleanup_application_registration_thread,
-                       thread_state);
+                                    thread_application_registration,
+                                    shutdown_application_registration_thread,
+                                    cleanup_application_registration_thread,
+                                    thread_state);
        if (!thread) {
                goto error;
        }
@@ -432,8 +430,8 @@ struct lttng_thread *launch_application_registration_thread(
        ret = notify_ust_apps(1, is_root);
        if (ret < 0) {
                ERR("Failed to notify applications or create the wait shared memory.\n"
-                       "Execution continues but there might be problems for already\n"
-                       "running applications that wishes to register.");
+                   "Execution continues but there might be problems for already\n"
+                   "running applications that wishes to register.");
        }
 
        return thread;
index d1be8f686d3fc20a04aa23779bada0eef3082a4c..cc857544390ea24674b8da75cf035fc59a0fd430 100644 (file)
@@ -7,42 +7,44 @@
  */
 
 #define _LGPL_SOURCE
-#include <lttng/trigger/trigger.h>
-#include <common/error.hpp>
+#include "cmd.hpp"
+#include "health-sessiond.hpp"
+#include "lttng-sessiond.hpp"
+#include "notification-thread-commands.hpp"
+#include "rotate.hpp"
+#include "rotation-thread.hpp"
+#include "session.hpp"
+#include "utils.hpp"
+
+#include <common/align.hpp>
 #include <common/config/session-config.hpp>
+#include <common/credentials.hpp>
 #include <common/defaults.hpp>
-#include <common/utils.hpp>
+#include <common/error.hpp>
 #include <common/futex.hpp>
-#include <common/align.hpp>
-#include <common/time.hpp>
 #include <common/hashtable/utils.hpp>
 #include <common/kernel-ctl/kernel-ctl.hpp>
-#include <common/credentials.hpp>
-#include <sys/stat.h>
-#include <time.h>
-#include <signal.h>
-#include <inttypes.h>
+#include <common/time.hpp>
+#include <common/utils.hpp>
 
+#include <lttng/action/action-internal.hpp>
+#include <lttng/condition/condition-internal.hpp>
 #include <lttng/notification/channel-internal.hpp>
 #include <lttng/rotate-internal.hpp>
-#include <lttng/condition/condition-internal.hpp>
-#include <lttng/action/action-internal.hpp>
-
-#include "session.hpp"
-#include "rotate.hpp"
-#include "rotation-thread.hpp"
-#include "lttng-sessiond.hpp"
-#include "health-sessiond.hpp"
-#include "cmd.hpp"
-#include "utils.hpp"
-#include "notification-thread-commands.hpp"
+#include <lttng/trigger/trigger.h>
 
+#include <inttypes.h>
+#include <signal.h>
+#include <sys/stat.h>
+#include <time.h>
 #include <urcu.h>
 #include <urcu/list.h>
 #include <urcu/rculfhash.h>
 
-int subscribe_session_consumed_size_rotation(struct ltt_session *session, uint64_t size,
-               struct notification_thread_handle *notification_thread_handle)
+int subscribe_session_consumed_size_rotation(
+       struct ltt_session *session,
+       uint64_t size,
+       struct notification_thread_handle *notification_thread_handle)
 {
        int ret;
        enum lttng_condition_status condition_status;
@@ -61,21 +63,20 @@ int subscribe_session_consumed_size_rotation(struct ltt_session *session, uint64
                goto end;
        }
 
-       condition_status = lttng_condition_session_consumed_size_set_threshold(
-                       rotate_condition, size);
+       condition_status =
+               lttng_condition_session_consumed_size_set_threshold(rotate_condition, size);
        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
                ERR("Could not set session consumed size condition threshold (size = %" PRIu64 ")",
-                               size);
+                   size);
                ret = -1;
                goto end;
        }
 
-       condition_status =
-                       lttng_condition_session_consumed_size_set_session_name(
-                               rotate_condition, session->name);
+       condition_status = lttng_condition_session_consumed_size_set_session_name(rotate_condition,
+                                                                                 session->name);
        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
                ERR("Could not set session consumed size condition session name (name = %s)",
-                               session->name);
+                   session->name);
                ret = -1;
                goto end;
        }
@@ -88,8 +89,7 @@ int subscribe_session_consumed_size_rotation(struct ltt_session *session, uint64
        }
 
        LTTNG_ASSERT(!session->rotate_trigger);
-       session->rotate_trigger = lttng_trigger_create(rotate_condition,
-                       notify_action);
+       session->rotate_trigger = lttng_trigger_create(rotate_condition, notify_action);
        if (!session->rotate_trigger) {
                ERR("Could not create size-based rotation trigger");
                ret = -1;
@@ -98,11 +98,10 @@ int subscribe_session_consumed_size_rotation(struct ltt_session *session, uint64
 
        /* Ensure this trigger is not visible to external users. */
        lttng_trigger_set_hidden(session->rotate_trigger);
-       lttng_trigger_set_credentials(
-                       session->rotate_trigger, &session_creds);
+       lttng_trigger_set_credentials(session->rotate_trigger, &session_creds);
 
-       nc_status = lttng_notification_channel_subscribe(
-                       rotate_notification_channel, rotate_condition);
+       nc_status =
+               lttng_notification_channel_subscribe(rotate_notification_channel, rotate_condition);
        if (nc_status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) {
                ERR("Could not subscribe to session consumed size notification");
                ret = -1;
@@ -110,8 +109,7 @@ int subscribe_session_consumed_size_rotation(struct ltt_session *session, uint64
        }
 
        ret = notification_thread_command_register_trigger(
-                       notification_thread_handle, session->rotate_trigger,
-                       true);
+               notification_thread_handle, session->rotate_trigger, true);
        if (ret < 0 && ret != -LTTNG_ERR_TRIGGER_EXISTS) {
                ERR("Register trigger, %s", lttng_strerror(ret));
                ret = -1;
@@ -129,24 +127,24 @@ end:
        return ret;
 }
 
-int unsubscribe_session_consumed_size_rotation(struct ltt_session *session,
-               struct notification_thread_handle *notification_thread_handle)
+int unsubscribe_session_consumed_size_rotation(
+       struct ltt_session *session, struct notification_thread_handle *notification_thread_handle)
 {
        int ret = 0;
        enum lttng_notification_channel_status status;
 
        LTTNG_ASSERT(session->rotate_trigger);
        status = lttng_notification_channel_unsubscribe(
-                       rotate_notification_channel,
-                       lttng_trigger_get_const_condition(session->rotate_trigger));
+               rotate_notification_channel,
+               lttng_trigger_get_const_condition(session->rotate_trigger));
        if (status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) {
                ERR("Session unsubscribe error: %d", (int) status);
                ret = -1;
                goto end;
        }
 
-       ret = notification_thread_command_unregister_trigger(
-                       notification_thread_handle, session->rotate_trigger);
+       ret = notification_thread_command_unregister_trigger(notification_thread_handle,
+                                                            session->rotate_trigger);
        if (ret != LTTNG_OK) {
                ERR("Session unregister trigger error: %d", ret);
                goto end;
index aa6ba07800d6dac81340405c6023e9d9d4dc3fa1..7b0936f48fe70ffcb4607642d38f6dbc1ca96a98 100644 (file)
@@ -7,38 +7,38 @@
  */
 
 #define _LGPL_SOURCE
-#include <lttng/trigger/trigger.h>
-#include <common/error.hpp>
+#include "cmd.hpp"
+#include "health-sessiond.hpp"
+#include "lttng-sessiond.hpp"
+#include "notification-thread-commands.hpp"
+#include "rotate.hpp"
+#include "rotation-thread.hpp"
+#include "session.hpp"
+#include "thread.hpp"
+#include "timer.hpp"
+#include "utils.hpp"
+
+#include <common/align.hpp>
 #include <common/config/session-config.hpp>
 #include <common/defaults.hpp>
-#include <common/utils.hpp>
+#include <common/error.hpp>
 #include <common/futex.hpp>
-#include <common/align.hpp>
-#include <common/time.hpp>
 #include <common/hashtable/utils.hpp>
-#include <sys/stat.h>
-#include <time.h>
-#include <signal.h>
-#include <inttypes.h>
-
 #include <common/kernel-ctl/kernel-ctl.hpp>
-#include <lttng/notification/channel-internal.hpp>
-#include <lttng/rotate-internal.hpp>
-#include <lttng/location-internal.hpp>
+#include <common/time.hpp>
+#include <common/utils.hpp>
+
 #include <lttng/condition/condition-internal.hpp>
+#include <lttng/location-internal.hpp>
+#include <lttng/notification/channel-internal.hpp>
 #include <lttng/notification/notification-internal.hpp>
+#include <lttng/rotate-internal.hpp>
+#include <lttng/trigger/trigger.h>
 
-#include "rotation-thread.hpp"
-#include "lttng-sessiond.hpp"
-#include "health-sessiond.hpp"
-#include "rotate.hpp"
-#include "cmd.hpp"
-#include "session.hpp"
-#include "timer.hpp"
-#include "notification-thread-commands.hpp"
-#include "utils.hpp"
-#include "thread.hpp"
-
+#include <inttypes.h>
+#include <signal.h>
+#include <sys/stat.h>
+#include <time.h>
 #include <urcu.h>
 #include <urcu/list.h>
 
@@ -75,8 +75,7 @@ struct rotation_thread_job {
 };
 } /* namespace */
 
-static
-const char *get_job_type_str(enum rotation_thread_job_type job_type)
+static const char *get_job_type_str(enum rotation_thread_job_type job_type)
 {
        switch (job_type) {
        case ROTATION_THREAD_JOB_TYPE_CHECK_PENDING_ROTATION:
@@ -105,8 +104,7 @@ end:
        return queue;
 }
 
-void rotation_thread_timer_queue_destroy(
-               struct rotation_thread_timer_queue *queue)
+void rotation_thread_timer_queue_destroy(struct rotation_thread_timer_queue *queue)
 {
        if (!queue) {
                return;
@@ -124,16 +122,15 @@ void rotation_thread_timer_queue_destroy(
 /*
  * Destroy the thread data previously created by the init function.
  */
-void rotation_thread_handle_destroy(
-               struct rotation_thread_handle *handle)
+void rotation_thread_handle_destroy(struct rotation_thread_handle *handle)
 {
        lttng_pipe_destroy(handle->quit_pipe);
        free(handle);
 }
 
-struct rotation_thread_handle *rotation_thread_handle_create(
-               struct rotation_thread_timer_queue *rotation_timer_queue,
-               struct notification_thread_handle *notification_thread_handle)
+struct rotation_thread_handle *
+rotation_thread_handle_create(struct rotation_thread_timer_queue *rotation_timer_queue,
+                             struct notification_thread_handle *notification_thread_handle)
 {
        struct rotation_thread_handle *handle;
 
@@ -160,15 +157,14 @@ error:
  * Called with the rotation_thread_timer_queue lock held.
  * Return true if the same timer job already exists in the queue, false if not.
  */
-static
-bool timer_job_exists(const struct rotation_thread_timer_queue *queue,
-               enum rotation_thread_job_type job_type,
-               struct ltt_session *session)
+static bool timer_job_exists(const struct rotation_thread_timer_queue *queue,
+                            enum rotation_thread_job_type job_type,
+                            struct ltt_session *session)
 {
        bool exists = false;
        struct rotation_thread_job *job;
 
-       cds_list_for_each_entry(job, &queue->list, head) {
+       cds_list_for_each_entry (job, &queue->list, head) {
                if (job->session == session && job->type == job_type) {
                        exists = true;
                        goto end;
@@ -179,8 +175,8 @@ end:
 }
 
 void rotation_thread_enqueue_job(struct rotation_thread_timer_queue *queue,
-               enum rotation_thread_job_type job_type,
-               struct ltt_session *session)
+                                enum rotation_thread_job_type job_type,
+                                struct ltt_session *session)
 {
        int ret;
        const char dummy = '!';
@@ -199,7 +195,8 @@ void rotation_thread_enqueue_job(struct rotation_thread_timer_queue *queue,
        job = zmalloc<rotation_thread_job>();
        if (!job) {
                PERROR("Failed to allocate rotation thread job of type \"%s\" for session \"%s\"",
-                               job_type_str, session->name);
+                      job_type_str,
+                      session->name);
                goto end;
        }
        /* No reason for this to fail as the caller must hold a reference. */
@@ -209,8 +206,7 @@ void rotation_thread_enqueue_job(struct rotation_thread_timer_queue *queue,
        job->type = job_type;
        cds_list_add_tail(&job->head, &queue->list);
 
-       ret = lttng_write(lttng_pipe_get_writefd(queue->event_pipe), &dummy,
-                       sizeof(dummy));
+       ret = lttng_write(lttng_pipe_get_writefd(queue->event_pipe), &dummy, sizeof(dummy));
        if (ret < 0) {
                /*
                 * We do not want to block in the timer handler, the job has
@@ -221,7 +217,7 @@ void rotation_thread_enqueue_job(struct rotation_thread_timer_queue *queue,
                DIAGNOSTIC_PUSH
                DIAGNOSTIC_IGNORE_LOGICAL_OP
                if (errno == EAGAIN || errno == EWOULDBLOCK) {
-               DIAGNOSTIC_POP
+                       DIAGNOSTIC_POP
                        /*
                         * Not an error, but would be surprising and indicate
                         * that the rotation thread can't keep up with the
@@ -231,7 +227,8 @@ void rotation_thread_enqueue_job(struct rotation_thread_timer_queue *queue,
                        goto end;
                }
                PERROR("Failed to wake-up the rotation thread after pushing a job of type \"%s\" for session \"%s\"",
-                               job_type_str, session->name);
+                      job_type_str,
+                      session->name);
                goto end;
        }
 
@@ -239,9 +236,7 @@ end:
        pthread_mutex_unlock(&queue->lock);
 }
 
-static
-int init_poll_set(struct lttng_poll_event *poll_set,
-               struct rotation_thread_handle *handle)
+static int init_poll_set(struct lttng_poll_event *poll_set, struct rotation_thread_handle *handle)
 {
        int ret;
 
@@ -256,16 +251,14 @@ int init_poll_set(struct lttng_poll_event *poll_set,
                goto error;
        }
 
-       ret = lttng_poll_add(poll_set,
-                       lttng_pipe_get_readfd(handle->quit_pipe), LPOLLIN);
+       ret = lttng_poll_add(poll_set, lttng_pipe_get_readfd(handle->quit_pipe), LPOLLIN);
        if (ret < 0) {
                ERR("Failed to add quit pipe read fd to poll set");
                goto error;
        }
 
-       ret = lttng_poll_add(poll_set,
-                       lttng_pipe_get_readfd(handle->rotation_timer_queue->event_pipe),
-                       LPOLLIN);
+       ret = lttng_poll_add(
+               poll_set, lttng_pipe_get_readfd(handle->rotation_timer_queue->event_pipe), LPOLLIN);
        if (ret < 0) {
                ERR("Failed to add rotate_pending fd to poll set");
                goto error;
@@ -277,8 +270,7 @@ error:
        return ret;
 }
 
-static
-void fini_thread_state(struct rotation_thread *state)
+static void fini_thread_state(struct rotation_thread *state)
 {
        lttng_poll_clean(&state->events);
        if (rotate_notification_channel) {
@@ -286,9 +278,7 @@ void fini_thread_state(struct rotation_thread *state)
        }
 }
 
-static
-int init_thread_state(struct rotation_thread_handle *handle,
-               struct rotation_thread *state)
+static int init_thread_state(struct rotation_thread_handle *handle, struct rotation_thread *state)
 {
        int ret;
 
@@ -301,15 +291,14 @@ int init_thread_state(struct rotation_thread_handle *handle,
                goto end;
        }
 
-       rotate_notification_channel = lttng_notification_channel_create(
-                       lttng_session_daemon_notification_endpoint);
+       rotate_notification_channel =
+               lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
        if (!rotate_notification_channel) {
                ERR("Could not create notification channel");
                ret = -1;
                goto end;
        }
-       ret = lttng_poll_add(&state->events, rotate_notification_channel->socket,
-                       LPOLLIN);
+       ret = lttng_poll_add(&state->events, rotate_notification_channel->socket, LPOLLIN);
        if (ret < 0) {
                ERR("Failed to add notification fd to pollset");
                goto end;
@@ -319,9 +308,8 @@ end:
        return ret;
 }
 
-static
-void check_session_rotation_pending_on_consumers(struct ltt_session *session,
-               bool *_rotation_completed)
+static void check_session_rotation_pending_on_consumers(struct ltt_session *session,
+                                                       bool *_rotation_completed)
 {
        int ret = 0;
        struct consumer_socket *socket;
@@ -341,17 +329,18 @@ void check_session_rotation_pending_on_consumers(struct ltt_session *session,
        if (!session->ust_session) {
                goto skip_ust;
        }
-       cds_lfht_for_each_entry(session->ust_session->consumer->socks->ht,
-                       &iter, socket, node.node) {
+       cds_lfht_for_each_entry (
+               session->ust_session->consumer->socks->ht, &iter, socket, node.node) {
                relayd_id = session->ust_session->consumer->type == CONSUMER_DST_LOCAL ?
-                               -1ULL :
-                               session->ust_session->consumer->net_seq_index;
+                       -1ULL :
+                       session->ust_session->consumer->net_seq_index;
 
                pthread_mutex_lock(socket->lock);
                ret = consumer_trace_chunk_exists(socket,
-                               relayd_id,
-                               session->id, session->chunk_being_archived,
-                               &exists_status);
+                                                 relayd_id,
+                                                 session->id,
+                                                 session->chunk_being_archived,
+                                                 &exists_status);
                if (ret) {
                        pthread_mutex_unlock(socket->lock);
                        ERR("Error occurred while checking rotation status on consumer daemon");
@@ -370,17 +359,18 @@ skip_ust:
        if (!session->kernel_session) {
                goto skip_kernel;
        }
-       cds_lfht_for_each_entry(session->kernel_session->consumer->socks->ht,
-                               &iter, socket, node.node) {
+       cds_lfht_for_each_entry (
+               session->kernel_session->consumer->socks->ht, &iter, socket, node.node) {
                pthread_mutex_lock(socket->lock);
                relayd_id = session->kernel_session->consumer->type == CONSUMER_DST_LOCAL ?
-                               -1ULL :
-                               session->kernel_session->consumer->net_seq_index;
+                       -1ULL :
+                       session->kernel_session->consumer->net_seq_index;
 
                ret = consumer_trace_chunk_exists(socket,
-                               relayd_id,
-                               session->id, session->chunk_being_archived,
-                               &exists_status);
+                                                 relayd_id,
+                                                 session->id,
+                                                 session->chunk_being_archived,
+                                                 &exists_status);
                if (ret) {
                        pthread_mutex_unlock(socket->lock);
                        ERR("Error occurred while checking rotation status on consumer daemon");
@@ -401,21 +391,19 @@ end:
        if (!chunk_exists_on_peer) {
                uint64_t chunk_being_archived_id;
 
-               chunk_status = lttng_trace_chunk_get_id(
-                               session->chunk_being_archived,
-                               &chunk_being_archived_id);
+               chunk_status = lttng_trace_chunk_get_id(session->chunk_being_archived,
+                                                       &chunk_being_archived_id);
                LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
-               DBG("Rotation of trace archive %" PRIu64 " of session \"%s\" is complete on all consumers",
-                               chunk_being_archived_id,
-                               session->name);
+               DBG("Rotation of trace archive %" PRIu64
+                   " of session \"%s\" is complete on all consumers",
+                   chunk_being_archived_id,
+                   session->name);
        }
        *_rotation_completed = !chunk_exists_on_peer;
        if (ret) {
-               ret = session_reset_rotation_state(session,
-                               LTTNG_ROTATION_STATE_ERROR);
+               ret = session_reset_rotation_state(session, LTTNG_ROTATION_STATE_ERROR);
                if (ret) {
-                       ERR("Failed to reset rotation state of session \"%s\"",
-                                       session->name);
+                       ERR("Failed to reset rotation state of session \"%s\"", session->name);
                }
        }
 }
@@ -425,9 +413,9 @@ end:
  * Should only return non-zero in the event of a fatal error. Doing so will
  * shutdown the thread.
  */
-static
-int check_session_rotation_pending(struct ltt_session *session,
-               struct notification_thread_handle *notification_thread_handle)
+static int
+check_session_rotation_pending(struct ltt_session *session,
+                              struct notification_thread_handle *notification_thread_handle)
 {
        int ret;
        struct lttng_trace_archive_location *location;
@@ -441,12 +429,13 @@ int check_session_rotation_pending(struct ltt_session *session,
                goto end;
        }
 
-       chunk_status = lttng_trace_chunk_get_id(session->chunk_being_archived,
-                       &chunk_being_archived_id);
+       chunk_status =
+               lttng_trace_chunk_get_id(session->chunk_being_archived, &chunk_being_archived_id);
        LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
 
        DBG("Checking for pending rotation on session \"%s\", trace archive %" PRIu64,
-                       session->name, chunk_being_archived_id);
+           session->name,
+           chunk_being_archived_id);
 
        /*
         * The rotation-pending check timer of a session is launched in
@@ -461,10 +450,8 @@ int check_session_rotation_pending(struct ltt_session *session,
                goto check_ongoing_rotation;
        }
 
-       check_session_rotation_pending_on_consumers(session,
-                       &rotation_completed);
-       if (!rotation_completed ||
-                       session->rotation_state == LTTNG_ROTATION_STATE_ERROR) {
+       check_session_rotation_pending_on_consumers(session, &rotation_completed);
+       if (!rotation_completed || session->rotation_state == LTTNG_ROTATION_STATE_ERROR) {
                goto check_ongoing_rotation;
        }
 
@@ -472,8 +459,8 @@ int check_session_rotation_pending(struct ltt_session *session,
         * Now we can clear the "ONGOING" state in the session. New
         * rotations can start now.
         */
-       chunk_status = lttng_trace_chunk_get_name(session->chunk_being_archived,
-                       &archived_chunk_name, NULL);
+       chunk_status = lttng_trace_chunk_get_name(
+               session->chunk_being_archived, &archived_chunk_name, NULL);
        LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
        free(session->last_archived_chunk_name);
        session->last_archived_chunk_name = strdup(archived_chunk_name);
@@ -485,29 +472,29 @@ int check_session_rotation_pending(struct ltt_session *session,
        if (!session->quiet_rotation) {
                location = session_get_trace_archive_location(session);
                ret = notification_thread_command_session_rotation_completed(
-                               notification_thread_handle,
-                               session->id,
-                               session->last_archived_chunk_id.value,
-                               location);
+                       notification_thread_handle,
+                       session->id,
+                       session->last_archived_chunk_id.value,
+                       location);
                lttng_trace_archive_location_put(location);
                if (ret != LTTNG_OK) {
                        ERR("Failed to notify notification thread of completed rotation for session %s",
-                                       session->name);
+                           session->name);
                }
        }
 
        ret = 0;
 check_ongoing_rotation:
        if (session->rotation_state == LTTNG_ROTATION_STATE_ONGOING) {
-               chunk_status = lttng_trace_chunk_get_id(
-                               session->chunk_being_archived,
-                               &chunk_being_archived_id);
+               chunk_status = lttng_trace_chunk_get_id(session->chunk_being_archived,
+                                                       &chunk_being_archived_id);
                LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
 
                DBG("Rotation of trace archive %" PRIu64 " is still pending for session %s",
-                               chunk_being_archived_id, session->name);
+                   chunk_being_archived_id,
+                   session->name);
                ret = timer_session_rotation_pending_check_start(session,
-                               DEFAULT_ROTATE_PENDING_TIMER);
+                                                                DEFAULT_ROTATE_PENDING_TIMER);
                if (ret) {
                        ERR("Failed to re-enable rotation pending timer");
                        ret = -1;
@@ -520,31 +507,30 @@ end:
 }
 
 /* Call with the session and session_list locks held. */
-static
-int launch_session_rotation(struct ltt_session *session)
+static int launch_session_rotation(struct ltt_session *session)
 {
        int ret;
        struct lttng_rotate_session_return rotation_return;
 
-       DBG("Launching scheduled time-based rotation on session \"%s\"",
-                       session->name);
+       DBG("Launching scheduled time-based rotation on session \"%s\"", session->name);
 
-       ret = cmd_rotate_session(session, &rotation_return, false,
-               LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
+       ret = cmd_rotate_session(
+               session, &rotation_return, false, LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
        if (ret == LTTNG_OK) {
                DBG("Scheduled time-based rotation successfully launched on session \"%s\"",
-                               session->name);
+                   session->name);
        } else {
                /* Don't consider errors as fatal. */
                DBG("Scheduled time-based rotation aborted for session %s: %s",
-                               session->name, lttng_strerror(ret));
+                   session->name,
+                   lttng_strerror(ret));
        }
        return 0;
 }
 
-static
-int run_job(struct rotation_thread_job *job, struct ltt_session *session,
-               struct notification_thread_handle *notification_thread_handle)
+static int run_job(struct rotation_thread_job *job,
+                  struct ltt_session *session,
+                  struct notification_thread_handle *notification_thread_handle)
 {
        int ret;
 
@@ -553,8 +539,7 @@ int run_job(struct rotation_thread_job *job, struct ltt_session *session,
                ret = launch_session_rotation(session);
                break;
        case ROTATION_THREAD_JOB_TYPE_CHECK_PENDING_ROTATION:
-               ret = check_session_rotation_pending(session,
-                               notification_thread_handle);
+               ret = check_session_rotation_pending(session, notification_thread_handle);
                break;
        default:
                abort();
@@ -562,10 +547,9 @@ int run_job(struct rotation_thread_job *job, struct ltt_session *session,
        return ret;
 }
 
-static
-int handle_job_queue(struct rotation_thread_handle *handle,
-               struct rotation_thread *state __attribute__((unused)),
-               struct rotation_thread_timer_queue *queue)
+static int handle_job_queue(struct rotation_thread_handle *handle,
+                           struct rotation_thread *state __attribute__((unused)),
+                           struct rotation_thread_timer_queue *queue)
 {
        int ret = 0;
 
@@ -579,16 +563,14 @@ int handle_job_queue(struct rotation_thread_handle *handle,
                        pthread_mutex_unlock(&queue->lock);
                        break;
                }
-               job = cds_list_first_entry(&queue->list,
-                               typeof(*job), head);
+               job = cds_list_first_entry(&queue->list, typeof(*job), head);
                cds_list_del(&job->head);
                pthread_mutex_unlock(&queue->lock);
 
                session_lock_list();
                session = job->session;
                if (!session) {
-                       DBG("Session \"%s\" not found",
-                                       session->name != NULL ? session->name : "");
+                       DBG("Session \"%s\" not found", session->name != NULL ? session->name : "");
                        /*
                         * This is a non-fatal error, and we cannot report it to
                         * the user (timer), so just print the error and
@@ -623,9 +605,8 @@ end:
        return ret;
 }
 
-static
-int handle_condition(const struct lttng_notification *notification,
-               struct notification_thread_handle *notification_thread_handle)
+static int handle_condition(const struct lttng_notification *notification,
+                           struct notification_thread_handle *notification_thread_handle)
 {
        int ret = 0;
        const char *condition_session_name = NULL;
@@ -635,9 +616,9 @@ int handle_condition(const struct lttng_notification *notification,
        uint64_t consumed;
        struct ltt_session *session;
        const struct lttng_condition *condition =
-                       lttng_notification_get_const_condition(notification);
+               lttng_notification_get_const_condition(notification);
        const struct lttng_evaluation *evaluation =
-                       lttng_notification_get_const_evaluation(notification);
+               lttng_notification_get_const_evaluation(notification);
 
        condition_type = lttng_condition_get_type(condition);
 
@@ -649,14 +630,14 @@ int handle_condition(const struct lttng_notification *notification,
 
        /* Fetch info to test */
        condition_status = lttng_condition_session_consumed_size_get_session_name(
-                       condition, &condition_session_name);
+               condition, &condition_session_name);
        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
                ERR("Session name could not be fetched");
                ret = -1;
                goto end;
        }
-       evaluation_status = lttng_evaluation_session_consumed_size_get_consumed_size(evaluation,
-                       &consumed);
+       evaluation_status =
+               lttng_evaluation_session_consumed_size_get_consumed_size(evaluation, &consumed);
        if (evaluation_status != LTTNG_EVALUATION_STATUS_OK) {
                ERR("Failed to get evaluation");
                ret = -1;
@@ -667,8 +648,8 @@ int handle_condition(const struct lttng_notification *notification,
        session = session_find_by_name(condition_session_name);
        if (!session) {
                DBG("Failed to find session while handling notification: notification type = %s, session name = `%s`",
-                               lttng_condition_type_str(condition_type),
-                               condition_session_name);
+                   lttng_condition_type_str(condition_type),
+                   condition_session_name);
                /*
                 * Not a fatal error: a session can be destroyed before we get
                 * the chance to handle the notification.
@@ -680,20 +661,19 @@ int handle_condition(const struct lttng_notification *notification,
        session_lock(session);
 
        if (!lttng_trigger_is_equal(session->rotate_trigger,
-                       lttng_notification_get_const_trigger(notification))) {
+                                   lttng_notification_get_const_trigger(notification))) {
                /* Notification does not originate from our rotation trigger. */
                ret = 0;
                goto end_unlock;
        }
 
-       ret = unsubscribe_session_consumed_size_rotation(session,
-                       notification_thread_handle);
+       ret = unsubscribe_session_consumed_size_rotation(session, notification_thread_handle);
        if (ret) {
                goto end_unlock;
        }
 
        ret = cmd_rotate_session(
-                       session, NULL, false, LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
+               session, NULL, false, LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED);
        switch (ret) {
        case LTTNG_OK:
                break;
@@ -713,7 +693,7 @@ int handle_condition(const struct lttng_notification *notification,
        }
 
        ret = subscribe_session_consumed_size_rotation(
-                       session, consumed + session->rotate_size, notification_thread_handle);
+               session, consumed + session->rotate_size, notification_thread_handle);
        if (ret) {
                ERR("Failed to subscribe to session consumed size condition");
                goto end_unlock;
@@ -728,18 +708,17 @@ end:
        return ret;
 }
 
-static
-int handle_notification_channel(int fd __attribute__((unused)),
-               struct rotation_thread_handle *handle,
-               struct rotation_thread *state __attribute__((unused)))
+static int handle_notification_channel(int fd __attribute__((unused)),
+                                      struct rotation_thread_handle *handle,
+                                      struct rotation_thread *state __attribute__((unused)))
 {
        int ret;
        bool notification_pending;
        struct lttng_notification *notification = NULL;
        enum lttng_notification_channel_status status;
 
-       status = lttng_notification_channel_has_pending_notification(
-                       rotate_notification_channel, &notification_pending);
+       status = lttng_notification_channel_has_pending_notification(rotate_notification_channel,
+                                                                    &notification_pending);
        if (status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) {
                ERR("Error occurred while checking for pending notification");
                ret = -1;
@@ -752,9 +731,8 @@ int handle_notification_channel(int fd __attribute__((unused)),
        }
 
        /* Receive the next notification. */
-       status = lttng_notification_channel_get_next_notification(
-                       rotate_notification_channel,
-                       &notification);
+       status = lttng_notification_channel_get_next_notification(rotate_notification_channel,
+                                                                 &notification);
 
        switch (status) {
        case LTTNG_NOTIFICATION_CHANNEL_STATUS_OK:
@@ -762,7 +740,8 @@ int handle_notification_channel(int fd __attribute__((unused)),
        case LTTNG_NOTIFICATION_CHANNEL_STATUS_NOTIFICATIONS_DROPPED:
                /* Not an error, we will wait for the next one */
                ret = 0;
-               goto end;;
+               goto end;
+               ;
        case LTTNG_NOTIFICATION_CHANNEL_STATUS_CLOSED:
                ERR("Notification channel was closed");
                ret = -1;
@@ -774,16 +753,14 @@ int handle_notification_channel(int fd __attribute__((unused)),
                goto end;
        }
 
-       ret = handle_condition(notification,
-                       handle->notification_thread_handle);
+       ret = handle_condition(notification, handle->notification_thread_handle);
 
 end:
        lttng_notification_destroy(notification);
        return ret;
 }
 
-static
-void *thread_rotation(void *data)
+static void *thread_rotation(void *data)
 {
        int ret;
        struct rotation_thread_handle *handle = (rotation_thread_handle *) data;
@@ -801,9 +778,7 @@ void *thread_rotation(void *data)
                goto end;
        }
 
-       queue_pipe_fd = lttng_pipe_get_readfd(
-                       handle->rotation_timer_queue->event_pipe);
-
+       queue_pipe_fd = lttng_pipe_get_readfd(handle->rotation_timer_queue->event_pipe);
 
        ret = init_thread_state(handle, &thread);
        if (ret) {
@@ -834,8 +809,7 @@ void *thread_rotation(void *data)
                        int fd = LTTNG_POLL_GETFD(&thread.events, i);
                        uint32_t revents = LTTNG_POLL_GETEV(&thread.events, i);
 
-                       DBG("Handling fd (%i) activity (%u)",
-                                       fd, revents);
+                       DBG("Handling fd (%i) activity (%u)", fd, revents);
 
                        if (revents & LPOLLERR) {
                                ERR("Polling returned an error on fd %i", fd);
@@ -843,8 +817,7 @@ void *thread_rotation(void *data)
                        }
 
                        if (fd == rotate_notification_channel->socket) {
-                               ret = handle_notification_channel(fd, handle,
-                                               &thread);
+                               ret = handle_notification_channel(fd, handle, &thread);
                                if (ret) {
                                        ERR("Error occurred while handling activity on notification channel socket");
                                        goto error;
@@ -858,8 +831,8 @@ void *thread_rotation(void *data)
                                 * flushed and all references held in the queue
                                 * are released.
                                 */
-                               ret = handle_job_queue(handle, &thread,
-                                               handle->rotation_timer_queue);
+                               ret = handle_job_queue(
+                                       handle, &thread, handle->rotation_timer_queue);
                                if (ret) {
                                        ERR("Failed to handle rotation timer pipe event");
                                        goto error;
@@ -870,7 +843,8 @@ void *thread_rotation(void *data)
 
                                        ret = lttng_read(fd, &buf, 1);
                                        if (ret != 1) {
-                                               ERR("Failed to read from wakeup pipe (fd = %i)", fd);
+                                               ERR("Failed to read from wakeup pipe (fd = %i)",
+                                                   fd);
                                                goto error;
                                        }
                                } else {
@@ -891,8 +865,7 @@ end:
        return NULL;
 }
 
-static
-bool shutdown_rotation_thread(void *thread_data)
+static bool shutdown_rotation_thread(void *thread_data)
 {
        struct rotation_thread_handle *handle = (rotation_thread_handle *) thread_data;
        const int write_fd = lttng_pipe_get_writefd(handle->quit_pipe);
@@ -904,11 +877,8 @@ bool launch_rotation_thread(struct rotation_thread_handle *handle)
 {
        struct lttng_thread *thread;
 
-       thread = lttng_thread_create("Rotation",
-                       thread_rotation,
-                       shutdown_rotation_thread,
-                       NULL,
-                       handle);
+       thread = lttng_thread_create(
+               "Rotation", thread_rotation, shutdown_rotation_thread, NULL, handle);
        if (!thread) {
                goto error;
        }
index 5db70faef47e98f0c865e65e69916365beab3a89..bef38e61934b554f1564788411fb8346580cdbb0 100644 (file)
@@ -6,99 +6,95 @@
  */
 
 #define _LGPL_SOURCE
-#include <inttypes.h>
-#include <string.h>
-#include <urcu/uatomic.h>
-#include <unistd.h>
+#include "agent.hpp"
+#include "kernel.hpp"
+#include "lttng-syscall.hpp"
+#include "save.hpp"
+#include "session.hpp"
+#include "trace-ust.hpp"
 
+#include <common/config/session-config.hpp>
 #include <common/defaults.hpp>
 #include <common/error.hpp>
-#include <common/config/session-config.hpp>
-#include <common/utils.hpp>
 #include <common/runas.hpp>
+#include <common/utils.hpp>
+
 #include <lttng/save-internal.hpp>
 
-#include "kernel.hpp"
-#include "save.hpp"
-#include "session.hpp"
-#include "lttng-syscall.hpp"
-#include "trace-ust.hpp"
-#include "agent.hpp"
+#include <inttypes.h>
+#include <string.h>
+#include <unistd.h>
+#include <urcu/uatomic.h>
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_kernel_channel_attributes(struct config_writer *writer,
-       struct lttng_channel_attr *attr)
+static int save_kernel_channel_attributes(struct config_writer *writer,
+                                         struct lttng_channel_attr *attr)
 {
        int ret;
 
        ret = config_writer_write_element_string(writer,
-               config_element_overwrite_mode,
-               attr->overwrite ? config_overwrite_mode_overwrite :
-                       config_overwrite_mode_discard);
+                                                config_element_overwrite_mode,
+                                                attr->overwrite ? config_overwrite_mode_overwrite :
+                                                                  config_overwrite_mode_discard);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_subbuf_size, attr->subbuf_size);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_subbuf_size, attr->subbuf_size);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_num_subbuf,
-               attr->num_subbuf);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_num_subbuf, attr->num_subbuf);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_switch_timer_interval,
-               attr->switch_timer_interval);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_switch_timer_interval, attr->switch_timer_interval);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_read_timer_interval,
-               attr->read_timer_interval);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_read_timer_interval, attr->read_timer_interval);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
        ret = config_writer_write_element_string(writer,
-               config_element_output_type,
-               attr->output == LTTNG_EVENT_SPLICE ?
-               config_output_type_splice : config_output_type_mmap);
+                                                config_element_output_type,
+                                                attr->output == LTTNG_EVENT_SPLICE ?
+                                                        config_output_type_splice :
+                                                        config_output_type_mmap);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_tracefile_size, attr->tracefile_size);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_tracefile_size, attr->tracefile_size);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_tracefile_count,
-               attr->tracefile_count);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_tracefile_count, attr->tracefile_count);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_live_timer_interval,
-               attr->live_timer_interval);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_live_timer_interval, attr->live_timer_interval);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -108,17 +104,15 @@ int save_kernel_channel_attributes(struct config_writer *writer,
                struct lttng_channel_extended *ext = NULL;
 
                ext = (struct lttng_channel_extended *) attr->extended.ptr;
-               ret = config_writer_write_element_unsigned_int(writer,
-                               config_element_monitor_timer_interval,
-                               ext->monitor_timer_interval);
+               ret = config_writer_write_element_unsigned_int(
+                       writer, config_element_monitor_timer_interval, ext->monitor_timer_interval);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
                }
 
-               ret = config_writer_write_element_signed_int(writer,
-                               config_element_blocking_timeout,
-                               ext->blocking_timeout);
+               ret = config_writer_write_element_signed_int(
+                       writer, config_element_blocking_timeout, ext->blocking_timeout);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
@@ -131,65 +125,61 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_ust_channel_attributes(struct config_writer *writer,
-       struct lttng_ust_abi_channel_attr *attr)
+static int save_ust_channel_attributes(struct config_writer *writer,
+                                      struct lttng_ust_abi_channel_attr *attr)
 {
        int ret;
        struct ltt_ust_channel *channel = NULL;
 
        ret = config_writer_write_element_string(writer,
-               config_element_overwrite_mode,
-               attr->overwrite ? config_overwrite_mode_overwrite :
-                       config_overwrite_mode_discard);
+                                                config_element_overwrite_mode,
+                                                attr->overwrite ? config_overwrite_mode_overwrite :
+                                                                  config_overwrite_mode_discard);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_subbuf_size, attr->subbuf_size);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_subbuf_size, attr->subbuf_size);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_num_subbuf,
-               attr->num_subbuf);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_num_subbuf, attr->num_subbuf);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_switch_timer_interval,
-               attr->switch_timer_interval);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_switch_timer_interval, attr->switch_timer_interval);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_read_timer_interval,
-               attr->read_timer_interval);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_read_timer_interval, attr->read_timer_interval);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
        ret = config_writer_write_element_string(writer,
-               config_element_output_type,
-               attr->output == LTTNG_UST_ABI_MMAP ?
-               config_output_type_mmap : config_output_type_splice);
+                                                config_element_output_type,
+                                                attr->output == LTTNG_UST_ABI_MMAP ?
+                                                        config_output_type_mmap :
+                                                        config_output_type_splice);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_signed_int(writer,
-                       config_element_blocking_timeout,
-                       attr->u.s.blocking_timeout);
+       ret = config_writer_write_element_signed_int(
+               writer, config_element_blocking_timeout, attr->u.s.blocking_timeout);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -200,9 +190,8 @@ int save_ust_channel_attributes(struct config_writer *writer,
         * lttng_ust_channel_attr
         */
        channel = lttng::utils::container_of(attr, &ltt_ust_channel::attr);
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_monitor_timer_interval,
-               channel->monitor_timer_interval);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_monitor_timer_interval, channel->monitor_timer_interval);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -213,9 +202,8 @@ end:
        return ret;
 }
 
-static
-const char *get_kernel_instrumentation_string(
-       enum lttng_kernel_abi_instrumentation instrumentation)
+static const char *
+get_kernel_instrumentation_string(enum lttng_kernel_abi_instrumentation instrumentation)
 {
        const char *instrumentation_string;
 
@@ -251,9 +239,7 @@ const char *get_kernel_instrumentation_string(
        return instrumentation_string;
 }
 
-static
-const char *get_kernel_context_type_string(
-       enum lttng_kernel_abi_context_type context_type)
+static const char *get_kernel_context_type_string(enum lttng_kernel_abi_context_type context_type)
 {
        const char *context_type_string;
 
@@ -373,9 +359,7 @@ const char *get_kernel_context_type_string(
        return context_type_string;
 }
 
-static
-const char *get_ust_context_type_string(
-       enum lttng_ust_abi_context_type context_type)
+static const char *get_ust_context_type_string(enum lttng_ust_abi_context_type context_type)
 {
        const char *context_type_string;
 
@@ -453,9 +437,7 @@ const char *get_ust_context_type_string(
        return context_type_string;
 }
 
-static
-const char *get_buffer_type_string(
-       enum lttng_buffer_type buffer_type)
+static const char *get_buffer_type_string(enum lttng_buffer_type buffer_type)
 {
        const char *buffer_type_string;
 
@@ -476,9 +458,7 @@ const char *get_buffer_type_string(
        return buffer_type_string;
 }
 
-static
-const char *get_loglevel_type_string(
-       enum lttng_ust_abi_loglevel_type loglevel_type)
+static const char *get_loglevel_type_string(enum lttng_ust_abi_loglevel_type loglevel_type)
 {
        const char *loglevel_type_string;
 
@@ -500,9 +480,7 @@ const char *get_loglevel_type_string(
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_kernel_function_event(struct config_writer *writer,
-               struct ltt_kernel_event *event)
+static int save_kernel_function_event(struct config_writer *writer, struct ltt_kernel_event *event)
 {
        int ret;
 
@@ -512,8 +490,8 @@ int save_kernel_function_event(struct config_writer *writer,
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer, config_element_name,
-                       event->event->u.ftrace.symbol_name);
+       ret = config_writer_write_element_string(
+               writer, config_element_name, event->event->u.ftrace.symbol_name);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -529,9 +507,7 @@ end:
        return ret;
 }
 
-static
-int save_kernel_kprobe_event(struct config_writer *writer,
-               struct ltt_kernel_event *event)
+static int save_kernel_kprobe_event(struct config_writer *writer, struct ltt_kernel_event *event)
 {
        int ret;
        const char *symbol_name;
@@ -567,23 +543,23 @@ int save_kernel_kprobe_event(struct config_writer *writer,
        }
 
        if (addr) {
-               ret = config_writer_write_element_unsigned_int( writer,
-                               config_element_address, addr);
+               ret = config_writer_write_element_unsigned_int(
+                       writer, config_element_address, addr);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
                }
        } else if (symbol_name) {
-               ret = config_writer_write_element_string(writer,
-                                config_element_symbol_name, symbol_name);
+               ret = config_writer_write_element_string(
+                       writer, config_element_symbol_name, symbol_name);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
                }
                /* If the offset is non-zero, write it.*/
                if (offset) {
-                       ret = config_writer_write_element_unsigned_int(writer,
-                               config_element_offset, offset);
+                       ret = config_writer_write_element_unsigned_int(
+                               writer, config_element_offset, offset);
                        if (ret) {
                                ret = LTTNG_ERR_SAVE_IO_FAIL;
                                goto end;
@@ -599,7 +575,6 @@ int save_kernel_kprobe_event(struct config_writer *writer,
                goto end;
        }
 
-
        ret = config_writer_close_element(writer);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
@@ -613,9 +588,8 @@ end:
  * Save the userspace probe tracepoint event associated with the event to the
  * config writer.
  */
-static
-int save_kernel_userspace_probe_tracepoint_event(struct config_writer *writer,
-               struct ltt_kernel_event *event)
+static int save_kernel_userspace_probe_tracepoint_event(struct config_writer *writer,
+                                                       struct ltt_kernel_event *event)
 {
        int ret = 0;
        const char *probe_name, *provider_name, *binary_path;
@@ -641,31 +615,29 @@ int save_kernel_userspace_probe_tracepoint_event(struct config_writer *writer,
 
        /* Get the binary path, probe name and provider name. */
        binary_path =
-               lttng_userspace_probe_location_tracepoint_get_binary_path(
-                               userspace_probe_location);
+               lttng_userspace_probe_location_tracepoint_get_binary_path(userspace_probe_location);
        if (!binary_path) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
        probe_name =
-               lttng_userspace_probe_location_tracepoint_get_probe_name(
-                               userspace_probe_location);
+               lttng_userspace_probe_location_tracepoint_get_probe_name(userspace_probe_location);
        if (!probe_name) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       provider_name =
-               lttng_userspace_probe_location_tracepoint_get_provider_name(
-                               userspace_probe_location);
+       provider_name = lttng_userspace_probe_location_tracepoint_get_provider_name(
+               userspace_probe_location);
        if (!provider_name) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
        /* Open a userspace probe tracepoint attribute. */
-       ret = config_writer_open_element(writer, config_element_userspace_probe_tracepoint_attributes);
+       ret = config_writer_open_element(writer,
+                                        config_element_userspace_probe_tracepoint_attributes);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -673,9 +645,10 @@ int save_kernel_userspace_probe_tracepoint_event(struct config_writer *writer,
 
        switch (lookup_type) {
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT:
-               ret = config_writer_write_element_string(writer,
-                               config_element_userspace_probe_lookup,
-                               config_element_userspace_probe_lookup_tracepoint_sdt);
+               ret = config_writer_write_element_string(
+                       writer,
+                       config_element_userspace_probe_lookup,
+                       config_element_userspace_probe_lookup_tracepoint_sdt);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
@@ -688,25 +661,24 @@ int save_kernel_userspace_probe_tracepoint_event(struct config_writer *writer,
        }
 
        /* Write the binary path, provider name and the probe name. */
-       ret = config_writer_write_element_string(writer,
-                       config_element_userspace_probe_location_binary_path,
-                       binary_path);
+       ret = config_writer_write_element_string(
+               writer, config_element_userspace_probe_location_binary_path, binary_path);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer,
-                       config_element_userspace_probe_tracepoint_location_provider_name,
-                       provider_name);
+       ret = config_writer_write_element_string(
+               writer,
+               config_element_userspace_probe_tracepoint_location_provider_name,
+               provider_name);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer,
-                       config_element_userspace_probe_tracepoint_location_probe_name,
-                       probe_name);
+       ret = config_writer_write_element_string(
+               writer, config_element_userspace_probe_tracepoint_location_probe_name, probe_name);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -727,9 +699,8 @@ end:
  * Save the userspace probe function event associated with the event to the
  * config writer.
  */
-static
-int save_kernel_userspace_probe_function_event(struct config_writer *writer,
-               struct ltt_kernel_event *event)
+static int save_kernel_userspace_probe_function_event(struct config_writer *writer,
+                                                     struct ltt_kernel_event *event)
 {
        int ret = 0;
        const char *function_name, *binary_path;
@@ -745,8 +716,7 @@ int save_kernel_userspace_probe_function_event(struct config_writer *writer,
        }
 
        /* Get lookup method and lookup method type. */
-       lookup_method = lttng_userspace_probe_location_get_lookup_method(
-                       userspace_probe_location);
+       lookup_method = lttng_userspace_probe_location_get_lookup_method(userspace_probe_location);
        if (!lookup_method) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -754,16 +724,14 @@ int save_kernel_userspace_probe_function_event(struct config_writer *writer,
 
        /* Get the binary path and the function name. */
        binary_path =
-               lttng_userspace_probe_location_function_get_binary_path(
-                               userspace_probe_location);
+               lttng_userspace_probe_location_function_get_binary_path(userspace_probe_location);
        if (!binary_path) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
        function_name =
-               lttng_userspace_probe_location_function_get_function_name(
-                               userspace_probe_location);
+               lttng_userspace_probe_location_function_get_function_name(userspace_probe_location);
        if (!function_name) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -771,7 +739,7 @@ int save_kernel_userspace_probe_function_event(struct config_writer *writer,
 
        /* Open a userspace probe function attribute. */
        ret = config_writer_open_element(writer,
-                       config_element_userspace_probe_function_attributes);
+                                        config_element_userspace_probe_function_attributes);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -780,18 +748,20 @@ int save_kernel_userspace_probe_function_event(struct config_writer *writer,
        lookup_type = lttng_userspace_probe_location_lookup_method_get_type(lookup_method);
        switch (lookup_type) {
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF:
-               ret = config_writer_write_element_string(writer,
-                               config_element_userspace_probe_lookup,
-                               config_element_userspace_probe_lookup_function_elf);
+               ret = config_writer_write_element_string(
+                       writer,
+                       config_element_userspace_probe_lookup,
+                       config_element_userspace_probe_lookup_function_elf);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
                }
                break;
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT:
-               ret = config_writer_write_element_string(writer,
-                               config_element_userspace_probe_lookup,
-                               config_element_userspace_probe_lookup_function_default);
+               ret = config_writer_write_element_string(
+                       writer,
+                       config_element_userspace_probe_lookup,
+                       config_element_userspace_probe_lookup_function_default);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
@@ -804,17 +774,17 @@ int save_kernel_userspace_probe_function_event(struct config_writer *writer,
        }
 
        /* Write the binary path and the function name. */
-       ret = config_writer_write_element_string(writer,
-                       config_element_userspace_probe_location_binary_path,
-                       binary_path);
+       ret = config_writer_write_element_string(
+               writer, config_element_userspace_probe_location_binary_path, binary_path);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer,
-                       config_element_userspace_probe_function_location_function_name,
-                       function_name);
+       ret = config_writer_write_element_string(
+               writer,
+               config_element_userspace_probe_function_location_function_name,
+               function_name);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -831,9 +801,8 @@ end:
        return ret;
 }
 
-static
-int save_kernel_userspace_probe_event(struct config_writer *writer,
-               struct ltt_kernel_event *event)
+static int save_kernel_userspace_probe_event(struct config_writer *writer,
+                                            struct ltt_kernel_event *event)
 {
        int ret;
        struct lttng_userspace_probe_location *userspace_probe_location;
@@ -845,7 +814,7 @@ int save_kernel_userspace_probe_event(struct config_writer *writer,
                goto end;
        }
 
-       switch(lttng_userspace_probe_location_get_type(userspace_probe_location)) {
+       switch (lttng_userspace_probe_location_get_type(userspace_probe_location)) {
        case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION:
        {
                ret = save_kernel_userspace_probe_function_event(writer, event);
@@ -875,9 +844,7 @@ end:
        return ret;
 }
 
-static
-int save_kernel_event(struct config_writer *writer,
-               struct ltt_kernel_event *event)
+static int save_kernel_event(struct config_writer *writer, struct ltt_kernel_event *event)
 {
        int ret;
        const char *instrumentation_type;
@@ -889,39 +856,35 @@ int save_kernel_event(struct config_writer *writer,
        }
 
        if (event->event->name[0]) {
-               ret = config_writer_write_element_string(writer,
-                       config_element_name, event->event->name);
+               ret = config_writer_write_element_string(
+                       writer, config_element_name, event->event->name);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
                }
        }
 
-       ret = config_writer_write_element_bool(writer, config_element_enabled,
-               event->enabled);
+       ret = config_writer_write_element_bool(writer, config_element_enabled, event->enabled);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       instrumentation_type = get_kernel_instrumentation_string(
-               event->event->instrumentation);
+       instrumentation_type = get_kernel_instrumentation_string(event->event->instrumentation);
        if (!instrumentation_type) {
                ret = LTTNG_ERR_INVALID;
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer, config_element_type,
-               instrumentation_type);
+       ret = config_writer_write_element_string(writer, config_element_type, instrumentation_type);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
        if (event->filter_expression) {
-               ret = config_writer_write_element_string(writer,
-                               config_element_filter,
-                               event->filter_expression);
+               ret = config_writer_write_element_string(
+                       writer, config_element_filter, event->filter_expression);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
@@ -929,12 +892,10 @@ int save_kernel_event(struct config_writer *writer,
        }
 
        if (event->event->instrumentation == LTTNG_KERNEL_ABI_FUNCTION ||
-               event->event->instrumentation == LTTNG_KERNEL_ABI_KPROBE ||
-               event->event->instrumentation == LTTNG_KERNEL_ABI_UPROBE ||
-               event->event->instrumentation == LTTNG_KERNEL_ABI_KRETPROBE) {
-
-               ret = config_writer_open_element(writer,
-                       config_element_attributes);
+           event->event->instrumentation == LTTNG_KERNEL_ABI_KPROBE ||
+           event->event->instrumentation == LTTNG_KERNEL_ABI_UPROBE ||
+           event->event->instrumentation == LTTNG_KERNEL_ABI_KRETPROBE) {
+               ret = config_writer_open_element(writer, config_element_attributes);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
@@ -988,9 +949,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_kernel_events(struct config_writer *writer,
-       struct ltt_kernel_channel *kchan)
+static int save_kernel_events(struct config_writer *writer, struct ltt_kernel_channel *kchan)
 {
        int ret;
        struct ltt_kernel_event *event;
@@ -1001,7 +960,7 @@ int save_kernel_events(struct config_writer *writer,
                goto end;
        }
 
-       cds_list_for_each_entry(event, &kchan->events_list.head, list) {
+       cds_list_for_each_entry (event, &kchan->events_list.head, list) {
                ret = save_kernel_event(writer, event);
                if (ret != LTTNG_OK) {
                        goto end;
@@ -1021,9 +980,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_ust_event(struct config_writer *writer,
-       struct ltt_ust_event *event)
+static int save_ust_event(struct config_writer *writer, struct ltt_ust_event *event)
 {
        int ret;
        const char *loglevel_type_string;
@@ -1035,16 +992,15 @@ int save_ust_event(struct config_writer *writer,
        }
 
        if (event->attr.name[0]) {
-               ret = config_writer_write_element_string(writer,
-                       config_element_name, event->attr.name);
+               ret = config_writer_write_element_string(
+                       writer, config_element_name, event->attr.name);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
                }
        }
 
-       ret = config_writer_write_element_bool(writer, config_element_enabled,
-               event->enabled);
+       ret = config_writer_write_element_bool(writer, config_element_enabled, event->enabled);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -1055,23 +1011,23 @@ int save_ust_event(struct config_writer *writer,
                ret = LTTNG_ERR_INVALID;
                goto end;
        }
-       ret = config_writer_write_element_string(writer, config_element_type,
-               config_event_type_tracepoint);
+       ret = config_writer_write_element_string(
+               writer, config_element_type, config_event_type_tracepoint);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       loglevel_type_string = get_loglevel_type_string(
-               (lttng_ust_abi_loglevel_type) event->attr.loglevel_type);
+       loglevel_type_string =
+               get_loglevel_type_string((lttng_ust_abi_loglevel_type) event->attr.loglevel_type);
        if (!loglevel_type_string) {
                ERR("Unsupported UST loglevel type.");
                ret = LTTNG_ERR_INVALID;
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer,
-               config_element_loglevel_type, loglevel_type_string);
+       ret = config_writer_write_element_string(
+               writer, config_element_loglevel_type, loglevel_type_string);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -1079,8 +1035,8 @@ int save_ust_event(struct config_writer *writer,
 
        /* The log level is irrelevant if no "filtering" is enabled */
        if (event->attr.loglevel_type != LTTNG_UST_ABI_LOGLEVEL_ALL) {
-               ret = config_writer_write_element_signed_int(writer,
-                               config_element_loglevel, event->attr.loglevel);
+               ret = config_writer_write_element_signed_int(
+                       writer, config_element_loglevel, event->attr.loglevel);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
@@ -1088,8 +1044,8 @@ int save_ust_event(struct config_writer *writer,
        }
 
        if (event->filter_expression) {
-               ret = config_writer_write_element_string(writer,
-                       config_element_filter, event->filter_expression);
+               ret = config_writer_write_element_string(
+                       writer, config_element_filter, event->filter_expression);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
@@ -1099,18 +1055,17 @@ int save_ust_event(struct config_writer *writer,
        if (event->exclusion && event->exclusion->count) {
                uint32_t i;
 
-               ret = config_writer_open_element(writer,
-                       config_element_exclusions);
+               ret = config_writer_open_element(writer, config_element_exclusions);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
                }
 
                for (i = 0; i < event->exclusion->count; i++) {
-                       ret = config_writer_write_element_string(writer,
+                       ret = config_writer_write_element_string(
+                               writer,
                                config_element_exclusion,
-                               LTTNG_EVENT_EXCLUSION_NAME_AT(
-                                       event->exclusion, i));
+                               LTTNG_EVENT_EXCLUSION_NAME_AT(event->exclusion, i));
                        if (ret) {
                                ret = LTTNG_ERR_SAVE_IO_FAIL;
                                goto end;
@@ -1138,9 +1093,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_ust_events(struct config_writer *writer,
-       struct lttng_ht *events)
+static int save_ust_events(struct config_writer *writer, struct lttng_ht *events)
 {
        int ret;
        struct ltt_ust_event *event;
@@ -1154,7 +1107,7 @@ int save_ust_events(struct config_writer *writer,
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(events->ht, &iter.iter, node, node) {
+       cds_lfht_for_each_entry (events->ht, &iter.iter, node, node) {
                event = lttng::utils::container_of(node, &ltt_ust_event::node);
 
                if (event->internal) {
@@ -1182,17 +1135,15 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int init_ust_event_from_agent_event(struct ltt_ust_event *ust_event,
-               struct agent_event *agent_event)
+static int init_ust_event_from_agent_event(struct ltt_ust_event *ust_event,
+                                          struct agent_event *agent_event)
 {
        int ret;
        enum lttng_ust_abi_loglevel_type ust_loglevel_type;
 
        ust_event->enabled = AGENT_EVENT_IS_ENABLED(agent_event);
        ust_event->attr.instrumentation = LTTNG_UST_ABI_TRACEPOINT;
-       if (lttng_strncpy(ust_event->attr.name, agent_event->name,
-                       LTTNG_SYMBOL_NAME_LEN)) {
+       if (lttng_strncpy(ust_event->attr.name, agent_event->name, LTTNG_SYMBOL_NAME_LEN)) {
                ret = LTTNG_ERR_INVALID;
                goto end;
        }
@@ -1223,9 +1174,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_agent_events(struct config_writer *writer,
-               struct agent *agent)
+static int save_agent_events(struct config_writer *writer, struct agent *agent)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -1238,7 +1187,7 @@ int save_agent_events(struct config_writer *writer,
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(agent->events->ht, &iter.iter, node, node) {
+       cds_lfht_for_each_entry (agent->events->ht, &iter.iter, node, node) {
                struct agent_event *agent_event;
                struct ltt_ust_event fake_event;
 
@@ -1277,9 +1226,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_kernel_context(struct config_writer *writer,
-       struct lttng_kernel_abi_context *ctx)
+static int save_kernel_context(struct config_writer *writer, struct lttng_kernel_abi_context *ctx)
 {
        int ret = LTTNG_OK;
 
@@ -1294,29 +1241,28 @@ int save_kernel_context(struct config_writer *writer,
        }
 
        if (ctx->ctx == LTTNG_KERNEL_ABI_CONTEXT_PERF_CPU_COUNTER) {
-               ret = config_writer_open_element(writer,
-                               config_element_context_perf);
+               ret = config_writer_open_element(writer, config_element_context_perf);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
                }
 
-               ret = config_writer_write_element_unsigned_int(writer,
-                       config_element_type, ctx->u.perf_counter.type);
+               ret = config_writer_write_element_unsigned_int(
+                       writer, config_element_type, ctx->u.perf_counter.type);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
                }
 
-               ret = config_writer_write_element_unsigned_int(writer,
-                       config_element_config, ctx->u.perf_counter.config);
+               ret = config_writer_write_element_unsigned_int(
+                       writer, config_element_config, ctx->u.perf_counter.config);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
                }
 
-               ret = config_writer_write_element_string(writer,
-                       config_element_name, ctx->u.perf_counter.name);
+               ret = config_writer_write_element_string(
+                       writer, config_element_name, ctx->u.perf_counter.name);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
@@ -1329,8 +1275,7 @@ int save_kernel_context(struct config_writer *writer,
                        goto end;
                }
        } else {
-               const char *context_type_string =
-                       get_kernel_context_type_string(ctx->ctx);
+               const char *context_type_string = get_kernel_context_type_string(ctx->ctx);
 
                if (!context_type_string) {
                        ERR("Unsupported kernel context type.");
@@ -1338,8 +1283,8 @@ int save_kernel_context(struct config_writer *writer,
                        goto end;
                }
 
-               ret = config_writer_write_element_string(writer,
-                       config_element_type, context_type_string);
+               ret = config_writer_write_element_string(
+                       writer, config_element_type, context_type_string);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
@@ -1359,9 +1304,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_kernel_contexts(struct config_writer *writer,
-               struct ltt_kernel_channel *kchan)
+static int save_kernel_contexts(struct config_writer *writer, struct ltt_kernel_channel *kchan)
 {
        int ret;
        struct ltt_kernel_context *ctx;
@@ -1377,7 +1320,7 @@ int save_kernel_contexts(struct config_writer *writer,
                goto end;
        }
 
-       cds_list_for_each_entry(ctx, &kchan->ctx_list, list) {
+       cds_list_for_each_entry (ctx, &kchan->ctx_list, list) {
                ret = save_kernel_context(writer, &ctx->ctx);
                if (ret != LTTNG_OK) {
                        goto end;
@@ -1397,9 +1340,8 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_ust_context_perf_thread_counter(struct config_writer *writer,
-               struct ltt_ust_context *ctx)
+static int save_ust_context_perf_thread_counter(struct config_writer *writer,
+                                               struct ltt_ust_context *ctx)
 {
        int ret;
 
@@ -1413,22 +1355,22 @@ int save_ust_context_perf_thread_counter(struct config_writer *writer,
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-                       config_element_type, ctx->ctx.u.perf_counter.type);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_type, ctx->ctx.u.perf_counter.type);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-                       config_element_config, ctx->ctx.u.perf_counter.config);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_config, ctx->ctx.u.perf_counter.config);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer, config_element_name,
-                       ctx->ctx.u.perf_counter.name);
+       ret = config_writer_write_element_string(
+               writer, config_element_name, ctx->ctx.u.perf_counter.name);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -1447,9 +1389,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_ust_context_app_ctx(struct config_writer *writer,
-               struct ltt_ust_context *ctx)
+static int save_ust_context_app_ctx(struct config_writer *writer, struct ltt_ust_context *ctx)
 {
        int ret;
 
@@ -1463,17 +1403,15 @@ int save_ust_context_app_ctx(struct config_writer *writer,
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer,
-                       config_element_context_app_provider_name,
-                       ctx->ctx.u.app_ctx.provider_name);
+       ret = config_writer_write_element_string(
+               writer, config_element_context_app_provider_name, ctx->ctx.u.app_ctx.provider_name);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer,
-                       config_element_context_app_ctx_name,
-                       ctx->ctx.u.app_ctx.ctx_name);
+       ret = config_writer_write_element_string(
+               writer, config_element_context_app_ctx_name, ctx->ctx.u.app_ctx.ctx_name);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -1492,9 +1430,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_ust_context_generic(struct config_writer *writer,
-               struct ltt_ust_context *ctx)
+static int save_ust_context_generic(struct config_writer *writer, struct ltt_ust_context *ctx)
 {
        int ret;
        const char *context_type_string;
@@ -1503,16 +1439,14 @@ int save_ust_context_generic(struct config_writer *writer,
        LTTNG_ASSERT(ctx);
 
        /* Save context as event_context_type_type */
-       context_type_string = get_ust_context_type_string(
-                       ctx->ctx.ctx);
+       context_type_string = get_ust_context_type_string(ctx->ctx.ctx);
        if (!context_type_string) {
                ERR("Unsupported UST context type.");
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer,
-                       config_element_type, context_type_string);
+       ret = config_writer_write_element_string(writer, config_element_type, context_type_string);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -1524,9 +1458,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_ust_context(struct config_writer *writer,
-       struct cds_list_head *ctx_list)
+static int save_ust_context(struct config_writer *writer, struct cds_list_head *ctx_list)
 {
        int ret;
        struct ltt_ust_context *ctx;
@@ -1540,9 +1472,8 @@ int save_ust_context(struct config_writer *writer,
                goto end;
        }
 
-       cds_list_for_each_entry(ctx, ctx_list, list) {
-               ret = config_writer_open_element(writer,
-                       config_element_context);
+       cds_list_for_each_entry (ctx, ctx_list, list) {
+               ret = config_writer_open_element(writer, config_element_context);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
@@ -1584,9 +1515,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_kernel_channel(struct config_writer *writer,
-       struct ltt_kernel_channel *kchan)
+static int save_kernel_channel(struct config_writer *writer, struct ltt_kernel_channel *kchan)
 {
        int ret;
 
@@ -1599,15 +1528,14 @@ int save_kernel_channel(struct config_writer *writer,
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer, config_element_name,
-               kchan->channel->name);
+       ret = config_writer_write_element_string(writer, config_element_name, kchan->channel->name);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_bool(writer, config_element_enabled,
-               kchan->channel->enabled);
+       ret = config_writer_write_element_bool(
+               writer, config_element_enabled, kchan->channel->enabled);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -1641,10 +1569,9 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_ust_channel(struct config_writer *writer,
-       struct ltt_ust_channel *ust_chan,
-       struct ltt_ust_session *session)
+static int save_ust_channel(struct config_writer *writer,
+                           struct ltt_ust_channel *ust_chan,
+                           struct ltt_ust_session *session)
 {
        int ret;
 
@@ -1658,15 +1585,13 @@ int save_ust_channel(struct config_writer *writer,
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer, config_element_name,
-               ust_chan->name);
+       ret = config_writer_write_element_string(writer, config_element_name, ust_chan->name);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_bool(writer, config_element_enabled,
-               ust_chan->enabled);
+       ret = config_writer_write_element_bool(writer, config_element_enabled, ust_chan->enabled);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -1677,23 +1602,22 @@ int save_ust_channel(struct config_writer *writer,
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_tracefile_size, ust_chan->tracefile_size);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_tracefile_size, ust_chan->tracefile_size);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_tracefile_count, ust_chan->tracefile_count);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_tracefile_count, ust_chan->tracefile_count);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-               config_element_live_timer_interval,
-               session->live_timer_interval);
+       ret = config_writer_write_element_unsigned_int(
+               writer, config_element_live_timer_interval, session->live_timer_interval);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -1744,9 +1668,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_kernel_session(struct config_writer *writer,
-       struct ltt_session *session)
+static int save_kernel_session(struct config_writer *writer, struct ltt_session *session)
 {
        int ret;
        struct ltt_kernel_channel *kchan;
@@ -1754,29 +1676,27 @@ int save_kernel_session(struct config_writer *writer,
        LTTNG_ASSERT(writer);
        LTTNG_ASSERT(session);
 
-       ret = config_writer_write_element_string(writer, config_element_type,
-               config_domain_type_kernel);
+       ret = config_writer_write_element_string(
+               writer, config_element_type, config_domain_type_kernel);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer,
-               config_element_buffer_type, config_buffer_type_global);
+       ret = config_writer_write_element_string(
+               writer, config_element_buffer_type, config_buffer_type_global);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       ret = config_writer_open_element(writer,
-               config_element_channels);
+       ret = config_writer_open_element(writer, config_element_channels);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       cds_list_for_each_entry(kchan, &session->kernel_session->channel_list.head,
-                       list) {
+       cds_list_for_each_entry (kchan, &session->kernel_session->channel_list.head, list) {
                ret = save_kernel_channel(writer, kchan);
                if (ret != LTTNG_OK) {
                        goto end;
@@ -1795,8 +1715,7 @@ end:
        return ret;
 }
 
-static
-const char *get_config_domain_str(enum lttng_domain_type domain)
+static const char *get_config_domain_str(enum lttng_domain_type domain)
 {
        const char *str_dom;
 
@@ -1825,9 +1744,9 @@ const char *get_config_domain_str(enum lttng_domain_type domain)
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
 static int save_process_attr_tracker(struct config_writer *writer,
-               struct ltt_session *sess,
-               int domain,
-               enum lttng_process_attr process_attr)
+                                    struct ltt_session *sess,
+                                    int domain,
+                                    enum lttng_process_attr process_attr)
 {
        int ret = LTTNG_OK;
        const char *element_id_tracker, *element_target_id, *element_id;
@@ -1874,15 +1793,13 @@ static int save_process_attr_tracker(struct config_writer *writer,
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
        {
-               tracker = kernel_get_process_attr_tracker(
-                               sess->kernel_session, process_attr);
+               tracker = kernel_get_process_attr_tracker(sess->kernel_session, process_attr);
                LTTNG_ASSERT(tracker);
                break;
        }
        case LTTNG_DOMAIN_UST:
        {
-               tracker = trace_ust_get_process_attr_tracker(
-                               sess->ust_session, process_attr);
+               tracker = trace_ust_get_process_attr_tracker(sess->ust_session, process_attr);
                LTTNG_ASSERT(tracker);
                break;
        }
@@ -1907,8 +1824,7 @@ static int save_process_attr_tracker(struct config_writer *writer,
                goto end;
        }
 
-       ret = config_writer_open_element(
-                       writer, config_element_process_attr_values);
+       ret = config_writer_open_element(writer, config_element_process_attr_values);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -1917,8 +1833,7 @@ static int save_process_attr_tracker(struct config_writer *writer,
        if (tracking_policy == LTTNG_TRACKING_POLICY_INCLUDE_SET) {
                unsigned int i, count;
                enum process_attr_tracker_status status =
-                               process_attr_tracker_get_inclusion_set(
-                                               tracker, &values);
+                       process_attr_tracker_get_inclusion_set(tracker, &values);
 
                if (status != PROCESS_ATTR_TRACKER_STATUS_OK) {
                        ret = LTTNG_ERR_NOMEM;
@@ -1931,12 +1846,10 @@ static int save_process_attr_tracker(struct config_writer *writer,
                        unsigned int integral_value = UINT_MAX;
                        const char *name = NULL;
                        const struct process_attr_value *value =
-                                       lttng_process_attr_tracker_values_get_at_index(
-                                                       values, i);
+                               lttng_process_attr_tracker_values_get_at_index(values, i);
 
                        LTTNG_ASSERT(value);
-                       ret = config_writer_open_element(
-                                       writer, element_target_id);
+                       ret = config_writer_open_element(writer, element_target_id);
                        if (ret) {
                                ret = LTTNG_ERR_SAVE_IO_FAIL;
                                goto end;
@@ -1944,16 +1857,13 @@ static int save_process_attr_tracker(struct config_writer *writer,
 
                        switch (value->type) {
                        case LTTNG_PROCESS_ATTR_VALUE_TYPE_PID:
-                               integral_value =
-                                               (unsigned int) value->value.pid;
+                               integral_value = (unsigned int) value->value.pid;
                                break;
                        case LTTNG_PROCESS_ATTR_VALUE_TYPE_UID:
-                               integral_value =
-                                               (unsigned int) value->value.uid;
+                               integral_value = (unsigned int) value->value.uid;
                                break;
                        case LTTNG_PROCESS_ATTR_VALUE_TYPE_GID:
-                               integral_value =
-                                               (unsigned int) value->value.gid;
+                               integral_value = (unsigned int) value->value.gid;
                                break;
                        case LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME:
                                name = value->value.user_name;
@@ -1968,12 +1878,11 @@ static int save_process_attr_tracker(struct config_writer *writer,
                        }
 
                        if (name) {
-                               ret = config_writer_write_element_string(writer,
-                                               config_element_name, name);
+                               ret = config_writer_write_element_string(
+                                       writer, config_element_name, name);
                        } else {
                                ret = config_writer_write_element_unsigned_int(
-                                               writer, element_id,
-                                               integral_value);
+                                       writer, element_id, integral_value);
                        }
 
                        if (ret) {
@@ -2011,58 +1920,55 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static int save_process_attr_trackers(struct config_writer *writer,
-               struct ltt_session *sess,
-               int domain)
+static int
+save_process_attr_trackers(struct config_writer *writer, struct ltt_session *sess, int domain)
 {
        int ret;
 
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
-               ret = save_process_attr_tracker(writer, sess, domain,
-                               LTTNG_PROCESS_ATTR_PROCESS_ID);
+               ret = save_process_attr_tracker(
+                       writer, sess, domain, LTTNG_PROCESS_ATTR_PROCESS_ID);
                if (ret != LTTNG_OK) {
                        goto end;
                }
-               ret = save_process_attr_tracker(writer, sess, domain,
-                               LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID);
+               ret = save_process_attr_tracker(
+                       writer, sess, domain, LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID);
                if (ret != LTTNG_OK) {
                        goto end;
                }
-               ret = save_process_attr_tracker(writer, sess, domain,
-                               LTTNG_PROCESS_ATTR_USER_ID);
+               ret = save_process_attr_tracker(writer, sess, domain, LTTNG_PROCESS_ATTR_USER_ID);
                if (ret != LTTNG_OK) {
                        goto end;
                }
-               ret = save_process_attr_tracker(writer, sess, domain,
-                               LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID);
+               ret = save_process_attr_tracker(
+                       writer, sess, domain, LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID);
                if (ret != LTTNG_OK) {
                        goto end;
                }
-               ret = save_process_attr_tracker(writer, sess, domain,
-                               LTTNG_PROCESS_ATTR_GROUP_ID);
+               ret = save_process_attr_tracker(writer, sess, domain, LTTNG_PROCESS_ATTR_GROUP_ID);
                if (ret != LTTNG_OK) {
                        goto end;
                }
-               ret = save_process_attr_tracker(writer, sess, domain,
-                               LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID);
+               ret = save_process_attr_tracker(
+                       writer, sess, domain, LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID);
                if (ret != LTTNG_OK) {
                        goto end;
                }
                break;
        case LTTNG_DOMAIN_UST:
-               ret = save_process_attr_tracker(writer, sess, domain,
-                               LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID);
+               ret = save_process_attr_tracker(
+                       writer, sess, domain, LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID);
                if (ret != LTTNG_OK) {
                        goto end;
                }
-               ret = save_process_attr_tracker(writer, sess, domain,
-                               LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID);
+               ret = save_process_attr_tracker(
+                       writer, sess, domain, LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID);
                if (ret != LTTNG_OK) {
                        goto end;
                }
-               ret = save_process_attr_tracker(writer, sess, domain,
-                               LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID);
+               ret = save_process_attr_tracker(
+                       writer, sess, domain, LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID);
                if (ret != LTTNG_OK) {
                        goto end;
                }
@@ -2077,9 +1983,9 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_ust_domain(struct config_writer *writer,
-       struct ltt_session *session, enum lttng_domain_type domain)
+static int save_ust_domain(struct config_writer *writer,
+                          struct ltt_session *session,
+                          enum lttng_domain_type domain)
 {
        int ret;
        struct ltt_ust_channel *ust_chan;
@@ -2091,8 +1997,7 @@ int save_ust_domain(struct config_writer *writer,
        LTTNG_ASSERT(writer);
        LTTNG_ASSERT(session);
 
-       ret = config_writer_open_element(writer,
-                       config_element_domain);
+       ret = config_writer_open_element(writer, config_element_domain);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -2104,23 +2009,21 @@ int save_ust_domain(struct config_writer *writer,
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer,
-                       config_element_type, config_domain_name);
+       ret = config_writer_write_element_string(writer, config_element_type, config_domain_name);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       buffer_type_string = get_buffer_type_string(
-                       session->ust_session->buffer_type);
+       buffer_type_string = get_buffer_type_string(session->ust_session->buffer_type);
        if (!buffer_type_string) {
                ERR("Unsupported buffer type.");
                ret = LTTNG_ERR_INVALID;
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer,
-                       config_element_buffer_type, buffer_type_string);
+       ret = config_writer_write_element_string(
+               writer, config_element_buffer_type, buffer_type_string);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -2133,8 +2036,8 @@ int save_ust_domain(struct config_writer *writer,
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(session->ust_session->domain_global.channels->ht,
-                       &iter.iter, node, node) {
+       cds_lfht_for_each_entry (
+               session->ust_session->domain_global.channels->ht, &iter.iter, node, node) {
                ust_chan = lttng::utils::container_of(node, &ltt_ust_channel::node);
                if (domain == ust_chan->domain) {
                        ret = save_ust_channel(writer, ust_chan, session->ust_session);
@@ -2154,15 +2057,13 @@ int save_ust_domain(struct config_writer *writer,
        }
 
        if (domain == LTTNG_DOMAIN_UST) {
-               ret = config_writer_open_element(
-                               writer, config_element_process_attr_trackers);
+               ret = config_writer_open_element(writer, config_element_process_attr_trackers);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
                }
 
-               ret = save_process_attr_trackers(
-                               writer, session, LTTNG_DOMAIN_UST);
+               ret = save_process_attr_trackers(writer, session, LTTNG_DOMAIN_UST);
                if (ret != LTTNG_OK) {
                        goto end;
                }
@@ -2188,8 +2089,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_domains(struct config_writer *writer, struct ltt_session *session)
+static int save_domains(struct config_writer *writer, struct ltt_session *session)
 {
        int ret = LTTNG_OK;
 
@@ -2207,8 +2107,7 @@ int save_domains(struct config_writer *writer, struct ltt_session *session)
        }
 
        if (session->kernel_session) {
-               ret = config_writer_open_element(writer,
-                       config_element_domain);
+               ret = config_writer_open_element(writer, config_element_domain);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
@@ -2219,15 +2118,13 @@ int save_domains(struct config_writer *writer, struct ltt_session *session)
                        goto end;
                }
 
-               ret = config_writer_open_element(
-                               writer, config_element_process_attr_trackers);
+               ret = config_writer_open_element(writer, config_element_process_attr_trackers);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
                }
 
-               ret = save_process_attr_trackers(
-                               writer, session, LTTNG_DOMAIN_KERNEL);
+               ret = save_process_attr_trackers(writer, session, LTTNG_DOMAIN_KERNEL);
                if (ret != LTTNG_OK) {
                        goto end;
                }
@@ -2281,9 +2178,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_consumer_output(struct config_writer *writer,
-       struct consumer_output *output)
+static int save_consumer_output(struct config_writer *writer, struct consumer_output *output)
 {
        int ret;
 
@@ -2296,8 +2191,7 @@ int save_consumer_output(struct config_writer *writer,
                goto end;
        }
 
-       ret = config_writer_write_element_bool(writer, config_element_enabled,
-                       output->enabled);
+       ret = config_writer_write_element_bool(writer, config_element_enabled, output->enabled);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
@@ -2311,8 +2205,8 @@ int save_consumer_output(struct config_writer *writer,
 
        switch (output->type) {
        case CONSUMER_DST_LOCAL:
-               ret = config_writer_write_element_string(writer,
-                       config_element_path, output->dst.session_root_path);
+               ret = config_writer_write_element_string(
+                       writer, config_element_path, output->dst.session_root_path);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
@@ -2334,16 +2228,15 @@ int save_consumer_output(struct config_writer *writer,
                        goto end_net_output;
                }
 
-               if (output->dst.net.control_isset &&
-                       output->dst.net.data_isset) {
+               if (output->dst.net.control_isset && output->dst.net.data_isset) {
                        ret = uri_to_str_url(&output->dst.net.control, uri, PATH_MAX);
                        if (ret < 0) {
                                ret = LTTNG_ERR_INVALID;
                                goto end_net_output;
                        }
 
-                       ret = config_writer_write_element_string(writer,
-                                       config_element_control_uri, uri);
+                       ret = config_writer_write_element_string(
+                               writer, config_element_control_uri, uri);
                        if (ret) {
                                ret = LTTNG_ERR_SAVE_IO_FAIL;
                                goto end_net_output;
@@ -2355,22 +2248,21 @@ int save_consumer_output(struct config_writer *writer,
                                goto end_net_output;
                        }
 
-                       ret = config_writer_write_element_string(writer,
-                                       config_element_data_uri, uri);
+                       ret = config_writer_write_element_string(
+                               writer, config_element_data_uri, uri);
                        if (ret) {
                                ret = LTTNG_ERR_SAVE_IO_FAIL;
                                goto end_net_output;
                        }
                        ret = LTTNG_OK;
-end_net_output:
+               end_net_output:
                        free(uri);
                        if (ret != LTTNG_OK) {
                                goto end;
                        }
                } else {
-                       ret = !output->dst.net.control_isset ?
-                               LTTNG_ERR_URL_CTRL_MISS :
-                               LTTNG_ERR_URL_DATA_MISS;
+                       ret = !output->dst.net.control_isset ? LTTNG_ERR_URL_CTRL_MISS :
+                                                              LTTNG_ERR_URL_DATA_MISS;
                        free(uri);
                        goto end;
                }
@@ -2408,9 +2300,7 @@ end:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_snapshot_outputs(struct config_writer *writer,
-       struct snapshot *snapshot)
+static int save_snapshot_outputs(struct config_writer *writer, struct snapshot *snapshot)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -2426,24 +2316,21 @@ int save_snapshot_outputs(struct config_writer *writer,
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(snapshot->output_ht->ht, &iter.iter, output,
-                       node.node) {
-               ret = config_writer_open_element(writer,
-                       config_element_output);
+       cds_lfht_for_each_entry (snapshot->output_ht->ht, &iter.iter, output, node.node) {
+               ret = config_writer_open_element(writer, config_element_output);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end_unlock;
                }
 
-               ret = config_writer_write_element_string(writer,
-                       config_element_name, output->name);
+               ret = config_writer_write_element_string(writer, config_element_name, output->name);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end_unlock;
                }
 
-               ret = config_writer_write_element_unsigned_int(writer,
-                       config_element_max_size, output->max_size);
+               ret = config_writer_write_element_unsigned_int(
+                       writer, config_element_max_size, output->max_size);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end_unlock;
@@ -2479,9 +2366,7 @@ end_unlock:
 }
 
 /* Return LTTNG_OK on success else a LTTNG_ERR* code. */
-static
-int save_session_output(struct config_writer *writer,
-       struct ltt_session *session)
+static int save_session_output(struct config_writer *writer, struct ltt_session *session)
 {
        int ret;
 
@@ -2489,7 +2374,7 @@ int save_session_output(struct config_writer *writer,
        LTTNG_ASSERT(session);
 
        if ((session->snapshot_mode && session->snapshot.nb_output == 0) ||
-               (!session->snapshot_mode && !session->consumer)) {
+           (!session->snapshot_mode && !session->consumer)) {
                /* Session is in no output mode */
                ret = LTTNG_OK;
                goto end;
@@ -2526,9 +2411,9 @@ end:
        return ret;
 }
 
-static
-int save_session_rotation_schedule(struct config_writer *writer,
-               enum lttng_rotation_schedule_type type, uint64_t value)
+static int save_session_rotation_schedule(struct config_writer *writer,
+                                         enum lttng_rotation_schedule_type type,
+                                         uint64_t value)
 {
        int ret = 0;
        const char *element_name;
@@ -2537,11 +2422,11 @@ int save_session_rotation_schedule(struct config_writer *writer,
        switch (type) {
        case LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC:
                element_name = config_element_rotation_schedule_periodic;
-               value_name = config_element_rotation_schedule_periodic_time_us;
+               value_name = config_element_rotation_schedule_periodic_time_us;
                break;
        case LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD:
                element_name = config_element_rotation_schedule_size_threshold;
-               value_name = config_element_rotation_schedule_size_threshold_bytes;
+               value_name = config_element_rotation_schedule_size_threshold_bytes;
                break;
        default:
                ret = -1;
@@ -2553,8 +2438,7 @@ int save_session_rotation_schedule(struct config_writer *writer,
                goto end;
        }
 
-       ret = config_writer_write_element_unsigned_int(writer,
-                       value_name, value);
+       ret = config_writer_write_element_unsigned_int(writer, value_name, value);
        if (ret) {
                goto end;
        }
@@ -2568,29 +2452,26 @@ end:
        return ret;
 }
 
-static
-int save_session_rotation_schedules(struct config_writer *writer,
-       struct ltt_session *session)
+static int save_session_rotation_schedules(struct config_writer *writer,
+                                          struct ltt_session *session)
 {
        int ret;
 
-       ret = config_writer_open_element(writer,
-                       config_element_rotation_schedules);
+       ret = config_writer_open_element(writer, config_element_rotation_schedules);
        if (ret) {
                goto end;
        }
        if (session->rotate_timer_period) {
                ret = save_session_rotation_schedule(writer,
-                               LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC,
-                               session->rotate_timer_period);
+                                                    LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC,
+                                                    session->rotate_timer_period);
                if (ret) {
                        goto close_schedules;
                }
        }
        if (session->rotate_size) {
-               ret = save_session_rotation_schedule(writer,
-                               LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD,
-                               session->rotate_size);
+               ret = save_session_rotation_schedule(
+                       writer, LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD, session->rotate_size);
                if (ret) {
                        goto close_schedules;
                }
@@ -2611,9 +2492,9 @@ end:
  *
  * Return LTTNG_OK on success else a LTTNG_ERR* code.
  */
-static
-int save_session(struct ltt_session *session,
-       struct lttng_save_session_attr *attr, lttng_sock_cred *creds)
+static int save_session(struct ltt_session *session,
+                       struct lttng_save_session_attr *attr,
+                       lttng_sock_cred *creds)
 {
        int ret, fd = -1;
        char config_file_path[LTTNG_PATH_MAX];
@@ -2630,8 +2511,7 @@ int save_session(struct ltt_session *session,
        session_name_len = strlen(session->name);
        memset(config_file_path, 0, sizeof(config_file_path));
 
-       if (!session_access_ok(session,
-               LTTNG_SOCK_GET_UID_CRED(creds)) || session->destroyed) {
+       if (!session_access_ok(session, LTTNG_SOCK_GET_UID_CRED(creds)) || session->destroyed) {
                ret = LTTNG_ERR_EPERM;
                goto end;
        }
@@ -2647,15 +2527,16 @@ int save_session(struct ltt_session *session,
                strncpy(config_file_path, provided_path, sizeof(config_file_path));
        } else {
                ssize_t ret_len;
-               char *home_dir = utils_get_user_home_dir(
-                       LTTNG_SOCK_GET_UID_CRED(creds));
+               char *home_dir = utils_get_user_home_dir(LTTNG_SOCK_GET_UID_CRED(creds));
                if (!home_dir) {
                        ret = LTTNG_ERR_SET_URL;
                        goto end;
                }
 
-               ret_len = snprintf(config_file_path, sizeof(config_file_path),
-                               DEFAULT_SESSION_HOME_CONFIGPATH, home_dir);
+               ret_len = snprintf(config_file_path,
+                                  sizeof(config_file_path),
+                                  DEFAULT_SESSION_HOME_CONFIGPATH,
+                                  home_dir);
                free(home_dir);
                if (ret_len < 0) {
                        PERROR("snprintf save session");
@@ -2669,15 +2550,16 @@ int save_session(struct ltt_session *session,
         * Check the path fits in the config file path dst including the '/'
         * followed by trailing .lttng extension and the NULL terminated string.
         */
-       if ((len + session_name_len + 2 +
-                       sizeof(DEFAULT_SESSION_CONFIG_FILE_EXTENSION))
-                       > sizeof(config_file_path)) {
+       if ((len + session_name_len + 2 + sizeof(DEFAULT_SESSION_CONFIG_FILE_EXTENSION)) >
+           sizeof(config_file_path)) {
                ret = LTTNG_ERR_SET_URL;
                goto end;
        }
 
-       ret = run_as_mkdir_recursive(config_file_path, S_IRWXU | S_IRWXG,
-                       LTTNG_SOCK_GET_UID_CRED(creds), LTTNG_SOCK_GET_GID_CRED(creds));
+       ret = run_as_mkdir_recursive(config_file_path,
+                                    S_IRWXU | S_IRWXG,
+                                    LTTNG_SOCK_GET_UID_CRED(creds),
+                                    LTTNG_SOCK_GET_GID_CRED(creds));
        if (ret) {
                ret = LTTNG_ERR_SET_URL;
                goto end;
@@ -2698,9 +2580,11 @@ int save_session(struct ltt_session *session,
                file_open_flags |= O_EXCL;
        }
 
-       fd = run_as_open(config_file_path, file_open_flags,
-               S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
-               LTTNG_SOCK_GET_UID_CRED(creds), LTTNG_SOCK_GET_GID_CRED(creds));
+       fd = run_as_open(config_file_path,
+                        file_open_flags,
+                        S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
+                        LTTNG_SOCK_GET_UID_CRED(creds),
+                        LTTNG_SOCK_GET_GID_CRED(creds));
        if (fd < 0) {
                PERROR("Could not create configuration file");
                switch (errno) {
@@ -2735,17 +2619,15 @@ int save_session(struct ltt_session *session,
                goto end;
        }
 
-       ret = config_writer_write_element_string(writer, config_element_name,
-                       session->name);
+       ret = config_writer_write_element_string(writer, config_element_name, session->name);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
        if (session->shm_path[0] != '\0') {
-               ret = config_writer_write_element_string(writer,
-                               config_element_shared_memory_path,
-                               session->shm_path);
+               ret = config_writer_write_element_string(
+                       writer, config_element_shared_memory_path, session->shm_path);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
                        goto end;
@@ -2757,15 +2639,14 @@ int save_session(struct ltt_session *session,
                goto end;
        }
 
-       ret = config_writer_write_element_bool(writer, config_element_started,
-                       session->active);
+       ret = config_writer_write_element_bool(writer, config_element_started, session->active);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
 
-       if (session->snapshot_mode || session->live_timer ||
-                       session->rotate_timer_period || session->rotate_size) {
+       if (session->snapshot_mode || session->live_timer || session->rotate_timer_period ||
+           session->rotate_size) {
                ret = config_writer_open_element(writer, config_element_attributes);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
@@ -2773,23 +2654,22 @@ int save_session(struct ltt_session *session,
                }
 
                if (session->snapshot_mode) {
-                       ret = config_writer_write_element_bool(writer,
-                                       config_element_snapshot_mode, 1);
+                       ret = config_writer_write_element_bool(
+                               writer, config_element_snapshot_mode, 1);
                        if (ret) {
                                ret = LTTNG_ERR_SAVE_IO_FAIL;
                                goto end;
                        }
                } else if (session->live_timer) {
-                       ret = config_writer_write_element_unsigned_int(writer,
-                                       config_element_live_timer_interval, session->live_timer);
+                       ret = config_writer_write_element_unsigned_int(
+                               writer, config_element_live_timer_interval, session->live_timer);
                        if (ret) {
                                ret = LTTNG_ERR_SAVE_IO_FAIL;
                                goto end;
                        }
                }
                if (session->rotate_timer_period || session->rotate_size) {
-                       ret = save_session_rotation_schedules(writer,
-                                       session);
+                       ret = save_session_rotation_schedules(writer, session);
                        if (ret) {
                                ret = LTTNG_ERR_SAVE_IO_FAIL;
                                goto end;
@@ -2848,8 +2728,7 @@ end:
        return ret;
 }
 
-int cmd_save_sessions(struct lttng_save_session_attr *attr,
-       lttng_sock_cred *creds)
+int cmd_save_sessions(struct lttng_save_session_attr *attr, lttng_sock_cred *creds)
 {
        int ret;
        const char *session_name;
@@ -2875,7 +2754,7 @@ int cmd_save_sessions(struct lttng_save_session_attr *attr,
        } else {
                struct ltt_session_list *list = session_get_list();
 
-               cds_list_for_each_entry(session, &list->head, list) {
+               cds_list_for_each_entry (session, &list->head, list) {
                        if (!session_get(session)) {
                                continue;
                        }
index e9d7261031d632fc44e4f820621a8e471a3e9e74..54b255e056dff80b445420e5ed33b73b0c0d0a3b 100644 (file)
@@ -6,6 +6,22 @@
  */
 
 #define _LGPL_SOURCE
+#include "cmd.hpp"
+#include "kernel.hpp"
+#include "lttng-sessiond.hpp"
+#include "session.hpp"
+#include "timer.hpp"
+#include "trace-ust.hpp"
+#include "utils.hpp"
+
+#include <common/common.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/trace-chunk.hpp>
+#include <common/urcu.hpp>
+#include <common/utils.hpp>
+
+#include <lttng/location-internal.hpp>
+
 #include <dirent.h>
 #include <inttypes.h>
 #include <limits.h>
 #include <sys/types.h>
 #include <urcu.h>
 
-#include <common/common.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/trace-chunk.hpp>
-#include <common/urcu.hpp>
-#include <common/utils.hpp>
-
-#include "lttng-sessiond.hpp"
-#include <lttng/location-internal.hpp>
-
-#include "cmd.hpp"
-#include "kernel.hpp"
-#include "session.hpp"
-#include "timer.hpp"
-#include "trace-ust.hpp"
-#include "utils.hpp"
-
 namespace {
 struct ltt_session_destroy_notifier_element {
        ltt_session_destroy_notifier notifier;
@@ -150,8 +150,7 @@ void session_list_wait_empty(void)
 {
        pthread_mutex_lock(&the_session_list.lock);
        while (!cds_list_empty(&the_session_list.head)) {
-               pthread_cond_wait(&the_session_list.removal_cond,
-                               &the_session_list.lock);
+               pthread_cond_wait(&the_session_list.removal_cond, &the_session_list.lock);
        }
        pthread_mutex_unlock(&the_session_list.lock);
 }
@@ -185,17 +184,15 @@ void session_unlock_list(void)
  *
  * The caller must hold the session lock.
  */
-enum consumer_dst_type session_get_consumer_destination_type(
-               const struct ltt_session *session)
+enum consumer_dst_type session_get_consumer_destination_type(const struct ltt_session *session)
 {
        /*
         * The output information is duplicated in both of those session types.
         * Hence, it doesn't matter from which it is retrieved. However, it is
         * possible for only one of them to be set.
         */
-       return session->kernel_session ?
-                       session->kernel_session->consumer->type :
-                       session->ust_session->consumer->type;
+       return session->kernel_session ? session->kernel_session->consumer->type :
+                                        session->ust_session->consumer->type;
 }
 
 /*
@@ -209,9 +206,8 @@ const char *session_get_net_consumer_hostname(const struct ltt_session *session)
        const char *hostname = NULL;
        const struct consumer_output *output;
 
-       output = session->kernel_session ?
-                       session->kernel_session->consumer :
-                       session->ust_session->consumer;
+       output = session->kernel_session ? session->kernel_session->consumer :
+                                          session->ust_session->consumer;
 
        /*
         * hostname is assumed to be the same for both control and data
@@ -237,13 +233,13 @@ const char *session_get_net_consumer_hostname(const struct ltt_session *session)
  * The caller must hold the session lock.
  */
 void session_get_net_consumer_ports(const struct ltt_session *session,
-               uint16_t *control_port, uint16_t *data_port)
+                                   uint16_t *control_port,
+                                   uint16_t *data_port)
 {
        const struct consumer_output *output;
 
-       output = session->kernel_session ?
-                       session->kernel_session->consumer :
-                       session->ust_session->consumer;
+       output = session->kernel_session ? session->kernel_session->consumer :
+                                          session->ust_session->consumer;
        *control_port = output->dst.net.control.port;
        *data_port = output->dst.net.data.port;
 }
@@ -253,29 +249,28 @@ void session_get_net_consumer_ports(const struct ltt_session *session,
  *
  * The caller must hold the session lock.
  */
-struct lttng_trace_archive_location *session_get_trace_archive_location(
-               const struct ltt_session *session)
+struct lttng_trace_archive_location *
+session_get_trace_archive_location(const struct ltt_session *session)
 {
        int ret;
        struct lttng_trace_archive_location *location = NULL;
        char *chunk_path = NULL;
 
        if (session->rotation_state != LTTNG_ROTATION_STATE_COMPLETED ||
-                       !session->last_archived_chunk_name) {
+           !session->last_archived_chunk_name) {
                goto end;
        }
 
        switch (session_get_consumer_destination_type(session)) {
        case CONSUMER_DST_LOCAL:
                ret = asprintf(&chunk_path,
-                               "%s/" DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY "/%s",
-                               session_get_base_path(session),
-                               session->last_archived_chunk_name);
+                              "%s/" DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY "/%s",
+                              session_get_base_path(session),
+                              session->last_archived_chunk_name);
                if (ret == -1) {
                        goto end;
                }
-               location = lttng_trace_archive_location_local_create(
-                               chunk_path);
+               location = lttng_trace_archive_location_local_create(chunk_path);
                break;
        case CONSUMER_DST_NET:
        {
@@ -283,13 +278,13 @@ struct lttng_trace_archive_location *session_get_trace_archive_location(
                uint16_t control_port, data_port;
 
                hostname = session_get_net_consumer_hostname(session);
-               session_get_net_consumer_ports(session,
-                               &control_port,
-                               &data_port);
+               session_get_net_consumer_ports(session, &control_port, &data_port);
                location = lttng_trace_archive_location_relay_create(
-                               hostname,
-                               LTTNG_TRACE_ARCHIVE_LOCATION_RELAY_PROTOCOL_TYPE_TCP,
-                               control_port, data_port, session->last_chunk_path);
+                       hostname,
+                       LTTNG_TRACE_ARCHIVE_LOCATION_RELAY_PROTOCOL_TYPE_TCP,
+                       control_port,
+                       data_port,
+                       session->last_chunk_path);
                break;
        }
        default:
@@ -468,10 +463,9 @@ void session_unlock(struct ltt_session *session)
        pthread_mutex_unlock(&session->lock);
 }
 
-static
-int _session_set_trace_chunk_no_lock_check(struct ltt_session *session,
-               struct lttng_trace_chunk *new_trace_chunk,
-               struct lttng_trace_chunk **_current_trace_chunk)
+static int _session_set_trace_chunk_no_lock_check(struct ltt_session *session,
+                                                 struct lttng_trace_chunk *new_trace_chunk,
+                                                 struct lttng_trace_chunk **_current_trace_chunk)
 {
        int ret = 0;
        unsigned int i, refs_to_acquire = 0, refs_acquired = 0, refs_to_release = 0;
@@ -489,13 +483,11 @@ int _session_set_trace_chunk_no_lock_check(struct ltt_session *session,
        current_trace_chunk = session->current_trace_chunk;
        session->current_trace_chunk = NULL;
        if (session->ust_session) {
-               lttng_trace_chunk_put(
-                               session->ust_session->current_trace_chunk);
+               lttng_trace_chunk_put(session->ust_session->current_trace_chunk);
                session->ust_session->current_trace_chunk = NULL;
        }
        if (session->kernel_session) {
-               lttng_trace_chunk_put(
-                               session->kernel_session->current_trace_chunk);
+               lttng_trace_chunk_put(session->kernel_session->current_trace_chunk);
                session->kernel_session->current_trace_chunk = NULL;
        }
        if (!new_trace_chunk) {
@@ -509,40 +501,37 @@ int _session_set_trace_chunk_no_lock_check(struct ltt_session *session,
        refs_to_acquire += !!session->ust_session;
        refs_to_acquire += !!session->kernel_session;
 
-       for (refs_acquired = 0; refs_acquired < refs_to_acquire;
-                       refs_acquired++) {
+       for (refs_acquired = 0; refs_acquired < refs_to_acquire; refs_acquired++) {
                if (!lttng_trace_chunk_get(new_trace_chunk)) {
                        ERR("Failed to acquire reference to new trace chunk of session \"%s\"",
-                                       session->name);
+                           session->name);
                        goto error;
                }
        }
 
        if (session->ust_session) {
-               const uint64_t relayd_id =
-                               session->ust_session->consumer->net_seq_index;
-               const bool is_local_trace =
-                               session->ust_session->consumer->type ==
-                               CONSUMER_DST_LOCAL;
+               const uint64_t relayd_id = session->ust_session->consumer->net_seq_index;
+               const bool is_local_trace = session->ust_session->consumer->type ==
+                       CONSUMER_DST_LOCAL;
 
                session->ust_session->current_trace_chunk = new_trace_chunk;
                if (is_local_trace) {
                        enum lttng_error_code ret_error_code;
 
-                       ret_error_code = ust_app_create_channel_subdirectories(
-                                       session->ust_session);
+                       ret_error_code =
+                               ust_app_create_channel_subdirectories(session->ust_session);
                        if (ret_error_code != LTTNG_OK) {
                                goto error;
                        }
                }
-               cds_lfht_for_each_entry(
-                               session->ust_session->consumer->socks->ht,
-                               &iter, socket, node.node) {
+               cds_lfht_for_each_entry (
+                       session->ust_session->consumer->socks->ht, &iter, socket, node.node) {
                        pthread_mutex_lock(socket->lock);
                        ret = consumer_create_trace_chunk(socket,
-                                       relayd_id,
-                                       session->id, new_trace_chunk,
-                                       DEFAULT_UST_TRACE_DIR);
+                                                         relayd_id,
+                                                         session->id,
+                                                         new_trace_chunk,
+                                                         DEFAULT_UST_TRACE_DIR);
                        pthread_mutex_unlock(socket->lock);
                        if (ret) {
                                goto error;
@@ -550,30 +539,28 @@ int _session_set_trace_chunk_no_lock_check(struct ltt_session *session,
                }
        }
        if (session->kernel_session) {
-               const uint64_t relayd_id =
-                               session->kernel_session->consumer->net_seq_index;
-               const bool is_local_trace =
-                               session->kernel_session->consumer->type ==
-                               CONSUMER_DST_LOCAL;
+               const uint64_t relayd_id = session->kernel_session->consumer->net_seq_index;
+               const bool is_local_trace = session->kernel_session->consumer->type ==
+                       CONSUMER_DST_LOCAL;
 
                session->kernel_session->current_trace_chunk = new_trace_chunk;
                if (is_local_trace) {
                        enum lttng_error_code ret_error_code;
 
-                       ret_error_code = kernel_create_channel_subdirectories(
-                                       session->kernel_session);
+                       ret_error_code =
+                               kernel_create_channel_subdirectories(session->kernel_session);
                        if (ret_error_code != LTTNG_OK) {
                                goto error;
                        }
                }
-               cds_lfht_for_each_entry(
-                               session->kernel_session->consumer->socks->ht,
-                               &iter, socket, node.node) {
+               cds_lfht_for_each_entry (
+                       session->kernel_session->consumer->socks->ht, &iter, socket, node.node) {
                        pthread_mutex_lock(socket->lock);
                        ret = consumer_create_trace_chunk(socket,
-                                       relayd_id,
-                                       session->id, new_trace_chunk,
-                                       DEFAULT_KERNEL_TRACE_DIR);
+                                                         relayd_id,
+                                                         session->id,
+                                                         new_trace_chunk,
+                                                         DEFAULT_KERNEL_TRACE_DIR);
                        pthread_mutex_unlock(socket->lock);
                        if (ret) {
                                goto error;
@@ -615,11 +602,11 @@ error:
        goto end_no_move;
 }
 
-struct lttng_trace_chunk *session_create_new_trace_chunk(
-               const struct ltt_session *session,
-               const struct consumer_output *consumer_output_override,
-               const char *session_base_path_override,
-               const char *chunk_name_override)
+struct lttng_trace_chunk *
+session_create_new_trace_chunk(const struct ltt_session *session,
+                              const struct consumer_output *consumer_output_override,
+                              const char *session_base_path_override,
+                              const char *chunk_name_override)
 {
        int ret;
        struct lttng_trace_chunk *trace_chunk = NULL;
@@ -640,28 +627,26 @@ struct lttng_trace_chunk *session_create_new_trace_chunk(
                output = consumer_output_override;
        } else {
                LTTNG_ASSERT(session->ust_session || session->kernel_session);
-               output = session->ust_session ?
-                                        session->ust_session->consumer :
-                                        session->kernel_session->consumer;
+               output = session->ust_session ? session->ust_session->consumer :
+                                               session->kernel_session->consumer;
        }
 
        is_local_trace = output->type == CONSUMER_DST_LOCAL;
-       base_path = session_base_path_override ? :
-                       consumer_output_get_base_path(output);
+       base_path = session_base_path_override ?: consumer_output_get_base_path(output);
 
        if (chunk_creation_ts == (time_t) -1) {
                PERROR("Failed to sample time while creation session \"%s\" trace chunk",
-                               session->name);
+                      session->name);
                goto error;
        }
 
-       next_chunk_id = session->most_recent_chunk_id.is_set ?
-                       session->most_recent_chunk_id.value + 1 : 0;
+       next_chunk_id =
+               session->most_recent_chunk_id.is_set ? session->most_recent_chunk_id.value + 1 : 0;
 
        if (session->current_trace_chunk &&
-                       !lttng_trace_chunk_get_name_overridden(session->current_trace_chunk)) {
+           !lttng_trace_chunk_get_name_overridden(session->current_trace_chunk)) {
                chunk_status = lttng_trace_chunk_rename_path(session->current_trace_chunk,
-                                       DEFAULT_CHUNK_TMP_OLD_DIRECTORY);
+                                                            DEFAULT_CHUNK_TMP_OLD_DIRECTORY);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        goto error;
                }
@@ -676,15 +661,13 @@ struct lttng_trace_chunk *session_create_new_trace_chunk(
                new_path = DEFAULT_CHUNK_TMP_NEW_DIRECTORY;
        }
 
-       trace_chunk = lttng_trace_chunk_create(next_chunk_id,
-                       chunk_creation_ts, new_path);
+       trace_chunk = lttng_trace_chunk_create(next_chunk_id, chunk_creation_ts, new_path);
        if (!trace_chunk) {
                goto error;
        }
 
        if (chunk_name_override) {
-               chunk_status = lttng_trace_chunk_override_name(trace_chunk,
-                               chunk_name_override);
+               chunk_status = lttng_trace_chunk_override_name(trace_chunk, chunk_name_override);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        goto error;
                }
@@ -698,16 +681,13 @@ struct lttng_trace_chunk *session_create_new_trace_chunk(
                goto end;
        }
 
-       chunk_status = lttng_trace_chunk_set_credentials(trace_chunk,
-                       &session_credentials);
+       chunk_status = lttng_trace_chunk_set_credentials(trace_chunk, &session_credentials);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                goto error;
        }
 
-       DBG("Creating base output directory of session \"%s\" at %s",
-                       session->name, base_path);
-       ret = utils_mkdir_recursive(base_path, S_IRWXU | S_IRWXG,
-                       session->uid, session->gid);
+       DBG("Creating base output directory of session \"%s\" at %s", session->name, base_path);
+       ret = utils_mkdir_recursive(base_path, S_IRWXU | S_IRWXG, session->uid, session->gid);
        if (ret) {
                goto error;
        }
@@ -715,8 +695,7 @@ struct lttng_trace_chunk *session_create_new_trace_chunk(
        if (!session_output_directory) {
                goto error;
        }
-       chunk_status = lttng_trace_chunk_set_as_owner(trace_chunk,
-                       session_output_directory);
+       chunk_status = lttng_trace_chunk_set_as_owner(trace_chunk, session_output_directory);
        lttng_directory_handle_put(session_output_directory);
        session_output_directory = NULL;
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
@@ -732,9 +711,9 @@ error:
 }
 
 int session_close_trace_chunk(struct ltt_session *session,
-               struct lttng_trace_chunk *trace_chunk,
-               enum lttng_trace_chunk_command_type close_command,
-               char *closed_trace_chunk_path)
+                             struct lttng_trace_chunk *trace_chunk,
+                             enum lttng_trace_chunk_command_type close_command,
+                             char *closed_trace_chunk_path)
 {
        int ret = 0;
        bool error_occurred = false;
@@ -744,8 +723,7 @@ int session_close_trace_chunk(struct ltt_session *session,
        const time_t chunk_close_timestamp = time(NULL);
        const char *new_path;
 
-       chunk_status = lttng_trace_chunk_set_close_command(
-                       trace_chunk, close_command);
+       chunk_status = lttng_trace_chunk_set_close_command(trace_chunk, close_command);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ret = -1;
                goto end;
@@ -753,7 +731,7 @@ int session_close_trace_chunk(struct ltt_session *session,
 
        if (chunk_close_timestamp == (time_t) -1) {
                ERR("Failed to sample the close timestamp of the current trace chunk of session \"%s\"",
-                               session->name);
+                   session->name);
                ret = -1;
                goto end;
        }
@@ -766,17 +744,17 @@ int session_close_trace_chunk(struct ltt_session *session,
                new_path = NULL;
        }
        if (session->current_trace_chunk &&
-                       !lttng_trace_chunk_get_name_overridden(session->current_trace_chunk)) {
+           !lttng_trace_chunk_get_name_overridden(session->current_trace_chunk)) {
                /* Rename new chunk path. */
-               chunk_status = lttng_trace_chunk_rename_path(session->current_trace_chunk,
-                                       new_path);
+               chunk_status =
+                       lttng_trace_chunk_rename_path(session->current_trace_chunk, new_path);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
        }
        if (!lttng_trace_chunk_get_name_overridden(trace_chunk) &&
-                       close_command == LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION) {
+           close_command == LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION) {
                const char *old_path;
 
                if (!session->rotated) {
@@ -785,8 +763,7 @@ int session_close_trace_chunk(struct ltt_session *session,
                        old_path = NULL;
                }
                /* We need to move back the .tmp_old_chunk to its rightful place. */
-               chunk_status = lttng_trace_chunk_rename_path(trace_chunk,
-                                       old_path);
+               chunk_status = lttng_trace_chunk_rename_path(trace_chunk, old_path);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ret = -1;
                        goto end;
@@ -795,27 +772,25 @@ int session_close_trace_chunk(struct ltt_session *session,
        if (close_command == LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED) {
                session->rotated = true;
        }
-       chunk_status = lttng_trace_chunk_set_close_timestamp(trace_chunk,
-                       chunk_close_timestamp);
+       chunk_status = lttng_trace_chunk_set_close_timestamp(trace_chunk, chunk_close_timestamp);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ERR("Failed to set the close timestamp of the current trace chunk of session \"%s\"",
-                               session->name);
+                   session->name);
                ret = -1;
                goto end;
        }
 
        if (session->ust_session) {
-               const uint64_t relayd_id =
-                               session->ust_session->consumer->net_seq_index;
+               const uint64_t relayd_id = session->ust_session->consumer->net_seq_index;
 
-               cds_lfht_for_each_entry(
-                               session->ust_session->consumer->socks->ht,
-                               &iter, socket, node.node) {
+               cds_lfht_for_each_entry (
+                       session->ust_session->consumer->socks->ht, &iter, socket, node.node) {
                        pthread_mutex_lock(socket->lock);
                        ret = consumer_close_trace_chunk(socket,
-                                       relayd_id,
-                                       session->id,
-                                       trace_chunk, closed_trace_chunk_path);
+                                                        relayd_id,
+                                                        session->id,
+                                                        trace_chunk,
+                                                        closed_trace_chunk_path);
                        pthread_mutex_unlock(socket->lock);
                        if (ret) {
                                ERR("Failed to close trace chunk on user space consumer");
@@ -824,17 +799,16 @@ int session_close_trace_chunk(struct ltt_session *session,
                }
        }
        if (session->kernel_session) {
-               const uint64_t relayd_id =
-                               session->kernel_session->consumer->net_seq_index;
+               const uint64_t relayd_id = session->kernel_session->consumer->net_seq_index;
 
-               cds_lfht_for_each_entry(
-                               session->kernel_session->consumer->socks->ht,
-                               &iter, socket, node.node) {
+               cds_lfht_for_each_entry (
+                       session->kernel_session->consumer->socks->ht, &iter, socket, node.node) {
                        pthread_mutex_lock(socket->lock);
                        ret = consumer_close_trace_chunk(socket,
-                                       relayd_id,
-                                       session->id,
-                                       trace_chunk, closed_trace_chunk_path);
+                                                        relayd_id,
+                                                        session->id,
+                                                        trace_chunk,
+                                                        closed_trace_chunk_path);
                        pthread_mutex_unlock(socket->lock);
                        if (ret) {
                                ERR("Failed to close trace chunk on kernel consumer");
@@ -863,8 +837,7 @@ end:
  * daemon as the same "offset" in a metadata stream will no longer point
  * to the same content.
  */
-static
-enum lttng_error_code session_kernel_open_packets(struct ltt_session *session)
+static enum lttng_error_code session_kernel_open_packets(struct ltt_session *session)
 {
        enum lttng_error_code ret = LTTNG_OK;
        struct consumer_socket *socket;
@@ -878,13 +851,14 @@ enum lttng_error_code session_kernel_open_packets(struct ltt_session *session)
        node = cds_lfht_iter_get_node(&iter.iter);
        socket = caa_container_of(node, typeof(*socket), node.node);
 
-       cds_list_for_each_entry(chan,
-                       &session->kernel_session->channel_list.head, list) {
+       cds_list_for_each_entry (chan, &session->kernel_session->channel_list.head, list) {
                int open_ret;
 
                DBG("Open packet of kernel channel: channel key = %" PRIu64
-                               ", session name = %s, session_id = %" PRIu64,
-                               chan->key, session->name, session->id);
+                   ", session name = %s, session_id = %" PRIu64,
+                   chan->key,
+                   session->name,
+                   session->id);
 
                open_ret = consumer_open_channel_packets(socket, chan->key);
                if (open_ret < 0) {
@@ -904,7 +878,8 @@ enum lttng_error_code session_open_packets(struct ltt_session *session)
        enum lttng_error_code ret = LTTNG_OK;
 
        DBG("Opening packets of session channels: session name = %s, session id = %" PRIu64,
-                       session->name, session->id);
+           session->name,
+           session->id);
 
        if (session->ust_session) {
                ret = ust_app_open_packets(session);
@@ -930,25 +905,23 @@ end:
  * Must be called with the session lock held.
  */
 int session_set_trace_chunk(struct ltt_session *session,
-               struct lttng_trace_chunk *new_trace_chunk,
-               struct lttng_trace_chunk **current_trace_chunk)
+                           struct lttng_trace_chunk *new_trace_chunk,
+                           struct lttng_trace_chunk **current_trace_chunk)
 {
        ASSERT_LOCKED(session->lock);
-       return _session_set_trace_chunk_no_lock_check(session, new_trace_chunk,
-                       current_trace_chunk);
+       return _session_set_trace_chunk_no_lock_check(
+               session, new_trace_chunk, current_trace_chunk);
 }
 
-static
-void session_notify_destruction(const struct ltt_session *session)
+static void session_notify_destruction(const struct ltt_session *session)
 {
        size_t i;
-       const size_t count = lttng_dynamic_array_get_count(
-                       &session->destroy_notifiers);
+       const size_t count = lttng_dynamic_array_get_count(&session->destroy_notifiers);
 
        for (i = 0; i < count; i++) {
                const struct ltt_session_destroy_notifier_element *element =
                        (ltt_session_destroy_notifier_element *) lttng_dynamic_array_get_element(
-                                       &session->destroy_notifiers, i);
+                               &session->destroy_notifiers, i);
 
                element->notifier(session, element->user_data);
        }
@@ -960,21 +933,19 @@ void session_notify_destruction(const struct ltt_session *session)
 void session_notify_clear(struct ltt_session *session)
 {
        size_t i;
-       const size_t count = lttng_dynamic_array_get_count(
-                       &session->clear_notifiers);
+       const size_t count = lttng_dynamic_array_get_count(&session->clear_notifiers);
 
        for (i = 0; i < count; i++) {
                const struct ltt_session_clear_notifier_element *element =
                        (ltt_session_clear_notifier_element *) lttng_dynamic_array_get_element(
-                                       &session->clear_notifiers, i);
+                               &session->clear_notifiers, i);
 
                element->notifier(session, element->user_data);
        }
        lttng_dynamic_array_clear(&session->clear_notifiers);
 }
 
-static
-void session_release(struct urcu_ref *ref)
+static void session_release(struct urcu_ref *ref)
 {
        int ret;
        struct ltt_ust_session *usess;
@@ -1110,27 +1081,23 @@ void session_destroy(struct ltt_session *session)
 }
 
 int session_add_destroy_notifier(struct ltt_session *session,
-               ltt_session_destroy_notifier notifier, void *user_data)
+                                ltt_session_destroy_notifier notifier,
+                                void *user_data)
 {
-       const struct ltt_session_destroy_notifier_element element = {
-               .notifier = notifier,
-               .user_data = user_data
-       };
+       const struct ltt_session_destroy_notifier_element element = { .notifier = notifier,
+                                                                     .user_data = user_data };
 
-       return lttng_dynamic_array_add_element(&session->destroy_notifiers,
-                       &element);
+       return lttng_dynamic_array_add_element(&session->destroy_notifiers, &element);
 }
 
 int session_add_clear_notifier(struct ltt_session *session,
-               ltt_session_clear_notifier notifier, void *user_data)
+                              ltt_session_clear_notifier notifier,
+                              void *user_data)
 {
-       const struct ltt_session_clear_notifier_element element = {
-               .notifier = notifier,
-               .user_data = user_data
-       };
+       const struct ltt_session_clear_notifier_element element = { .notifier = notifier,
+                                                                   .user_data = user_data };
 
-       return lttng_dynamic_array_add_element(&session->clear_notifiers,
-                       &element);
+       return lttng_dynamic_array_add_element(&session->clear_notifiers, &element);
 }
 
 /*
@@ -1148,9 +1115,8 @@ struct ltt_session *session_find_by_name(const char *name)
 
        DBG2("Trying to find session by name %s", name);
 
-       cds_list_for_each_entry(iter, &the_session_list.head, list) {
-               if (!strncmp(iter->name, name, NAME_MAX) &&
-                               !iter->destroyed) {
+       cds_list_for_each_entry (iter, &the_session_list.head, list) {
+               if (!strncmp(iter->name, name, NAME_MAX) && !iter->destroyed) {
                        goto found;
                }
        }
@@ -1197,8 +1163,8 @@ end:
  * Create a new session and add it to the session list.
  * Session list lock must be held by the caller.
  */
-enum lttng_error_code session_create(const char *name, uid_t uid, gid_t gid,
-               struct ltt_session **out_session)
+enum lttng_error_code
+session_create(const char *name, uid_t uid, gid_t gid, struct ltt_session **out_session)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -1223,11 +1189,11 @@ enum lttng_error_code session_create(const char *name, uid_t uid, gid_t gid,
        }
 
        lttng_dynamic_array_init(&new_session->destroy_notifiers,
-                       sizeof(struct ltt_session_destroy_notifier_element),
-                       NULL);
+                                sizeof(struct ltt_session_destroy_notifier_element),
+                                NULL);
        lttng_dynamic_array_init(&new_session->clear_notifiers,
-                       sizeof(struct ltt_session_clear_notifier_element),
-                       NULL);
+                                sizeof(struct ltt_session_clear_notifier_element),
+                                NULL);
        urcu_ref_init(&new_session->ref);
        pthread_mutex_init(&new_session->lock, NULL);
 
@@ -1273,16 +1239,17 @@ enum lttng_error_code session_create(const char *name, uid_t uid, gid_t gid,
 
                        if (i == 0) {
                                ret = snprintf(new_session->name,
-                                               sizeof(new_session->name),
-                                               "%s-%s",
-                                               DEFAULT_SESSION_NAME,
-                                               datetime);
+                                              sizeof(new_session->name),
+                                              "%s-%s",
+                                              DEFAULT_SESSION_NAME,
+                                              datetime);
                        } else {
                                ret = snprintf(new_session->name,
-                                               sizeof(new_session->name),
-                                               "%s%d-%s",
-                                               DEFAULT_SESSION_NAME, i,
-                                               datetime);
+                                              sizeof(new_session->name),
+                                              "%s%d-%s",
+                                              DEFAULT_SESSION_NAME,
+                                              i,
+                                              datetime);
                        }
                        new_session->name_contains_creation_time = true;
                        if (ret == -1 || ret >= sizeof(new_session->name)) {
@@ -1295,8 +1262,7 @@ enum lttng_error_code session_create(const char *name, uid_t uid, gid_t gid,
                                goto error;
                        }
 
-                       clashing_session =
-                                       session_find_by_name(new_session->name);
+                       clashing_session = session_find_by_name(new_session->name);
                        session_put(clashing_session);
                        if (!clashing_session) {
                                found_name = true;
@@ -1318,7 +1284,7 @@ enum lttng_error_code session_create(const char *name, uid_t uid, gid_t gid,
                if (errno == ENAMETOOLONG) {
                        new_session->hostname[sizeof(new_session->hostname) - 1] = '\0';
                        ERR("Hostname exceeds the maximal permitted length and has been truncated to %s",
-                                       new_session->hostname);
+                           new_session->hostname);
                } else {
                        ret_code = LTTNG_ERR_SESSION_FAIL;
                        goto error;
@@ -1353,8 +1319,10 @@ enum lttng_error_code session_create(const char *name, uid_t uid, gid_t gid,
         * set it up and, if valid, assign it to the session.
         */
        DBG("Tracing session %s created with ID %" PRIu64 " by uid = %d, gid = %d",
-                       new_session->name, new_session->id, new_session->uid,
-                       new_session->gid);
+           new_session->name,
+           new_session->id,
+           new_session->uid,
+           new_session->gid);
        ret_code = LTTNG_OK;
 end:
        if (new_session) {
@@ -1393,8 +1361,7 @@ bool session_access_ok(struct ltt_session *session, uid_t uid)
  *
  * Must be called with the session and session_list locks held.
  */
-int session_reset_rotation_state(struct ltt_session *session,
-               enum lttng_rotation_state result)
+int session_reset_rotation_state(struct ltt_session *session, enum lttng_rotation_state result)
 {
        int ret = 0;
 
@@ -1409,12 +1376,9 @@ int session_reset_rotation_state(struct ltt_session *session,
                uint64_t chunk_id;
                enum lttng_trace_chunk_status chunk_status;
 
-               chunk_status = lttng_trace_chunk_get_id(
-                               session->chunk_being_archived,
-                               &chunk_id);
+               chunk_status = lttng_trace_chunk_get_id(session->chunk_being_archived, &chunk_id);
                LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
-               LTTNG_OPTIONAL_SET(&session->last_archived_chunk_id,
-                               chunk_id);
+               LTTNG_OPTIONAL_SET(&session->last_archived_chunk_id, chunk_id);
                lttng_trace_chunk_put(session->chunk_being_archived);
                session->chunk_being_archived = NULL;
                /*
@@ -1498,5 +1462,5 @@ ltt_session::sptr ls::find_session_by_id(ltt_session::id_t id)
                return nullptr;
        }
 
-       return {session, session_put};
+       return { session, session_put };
 }
index 8ebb2a07c3c674dc6c9d0436a9b6382d8244d87c..e45c1bd40013844b581ed312eb17f938d08ba025 100644 (file)
@@ -5,35 +5,36 @@
  *
  */
 
-#include "version.hpp"
-#include "sessiond-config.hpp"
 #include "lttng-ust-ctl.hpp"
+#include "sessiond-config.hpp"
+#include "version.hpp"
+
+#include <common/compat/errno.hpp>
+#include <common/compat/getenv.hpp>
 #include <common/defaults.hpp>
-#include <limits.h>
-#include <ctype.h>
 #include <common/error.hpp>
-#include <common/utils.hpp>
 #include <common/path.hpp>
-#include <common/compat/errno.hpp>
-#include <common/compat/getenv.hpp>
+#include <common/utils.hpp>
 
-static
-struct sessiond_config sessiond_config_build_defaults = {
-       .verbose =                              0,
-       .verbose_consumer =                     0,
-       .agent_tcp_port =                       { .begin = DEFAULT_AGENT_TCP_PORT_RANGE_BEGIN, .end = DEFAULT_AGENT_TCP_PORT_RANGE_END },
+#include <ctype.h>
+#include <limits.h>
 
-       .event_notifier_buffer_size_kernel =    DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE,
-       .event_notifier_buffer_size_userspace = DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE,
-       .app_socket_timeout =                   DEFAULT_APP_SOCKET_RW_TIMEOUT,
+static struct sessiond_config sessiond_config_build_defaults = {
+       .verbose = 0,
+       .verbose_consumer = 0,
+       .agent_tcp_port = { .begin = DEFAULT_AGENT_TCP_PORT_RANGE_BEGIN,
+                           .end = DEFAULT_AGENT_TCP_PORT_RANGE_END },
 
-       .quiet =                                false,
+       .event_notifier_buffer_size_kernel = DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE,
+       .event_notifier_buffer_size_userspace = DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE,
+       .app_socket_timeout = DEFAULT_APP_SOCKET_RW_TIMEOUT,
 
+       .quiet = false,
 
-       .no_kernel =                            false,
-       .background =                           false,
-       .daemonize =                            false,
-       .sig_parent =                           false,
+       .no_kernel = false,
+       .background = false,
+       .daemonize = false,
+       .sig_parent = false,
 
        .tracing_group_name = { (char *) DEFAULT_TRACING_GROUP, false },
 
@@ -69,15 +70,12 @@ struct sessiond_config sessiond_config_build_defaults = {
        .kconsumerd_cmd_unix_sock_path = { nullptr, false },
 };
 
-static
-void config_string_fini(struct config_string *str)
+static void config_string_fini(struct config_string *str)
 {
        config_string_set(str, NULL);
 }
 
-static
-void config_string_set_static(struct config_string *config_str,
-               const char *value)
+static void config_string_set_static(struct config_string *config_str, const char *value)
 {
        config_string_set(config_str, (char *) value);
        config_str->should_free = false;
@@ -108,10 +106,10 @@ int sessiond_config_apply_env_config(struct sessiond_config *config)
 
                errno = 0;
                int_val = strtoul(env_value, &endptr, 0);
-               if (errno != 0 || int_val > INT_MAX ||
-                               (int_val < 0 && int_val != -1)) {
+               if (errno != 0 || int_val > INT_MAX || (int_val < 0 && int_val != -1)) {
                        ERR("Invalid value \"%s\" used for \"%s\" environment variable",
-                                       env_value, DEFAULT_APP_SOCKET_TIMEOUT_ENV);
+                           env_value,
+                           DEFAULT_APP_SOCKET_TIMEOUT_ENV);
                        ret = -1;
                        goto end;
                }
@@ -121,49 +119,41 @@ int sessiond_config_apply_env_config(struct sessiond_config *config)
 
        env_value = lttng_secure_getenv("LTTNG_CONSUMERD32_BIN");
        if (env_value) {
-               config_string_set_static(&config->consumerd32_bin_path,
-                               env_value);
+               config_string_set_static(&config->consumerd32_bin_path, env_value);
        }
        env_value = lttng_secure_getenv("LTTNG_CONSUMERD64_BIN");
        if (env_value) {
-               config_string_set_static(&config->consumerd64_bin_path,
-                               env_value);
+               config_string_set_static(&config->consumerd64_bin_path, env_value);
        }
 
        env_value = lttng_secure_getenv("LTTNG_CONSUMERD32_LIBDIR");
        if (env_value) {
-               config_string_set_static(&config->consumerd32_lib_dir,
-                               env_value);
+               config_string_set_static(&config->consumerd32_lib_dir, env_value);
        }
        env_value = lttng_secure_getenv("LTTNG_CONSUMERD64_LIBDIR");
        if (env_value) {
-               config_string_set_static(&config->consumerd64_lib_dir,
-                               env_value);
+               config_string_set_static(&config->consumerd64_lib_dir, env_value);
        }
 
        env_value = lttng_secure_getenv("LTTNG_UST_CLOCK_PLUGIN");
        if (env_value) {
-               config_string_set_static(&config->lttng_ust_clock_plugin,
-                               env_value);
+               config_string_set_static(&config->lttng_ust_clock_plugin, env_value);
        }
 
        env_value = lttng_secure_getenv(DEFAULT_LTTNG_KMOD_PROBES);
        if (env_value) {
-               config_string_set_static(&config->kmod_probes_list,
-                               env_value);
+               config_string_set_static(&config->kmod_probes_list, env_value);
        }
 
        env_value = lttng_secure_getenv(DEFAULT_LTTNG_EXTRA_KMOD_PROBES);
        if (env_value) {
-               config_string_set_static(&config->kmod_extra_probes_list,
-                               env_value);
+               config_string_set_static(&config->kmod_extra_probes_list, env_value);
        }
 end:
        return ret;
 }
 
-static
-int config_set_paths_root(struct sessiond_config *config)
+static int config_set_paths_root(struct sessiond_config *config)
 {
        int ret = 0;
 
@@ -174,20 +164,15 @@ int config_set_paths_root(struct sessiond_config *config)
                goto end;
        }
 
-       config_string_set_static(&config->apps_unix_sock_path,
-                       DEFAULT_GLOBAL_APPS_UNIX_SOCK);
-       config_string_set_static(&config->client_unix_sock_path,
-                       DEFAULT_GLOBAL_CLIENT_UNIX_SOCK);
-       config_string_set_static(&config->wait_shm_path,
-                       DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH);
-       config_string_set_static(&config->health_unix_sock_path,
-                       DEFAULT_GLOBAL_HEALTH_UNIX_SOCK);
+       config_string_set_static(&config->apps_unix_sock_path, DEFAULT_GLOBAL_APPS_UNIX_SOCK);
+       config_string_set_static(&config->client_unix_sock_path, DEFAULT_GLOBAL_CLIENT_UNIX_SOCK);
+       config_string_set_static(&config->wait_shm_path, DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH);
+       config_string_set_static(&config->health_unix_sock_path, DEFAULT_GLOBAL_HEALTH_UNIX_SOCK);
 end:
        return ret;
 }
 
-static
-int config_set_paths_non_root(struct sessiond_config *config)
+static int config_set_paths_non_root(struct sessiond_config *config)
 {
        int ret = 0;
        const char *home_path = utils_get_home_dir();
@@ -267,8 +252,7 @@ int sessiond_config_init(struct sessiond_config *config)
        }
 
        /* 32 bits consumerd path setup */
-       ret = asprintf(&str, DEFAULT_USTCONSUMERD32_PATH,
-                       config->rundir.value);
+       ret = asprintf(&str, DEFAULT_USTCONSUMERD32_PATH, config->rundir.value);
        if (ret < 0) {
                ERR("Failed to set 32-bit consumer path");
                goto error;
@@ -276,8 +260,7 @@ int sessiond_config_init(struct sessiond_config *config)
        config_string_set(&config->consumerd32_path, str);
        str = NULL;
 
-       ret = asprintf(&str, DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH,
-                       config->rundir.value);
+       ret = asprintf(&str, DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH, config->rundir.value);
        if (ret < 0) {
                ERR("Failed to set 32-bit consumer error socket path");
                goto error;
@@ -285,8 +268,7 @@ int sessiond_config_init(struct sessiond_config *config)
        config_string_set(&config->consumerd32_err_unix_sock_path, str);
        str = NULL;
 
-       ret = asprintf(&str, DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH,
-                       config->rundir.value);
+       ret = asprintf(&str, DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH, config->rundir.value);
        if (ret < 0) {
                ERR("Failed to set 32-bit consumer command socket path");
                goto error;
@@ -295,8 +277,7 @@ int sessiond_config_init(struct sessiond_config *config)
        str = NULL;
 
        /* 64 bits consumerd path setup */
-       ret = asprintf(&str, DEFAULT_USTCONSUMERD64_PATH,
-                       config->rundir.value);
+       ret = asprintf(&str, DEFAULT_USTCONSUMERD64_PATH, config->rundir.value);
        if (ret < 0) {
                ERR("Failed to set 64-bit consumer path");
                goto error;
@@ -304,8 +285,7 @@ int sessiond_config_init(struct sessiond_config *config)
        config_string_set(&config->consumerd64_path, str);
        str = NULL;
 
-       ret = asprintf(&str, DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH,
-                       config->rundir.value);
+       ret = asprintf(&str, DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH, config->rundir.value);
        if (ret < 0) {
                ERR("Failed to set 64-bit consumer error socket path");
                goto error;
@@ -313,8 +293,7 @@ int sessiond_config_init(struct sessiond_config *config)
        config_string_set(&config->consumerd64_err_unix_sock_path, str);
        str = NULL;
 
-       ret = asprintf(&str, DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH,
-                       config->rundir.value);
+       ret = asprintf(&str, DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH, config->rundir.value);
        if (ret < 0) {
                ERR("Failed to set 64-bit consumer command socket path");
                goto error;
@@ -323,8 +302,7 @@ int sessiond_config_init(struct sessiond_config *config)
        str = NULL;
 
        /* kconsumerd consumerd path setup */
-       ret = asprintf(&str, DEFAULT_KCONSUMERD_PATH,
-                       config->rundir.value);
+       ret = asprintf(&str, DEFAULT_KCONSUMERD_PATH, config->rundir.value);
        if (ret < 0) {
                ERR("Failed to set kernel consumer path");
                goto error;
@@ -332,8 +310,7 @@ int sessiond_config_init(struct sessiond_config *config)
        config_string_set(&config->kconsumerd_path, str);
        str = NULL;
 
-       ret = asprintf(&str, DEFAULT_KCONSUMERD_ERR_SOCK_PATH,
-                       config->rundir.value);
+       ret = asprintf(&str, DEFAULT_KCONSUMERD_ERR_SOCK_PATH, config->rundir.value);
        if (ret < 0) {
                ERR("Failed to set kernel consumer error socket path");
                goto error;
@@ -341,8 +318,7 @@ int sessiond_config_init(struct sessiond_config *config)
        config_string_set(&config->kconsumerd_err_unix_sock_path, str);
        str = NULL;
 
-       ret = asprintf(&str, DEFAULT_KCONSUMERD_CMD_SOCK_PATH,
-                       config->rundir.value);
+       ret = asprintf(&str, DEFAULT_KCONSUMERD_CMD_SOCK_PATH, config->rundir.value);
        if (ret < 0) {
                ERR("Failed to set kernel consumer command socket path");
                goto error;
@@ -350,8 +326,7 @@ int sessiond_config_init(struct sessiond_config *config)
        config_string_set(&config->kconsumerd_cmd_unix_sock_path, str);
        str = NULL;
 
-       ret = asprintf(&str, "%s/%s", config->rundir.value,
-                       DEFAULT_LTTNG_SESSIOND_PIDFILE);
+       ret = asprintf(&str, "%s/%s", config->rundir.value, DEFAULT_LTTNG_SESSIOND_PIDFILE);
        if (ret < 0) {
                ERR("Failed to set PID file path");
                goto error;
@@ -359,8 +334,7 @@ int sessiond_config_init(struct sessiond_config *config)
        config_string_set(&config->pid_file_path, str);
        str = NULL;
 
-       ret = asprintf(&str, "%s/%s", config->rundir.value,
-                       DEFAULT_LTTNG_SESSIOND_LOCKFILE);
+       ret = asprintf(&str, "%s/%s", config->rundir.value, DEFAULT_LTTNG_SESSIOND_LOCKFILE);
        if (ret < 0) {
                ERR("Failed to set lock file path");
                goto error;
@@ -368,8 +342,7 @@ int sessiond_config_init(struct sessiond_config *config)
        config_string_set(&config->lock_file_path, str);
        str = NULL;
 
-       ret = asprintf(&str, "%s/%s", config->rundir.value,
-                       DEFAULT_LTTNG_SESSIOND_AGENTPORT_FILE);
+       ret = asprintf(&str, "%s/%s", config->rundir.value, DEFAULT_LTTNG_SESSIOND_AGENTPORT_FILE);
        if (ret < 0) {
                ERR("Failed to set agent port file path");
                goto error;
@@ -384,14 +357,12 @@ int sessiond_config_init(struct sessiond_config *config)
         */
 #if (CAA_BITS_PER_LONG == 32)
        config_string_set_static(&config->consumerd32_bin_path,
-                       INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE);
-       config_string_set_static(&config->consumerd32_lib_dir,
-                       INSTALL_LIB_PATH);
+                                INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE);
+       config_string_set_static(&config->consumerd32_lib_dir, INSTALL_LIB_PATH);
 #elif (CAA_BITS_PER_LONG == 64)
        config_string_set_static(&config->consumerd64_bin_path,
-                       INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE);
-       config_string_set_static(&config->consumerd64_lib_dir,
-                       INSTALL_LIB_PATH);
+                                INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE);
+       config_string_set_static(&config->consumerd64_lib_dir, INSTALL_LIB_PATH);
 #else
 #error "Unknown bitness"
 #endif
@@ -432,8 +403,7 @@ void sessiond_config_fini(struct sessiond_config *config)
        config_string_fini(&config->kconsumerd_cmd_unix_sock_path);
 }
 
-static
-int resolve_path(struct config_string *path)
+static int resolve_path(struct config_string *path)
 {
        int ret = 0;
        char *absolute_path;
@@ -453,9 +423,9 @@ end:
        return ret;
 }
 
-#define RESOLVE_CHECK(path_config_str)         \
-       if (resolve_path(path_config_str))      \
-               return -1
+#define RESOLVE_CHECK(path_config_str)     \
+       if (resolve_path(path_config_str)) \
+       return -1
 
 int sessiond_config_resolve_paths(struct sessiond_config *config)
 {
@@ -507,38 +477,60 @@ void sessiond_config_log(struct sessiond_config *config)
                DBG_NO_LOC("\tagent_tcp_port:                %i", config->agent_tcp_port.begin);
        } else {
                DBG_NO_LOC("\tagent_tcp_port:                [%i, %i]",
-                               config->agent_tcp_port.begin,
-                               config->agent_tcp_port.end);
+                          config->agent_tcp_port.begin,
+                          config->agent_tcp_port.end);
        }
        DBG_NO_LOC("\tapplication socket timeout:    %i", config->app_socket_timeout);
        DBG_NO_LOC("\tno-kernel:                     %s", config->no_kernel ? "True" : "False");
        DBG_NO_LOC("\tbackground:                    %s", config->background ? "True" : "False");
        DBG_NO_LOC("\tdaemonize:                     %s", config->daemonize ? "True" : "False");
        DBG_NO_LOC("\tsignal parent on start:        %s", config->sig_parent ? "True" : "False");
-       DBG_NO_LOC("\ttracing group name:            %s", config->tracing_group_name.value ? : "Unknown");
-       DBG_NO_LOC("\tkmod_probe_list:               %s", config->kmod_probes_list.value ? : "None");
-       DBG_NO_LOC("\tkmod_extra_probe_list:         %s", config->kmod_extra_probes_list.value ? : "None");
-       DBG_NO_LOC("\trundir:                        %s", config->rundir.value ? : "Unknown");
-       DBG_NO_LOC("\tapplication socket path:       %s", config->apps_unix_sock_path.value ? : "Unknown");
-       DBG_NO_LOC("\tclient socket path:            %s", config->client_unix_sock_path.value ? : "Unknown");
-       DBG_NO_LOC("\twait shm path:                 %s", config->wait_shm_path.value ? : "Unknown");
-       DBG_NO_LOC("\thealth socket path:            %s", config->health_unix_sock_path.value ? : "Unknown");
-       DBG_NO_LOC("\tLTTNG_UST_CLOCK_PLUGIN:        %s", config->lttng_ust_clock_plugin.value ? : "None");
-       DBG_NO_LOC("\tpid file path:                 %s", config->pid_file_path.value ? : "Unknown");
-       DBG_NO_LOC("\tlock file path:                %s", config->lock_file_path.value ? : "Unknown");
-       DBG_NO_LOC("\tsession load path:             %s", config->load_session_path.value ? : "None");
-       DBG_NO_LOC("\tagent port file path:          %s", config->agent_port_file_path.value ? : "Unknown");
-       DBG_NO_LOC("\tconsumerd32 path:              %s", config->consumerd32_path.value ? : "Unknown");
-       DBG_NO_LOC("\tconsumerd32 bin path:          %s", config->consumerd32_bin_path.value ? : "Unknown");
-       DBG_NO_LOC("\tconsumerd32 lib dir:           %s", config->consumerd32_lib_dir.value ? : "Unknown");
-       DBG_NO_LOC("\tconsumerd32 err unix sock path:%s", config->consumerd32_err_unix_sock_path.value ? : "Unknown");
-       DBG_NO_LOC("\tconsumerd32 cmd unix sock path:%s", config->consumerd32_cmd_unix_sock_path.value ? : "Unknown");
-       DBG_NO_LOC("\tconsumerd64 path:              %s", config->consumerd64_path.value ? : "Unknown");
-       DBG_NO_LOC("\tconsumerd64 bin path:          %s", config->consumerd64_bin_path.value ? : "Unknown");
-       DBG_NO_LOC("\tconsumerd64 lib dir:           %s", config->consumerd64_lib_dir.value ? : "Unknown");
-       DBG_NO_LOC("\tconsumerd64 err unix sock path:%s", config->consumerd64_err_unix_sock_path.value ? : "Unknown");
-       DBG_NO_LOC("\tconsumerd64 cmd unix sock path:%s", config->consumerd64_cmd_unix_sock_path.value ? : "Unknown");
-       DBG_NO_LOC("\tkconsumerd path:               %s", config->kconsumerd_path.value ? : "Unknown");
-       DBG_NO_LOC("\tkconsumerd err unix sock path: %s", config->kconsumerd_err_unix_sock_path.value ? : "Unknown");
-       DBG_NO_LOC("\tkconsumerd cmd unix sock path: %s", config->kconsumerd_cmd_unix_sock_path.value ? : "Unknown");
+       DBG_NO_LOC("\ttracing group name:            %s",
+                  config->tracing_group_name.value ?: "Unknown");
+       DBG_NO_LOC("\tkmod_probe_list:               %s", config->kmod_probes_list.value ?: "None");
+       DBG_NO_LOC("\tkmod_extra_probe_list:         %s",
+                  config->kmod_extra_probes_list.value ?: "None");
+       DBG_NO_LOC("\trundir:                        %s", config->rundir.value ?: "Unknown");
+       DBG_NO_LOC("\tapplication socket path:       %s",
+                  config->apps_unix_sock_path.value ?: "Unknown");
+       DBG_NO_LOC("\tclient socket path:            %s",
+                  config->client_unix_sock_path.value ?: "Unknown");
+       DBG_NO_LOC("\twait shm path:                 %s", config->wait_shm_path.value ?: "Unknown");
+       DBG_NO_LOC("\thealth socket path:            %s",
+                  config->health_unix_sock_path.value ?: "Unknown");
+       DBG_NO_LOC("\tLTTNG_UST_CLOCK_PLUGIN:        %s",
+                  config->lttng_ust_clock_plugin.value ?: "None");
+       DBG_NO_LOC("\tpid file path:                 %s", config->pid_file_path.value ?: "Unknown");
+       DBG_NO_LOC("\tlock file path:                %s",
+                  config->lock_file_path.value ?: "Unknown");
+       DBG_NO_LOC("\tsession load path:             %s",
+                  config->load_session_path.value ?: "None");
+       DBG_NO_LOC("\tagent port file path:          %s",
+                  config->agent_port_file_path.value ?: "Unknown");
+       DBG_NO_LOC("\tconsumerd32 path:              %s",
+                  config->consumerd32_path.value ?: "Unknown");
+       DBG_NO_LOC("\tconsumerd32 bin path:          %s",
+                  config->consumerd32_bin_path.value ?: "Unknown");
+       DBG_NO_LOC("\tconsumerd32 lib dir:           %s",
+                  config->consumerd32_lib_dir.value ?: "Unknown");
+       DBG_NO_LOC("\tconsumerd32 err unix sock path:%s",
+                  config->consumerd32_err_unix_sock_path.value ?: "Unknown");
+       DBG_NO_LOC("\tconsumerd32 cmd unix sock path:%s",
+                  config->consumerd32_cmd_unix_sock_path.value ?: "Unknown");
+       DBG_NO_LOC("\tconsumerd64 path:              %s",
+                  config->consumerd64_path.value ?: "Unknown");
+       DBG_NO_LOC("\tconsumerd64 bin path:          %s",
+                  config->consumerd64_bin_path.value ?: "Unknown");
+       DBG_NO_LOC("\tconsumerd64 lib dir:           %s",
+                  config->consumerd64_lib_dir.value ?: "Unknown");
+       DBG_NO_LOC("\tconsumerd64 err unix sock path:%s",
+                  config->consumerd64_err_unix_sock_path.value ?: "Unknown");
+       DBG_NO_LOC("\tconsumerd64 cmd unix sock path:%s",
+                  config->consumerd64_cmd_unix_sock_path.value ?: "Unknown");
+       DBG_NO_LOC("\tkconsumerd path:               %s",
+                  config->kconsumerd_path.value ?: "Unknown");
+       DBG_NO_LOC("\tkconsumerd err unix sock path: %s",
+                  config->kconsumerd_err_unix_sock_path.value ?: "Unknown");
+       DBG_NO_LOC("\tkconsumerd cmd unix sock path: %s",
+                  config->kconsumerd_cmd_unix_sock_path.value ?: "Unknown");
 }
index e0ffe69c0b1a5303cebfe908ab99cee7eb2220d1..dda699fc4bcf5ea6b6b8bf4c2d546ed336c5f7d9 100644 (file)
@@ -6,14 +6,14 @@
  */
 
 #define _LGPL_SOURCE
-#include <inttypes.h>
-#include <string.h>
-#include <urcu/uatomic.h>
+#include "snapshot.hpp"
+#include "utils.hpp"
 
 #include <common/defaults.hpp>
 
-#include "snapshot.hpp"
-#include "utils.hpp"
+#include <inttypes.h>
+#include <string.h>
+#include <urcu/uatomic.h>
 
 /*
  * Return the atomically incremented value of next_output_id.
@@ -29,10 +29,13 @@ static inline unsigned long get_next_output_id(struct snapshot *snapshot)
  * Return 0 on success or else a negative value.
  */
 static int output_init(const struct ltt_session *session,
-               uint64_t max_size, const char *name,
-               struct lttng_uri *uris, size_t nb_uri,
-               struct consumer_output *consumer, struct snapshot_output *output,
-               struct snapshot *snapshot)
+                      uint64_t max_size,
+                      const char *name,
+                      struct lttng_uri *uris,
+                      size_t nb_uri,
+                      struct consumer_output *consumer,
+                      struct snapshot_output *output,
+                      struct snapshot *snapshot)
 {
        int ret = 0, i;
 
@@ -58,8 +61,11 @@ static int output_init(const struct ltt_session *session,
                }
        } else {
                /* Set default name. */
-               ret = snprintf(output->name, sizeof(output->name), "%s-%" PRIu32,
-                               DEFAULT_SNAPSHOT_NAME, output->id);
+               ret = snprintf(output->name,
+                              sizeof(output->name),
+                              "%s-%" PRIu32,
+                              DEFAULT_SNAPSHOT_NAME,
+                              output->id);
                if (ret < 0) {
                        ret = -ENOMEM;
                        goto error;
@@ -84,11 +90,12 @@ static int output_init(const struct ltt_session *session,
        }
 
        if (uris[0].dtype == LTTNG_DST_PATH) {
-               memset(output->consumer->dst.session_root_path, 0,
-                               sizeof(output->consumer->dst.session_root_path));
+               memset(output->consumer->dst.session_root_path,
+                      0,
+                      sizeof(output->consumer->dst.session_root_path));
                if (lttng_strncpy(output->consumer->dst.session_root_path,
-                               uris[0].dst.path,
-                               sizeof(output->consumer->dst.session_root_path))) {
+                                 uris[0].dst.path,
+                                 sizeof(output->consumer->dst.session_root_path))) {
                        ret = -LTTNG_ERR_INVALID;
                        goto error;
                }
@@ -103,10 +110,9 @@ static int output_init(const struct ltt_session *session,
                goto error;
        }
 
-       for (i = 0; i < nb_uri; i ++) {
+       for (i = 0; i < nb_uri; i++) {
                /* Network URIs */
-               ret = consumer_set_network_uri(session, output->consumer,
-                               &uris[i]);
+               ret = consumer_set_network_uri(session, output->consumer, &uris[i]);
                if (ret < 0) {
                        goto error;
                }
@@ -124,13 +130,15 @@ end:
  * Return 0 on success or else a negative value.
  */
 int snapshot_output_init_with_uri(const struct ltt_session *session,
-               uint64_t max_size, const char *name,
-               struct lttng_uri *uris, size_t nb_uri,
-               struct consumer_output *consumer, struct snapshot_output *output,
-               struct snapshot *snapshot)
+                                 uint64_t max_size,
+                                 const char *name,
+                                 struct lttng_uri *uris,
+                                 size_t nb_uri,
+                                 struct consumer_output *consumer,
+                                 struct snapshot_output *output,
+                                 struct snapshot *snapshot)
 {
-       return output_init(session, max_size, name, uris, nb_uri, consumer,
-                       output, snapshot);
+       return output_init(session, max_size, name, uris, nb_uri, consumer, output, snapshot);
 }
 
 /*
@@ -140,10 +148,13 @@ int snapshot_output_init_with_uri(const struct ltt_session *session,
  * Return 0 on success or else a negative value.
  */
 int snapshot_output_init(const struct ltt_session *session,
-               uint64_t max_size, const char *name,
-               const char *ctrl_url, const char *data_url,
-               struct consumer_output *consumer, struct snapshot_output *output,
-               struct snapshot *snapshot)
+                        uint64_t max_size,
+                        const char *name,
+                        const char *ctrl_url,
+                        const char *data_url,
+                        struct consumer_output *consumer,
+                        struct snapshot_output *output,
+                        struct snapshot *snapshot)
 {
        int ret = 0, nb_uri;
        struct lttng_uri *uris = NULL;
@@ -155,8 +166,7 @@ int snapshot_output_init(const struct ltt_session *session,
                goto error;
        }
 
-       ret = output_init(session, max_size, name, uris, nb_uri, consumer,
-                       output, snapshot);
+       ret = output_init(session, max_size, name, uris, nb_uri, consumer, output, snapshot);
 
 error:
        free(uris);
@@ -171,8 +181,7 @@ struct snapshot_output *snapshot_output_alloc(void)
 /*
  * Delete output from the snapshot object.
  */
-void snapshot_delete_output(struct snapshot *snapshot,
-               struct snapshot_output *output)
+void snapshot_delete_output(struct snapshot *snapshot, struct snapshot_output *output)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -196,8 +205,7 @@ void snapshot_delete_output(struct snapshot *snapshot,
 /*
  * Add output object to the snapshot.
  */
-void snapshot_add_output(struct snapshot *snapshot,
-               struct snapshot_output *output)
+void snapshot_add_output(struct snapshot *snapshot, struct snapshot_output *output)
 {
        LTTNG_ASSERT(snapshot);
        LTTNG_ASSERT(snapshot->output_ht);
@@ -233,8 +241,7 @@ void snapshot_output_destroy(struct snapshot_output *obj)
  *
  * Return the reference on success or else NULL.
  */
-struct snapshot_output *snapshot_find_output_by_name(const char *name,
-               struct snapshot *snapshot)
+struct snapshot_output *snapshot_find_output_by_name(const char *name, struct snapshot *snapshot)
 {
        struct lttng_ht_iter iter;
        struct snapshot_output *output = NULL;
@@ -243,8 +250,7 @@ struct snapshot_output *snapshot_find_output_by_name(const char *name,
        LTTNG_ASSERT(name);
        ASSERT_RCU_READ_LOCKED();
 
-       cds_lfht_for_each_entry(snapshot->output_ht->ht, &iter.iter, output,
-               node.node) {
+       cds_lfht_for_each_entry (snapshot->output_ht->ht, &iter.iter, output, node.node) {
                if (!strncmp(output->name, name, strlen(name))) {
                        return output;
                }
@@ -260,8 +266,7 @@ struct snapshot_output *snapshot_find_output_by_name(const char *name,
  *
  * Return the reference on success or else NULL.
  */
-struct snapshot_output *snapshot_find_output_by_id(uint32_t id,
-               struct snapshot *snapshot)
+struct snapshot_output *snapshot_find_output_by_id(uint32_t id, struct snapshot *snapshot)
 {
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
@@ -270,7 +275,7 @@ struct snapshot_output *snapshot_find_output_by_id(uint32_t id,
        LTTNG_ASSERT(snapshot);
        ASSERT_RCU_READ_LOCKED();
 
-       lttng_ht_lookup(snapshot->output_ht, (void *)((unsigned long) id), &iter);
+       lttng_ht_lookup(snapshot->output_ht, (void *) ((unsigned long) id), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
        if (!node) {
                DBG3("Snapshot output not found with id %" PRId32, id);
@@ -321,8 +326,7 @@ void snapshot_destroy(struct snapshot *obj)
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(obj->output_ht->ht, &iter.iter, output,
-                       node.node) {
+       cds_lfht_for_each_entry (obj->output_ht->ht, &iter.iter, output, node.node) {
                snapshot_delete_output(obj, output);
                snapshot_output_destroy(output);
        }
index b56f0e2a02af77d89db85f1426f809ec557df966..856b98e8ad77c1de6b58c24036ae65ae627068a7 100644 (file)
 
 namespace lst = lttng::sessiond::trace;
 
-lttng::sessiond::trace::stream_class::stream_class(unsigned int in_id,
-               enum header_type in_header_type,
-               nonstd::optional<std::string> in_default_clock_class_name) :
-       id{in_id},
-       header_type_{in_header_type},
-       default_clock_class_name{std::move(in_default_clock_class_name)}
+lttng::sessiond::trace::stream_class::stream_class(
+       unsigned int in_id,
+       enum header_type in_header_type,
+       nonstd::optional<std::string> in_default_clock_class_name) :
+       id{ in_id },
+       header_type_{ in_header_type },
+       default_clock_class_name{ std::move(in_default_clock_class_name) }
 {
 }
 
index 3465fc227bd2ae13c55920ebf75779db7208f9a3..5e8579a5e5fd65567e463256fb348ead05f671ff 100644 (file)
@@ -9,7 +9,9 @@
 
 #include "lttng-sessiond.hpp"
 #include "utils.hpp"
+
 #include <common/utils.hpp>
+
 #include <pthread.h>
 
 /*
index fd9136fe5562b4e5acee6a70bef36061572b38c0..661bc517b2f6a37e8ffa29c935d09f1583f73867 100644 (file)
@@ -6,12 +6,14 @@
  */
 
 #include "thread.hpp"
+
+#include <common/defaults.hpp>
+#include <common/error.hpp>
+#include <common/macros.hpp>
+
+#include <pthread.h>
 #include <urcu/list.h>
 #include <urcu/ref.h>
-#include <pthread.h>
-#include <common/macros.hpp>
-#include <common/error.hpp>
-#include <common/defaults.hpp>
 
 namespace {
 struct thread_list {
@@ -42,8 +44,7 @@ struct lttng_thread {
        void *data;
 };
 
-static
-void lttng_thread_destroy(struct lttng_thread *thread)
+static void lttng_thread_destroy(struct lttng_thread *thread)
 {
        if (thread->cleanup) {
                thread->cleanup(thread->data);
@@ -51,14 +52,12 @@ void lttng_thread_destroy(struct lttng_thread *thread)
        free(thread);
 }
 
-static
-void lttng_thread_release(struct urcu_ref *ref)
+static void lttng_thread_release(struct urcu_ref *ref)
 {
        lttng_thread_destroy(lttng::utils::container_of(ref, &lttng_thread::ref));
 }
 
-static
-void *launch_thread(void *data)
+static void *launch_thread(void *data)
 {
        void *ret;
        struct lttng_thread *thread = (struct lttng_thread *) data;
@@ -71,10 +70,10 @@ void *launch_thread(void *data)
 }
 
 struct lttng_thread *lttng_thread_create(const char *name,
-               lttng_thread_entry_point entry,
-               lttng_thread_shutdown_cb shutdown,
-               lttng_thread_cleanup_cb cleanup,
-               void *thread_data)
+                                        lttng_thread_entry_point entry,
+                                        lttng_thread_shutdown_cb shutdown,
+                                        lttng_thread_cleanup_cb cleanup,
+                                        void *thread_data)
 {
        int ret;
        struct lttng_thread *thread;
@@ -105,8 +104,7 @@ struct lttng_thread *lttng_thread_create(const char *name,
        cds_list_add(&thread->node, &thread_list.head);
        (void) lttng_thread_get(thread);
 
-       ret = pthread_create(&thread->thread, default_pthread_attr(),
-                       launch_thread, thread);
+       ret = pthread_create(&thread->thread, default_pthread_attr(), launch_thread, thread);
        if (ret) {
                PERROR("Failed to create \"%s\" thread", thread->name);
                goto error_pthread_create;
@@ -145,8 +143,7 @@ const char *lttng_thread_get_name(const struct lttng_thread *thread)
        return thread->name;
 }
 
-static
-bool _lttng_thread_shutdown(struct lttng_thread *thread)
+static bool _lttng_thread_shutdown(struct lttng_thread *thread)
 {
        int ret;
        void *status;
@@ -191,7 +188,7 @@ void lttng_thread_list_shutdown_orphans(void)
        struct lttng_thread *thread, *tmp;
 
        pthread_mutex_lock(&thread_list.lock);
-       cds_list_for_each_entry_safe(thread, tmp, &thread_list.head, node) {
+       cds_list_for_each_entry_safe (thread, tmp, &thread_list.head, node) {
                bool result;
                const long ref = uatomic_read(&thread->ref.refcount);
 
index 30eb13446e3badb44e1e278e5f8ad5c636490e7c..bb5f1d3eabf80cb78fefe6d9fbe0d448d41d4c7b 100644 (file)
@@ -7,23 +7,23 @@
  */
 
 #define _LGPL_SOURCE
-#include <inttypes.h>
-#include <signal.h>
-
-#include "timer.hpp"
 #include "health-sessiond.hpp"
 #include "rotation-thread.hpp"
 #include "thread.hpp"
+#include "timer.hpp"
+
+#include <inttypes.h>
+#include <signal.h>
 
-#define LTTNG_SESSIOND_SIG_QS                          SIGRTMIN + 10
-#define LTTNG_SESSIOND_SIG_EXIT                                SIGRTMIN + 11
-#define LTTNG_SESSIOND_SIG_PENDING_ROTATION_CHECK      SIGRTMIN + 12
-#define LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION          SIGRTMIN + 13
+#define LTTNG_SESSIOND_SIG_QS                    SIGRTMIN + 10
+#define LTTNG_SESSIOND_SIG_EXIT                          SIGRTMIN + 11
+#define LTTNG_SESSIOND_SIG_PENDING_ROTATION_CHECK SIGRTMIN + 12
+#define LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION    SIGRTMIN + 13
 
-#define UINT_TO_PTR(value)                             \
-       ({                                              \
-               LTTNG_ASSERT(value <= UINTPTR_MAX);             \
-               (void *) (uintptr_t) value;             \
+#define UINT_TO_PTR(value)                          \
+       ({                                          \
+               LTTNG_ASSERT(value <= UINTPTR_MAX); \
+               (void *) (uintptr_t) value;         \
        })
 #define PTR_TO_UINT(ptr) ((uintptr_t) ptr)
 
@@ -49,8 +49,7 @@ struct timer_signal_data {
 /*
  * Set custom signal mask to current thread.
  */
-static
-void setmask(sigset_t *mask)
+static void setmask(sigset_t *mask)
 {
        int ret;
 
@@ -81,8 +80,7 @@ void setmask(sigset_t *mask)
  * returns, it means that no timer signr is currently pending or being handled
  * by the timer thread. This cannot be called from the timer thread.
  */
-static
-void timer_signal_thread_qs(unsigned int signr)
+static void timer_signal_thread_qs(unsigned int signr)
 {
        sigset_t pending_set;
        int ret;
@@ -139,9 +137,11 @@ void timer_signal_thread_qs(unsigned int signr)
  * Returns a negative value on error, 0 if a timer was created, and
  * a positive value if no timer was created (not an error).
  */
-static
-int timer_start(timer_t *timer_id, struct ltt_session *session,
-               unsigned int timer_interval_us, int signal, bool one_shot)
+static int timer_start(timer_t *timer_id,
+                      struct ltt_session *session,
+                      unsigned int timer_interval_us,
+                      int signal,
+                      bool one_shot)
 {
        int ret = 0, delete_ret;
        struct sigevent sev = {};
@@ -183,8 +183,7 @@ end:
        return ret;
 }
 
-static
-int timer_stop(timer_t *timer_id, int signal)
+static int timer_stop(timer_t *timer_id, int signal)
 {
        int ret = 0;
 
@@ -201,7 +200,7 @@ end:
 }
 
 int timer_session_rotation_pending_check_start(struct ltt_session *session,
-               unsigned int interval_us)
+                                              unsigned int interval_us)
 {
        int ret;
 
@@ -209,8 +208,7 @@ int timer_session_rotation_pending_check_start(struct ltt_session *session,
                ret = -1;
                goto end;
        }
-       DBG("Enabling session rotation pending check timer on session %" PRIu64,
-                       session->id);
+       DBG("Enabling session rotation pending check timer on session %" PRIu64, session->id);
        /*
         * We arm this timer in a one-shot mode so we don't have to disable it
         * explicitly (which could deadlock if the timer thread is blocked
@@ -221,9 +219,10 @@ int timer_session_rotation_pending_check_start(struct ltt_session *session,
         * no need to go through the whole signal teardown scheme everytime.
         */
        ret = timer_start(&session->rotation_pending_check_timer,
-                       session, interval_us,
-                       LTTNG_SESSIOND_SIG_PENDING_ROTATION_CHECK,
-                       /* one-shot */ true);
+                         session,
+                         interval_us,
+                         LTTNG_SESSIOND_SIG_PENDING_ROTATION_CHECK,
+                         /* one-shot */ true);
        if (ret == 0) {
                session->rotation_pending_check_timer_enabled = true;
        }
@@ -241,10 +240,9 @@ int timer_session_rotation_pending_check_stop(struct ltt_session *session)
        LTTNG_ASSERT(session);
        LTTNG_ASSERT(session->rotation_pending_check_timer_enabled);
 
-       DBG("Disabling session rotation pending check timer on session %" PRIu64,
-                       session->id);
+       DBG("Disabling session rotation pending check timer on session %" PRIu64, session->id);
        ret = timer_stop(&session->rotation_pending_check_timer,
-                       LTTNG_SESSIOND_SIG_PENDING_ROTATION_CHECK);
+                        LTTNG_SESSIOND_SIG_PENDING_ROTATION_CHECK);
        if (ret == -1) {
                ERR("Failed to stop rotate_pending_check timer");
        } else {
@@ -261,7 +259,7 @@ int timer_session_rotation_pending_check_stop(struct ltt_session *session)
  * Call with session and session_list locks held.
  */
 int timer_session_rotation_schedule_timer_start(struct ltt_session *session,
-               unsigned int interval_us)
+                                               unsigned int interval_us)
 {
        int ret;
 
@@ -269,11 +267,15 @@ int timer_session_rotation_schedule_timer_start(struct ltt_session *session,
                ret = -1;
                goto end;
        }
-       DBG("Enabling scheduled rotation timer on session \"%s\" (%ui %s)", session->name,
-                       interval_us, USEC_UNIT);
-       ret = timer_start(&session->rotation_schedule_timer, session,
-                       interval_us, LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION,
-                       /* one-shot */ false);
+       DBG("Enabling scheduled rotation timer on session \"%s\" (%ui %s)",
+           session->name,
+           interval_us,
+           USEC_UNIT);
+       ret = timer_start(&session->rotation_schedule_timer,
+                         session,
+                         interval_us,
+                         LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION,
+                         /* one-shot */ false);
        if (ret < 0) {
                goto end;
        }
@@ -296,11 +298,9 @@ int timer_session_rotation_schedule_timer_stop(struct ltt_session *session)
        }
 
        DBG("Disabling scheduled rotation timer on session %s", session->name);
-       ret = timer_stop(&session->rotation_schedule_timer,
-                       LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION);
+       ret = timer_stop(&session->rotation_schedule_timer, LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION);
        if (ret < 0) {
-               ERR("Failed to stop scheduled rotation timer of session \"%s\"",
-                               session->name);
+               ERR("Failed to stop scheduled rotation timer of session \"%s\"", session->name);
                goto end;
        }
 
@@ -335,8 +335,7 @@ int timer_signal_init(void)
 /*
  * This thread is the sighandler for the timer signals.
  */
-static
-void *thread_timer(void *data)
+static void *thread_timer(void *data)
 {
        int signr;
        sigset_t mask;
@@ -378,15 +377,15 @@ void *thread_timer(void *data)
                        goto end;
                } else if (signr == LTTNG_SESSIOND_SIG_PENDING_ROTATION_CHECK) {
                        struct ltt_session *session =
-                                       (struct ltt_session *) info.si_value.sival_ptr;
+                               (struct ltt_session *) info.si_value.sival_ptr;
 
                        rotation_thread_enqueue_job(ctx->rotation_thread_job_queue,
-                                       ROTATION_THREAD_JOB_TYPE_CHECK_PENDING_ROTATION,
-                                       session);
+                                                   ROTATION_THREAD_JOB_TYPE_CHECK_PENDING_ROTATION,
+                                                   session);
                } else if (signr == LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION) {
                        rotation_thread_enqueue_job(ctx->rotation_thread_job_queue,
-                                       ROTATION_THREAD_JOB_TYPE_SCHEDULED_ROTATION,
-                                       (struct ltt_session *) info.si_value.sival_ptr);
+                                                   ROTATION_THREAD_JOB_TYPE_SCHEDULED_ROTATION,
+                                                   (struct ltt_session *) info.si_value.sival_ptr);
                        /*
                         * The scheduled periodic rotation timer is not in
                         * "one-shot" mode. The reference to the session is not
@@ -406,22 +405,17 @@ end:
        return NULL;
 }
 
-static
-bool shutdown_timer_thread(void *data __attribute__((unused)))
+static bool shutdown_timer_thread(void *data __attribute__((unused)))
 {
        return kill(getpid(), LTTNG_SESSIOND_SIG_EXIT) == 0;
 }
 
-bool launch_timer_thread(
-               struct timer_thread_parameters *timer_thread_parameters)
+bool launch_timer_thread(struct timer_thread_parameters *timer_thread_parameters)
 {
        struct lttng_thread *thread;
 
-       thread = lttng_thread_create("Timer",
-                       thread_timer,
-                       shutdown_timer_thread,
-                       NULL,
-                       timer_thread_parameters);
+       thread = lttng_thread_create(
+               "Timer", thread_timer, shutdown_timer_thread, NULL, timer_thread_parameters);
        if (!thread) {
                goto error;
        }
index b9c9b326f6a403acee66284c55c6c2fa546040d4..be0457dca60f2753340e279793867f14a7229e9f 100644 (file)
@@ -9,11 +9,9 @@
 
 namespace lst = lttng::sessiond::trace;
 
-lttng::sessiond::trace::trace_class::trace_class(
-               const struct abi& in_abi,
-               const lttng_uuid& in_trace_uuid) :
-       abi{in_abi},
-       uuid{in_trace_uuid}
+lttng::sessiond::trace::trace_class::trace_class(const struct abi& in_abi,
+                                                const lttng_uuid& in_trace_uuid) :
+       abi{ in_abi }, uuid{ in_trace_uuid }
 {
 }
 
index 23d808ce8852f155e82bcbf7dc6cd65f41f48703..2070fcd3fb28d93e9f1c201139df62a0e2c86b09 100644 (file)
@@ -6,41 +6,42 @@
  */
 
 #define _LGPL_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
+#include "consumer.hpp"
+#include "lttng-sessiond.hpp"
+#include "notification-thread-commands.hpp"
+#include "trace-kernel.hpp"
+
+#include <common/common.hpp>
+#include <common/defaults.hpp>
+#include <common/macros.hpp>
+#include <common/trace-chunk.hpp>
 
-#include <lttng/event.h>
-#include <lttng/lttng-error.h>
-#include <lttng/kernel-probe.h>
-#include <lttng/userspace-probe.h>
-#include <lttng/userspace-probe-internal.hpp>
-#include <lttng/event-rule/event-rule.h>
 #include <lttng/event-rule/event-rule-internal.hpp>
-#include <lttng/event-rule/kernel-kprobe.h>
+#include <lttng/event-rule/event-rule.h>
 #include <lttng/event-rule/kernel-kprobe-internal.hpp>
-#include <lttng/event-rule/kernel-syscall.h>
+#include <lttng/event-rule/kernel-kprobe.h>
 #include <lttng/event-rule/kernel-syscall-internal.hpp>
-#include <lttng/event-rule/kernel-tracepoint.h>
+#include <lttng/event-rule/kernel-syscall.h>
 #include <lttng/event-rule/kernel-tracepoint-internal.hpp>
-#include <lttng/event-rule/kernel-uprobe.h>
+#include <lttng/event-rule/kernel-tracepoint.h>
 #include <lttng/event-rule/kernel-uprobe-internal.hpp>
-#include <common/common.hpp>
-#include <common/defaults.hpp>
-#include <common/trace-chunk.hpp>
-#include <common/macros.hpp>
+#include <lttng/event-rule/kernel-uprobe.h>
+#include <lttng/event.h>
+#include <lttng/kernel-probe.h>
+#include <lttng/lttng-error.h>
+#include <lttng/userspace-probe-internal.hpp>
+#include <lttng/userspace-probe.h>
 
-#include "consumer.hpp"
-#include "trace-kernel.hpp"
-#include "lttng-sessiond.hpp"
-#include "notification-thread-commands.hpp"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
 /*
  * Find the channel name for the given kernel session.
  */
-struct ltt_kernel_channel *trace_kernel_get_channel_by_name(
-               const char *name, struct ltt_kernel_session *session)
+struct ltt_kernel_channel *trace_kernel_get_channel_by_name(const char *name,
+                                                           struct ltt_kernel_session *session)
 {
        struct ltt_kernel_channel *chan;
 
@@ -56,7 +57,7 @@ struct ltt_kernel_channel *trace_kernel_get_channel_by_name(
 
        DBG("Trying to find channel %s", name);
 
-       cds_list_for_each_entry(chan, &session->channel_list.head, list) {
+       cds_list_for_each_entry (chan, &session->channel_list.head, list) {
                if (strcmp(name, chan->channel->name) == 0) {
                        DBG("Found channel by name %s", name);
                        return chan;
@@ -69,10 +70,10 @@ struct ltt_kernel_channel *trace_kernel_get_channel_by_name(
 /*
  * Find the event for the given channel.
  */
-struct ltt_kernel_event *trace_kernel_find_event(
-               char *name, struct ltt_kernel_channel *channel,
-               enum lttng_event_type type,
-               struct lttng_bytecode *filter)
+struct ltt_kernel_event *trace_kernel_find_event(char *name,
+                                                struct ltt_kernel_channel *channel,
+                                                enum lttng_event_type type,
+                                                struct lttng_bytecode *filter)
 {
        struct ltt_kernel_event *ev;
        int found = 0;
@@ -80,7 +81,7 @@ struct ltt_kernel_event *trace_kernel_find_event(
        LTTNG_ASSERT(name);
        LTTNG_ASSERT(channel);
 
-       cds_list_for_each_entry(ev, &channel->events_list.head, list) {
+       cds_list_for_each_entry (ev, &channel->events_list.head, list) {
                if (type != LTTNG_EVENT_ALL && ev->type != type) {
                        continue;
                }
@@ -92,8 +93,7 @@ struct ltt_kernel_event *trace_kernel_find_event(
                }
                if (ev->filter && filter) {
                        if (ev->filter->len != filter->len ||
-                                       memcmp(ev->filter->data, filter->data,
-                                               filter->len) != 0) {
+                           memcmp(ev->filter->data, filter->data, filter->len) != 0) {
                                continue;
                        }
                }
@@ -101,8 +101,7 @@ struct ltt_kernel_event *trace_kernel_find_event(
                break;
        }
        if (found) {
-               DBG("Found event %s for channel %s", name,
-                       channel->channel->name);
+               DBG("Found event %s for channel %s", name, channel->channel->name);
                return ev;
        } else {
                return NULL;
@@ -112,9 +111,9 @@ struct ltt_kernel_event *trace_kernel_find_event(
 /*
  * Find the event name for the given channel.
  */
-struct ltt_kernel_event *trace_kernel_get_event_by_name(
-               char *name, struct ltt_kernel_channel *channel,
-               enum lttng_event_type type)
+struct ltt_kernel_event *trace_kernel_get_event_by_name(char *name,
+                                                       struct ltt_kernel_channel *channel,
+                                                       enum lttng_event_type type)
 {
        struct ltt_kernel_event *ev;
        int found = 0;
@@ -122,7 +121,7 @@ struct ltt_kernel_event *trace_kernel_get_event_by_name(
        LTTNG_ASSERT(name);
        LTTNG_ASSERT(channel);
 
-       cds_list_for_each_entry(ev, &channel->events_list.head, list) {
+       cds_list_for_each_entry (ev, &channel->events_list.head, list) {
                if (type != LTTNG_EVENT_ALL && ev->type != type) {
                        continue;
                }
@@ -133,8 +132,7 @@ struct ltt_kernel_event *trace_kernel_get_event_by_name(
                break;
        }
        if (found) {
-               DBG("Found event %s for channel %s", name,
-                       channel->channel->name);
+               DBG("Found event %s for channel %s", name, channel->channel->name);
                return ev;
        } else {
                return NULL;
@@ -214,8 +212,7 @@ alloc_error:
  *
  * Return pointer to structure or NULL.
  */
-struct ltt_kernel_channel *trace_kernel_create_channel(
-               struct lttng_channel *chan)
+struct ltt_kernel_channel *trace_kernel_create_channel(struct lttng_channel *chan)
 {
        struct ltt_kernel_channel *lkc;
        struct lttng_channel_extended *extended = NULL;
@@ -249,8 +246,7 @@ struct ltt_kernel_channel *trace_kernel_create_channel(
         * default channel name is requested.
         */
        if (chan->name[0] == '\0') {
-               strncpy(lkc->channel->name, DEFAULT_CHANNEL_NAME,
-                       sizeof(lkc->channel->name));
+               strncpy(lkc->channel->name, DEFAULT_CHANNEL_NAME, sizeof(lkc->channel->name));
        }
        lkc->channel->name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0';
 
@@ -280,8 +276,7 @@ error:
  *
  * Return the allocated object or NULL on error.
  */
-struct ltt_kernel_context *trace_kernel_create_context(
-               struct lttng_kernel_abi_context *ctx)
+struct ltt_kernel_context *trace_kernel_create_context(struct lttng_kernel_abi_context *ctx)
 {
        struct ltt_kernel_context *kctx;
 
@@ -304,8 +299,7 @@ error:
  *
  * Return the allocated object or NULL on error.
  */
-struct ltt_kernel_context *trace_kernel_copy_context(
-               struct ltt_kernel_context *kctx)
+struct ltt_kernel_context *trace_kernel_copy_context(struct ltt_kernel_context *kctx)
 {
        struct ltt_kernel_context *kctx_copy;
 
@@ -329,10 +323,10 @@ error:
  *
  * Return pointer to structure or NULL.
  */
-enum lttng_error_code trace_kernel_create_event(
-               struct lttng_event *ev, char *filter_expression,
-               struct lttng_bytecode *filter,
-               struct ltt_kernel_event **kernel_event)
+enum lttng_error_code trace_kernel_create_event(struct lttng_event *ev,
+                                               char *filter_expression,
+                                               struct lttng_bytecode *filter,
+                                               struct ltt_kernel_event **kernel_event)
 {
        enum lttng_error_code ret;
        struct lttng_kernel_abi_event *attr;
@@ -355,12 +349,13 @@ enum lttng_error_code trace_kernel_create_event(
                attr->u.kprobe.addr = ev->attr.probe.addr;
                attr->u.kprobe.offset = ev->attr.probe.offset;
                strncpy(attr->u.kprobe.symbol_name,
-                               ev->attr.probe.symbol_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN);
+                       ev->attr.probe.symbol_name,
+                       LTTNG_KERNEL_ABI_SYM_NAME_LEN);
                attr->u.kprobe.symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0';
                break;
        case LTTNG_EVENT_USERSPACE_PROBE:
        {
-               const struct lttng_userspace_probe_locationlocation = NULL;
+               const struct lttng_userspace_probe_location *location = NULL;
                const struct lttng_userspace_probe_location_lookup_method *lookup = NULL;
 
                location = lttng_event_get_userspace_probe_location(ev);
@@ -379,8 +374,7 @@ enum lttng_error_code trace_kernel_create_event(
                 */
                attr->instrumentation = LTTNG_KERNEL_ABI_UPROBE;
 
-               lookup = lttng_userspace_probe_location_get_lookup_method(
-                               location);
+               lookup = lttng_userspace_probe_location_get_lookup_method(location);
                if (!lookup) {
                        ret = LTTNG_ERR_PROBE_LOCATION_INVAL;
                        goto error;
@@ -394,26 +388,24 @@ enum lttng_error_code trace_kernel_create_event(
                case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF:
                        /* Get the file descriptor on the target binary. */
                        attr->u.uprobe.fd =
-                                       lttng_userspace_probe_location_function_get_binary_fd(location);
+                               lttng_userspace_probe_location_function_get_binary_fd(location);
 
                        /*
                         * Save a reference to the probe location used during
                         * the listing of events.
                         */
-                       userspace_probe_location =
-                                       lttng_userspace_probe_location_copy(location);
+                       userspace_probe_location = lttng_userspace_probe_location_copy(location);
                        break;
                case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT:
                        /* Get the file descriptor on the target binary. */
                        attr->u.uprobe.fd =
-                                       lttng_userspace_probe_location_tracepoint_get_binary_fd(location);
+                               lttng_userspace_probe_location_tracepoint_get_binary_fd(location);
 
                        /*
                         * Save a reference to the probe location used during the listing of
                         * events.
                         */
-                       userspace_probe_location =
-                                       lttng_userspace_probe_location_copy(location);
+                       userspace_probe_location = lttng_userspace_probe_location_copy(location);
                        break;
                default:
                        DBG("Unsupported lookup method type");
@@ -427,13 +419,15 @@ enum lttng_error_code trace_kernel_create_event(
                attr->u.kretprobe.addr = ev->attr.probe.addr;
                attr->u.kretprobe.offset = ev->attr.probe.offset;
                strncpy(attr->u.kretprobe.symbol_name,
-                               ev->attr.probe.symbol_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN);
+                       ev->attr.probe.symbol_name,
+                       LTTNG_KERNEL_ABI_SYM_NAME_LEN);
                attr->u.kretprobe.symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0';
                break;
        case LTTNG_EVENT_FUNCTION_ENTRY:
                attr->instrumentation = LTTNG_KERNEL_ABI_FUNCTION;
                strncpy(attr->u.ftrace.symbol_name,
-                               ev->attr.ftrace.symbol_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN);
+                       ev->attr.ftrace.symbol_name,
+                       LTTNG_KERNEL_ABI_SYM_NAME_LEN);
                attr->u.ftrace.symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0';
                break;
        case LTTNG_EVENT_TRACEPOINT:
@@ -483,11 +477,11 @@ error:
  *
  * Return pointer to structure or NULL.
  */
-enum lttng_error_code trace_kernel_create_event_notifier_rule(
-               struct lttng_trigger *trigger,
-               uint64_t token,
-               uint64_t error_counter_index,
-               struct ltt_kernel_event_notifier_rule **event_notifier_rule)
+enum lttng_error_code
+trace_kernel_create_event_notifier_rule(struct lttng_trigger *trigger,
+                                       uint64_t token,
+                                       uint64_t error_counter_index,
+                                       struct ltt_kernel_event_notifier_rule **event_notifier_rule)
 {
        enum lttng_error_code ret = LTTNG_OK;
        enum lttng_condition_type condition_type;
@@ -505,16 +499,14 @@ enum lttng_error_code trace_kernel_create_event_notifier_rule(
        condition_type = lttng_condition_get_type(condition);
        LTTNG_ASSERT(condition_type == LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
 
-       condition_status = lttng_condition_event_rule_matches_get_rule(
-                       condition, &event_rule);
+       condition_status = lttng_condition_event_rule_matches_get_rule(condition, &event_rule);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
        LTTNG_ASSERT(event_rule);
 
        event_rule_type = lttng_event_rule_get_type(event_rule);
        LTTNG_ASSERT(event_rule_type != LTTNG_EVENT_RULE_TYPE_UNKNOWN);
 
-       local_kernel_token_event_rule =
-                       zmalloc<ltt_kernel_event_notifier_rule>();
+       local_kernel_token_event_rule = zmalloc<ltt_kernel_event_notifier_rule>();
        if (local_kernel_token_event_rule == NULL) {
                PERROR("Failed to allocate ltt_kernel_token_event_rule structure");
                ret = LTTNG_ERR_NOMEM;
@@ -531,11 +523,10 @@ enum lttng_error_code trace_kernel_create_event_notifier_rule(
 
        local_kernel_token_event_rule->trigger = trigger;
        /* The event rule still owns the filter and bytecode. */
-       local_kernel_token_event_rule->filter =
-                       lttng_event_rule_get_filter_bytecode(event_rule);
+       local_kernel_token_event_rule->filter = lttng_event_rule_get_filter_bytecode(event_rule);
 
        DBG3("Created kernel event notifier rule: token =  %" PRIu64,
-                       local_kernel_token_event_rule->token);
+            local_kernel_token_event_rule->token);
 error:
        *event_notifier_rule = local_kernel_token_event_rule;
        return ret;
@@ -545,8 +536,8 @@ error:
  * Initialize a kernel trigger from an event rule.
  */
 enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
-               const struct lttng_event_rule *rule,
-               struct lttng_kernel_abi_event_notifier *kernel_event_notifier)
+       const struct lttng_event_rule *rule,
+       struct lttng_kernel_abi_event_notifier *kernel_event_notifier)
 {
        enum lttng_error_code ret_code;
        const char *name;
@@ -570,18 +561,16 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
                switch (lttng_kernel_probe_location_get_type(location)) {
                case LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS:
                {
-                       k_status = lttng_kernel_probe_location_address_get_address(
-                                       location, &address);
+                       k_status =
+                               lttng_kernel_probe_location_address_get_address(location, &address);
                        LTTNG_ASSERT(k_status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
                        break;
                }
                case LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET:
                {
-                       k_status = lttng_kernel_probe_location_symbol_get_offset(
-                                       location, &offset);
+                       k_status = lttng_kernel_probe_location_symbol_get_offset(location, &offset);
                        LTTNG_ASSERT(k_status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
-                       symbol_name = lttng_kernel_probe_location_symbol_get_name(
-                                       location);
+                       symbol_name = lttng_kernel_probe_location_symbol_get_name(location);
                        break;
                }
                default:
@@ -593,9 +582,9 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
                kernel_event_notifier->event.u.kprobe.offset = offset;
                if (symbol_name) {
                        strncpy_ret = lttng_strncpy(
-                                       kernel_event_notifier->event.u.kprobe.symbol_name,
-                                       symbol_name,
-                                       sizeof(kernel_event_notifier->event.u.kprobe.symbol_name));
+                               kernel_event_notifier->event.u.kprobe.symbol_name,
+                               symbol_name,
+                               sizeof(kernel_event_notifier->event.u.kprobe.symbol_name));
 
                        if (strncpy_ret) {
                                ret_code = LTTNG_ERR_INVALID;
@@ -603,7 +592,8 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
                        }
                }
 
-               kernel_event_notifier->event.u.kprobe.symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0';
+               kernel_event_notifier->event.u.kprobe
+                       .symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0';
 
                status = lttng_event_rule_kernel_kprobe_get_event_name(rule, &name);
                LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
@@ -612,7 +602,7 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
        }
        case LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE:
        {
-               const struct lttng_userspace_probe_locationlocation = NULL;
+               const struct lttng_userspace_probe_location *location = NULL;
                const struct lttng_userspace_probe_location_lookup_method *lookup = NULL;
                enum lttng_event_rule_status status;
 
@@ -624,8 +614,7 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
 
                kernel_event_notifier->event.instrumentation = LTTNG_KERNEL_ABI_UPROBE;
 
-               lookup = lttng_userspace_probe_location_get_lookup_method(
-                               location);
+               lookup = lttng_userspace_probe_location_get_lookup_method(location);
                if (!lookup) {
                        ret_code = LTTNG_ERR_PROBE_LOCATION_INVAL;
                        goto error;
@@ -639,20 +628,19 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
                case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF:
                        /* Get the file descriptor on the target binary. */
                        kernel_event_notifier->event.u.uprobe.fd =
-                                       lttng_userspace_probe_location_function_get_binary_fd(location);
+                               lttng_userspace_probe_location_function_get_binary_fd(location);
 
                        break;
                case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT:
                        /* Get the file descriptor on the target binary. */
                        kernel_event_notifier->event.u.uprobe.fd =
-                                       lttng_userspace_probe_location_tracepoint_get_binary_fd(location);
+                               lttng_userspace_probe_location_tracepoint_get_binary_fd(location);
                        break;
                default:
                        abort();
                }
 
-               status = lttng_event_rule_kernel_uprobe_get_event_name(
-                               rule, &name);
+               status = lttng_event_rule_kernel_uprobe_get_event_name(rule, &name);
                LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
                ret_code = LTTNG_OK;
                break;
@@ -660,12 +648,10 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
        case LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT:
        {
                const enum lttng_event_rule_status status =
-                               lttng_event_rule_kernel_tracepoint_get_name_pattern(
-                                               rule, &name);
+                       lttng_event_rule_kernel_tracepoint_get_name_pattern(rule, &name);
 
                LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
-               kernel_event_notifier->event.instrumentation =
-                               LTTNG_KERNEL_ABI_TRACEPOINT;
+               kernel_event_notifier->event.instrumentation = LTTNG_KERNEL_ABI_TRACEPOINT;
 
                ret_code = LTTNG_OK;
                break;
@@ -673,17 +659,16 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
        case LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL:
        {
                const enum lttng_event_rule_status status =
-                               lttng_event_rule_kernel_syscall_get_name_pattern(
-                                               rule, &name);
-               const enum lttng_event_rule_kernel_syscall_emission_site
-                       emission_site =
+                       lttng_event_rule_kernel_syscall_get_name_pattern(rule, &name);
+               const enum lttng_event_rule_kernel_syscall_emission_site emission_site =
                        lttng_event_rule_kernel_syscall_get_emission_site(rule);
                enum lttng_kernel_abi_syscall_entryexit entryexit;
 
                LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
-               LTTNG_ASSERT(emission_site != LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_UNKNOWN);
+               LTTNG_ASSERT(emission_site !=
+                            LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_UNKNOWN);
 
-               switch(emission_site) {
+               switch (emission_site) {
                case LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY:
                        entryexit = LTTNG_KERNEL_ABI_SYSCALL_ENTRY;
                        break;
@@ -698,14 +683,10 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
                        break;
                }
 
-               kernel_event_notifier->event.instrumentation =
-                               LTTNG_KERNEL_ABI_SYSCALL;
-               kernel_event_notifier->event.u.syscall.abi =
-                               LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL;
-               kernel_event_notifier->event.u.syscall.entryexit =
-                               entryexit;
-               kernel_event_notifier->event.u.syscall.match =
-                               LTTNG_KERNEL_ABI_SYSCALL_MATCH_NAME;
+               kernel_event_notifier->event.instrumentation = LTTNG_KERNEL_ABI_SYSCALL;
+               kernel_event_notifier->event.u.syscall.abi = LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL;
+               kernel_event_notifier->event.u.syscall.entryexit = entryexit;
+               kernel_event_notifier->event.u.syscall.match = LTTNG_KERNEL_ABI_SYSCALL_MATCH_NAME;
                ret_code = LTTNG_OK;
                break;
        }
@@ -714,8 +695,8 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
                break;
        }
 
-       strncpy_ret = lttng_strncpy(kernel_event_notifier->event.name, name,
-                       LTTNG_KERNEL_ABI_SYM_NAME_LEN);
+       strncpy_ret = lttng_strncpy(
+               kernel_event_notifier->event.name, name, LTTNG_KERNEL_ABI_SYM_NAME_LEN);
        if (strncpy_ret) {
                ret_code = LTTNG_ERR_INVALID;
                goto error;
@@ -742,11 +723,9 @@ struct ltt_kernel_metadata *trace_kernel_create_metadata(void)
                goto error;
        }
 
-       ret = lttng_strncpy(
-                       chan->name, DEFAULT_METADATA_NAME, sizeof(chan->name));
+       ret = lttng_strncpy(chan->name, DEFAULT_METADATA_NAME, sizeof(chan->name));
        if (ret) {
-               ERR("Failed to initialize metadata channel name to `%s`",
-                               DEFAULT_METADATA_NAME);
+               ERR("Failed to initialize metadata channel name to `%s`", DEFAULT_METADATA_NAME);
                goto error;
        }
 
@@ -755,8 +734,8 @@ struct ltt_kernel_metadata *trace_kernel_create_metadata(void)
        chan->attr.subbuf_size = default_get_metadata_subbuf_size();
        chan->attr.num_subbuf = DEFAULT_METADATA_SUBBUF_NUM;
        chan->attr.switch_timer_interval = DEFAULT_METADATA_SWITCH_TIMER;
-       chan->attr.read_timer_interval = DEFAULT_METADATA_READ_TIMER;;
-
+       chan->attr.read_timer_interval = DEFAULT_METADATA_READ_TIMER;
+       ;
 
        /*
         * The metadata channel of kernel sessions must use the "mmap"
@@ -793,8 +772,7 @@ error:
  *
  * Return pointer to structure or NULL.
  */
-struct ltt_kernel_stream *trace_kernel_create_stream(const char *name,
-               unsigned int count)
+struct ltt_kernel_stream *trace_kernel_create_stream(const char *name, unsigned int count)
 {
        int ret;
        struct ltt_kernel_stream *lks;
@@ -884,25 +862,23 @@ void trace_kernel_destroy_event(struct ltt_kernel_event *event)
  */
 static void free_token_event_rule_rcu(struct rcu_head *rcu_node)
 {
-       struct ltt_kernel_event_notifier_rule *rule = caa_container_of(rcu_node,
-                       struct ltt_kernel_event_notifier_rule, rcu_node);
+       struct ltt_kernel_event_notifier_rule *rule =
+               caa_container_of(rcu_node, struct ltt_kernel_event_notifier_rule, rcu_node);
 
        free(rule);
 }
 
-void trace_kernel_destroy_event_notifier_rule(
-               struct ltt_kernel_event_notifier_rule *event)
+void trace_kernel_destroy_event_notifier_rule(struct ltt_kernel_event_notifier_rule *event)
 {
        LTTNG_ASSERT(event);
 
        if (event->fd >= 0) {
                const int ret = close(event->fd);
 
-               DBG("Closing kernel event notifier rule file descriptor: fd = %d",
-                               event->fd);
+               DBG("Closing kernel event notifier rule file descriptor: fd = %d", event->fd);
                if (ret) {
                        PERROR("Failed to close kernel event notifier file descriptor: fd = %d",
-                                       event->fd);
+                              event->fd);
                }
        } else {
                DBG("Destroying kernel event notifier rule (no associated file descriptor)");
@@ -947,28 +923,26 @@ void trace_kernel_destroy_channel(struct ltt_kernel_channel *channel)
        }
 
        /* For each stream in the channel list */
-       cds_list_for_each_entry_safe(stream, stmp, &channel->stream_list.head, list) {
+       cds_list_for_each_entry_safe (stream, stmp, &channel->stream_list.head, list) {
                trace_kernel_destroy_stream(stream);
        }
 
        /* For each event in the channel list */
-       cds_list_for_each_entry_safe(event, etmp, &channel->events_list.head, list) {
+       cds_list_for_each_entry_safe (event, etmp, &channel->events_list.head, list) {
                trace_kernel_destroy_event(event);
        }
 
        /* For each context in the channel list */
-       cds_list_for_each_entry_safe(ctx, ctmp, &channel->ctx_list, list) {
+       cds_list_for_each_entry_safe (ctx, ctmp, &channel->ctx_list, list) {
                trace_kernel_destroy_context(ctx);
        }
 
        /* Remove from channel list */
        cds_list_del(&channel->list);
 
-       if (the_notification_thread_handle &&
-                       channel->published_to_notification_thread) {
+       if (the_notification_thread_handle && channel->published_to_notification_thread) {
                status = notification_thread_command_remove_channel(
-                               the_notification_thread_handle, channel->key,
-                               LTTNG_DOMAIN_KERNEL);
+                       the_notification_thread_handle, channel->key, LTTNG_DOMAIN_KERNEL);
                LTTNG_ASSERT(status == LTTNG_OK);
        }
        free(channel->channel->attr.extended.ptr);
@@ -1029,7 +1003,7 @@ void trace_kernel_destroy_session(struct ltt_kernel_session *session)
                trace_kernel_destroy_metadata(session->metadata);
        }
 
-       cds_list_for_each_entry_safe(channel, ctmp, &session->channel_list.head, list) {
+       cds_list_for_each_entry_safe (channel, ctmp, &session->channel_list.head, list) {
                trace_kernel_destroy_channel(channel);
        }
 }
index 4a3e74de7792b8bc0b195b98f8bc15d9db9e5a10..bf57a4056df382c0210eec5dde37298b78831fe1 100644 (file)
@@ -7,22 +7,22 @@
  */
 
 #define _LGPL_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <inttypes.h>
+#include "agent.hpp"
+#include "buffer-registry.hpp"
+#include "trace-ust.hpp"
+#include "ust-app.hpp"
+#include "utils.hpp"
 
 #include <common/common.hpp>
 #include <common/defaults.hpp>
 #include <common/trace-chunk.hpp>
 #include <common/utils.hpp>
 
-#include "buffer-registry.hpp"
-#include "trace-ust.hpp"
-#include "utils.hpp"
-#include "ust-app.hpp"
-#include "agent.hpp"
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
 namespace lsu = lttng::sessiond::ust;
 
@@ -31,8 +31,7 @@ namespace lsu = lttng::sessiond::ust;
  *
  * Matches by name only. Used by the disable command.
  */
-int trace_ust_ht_match_event_by_name(struct cds_lfht_node *node,
-               const void *_key)
+int trace_ust_ht_match_event_by_name(struct cds_lfht_node *node, const void *_key)
 {
        struct ltt_ust_event *event;
        const char *name;
@@ -84,8 +83,10 @@ int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_key)
 
        /* Event loglevel value and type. */
        ll_match = loglevels_match(event->attr.loglevel_type,
-               ev_loglevel_value, key->loglevel_type,
-               key->loglevel_value, LTTNG_UST_ABI_LOGLEVEL_ALL);
+                                  ev_loglevel_value,
+                                  key->loglevel_type,
+                                  key->loglevel_value,
+                                  LTTNG_UST_ABI_LOGLEVEL_ALL);
 
        if (!ll_match) {
                goto no_match;
@@ -99,8 +100,7 @@ int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_key)
        if (key->filter && event->filter) {
                /* Both filters exists, check length followed by the bytecode. */
                if (event->filter->len != key->filter->len ||
-                               memcmp(event->filter->data, key->filter->data,
-                                       event->filter->len) != 0) {
+                   memcmp(event->filter->data, key->filter->data, event->filter->len) != 0) {
                        goto no_match;
                }
        }
@@ -121,10 +121,8 @@ int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_key)
                /* Compare names individually. */
                for (i = 0; i < event->exclusion->count; ++i) {
                        size_t j;
-                       bool found = false;
-                       const char *name_ev =
-                               LTTNG_EVENT_EXCLUSION_NAME_AT(
-                                       event->exclusion, i);
+                       bool found = false;
+                       const char *name_ev = LTTNG_EVENT_EXCLUSION_NAME_AT(event->exclusion, i);
 
                        /*
                         * Compare this exclusion name to all the key's
@@ -132,11 +130,9 @@ int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_key)
                         */
                        for (j = 0; j < key->exclusion->count; ++j) {
                                const char *name_key =
-                                       LTTNG_EVENT_EXCLUSION_NAME_AT(
-                                               key->exclusion, j);
+                                       LTTNG_EVENT_EXCLUSION_NAME_AT(key->exclusion, j);
 
-                               if (!strncmp(name_ev, name_key,
-                                               LTTNG_SYMBOL_NAME_LEN)) {
+                               if (!strncmp(name_ev, name_key, LTTNG_SYMBOL_NAME_LEN)) {
                                        /* Names match! */
                                        found = true;
                                        break;
@@ -163,8 +159,7 @@ no_match:
  * Find the channel in the hashtable and return channel pointer. RCU read side
  * lock MUST be acquired before calling this.
  */
-struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
-               const char *name)
+struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht, const char *name)
 {
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
@@ -177,7 +172,7 @@ struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
        if (name[0] == '\0')
                name = DEFAULT_CHANNEL_NAME;
 
-       lttng_ht_lookup(ht, (void *)name, &iter);
+       lttng_ht_lookup(ht, (void *) name, &iter);
        node = lttng_ht_iter_get_node_str(&iter);
        if (node == NULL) {
                goto error;
@@ -197,9 +192,11 @@ error:
  * MUST be acquired before calling this.
  */
 struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
-               char *name, struct lttng_bytecode *filter,
-               enum lttng_ust_abi_loglevel_type loglevel_type, int loglevel_value,
-               struct lttng_event_exclusion *exclusion)
+                                          char *name,
+                                          struct lttng_bytecode *filter,
+                                          enum lttng_ust_abi_loglevel_type loglevel_type,
+                                          int loglevel_value,
+                                          struct lttng_event_exclusion *exclusion)
 {
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
@@ -215,8 +212,11 @@ struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
        key.loglevel_value = loglevel_value;
        key.exclusion = exclusion;
 
-       cds_lfht_lookup(ht->ht, ht->hash_fct((void *) name, lttng_ht_seed),
-                       trace_ust_ht_match_event, &key, &iter.iter);
+       cds_lfht_lookup(ht->ht,
+                       ht->hash_fct((void *) name, lttng_ht_seed),
+                       trace_ust_ht_match_event,
+                       &key,
+                       &iter.iter);
        node = lttng_ht_iter_get_node_str(&iter);
        if (node == NULL) {
                goto error;
@@ -239,7 +239,7 @@ error:
  * once the agent is no longer in scope or being used.
  */
 struct agent *trace_ust_find_agent(struct ltt_ust_session *session,
-               enum lttng_domain_type domain_type)
+                                  enum lttng_domain_type domain_type)
 {
        struct agent *agt = NULL;
        struct lttng_ht_node_u64 *node;
@@ -346,7 +346,7 @@ error_alloc:
  * Return pointer to structure or NULL.
  */
 struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *chan,
-               enum lttng_domain_type domain)
+                                                enum lttng_domain_type domain)
 {
        struct ltt_ust_channel *luc;
 
@@ -367,10 +367,10 @@ struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *chan,
        luc->attr.switch_timer_interval = chan->attr.switch_timer_interval;
        luc->attr.read_timer_interval = chan->attr.read_timer_interval;
        luc->attr.output = (enum lttng_ust_abi_output) chan->attr.output;
-       luc->monitor_timer_interval = ((struct lttng_channel_extended *)
-                       chan->attr.extended.ptr)->monitor_timer_interval;
-       luc->attr.u.s.blocking_timeout = ((struct lttng_channel_extended *)
-                       chan->attr.extended.ptr)->blocking_timeout;
+       luc->monitor_timer_interval =
+               ((struct lttng_channel_extended *) chan->attr.extended.ptr)->monitor_timer_interval;
+       luc->attr.u.s.blocking_timeout =
+               ((struct lttng_channel_extended *) chan->attr.extended.ptr)->blocking_timeout;
 
        /* Translate to UST output enum */
        switch (luc->attr.output) {
@@ -423,12 +423,10 @@ static int validate_exclusion(struct lttng_event_exclusion *exclusion)
 
        for (i = 0; i < exclusion->count; ++i) {
                size_t j;
-               const char *name_a =
-                       LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, i);
+               const char *name_a = LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, i);
 
                for (j = 0; j < i; ++j) {
-                       const char *name_b =
-                               LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, j);
+                       const char *name_b = LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, j);
 
                        if (!strncmp(name_a, name_b, LTTNG_SYMBOL_NAME_LEN)) {
                                /* Match! */
@@ -449,11 +447,11 @@ end:
  * Return an lttng_error_code
  */
 enum lttng_error_code trace_ust_create_event(struct lttng_event *ev,
-               char *filter_expression,
-               struct lttng_bytecode *filter,
-               struct lttng_event_exclusion *exclusion,
-               bool internal_event,
-               struct ltt_ust_event **ust_event)
+                                            char *filter_expression,
+                                            struct lttng_bytecode *filter,
+                                            struct lttng_event_exclusion *exclusion,
+                                            bool internal_event,
+                                            struct ltt_ust_event **ust_event)
 {
        struct ltt_ust_event *local_ust_event;
        enum lttng_error_code ret = LTTNG_OK;
@@ -500,7 +498,7 @@ enum lttng_error_code trace_ust_create_event(struct lttng_event *ev,
        switch (ev->loglevel_type) {
        case LTTNG_EVENT_LOGLEVEL_ALL:
                local_ust_event->attr.loglevel_type = LTTNG_UST_ABI_LOGLEVEL_ALL;
-               local_ust_event->attr.loglevel = -1;    /* Force to -1 */
+               local_ust_event->attr.loglevel = -1; /* Force to -1 */
                break;
        case LTTNG_EVENT_LOGLEVEL_RANGE:
                local_ust_event->attr.loglevel_type = LTTNG_UST_ABI_LOGLEVEL_RANGE;
@@ -525,8 +523,9 @@ enum lttng_error_code trace_ust_create_event(struct lttng_event *ev,
        lttng_ht_node_init_str(&local_ust_event->node, local_ust_event->attr.name);
 
        DBG2("Trace UST event %s, loglevel (%d,%d) created",
-               local_ust_event->attr.name, local_ust_event->attr.loglevel_type,
-               local_ust_event->attr.loglevel);
+            local_ust_event->attr.name,
+            local_ust_event->attr.loglevel_type,
+            local_ust_event->attr.loglevel);
 
        *ust_event = local_ust_event;
 
@@ -541,9 +540,7 @@ error:
        return ret;
 }
 
-static
-int trace_ust_context_type_event_to_ust(
-               enum lttng_event_context_type type)
+static int trace_ust_context_type_event_to_ust(enum lttng_event_context_type type)
 {
        int utype;
 
@@ -627,7 +624,7 @@ int trace_ust_context_type_event_to_ust(
  * Return 1 if contexts match, 0 otherwise.
  */
 int trace_ust_match_context(const struct ltt_ust_context *uctx,
-               const struct lttng_event_context *ctx)
+                           const struct lttng_event_context *ctx)
 {
        int utype;
 
@@ -640,32 +637,27 @@ int trace_ust_match_context(const struct ltt_ust_context *uctx,
        }
        switch (utype) {
        case LTTNG_UST_ABI_CONTEXT_PERF_THREAD_COUNTER:
-               if (uctx->ctx.u.perf_counter.type
-                               != ctx->u.perf_counter.type) {
+               if (uctx->ctx.u.perf_counter.type != ctx->u.perf_counter.type) {
                        return 0;
                }
-               if (uctx->ctx.u.perf_counter.config
-                               != ctx->u.perf_counter.config) {
+               if (uctx->ctx.u.perf_counter.config != ctx->u.perf_counter.config) {
                        return 0;
                }
                if (strncmp(uctx->ctx.u.perf_counter.name,
-                               ctx->u.perf_counter.name,
-                               LTTNG_UST_ABI_SYM_NAME_LEN)) {
+                           ctx->u.perf_counter.name,
+                           LTTNG_UST_ABI_SYM_NAME_LEN)) {
                        return 0;
                }
                break;
        case LTTNG_UST_ABI_CONTEXT_APP_CONTEXT:
                LTTNG_ASSERT(uctx->ctx.u.app_ctx.provider_name);
                LTTNG_ASSERT(uctx->ctx.u.app_ctx.ctx_name);
-               if (strcmp(uctx->ctx.u.app_ctx.provider_name,
-                               ctx->u.app_ctx.provider_name) ||
-                               strcmp(uctx->ctx.u.app_ctx.ctx_name,
-                               ctx->u.app_ctx.ctx_name)) {
+               if (strcmp(uctx->ctx.u.app_ctx.provider_name, ctx->u.app_ctx.provider_name) ||
+                   strcmp(uctx->ctx.u.app_ctx.ctx_name, ctx->u.app_ctx.ctx_name)) {
                        return 0;
                }
        default:
                break;
-
        }
        return 1;
 }
@@ -675,8 +667,7 @@ int trace_ust_match_context(const struct ltt_ust_context *uctx,
  *
  * Return pointer to structure or NULL.
  */
-struct ltt_ust_context *trace_ust_create_context(
-               const struct lttng_event_context *ctx)
+struct ltt_ust_context *trace_ust_create_context(const struct lttng_event_context *ctx)
 {
        struct ltt_ust_context *uctx = NULL;
        int utype;
@@ -700,8 +691,9 @@ struct ltt_ust_context *trace_ust_create_context(
        case LTTNG_UST_ABI_CONTEXT_PERF_THREAD_COUNTER:
                uctx->ctx.u.perf_counter.type = ctx->u.perf_counter.type;
                uctx->ctx.u.perf_counter.config = ctx->u.perf_counter.config;
-               strncpy(uctx->ctx.u.perf_counter.name, ctx->u.perf_counter.name,
-                               LTTNG_UST_ABI_SYM_NAME_LEN);
+               strncpy(uctx->ctx.u.perf_counter.name,
+                       ctx->u.perf_counter.name,
+                       LTTNG_UST_ABI_SYM_NAME_LEN);
                uctx->ctx.u.perf_counter.name[LTTNG_UST_ABI_SYM_NAME_LEN - 1] = '\0';
                break;
        case LTTNG_UST_ABI_CONTEXT_APP_CONTEXT:
@@ -734,8 +726,8 @@ error:
 
 static void destroy_id_tracker_node_rcu(struct rcu_head *head)
 {
-       struct ust_id_tracker_node *tracker_node = caa_container_of(
-                       head, struct ust_id_tracker_node, node.head);
+       struct ust_id_tracker_node *tracker_node =
+               caa_container_of(head, struct ust_id_tracker_node, node.head);
        free(tracker_node);
 }
 
@@ -770,8 +762,7 @@ static void fini_id_tracker(struct ust_id_tracker *id_tracker)
                return;
        }
        rcu_read_lock();
-       cds_lfht_for_each_entry (id_tracker->ht->ht, &iter.iter, tracker_node,
-                       node.node) {
+       cds_lfht_for_each_entry (id_tracker->ht->ht, &iter.iter, tracker_node, node.node) {
                int ret = lttng_ht_del(id_tracker->ht, &iter);
 
                LTTNG_ASSERT(!ret);
@@ -782,10 +773,8 @@ static void fini_id_tracker(struct ust_id_tracker *id_tracker)
        id_tracker->ht = NULL;
 }
 
-static struct ust_id_tracker_node *id_tracker_lookup(
-               struct ust_id_tracker *id_tracker,
-               int id,
-               struct lttng_ht_iter *iter)
+static struct ust_id_tracker_node *
+id_tracker_lookup(struct ust_id_tracker *id_tracker, int id, struct lttng_ht_iter *iter)
 {
        unsigned long _id = (unsigned long) id;
        struct lttng_ht_node_ulong *node;
@@ -851,7 +840,7 @@ end:
 }
 
 static struct ust_id_tracker *get_id_tracker(struct ltt_ust_session *session,
-               enum lttng_process_attr process_attr)
+                                            enum lttng_process_attr process_attr)
 {
        switch (process_attr) {
        case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID:
@@ -865,9 +854,9 @@ static struct ust_id_tracker *get_id_tracker(struct ltt_ust_session *session,
        }
 }
 
-static struct process_attr_tracker *_trace_ust_get_process_attr_tracker(
-               struct ltt_ust_session *session,
-               enum lttng_process_attr process_attr)
+static struct process_attr_tracker *
+_trace_ust_get_process_attr_tracker(struct ltt_ust_session *session,
+                                   enum lttng_process_attr process_attr)
 {
        switch (process_attr) {
        case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID:
@@ -881,21 +870,20 @@ static struct process_attr_tracker *_trace_ust_get_process_attr_tracker(
        }
 }
 
-const struct process_attr_tracker *trace_ust_get_process_attr_tracker(
-               struct ltt_ust_session *session,
-               enum lttng_process_attr process_attr)
+const struct process_attr_tracker *
+trace_ust_get_process_attr_tracker(struct ltt_ust_session *session,
+                                  enum lttng_process_attr process_attr)
 {
-       return (const struct process_attr_tracker *)
-                       _trace_ust_get_process_attr_tracker(
-                                       session, process_attr);
+       return (const struct process_attr_tracker *) _trace_ust_get_process_attr_tracker(
+               session, process_attr);
 }
 
 /*
  * The session lock is held when calling this function.
  */
 int trace_ust_id_tracker_lookup(enum lttng_process_attr process_attr,
-               struct ltt_ust_session *session,
-               int id)
+                               struct ltt_ust_session *session,
+                               int id)
 {
        struct lttng_ht_iter iter;
        struct ust_id_tracker *id_tracker;
@@ -916,18 +904,16 @@ int trace_ust_id_tracker_lookup(enum lttng_process_attr process_attr,
 /*
  * Called with the session lock held.
  */
-enum lttng_error_code trace_ust_process_attr_tracker_set_tracking_policy(
-               struct ltt_ust_session *session,
-               enum lttng_process_attr process_attr,
-               enum lttng_tracking_policy policy)
+enum lttng_error_code
+trace_ust_process_attr_tracker_set_tracking_policy(struct ltt_ust_session *session,
+                                                  enum lttng_process_attr process_attr,
+                                                  enum lttng_tracking_policy policy)
 {
        int ret;
        enum lttng_error_code ret_code = LTTNG_OK;
-       struct ust_id_tracker *id_tracker =
-                       get_id_tracker(session, process_attr);
+       struct ust_id_tracker *id_tracker = get_id_tracker(session, process_attr);
        struct process_attr_tracker *tracker =
-                       _trace_ust_get_process_attr_tracker(
-                                       session, process_attr);
+               _trace_ust_get_process_attr_tracker(session, process_attr);
        bool should_update_apps = false;
        enum lttng_tracking_policy previous_policy;
 
@@ -979,15 +965,14 @@ end:
 }
 
 /* Called with the session lock held. */
-enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_add_value(
-               struct ltt_ust_session *session,
-               enum lttng_process_attr process_attr,
-               const struct process_attr_value *value)
+enum lttng_error_code
+trace_ust_process_attr_tracker_inclusion_set_add_value(struct ltt_ust_session *session,
+                                                      enum lttng_process_attr process_attr,
+                                                      const struct process_attr_value *value)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
        bool should_update_apps = false;
-       struct ust_id_tracker *id_tracker =
-                       get_id_tracker(session, process_attr);
+       struct ust_id_tracker *id_tracker = get_id_tracker(session, process_attr);
        struct process_attr_tracker *tracker;
        int integral_value;
        enum process_attr_tracker_status status;
@@ -1007,8 +992,7 @@ enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_add_value(
                if (value->type == LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME) {
                        uid_t uid;
 
-                       ret_code = utils_user_id_from_name(
-                                       value->value.user_name, &uid);
+                       ret_code = utils_user_id_from_name(value->value.user_name, &uid);
                        if (ret_code != LTTNG_OK) {
                                goto end;
                        }
@@ -1022,8 +1006,7 @@ enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_add_value(
                if (value->type == LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME) {
                        gid_t gid;
 
-                       ret_code = utils_group_id_from_name(
-                                       value->value.group_name, &gid);
+                       ret_code = utils_group_id_from_name(value->value.group_name, &gid);
                        if (ret_code != LTTNG_OK) {
                                goto end;
                        }
@@ -1061,8 +1044,9 @@ enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_add_value(
        }
 
        DBG("User space track %s %d for session id %" PRIu64,
-                       lttng_process_attr_to_string(process_attr),
-                       integral_value, session->id);
+           lttng_process_attr_to_string(process_attr),
+           integral_value,
+           session->id);
 
        ret_code = (lttng_error_code) id_tracker_add_id(id_tracker, integral_value);
        if (ret_code != LTTNG_OK) {
@@ -1088,15 +1072,14 @@ end:
 }
 
 /* Called with the session lock held. */
-enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_remove_value(
-               struct ltt_ust_session *session,
-               enum lttng_process_attr process_attr,
-               const struct process_attr_value *value)
+enum lttng_error_code
+trace_ust_process_attr_tracker_inclusion_set_remove_value(struct ltt_ust_session *session,
+                                                         enum lttng_process_attr process_attr,
+                                                         const struct process_attr_value *value)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
        bool should_update_apps = false;
-       struct ust_id_tracker *id_tracker =
-                       get_id_tracker(session, process_attr);
+       struct ust_id_tracker *id_tracker = get_id_tracker(session, process_attr);
        struct process_attr_tracker *tracker;
        int integral_value;
        enum process_attr_tracker_status status;
@@ -1116,8 +1099,7 @@ enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_remove_value(
                if (value->type == LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME) {
                        uid_t uid;
 
-                       ret_code = utils_user_id_from_name(
-                                       value->value.user_name, &uid);
+                       ret_code = utils_user_id_from_name(value->value.user_name, &uid);
                        if (ret_code != LTTNG_OK) {
                                goto end;
                        }
@@ -1131,8 +1113,7 @@ enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_remove_value(
                if (value->type == LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME) {
                        gid_t gid;
 
-                       ret_code = utils_group_id_from_name(
-                                       value->value.group_name, &gid);
+                       ret_code = utils_group_id_from_name(value->value.group_name, &gid);
                        if (ret_code != LTTNG_OK) {
                                goto end;
                        }
@@ -1152,8 +1133,7 @@ enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_remove_value(
                goto end;
        }
 
-       status = process_attr_tracker_inclusion_set_remove_value(
-                       tracker, value);
+       status = process_attr_tracker_inclusion_set_remove_value(tracker, value);
        if (status != PROCESS_ATTR_TRACKER_STATUS_OK) {
                switch (status) {
                case PROCESS_ATTR_TRACKER_STATUS_MISSING:
@@ -1171,8 +1151,9 @@ enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_remove_value(
        }
 
        DBG("User space untrack %s %d for session id %" PRIu64,
-                       lttng_process_attr_to_string(process_attr),
-                       integral_value, session->id);
+           lttng_process_attr_to_string(process_attr),
+           integral_value,
+           session->id);
 
        ret_code = (lttng_error_code) id_tracker_del_id(id_tracker, integral_value);
        if (ret_code != LTTNG_OK) {
@@ -1204,8 +1185,7 @@ static void destroy_context_rcu(struct rcu_head *head)
 {
        struct lttng_ht_node_ulong *node =
                lttng::utils::container_of(head, &lttng_ht_node_ulong::head);
-       struct ltt_ust_context *ctx =
-               lttng::utils::container_of(node, &ltt_ust_context::node);
+       struct ltt_ust_context *ctx = lttng::utils::container_of(node, &ltt_ust_context::node);
 
        trace_ust_destroy_context(ctx);
 }
@@ -1223,7 +1203,7 @@ static void destroy_contexts(struct lttng_ht *ht)
        LTTNG_ASSERT(ht);
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(ht->ht, &iter.iter, node, node) {
+       cds_lfht_for_each_entry (ht->ht, &iter.iter, node, node) {
                /* Remove from ordered list. */
                ctx = lttng::utils::container_of(node, &ltt_ust_context::node);
                cds_list_del(&ctx->list);
@@ -1271,10 +1251,8 @@ void trace_ust_destroy_context(struct ltt_ust_context *ctx)
  */
 static void destroy_event_rcu(struct rcu_head *head)
 {
-       struct lttng_ht_node_str *node =
-               lttng::utils::container_of(head, &lttng_ht_node_str::head);
-       struct ltt_ust_event *event =
-               lttng::utils::container_of(node, &ltt_ust_event::node);
+       struct lttng_ht_node_str *node = lttng::utils::container_of(head, &lttng_ht_node_str::head);
+       struct ltt_ust_event *event = lttng::utils::container_of(node, &ltt_ust_event::node);
 
        trace_ust_destroy_event(event);
 }
@@ -1291,7 +1269,7 @@ static void destroy_events(struct lttng_ht *events)
        LTTNG_ASSERT(events);
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(events->ht, &iter.iter, node, node) {
+       cds_lfht_for_each_entry (events->ht, &iter.iter, node, node) {
                ret = lttng_ht_del(events, &iter);
                LTTNG_ASSERT(!ret);
                call_rcu(&node->head, destroy_event_rcu);
@@ -1320,10 +1298,8 @@ static void _trace_ust_destroy_channel(struct ltt_ust_channel *channel)
  */
 static void destroy_channel_rcu(struct rcu_head *head)
 {
-       struct lttng_ht_node_str *node =
-               lttng::utils::container_of(head, &lttng_ht_node_str::head);
-       struct ltt_ust_channel *channel =
-               lttng::utils::container_of(node, &ltt_ust_channel::node);
+       struct lttng_ht_node_str *node = lttng::utils::container_of(head, &lttng_ht_node_str::head);
+       struct ltt_ust_channel *channel = lttng::utils::container_of(node, &ltt_ust_channel::node);
 
        _trace_ust_destroy_channel(channel);
 }
@@ -1341,8 +1317,7 @@ void trace_ust_destroy_channel(struct ltt_ust_channel *channel)
 /*
  * Remove an UST channel from a channel HT.
  */
-void trace_ust_delete_channel(struct lttng_ht *ht,
-               struct ltt_ust_channel *channel)
+void trace_ust_delete_channel(struct lttng_ht *ht, struct ltt_ust_channel *channel)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -1362,7 +1337,7 @@ int trace_ust_regenerate_metadata(struct ltt_ust_session *usess)
        struct buffer_reg_session *session_reg = NULL;
 
        rcu_read_lock();
-       cds_list_for_each_entry(uid_reg, &usess->buffer_reg_uid_list, lnode) {
+       cds_list_for_each_entry (uid_reg, &usess->buffer_reg_uid_list, lnode) {
                lsu::registry_session *registry;
 
                session_reg = uid_reg->registry;
@@ -1393,7 +1368,7 @@ static void destroy_channels(struct lttng_ht *channels)
        LTTNG_ASSERT(channels);
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(channels->ht, &iter.iter, node, node) {
+       cds_lfht_for_each_entry (channels->ht, &iter.iter, node, node) {
                struct ltt_ust_channel *chan =
                        lttng::utils::container_of(node, &ltt_ust_channel::node);
 
@@ -1433,7 +1408,7 @@ void trace_ust_destroy_session(struct ltt_ust_session *session)
        destroy_domain_global(&session->domain_global);
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(session->agents->ht, &iter.iter, agt, node.node) {
+       cds_lfht_for_each_entry (session->agents->ht, &iter.iter, agt, node.node) {
                int ret = lttng_ht_del(session->agents, &iter);
 
                LTTNG_ASSERT(!ret);
@@ -1444,8 +1419,7 @@ void trace_ust_destroy_session(struct ltt_ust_session *session)
        lttng_ht_destroy(session->agents);
 
        /* Cleanup UID buffer registry object(s). */
-       cds_list_for_each_entry_safe(reg, sreg, &session->buffer_reg_uid_list,
-                       lnode) {
+       cds_list_for_each_entry_safe (reg, sreg, &session->buffer_reg_uid_list, lnode) {
                cds_list_del(&reg->lnode);
                buffer_reg_uid_remove(reg);
                buffer_reg_uid_destroy(reg, session->consumer);
index 10f8dd59811a4e99f51d6c5fba025e347c4d7df8..a74e46c2975b9e79fe81566d6f8720c7d7174442 100644 (file)
@@ -6,26 +6,28 @@
  *
  */
 
-#include "lttng/tracker.h"
 #include "common/dynamic-array.hpp"
 #include "common/macros.hpp"
+#include "lttng/tracker.h"
 #define _LGPL_SOURCE
-#include <grp.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <urcu.h>
-#include <urcu/list.h>
-#include <urcu/rculfhash.h>
-
 #include "tracker.hpp"
+
 #include <common/defaults.hpp>
 #include <common/error.hpp>
 #include <common/hashtable/hashtable.hpp>
 #include <common/hashtable/utils.hpp>
 #include <common/tracker.hpp>
+
 #include <lttng/lttng-error.h>
 
+#include <grp.h>
+#include <pwd.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <urcu.h>
+#include <urcu/list.h>
+#include <urcu/rculfhash.h>
+
 struct process_attr_tracker {
        enum lttng_tracking_policy policy;
        struct cds_lfht *inclusion_set_ht;
@@ -41,8 +43,8 @@ struct process_attr_tracker_value_node {
 
 static void process_attr_tracker_value_node_rcu_free(struct rcu_head *rcu_head)
 {
-       struct process_attr_tracker_value_node *node = lttng::utils::container_of(
-                       rcu_head, &process_attr_tracker_value_node::rcu_head);
+       struct process_attr_tracker_value_node *node =
+               lttng::utils::container_of(rcu_head, &process_attr_tracker_value_node::rcu_head);
 
        free(node);
 }
@@ -56,11 +58,10 @@ struct process_attr_tracker *process_attr_tracker_create(void)
                return NULL;
        }
 
-       (void) process_attr_tracker_set_tracking_policy(
-                       tracker, LTTNG_TRACKING_POLICY_INCLUDE_ALL);
+       (void) process_attr_tracker_set_tracking_policy(tracker, LTTNG_TRACKING_POLICY_INCLUDE_ALL);
 
-       tracker->inclusion_set_ht = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0,
-                       CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       tracker->inclusion_set_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!tracker->inclusion_set_ht) {
                goto error;
        }
@@ -71,19 +72,16 @@ error:
        return NULL;
 }
 
-static void process_attr_tracker_remove_value_node(
-               struct process_attr_tracker *tracker,
-               struct process_attr_tracker_value_node *value_node)
+static void
+process_attr_tracker_remove_value_node(struct process_attr_tracker *tracker,
+                                      struct process_attr_tracker_value_node *value_node)
 {
-       cds_lfht_del(tracker->inclusion_set_ht,
-                       &value_node->inclusion_set_ht_node);
+       cds_lfht_del(tracker->inclusion_set_ht, &value_node->inclusion_set_ht_node);
        process_attr_value_destroy(value_node->value);
-       call_rcu(&value_node->rcu_head,
-                       process_attr_tracker_value_node_rcu_free);
+       call_rcu(&value_node->rcu_head, process_attr_tracker_value_node_rcu_free);
 }
 
-static void process_attr_tracker_clear_inclusion_set(
-               struct process_attr_tracker *tracker)
+static void process_attr_tracker_clear_inclusion_set(struct process_attr_tracker *tracker)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -94,8 +92,8 @@ static void process_attr_tracker_clear_inclusion_set(
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry (tracker->inclusion_set_ht, &iter.iter,
-                       value_node, inclusion_set_ht_node) {
+       cds_lfht_for_each_entry (
+               tracker->inclusion_set_ht, &iter.iter, value_node, inclusion_set_ht_node) {
                process_attr_tracker_remove_value_node(tracker, value_node);
        }
        rcu_read_unlock();
@@ -104,12 +102,11 @@ static void process_attr_tracker_clear_inclusion_set(
        tracker->inclusion_set_ht = NULL;
 }
 
-static int process_attr_tracker_create_inclusion_set(
-               struct process_attr_tracker *tracker)
+static int process_attr_tracker_create_inclusion_set(struct process_attr_tracker *tracker)
 {
        LTTNG_ASSERT(!tracker->inclusion_set_ht);
-       tracker->inclusion_set_ht = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0,
-                       CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       tracker->inclusion_set_ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        return tracker->inclusion_set_ht ? 0 : -1;
 }
 
@@ -123,15 +120,14 @@ void process_attr_tracker_destroy(struct process_attr_tracker *tracker)
        free(tracker);
 }
 
-enum lttng_tracking_policy process_attr_tracker_get_tracking_policy(
-               const struct process_attr_tracker *tracker)
+enum lttng_tracking_policy
+process_attr_tracker_get_tracking_policy(const struct process_attr_tracker *tracker)
 {
        return tracker->policy;
 }
 
-int process_attr_tracker_set_tracking_policy(
-               struct process_attr_tracker *tracker,
-               enum lttng_tracking_policy tracking_policy)
+int process_attr_tracker_set_tracking_policy(struct process_attr_tracker *tracker,
+                                            enum lttng_tracking_policy tracking_policy)
 {
        int ret = 0;
 
@@ -149,21 +145,18 @@ end:
        return ret;
 }
 
-static int match_inclusion_set_value(
-               struct cds_lfht_node *node, const void *key)
+static int match_inclusion_set_value(struct cds_lfht_node *node, const void *key)
 {
        const struct process_attr_value *value_key = (process_attr_value *) key;
-       const struct process_attr_tracker_value_node *value_node =
-                       caa_container_of(node,
-                                       struct process_attr_tracker_value_node,
-                                       inclusion_set_ht_node);
+       const struct process_attr_tracker_value_node *value_node = caa_container_of(
+               node, struct process_attr_tracker_value_node, inclusion_set_ht_node);
 
        return process_attr_tracker_value_equal(value_node->value, value_key);
 }
 
-static struct process_attr_tracker_value_node *process_attr_tracker_lookup(
-               const struct process_attr_tracker *tracker,
-               const struct process_attr_value *value)
+static struct process_attr_tracker_value_node *
+process_attr_tracker_lookup(const struct process_attr_tracker *tracker,
+                           const struct process_attr_value *value)
 {
        struct cds_lfht_iter iter;
        struct cds_lfht_node *node;
@@ -173,22 +166,23 @@ static struct process_attr_tracker_value_node *process_attr_tracker_lookup(
        rcu_read_lock();
        cds_lfht_lookup(tracker->inclusion_set_ht,
                        process_attr_value_hash(value),
-                       match_inclusion_set_value, value, &iter);
+                       match_inclusion_set_value,
+                       value,
+                       &iter);
        node = cds_lfht_iter_get_node(&iter);
        rcu_read_unlock();
 
-       return node ? lttng::utils::container_of(node,
-                                     &process_attr_tracker_value_node::inclusion_set_ht_node) :
-                           NULL;
+       return node ? lttng::utils::container_of(
+                             node, &process_attr_tracker_value_node::inclusion_set_ht_node) :
+                     NULL;
 }
 
 /* Protected by session mutex held by caller. */
-enum process_attr_tracker_status process_attr_tracker_inclusion_set_add_value(
-               struct process_attr_tracker *tracker,
-               const struct process_attr_value *value)
+enum process_attr_tracker_status
+process_attr_tracker_inclusion_set_add_value(struct process_attr_tracker *tracker,
+                                            const struct process_attr_value *value)
 {
-       enum process_attr_tracker_status status =
-                       PROCESS_ATTR_TRACKER_STATUS_OK;
+       enum process_attr_tracker_status status = PROCESS_ATTR_TRACKER_STATUS_OK;
        struct process_attr_value *value_copy = NULL;
        struct process_attr_tracker_value_node *value_node = NULL;
 
@@ -217,8 +211,8 @@ enum process_attr_tracker_status process_attr_tracker_inclusion_set_add_value(
 
        value_node->value = value_copy;
        cds_lfht_add(tracker->inclusion_set_ht,
-                       process_attr_value_hash(value_copy),
-                       &value_node->inclusion_set_ht_node);
+                    process_attr_value_hash(value_copy),
+                    &value_node->inclusion_set_ht_node);
        value_copy = NULL;
        value_node = NULL;
 end:
@@ -234,13 +228,11 @@ end:
 
 /* Protected by session mutex held by caller. */
 enum process_attr_tracker_status
-process_attr_tracker_inclusion_set_remove_value(
-               struct process_attr_tracker *tracker,
-               const struct process_attr_value *value)
+process_attr_tracker_inclusion_set_remove_value(struct process_attr_tracker *tracker,
+                                               const struct process_attr_value *value)
 {
        struct process_attr_tracker_value_node *value_node;
-       enum process_attr_tracker_status status =
-                       PROCESS_ATTR_TRACKER_STATUS_OK;
+       enum process_attr_tracker_status status = PROCESS_ATTR_TRACKER_STATUS_OK;
 
        rcu_read_lock();
        if (tracker->policy != LTTNG_TRACKING_POLICY_INCLUDE_SET) {
@@ -260,14 +252,13 @@ end:
        return status;
 }
 
-enum process_attr_tracker_status process_attr_tracker_get_inclusion_set(
-               const struct process_attr_tracker *tracker,
-               struct lttng_process_attr_values **_values)
+enum process_attr_tracker_status
+process_attr_tracker_get_inclusion_set(const struct process_attr_tracker *tracker,
+                                      struct lttng_process_attr_values **_values)
 {
        struct lttng_ht_iter iter;
        struct process_attr_tracker_value_node *value_node;
-       enum process_attr_tracker_status status =
-                       PROCESS_ATTR_TRACKER_STATUS_OK;
+       enum process_attr_tracker_status status = PROCESS_ATTR_TRACKER_STATUS_OK;
        struct lttng_process_attr_values *values;
        struct process_attr_value *new_value = NULL;
 
@@ -283,8 +274,8 @@ enum process_attr_tracker_status process_attr_tracker_get_inclusion_set(
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry (tracker->inclusion_set_ht, &iter.iter,
-                       value_node, inclusion_set_ht_node) {
+       cds_lfht_for_each_entry (
+               tracker->inclusion_set_ht, &iter.iter, value_node, inclusion_set_ht_node) {
                int ret;
 
                new_value = process_attr_value_copy(value_node->value);
@@ -293,8 +284,7 @@ enum process_attr_tracker_status process_attr_tracker_get_inclusion_set(
                        goto error_unlock;
                }
 
-               ret = lttng_dynamic_pointer_array_add_pointer(
-                               &values->array, new_value);
+               ret = lttng_dynamic_pointer_array_add_pointer(&values->array, new_value);
                if (ret) {
                        status = PROCESS_ATTR_TRACKER_STATUS_ERROR;
                        goto error_unlock;
index 63941a8abe05d71018c40c26aa4fdec996a44d3a..128dd9d15cc8f4fd16bbadb3391adae4a3cac095 100644 (file)
@@ -6,20 +6,22 @@
  */
 
 #include "event-notifier-error-accounting.hpp"
+
+#include <lttng/action/action-internal.hpp>
 #include <lttng/error-query-internal.hpp>
 #include <lttng/trigger/trigger-internal.hpp>
-#include <lttng/action/action-internal.hpp>
 
-enum lttng_trigger_status lttng_trigger_add_error_results(
-               const struct lttng_trigger *trigger __attribute__((unused)),
-               struct lttng_error_query_results *results __attribute__((unused)))
+enum lttng_trigger_status lttng_trigger_add_error_results(const struct lttng_trigger *trigger
+                                                         __attribute__((unused)),
+                                                         struct lttng_error_query_results *results
+                                                         __attribute__((unused)))
 {
        return LTTNG_TRIGGER_STATUS_OK;
 }
 
-enum lttng_trigger_status lttng_trigger_condition_add_error_results(
-               const struct lttng_trigger *trigger,
-               struct lttng_error_query_results *results)
+enum lttng_trigger_status
+lttng_trigger_condition_add_error_results(const struct lttng_trigger *trigger,
+                                         struct lttng_error_query_results *results)
 {
        enum lttng_trigger_status status;
        uint64_t discarded_tracer_messages_count;
@@ -29,10 +31,8 @@ enum lttng_trigger_status lttng_trigger_condition_add_error_results(
        uid_t trigger_owner;
 
        status = lttng_trigger_get_name(trigger, &trigger_name);
-       trigger_name = status == LTTNG_TRIGGER_STATUS_OK ?
-                       trigger_name : "(anonymous)";
-       status = lttng_trigger_get_owner_uid(trigger,
-                       &trigger_owner);
+       trigger_name = status == LTTNG_TRIGGER_STATUS_OK ? trigger_name : "(anonymous)";
+       status = lttng_trigger_get_owner_uid(trigger, &trigger_owner);
        LTTNG_ASSERT(status == LTTNG_TRIGGER_STATUS_OK);
 
        /*
@@ -47,25 +47,25 @@ enum lttng_trigger_status lttng_trigger_condition_add_error_results(
        }
 
        error_accounting_status = event_notifier_error_accounting_get_count(
-                       trigger, &discarded_tracer_messages_count);
+               trigger, &discarded_tracer_messages_count);
        if (error_accounting_status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
                ERR("Failed to retrieve tracer discarded messages count for trigger: trigger name = '%s', trigger owner uid = %d",
-                               trigger_name, (int) trigger_owner);
+                   trigger_name,
+                   (int) trigger_owner);
                status = LTTNG_TRIGGER_STATUS_ERROR;
                goto end;
        }
 
        discarded_tracer_messages_counter = lttng_error_query_result_counter_create(
-                       "discarded tracer messages",
-                       "Count of messages discarded by the tracer due to a communication error with the session daemon",
-                       discarded_tracer_messages_count);
+               "discarded tracer messages",
+               "Count of messages discarded by the tracer due to a communication error with the session daemon",
+               discarded_tracer_messages_count);
        if (!discarded_tracer_messages_counter) {
                status = LTTNG_TRIGGER_STATUS_ERROR;
                goto end;
        }
 
-       if (lttng_error_query_results_add_result(
-                           results, discarded_tracer_messages_counter)) {
+       if (lttng_error_query_results_add_result(results, discarded_tracer_messages_counter)) {
                status = LTTNG_TRIGGER_STATUS_ERROR;
                goto end;
        }
@@ -79,9 +79,9 @@ end:
        return status;
 }
 
-enum lttng_trigger_status lttng_trigger_add_action_error_query_results(
-               struct lttng_trigger *trigger,
-               struct lttng_error_query_results *results)
+enum lttng_trigger_status
+lttng_trigger_add_action_error_query_results(struct lttng_trigger *trigger,
+                                            struct lttng_error_query_results *results)
 {
        enum lttng_trigger_status status;
        const char *trigger_name;
@@ -89,14 +89,12 @@ enum lttng_trigger_status lttng_trigger_add_action_error_query_results(
        enum lttng_action_status action_status;
 
        status = lttng_trigger_get_name(trigger, &trigger_name);
-       trigger_name = status == LTTNG_TRIGGER_STATUS_OK ?
-                       trigger_name : "(anonymous)";
-       status = lttng_trigger_get_owner_uid(trigger,
-                       &trigger_owner);
+       trigger_name = status == LTTNG_TRIGGER_STATUS_OK ? trigger_name : "(anonymous)";
+       status = lttng_trigger_get_owner_uid(trigger, &trigger_owner);
        LTTNG_ASSERT(status == LTTNG_TRIGGER_STATUS_OK);
 
-       action_status = lttng_action_add_error_query_results(
-                       lttng_trigger_get_action(trigger), results);
+       action_status =
+               lttng_action_add_error_query_results(lttng_trigger_get_action(trigger), results);
        switch (action_status) {
        case LTTNG_ACTION_STATUS_OK:
                break;
index dce1af96c8f6045622c34372fde818116576b3b6..3c628fb412f813974dc541c8b53dfdbc6fd44837 100644 (file)
@@ -5,14 +5,14 @@
  *
  */
 
-#include "tsdl-trace-class-visitor.hpp"
 #include "clock-class.hpp"
+#include "tsdl-trace-class-visitor.hpp"
 
 #include <common/exception.hpp>
 #include <common/format.hpp>
 #include <common/make-unique.hpp>
-#include <common/uuid.hpp>
 #include <common/scope-exit.hpp>
+#include <common/uuid.hpp>
 
 #include <vendor/optional.hpp>
 
@@ -35,22 +35,20 @@ const auto ctf_spec_minor = 8;
  * Although the CTF v1.8 specification recommends ignoring any leading underscore, Some readers,
  * such as Babeltrace 1.x, expect special identifiers without a prepended underscore.
  */
-const std::unordered_set<std::string> safe_tsdl_identifiers = {
-       "stream_id",
-       "packet_size",
-       "content_size",
-       "id",
-       "v",
-       "timestamp",
-       "events_discarded",
-       "packet_seq_num",
-       "timestamp_begin",
-       "timestamp_end",
-       "cpu_id",
-       "magic",
-       "uuid",
-       "stream_instance_id"
-};
+const std::unordered_set<std::string> safe_tsdl_identifiers = { "stream_id",
+                                                               "packet_size",
+                                                               "content_size",
+                                                               "id",
+                                                               "v",
+                                                               "timestamp",
+                                                               "events_discarded",
+                                                               "packet_seq_num",
+                                                               "timestamp_begin",
+                                                               "timestamp_end",
+                                                               "cpu_id",
+                                                               "magic",
+                                                               "uuid",
+                                                               "stream_instance_id" };
 
 /*
  * A previous implementation always prepended '_' to the identifiers in order to
@@ -76,7 +74,7 @@ std::string escape_tsdl_identifier(const std::string& original_identifier)
        new_identifier = "_";
 
        /* Replace illegal characters by '_'. */
-       std::locale c_locale{"C"};
+       std::locale c_locale{ "C" };
        for (const auto current_char : original_identifier) {
                if (!std::isalnum(current_char, c_locale) && current_char != '_') {
                        new_identifier += '_';
@@ -139,8 +137,8 @@ public:
        using type_lookup_function = std::function<const lst::type&(const lst::field_location&)>;
 
        variant_tsdl_keyword_sanitizer(tsdl::details::type_overrider& type_overrides,
-                       type_lookup_function lookup_type) :
-               _type_overrides{type_overrides}, _lookup_type(lookup_type)
+                                      type_lookup_function lookup_type) :
+               _type_overrides{ type_overrides }, _lookup_type(lookup_type)
        {
        }
 
@@ -163,35 +161,43 @@ private:
        {
        }
 
-       virtual void visit(const lst::floating_point_type& type __attribute__((unused))) override final
+       virtual void visit(const lst::floating_point_type& type
+                          __attribute__((unused))) override final
        {
        }
 
-       virtual void visit(const lst::signed_enumeration_type& type __attribute__((unused))) override final
+       virtual void visit(const lst::signed_enumeration_type& type
+                          __attribute__((unused))) override final
        {
        }
 
-       virtual void visit(const lst::unsigned_enumeration_type& type __attribute__((unused))) override final
+       virtual void visit(const lst::unsigned_enumeration_type& type
+                          __attribute__((unused))) override final
        {
        }
 
-       virtual void visit(const lst::static_length_array_type& type __attribute__((unused))) override final
+       virtual void visit(const lst::static_length_array_type& type
+                          __attribute__((unused))) override final
        {
        }
 
-       virtual void visit(const lst::dynamic_length_array_type& type __attribute__((unused))) override final
+       virtual void visit(const lst::dynamic_length_array_type& type
+                          __attribute__((unused))) override final
        {
        }
 
-       virtual void visit(const lst::static_length_blob_type& type __attribute__((unused))) override final
+       virtual void visit(const lst::static_length_blob_type& type
+                          __attribute__((unused))) override final
        {
        }
 
-       virtual void visit(const lst::dynamic_length_blob_type& type __attribute__((unused))) override final
+       virtual void visit(const lst::dynamic_length_blob_type& type
+                          __attribute__((unused))) override final
        {
        }
 
-       virtual void visit(const lst::null_terminated_string_type& type __attribute__((unused))) override final
+       virtual void visit(const lst::null_terminated_string_type& type
+                          __attribute__((unused))) override final
        {
        }
 
@@ -204,42 +210,44 @@ private:
        }
 
        /*
-        * Create a new enumeration type replacing any mapping that match, by name, the elements in `unsafe_names_found`
-        * with a TSDL-safe version. Currently, unsafe identifiers are made safe by adding
-        * a leading underscore.
+        * Create a new enumeration type replacing any mapping that match, by name, the elements in
+        * `unsafe_names_found` with a TSDL-safe version. Currently, unsafe identifiers are made
+        * safe by adding a leading underscore.
         */
        template <typename MappingIntegerType>
        lst::type::cuptr _create_sanitized_selector(
-                       const lst::typed_enumeration_type<MappingIntegerType>& original_selector,
-                       const unsafe_names& unsafe_names_found)
+               const lst::typed_enumeration_type<MappingIntegerType>& original_selector,
+               const unsafe_names& unsafe_names_found)
        {
-               auto new_mappings = std::make_shared<typename lst::typed_enumeration_type<
-                               MappingIntegerType>::mappings>();
+               auto new_mappings = std::make_shared<
+                       typename lst::typed_enumeration_type<MappingIntegerType>::mappings>();
 
                for (const auto& mapping : *original_selector.mappings_) {
                        if (unsafe_names_found.find(mapping.name.c_str()) ==
-                                       unsafe_names_found.end()) {
+                           unsafe_names_found.end()) {
                                /* Mapping is safe, simply copy it. */
                                new_mappings->emplace_back(mapping);
                        } else {
                                /* Unsafe mapping, rename it and keep the rest of its attributes. */
-                               new_mappings->emplace_back(
-                                               fmt::format("_{}", mapping.name), mapping.range);
+                               new_mappings->emplace_back(fmt::format("_{}", mapping.name),
+                                                          mapping.range);
                        }
                }
 
                return lttng::make_unique<lst::typed_enumeration_type<MappingIntegerType>>(
-                               original_selector.alignment, original_selector.byte_order,
-                               original_selector.size, original_selector.base_, new_mappings);
+                       original_selector.alignment,
+                       original_selector.byte_order,
+                       original_selector.size,
+                       original_selector.base_,
+                       new_mappings);
        }
 
        template <typename MappingIntegerType>
        const typename lst::typed_enumeration_type<MappingIntegerType>::mapping&
        _find_enumeration_mapping_by_range(
-                       const typename lst::typed_enumeration_type<MappingIntegerType>&
-                                       enumeration_type,
-                       const typename lst::typed_enumeration_type<
-                                       MappingIntegerType>::mapping::range_t& target_mapping_range)
+               const typename lst::typed_enumeration_type<MappingIntegerType>& enumeration_type,
+               const typename lst::typed_enumeration_type<MappingIntegerType>::mapping::range_t&
+                       target_mapping_range)
        {
                for (const auto& mapping : *enumeration_type.mappings_) {
                        if (mapping.range == target_mapping_range) {
@@ -248,8 +256,8 @@ private:
                }
 
                LTTNG_THROW_ERROR(fmt::format(
-                               "Failed to find mapping by range in enumeration while sanitizing a variant: target_mapping_range={}",
-                               target_mapping_range));
+                       "Failed to find mapping by range in enumeration while sanitizing a variant: target_mapping_range={}",
+                       target_mapping_range));
        }
 
        /*
@@ -257,14 +265,14 @@ private:
         * to produce a TSDL-safe version of the variant.
         */
        template <typename MappingIntegerType>
-       lst::type::cuptr _create_sanitized_variant(
-                       const lst::variant_type<MappingIntegerType>& original_variant)
+       lst::type::cuptr
+       _create_sanitized_variant(const lst::variant_type<MappingIntegerType>& original_variant)
        {
                typename lst::variant_type<MappingIntegerType>::choices new_choices;
-               const auto& sanitized_selector = static_cast<
-                               const lst::typed_enumeration_type<MappingIntegerType>&>(
-                               _type_overrides.type(_lookup_type(
-                                               original_variant.selector_field_location)));
+               const auto& sanitized_selector =
+                       static_cast<const lst::typed_enumeration_type<MappingIntegerType>&>(
+                               _type_overrides.type(
+                                       _lookup_type(original_variant.selector_field_location)));
 
                /* Visit variant choices to sanitize them as needed. */
                for (const auto& choice : original_variant.choices_) {
@@ -274,16 +282,15 @@ private:
                for (const auto& choice : original_variant.choices_) {
                        const auto& sanitized_choice_type = _type_overrides.type(*choice.second);
 
-                       new_choices.emplace_back(
-                                       _find_enumeration_mapping_by_range(
-                                                       sanitized_selector, choice.first.range),
-                                       sanitized_choice_type.copy());
+                       new_choices.emplace_back(_find_enumeration_mapping_by_range(
+                                                        sanitized_selector, choice.first.range),
+                                                sanitized_choice_type.copy());
                }
 
                return lttng::make_unique<lst::variant_type<MappingIntegerType>>(
-                                              original_variant.alignment,
-                                              original_variant.selector_field_location,
-                                              std::move(new_choices));
+                       original_variant.alignment,
+                       original_variant.selector_field_location,
+                       std::move(new_choices));
        }
 
        template <typename MappingIntegerType>
@@ -291,39 +298,18 @@ private:
        {
                unsafe_names unsafe_names_found;
                static const std::unordered_set<std::string> tsdl_protected_keywords = {
-                               "align",
-                               "callsite",
-                               "const",
-                               "char",
-                               "clock",
-                               "double",
-                               "enum",
-                               "env",
-                               "event",
-                               "floating_point",
-                               "float",
-                               "integer",
-                               "int",
-                               "long",
-                               "short",
-                               "signed",
-                               "stream",
-                               "string",
-                               "struct",
-                               "trace",
-                               "typealias",
-                               "typedef",
-                               "unsigned",
-                               "variant",
-                               "void",
-                               "_Bool",
-                               "_Complex",
-                               "_Imaginary",
+                       "align",  "callsite", "const",     "char",           "clock",    "double",
+                       "enum",   "env",      "event",     "floating_point", "float",    "integer",
+                       "int",    "long",     "short",     "signed",         "stream",   "string",
+                       "struct", "trace",    "typealias", "typedef",        "unsigned", "variant",
+                       "void",   "_Bool",    "_Complex",  "_Imaginary",
                };
 
                for (const auto& choice : type.choices_) {
-                       if (tsdl_protected_keywords.find(choice.first.name) != tsdl_protected_keywords.cend()) {
-                               /* Choice name is illegal, we have to rename it and its matching mapping. */
+                       if (tsdl_protected_keywords.find(choice.first.name) !=
+                           tsdl_protected_keywords.cend()) {
+                               /* Choice name is illegal, we have to rename it and its matching
+                                * mapping. */
                                unsafe_names_found.insert(choice.first.name.c_str());
                        }
                }
@@ -347,30 +333,37 @@ private:
                const auto& overriden_selector_type = _type_overrides.type(original_selector_type);
 
                auto sanitized_selector_type = _create_sanitized_selector(
-                               static_cast<const lst::typed_enumeration_type<MappingIntegerType>&>(
-                                       overriden_selector_type), unsafe_names_found);
+                       static_cast<const lst::typed_enumeration_type<MappingIntegerType>&>(
+                               overriden_selector_type),
+                       unsafe_names_found);
                _type_overrides.publish(original_selector_type, std::move(sanitized_selector_type));
 
                auto sanitized_variant_type = _create_sanitized_variant(
-                               static_cast<const lst::variant_type<MappingIntegerType>&>(type));
+                       static_cast<const lst::variant_type<MappingIntegerType>&>(type));
                _type_overrides.publish(type, std::move(sanitized_variant_type));
        }
 
-       virtual void visit(const lst::variant_type<lst::signed_enumeration_type::mapping::range_t::range_integer_t>& type) override final
+       virtual void visit(const lst::variant_type<
+                          lst::signed_enumeration_type::mapping::range_t::range_integer_t>& type)
+               override final
        {
                visit_variant(type);
        }
 
-       virtual void visit(const lst::variant_type<lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>& type) override final
+       virtual void visit(const lst::variant_type<
+                          lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>& type)
+               override final
        {
                visit_variant(type);
        }
 
-       virtual void visit(const lst::static_length_string_type& type __attribute__((unused))) override final
+       virtual void visit(const lst::static_length_string_type& type
+                          __attribute__((unused))) override final
        {
        }
 
-       virtual void visit(const lst::dynamic_length_string_type& type __attribute__((unused))) override final
+       virtual void visit(const lst::dynamic_length_string_type& type
+                          __attribute__((unused))) override final
        {
        }
 
@@ -382,17 +375,17 @@ class tsdl_field_visitor : public lttng::sessiond::trace::field_visitor,
                           public lttng::sessiond::trace::type_visitor {
 public:
        tsdl_field_visitor(const lst::abi& abi,
-                       unsigned int indentation_level,
-                       const tsdl::details::type_overrider& type_overrides,
-                       const nonstd::optional<std::string>& in_default_clock_class_name =
-                                       nonstd::nullopt) :
-               _indentation_level{indentation_level},
-               _trace_abi{abi},
-               _bypass_identifier_escape{false},
-               _default_clock_class_name{in_default_clock_class_name ?
-                                               in_default_clock_class_name->c_str() :
-                                               nullptr},
-               _type_overrides{type_overrides}
+                          unsigned int indentation_level,
+                          const tsdl::details::type_overrider& type_overrides,
+                          const nonstd::optional<std::string>& in_default_clock_class_name =
+                                  nonstd::nullopt) :
+               _indentation_level{ indentation_level },
+               _trace_abi{ abi },
+               _bypass_identifier_escape{ false },
+               _default_clock_class_name{ in_default_clock_class_name ?
+                                                  in_default_clock_class_name->c_str() :
+                                                  nullptr },
+               _type_overrides{ type_overrides }
        {
        }
 
@@ -413,7 +406,8 @@ private:
                 * constraint. The name of this structure is generated using the field's name.
                 */
                _current_field_name.push(_bypass_identifier_escape ?
-                               field.name : escape_tsdl_identifier(field.name));
+                                                field.name :
+                                                escape_tsdl_identifier(field.name));
                _type_overrides.type(field.get_type()).accept(*this);
                _description += " ";
                _description += _current_field_name.top();
@@ -437,8 +431,8 @@ private:
 
                /* Mandatory properties (no defaults). */
                _description += fmt::format("size = {size}; align = {alignment};",
-                               fmt::arg("size", type.size),
-                               fmt::arg("alignment", type.alignment));
+                                           fmt::arg("size", type.size),
+                                           fmt::arg("alignment", type.alignment));
 
                /* Defaults to unsigned. */
                if (type.signedness_ == lst::integer_type::signedness::SIGNED) {
@@ -461,8 +455,8 @@ private:
                                break;
                        default:
                                LTTNG_THROW_ERROR(fmt::format(
-                                               "Unexpected base encountered while serializing integer type to TSDL: base = {}",
-                                               (int) type.base_));
+                                       "Unexpected base encountered while serializing integer type to TSDL: base = {}",
+                                       (int) type.base_));
                        }
 
                        _description += fmt::format(" base = {};", base);
@@ -470,7 +464,8 @@ private:
 
                /* Defaults to the trace's native byte order. */
                if (type.byte_order != _trace_abi.byte_order) {
-                       const auto byte_order_str = type.byte_order == lst::byte_order::BIG_ENDIAN_ ? "be" : "le";
+                       const auto byte_order_str =
+                               type.byte_order == lst::byte_order::BIG_ENDIAN_ ? "be" : "le";
 
                        _description += fmt::format(" byte_order = {};", byte_order_str);
                }
@@ -487,24 +482,25 @@ private:
                                break;
                        default:
                                LTTNG_THROW_ERROR(fmt::format(
-                                               "Unexpected encoding encountered while serializing integer type to TSDL: encoding = {}",
-                                               (int) *_current_integer_encoding_override));
+                                       "Unexpected encoding encountered while serializing integer type to TSDL: encoding = {}",
+                                       (int) *_current_integer_encoding_override));
                        }
 
                        _description += fmt::format(" encoding = {};", encoding_str);
                        _current_integer_encoding_override.reset();
                }
 
-               if (std::find(type.roles_.begin(), type.roles_.end(),
-                                   lst::integer_type::role::DEFAULT_CLOCK_TIMESTAMP) !=
-                                               type.roles_.end() ||
-                               std::find(type.roles_.begin(), type.roles_.end(),
-                                               lst::integer_type::role::
-                                                               PACKET_END_DEFAULT_CLOCK_TIMESTAMP) !=
-                                               type.roles_.end()) {
+               if (std::find(type.roles_.begin(),
+                             type.roles_.end(),
+                             lst::integer_type::role::DEFAULT_CLOCK_TIMESTAMP) !=
+                           type.roles_.end() ||
+                   std::find(type.roles_.begin(),
+                             type.roles_.end(),
+                             lst::integer_type::role::PACKET_END_DEFAULT_CLOCK_TIMESTAMP) !=
+                           type.roles_.end()) {
                        LTTNG_ASSERT(_default_clock_class_name);
-                       _description += fmt::format(
-                                       " map = clock.{}.value;", _default_clock_class_name);
+                       _description +=
+                               fmt::format(" map = clock.{}.value;", _default_clock_class_name);
                }
 
                _description += " }";
@@ -513,14 +509,15 @@ private:
        virtual void visit(const lst::floating_point_type& type) override final
        {
                _description += fmt::format(
-                               "floating_point {{ align = {alignment}; mant_dig = {mantissa_digits}; exp_dig = {exponent_digits};",
-                               fmt::arg("alignment", type.alignment),
-                               fmt::arg("mantissa_digits", type.mantissa_digits),
-                               fmt::arg("exponent_digits", type.exponent_digits));
+                       "floating_point {{ align = {alignment}; mant_dig = {mantissa_digits}; exp_dig = {exponent_digits};",
+                       fmt::arg("alignment", type.alignment),
+                       fmt::arg("mantissa_digits", type.mantissa_digits),
+                       fmt::arg("exponent_digits", type.exponent_digits));
 
                /* Defaults to the trace's native byte order. */
                if (type.byte_order != _trace_abi.byte_order) {
-                       const auto byte_order_str = type.byte_order == lst::byte_order::BIG_ENDIAN_ ? "be" : "le";
+                       const auto byte_order_str =
+                               type.byte_order == lst::byte_order::BIG_ENDIAN_ ? "be" : "le";
 
                        _description += fmt::format(" byte_order = {};", byte_order_str);
                }
@@ -547,17 +544,16 @@ private:
 
                        _description.resize(_description.size() + mappings_indentation_level, '\t');
                        if (mapping.range.begin == mapping.range.end) {
-                               _description += fmt::format(
-                                               "\"{mapping_name}\" = {mapping_value}",
-                                               fmt::arg("mapping_name", mapping.name),
-                                               fmt::arg("mapping_value", mapping.range.begin));
+                               _description +=
+                                       fmt::format("\"{mapping_name}\" = {mapping_value}",
+                                                   fmt::arg("mapping_name", mapping.name),
+                                                   fmt::arg("mapping_value", mapping.range.begin));
                        } else {
                                _description += fmt::format(
-                                               "\"{mapping_name}\" = {mapping_range_begin} ... {mapping_range_end}",
-                                               fmt::arg("mapping_name", mapping.name),
-                                               fmt::arg("mapping_range_begin",
-                                                               mapping.range.begin),
-                                               fmt::arg("mapping_range_end", mapping.range.end));
+                                       "\"{mapping_name}\" = {mapping_range_begin} ... {mapping_range_end}",
+                                       fmt::arg("mapping_name", mapping.name),
+                                       fmt::arg("mapping_range_begin", mapping.range.begin),
+                                       fmt::arg("mapping_range_end", mapping.range.end));
                        }
 
                        first_mapping = false;
@@ -583,9 +579,9 @@ private:
                if (type.alignment != 0) {
                        LTTNG_ASSERT(_current_field_name.size() > 0);
                        _description += fmt::format(
-                                       "struct {{ }} align({alignment}) {field_name}_padding;\n",
-                                       fmt::arg("alignment", type.alignment),
-                                       fmt::arg("field_name", _current_field_name.top()));
+                               "struct {{ }} align({alignment}) {field_name}_padding;\n",
+                               fmt::arg("alignment", type.alignment),
+                               fmt::arg("field_name", _current_field_name.top()));
                        _description.resize(_description.size() + _indentation_level, '\t');
                }
 
@@ -604,39 +600,51 @@ private:
                         */
                        LTTNG_ASSERT(_current_field_name.size() > 0);
                        _description += fmt::format(
-                                       "struct {{ }} align({alignment}) {field_name}_padding;\n",
-                                       fmt::arg("alignment", type.alignment),
-                                       fmt::arg("field_name", _current_field_name.top()));
+                               "struct {{ }} align({alignment}) {field_name}_padding;\n",
+                               fmt::arg("alignment", type.alignment),
+                               fmt::arg("field_name", _current_field_name.top()));
                        _description.resize(_description.size() + _indentation_level, '\t');
                }
 
                type.element_type->accept(*this);
-               _type_suffixes.emplace(fmt::format("[{}]",
-                               _bypass_identifier_escape ?
-                                               *(type.length_field_location.elements_.end() - 1) :
-                                                       escape_tsdl_identifier(*(type.length_field_location.elements_.end() - 1))));
+               _type_suffixes.emplace(fmt::format(
+                       "[{}]",
+                       _bypass_identifier_escape ?
+                               *(type.length_field_location.elements_.end() - 1) :
+                               escape_tsdl_identifier(
+                                       *(type.length_field_location.elements_.end() - 1))));
        }
 
        virtual void visit(const lst::static_length_blob_type& type) override final
        {
-               /* This type doesn't exist in CTF 1.x, express it as a static length array of uint8_t. */
-               std::unique_ptr<const lst::type> uint8_element = lttng::make_unique<lst::integer_type>(8,
-                               _trace_abi.byte_order, 8, lst::integer_type::signedness::UNSIGNED,
+               /* This type doesn't exist in CTF 1.x, express it as a static length array of
+                * uint8_t. */
+               std::unique_ptr<const lst::type> uint8_element =
+                       lttng::make_unique<lst::integer_type>(
+                               8,
+                               _trace_abi.byte_order,
+                               8,
+                               lst::integer_type::signedness::UNSIGNED,
                                lst::integer_type::base::HEXADECIMAL);
                const auto array = lttng::make_unique<lst::static_length_array_type>(
-                               type.alignment, std::move(uint8_element), type.length_bytes);
+                       type.alignment, std::move(uint8_element), type.length_bytes);
 
                visit(*array);
        }
 
        virtual void visit(const lst::dynamic_length_blob_type& type) override final
        {
-               /* This type doesn't exist in CTF 1.x, express it as a dynamic length array of uint8_t. */
-               std::unique_ptr<const lst::type> uint8_element = lttng::make_unique<lst::integer_type>(0,
-                               _trace_abi.byte_order, 8, lst::integer_type::signedness::UNSIGNED,
+               /* This type doesn't exist in CTF 1.x, express it as a dynamic length array of
+                * uint8_t. */
+               std::unique_ptr<const lst::type> uint8_element =
+                       lttng::make_unique<lst::integer_type>(
+                               0,
+                               _trace_abi.byte_order,
+                               8,
+                               lst::integer_type::signedness::UNSIGNED,
                                lst::integer_type::base::HEXADECIMAL);
                const auto array = lttng::make_unique<lst::dynamic_length_array_type>(
-                               type.alignment, std::move(uint8_element), type.length_field_location);
+                       type.alignment, std::move(uint8_element), type.length_field_location);
 
                visit(*array);
        }
@@ -681,17 +689,19 @@ private:
                if (type.alignment != 0) {
                        LTTNG_ASSERT(_current_field_name.size() > 0);
                        _description += fmt::format(
-                                       "struct {{ }} align({alignment}) {field_name}_padding;\n",
-                                       fmt::arg("alignment", type.alignment),
-                                       fmt::arg("field_name", _current_field_name.top()));
+                               "struct {{ }} align({alignment}) {field_name}_padding;\n",
+                               fmt::arg("alignment", type.alignment),
+                               fmt::arg("field_name", _current_field_name.top()));
                        _description.resize(_description.size() + _indentation_level, '\t');
                }
 
                _indentation_level++;
-               _description += fmt::format("variant <{}> {{\n",
-                               _bypass_identifier_escape ?
-                                               *(type.selector_field_location.elements_.end() - 1) :
-                                                       escape_tsdl_identifier(*(type.selector_field_location.elements_.end() - 1)));
+               _description += fmt::format(
+                       "variant <{}> {{\n",
+                       _bypass_identifier_escape ?
+                               *(type.selector_field_location.elements_.end() - 1) :
+                               escape_tsdl_identifier(
+                                       *(type.selector_field_location.elements_.end() - 1)));
 
                /*
                 * The CTF 1.8 specification only recommends that implementations ignore
@@ -714,12 +724,16 @@ private:
                _description += "}";
        }
 
-       virtual void visit(const lst::variant_type<lst::signed_enumeration_type::mapping::range_t::range_integer_t>& type) override final
+       virtual void visit(const lst::variant_type<
+                          lst::signed_enumeration_type::mapping::range_t::range_integer_t>& type)
+               override final
        {
                visit_variant(type);
        }
 
-       virtual void visit(const lst::variant_type<lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>& type) override final
+       virtual void visit(const lst::variant_type<
+                          lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>& type)
+               override final
        {
                visit_variant(type);
        }
@@ -727,9 +741,12 @@ private:
        lst::type::cuptr create_character_type(enum lst::string_type::encoding encoding)
        {
                _current_integer_encoding_override = encoding;
-               return lttng::make_unique<lst::integer_type>(8, _trace_abi.byte_order, 8,
-                               lst::integer_type::signedness::UNSIGNED,
-                               lst::integer_type::base::DECIMAL);
+               return lttng::make_unique<lst::integer_type>(
+                       8,
+                       _trace_abi.byte_order,
+                       8,
+                       lst::integer_type::signedness::UNSIGNED,
+                       lst::integer_type::base::DECIMAL);
        }
 
        virtual void visit(const lst::static_length_string_type& type) override final
@@ -739,7 +756,7 @@ private:
                 * an encoding specified.
                 */
                const auto char_array = lttng::make_unique<lst::static_length_array_type>(
-                               type.alignment, create_character_type(type.encoding_), type.length);
+                       type.alignment, create_character_type(type.encoding_), type.length);
 
                visit(*char_array);
        }
@@ -751,8 +768,9 @@ private:
                 * an encoding specified.
                 */
                const auto char_sequence = lttng::make_unique<lst::dynamic_length_array_type>(
-                               type.alignment, create_character_type(type.encoding_),
-                               type.length_field_location);
+                       type.alignment,
+                       create_character_type(type.encoding_),
+                       type.length_field_location);
 
                visit(*char_sequence);
        }
@@ -781,7 +799,7 @@ private:
 
 class tsdl_trace_environment_visitor : public lst::trace_class_environment_visitor {
 public:
-       tsdl_trace_environment_visitor() : _environment{"env {\n"}
+       tsdl_trace_environment_visitor() : _environment{ "env {\n" }
        {
        }
 
@@ -792,8 +810,8 @@ public:
 
        virtual void visit(const lst::environment_field<const char *>& field) override
        {
-               _environment += fmt::format("   {} = \"{}\";\n", field.name,
-                               escape_tsdl_env_string_value(field.value));
+               _environment += fmt::format(
+                       "       {} = \"{}\";\n", field.name, escape_tsdl_env_string_value(field.value));
        }
 
        /* Only call once. */
@@ -808,10 +826,10 @@ private:
 };
 } /* namespace */
 
-tsdl::trace_class_visitor::trace_class_visitor(const lst::abi& trace_abi,
-               tsdl::append_metadata_fragment_function append_metadata_fragment) :
-       _trace_abi{trace_abi},
-       _append_metadata_fragment(append_metadata_fragment)
+tsdl::trace_class_visitor::trace_class_visitor(
+       const lst::abi& trace_abi,
+       tsdl::append_metadata_fragment_function append_metadata_fragment) :
+       _trace_abi{ trace_abi }, _append_metadata_fragment(append_metadata_fragment)
 {
 }
 
@@ -826,33 +844,33 @@ void tsdl::trace_class_visitor::visit(const lttng::sessiond::trace::trace_class&
        LTTNG_ASSERT(!_current_trace_class || _current_trace_class == &trace_class);
        _current_trace_class = &trace_class;
 
-       tsdl_field_visitor packet_header_visitor{trace_class.abi, 1, _sanitized_types_overrides};
+       tsdl_field_visitor packet_header_visitor{ trace_class.abi, 1, _sanitized_types_overrides };
 
        trace_class.packet_header()->accept(packet_header_visitor);
 
        /* Declare type aliases, trace class, and packet header. */
        auto trace_class_tsdl = fmt::format(
-                       "/* CTF {ctf_major}.{ctf_minor} */\n\n"
-                       "trace {{\n"
-                       "       major = {ctf_major};\n"
-                       "       minor = {ctf_minor};\n"
-                       "       uuid = \"{uuid}\";\n"
-                       "       byte_order = {byte_order};\n"
-                       "       packet.header := {packet_header_layout};\n"
-                       "}};\n\n",
-                       fmt::arg("ctf_major", ctf_spec_major),
-                       fmt::arg("ctf_minor", ctf_spec_minor),
-                       fmt::arg("uint8_t_alignment", trace_class.abi.uint8_t_alignment),
-                       fmt::arg("uint16_t_alignment", trace_class.abi.uint16_t_alignment),
-                       fmt::arg("uint32_t_alignment", trace_class.abi.uint32_t_alignment),
-                       fmt::arg("uint64_t_alignment", trace_class.abi.uint64_t_alignment),
-                       fmt::arg("long_alignment", trace_class.abi.long_alignment),
-                       fmt::arg("long_size", trace_class.abi.long_alignment),
-                       fmt::arg("bits_per_long", trace_class.abi.bits_per_long),
-                       fmt::arg("uuid", lttng::utils::uuid_to_str(trace_class.uuid)),
-                       fmt::arg("byte_order",
-                                       trace_class.abi.byte_order == lst::byte_order::BIG_ENDIAN_ ? "be" : "le"),
-                       fmt::arg("packet_header_layout", packet_header_visitor.move_description()));
+               "/* CTF {ctf_major}.{ctf_minor} */\n\n"
+               "trace {{\n"
+               "       major = {ctf_major};\n"
+               "       minor = {ctf_minor};\n"
+               "       uuid = \"{uuid}\";\n"
+               "       byte_order = {byte_order};\n"
+               "       packet.header := {packet_header_layout};\n"
+               "}};\n\n",
+               fmt::arg("ctf_major", ctf_spec_major),
+               fmt::arg("ctf_minor", ctf_spec_minor),
+               fmt::arg("uint8_t_alignment", trace_class.abi.uint8_t_alignment),
+               fmt::arg("uint16_t_alignment", trace_class.abi.uint16_t_alignment),
+               fmt::arg("uint32_t_alignment", trace_class.abi.uint32_t_alignment),
+               fmt::arg("uint64_t_alignment", trace_class.abi.uint64_t_alignment),
+               fmt::arg("long_alignment", trace_class.abi.long_alignment),
+               fmt::arg("long_size", trace_class.abi.long_alignment),
+               fmt::arg("bits_per_long", trace_class.abi.bits_per_long),
+               fmt::arg("uuid", lttng::utils::uuid_to_str(trace_class.uuid)),
+               fmt::arg("byte_order",
+                        trace_class.abi.byte_order == lst::byte_order::BIG_ENDIAN_ ? "be" : "le"),
+               fmt::arg("packet_header_layout", packet_header_visitor.move_description()));
 
        /* Declare trace scope and type aliases. */
        append_metadata_fragment(trace_class_tsdl);
@@ -865,26 +883,24 @@ void tsdl::trace_class_visitor::visit(const lttng::sessiond::trace::trace_class&
 void tsdl::trace_class_visitor::visit(const lttng::sessiond::trace::clock_class& clock_class)
 {
        auto uuid_str = clock_class.uuid ?
-                       fmt::format("   uuid = \"{}\";\n",
-                                       lttng::utils::uuid_to_str(*clock_class.uuid)) :
-                             "";
+               fmt::format("   uuid = \"{}\";\n", lttng::utils::uuid_to_str(*clock_class.uuid)) :
+               "";
 
        /* Assumes a single clock that maps to specific stream class fields/roles. */
-       auto clock_class_str = fmt::format(
-                       "clock {{\n"
-                       "       name = \"{name}\";\n"
-                       /* Optional uuid. */
-                       "{uuid}"
-                       "       description = \"{description}\";\n"
-                       "       freq = {frequency};\n"
-                       "       offset = {offset};\n"
-                       "}};\n"
-                       "\n",
-                       fmt::arg("name", clock_class.name),
-                       fmt::arg("uuid", uuid_str),
-                       fmt::arg("description", clock_class.description),
-                       fmt::arg("frequency", clock_class.frequency),
-                       fmt::arg("offset", clock_class.offset));
+       auto clock_class_str = fmt::format("clock {{\n"
+                                          "    name = \"{name}\";\n"
+                                          /* Optional uuid. */
+                                          "{uuid}"
+                                          "    description = \"{description}\";\n"
+                                          "    freq = {frequency};\n"
+                                          "    offset = {offset};\n"
+                                          "}};\n"
+                                          "\n",
+                                          fmt::arg("name", clock_class.name),
+                                          fmt::arg("uuid", uuid_str),
+                                          fmt::arg("description", clock_class.description),
+                                          fmt::arg("frequency", clock_class.frequency),
+                                          fmt::arg("offset", clock_class.offset));
 
        append_metadata_fragment(clock_class_str);
 }
@@ -892,47 +908,54 @@ void tsdl::trace_class_visitor::visit(const lttng::sessiond::trace::clock_class&
 void tsdl::trace_class_visitor::visit(const lttng::sessiond::trace::stream_class& stream_class)
 {
        _current_stream_class = &stream_class;
-       const auto clear_stream_class_on_exit = lttng::make_scope_exit(
-                       [this]() noexcept { _current_stream_class = nullptr; });
+       const auto clear_stream_class_on_exit =
+               lttng::make_scope_exit([this]() noexcept { _current_stream_class = nullptr; });
 
        auto stream_class_str = fmt::format("stream {{\n"
-               "       id = {};\n", stream_class.id);
-       variant_tsdl_keyword_sanitizer variant_sanitizer(_sanitized_types_overrides,
-                       [this](const lttng::sessiond::trace::field_location& location)
-                                       -> const lst::type& {
-                               return _lookup_field_type(location);
-                       });
+                                           "   id = {};\n",
+                                           stream_class.id);
+       variant_tsdl_keyword_sanitizer variant_sanitizer(
+               _sanitized_types_overrides,
+               [this](const lttng::sessiond::trace::field_location& location) -> const lst::type& {
+                       return _lookup_field_type(location);
+               });
 
        const auto *event_header = stream_class.event_header();
        if (event_header) {
-               tsdl_field_visitor event_header_visitor{_trace_abi, 1, _sanitized_types_overrides,
-                               stream_class.default_clock_class_name};
+               tsdl_field_visitor event_header_visitor{ _trace_abi,
+                                                        1,
+                                                        _sanitized_types_overrides,
+                                                        stream_class.default_clock_class_name };
 
                event_header->accept(variant_sanitizer);
                event_header->accept(event_header_visitor);
                stream_class_str += fmt::format("       event.header := {};\n",
-                               event_header_visitor.move_description());
+                                               event_header_visitor.move_description());
        }
 
        const auto *packet_context = stream_class.packet_context();
        if (packet_context) {
-               tsdl_field_visitor packet_context_visitor{_trace_abi, 1, _sanitized_types_overrides,
-                               stream_class.default_clock_class_name};
+               tsdl_field_visitor packet_context_visitor{ _trace_abi,
+                                                          1,
+                                                          _sanitized_types_overrides,
+                                                          stream_class.default_clock_class_name };
 
                packet_context->accept(variant_sanitizer);
                packet_context->accept(packet_context_visitor);
                stream_class_str += fmt::format("       packet.context := {};\n",
-                               packet_context_visitor.move_description());
+                                               packet_context_visitor.move_description());
        }
 
        const auto *event_context = stream_class.event_context();
        if (event_context) {
-               tsdl_field_visitor event_context_visitor{_trace_abi, 1, _sanitized_types_overrides};
+               tsdl_field_visitor event_context_visitor{ _trace_abi,
+                                                         1,
+                                                         _sanitized_types_overrides };
 
                event_context->accept(variant_sanitizer);
                event_context->accept(event_context_visitor);
                stream_class_str += fmt::format("       event.context := {};\n",
-                               event_context_visitor.move_description());
+                                               event_context_visitor.move_description());
        }
 
        stream_class_str += "};\n\n";
@@ -943,55 +966,55 @@ void tsdl::trace_class_visitor::visit(const lttng::sessiond::trace::stream_class
 void tsdl::trace_class_visitor::visit(const lttng::sessiond::trace::event_class& event_class)
 {
        _current_event_class = &event_class;
-       const auto clear_event_class_on_exit = lttng::make_scope_exit(
-                       [this]() noexcept { _current_event_class = nullptr; });
+       const auto clear_event_class_on_exit =
+               lttng::make_scope_exit([this]() noexcept { _current_event_class = nullptr; });
 
        auto event_class_str = fmt::format("event {{\n"
                                           "    name = \"{name}\";\n"
                                           "    id = {id};\n"
                                           "    stream_id = {stream_class_id};\n"
                                           "    loglevel = {log_level};\n",
-                       fmt::arg("name", event_class.name),
-                       fmt::arg("id", event_class.id),
-                       fmt::arg("stream_class_id", event_class.stream_class_id),
-                       fmt::arg("log_level", event_class.log_level));
+                                          fmt::arg("name", event_class.name),
+                                          fmt::arg("id", event_class.id),
+                                          fmt::arg("stream_class_id", event_class.stream_class_id),
+                                          fmt::arg("log_level", event_class.log_level));
 
        if (event_class.model_emf_uri) {
-               event_class_str += fmt::format(
-                               "       model.emf.uri = \"{}\";\n", *event_class.model_emf_uri);
+               event_class_str +=
+                       fmt::format("   model.emf.uri = \"{}\";\n", *event_class.model_emf_uri);
        }
 
-       tsdl_field_visitor payload_visitor{_trace_abi, 1, _sanitized_types_overrides};
-       variant_tsdl_keyword_sanitizer variant_sanitizer(_sanitized_types_overrides,
-                       [this](const lttng::sessiond::trace::field_location& location)
-                                       -> const lst::type& {
-                               return _lookup_field_type(location);
-                       });
+       tsdl_field_visitor payload_visitor{ _trace_abi, 1, _sanitized_types_overrides };
+       variant_tsdl_keyword_sanitizer variant_sanitizer(
+               _sanitized_types_overrides,
+               [this](const lttng::sessiond::trace::field_location& location) -> const lst::type& {
+                       return _lookup_field_type(location);
+               });
 
        event_class.payload->accept(variant_sanitizer);
        event_class.payload->accept(payload_visitor);
 
-       event_class_str += fmt::format(
-                       "       fields := {};\n}};\n\n", payload_visitor.move_description());
+       event_class_str +=
+               fmt::format("   fields := {};\n}};\n\n", payload_visitor.move_description());
 
        append_metadata_fragment(event_class_str);
 }
 
-void tsdl::details::type_overrider::publish(
-               const lttng::sessiond::trace::type& original_type,
-               lttng::sessiond::trace::type::cuptr new_type_override)
+void tsdl::details::type_overrider::publish(const lttng::sessiond::trace::type& original_type,
+                                           lttng::sessiond::trace::type::cuptr new_type_override)
 {
        auto current_override = _overriden_types.find(&original_type);
 
        if (current_override != _overriden_types.end()) {
                current_override->second = std::move(new_type_override);
        } else {
-               _overriden_types.insert(std::make_pair(&original_type, std::move(new_type_override)));
+               _overriden_types.insert(
+                       std::make_pair(&original_type, std::move(new_type_override)));
        }
 }
 
-const lst::type& tsdl::details::type_overrider::type(
-               const lttng::sessiond::trace::type& original) const noexcept
+const lst::type&
+tsdl::details::type_overrider::type(const lttng::sessiond::trace::type& original) const noexcept
 {
        const auto result = _overriden_types.find(&original);
 
@@ -1005,9 +1028,9 @@ const lst::type& tsdl::details::type_overrider::type(
 }
 
 namespace {
-const lttng::sessiond::trace::type& lookup_type_from_root_type(
-               const lttng::sessiond::trace::type& root_type,
-               const lttng::sessiond::trace::field_location& field_location)
+const lttng::sessiond::trace::type&
+lookup_type_from_root_type(const lttng::sessiond::trace::type& root_type,
+                          const lttng::sessiond::trace::field_location& field_location)
 {
        const auto *type = &root_type;
 
@@ -1025,21 +1048,22 @@ const lttng::sessiond::trace::type& lookup_type_from_root_type(
                 */
                if (!struct_type) {
                        LTTNG_THROW_ERROR(fmt::format(
-                                       "Encountered a type that is not a structure while traversing field location: field-location=`{}`",
-                                       field_location));
+                               "Encountered a type that is not a structure while traversing field location: field-location=`{}`",
+                               field_location));
                }
 
-               const auto field_found_it = std::find_if(struct_type->fields_.cbegin(),
-                               struct_type->fields_.cend(),
-                               [&location_element](const lst::field::cuptr& struct_field) {
-                                       return struct_field->name == location_element;
-                               });
+               const auto field_found_it =
+                       std::find_if(struct_type->fields_.cbegin(),
+                                    struct_type->fields_.cend(),
+                                    [&location_element](const lst::field::cuptr& struct_field) {
+                                            return struct_field->name == location_element;
+                                    });
 
                if (field_found_it == struct_type->fields_.cend()) {
                        LTTNG_THROW_ERROR(fmt::format(
-                                       "Failed to find field using field location: field-name:=`{field_name}`, field-location=`{field_location}`",
-                                       fmt::arg("field_location", field_location),
-                                       fmt::arg("field_name", location_element)));
+                               "Failed to find field using field location: field-name:=`{field_name}`, field-location=`{field_location}`",
+                               fmt::arg("field_location", field_location),
+                               fmt::arg("field_name", location_element)));
                }
 
                type = &(*field_found_it)->get_type();
@@ -1058,7 +1082,7 @@ const lttng::sessiond::trace::type& lookup_type_from_root_type(
  * as found in the trace hierarchy.
  */
 const lttng::sessiond::trace::type& lttng::sessiond::tsdl::trace_class_visitor::_lookup_field_type(
-               const lttng::sessiond::trace::field_location& location) const
+       const lttng::sessiond::trace::field_location& location) const
 {
        /* Validate the look-up is happening in a valid visit context. */
        switch (location.root_) {
@@ -1066,47 +1090,44 @@ const lttng::sessiond::trace::type& lttng::sessiond::tsdl::trace_class_visitor::
        case lst::field_location::root::EVENT_RECORD_PAYLOAD:
                if (!_current_event_class) {
                        LTTNG_THROW_ERROR(
-                                       "Field type look-up failure: no current event class in visitor's context");
+                               "Field type look-up failure: no current event class in visitor's context");
                }
                /* fall through. */
        case lst::field_location::root::EVENT_RECORD_COMMON_CONTEXT:
        case lst::field_location::root::PACKET_CONTEXT:
                if (!_current_stream_class) {
                        LTTNG_THROW_ERROR(
-                                       "Field type look-up failure: no current stream class in visitor's context");
+                               "Field type look-up failure: no current stream class in visitor's context");
                }
                /* fall through. */
        case lst::field_location::root::PACKET_HEADER:
                if (!_current_trace_class) {
                        LTTNG_THROW_ERROR(
-                                       "Field type look-up failure: no current trace class in visitor's context");
+                               "Field type look-up failure: no current trace class in visitor's context");
                }
 
                break;
        case lst::field_location::root::EVENT_RECORD_SPECIFIC_CONTEXT:
                LTTNG_THROW_UNSUPPORTED_ERROR(
-                               "Field type look-up failure: event-record specific contexts are not supported");
+                       "Field type look-up failure: event-record specific contexts are not supported");
        default:
                LTTNG_THROW_UNSUPPORTED_ERROR(
-                               "Field type look-up failure: unknown field location root");
+                       "Field type look-up failure: unknown field location root");
        }
 
        switch (location.root_) {
        case lst::field_location::root::PACKET_HEADER:
-               return lookup_type_from_root_type(
-                               *_current_trace_class->packet_header(), location);
+               return lookup_type_from_root_type(*_current_trace_class->packet_header(), location);
        case lst::field_location::root::PACKET_CONTEXT:
-               return lookup_type_from_root_type(
-                               *_current_stream_class->packet_context(), location);
+               return lookup_type_from_root_type(*_current_stream_class->packet_context(),
+                                                 location);
        case lst::field_location::root::EVENT_RECORD_HEADER:
-               return lookup_type_from_root_type(
-                               *_current_stream_class->event_header(), location);
+               return lookup_type_from_root_type(*_current_stream_class->event_header(), location);
        case lst::field_location::root::EVENT_RECORD_COMMON_CONTEXT:
-               return lookup_type_from_root_type(
-                               *_current_stream_class->event_context(), location);
+               return lookup_type_from_root_type(*_current_stream_class->event_context(),
+                                                 location);
        case lst::field_location::root::EVENT_RECORD_PAYLOAD:
-               return lookup_type_from_root_type(
-                               *_current_event_class->payload, location);
+               return lookup_type_from_root_type(*_current_event_class->payload, location);
        case lst::field_location::root::EVENT_RECORD_SPECIFIC_CONTEXT:
        default:
                /* Unreachable as it was checked before. */
index ec8aa1c39ca7e4dd270c2d828e248a8f6b1dfd73..122bbddaf02fe99289c44207ff2bff657faec784 100644 (file)
@@ -66,8 +66,7 @@ struct lttng_ht *ust_app_ht;
 struct lttng_ht *ust_app_ht_by_sock;
 struct lttng_ht *ust_app_ht_by_notify_sock;
 
-static
-int ust_app_flush_app_session(struct ust_app *app, struct ust_app_session *ua_sess);
+static int ust_app_flush_app_session(struct ust_app *app, struct ust_app_session *ua_sess);
 
 /* Next available channel key. Access under next_channel_key_lock. */
 static uint64_t _next_channel_key;
@@ -86,8 +85,7 @@ namespace {
  * A registry per UID object MUST exists before calling this function or else
  * it LTTNG_ASSERT() if not found. RCU read side lock must be acquired.
  */
-static lsu::registry_session *get_session_registry(
-               const struct ust_app_session *ua_sess)
+static lsu::registry_session *get_session_registry(const struct ust_app_session *ua_sess)
 {
        lsu::registry_session *registry = NULL;
 
@@ -105,9 +103,10 @@ static lsu::registry_session *get_session_registry(
        }
        case LTTNG_BUFFER_PER_UID:
        {
-               struct buffer_reg_uid *reg_uid = buffer_reg_uid_find(
-                               ua_sess->tracing_id, ua_sess->bits_per_long,
-                               lttng_credentials_get_uid(&ua_sess->real_credentials));
+               struct buffer_reg_uid *reg_uid =
+                       buffer_reg_uid_find(ua_sess->tracing_id,
+                                           ua_sess->bits_per_long,
+                                           lttng_credentials_get_uid(&ua_sess->real_credentials));
                if (!reg_uid) {
                        goto error;
                }
@@ -122,15 +121,14 @@ error:
        return registry;
 }
 
-lsu::registry_session::locked_ptr
-get_locked_session_registry(const struct ust_app_session *ua_sess)
+lsu::registry_session::locked_ptr get_locked_session_registry(const struct ust_app_session *ua_sess)
 {
        auto session = get_session_registry(ua_sess);
        if (session) {
                pthread_mutex_lock(&session->_lock);
        }
 
-       return lsu::registry_session::locked_ptr{session};
+       return lsu::registry_session::locked_ptr{ session };
 }
 } /* namespace */
 
@@ -160,9 +158,8 @@ static uint64_t get_next_session_id(void)
        return ret;
 }
 
-static void copy_channel_attr_to_ustctl(
-               struct lttng_ust_ctl_consumer_channel_attr *attr,
-               struct lttng_ust_abi_channel_attr *uattr)
+static void copy_channel_attr_to_ustctl(struct lttng_ust_ctl_consumer_channel_attr *attr,
+                                       struct lttng_ust_abi_channel_attr *uattr)
 {
        /* Copy event attributes since the layout is different. */
        attr->subbuf_size = uattr->subbuf_size;
@@ -202,9 +199,8 @@ static int ht_match_ust_app_event(struct cds_lfht_node *node, const void *_key)
 
        /* Event loglevel. */
        if (ev_loglevel_value != key->loglevel_type) {
-               if (event->attr.loglevel_type == LTTNG_UST_ABI_LOGLEVEL_ALL
-                               && key->loglevel_type == 0 &&
-                               ev_loglevel_value == -1) {
+               if (event->attr.loglevel_type == LTTNG_UST_ABI_LOGLEVEL_ALL &&
+                   key->loglevel_type == 0 && ev_loglevel_value == -1) {
                        /*
                         * Match is accepted. This is because on event creation, the
                         * loglevel is set to -1 if the event loglevel type is ALL so 0 and
@@ -224,8 +220,7 @@ static int ht_match_ust_app_event(struct cds_lfht_node *node, const void *_key)
        if (key->filter && event->filter) {
                /* Both filters exists, check length followed by the bytecode. */
                if (event->filter->len != key->filter->len ||
-                               memcmp(event->filter->data, key->filter->data,
-                                       event->filter->len) != 0) {
+                   memcmp(event->filter->data, key->filter->data, event->filter->len) != 0) {
                        goto no_match;
                }
        }
@@ -238,13 +233,13 @@ static int ht_match_ust_app_event(struct cds_lfht_node *node, const void *_key)
        if (key->exclusion && event->exclusion) {
                /* Both exclusions exists, check count followed by the names. */
                if (event->exclusion->count != key->exclusion->count ||
-                               memcmp(event->exclusion->names, key->exclusion->names,
-                                       event->exclusion->count * LTTNG_UST_ABI_SYM_NAME_LEN) != 0) {
+                   memcmp(event->exclusion->names,
+                          key->exclusion->names,
+                          event->exclusion->count * LTTNG_UST_ABI_SYM_NAME_LEN) != 0) {
                        goto no_match;
                }
        }
 
-
        /* Match. */
        return 1;
 
@@ -256,8 +251,7 @@ no_match:
  * Unique add of an ust app event in the given ht. This uses the custom
  * ht_match_ust_app_event match function and the event name as hash.
  */
-static void add_unique_ust_app_event(struct ust_app_channel *ua_chan,
-               struct ust_app_event *event)
+static void add_unique_ust_app_event(struct ust_app_channel *ua_chan, struct ust_app_event *event)
 {
        struct cds_lfht_node *node_ptr;
        struct ust_app_ht_key key;
@@ -274,8 +268,10 @@ static void add_unique_ust_app_event(struct ust_app_channel *ua_chan,
        key.exclusion = event->exclusion;
 
        node_ptr = cds_lfht_add_unique(ht->ht,
-                       ht->hash_fct(event->node.key, lttng_ht_seed),
-                       ht_match_ust_app_event, &key, &event->node.node);
+                                      ht->hash_fct(event->node.key, lttng_ht_seed),
+                                      ht_match_ust_app_event,
+                                      &key,
+                                      &event->node.node);
        LTTNG_ASSERT(node_ptr == &event->node.node);
 }
 
@@ -305,9 +301,7 @@ static void close_notify_sock_rcu(struct rcu_head *head)
  * Delete ust context safely. RCU read lock must be held before calling
  * this function.
  */
-static
-void delete_ust_app_ctx(int sock, struct ust_app_ctx *ua_ctx,
-               struct ust_app *app)
+static void delete_ust_app_ctx(int sock, struct ust_app_ctx *ua_ctx, struct ust_app *app)
 {
        int ret;
 
@@ -321,14 +315,18 @@ void delete_ust_app_ctx(int sock, struct ust_app_ctx *ua_ctx,
                if (ret < 0) {
                        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                                DBG3("UST app release ctx failed. Application is dead: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                    app->pid,
+                                    app->sock);
                        } else if (ret == -EAGAIN) {
                                WARN("UST app release ctx failed. Communication time out: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                    app->pid,
+                                    app->sock);
                        } else {
                                ERR("UST app release ctx obj handle %d failed with ret %d: pid = %d, sock = %d",
-                                               ua_ctx->obj->handle, ret,
-                                               app->pid, app->sock);
+                                   ua_ctx->obj->handle,
+                                   ret,
+                                   app->pid,
+                                   app->sock);
                        }
                }
                free(ua_ctx->obj);
@@ -340,9 +338,7 @@ void delete_ust_app_ctx(int sock, struct ust_app_ctx *ua_ctx,
  * Delete ust app event safely. RCU read lock must be held before calling
  * this function.
  */
-static
-void delete_ust_app_event(int sock, struct ust_app_event *ua_event,
-               struct ust_app *app)
+static void delete_ust_app_event(int sock, struct ust_app_event *ua_event, struct ust_app *app)
 {
        int ret;
 
@@ -359,13 +355,17 @@ void delete_ust_app_event(int sock, struct ust_app_event *ua_event,
                if (ret < 0) {
                        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                                DBG3("UST app release event failed. Application is dead: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                    app->pid,
+                                    app->sock);
                        } else if (ret == -EAGAIN) {
                                WARN("UST app release event failed. Communication time out: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                    app->pid,
+                                    app->sock);
                        } else {
                                ERR("UST app release event obj failed with ret %d: pid = %d, sock = %d",
-                                               ret, app->pid, app->sock);
+                                   ret,
+                                   app->pid,
+                                   app->sock);
                        }
                }
                free(ua_event->obj);
@@ -377,11 +377,10 @@ void delete_ust_app_event(int sock, struct ust_app_event *ua_event,
  * Delayed reclaim of a ust_app_event_notifier_rule object. This MUST be called
  * through a call_rcu().
  */
-static
-void free_ust_app_event_notifier_rule_rcu(struct rcu_head *head)
+static void free_ust_app_event_notifier_rule_rcu(struct rcu_head *head)
 {
-       struct ust_app_event_notifier_rule *obj = lttng::utils::container_of(
-                       head, &ust_app_event_notifier_rule::rcu_head);
+       struct ust_app_event_notifier_rule *obj =
+               lttng::utils::container_of(head, &ust_app_event_notifier_rule::rcu_head);
 
        free(obj);
 }
@@ -389,9 +388,8 @@ void free_ust_app_event_notifier_rule_rcu(struct rcu_head *head)
 /*
  * Delete ust app event notifier rule safely.
  */
-static void delete_ust_app_event_notifier_rule(int sock,
-               struct ust_app_event_notifier_rule *ua_event_notifier_rule,
-               struct ust_app *app)
+static void delete_ust_app_event_notifier_rule(
+       int sock, struct ust_app_event_notifier_rule *ua_event_notifier_rule, struct ust_app *app)
 {
        int ret;
 
@@ -408,13 +406,17 @@ static void delete_ust_app_event_notifier_rule(int sock,
                if (ret < 0) {
                        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                                DBG3("UST app release event notifier failed. Application is dead: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                    app->pid,
+                                    app->sock);
                        } else if (ret == -EAGAIN) {
                                WARN("UST app release event notifier failed. Communication time out: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                    app->pid,
+                                    app->sock);
                        } else {
                                ERR("UST app release event notifier failed with ret %d: pid = %d, sock = %d",
-                                               ret, app->pid, app->sock);
+                                   ret,
+                                   app->pid,
+                                   app->sock);
                        }
                }
 
@@ -422,8 +424,7 @@ static void delete_ust_app_event_notifier_rule(int sock,
        }
 
        lttng_trigger_put(ua_event_notifier_rule->trigger);
-       call_rcu(&ua_event_notifier_rule->rcu_head,
-                       free_ust_app_event_notifier_rule_rcu);
+       call_rcu(&ua_event_notifier_rule->rcu_head, free_ust_app_event_notifier_rule_rcu);
 }
 
 /*
@@ -431,8 +432,7 @@ static void delete_ust_app_event_notifier_rule(int sock,
  *
  * Return 0 on success or else a negative value.
  */
-static int release_ust_app_stream(int sock, struct ust_app_stream *stream,
-               struct ust_app *app)
+static int release_ust_app_stream(int sock, struct ust_app_stream *stream, struct ust_app *app)
 {
        int ret = 0;
 
@@ -445,13 +445,17 @@ static int release_ust_app_stream(int sock, struct ust_app_stream *stream,
                if (ret < 0) {
                        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                                DBG3("UST app release stream failed. Application is dead: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                    app->pid,
+                                    app->sock);
                        } else if (ret == -EAGAIN) {
                                WARN("UST app release stream failed. Communication time out: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                    app->pid,
+                                    app->sock);
                        } else {
                                ERR("UST app release stream obj failed with ret %d: pid = %d, sock = %d",
-                                               ret, app->pid, app->sock);
+                                   ret,
+                                   app->pid,
+                                   app->sock);
                        }
                }
                lttng_fd_put(LTTNG_FD_APPS, 2);
@@ -465,9 +469,7 @@ static int release_ust_app_stream(int sock, struct ust_app_stream *stream,
  * Delete ust app stream safely. RCU read lock must be held before calling
  * this function.
  */
-static
-void delete_ust_app_stream(int sock, struct ust_app_stream *stream,
-               struct ust_app *app)
+static void delete_ust_app_stream(int sock, struct ust_app_stream *stream, struct ust_app *app)
 {
        LTTNG_ASSERT(stream);
        ASSERT_RCU_READ_LOCKED();
@@ -476,8 +478,7 @@ void delete_ust_app_stream(int sock, struct ust_app_stream *stream,
        free(stream);
 }
 
-static
-void delete_ust_app_channel_rcu(struct rcu_head *head)
+static void delete_ust_app_channel_rcu(struct rcu_head *head)
 {
        struct ust_app_channel *ua_chan =
                lttng::utils::container_of(head, &ust_app_channel::rcu_head);
@@ -494,8 +495,7 @@ void delete_ust_app_channel_rcu(struct rcu_head *head)
  *
  * The session list lock must be held by the caller.
  */
-static
-void save_per_pid_lost_discarded_counters(struct ust_app_channel *ua_chan)
+static void save_per_pid_lost_discarded_counters(struct ust_app_channel *ua_chan)
 {
        uint64_t discarded = 0, lost = 0;
        struct ltt_session *session;
@@ -528,16 +528,17 @@ void save_per_pid_lost_discarded_counters(struct ust_app_channel *ua_chan)
 
        if (ua_chan->attr.overwrite) {
                consumer_get_lost_packets(ua_chan->session->tracing_id,
-                               ua_chan->key, session->ust_session->consumer,
-                               &lost);
+                                         ua_chan->key,
+                                         session->ust_session->consumer,
+                                         &lost);
        } else {
                consumer_get_discarded_events(ua_chan->session->tracing_id,
-                               ua_chan->key, session->ust_session->consumer,
-                               &discarded);
+                                             ua_chan->key,
+                                             session->ust_session->consumer,
+                                             &discarded);
        }
-       uchan = trace_ust_find_channel_by_name(
-                       session->ust_session->domain_global.channels,
-                       ua_chan->name);
+       uchan = trace_ust_find_channel_by_name(session->ust_session->domain_global.channels,
+                                              ua_chan->name);
        if (!uchan) {
                ERR("Missing UST channel to store discarded counters");
                goto end;
@@ -560,9 +561,9 @@ end:
  * The session list lock must be held by the caller.
  */
 static void delete_ust_app_channel(int sock,
-               struct ust_app_channel *ua_chan,
-               struct ust_app *app,
-               const lsu::registry_session::locked_ptr& locked_registry)
+                                  struct ust_app_channel *ua_chan,
+                                  struct ust_app *app,
+                                  const lsu::registry_session::locked_ptr& locked_registry)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -576,13 +577,13 @@ static void delete_ust_app_channel(int sock,
        DBG3("UST app deleting channel %s", ua_chan->name);
 
        /* Wipe stream */
-       cds_list_for_each_entry_safe(stream, stmp, &ua_chan->streams.head, list) {
+       cds_list_for_each_entry_safe (stream, stmp, &ua_chan->streams.head, list) {
                cds_list_del(&stream->list);
                delete_ust_app_stream(sock, stream, app);
        }
 
        /* Wipe context */
-       cds_lfht_for_each_entry(ua_chan->ctx->ht, &iter.iter, ua_ctx, node.node) {
+       cds_lfht_for_each_entry (ua_chan->ctx->ht, &iter.iter, ua_ctx, node.node) {
                cds_list_del(&ua_ctx->list);
                ret = lttng_ht_del(ua_chan->ctx, &iter);
                LTTNG_ASSERT(!ret);
@@ -590,8 +591,7 @@ static void delete_ust_app_channel(int sock,
        }
 
        /* Wipe events */
-       cds_lfht_for_each_entry(ua_chan->events->ht, &iter.iter, ua_event,
-                       node.node) {
+       cds_lfht_for_each_entry (ua_chan->events->ht, &iter.iter, ua_event, node.node) {
                ret = lttng_ht_del(ua_chan->events, &iter);
                LTTNG_ASSERT(!ret);
                delete_ust_app_event(sock, ua_event, app);
@@ -602,7 +602,7 @@ static void delete_ust_app_channel(int sock,
                if (locked_registry) {
                        try {
                                locked_registry->remove_channel(ua_chan->key, sock >= 0);
-                       } catch (const std::exception &ex) {
+                       } catch (const std::exceptionex) {
                                DBG("Could not find channel for removal: %s", ex.what());
                        }
                }
@@ -628,16 +628,20 @@ static void delete_ust_app_channel(int sock,
                if (ret < 0) {
                        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                                DBG3("UST app channel %s release failed. Application is dead: pid = %d, sock = %d",
-                                               ua_chan->name, app->pid,
-                                               app->sock);
+                                    ua_chan->name,
+                                    app->pid,
+                                    app->sock);
                        } else if (ret == -EAGAIN) {
                                WARN("UST app channel %s release failed. Communication time out: pid = %d, sock = %d",
-                                               ua_chan->name, app->pid,
-                                               app->sock);
+                                    ua_chan->name,
+                                    app->pid,
+                                    app->sock);
                        } else {
                                ERR("UST app channel %s release failed with ret %d: pid = %d, sock = %d",
-                                               ua_chan->name, ret, app->pid,
-                                               app->sock);
+                                   ua_chan->name,
+                                   ret,
+                                   app->pid,
+                                   app->sock);
                        }
                }
                lttng_fd_put(LTTNG_FD_APPS, 1);
@@ -686,8 +690,8 @@ int ust_app_release_object(struct ust_app *app, struct lttng_ust_abi_object_data
  * terminated concurrently).
  */
 ssize_t ust_app_push_metadata(const lsu::registry_session::locked_ptr& locked_registry,
-               struct consumer_socket *socket,
-               int send_zero_data)
+                             struct consumer_socket *socket,
+                             int send_zero_data)
 {
        int ret;
        char *metadata_str = NULL;
@@ -715,7 +719,7 @@ ssize_t ust_app_push_metadata(const lsu::registry_session::locked_ptr& locked_re
        metadata_version = locked_registry->_metadata_version;
        if (len == 0) {
                DBG3("No metadata to push for metadata key %" PRIu64,
-                               locked_registry->_metadata_key);
+                    locked_registry->_metadata_key);
                ret_val = len;
                if (send_zero_data) {
                        DBG("No metadata to push");
@@ -748,8 +752,8 @@ push_data:
         * daemon. Those push and pull schemes are performed on two
         * different bidirectionnal communication sockets.
         */
-       ret = consumer_push_metadata(socket, metadata_key,
-                       metadata_str, len, offset, metadata_version);
+       ret = consumer_push_metadata(
+               socket, metadata_key, metadata_str, len, offset, metadata_version);
        pthread_mutex_lock(&locked_registry->_lock);
        if (ret < 0) {
                /*
@@ -788,8 +792,7 @@ push_data:
                 * send.
                 */
                locked_registry->_metadata_len_sent =
-                       std::max(locked_registry->_metadata_len_sent,
-                               new_metadata_len_sent);
+                       std::max(locked_registry->_metadata_len_sent, new_metadata_len_sent);
        }
        free(metadata_str);
        return len;
@@ -826,7 +829,7 @@ error_push:
  * terminated concurrently).
  */
 static int push_metadata(const lsu::registry_session::locked_ptr& locked_registry,
-               struct consumer_output *consumer)
+                        struct consumer_output *consumer)
 {
        int ret_val;
        ssize_t ret;
@@ -842,8 +845,7 @@ static int push_metadata(const lsu::registry_session::locked_ptr& locked_registr
        }
 
        /* Get consumer socket to use to push the metadata.*/
-       socket = consumer_find_socket_by_bitness(locked_registry->abi.bits_per_long,
-                       consumer);
+       socket = consumer_find_socket_by_bitness(locked_registry->abi.bits_per_long, consumer);
        if (!socket) {
                ret_val = -1;
                goto error;
@@ -872,8 +874,9 @@ error:
  *
  * Return 0 on success else a negative value.
  */
-static int close_metadata(uint64_t metadata_key, unsigned int consumer_bitness,
-               struct consumer_output *consumer)
+static int close_metadata(uint64_t metadata_key,
+                         unsigned int consumer_bitness,
+                         struct consumer_output *consumer)
 {
        int ret;
        struct consumer_socket *socket;
@@ -882,8 +885,7 @@ static int close_metadata(uint64_t metadata_key, unsigned int consumer_bitness,
        LTTNG_ASSERT(consumer);
 
        /* Get consumer socket to use to push the metadata. */
-       socket = consumer_find_socket_by_bitness(consumer_bitness,
-                       consumer);
+       socket = consumer_find_socket_by_bitness(consumer_bitness, consumer);
        if (!socket) {
                ret = -1;
                goto end;
@@ -898,8 +900,7 @@ end:
        return ret;
 }
 
-static
-void delete_ust_app_session_rcu(struct rcu_head *head)
+static void delete_ust_app_session_rcu(struct rcu_head *head)
 {
        struct ust_app_session *ua_sess =
                lttng::utils::container_of(head, &ust_app_session::rcu_head);
@@ -914,9 +915,7 @@ void delete_ust_app_session_rcu(struct rcu_head *head)
  *
  * The session list lock must be held by the caller.
  */
-static
-void delete_ust_app_session(int sock, struct ust_app_session *ua_sess,
-               struct ust_app *app)
+static void delete_ust_app_session(int sock, struct ust_app_session *ua_sess, struct ust_app *app)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -937,8 +936,7 @@ void delete_ust_app_session(int sock, struct ust_app_session *ua_sess,
                (void) push_metadata(locked_registry, ua_sess->consumer);
        }
 
-       cds_lfht_for_each_entry(ua_sess->channels->ht, &iter.iter, ua_chan,
-                       node.node) {
+       cds_lfht_for_each_entry (ua_sess->channels->ht, &iter.iter, ua_chan, node.node) {
                ret = lttng_ht_del(ua_sess->channels, &iter);
                LTTNG_ASSERT(!ret);
                delete_ust_app_channel(sock, ua_chan, app, locked_registry);
@@ -985,13 +983,17 @@ void delete_ust_app_session(int sock, struct ust_app_session *ua_sess,
                if (ret < 0) {
                        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                                DBG3("UST app release session handle failed. Application is dead: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                    app->pid,
+                                    app->sock);
                        } else if (ret == -EAGAIN) {
                                WARN("UST app release session handle failed. Communication time out: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                    app->pid,
+                                    app->sock);
                        } else {
                                ERR("UST app release session handle failed with ret %d: pid = %d, sock = %d",
-                                               ret, app->pid, app->sock);
+                                   ret,
+                                   app->pid,
+                                   app->sock);
                        }
                }
 
@@ -1012,8 +1014,7 @@ void delete_ust_app_session(int sock, struct ust_app_session *ua_sess,
  * Delete a traceable application structure from the global list. Never call
  * this function outside of a call_rcu call.
  */
-static
-void delete_ust_app(struct ust_app *app)
+static void delete_ust_app(struct ust_app *app)
 {
        int ret, sock;
        struct ust_app_session *ua_sess, *tmp_ua_sess;
@@ -1031,8 +1032,7 @@ void delete_ust_app(struct ust_app *app)
        app->sock = -1;
 
        /* Wipe sessions */
-       cds_list_for_each_entry_safe(ua_sess, tmp_ua_sess, &app->teardown_head,
-                       teardown_node) {
+       cds_list_for_each_entry_safe (ua_sess, tmp_ua_sess, &app->teardown_head, teardown_node) {
                /* Free every object in the session and the session. */
                rcu_read_lock();
                delete_ust_app_session(sock, ua_sess, app);
@@ -1042,12 +1042,13 @@ void delete_ust_app(struct ust_app *app)
        /* Remove the event notifier rules associated with this app. */
        rcu_read_lock();
        cds_lfht_for_each_entry (app->token_to_event_notifier_rule_ht->ht,
-                       &iter.iter, event_notifier_rule, node.node) {
+                                &iter.iter,
+                                event_notifier_rule,
+                                node.node) {
                ret = lttng_ht_del(app->token_to_event_notifier_rule_ht, &iter);
                LTTNG_ASSERT(!ret);
 
-               delete_ust_app_event_notifier_rule(
-                               app->sock, event_notifier_rule, app);
+               delete_ust_app_event_notifier_rule(app->sock, event_notifier_rule, app);
        }
 
        rcu_read_unlock();
@@ -1065,12 +1066,11 @@ void delete_ust_app(struct ust_app *app)
                enum lttng_error_code ret_code;
                enum event_notifier_error_accounting_status status;
 
-               const int event_notifier_read_fd = lttng_pipe_get_readfd(
-                               app->event_notifier_group.event_pipe);
+               const int event_notifier_read_fd =
+                       lttng_pipe_get_readfd(app->event_notifier_group.event_pipe);
 
                ret_code = notification_thread_command_remove_tracer_event_source(
-                               the_notification_thread_handle,
-                               event_notifier_read_fd);
+                       the_notification_thread_handle, event_notifier_read_fd);
                if (ret_code != LTTNG_OK) {
                        ERR("Failed to remove application tracer event source from notification thread");
                }
@@ -1084,8 +1084,8 @@ void delete_ust_app(struct ust_app *app)
                free(app->event_notifier_group.object);
        }
 
-       event_notifier_write_fd_is_open = lttng_pipe_is_write_open(
-                       app->event_notifier_group.event_pipe);
+       event_notifier_write_fd_is_open =
+               lttng_pipe_is_write_open(app->event_notifier_group.event_pipe);
        lttng_pipe_destroy(app->event_notifier_group.event_pipe);
        /*
         * Release the file descriptors reserved for the event notifier pipe.
@@ -1122,13 +1122,11 @@ void delete_ust_app(struct ust_app *app)
 /*
  * URCU intermediate call to delete an UST app.
  */
-static
-void delete_ust_app_rcu(struct rcu_head *head)
+static void delete_ust_app_rcu(struct rcu_head *head)
 {
        struct lttng_ht_node_ulong *node =
                lttng::utils::container_of(head, &lttng_ht_node_ulong::head);
-       struct ust_app *app =
-               lttng::utils::container_of(node, &ust_app::pid_n);
+       struct ust_app *app = lttng::utils::container_of(node, &ust_app::pid_n);
 
        DBG3("Call RCU deleting app PID %d", app->pid);
        delete_ust_app(app);
@@ -1140,8 +1138,7 @@ void delete_ust_app_rcu(struct rcu_head *head)
  *
  * The session list lock must be held by the caller.
  */
-static void destroy_app_session(struct ust_app *app,
-               struct ust_app_session *ua_sess)
+static void destroy_app_session(struct ust_app *app, struct ust_app_session *ua_sess)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -1166,8 +1163,7 @@ end:
 /*
  * Alloc new UST app session.
  */
-static
-struct ust_app_session *alloc_ust_app_session(void)
+static struct ust_app_session *alloc_ust_app_session(void)
 {
        struct ust_app_session *ua_sess;
 
@@ -1192,10 +1188,9 @@ error_free:
 /*
  * Alloc new UST app channel.
  */
-static
-struct ust_app_channel *alloc_ust_app_channel(const char *name,
-               struct ust_app_session *ua_sess,
-               struct lttng_ust_abi_channel_attr *attr)
+static struct ust_app_channel *alloc_ust_app_channel(const char *name,
+                                                    struct ust_app_session *ua_sess,
+                                                    struct lttng_ust_abi_channel_attr *attr)
 {
        struct ust_app_channel *ua_chan;
 
@@ -1268,9 +1263,7 @@ error:
 /*
  * Alloc new UST app event.
  */
-static
-struct ust_app_event *alloc_ust_app_event(char *name,
-               struct lttng_ust_abi_event *attr)
+static struct ust_app_event *alloc_ust_app_event(char *name, struct lttng_ust_abi_event *attr)
 {
        struct ust_app_event *ua_event;
 
@@ -1302,11 +1295,10 @@ error:
 /*
  * Allocate a new UST app event notifier rule.
  */
-static struct ust_app_event_notifier_rule *alloc_ust_app_event_notifier_rule(
-               struct lttng_trigger *trigger)
+static struct ust_app_event_notifier_rule *
+alloc_ust_app_event_notifier_rule(struct lttng_trigger *trigger)
 {
-       enum lttng_event_rule_generate_exclusions_status
-                       generate_exclusion_status;
+       enum lttng_event_rule_generate_exclusions_status generate_exclusion_status;
        enum lttng_condition_status cond_status;
        struct ust_app_event_notifier_rule *ua_event_notifier_rule;
        struct lttng_condition *condition = NULL;
@@ -1320,28 +1312,26 @@ static struct ust_app_event_notifier_rule *alloc_ust_app_event_notifier_rule(
 
        ua_event_notifier_rule->enabled = 1;
        ua_event_notifier_rule->token = lttng_trigger_get_tracer_token(trigger);
-       lttng_ht_node_init_u64(&ua_event_notifier_rule->node,
-                       ua_event_notifier_rule->token);
+       lttng_ht_node_init_u64(&ua_event_notifier_rule->node, ua_event_notifier_rule->token);
 
        condition = lttng_trigger_get_condition(trigger);
        LTTNG_ASSERT(condition);
        LTTNG_ASSERT(lttng_condition_get_type(condition) ==
-                       LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
+                    LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
 
-       cond_status = lttng_condition_event_rule_matches_get_rule(
-                       condition, &event_rule);
+       cond_status = lttng_condition_event_rule_matches_get_rule(condition, &event_rule);
        LTTNG_ASSERT(cond_status == LTTNG_CONDITION_STATUS_OK);
        LTTNG_ASSERT(event_rule);
 
        ua_event_notifier_rule->error_counter_index =
-                       lttng_condition_event_rule_matches_get_error_counter_index(condition);
+               lttng_condition_event_rule_matches_get_error_counter_index(condition);
        /* Acquire the event notifier's reference to the trigger. */
        lttng_trigger_get(trigger);
 
        ua_event_notifier_rule->trigger = trigger;
        ua_event_notifier_rule->filter = lttng_event_rule_get_filter_bytecode(event_rule);
        generate_exclusion_status = lttng_event_rule_generate_exclusions(
-                       event_rule, &ua_event_notifier_rule->exclusion);
+               event_rule, &ua_event_notifier_rule->exclusion);
        switch (generate_exclusion_status) {
        case LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_OK:
        case LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE:
@@ -1353,7 +1343,7 @@ static struct ust_app_event_notifier_rule *alloc_ust_app_event_notifier_rule(
        }
 
        DBG3("UST app event notifier rule allocated: token = %" PRIu64,
-                       ua_event_notifier_rule->token);
+            ua_event_notifier_rule->token);
 
        return ua_event_notifier_rule;
 
@@ -1367,8 +1357,7 @@ error:
 /*
  * Alloc new UST app context.
  */
-static
-struct ust_app_ctx *alloc_ust_app_ctx(struct lttng_ust_context_attr *uctx)
+static struct ust_app_ctx *alloc_ust_app_ctx(struct lttng_ust_context_attr *uctx)
 {
        struct ust_app_ctx *ua_ctx;
 
@@ -1409,20 +1398,21 @@ error:
  *
  * Return allocated filter or NULL on error.
  */
-static struct lttng_ust_abi_filter_bytecode *create_ust_filter_bytecode_from_bytecode(
-               const struct lttng_bytecode *orig_f)
+static struct lttng_ust_abi_filter_bytecode *
+create_ust_filter_bytecode_from_bytecode(const struct lttng_bytecode *orig_f)
 {
        struct lttng_ust_abi_filter_bytecode *filter = NULL;
 
        /* Copy filter bytecode. */
        filter = zmalloc<lttng_ust_abi_filter_bytecode>(sizeof(*filter) + orig_f->len);
        if (!filter) {
-               PERROR("Failed to allocate lttng_ust_filter_bytecode: bytecode len = %" PRIu32 " bytes", orig_f->len);
+               PERROR("Failed to allocate lttng_ust_filter_bytecode: bytecode len = %" PRIu32
+                      " bytes",
+                      orig_f->len);
                goto error;
        }
 
-       LTTNG_ASSERT(sizeof(struct lttng_bytecode) ==
-                       sizeof(struct lttng_ust_abi_filter_bytecode));
+       LTTNG_ASSERT(sizeof(struct lttng_bytecode) == sizeof(struct lttng_ust_abi_filter_bytecode));
        memcpy(filter, orig_f, sizeof(*filter) + orig_f->len);
 error:
        return filter;
@@ -1441,12 +1431,14 @@ create_ust_capture_bytecode_from_bytecode(const struct lttng_bytecode *orig_f)
        /* Copy capture bytecode. */
        capture = zmalloc<lttng_ust_abi_capture_bytecode>(sizeof(*capture) + orig_f->len);
        if (!capture) {
-               PERROR("Failed to allocate lttng_ust_abi_capture_bytecode: bytecode len = %" PRIu32 " bytes", orig_f->len);
+               PERROR("Failed to allocate lttng_ust_abi_capture_bytecode: bytecode len = %" PRIu32
+                      " bytes",
+                      orig_f->len);
                goto error;
        }
 
        LTTNG_ASSERT(sizeof(struct lttng_bytecode) ==
-                       sizeof(struct lttng_ust_abi_capture_bytecode));
+                    sizeof(struct lttng_ust_abi_capture_bytecode));
        memcpy(capture, orig_f, sizeof(*capture) + orig_f->len);
 error:
        return capture;
@@ -1463,7 +1455,7 @@ struct ust_app *ust_app_find_by_sock(int sock)
 
        ASSERT_RCU_READ_LOCKED();
 
-       lttng_ht_lookup(ust_app_ht_by_sock, (void *)((unsigned long) sock), &iter);
+       lttng_ht_lookup(ust_app_ht_by_sock, (void *) ((unsigned long) sock), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
        if (node == NULL) {
                DBG2("UST app find by sock %d not found", sock);
@@ -1487,8 +1479,7 @@ static struct ust_app *find_app_by_notify_sock(int sock)
 
        ASSERT_RCU_READ_LOCKED();
 
-       lttng_ht_lookup(ust_app_ht_by_notify_sock, (void *)((unsigned long) sock),
-                       &iter);
+       lttng_ht_lookup(ust_app_ht_by_notify_sock, (void *) ((unsigned long) sock), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
        if (node == NULL) {
                DBG2("UST app find by notify sock %d not found", sock);
@@ -1508,9 +1499,10 @@ error:
  * Return an ust_app_event object or NULL on error.
  */
 static struct ust_app_event *find_ust_app_event(struct lttng_ht *ht,
-               const char *name, const struct lttng_bytecode *filter,
-               int loglevel_value,
-               const struct lttng_event_exclusion *exclusion)
+                                               const char *name,
+                                               const struct lttng_bytecode *filter,
+                                               int loglevel_value,
+                                               const struct lttng_event_exclusion *exclusion)
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_str *node;
@@ -1528,8 +1520,11 @@ static struct ust_app_event *find_ust_app_event(struct lttng_ht *ht,
        key.exclusion = exclusion;
 
        /* Lookup using the event name as hash and a custom match fct. */
-       cds_lfht_lookup(ht->ht, ht->hash_fct((void *) name, lttng_ht_seed),
-                       ht_match_ust_app_event, &key, &iter.iter);
+       cds_lfht_lookup(ht->ht,
+                       ht->hash_fct((void *) name, lttng_ht_seed),
+                       ht_match_ust_app_event,
+                       &key,
+                       &iter.iter);
        node = lttng_ht_iter_get_node_str(&iter);
        if (node == NULL) {
                goto end;
@@ -1547,8 +1542,8 @@ end:
  * Must be called with the RCU read lock held.
  * Return an ust_app_event_notifier_rule object or NULL on error.
  */
-static struct ust_app_event_notifier_rule *find_ust_app_event_notifier_rule(
-               struct lttng_ht *ht, uint64_t token)
+static struct ust_app_event_notifier_rule *find_ust_app_event_notifier_rule(struct lttng_ht *ht,
+                                                                           uint64_t token)
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_u64 *node;
@@ -1560,13 +1555,11 @@ static struct ust_app_event_notifier_rule *find_ust_app_event_notifier_rule(
        lttng_ht_lookup(ht, &token, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
        if (node == NULL) {
-               DBG2("UST app event notifier rule token not found: token = %" PRIu64,
-                               token);
+               DBG2("UST app event notifier rule token not found: token = %" PRIu64, token);
                goto end;
        }
 
-       event_notifier_rule = lttng::utils::container_of(
-                       node, &ust_app_event_notifier_rule::node);
+       event_notifier_rule = lttng::utils::container_of(node, &ust_app_event_notifier_rule::node);
 end:
        return event_notifier_rule;
 }
@@ -1576,30 +1569,33 @@ end:
  *
  * Called with UST app session lock held.
  */
-static
-int create_ust_channel_context(struct ust_app_channel *ua_chan,
-               struct ust_app_ctx *ua_ctx, struct ust_app *app)
+static int create_ust_channel_context(struct ust_app_channel *ua_chan,
+                                     struct ust_app_ctx *ua_ctx,
+                                     struct ust_app *app)
 {
        int ret;
 
        health_code_update();
 
        pthread_mutex_lock(&app->sock_lock);
-       ret = lttng_ust_ctl_add_context(app->sock, &ua_ctx->ctx,
-                       ua_chan->obj, &ua_ctx->obj);
+       ret = lttng_ust_ctl_add_context(app->sock, &ua_ctx->ctx, ua_chan->obj, &ua_ctx->obj);
        pthread_mutex_unlock(&app->sock_lock);
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        ret = 0;
                        DBG3("UST app create channel context failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        ret = 0;
                        WARN("UST app create channel context failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app create channel context failed with ret %d: pid = %d, sock = %d",
-                                       ret, app->pid, app->sock);
+                           ret,
+                           app->pid,
+                           app->sock);
                }
                goto error;
        }
@@ -1607,7 +1603,8 @@ int create_ust_channel_context(struct ust_app_channel *ua_chan,
        ua_ctx->handle = ua_ctx->obj->handle;
 
        DBG2("UST app context handle %d created successfully for channel %s",
-                       ua_ctx->handle, ua_chan->name);
+            ua_ctx->handle,
+            ua_chan->name);
 
 error:
        health_code_update();
@@ -1618,8 +1615,8 @@ error:
  * Set the filter on the tracer.
  */
 static int set_ust_object_filter(struct ust_app *app,
-               const struct lttng_bytecode *bytecode,
-               struct lttng_ust_abi_object_data *ust_object)
+                                const struct lttng_bytecode *bytecode,
+                                struct lttng_ust_abi_object_data *ust_object)
 {
        int ret;
        struct lttng_ust_abi_filter_bytecode *ust_bytecode = NULL;
@@ -1632,21 +1629,25 @@ static int set_ust_object_filter(struct ust_app *app,
                goto error;
        }
        pthread_mutex_lock(&app->sock_lock);
-       ret = lttng_ust_ctl_set_filter(app->sock, ust_bytecode,
-                       ust_object);
+       ret = lttng_ust_ctl_set_filter(app->sock, ust_bytecode, ust_object);
        pthread_mutex_unlock(&app->sock_lock);
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        ret = 0;
                        DBG3("UST app  set filter failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        ret = 0;
                        WARN("UST app  set filter failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app  set filter failed with ret %d: pid = %d, sock = %d, object = %p",
-                                       ret, app->pid, app->sock, ust_object);
+                           ret,
+                           app->pid,
+                           app->sock,
+                           ust_object);
                }
                goto error;
        }
@@ -1665,9 +1666,9 @@ error:
  * the captured payloads.
  */
 static int set_ust_capture(struct ust_app *app,
-               const struct lttng_bytecode *bytecode,
-               unsigned int capture_seqnum,
-               struct lttng_ust_abi_object_data *ust_object)
+                          const struct lttng_bytecode *bytecode,
+                          unsigned int capture_seqnum,
+                          struct lttng_ust_abi_object_data *ust_object)
 {
        int ret;
        struct lttng_ust_abi_capture_bytecode *ust_bytecode = NULL;
@@ -1686,22 +1687,24 @@ static int set_ust_capture(struct ust_app *app,
        ust_bytecode->seqnum = capture_seqnum;
 
        pthread_mutex_lock(&app->sock_lock);
-       ret = lttng_ust_ctl_set_capture(app->sock, ust_bytecode,
-                       ust_object);
+       ret = lttng_ust_ctl_set_capture(app->sock, ust_bytecode, ust_object);
        pthread_mutex_unlock(&app->sock_lock);
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        ret = 0;
                        DBG3("UST app set capture failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        ret = 0;
                        DBG3("UST app set capture failed. Communication timeout: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app event set capture failed with ret %d: pid = %d, sock = %d",
-                                       ret, app->pid,
-                                       app->sock);
+                           ret,
+                           app->pid,
+                           app->sock);
                }
 
                goto error;
@@ -1715,9 +1718,8 @@ error:
        return ret;
 }
 
-static
-struct lttng_ust_abi_event_exclusion *create_ust_exclusion_from_exclusion(
-               const struct lttng_event_exclusion *exclusion)
+static struct lttng_ust_abi_event_exclusion *
+create_ust_exclusion_from_exclusion(const struct lttng_event_exclusion *exclusion)
 {
        struct lttng_ust_abi_event_exclusion *ust_exclusion = NULL;
        size_t exclusion_alloc_size = sizeof(struct lttng_ust_abi_event_exclusion) +
@@ -1730,7 +1732,7 @@ struct lttng_ust_abi_event_exclusion *create_ust_exclusion_from_exclusion(
        }
 
        LTTNG_ASSERT(sizeof(struct lttng_event_exclusion) ==
-                       sizeof(struct lttng_ust_abi_event_exclusion));
+                    sizeof(struct lttng_ust_abi_event_exclusion));
        memcpy(ust_exclusion, exclusion, exclusion_alloc_size);
 end:
        return ust_exclusion;
@@ -1740,8 +1742,8 @@ end:
  * Set event exclusions on the tracer.
  */
 static int set_ust_object_exclusions(struct ust_app *app,
-               const struct lttng_event_exclusion *exclusions,
-               struct lttng_ust_abi_object_data *ust_object)
+                                    const struct lttng_event_exclusion *exclusions,
+                                    struct lttng_ust_abi_object_data *ust_object)
 {
        int ret;
        struct lttng_ust_abi_event_exclusion *ust_exclusions = NULL;
@@ -1750,8 +1752,7 @@ static int set_ust_object_exclusions(struct ust_app *app,
 
        health_code_update();
 
-       ust_exclusions = create_ust_exclusion_from_exclusion(
-                       exclusions);
+       ust_exclusions = create_ust_exclusion_from_exclusion(exclusions);
        if (!ust_exclusions) {
                ret = -LTTNG_ERR_NOMEM;
                goto error;
@@ -1763,14 +1764,19 @@ static int set_ust_object_exclusions(struct ust_app *app,
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        ret = 0;
                        DBG3("UST app event exclusion failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        ret = 0;
                        WARN("UST app event exclusion failed. Communication time out(pid: %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app event exclusions failed with ret %d: pid = %d, sock = %d, object = %p",
-                                       ret, app->pid, app->sock, ust_object);
+                           ret,
+                           app->pid,
+                           app->sock,
+                           ust_object);
                }
                goto error;
        }
@@ -1786,8 +1792,7 @@ error:
 /*
  * Disable the specified event on to UST tracer for the UST session.
  */
-static int disable_ust_object(struct ust_app *app,
-               struct lttng_ust_abi_object_data *object)
+static int disable_ust_object(struct ust_app *app, struct lttng_ust_abi_object_data *object)
 {
        int ret;
 
@@ -1800,20 +1805,24 @@ static int disable_ust_object(struct ust_app *app,
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        ret = 0;
                        DBG3("UST app disable object failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        ret = 0;
                        WARN("UST app disable object failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app disable object failed with ret %d: pid = %d, sock = %d, object = %p",
-                                       ret, app->pid, app->sock, object);
+                           ret,
+                           app->pid,
+                           app->sock,
+                           object);
                }
                goto error;
        }
 
-       DBG2("UST app object %p disabled successfully for app: pid = %d",
-                       object, app->pid);
+       DBG2("UST app object %p disabled successfully for app: pid = %d", object, app->pid);
 
 error:
        health_code_update();
@@ -1824,7 +1833,8 @@ error:
  * Disable the specified channel on to UST tracer for the UST session.
  */
 static int disable_ust_channel(struct ust_app *app,
-               struct ust_app_session *ua_sess, struct ust_app_channel *ua_chan)
+                              struct ust_app_session *ua_sess,
+                              struct ust_app_channel *ua_chan)
 {
        int ret;
 
@@ -1837,21 +1847,25 @@ static int disable_ust_channel(struct ust_app *app,
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        ret = 0;
                        DBG3("UST app disable channel failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        ret = 0;
                        WARN("UST app disable channel failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app channel %s disable failed, session handle %d, with ret %d: pid = %d, sock = %d",
-                                       ua_chan->name, ua_sess->handle, ret,
-                                       app->pid, app->sock);
+                           ua_chan->name,
+                           ua_sess->handle,
+                           ret,
+                           app->pid,
+                           app->sock);
                }
                goto error;
        }
 
-       DBG2("UST app channel %s disabled successfully for app: pid = %d",
-                       ua_chan->name, app->pid);
+       DBG2("UST app channel %s disabled successfully for app: pid = %d", ua_chan->name, app->pid);
 
 error:
        health_code_update();
@@ -1862,7 +1876,8 @@ error:
  * Enable the specified channel on to UST tracer for the UST session.
  */
 static int enable_ust_channel(struct ust_app *app,
-               struct ust_app_session *ua_sess, struct ust_app_channel *ua_chan)
+                             struct ust_app_session *ua_sess,
+                             struct ust_app_channel *ua_chan)
 {
        int ret;
 
@@ -1875,23 +1890,29 @@ static int enable_ust_channel(struct ust_app *app,
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        ret = 0;
                        DBG3("UST app channel %s enable failed. Application is dead: pid = %d, sock = %d",
-                                       ua_chan->name, app->pid, app->sock);
+                            ua_chan->name,
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        ret = 0;
                        WARN("UST app channel %s enable failed. Communication time out: pid = %d, sock = %d",
-                                       ua_chan->name, app->pid, app->sock);
+                            ua_chan->name,
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app channel %s enable failed, session handle %d, with ret %d: pid = %d, sock = %d",
-                                       ua_chan->name, ua_sess->handle, ret,
-                                       app->pid, app->sock);
+                           ua_chan->name,
+                           ua_sess->handle,
+                           ret,
+                           app->pid,
+                           app->sock);
                }
                goto error;
        }
 
        ua_chan->enabled = 1;
 
-       DBG2("UST app channel %s enabled successfully for app: pid = %d",
-                       ua_chan->name, app->pid);
+       DBG2("UST app channel %s enabled successfully for app: pid = %d", ua_chan->name, app->pid);
 
 error:
        health_code_update();
@@ -1901,8 +1922,7 @@ error:
 /*
  * Enable the specified event on to UST tracer for the UST session.
  */
-static int enable_ust_object(
-               struct ust_app *app, struct lttng_ust_abi_object_data *ust_object)
+static int enable_ust_object(struct ust_app *app, struct lttng_ust_abi_object_data *ust_object)
 {
        int ret;
 
@@ -1915,20 +1935,24 @@ static int enable_ust_object(
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        ret = 0;
                        DBG3("UST app enable object failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        ret = 0;
                        WARN("UST app enable object failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app enable object failed with ret %d: pid = %d, sock = %d, object = %p",
-                                       ret, app->pid, app->sock, ust_object);
+                           ret,
+                           app->pid,
+                           app->sock,
+                           ust_object);
                }
                goto error;
        }
 
-       DBG2("UST app object %p enabled successfully for app: pid = %d",
-                       ust_object, app->pid);
+       DBG2("UST app object %p enabled successfully for app: pid = %d", ust_object, app->pid);
 
 error:
        health_code_update();
@@ -1941,7 +1965,8 @@ error:
  * Return 0 on success. On error, a negative value is returned.
  */
 static int send_channel_pid_to_ust(struct ust_app *app,
-               struct ust_app_session *ua_sess, struct ust_app_channel *ua_chan)
+                                  struct ust_app_session *ua_sess,
+                                  struct ust_app_channel *ua_chan)
 {
        int ret;
        struct ust_app_stream *stream, *stmp;
@@ -1952,18 +1977,20 @@ static int send_channel_pid_to_ust(struct ust_app *app,
 
        health_code_update();
 
-       DBG("UST app sending channel %s to UST app sock %d", ua_chan->name,
-                       app->sock);
+       DBG("UST app sending channel %s to UST app sock %d", ua_chan->name, app->sock);
 
        /* Send channel to the application. */
        ret = ust_consumer_send_channel_to_ust(app, ua_sess, ua_chan);
        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
-               ret = -ENOTCONN;        /* Caused by app exiting. */
+               ret = -ENOTCONN; /* Caused by app exiting. */
                goto error;
        } else if (ret == -EAGAIN) {
                /* Caused by timeout. */
-               WARN("Communication with application %d timed out on send_channel for channel \"%s\" of session \"%" PRIu64 "\".",
-                               app->pid, ua_chan->name, ua_sess->tracing_id);
+               WARN("Communication with application %d timed out on send_channel for channel \"%s\" of session \"%" PRIu64
+                    "\".",
+                    app->pid,
+                    ua_chan->name,
+                    ua_sess->tracing_id);
                /* Treat this the same way as an application that is exiting. */
                ret = -ENOTCONN;
                goto error;
@@ -1974,16 +2001,19 @@ static int send_channel_pid_to_ust(struct ust_app *app,
        health_code_update();
 
        /* Send all streams to application. */
-       cds_list_for_each_entry_safe(stream, stmp, &ua_chan->streams.head, list) {
+       cds_list_for_each_entry_safe (stream, stmp, &ua_chan->streams.head, list) {
                ret = ust_consumer_send_stream_to_ust(app, ua_chan, stream);
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        ret = -ENOTCONN; /* Caused by app exiting. */
                        goto error;
                } else if (ret == -EAGAIN) {
                        /* Caused by timeout. */
-                       WARN("Communication with application %d timed out on send_stream for stream \"%s\" of channel \"%s\" of session \"%" PRIu64 "\".",
-                                       app->pid, stream->name, ua_chan->name,
-                                       ua_sess->tracing_id);
+                       WARN("Communication with application %d timed out on send_stream for stream \"%s\" of channel \"%s\" of session \"%" PRIu64
+                            "\".",
+                            app->pid,
+                            stream->name,
+                            ua_chan->name,
+                            ua_sess->tracing_id);
                        /*
                         * Treat this the same way as an application that is
                         * exiting.
@@ -2007,9 +2037,9 @@ error:
  *
  * Should be called with session mutex held.
  */
-static
-int create_ust_event(struct ust_app *app,
-               struct ust_app_channel *ua_chan, struct ust_app_event *ua_event)
+static int create_ust_event(struct ust_app *app,
+                           struct ust_app_channel *ua_chan,
+                           struct ust_app_event *ua_event)
 {
        int ret = 0;
 
@@ -2017,22 +2047,25 @@ int create_ust_event(struct ust_app *app,
 
        /* Create UST event on tracer */
        pthread_mutex_lock(&app->sock_lock);
-       ret = lttng_ust_ctl_create_event(app->sock, &ua_event->attr, ua_chan->obj,
-                       &ua_event->obj);
+       ret = lttng_ust_ctl_create_event(app->sock, &ua_event->attr, ua_chan->obj, &ua_event->obj);
        pthread_mutex_unlock(&app->sock_lock);
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        ret = 0;
                        DBG3("UST app create event failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        ret = 0;
                        WARN("UST app create event failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app create event '%s' failed with ret %d: pid = %d, sock = %d",
-                                       ua_event->attr.name, ret, app->pid,
-                                       app->sock);
+                           ua_event->attr.name,
+                           ret,
+                           app->pid,
+                           app->sock);
                }
                goto error;
        }
@@ -2040,7 +2073,9 @@ int create_ust_event(struct ust_app *app,
        ua_event->handle = ua_event->obj->handle;
 
        DBG2("UST app event %s created successfully for pid:%d object = %p",
-                       ua_event->attr.name, app->pid, ua_event->obj);
+            ua_event->attr.name,
+            app->pid,
+            ua_event->obj);
 
        health_code_update();
 
@@ -2093,16 +2128,15 @@ error:
        return ret;
 }
 
-static int init_ust_event_notifier_from_event_rule(
-               const struct lttng_event_rule *rule,
-               struct lttng_ust_abi_event_notifier *event_notifier)
+static int
+init_ust_event_notifier_from_event_rule(const struct lttng_event_rule *rule,
+                                       struct lttng_ust_abi_event_notifier *event_notifier)
 {
        enum lttng_event_rule_status status;
        enum lttng_ust_abi_loglevel_type ust_loglevel_type = LTTNG_UST_ABI_LOGLEVEL_ALL;
        int loglevel = -1, ret = 0;
        const char *pattern;
 
-
        memset(event_notifier, 0, sizeof(*event_notifier));
 
        if (lttng_event_rule_targets_agent_domain(rule)) {
@@ -2112,15 +2146,14 @@ static int init_ust_event_notifier_from_event_rule(
                 * attached later on.
                 * Set the default values for the agent event.
                 */
-               pattern = event_get_default_agent_ust_name(
-                               lttng_event_rule_get_domain_type(rule));
+               pattern = event_get_default_agent_ust_name(lttng_event_rule_get_domain_type(rule));
                loglevel = 0;
                ust_loglevel_type = LTTNG_UST_ABI_LOGLEVEL_ALL;
        } else {
                const struct lttng_log_level_rule *log_level_rule;
 
                LTTNG_ASSERT(lttng_event_rule_get_type(rule) ==
-                               LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT);
+                            LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT);
 
                status = lttng_event_rule_user_tracepoint_get_name_pattern(rule, &pattern);
                if (status != LTTNG_EVENT_RULE_STATUS_OK) {
@@ -2128,8 +2161,7 @@ static int init_ust_event_notifier_from_event_rule(
                        abort();
                }
 
-               status = lttng_event_rule_user_tracepoint_get_log_level_rule(
-                               rule, &log_level_rule);
+               status = lttng_event_rule_user_tracepoint_get_log_level_rule(rule, &log_level_rule);
                if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
                        ust_loglevel_type = LTTNG_UST_ABI_LOGLEVEL_ALL;
                } else if (status == LTTNG_EVENT_RULE_STATUS_OK) {
@@ -2138,13 +2170,13 @@ static int init_ust_event_notifier_from_event_rule(
                        switch (lttng_log_level_rule_get_type(log_level_rule)) {
                        case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
                                ust_loglevel_type = LTTNG_UST_ABI_LOGLEVEL_SINGLE;
-                               llr_status = lttng_log_level_rule_exactly_get_level(
-                                               log_level_rule, &loglevel);
+                               llr_status = lttng_log_level_rule_exactly_get_level(log_level_rule,
+                                                                                   &loglevel);
                                break;
                        case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
                                ust_loglevel_type = LTTNG_UST_ABI_LOGLEVEL_RANGE;
                                llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                                               log_level_rule, &loglevel);
+                                       log_level_rule, &loglevel);
                                break;
                        default:
                                abort();
@@ -2158,11 +2190,10 @@ static int init_ust_event_notifier_from_event_rule(
        }
 
        event_notifier->event.instrumentation = LTTNG_UST_ABI_TRACEPOINT;
-       ret = lttng_strncpy(event_notifier->event.name, pattern,
-                       sizeof(event_notifier->event.name));
+       ret = lttng_strncpy(
+               event_notifier->event.name, pattern, sizeof(event_notifier->event.name));
        if (ret) {
-               ERR("Failed to copy event rule pattern to notifier: pattern = '%s' ",
-                               pattern);
+               ERR("Failed to copy event rule pattern to notifier: pattern = '%s' ", pattern);
                goto end;
        }
 
@@ -2177,7 +2208,7 @@ end:
  * given application.
  */
 static int create_ust_event_notifier(struct ust_app *app,
-               struct ust_app_event_notifier_rule *ua_event_notifier_rule)
+                                    struct ust_app_event_notifier_rule *ua_event_notifier_rule)
 {
        int ret = 0;
        enum lttng_condition_status condition_status;
@@ -2191,25 +2222,21 @@ static int create_ust_event_notifier(struct ust_app *app,
        health_code_update();
        LTTNG_ASSERT(app->event_notifier_group.object);
 
-       condition = lttng_trigger_get_const_condition(
-                       ua_event_notifier_rule->trigger);
+       condition = lttng_trigger_get_const_condition(ua_event_notifier_rule->trigger);
        LTTNG_ASSERT(condition);
        LTTNG_ASSERT(lttng_condition_get_type(condition) ==
-                       LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
+                    LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
 
-       condition_status = lttng_condition_event_rule_matches_get_rule(
-                       condition, &event_rule);
+       condition_status = lttng_condition_event_rule_matches_get_rule(condition, &event_rule);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
        LTTNG_ASSERT(event_rule);
 
        event_rule_type = lttng_event_rule_get_type(event_rule);
        LTTNG_ASSERT(event_rule_type == LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT ||
-                       event_rule_type == LTTNG_EVENT_RULE_TYPE_JUL_LOGGING ||
-                       event_rule_type ==
-                                       LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING ||
-                       event_rule_type ==
-                                       LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING);
+                    event_rule_type == LTTNG_EVENT_RULE_TYPE_JUL_LOGGING ||
+                    event_rule_type == LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING ||
+                    event_rule_type == LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING);
 
        init_ust_event_notifier_from_event_rule(event_rule, &event_notifier);
        event_notifier.event.token = ua_event_notifier_rule->token;
@@ -2217,23 +2244,28 @@ static int create_ust_event_notifier(struct ust_app *app,
 
        /* Create UST event notifier against the tracer. */
        pthread_mutex_lock(&app->sock_lock);
-       ret = lttng_ust_ctl_create_event_notifier(app->sock, &event_notifier,
-                       app->event_notifier_group.object,
-                       &ua_event_notifier_rule->obj);
+       ret = lttng_ust_ctl_create_event_notifier(app->sock,
+                                                 &event_notifier,
+                                                 app->event_notifier_group.object,
+                                                 &ua_event_notifier_rule->obj);
        pthread_mutex_unlock(&app->sock_lock);
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        ret = 0;
                        DBG3("UST app create event notifier failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        ret = 0;
                        WARN("UST app create event notifier failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app create event notifier '%s' failed with ret %d: pid = %d, sock = %d",
-                                       event_notifier.event.name, ret, app->pid,
-                                       app->sock);
+                           event_notifier.event.name,
+                           ret,
+                           app->pid,
+                           app->sock);
                }
                goto error;
        }
@@ -2241,15 +2273,17 @@ static int create_ust_event_notifier(struct ust_app *app,
        ua_event_notifier_rule->handle = ua_event_notifier_rule->obj->handle;
 
        DBG2("UST app event notifier %s created successfully: app = '%s': pid = %d, object = %p",
-                       event_notifier.event.name, app->name, app->pid,
-                       ua_event_notifier_rule->obj);
+            event_notifier.event.name,
+            app->name,
+            app->pid,
+            ua_event_notifier_rule->obj);
 
        health_code_update();
 
        /* Set filter if one is present. */
        if (ua_event_notifier_rule->filter) {
-               ret = set_ust_object_filter(app, ua_event_notifier_rule->filter,
-                               ua_event_notifier_rule->obj);
+               ret = set_ust_object_filter(
+                       app, ua_event_notifier_rule->filter, ua_event_notifier_rule->obj);
                if (ret < 0) {
                        goto error;
                }
@@ -2257,9 +2291,8 @@ static int create_ust_event_notifier(struct ust_app *app,
 
        /* Set exclusions for the event. */
        if (ua_event_notifier_rule->exclusion) {
-               ret = set_ust_object_exclusions(app,
-                               ua_event_notifier_rule->exclusion,
-                               ua_event_notifier_rule->obj);
+               ret = set_ust_object_exclusions(
+                       app, ua_event_notifier_rule->exclusion, ua_event_notifier_rule->obj);
                if (ret < 0) {
                        goto error;
                }
@@ -2267,16 +2300,15 @@ static int create_ust_event_notifier(struct ust_app *app,
 
        /* Set the capture bytecodes. */
        cond_status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
-                       condition, &capture_bytecode_count);
+               condition, &capture_bytecode_count);
        LTTNG_ASSERT(cond_status == LTTNG_CONDITION_STATUS_OK);
 
        for (i = 0; i < capture_bytecode_count; i++) {
                const struct lttng_bytecode *capture_bytecode =
-                               lttng_condition_event_rule_matches_get_capture_bytecode_at_index(
-                                               condition, i);
+                       lttng_condition_event_rule_matches_get_capture_bytecode_at_index(condition,
+                                                                                        i);
 
-               ret = set_ust_capture(app, capture_bytecode, i,
-                               ua_event_notifier_rule->obj);
+               ret = set_ust_capture(app, capture_bytecode, i, ua_event_notifier_rule->obj);
                if (ret < 0) {
                        goto error;
                }
@@ -2318,8 +2350,7 @@ error:
 /*
  * Copy data between an UST app event and a LTT event.
  */
-static void shadow_copy_event(struct ust_app_event *ua_event,
-               struct ltt_ust_event *uevent)
+static void shadow_copy_event(struct ust_app_event *ua_event, struct ltt_ust_event *uevent)
 {
        size_t exclusion_alloc_size;
 
@@ -2340,13 +2371,12 @@ static void shadow_copy_event(struct ust_app_event *ua_event,
        /* Copy exclusion data */
        if (uevent->exclusion) {
                exclusion_alloc_size = sizeof(struct lttng_event_exclusion) +
-                               LTTNG_UST_ABI_SYM_NAME_LEN * uevent->exclusion->count;
+                       LTTNG_UST_ABI_SYM_NAME_LEN * uevent->exclusion->count;
                ua_event->exclusion = zmalloc<lttng_event_exclusion>(exclusion_alloc_size);
                if (ua_event->exclusion == NULL) {
                        PERROR("malloc");
                } else {
-                       memcpy(ua_event->exclusion, uevent->exclusion,
-                                       exclusion_alloc_size);
+                       memcpy(ua_event->exclusion, uevent->exclusion, exclusion_alloc_size);
                }
        }
 }
@@ -2354,8 +2384,7 @@ static void shadow_copy_event(struct ust_app_event *ua_event,
 /*
  * Copy data between an UST app channel and a LTT channel.
  */
-static void shadow_copy_channel(struct ust_app_channel *ua_chan,
-               struct ltt_ust_channel *uchan)
+static void shadow_copy_channel(struct ust_app_channel *ua_chan, struct ltt_ust_channel *uchan)
 {
        DBG2("UST app shadow copy of channel %s started", ua_chan->name);
 
@@ -2390,7 +2419,8 @@ static void shadow_copy_channel(struct ust_app_channel *ua_chan,
  * Copy data between a UST app session and a regular LTT session.
  */
 static void shadow_copy_session(struct ust_app_session *ua_sess,
-               struct ltt_ust_session *usess, struct ust_app *app)
+                               struct ltt_ust_session *usess,
+                               struct ust_app *app)
 {
        struct tm *timeinfo;
        char datetime[16];
@@ -2417,20 +2447,23 @@ static void shadow_copy_session(struct ust_app_session *ua_sess,
 
        ua_sess->output_traces = usess->output_traces;
        ua_sess->live_timer_interval = usess->live_timer_interval;
-       copy_channel_attr_to_ustctl(&ua_sess->metadata_attr,
-                       &usess->metadata_attr);
+       copy_channel_attr_to_ustctl(&ua_sess->metadata_attr, &usess->metadata_attr);
 
        switch (ua_sess->buffer_type) {
        case LTTNG_BUFFER_PER_PID:
-               ret = snprintf(ua_sess->path, sizeof(ua_sess->path),
-                               DEFAULT_UST_TRACE_PID_PATH "/%s-%d-%s", app->name, app->pid,
-                               datetime);
+               ret = snprintf(ua_sess->path,
+                              sizeof(ua_sess->path),
+                              DEFAULT_UST_TRACE_PID_PATH "/%s-%d-%s",
+                              app->name,
+                              app->pid,
+                              datetime);
                break;
        case LTTNG_BUFFER_PER_UID:
-               ret = snprintf(ua_sess->path, sizeof(ua_sess->path),
-                               DEFAULT_UST_TRACE_UID_PATH,
-                               lttng_credentials_get_uid(&ua_sess->real_credentials),
-                               app->abi.bits_per_long);
+               ret = snprintf(ua_sess->path,
+                              sizeof(ua_sess->path),
+                              DEFAULT_UST_TRACE_UID_PATH,
+                              lttng_credentials_get_uid(&ua_sess->real_credentials),
+                              app->abi.bits_per_long);
                break;
        default:
                abort();
@@ -2442,23 +2475,26 @@ static void shadow_copy_session(struct ust_app_session *ua_sess,
                goto error;
        }
 
-       strncpy(ua_sess->root_shm_path, usess->root_shm_path,
-               sizeof(ua_sess->root_shm_path));
+       strncpy(ua_sess->root_shm_path, usess->root_shm_path, sizeof(ua_sess->root_shm_path));
        ua_sess->root_shm_path[sizeof(ua_sess->root_shm_path) - 1] = '\0';
-       strncpy(ua_sess->shm_path, usess->shm_path,
-               sizeof(ua_sess->shm_path));
+       strncpy(ua_sess->shm_path, usess->shm_path, sizeof(ua_sess->shm_path));
        ua_sess->shm_path[sizeof(ua_sess->shm_path) - 1] = '\0';
        if (ua_sess->shm_path[0]) {
                switch (ua_sess->buffer_type) {
                case LTTNG_BUFFER_PER_PID:
-                       ret = snprintf(tmp_shm_path, sizeof(tmp_shm_path),
-                                       "/" DEFAULT_UST_TRACE_PID_PATH "/%s-%d-%s",
-                                       app->name, app->pid, datetime);
+                       ret = snprintf(tmp_shm_path,
+                                      sizeof(tmp_shm_path),
+                                      "/" DEFAULT_UST_TRACE_PID_PATH "/%s-%d-%s",
+                                      app->name,
+                                      app->pid,
+                                      datetime);
                        break;
                case LTTNG_BUFFER_PER_UID:
-                       ret = snprintf(tmp_shm_path, sizeof(tmp_shm_path),
-                                       "/" DEFAULT_UST_TRACE_UID_PATH,
-                                       app->uid, app->abi.bits_per_long);
+                       ret = snprintf(tmp_shm_path,
+                                      sizeof(tmp_shm_path),
+                                      "/" DEFAULT_UST_TRACE_UID_PATH,
+                                      app->uid,
+                                      app->abi.bits_per_long);
                        break;
                default:
                        abort();
@@ -2469,7 +2505,8 @@ static void shadow_copy_session(struct ust_app_session *ua_sess,
                        abort();
                        goto error;
                }
-               strncat(ua_sess->shm_path, tmp_shm_path,
+               strncat(ua_sess->shm_path,
+                       tmp_shm_path,
                        sizeof(ua_sess->shm_path) - strlen(ua_sess->shm_path) - 1);
                ua_sess->shm_path[sizeof(ua_sess->shm_path) - 1] = '\0';
        }
@@ -2482,9 +2519,9 @@ error:
 /*
  * Lookup sesison wrapper.
  */
-static
-void __lookup_session_by_app(const struct ltt_ust_session *usess,
-                       struct ust_app *app, struct lttng_ht_iter *iter)
+static void __lookup_session_by_app(const struct ltt_ust_session *usess,
+                                   struct ust_app *app,
+                                   struct lttng_ht_iter *iter)
 {
        /* Get right UST app session from app */
        lttng_ht_lookup(app->sessions, &usess->id, iter);
@@ -2494,8 +2531,8 @@ void __lookup_session_by_app(const struct ltt_ust_session *usess,
  * Return ust app session from the app session hashtable using the UST session
  * id.
  */
-static struct ust_app_session *lookup_session_by_app(
-               const struct ltt_ust_session *usess, struct ust_app *app)
+static struct ust_app_session *lookup_session_by_app(const struct ltt_ust_session *usess,
+                                                    struct ust_app *app)
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_u64 *node;
@@ -2520,7 +2557,8 @@ error:
  * Return 0 on success or else a negative value.
  */
 static int setup_buffer_reg_pid(struct ust_app_session *ua_sess,
-               struct ust_app *app, struct buffer_reg_pid **regp)
+                               struct ust_app *app,
+                               struct buffer_reg_pid **regp)
 {
        int ret = 0;
        struct buffer_reg_pid *reg_pid;
@@ -2536,8 +2574,8 @@ static int setup_buffer_reg_pid(struct ust_app_session *ua_sess,
                 * This is the create channel path meaning that if there is NO
                 * registry available, we have to create one for this session.
                 */
-               ret = buffer_reg_pid_create(ua_sess->id, &reg_pid,
-                       ua_sess->root_shm_path, ua_sess->shm_path);
+               ret = buffer_reg_pid_create(
+                       ua_sess->id, &reg_pid, ua_sess->root_shm_path, ua_sess->shm_path);
                if (ret < 0) {
                        goto error;
                }
@@ -2546,12 +2584,16 @@ static int setup_buffer_reg_pid(struct ust_app_session *ua_sess,
        }
 
        /* Initialize registry. */
-       reg_pid->registry->reg.ust = ust_registry_session_per_pid_create(app, app->abi,
-                       app->version.major, app->version.minor, reg_pid->root_shm_path,
-                       reg_pid->shm_path,
-                       lttng_credentials_get_uid(&ua_sess->effective_credentials),
-                       lttng_credentials_get_gid(&ua_sess->effective_credentials),
-                       ua_sess->tracing_id);
+       reg_pid->registry->reg.ust = ust_registry_session_per_pid_create(
+               app,
+               app->abi,
+               app->version.major,
+               app->version.minor,
+               reg_pid->root_shm_path,
+               reg_pid->shm_path,
+               lttng_credentials_get_uid(&ua_sess->effective_credentials),
+               lttng_credentials_get_gid(&ua_sess->effective_credentials),
+               ua_sess->tracing_id);
        if (!reg_pid->registry->reg.ust) {
                /*
                 * reg_pid->registry->reg.ust is NULL upon error, so we need to
@@ -2584,8 +2626,9 @@ error:
  * Return 0 on success or else a negative value.
  */
 static int setup_buffer_reg_uid(struct ltt_ust_session *usess,
-               struct ust_app_session *ua_sess,
-               struct ust_app *app, struct buffer_reg_uid **regp)
+                               struct ust_app_session *ua_sess,
+                               struct ust_app *app,
+                               struct buffer_reg_uid **regp)
 {
        int ret = 0;
        struct buffer_reg_uid *reg_uid;
@@ -2601,9 +2644,13 @@ static int setup_buffer_reg_uid(struct ltt_ust_session *usess,
                 * This is the create channel path meaning that if there is NO
                 * registry available, we have to create one for this session.
                 */
-               ret = buffer_reg_uid_create(usess->id, app->abi.bits_per_long, app->uid,
-                               LTTNG_DOMAIN_UST, &reg_uid, ua_sess->root_shm_path,
-                               ua_sess->shm_path);
+               ret = buffer_reg_uid_create(usess->id,
+                                           app->abi.bits_per_long,
+                                           app->uid,
+                                           LTTNG_DOMAIN_UST,
+                                           &reg_uid,
+                                           ua_sess->root_shm_path,
+                                           ua_sess->shm_path);
                if (ret < 0) {
                        goto error;
                }
@@ -2613,8 +2660,14 @@ static int setup_buffer_reg_uid(struct ltt_ust_session *usess,
 
        /* Initialize registry. */
        reg_uid->registry->reg.ust = ust_registry_session_per_uid_create(app->abi,
-                       app->version.major, app->version.minor, reg_uid->root_shm_path,
-                       reg_uid->shm_path, usess->uid, usess->gid, ua_sess->tracing_id, app->uid);
+                                                                        app->version.major,
+                                                                        app->version.minor,
+                                                                        reg_uid->root_shm_path,
+                                                                        reg_uid->shm_path,
+                                                                        usess->uid,
+                                                                        usess->gid,
+                                                                        ua_sess->tracing_id,
+                                                                        app->uid);
        if (!reg_uid->registry->reg.ust) {
                /*
                 * reg_uid->registry->reg.ust is NULL upon error, so we need to
@@ -2653,8 +2706,9 @@ error:
  * -ENOTCONN which is the default code if the lttng_ust_ctl_create_session fails.
  */
 static int find_or_create_ust_app_session(struct ltt_ust_session *usess,
-               struct ust_app *app, struct ust_app_session **ua_sess_ptr,
-               int *is_created)
+                                         struct ust_app *app,
+                                         struct ust_app_session **ua_sess_ptr,
+                                         int *is_created)
 {
        int ret, created = 0;
        struct ust_app_session *ua_sess;
@@ -2668,7 +2722,8 @@ static int find_or_create_ust_app_session(struct ltt_ust_session *usess,
        ua_sess = lookup_session_by_app(usess, app);
        if (ua_sess == NULL) {
                DBG2("UST app pid: %d session id %" PRIu64 " not found, creating it",
-                               app->pid, usess->id);
+                    app->pid,
+                    usess->id);
                ua_sess = alloc_ust_app_session();
                if (ua_sess == NULL) {
                        /* Only malloc can failed so something is really wrong */
@@ -2711,15 +2766,19 @@ static int find_or_create_ust_app_session(struct ltt_ust_session *usess,
                if (ret < 0) {
                        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                                DBG("UST app creating session failed. Application is dead: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                   app->pid,
+                                   app->sock);
                                ret = 0;
                        } else if (ret == -EAGAIN) {
                                DBG("UST app creating session failed. Communication time out: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                   app->pid,
+                                   app->sock);
                                ret = 0;
                        } else {
                                ERR("UST app creating session failed with ret %d: pid = %d, sock =%d",
-                                               ret, app->pid, app->sock);
+                                   ret,
+                                   app->pid,
+                                   app->sock);
                        }
                        delete_ust_app_session(-1, ua_sess, app);
                        if (ret != -ENOMEM) {
@@ -2735,12 +2794,10 @@ static int find_or_create_ust_app_session(struct ltt_ust_session *usess,
                ua_sess->handle = ret;
 
                /* Add ust app session to app's HT */
-               lttng_ht_node_init_u64(&ua_sess->node,
-                               ua_sess->tracing_id);
+               lttng_ht_node_init_u64(&ua_sess->node, ua_sess->tracing_id);
                lttng_ht_add_unique_u64(app->sessions, &ua_sess->node);
                lttng_ht_node_init_ulong(&ua_sess->ust_objd_node, ua_sess->handle);
-               lttng_ht_add_unique_ulong(app->ust_sessions_objd,
-                               &ua_sess->ust_objd_node);
+               lttng_ht_add_unique_ulong(app->ust_sessions_objd, &ua_sess->ust_objd_node);
 
                DBG2("UST app session created successfully with handle %d", ret);
        }
@@ -2780,19 +2837,17 @@ static int ht_match_ust_app_ctx(struct cds_lfht_node *node, const void *_key)
                goto no_match;
        }
 
-       switch(key->ctx) {
+       switch (key->ctx) {
        case LTTNG_UST_ABI_CONTEXT_PERF_THREAD_COUNTER:
                if (strncmp(key->u.perf_counter.name,
-                               ctx->ctx.u.perf_counter.name,
-                               sizeof(key->u.perf_counter.name))) {
+                           ctx->ctx.u.perf_counter.name,
+                           sizeof(key->u.perf_counter.name))) {
                        goto no_match;
                }
                break;
        case LTTNG_UST_ABI_CONTEXT_APP_CONTEXT:
-               if (strcmp(key->u.app_ctx.provider_name,
-                               ctx->ctx.u.app_ctx.provider_name) ||
-                               strcmp(key->u.app_ctx.ctx_name,
-                               ctx->ctx.u.app_ctx.ctx_name)) {
+               if (strcmp(key->u.app_ctx.provider_name, ctx->ctx.u.app_ctx.provider_name) ||
+                   strcmp(key->u.app_ctx.ctx_name, ctx->ctx.u.app_ctx.ctx_name)) {
                        goto no_match;
                }
                break;
@@ -2813,9 +2868,8 @@ no_match:
  * Must be called while holding RCU read side lock.
  * Return an ust_app_ctx object or NULL on error.
  */
-static
-struct ust_app_ctx *find_ust_app_context(struct lttng_ht *ht,
-               struct lttng_ust_context_attr *uctx)
+static struct ust_app_ctx *find_ust_app_context(struct lttng_ht *ht,
+                                               struct lttng_ust_context_attr *uctx)
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_ulong *node;
@@ -2826,8 +2880,11 @@ struct ust_app_ctx *find_ust_app_context(struct lttng_ht *ht,
        ASSERT_RCU_READ_LOCKED();
 
        /* Lookup using the lttng_ust_context_type and a custom match fct. */
-       cds_lfht_lookup(ht->ht, ht->hash_fct((void *) uctx->ctx, lttng_ht_seed),
-                       ht_match_ust_app_ctx, uctx, &iter.iter);
+       cds_lfht_lookup(ht->ht,
+                       ht->hash_fct((void *) uctx->ctx, lttng_ht_seed),
+                       ht_match_ust_app_ctx,
+                       uctx,
+                       &iter.iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
        if (!node) {
                goto end;
@@ -2844,10 +2901,9 @@ end:
  *
  * Called with UST app session lock held and a RCU read side lock.
  */
-static
-int create_ust_app_channel_context(struct ust_app_channel *ua_chan,
-               struct lttng_ust_context_attr *uctx,
-               struct ust_app *app)
+static int create_ust_app_channel_context(struct ust_app_channel *ua_chan,
+                                         struct lttng_ust_context_attr *uctx,
+                                         struct ust_app *app)
 {
        int ret = 0;
        struct ust_app_ctx *ua_ctx;
@@ -2887,9 +2943,7 @@ error:
  *
  * Called with UST app session lock held.
  */
-static
-int enable_ust_app_event(struct ust_app_event *ua_event,
-               struct ust_app *app)
+static int enable_ust_app_event(struct ust_app_event *ua_event, struct ust_app *app)
 {
        int ret;
 
@@ -2907,8 +2961,7 @@ error:
 /*
  * Disable on the tracer side a ust app event for the session and channel.
  */
-static int disable_ust_app_event(struct ust_app_event *ua_event,
-               struct ust_app *app)
+static int disable_ust_app_event(struct ust_app_event *ua_event, struct ust_app *app)
 {
        int ret;
 
@@ -2926,9 +2979,9 @@ error:
 /*
  * Lookup ust app channel for session and disable it on the tracer side.
  */
-static
-int disable_ust_app_channel(struct ust_app_session *ua_sess,
-               struct ust_app_channel *ua_chan, struct ust_app *app)
+static int disable_ust_app_channel(struct ust_app_session *ua_sess,
+                                  struct ust_app_channel *ua_chan,
+                                  struct ust_app *app)
 {
        int ret;
 
@@ -2948,7 +3001,8 @@ error:
  * MUST be called with a RCU read side lock acquired.
  */
 static int enable_ust_app_channel(struct ust_app_session *ua_sess,
-               struct ltt_ust_channel *uchan, struct ust_app *app)
+                                 struct ltt_ust_channel *uchan,
+                                 struct ust_app *app)
 {
        int ret = 0;
        struct lttng_ht_iter iter;
@@ -2957,11 +3011,12 @@ static int enable_ust_app_channel(struct ust_app_session *ua_sess,
 
        ASSERT_RCU_READ_LOCKED();
 
-       lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &iter);
+       lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &iter);
        ua_chan_node = lttng_ht_iter_get_node_str(&iter);
        if (ua_chan_node == NULL) {
                DBG2("Unable to find channel %s in ust session id %" PRIu64,
-                               uchan->name, ua_sess->tracing_id);
+                    uchan->name,
+                    ua_sess->tracing_id);
                goto error;
        }
 
@@ -2984,8 +3039,10 @@ error:
  * Return 0 on success or else a negative value.
  */
 static int do_consumer_create_channel(struct ltt_ust_session *usess,
-               struct ust_app_session *ua_sess, struct ust_app_channel *ua_chan,
-               int bitness, lsu::registry_session *registry)
+                                     struct ust_app_session *ua_sess,
+                                     struct ust_app_channel *ua_chan,
+                                     int bitness,
+                                     lsu::registry_session *registry)
 {
        int ret;
        unsigned int nb_fd = 0;
@@ -3019,8 +3076,8 @@ static int do_consumer_create_channel(struct ltt_ust_session *usess,
         * Ask consumer to create channel. The consumer will return the number of
         * stream we have to expect.
         */
-       ret = ust_consumer_ask_channel(ua_sess, ua_chan, usess->consumer, socket,
-                       registry, usess->current_trace_chunk);
+       ret = ust_consumer_ask_channel(
+               ua_sess, ua_chan, usess->consumer, socket, registry, usess->current_trace_chunk);
        if (ret < 0) {
                goto error_ask;
        }
@@ -3079,7 +3136,7 @@ error:
  * Return 0 on success or else a negative value.
  */
 static int duplicate_stream_object(struct buffer_reg_stream *reg_stream,
-               struct ust_app_stream *stream)
+                                  struct ust_app_stream *stream)
 {
        int ret;
 
@@ -3094,11 +3151,12 @@ static int duplicate_stream_object(struct buffer_reg_stream *reg_stream,
        }
 
        /* Duplicate object for stream once the original is in the registry. */
-       ret = lttng_ust_ctl_duplicate_ust_object_data(&stream->obj,
-                       reg_stream->obj.ust);
+       ret = lttng_ust_ctl_duplicate_ust_object_data(&stream->obj, reg_stream->obj.ust);
        if (ret < 0) {
                ERR("Duplicate stream obj from %p to %p failed with ret %d",
-                               reg_stream->obj.ust, stream->obj, ret);
+                   reg_stream->obj.ust,
+                   stream->obj,
+                   ret);
                lttng_fd_put(LTTNG_FD_APPS, 2);
                goto error;
        }
@@ -3115,7 +3173,7 @@ error:
  * Return 0 on success or else a negative value.
  */
 static int duplicate_channel_object(struct buffer_reg_channel *buf_reg_chan,
-               struct ust_app_channel *ua_chan)
+                                   struct ust_app_channel *ua_chan)
 {
        int ret;
 
@@ -3133,7 +3191,9 @@ static int duplicate_channel_object(struct buffer_reg_channel *buf_reg_chan,
        ret = lttng_ust_ctl_duplicate_ust_object_data(&ua_chan->obj, buf_reg_chan->obj.ust);
        if (ret < 0) {
                ERR("Duplicate channel obj from %p to %p failed with ret: %d",
-                               buf_reg_chan->obj.ust, ua_chan->obj, ret);
+                   buf_reg_chan->obj.ust,
+                   ua_chan->obj,
+                   ret);
                goto error;
        }
        ua_chan->handle = ua_chan->obj->handle;
@@ -3153,8 +3213,8 @@ error_fd_get:
  * Return 0 on success or else a negative value.
  */
 static int setup_buffer_reg_streams(struct buffer_reg_channel *buf_reg_chan,
-               struct ust_app_channel *ua_chan,
-               struct ust_app *app)
+                                   struct ust_app_channel *ua_chan,
+                                   struct ust_app *app)
 {
        int ret = 0;
        struct ust_app_stream *stream, *stmp;
@@ -3165,7 +3225,7 @@ static int setup_buffer_reg_streams(struct buffer_reg_channel *buf_reg_chan,
        DBG2("UST app setup buffer registry stream");
 
        /* Send all streams to application. */
-       cds_list_for_each_entry_safe(stream, stmp, &ua_chan->streams.head, list) {
+       cds_list_for_each_entry_safe (stream, stmp, &ua_chan->streams.head, list) {
                struct buffer_reg_stream *reg_stream;
 
                ret = buffer_reg_stream_create(&reg_stream);
@@ -3199,7 +3259,8 @@ error:
  * Return 0 on success else a negative value.
  */
 static int create_buffer_reg_channel(struct buffer_reg_session *reg_sess,
-               struct ust_app_channel *ua_chan, struct buffer_reg_channel **regp)
+                                    struct ust_app_channel *ua_chan,
+                                    struct buffer_reg_channel **regp)
 {
        int ret;
        struct buffer_reg_channel *buf_reg_chan = NULL;
@@ -3223,7 +3284,8 @@ static int create_buffer_reg_channel(struct buffer_reg_session *reg_sess,
        try {
                reg_sess->reg.ust->add_channel(ua_chan->tracing_channel_id);
        } catch (const std::exception& ex) {
-               ERR("Failed to add a channel registry to userspace registry session: %s", ex.what());
+               ERR("Failed to add a channel registry to userspace registry session: %s",
+                   ex.what());
                ret = -1;
                goto error;
        }
@@ -3250,8 +3312,9 @@ error_create:
  * Return 0 on success else a negative value.
  */
 static int setup_buffer_reg_channel(struct buffer_reg_session *reg_sess,
-               struct ust_app_channel *ua_chan, struct buffer_reg_channel *buf_reg_chan,
-               struct ust_app *app)
+                                   struct ust_app_channel *ua_chan,
+                                   struct buffer_reg_channel *buf_reg_chan,
+                                   struct ust_app *app)
 {
        int ret;
 
@@ -3285,8 +3348,9 @@ error:
  * Return 0 on success else a negative value.
  */
 static int send_channel_uid_to_ust(struct buffer_reg_channel *buf_reg_chan,
-               struct ust_app *app, struct ust_app_session *ua_sess,
-               struct ust_app_channel *ua_chan)
+                                  struct ust_app *app,
+                                  struct ust_app_session *ua_sess,
+                                  struct ust_app_channel *ua_chan)
 {
        int ret;
        struct buffer_reg_stream *reg_stream;
@@ -3306,12 +3370,15 @@ static int send_channel_uid_to_ust(struct buffer_reg_channel *buf_reg_chan,
        /* Send channel to the application. */
        ret = ust_consumer_send_channel_to_ust(app, ua_sess, ua_chan);
        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
-               ret = -ENOTCONN;        /* Caused by app exiting. */
+               ret = -ENOTCONN; /* Caused by app exiting. */
                goto error;
        } else if (ret == -EAGAIN) {
                /* Caused by timeout. */
-               WARN("Communication with application %d timed out on send_channel for channel \"%s\" of session \"%" PRIu64 "\".",
-                               app->pid, ua_chan->name, ua_sess->tracing_id);
+               WARN("Communication with application %d timed out on send_channel for channel \"%s\" of session \"%" PRIu64
+                    "\".",
+                    app->pid,
+                    ua_chan->name,
+                    ua_sess->tracing_id);
                /* Treat this the same way as an application that is exiting. */
                ret = -ENOTCONN;
                goto error;
@@ -3323,7 +3390,7 @@ static int send_channel_uid_to_ust(struct buffer_reg_channel *buf_reg_chan,
 
        /* Send all streams to application. */
        pthread_mutex_lock(&buf_reg_chan->stream_list_lock);
-       cds_list_for_each_entry(reg_stream, &buf_reg_chan->streams, lnode) {
+       cds_list_for_each_entry (reg_stream, &buf_reg_chan->streams, lnode) {
                struct ust_app_stream stream = {};
 
                ret = duplicate_stream_object(reg_stream, &stream);
@@ -3341,10 +3408,11 @@ static int send_channel_uid_to_ust(struct buffer_reg_channel *buf_reg_chan,
                                 * Treat this the same way as an application
                                 * that is exiting.
                                 */
-                               WARN("Communication with application %d timed out on send_stream for stream of channel \"%s\" of session \"%" PRIu64 "\".",
-                                               app->pid,
-                                               ua_chan->name,
-                                               ua_sess->tracing_id);
+                               WARN("Communication with application %d timed out on send_stream for stream of channel \"%s\" of session \"%" PRIu64
+                                    "\".",
+                                    app->pid,
+                                    ua_chan->name,
+                                    ua_sess->tracing_id);
                                ret = -ENOTCONN;
                        }
                        (void) release_ust_app_stream(-1, &stream, app);
@@ -3373,8 +3441,9 @@ error:
  * Return 0 on success else a negative value.
  */
 static int create_channel_per_uid(struct ust_app *app,
-               struct ltt_ust_session *usess, struct ust_app_session *ua_sess,
-               struct ust_app_channel *ua_chan)
+                                 struct ltt_ust_session *usess,
+                                 struct ust_app_session *ua_sess,
+                                 struct ust_app_channel *ua_chan)
 {
        int ret;
        struct buffer_reg_uid *reg_uid;
@@ -3398,8 +3467,7 @@ static int create_channel_per_uid(struct ust_app *app,
         */
        LTTNG_ASSERT(reg_uid);
 
-       buf_reg_chan = buffer_reg_channel_find(ua_chan->tracing_channel_id,
-                       reg_uid);
+       buf_reg_chan = buffer_reg_channel_find(ua_chan->tracing_channel_id, reg_uid);
        if (buf_reg_chan) {
                goto send_channel;
        }
@@ -3407,8 +3475,7 @@ static int create_channel_per_uid(struct ust_app *app,
        /* Create the buffer registry channel object. */
        ret = create_buffer_reg_channel(reg_uid->registry, ua_chan, &buf_reg_chan);
        if (ret < 0) {
-               ERR("Error creating the UST channel \"%s\" registry instance",
-                               ua_chan->name);
+               ERR("Error creating the UST channel \"%s\" registry instance", ua_chan->name);
                goto error;
        }
 
@@ -3421,11 +3488,10 @@ static int create_channel_per_uid(struct ust_app *app,
         * Create the buffers on the consumer side. This call populates the
         * ust app channel object with all streams and data object.
         */
-       ret = do_consumer_create_channel(usess, ua_sess, ua_chan,
-                       app->abi.bits_per_long, reg_uid->registry->reg.ust);
+       ret = do_consumer_create_channel(
+               usess, ua_sess, ua_chan, app->abi.bits_per_long, reg_uid->registry->reg.ust);
        if (ret < 0) {
-               ERR("Error creating UST channel \"%s\" on the consumer daemon",
-                               ua_chan->name);
+               ERR("Error creating UST channel \"%s\" on the consumer daemon", ua_chan->name);
 
                /*
                 * Let's remove the previously created buffer registry channel so
@@ -3434,7 +3500,7 @@ static int create_channel_per_uid(struct ust_app *app,
                auto locked_registry = reg_uid->registry->reg.ust->lock();
                try {
                        locked_registry->remove_channel(ua_chan->tracing_channel_id, false);
-               } catch (const std::exception &ex) {
+               } catch (const std::exceptionex) {
                        DBG("Could not find channel for removal: %s", ex.what());
                }
                buffer_reg_channel_remove(reg_uid->registry, buf_reg_chan);
@@ -3445,8 +3511,7 @@ static int create_channel_per_uid(struct ust_app *app,
        /*
         * Setup the streams and add it to the session registry.
         */
-       ret = setup_buffer_reg_channel(reg_uid->registry,
-                       ua_chan, buf_reg_chan, app);
+       ret = setup_buffer_reg_channel(reg_uid->registry, ua_chan, buf_reg_chan, app);
        if (ret < 0) {
                ERR("Error setting up UST channel \"%s\"", ua_chan->name);
                goto error;
@@ -3461,11 +3526,14 @@ static int create_channel_per_uid(struct ust_app *app,
 
        /* Notify the notification subsystem of the channel's creation. */
        notification_ret = notification_thread_command_add_channel(
-                       the_notification_thread_handle, session->id,
-                       ua_chan->name, ua_chan->key, LTTNG_DOMAIN_UST,
-                       ua_chan->attr.subbuf_size * ua_chan->attr.num_subbuf);
+               the_notification_thread_handle,
+               session->id,
+               ua_chan->name,
+               ua_chan->key,
+               LTTNG_DOMAIN_UST,
+               ua_chan->attr.subbuf_size * ua_chan->attr.num_subbuf);
        if (notification_ret != LTTNG_OK) {
-               ret = - (int) notification_ret;
+               ret = -(int) notification_ret;
                ERR("Failed to add channel to notification thread");
                goto error;
        }
@@ -3496,8 +3564,9 @@ error:
  * Return 0 on success else a negative value.
  */
 static int create_channel_per_pid(struct ust_app *app,
-               struct ltt_ust_session *usess, struct ust_app_session *ua_sess,
-               struct ust_app_channel *ua_chan)
+                                 struct ltt_ust_session *usess,
+                                 struct ust_app_session *ua_sess,
+                                 struct ust_app_channel *ua_chan)
 {
        int ret;
        lsu::registry_session *registry;
@@ -3522,8 +3591,9 @@ static int create_channel_per_pid(struct ust_app *app,
        try {
                registry->add_channel(ua_chan->key);
        } catch (const std::exception& ex) {
-               ERR("Error creating the UST channel \"%s\" registry instance: %s", ua_chan->name,
-                               ex.what());
+               ERR("Error creating the UST channel \"%s\" registry instance: %s",
+                   ua_chan->name,
+                   ex.what());
                ret = -1;
                goto error;
        }
@@ -3534,11 +3604,9 @@ static int create_channel_per_pid(struct ust_app *app,
        ASSERT_SESSION_LIST_LOCKED();
 
        /* Create and get channel on the consumer side. */
-       ret = do_consumer_create_channel(usess, ua_sess, ua_chan,
-                       app->abi.bits_per_long, registry);
+       ret = do_consumer_create_channel(usess, ua_sess, ua_chan, app->abi.bits_per_long, registry);
        if (ret < 0) {
-               ERR("Error creating UST channel \"%s\" on the consumer daemon",
-                       ua_chan->name);
+               ERR("Error creating UST channel \"%s\" on the consumer daemon", ua_chan->name);
                goto error_remove_from_registry;
        }
 
@@ -3558,12 +3626,15 @@ static int create_channel_per_pid(struct ust_app *app,
                ust_reg_chan._consumer_key = ua_chan->key;
        }
 
-       cmd_ret = notification_thread_command_add_channel(
-                       the_notification_thread_handle, session->id,
-                       ua_chan->name, ua_chan->key, LTTNG_DOMAIN_UST,
-                       ua_chan->attr.subbuf_size * ua_chan->attr.num_subbuf);
+       cmd_ret = notification_thread_command_add_channel(the_notification_thread_handle,
+                                                         session->id,
+                                                         ua_chan->name,
+                                                         ua_chan->key,
+                                                         LTTNG_DOMAIN_UST,
+                                                         ua_chan->attr.subbuf_size *
+                                                                 ua_chan->attr.num_subbuf);
        if (cmd_ret != LTTNG_OK) {
-               ret = - (int) cmd_ret;
+               ret = -(int) cmd_ret;
                ERR("Failed to add channel to notification thread");
                goto error_remove_from_registry;
        }
@@ -3596,8 +3667,9 @@ error:
  * the application exited concurrently.
  */
 static int ust_app_channel_send(struct ust_app *app,
-               struct ltt_ust_session *usess, struct ust_app_session *ua_sess,
-               struct ust_app_channel *ua_chan)
+                               struct ltt_ust_session *usess,
+                               struct ust_app_session *ua_sess,
+                               struct ust_app_channel *ua_chan)
 {
        int ret;
 
@@ -3656,10 +3728,10 @@ error:
  * Return 0 on success or else a negative value.
  */
 static int ust_app_channel_allocate(struct ust_app_session *ua_sess,
-               struct ltt_ust_channel *uchan,
-               enum lttng_ust_abi_chan_type type,
-               struct ltt_ust_session *usess __attribute__((unused)),
-               struct ust_app_channel **ua_chanp)
+                                   struct ltt_ust_channel *uchan,
+                                   enum lttng_ust_abi_chan_type type,
+                                   struct ltt_ust_session *usess __attribute__((unused)),
+                                   struct ust_app_channel **ua_chanp)
 {
        int ret = 0;
        struct lttng_ht_iter iter;
@@ -3669,7 +3741,7 @@ static int ust_app_channel_allocate(struct ust_app_session *ua_sess,
        ASSERT_RCU_READ_LOCKED();
 
        /* Lookup channel in the ust app session */
-       lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &iter);
+       lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &iter);
        ua_chan_node = lttng_ht_iter_get_node_str(&iter);
        if (ua_chan_node != NULL) {
                ua_chan = lttng::utils::container_of(ua_chan_node, &ust_app_channel::node);
@@ -3707,10 +3779,9 @@ error:
  * Must be called with the RCU read side lock held.
  * Called with ust app session mutex held.
  */
-static
-int create_ust_app_event(struct ust_app_channel *ua_chan,
-               struct ltt_ust_event *uevent,
-               struct ust_app *app)
+static int create_ust_app_event(struct ust_app_channel *ua_chan,
+                               struct ltt_ust_event *uevent,
+                               struct ust_app *app)
 {
        int ret = 0;
        struct ust_app_event *ua_event;
@@ -3736,18 +3807,19 @@ int create_ust_app_event(struct ust_app_channel *ua_chan,
                 */
                if (ret == -LTTNG_UST_ERR_EXIST) {
                        ERR("Tracer for application reported that an event being created already existed: "
-                                       "event_name = \"%s\", pid = %d, ppid = %d, uid = %d, gid = %d",
-                                       uevent->attr.name,
-                                       app->pid, app->ppid, app->uid,
-                                       app->gid);
+                           "event_name = \"%s\", pid = %d, ppid = %d, uid = %d, gid = %d",
+                           uevent->attr.name,
+                           app->pid,
+                           app->ppid,
+                           app->uid,
+                           app->gid);
                }
                goto error;
        }
 
        add_unique_ust_app_event(ua_chan, ua_event);
 
-       DBG2("UST app create event completed: app = '%s' pid = %d",
-                       app->name, app->pid);
+       DBG2("UST app create event completed: app = '%s' pid = %d", app->name, app->pid);
 
 end:
        return ret;
@@ -3764,9 +3836,7 @@ error:
  * Must be called with the RCU read side lock held.
  * Called with ust app session mutex held.
  */
-static
-int create_ust_app_event_notifier_rule(struct lttng_trigger *trigger,
-               struct ust_app *app)
+static int create_ust_app_event_notifier_rule(struct lttng_trigger *trigger, struct ust_app *app)
 {
        int ret = 0;
        struct ust_app_event_notifier_rule *ua_event_notifier_rule;
@@ -3790,19 +3860,23 @@ int create_ust_app_event_notifier_rule(struct lttng_trigger *trigger,
                 */
                if (ret == -LTTNG_UST_ERR_EXIST) {
                        ERR("Tracer for application reported that an event notifier being created already exists: "
-                                       "token = \"%" PRIu64 "\", pid = %d, ppid = %d, uid = %d, gid = %d",
-                                       lttng_trigger_get_tracer_token(trigger),
-                                       app->pid, app->ppid, app->uid,
-                                       app->gid);
+                           "token = \"%" PRIu64 "\", pid = %d, ppid = %d, uid = %d, gid = %d",
+                           lttng_trigger_get_tracer_token(trigger),
+                           app->pid,
+                           app->ppid,
+                           app->uid,
+                           app->gid);
                }
                goto error;
        }
 
        lttng_ht_add_unique_u64(app->token_to_event_notifier_rule_ht,
-                       &ua_event_notifier_rule->node);
+                               &ua_event_notifier_rule->node);
 
        DBG2("UST app create token event rule completed: app = '%s', pid = %d, token = %" PRIu64,
-                       app->name, app->pid, lttng_trigger_get_tracer_token(trigger));
+            app->name,
+            app->pid,
+            lttng_trigger_get_tracer_token(trigger));
 
        goto end;
 
@@ -3819,7 +3893,8 @@ end:
  * Called with UST app session lock held and RCU read side lock.
  */
 static int create_ust_app_metadata(struct ust_app_session *ua_sess,
-               struct ust_app *app, struct consumer_output *consumer)
+                                  struct ust_app *app,
+                                  struct consumer_output *consumer)
 {
        int ret = 0;
        struct ust_app_channel *metadata;
@@ -3884,8 +3959,12 @@ static int create_ust_app_metadata(struct ust_app_session *ua_sess,
         * never added or monitored until we do a first push metadata to the
         * consumer.
         */
-       ret = ust_consumer_ask_channel(ua_sess, metadata, consumer, socket,
-                       locked_registry.get(), session->current_trace_chunk);
+       ret = ust_consumer_ask_channel(ua_sess,
+                                      metadata,
+                                      consumer,
+                                      socket,
+                                      locked_registry.get(),
+                                      session->current_trace_chunk);
        if (ret < 0) {
                /* Nullify the metadata key so we don't try to close it later on. */
                locked_registry->_metadata_key = 0;
@@ -3905,8 +3984,7 @@ static int create_ust_app_metadata(struct ust_app_session *ua_sess,
                goto error_consumer;
        }
 
-       DBG2("UST metadata with key %" PRIu64 " created for app pid %d",
-                       metadata->key, app->pid);
+       DBG2("UST metadata with key %" PRIu64 " created for app pid %d", metadata->key, app->pid);
 
 error_consumer:
        lttng_fd_put(LTTNG_FD_APPS, 1);
@@ -3928,7 +4006,7 @@ struct ust_app *ust_app_find_by_pid(pid_t pid)
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
 
-       lttng_ht_lookup(ust_app_ht, (void *)((unsigned long) pid), &iter);
+       lttng_ht_lookup(ust_app_ht, (void *) ((unsigned long) pid), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
        if (node == NULL) {
                DBG2("UST app no found with pid %d", pid);
@@ -3961,15 +4039,13 @@ struct ust_app *ust_app_create(struct ust_register_msg *msg, int sock)
 
        DBG3("UST app creating application for socket %d", sock);
 
-       if ((msg->bits_per_long == 64 &&
-                           (uatomic_read(&the_ust_consumerd64_fd) ==
-                                           -EINVAL)) ||
-                       (msg->bits_per_long == 32 &&
-                                       (uatomic_read(&the_ust_consumerd32_fd) ==
-                                                       -EINVAL))) {
+       if ((msg->bits_per_long == 64 && (uatomic_read(&the_ust_consumerd64_fd) == -EINVAL)) ||
+           (msg->bits_per_long == 32 && (uatomic_read(&the_ust_consumerd32_fd) == -EINVAL))) {
                ERR("Registration failed: application \"%s\" (pid: %d) has "
-                               "%d-bit long, but no consumerd for this size is available.\n",
-                               msg->name, msg->pid, msg->bits_per_long);
+                   "%d-bit long, but no consumerd for this size is available.\n",
+                   msg->name,
+                   msg->pid,
+                   msg->bits_per_long);
                goto error;
        }
 
@@ -3981,14 +4057,16 @@ struct ust_app *ust_app_create(struct ust_register_msg *msg, int sock)
        ret = lttng_fd_get(LTTNG_FD_APPS, 2);
        if (ret) {
                ERR("Failed to reserve two file descriptors for the event source pipe while creating a new application instance: app = '%s', pid = %d",
-                               msg->name, (int) msg->pid);
+                   msg->name,
+                   (int) msg->pid);
                goto error;
        }
 
        event_notifier_event_source_pipe = lttng_pipe_open(FD_CLOEXEC);
        if (!event_notifier_event_source_pipe) {
                PERROR("Failed to open application event source pipe: '%s' (pid = %d)",
-                               msg->name, msg->pid);
+                      msg->name,
+                      msg->pid);
                goto error;
        }
 
@@ -4012,8 +4090,8 @@ struct ust_app *ust_app_create(struct ust_register_msg *msg, int sock)
                .uint32_t_alignment = msg->uint32_t_alignment,
                .uint64_t_alignment = msg->uint64_t_alignment,
                .byte_order = msg->byte_order == LITTLE_ENDIAN ?
-                               lttng::sessiond::trace::byte_order::LITTLE_ENDIAN_ :
-                                       lttng::sessiond::trace::byte_order::BIG_ENDIAN_,
+                       lttng::sessiond::trace::byte_order::LITTLE_ENDIAN_ :
+                       lttng::sessiond::trace::byte_order::BIG_ENDIAN_,
        };
 
        lta->v_major = msg->major;
@@ -4081,9 +4159,16 @@ void ust_app_add(struct ust_app *app)
        lttng_ht_add_unique_ulong(ust_app_ht_by_notify_sock, &app->notify_sock_n);
 
        DBG("App registered with pid:%d ppid:%d uid:%d gid:%d sock =%d name:%s "
-                       "notify_sock =%d (version %d.%d)", app->pid, app->ppid, app->uid,
-                       app->gid, app->sock, app->name, app->notify_sock, app->v_major,
-                       app->v_minor);
+           "notify_sock =%d (version %d.%d)",
+           app->pid,
+           app->ppid,
+           app->uid,
+           app->gid,
+           app->sock,
+           app->name,
+           app->notify_sock,
+           app->v_major,
+           app->v_minor);
 
        rcu_read_unlock();
 }
@@ -4106,13 +4191,17 @@ int ust_app_version(struct ust_app *app)
        if (ret < 0) {
                if (ret == -LTTNG_UST_ERR_EXITING || ret == -EPIPE) {
                        DBG3("UST app version failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        WARN("UST app version failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app version failed with ret %d: pid = %d, sock = %d",
-                                       ret, app->pid, app->sock);
+                           ret,
+                           app->pid,
+                           app->sock);
                }
        }
 
@@ -4151,25 +4240,29 @@ int ust_app_setup_event_notifier_group(struct ust_app *app)
        }
 
        /* Get the write side of the pipe. */
-       event_pipe_write_fd = lttng_pipe_get_writefd(
-                       app->event_notifier_group.event_pipe);
+       event_pipe_write_fd = lttng_pipe_get_writefd(app->event_notifier_group.event_pipe);
 
        pthread_mutex_lock(&app->sock_lock);
-       ret = lttng_ust_ctl_create_event_notifier_group(app->sock,
-                       event_pipe_write_fd, &event_notifier_group);
+       ret = lttng_ust_ctl_create_event_notifier_group(
+               app->sock, event_pipe_write_fd, &event_notifier_group);
        pthread_mutex_unlock(&app->sock_lock);
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        ret = 0;
                        DBG3("UST app create event notifier group failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        ret = 0;
                        WARN("UST app create event notifier group failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app create event notifier group failed with ret %d: pid = %d, sock = %d, event_pipe_write_fd: %d",
-                                       ret, app->pid, app->sock, event_pipe_write_fd);
+                           ret,
+                           app->pid,
+                           app->sock,
+                           event_pipe_write_fd);
                }
                goto error;
        }
@@ -4177,7 +4270,8 @@ int ust_app_setup_event_notifier_group(struct ust_app *app)
        ret = lttng_pipe_write_close(app->event_notifier_group.event_pipe);
        if (ret) {
                ERR("Failed to close write end of the application's event source pipe: app = '%s' (pid = %d)",
-                               app->name, app->pid);
+                   app->name,
+                   app->pid);
                goto error;
        }
 
@@ -4188,32 +4282,34 @@ int ust_app_setup_event_notifier_group(struct ust_app *app)
        lttng_fd_put(LTTNG_FD_APPS, 1);
 
        lttng_ret = notification_thread_command_add_tracer_event_source(
-                       the_notification_thread_handle,
-                       lttng_pipe_get_readfd(
-                                       app->event_notifier_group.event_pipe),
-                       LTTNG_DOMAIN_UST);
+               the_notification_thread_handle,
+               lttng_pipe_get_readfd(app->event_notifier_group.event_pipe),
+               LTTNG_DOMAIN_UST);
        if (lttng_ret != LTTNG_OK) {
                ERR("Failed to add tracer event source to notification thread");
-               ret = - 1;
+               ret = -1;
                goto error;
        }
 
        /* Assign handle only when the complete setup is valid. */
        app->event_notifier_group.object = event_notifier_group;
 
-       event_notifier_error_accounting_status =
-                       event_notifier_error_accounting_register_app(app);
+       event_notifier_error_accounting_status = event_notifier_error_accounting_register_app(app);
        switch (event_notifier_error_accounting_status) {
        case EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK:
                break;
        case EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_UNSUPPORTED:
                DBG3("Failed to setup event notifier error accounting (application does not support notifier error accounting): app socket fd = %d, app name = '%s', app pid = %d",
-                               app->sock, app->name, (int) app->pid);
+                    app->sock,
+                    app->name,
+                    (int) app->pid);
                ret = 0;
                goto error_accounting;
        case EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD:
                DBG3("Failed to setup event notifier error accounting (application is dead): app socket fd = %d, app name = '%s', app pid = %d",
-                               app->sock, app->name, (int) app->pid);
+                    app->sock,
+                    app->name,
+                    (int) app->pid);
                ret = 0;
                goto error_accounting;
        default:
@@ -4226,9 +4322,8 @@ int ust_app_setup_event_notifier_group(struct ust_app *app)
 
 error_accounting:
        lttng_ret = notification_thread_command_remove_tracer_event_source(
-                       the_notification_thread_handle,
-                       lttng_pipe_get_readfd(
-                                       app->event_notifier_group.event_pipe));
+               the_notification_thread_handle,
+               lttng_pipe_get_readfd(app->event_notifier_group.event_pipe));
        if (lttng_ret != LTTNG_OK) {
                ERR("Failed to remove application tracer event source from notification thread");
        }
@@ -4258,7 +4353,7 @@ void ust_app_unregister(int sock)
        rcu_read_lock();
 
        /* Get the node reference for a call_rcu */
-       lttng_ht_lookup(ust_app_ht_by_sock, (void *)((unsigned long) sock), &ust_app_sock_iter);
+       lttng_ht_lookup(ust_app_ht_by_sock, (void *) ((unsigned long) sock), &ust_app_sock_iter);
        node = lttng_ht_iter_get_node_ulong(&ust_app_sock_iter);
        LTTNG_ASSERT(node);
 
@@ -4271,8 +4366,7 @@ void ust_app_unregister(int sock)
         * ensuring proper behavior of data_pending check.
         * Remove sessions so they are not visible during deletion.
         */
-       cds_lfht_for_each_entry(lta->sessions->ht, &iter.iter, ua_sess,
-                       node.node) {
+       cds_lfht_for_each_entry (lta->sessions->ht, &iter.iter, ua_sess, node.node) {
                ret = lttng_ht_del(lta->sessions, &iter);
                if (ret) {
                        /* The session was already removed so scheduled for teardown. */
@@ -4324,9 +4418,11 @@ void ust_app_unregister(int sock)
                                        locked_registry->_metadata_closed = true;
                                }
 
-                               /* Release lock before communication, see comments in close_metadata(). */
+                               /* Release lock before communication, see comments in
+                                * close_metadata(). */
                                locked_registry.reset();
-                               (void) close_metadata(metadata_key, consumer_bitness, ua_sess->consumer);
+                               (void) close_metadata(
+                                       metadata_key, consumer_bitness, ua_sess->consumer);
                        } else {
                                locked_registry.reset();
                        }
@@ -4357,8 +4453,7 @@ void ust_app_unregister(int sock)
        iter.iter.node = &lta->pid_n.node;
        ret = lttng_ht_del(ust_app_ht, &iter);
        if (ret) {
-               DBG3("Unregister app by PID %d failed. This can happen on pid reuse",
-                               lta->pid);
+               DBG3("Unregister app by PID %d failed. This can happen on pid reuse", lta->pid);
        }
 
        /* Free memory */
@@ -4389,7 +4484,7 @@ int ust_app_list_events(struct lttng_event **events)
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                struct lttng_ust_abi_tracepoint_iter uiter;
 
                health_code_update();
@@ -4406,31 +4501,33 @@ int ust_app_list_events(struct lttng_event **events)
                if (handle < 0) {
                        if (handle != -EPIPE && handle != -LTTNG_UST_ERR_EXITING) {
                                ERR("UST app list events getting handle failed for app pid %d",
-                                               app->pid);
+                                   app->pid);
                        }
                        pthread_mutex_unlock(&app->sock_lock);
                        continue;
                }
 
-               while ((ret = lttng_ust_ctl_tracepoint_list_get(app->sock, handle,
-                                       &uiter)) != -LTTNG_UST_ERR_NOENT) {
+               while ((ret = lttng_ust_ctl_tracepoint_list_get(app->sock, handle, &uiter)) !=
+                      -LTTNG_UST_ERR_NOENT) {
                        /* Handle ustctl error. */
                        if (ret < 0) {
                                int release_ret;
 
                                if (ret != -LTTNG_UST_ERR_EXITING && ret != -EPIPE) {
                                        ERR("UST app tp list get failed for app %d with ret %d",
-                                                       app->sock, ret);
+                                           app->sock,
+                                           ret);
                                } else {
                                        DBG3("UST app tp list get failed. Application is dead");
                                        break;
                                }
                                free(tmp_event);
                                release_ret = lttng_ust_ctl_release_handle(app->sock, handle);
-                               if (release_ret < 0 &&
-                                               release_ret != -LTTNG_UST_ERR_EXITING &&
-                                               release_ret != -EPIPE) {
-                                       ERR("Error releasing app handle for app %d with ret %d", app->sock, release_ret);
+                               if (release_ret < 0 && release_ret != -LTTNG_UST_ERR_EXITING &&
+                                   release_ret != -EPIPE) {
+                                       ERR("Error releasing app handle for app %d with ret %d",
+                                           app->sock,
+                                           release_ret);
                                }
                                pthread_mutex_unlock(&app->sock_lock);
                                goto rcu_error;
@@ -4444,27 +4541,32 @@ int ust_app_list_events(struct lttng_event **events)
 
                                new_nbmem = nbmem << 1;
                                DBG2("Reallocating event list from %zu to %zu entries",
-                                               nbmem, new_nbmem);
-                               new_tmp_event = (lttng_event *) realloc(tmp_event,
-                                       new_nbmem * sizeof(struct lttng_event));
+                                    nbmem,
+                                    new_nbmem);
+                               new_tmp_event = (lttng_event *) realloc(
+                                       tmp_event, new_nbmem * sizeof(struct lttng_event));
                                if (new_tmp_event == NULL) {
                                        int release_ret;
 
                                        PERROR("realloc ust app events");
                                        free(tmp_event);
                                        ret = -ENOMEM;
-                                       release_ret = lttng_ust_ctl_release_handle(app->sock, handle);
+                                       release_ret =
+                                               lttng_ust_ctl_release_handle(app->sock, handle);
                                        if (release_ret < 0 &&
-                                                       release_ret != -LTTNG_UST_ERR_EXITING &&
-                                                       release_ret != -EPIPE) {
-                                               ERR("Error releasing app handle for app %d with ret %d", app->sock, release_ret);
+                                           release_ret != -LTTNG_UST_ERR_EXITING &&
+                                           release_ret != -EPIPE) {
+                                               ERR("Error releasing app handle for app %d with ret %d",
+                                                   app->sock,
+                                                   release_ret);
                                        }
                                        pthread_mutex_unlock(&app->sock_lock);
                                        goto rcu_error;
                                }
                                /* Zero the new memory */
-                               memset(new_tmp_event + nbmem, 0,
-                                       (new_nbmem - nbmem) * sizeof(struct lttng_event));
+                               memset(new_tmp_event + nbmem,
+                                      0,
+                                      (new_nbmem - nbmem) * sizeof(struct lttng_event));
                                nbmem = new_nbmem;
                                tmp_event = new_tmp_event;
                        }
@@ -4480,13 +4582,17 @@ int ust_app_list_events(struct lttng_event **events)
                if (ret < 0) {
                        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                                DBG3("Error releasing app handle. Application died: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                    app->pid,
+                                    app->sock);
                        } else if (ret == -EAGAIN) {
                                WARN("Error releasing app handle. Communication time out: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                    app->pid,
+                                    app->sock);
                        } else {
                                ERR("Error releasing app handle with ret %d: pid = %d, sock = %d",
-                                               ret, app->pid, app->sock);
+                                   ret,
+                                   app->pid,
+                                   app->sock);
                        }
                }
        }
@@ -4524,7 +4630,7 @@ int ust_app_list_event_fields(struct lttng_event_field **fields)
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                struct lttng_ust_abi_field_iter uiter;
 
                health_code_update();
@@ -4541,21 +4647,22 @@ int ust_app_list_event_fields(struct lttng_event_field **fields)
                if (handle < 0) {
                        if (handle != -EPIPE && handle != -LTTNG_UST_ERR_EXITING) {
                                ERR("UST app list field getting handle failed for app pid %d",
-                                               app->pid);
+                                   app->pid);
                        }
                        pthread_mutex_unlock(&app->sock_lock);
                        continue;
                }
 
-               while ((ret = lttng_ust_ctl_tracepoint_field_list_get(app->sock, handle,
-                                       &uiter)) != -LTTNG_UST_ERR_NOENT) {
+               while ((ret = lttng_ust_ctl_tracepoint_field_list_get(app->sock, handle, &uiter)) !=
+                      -LTTNG_UST_ERR_NOENT) {
                        /* Handle ustctl error. */
                        if (ret < 0) {
                                int release_ret;
 
                                if (ret != -LTTNG_UST_ERR_EXITING && ret != -EPIPE) {
                                        ERR("UST app tp list field failed for app %d with ret %d",
-                                                       app->sock, ret);
+                                           app->sock,
+                                           ret);
                                } else {
                                        DBG3("UST app tp list field failed. Application is dead");
                                        break;
@@ -4563,10 +4670,11 @@ int ust_app_list_event_fields(struct lttng_event_field **fields)
                                free(tmp_event);
                                release_ret = lttng_ust_ctl_release_handle(app->sock, handle);
                                pthread_mutex_unlock(&app->sock_lock);
-                               if (release_ret < 0 &&
-                                               release_ret != -LTTNG_UST_ERR_EXITING &&
-                                               release_ret != -EPIPE) {
-                                       ERR("Error releasing app handle for app %d with ret %d", app->sock, release_ret);
+                               if (release_ret < 0 && release_ret != -LTTNG_UST_ERR_EXITING &&
+                                   release_ret != -EPIPE) {
+                                       ERR("Error releasing app handle for app %d with ret %d",
+                                           app->sock,
+                                           release_ret);
                                }
                                goto rcu_error;
                        }
@@ -4579,37 +4687,45 @@ int ust_app_list_event_fields(struct lttng_event_field **fields)
 
                                new_nbmem = nbmem << 1;
                                DBG2("Reallocating event field list from %zu to %zu entries",
-                                               nbmem, new_nbmem);
-                               new_tmp_event = (lttng_event_field *) realloc(tmp_event,
-                                       new_nbmem * sizeof(struct lttng_event_field));
+                                    nbmem,
+                                    new_nbmem);
+                               new_tmp_event = (lttng_event_field *) realloc(
+                                       tmp_event, new_nbmem * sizeof(struct lttng_event_field));
                                if (new_tmp_event == NULL) {
                                        int release_ret;
 
                                        PERROR("realloc ust app event fields");
                                        free(tmp_event);
                                        ret = -ENOMEM;
-                                       release_ret = lttng_ust_ctl_release_handle(app->sock, handle);
+                                       release_ret =
+                                               lttng_ust_ctl_release_handle(app->sock, handle);
                                        pthread_mutex_unlock(&app->sock_lock);
-                                       if (release_ret &&
-                                                       release_ret != -LTTNG_UST_ERR_EXITING &&
-                                                       release_ret != -EPIPE) {
-                                               ERR("Error releasing app handle for app %d with ret %d", app->sock, release_ret);
+                                       if (release_ret && release_ret != -LTTNG_UST_ERR_EXITING &&
+                                           release_ret != -EPIPE) {
+                                               ERR("Error releasing app handle for app %d with ret %d",
+                                                   app->sock,
+                                                   release_ret);
                                        }
                                        goto rcu_error;
                                }
                                /* Zero the new memory */
-                               memset(new_tmp_event + nbmem, 0,
-                                       (new_nbmem - nbmem) * sizeof(struct lttng_event_field));
+                               memset(new_tmp_event + nbmem,
+                                      0,
+                                      (new_nbmem - nbmem) * sizeof(struct lttng_event_field));
                                nbmem = new_nbmem;
                                tmp_event = new_tmp_event;
                        }
 
-                       memcpy(tmp_event[count].field_name, uiter.field_name, LTTNG_UST_ABI_SYM_NAME_LEN);
+                       memcpy(tmp_event[count].field_name,
+                              uiter.field_name,
+                              LTTNG_UST_ABI_SYM_NAME_LEN);
                        /* Mapping between these enums matches 1 to 1. */
                        tmp_event[count].type = (enum lttng_event_field_type) uiter.type;
                        tmp_event[count].nowrite = uiter.nowrite;
 
-                       memcpy(tmp_event[count].event.name, uiter.event_name, LTTNG_UST_ABI_SYM_NAME_LEN);
+                       memcpy(tmp_event[count].event.name,
+                              uiter.event_name,
+                              LTTNG_UST_ABI_SYM_NAME_LEN);
                        tmp_event[count].event.loglevel = uiter.loglevel;
                        tmp_event[count].event.type = LTTNG_EVENT_TRACEPOINT;
                        tmp_event[count].event.pid = app->pid;
@@ -4618,9 +4734,7 @@ int ust_app_list_event_fields(struct lttng_event_field **fields)
                }
                ret = lttng_ust_ctl_release_handle(app->sock, handle);
                pthread_mutex_unlock(&app->sock_lock);
-               if (ret < 0 &&
-                               ret != -LTTNG_UST_ERR_EXITING &&
-                               ret != -EPIPE) {
+               if (ret < 0 && ret != -LTTNG_UST_ERR_EXITING && ret != -EPIPE) {
                        ERR("Error releasing app handle for app %d with ret %d", app->sock, ret);
                }
        }
@@ -4652,8 +4766,8 @@ void ust_app_clean_list(void)
 
        /* Cleanup notify socket hash table */
        if (ust_app_ht_by_notify_sock) {
-               cds_lfht_for_each_entry(ust_app_ht_by_notify_sock->ht, &iter.iter, app,
-                               notify_sock_n.node) {
+               cds_lfht_for_each_entry (
+                       ust_app_ht_by_notify_sock->ht, &iter.iter, app, notify_sock_n.node) {
                        /*
                         * Assert that all notifiers are gone as all triggers
                         * are unregistered prior to this clean-up.
@@ -4665,7 +4779,7 @@ void ust_app_clean_list(void)
        }
 
        if (ust_app_ht) {
-               cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+               cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        ret = lttng_ht_del(ust_app_ht, &iter);
                        LTTNG_ASSERT(!ret);
                        call_rcu(&app->pid_n.head, delete_ust_app_rcu);
@@ -4674,8 +4788,7 @@ void ust_app_clean_list(void)
 
        /* Cleanup socket hash table */
        if (ust_app_ht_by_sock) {
-               cds_lfht_for_each_entry(ust_app_ht_by_sock->ht, &iter.iter, app,
-                               sock_n.node) {
+               cds_lfht_for_each_entry (ust_app_ht_by_sock->ht, &iter.iter, app, sock_n.node) {
                        ret = lttng_ht_del(ust_app_ht_by_sock, &iter);
                        LTTNG_ASSERT(!ret);
                }
@@ -4718,8 +4831,7 @@ int ust_app_ht_alloc(void)
 /*
  * For a specific UST session, disable the channel for all registered apps.
  */
-int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan)
+int ust_app_disable_channel_glb(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan)
 {
        int ret = 0;
        struct lttng_ht_iter iter;
@@ -4730,12 +4842,13 @@ int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
 
        LTTNG_ASSERT(usess->active);
        DBG2("UST app disabling channel %s from global domain for session id %" PRIu64,
-                       uchan->name, usess->id);
+            uchan->name,
+            usess->id);
 
        rcu_read_lock();
 
        /* For every registered applications */
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                struct lttng_ht_iter uiter;
                if (!app->compatible) {
                        /*
@@ -4750,7 +4863,7 @@ int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
                }
 
                /* Get channel */
-               lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &uiter);
+               lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &uiter);
                ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
                /* If the session if found for the app, the channel must be there */
                LTTNG_ASSERT(ua_chan_node);
@@ -4774,8 +4887,7 @@ int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
 /*
  * For a specific UST session, enable the channel for all registered apps.
  */
-int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan)
+int ust_app_enable_channel_glb(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan)
 {
        int ret = 0;
        struct lttng_ht_iter iter;
@@ -4784,12 +4896,13 @@ int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
 
        LTTNG_ASSERT(usess->active);
        DBG2("UST app enabling channel %s to global domain for session id %" PRIu64,
-                       uchan->name, usess->id);
+            uchan->name,
+            usess->id);
 
        rcu_read_lock();
 
        /* For every registered applications */
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                if (!app->compatible) {
                        /*
                         * TODO: In time, we should notice the caller of this error by
@@ -4818,7 +4931,8 @@ int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
  * Disable an event in a channel and for a specific session.
  */
 int ust_app_disable_event_glb(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
+                             struct ltt_ust_channel *uchan,
+                             struct ltt_ust_event *uevent)
 {
        int ret = 0;
        struct lttng_ht_iter iter, uiter;
@@ -4830,13 +4944,15 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
 
        LTTNG_ASSERT(usess->active);
        DBG("UST app disabling event %s for all apps in channel "
-                       "%s for session id %" PRIu64,
-                       uevent->attr.name, uchan->name, usess->id);
+           "%s for session id %" PRIu64,
+           uevent->attr.name,
+           uchan->name,
+           usess->id);
 
        rcu_read_lock();
 
        /* For all registered applications */
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                if (!app->compatible) {
                        /*
                         * TODO: In time, we should notice the caller of this error by
@@ -4851,21 +4967,29 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
                }
 
                /* Lookup channel in the ust app session */
-               lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &uiter);
+               lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &uiter);
                ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
                if (ua_chan_node == NULL) {
                        DBG2("Channel %s not found in session id %" PRIu64 " for app pid %d."
-                                       "Skipping", uchan->name, usess->id, app->pid);
+                            "Skipping",
+                            uchan->name,
+                            usess->id,
+                            app->pid);
                        continue;
                }
                ua_chan = lttng::utils::container_of(ua_chan_node, &ust_app_channel::node);
 
-               ua_event = find_ust_app_event(ua_chan->events, uevent->attr.name,
-                               uevent->filter, uevent->attr.loglevel,
-                               uevent->exclusion);
+               ua_event = find_ust_app_event(ua_chan->events,
+                                             uevent->attr.name,
+                                             uevent->filter,
+                                             uevent->attr.loglevel,
+                                             uevent->exclusion);
                if (ua_event == NULL) {
                        DBG2("Event %s not found in channel %s for app pid %d."
-                                       "Skipping", uevent->attr.name, uchan->name, app->pid);
+                            "Skipping",
+                            uevent->attr.name,
+                            uchan->name,
+                            app->pid);
                        continue;
                }
 
@@ -4881,11 +5005,11 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
 }
 
 /* The ua_sess lock must be held by the caller.  */
-static
-int ust_app_channel_create(struct ltt_ust_session *usess,
-               struct ust_app_session *ua_sess,
-               struct ltt_ust_channel *uchan, struct ust_app *app,
-               struct ust_app_channel **_ua_chan)
+static int ust_app_channel_create(struct ltt_ust_session *usess,
+                                 struct ust_app_session *ua_sess,
+                                 struct ltt_ust_channel *uchan,
+                                 struct ust_app *app,
+                                 struct ust_app_channel **_ua_chan)
 {
        int ret = 0;
        struct ust_app_channel *ua_chan = NULL;
@@ -4893,10 +5017,8 @@ int ust_app_channel_create(struct ltt_ust_session *usess,
        LTTNG_ASSERT(ua_sess);
        ASSERT_LOCKED(ua_sess->lock);
 
-       if (!strncmp(uchan->name, DEFAULT_METADATA_NAME,
-                    sizeof(uchan->name))) {
-               copy_channel_attr_to_ustctl(&ua_sess->metadata_attr,
-                       &uchan->attr);
+       if (!strncmp(uchan->name, DEFAULT_METADATA_NAME, sizeof(uchan->name))) {
+               copy_channel_attr_to_ustctl(&ua_sess->metadata_attr, &uchan->attr);
                ret = 0;
        } else {
                struct ltt_ust_context *uctx = NULL;
@@ -4905,23 +5027,20 @@ int ust_app_channel_create(struct ltt_ust_session *usess,
                 * Create channel onto application and synchronize its
                 * configuration.
                 */
-               ret = ust_app_channel_allocate(ua_sess, uchan,
-                       LTTNG_UST_ABI_CHAN_PER_CPU, usess,
-                       &ua_chan);
+               ret = ust_app_channel_allocate(
+                       ua_sess, uchan, LTTNG_UST_ABI_CHAN_PER_CPU, usess, &ua_chan);
                if (ret < 0) {
                        goto error;
                }
 
-               ret = ust_app_channel_send(app, usess,
-                       ua_sess, ua_chan);
+               ret = ust_app_channel_send(app, usess, ua_sess, ua_chan);
                if (ret) {
                        goto error;
                }
 
                /* Add contexts. */
-               cds_list_for_each_entry(uctx, &uchan->ctx_list, list) {
-                       ret = create_ust_app_channel_context(ua_chan,
-                               &uctx->ctx, app);
+               cds_list_for_each_entry (uctx, &uchan->ctx_list, list) {
+                       ret = create_ust_app_channel_context(ua_chan, &uctx->ctx, app);
                        if (ret) {
                                goto error;
                        }
@@ -4937,7 +5056,7 @@ error:
                         * or a timeout on it. We can't inform the caller that for a
                         * specific app, the session failed so lets continue here.
                         */
-                       ret = 0;        /* Not an error. */
+                       ret = 0; /* Not an error. */
                        break;
                case -ENOMEM:
                default:
@@ -4960,7 +5079,8 @@ error:
  * Enable event for a specific session and channel on the tracer.
  */
 int ust_app_enable_event_glb(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
+                            struct ltt_ust_channel *uchan,
+                            struct ltt_ust_event *uevent)
 {
        int ret = 0;
        struct lttng_ht_iter iter, uiter;
@@ -4972,7 +5092,8 @@ int ust_app_enable_event_glb(struct ltt_ust_session *usess,
 
        LTTNG_ASSERT(usess->active);
        DBG("UST app enabling event %s for all apps for session id %" PRIu64,
-                       uevent->attr.name, usess->id);
+           uevent->attr.name,
+           usess->id);
 
        /*
         * NOTE: At this point, this function is called only if the session and
@@ -4983,7 +5104,7 @@ int ust_app_enable_event_glb(struct ltt_ust_session *usess,
        rcu_read_lock();
 
        /* For all registered applications */
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                if (!app->compatible) {
                        /*
                         * TODO: In time, we should notice the caller of this error by
@@ -5005,7 +5126,7 @@ int ust_app_enable_event_glb(struct ltt_ust_session *usess,
                }
 
                /* Lookup channel in the ust app session */
-               lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &uiter);
+               lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &uiter);
                ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
                /*
                 * It is possible that the channel cannot be found is
@@ -5020,11 +5141,16 @@ int ust_app_enable_event_glb(struct ltt_ust_session *usess,
                ua_chan = lttng::utils::container_of(ua_chan_node, &ust_app_channel::node);
 
                /* Get event node */
-               ua_event = find_ust_app_event(ua_chan->events, uevent->attr.name,
-                               uevent->filter, uevent->attr.loglevel, uevent->exclusion);
+               ua_event = find_ust_app_event(ua_chan->events,
+                                             uevent->attr.name,
+                                             uevent->filter,
+                                             uevent->attr.loglevel,
+                                             uevent->exclusion);
                if (ua_event == NULL) {
                        DBG3("UST app enable event %s not found for app PID %d."
-                                       "Skipping app", uevent->attr.name, app->pid);
+                            "Skipping app",
+                            uevent->attr.name,
+                            app->pid);
                        goto next_app;
                }
 
@@ -5047,7 +5173,8 @@ error:
  * all registered apps.
  */
 int ust_app_create_event_glb(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
+                            struct ltt_ust_channel *uchan,
+                            struct ltt_ust_event *uevent)
 {
        int ret = 0;
        struct lttng_ht_iter iter, uiter;
@@ -5058,12 +5185,13 @@ int ust_app_create_event_glb(struct ltt_ust_session *usess,
 
        LTTNG_ASSERT(usess->active);
        DBG("UST app creating event %s for all apps for session id %" PRIu64,
-                       uevent->attr.name, usess->id);
+           uevent->attr.name,
+           usess->id);
 
        rcu_read_lock();
 
        /* For all registered applications */
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                if (!app->compatible) {
                        /*
                         * TODO: In time, we should notice the caller of this error by
@@ -5085,7 +5213,7 @@ int ust_app_create_event_glb(struct ltt_ust_session *usess,
                }
 
                /* Lookup channel in the ust app session */
-               lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &uiter);
+               lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &uiter);
                ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
                /* If the channel is not found, there is a code flow error */
                LTTNG_ASSERT(ua_chan_node);
@@ -5100,7 +5228,8 @@ int ust_app_create_event_glb(struct ltt_ust_session *usess,
                                break;
                        }
                        DBG2("UST app event %s already exist on app PID %d",
-                                       uevent->attr.name, app->pid);
+                            uevent->attr.name,
+                            app->pid);
                        continue;
                }
        }
@@ -5115,8 +5244,7 @@ int ust_app_create_event_glb(struct ltt_ust_session *usess,
  * Called with UST app session lock held.
  *
  */
-static
-int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app)
+static int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app)
 {
        int ret = 0;
        struct ust_app_session *ua_sess;
@@ -5162,18 +5290,22 @@ skip_setup:
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        DBG3("UST app start session failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                        pthread_mutex_unlock(&ua_sess->lock);
                        goto end;
                } else if (ret == -EAGAIN) {
                        WARN("UST app start session failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                        pthread_mutex_unlock(&ua_sess->lock);
                        goto end;
 
                } else {
                        ERR("UST app start session failed with ret %d: pid = %d, sock = %d",
-                                       ret, app->pid, app->sock);
+                           ret,
+                           app->pid,
+                           app->sock);
                }
                goto error_unlock;
        }
@@ -5193,13 +5325,17 @@ skip_setup:
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        DBG3("UST app wait quiescent failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        WARN("UST app wait quiescent failed. Communication time out: pid =  %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app wait quiescent failed with ret %d: pid %d, sock = %d",
-                                       ret, app->pid, app->sock);
+                           ret,
+                           app->pid,
+                           app->sock);
                }
        }
 
@@ -5218,8 +5354,7 @@ error_unlock:
 /*
  * Stop tracing for a specific UST session and app.
  */
-static
-int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app)
+static int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app)
 {
        int ret = 0;
        struct ust_app_session *ua_sess;
@@ -5263,16 +5398,20 @@ int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app)
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        DBG3("UST app stop session failed. Application is dead: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                        goto end_unlock;
                } else if (ret == -EAGAIN) {
                        WARN("UST app stop session failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                        goto end_unlock;
 
                } else {
                        ERR("UST app stop session failed with ret %d: pid = %d, sock = %d",
-                                       ret, app->pid, app->sock);
+                           ret,
+                           app->pid,
+                           app->sock);
                }
                goto error_rcu_unlock;
        }
@@ -5287,13 +5426,17 @@ int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app)
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        DBG3("UST app wait quiescent failed. Application is dead: pid= %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        WARN("UST app wait quiescent failed. Communication time out: pid= %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app wait quiescent failed with ret %d: pid= %d, sock = %d",
-                                       ret, app->pid, app->sock);
+                           ret,
+                           app->pid,
+                           app->sock);
                }
        }
 
@@ -5323,9 +5466,7 @@ error_rcu_unlock:
        return -1;
 }
 
-static
-int ust_app_flush_app_session(struct ust_app *app,
-               struct ust_app_session *ua_sess)
+static int ust_app_flush_app_session(struct ust_app *app, struct ust_app_session *ua_sess)
 {
        int ret, retval = 0;
        struct lttng_ht_iter iter;
@@ -5349,14 +5490,12 @@ int ust_app_flush_app_session(struct ust_app *app,
        health_code_update();
 
        /* Flushing buffers */
-       socket = consumer_find_socket_by_bitness(app->abi.bits_per_long,
-                       ua_sess->consumer);
+       socket = consumer_find_socket_by_bitness(app->abi.bits_per_long, ua_sess->consumer);
 
        /* Flush buffers and push metadata. */
        switch (ua_sess->buffer_type) {
        case LTTNG_BUFFER_PER_PID:
-               cds_lfht_for_each_entry(ua_sess->channels->ht, &iter.iter, ua_chan,
-                               node.node) {
+               cds_lfht_for_each_entry (ua_sess->channels->ht, &iter.iter, ua_chan, node.node) {
                        health_code_update();
                        ret = consumer_flush_channel(socket, ua_chan->key);
                        if (ret) {
@@ -5387,8 +5526,7 @@ end_not_compatible:
  * Flush buffers for all applications for a specific UST session.
  * Called with UST session lock held.
  */
-static
-int ust_app_flush_session(struct ltt_ust_session *usess)
+static int ust_app_flush_session(struct ltt_ust_session *usess)
 
 {
        int ret = 0;
@@ -5405,21 +5543,21 @@ int ust_app_flush_session(struct ltt_ust_session *usess)
                struct lttng_ht_iter iter;
 
                /* Flush all per UID buffers associated to that session. */
-               cds_list_for_each_entry(reg, &usess->buffer_reg_uid_list, lnode) {
+               cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        lsu::registry_session *ust_session_reg;
                        struct buffer_reg_channel *buf_reg_chan;
                        struct consumer_socket *socket;
 
                        /* Get consumer socket to use to push the metadata.*/
                        socket = consumer_find_socket_by_bitness(reg->bits_per_long,
-                                       usess->consumer);
+                                                                usess->consumer);
                        if (!socket) {
                                /* Ignore request if no consumer is found for the session. */
                                continue;
                        }
 
-                       cds_lfht_for_each_entry(reg->registry->channels->ht, &iter.iter,
-                                       buf_reg_chan, node.node) {
+                       cds_lfht_for_each_entry (
+                               reg->registry->channels->ht, &iter.iter, buf_reg_chan, node.node) {
                                /*
                                 * The following call will print error values so the return
                                 * code is of little importance because whatever happens, we
@@ -5441,7 +5579,7 @@ int ust_app_flush_session(struct ltt_ust_session *usess)
                struct lttng_ht_iter iter;
                struct ust_app *app;
 
-               cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+               cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        ua_sess = lookup_session_by_app(usess, app);
                        if (ua_sess == NULL) {
                                continue;
@@ -5461,9 +5599,7 @@ int ust_app_flush_session(struct ltt_ust_session *usess)
        return ret;
 }
 
-static
-int ust_app_clear_quiescent_app_session(struct ust_app *app,
-               struct ust_app_session *ua_sess)
+static int ust_app_clear_quiescent_app_session(struct ust_app *app, struct ust_app_session *ua_sess)
 {
        int ret = 0;
        struct lttng_ht_iter iter;
@@ -5486,11 +5622,9 @@ int ust_app_clear_quiescent_app_session(struct ust_app *app,
 
        health_code_update();
 
-       socket = consumer_find_socket_by_bitness(app->abi.bits_per_long,
-                       ua_sess->consumer);
+       socket = consumer_find_socket_by_bitness(app->abi.bits_per_long, ua_sess->consumer);
        if (!socket) {
-               ERR("Failed to find consumer (%" PRIu32 ") socket",
-                               app->abi.bits_per_long);
+               ERR("Failed to find consumer (%" PRIu32 ") socket", app->abi.bits_per_long);
                ret = -1;
                goto end_unlock;
        }
@@ -5498,11 +5632,9 @@ int ust_app_clear_quiescent_app_session(struct ust_app *app,
        /* Clear quiescent state. */
        switch (ua_sess->buffer_type) {
        case LTTNG_BUFFER_PER_PID:
-               cds_lfht_for_each_entry(ua_sess->channels->ht, &iter.iter,
-                               ua_chan, node.node) {
+               cds_lfht_for_each_entry (ua_sess->channels->ht, &iter.iter, ua_chan, node.node) {
                        health_code_update();
-                       ret = consumer_clear_quiescent_channel(socket,
-                                       ua_chan->key);
+                       ret = consumer_clear_quiescent_channel(socket, ua_chan->key);
                        if (ret) {
                                ERR("Error clearing quiescent state for consumer channel");
                                ret = -1;
@@ -5533,8 +5665,7 @@ end_not_compatible:
  * specific UST session.
  * Called with UST session lock held.
  */
-static
-int ust_app_clear_quiescent_session(struct ltt_ust_session *usess)
+static int ust_app_clear_quiescent_session(struct ltt_ust_session *usess)
 
 {
        int ret = 0;
@@ -5553,13 +5684,13 @@ int ust_app_clear_quiescent_session(struct ltt_ust_session *usess)
                 * Clear quiescent for all per UID buffers associated to
                 * that session.
                 */
-               cds_list_for_each_entry(reg, &usess->buffer_reg_uid_list, lnode) {
+               cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        struct consumer_socket *socket;
                        struct buffer_reg_channel *buf_reg_chan;
 
                        /* Get associated consumer socket.*/
-                       socket = consumer_find_socket_by_bitness(
-                                       reg->bits_per_long, usess->consumer);
+                       socket = consumer_find_socket_by_bitness(reg->bits_per_long,
+                                                                usess->consumer);
                        if (!socket) {
                                /*
                                 * Ignore request if no consumer is found for
@@ -5568,8 +5699,8 @@ int ust_app_clear_quiescent_session(struct ltt_ust_session *usess)
                                continue;
                        }
 
-                       cds_lfht_for_each_entry(reg->registry->channels->ht,
-                                       &iter.iter, buf_reg_chan, node.node) {
+                       cds_lfht_for_each_entry (
+                               reg->registry->channels->ht, &iter.iter, buf_reg_chan, node.node) {
                                /*
                                 * The following call will print error values so
                                 * the return code is of little importance
@@ -5577,7 +5708,7 @@ int ust_app_clear_quiescent_session(struct ltt_ust_session *usess)
                                 * all.
                                 */
                                (void) consumer_clear_quiescent_channel(socket,
-                                               buf_reg_chan->consumer_key);
+                                                                       buf_reg_chan->consumer_key);
                        }
                }
                break;
@@ -5588,14 +5719,12 @@ int ust_app_clear_quiescent_session(struct ltt_ust_session *usess)
                struct lttng_ht_iter iter;
                struct ust_app *app;
 
-               cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app,
-                               pid_n.node) {
+               cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        ua_sess = lookup_session_by_app(usess, app);
                        if (ua_sess == NULL) {
                                continue;
                        }
-                       (void) ust_app_clear_quiescent_app_session(app,
-                                       ua_sess);
+                       (void) ust_app_clear_quiescent_app_session(app, ua_sess);
                }
                break;
        }
@@ -5648,13 +5777,17 @@ static int destroy_trace(struct ltt_ust_session *usess, struct ust_app *app)
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        DBG3("UST app wait quiescent failed. Application is dead: pid= %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        WARN("UST app wait quiescent failed. Communication time out: pid= %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app wait quiescent failed with ret %d: pid= %d, sock = %d",
-                                       ret, app->pid, app->sock);
+                           ret,
+                           app->pid,
+                           app->sock);
                }
        }
 end:
@@ -5689,7 +5822,7 @@ int ust_app_start_trace_all(struct ltt_ust_session *usess)
         */
        (void) ust_app_clear_quiescent_session(usess);
 
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                ust_app_global_update(usess, app);
        }
 
@@ -5718,7 +5851,7 @@ int ust_app_stop_trace_all(struct ltt_ust_session *usess)
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                ret = ust_app_stop_trace(usess, app);
                if (ret < 0) {
                        /* Continue to next apps even on error */
@@ -5746,7 +5879,7 @@ int ust_app_destroy_trace_all(struct ltt_ust_session *usess)
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                ret = destroy_trace(usess, app);
                if (ret < 0) {
                        /* Continue to next apps even on error */
@@ -5760,13 +5893,11 @@ int ust_app_destroy_trace_all(struct ltt_ust_session *usess)
 }
 
 /* The ua_sess lock must be held by the caller. */
-static
-int find_or_create_ust_app_channel(
-               struct ltt_ust_session *usess,
-               struct ust_app_session *ua_sess,
-               struct ust_app *app,
-               struct ltt_ust_channel *uchan,
-               struct ust_app_channel **ua_chan)
+static int find_or_create_ust_app_channel(struct ltt_ust_session *usess,
+                                         struct ust_app_session *ua_sess,
+                                         struct ust_app *app,
+                                         struct ltt_ust_channel *uchan,
+                                         struct ust_app_channel **ua_chan)
 {
        int ret = 0;
        struct lttng_ht_iter iter;
@@ -5775,8 +5906,7 @@ int find_or_create_ust_app_channel(
        lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &iter);
        ua_chan_node = lttng_ht_iter_get_node_str(&iter);
        if (ua_chan_node) {
-               *ua_chan = caa_container_of(ua_chan_node,
-                       struct ust_app_channel, node);
+               *ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
                goto end;
        }
 
@@ -5788,16 +5918,18 @@ end:
        return ret;
 }
 
-static
-int ust_app_channel_synchronize_event(struct ust_app_channel *ua_chan,
-               struct ltt_ust_event *uevent,
-               struct ust_app *app)
+static int ust_app_channel_synchronize_event(struct ust_app_channel *ua_chan,
+                                            struct ltt_ust_event *uevent,
+                                            struct ust_app *app)
 {
        int ret = 0;
        struct ust_app_event *ua_event = NULL;
 
-       ua_event = find_ust_app_event(ua_chan->events, uevent->attr.name,
-               uevent->filter, uevent->attr.loglevel, uevent->exclusion);
+       ua_event = find_ust_app_event(ua_chan->events,
+                                     uevent->attr.name,
+                                     uevent->filter,
+                                     uevent->attr.loglevel,
+                                     uevent->exclusion);
        if (!ua_event) {
                ret = create_ust_app_event(ua_chan, uevent, app);
                if (ret < 0) {
@@ -5805,9 +5937,8 @@ int ust_app_channel_synchronize_event(struct ust_app_channel *ua_chan,
                }
        } else {
                if (ua_event->enabled != uevent->enabled) {
-                       ret = uevent->enabled ?
-                               enable_ust_app_event(ua_event, app) :
-                               disable_ust_app_event(ua_event, app);
+                       ret = uevent->enabled ? enable_ust_app_event(ua_event, app) :
+                                               disable_ust_app_event(ua_event, app);
                }
        }
 
@@ -5816,8 +5947,7 @@ end:
 }
 
 /* Called with RCU read-side lock held. */
-static
-void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
+static void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
 {
        int ret = 0;
        enum lttng_error_code ret_code;
@@ -5852,7 +5982,7 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
 
        /* Get all triggers using uid 0 (root) */
        ret_code = notification_thread_command_list_triggers(
-                       the_notification_thread_handle, 0, &triggers);
+               the_notification_thread_handle, 0, &triggers);
        if (ret_code != LTTNG_OK) {
                goto end;
        }
@@ -5879,14 +6009,13 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
                condition = lttng_trigger_get_condition(trigger);
 
                if (lttng_condition_get_type(condition) !=
-                               LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES) {
+                   LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES) {
                        /* Does not apply */
                        continue;
                }
 
-               condition_status =
-                               lttng_condition_event_rule_matches_borrow_rule_mutable(
-                                               condition, &event_rule);
+               condition_status = lttng_condition_event_rule_matches_borrow_rule_mutable(
+                       condition, &event_rule);
                LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
                if (lttng_event_rule_get_domain_type(event_rule) == LTTNG_DOMAIN_KERNEL) {
@@ -5900,7 +6029,7 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
                 * explicitly acquiring it here.
                 */
                looked_up_event_notifier_rule = find_ust_app_event_notifier_rule(
-                               app->token_to_event_notifier_rule_ht, token);
+                       app->token_to_event_notifier_rule_ht, token);
                if (!looked_up_event_notifier_rule) {
                        ret = create_ust_app_event_notifier_rule(trigger, app);
                        if (ret < 0) {
@@ -5912,8 +6041,9 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
        rcu_read_lock();
        /* Remove all unknown event sources from the app. */
        cds_lfht_for_each_entry (app->token_to_event_notifier_rule_ht->ht,
-                       &app_trigger_iter.iter, event_notifier_rule,
-                       node.node) {
+                                &app_trigger_iter.iter,
+                                event_notifier_rule,
+                                node.node) {
                const uint64_t app_token = event_notifier_rule->token;
                bool found = false;
 
@@ -5924,13 +6054,11 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
                for (i = 0; i < count; i++) {
                        uint64_t notification_thread_token;
                        const struct lttng_trigger *trigger =
-                                       lttng_triggers_get_at_index(
-                                                       triggers, i);
+                               lttng_triggers_get_at_index(triggers, i);
 
                        LTTNG_ASSERT(trigger);
 
-                       notification_thread_token =
-                                       lttng_trigger_get_tracer_token(trigger);
+                       notification_thread_token = lttng_trigger_get_tracer_token(trigger);
 
                        if (notification_thread_token == app_token) {
                                found = true;
@@ -5947,15 +6075,13 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
                 * This trigger was unregistered, disable it on the tracer's
                 * side.
                 */
-               ret = lttng_ht_del(app->token_to_event_notifier_rule_ht,
-                               &app_trigger_iter);
+               ret = lttng_ht_del(app->token_to_event_notifier_rule_ht, &app_trigger_iter);
                LTTNG_ASSERT(ret == 0);
 
                /* Callee logs errors. */
                (void) disable_ust_object(app, event_notifier_rule->obj);
 
-               delete_ust_app_event_notifier_rule(
-                               app->sock, event_notifier_rule, app);
+               delete_ust_app_event_notifier_rule(app->sock, event_notifier_rule, app);
        }
 
        rcu_read_unlock();
@@ -5968,10 +6094,9 @@ end:
 /*
  * RCU read lock must be held by the caller.
  */
-static
-void ust_app_synchronize_all_channels(struct ltt_ust_session *usess,
-               struct ust_app_session *ua_sess,
-               struct ust_app *app)
+static void ust_app_synchronize_all_channels(struct ltt_ust_session *usess,
+                                            struct ust_app_session *ua_sess,
+                                            struct ust_app *app)
 {
        int ret = 0;
        struct cds_lfht_iter uchan_iter;
@@ -5982,8 +6107,7 @@ void ust_app_synchronize_all_channels(struct ltt_ust_session *usess,
        LTTNG_ASSERT(app);
        ASSERT_RCU_READ_LOCKED();
 
-       cds_lfht_for_each_entry(usess->domain_global.channels->ht, &uchan_iter,
-                       uchan, node.node) {
+       cds_lfht_for_each_entry (usess->domain_global.channels->ht, &uchan_iter, uchan, node.node) {
                struct ust_app_channel *ua_chan;
                struct cds_lfht_iter uevent_iter;
                struct ltt_ust_event *uevent;
@@ -5995,8 +6119,7 @@ void ust_app_synchronize_all_channels(struct ltt_ust_session *usess,
                 * allocated (if necessary) and sent to the application, and
                 * all enabled contexts will be added to the channel.
                 */
-               ret = find_or_create_ust_app_channel(usess, ua_sess,
-                       app, uchan, &ua_chan);
+               ret = find_or_create_ust_app_channel(usess, ua_sess, app, uchan, &ua_chan);
                if (ret) {
                        /* Tracer is probably gone or ENOMEM. */
                        goto end;
@@ -6007,19 +6130,16 @@ void ust_app_synchronize_all_channels(struct ltt_ust_session *usess,
                        continue;
                }
 
-               cds_lfht_for_each_entry(uchan->events->ht, &uevent_iter, uevent,
-                               node.node) {
-                       ret = ust_app_channel_synchronize_event(ua_chan,
-                               uevent, app);
+               cds_lfht_for_each_entry (uchan->events->ht, &uevent_iter, uevent, node.node) {
+                       ret = ust_app_channel_synchronize_event(ua_chan, uevent, app);
                        if (ret) {
                                goto end;
                        }
                }
 
                if (ua_chan->enabled != uchan->enabled) {
-                       ret = uchan->enabled ?
-                               enable_ust_app_channel(ua_sess, uchan, app) :
-                               disable_ust_app_channel(ua_sess, ua_chan, app);
+                       ret = uchan->enabled ? enable_ust_app_channel(ua_sess, uchan, app) :
+                                              disable_ust_app_channel(ua_sess, ua_chan, app);
                        if (ret) {
                                goto end;
                        }
@@ -6033,9 +6153,7 @@ end:
  * The caller must ensure that the application is compatible and is tracked
  * by the process attribute trackers.
  */
-static
-void ust_app_synchronize(struct ltt_ust_session *usess,
-               struct ust_app *app)
+static void ust_app_synchronize(struct ltt_ust_session *usess, struct ust_app *app)
 {
        int ret = 0;
        struct ust_app_session *ua_sess = NULL;
@@ -6077,7 +6195,8 @@ void ust_app_synchronize(struct ltt_ust_session *usess,
        ret = create_ust_app_metadata(ua_sess, app, usess->consumer);
        if (ret < 0) {
                ERR("Metadata creation failed for app sock %d for session id %" PRIu64,
-                               app->sock, usess->id);
+                   app->sock,
+                   usess->id);
        }
 
        rcu_read_unlock();
@@ -6088,8 +6207,7 @@ end:
        return;
 }
 
-static
-void ust_app_global_destroy(struct ltt_ust_session *usess, struct ust_app *app)
+static void ust_app_global_destroy(struct ltt_ust_session *usess, struct ust_app *app)
 {
        struct ust_app_session *ua_sess;
 
@@ -6112,20 +6230,14 @@ void ust_app_global_update(struct ltt_ust_session *usess, struct ust_app *app)
        LTTNG_ASSERT(usess->active);
        ASSERT_RCU_READ_LOCKED();
 
-       DBG2("UST app global update for app sock %d for session id %" PRIu64,
-                       app->sock, usess->id);
+       DBG2("UST app global update for app sock %d for session id %" PRIu64, app->sock, usess->id);
 
        if (!app->compatible) {
                return;
        }
-       if (trace_ust_id_tracker_lookup(LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID,
-                           usess, app->pid) &&
-                       trace_ust_id_tracker_lookup(
-                                       LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID,
-                                       usess, app->uid) &&
-                       trace_ust_id_tracker_lookup(
-                                       LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID,
-                                       usess, app->gid)) {
+       if (trace_ust_id_tracker_lookup(LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID, usess, app->pid) &&
+           trace_ust_id_tracker_lookup(LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID, usess, app->uid) &&
+           trace_ust_id_tracker_lookup(LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID, usess, app->gid)) {
                /*
                 * Synchronize the application's internal tracing configuration
                 * and start tracing.
@@ -6148,7 +6260,8 @@ void ust_app_global_update_event_notifier_rules(struct ust_app *app)
        ASSERT_RCU_READ_LOCKED();
 
        DBG2("UST application global event notifier rules update: app = '%s', pid = %d",
-                       app->name, app->pid);
+            app->name,
+            app->pid);
 
        if (!app->compatible || !ust_app_supports_notifiers(app)) {
                return;
@@ -6156,7 +6269,8 @@ void ust_app_global_update_event_notifier_rules(struct ust_app *app)
 
        if (app->event_notifier_group.object == NULL) {
                WARN("UST app global update of event notifiers for app skipped since communication handle is null: app = '%s', pid = %d",
-                               app->name, app->pid);
+                    app->name,
+                    app->pid);
                return;
        }
 
@@ -6172,7 +6286,7 @@ void ust_app_global_update_all(struct ltt_ust_session *usess)
        struct ust_app *app;
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                ust_app_global_update(usess, app);
        }
        rcu_read_unlock();
@@ -6184,7 +6298,7 @@ void ust_app_global_update_all_event_notifier_rules(void)
        struct ust_app *app;
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                ust_app_global_update_event_notifier_rules(app);
        }
 
@@ -6195,7 +6309,8 @@ void ust_app_global_update_all_event_notifier_rules(void)
  * Add context to a specific channel for global UST domain.
  */
 int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, struct ltt_ust_context *uctx)
+                               struct ltt_ust_channel *uchan,
+                               struct ltt_ust_context *uctx)
 {
        int ret = 0;
        struct lttng_ht_node_str *ua_chan_node;
@@ -6207,7 +6322,7 @@ int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
        LTTNG_ASSERT(usess->active);
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                if (!app->compatible) {
                        /*
                         * TODO: In time, we should notice the caller of this error by
@@ -6228,13 +6343,12 @@ int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
                }
 
                /* Lookup channel in the ust app session */
-               lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &uiter);
+               lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &uiter);
                ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
                if (ua_chan_node == NULL) {
                        goto next_app;
                }
-               ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel,
-                               node);
+               ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
                ret = create_ust_app_channel_context(ua_chan, &uctx->ctx, app);
                if (ret < 0) {
                        goto next_app;
@@ -6259,16 +6373,22 @@ int ust_app_recv_registration(int sock, struct ust_register_msg *msg)
 
        LTTNG_ASSERT(msg);
 
-       ret = lttng_ust_ctl_recv_reg_msg(sock, &msg->type, &msg->major, &msg->minor,
-                       &pid, &ppid, &uid, &gid,
-                       &msg->bits_per_long,
-                       &msg->uint8_t_alignment,
-                       &msg->uint16_t_alignment,
-                       &msg->uint32_t_alignment,
-                       &msg->uint64_t_alignment,
-                       &msg->long_alignment,
-                       &msg->byte_order,
-                       msg->name);
+       ret = lttng_ust_ctl_recv_reg_msg(sock,
+                                        &msg->type,
+                                        &msg->major,
+                                        &msg->minor,
+                                        &pid,
+                                        &ppid,
+                                        &uid,
+                                        &gid,
+                                        &msg->bits_per_long,
+                                        &msg->uint8_t_alignment,
+                                        &msg->uint16_t_alignment,
+                                        &msg->uint32_t_alignment,
+                                        &msg->uint64_t_alignment,
+                                        &msg->long_alignment,
+                                        &msg->byte_order,
+                                        msg->name);
        if (ret < 0) {
                switch (-ret) {
                case EPIPE:
@@ -6278,8 +6398,10 @@ int ust_app_recv_registration(int sock, struct ust_register_msg *msg)
                        break;
                case LTTNG_UST_ERR_UNSUP_MAJOR:
                        ERR("UST app recv reg unsupported version %d.%d. Supporting %d.%d",
-                                       msg->major, msg->minor, LTTNG_UST_ABI_MAJOR_VERSION,
-                                       LTTNG_UST_ABI_MINOR_VERSION);
+                           msg->major,
+                           msg->minor,
+                           LTTNG_UST_ABI_MAJOR_VERSION,
+                           LTTNG_UST_ABI_MINOR_VERSION);
                        break;
                default:
                        ERR("UST app recv reg message failed with ret %d", ret);
@@ -6300,9 +6422,8 @@ error:
  * Return a ust app session object using the application object and the
  * session object descriptor has a key. If not found, NULL is returned.
  * A RCU read side lock MUST be acquired when calling this function.
-*/
-static struct ust_app_session *find_session_by_objd(struct ust_app *app,
-               int objd)
+ */
+static struct ust_app_session *find_session_by_objd(struct ust_app *app, int objd)
 {
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
@@ -6311,7 +6432,7 @@ static struct ust_app_session *find_session_by_objd(struct ust_app *app,
        LTTNG_ASSERT(app);
        ASSERT_RCU_READ_LOCKED();
 
-       lttng_ht_lookup(app->ust_sessions_objd, (void *)((unsigned long) objd), &iter);
+       lttng_ht_lookup(app->ust_sessions_objd, (void *) ((unsigned long) objd), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
        if (node == NULL) {
                DBG2("UST app session find by objd %d not found", objd);
@@ -6329,8 +6450,7 @@ error:
  * object descriptor has a key. If not found, NULL is returned. A RCU read side
  * lock MUST be acquired before calling this function.
  */
-static struct ust_app_channel *find_channel_by_objd(struct ust_app *app,
-               int objd)
+static struct ust_app_channel *find_channel_by_objd(struct ust_app *app, int objd)
 {
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
@@ -6339,7 +6459,7 @@ static struct ust_app_channel *find_channel_by_objd(struct ust_app *app,
        LTTNG_ASSERT(app);
        ASSERT_RCU_READ_LOCKED();
 
-       lttng_ht_lookup(app->ust_objd, (void *)((unsigned long) objd), &iter);
+       lttng_ht_lookup(app->ust_objd, (void *) ((unsigned long) objd), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
        if (node == NULL) {
                DBG2("UST app channel find by objd %d not found", objd);
@@ -6361,9 +6481,9 @@ error:
  * On success 0 is returned else a negative value.
  */
 static int handle_app_register_channel_notification(int sock,
-               int cobjd,
-               struct lttng_ust_ctl_field *raw_context_fields,
-               size_t context_field_count)
+                                                   int cobjd,
+                                                   struct lttng_ust_ctl_field *raw_context_fields,
+                                                   size_t context_field_count)
 {
        int ret, ret_code = 0;
        uint32_t chan_id;
@@ -6371,16 +6491,15 @@ static int handle_app_register_channel_notification(int sock,
        struct ust_app *app;
        struct ust_app_channel *ua_chan;
        struct ust_app_session *ua_sess;
-       auto ust_ctl_context_fields = lttng::make_unique_wrapper<lttng_ust_ctl_field, lttng::free>(
-                       raw_context_fields);
+       auto ust_ctl_context_fields =
+               lttng::make_unique_wrapper<lttng_ust_ctl_field, lttng::free>(raw_context_fields);
 
        lttng::urcu::read_lock_guard read_lock_guard;
 
        /* Lookup application. If not found, there is a code flow error. */
        app = find_app_by_notify_sock(sock);
        if (!app) {
-               DBG("Application socket %d is being torn down. Abort event notify",
-                               sock);
+               DBG("Application socket %d is being torn down. Abort event notify", sock);
                return -1;
        }
 
@@ -6428,16 +6547,17 @@ static int handle_app_register_channel_notification(int sock,
         */
        try {
                auto app_context_fields = lsu::create_trace_fields_from_ust_ctl_fields(
-                               *locked_registry_session, ust_ctl_context_fields.get(),
-                               context_field_count,
-                               lst::field_location::root::EVENT_RECORD_COMMON_CONTEXT,
-                               lsu::ctl_field_quirks::UNDERSCORE_PREFIXED_VARIANT_TAG_MAPPINGS);
+                       *locked_registry_session,
+                       ust_ctl_context_fields.get(),
+                       context_field_count,
+                       lst::field_location::root::EVENT_RECORD_COMMON_CONTEXT,
+                       lsu::ctl_field_quirks::UNDERSCORE_PREFIXED_VARIANT_TAG_MAPPINGS);
 
                if (!ust_reg_chan.is_registered()) {
                        lst::type::cuptr event_context = app_context_fields.size() ?
-                                       lttng::make_unique<lst::structure_type>(
-                                                       0, std::move(app_context_fields)) :
-                                       nullptr;
+                               lttng::make_unique<lst::structure_type>(
+                                       0, std::move(app_context_fields)) :
+                               nullptr;
 
                        ust_reg_chan.event_context(std::move(event_context));
                } else {
@@ -6452,15 +6572,16 @@ static int handle_app_register_channel_notification(int sock,
                                context_fields_match = app_context_fields.size() == 0;
                        } else {
                                const lst::structure_type app_event_context_struct(
-                                               0, std::move(app_context_fields));
+                                       0, std::move(app_context_fields));
 
                                context_fields_match = *previous_event_context ==
-                                               app_event_context_struct;
+                                       app_event_context_struct;
                        }
 
                        if (!context_fields_match) {
                                ERR("Registering application channel due to context field mismatch: pid = %d, sock = %d",
-                                               app->pid, app->sock);
+                                   app->pid,
+                                   app->sock);
                                ret_code = -EINVAL;
                                goto reply;
                        }
@@ -6472,25 +6593,32 @@ static int handle_app_register_channel_notification(int sock,
        }
 
 reply:
-       DBG3("UST app replying to register channel key %" PRIu64
-                       " with id %u, ret = %d", chan_reg_key, chan_id,
-                       ret_code);
-
-       ret = lttng_ust_ctl_reply_register_channel(sock, chan_id,
-                       ust_reg_chan.header_type_ == lst::stream_class::header_type::COMPACT ?
-                                       LTTNG_UST_CTL_CHANNEL_HEADER_COMPACT :
-                                             LTTNG_UST_CTL_CHANNEL_HEADER_LARGE,
-                       ret_code);
+       DBG3("UST app replying to register channel key %" PRIu64 " with id %u, ret = %d",
+            chan_reg_key,
+            chan_id,
+            ret_code);
+
+       ret = lttng_ust_ctl_reply_register_channel(
+               sock,
+               chan_id,
+               ust_reg_chan.header_type_ == lst::stream_class::header_type::COMPACT ?
+                       LTTNG_UST_CTL_CHANNEL_HEADER_COMPACT :
+                       LTTNG_UST_CTL_CHANNEL_HEADER_LARGE,
+               ret_code);
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        DBG3("UST app reply channel failed. Application died: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        WARN("UST app reply channel failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app reply channel failed with ret %d: pid = %d, sock = %d",
-                                       ret, app->pid, app->sock);
+                           ret,
+                           app->pid,
+                           app->sock);
                }
 
                return ret;
@@ -6511,9 +6639,15 @@ reply:
  *
  * On success 0 is returned else a negative value.
  */
-static int add_event_ust_registry(int sock, int sobjd, int cobjd, const char *name,
-               char *raw_signature, size_t nr_fields, struct lttng_ust_ctl_field *raw_fields,
-               int loglevel_value, char *raw_model_emf_uri)
+static int add_event_ust_registry(int sock,
+                                 int sobjd,
+                                 int cobjd,
+                                 const char *name,
+                                 char *raw_signature,
+                                 size_t nr_fields,
+                                 struct lttng_ust_ctl_field *raw_fields,
+                                 int loglevel_value,
+                                 char *raw_model_emf_uri)
 {
        int ret, ret_code;
        uint32_t event_id = 0;
@@ -6529,8 +6663,7 @@ static int add_event_ust_registry(int sock, int sobjd, int cobjd, const char *na
        /* Lookup application. If not found, there is a code flow error. */
        app = find_app_by_notify_sock(sock);
        if (!app) {
-               DBG("Application socket %d is being torn down. Abort event notify",
-                               sock);
+               DBG("Application socket %d is being torn down. Abort event notify", sock);
                return -1;
        }
 
@@ -6562,24 +6695,30 @@ static int add_event_ust_registry(int sock, int sobjd, int cobjd, const char *na
                                auto& channel = locked_registry->channel(chan_reg_key);
 
                                /* event_id is set on success. */
-                               channel.add_event(sobjd, cobjd, name, signature.get(),
-                                               lsu::create_trace_fields_from_ust_ctl_fields(
-                                                               *locked_registry, fields.get(),
-                                                               nr_fields,
-                                                               lst::field_location::root::
-                                                                               EVENT_RECORD_PAYLOAD,
-                                                               lsu::ctl_field_quirks::
-                                                                               UNDERSCORE_PREFIXED_VARIANT_TAG_MAPPINGS),
-                                               loglevel_value,
-                                               model_emf_uri.get() ?
-                                                               nonstd::optional<std::string>(
-                                                                               model_emf_uri.get()) :
-                                                               nonstd::nullopt,
-                                               ua_sess->buffer_type, *app, event_id);
+                               channel.add_event(
+                                       sobjd,
+                                       cobjd,
+                                       name,
+                                       signature.get(),
+                                       lsu::create_trace_fields_from_ust_ctl_fields(
+                                               *locked_registry,
+                                               fields.get(),
+                                               nr_fields,
+                                               lst::field_location::root::EVENT_RECORD_PAYLOAD,
+                                               lsu::ctl_field_quirks::
+                                                       UNDERSCORE_PREFIXED_VARIANT_TAG_MAPPINGS),
+                                       loglevel_value,
+                                       model_emf_uri.get() ?
+                                               nonstd::optional<std::string>(model_emf_uri.get()) :
+                                               nonstd::nullopt,
+                                       ua_sess->buffer_type,
+                                       *app,
+                                       event_id);
                                ret_code = 0;
                        } catch (const std::exception& ex) {
-                               ERR("Failed to add event `%s` to registry session: %s", name,
-                                               ex.what());
+                               ERR("Failed to add event `%s` to registry session: %s",
+                                   name,
+                                   ex.what());
                                /* Inform the application of the error; don't return directly. */
                                ret_code = -EINVAL;
                        }
@@ -6598,13 +6737,17 @@ static int add_event_ust_registry(int sock, int sobjd, int cobjd, const char *na
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        DBG3("UST app reply event failed. Application died: pid = %d, sock = %d.",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        WARN("UST app reply event failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app reply event failed with ret %d: pid = %d, sock = %d",
-                                       ret, app->pid, app->sock);
+                           ret,
+                           app->pid,
+                           app->sock);
                }
                /*
                 * No need to wipe the create event since the application socket will
@@ -6613,8 +6756,7 @@ static int add_event_ust_registry(int sock, int sobjd, int cobjd, const char *na
                return ret;
        }
 
-       DBG3("UST registry event %s with id %" PRId32 " added successfully",
-                       name, event_id);
+       DBG3("UST registry event %s with id %" PRId32 " added successfully", name, event_id);
        return ret;
 }
 
@@ -6626,8 +6768,11 @@ static int add_event_ust_registry(int sock, int sobjd, int cobjd, const char *na
  *
  * On success 0 is returned else a negative value.
  */
-static int add_enum_ust_registry(int sock, int sobjd, const char *name,
-               struct lttng_ust_ctl_enum_entry *raw_entries, size_t nr_entries)
+static int add_enum_ust_registry(int sock,
+                                int sobjd,
+                                const char *name,
+                                struct lttng_ust_ctl_enum_entry *raw_entries,
+                                size_t nr_entries)
 {
        int ret = 0;
        struct ust_app *app;
@@ -6635,14 +6780,13 @@ static int add_enum_ust_registry(int sock, int sobjd, const char *name,
        uint64_t enum_id = -1ULL;
        lttng::urcu::read_lock_guard read_lock_guard;
        auto entries = lttng::make_unique_wrapper<struct lttng_ust_ctl_enum_entry, lttng::free>(
-                       raw_entries);
+               raw_entries);
 
        /* Lookup application. If not found, there is a code flow error. */
        app = find_app_by_notify_sock(sock);
        if (!app) {
                /* Return an error since this is not an error */
-               DBG("Application socket %d is being torn down. Aborting enum registration",
-                               sock);
+               DBG("Application socket %d is being torn down. Aborting enum registration", sock);
                return -1;
        }
 
@@ -6668,11 +6812,16 @@ static int add_enum_ust_registry(int sock, int sobjd, const char *name,
        int application_reply_code;
        try {
                locked_registry->create_or_find_enum(
-                               sobjd, name, entries.release(), nr_entries, &enum_id);
+                       sobjd, name, entries.release(), nr_entries, &enum_id);
                application_reply_code = 0;
        } catch (const std::exception& ex) {
-               ERR("%s: %s", fmt::format("Failed to create or find enumeration provided by application: app = {}, enumeration name = {}",
-                               *app, name).c_str(), ex.what());
+               ERR("%s: %s",
+                   fmt::format(
+                           "Failed to create or find enumeration provided by application: app = {}, enumeration name = {}",
+                           *app,
+                           name)
+                           .c_str(),
+                   ex.what());
                application_reply_code = -1;
        }
 
@@ -6685,13 +6834,17 @@ static int add_enum_ust_registry(int sock, int sobjd, const char *name,
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        DBG3("UST app reply enum failed. Application died: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        WARN("UST app reply enum failed. Communication time out: pid = %d, sock = %d",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app reply enum failed with ret %d: pid = %d, sock = %d",
-                                       ret, app->pid, app->sock);
+                           ret,
+                           app->pid,
+                           app->sock);
                }
                /*
                 * No need to wipe the create enum since the application socket will
@@ -6719,14 +6872,11 @@ int ust_app_recv_notify(int sock)
        ret = lttng_ust_ctl_recv_notify(sock, &cmd);
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
-                       DBG3("UST app recv notify failed. Application died: sock = %d",
-                                       sock);
+                       DBG3("UST app recv notify failed. Application died: sock = %d", sock);
                } else if (ret == -EAGAIN) {
-                       WARN("UST app recv notify failed. Communication time out: sock = %d",
-                                       sock);
+                       WARN("UST app recv notify failed. Communication time out: sock = %d", sock);
                } else {
-                       ERR("UST app recv notify failed with ret %d: sock = %d",
-                                       ret, sock);
+                       ERR("UST app recv notify failed with ret %d: sock = %d", ret, sock);
                }
                goto error;
        }
@@ -6741,18 +6891,24 @@ int ust_app_recv_notify(int sock)
 
                DBG2("UST app ustctl register event received");
 
-               ret = lttng_ust_ctl_recv_register_event(sock, &sobjd, &cobjd, name, &loglevel_value,
-                               &sig, &nr_fields, &fields, &model_emf_uri);
+               ret = lttng_ust_ctl_recv_register_event(sock,
+                                                       &sobjd,
+                                                       &cobjd,
+                                                       name,
+                                                       &loglevel_value,
+                                                       &sig,
+                                                       &nr_fields,
+                                                       &fields,
+                                                       &model_emf_uri);
                if (ret < 0) {
                        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                                DBG3("UST app recv event failed. Application died: sock = %d",
-                                               sock);
+                                    sock);
                        } else if (ret == -EAGAIN) {
                                WARN("UST app recv event failed. Communication time out: sock = %d",
-                                               sock);
+                                    sock);
                        } else {
-                               ERR("UST app recv event failed with ret %d: sock = %d",
-                                               ret, sock);
+                               ERR("UST app recv event failed with ret %d: sock = %d", ret, sock);
                        }
                        goto error;
                }
@@ -6761,7 +6917,8 @@ int ust_app_recv_notify(int sock)
                        lttng::urcu::read_lock_guard rcu_lock;
                        const struct ust_app *app = find_app_by_notify_sock(sock);
                        if (!app) {
-                               DBG("Application socket %d is being torn down. Abort event notify", sock);
+                               DBG("Application socket %d is being torn down. Abort event notify",
+                                   sock);
                                ret = -1;
                                goto error;
                        }
@@ -6769,7 +6926,8 @@ int ust_app_recv_notify(int sock)
 
                if ((!fields && nr_fields > 0) || (fields && nr_fields == 0)) {
                        ERR("Invalid return value from lttng_ust_ctl_recv_register_event: fields = %p, nr_fields = %zu",
-                                       fields, nr_fields);
+                           fields,
+                           nr_fields);
                        ret = -1;
                        free(fields);
                        goto error;
@@ -6781,8 +6939,15 @@ int ust_app_recv_notify(int sock)
                 * code path loses the ownsership of these variables and transfer them
                 * to the this function.
                 */
-               ret = add_event_ust_registry(sock, sobjd, cobjd, name, sig, nr_fields,
-                               fields, loglevel_value, model_emf_uri);
+               ret = add_event_ust_registry(sock,
+                                            sobjd,
+                                            cobjd,
+                                            name,
+                                            sig,
+                                            nr_fields,
+                                            fields,
+                                            loglevel_value,
+                                            model_emf_uri);
                if (ret < 0) {
                        goto error;
                }
@@ -6798,17 +6963,18 @@ int ust_app_recv_notify(int sock)
                DBG2("UST app ustctl register channel received");
 
                ret = lttng_ust_ctl_recv_register_channel(
-                               sock, &sobjd, &cobjd, &field_count, &context_fields);
+                       sock, &sobjd, &cobjd, &field_count, &context_fields);
                if (ret < 0) {
                        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                                DBG3("UST app recv channel failed. Application died: sock = %d",
-                                               sock);
+                                    sock);
                        } else if (ret == -EAGAIN) {
                                WARN("UST app recv channel failed. Communication time out: sock = %d",
-                                               sock);
+                                    sock);
                        } else {
-                               ERR("UST app recv channel failed with ret %d: sock = %d", ret,
-                                               sock);
+                               ERR("UST app recv channel failed with ret %d: sock = %d",
+                                   ret,
+                                   sock);
                        }
                        goto error;
                }
@@ -6818,7 +6984,8 @@ int ust_app_recv_notify(int sock)
                 * that if needed it will be freed. After this, it's invalid to access
                 * fields or clean them up.
                 */
-               ret = handle_app_register_channel_notification(sock, cobjd, context_fields, field_count);
+               ret = handle_app_register_channel_notification(
+                       sock, cobjd, context_fields, field_count);
                if (ret < 0) {
                        goto error;
                }
@@ -6834,25 +7001,21 @@ int ust_app_recv_notify(int sock)
 
                DBG2("UST app ustctl register enum received");
 
-               ret = lttng_ust_ctl_recv_register_enum(sock, &sobjd, name,
-                               &entries, &nr_entries);
+               ret = lttng_ust_ctl_recv_register_enum(sock, &sobjd, name, &entries, &nr_entries);
                if (ret < 0) {
                        if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
-                               DBG3("UST app recv enum failed. Application died: sock = %d",
-                                               sock);
+                               DBG3("UST app recv enum failed. Application died: sock = %d", sock);
                        } else if (ret == -EAGAIN) {
                                WARN("UST app recv enum failed. Communication time out: sock = %d",
-                                               sock);
+                                    sock);
                        } else {
-                               ERR("UST app recv enum failed with ret %d: sock = %d",
-                                               ret, sock);
+                               ERR("UST app recv enum failed with ret %d: sock = %d", ret, sock);
                        }
                        goto error;
                }
 
                /* Callee assumes ownership of entries. */
-               ret = add_enum_ust_registry(sock, sobjd, name,
-                               entries, nr_entries);
+               ret = add_enum_ust_registry(sock, sobjd, name, entries, nr_entries);
                if (ret < 0) {
                        goto error;
                }
@@ -6963,10 +7126,9 @@ void ust_app_destroy(struct ust_app *app)
  *
  * Returns LTTNG_OK on success or a LTTNG_ERR error code.
  */
-enum lttng_error_code ust_app_snapshot_record(
-               const struct ltt_ust_session *usess,
-               const struct consumer_output *output,
-               uint64_t nb_packets_per_stream)
+enum lttng_error_code ust_app_snapshot_record(const struct ltt_ust_session *usess,
+                                             const struct consumer_output *output,
+                                             uint64_t nb_packets_per_stream)
 {
        int ret = 0;
        enum lttng_error_code status = LTTNG_OK;
@@ -6984,7 +7146,7 @@ enum lttng_error_code ust_app_snapshot_record(
        {
                struct buffer_reg_uid *reg;
 
-               cds_list_for_each_entry(reg, &usess->buffer_reg_uid_list, lnode) {
+               cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        struct buffer_reg_channel *buf_reg_chan;
                        struct consumer_socket *socket;
                        char pathname[PATH_MAX];
@@ -6997,16 +7159,18 @@ enum lttng_error_code ust_app_snapshot_record(
 
                        /* Get consumer socket to use to push the metadata.*/
                        socket = consumer_find_socket_by_bitness(reg->bits_per_long,
-                                       usess->consumer);
+                                                                usess->consumer);
                        if (!socket) {
                                status = LTTNG_ERR_INVALID;
                                goto error;
                        }
 
                        memset(pathname, 0, sizeof(pathname));
-                       ret = snprintf(pathname, sizeof(pathname),
-                                       DEFAULT_UST_TRACE_UID_PATH,
-                                       reg->uid, reg->bits_per_long);
+                       ret = snprintf(pathname,
+                                      sizeof(pathname),
+                                      DEFAULT_UST_TRACE_UID_PATH,
+                                      reg->uid,
+                                      reg->bits_per_long);
                        if (ret < 0) {
                                PERROR("snprintf snapshot path");
                                status = LTTNG_ERR_INVALID;
@@ -7014,26 +7178,32 @@ enum lttng_error_code ust_app_snapshot_record(
                        }
                        /* Free path allowed on previous iteration. */
                        free(trace_path);
-                       trace_path = setup_channel_trace_path(usess->consumer, pathname,
-                                               &consumer_path_offset);
+                       trace_path = setup_channel_trace_path(
+                               usess->consumer, pathname, &consumer_path_offset);
                        if (!trace_path) {
                                status = LTTNG_ERR_INVALID;
                                goto error;
                        }
                        /* Add the UST default trace dir to path. */
-                       cds_lfht_for_each_entry(reg->registry->channels->ht, &iter.iter,
-                                       buf_reg_chan, node.node) {
-                               status = consumer_snapshot_channel(socket,
-                                               buf_reg_chan->consumer_key,
-                                               output, 0, &trace_path[consumer_path_offset],
-                                               nb_packets_per_stream);
+                       cds_lfht_for_each_entry (
+                               reg->registry->channels->ht, &iter.iter, buf_reg_chan, node.node) {
+                               status =
+                                       consumer_snapshot_channel(socket,
+                                                                 buf_reg_chan->consumer_key,
+                                                                 output,
+                                                                 0,
+                                                                 &trace_path[consumer_path_offset],
+                                                                 nb_packets_per_stream);
                                if (status != LTTNG_OK) {
                                        goto error;
                                }
                        }
                        status = consumer_snapshot_channel(socket,
-                                       reg->registry->reg.ust->_metadata_key, output, 1,
-                                       &trace_path[consumer_path_offset], 0);
+                                                          reg->registry->reg.ust->_metadata_key,
+                                                          output,
+                                                          1,
+                                                          &trace_path[consumer_path_offset],
+                                                          0);
                        if (status != LTTNG_OK) {
                                goto error;
                        }
@@ -7042,7 +7212,7 @@ enum lttng_error_code ust_app_snapshot_record(
        }
        case LTTNG_BUFFER_PER_PID:
        {
-               cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+               cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        struct consumer_socket *socket;
                        struct lttng_ht_iter chan_iter;
                        struct ust_app_channel *ua_chan;
@@ -7058,8 +7228,7 @@ enum lttng_error_code ust_app_snapshot_record(
                        }
 
                        /* Get the right consumer socket for the application. */
-                       socket = consumer_find_socket_by_bitness(app->abi.bits_per_long,
-                                       output);
+                       socket = consumer_find_socket_by_bitness(app->abi.bits_per_long, output);
                        if (!socket) {
                                status = LTTNG_ERR_INVALID;
                                goto error;
@@ -7067,8 +7236,7 @@ enum lttng_error_code ust_app_snapshot_record(
 
                        /* Add the UST default trace dir to path. */
                        memset(pathname, 0, sizeof(pathname));
-                       ret = snprintf(pathname, sizeof(pathname), "%s",
-                                       ua_sess->path);
+                       ret = snprintf(pathname, sizeof(pathname), "%s", ua_sess->path);
                        if (ret < 0) {
                                status = LTTNG_ERR_INVALID;
                                PERROR("snprintf snapshot path");
@@ -7076,18 +7244,21 @@ enum lttng_error_code ust_app_snapshot_record(
                        }
                        /* Free path allowed on previous iteration. */
                        free(trace_path);
-                       trace_path = setup_channel_trace_path(usess->consumer, pathname,
-                                       &consumer_path_offset);
+                       trace_path = setup_channel_trace_path(
+                               usess->consumer, pathname, &consumer_path_offset);
                        if (!trace_path) {
                                status = LTTNG_ERR_INVALID;
                                goto error;
                        }
-                       cds_lfht_for_each_entry(ua_sess->channels->ht, &chan_iter.iter,
-                                       ua_chan, node.node) {
-                               status = consumer_snapshot_channel(socket,
-                                               ua_chan->key, output, 0,
-                                               &trace_path[consumer_path_offset],
-                                               nb_packets_per_stream);
+                       cds_lfht_for_each_entry (
+                               ua_sess->channels->ht, &chan_iter.iter, ua_chan, node.node) {
+                               status =
+                                       consumer_snapshot_channel(socket,
+                                                                 ua_chan->key,
+                                                                 output,
+                                                                 0,
+                                                                 &trace_path[consumer_path_offset],
+                                                                 nb_packets_per_stream);
                                switch (status) {
                                case LTTNG_OK:
                                        break;
@@ -7104,8 +7275,11 @@ enum lttng_error_code ust_app_snapshot_record(
                                continue;
                        }
                        status = consumer_snapshot_channel(socket,
-                                       registry->_metadata_key, output, 1,
-                                       &trace_path[consumer_path_offset], 0);
+                                                          registry->_metadata_key,
+                                                          output,
+                                                          1,
+                                                          &trace_path[consumer_path_offset],
+                                                          0);
                        switch (status) {
                        case LTTNG_OK:
                                break;
@@ -7131,8 +7305,8 @@ error:
 /*
  * Return the size taken by one more packet per stream.
  */
-uint64_t ust_app_get_size_one_more_packet_per_stream(
-               const struct ltt_ust_session *usess, uint64_t cur_nr_packets)
+uint64_t ust_app_get_size_one_more_packet_per_stream(const struct ltt_ust_session *usess,
+                                                    uint64_t cur_nr_packets)
 {
        uint64_t tot_size = 0;
        struct ust_app *app;
@@ -7145,12 +7319,12 @@ uint64_t ust_app_get_size_one_more_packet_per_stream(
        {
                struct buffer_reg_uid *reg;
 
-               cds_list_for_each_entry(reg, &usess->buffer_reg_uid_list, lnode) {
+               cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        struct buffer_reg_channel *buf_reg_chan;
 
                        rcu_read_lock();
-                       cds_lfht_for_each_entry(reg->registry->channels->ht, &iter.iter,
-                                       buf_reg_chan, node.node) {
+                       cds_lfht_for_each_entry (
+                               reg->registry->channels->ht, &iter.iter, buf_reg_chan, node.node) {
                                if (cur_nr_packets >= buf_reg_chan->num_subbuf) {
                                        /*
                                         * Don't take channel into account if we
@@ -7167,7 +7341,7 @@ uint64_t ust_app_get_size_one_more_packet_per_stream(
        case LTTNG_BUFFER_PER_PID:
        {
                rcu_read_lock();
-               cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+               cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        struct ust_app_channel *ua_chan;
                        struct ust_app_session *ua_sess;
                        struct lttng_ht_iter chan_iter;
@@ -7178,8 +7352,8 @@ uint64_t ust_app_get_size_one_more_packet_per_stream(
                                continue;
                        }
 
-                       cds_lfht_for_each_entry(ua_sess->channels->ht, &chan_iter.iter,
-                                       ua_chan, node.node) {
+                       cds_lfht_for_each_entry (
+                               ua_sess->channels->ht, &chan_iter.iter, ua_chan, node.node) {
                                if (cur_nr_packets >= ua_chan->attr.num_subbuf) {
                                        /*
                                         * Don't take channel into account if we
@@ -7202,9 +7376,12 @@ uint64_t ust_app_get_size_one_more_packet_per_stream(
 }
 
 int ust_app_uid_get_channel_runtime_stats(uint64_t ust_session_id,
-               struct cds_list_head *buffer_reg_uid_list,
-               struct consumer_output *consumer, uint64_t uchan_id,
-               int overwrite, uint64_t *discarded, uint64_t *lost)
+                                         struct cds_list_head *buffer_reg_uid_list,
+                                         struct consumer_output *consumer,
+                                         uint64_t uchan_id,
+                                         int overwrite,
+                                         uint64_t *discarded,
+                                         uint64_t *lost)
 {
        int ret;
        uint64_t consumer_chan_key;
@@ -7213,7 +7390,7 @@ int ust_app_uid_get_channel_runtime_stats(uint64_t ust_session_id,
        *lost = 0;
 
        ret = buffer_reg_uid_consumer_channel_key(
-                       buffer_reg_uid_list, uchan_id, &consumer_chan_key);
+               buffer_reg_uid_list, uchan_id, &consumer_chan_key);
        if (ret < 0) {
                /* Not found */
                ret = 0;
@@ -7221,11 +7398,10 @@ int ust_app_uid_get_channel_runtime_stats(uint64_t ust_session_id,
        }
 
        if (overwrite) {
-               ret = consumer_get_lost_packets(ust_session_id,
-                               consumer_chan_key, consumer, lost);
+               ret = consumer_get_lost_packets(ust_session_id, consumer_chan_key, consumer, lost);
        } else {
-               ret = consumer_get_discarded_events(ust_session_id,
-                               consumer_chan_key, consumer, discarded);
+               ret = consumer_get_discarded_events(
+                       ust_session_id, consumer_chan_key, consumer, discarded);
        }
 
 end:
@@ -7233,9 +7409,11 @@ end:
 }
 
 int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan,
-               struct consumer_output *consumer, int overwrite,
-               uint64_t *discarded, uint64_t *lost)
+                                         struct ltt_ust_channel *uchan,
+                                         struct consumer_output *consumer,
+                                         int overwrite,
+                                         uint64_t *discarded,
+                                         uint64_t *lost)
 {
        int ret = 0;
        struct lttng_ht_iter iter;
@@ -7252,7 +7430,7 @@ int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
         * Iterate over every registered applications. Sum counters for
         * all applications containing requested session and channel.
         */
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                struct lttng_ht_iter uiter;
 
                ua_sess = lookup_session_by_app(usess, app);
@@ -7271,8 +7449,7 @@ int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
                if (overwrite) {
                        uint64_t _lost;
 
-                       ret = consumer_get_lost_packets(usess->id, ua_chan->key,
-                                       consumer, &_lost);
+                       ret = consumer_get_lost_packets(usess->id, ua_chan->key, consumer, &_lost);
                        if (ret < 0) {
                                break;
                        }
@@ -7280,8 +7457,8 @@ int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
                } else {
                        uint64_t _discarded;
 
-                       ret = consumer_get_discarded_events(usess->id,
-                                       ua_chan->key, consumer, &_discarded);
+                       ret = consumer_get_discarded_events(
+                               usess->id, ua_chan->key, consumer, &_discarded);
                        if (ret < 0) {
                                break;
                        }
@@ -7293,9 +7470,7 @@ int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
        return ret;
 }
 
-static
-int ust_app_regenerate_statedump(struct ltt_ust_session *usess,
-               struct ust_app *app)
+static int ust_app_regenerate_statedump(struct ltt_ust_session *usess, struct ust_app *app)
 {
        int ret = 0;
        struct ust_app_session *ua_sess;
@@ -7342,7 +7517,7 @@ int ust_app_regenerate_statedump_all(struct ltt_ust_session *usess)
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+       cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                if (!app->compatible) {
                        continue;
                }
@@ -7381,25 +7556,25 @@ enum lttng_error_code ust_app_rotate_session(struct ltt_session *session)
        {
                struct buffer_reg_uid *reg;
 
-               cds_list_for_each_entry(reg, &usess->buffer_reg_uid_list, lnode) {
+               cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        struct buffer_reg_channel *buf_reg_chan;
                        struct consumer_socket *socket;
 
                        /* Get consumer socket to use to push the metadata.*/
                        socket = consumer_find_socket_by_bitness(reg->bits_per_long,
-                                       usess->consumer);
+                                                                usess->consumer);
                        if (!socket) {
                                cmd_ret = LTTNG_ERR_INVALID;
                                goto error;
                        }
 
                        /* Rotate the data channels. */
-                       cds_lfht_for_each_entry(reg->registry->channels->ht, &iter.iter,
-                                       buf_reg_chan, node.node) {
+                       cds_lfht_for_each_entry (
+                               reg->registry->channels->ht, &iter.iter, buf_reg_chan, node.node) {
                                ret = consumer_rotate_channel(socket,
-                                               buf_reg_chan->consumer_key,
-                                               usess->consumer,
-                                               /* is_metadata_channel */ false);
+                                                             buf_reg_chan->consumer_key,
+                                                             usess->consumer,
+                                                             /* is_metadata_channel */ false);
                                if (ret < 0) {
                                        cmd_ret = LTTNG_ERR_ROTATION_FAIL_CONSUMER;
                                        goto error;
@@ -7425,9 +7600,9 @@ enum lttng_error_code ust_app_rotate_session(struct ltt_session *session)
                        }
 
                        ret = consumer_rotate_channel(socket,
-                                       reg->registry->reg.ust->_metadata_key,
-                                       usess->consumer,
-                                       /* is_metadata_channel */ true);
+                                                     reg->registry->reg.ust->_metadata_key,
+                                                     usess->consumer,
+                                                     /* is_metadata_channel */ true);
                        if (ret < 0) {
                                cmd_ret = LTTNG_ERR_ROTATION_FAIL_CONSUMER;
                                goto error;
@@ -7437,7 +7612,7 @@ enum lttng_error_code ust_app_rotate_session(struct ltt_session *session)
        }
        case LTTNG_BUFFER_PER_PID:
        {
-               cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+               cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        struct consumer_socket *socket;
                        struct lttng_ht_iter chan_iter;
                        struct ust_app_channel *ua_chan;
@@ -7452,7 +7627,7 @@ enum lttng_error_code ust_app_rotate_session(struct ltt_session *session)
 
                        /* Get the right consumer socket for the application. */
                        socket = consumer_find_socket_by_bitness(app->abi.bits_per_long,
-                                       usess->consumer);
+                                                                usess->consumer);
                        if (!socket) {
                                cmd_ret = LTTNG_ERR_INVALID;
                                goto error;
@@ -7465,12 +7640,12 @@ enum lttng_error_code ust_app_rotate_session(struct ltt_session *session)
                        }
 
                        /* Rotate the data channels. */
-                       cds_lfht_for_each_entry(ua_sess->channels->ht, &chan_iter.iter,
-                                       ua_chan, node.node) {
+                       cds_lfht_for_each_entry (
+                               ua_sess->channels->ht, &chan_iter.iter, ua_chan, node.node) {
                                ret = consumer_rotate_channel(socket,
-                                               ua_chan->key,
-                                               ua_sess->consumer,
-                                               /* is_metadata_channel */ false);
+                                                             ua_chan->key,
+                                                             ua_sess->consumer,
+                                                             /* is_metadata_channel */ false);
                                if (ret < 0) {
                                        /* Per-PID buffer and application going away. */
                                        if (ret == -LTTNG_ERR_CHAN_NOT_FOUND)
@@ -7487,9 +7662,9 @@ enum lttng_error_code ust_app_rotate_session(struct ltt_session *session)
                                (void) push_metadata(locked_registry, usess->consumer);
                        }
                        ret = consumer_rotate_channel(socket,
-                                       registry->_metadata_key,
-                                       ua_sess->consumer,
-                                       /* is_metadata_channel */ true);
+                                                     registry->_metadata_key,
+                                                     ua_sess->consumer,
+                                                     /* is_metadata_channel */ true);
                        if (ret < 0) {
                                /* Per-PID buffer and application going away. */
                                if (ret == -LTTNG_ERR_CHAN_NOT_FOUND)
@@ -7512,8 +7687,7 @@ error:
        return cmd_ret;
 }
 
-enum lttng_error_code ust_app_create_channel_subdirectories(
-               const struct ltt_ust_session *usess)
+enum lttng_error_code ust_app_create_channel_subdirectories(const struct ltt_ust_session *usess)
 {
        enum lttng_error_code ret = LTTNG_OK;
        struct lttng_ht_iter iter;
@@ -7529,10 +7703,12 @@ enum lttng_error_code ust_app_create_channel_subdirectories(
        {
                struct buffer_reg_uid *reg;
 
-               cds_list_for_each_entry(reg, &usess->buffer_reg_uid_list, lnode) {
+               cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        fmt_ret = asprintf(&pathname_index,
-                                      DEFAULT_UST_TRACE_DIR "/" DEFAULT_UST_TRACE_UID_PATH "/" DEFAULT_INDEX_DIR,
-                                      reg->uid, reg->bits_per_long);
+                                          DEFAULT_UST_TRACE_DIR "/" DEFAULT_UST_TRACE_UID_PATH
+                                                                "/" DEFAULT_INDEX_DIR,
+                                          reg->uid,
+                                          reg->bits_per_long);
                        if (fmt_ret < 0) {
                                ERR("Failed to format channel index directory");
                                ret = LTTNG_ERR_CREATE_DIR_FAIL;
@@ -7544,8 +7720,7 @@ enum lttng_error_code ust_app_create_channel_subdirectories(
                         * of implicitly creating the channel's path.
                         */
                        chunk_status = lttng_trace_chunk_create_subdirectory(
-                                       usess->current_trace_chunk,
-                                       pathname_index);
+                               usess->current_trace_chunk, pathname_index);
                        free(pathname_index);
                        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                                ret = LTTNG_ERR_CREATE_DIR_FAIL;
@@ -7561,16 +7736,14 @@ enum lttng_error_code ust_app_create_channel_subdirectories(
                /*
                 * Create the toplevel ust/ directory in case no apps are running.
                 */
-               chunk_status = lttng_trace_chunk_create_subdirectory(
-                               usess->current_trace_chunk,
-                               DEFAULT_UST_TRACE_DIR);
+               chunk_status = lttng_trace_chunk_create_subdirectory(usess->current_trace_chunk,
+                                                                    DEFAULT_UST_TRACE_DIR);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ret = LTTNG_ERR_CREATE_DIR_FAIL;
                        goto error;
                }
 
-               cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app,
-                               pid_n.node) {
+               cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        struct ust_app_session *ua_sess;
                        lsu::registry_session *registry;
 
@@ -7587,8 +7760,8 @@ enum lttng_error_code ust_app_create_channel_subdirectories(
                        }
 
                        fmt_ret = asprintf(&pathname_index,
-                                       DEFAULT_UST_TRACE_DIR "/%s/" DEFAULT_INDEX_DIR,
-                                       ua_sess->path);
+                                          DEFAULT_UST_TRACE_DIR "/%s/" DEFAULT_INDEX_DIR,
+                                          ua_sess->path);
                        if (fmt_ret < 0) {
                                ERR("Failed to format channel index directory");
                                ret = LTTNG_ERR_CREATE_DIR_FAIL;
@@ -7599,8 +7772,7 @@ enum lttng_error_code ust_app_create_channel_subdirectories(
                         * of implicitly creating the channel's path.
                         */
                        chunk_status = lttng_trace_chunk_create_subdirectory(
-                                       usess->current_trace_chunk,
-                                       pathname_index);
+                               usess->current_trace_chunk, pathname_index);
                        free(pathname_index);
                        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                                ret = LTTNG_ERR_CREATE_DIR_FAIL;
@@ -7647,23 +7819,22 @@ enum lttng_error_code ust_app_clear_session(struct ltt_session *session)
        {
                struct buffer_reg_uid *reg;
 
-               cds_list_for_each_entry(reg, &usess->buffer_reg_uid_list, lnode) {
+               cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        struct buffer_reg_channel *buf_reg_chan;
                        struct consumer_socket *socket;
 
                        /* Get consumer socket to use to push the metadata.*/
                        socket = consumer_find_socket_by_bitness(reg->bits_per_long,
-                                       usess->consumer);
+                                                                usess->consumer);
                        if (!socket) {
                                cmd_ret = LTTNG_ERR_INVALID;
                                goto error_socket;
                        }
 
                        /* Clear the data channels. */
-                       cds_lfht_for_each_entry(reg->registry->channels->ht, &iter.iter,
-                                       buf_reg_chan, node.node) {
-                               ret = consumer_clear_channel(socket,
-                                               buf_reg_chan->consumer_key);
+                       cds_lfht_for_each_entry (
+                               reg->registry->channels->ht, &iter.iter, buf_reg_chan, node.node) {
+                               ret = consumer_clear_channel(socket, buf_reg_chan->consumer_key);
                                if (ret < 0) {
                                        goto error;
                                }
@@ -7679,8 +7850,7 @@ enum lttng_error_code ust_app_clear_session(struct ltt_session *session)
                         * Metadata channel is not cleared per se but we still need to
                         * perform a rotation operation on it behind the scene.
                         */
-                       ret = consumer_clear_channel(socket,
-                                       reg->registry->reg.ust->_metadata_key);
+                       ret = consumer_clear_channel(socket, reg->registry->reg.ust->_metadata_key);
                        if (ret < 0) {
                                goto error;
                        }
@@ -7689,7 +7859,7 @@ enum lttng_error_code ust_app_clear_session(struct ltt_session *session)
        }
        case LTTNG_BUFFER_PER_PID:
        {
-               cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+               cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        struct consumer_socket *socket;
                        struct lttng_ht_iter chan_iter;
                        struct ust_app_channel *ua_chan;
@@ -7704,7 +7874,7 @@ enum lttng_error_code ust_app_clear_session(struct ltt_session *session)
 
                        /* Get the right consumer socket for the application. */
                        socket = consumer_find_socket_by_bitness(app->abi.bits_per_long,
-                                       usess->consumer);
+                                                                usess->consumer);
                        if (!socket) {
                                cmd_ret = LTTNG_ERR_INVALID;
                                goto error_socket;
@@ -7717,8 +7887,8 @@ enum lttng_error_code ust_app_clear_session(struct ltt_session *session)
                        }
 
                        /* Clear the data channels. */
-                       cds_lfht_for_each_entry(ua_sess->channels->ht, &chan_iter.iter,
-                                       ua_chan, node.node) {
+                       cds_lfht_for_each_entry (
+                               ua_sess->channels->ht, &chan_iter.iter, ua_chan, node.node) {
                                ret = consumer_clear_channel(socket, ua_chan->key);
                                if (ret < 0) {
                                        /* Per-PID buffer and application going away. */
@@ -7804,24 +7974,21 @@ enum lttng_error_code ust_app_open_packets(struct ltt_session *session)
        {
                struct buffer_reg_uid *reg;
 
-               cds_list_for_each_entry (
-                               reg, &usess->buffer_reg_uid_list, lnode) {
+               cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        struct buffer_reg_channel *buf_reg_chan;
                        struct consumer_socket *socket;
 
-                       socket = consumer_find_socket_by_bitness(
-                                       reg->bits_per_long, usess->consumer);
+                       socket = consumer_find_socket_by_bitness(reg->bits_per_long,
+                                                                usess->consumer);
                        if (!socket) {
                                ret = LTTNG_ERR_FATAL;
                                goto error;
                        }
 
-                       cds_lfht_for_each_entry(reg->registry->channels->ht,
-                                       &iter.iter, buf_reg_chan, node.node) {
-                               const int open_ret =
-                                               consumer_open_channel_packets(
-                                                       socket,
-                                                       buf_reg_chan->consumer_key);
+                       cds_lfht_for_each_entry (
+                               reg->registry->channels->ht, &iter.iter, buf_reg_chan, node.node) {
+                               const int open_ret = consumer_open_channel_packets(
+                                       socket, buf_reg_chan->consumer_key);
 
                                if (open_ret < 0) {
                                        ret = LTTNG_ERR_UNK;
@@ -7835,8 +8002,7 @@ enum lttng_error_code ust_app_open_packets(struct ltt_session *session)
        {
                struct ust_app *app;
 
-               cds_lfht_for_each_entry (
-                               ust_app_ht->ht, &iter.iter, app, pid_n.node) {
+               cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        struct consumer_socket *socket;
                        struct lttng_ht_iter chan_iter;
                        struct ust_app_channel *ua_chan;
@@ -7850,8 +8016,8 @@ enum lttng_error_code ust_app_open_packets(struct ltt_session *session)
                        }
 
                        /* Get the right consumer socket for the application. */
-                       socket = consumer_find_socket_by_bitness(
-                                       app->abi.bits_per_long, usess->consumer);
+                       socket = consumer_find_socket_by_bitness(app->abi.bits_per_long,
+                                                                usess->consumer);
                        if (!socket) {
                                ret = LTTNG_ERR_FATAL;
                                goto error;
@@ -7863,12 +8029,10 @@ enum lttng_error_code ust_app_open_packets(struct ltt_session *session)
                                continue;
                        }
 
-                       cds_lfht_for_each_entry(ua_sess->channels->ht,
-                                       &chan_iter.iter, ua_chan, node.node) {
+                       cds_lfht_for_each_entry (
+                               ua_sess->channels->ht, &chan_iter.iter, ua_chan, node.node) {
                                const int open_ret =
-                                               consumer_open_channel_packets(
-                                                       socket,
-                                                       ua_chan->key);
+                                       consumer_open_channel_packets(socket, ua_chan->key);
 
                                if (open_ret < 0) {
                                        /*
@@ -7920,5 +8084,5 @@ lsu::ctl_field_quirks ust_app::ctl_field_quirks() const
         * correctly match, making this quirk unnecessary.
         */
        return v_major <= 9 ? lsu::ctl_field_quirks::UNDERSCORE_PREFIXED_VARIANT_TAG_MAPPINGS :
-               lsu::ctl_field_quirks::NONE;
+                             lsu::ctl_field_quirks::NONE;
 }
\ No newline at end of file
index 34b466f0a849332ee8fc89cd84fef16693d55bab..b4a8e208bc28e665855d667a9b6b9dc7b981279c 100644 (file)
@@ -9,12 +9,12 @@
 
 #include "ust-clock-class.hpp"
 
-#include <common/time.hpp>
 #include <common/exception.hpp>
+#include <common/time.hpp>
 
 #include <lttng/ust-clock.h>
 
-#define CLOCK_OFFSET_SAMPLE_COUNT              10
+#define CLOCK_OFFSET_SAMPLE_COUNT 10
 
 namespace lst = lttng::sessiond::trace;
 
@@ -66,7 +66,7 @@ nonstd::optional<lttng_uuid> sample_clock_uuid()
                LTTNG_THROW_ERROR("Failed to parse UUID from string");
        }
 
-       return nonstd::optional<lttng_uuid>{uuid};
+       return nonstd::optional<lttng_uuid>{ uuid };
 }
 
 const char *sample_clock_name()
@@ -79,7 +79,8 @@ const char *sample_clock_name()
 
        const auto name = get_name_cb();
        if (!name) {
-               LTTNG_THROW_ERROR("Invalid clock name returned by LTTng-UST `lttng_ust_clock_name_function`");
+               LTTNG_THROW_ERROR(
+                       "Invalid clock name returned by LTTng-UST `lttng_ust_clock_name_function`");
        }
 
        return name;
@@ -95,7 +96,8 @@ const char *sample_clock_description()
 
        const auto description = get_description_cb();
        if (!description) {
-               LTTNG_THROW_ERROR("Invalid clock description returned by LTTng-UST `lttng_ust_clock_description_function`");
+               LTTNG_THROW_ERROR(
+                       "Invalid clock description returned by LTTng-UST `lttng_ust_clock_description_function`");
        }
 
        return description;
@@ -107,8 +109,7 @@ const char *sample_clock_description()
  */
 void measure_single_clock_offset(struct offset_sample *sample)
 {
-       lst::clock_class::cycles_t monotonic_avg, monotonic[2], measure_delta,
-                       realtime;
+       lst::clock_class::cycles_t monotonic_avg, monotonic[2], measure_delta, realtime;
        const auto tcf = sample_clock_frequency();
        struct timespec rts = { 0, 0 };
 
@@ -132,8 +133,7 @@ void measure_single_clock_offset(struct offset_sample *sample)
        if (tcf == NSEC_PER_SEC) {
                realtime += rts.tv_nsec;
        } else {
-               realtime += (lst::clock_class::cycles_t) rts.tv_nsec * tcf /
-                               NSEC_PER_SEC;
+               realtime += (lst::clock_class::cycles_t) rts.tv_nsec * tcf / NSEC_PER_SEC;
        }
 
        sample->offset = (lst::clock_class::scycles_t) realtime - monotonic_avg;
@@ -163,9 +163,9 @@ lst::clock_class::scycles_t measure_clock_offset(void)
 
 lttng::sessiond::ust::clock_class::clock_class() :
        lst::clock_class(sample_clock_name(),
-                       sample_clock_description(),
-                       sample_clock_uuid(),
-                       measure_clock_offset(),
-                       sample_clock_frequency())
+                        sample_clock_description(),
+                        sample_clock_uuid(),
+                        measure_clock_offset(),
+                        sample_clock_frequency())
 {
 }
index ef61cfc7e0f00271e5babb82b2c0f7e19118d0de..6b646fb941c767b1e4bdbd546619625f6c1186f3 100644 (file)
@@ -6,24 +6,24 @@
  */
 
 #define _LGPL_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <inttypes.h>
+#include "buffer-registry.hpp"
+#include "consumer.hpp"
+#include "health-sessiond.hpp"
+#include "lttng-sessiond.hpp"
+#include "lttng-ust-error.hpp"
+#include "session.hpp"
+#include "ust-consumer.hpp"
 
-#include <common/compat/errno.hpp>
 #include <common/common.hpp>
+#include <common/compat/errno.hpp>
 #include <common/consumer/consumer.hpp>
 #include <common/defaults.hpp>
 
-#include "consumer.hpp"
-#include "health-sessiond.hpp"
-#include "ust-consumer.hpp"
-#include "lttng-ust-error.hpp"
-#include "buffer-registry.hpp"
-#include "session.hpp"
-#include "lttng-sessiond.hpp"
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
 namespace lsu = lttng::sessiond::ust;
 
@@ -33,11 +33,11 @@ namespace lsu = lttng::sessiond::ust;
  * Consumer socket lock MUST be acquired before calling this.
  */
 static int ask_channel_creation(struct ust_app_session *ua_sess,
-               struct ust_app_channel *ua_chan,
-               struct consumer_output *consumer,
-               struct consumer_socket *socket,
-               lsu::registry_session *registry,
-               struct lttng_trace_chunk *trace_chunk)
+                               struct ust_app_channel *ua_chan,
+                               struct consumer_output *consumer,
+                               struct consumer_socket *socket,
+                               lsu::registry_session *registry,
+                               struct lttng_trace_chunk *trace_chunk)
 {
        int ret, output;
        uint32_t chan_id;
@@ -59,8 +59,7 @@ static int ask_channel_creation(struct ust_app_session *ua_sess,
 
        is_local_trace = consumer->net_seq_index == -1ULL;
        /* Format the channel's path (relative to the current trace chunk). */
-       pathname = setup_channel_trace_path(consumer, ua_sess->path,
-                       &consumer_path_offset);
+       pathname = setup_channel_trace_path(consumer, ua_sess->path, &consumer_path_offset);
        if (!pathname) {
                ret = -1;
                goto error;
@@ -70,8 +69,7 @@ static int ask_channel_creation(struct ust_app_session *ua_sess,
                enum lttng_trace_chunk_status chunk_status;
                char *pathname_index;
 
-               ret = asprintf(&pathname_index, "%s/" DEFAULT_INDEX_DIR,
-                               pathname);
+               ret = asprintf(&pathname_index, "%s/" DEFAULT_INDEX_DIR, pathname);
                if (ret < 0) {
                        ERR("Failed to format channel index directory");
                        ret = -1;
@@ -82,8 +80,7 @@ static int ask_channel_creation(struct ust_app_session *ua_sess,
                 * Create the index subdirectory which will take care
                 * of implicitly creating the channel's path.
                 */
-               chunk_status = lttng_trace_chunk_create_subdirectory(
-                               trace_chunk, pathname_index);
+               chunk_status = lttng_trace_chunk_create_subdirectory(trace_chunk, pathname_index);
                free(pathname_index);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ret = -1;
@@ -116,12 +113,9 @@ static int ask_channel_creation(struct ust_app_session *ua_sess,
                if (ua_sess->shm_path[0]) {
                        strncpy(shm_path, ua_sess->shm_path, sizeof(shm_path));
                        shm_path[sizeof(shm_path) - 1] = '\0';
-                       strncat(shm_path, "/",
-                               sizeof(shm_path) - strlen(shm_path) - 1);
-                       strncat(shm_path, ua_chan->name,
-                                       sizeof(shm_path) - strlen(shm_path) - 1);
-                               strncat(shm_path, "_",
-                                       sizeof(shm_path) - strlen(shm_path) - 1);
+                       strncat(shm_path, "/", sizeof(shm_path) - strlen(shm_path) - 1);
+                       strncat(shm_path, ua_chan->name, sizeof(shm_path) - strlen(shm_path) - 1);
+                       strncat(shm_path, "_", sizeof(shm_path) - strlen(shm_path) - 1);
                }
                strncpy(root_shm_path, ua_sess->root_shm_path, sizeof(root_shm_path));
                root_shm_path[sizeof(root_shm_path) - 1] = '\0';
@@ -135,32 +129,33 @@ static int ask_channel_creation(struct ust_app_session *ua_sess,
        }
 
        consumer_init_ask_channel_comm_msg(&msg,
-                       ua_chan->attr.subbuf_size,
-                       ua_chan->attr.num_subbuf,
-                       ua_chan->attr.overwrite,
-                       ua_chan->attr.switch_timer_interval,
-                       ua_chan->attr.read_timer_interval,
-                       ua_sess->live_timer_interval,
-                       ua_sess->live_timer_interval != 0,
-                       ua_chan->monitor_timer_interval,
-                       output,
-                       (int) ua_chan->attr.type,
-                       ua_sess->tracing_id,
-                       &pathname[consumer_path_offset],
-                       ua_chan->name,
-                       consumer->net_seq_index,
-                       ua_chan->key,
-                       registry->uuid,
-                       chan_id,
-                       ua_chan->tracefile_size,
-                       ua_chan->tracefile_count,
-                       ua_sess->id,
-                       ua_sess->output_traces,
-                       lttng_credentials_get_uid(&ua_sess->real_credentials),
-                       ua_chan->attr.blocking_timeout,
-                       root_shm_path, shm_path,
-                       trace_chunk,
-                       &ua_sess->effective_credentials);
+                                          ua_chan->attr.subbuf_size,
+                                          ua_chan->attr.num_subbuf,
+                                          ua_chan->attr.overwrite,
+                                          ua_chan->attr.switch_timer_interval,
+                                          ua_chan->attr.read_timer_interval,
+                                          ua_sess->live_timer_interval,
+                                          ua_sess->live_timer_interval != 0,
+                                          ua_chan->monitor_timer_interval,
+                                          output,
+                                          (int) ua_chan->attr.type,
+                                          ua_sess->tracing_id,
+                                          &pathname[consumer_path_offset],
+                                          ua_chan->name,
+                                          consumer->net_seq_index,
+                                          ua_chan->key,
+                                          registry->uuid,
+                                          chan_id,
+                                          ua_chan->tracefile_size,
+                                          ua_chan->tracefile_count,
+                                          ua_sess->id,
+                                          ua_sess->output_traces,
+                                          lttng_credentials_get_uid(&ua_sess->real_credentials),
+                                          ua_chan->attr.blocking_timeout,
+                                          root_shm_path,
+                                          shm_path,
+                                          trace_chunk,
+                                          &ua_sess->effective_credentials);
 
        health_code_update();
 
@@ -169,8 +164,7 @@ static int ask_channel_creation(struct ust_app_session *ua_sess,
                goto error;
        }
 
-       ret = consumer_recv_status_channel(socket, &key,
-                       &ua_chan->expected_stream_count);
+       ret = consumer_recv_status_channel(socket, &key, &ua_chan->expected_stream_count);
        if (ret < 0) {
                goto error;
        }
@@ -181,8 +175,9 @@ static int ask_channel_creation(struct ust_app_session *ua_sess,
                LTTNG_ASSERT(ua_chan->expected_stream_count > 0);
        }
 
-       DBG2("UST ask channel %" PRIu64 " successfully done with %u stream(s)", key,
-                       ua_chan->expected_stream_count);
+       DBG2("UST ask channel %" PRIu64 " successfully done with %u stream(s)",
+            key,
+            ua_chan->expected_stream_count);
 
 error:
        free(pathname);
@@ -198,11 +193,11 @@ error:
  * Returns 0 on success else a negative value.
  */
 int ust_consumer_ask_channel(struct ust_app_session *ua_sess,
-               struct ust_app_channel *ua_chan,
-               struct consumer_output *consumer,
-               struct consumer_socket *socket,
-               lsu::registry_session *registry,
-               struct lttng_trace_chunk * trace_chunk)
+                            struct ust_app_channel *ua_chan,
+                            struct consumer_output *consumer,
+                            struct consumer_socket *socket,
+                            lsu::registry_session *registry,
+                            struct lttng_trace_chunk *trace_chunk)
 {
        int ret;
 
@@ -219,8 +214,7 @@ int ust_consumer_ask_channel(struct ust_app_session *ua_sess,
        }
 
        pthread_mutex_lock(socket->lock);
-       ret = ask_channel_creation(ua_sess, ua_chan, consumer, socket, registry,
-                       trace_chunk);
+       ret = ask_channel_creation(ua_sess, ua_chan, consumer, socket, registry, trace_chunk);
        pthread_mutex_unlock(socket->lock);
        if (ret < 0) {
                ERR("ask_channel_creation consumer command failed");
@@ -237,8 +231,7 @@ error:
  *
  * Return 0 on success else a negative value.
  */
-int ust_consumer_get_channel(struct consumer_socket *socket,
-               struct ust_app_channel *ua_chan)
+int ust_consumer_get_channel(struct consumer_socket *socket, struct ust_app_channel *ua_chan)
 {
        int ret;
        struct lttcomm_consumer_msg msg;
@@ -264,7 +257,8 @@ int ust_consumer_get_channel(struct consumer_socket *socket,
        if (ret < 0) {
                if (ret != -EPIPE) {
                        ERR("Error recv channel from consumer %d with ret %d",
-                                       *socket->fd_ptr, ret);
+                           *socket->fd_ptr,
+                           ret);
                } else {
                        DBG3("UST app recv channel from consumer. Consumer is dead.");
                }
@@ -292,7 +286,8 @@ int ust_consumer_get_channel(struct consumer_socket *socket,
                        }
                        if (ret != -EPIPE) {
                                ERR("Recv stream from consumer %d with ret %d",
-                                               *socket->fd_ptr, ret);
+                                   *socket->fd_ptr,
+                                   ret);
                        } else {
                                DBG3("UST app recv stream from consumer. Consumer is dead.");
                        }
@@ -331,8 +326,7 @@ error:
  *
  * Return 0 on success else a negative value.
  */
-int ust_consumer_destroy_channel(struct consumer_socket *socket,
-               struct ust_app_channel *ua_chan)
+int ust_consumer_destroy_channel(struct consumer_socket *socket, struct ust_app_channel *ua_chan)
 {
        int ret;
        struct lttcomm_consumer_msg msg;
@@ -364,7 +358,8 @@ error:
  * On success return 0 else a negative value.
  */
 int ust_consumer_send_stream_to_ust(struct ust_app *app,
-               struct ust_app_channel *channel, struct ust_app_stream *stream)
+                                   struct ust_app_channel *channel,
+                                   struct ust_app_stream *stream)
 {
        int ret;
 
@@ -381,14 +376,18 @@ int ust_consumer_send_stream_to_ust(struct ust_app *app,
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        DBG3("UST app send stream to ust failed. Application is dead. (pid: %d, sock: %d).",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        WARN("UST app send stream to ust failed. Communication time out (pid: %d, sock: %d).",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app send stream, handle %d, to ust failed with ret %d (pid: %d, sock: %d).",
-                                       stream->obj->handle, ret, app->pid,
-                                       app->sock);
+                           stream->obj->handle,
+                           ret,
+                           app->pid,
+                           app->sock);
                }
                goto error;
        }
@@ -404,7 +403,8 @@ error:
  * On success return 0 else a negative value.
  */
 int ust_consumer_send_channel_to_ust(struct ust_app *app,
-               struct ust_app_session *ua_sess, struct ust_app_channel *channel)
+                                    struct ust_app_session *ua_sess,
+                                    struct ust_app_channel *channel)
 {
        int ret;
 
@@ -414,7 +414,10 @@ int ust_consumer_send_channel_to_ust(struct ust_app *app,
        LTTNG_ASSERT(channel->obj);
 
        DBG2("UST app send channel to sock %d pid %d (name: %s, key: %" PRIu64 ")",
-                       app->sock, app->pid, channel->name, channel->tracing_channel_id);
+            app->sock,
+            app->pid,
+            channel->name,
+            channel->tracing_channel_id);
 
        /* Send stream to application. */
        pthread_mutex_lock(&app->sock_lock);
@@ -423,14 +426,18 @@ int ust_consumer_send_channel_to_ust(struct ust_app *app,
        if (ret < 0) {
                if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) {
                        DBG3("UST app send channel to ust failed. Application is dead (pid: %d, sock: %d).",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else if (ret == -EAGAIN) {
                        WARN("UST app send channel to ust failed. Communication timeout (pid: %d, sock: %d).",
-                                       app->pid, app->sock);
+                            app->pid,
+                            app->sock);
                } else {
                        ERR("UST app send channel %s, to ust failed with ret %d (pid: %d, sock: %d).",
-                                       channel->name, ret, app->pid,
-                                       app->sock);
+                           channel->name,
+                           ret,
+                           app->pid,
+                           app->sock);
                }
                goto error;
        }
@@ -467,18 +474,17 @@ int ust_consumer_metadata_request(struct consumer_socket *socket)
        }
 
        DBG("Metadata request received for session %" PRIu64 ", key %" PRIu64,
-                       request.session_id, request.key);
+           request.session_id,
+           request.key);
 
-       reg_uid = buffer_reg_uid_find(request.session_id,
-                       request.bits_per_long, request.uid);
+       reg_uid = buffer_reg_uid_find(request.session_id, request.bits_per_long, request.uid);
        if (reg_uid) {
                ust_reg = reg_uid->registry->reg.ust;
        } else {
-               struct buffer_reg_pid *reg_pid =
-                       buffer_reg_pid_find(request.session_id_per_pid);
+               struct buffer_reg_pid *reg_pid = buffer_reg_pid_find(request.session_id_per_pid);
                if (!reg_pid) {
                        DBG("PID registry not found for session id %" PRIu64,
-                                       request.session_id_per_pid);
+                           request.session_id_per_pid);
 
                        memset(&msg, 0, sizeof(msg));
                        msg.cmd_type = LTTNG_ERR_UND;
index e7e5d392452bc5c383f2d8fc6d8d2627fd50069e..0c713c21ba56c85a51c00d17f44ad40cec651bea 100644 (file)
@@ -24,12 +24,13 @@ namespace {
 class session_attributes {
 public:
        using registry_enum_getter_fn =
-                       std::function<lsu::registry_enum::const_rcu_protected_reference(
-                                       const char *name, uint64_t id)>;
+               std::function<lsu::registry_enum::const_rcu_protected_reference(const char *name,
+                                                                               uint64_t id)>;
 
        session_attributes(registry_enum_getter_fn reg_enum_getter,
-                       lst::byte_order native_trace_byte_order) :
-               get_registry_enum{reg_enum_getter}, _native_trace_byte_order{native_trace_byte_order}
+                          lst::byte_order native_trace_byte_order) :
+               get_registry_enum{ reg_enum_getter },
+               _native_trace_byte_order{ native_trace_byte_order }
        {
        }
 
@@ -41,44 +42,47 @@ public:
 using publish_field_fn = std::function<void(lst::field::uptr)>;
 
 /* Look-up field from a field location. */
-using lookup_field_fn = std::function<const lst::field &(const lst::field_location &)>;
-
-lst::type::cuptr create_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes,
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               publish_field_fn publish_field,
-               lookup_field_fn lookup_field,
-               lst::field_location::root lookup_root,
-               lst::field_location::elements& current_field_location_elements,
-               lsu::ctl_field_quirks quirks);
+using lookup_field_fn = std::function<const lst::field&(const lst::field_location&)>;
+
+lst::type::cuptr
+create_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
+                               const lttng_ust_ctl_field *end,
+                               const session_attributes& session_attributes,
+                               const lttng_ust_ctl_field **next_ust_ctl_field,
+                               publish_field_fn publish_field,
+                               lookup_field_fn lookup_field,
+                               lst::field_location::root lookup_root,
+                               lst::field_location::elements& current_field_location_elements,
+                               lsu::ctl_field_quirks quirks);
 
 void create_field_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes,
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               publish_field_fn publish_field,
-               lookup_field_fn lookup_field,
-               lst::field_location::root lookup_root,
-               lst::field_location::elements& current_field_location_elements,
-               lsu::ctl_field_quirks quirks);
+                                     const lttng_ust_ctl_field *end,
+                                     const session_attributes& session_attributes,
+                                     const lttng_ust_ctl_field **next_ust_ctl_field,
+                                     publish_field_fn publish_field,
+                                     lookup_field_fn lookup_field,
+                                     lst::field_location::root lookup_root,
+                                     lst::field_location::elements& current_field_location_elements,
+                                     lsu::ctl_field_quirks quirks);
 
 template <class UstCtlEncodingType>
-enum lst::null_terminated_string_type::encoding ust_ctl_encoding_to_string_field_encoding(UstCtlEncodingType encoding)
+enum lst::null_terminated_string_type::encoding
+ust_ctl_encoding_to_string_field_encoding(UstCtlEncodingType encoding)
 {
-       static const std::unordered_map<UstCtlEncodingType, enum lst::null_terminated_string_type::encoding>
-                       encoding_conversion_map = {
-                                       {(UstCtlEncodingType) lttng_ust_ctl_encode_ASCII,
-                                                       lst::null_terminated_string_type::encoding::ASCII},
-                                       {(UstCtlEncodingType) lttng_ust_ctl_encode_UTF8,
-                                                       lst::null_terminated_string_type::encoding::UTF8},
-                       };
+       static const std::unordered_map<UstCtlEncodingType,
+                                       enum lst::null_terminated_string_type::encoding>
+               encoding_conversion_map = {
+                       { (UstCtlEncodingType) lttng_ust_ctl_encode_ASCII,
+                         lst::null_terminated_string_type::encoding::ASCII },
+                       { (UstCtlEncodingType) lttng_ust_ctl_encode_UTF8,
+                         lst::null_terminated_string_type::encoding::UTF8 },
+               };
 
        const auto encoding_it = encoding_conversion_map.find(encoding);
        if (encoding_it == encoding_conversion_map.end()) {
                LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                               "Unknown lttng_ust_ctl_string_encodings value `{}` encountered when decoding integer field",
-                               encoding));
+                       "Unknown lttng_ust_ctl_string_encodings value `{}` encountered when decoding integer field",
+                       encoding));
        }
 
        return encoding_it->second;
@@ -88,106 +92,111 @@ template <class UstCtlBaseType>
 enum lst::integer_type::base ust_ctl_base_to_integer_field_base(UstCtlBaseType base)
 {
        static const std::unordered_map<UstCtlBaseType, enum lst::integer_type::base>
-                       base_conversion_map = {{2, lst::integer_type::base::BINARY},
-                                       {8, lst::integer_type::base::OCTAL},
-                                       {10, lst::integer_type::base::DECIMAL},
-                                       {16, lst::integer_type::base::HEXADECIMAL}};
+               base_conversion_map = { { 2, lst::integer_type::base::BINARY },
+                                       { 8, lst::integer_type::base::OCTAL },
+                                       { 10, lst::integer_type::base::DECIMAL },
+                                       { 16, lst::integer_type::base::HEXADECIMAL } };
 
        const auto base_it = base_conversion_map.find(base);
        if (base_it == base_conversion_map.end()) {
                LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                               "Unknown integer base value `{}` encountered when decoding integer field",
-                               base));
+                       "Unknown integer base value `{}` encountered when decoding integer field",
+                       base));
        }
 
        return base_it->second;
 }
 
-lst::type::cuptr create_integer_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes,
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               lsu::ctl_field_quirks quirks __attribute__((unused)))
+lst::type::cuptr
+create_integer_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
+                                       const lttng_ust_ctl_field *end,
+                                       const session_attributes& session_attributes,
+                                       const lttng_ust_ctl_field **next_ust_ctl_field,
+                                       lsu::ctl_field_quirks quirks __attribute__((unused)))
 {
        if (current >= end) {
-               LTTNG_THROW_PROTOCOL_ERROR(
-                               fmt::format("End of {} array reached unexpectedly during decoding",
-                                               typeid(*current)));
+               LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
+                       "End of {} array reached unexpectedly during decoding", typeid(*current)));
        }
 
        const auto base = ust_ctl_base_to_integer_field_base(current->type.u.integer.base);
        const auto signedness = current->type.u.integer.signedness ?
-                       lst::integer_type::signedness::SIGNED :
-                             lst::integer_type::signedness::UNSIGNED;
+               lst::integer_type::signedness::SIGNED :
+               lst::integer_type::signedness::UNSIGNED;
        const auto byte_order = current->type.u.integer.reverse_byte_order ?
-                       lst::type::reverse_byte_order(session_attributes._native_trace_byte_order) :
-                             session_attributes._native_trace_byte_order;
+               lst::type::reverse_byte_order(session_attributes._native_trace_byte_order) :
+               session_attributes._native_trace_byte_order;
 
        *next_ust_ctl_field = current + 1;
 
        return lttng::make_unique<const lst::integer_type>(current->type.u.integer.alignment,
-                       byte_order, current->type.u.integer.size, signedness, base);
+                                                          byte_order,
+                                                          current->type.u.integer.size,
+                                                          signedness,
+                                                          base);
 }
 
-lst::type::cuptr create_floating_point_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes,
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               lsu::ctl_field_quirks quirks __attribute__((unused)))
+lst::type::cuptr
+create_floating_point_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
+                                              const lttng_ust_ctl_field *end,
+                                              const session_attributes& session_attributes,
+                                              const lttng_ust_ctl_field **next_ust_ctl_field,
+                                              lsu::ctl_field_quirks quirks __attribute__((unused)))
 {
        if (current >= end) {
-               LTTNG_THROW_PROTOCOL_ERROR(
-                               fmt::format("End of {} array reached unexpectedly during decoding",
-                                               typeid(*current)));
+               LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
+                       "End of {} array reached unexpectedly during decoding", typeid(*current)));
        }
 
        *next_ust_ctl_field = current + 1;
 
        const auto byte_order = current->type.u._float.reverse_byte_order ?
-                       lst::type::reverse_byte_order(session_attributes._native_trace_byte_order) :
-                             session_attributes._native_trace_byte_order;
+               lst::type::reverse_byte_order(session_attributes._native_trace_byte_order) :
+               session_attributes._native_trace_byte_order;
 
        try {
                return lttng::make_unique<const lst::floating_point_type>(
-                               current->type.u._float.alignment, byte_order,
-                               current->type.u._float.exp_dig, current->type.u._float.mant_dig);
+                       current->type.u._float.alignment,
+                       byte_order,
+                       current->type.u._float.exp_dig,
+                       current->type.u._float.mant_dig);
        } catch (lttng::invalid_argument_error& ex) {
-               LTTNG_THROW_PROTOCOL_ERROR(fmt::format("Invalid floating point attribute in {}: {}",
-                               typeid(*current), ex.what()));
+               LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
+                       "Invalid floating point attribute in {}: {}", typeid(*current), ex.what()));
        }
 }
 
-lst::type::cuptr create_enumeration_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes,
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               lsu::ctl_field_quirks quirks __attribute__((unused)))
+lst::type::cuptr
+create_enumeration_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
+                                           const lttng_ust_ctl_field *end,
+                                           const session_attributes& session_attributes,
+                                           const lttng_ust_ctl_field **next_ust_ctl_field,
+                                           lsu::ctl_field_quirks quirks __attribute__((unused)))
 {
        if (current >= end) {
-               LTTNG_THROW_PROTOCOL_ERROR(
-                               fmt::format("End of {} array reached unexpectedly during decoding",
-                                               typeid(*current)));
+               LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
+                       "End of {} array reached unexpectedly during decoding", typeid(*current)));
        }
 
        uint64_t enumeration_id;
        const auto& enum_uctl_field = *current;
        const char *enumeration_name;
        const auto *enum_container_uctl_type =
-                       &current->type.u.legacy.basic.enumeration.container_type;
+               &current->type.u.legacy.basic.enumeration.container_type;
 
        if (enum_uctl_field.type.atype == lttng_ust_ctl_atype_enum_nestable) {
                /* Nestable enumeration fields are followed by their container type. */
                ++current;
                if (current >= end) {
                        LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                                       "Array of {} is too short to contain nestable enumeration's container",
-                                       typeid(*current)));
+                               "Array of {} is too short to contain nestable enumeration's container",
+                               typeid(*current)));
                }
 
                if (current->type.atype != lttng_ust_ctl_atype_integer) {
-                       LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                                       "Invalid type of nestable enum container: type id = {}",
-                                       current->type.atype));
+                       LTTNG_THROW_PROTOCOL_ERROR(
+                               fmt::format("Invalid type of nestable enum container: type id = {}",
+                                           current->type.atype));
                }
 
                enum_container_uctl_type = &current->type.u.integer;
@@ -202,86 +211,88 @@ lst::type::cuptr create_enumeration_type_from_ust_ctl_fields(const lttng_ust_ctl
 
        const auto base = ust_ctl_base_to_integer_field_base(enum_container_uctl_type->base);
        const auto byte_order = enum_container_uctl_type->reverse_byte_order ?
-                       lst::integer_type::reverse_byte_order(
-                                       session_attributes._native_trace_byte_order) :
-                             session_attributes._native_trace_byte_order;
+               lst::integer_type::reverse_byte_order(session_attributes._native_trace_byte_order) :
+               session_attributes._native_trace_byte_order;
        const auto signedness = enum_container_uctl_type->signedness ?
-                       lst::integer_type::signedness::SIGNED :
-                             lst::integer_type::signedness::UNSIGNED;
+               lst::integer_type::signedness::SIGNED :
+               lst::integer_type::signedness::UNSIGNED;
 
        if (signedness == lst::integer_type::signedness::SIGNED) {
                const auto& enum_registry = static_cast<const lsu::registry_signed_enum&>(
-                               *session_attributes.get_registry_enum(
-                                               enumeration_name, enumeration_id));
+                       *session_attributes.get_registry_enum(enumeration_name, enumeration_id));
 
                return lttng::make_unique<const lst::signed_enumeration_type>(
-                               enum_container_uctl_type->alignment, byte_order,
-                               enum_container_uctl_type->size, base,
-                               enum_registry._mappings);
+                       enum_container_uctl_type->alignment,
+                       byte_order,
+                       enum_container_uctl_type->size,
+                       base,
+                       enum_registry._mappings);
        } else {
                const auto& enum_registry = static_cast<const lsu::registry_unsigned_enum&>(
-                               *session_attributes.get_registry_enum(
-                                               enumeration_name, enumeration_id));
+                       *session_attributes.get_registry_enum(enumeration_name, enumeration_id));
 
                return lttng::make_unique<const lst::unsigned_enumeration_type>(
-                               enum_container_uctl_type->alignment, byte_order,
-                               enum_container_uctl_type->size, base,
-                               enum_registry._mappings);
+                       enum_container_uctl_type->alignment,
+                       byte_order,
+                       enum_container_uctl_type->size,
+                       base,
+                       enum_registry._mappings);
        }
 }
 
-lst::type::cuptr create_string_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes __attribute__((unused)),
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               lsu::ctl_field_quirks quirks __attribute__((unused)))
+lst::type::cuptr
+create_string_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
+                                      const lttng_ust_ctl_field *end,
+                                      const session_attributes& session_attributes
+                                      __attribute__((unused)),
+                                      const lttng_ust_ctl_field **next_ust_ctl_field,
+                                      lsu::ctl_field_quirks quirks __attribute__((unused)))
 {
        if (current >= end) {
-               LTTNG_THROW_PROTOCOL_ERROR(
-                               fmt::format("End of {} array reached unexpectedly during decoding",
-                                               typeid(*current)));
+               LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
+                       "End of {} array reached unexpectedly during decoding", typeid(*current)));
        }
 
        const auto& string_uctl_field = *current;
        *next_ust_ctl_field = current + 1;
 
-       const auto encoding = ust_ctl_encoding_to_string_field_encoding(
-                       string_uctl_field.type.u.string.encoding);
+       const auto encoding =
+               ust_ctl_encoding_to_string_field_encoding(string_uctl_field.type.u.string.encoding);
 
        return lttng::make_unique<const lst::null_terminated_string_type>(1, encoding);
 }
 
-lst::type::cuptr create_integer_type_from_ust_ctl_basic_type(
-               const lttng_ust_ctl_basic_type& type, const session_attributes& session_attributes)
+lst::type::cuptr
+create_integer_type_from_ust_ctl_basic_type(const lttng_ust_ctl_basic_type& type,
+                                           const session_attributes& session_attributes)
 {
        /* Checked by caller. */
        LTTNG_ASSERT(type.atype == lttng_ust_ctl_atype_integer);
 
        const auto byte_order = type.u.basic.integer.reverse_byte_order ?
-                       lst::integer_type::reverse_byte_order(
-                                       session_attributes._native_trace_byte_order) :
-                             session_attributes._native_trace_byte_order;
+               lst::integer_type::reverse_byte_order(session_attributes._native_trace_byte_order) :
+               session_attributes._native_trace_byte_order;
        const auto signedness = type.u.basic.integer.signedness ?
-                       lst::integer_type::signedness::SIGNED :
-                             lst::integer_type::signedness::UNSIGNED;
+               lst::integer_type::signedness::SIGNED :
+               lst::integer_type::signedness::UNSIGNED;
        const auto base = ust_ctl_base_to_integer_field_base(type.u.basic.integer.base);
        const auto size = type.u.basic.integer.size;
        const auto alignment = type.u.basic.integer.alignment;
 
        return lttng::make_unique<const lst::integer_type>(
-                       alignment, byte_order, size, signedness, base);
+               alignment, byte_order, size, signedness, base);
 }
 
-lst::type::cuptr create_array_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes,
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               lsu::ctl_field_quirks quirks __attribute__((unused)))
+lst::type::cuptr
+create_array_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
+                                     const lttng_ust_ctl_field *end,
+                                     const session_attributes& session_attributes,
+                                     const lttng_ust_ctl_field **next_ust_ctl_field,
+                                     lsu::ctl_field_quirks quirks __attribute__((unused)))
 {
        if (current >= end) {
-               LTTNG_THROW_PROTOCOL_ERROR(
-                               fmt::format("End of {} array reached unexpectedly during decoding",
-                                               typeid(*current)));
+               LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
+                       "End of {} array reached unexpectedly during decoding", typeid(*current)));
        }
 
        const auto& array_uctl_field = *current;
@@ -295,54 +306,55 @@ lst::type::cuptr create_array_type_from_ust_ctl_fields(const lttng_ust_ctl_field
        const auto& element_uctl_type = array_uctl_field.type.u.legacy.array.elem_type;
        if (element_uctl_type.atype != lttng_ust_ctl_atype_integer) {
                LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                               "Unexpected legacy array element type: atype = {}, expected atype = lttng_ust_ctl_atype_integer ({})",
-                               element_uctl_type.atype, lttng_ust_ctl_atype_integer));
+                       "Unexpected legacy array element type: atype = {}, expected atype = lttng_ust_ctl_atype_integer ({})",
+                       element_uctl_type.atype,
+                       lttng_ust_ctl_atype_integer));
        }
 
-       element_type = create_integer_type_from_ust_ctl_basic_type(
-                       element_uctl_type, session_attributes);
+       element_type =
+               create_integer_type_from_ust_ctl_basic_type(element_uctl_type, session_attributes);
        if (element_uctl_type.atype == lttng_ust_ctl_atype_integer &&
-                       element_uctl_type.u.basic.integer.encoding != lttng_ust_ctl_encode_none) {
+           element_uctl_type.u.basic.integer.encoding != lttng_ust_ctl_encode_none) {
                /* Element represents a text character. */
                element_encoding = ust_ctl_encoding_to_string_field_encoding(
-                               element_uctl_type.u.basic.integer.encoding);
+                       element_uctl_type.u.basic.integer.encoding);
        }
 
        *next_ust_ctl_field = current + 1;
 
        if (element_encoding) {
                const auto integer_element_size =
-                               static_cast<const lst::integer_type&>(*element_type).size;
+                       static_cast<const lst::integer_type&>(*element_type).size;
 
                if (integer_element_size != 8) {
                        LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                                       "Unexpected legacy array element type: integer has encoding but size is not 8: size = {}",
-                                       integer_element_size));
+                               "Unexpected legacy array element type: integer has encoding but size is not 8: size = {}",
+                               integer_element_size));
                }
 
                /* Array is a static-length string. */
                return lttng::make_unique<lst::static_length_string_type>(
-                               array_alignment, *element_encoding, array_length);
+                       array_alignment, *element_encoding, array_length);
        }
 
        return lttng::make_unique<lst::static_length_array_type>(
-                       array_alignment, std::move(element_type), array_length);
+               array_alignment, std::move(element_type), array_length);
 }
 
-lst::type::cuptr create_array_nestable_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes,
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               publish_field_fn publish_field,
-               lookup_field_fn lookup_field,
-               lst::field_location::root lookup_root,
-               lst::field_location::elements &current_field_location_elements,
-               lsu::ctl_field_quirks quirks)
+lst::type::cuptr create_array_nestable_type_from_ust_ctl_fields(
+       const lttng_ust_ctl_field *current,
+       const lttng_ust_ctl_field *end,
+       const session_attributes& session_attributes,
+       const lttng_ust_ctl_field **next_ust_ctl_field,
+       publish_field_fn publish_field,
+       lookup_field_fn lookup_field,
+       lst::field_location::root lookup_root,
+       lst::field_location::elements& current_field_location_elements,
+       lsu::ctl_field_quirks quirks)
 {
        if (current >= end) {
-               LTTNG_THROW_PROTOCOL_ERROR(
-                               fmt::format("End of {} array reached unexpectedly during decoding",
-                                               typeid(*current)));
+               LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
+                       "End of {} array reached unexpectedly during decoding", typeid(*current)));
        }
 
        const auto& array_uctl_field = *current;
@@ -357,52 +369,58 @@ lst::type::cuptr create_array_nestable_type_from_ust_ctl_fields(const lttng_ust_
        const auto& element_uctl_field = *(current + 1);
 
        /* next_ust_ctl_field is updated as needed. */
-       element_type = create_type_from_ust_ctl_fields(&element_uctl_field, end, session_attributes,
-                       next_ust_ctl_field, publish_field, lookup_field, lookup_root,
-                       current_field_location_elements, quirks);
+       element_type = create_type_from_ust_ctl_fields(&element_uctl_field,
+                                                      end,
+                                                      session_attributes,
+                                                      next_ust_ctl_field,
+                                                      publish_field,
+                                                      lookup_field,
+                                                      lookup_root,
+                                                      current_field_location_elements,
+                                                      quirks);
        if (element_uctl_field.type.atype == lttng_ust_ctl_atype_integer &&
-                       element_uctl_field.type.u.integer.encoding != lttng_ust_ctl_encode_none) {
+           element_uctl_field.type.u.integer.encoding != lttng_ust_ctl_encode_none) {
                /* Element represents a text character. */
                element_encoding = ust_ctl_encoding_to_string_field_encoding(
-                               element_uctl_field.type.u.integer.encoding);
+                       element_uctl_field.type.u.integer.encoding);
        }
 
        if (element_encoding) {
                const auto integer_element_size =
-                               static_cast<const lst::integer_type&>(*element_type).size;
+                       static_cast<const lst::integer_type&>(*element_type).size;
 
                if (integer_element_size != 8) {
                        LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                                       "Unexpected array element type: integer has encoding but size is not 8: size = {}",
-                                       integer_element_size));
+                               "Unexpected array element type: integer has encoding but size is not 8: size = {}",
+                               integer_element_size));
                }
 
                /* Array is a static-length string. */
                return lttng::make_unique<lst::static_length_string_type>(
-                               array_alignment, *element_encoding, array_length);
+                       array_alignment, *element_encoding, array_length);
        }
 
        return lttng::make_unique<lst::static_length_array_type>(
-                       array_alignment, std::move(element_type), array_length);
+               array_alignment, std::move(element_type), array_length);
 }
 
 /*
  * For legacy sequence types, LTTng-UST expresses both the sequence and sequence
  * length as part of the same lttng_ust_ctl_field entry.
  */
-lst::type::cuptr create_sequence_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes,
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               publish_field_fn publish_field,
-               lst::field_location::root lookup_root,
-               lst::field_location::elements &current_field_location_elements,
-               lsu::ctl_field_quirks quirks __attribute__((unused)))
+lst::type::cuptr create_sequence_type_from_ust_ctl_fields(
+       const lttng_ust_ctl_field *current,
+       const lttng_ust_ctl_field *end,
+       const session_attributes& session_attributes,
+       const lttng_ust_ctl_field **next_ust_ctl_field,
+       publish_field_fn publish_field,
+       lst::field_location::root lookup_root,
+       lst::field_location::elements& current_field_location_elements,
+       lsu::ctl_field_quirks quirks __attribute__((unused)))
 {
        if (current >= end) {
-               LTTNG_THROW_PROTOCOL_ERROR(
-                               fmt::format("End of {} array reached unexpectedly during decoding",
-                                               typeid(*current)));
+               LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
+                       "End of {} array reached unexpectedly during decoding", typeid(*current)));
        }
 
        const auto& sequence_uctl_field = *current;
@@ -412,76 +430,79 @@ lst::type::cuptr create_sequence_type_from_ust_ctl_fields(const lttng_ust_ctl_fi
 
        if (element_uctl_type.atype != lttng_ust_ctl_atype_integer) {
                LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                               "Unexpected legacy sequence element type: atype = {}, expected atype = lttng_ust_ctl_atype_integer ({})",
-                               element_uctl_type.atype, lttng_ust_ctl_atype_integer));
+                       "Unexpected legacy sequence element type: atype = {}, expected atype = lttng_ust_ctl_atype_integer ({})",
+                       element_uctl_type.atype,
+                       lttng_ust_ctl_atype_integer));
        }
 
        if (length_uctl_type.atype != lttng_ust_ctl_atype_integer) {
                LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                               "Unexpected legacy sequence length field type: atype = {}, expected atype = lttng_ust_ctl_atype_integer ({})",
-                               length_uctl_type.atype, lttng_ust_ctl_atype_integer));
+                       "Unexpected legacy sequence length field type: atype = {}, expected atype = lttng_ust_ctl_atype_integer ({})",
+                       length_uctl_type.atype,
+                       lttng_ust_ctl_atype_integer));
        }
 
        nonstd::optional<enum lst::string_type::encoding> element_encoding;
        if (element_uctl_type.atype == lttng_ust_ctl_atype_integer &&
-                       element_uctl_type.u.basic.integer.encoding != lttng_ust_ctl_encode_none) {
+           element_uctl_type.u.basic.integer.encoding != lttng_ust_ctl_encode_none) {
                /* Element represents a text character. */
                element_encoding = ust_ctl_encoding_to_string_field_encoding(
-                               element_uctl_type.u.basic.integer.encoding);
+                       element_uctl_type.u.basic.integer.encoding);
        }
 
        const auto length_field_name = fmt::format("_{}_length", sequence_uctl_field.name);
-       auto element_type = create_integer_type_from_ust_ctl_basic_type(
-                       element_uctl_type, session_attributes);
-       auto length_type = create_integer_type_from_ust_ctl_basic_type(
-                       length_uctl_type, session_attributes);
+       auto element_type =
+               create_integer_type_from_ust_ctl_basic_type(element_uctl_type, session_attributes);
+       auto length_type =
+               create_integer_type_from_ust_ctl_basic_type(length_uctl_type, session_attributes);
 
        lst::field_location::elements length_field_location_elements =
-                       current_field_location_elements;
+               current_field_location_elements;
        length_field_location_elements.emplace_back(length_field_name);
 
        const lst::field_location length_field_location{
-                       lookup_root, std::move(length_field_location_elements)};
+               lookup_root, std::move(length_field_location_elements)
+       };
 
        /* Publish an implicit length field _before_ the sequence field. */
-       publish_field(lttng::make_unique<lst::field>(std::move(length_field_name), std::move(length_type)));
+       publish_field(lttng::make_unique<lst::field>(std::move(length_field_name),
+                                                    std::move(length_type)));
 
        *next_ust_ctl_field = current + 1;
 
        if (element_encoding) {
                const auto integer_element_size =
-                               static_cast<const lst::integer_type&>(*element_type).size;
+                       static_cast<const lst::integer_type&>(*element_type).size;
 
                if (integer_element_size != 8) {
                        LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                                       "Unexpected legacy array element type: integer has encoding but size is not 8: size = {}",
-                                       integer_element_size));
+                               "Unexpected legacy array element type: integer has encoding but size is not 8: size = {}",
+                               integer_element_size));
                }
 
                /* Sequence is a dynamic-length string. */
-               return lttng::make_unique<lst::dynamic_length_string_type>(sequence_alignment,
-                               *element_encoding, std::move(length_field_location));
+               return lttng::make_unique<lst::dynamic_length_string_type>(
+                       sequence_alignment, *element_encoding, std::move(length_field_location));
        }
 
-       return lttng::make_unique<lst::dynamic_length_array_type>(sequence_alignment,
-                       std::move(element_type), std::move(length_field_location));
+       return lttng::make_unique<lst::dynamic_length_array_type>(
+               sequence_alignment, std::move(element_type), std::move(length_field_location));
 }
 
 lst::type::cuptr create_sequence_nestable_type_from_ust_ctl_fields(
-               const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes,
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               publish_field_fn publish_field,
-               lookup_field_fn lookup_field,
-               lst::field_location::root lookup_root,
-               lst::field_location::elements &current_field_location_elements,
-               lsu::ctl_field_quirks quirks)
+       const lttng_ust_ctl_field *current,
+       const lttng_ust_ctl_field *end,
+       const session_attributes& session_attributes,
+       const lttng_ust_ctl_field **next_ust_ctl_field,
+       publish_field_fn publish_field,
+       lookup_field_fn lookup_field,
+       lst::field_location::root lookup_root,
+       lst::field_location::elements& current_field_location_elements,
+       lsu::ctl_field_quirks quirks)
 {
        if (current >= end) {
-               LTTNG_THROW_PROTOCOL_ERROR(
-                               fmt::format("End of {} array reached unexpectedly during decoding",
-                                               typeid(*current)));
+               LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
+                       "End of {} array reached unexpectedly during decoding", typeid(*current)));
        }
 
        const auto& sequence_uctl_field = *current;
@@ -493,67 +514,76 @@ lst::type::cuptr create_sequence_nestable_type_from_ust_ctl_fields(
 
        nonstd::optional<enum lst::string_type::encoding> element_encoding;
        if (element_uctl_field.type.atype == lttng_ust_ctl_atype_integer &&
-                       element_uctl_field.type.u.integer.encoding != lttng_ust_ctl_encode_none) {
+           element_uctl_field.type.u.integer.encoding != lttng_ust_ctl_encode_none) {
                /* Element represents a text character. */
                element_encoding = ust_ctl_encoding_to_string_field_encoding(
-                               element_uctl_field.type.u.integer.encoding);
+                       element_uctl_field.type.u.integer.encoding);
        }
 
        /* next_ust_ctl_field is updated as needed. */
-       auto element_type = create_type_from_ust_ctl_fields(&element_uctl_field, end,
-                       session_attributes, next_ust_ctl_field, publish_field, lookup_field,
-                       lookup_root, current_field_location_elements, quirks);
+       auto element_type = create_type_from_ust_ctl_fields(&element_uctl_field,
+                                                           end,
+                                                           session_attributes,
+                                                           next_ust_ctl_field,
+                                                           publish_field,
+                                                           lookup_field,
+                                                           lookup_root,
+                                                           current_field_location_elements,
+                                                           quirks);
 
        if (lttng_strnlen(sequence_uctl_field.type.u.sequence_nestable.length_name,
-                           sizeof(sequence_uctl_field.type.u.sequence_nestable.length_name)) ==
-                       sizeof(sequence_uctl_field.type.u.sequence_nestable.length_name)) {
+                         sizeof(sequence_uctl_field.type.u.sequence_nestable.length_name)) ==
+           sizeof(sequence_uctl_field.type.u.sequence_nestable.length_name)) {
                LTTNG_THROW_PROTOCOL_ERROR("Sequence length field name is not null terminated");
        }
 
        lst::field_location::elements length_field_location_elements =
-                       current_field_location_elements;
+               current_field_location_elements;
        length_field_location_elements.emplace_back(std::move(length_field_name));
 
        const lst::field_location length_field_location{
-                       lookup_root, std::move(length_field_location_elements)};
+               lookup_root, std::move(length_field_location_elements)
+       };
 
        /* Validate existence of length field (throws if not found). */
-       const auto &length_field = lookup_field(length_field_location);
+       const autolength_field = lookup_field(length_field_location);
        const auto *integer_selector_field =
-                       dynamic_cast<const lst::integer_type *>(&length_field.get_type());
+               dynamic_cast<const lst::integer_type *>(&length_field.get_type());
        if (!integer_selector_field) {
-               LTTNG_THROW_PROTOCOL_ERROR("Invalid selector field type referenced from sequence: expected integer or enumeration");
+               LTTNG_THROW_PROTOCOL_ERROR(
+                       "Invalid selector field type referenced from sequence: expected integer or enumeration");
        }
 
        if (element_encoding) {
                const auto integer_element_size =
-                               static_cast<const lst::integer_type&>(*element_type).size;
+                       static_cast<const lst::integer_type&>(*element_type).size;
 
                if (integer_element_size != 8) {
                        LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                                       "Unexpected array element type: integer has encoding but size is not 8: size = {}",
-                                       integer_element_size));
+                               "Unexpected array element type: integer has encoding but size is not 8: size = {}",
+                               integer_element_size));
                }
 
                /* Sqeuence is a dynamic-length string. */
-               return lttng::make_unique<lst::dynamic_length_string_type>(sequence_alignment,
-                               *element_encoding, std::move(length_field_location));
+               return lttng::make_unique<lst::dynamic_length_string_type>(
+                       sequence_alignment, *element_encoding, std::move(length_field_location));
        }
 
-       return lttng::make_unique<lst::dynamic_length_array_type>(sequence_alignment,
-                       std::move(element_type), std::move(length_field_location));
+       return lttng::make_unique<lst::dynamic_length_array_type>(
+               sequence_alignment, std::move(element_type), std::move(length_field_location));
 }
 
-lst::type::cuptr create_structure_field_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes __attribute__((unused)),
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               lsu::ctl_field_quirks quirks __attribute__((unused)))
+lst::type::cuptr
+create_structure_field_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
+                                          const lttng_ust_ctl_field *end,
+                                          const session_attributes& session_attributes
+                                          __attribute__((unused)),
+                                          const lttng_ust_ctl_field **next_ust_ctl_field,
+                                          lsu::ctl_field_quirks quirks __attribute__((unused)))
 {
        if (current >= end) {
-               LTTNG_THROW_PROTOCOL_ERROR(
-                               fmt::format("End of {} array reached unexpectedly during decoding",
-                                               typeid(*current)));
+               LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
+                       "End of {} array reached unexpectedly during decoding", typeid(*current)));
        }
 
        uint32_t field_count;
@@ -570,8 +600,8 @@ lst::type::cuptr create_structure_field_from_ust_ctl_fields(const lttng_ust_ctl_
 
        if (field_count != 0) {
                LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                               "Only empty structures are supported by LTTng-UST: nr_fields = {}",
-                               field_count));
+                       "Only empty structures are supported by LTTng-UST: nr_fields = {}",
+                       field_count));
        }
 
        *next_ust_ctl_field = current + 1;
@@ -579,62 +609,74 @@ lst::type::cuptr create_structure_field_from_ust_ctl_fields(const lttng_ust_ctl_
 }
 
 template <class VariantSelectorMappingIntegerType>
-typename lst::variant_type<VariantSelectorMappingIntegerType>::choices create_typed_variant_choices(
-               const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes,
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               lookup_field_fn lookup_field,
-               lst::field_location::root lookup_root,
-               lst::field_location::elements& current_field_location_elements,
-               unsigned int choice_count,
-               const lst::field& selector_field,
-               lsu::ctl_field_quirks quirks)
+typename lst::variant_type<VariantSelectorMappingIntegerType>::choices
+create_typed_variant_choices(const lttng_ust_ctl_field *current,
+                            const lttng_ust_ctl_field *end,
+                            const session_attributes& session_attributes,
+                            const lttng_ust_ctl_field **next_ust_ctl_field,
+                            lookup_field_fn lookup_field,
+                            lst::field_location::root lookup_root,
+                            lst::field_location::elements& current_field_location_elements,
+                            unsigned int choice_count,
+                            const lst::field& selector_field,
+                            lsu::ctl_field_quirks quirks)
 {
        typename lst::variant_type<VariantSelectorMappingIntegerType>::choices choices;
-       const auto& typed_enumeration = static_cast<
-                       const lst::typed_enumeration_type<VariantSelectorMappingIntegerType>&>(
+       const auto& typed_enumeration =
+               static_cast<const lst::typed_enumeration_type<VariantSelectorMappingIntegerType>&>(
                        selector_field.get_type());
 
        for (unsigned int i = 0; i < choice_count; i++) {
                create_field_from_ust_ctl_fields(
-                               current, end, session_attributes, next_ust_ctl_field,
-                               [&choices, typed_enumeration, &selector_field, quirks](
-                                               lst::field::uptr field) {
-                                       /*
-                                        * Find the enumeration mapping that matches the
-                                        * field's name.
-                                        */
-                                       const auto mapping_it = std::find_if(
-                                                       typed_enumeration.mappings_->begin(),
-                                                       typed_enumeration.mappings_->end(),
-                                                       [&field, quirks](const typename std::remove_reference<
-                                                                       decltype(typed_enumeration)>::type::
-                                                                                       mapping& mapping) {
-                                                               if (static_cast<bool>(quirks & lsu::ctl_field_quirks::UNDERSCORE_PREFIXED_VARIANT_TAG_MAPPINGS)) {
-                                                                       /*
-                                                                        * Check if they match with
-                                                                        * a prepended underscore
-                                                                        * and, if not, perform the
-                                                                        * regular check.
-                                                                        */
-                                                                       if ((std::string("_") + field->name) == mapping.name) {
-                                                                               return true;
-                                                                       }
-                                                               }
-
-                                                               return mapping.name == field->name;
-                                                       });
-
-                                       if (mapping_it == typed_enumeration.mappings_->end()) {
-                                               LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                                                               "Invalid variant choice: `{}` does not match any mapping in `{}` enumeration",
-                                                               field->name, selector_field.name));
-                                       }
-
-                                       choices.emplace_back(*mapping_it, field->move_type());
-                               },
-                               lookup_field, lookup_root, current_field_location_elements, quirks);
+                       current,
+                       end,
+                       session_attributes,
+                       next_ust_ctl_field,
+                       [&choices, typed_enumeration, &selector_field, quirks](
+                               lst::field::uptr field) {
+                               /*
+                                * Find the enumeration mapping that matches the
+                                * field's name.
+                                */
+                               const auto mapping_it = std::find_if(
+                                       typed_enumeration.mappings_->begin(),
+                                       typed_enumeration.mappings_->end(),
+                                       [&field,
+                                        quirks](const typename std::remove_reference<
+                                                decltype(typed_enumeration)>::type::mapping&
+                                                        mapping) {
+                                               if (static_cast<bool>(
+                                                           quirks &
+                                                           lsu::ctl_field_quirks::
+                                                                   UNDERSCORE_PREFIXED_VARIANT_TAG_MAPPINGS)) {
+                                                       /*
+                                                        * Check if they match with
+                                                        * a prepended underscore
+                                                        * and, if not, perform the
+                                                        * regular check.
+                                                        */
+                                                       if ((std::string("_") + field->name) ==
+                                                           mapping.name) {
+                                                               return true;
+                                                       }
+                                               }
+
+                                               return mapping.name == field->name;
+                                       });
+
+                               if (mapping_it == typed_enumeration.mappings_->end()) {
+                                       LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
+                                               "Invalid variant choice: `{}` does not match any mapping in `{}` enumeration",
+                                               field->name,
+                                               selector_field.name));
+                               }
+
+                               choices.emplace_back(*mapping_it, field->move_type());
+                       },
+                       lookup_field,
+                       lookup_root,
+                       current_field_location_elements,
+                       quirks);
 
                current = *next_ust_ctl_field;
        }
@@ -642,19 +684,19 @@ typename lst::variant_type<VariantSelectorMappingIntegerType>::choices create_ty
        return choices;
 }
 
-lst::type::cuptr create_variant_field_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes,
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               lookup_field_fn lookup_field,
-               lst::field_location::root lookup_root,
-               lst::field_location::elements &current_field_location_elements,
-               lsu::ctl_field_quirks quirks)
+lst::type::cuptr create_variant_field_from_ust_ctl_fields(
+       const lttng_ust_ctl_field *current,
+       const lttng_ust_ctl_field *end,
+       const session_attributes& session_attributes,
+       const lttng_ust_ctl_field **next_ust_ctl_field,
+       lookup_field_fn lookup_field,
+       lst::field_location::root lookup_root,
+       lst::field_location::elements& current_field_location_elements,
+       lsu::ctl_field_quirks quirks)
 {
        if (current >= end) {
-               LTTNG_THROW_PROTOCOL_ERROR(
-                               fmt::format("End of {} array reached unexpectedly during decoding",
-                                               typeid(*current)));
+               LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
+                       "End of {} array reached unexpectedly during decoding", typeid(*current)));
        }
 
        const auto& variant_uctl_field = *current;
@@ -675,133 +717,182 @@ lst::type::cuptr create_variant_field_from_ust_ctl_fields(const lttng_ust_ctl_fi
        }
 
        lst::field_location::elements selector_field_location_elements =
-                       current_field_location_elements;
+               current_field_location_elements;
        selector_field_location_elements.emplace_back(tag_name);
 
        const lst::field_location selector_field_location{
-                       lookup_root, std::move(selector_field_location_elements)};
+               lookup_root, std::move(selector_field_location_elements)
+       };
 
        /* Validate existence of selector field (throws if not found). */
-       const auto &selector_field = lookup_field(selector_field_location);
+       const autoselector_field = lookup_field(selector_field_location);
        const auto *enumeration_selector_type =
-                       dynamic_cast<const lst::enumeration_type *>(&selector_field.get_type());
+               dynamic_cast<const lst::enumeration_type *>(&selector_field.get_type());
        if (!enumeration_selector_type) {
-               LTTNG_THROW_PROTOCOL_ERROR("Invalid selector field type referenced from variant: expected enumeration");
+               LTTNG_THROW_PROTOCOL_ERROR(
+                       "Invalid selector field type referenced from variant: expected enumeration");
        }
 
        const bool selector_is_signed = enumeration_selector_type->signedness_ ==
-                       lst::integer_type::signedness::SIGNED;
+               lst::integer_type::signedness::SIGNED;
 
        /* Choices follow. next_ust_ctl_field is updated as needed. */
        if (selector_is_signed) {
                lst::variant_type<lst::signed_enumeration_type::mapping::range_t::range_integer_t>::
-                               choices choices = create_typed_variant_choices<int64_t>(current,
-                                               end, session_attributes, next_ust_ctl_field,
-                                               lookup_field, lookup_root,
-                                               current_field_location_elements, choice_count,
-                                               selector_field, quirks);
+                       choices choices = create_typed_variant_choices<int64_t>(
+                               current,
+                               end,
+                               session_attributes,
+                               next_ust_ctl_field,
+                               lookup_field,
+                               lookup_root,
+                               current_field_location_elements,
+                               choice_count,
+                               selector_field,
+                               quirks);
 
                return lttng::make_unique<lst::variant_type<int64_t>>(
-                               alignment, std::move(selector_field_location), std::move(choices));
+                       alignment, std::move(selector_field_location), std::move(choices));
        } else {
-               lst::variant_type<lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>::
-                               choices choices = create_typed_variant_choices<uint64_t>(current,
-                                               end, session_attributes, next_ust_ctl_field,
-                                               lookup_field, lookup_root,
-                                               current_field_location_elements, choice_count,
-                                               selector_field, quirks);
+               lst::variant_type<
+                       lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>::choices
+                       choices = create_typed_variant_choices<uint64_t>(
+                               current,
+                               end,
+                               session_attributes,
+                               next_ust_ctl_field,
+                               lookup_field,
+                               lookup_root,
+                               current_field_location_elements,
+                               choice_count,
+                               selector_field,
+                               quirks);
 
                return lttng::make_unique<lst::variant_type<uint64_t>>(
-                               alignment, std::move(selector_field_location), std::move(choices));
+                       alignment, std::move(selector_field_location), std::move(choices));
        }
 }
 
-lst::type::cuptr create_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes,
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               publish_field_fn publish_field,
-               lookup_field_fn lookup_field,
-               lst::field_location::root lookup_root,
-               lst::field_location::elements& current_field_location_elements,
-               lsu::ctl_field_quirks quirks)
+lst::type::cuptr
+create_type_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
+                               const lttng_ust_ctl_field *end,
+                               const session_attributes& session_attributes,
+                               const lttng_ust_ctl_field **next_ust_ctl_field,
+                               publish_field_fn publish_field,
+                               lookup_field_fn lookup_field,
+                               lst::field_location::root lookup_root,
+                               lst::field_location::elements& current_field_location_elements,
+                               lsu::ctl_field_quirks quirks)
 {
        switch (current->type.atype) {
        case lttng_ust_ctl_atype_integer:
                return create_integer_type_from_ust_ctl_fields(
-                               current, end, session_attributes, next_ust_ctl_field, quirks);
+                       current, end, session_attributes, next_ust_ctl_field, quirks);
        case lttng_ust_ctl_atype_enum:
        case lttng_ust_ctl_atype_enum_nestable:
                return create_enumeration_type_from_ust_ctl_fields(
-                               current, end, session_attributes, next_ust_ctl_field, quirks);
+                       current, end, session_attributes, next_ust_ctl_field, quirks);
        case lttng_ust_ctl_atype_float:
                return create_floating_point_type_from_ust_ctl_fields(
-                               current, end, session_attributes, next_ust_ctl_field, quirks);
+                       current, end, session_attributes, next_ust_ctl_field, quirks);
        case lttng_ust_ctl_atype_string:
                return create_string_type_from_ust_ctl_fields(
-                               current, end, session_attributes, next_ust_ctl_field, quirks);
+                       current, end, session_attributes, next_ust_ctl_field, quirks);
        case lttng_ust_ctl_atype_array:
                return create_array_type_from_ust_ctl_fields(
-                               current, end, session_attributes, next_ust_ctl_field, quirks);
+                       current, end, session_attributes, next_ust_ctl_field, quirks);
        case lttng_ust_ctl_atype_array_nestable:
-               return create_array_nestable_type_from_ust_ctl_fields(current, end,
-                               session_attributes, next_ust_ctl_field, publish_field, lookup_field,
-                               lookup_root, current_field_location_elements, quirks);
+               return create_array_nestable_type_from_ust_ctl_fields(
+                       current,
+                       end,
+                       session_attributes,
+                       next_ust_ctl_field,
+                       publish_field,
+                       lookup_field,
+                       lookup_root,
+                       current_field_location_elements,
+                       quirks);
        case lttng_ust_ctl_atype_sequence:
-               return create_sequence_type_from_ust_ctl_fields(current, end, session_attributes,
-                               next_ust_ctl_field, publish_field, lookup_root,
-                               current_field_location_elements, quirks);
+               return create_sequence_type_from_ust_ctl_fields(current,
+                                                               end,
+                                                               session_attributes,
+                                                               next_ust_ctl_field,
+                                                               publish_field,
+                                                               lookup_root,
+                                                               current_field_location_elements,
+                                                               quirks);
        case lttng_ust_ctl_atype_sequence_nestable:
-               return create_sequence_nestable_type_from_ust_ctl_fields(current, end,
-                               session_attributes, next_ust_ctl_field, publish_field, lookup_field,
-                               lookup_root, current_field_location_elements, quirks);
+               return create_sequence_nestable_type_from_ust_ctl_fields(
+                       current,
+                       end,
+                       session_attributes,
+                       next_ust_ctl_field,
+                       publish_field,
+                       lookup_field,
+                       lookup_root,
+                       current_field_location_elements,
+                       quirks);
        case lttng_ust_ctl_atype_struct:
        case lttng_ust_ctl_atype_struct_nestable:
                return create_structure_field_from_ust_ctl_fields(
-                               current, end, session_attributes, next_ust_ctl_field, quirks);
+                       current, end, session_attributes, next_ust_ctl_field, quirks);
        case lttng_ust_ctl_atype_variant:
        case lttng_ust_ctl_atype_variant_nestable:
-               return create_variant_field_from_ust_ctl_fields(current, end, session_attributes,
-                               next_ust_ctl_field, lookup_field, lookup_root,
-                               current_field_location_elements, quirks);
+               return create_variant_field_from_ust_ctl_fields(current,
+                                                               end,
+                                                               session_attributes,
+                                                               next_ust_ctl_field,
+                                                               lookup_field,
+                                                               lookup_root,
+                                                               current_field_location_elements,
+                                                               quirks);
        default:
-               LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                               "Unknown {} value `{}` encountered while converting {} to {}",
-                               typeid(current->type.atype), current->type.atype, typeid(*current),
-                               typeid(lst::type::cuptr::element_type)));
+               LTTNG_THROW_PROTOCOL_ERROR(
+                       fmt::format("Unknown {} value `{}` encountered while converting {} to {}",
+                                   typeid(current->type.atype),
+                                   current->type.atype,
+                                   typeid(*current),
+                                   typeid(lst::type::cuptr::element_type)));
        }
 }
 
 void create_field_from_ust_ctl_fields(const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               const session_attributes& session_attributes,
-               const lttng_ust_ctl_field **next_ust_ctl_field,
-               publish_field_fn publish_field,
-               lookup_field_fn lookup_field,
-               lst::field_location::root lookup_root,
-               lst::field_location::elements& current_field_location_elements,
-               lsu::ctl_field_quirks quirks)
+                                     const lttng_ust_ctl_field *end,
+                                     const session_attributes& session_attributes,
+                                     const lttng_ust_ctl_field **next_ust_ctl_field,
+                                     publish_field_fn publish_field,
+                                     lookup_field_fn lookup_field,
+                                     lst::field_location::root lookup_root,
+                                     lst::field_location::elements& current_field_location_elements,
+                                     lsu::ctl_field_quirks quirks)
 {
        LTTNG_ASSERT(current < end);
 
        if (lttng_strnlen(current->name, sizeof(current->name)) == sizeof(current->name)) {
                LTTNG_THROW_PROTOCOL_ERROR(
-                               fmt::format("Name of {} is not null-terminated", typeid(*current)));
-       }
-
-       publish_field(lttng::make_unique<lst::field>(current->name,
-                       create_type_from_ust_ctl_fields(current, end, session_attributes,
-                                       next_ust_ctl_field, publish_field, lookup_field,
-                                       lookup_root, current_field_location_elements, quirks)));
+                       fmt::format("Name of {} is not null-terminated", typeid(*current)));
+       }
+
+       publish_field(lttng::make_unique<lst::field>(
+               current->name,
+               create_type_from_ust_ctl_fields(current,
+                                               end,
+                                               session_attributes,
+                                               next_ust_ctl_field,
+                                               publish_field,
+                                               lookup_field,
+                                               lookup_root,
+                                               current_field_location_elements,
+                                               quirks)));
 }
 
-std::vector<lst::field::cuptr>::iterator lookup_field_in_vector(
-               std::vector<lst::field::cuptr>& fields, const lst::field_location& location)
+std::vector<lst::field::cuptr>::iterator
+lookup_field_in_vector(std::vector<lst::field::cuptr>& fields, const lst::field_location& location)
 {
        if (location.elements_.size() != 1) {
                LTTNG_THROW_ERROR(fmt::format(
-                               "Unexpected field location received during field look-up: location = {}",
-                               location));
+                       "Unexpected field location received during field look-up: location = {}",
+                       location));
        }
 
        /*
@@ -811,14 +902,14 @@ std::vector<lst::field::cuptr>::iterator lookup_field_in_vector(
         * location has a depth of 1 and directly refers to a field
         * in the 'fields' vector.
         */
-       const auto field_it = std::find_if(fields.begin(), fields.end(),
-                       [location](lst::field::cuptr &field) {
-                               return field->name == location.elements_[0];
-                       });
+       const auto field_it =
+               std::find_if(fields.begin(), fields.end(), [location](lst::field::cuptr& field) {
+                       return field->name == location.elements_[0];
+               });
 
        if (field_it == fields.end()) {
                LTTNG_THROW_PROTOCOL_ERROR(
-                               fmt::format("Failed to look-up field: location = {}", location));
+                       fmt::format("Failed to look-up field: location = {}", location));
        }
 
        return field_it;
@@ -832,20 +923,21 @@ std::vector<lst::field::cuptr>::iterator lookup_field_in_vector(
  *
  * Always returns a new field, throws on error.
  */
-std::vector<lst::field::cuptr> create_fields_from_ust_ctl_fields(
-               const lsu::registry_session& session,
-               const lttng_ust_ctl_field *current,
-               const lttng_ust_ctl_field *end,
-               lst::field_location::root lookup_root,
-               lsu::ctl_field_quirks quirks)
+std::vector<lst::field::cuptr>
+create_fields_from_ust_ctl_fields(const lsu::registry_session& session,
+                                 const lttng_ust_ctl_field *current,
+                                 const lttng_ust_ctl_field *end,
+                                 lst::field_location::root lookup_root,
+                                 lsu::ctl_field_quirks quirks)
 {
        std::vector<lst::field::cuptr> fields;
        const auto trace_native_byte_order = session.abi.byte_order;
        const session_attributes session_attributes{
-                       [&session](const char *enum_name, uint64_t enum_id) {
-                               return session.enumeration(enum_name, enum_id);
-                       },
-                       trace_native_byte_order};
+               [&session](const char *enum_name, uint64_t enum_id) {
+                       return session.enumeration(enum_name, enum_id);
+               },
+               trace_native_byte_order
+       };
        /* Location of field being created. */
        lst::field_location::elements current_field_location_elements;
 
@@ -862,18 +954,23 @@ std::vector<lst::field::cuptr> create_fields_from_ust_ctl_fields(
                 * needed depending on the decoded field's type.
                 */
                create_field_from_ust_ctl_fields(
-                               current, end, session_attributes, &next_field,
-                               [&fields](lst::field::cuptr field) {
-                                       /* Publishing a field simply adds it to the converted
-                                        * fields. */
-                                       fields.emplace_back(std::move(field));
-                               },
-                               [&fields](const lst::field_location& location)
-                                               -> lookup_field_fn::result_type {
-                                       /* Resolve location to a previously-constructed field. */
-                                       return **lookup_field_in_vector(fields, location);
-                               },
-                               lookup_root, current_field_location_elements, quirks);
+                       current,
+                       end,
+                       session_attributes,
+                       &next_field,
+                       [&fields](lst::field::cuptr field) {
+                               /* Publishing a field simply adds it to the converted
+                                * fields. */
+                               fields.emplace_back(std::move(field));
+                       },
+                       [&fields](const lst::field_location& location)
+                               -> lookup_field_fn::result_type {
+                               /* Resolve location to a previously-constructed field. */
+                               return **lookup_field_in_vector(fields, location);
+                       },
+                       lookup_root,
+                       current_field_location_elements,
+                       quirks);
 
                current = next_field;
        }
@@ -882,13 +979,13 @@ std::vector<lst::field::cuptr> create_fields_from_ust_ctl_fields(
 }
 } /* namespace */
 
-std::vector<lst::field::cuptr> lsu::create_trace_fields_from_ust_ctl_fields(
-               const lsu::registry_session& session,
-               const lttng_ust_ctl_field *fields,
-               std::size_t field_count,
-               lst::field_location::root lookup_root,
-               lsu::ctl_field_quirks quirks)
+std::vector<lst::field::cuptr>
+lsu::create_trace_fields_from_ust_ctl_fields(const lsu::registry_session& session,
+                                            const lttng_ust_ctl_field *fields,
+                                            std::size_t field_count,
+                                            lst::field_location::root lookup_root,
+                                            lsu::ctl_field_quirks quirks)
 {
        return create_fields_from_ust_ctl_fields(
-                       session, fields, fields + field_count, lookup_root, quirks);
+               session, fields, fields + field_count, lookup_root, quirks);
 }
index 6a5d5ff52b520cb1ddd5623923b712247098c5f4..ea49555c0022fa6d1d404218e26b330851b021d9 100644 (file)
@@ -6,6 +6,17 @@
  */
 
 #define _LGPL_SOURCE
+#include "tsdl-environment-visitor.hpp"
+#include "ust-app.hpp"
+#include "ust-clock-class.hpp"
+#include "ust-registry.hpp"
+
+#include <common/common.hpp>
+#include <common/exception.hpp>
+#include <common/format.hpp>
+#include <common/time.hpp>
+#include <common/uuid.hpp>
+
 #include <inttypes.h>
 #include <limits.h>
 #include <stdarg.h>
 #include <unistd.h>
 #include <vector>
 
-#include <common/common.hpp>
-#include <common/exception.hpp>
-#include <common/format.hpp>
-#include <common/time.hpp>
-#include <common/uuid.hpp>
-
-#include "ust-app.hpp"
-#include "ust-clock-class.hpp"
-#include "ust-registry.hpp"
-#include "tsdl-environment-visitor.hpp"
-
 namespace ls = lttng::sessiond;
 namespace lsu = lttng::sessiond::ust;
index f8295df4513806d60fb66a7b0903b47a49626894..ceba9a8963ab333bd381e6a6a6e87a6419be1ae6 100644 (file)
@@ -5,8 +5,8 @@
  *
  */
 
-#include "ust-registry-channel.hpp"
 #include "ust-app.hpp"
+#include "ust-registry-channel.hpp"
 #include "ust-registry-event.hpp"
 
 #include <common/error.hpp>
@@ -29,7 +29,7 @@ unsigned long ht_hash_event(const void *_key, unsigned long seed)
 {
        uint64_t hashed_key;
        const lttng::sessiond::ust::registry_event *key =
-                       (lttng::sessiond::ust::registry_event *) _key;
+               (lttng::sessiond::ust::registry_event *) _key;
 
        LTTNG_ASSERT(key);
 
@@ -79,136 +79,162 @@ no_match:
        return 0;
 }
 
-lst::type::cuptr create_event_header(const lst::abi& trace_abi, lst::stream_class::header_type header_type)
+lst::type::cuptr create_event_header(const lst::abi& trace_abi,
+                                    lst::stream_class::header_type header_type)
 {
        lst::structure_type::fields event_header_fields;
 
        if (header_type == lst::stream_class::header_type::COMPACT) {
                auto enum_mappings = std::make_shared<lst::unsigned_enumeration_type::mappings>();
                lst::unsigned_enumeration_type::mapping compact_mapping{
-                               "compact", lst::unsigned_enumeration_type::mapping::range_t(0, 30)};
-               lst::unsigned_enumeration_type::mapping extended_mapping{"extended", 31};
+                       "compact", lst::unsigned_enumeration_type::mapping::range_t(0, 30)
+               };
+               lst::unsigned_enumeration_type::mapping extended_mapping{ "extended", 31 };
 
                enum_mappings->emplace_back(compact_mapping);
                enum_mappings->emplace_back(extended_mapping);
 
-               lst::type::cuptr choice_enum = lttng::make_unique<lst::unsigned_enumeration_type>(1,
-                               trace_abi.byte_order, 5, lst::integer_type::base::DECIMAL,
-                               std::move(enum_mappings),
-                               std::initializer_list<lst::integer_type::role>(
-                                               {lst::integer_type::role::EVENT_RECORD_CLASS_ID}));
+               lst::type::cuptr choice_enum = lttng::make_unique<lst::unsigned_enumeration_type>(
+                       1,
+                       trace_abi.byte_order,
+                       5,
+                       lst::integer_type::base::DECIMAL,
+                       std::move(enum_mappings),
+                       std::initializer_list<lst::integer_type::role>(
+                               { lst::integer_type::role::EVENT_RECORD_CLASS_ID }));
 
-               lst::variant_type<lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>::
-                               choices variant_choices;
+               lst::variant_type<
+                       lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>::choices
+                       variant_choices;
 
                lst::structure_type::fields compact_fields;
-               compact_fields.emplace_back(lttng::make_unique<lst::field>("timestamp",
-                               lttng::make_unique<lst::integer_type>(1, trace_abi.byte_order, 27,
-                                               lst::integer_type::signedness::UNSIGNED,
-                                               lst::integer_type::base::DECIMAL,
-                                               std::initializer_list<lst::integer_type::
-                                                                               role>({lst::integer_type::role::
-                                                                               DEFAULT_CLOCK_TIMESTAMP}))));
-
-               auto compact_type = lttng::make_unique<lst::structure_type>(
-                               0, std::move(compact_fields));
+               compact_fields.emplace_back(lttng::make_unique<lst::field>(
+                       "timestamp",
+                       lttng::make_unique<lst::integer_type>(
+                               1,
+                               trace_abi.byte_order,
+                               27,
+                               lst::integer_type::signedness::UNSIGNED,
+                               lst::integer_type::base::DECIMAL,
+                               std::initializer_list<lst::integer_type::role>(
+                                       { lst::integer_type::role::DEFAULT_CLOCK_TIMESTAMP }))));
+
+               auto compact_type =
+                       lttng::make_unique<lst::structure_type>(0, std::move(compact_fields));
                variant_choices.emplace_back(std::move(compact_mapping), std::move(compact_type));
 
                lst::structure_type::fields extended_fields;
-               extended_fields.emplace_back(lttng::make_unique<lst::field>("id",
-                               lttng::make_unique<lst::integer_type>(trace_abi.uint32_t_alignment,
-                                               trace_abi.byte_order, 32,
-                                               lst::integer_type::signedness::UNSIGNED,
-                                               lst::integer_type::base::DECIMAL,
-                                               std::initializer_list<lst::integer_type::
-                                                                               role>({lst::integer_type::role::
-                                                                               EVENT_RECORD_CLASS_ID}))));
-               extended_fields.emplace_back(lttng::make_unique<lst::field>("timestamp",
-                               lttng::make_unique<lst::integer_type>(trace_abi.uint64_t_alignment,
-                                               trace_abi.byte_order, 64,
-                                               lst::integer_type::signedness::UNSIGNED,
-                                               lst::integer_type::base::DECIMAL,
-                                               std::initializer_list<lst::integer_type::
-                                                                               role>({lst::integer_type::role::
-                                                                               DEFAULT_CLOCK_TIMESTAMP}))));
-
-               lst::type::cuptr extended_type = lttng::make_unique<lst::structure_type>(0, std::move(extended_fields));
+               extended_fields.emplace_back(lttng::make_unique<lst::field>(
+                       "id",
+                       lttng::make_unique<lst::integer_type>(
+                               trace_abi.uint32_t_alignment,
+                               trace_abi.byte_order,
+                               32,
+                               lst::integer_type::signedness::UNSIGNED,
+                               lst::integer_type::base::DECIMAL,
+                               std::initializer_list<lst::integer_type::role>(
+                                       { lst::integer_type::role::EVENT_RECORD_CLASS_ID }))));
+               extended_fields.emplace_back(lttng::make_unique<lst::field>(
+                       "timestamp",
+                       lttng::make_unique<lst::integer_type>(
+                               trace_abi.uint64_t_alignment,
+                               trace_abi.byte_order,
+                               64,
+                               lst::integer_type::signedness::UNSIGNED,
+                               lst::integer_type::base::DECIMAL,
+                               std::initializer_list<lst::integer_type::role>(
+                                       { lst::integer_type::role::DEFAULT_CLOCK_TIMESTAMP }))));
+
+               lst::type::cuptr extended_type =
+                       lttng::make_unique<lst::structure_type>(0, std::move(extended_fields));
                variant_choices.emplace_back(std::move(extended_mapping), std::move(extended_type));
 
                auto variant = lttng::make_unique<lst::variant_type<
-                               lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>>(
-                               0,
-                               lst::field_location(lst::field_location::root::EVENT_RECORD_HEADER,
-                                               {"id"}),
-                               std::move(variant_choices));
+                       lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>>(
+                       0,
+                       lst::field_location(lst::field_location::root::EVENT_RECORD_HEADER,
+                                           { "id" }),
+                       std::move(variant_choices));
 
-               event_header_fields.emplace_back(lttng::make_unique<lst::field>("id", std::move(choice_enum)));
                event_header_fields.emplace_back(
-                               lttng::make_unique<lst::field>("v", std::move(variant)));
+                       lttng::make_unique<lst::field>("id", std::move(choice_enum)));
+               event_header_fields.emplace_back(
+                       lttng::make_unique<lst::field>("v", std::move(variant)));
        } else {
                auto enum_mappings = std::make_shared<lst::unsigned_enumeration_type::mappings>();
-               lst::unsigned_enumeration_type::mapping compact_mapping{"compact",
-                               lst::unsigned_enumeration_type::mapping::range_t(0, 65534)};
-               lst::unsigned_enumeration_type::mapping extended_mapping{"extended", 65535};
+               lst::unsigned_enumeration_type::mapping compact_mapping{
+                       "compact", lst::unsigned_enumeration_type::mapping::range_t(0, 65534)
+               };
+               lst::unsigned_enumeration_type::mapping extended_mapping{ "extended", 65535 };
                enum_mappings->emplace_back(compact_mapping);
                enum_mappings->emplace_back(extended_mapping);
 
                auto choice_enum = lttng::make_unique<lst::unsigned_enumeration_type>(
-                               trace_abi.uint16_t_alignment, trace_abi.byte_order, 16,
-                               lst::integer_type::base::DECIMAL, std::move(enum_mappings),
-                               std::initializer_list<lst::integer_type::role>(
-                                               {lst::integer_type::role::EVENT_RECORD_CLASS_ID}));
-
-               lst::variant_type<lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>::
-                               choices variant_choices;
+                       trace_abi.uint16_t_alignment,
+                       trace_abi.byte_order,
+                       16,
+                       lst::integer_type::base::DECIMAL,
+                       std::move(enum_mappings),
+                       std::initializer_list<lst::integer_type::role>(
+                               { lst::integer_type::role::EVENT_RECORD_CLASS_ID }));
+
+               lst::variant_type<
+                       lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>::choices
+                       variant_choices;
 
                lst::structure_type::fields compact_fields;
-               compact_fields.emplace_back(lttng::make_unique<lst::field>("timestamp",
-                               lttng::make_unique<lst::integer_type>(trace_abi.uint32_t_alignment,
-                                               trace_abi.byte_order, 32,
-                                               lst::integer_type::signedness::UNSIGNED,
-                                               lst::integer_type::base::DECIMAL,
-                                               std::initializer_list<lst::integer_type::
-                                                                               role>({lst::integer_type::role::
-                                                                               DEFAULT_CLOCK_TIMESTAMP}))));
-
-               lst::type::cuptr compact_type = lttng::make_unique<lst::structure_type>(
-                               0, std::move(compact_fields));
+               compact_fields.emplace_back(lttng::make_unique<lst::field>(
+                       "timestamp",
+                       lttng::make_unique<lst::integer_type>(
+                               trace_abi.uint32_t_alignment,
+                               trace_abi.byte_order,
+                               32,
+                               lst::integer_type::signedness::UNSIGNED,
+                               lst::integer_type::base::DECIMAL,
+                               std::initializer_list<lst::integer_type::role>(
+                                       { lst::integer_type::role::DEFAULT_CLOCK_TIMESTAMP }))));
+
+               lst::type::cuptr compact_type =
+                       lttng::make_unique<lst::structure_type>(0, std::move(compact_fields));
                variant_choices.emplace_back(std::move(compact_mapping), std::move(compact_type));
 
                lst::structure_type::fields extended_fields;
-               extended_fields.emplace_back(lttng::make_unique<lst::field>("id",
-                               lttng::make_unique<lst::integer_type>(trace_abi.uint32_t_alignment,
-                                               trace_abi.byte_order, 32,
-                                               lst::integer_type::signedness::UNSIGNED,
-                                               lst::integer_type::base::DECIMAL,
-                                               std::initializer_list<lst::integer_type::
-                                                                               role>({lst::integer_type::role::
-                                                                               EVENT_RECORD_CLASS_ID}))));
-               extended_fields.emplace_back(lttng::make_unique<lst::field>("timestamp",
-                               lttng::make_unique<lst::integer_type>(trace_abi.uint64_t_alignment,
-                                               trace_abi.byte_order, 64,
-                                               lst::integer_type::signedness::UNSIGNED,
-                                               lst::integer_type::base::DECIMAL,
-                                               std::initializer_list<lst::integer_type::
-                                                                               role>({lst::integer_type::role::
-                                                                               DEFAULT_CLOCK_TIMESTAMP}))));
-
-               auto extended_type = lttng::make_unique<lst::structure_type>(
-                               0, std::move(extended_fields));
+               extended_fields.emplace_back(lttng::make_unique<lst::field>(
+                       "id",
+                       lttng::make_unique<lst::integer_type>(
+                               trace_abi.uint32_t_alignment,
+                               trace_abi.byte_order,
+                               32,
+                               lst::integer_type::signedness::UNSIGNED,
+                               lst::integer_type::base::DECIMAL,
+                               std::initializer_list<lst::integer_type::role>(
+                                       { lst::integer_type::role::EVENT_RECORD_CLASS_ID }))));
+               extended_fields.emplace_back(lttng::make_unique<lst::field>(
+                       "timestamp",
+                       lttng::make_unique<lst::integer_type>(
+                               trace_abi.uint64_t_alignment,
+                               trace_abi.byte_order,
+                               64,
+                               lst::integer_type::signedness::UNSIGNED,
+                               lst::integer_type::base::DECIMAL,
+                               std::initializer_list<lst::integer_type::role>(
+                                       { lst::integer_type::role::DEFAULT_CLOCK_TIMESTAMP }))));
+
+               auto extended_type =
+                       lttng::make_unique<lst::structure_type>(0, std::move(extended_fields));
                variant_choices.emplace_back(std::move(extended_mapping), std::move(extended_type));
 
                auto variant = lttng::make_unique<lst::variant_type<
-                               lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>>(
-                               0,
-                               lst::field_location(lst::field_location::root::EVENT_RECORD_HEADER,
-                                               {"id"}),
-                               std::move(variant_choices));
+                       lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>>(
+                       0,
+                       lst::field_location(lst::field_location::root::EVENT_RECORD_HEADER,
+                                           { "id" }),
+                       std::move(variant_choices));
 
                event_header_fields.emplace_back(
-                               lttng::make_unique<lst::field>("id", std::move(choice_enum)));
+                       lttng::make_unique<lst::field>("id", std::move(choice_enum)));
                event_header_fields.emplace_back(
-                               lttng::make_unique<lst::field>("v", std::move(variant)));
+                       lttng::make_unique<lst::field>("v", std::move(variant)));
        }
 
        return lttng::make_unique<lst::structure_type>(0, std::move(event_header_fields));
@@ -219,78 +245,106 @@ lst::type::cuptr create_packet_context(const lst::abi& trace_abi)
        lst::structure_type::fields packet_context_fields;
 
        /* uint64_t timestamp_begin */
-       packet_context_fields.emplace_back(lttng::make_unique<lst::field>("timestamp_begin",
-                       lttng::make_unique<lst::integer_type>(trace_abi.uint64_t_alignment,
-                                       trace_abi.byte_order, 64,
-                                       lst::integer_type::signedness::UNSIGNED,
-                                       lst::integer_type::base::DECIMAL,
-                                       std::initializer_list<lst::integer_type::role>({lst::integer_type::role::DEFAULT_CLOCK_TIMESTAMP}))));
+       packet_context_fields.emplace_back(lttng::make_unique<lst::field>(
+               "timestamp_begin",
+               lttng::make_unique<lst::integer_type>(
+                       trace_abi.uint64_t_alignment,
+                       trace_abi.byte_order,
+                       64,
+                       lst::integer_type::signedness::UNSIGNED,
+                       lst::integer_type::base::DECIMAL,
+                       std::initializer_list<lst::integer_type::role>(
+                               { lst::integer_type::role::DEFAULT_CLOCK_TIMESTAMP }))));
 
        /* uint64_t timestamp_end */
-       packet_context_fields.emplace_back(lttng::make_unique<lst::field>("timestamp_end",
-                       lttng::make_unique<lst::integer_type>(trace_abi.uint64_t_alignment,
-                                       trace_abi.byte_order, 64,
-                                       lst::integer_type::signedness::UNSIGNED,
-                                       lst::integer_type::base::DECIMAL,
-                                       std::initializer_list<lst::integer_type::role>({lst::integer_type::role::PACKET_END_DEFAULT_CLOCK_TIMESTAMP}))));
+       packet_context_fields.emplace_back(lttng::make_unique<lst::field>(
+               "timestamp_end",
+               lttng::make_unique<lst::integer_type>(
+                       trace_abi.uint64_t_alignment,
+                       trace_abi.byte_order,
+                       64,
+                       lst::integer_type::signedness::UNSIGNED,
+                       lst::integer_type::base::DECIMAL,
+                       std::initializer_list<lst::integer_type::role>(
+                               { lst::integer_type::role::PACKET_END_DEFAULT_CLOCK_TIMESTAMP }))));
 
        /* uint64_t content_size */
-       packet_context_fields.emplace_back(lttng::make_unique<lst::field>("content_size",
-                       lttng::make_unique<lst::integer_type>(trace_abi.uint64_t_alignment,
-                                       trace_abi.byte_order, 64,
-                                       lst::integer_type::signedness::UNSIGNED,
-                                       lst::integer_type::base::DECIMAL,
-                                       std::initializer_list<lst::integer_type::role>({lst::integer_type::role::PACKET_CONTENT_LENGTH}))));
+       packet_context_fields.emplace_back(lttng::make_unique<lst::field>(
+               "content_size",
+               lttng::make_unique<lst::integer_type>(
+                       trace_abi.uint64_t_alignment,
+                       trace_abi.byte_order,
+                       64,
+                       lst::integer_type::signedness::UNSIGNED,
+                       lst::integer_type::base::DECIMAL,
+                       std::initializer_list<lst::integer_type::role>(
+                               { lst::integer_type::role::PACKET_CONTENT_LENGTH }))));
 
        /* uint64_t packet_size */
-       packet_context_fields.emplace_back(lttng::make_unique<lst::field>("packet_size",
-                       lttng::make_unique<lst::integer_type>(trace_abi.uint64_t_alignment,
-                                       trace_abi.byte_order, 64,
-                                       lst::integer_type::signedness::UNSIGNED,
-                                       lst::integer_type::base::DECIMAL,
-                                       std::initializer_list<lst::integer_type::role>({lst::integer_type::role::PACKET_TOTAL_LENGTH}))));
+       packet_context_fields.emplace_back(lttng::make_unique<lst::field>(
+               "packet_size",
+               lttng::make_unique<lst::integer_type>(
+                       trace_abi.uint64_t_alignment,
+                       trace_abi.byte_order,
+                       64,
+                       lst::integer_type::signedness::UNSIGNED,
+                       lst::integer_type::base::DECIMAL,
+                       std::initializer_list<lst::integer_type::role>(
+                               { lst::integer_type::role::PACKET_TOTAL_LENGTH }))));
 
        /* uint64_t packet_seq_num */
-       packet_context_fields.emplace_back(lttng::make_unique<lst::field>("packet_seq_num",
-                       lttng::make_unique<lst::integer_type>(trace_abi.uint64_t_alignment,
-                                       trace_abi.byte_order, 64,
-                                       lst::integer_type::signedness::UNSIGNED,
-                                       lst::integer_type::base::DECIMAL,
-                                       std::initializer_list<lst::integer_type::role>({lst::integer_type::role::PACKET_SEQUENCE_NUMBER}))));
+       packet_context_fields.emplace_back(lttng::make_unique<lst::field>(
+               "packet_seq_num",
+               lttng::make_unique<lst::integer_type>(
+                       trace_abi.uint64_t_alignment,
+                       trace_abi.byte_order,
+                       64,
+                       lst::integer_type::signedness::UNSIGNED,
+                       lst::integer_type::base::DECIMAL,
+                       std::initializer_list<lst::integer_type::role>(
+                               { lst::integer_type::role::PACKET_SEQUENCE_NUMBER }))));
 
        /* unsigned long events_discarded */
-       packet_context_fields.emplace_back(lttng::make_unique<lst::field>("events_discarded",
-                       lttng::make_unique<lst::integer_type>(trace_abi.long_alignment,
-                                       trace_abi.byte_order, trace_abi.bits_per_long,
-                                       lst::integer_type::signedness::UNSIGNED,
-                                       lst::integer_type::base::DECIMAL,
-                                       std::initializer_list<lst::integer_type::role>({lst::integer_type::role::DISCARDED_EVENT_RECORD_COUNTER_SNAPSHOT}))));
+       packet_context_fields.emplace_back(lttng::make_unique<lst::field>(
+               "events_discarded",
+               lttng::make_unique<lst::integer_type>(
+                       trace_abi.long_alignment,
+                       trace_abi.byte_order,
+                       trace_abi.bits_per_long,
+                       lst::integer_type::signedness::UNSIGNED,
+                       lst::integer_type::base::DECIMAL,
+                       std::initializer_list<lst::integer_type::role>(
+                               { lst::integer_type::role::
+                                         DISCARDED_EVENT_RECORD_COUNTER_SNAPSHOT }))));
 
        /* uint32_t cpu_id */
-       packet_context_fields.emplace_back(lttng::make_unique<lst::field>("cpu_id",
-                       lttng::make_unique<lst::integer_type>(trace_abi.uint32_t_alignment,
-                                       trace_abi.byte_order, 32,
-                                       lst::integer_type::signedness::UNSIGNED,
-                                       lst::integer_type::base::DECIMAL)));
+       packet_context_fields.emplace_back(lttng::make_unique<lst::field>(
+               "cpu_id",
+               lttng::make_unique<lst::integer_type>(trace_abi.uint32_t_alignment,
+                                                     trace_abi.byte_order,
+                                                     32,
+                                                     lst::integer_type::signedness::UNSIGNED,
+                                                     lst::integer_type::base::DECIMAL)));
 
        return lttng::make_unique<lst::structure_type>(0, std::move(packet_context_fields));
 }
 }; /* namespace */
 
-lsu::registry_channel::registry_channel(unsigned int channel_id,
-               const lst::abi& trace_abi,
-               std::string in_default_clock_class_name,
-               lsu::registry_channel::registered_listener_fn channel_registered_listener,
-               lsu::registry_channel::event_added_listener_fn event_added_listener) :
+lsu::registry_channel::registry_channel(
+       unsigned int channel_id,
+       const lst::abi& trace_abi,
+       std::string in_default_clock_class_name,
+       lsu::registry_channel::registered_listener_fn channel_registered_listener,
+       lsu::registry_channel::event_added_listener_fn event_added_listener) :
        lst::stream_class(channel_id,
-                       lst::stream_class::header_type::LARGE,
-                       std::move(in_default_clock_class_name)),
-       _key{-1ULL},
-       _consumer_key{-1ULL},
-       _next_event_id{0},
-       _is_registered_listener{channel_registered_listener},
-       _event_added_listener{event_added_listener},
-       _is_registered{false}
+                         lst::stream_class::header_type::LARGE,
+                         std::move(in_default_clock_class_name)),
+       _key{ -1ULL },
+       _consumer_key{ -1ULL },
+       _next_event_id{ 0 },
+       _is_registered_listener{ channel_registered_listener },
+       _event_added_listener{ event_added_listener },
+       _is_registered{ false }
 {
        _events = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
        if (!_events) {
@@ -312,17 +366,16 @@ lsu::registry_channel::registry_channel(unsigned int channel_id,
        _event_header = create_event_header(trace_abi, header_type_);
 }
 
-void lsu::registry_channel::add_event(
-               int session_objd,
-               int channel_objd,
-               std::string name,
-               std::string signature,
-               std::vector<lst::field::cuptr> event_fields,
-               int loglevel_value,
-               nonstd::optional<std::string> model_emf_uri,
-               lttng_buffer_type buffer_type,
-               const ust_app& app,
-               uint32_t& out_event_id)
+void lsu::registry_channel::add_event(int session_objd,
+                                     int channel_objd,
+                                     std::string name,
+                                     std::string signature,
+                                     std::vector<lst::field::cuptr> event_fields,
+                                     int loglevel_value,
+                                     nonstd::optional<std::string> model_emf_uri,
+                                     lttng_buffer_type buffer_type,
+                                     const ust_app& app,
+                                     uint32_t& out_event_id)
 {
        uint32_t event_id;
        struct cds_lfht_node *nptr;
@@ -334,27 +387,33 @@ void lsu::registry_channel::add_event(
         */
        if (session_objd < 0) {
                LTTNG_THROW_INVALID_ARGUMENT_ERROR(fmt::format(
-                               "Invalid session object descriptor provided by application: session descriptor = {}, app = {}",
-                               session_objd, app));
+                       "Invalid session object descriptor provided by application: session descriptor = {}, app = {}",
+                       session_objd,
+                       app));
        }
 
        if (channel_objd < 0) {
                LTTNG_THROW_INVALID_ARGUMENT_ERROR(fmt::format(
-                               "Invalid channel object descriptor provided by application: channel descriptor = {}, app = {}",
-                               channel_objd, app));
+                       "Invalid channel object descriptor provided by application: channel descriptor = {}, app = {}",
+                       channel_objd,
+                       app));
        }
 
        /* Check if we've reached the maximum possible id. */
        if (is_max_event_id(_next_event_id)) {
                LTTNG_THROW_ERROR(fmt::format(
-                               "Failed to allocate new event id (id would overflow): app = {}",
-                               app));
+                       "Failed to allocate new event id (id would overflow): app = {}", app));
        }
 
        auto event = lttng::make_unique_wrapper<lsu::registry_event, registry_event_destroy>(
-                       new lsu::registry_event(_next_event_id, id, session_objd, channel_objd,
-                                       std::move(name), std::move(signature),
-                                       std::move(event_fields), loglevel_value,
+               new lsu::registry_event(_next_event_id,
+                                       id,
+                                       session_objd,
+                                       channel_objd,
+                                       std::move(name),
+                                       std::move(signature),
+                                       std::move(event_fields),
+                                       loglevel_value,
                                        std::move(model_emf_uri)));
 
        DBG3("%s", fmt::format("UST registry creating event: event = {}", *event).c_str());
@@ -363,8 +422,11 @@ void lsu::registry_channel::add_event(
         * This is an add unique with a custom match function for event. The node
         * are matched using the event name and signature.
         */
-       nptr = cds_lfht_add_unique(_events->ht, _events->hash_fct(event.get(), lttng_ht_seed),
-                       _events->match_fct, event.get(), &event->_node);
+       nptr = cds_lfht_add_unique(_events->ht,
+                                  _events->hash_fct(event.get(), lttng_ht_seed),
+                                  _events->match_fct,
+                                  event.get(),
+                                  &event->_node);
        if (nptr != &event->_node) {
                if (buffer_type == LTTNG_BUFFER_PER_UID) {
                        /*
@@ -372,12 +434,12 @@ void lsu::registry_channel::add_event(
                         * returned node.
                         */
                        const auto existing_event = lttng::utils::container_of(
-                                       nptr, &lttng::sessiond::ust::registry_event::_node);
+                               nptr, &lttng::sessiond::ust::registry_event::_node);
                        event_id = existing_event->id;
                } else {
                        LTTNG_THROW_INVALID_ARGUMENT_ERROR(fmt::format(
-                                       "UST registry create event add unique failed for event: event = {}",
-                                       *event));
+                               "UST registry create event add unique failed for event: event = {}",
+                               *event));
                }
        } else {
                const auto& event_ref = *event;
@@ -404,7 +466,7 @@ lsu::registry_channel::~registry_channel()
        lttng_ht_destroy(_events);
 }
 
-const lttng::sessiond::trace::typelsu::registry_channel::event_context() const
+const lttng::sessiond::trace::type *lsu::registry_channel::event_context() const
 {
        LTTNG_ASSERT(_is_registered);
        return lst::stream_class::event_context();
@@ -431,7 +493,7 @@ void lsu::registry_channel::set_as_registered()
 }
 
 void lsu::registry_channel::_accept_on_event_classes(
-               lttng::sessiond::trace::trace_class_visitor& visitor) const
+       lttng::sessiond::trace::trace_class_visitor& visitor) const
 {
        std::vector<const lttng::sessiond::ust::registry_event *> sorted_event_classes;
 
@@ -442,17 +504,16 @@ void lsu::registry_channel::_accept_on_event_classes(
 
                DIAGNOSTIC_PUSH
                DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
-               cds_lfht_for_each_entry(_events->ht, &iter.iter, event, _node) {
+               cds_lfht_for_each_entry (_events->ht, &iter.iter, event, _node) {
                        sorted_event_classes.emplace_back(event);
                }
                DIAGNOSTIC_POP
        }
 
-       std::sort(sorted_event_classes.begin(), sorted_event_classes.end(),
-                       [](const lttng::sessiond::ust::registry_event *a,
-                                       const lttng::sessiond::ust::registry_event *b) {
-                               return a->id < b->id;
-                       });
+       std::sort(sorted_event_classes.begin(),
+                 sorted_event_classes.end(),
+                 [](const lttng::sessiond::ust::registry_event *a,
+                    const lttng::sessiond::ust::registry_event *b) { return a->id < b->id; });
 
        for (const auto event : sorted_event_classes) {
                event->accept(visitor);
index 543da2f6670b36bf19088f0fc20a285ed7adf07e..fec7fb54815339cf39cb75a7aeb3918eb729579e 100644 (file)
@@ -15,24 +15,24 @@ namespace lst = lttng::sessiond::trace;
 namespace lsu = lttng::sessiond::ust;
 
 lsu::registry_event::registry_event(unsigned int in_id,
-               unsigned int in_stream_class_id,
-               int in_session_objd,
-               int in_channel_objd,
-               std::string in_name,
-               std::string in_signature,
-               std::vector<lttng::sessiond::trace::field::cuptr> in_fields,
-               int in_loglevel_value,
-               nonstd::optional<std::string> in_model_emf_uri) :
+                                   unsigned int in_stream_class_id,
+                                   int in_session_objd,
+                                   int in_channel_objd,
+                                   std::string in_name,
+                                   std::string in_signature,
+                                   std::vector<lttng::sessiond::trace::field::cuptr> in_fields,
+                                   int in_loglevel_value,
+                                   nonstd::optional<std::string> in_model_emf_uri) :
        lst::event_class(in_id,
-                       in_stream_class_id,
-                       in_loglevel_value,
-                       std::move(in_name),
-                       std::move(in_model_emf_uri),
-                       lttng::make_unique<lst::structure_type>(0, std::move(in_fields))),
-       session_objd{in_session_objd},
-       channel_objd{in_channel_objd},
-       signature{std::move(in_signature)},
-       _metadata_dumped{false}
+                        in_stream_class_id,
+                        in_loglevel_value,
+                        std::move(in_name),
+                        std::move(in_model_emf_uri),
+                        lttng::make_unique<lst::structure_type>(0, std::move(in_fields))),
+       session_objd{ in_session_objd },
+       channel_objd{ in_channel_objd },
+       signature{ std::move(in_signature) },
+       _metadata_dumped{ false }
 {
        cds_lfht_node_init(&_node);
        _head = {};
index 9060e80bab95e8a0f8491bc070f1d0842be9298d..49dc60d5232090048c781d9f587a25fc79670925 100644 (file)
@@ -14,19 +14,19 @@ namespace lst = lttng::sessiond::trace;
 namespace lsu = lttng::sessiond::ust;
 
 lsu::registry_session_per_pid::registry_session_per_pid(const struct ust_app& app,
-               const struct lst::abi& in_abi,
-               uint32_t major,
-               uint32_t minor,
-               const char *root_shm_path,
-               const char *shm_path,
-               uid_t euid,
-               gid_t egid,
-               uint64_t tracing_id) :
-       registry_session{in_abi, major, minor, root_shm_path, shm_path, euid, egid, tracing_id},
-       _tracer_patch_level_version{app.version.patchlevel},
-       _vpid{app.pid},
-       _procname{app.name},
-       _app_creation_time{app.registration_time}
+                                                       const struct lst::abi& in_abi,
+                                                       uint32_t major,
+                                                       uint32_t minor,
+                                                       const char *root_shm_path,
+                                                       const char *shm_path,
+                                                       uid_t euid,
+                                                       gid_t egid,
+                                                       uint64_t tracing_id) :
+       registry_session{ in_abi, major, minor, root_shm_path, shm_path, euid, egid, tracing_id },
+       _tracer_patch_level_version{ app.version.patchlevel },
+       _vpid{ app.pid },
+       _procname{ app.name },
+       _app_creation_time{ app.registration_time }
 {
        lttng::pthread::lock_guard registry_lock(_lock);
        _generate_metadata();
@@ -41,10 +41,10 @@ void lsu::registry_session_per_pid::accept(lst::trace_class_environment_visitor&
 {
        registry_session::accept(visitor);
        visitor.visit(lst::environment_field<int64_t>("tracer_buffering_id", _vpid));
-       visitor.visit(lst::environment_field<int64_t>(
-                       "tracer_patchlevel", _tracer_patch_level_version));
+       visitor.visit(
+               lst::environment_field<int64_t>("tracer_patchlevel", _tracer_patch_level_version));
        visitor.visit(lst::environment_field<int64_t>("vpid", _vpid));
        visitor.visit(lst::environment_field<std::string>("procname", _procname));
        visitor.visit(lst::environment_field<std::string>(
-                       "vpid_datetime", lttng::utils::time_to_iso8601_str(_app_creation_time)));
+               "vpid_datetime", lttng::utils::time_to_iso8601_str(_app_creation_time)));
 }
index bfa50f3913d4adf1ea5f74e767a97c779d19d672..f5e1a93c2630d02bd9c59bea1256b85a3b8af42b 100644 (file)
 namespace lst = lttng::sessiond::trace;
 namespace lsu = lttng::sessiond::ust;
 
-lsu::registry_session_per_uid::registry_session_per_uid(
-               const struct lst::abi& in_abi,
-               uint32_t major,
-               uint32_t minor,
-               const char *root_shm_path,
-               const char *shm_path,
-               uid_t euid,
-               gid_t egid,
-               uint64_t tracing_id,
-               uid_t tracing_uid) :
-       registry_session{in_abi, major, minor, root_shm_path, shm_path, euid, egid, tracing_id},
-       _tracing_uid{tracing_uid}
+lsu::registry_session_per_uid::registry_session_per_uid(const struct lst::abi& in_abi,
+                                                       uint32_t major,
+                                                       uint32_t minor,
+                                                       const char *root_shm_path,
+                                                       const char *shm_path,
+                                                       uid_t euid,
+                                                       gid_t egid,
+                                                       uint64_t tracing_id,
+                                                       uid_t tracing_uid) :
+       registry_session{ in_abi, major, minor, root_shm_path, shm_path, euid, egid, tracing_id },
+       _tracing_uid{ tracing_uid }
 {
        lttng::pthread::lock_guard registry_lock(_lock);
        _generate_metadata();
index a8199bb6253ced527bf857cdeee12ab28262ac96..0bca522d1bc66d5518f23dd93eaddafda78f322a 100644 (file)
@@ -5,13 +5,13 @@
  *
  */
 
+#include "ctf2-trace-class-visitor.hpp"
 #include "field.hpp"
 #include "lttng-sessiond.hpp"
 #include "notification-thread-commands.hpp"
 #include "session.hpp"
 #include "trace-class.hpp"
 #include "tsdl-trace-class-visitor.hpp"
-#include "ctf2-trace-class-visitor.hpp"
 #include "ust-app.hpp"
 #include "ust-field-convert.hpp"
 #include "ust-registry.hpp"
@@ -68,7 +68,9 @@ void clear_metadata_file(int fd)
 {
        const auto lseek_ret = lseek(fd, 0, SEEK_SET);
        if (lseek_ret < 0) {
-               LTTNG_THROW_POSIX("Failed to seek to the beginning of the metadata file while clearing it", errno);
+               LTTNG_THROW_POSIX(
+                       "Failed to seek to the beginning of the metadata file while clearing it",
+                       errno);
        }
 
        const auto ret = ftruncate(fd, 0);
@@ -113,8 +115,7 @@ void destroy_channel(lsu::registry_channel *chan, bool notify) noexcept
 
        if (notify) {
                cmd_ret = notification_thread_command_remove_channel(
-                               the_notification_thread_handle,
-                               chan->_consumer_key, LTTNG_DOMAIN_UST);
+                       the_notification_thread_handle, chan->_consumer_key, LTTNG_DOMAIN_UST);
                if (cmd_ret != LTTNG_OK) {
                        ERR("Failed to remove channel from notification thread");
                }
@@ -126,8 +127,7 @@ void destroy_channel(lsu::registry_channel *chan, bool notify) noexcept
                /* Destroy all event associated with this registry. */
                DIAGNOSTIC_PUSH
                DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
-               cds_lfht_for_each_entry(
-                               chan->_events->ht, &iter.iter, event, _node) {
+               cds_lfht_for_each_entry (chan->_events->ht, &iter.iter, event, _node) {
                        /* Delete the node from the ht and free it. */
                        ust_registry_channel_destroy_event(chan, event);
                }
@@ -172,8 +172,7 @@ int ht_match_enum(struct cds_lfht_node *node, const void *_key)
 
        DIAGNOSTIC_PUSH
        DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
-       _enum = caa_container_of(node, lsu::registry_enum,
-                       node.node);
+       _enum = caa_container_of(node, lsu::registry_enum, node.node);
        DIAGNOSTIC_POP
 
        LTTNG_ASSERT(_enum);
@@ -231,28 +230,27 @@ void lsu::details::locked_registry_session_release(lsu::registry_session *sessio
 }
 
 lsu::registry_session::registry_session(const struct lst::abi& in_abi,
-               uint32_t major,
-               uint32_t minor,
-               const char *root_shm_path,
-               const char *shm_path,
-               uid_t euid,
-               gid_t egid,
-               uint64_t tracing_id) :
+                                       uint32_t major,
+                                       uint32_t minor,
+                                       const char *root_shm_path,
+                                       const char *shm_path,
+                                       uid_t euid,
+                                       gid_t egid,
+                                       uint64_t tracing_id) :
        lst::trace_class(in_abi, generate_uuid_or_throw()),
-       _root_shm_path{root_shm_path ? root_shm_path : ""},
-       _shm_path{shm_path ? shm_path : ""},
-       _metadata_path{_shm_path.size() > 0 ? fmt::format("{}/metadata", _shm_path) :
-                                                   std::string("")},
-       _uid{euid},
-       _gid{egid},
-       _app_tracer_version{.major = major, .minor = minor},
-       _tracing_id{tracing_id},
-       _clock{lttng::make_unique<lsu::clock_class>()},
-       _metadata_generating_visitor{lttng::make_unique<ls::tsdl::trace_class_visitor>(
-                       abi, [this](const std::string& fragment) {
-                               _append_metadata_fragment(fragment);
-                       })},
-       _packet_header{_create_packet_header()}
+       _root_shm_path{ root_shm_path ? root_shm_path : "" },
+       _shm_path{ shm_path ? shm_path : "" },
+       _metadata_path{ _shm_path.size() > 0 ? fmt::format("{}/metadata", _shm_path) :
+                                              std::string("") },
+       _uid{ euid },
+       _gid{ egid },
+       _app_tracer_version{ .major = major, .minor = minor },
+       _tracing_id{ tracing_id },
+       _clock{ lttng::make_unique<lsu::clock_class>() },
+       _metadata_generating_visitor{ lttng::make_unique<ls::tsdl::trace_class_visitor>(
+               abi,
+               [this](const std::string& fragment) { _append_metadata_fragment(fragment); }) },
+       _packet_header{ _create_packet_header() }
 {
        pthread_mutex_init(&_lock, NULL);
        if (_shm_path.size() > 0) {
@@ -263,11 +261,17 @@ lsu::registry_session::registry_session(const struct lst::abi& in_abi,
 
        if (_metadata_path.size() > 0) {
                /* Create metadata file. */
-               const int ret = run_as_open(_metadata_path.c_str(), O_WRONLY | O_CREAT | O_EXCL,
-                               S_IRUSR | S_IWUSR, euid, egid);
+               const int ret = run_as_open(_metadata_path.c_str(),
+                                           O_WRONLY | O_CREAT | O_EXCL,
+                                           S_IRUSR | S_IWUSR,
+                                           euid,
+                                           egid);
                if (ret < 0) {
-                       LTTNG_THROW_POSIX(fmt::format("Failed to open metadata file during registry session creation: path = {}",
-                                       _metadata_path), errno);
+                       LTTNG_THROW_POSIX(
+                               fmt::format(
+                                       "Failed to open metadata file during registry session creation: path = {}",
+                                       _metadata_path),
+                               errno);
                }
 
                _metadata_fd = ret;
@@ -293,30 +297,49 @@ lst::type::cuptr lsu::registry_session::_create_packet_header() const
        lst::structure_type::fields packet_header_fields;
 
        /* uint32_t magic */
-       packet_header_fields.emplace_back(lttng::make_unique<lst::field>("magic",
-                       lttng::make_unique<lst::integer_type>(abi.uint32_t_alignment,
-                                       abi.byte_order, 32, lst::integer_type::signedness::UNSIGNED,
-                                       lst::integer_type::base::HEXADECIMAL,
-                                       std::initializer_list<lst::integer_type::role>({lst::integer_type::role::PACKET_MAGIC_NUMBER}))));
+       packet_header_fields.emplace_back(lttng::make_unique<lst::field>(
+               "magic",
+               lttng::make_unique<lst::integer_type>(
+                       abi.uint32_t_alignment,
+                       abi.byte_order,
+                       32,
+                       lst::integer_type::signedness::UNSIGNED,
+                       lst::integer_type::base::HEXADECIMAL,
+                       std::initializer_list<lst::integer_type::role>(
+                               { lst::integer_type::role::PACKET_MAGIC_NUMBER }))));
 
        /* uuid */
-       packet_header_fields.emplace_back(lttng::make_unique<lst::field>("uuid",
-                       lttng::make_unique<lst::static_length_blob_type>(0, 16,
-                                       std::initializer_list<lst::static_length_blob_type::role>({lst::static_length_blob_type::role::METADATA_STREAM_UUID}))));
+       packet_header_fields.emplace_back(lttng::make_unique<lst::field>(
+               "uuid",
+               lttng::make_unique<lst::static_length_blob_type>(
+                       0,
+                       16,
+                       std::initializer_list<lst::static_length_blob_type::role>(
+                               { lst::static_length_blob_type::role::METADATA_STREAM_UUID }))));
 
        /* uint32_t stream_id */
-       packet_header_fields.emplace_back(lttng::make_unique<lst::field>("stream_id",
-                       lttng::make_unique<lst::integer_type>(abi.uint32_t_alignment,
-                                       abi.byte_order, 32, lst::integer_type::signedness::UNSIGNED,
-                                       lst::integer_type::base::DECIMAL,
-                                       std::initializer_list<lst::integer_type::role>({lst::integer_type::role::DATA_STREAM_CLASS_ID}))));
+       packet_header_fields.emplace_back(lttng::make_unique<lst::field>(
+               "stream_id",
+               lttng::make_unique<lst::integer_type>(
+                       abi.uint32_t_alignment,
+                       abi.byte_order,
+                       32,
+                       lst::integer_type::signedness::UNSIGNED,
+                       lst::integer_type::base::DECIMAL,
+                       std::initializer_list<lst::integer_type::role>(
+                               { lst::integer_type::role::DATA_STREAM_CLASS_ID }))));
 
        /* uint64_t stream_instance_id */
-       packet_header_fields.emplace_back(lttng::make_unique<lst::field>("stream_instance_id",
-                       lttng::make_unique<lst::integer_type>(abi.uint64_t_alignment,
-                                       abi.byte_order, 64, lst::integer_type::signedness::UNSIGNED,
-                                       lst::integer_type::base::DECIMAL,
-                                       std::initializer_list<lst::integer_type::role>({lst::integer_type::role::DATA_STREAM_ID}))));
+       packet_header_fields.emplace_back(lttng::make_unique<lst::field>(
+               "stream_instance_id",
+               lttng::make_unique<lst::integer_type>(
+                       abi.uint64_t_alignment,
+                       abi.byte_order,
+                       64,
+                       lst::integer_type::signedness::UNSIGNED,
+                       lst::integer_type::base::DECIMAL,
+                       std::initializer_list<lst::integer_type::role>(
+                               { lst::integer_type::role::DATA_STREAM_ID }))));
 
        return lttng::make_unique<lst::structure_type>(0, std::move(packet_header_fields));
 }
@@ -365,7 +388,7 @@ lsu::registry_session::~registry_session()
                /* Destroy all event associated with this registry. */
                DIAGNOSTIC_PUSH
                DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
-               cds_lfht_for_each_entry(_channels->ht, &iter.iter, chan, _node.node) {
+               cds_lfht_for_each_entry (_channels->ht, &iter.iter, chan, _node.node) {
                        /* Delete the node from the ht and free it. */
                        ret = lttng_ht_del(_channels.get(), &iter);
                        LTTNG_ASSERT(!ret);
@@ -389,8 +412,10 @@ lsu::registry_session::~registry_session()
 
        if (_root_shm_path[0]) {
                /* Try to delete the directory hierarchy. */
-               (void) run_as_rmdir_recursive(_root_shm_path.c_str(), _uid, _gid,
-                               LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
+               (void) run_as_rmdir_recursive(_root_shm_path.c_str(),
+                                             _uid,
+                                             _gid,
+                                             LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
        }
 
        /* Destroy the enum hash table */
@@ -426,39 +451,41 @@ void lsu::registry_session::add_channel(uint64_t key)
         * the metadata can be dumped for that event.
         */
        if (is_max_channel_id(_used_channel_id)) {
-               LTTNG_THROW_ERROR(fmt::format("Failed to allocate unique id for channel under session while adding channel"));
+               LTTNG_THROW_ERROR(fmt::format(
+                       "Failed to allocate unique id for channel under session while adding channel"));
        }
 
        auto chan = new lsu::registry_channel(
-                       _get_next_channel_id(), abi, _clock->name,
-                       /* Registered channel listener. */
-                       [this](const lsu::registry_channel& registered_channel) {
-                               /*
-                                * Channel registration completed, serialize it's layout's
-                                * description.
-                                */
-                               registered_channel.accept(*_metadata_generating_visitor);
-                       },
-                       /* Added event listener. */
-                       [this](const lsu::registry_channel& channel,
-                                       const lsu::registry_event& added_event) {
-                               /*
-                                * The channel and its event classes will be dumped at once when
-                                * it is registered. This check prevents event classes from being
-                                * declared before their stream class.
-                                */
-                               if (channel.is_registered()) {
-                                       added_event.accept(*_metadata_generating_visitor);
-                               }
-                       });
+               _get_next_channel_id(),
+               abi,
+               _clock->name,
+               /* Registered channel listener. */
+               [this](const lsu::registry_channel& registered_channel) {
+                       /*
+                        * Channel registration completed, serialize it's layout's
+                        * description.
+                        */
+                       registered_channel.accept(*_metadata_generating_visitor);
+               },
+               /* Added event listener. */
+               [this](const lsu::registry_channel& channel,
+                      const lsu::registry_event& added_event) {
+                       /*
+                        * The channel and its event classes will be dumped at once when
+                        * it is registered. This check prevents event classes from being
+                        * declared before their stream class.
+                        */
+                       if (channel.is_registered()) {
+                               added_event.accept(*_metadata_generating_visitor);
+                       }
+               });
 
        lttng::urcu::read_lock_guard rcu_read_lock_guard;
        lttng_ht_node_init_u64(&chan->_node, key);
        lttng_ht_add_unique_u64(_channels.get(), &chan->_node);
 }
 
-lttng::sessiond::ust::registry_channel& lsu::registry_session::channel(
-               uint64_t channel_key) const
+lttng::sessiond::ust::registry_channel& lsu::registry_session::channel(uint64_t channel_key) const
 {
        lttng::urcu::read_lock_guard read_lock_guard;
        struct lttng_ht_node_u64 *node;
@@ -469,8 +496,8 @@ lttng::sessiond::ust::registry_channel& lsu::registry_session::channel(
        lttng_ht_lookup(_channels.get(), &channel_key, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
        if (!node) {
-               LTTNG_THROW_INVALID_ARGUMENT_ERROR(fmt::format(
-                               "Invalid channel key provided: channel key = {}", channel_key));
+               LTTNG_THROW_INVALID_ARGUMENT_ERROR(
+                       fmt::format("Invalid channel key provided: channel key = {}", channel_key));
        }
 
        DIAGNOSTIC_PUSH
@@ -496,7 +523,7 @@ void lsu::registry_session::remove_channel(uint64_t channel_key, bool notify)
 }
 
 void lsu::registry_session::accept(
-               lttng::sessiond::trace::trace_class_environment_visitor& visitor) const
+       lttng::sessiond::trace::trace_class_environment_visitor& visitor) const
 {
        ASSERT_LOCKED(_lock);
 
@@ -504,8 +531,9 @@ void lsu::registry_session::accept(
        visitor.visit(lst::environment_field<const char *>("tracer_name", "lttng-ust"));
        visitor.visit(lst::environment_field<int64_t>("tracer_major", _app_tracer_version.major));
        visitor.visit(lst::environment_field<int64_t>("tracer_minor", _app_tracer_version.minor));
-       visitor.visit(lst::environment_field<const char *>("tracer_buffering_scheme",
-                       buffering_scheme() == LTTNG_BUFFER_PER_PID ? "pid" : "uid"));
+       visitor.visit(lst::environment_field<const char *>(
+               "tracer_buffering_scheme",
+               buffering_scheme() == LTTNG_BUFFER_PER_PID ? "pid" : "uid"));
        visitor.visit(lst::environment_field<int64_t>("architecture_bit_width", abi.bits_per_long));
 
        {
@@ -516,11 +544,12 @@ void lsu::registry_session::accept(
                LTTNG_ASSERT(session);
                ASSERT_LOCKED(session->lock);
 
-               visitor.visit(lst::environment_field<const char *>("trace_name",
-                               session->has_auto_generated_name ? DEFAULT_SESSION_NAME :
-                                                                        session->name));
-               visitor.visit(lst::environment_field<std::string>("trace_creation_datetime",
-                               lttng::utils::time_to_iso8601_str(session->creation_time)));
+               visitor.visit(lst::environment_field<const char *>(
+                       "trace_name",
+                       session->has_auto_generated_name ? DEFAULT_SESSION_NAME : session->name));
+               visitor.visit(lst::environment_field<std::string>(
+                       "trace_creation_datetime",
+                       lttng::utils::time_to_iso8601_str(session->creation_time)));
                visitor.visit(lst::environment_field<const char *>("hostname", session->hostname));
        }
 }
@@ -544,17 +573,16 @@ void lsu::registry_session::_accept_on_stream_classes(lst::trace_class_visitor&
 
                DIAGNOSTIC_PUSH
                DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
-               cds_lfht_for_each_entry(_channels->ht, &channel_it.iter, channel, _node.node) {
+               cds_lfht_for_each_entry (_channels->ht, &channel_it.iter, channel, _node.node) {
                        sorted_stream_classes.emplace_back(channel);
                }
                DIAGNOSTIC_POP
        }
 
-       std::sort(sorted_stream_classes.begin(), sorted_stream_classes.end(),
-                       [](const lttng::sessiond::ust::registry_channel *a,
-                                       const lttng::sessiond::ust::registry_channel *b) {
-                               return a->id < b->id;
-                       });
+       std::sort(sorted_stream_classes.begin(),
+                 sorted_stream_classes.end(),
+                 [](const lttng::sessiond::ust::registry_channel *a,
+                    const lttng::sessiond::ust::registry_channel *b) { return a->id < b->id; });
 
        for (const auto stream_class : sorted_stream_classes) {
                stream_class->accept(visitor);
@@ -588,17 +616,19 @@ void lsu::registry_session::_increase_metadata_size(size_t reservation_length)
 
        /* Rounding the new allocation length to the next power of 2 would overflow. */
        if (new_alloc_len > (UINT32_MAX >> 1)) {
-               LTTNG_THROW_ERROR("Failed to reserve trace metadata storage as the new size would overflow");
+               LTTNG_THROW_ERROR(
+                       "Failed to reserve trace metadata storage as the new size would overflow");
        }
 
        /* The current allocation length is already the largest we can afford. */
        if ((old_alloc_len << 1) > (UINT32_MAX >> 1)) {
-               LTTNG_THROW_ERROR("Failed to reserve trace metadata storage as the max size was already reached");
+               LTTNG_THROW_ERROR(
+                       "Failed to reserve trace metadata storage as the max size was already reached");
        }
 
        if (new_alloc_len > old_alloc_len) {
-               new_alloc_len = std::max<size_t>(
-                               1U << get_count_order(new_alloc_len), old_alloc_len << 1);
+               new_alloc_len =
+                       std::max<size_t>(1U << get_count_order(new_alloc_len), old_alloc_len << 1);
 
                auto newptr = (char *) realloc(_metadata, new_alloc_len);
                if (!newptr) {
@@ -624,11 +654,10 @@ void lsu::registry_session::_append_metadata_fragment(const std::string& fragmen
 
        if (_metadata_fd >= 0) {
                const auto bytes_written =
-                               lttng_write(_metadata_fd, fragment.c_str(), fragment.size());
+                       lttng_write(_metadata_fd, fragment.c_str(), fragment.size());
 
                if (bytes_written != fragment.size()) {
-                       LTTNG_THROW_POSIX("Failed to write trace metadata fragment to file",
-                                       errno);
+                       LTTNG_THROW_POSIX("Failed to write trace metadata fragment to file", errno);
                }
        }
 }
@@ -688,12 +717,15 @@ lsu::registry_session::enumeration(const char *enum_name, uint64_t enum_id) cons
        reg_enum_lookup.id = enum_id;
        cds_lfht_lookup(_enums->ht,
                        ht_hash_enum((void *) &reg_enum_lookup, lttng_ht_seed),
-                       ht_match_enum_id, &reg_enum_lookup, &iter.iter);
+                       ht_match_enum_id,
+                       &reg_enum_lookup,
+                       &iter.iter);
        node = lttng_ht_iter_get_node_str(&iter);
        if (!node) {
                LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
-                               "Unknown enumeration referenced by application event field: enum name = `{}`, enum id = {}",
-                               enum_name, enum_id));
+                       "Unknown enumeration referenced by application event field: enum name = `{}`, enum id = {}",
+                       enum_name,
+                       enum_id));
        }
 
        DIAGNOSTIC_PUSH
@@ -701,15 +733,15 @@ lsu::registry_session::enumeration(const char *enum_name, uint64_t enum_id) cons
        reg_enum = lttng::utils::container_of(node, &lsu::registry_enum::node);
        DIAGNOSTIC_POP
 
-       return lsu::registry_enum::const_rcu_protected_reference{*reg_enum, std::move(rcu_lock)};
+       return lsu::registry_enum::const_rcu_protected_reference{ *reg_enum, std::move(rcu_lock) };
 }
 
 /*
  * Lookup enumeration by name and comparing enumeration entries.
  * Needs to be called from RCU read-side critical section.
  */
-lsu::registry_enum *lsu::registry_session::_lookup_enum(
-               const lsu::registry_enum *reg_enum_lookup) const
+lsu::registry_enum *
+lsu::registry_session::_lookup_enum(const lsu::registry_enum *reg_enum_lookup) const
 {
        lsu::registry_enum *reg_enum = NULL;
        struct lttng_ht_node_str *node;
@@ -717,8 +749,11 @@ lsu::registry_enum *lsu::registry_session::_lookup_enum(
 
        ASSERT_RCU_READ_LOCKED();
 
-       cds_lfht_lookup(_enums->ht, ht_hash_enum((void *) reg_enum_lookup, lttng_ht_seed),
-                       ht_match_enum, reg_enum_lookup, &iter.iter);
+       cds_lfht_lookup(_enums->ht,
+                       ht_hash_enum((void *) reg_enum_lookup, lttng_ht_seed),
+                       ht_match_enum,
+                       reg_enum_lookup,
+                       &iter.iter);
        node = lttng_ht_iter_get_node_str(&iter);
        if (!node) {
                goto end;
@@ -741,15 +776,17 @@ end:
  *
  * We receive ownership of entries.
  */
-void lsu::registry_session::create_or_find_enum(
-               int session_objd, const char *enum_name,
-               struct lttng_ust_ctl_enum_entry *raw_entries, size_t nr_entries,
-               uint64_t *enum_id)
+void lsu::registry_session::create_or_find_enum(int session_objd,
+                                               const char *enum_name,
+                                               struct lttng_ust_ctl_enum_entry *raw_entries,
+                                               size_t nr_entries,
+                                               uint64_t *enum_id)
 {
        struct cds_lfht_node *nodep;
        lsu::registry_enum *reg_enum = NULL, *old_reg_enum;
        lttng::urcu::read_lock_guard read_lock_guard;
-       auto entries = lttng::make_unique_wrapper<lttng_ust_ctl_enum_entry, lttng::free>(raw_entries);
+       auto entries =
+               lttng::make_unique_wrapper<lttng_ust_ctl_enum_entry, lttng::free>(raw_entries);
 
        LTTNG_ASSERT(enum_name);
 
@@ -759,26 +796,23 @@ void lsu::registry_session::create_or_find_enum(
         */
        if (session_objd < 0) {
                LTTNG_THROW_INVALID_ARGUMENT_ERROR(fmt::format(
-                               "Invalid parameters used to create or look-up enumeration from registry session: session_objd = {}",
-                               session_objd));
+                       "Invalid parameters used to create or look-up enumeration from registry session: session_objd = {}",
+                       session_objd));
        }
        if (nr_entries == 0) {
                LTTNG_THROW_INVALID_ARGUMENT_ERROR(fmt::format(
-                               "Invalid parameters used to create or look-up enumeration from registry session: nr_entries = {}",
-                               nr_entries));
+                       "Invalid parameters used to create or look-up enumeration from registry session: nr_entries = {}",
+                       nr_entries));
        }
-       if (lttng_strnlen(enum_name, LTTNG_UST_ABI_SYM_NAME_LEN) ==
-                                       LTTNG_UST_ABI_SYM_NAME_LEN) {
+       if (lttng_strnlen(enum_name, LTTNG_UST_ABI_SYM_NAME_LEN) == LTTNG_UST_ABI_SYM_NAME_LEN) {
                LTTNG_THROW_INVALID_ARGUMENT_ERROR(
-                               "Invalid parameters used to create or look-up enumeration from registry session: enumeration name is not null terminated");
+                       "Invalid parameters used to create or look-up enumeration from registry session: enumeration name is not null terminated");
        }
 
        if (entries->start.signedness) {
-               reg_enum = new lsu::registry_signed_enum(
-                               enum_name, entries.get(), nr_entries);
+               reg_enum = new lsu::registry_signed_enum(enum_name, entries.get(), nr_entries);
        } else {
-               reg_enum = new lsu::registry_unsigned_enum(
-                               enum_name, entries.get(), nr_entries);
+               reg_enum = new lsu::registry_unsigned_enum(enum_name, entries.get(), nr_entries);
        }
 
        old_reg_enum = _lookup_enum(reg_enum);
@@ -788,22 +822,25 @@ void lsu::registry_session::create_or_find_enum(
                destroy_enum(reg_enum);
                reg_enum = old_reg_enum;
        } else {
-               DBG("UST registry creating enum: %s, sess_objd: %u",
-                               enum_name, session_objd);
+               DBG("UST registry creating enum: %s, sess_objd: %u", enum_name, session_objd);
                if (_next_enum_id == -1ULL) {
                        destroy_enum(reg_enum);
-                       LTTNG_THROW_ERROR("Failed to allocate unique enumeration ID as it would overflow");
+                       LTTNG_THROW_ERROR(
+                               "Failed to allocate unique enumeration ID as it would overflow");
                }
 
                reg_enum->id = _next_enum_id++;
                nodep = cds_lfht_add_unique(_enums->ht,
-                               ht_hash_enum(reg_enum, lttng_ht_seed),
-                               ht_match_enum_id, reg_enum,
-                               &reg_enum->node.node);
+                                           ht_hash_enum(reg_enum, lttng_ht_seed),
+                                           ht_match_enum_id,
+                                           reg_enum,
+                                           &reg_enum->node.node);
                LTTNG_ASSERT(nodep == &reg_enum->node.node);
        }
 
        DBG("UST registry reply with enum %s with id %" PRIu64 " in sess_objd: %u",
-                       enum_name, reg_enum->id, session_objd);
+           enum_name,
+           reg_enum->id,
+           session_objd);
        *enum_id = reg_enum->id;
 }
index a6ceece9882dad64dfd20606eb2148446bad05e4..57aa2236fcbe08d7a26710462c038000dc462c98 100644 (file)
@@ -7,12 +7,12 @@
 
 #define _LGPL_SOURCE
 
-#include "ust-registry.hpp"
 #include "lttng-sessiond.hpp"
 #include "notification-thread-commands.hpp"
 #include "ust-app.hpp"
 #include "ust-registry-session-pid.hpp"
 #include "ust-registry-session-uid.hpp"
+#include "ust-registry.hpp"
 #include "utils.hpp"
 
 #include <common/common.hpp>
@@ -20,6 +20,7 @@
 #include <common/format.hpp>
 #include <common/hashtable/utils.hpp>
 #include <common/make-unique-wrapper.hpp>
+
 #include <lttng/lttng.h>
 
 #include <inttypes.h>
@@ -36,7 +37,7 @@ static void ust_registry_event_destroy_rcu(struct rcu_head *head)
        DIAGNOSTIC_PUSH
        DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
        lttng::sessiond::ust::registry_event *event =
-                       lttng::utils::container_of(head, &lttng::sessiond::ust::registry_event::_head);
+               lttng::utils::container_of(head, &lttng::sessiond::ust::registry_event::_head);
        DIAGNOSTIC_POP
 
        lttng::sessiond::ust::registry_event_destroy(event);
@@ -47,7 +48,7 @@ static void ust_registry_event_destroy_rcu(struct rcu_head *head)
  * This MUST be called within a RCU read side lock section.
  */
 void ust_registry_channel_destroy_event(lsu::registry_channel *chan,
-               lttng::sessiond::ust::registry_event *event)
+                                       lttng::sessiond::ust::registry_event *event)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -67,18 +68,25 @@ void ust_registry_channel_destroy_event(lsu::registry_channel *chan,
 }
 
 lsu::registry_session *ust_registry_session_per_uid_create(const lttng::sessiond::trace::abi& abi,
-               uint32_t major,
-               uint32_t minor,
-               const char *root_shm_path,
-               const char *shm_path,
-               uid_t euid,
-               gid_t egid,
-               uint64_t tracing_id,
-               uid_t tracing_uid)
+                                                          uint32_t major,
+                                                          uint32_t minor,
+                                                          const char *root_shm_path,
+                                                          const char *shm_path,
+                                                          uid_t euid,
+                                                          gid_t egid,
+                                                          uint64_t tracing_id,
+                                                          uid_t tracing_uid)
 {
        try {
-               return new lsu::registry_session_per_uid(abi, major, minor, root_shm_path, shm_path,
-                               euid, egid, tracing_id, tracing_uid);
+               return new lsu::registry_session_per_uid(abi,
+                                                        major,
+                                                        minor,
+                                                        root_shm_path,
+                                                        shm_path,
+                                                        euid,
+                                                        egid,
+                                                        tracing_id,
+                                                        tracing_uid);
        } catch (const std::exception& ex) {
                ERR("Failed to create per-uid registry session: %s", ex.what());
                return nullptr;
@@ -86,18 +94,18 @@ lsu::registry_session *ust_registry_session_per_uid_create(const lttng::sessiond
 }
 
 lsu::registry_session *ust_registry_session_per_pid_create(struct ust_app *app,
-               const lttng::sessiond::trace::abi& abi,
-               uint32_t major,
-               uint32_t minor,
-               const char *root_shm_path,
-               const char *shm_path,
-               uid_t euid,
-               gid_t egid,
-               uint64_t tracing_id)
+                                                          const lttng::sessiond::trace::abi& abi,
+                                                          uint32_t major,
+                                                          uint32_t minor,
+                                                          const char *root_shm_path,
+                                                          const char *shm_path,
+                                                          uid_t euid,
+                                                          gid_t egid,
+                                                          uint64_t tracing_id)
 {
        try {
-               return new lsu::registry_session_per_pid(*app, abi, major, minor, root_shm_path,
-                               shm_path, euid, egid, tracing_id);
+               return new lsu::registry_session_per_pid(
+                       *app, abi, major, minor, root_shm_path, shm_path, euid, egid, tracing_id);
        } catch (const std::exception& ex) {
                ERR("Failed to create per-pid registry session: %s", ex.what());
                return nullptr;
@@ -113,9 +121,9 @@ void ust_registry_session_destroy(lsu::registry_session *reg)
        delete reg;
 }
 
-lsu::registry_enum::registry_enum(
-               std::string in_name, enum lst::integer_type::signedness in_signedness) :
-       name{std::move(in_name)}, signedness{in_signedness}
+lsu::registry_enum::registry_enum(std::string in_name,
+                                 enum lst::integer_type::signedness in_signedness) :
+       name{ std::move(in_name) }, signedness{ in_signedness }
 {
        cds_lfht_node_init(&this->node.node);
        this->rcu_head = {};
index cecaf4d584d244a5a54c2123dc9ce88e0d62c281..988c786572232df41f4a1ef06989c4211c722aca 100644 (file)
@@ -5,14 +5,15 @@
  *
  */
 
-#include <lttng/ust-sigbus.h>
-#include <lttng/ust-ctl.h>
-#include <lttng/lttng-export.h>
 #include "ust-sigbus.hpp"
 
+#include <lttng/lttng-export.h>
+#include <lttng/ust-ctl.h>
+#include <lttng/ust-sigbus.h>
+
 LTTNG_EXPORT DEFINE_LTTNG_UST_SIGBUS_STATE();
 
 void lttng_ust_handle_sigbus(void *address)
 {
-        lttng_ust_ctl_sigbus_handle(address);
+       lttng_ust_ctl_sigbus_handle(address);
 }
index 8fec340403c4994fcee00a0678dc071906c66554..b4d3c00a498b2644d34c7b7bccdf9a26d1ee2938 100644 (file)
@@ -7,14 +7,14 @@
  */
 
 #define _LGPL_SOURCE
-#include <stdlib.h>
-#include <unistd.h>
+#include "lttng-sessiond.hpp"
+#include "snapshot.hpp"
+#include "utils.hpp"
 
 #include <common/error.hpp>
 
-#include "utils.hpp"
-#include "snapshot.hpp"
-#include "lttng-sessiond.hpp"
+#include <stdlib.h>
+#include <unistd.h>
 
 /*
  * Write to writable pipe used to notify a thread.
@@ -37,8 +37,11 @@ int notify_thread_pipe(int wpipe)
        return (int) ret;
 }
 
-int loglevels_match(int a_loglevel_type, int a_loglevel_value,
-       int b_loglevel_type, int b_loglevel_value, int loglevel_all_type)
+int loglevels_match(int a_loglevel_type,
+                   int a_loglevel_value,
+                   int b_loglevel_type,
+                   int b_loglevel_value,
+                   int loglevel_all_type)
 {
        int match = 1;
 
@@ -68,7 +71,6 @@ const char *session_get_base_path(const struct ltt_session *session)
 
 const char *consumer_output_get_base_path(const struct consumer_output *output)
 {
-       return output->type == CONSUMER_DST_LOCAL ?
-                       output->dst.session_root_path :
-                       output->dst.net.base_dir;
+       return output->type == CONSUMER_DST_LOCAL ? output->dst.session_root_path :
+                                                   output->dst.net.base_dir;
 }
index 5db0c5664888193d1b943558faf2ae4d3556a4aa..7285b5b75f7711879f02e1993bd1032c8d8b840b 100644 (file)
@@ -7,6 +7,12 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+
+#include <lttng/domain-internal.hpp>
+
 #include <ctype.h>
 #include <popt.h>
 #include <stdio.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-
 #include <urcu/list.h>
 
-#include <lttng/domain-internal.hpp>
-#include <common/mi-lttng.hpp>
-
-#include "../command.hpp"
-
 static char *opt_channel_name;
 static char *opt_session_name;
 static int opt_kernel;
@@ -34,7 +34,7 @@ static char *opt_type;
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-add-context.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -54,49 +54,49 @@ static struct mi_writer *writer;
  * Taken from the LTTng ABI except for "UNKNOWN".
  */
 enum context_type {
-       CONTEXT_UNKNOWN      = -1,
-       CONTEXT_PID          = 0,
-       CONTEXT_PERF_COUNTER = 1,       /* Backward compat. */
-       CONTEXT_PROCNAME     = 2,
-       CONTEXT_PRIO         = 3,
-       CONTEXT_NICE         = 4,
-       CONTEXT_VPID         = 5,
-       CONTEXT_TID          = 6,
-       CONTEXT_VTID         = 7,
-       CONTEXT_PPID         = 8,
-       CONTEXT_VPPID        = 9,
-       CONTEXT_PTHREAD_ID   = 10,
-       CONTEXT_HOSTNAME     = 11,
-       CONTEXT_IP           = 12,
+       CONTEXT_UNKNOWN = -1,
+       CONTEXT_PID = 0,
+       CONTEXT_PERF_COUNTER = 1, /* Backward compat. */
+       CONTEXT_PROCNAME = 2,
+       CONTEXT_PRIO = 3,
+       CONTEXT_NICE = 4,
+       CONTEXT_VPID = 5,
+       CONTEXT_TID = 6,
+       CONTEXT_VTID = 7,
+       CONTEXT_PPID = 8,
+       CONTEXT_VPPID = 9,
+       CONTEXT_PTHREAD_ID = 10,
+       CONTEXT_HOSTNAME = 11,
+       CONTEXT_IP = 12,
        CONTEXT_PERF_CPU_COUNTER = 13,
        CONTEXT_PERF_THREAD_COUNTER = 14,
-       CONTEXT_APP_CONTEXT  = 15,
+       CONTEXT_APP_CONTEXT = 15,
        CONTEXT_INTERRUPTIBLE = 16,
-       CONTEXT_PREEMPTIBLE  = 17,
+       CONTEXT_PREEMPTIBLE = 17,
        CONTEXT_NEED_RESCHEDULE = 18,
-       CONTEXT_MIGRATABLE   = 19,
+       CONTEXT_MIGRATABLE = 19,
        CONTEXT_CALLSTACK_KERNEL = 20,
        CONTEXT_CALLSTACK_USER = 21,
-       CONTEXT_CGROUP_NS    = 22,
-       CONTEXT_IPC_NS       = 23,
-       CONTEXT_MNT_NS       = 24,
-       CONTEXT_NET_NS       = 25,
-       CONTEXT_PID_NS       = 26,
-       CONTEXT_USER_NS      = 27,
-       CONTEXT_UTS_NS       = 28,
-       CONTEXT_UID          = 29,
-       CONTEXT_EUID         = 30,
-       CONTEXT_SUID         = 31,
-       CONTEXT_GID          = 32,
-       CONTEXT_EGID         = 33,
-       CONTEXT_SGID         = 34,
-       CONTEXT_VUID         = 35,
-       CONTEXT_VEUID        = 36,
-       CONTEXT_VSUID        = 37,
-       CONTEXT_VGID         = 38,
-       CONTEXT_VEGID        = 39,
-       CONTEXT_VSGID        = 40,
-       CONTEXT_TIME_NS      = 41,
+       CONTEXT_CGROUP_NS = 22,
+       CONTEXT_IPC_NS = 23,
+       CONTEXT_MNT_NS = 24,
+       CONTEXT_NET_NS = 25,
+       CONTEXT_PID_NS = 26,
+       CONTEXT_USER_NS = 27,
+       CONTEXT_UTS_NS = 28,
+       CONTEXT_UID = 29,
+       CONTEXT_EUID = 30,
+       CONTEXT_SUID = 31,
+       CONTEXT_GID = 32,
+       CONTEXT_EGID = 33,
+       CONTEXT_SGID = 34,
+       CONTEXT_VUID = 35,
+       CONTEXT_VEUID = 36,
+       CONTEXT_VSUID = 37,
+       CONTEXT_VGID = 38,
+       CONTEXT_VEGID = 39,
+       CONTEXT_VSGID = 40,
+       CONTEXT_TIME_NS = 41,
 };
 
 /*
@@ -110,25 +110,25 @@ enum perf_type {
 };
 
 enum perf_count_hard {
-       PERF_COUNT_HW_CPU_CYCLES                = 0,
-       PERF_COUNT_HW_INSTRUCTIONS              = 1,
-       PERF_COUNT_HW_CACHE_REFERENCES          = 2,
-       PERF_COUNT_HW_CACHE_MISSES              = 3,
-       PERF_COUNT_HW_BRANCH_INSTRUCTIONS       = 4,
-       PERF_COUNT_HW_BRANCH_MISSES             = 5,
-       PERF_COUNT_HW_BUS_CYCLES                = 6,
-       PERF_COUNT_HW_STALLED_CYCLES_FRONTEND   = 7,
-       PERF_COUNT_HW_STALLED_CYCLES_BACKEND    = 8,
+       PERF_COUNT_HW_CPU_CYCLES = 0,
+       PERF_COUNT_HW_INSTRUCTIONS = 1,
+       PERF_COUNT_HW_CACHE_REFERENCES = 2,
+       PERF_COUNT_HW_CACHE_MISSES = 3,
+       PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
+       PERF_COUNT_HW_BRANCH_MISSES = 5,
+       PERF_COUNT_HW_BUS_CYCLES = 6,
+       PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7,
+       PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8,
 };
 
 enum perf_count_soft {
-       PERF_COUNT_SW_CPU_CLOCK        = 0,
-       PERF_COUNT_SW_TASK_CLOCK       = 1,
-       PERF_COUNT_SW_PAGE_FAULTS      = 2,
+       PERF_COUNT_SW_CPU_CLOCK = 0,
+       PERF_COUNT_SW_TASK_CLOCK = 1,
+       PERF_COUNT_SW_PAGE_FAULTS = 2,
        PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
-       PERF_COUNT_SW_CPU_MIGRATIONS   = 4,
-       PERF_COUNT_SW_PAGE_FAULTS_MIN  = 5,
-       PERF_COUNT_SW_PAGE_FAULTS_MAJ  = 6,
+       PERF_COUNT_SW_CPU_MIGRATIONS = 4,
+       PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
+       PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
        PERF_COUNT_SW_ALIGNMENT_FAULTS = 7,
        PERF_COUNT_SW_EMULATION_FAULTS = 8,
 };
@@ -141,121 +141,121 @@ enum perf_count_soft {
  *       { accesses, misses }
  */
 enum perf_hw_cache_id {
-       PERF_COUNT_HW_CACHE_L1D                 = 0,
-       PERF_COUNT_HW_CACHE_L1I                 = 1,
-       PERF_COUNT_HW_CACHE_LL                  = 2,
-       PERF_COUNT_HW_CACHE_DTLB                = 3,
-       PERF_COUNT_HW_CACHE_ITLB                = 4,
-       PERF_COUNT_HW_CACHE_BPU                 = 5,
-
-       PERF_COUNT_HW_CACHE_MAX,                /* non-ABI */
+       PERF_COUNT_HW_CACHE_L1D = 0,
+       PERF_COUNT_HW_CACHE_L1I = 1,
+       PERF_COUNT_HW_CACHE_LL = 2,
+       PERF_COUNT_HW_CACHE_DTLB = 3,
+       PERF_COUNT_HW_CACHE_ITLB = 4,
+       PERF_COUNT_HW_CACHE_BPU = 5,
+
+       PERF_COUNT_HW_CACHE_MAX, /* non-ABI */
 };
 
 enum perf_hw_cache_op_id {
-       PERF_COUNT_HW_CACHE_OP_READ             = 0,
-       PERF_COUNT_HW_CACHE_OP_WRITE            = 1,
-       PERF_COUNT_HW_CACHE_OP_PREFETCH         = 2,
+       PERF_COUNT_HW_CACHE_OP_READ = 0,
+       PERF_COUNT_HW_CACHE_OP_WRITE = 1,
+       PERF_COUNT_HW_CACHE_OP_PREFETCH = 2,
 
-       PERF_COUNT_HW_CACHE_OP_MAX,             /* non-ABI */
+       PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */
 };
 
 enum perf_hw_cache_op_result_id {
-       PERF_COUNT_HW_CACHE_RESULT_ACCESS       = 0,
-       PERF_COUNT_HW_CACHE_RESULT_MISS         = 1,
+       PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0,
+       PERF_COUNT_HW_CACHE_RESULT_MISS = 1,
 
-       PERF_COUNT_HW_CACHE_RESULT_MAX,         /* non-ABI */
+       PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */
 };
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",           'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"session",        's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0},
-       {"channel",        'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0},
-       {"kernel",         'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
-       {"userspace",      'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0},
-       {"jul",            'j', POPT_ARG_NONE, 0, OPT_JUL, 0, 0},
-       {"log4j",          'l', POPT_ARG_NONE, 0, OPT_LOG4J, 0, 0},
-       {"type",           't', POPT_ARG_STRING, &opt_type, OPT_TYPE, 0, 0},
-       {"list",           0, POPT_ARG_NONE, NULL, OPT_LIST, NULL, NULL},
-       {"list-options",   0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
+       { "channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0 },
+       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0 },
+       { "userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0 },
+       { "jul", 'j', POPT_ARG_NONE, 0, OPT_JUL, 0, 0 },
+       { "log4j", 'l', POPT_ARG_NONE, 0, OPT_LOG4J, 0, 0 },
+       { "type", 't', POPT_ARG_STRING, &opt_type, OPT_TYPE, 0, 0 },
+       { "list", 0, POPT_ARG_NONE, NULL, OPT_LIST, NULL, NULL },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 /*
  * Context options
  */
-#define PERF_HW(optstr, name, type, hide)                              \
-       {                                                               \
-               optstr, type, PERF_COUNT_HW_##name, hide                \
+#define PERF_HW(optstr, name, type, hide)                \
+       {                                                \
+               optstr, type, PERF_COUNT_HW_##name, hide \
        }
 
-#define PERF_SW(optstr, name, type, hide)                              \
-       {                                                               \
-               optstr, type, PERF_COUNT_SW_##name, hide                \
+#define PERF_SW(optstr, name, type, hide)                \
+       {                                                \
+               optstr, type, PERF_COUNT_SW_##name, hide \
        }
 
-#define _PERF_HW_CACHE(optstr, name, type, op, result, hide)           \
-       {                                                               \
-               optstr, type,                                           \
-               PERF_COUNT_HW_CACHE_##name,                             \
-               PERF_COUNT_HW_CACHE_OP_##op,                            \
-               PERF_COUNT_HW_CACHE_RESULT_##result,                    \
-               hide,                                                   \
+#define _PERF_HW_CACHE(optstr, name, type, op, result, hide)                           \
+       {                                                                              \
+               optstr, type, PERF_COUNT_HW_CACHE_##name, PERF_COUNT_HW_CACHE_OP_##op, \
+                       PERF_COUNT_HW_CACHE_RESULT_##result, hide,                     \
        }
 
-#define PERF_HW_CACHE(optstr, name, type, hide)                                \
-       _PERF_HW_CACHE(optstr "-loads", name, type,                     \
-               READ, ACCESS, hide),                                    \
-       _PERF_HW_CACHE(optstr "-load-misses", name, type,               \
-               READ, MISS, hide),                                      \
-       _PERF_HW_CACHE(optstr "-stores", name, type,                    \
-               WRITE, ACCESS, hide),                                   \
-       _PERF_HW_CACHE(optstr "-store-misses", name, type,              \
-               WRITE, MISS, hide),                                     \
-       _PERF_HW_CACHE(optstr "-prefetches", name, type,                \
-               PREFETCH, ACCESS, hide),                                \
-       _PERF_HW_CACHE(optstr "-prefetch-misses", name, type,           \
-               PREFETCH, MISS, hide)
+#define PERF_HW_CACHE(optstr, name, type, hide)                                           \
+       _PERF_HW_CACHE(optstr "-loads", name, type, READ, ACCESS, hide),                  \
+               _PERF_HW_CACHE(optstr "-load-misses", name, type, READ, MISS, hide),      \
+               _PERF_HW_CACHE(optstr "-stores", name, type, WRITE, ACCESS, hide),        \
+               _PERF_HW_CACHE(optstr "-store-misses", name, type, WRITE, MISS, hide),    \
+               _PERF_HW_CACHE(optstr "-prefetches", name, type, PREFETCH, ACCESS, hide), \
+               _PERF_HW_CACHE(optstr "-prefetch-misses", name, type, PREFETCH, MISS, hide)
 
 namespace {
 const struct ctx_opts {
        /* Needed for end-of-list item. */
-       ctx_opts()
-               : ctx_opts(nullptr, CONTEXT_UNKNOWN)
-       {}
+       ctx_opts() : ctx_opts(nullptr, CONTEXT_UNKNOWN)
+       {
+       }
 
-       ctx_opts(const char *symbol_, context_type ctx_type_, bool hide_help_ = false)
-               : symbol((char *) symbol_), ctx_type(ctx_type_), hide_help(hide_help_)
-       {}
+       ctx_opts(const char *symbol_, context_type ctx_type_, bool hide_help_ = false) :
+               symbol((char *) symbol_), ctx_type(ctx_type_), hide_help(hide_help_)
+       {
+       }
 
-       ctx_opts(const char *symbol_, context_type ctx_type_, perf_count_hard perf_count_hard, bool hide_help_)
-               : ctx_opts(symbol_, ctx_type_, hide_help_)
+       ctx_opts(const char *symbol_,
+                context_type ctx_type_,
+                perf_count_hard perf_count_hard,
+                bool hide_help_) :
+               ctx_opts(symbol_, ctx_type_, hide_help_)
        {
                u.perf.type = PERF_TYPE_HARDWARE;
                u.perf.config = perf_count_hard;
        }
 
-       ctx_opts(const char *symbol_, context_type ctx_type_, perf_count_soft perf_count_soft, bool hide_help_)
-               : ctx_opts(symbol_, ctx_type_, hide_help_)
+       ctx_opts(const char *symbol_,
+                context_type ctx_type_,
+                perf_count_soft perf_count_soft,
+                bool hide_help_) :
+               ctx_opts(symbol_, ctx_type_, hide_help_)
        {
                u.perf.type = PERF_TYPE_SOFTWARE;
                u.perf.config = perf_count_soft;
        }
 
-       ctx_opts(const char *symbol_, context_type ctx_type_,
-                       perf_hw_cache_id perf_hw_cache_id,
-                       perf_hw_cache_op_id perf_hw_cache_op_id,
-                       perf_hw_cache_op_result_id perf_hw_cache_op_result_id,
-                       bool hide_help_)
-               : ctx_opts(symbol_, ctx_type_, hide_help_)
+       ctx_opts(const char *symbol_,
+                context_type ctx_type_,
+                perf_hw_cache_id perf_hw_cache_id,
+                perf_hw_cache_op_id perf_hw_cache_op_id,
+                perf_hw_cache_op_result_id perf_hw_cache_op_result_id,
+                bool hide_help_) :
+               ctx_opts(symbol_, ctx_type_, hide_help_)
        {
                u.perf.type = PERF_TYPE_HW_CACHE;
-               u.perf.config = perf_hw_cache_id | perf_hw_cache_op_id << 8 | perf_hw_cache_op_result_id << 16;
+               u.perf.config = perf_hw_cache_id | perf_hw_cache_op_id << 8 |
+                       perf_hw_cache_op_result_id << 16;
        }
 
        char *symbol;
        enum context_type ctx_type;
-       bool hide_help; /* Hide from --help */
+       bool hide_help; /* Hide from --help */
        union {
                struct {
                        uint32_t type;
@@ -315,219 +315,147 @@ const struct ctx_opts {
        /* Perf options */
 
        /* Perf per-CPU counters */
-       PERF_HW("perf:cpu:cpu-cycles", CPU_CYCLES,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW("perf:cpu:cycles", CPU_CYCLES,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW("perf:cpu:stalled-cycles-frontend", STALLED_CYCLES_FRONTEND,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW("perf:cpu:idle-cycles-frontend", STALLED_CYCLES_FRONTEND,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW("perf:cpu:stalled-cycles-backend", STALLED_CYCLES_BACKEND,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW("perf:cpu:idle-cycles-backend", STALLED_CYCLES_BACKEND,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW("perf:cpu:instructions", INSTRUCTIONS,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW("perf:cpu:cache-references", CACHE_REFERENCES,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW("perf:cpu:cache-misses", CACHE_MISSES,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW("perf:cpu:branch-instructions", BRANCH_INSTRUCTIONS,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW("perf:cpu:branches", BRANCH_INSTRUCTIONS,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW("perf:cpu:branch-misses", BRANCH_MISSES,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW("perf:cpu:bus-cycles", BUS_CYCLES,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-
-       PERF_HW_CACHE("perf:cpu:L1-dcache", L1D,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW_CACHE("perf:cpu:L1-icache", L1I,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW_CACHE("perf:cpu:LLC", LL,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_HW_CACHE("perf:cpu:dTLB", DTLB,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       _PERF_HW_CACHE("perf:cpu:iTLB-loads", ITLB,
-               CONTEXT_PERF_CPU_COUNTER, READ, ACCESS, 0),
-       _PERF_HW_CACHE("perf:cpu:iTLB-load-misses", ITLB,
-               CONTEXT_PERF_CPU_COUNTER, READ, MISS, 0),
-       _PERF_HW_CACHE("perf:cpu:branch-loads", BPU,
-               CONTEXT_PERF_CPU_COUNTER, READ, ACCESS, 0),
-       _PERF_HW_CACHE("perf:cpu:branch-load-misses", BPU,
-               CONTEXT_PERF_CPU_COUNTER, READ, MISS, 0),
-
-       PERF_SW("perf:cpu:cpu-clock", CPU_CLOCK,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_SW("perf:cpu:task-clock", TASK_CLOCK,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_SW("perf:cpu:page-fault", PAGE_FAULTS,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_SW("perf:cpu:faults", PAGE_FAULTS,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_SW("perf:cpu:major-faults", PAGE_FAULTS_MAJ,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_SW("perf:cpu:minor-faults", PAGE_FAULTS_MIN,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_SW("perf:cpu:context-switches", CONTEXT_SWITCHES,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_SW("perf:cpu:cs", CONTEXT_SWITCHES,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_SW("perf:cpu:cpu-migrations", CPU_MIGRATIONS,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_SW("perf:cpu:migrations", CPU_MIGRATIONS,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_SW("perf:cpu:alignment-faults", ALIGNMENT_FAULTS,
-               CONTEXT_PERF_CPU_COUNTER, 0),
-       PERF_SW("perf:cpu:emulation-faults", EMULATION_FAULTS,
-               CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_HW("perf:cpu:cpu-cycles", CPU_CYCLES, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_HW("perf:cpu:cycles", CPU_CYCLES, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_HW("perf:cpu:stalled-cycles-frontend",
+               STALLED_CYCLES_FRONTEND,
+               CONTEXT_PERF_CPU_COUNTER,
+               0),
+       PERF_HW("perf:cpu:idle-cycles-frontend",
+               STALLED_CYCLES_FRONTEND,
+               CONTEXT_PERF_CPU_COUNTER,
+               0),
+       PERF_HW("perf:cpu:stalled-cycles-backend",
+               STALLED_CYCLES_BACKEND,
+               CONTEXT_PERF_CPU_COUNTER,
+               0),
+       PERF_HW("perf:cpu:idle-cycles-backend", STALLED_CYCLES_BACKEND, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_HW("perf:cpu:instructions", INSTRUCTIONS, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_HW("perf:cpu:cache-references", CACHE_REFERENCES, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_HW("perf:cpu:cache-misses", CACHE_MISSES, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_HW("perf:cpu:branch-instructions", BRANCH_INSTRUCTIONS, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_HW("perf:cpu:branches", BRANCH_INSTRUCTIONS, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_HW("perf:cpu:branch-misses", BRANCH_MISSES, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_HW("perf:cpu:bus-cycles", BUS_CYCLES, CONTEXT_PERF_CPU_COUNTER, 0),
+
+       PERF_HW_CACHE("perf:cpu:L1-dcache", L1D, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_HW_CACHE("perf:cpu:L1-icache", L1I, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_HW_CACHE("perf:cpu:LLC", LL, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_HW_CACHE("perf:cpu:dTLB", DTLB, CONTEXT_PERF_CPU_COUNTER, 0),
+       _PERF_HW_CACHE("perf:cpu:iTLB-loads", ITLB, CONTEXT_PERF_CPU_COUNTER, READ, ACCESS, 0),
+       _PERF_HW_CACHE("perf:cpu:iTLB-load-misses", ITLB, CONTEXT_PERF_CPU_COUNTER, READ, MISS, 0),
+       _PERF_HW_CACHE("perf:cpu:branch-loads", BPU, CONTEXT_PERF_CPU_COUNTER, READ, ACCESS, 0),
+       _PERF_HW_CACHE("perf:cpu:branch-load-misses", BPU, CONTEXT_PERF_CPU_COUNTER, READ, MISS, 0),
+
+       PERF_SW("perf:cpu:cpu-clock", CPU_CLOCK, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_SW("perf:cpu:task-clock", TASK_CLOCK, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_SW("perf:cpu:page-fault", PAGE_FAULTS, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_SW("perf:cpu:faults", PAGE_FAULTS, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_SW("perf:cpu:major-faults", PAGE_FAULTS_MAJ, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_SW("perf:cpu:minor-faults", PAGE_FAULTS_MIN, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_SW("perf:cpu:context-switches", CONTEXT_SWITCHES, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_SW("perf:cpu:cs", CONTEXT_SWITCHES, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_SW("perf:cpu:cpu-migrations", CPU_MIGRATIONS, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_SW("perf:cpu:migrations", CPU_MIGRATIONS, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_SW("perf:cpu:alignment-faults", ALIGNMENT_FAULTS, CONTEXT_PERF_CPU_COUNTER, 0),
+       PERF_SW("perf:cpu:emulation-faults", EMULATION_FAULTS, CONTEXT_PERF_CPU_COUNTER, 0),
 
        /* Perf per-thread counters */
-       PERF_HW("perf:thread:cpu-cycles", CPU_CYCLES,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW("perf:thread:cycles", CPU_CYCLES,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW("perf:thread:stalled-cycles-frontend", STALLED_CYCLES_FRONTEND,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW("perf:thread:idle-cycles-frontend", STALLED_CYCLES_FRONTEND,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW("perf:thread:stalled-cycles-backend", STALLED_CYCLES_BACKEND,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW("perf:thread:idle-cycles-backend", STALLED_CYCLES_BACKEND,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW("perf:thread:instructions", INSTRUCTIONS,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW("perf:thread:cache-references", CACHE_REFERENCES,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW("perf:thread:cache-misses", CACHE_MISSES,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW("perf:thread:branch-instructions", BRANCH_INSTRUCTIONS,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW("perf:thread:branches", BRANCH_INSTRUCTIONS,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW("perf:thread:branch-misses", BRANCH_MISSES,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW("perf:thread:bus-cycles", BUS_CYCLES,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-
-       PERF_HW_CACHE("perf:thread:L1-dcache", L1D,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW_CACHE("perf:thread:L1-icache", L1I,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW_CACHE("perf:thread:LLC", LL,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_HW_CACHE("perf:thread:dTLB", DTLB,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       _PERF_HW_CACHE("perf:thread:iTLB-loads", ITLB,
-               CONTEXT_PERF_THREAD_COUNTER, READ, ACCESS, 0),
-       _PERF_HW_CACHE("perf:thread:iTLB-load-misses", ITLB,
-               CONTEXT_PERF_THREAD_COUNTER, READ, MISS, 0),
-       _PERF_HW_CACHE("perf:thread:branch-loads", BPU,
-               CONTEXT_PERF_THREAD_COUNTER, READ, ACCESS, 0),
-       _PERF_HW_CACHE("perf:thread:branch-load-misses", BPU,
-               CONTEXT_PERF_THREAD_COUNTER, READ, MISS, 0),
-
-       PERF_SW("perf:thread:cpu-clock", CPU_CLOCK,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_SW("perf:thread:task-clock", TASK_CLOCK,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_SW("perf:thread:page-fault", PAGE_FAULTS,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_SW("perf:thread:faults", PAGE_FAULTS,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_SW("perf:thread:major-faults", PAGE_FAULTS_MAJ,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_SW("perf:thread:minor-faults", PAGE_FAULTS_MIN,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_SW("perf:thread:context-switches", CONTEXT_SWITCHES,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_SW("perf:thread:cs", CONTEXT_SWITCHES,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_SW("perf:thread:cpu-migrations", CPU_MIGRATIONS,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_SW("perf:thread:migrations", CPU_MIGRATIONS,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_SW("perf:thread:alignment-faults", ALIGNMENT_FAULTS,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
-       PERF_SW("perf:thread:emulation-faults", EMULATION_FAULTS,
-               CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_HW("perf:thread:cpu-cycles", CPU_CYCLES, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_HW("perf:thread:cycles", CPU_CYCLES, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_HW("perf:thread:stalled-cycles-frontend",
+               STALLED_CYCLES_FRONTEND,
+               CONTEXT_PERF_THREAD_COUNTER,
+               0),
+       PERF_HW("perf:thread:idle-cycles-frontend",
+               STALLED_CYCLES_FRONTEND,
+               CONTEXT_PERF_THREAD_COUNTER,
+               0),
+       PERF_HW("perf:thread:stalled-cycles-backend",
+               STALLED_CYCLES_BACKEND,
+               CONTEXT_PERF_THREAD_COUNTER,
+               0),
+       PERF_HW("perf:thread:idle-cycles-backend",
+               STALLED_CYCLES_BACKEND,
+               CONTEXT_PERF_THREAD_COUNTER,
+               0),
+       PERF_HW("perf:thread:instructions", INSTRUCTIONS, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_HW("perf:thread:cache-references", CACHE_REFERENCES, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_HW("perf:thread:cache-misses", CACHE_MISSES, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_HW("perf:thread:branch-instructions",
+               BRANCH_INSTRUCTIONS,
+               CONTEXT_PERF_THREAD_COUNTER,
+               0),
+       PERF_HW("perf:thread:branches", BRANCH_INSTRUCTIONS, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_HW("perf:thread:branch-misses", BRANCH_MISSES, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_HW("perf:thread:bus-cycles", BUS_CYCLES, CONTEXT_PERF_THREAD_COUNTER, 0),
+
+       PERF_HW_CACHE("perf:thread:L1-dcache", L1D, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_HW_CACHE("perf:thread:L1-icache", L1I, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_HW_CACHE("perf:thread:LLC", LL, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_HW_CACHE("perf:thread:dTLB", DTLB, CONTEXT_PERF_THREAD_COUNTER, 0),
+       _PERF_HW_CACHE("perf:thread:iTLB-loads", ITLB, CONTEXT_PERF_THREAD_COUNTER, READ, ACCESS, 0),
+       _PERF_HW_CACHE(
+               "perf:thread:iTLB-load-misses", ITLB, CONTEXT_PERF_THREAD_COUNTER, READ, MISS, 0),
+       _PERF_HW_CACHE(
+               "perf:thread:branch-loads", BPU, CONTEXT_PERF_THREAD_COUNTER, READ, ACCESS, 0),
+       _PERF_HW_CACHE(
+               "perf:thread:branch-load-misses", BPU, CONTEXT_PERF_THREAD_COUNTER, READ, MISS, 0),
+
+       PERF_SW("perf:thread:cpu-clock", CPU_CLOCK, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_SW("perf:thread:task-clock", TASK_CLOCK, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_SW("perf:thread:page-fault", PAGE_FAULTS, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_SW("perf:thread:faults", PAGE_FAULTS, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_SW("perf:thread:major-faults", PAGE_FAULTS_MAJ, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_SW("perf:thread:minor-faults", PAGE_FAULTS_MIN, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_SW("perf:thread:context-switches", CONTEXT_SWITCHES, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_SW("perf:thread:cs", CONTEXT_SWITCHES, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_SW("perf:thread:cpu-migrations", CPU_MIGRATIONS, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_SW("perf:thread:migrations", CPU_MIGRATIONS, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_SW("perf:thread:alignment-faults", ALIGNMENT_FAULTS, CONTEXT_PERF_THREAD_COUNTER, 0),
+       PERF_SW("perf:thread:emulation-faults", EMULATION_FAULTS, CONTEXT_PERF_THREAD_COUNTER, 0),
 
        /*
         * Perf per-CPU counters, backward compatibilty for names.
         * Hidden from help listing.
         */
-       PERF_HW("perf:cpu-cycles", CPU_CYCLES,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW("perf:cycles", CPU_CYCLES,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW("perf:stalled-cycles-frontend", STALLED_CYCLES_FRONTEND,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW("perf:idle-cycles-frontend", STALLED_CYCLES_FRONTEND,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW("perf:stalled-cycles-backend", STALLED_CYCLES_BACKEND,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW("perf:idle-cycles-backend", STALLED_CYCLES_BACKEND,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW("perf:instructions", INSTRUCTIONS,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW("perf:cache-references", CACHE_REFERENCES,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW("perf:cache-misses", CACHE_MISSES,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW("perf:branch-instructions", BRANCH_INSTRUCTIONS,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW("perf:branches", BRANCH_INSTRUCTIONS,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW("perf:branch-misses", BRANCH_MISSES,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW("perf:bus-cycles", BUS_CYCLES,
-               CONTEXT_PERF_COUNTER, 1),
-
-       PERF_HW_CACHE("perf:L1-dcache", L1D,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW_CACHE("perf:L1-icache", L1I,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW_CACHE("perf:LLC", LL,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_HW_CACHE("perf:dTLB", DTLB,
-               CONTEXT_PERF_COUNTER, 1),
-       _PERF_HW_CACHE("perf:iTLB-loads", ITLB,
-               CONTEXT_PERF_COUNTER, READ, ACCESS, 1),
-       _PERF_HW_CACHE("perf:iTLB-load-misses", ITLB,
-               CONTEXT_PERF_COUNTER, READ, MISS, 1),
-       _PERF_HW_CACHE("perf:branch-loads", BPU,
-               CONTEXT_PERF_COUNTER, READ, ACCESS, 1),
-       _PERF_HW_CACHE("perf:branch-load-misses", BPU,
-               CONTEXT_PERF_COUNTER, READ, MISS, 1),
-
-       PERF_SW("perf:cpu-clock", CPU_CLOCK,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_SW("perf:task-clock", TASK_CLOCK,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_SW("perf:page-fault", PAGE_FAULTS,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_SW("perf:faults", PAGE_FAULTS,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_SW("perf:major-faults", PAGE_FAULTS_MAJ,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_SW("perf:minor-faults", PAGE_FAULTS_MIN,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_SW("perf:context-switches", CONTEXT_SWITCHES,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_SW("perf:cs", CONTEXT_SWITCHES,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_SW("perf:cpu-migrations", CPU_MIGRATIONS,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_SW("perf:migrations", CPU_MIGRATIONS,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_SW("perf:alignment-faults", ALIGNMENT_FAULTS,
-               CONTEXT_PERF_COUNTER, 1),
-       PERF_SW("perf:emulation-faults", EMULATION_FAULTS,
-               CONTEXT_PERF_COUNTER, 1),
-
-       {},             /* Closure */
+       PERF_HW("perf:cpu-cycles", CPU_CYCLES, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW("perf:cycles", CPU_CYCLES, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW("perf:stalled-cycles-frontend", STALLED_CYCLES_FRONTEND, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW("perf:idle-cycles-frontend", STALLED_CYCLES_FRONTEND, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW("perf:stalled-cycles-backend", STALLED_CYCLES_BACKEND, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW("perf:idle-cycles-backend", STALLED_CYCLES_BACKEND, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW("perf:instructions", INSTRUCTIONS, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW("perf:cache-references", CACHE_REFERENCES, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW("perf:cache-misses", CACHE_MISSES, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW("perf:branch-instructions", BRANCH_INSTRUCTIONS, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW("perf:branches", BRANCH_INSTRUCTIONS, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW("perf:branch-misses", BRANCH_MISSES, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW("perf:bus-cycles", BUS_CYCLES, CONTEXT_PERF_COUNTER, 1),
+
+       PERF_HW_CACHE("perf:L1-dcache", L1D, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW_CACHE("perf:L1-icache", L1I, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW_CACHE("perf:LLC", LL, CONTEXT_PERF_COUNTER, 1),
+       PERF_HW_CACHE("perf:dTLB", DTLB, CONTEXT_PERF_COUNTER, 1),
+       _PERF_HW_CACHE("perf:iTLB-loads", ITLB, CONTEXT_PERF_COUNTER, READ, ACCESS, 1),
+       _PERF_HW_CACHE("perf:iTLB-load-misses", ITLB, CONTEXT_PERF_COUNTER, READ, MISS, 1),
+       _PERF_HW_CACHE("perf:branch-loads", BPU, CONTEXT_PERF_COUNTER, READ, ACCESS, 1),
+       _PERF_HW_CACHE("perf:branch-load-misses", BPU, CONTEXT_PERF_COUNTER, READ, MISS, 1),
+
+       PERF_SW("perf:cpu-clock", CPU_CLOCK, CONTEXT_PERF_COUNTER, 1),
+       PERF_SW("perf:task-clock", TASK_CLOCK, CONTEXT_PERF_COUNTER, 1),
+       PERF_SW("perf:page-fault", PAGE_FAULTS, CONTEXT_PERF_COUNTER, 1),
+       PERF_SW("perf:faults", PAGE_FAULTS, CONTEXT_PERF_COUNTER, 1),
+       PERF_SW("perf:major-faults", PAGE_FAULTS_MAJ, CONTEXT_PERF_COUNTER, 1),
+       PERF_SW("perf:minor-faults", PAGE_FAULTS_MIN, CONTEXT_PERF_COUNTER, 1),
+       PERF_SW("perf:context-switches", CONTEXT_SWITCHES, CONTEXT_PERF_COUNTER, 1),
+       PERF_SW("perf:cs", CONTEXT_SWITCHES, CONTEXT_PERF_COUNTER, 1),
+       PERF_SW("perf:cpu-migrations", CPU_MIGRATIONS, CONTEXT_PERF_COUNTER, 1),
+       PERF_SW("perf:migrations", CPU_MIGRATIONS, CONTEXT_PERF_COUNTER, 1),
+       PERF_SW("perf:alignment-faults", ALIGNMENT_FAULTS, CONTEXT_PERF_COUNTER, 1),
+       PERF_SW("perf:emulation-faults", EMULATION_FAULTS, CONTEXT_PERF_COUNTER, 1),
+
+       {}, /* Closure */
 };
 
 #undef PERF_HW_CACHE
@@ -576,8 +504,7 @@ end:
        return ret;
 }
 
-static
-enum lttng_domain_type get_domain(void)
+static enum lttng_domain_type get_domain(void)
 {
        if (opt_kernel) {
                return LTTNG_DOMAIN_KERNEL;
@@ -592,8 +519,7 @@ enum lttng_domain_type get_domain(void)
        }
 }
 
-static
-int mi_open(void)
+static int mi_open(void)
 {
        int ret;
 
@@ -617,16 +543,14 @@ int mi_open(void)
        }
 
        /* Open command element */
-       ret = mi_lttng_writer_command_open(writer,
-                       mi_lttng_element_command_add_context);
+       ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_add_context);
        if (ret) {
                ret = CMD_ERROR;
                goto end;
        }
 
        /* Open output element */
-       ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_command_output);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
        if (ret) {
                ret = CMD_ERROR;
                goto end;
@@ -635,8 +559,7 @@ end:
        return ret;
 }
 
-static
-int mi_close(enum cmd_error_code success)
+static int mi_close(enum cmd_error_code success)
 {
        int ret;
 
@@ -653,8 +576,8 @@ int mi_close(enum cmd_error_code success)
        }
 
        /* Success ? */
-       ret = mi_lttng_writer_write_element_bool(writer,
-                       mi_lttng_element_command_success, !success);
+       ret = mi_lttng_writer_write_element_bool(
+               writer, mi_lttng_element_command_success, !success);
        if (ret) {
                ret = CMD_ERROR;
                goto end;
@@ -670,9 +593,7 @@ end:
        return ret;
 }
 
-static
-void populate_context(struct lttng_event_context *context,
-               const struct ctx_opts *opt)
+static void populate_context(struct lttng_event_context *context, const struct ctx_opts *opt)
 {
        char *ptr;
 
@@ -683,8 +604,7 @@ void populate_context(struct lttng_event_context *context,
        case LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER:
                context->u.perf_counter.type = opt->u.perf.type;
                context->u.perf_counter.config = opt->u.perf.config;
-               strncpy(context->u.perf_counter.name, opt->symbol,
-                               LTTNG_SYMBOL_NAME_LEN);
+               strncpy(context->u.perf_counter.name, opt->symbol, LTTNG_SYMBOL_NAME_LEN);
                context->u.perf_counter.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
                /* Replace : and - by _ */
                while ((ptr = strchr(context->u.perf_counter.name, '-')) != NULL) {
@@ -695,10 +615,8 @@ void populate_context(struct lttng_event_context *context,
                }
                break;
        case LTTNG_EVENT_CONTEXT_APP_CONTEXT:
-               context->u.app_ctx.provider_name =
-                       opt->u.app_ctx.provider_name;
-               context->u.app_ctx.ctx_name =
-                       opt->u.app_ctx.ctx_name;
+               context->u.app_ctx.provider_name = opt->u.app_ctx.provider_name;
+               context->u.app_ctx.ctx_name = opt->u.app_ctx.ctx_name;
                break;
        default:
                break;
@@ -708,10 +626,8 @@ void populate_context(struct lttng_event_context *context,
 /*
  * Pretty print context type.
  */
-static
-int print_ctx_type(void)
+static int print_ctx_type(void)
 {
-
        FILE *ofp = stdout;
        int i = 0;
        int ret;
@@ -745,9 +661,9 @@ int print_ctx_type(void)
                                }
 
                                ret = mi_lttng_writer_write_element_string(
-                                               writer,
-                                               mi_lttng_element_context_symbol,
-                                               ctx_opts[i].symbol);
+                                       writer,
+                                       mi_lttng_element_context_symbol,
+                                       ctx_opts[i].symbol);
                                if (ret) {
                                        ret = CMD_ERROR;
                                        goto end;
@@ -810,7 +726,7 @@ static int add_context(char *session_name)
        }
 
        /* Iterate over all the context types given */
-       cds_list_for_each_entry(type, &ctx_type_list.head, list) {
+       cds_list_for_each_entry (type, &ctx_type_list.head, list) {
                DBG("Adding context...");
 
                populate_context(&context, type->opt);
@@ -823,9 +739,8 @@ static int add_context(char *session_name)
                                goto error;
                        }
 
-                       ret = mi_lttng_writer_write_element_string(writer,
-                                       mi_lttng_element_context_symbol,
-                                       type->opt->symbol);
+                       ret = mi_lttng_writer_write_element_string(
+                               writer, mi_lttng_element_context_symbol, type->opt->symbol);
                        if (ret) {
                                ret = CMD_ERROR;
                                goto error;
@@ -840,21 +755,21 @@ static int add_context(char *session_name)
                } else {
                        if (opt_channel_name) {
                                MSG("%s context %s added to channel %s",
-                                               lttng_domain_type_str(dom.type),
-                                               type->opt->symbol,
-                                               opt_channel_name);
+                                   lttng_domain_type_str(dom.type),
+                                   type->opt->symbol,
+                                   opt_channel_name);
                        } else {
                                MSG("%s context %s added to all channels",
-                                               lttng_domain_type_str(dom.type),
-                                               type->opt->symbol);
+                                   lttng_domain_type_str(dom.type),
+                                   type->opt->symbol);
                        }
                        success = 1;
                }
 
                if (lttng_opt_mi) {
                        /* Is the single operation a success ? */
-                       ret = mi_lttng_writer_write_element_bool(writer,
-                                       mi_lttng_element_success, success);
+                       ret = mi_lttng_writer_write_element_bool(
+                               writer, mi_lttng_element_success, success);
                        if (ret) {
                                ret = CMD_ERROR;
                                goto error;
@@ -892,8 +807,7 @@ error:
        return ret;
 }
 
-static
-void destroy_ctx_type(struct ctx_type *type)
+static void destroy_ctx_type(struct ctx_type *type)
 {
        if (!type) {
                return;
@@ -905,8 +819,7 @@ void destroy_ctx_type(struct ctx_type *type)
        free(type);
 }
 
-static
-struct ctx_type *create_ctx_type(void)
+static struct ctx_type *create_ctx_type(void)
 {
        struct ctx_type *type = zmalloc<ctx_type>();
 
@@ -926,8 +839,7 @@ end:
        return type;
 }
 
-static
-int find_ctx_type_perf_raw(const char *ctx, struct ctx_type *type)
+static int find_ctx_type_perf_raw(const char *ctx, struct ctx_type *type)
 {
        int ret;
        int field_pos = 0;
@@ -982,7 +894,7 @@ int find_ctx_type_perf_raw(const char *ctx, struct ctx_type *type)
                                goto end;
                        }
                        errno = 0;
-                       type->opt->u.perf.config = strtoll(next +  1, &endptr, 16);
+                       type->opt->u.perf.config = strtoll(next + 1, &endptr, 16);
                        if (errno != 0 || !endptr || *endptr) {
                                ERR("Wrong perf raw mask format: expected rNNN");
                                ret = -1;
@@ -1003,8 +915,8 @@ int find_ctx_type_perf_raw(const char *ctx, struct ctx_type *type)
 
        if (field_pos < 5) {
                ERR("Invalid perf counter specifier, expected a specifier of "
-                       "the form perf:cpu:raw:rNNN:<name> or "
-                       "perf:thread:raw:rNNN:<name>");
+                   "the form perf:cpu:raw:rNNN:<name> or "
+                   "perf:thread:raw:rNNN:<name>");
                ret = -1;
                goto end;
        }
@@ -1017,8 +929,7 @@ end:
        return ret;
 }
 
-static
-struct ctx_type *get_context_type(const char *ctx)
+static struct ctx_type *get_context_type(const char *ctx)
 {
        int opt_index, ret;
        struct ctx_type *type = NULL;
@@ -1083,8 +994,7 @@ struct ctx_type *get_context_type(const char *ctx)
         * No colon found or no ctx name ("$app.provider:") or no provider name
         * given ("$app.:..."), which is invalid.
         */
-       if (!colon_pos || colon_pos == len ||
-                       colon_pos == sizeof(app_ctx_prefix)) {
+       if (!colon_pos || colon_pos == len || colon_pos == sizeof(app_ctx_prefix)) {
                ERR("Invalid application context provided: no provider or context name provided.");
                goto not_found;
        }
@@ -1095,8 +1005,7 @@ struct ctx_type *get_context_type(const char *ctx)
                PERROR("malloc provider_name");
                goto not_found;
        }
-       strncpy(provider_name, ctx + sizeof(app_ctx_prefix) - 1,
-                       provider_name_len - 1);
+       strncpy(provider_name, ctx + sizeof(app_ctx_prefix) - 1, provider_name_len - 1);
        type->opt->u.app_ctx.provider_name = provider_name;
 
        ctx_name_len = len - colon_pos;
@@ -1181,8 +1090,8 @@ int cmd_add_context(int argc, const char **argv)
                goto end;
        }
 
-       ret = print_missing_or_multiple_domains(
-                       opt_kernel + opt_userspace + opt_jul + opt_log4j, true);
+       ret = print_missing_or_multiple_domains(opt_kernel + opt_userspace + opt_jul + opt_log4j,
+                                               true);
        if (ret) {
                ret = CMD_ERROR;
                goto end;
@@ -1227,7 +1136,7 @@ end:
        }
 
        /* Cleanup allocated memory */
-       cds_list_for_each_entry_safe(type, tmptype, &ctx_type_list.head, list) {
+       cds_list_for_each_entry_safe (type, tmptype, &ctx_type_list.head, list) {
                destroy_ctx_type(type);
        }
 
index 8619a822161eda44fbe2f61aceb7dedae8c07781..b0da1988947f4452b2bd970edc2619b033294fe4 100644 (file)
@@ -5,28 +5,29 @@
  *
  */
 
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-
 #include "../command.hpp"
 #include "../loglevel.hpp"
 #include "../uprobe.hpp"
-
-#include "common/argpar/argpar.h"
 #include "common/argpar-utils/argpar-utils.hpp"
+#include "common/argpar/argpar.h"
 #include "common/dynamic-array.hpp"
 #include "common/mi-lttng.hpp"
 #include "common/string-utils/string-utils.hpp"
 #include "common/utils.hpp"
+
 #include <lttng/domain-internal.hpp>
+
+#include <ctype.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
 /* For lttng_event_rule_type_str(). */
-#include <lttng/event-rule/event-rule-internal.hpp>
-#include <lttng/lttng.h>
+#include "common/dynamic-array.hpp"
 #include "common/filter/filter-ast.hpp"
 #include "common/filter/filter-ir.hpp"
-#include "common/dynamic-array.hpp"
+
+#include <lttng/event-rule/event-rule-internal.hpp>
+#include <lttng/lttng.h>
 
 #if (LTTNG_SYMBOL_NAME_LEN == 256)
 #define LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API "255"
@@ -35,7 +36,7 @@
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-add-trigger.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -82,22 +83,20 @@ static const struct argpar_opt_descr event_rule_opt_descrs[] = {
        ARGPAR_OPT_DESCR_SENTINEL
 };
 
-static
-bool has_syscall_prefix(const char *arg)
+static bool has_syscall_prefix(const char *arg)
 {
        bool matches = false;
        const char kernel_syscall_type_opt_prefix[] = "kernel:syscall";
        const size_t kernel_syscall_type_opt_prefix_len =
-                       sizeof(kernel_syscall_type_opt_prefix) - 1;
+               sizeof(kernel_syscall_type_opt_prefix) - 1;
        const char syscall_type_opt_prefix[] = "syscall";
-       const size_t syscall_type_opt_prefix_len =
-                       sizeof(syscall_type_opt_prefix) - 1;
+       const size_t syscall_type_opt_prefix_len = sizeof(syscall_type_opt_prefix) - 1;
 
-       if (strncmp(arg, syscall_type_opt_prefix,
-                           syscall_type_opt_prefix_len) == 0) {
+       if (strncmp(arg, syscall_type_opt_prefix, syscall_type_opt_prefix_len) == 0) {
                matches = true;
-       } else if (strncmp(arg, kernel_syscall_type_opt_prefix,
-                                  kernel_syscall_type_opt_prefix_len) == 0) {
+       } else if (strncmp(arg,
+                          kernel_syscall_type_opt_prefix,
+                          kernel_syscall_type_opt_prefix_len) == 0) {
                matches = true;
        } else {
                matches = false;
@@ -106,8 +105,7 @@ bool has_syscall_prefix(const char *arg)
        return matches;
 }
 
-static
-bool assign_event_rule_type(enum lttng_event_rule_type *dest, const char *arg)
+static bool assign_event_rule_type(enum lttng_event_rule_type *dest, const char *arg)
 {
        bool ret;
 
@@ -118,19 +116,15 @@ bool assign_event_rule_type(enum lttng_event_rule_type *dest, const char *arg)
 
        if (strcmp(arg, "user") == 0 || strcmp(arg, "user:tracepoint") == 0) {
                *dest = LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT;
-       } else if (strcmp(arg, "kernel") == 0 ||
-                       strcmp(arg, "kernel:tracepoint") == 0) {
+       } else if (strcmp(arg, "kernel") == 0 || strcmp(arg, "kernel:tracepoint") == 0) {
                *dest = LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT;
        } else if (strcmp(arg, "jul") == 0 || strcmp(arg, "jul:logging") == 0) {
                *dest = LTTNG_EVENT_RULE_TYPE_JUL_LOGGING;
-       } else if (strcmp(arg, "log4j") == 0 ||
-                       strcmp(arg, "log4j:logging") == 0) {
+       } else if (strcmp(arg, "log4j") == 0 || strcmp(arg, "log4j:logging") == 0) {
                *dest = LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING;
-       } else if (strcmp(arg, "python") == 0 ||
-                       strcmp(arg, "python:logging") == 0) {
+       } else if (strcmp(arg, "python") == 0 || strcmp(arg, "python:logging") == 0) {
                *dest = LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING;
-       } else if (strcmp(arg, "kprobe") == 0 ||
-                       strcmp(arg, "kernel:kprobe") == 0) {
+       } else if (strcmp(arg, "kprobe") == 0 || strcmp(arg, "kernel:kprobe") == 0) {
                *dest = LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE;
        } else if (strcmp(arg, "kernel:uprobe") == 0) {
                *dest = LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE;
@@ -166,8 +160,7 @@ end:
        return ret;
 }
 
-static
-bool assign_string(char **dest, const char *src, const char *opt_name)
+static bool assign_string(char **dest, const char *src, const char *opt_name)
 {
        bool ret;
 
@@ -192,8 +185,9 @@ end:
        return ret;
 }
 
-static bool parse_syscall_emission_site_from_type(const char *str,
-               enum lttng_event_rule_kernel_syscall_emission_site *type)
+static bool
+parse_syscall_emission_site_from_type(const char *str,
+                                     enum lttng_event_rule_kernel_syscall_emission_site *type)
 {
        bool ret = false;
        const char kernel_prefix[] = "kernel:";
@@ -207,8 +201,7 @@ static bool parse_syscall_emission_site_from_type(const char *str,
                str = &str[kernel_prefix_len];
        }
 
-       if (strcmp(str, "syscall") == 0 ||
-                       strcmp(str, "syscall:entry+exit") == 0) {
+       if (strcmp(str, "syscall") == 0 || strcmp(str, "syscall:entry+exit") == 0) {
                *type = LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY_EXIT;
        } else if (strcmp(str, "syscall:entry") == 0) {
                *type = LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY;
@@ -234,9 +227,9 @@ error:
  * Return true if the string was successfully parsed as a log level string.
  */
 static bool parse_log_level_string(const char *str,
-               enum lttng_event_rule_type event_rule_type,
-               int *log_level,
-               bool *log_level_only)
+                                  enum lttng_event_rule_type event_rule_type,
+                                  int *log_level,
+                                  bool *log_level_only)
 {
        bool ret;
 
@@ -244,14 +237,12 @@ static bool parse_log_level_string(const char *str,
        case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
        {
                enum lttng_loglevel log_level_min, log_level_max;
-               if (!loglevel_parse_range_string(
-                                   str, &log_level_min, &log_level_max)) {
+               if (!loglevel_parse_range_string(str, &log_level_min, &log_level_max)) {
                        goto error;
                }
 
                /* Only support VAL and VAL.. for now. */
-               if (log_level_min != log_level_max &&
-                               log_level_max != LTTNG_LOGLEVEL_EMERG) {
+               if (log_level_min != log_level_max && log_level_max != LTTNG_LOGLEVEL_EMERG) {
                        goto error;
                }
 
@@ -262,14 +253,12 @@ static bool parse_log_level_string(const char *str,
        case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
        {
                enum lttng_loglevel_log4j log_level_min, log_level_max;
-               if (!loglevel_log4j_parse_range_string(
-                                   str, &log_level_min, &log_level_max)) {
+               if (!loglevel_log4j_parse_range_string(str, &log_level_min, &log_level_max)) {
                        goto error;
                }
 
                /* Only support VAL and VAL.. for now. */
-               if (log_level_min != log_level_max &&
-                               log_level_max != LTTNG_LOGLEVEL_LOG4J_FATAL) {
+               if (log_level_min != log_level_max && log_level_max != LTTNG_LOGLEVEL_LOG4J_FATAL) {
                        goto error;
                }
 
@@ -280,14 +269,12 @@ static bool parse_log_level_string(const char *str,
        case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
        {
                enum lttng_loglevel_jul log_level_min, log_level_max;
-               if (!loglevel_jul_parse_range_string(
-                                   str, &log_level_min, &log_level_max)) {
+               if (!loglevel_jul_parse_range_string(str, &log_level_min, &log_level_max)) {
                        goto error;
                }
 
                /* Only support VAL and VAL.. for now. */
-               if (log_level_min != log_level_max &&
-                               log_level_max != LTTNG_LOGLEVEL_JUL_SEVERE) {
+               if (log_level_min != log_level_max && log_level_max != LTTNG_LOGLEVEL_JUL_SEVERE) {
                        goto error;
                }
 
@@ -298,15 +285,13 @@ static bool parse_log_level_string(const char *str,
        case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
        {
                enum lttng_loglevel_python log_level_min, log_level_max;
-               if (!loglevel_python_parse_range_string(
-                                   str, &log_level_min, &log_level_max)) {
+               if (!loglevel_python_parse_range_string(str, &log_level_min, &log_level_max)) {
                        goto error;
                }
 
                /* Only support VAL and VAL.. for now. */
                if (log_level_min != log_level_max &&
-                               log_level_max !=
-                                               LTTNG_LOGLEVEL_PYTHON_CRITICAL) {
+                   log_level_max != LTTNG_LOGLEVEL_PYTHON_CRITICAL) {
                        goto error;
                }
 
@@ -330,7 +315,7 @@ end:
 }
 
 static int parse_kernel_probe_opts(const char *source,
-               struct lttng_kernel_probe_location **location)
+                                  struct lttng_kernel_probe_location **location)
 {
        int ret = 0;
        int match;
@@ -340,10 +325,8 @@ static int parse_kernel_probe_opts(const char *source,
        uint64_t offset;
 
        /* Check for symbol+offset. */
-       match = sscanf(source,
-                       "%" LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API
-                       "[^'+']+%18s",
-                       name, s_hex);
+       match = sscanf(
+               source, "%" LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API "[^'+']+%18s", name, s_hex);
        if (match == 2) {
                if (*s_hex == '\0') {
                        ERR("Kernel probe symbol offset is missing.");
@@ -357,8 +340,7 @@ static int parse_kernel_probe_opts(const char *source,
                }
                offset = strtoull(s_hex, NULL, 0);
 
-               *location = lttng_kernel_probe_location_symbol_create(
-                               symbol_name, offset);
+               *location = lttng_kernel_probe_location_symbol_create(symbol_name, offset);
                if (!*location) {
                        ERR("Failed to create symbol kernel probe location.");
                        goto error;
@@ -369,10 +351,7 @@ static int parse_kernel_probe_opts(const char *source,
 
        /* Check for symbol. */
        if (isalpha(name[0]) || name[0] == '_') {
-               match = sscanf(source,
-                               "%" LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API
-                               "s",
-                               name);
+               match = sscanf(source, "%" LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API "s", name);
                if (match == 1) {
                        symbol_name = strndup(name, LTTNG_SYMBOL_NAME_LEN);
                        if (!symbol_name) {
@@ -380,8 +359,7 @@ static int parse_kernel_probe_opts(const char *source,
                                goto error;
                        }
 
-                       *location = lttng_kernel_probe_location_symbol_create(
-                                       symbol_name, 0);
+                       *location = lttng_kernel_probe_location_symbol_create(symbol_name, 0);
                        if (!*location) {
                                ERR("Failed to create symbol kernel probe location.");
                                goto error;
@@ -421,16 +399,13 @@ end:
        return ret;
 }
 
-static
-struct lttng_event_expr *ir_op_load_expr_to_event_expr(
-               const struct ir_load_expression *load_expr,
-               const char *capture_str)
+static struct lttng_event_expr *
+ir_op_load_expr_to_event_expr(const struct ir_load_expression *load_expr, const char *capture_str)
 {
        char *provider_name = NULL;
        struct lttng_event_expr *event_expr = NULL;
        const struct ir_load_expression_op *load_expr_op = load_expr->child;
-       const enum ir_load_expression_type load_expr_child_type =
-                       load_expr_op->type;
+       const enum ir_load_expression_type load_expr_child_type = load_expr_op->type;
 
        switch (load_expr_child_type) {
        case IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT:
@@ -445,13 +420,14 @@ struct lttng_event_expr *ir_op_load_expr_to_event_expr(
                LTTNG_ASSERT(field_name);
 
                event_expr = load_expr_child_type == IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT ?
-                               lttng_event_expr_event_payload_field_create(field_name) :
-                               lttng_event_expr_channel_context_field_create(field_name);
+                       lttng_event_expr_event_payload_field_create(field_name) :
+                       lttng_event_expr_channel_context_field_create(field_name);
                if (!event_expr) {
                        ERR("Failed to create %s event expression: field name = `%s`.",
-                                       load_expr_child_type == IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT ?
-                                                       "payload field" : "channel context",
-                                                       field_name);
+                           load_expr_child_type == IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT ?
+                                   "payload field" :
+                                   "channel context",
+                           field_name);
                        goto error;
                }
 
@@ -476,14 +452,14 @@ struct lttng_event_expr *ir_op_load_expr_to_event_expr(
                colon = strchr(field_name, ':');
                if (!colon) {
                        ERR("Invalid app-specific context field name: missing colon in `%s`.",
-                                       field_name);
+                           field_name);
                        goto error;
                }
 
                type_name = colon + 1;
                if (*type_name == '\0') {
                        ERR("Invalid app-specific context field name: missing type name after colon in `%s`.",
-                                       field_name);
+                           field_name);
                        goto error;
                }
 
@@ -493,19 +469,19 @@ struct lttng_event_expr *ir_op_load_expr_to_event_expr(
                        goto error;
                }
 
-               event_expr = lttng_event_expr_app_specific_context_field_create(
-                               provider_name, type_name);
+               event_expr = lttng_event_expr_app_specific_context_field_create(provider_name,
+                                                                               type_name);
                if (!event_expr) {
                        ERR("Failed to create app-specific context field event expression: provider name = `%s`, type name = `%s`",
-                                       provider_name, type_name);
+                           provider_name,
+                           type_name);
                        goto error;
                }
 
                break;
        }
        default:
-               ERR("%s: unexpected load expr type %d.", __func__,
-                               load_expr_op->type);
+               ERR("%s: unexpected load expr type %d.", __func__, load_expr_op->type);
                abort();
        }
 
@@ -535,12 +511,13 @@ struct lttng_event_expr *ir_op_load_expr_to_event_expr(
                break;
        case IR_LOAD_EXPRESSION_GET_SYMBOL:
                ERR("While parsing expression `%s`: Capturing subfields is not supported.",
-                               capture_str);
+                   capture_str);
                goto error;
 
        default:
-               ERR("%s: unexpected load expression operator %s.", __func__,
-                               ir_load_expression_type_str(load_expr_op->type));
+               ERR("%s: unexpected load expression operator %s.",
+                   __func__,
+                   ir_load_expression_type_str(load_expr_op->type));
                abort();
        }
 
@@ -556,9 +533,8 @@ end:
        return event_expr;
 }
 
-static
-struct lttng_event_expr *ir_op_load_to_event_expr(
-               const struct ir_op *ir, const char *capture_str)
+static struct lttng_event_expr *ir_op_load_to_event_expr(const struct ir_op *ir,
+                                                        const char *capture_str)
 {
        struct lttng_event_expr *event_expr = NULL;
 
@@ -567,24 +543,20 @@ struct lttng_event_expr *ir_op_load_to_event_expr(
        switch (ir->data_type) {
        case IR_DATA_EXPRESSION:
        {
-               const struct ir_load_expression *ir_load_expr =
-                               ir->u.load.u.expression;
+               const struct ir_load_expression *ir_load_expr = ir->u.load.u.expression;
 
-               event_expr = ir_op_load_expr_to_event_expr(
-                               ir_load_expr, capture_str);
+               event_expr = ir_op_load_expr_to_event_expr(ir_load_expr, capture_str);
                break;
        }
        default:
-               ERR("%s: unexpected data type: %s.", __func__,
-                               ir_data_type_str(ir->data_type));
+               ERR("%s: unexpected data type: %s.", __func__, ir_data_type_str(ir->data_type));
                abort();
        }
 
        return event_expr;
 }
 
-static
-const char *ir_operator_type_human_str(enum ir_op_type op)
+static const char *ir_operator_type_human_str(enum ir_op_type op)
 {
        const char *name;
 
@@ -605,9 +577,8 @@ const char *ir_operator_type_human_str(enum ir_op_type op)
        return name;
 }
 
-static
-struct lttng_event_expr *ir_op_root_to_event_expr(const struct ir_op *ir,
-               const char *capture_str)
+static struct lttng_event_expr *ir_op_root_to_event_expr(const struct ir_op *ir,
+                                                        const char *capture_str)
 {
        struct lttng_event_expr *event_expr = NULL;
 
@@ -622,20 +593,18 @@ struct lttng_event_expr *ir_op_root_to_event_expr(const struct ir_op *ir,
        case IR_OP_UNARY:
        case IR_OP_LOGICAL:
                ERR("While parsing expression `%s`: %s operators are not allowed in capture expressions.",
-                               capture_str,
-                               ir_operator_type_human_str(ir->op));
+                   capture_str,
+                   ir_operator_type_human_str(ir->op));
                break;
        default:
-               ERR("%s: unexpected IR op type: %s.", __func__,
-                               ir_op_type_str(ir->op));
+               ERR("%s: unexpected IR op type: %s.", __func__, ir_op_type_str(ir->op));
                abort();
        }
 
        return event_expr;
 }
 
-static
-void destroy_event_expr(void *ptr)
+static void destroy_event_expr(void *ptr)
 {
        lttng_event_expr_destroy((lttng_event_expr *) ptr);
 }
@@ -650,12 +619,9 @@ struct parse_event_rule_res {
 };
 } /* namespace */
 
-static
-struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
-               int argc_offset)
+static struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv, int argc_offset)
 {
-       enum lttng_event_rule_type event_rule_type =
-                       LTTNG_EVENT_RULE_TYPE_UNKNOWN;
+       enum lttng_event_rule_type event_rule_type = LTTNG_EVENT_RULE_TYPE_UNKNOWN;
        struct argpar_iter *argpar_iter = NULL;
        const struct argpar_item *argpar_item = NULL;
        int consumed_args = -1;
@@ -684,8 +650,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
        /* Log level. */
        char *log_level_str = NULL;
 
-       lttng_dynamic_pointer_array_init(&res.capture_descriptors,
-                               destroy_event_expr);
+       lttng_dynamic_pointer_array_init(&res.capture_descriptors, destroy_event_expr);
 
        lttng_dynamic_pointer_array_init(&exclude_names, free);
 
@@ -698,10 +663,10 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
        while (true) {
                enum parse_next_item_status status;
 
-               status = parse_next_item(argpar_iter, &argpar_item,
-                       argc_offset, *argv, false, NULL, NULL);
+               status = parse_next_item(
+                       argpar_iter, &argpar_item, argc_offset, *argv, false, NULL, NULL);
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR ||
-                               status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
+                   status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
                        goto error;
                } else if (status == PARSE_NEXT_ITEM_STATUS_END) {
                        break;
@@ -710,8 +675,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                LTTNG_ASSERT(status == PARSE_NEXT_ITEM_STATUS_OK);
 
                if (argpar_item_type(argpar_item) == ARGPAR_ITEM_TYPE_OPT) {
-                       const struct argpar_opt_descr *descr =
-                               argpar_item_opt_descr(argpar_item);
+                       const struct argpar_opt_descr *descr = argpar_item_opt_descr(argpar_item);
                        const char *arg = argpar_item_opt_arg(argpar_item);
 
                        switch (descr->id) {
@@ -721,36 +685,31 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                                }
 
                                /* Save the string for later use. */
-                               if (!assign_string(&event_rule_type_str, arg,
-                                               "--type/-t")) {
+                               if (!assign_string(&event_rule_type_str, arg, "--type/-t")) {
                                        goto error;
                                }
 
                                break;
                        case OPT_LOCATION:
-                               if (!assign_string(&location, arg,
-                                               "--location/-L")) {
+                               if (!assign_string(&location, arg, "--location/-L")) {
                                        goto error;
                                }
 
                                break;
                        case OPT_EVENT_NAME:
-                               if (!assign_string(&event_name, arg,
-                                               "--event-name/-E")) {
+                               if (!assign_string(&event_name, arg, "--event-name/-E")) {
                                        goto error;
                                }
 
                                break;
                        case OPT_FILTER:
-                               if (!assign_string(&filter, arg,
-                                               "--filter/-f")) {
+                               if (!assign_string(&filter, arg, "--filter/-f")) {
                                        goto error;
                                }
 
                                break;
                        case OPT_NAME:
-                               if (!assign_string(&name, arg,
-                                               "--name/-n")) {
+                               if (!assign_string(&name, arg, "--name/-n")) {
                                        goto error;
                                }
 
@@ -759,9 +718,8 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                        {
                                int ret;
 
-                               ret = lttng_dynamic_pointer_array_add_pointer(
-                                               &exclude_names,
-                                               strdup(arg));
+                               ret = lttng_dynamic_pointer_array_add_pointer(&exclude_names,
+                                                                             strdup(arg));
                                if (ret != 0) {
                                        ERR("Failed to add pointer to dynamic pointer array.");
                                        goto error;
@@ -770,8 +728,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                                break;
                        }
                        case OPT_LOG_LEVEL:
-                               if (!assign_string(&log_level_str, arg,
-                                               "--log-level/-l")) {
+                               if (!assign_string(&log_level_str, arg, "--log-level/-l")) {
                                        goto error;
                                }
 
@@ -780,15 +737,14 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                        {
                                int ret;
 
-                               ret = filter_parser_ctx_create_from_filter_expression(
-                                               arg, &parser_ctx);
+                               ret = filter_parser_ctx_create_from_filter_expression(arg,
+                                                                                     &parser_ctx);
                                if (ret) {
                                        ERR("Failed to parse capture expression `%s`.", arg);
                                        goto error;
                                }
 
-                               event_expr = ir_op_root_to_event_expr(
-                                               parser_ctx->ir_root, arg);
+                               event_expr = ir_op_root_to_event_expr(parser_ctx->ir_root, arg);
                                filter_parser_ctx_free(parser_ctx);
                                parser_ctx = nullptr;
                                if (!event_expr) {
@@ -800,8 +756,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                                }
 
                                ret = lttng_dynamic_pointer_array_add_pointer(
-                                               &res.capture_descriptors,
-                                               event_expr);
+                                       &res.capture_descriptors, event_expr);
                                if (ret) {
                                        goto error;
                                }
@@ -851,15 +806,13 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
        default:
                if (name) {
                        ERR("Can't use --name with %s event rules.",
-                                       lttng_event_rule_type_str(
-                                                       event_rule_type));
+                           lttng_event_rule_type_str(event_rule_type));
                        goto error;
                }
 
                if (lttng_dynamic_pointer_array_get_count(&exclude_names) > 0) {
                        ERR("Can't use --exclude-name/-x with %s event rules.",
-                                       lttng_event_rule_type_str(
-                                                       event_rule_type));
+                           lttng_event_rule_type_str(event_rule_type));
                        goto error;
                }
        }
@@ -876,7 +829,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
        case LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE:
                if (!location) {
                        ERR("Event rule of type %s requires a --location.",
-                       lttng_event_rule_type_str(event_rule_type));
+                           lttng_event_rule_type_str(event_rule_type));
                        goto error;
                }
 
@@ -889,14 +842,13 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
        default:
                if (location) {
                        ERR("Can't use --location with %s event rules.",
-                       lttng_event_rule_type_str(event_rule_type));
+                           lttng_event_rule_type_str(event_rule_type));
                        goto error;
                }
 
                if (event_name) {
                        ERR("Can't use --event-name with %s event rules.",
-                                       lttng_event_rule_type_str(
-                                                       event_rule_type));
+                           lttng_event_rule_type_str(event_rule_type));
                        goto error;
                }
        }
@@ -925,7 +877,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                        break;
                default:
                        ERR("Filter expressions are not supported for %s event rules.",
-                                       lttng_event_rule_type_str(event_rule_type));
+                           lttng_event_rule_type_str(event_rule_type));
                        goto error;
                }
        }
@@ -938,7 +890,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
        if (lttng_dynamic_pointer_array_get_count(&exclude_names) > 0) {
                if (event_rule_type != LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT) {
                        ERR("Event name exclusions are not yet implemented for %s event rules.",
-                                       lttng_event_rule_type_str(event_rule_type));
+                           lttng_event_rule_type_str(event_rule_type));
                        goto error;
                }
 
@@ -969,17 +921,17 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                                break;
                        }
 
-                       if (!parse_log_level_string(log_level_str, event_rule_type,
-                                           &log_level, &log_level_only)) {
-                               ERR("Failed to parse log level string `%s`.",
-                                               log_level_str);
+                       if (!parse_log_level_string(
+                                   log_level_str, event_rule_type, &log_level, &log_level_only)) {
+                               ERR("Failed to parse log level string `%s`.", log_level_str);
                                goto error;
                        }
 
                        if (log_level_only) {
                                log_level_rule = lttng_log_level_rule_exactly_create(log_level);
                        } else {
-                               log_level_rule = lttng_log_level_rule_at_least_as_severe_as_create(log_level);
+                               log_level_rule = lttng_log_level_rule_at_least_as_severe_as_create(
+                                       log_level);
                        }
 
                        if (log_level_rule == NULL) {
@@ -990,7 +942,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                }
                default:
                        ERR("Log levels are not supported for %s event rules.",
-                                       lttng_event_rule_type_str(event_rule_type));
+                           lttng_event_rule_type_str(event_rule_type));
                        goto error;
                }
        }
@@ -1008,21 +960,19 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                }
 
                /* Set pattern. */
-               event_rule_status = lttng_event_rule_user_tracepoint_set_name_pattern(
-                               res.er, name);
+               event_rule_status = lttng_event_rule_user_tracepoint_set_name_pattern(res.er, name);
                if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to set user_tracepoint event rule's pattern to '%s'.",
-                                       name);
+                       ERR("Failed to set user_tracepoint event rule's pattern to '%s'.", name);
                        goto error;
                }
 
                /* Set filter. */
                if (filter) {
-                       event_rule_status = lttng_event_rule_user_tracepoint_set_filter(
-                                       res.er, filter);
+                       event_rule_status =
+                               lttng_event_rule_user_tracepoint_set_filter(res.er, filter);
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                                ERR("Failed to set user_tracepoint event rule's filter to '%s'.",
-                                               filter);
+                                   filter);
                                goto error;
                        }
                }
@@ -1030,32 +980,27 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                /* Set exclusion list. */
                if (lttng_dynamic_pointer_array_get_count(&exclude_names) > 0) {
                        int n;
-                       int count = lttng_dynamic_pointer_array_get_count(
-                                       &exclude_names);
+                       int count = lttng_dynamic_pointer_array_get_count(&exclude_names);
 
                        for (n = 0; n < count; n++) {
                                const char *exclude_name =
-                                               (const char *) lttng_dynamic_pointer_array_get_pointer(
-                                                               &exclude_names,
-                                                               n);
+                                       (const char *) lttng_dynamic_pointer_array_get_pointer(
+                                               &exclude_names, n);
 
                                event_rule_status =
-                                               lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(
-                                                               res.er,
-                                                               exclude_name);
-                               if (event_rule_status !=
-                                               LTTNG_EVENT_RULE_STATUS_OK) {
+                                       lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(
+                                               res.er, exclude_name);
+                               if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                                        ERR("Failed to set user_tracepoint exclusion list element '%s'",
-                                                       exclude_name);
+                                           exclude_name);
                                        goto error;
                                }
                        }
                }
 
                if (log_level_rule) {
-                       event_rule_status =
-                                       lttng_event_rule_user_tracepoint_set_log_level_rule(
-                                                       res.er, log_level_rule);
+                       event_rule_status = lttng_event_rule_user_tracepoint_set_log_level_rule(
+                               res.er, log_level_rule);
 
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                                ERR("Failed to set log level on event fule.");
@@ -1076,21 +1021,20 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                }
 
                /* Set pattern. */
-               event_rule_status = lttng_event_rule_kernel_tracepoint_set_name_pattern(
-                               res.er, name);
+               event_rule_status =
+                       lttng_event_rule_kernel_tracepoint_set_name_pattern(res.er, name);
                if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to set kernel_tracepoint event rule's pattern to '%s'.",
-                                       name);
+                       ERR("Failed to set kernel_tracepoint event rule's pattern to '%s'.", name);
                        goto error;
                }
 
                /* Set filter. */
                if (filter) {
-                       event_rule_status = lttng_event_rule_kernel_tracepoint_set_filter(
-                                       res.er, filter);
+                       event_rule_status =
+                               lttng_event_rule_kernel_tracepoint_set_filter(res.er, filter);
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                                ERR("Failed to set kernel_tracepoint event rule's filter to '%s'.",
-                                               filter);
+                                   filter);
                                goto error;
                        }
                }
@@ -1107,29 +1051,25 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                }
 
                /* Set pattern. */
-               event_rule_status = lttng_event_rule_jul_logging_set_name_pattern(
-                               res.er, name);
+               event_rule_status = lttng_event_rule_jul_logging_set_name_pattern(res.er, name);
                if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to set jul_logging event rule's pattern to '%s'.",
-                                       name);
+                       ERR("Failed to set jul_logging event rule's pattern to '%s'.", name);
                        goto error;
                }
 
                /* Set filter. */
                if (filter) {
-                       event_rule_status = lttng_event_rule_jul_logging_set_filter(
-                                       res.er, filter);
+                       event_rule_status = lttng_event_rule_jul_logging_set_filter(res.er, filter);
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                                ERR("Failed to set jul_logging event rule's filter to '%s'.",
-                                               filter);
+                                   filter);
                                goto error;
                        }
                }
 
                if (log_level_rule) {
-                       event_rule_status =
-                                       lttng_event_rule_jul_logging_set_log_level_rule(
-                                                       res.er, log_level_rule);
+                       event_rule_status = lttng_event_rule_jul_logging_set_log_level_rule(
+                               res.er, log_level_rule);
 
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                                ERR("Failed to set log level on event fule.");
@@ -1149,29 +1089,26 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                }
 
                /* Set pattern. */
-               event_rule_status = lttng_event_rule_log4j_logging_set_name_pattern(
-                               res.er, name);
+               event_rule_status = lttng_event_rule_log4j_logging_set_name_pattern(res.er, name);
                if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to set jul_logging event rule's pattern to '%s'.",
-                                       name);
+                       ERR("Failed to set jul_logging event rule's pattern to '%s'.", name);
                        goto error;
                }
 
                /* Set filter. */
                if (filter) {
-                       event_rule_status = lttng_event_rule_log4j_logging_set_filter(
-                                       res.er, filter);
+                       event_rule_status =
+                               lttng_event_rule_log4j_logging_set_filter(res.er, filter);
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                                ERR("Failed to set jul_logging event rule's filter to '%s'.",
-                                               filter);
+                                   filter);
                                goto error;
                        }
                }
 
                if (log_level_rule) {
-                       event_rule_status =
-                                       lttng_event_rule_log4j_logging_set_log_level_rule(
-                                                       res.er, log_level_rule);
+                       event_rule_status = lttng_event_rule_log4j_logging_set_log_level_rule(
+                               res.er, log_level_rule);
 
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                                ERR("Failed to set log level on event fule.");
@@ -1191,29 +1128,26 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                }
 
                /* Set pattern. */
-               event_rule_status = lttng_event_rule_python_logging_set_name_pattern(
-                               res.er, name);
+               event_rule_status = lttng_event_rule_python_logging_set_name_pattern(res.er, name);
                if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to set jul_logging event rule's pattern to '%s'.",
-                                       name);
+                       ERR("Failed to set jul_logging event rule's pattern to '%s'.", name);
                        goto error;
                }
 
                /* Set filter. */
                if (filter) {
-                       event_rule_status = lttng_event_rule_python_logging_set_filter(
-                                       res.er, filter);
+                       event_rule_status =
+                               lttng_event_rule_python_logging_set_filter(res.er, filter);
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                                ERR("Failed to set jul_logging event rule's filter to '%s'.",
-                                               filter);
+                                   filter);
                                goto error;
                        }
                }
 
                if (log_level_rule) {
-                       event_rule_status =
-                                       lttng_event_rule_python_logging_set_log_level_rule(
-                                                       res.er, log_level_rule);
+                       event_rule_status = lttng_event_rule_python_logging_set_log_level_rule(
+                               res.er, log_level_rule);
 
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                                ERR("Failed to set log level on event fule.");
@@ -1227,8 +1161,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                int ret;
                enum lttng_event_rule_status event_rule_status;
 
-               ret = parse_kernel_probe_opts(
-                               location, &kernel_probe_location);
+               ret = parse_kernel_probe_opts(location, &kernel_probe_location);
                if (ret) {
                        ERR("Failed to parse kernel probe location.");
                        goto error;
@@ -1242,11 +1175,9 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                }
 
                event_rule_status =
-                               lttng_event_rule_kernel_kprobe_set_event_name(
-                                               res.er, event_name);
+                       lttng_event_rule_kernel_kprobe_set_event_name(res.er, event_name);
                if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to set kprobe event rule's name to '%s'.",
-                                       event_name);
+                       ERR("Failed to set kprobe event rule's name to '%s'.", event_name);
                        goto error;
                }
 
@@ -1257,8 +1188,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                int ret;
                enum lttng_event_rule_status event_rule_status;
 
-               ret = parse_userspace_probe_opts(
-                               location, &userspace_probe_location);
+               ret = parse_userspace_probe_opts(location, &userspace_probe_location);
                if (ret) {
                        ERR("Failed to parse user space probe location.");
                        goto error;
@@ -1271,11 +1201,10 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                }
 
                event_rule_status =
-                               lttng_event_rule_kernel_uprobe_set_event_name(
-                                               res.er, event_name);
+                       lttng_event_rule_kernel_uprobe_set_event_name(res.er, event_name);
                if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set user space probe event rule's name to '%s'.",
-                                       event_name);
+                           event_name);
                        goto error;
                }
 
@@ -1286,8 +1215,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                enum lttng_event_rule_status event_rule_status;
                enum lttng_event_rule_kernel_syscall_emission_site emission_site;
 
-               if (!parse_syscall_emission_site_from_type(
-                                   event_rule_type_str, &emission_site)) {
+               if (!parse_syscall_emission_site_from_type(event_rule_type_str, &emission_site)) {
                        ERR("Failed to parse syscall type '%s'.", event_rule_type_str);
                        goto error;
                }
@@ -1298,20 +1226,17 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv,
                        goto error;
                }
 
-               event_rule_status = lttng_event_rule_kernel_syscall_set_name_pattern(
-                               res.er, name);
+               event_rule_status = lttng_event_rule_kernel_syscall_set_name_pattern(res.er, name);
                if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to set syscall event rule's pattern to '%s'.",
-                                       name);
+                       ERR("Failed to set syscall event rule's pattern to '%s'.", name);
                        goto error;
                }
 
                if (filter) {
-                       event_rule_status = lttng_event_rule_kernel_syscall_set_filter(
-                                       res.er, filter);
+                       event_rule_status =
+                               lttng_event_rule_kernel_syscall_set_filter(res.er, filter);
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
-                               ERR("Failed to set syscall event rule's filter to '%s'.",
-                                               filter);
+                               ERR("Failed to set syscall event rule's filter to '%s'.", filter);
                                goto error;
                        }
                }
@@ -1352,9 +1277,8 @@ end:
        return res;
 }
 
-static
-struct lttng_condition *handle_condition_event(int *argc, const char ***argv,
-               int argc_offset)
+static struct lttng_condition *
+handle_condition_event(int *argc, const char ***argv, int argc_offset)
 {
        struct parse_event_rule_res res;
        struct lttng_condition *c;
@@ -1373,17 +1297,15 @@ struct lttng_condition *handle_condition_event(int *argc, const char ***argv,
                goto error;
        }
 
-       for (i = 0; i < lttng_dynamic_pointer_array_get_count(&res.capture_descriptors);
-                       i++) {
+       for (i = 0; i < lttng_dynamic_pointer_array_get_count(&res.capture_descriptors); i++) {
                enum lttng_condition_status status;
                struct lttng_event_expr **expr =
-                               (lttng_event_expr **) lttng_dynamic_array_get_element(
-                                       &res.capture_descriptors.array, i);
+                       (lttng_event_expr **) lttng_dynamic_array_get_element(
+                               &res.capture_descriptors.array, i);
 
                LTTNG_ASSERT(expr);
                LTTNG_ASSERT(*expr);
-               status = lttng_condition_event_rule_matches_append_capture_descriptor(
-                               c, *expr);
+               status = lttng_condition_event_rule_matches_append_capture_descriptor(c, *expr);
                if (status != LTTNG_CONDITION_STATUS_OK) {
                        if (status == LTTNG_CONDITION_STATUS_UNSUPPORTED) {
                                ERR("The capture feature is unsupported by the event-rule condition type");
@@ -1411,18 +1333,15 @@ end:
 namespace {
 struct condition_descr {
        const char *name;
-       struct lttng_condition *(*handler) (int *argc, const char ***argv,
-               int argc_offset);
+       struct lttng_condition *(*handler)(int *argc, const char ***argv, int argc_offset);
 };
 } /* namespace */
 
-static const
-struct condition_descr condition_descrs[] = {
+static const struct condition_descr condition_descrs[] = {
        { "event-rule-matches", handle_condition_event },
 };
 
-static
-void print_valid_condition_names(void)
+static void print_valid_condition_names(void)
 {
        unsigned int i;
 
@@ -1433,10 +1352,12 @@ void print_valid_condition_names(void)
        }
 }
 
-static
-struct lttng_condition *parse_condition(const char *condition_name, int *argc,
-               const char ***argv, int argc_offset, int orig_arg_index,
-               const char *orig_arg)
+static struct lttng_condition *parse_condition(const char *condition_name,
+                                              int *argc,
+                                              const char ***argv,
+                                              int argc_offset,
+                                              int orig_arg_index,
+                                              const char *orig_arg)
 {
        int i;
        struct lttng_condition *cond;
@@ -1451,7 +1372,9 @@ struct lttng_condition *parse_condition(const char *condition_name, int *argc,
 
        if (!descr) {
                ERR(WHILE_PARSING_ARG_N_ARG_FMT "Unknown condition name '%s'",
-                       orig_arg_index + 1, orig_arg, condition_name);
+                   orig_arg_index + 1,
+                   orig_arg,
+                   condition_name);
                print_valid_condition_names();
                goto error;
        }
@@ -1513,8 +1436,7 @@ static struct lttng_rate_policy *parse_rate_policy(const char *policy_str)
 
        /* Parse the value. */
        if (utils_parse_unsigned_long_long(policy_value_str, &value) != 0) {
-               ERR("Failed to parse rate policy value `%s` as an integer.",
-                               policy_value_str);
+               ERR("Failed to parse rate policy value `%s` as an integer.", policy_value_str);
                goto end;
        }
 
@@ -1544,13 +1466,10 @@ end:
 }
 
 static const struct argpar_opt_descr notify_action_opt_descrs[] = {
-       { OPT_RATE_POLICY, '\0', "rate-policy", true },
-       ARGPAR_OPT_DESCR_SENTINEL
+       { OPT_RATE_POLICY, '\0', "rate-policy", true }, ARGPAR_OPT_DESCR_SENTINEL
 };
 
-static
-struct lttng_action *handle_action_notify(int *argc, const char ***argv,
-               int argc_offset)
+static struct lttng_action *handle_action_notify(int *argc, const char ***argv, int argc_offset)
 {
        struct lttng_action *action = NULL;
        struct argpar_iter *argpar_iter = NULL;
@@ -1566,11 +1485,15 @@ struct lttng_action *handle_action_notify(int *argc, const char ***argv,
        while (true) {
                enum parse_next_item_status status;
 
-               status = parse_next_item(argpar_iter, &argpar_item,
-                       argc_offset, *argv, false, NULL,
-                       "While parsing `notify` action:");
+               status = parse_next_item(argpar_iter,
+                                        &argpar_item,
+                                        argc_offset,
+                                        *argv,
+                                        false,
+                                        NULL,
+                                        "While parsing `notify` action:");
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR ||
-                               status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
+                   status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
                        goto error;
                } else if (status == PARSE_NEXT_ITEM_STATUS_END) {
                        break;
@@ -1579,8 +1502,7 @@ struct lttng_action *handle_action_notify(int *argc, const char ***argv,
                LTTNG_ASSERT(status == PARSE_NEXT_ITEM_STATUS_OK);
 
                if (argpar_item_type(argpar_item) == ARGPAR_ITEM_TYPE_OPT) {
-                       const struct argpar_opt_descr *descr =
-                               argpar_item_opt_descr(argpar_item);
+                       const struct argpar_opt_descr *descr = argpar_item_opt_descr(argpar_item);
                        const char *arg = argpar_item_opt_arg(argpar_item);
 
                        switch (descr->id) {
@@ -1638,16 +1560,15 @@ end:
  * optional rate policy.
  */
 
-static struct lttng_action *handle_action_simple_session_with_policy(int *argc,
-               const char ***argv,
-               int argc_offset,
-               struct lttng_action *(*create_action_cb)(void),
-               enum lttng_action_status (*set_session_name_cb)(
-                               struct lttng_action *, const char *),
-               enum lttng_action_status (*set_rate_policy_cb)(
-                               struct lttng_action *,
-                               const struct lttng_rate_policy *),
-               const char *action_name)
+static struct lttng_action *handle_action_simple_session_with_policy(
+       int *argc,
+       const char ***argv,
+       int argc_offset,
+       struct lttng_action *(*create_action_cb)(void),
+       enum lttng_action_status (*set_session_name_cb)(struct lttng_action *, const char *),
+       enum lttng_action_status (*set_rate_policy_cb)(struct lttng_action *,
+                                                      const struct lttng_rate_policy *),
+       const char *action_name)
 {
        struct lttng_action *action = NULL;
        struct argpar_iter *argpar_iter = NULL;
@@ -1660,8 +1581,7 @@ static struct lttng_action *handle_action_simple_session_with_policy(int *argc,
        LTTNG_ASSERT(set_rate_policy_cb);
 
        const struct argpar_opt_descr rate_policy_opt_descrs[] = {
-               { OPT_RATE_POLICY, '\0', "rate-policy", true },
-               ARGPAR_OPT_DESCR_SENTINEL
+               { OPT_RATE_POLICY, '\0', "rate-policy", true }, ARGPAR_OPT_DESCR_SENTINEL
        };
 
        argpar_iter = argpar_iter_create(*argc, *argv, rate_policy_opt_descrs);
@@ -1673,11 +1593,16 @@ static struct lttng_action *handle_action_simple_session_with_policy(int *argc,
        while (true) {
                enum parse_next_item_status status;
 
-               status = parse_next_item(argpar_iter, &argpar_item, argc_offset,
-                       *argv, false, NULL,
-                       "While parsing `%s` action:", action_name);
+               status = parse_next_item(argpar_iter,
+                                        &argpar_item,
+                                        argc_offset,
+                                        *argv,
+                                        false,
+                                        NULL,
+                                        "While parsing `%s` action:",
+                                        action_name);
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR ||
-                               status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
+                   status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
                        goto error;
                } else if (status == PARSE_NEXT_ITEM_STATUS_END) {
                        break;
@@ -1686,8 +1611,7 @@ static struct lttng_action *handle_action_simple_session_with_policy(int *argc,
                LTTNG_ASSERT(status == PARSE_NEXT_ITEM_STATUS_OK);
 
                if (argpar_item_type(argpar_item) == ARGPAR_ITEM_TYPE_OPT) {
-                       const struct argpar_opt_descr *descr =
-                               argpar_item_opt_descr(argpar_item);
+                       const struct argpar_opt_descr *descr = argpar_item_opt_descr(argpar_item);
                        const char *arg = argpar_item_opt_arg(argpar_item);
 
                        switch (descr->id) {
@@ -1734,7 +1658,8 @@ static struct lttng_action *handle_action_simple_session_with_policy(int *argc,
        action_status = set_session_name_cb(action, session_name_arg);
        if (action_status != LTTNG_ACTION_STATUS_OK) {
                ERR("Failed to set action %s session's session name to '%s'.",
-                               action_name, session_name_arg);
+                   action_name,
+                   session_name_arg);
                goto error;
        }
 
@@ -1759,33 +1684,36 @@ end:
        return action;
 }
 
-static
-struct lttng_action *handle_action_start_session(int *argc,
-               const char ***argv, int argc_offset)
+static struct lttng_action *
+handle_action_start_session(int *argc, const char ***argv, int argc_offset)
 {
-       return handle_action_simple_session_with_policy(argc, argv,
-                       argc_offset,
-                       lttng_action_start_session_create,
-                       lttng_action_start_session_set_session_name,
-                       lttng_action_start_session_set_rate_policy, "start");
+       return handle_action_simple_session_with_policy(argc,
+                                                       argv,
+                                                       argc_offset,
+                                                       lttng_action_start_session_create,
+                                                       lttng_action_start_session_set_session_name,
+                                                       lttng_action_start_session_set_rate_policy,
+                                                       "start");
 }
 
-static
-struct lttng_action *handle_action_stop_session(int *argc,
-               const char ***argv, int argc_offset)
+static struct lttng_action *
+handle_action_stop_session(int *argc, const char ***argv, int argc_offset)
 {
-       return handle_action_simple_session_with_policy(argc, argv,
-                       argc_offset,
-                       lttng_action_stop_session_create,
-                       lttng_action_stop_session_set_session_name,
-                       lttng_action_stop_session_set_rate_policy, "stop");
+       return handle_action_simple_session_with_policy(argc,
+                                                       argv,
+                                                       argc_offset,
+                                                       lttng_action_stop_session_create,
+                                                       lttng_action_stop_session_set_session_name,
+                                                       lttng_action_stop_session_set_rate_policy,
+                                                       "stop");
 }
 
-static
-struct lttng_action *handle_action_rotate_session(int *argc,
-               const char ***argv, int argc_offset)
+static struct lttng_action *
+handle_action_rotate_session(int *argc, const char ***argv, int argc_offset)
 {
-       return handle_action_simple_session_with_policy(argc, argv,
+       return handle_action_simple_session_with_policy(
+               argc,
+               argv,
                argc_offset,
                lttng_action_rotate_session_create,
                lttng_action_rotate_session_set_session_name,
@@ -1804,9 +1732,8 @@ static const struct argpar_opt_descr snapshot_action_opt_descrs[] = {
        ARGPAR_OPT_DESCR_SENTINEL
 };
 
-static
-struct lttng_action *handle_action_snapshot_session(int *argc,
-               const char ***argv, int argc_offset)
+static struct lttng_action *
+handle_action_snapshot_session(int *argc, const char ***argv, int argc_offset)
 {
        struct lttng_action *action = NULL;
        struct argpar_iter *argpar_iter = NULL;
@@ -1834,10 +1761,15 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
        while (true) {
                enum parse_next_item_status status;
 
-               status = parse_next_item(argpar_iter, &argpar_item, argc_offset,
-                       *argv, false, NULL, "While parsing `snapshot` action:");
+               status = parse_next_item(argpar_iter,
+                                        &argpar_item,
+                                        argc_offset,
+                                        *argv,
+                                        false,
+                                        NULL,
+                                        "While parsing `snapshot` action:");
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR ||
-                               status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
+                   status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
                        goto error;
                } else if (status == PARSE_NEXT_ITEM_STATUS_END) {
                        break;
@@ -1846,8 +1778,7 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
                LTTNG_ASSERT(status == PARSE_NEXT_ITEM_STATUS_OK);
 
                if (argpar_item_type(argpar_item) == ARGPAR_ITEM_TYPE_OPT) {
-                       const struct argpar_opt_descr *descr =
-                               argpar_item_opt_descr(argpar_item);
+                       const struct argpar_opt_descr *descr = argpar_item_opt_descr(argpar_item);
                        const char *arg = argpar_item_opt_arg(argpar_item);
 
                        switch (descr->id) {
@@ -1960,11 +1891,10 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
                goto error;
        }
 
-       action_status = lttng_action_snapshot_session_set_session_name(
-                       action, session_name_arg);
+       action_status = lttng_action_snapshot_session_set_session_name(action, session_name_arg);
        if (action_status != LTTNG_ACTION_STATUS_OK) {
                ERR("Failed to set action snapshot session's session name to '%s'.",
-                               session_name_arg);
+                   session_name_arg);
                goto error;
        }
 
@@ -1974,8 +1904,7 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
                        goto error;
                }
 
-               ret = lttng_snapshot_output_set_name(
-                               snapshot_name_arg, snapshot_output);
+               ret = lttng_snapshot_output_set_name(snapshot_name_arg, snapshot_output);
                if (ret != 0) {
                        ERR("Failed to set name of snapshot output.");
                        goto error;
@@ -1999,7 +1928,7 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
                ret = lttng_snapshot_output_set_size(max_size, snapshot_output);
                if (ret != 0) {
                        ERR("Failed to set snapshot output's max size to %" PRIu64 " bytes.",
-                                       max_size);
+                           max_size);
                        goto error;
                }
        }
@@ -2020,29 +1949,25 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
                }
 
                if (uris[0].dtype == LTTNG_DST_PATH) {
-                       ret = lttng_snapshot_output_set_local_path(
-                                       uris[0].dst.path, snapshot_output);
+                       ret = lttng_snapshot_output_set_local_path(uris[0].dst.path,
+                                                                  snapshot_output);
                        free(uris);
                        if (ret != 0) {
-                               ERR("Failed to assign '%s' as a local destination.",
-                                               url_arg);
+                               ERR("Failed to assign '%s' as a local destination.", url_arg);
                                goto error;
                        }
                } else {
-                       ret = lttng_snapshot_output_set_network_url(
-                                       url_arg, snapshot_output);
+                       ret = lttng_snapshot_output_set_network_url(url_arg, snapshot_output);
                        free(uris);
                        if (ret != 0) {
-                               ERR("Failed to assign '%s' as a network URL.",
-                                               url_arg);
+                               ERR("Failed to assign '%s' as a network URL.", url_arg);
                                goto error;
                        }
                }
        }
 
        if (path_arg) {
-               ret = lttng_snapshot_output_set_local_path(
-                               path_arg, snapshot_output);
+               ret = lttng_snapshot_output_set_local_path(path_arg, snapshot_output);
                if (ret != 0) {
                        ERR("Failed to parse '%s' as a local path.", path_arg);
                        goto error;
@@ -2055,17 +1980,17 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
                 * data URLs.
                 */
                ret = lttng_snapshot_output_set_network_urls(
-                               ctrl_url_arg, data_url_arg, snapshot_output);
+                       ctrl_url_arg, data_url_arg, snapshot_output);
                if (ret != 0) {
                        ERR("Failed to parse `%s` and `%s` as control and data URLs.",
-                                       ctrl_url_arg, data_url_arg);
+                           ctrl_url_arg,
+                           data_url_arg);
                        goto error;
                }
        }
 
        if (snapshot_output) {
-               action_status = lttng_action_snapshot_session_set_output(
-                               action, snapshot_output);
+               action_status = lttng_action_snapshot_session_set_output(action, snapshot_output);
                if (action_status != LTTNG_ACTION_STATUS_OK) {
                        ERR("Failed to set snapshot session action's output.");
                        goto error;
@@ -2077,8 +2002,7 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
 
        if (policy) {
                enum lttng_action_status status;
-               status = lttng_action_snapshot_session_set_rate_policy(
-                               action, policy);
+               status = lttng_action_snapshot_session_set_rate_policy(action, policy);
                if (status != LTTNG_ACTION_STATUS_OK) {
                        ERR("Failed to set rate policy");
                        goto error;
@@ -2108,13 +2032,11 @@ end:
 namespace {
 struct action_descr {
        const char *name;
-       struct lttng_action *(*handler) (int *argc, const char ***argv,
-               int argc_offset);
+       struct lttng_action *(*handler)(int *argc, const char ***argv, int argc_offset);
 };
 } /* namespace */
 
-static const
-struct action_descr action_descrs[] = {
+static const struct action_descr action_descrs[] = {
        { "notify", handle_action_notify },
        { "start-session", handle_action_start_session },
        { "stop-session", handle_action_stop_session },
@@ -2122,8 +2044,7 @@ struct action_descr action_descrs[] = {
        { "snapshot-session", handle_action_snapshot_session },
 };
 
-static
-void print_valid_action_names(void)
+static void print_valid_action_names(void)
 {
        unsigned int i;
 
@@ -2134,10 +2055,12 @@ void print_valid_action_names(void)
        }
 }
 
-static
-struct lttng_action *parse_action(const char *action_name, int *argc,
-               const char ***argv, int argc_offset, int orig_arg_index,
-               const char *orig_arg)
+static struct lttng_action *parse_action(const char *action_name,
+                                        int *argc,
+                                        const char ***argv,
+                                        int argc_offset,
+                                        int orig_arg_index,
+                                        const char *orig_arg)
 {
        int i;
        struct lttng_action *action;
@@ -2152,7 +2075,9 @@ struct lttng_action *parse_action(const char *action_name, int *argc,
 
        if (!descr) {
                ERR(WHILE_PARSING_ARG_N_ARG_FMT "Unknown action name '%s'",
-                       orig_arg_index + 1, orig_arg, action_name);
+                   orig_arg_index + 1,
+                   orig_arg,
+                   action_name);
                print_valid_action_names();
                goto error;
        }
@@ -2170,8 +2095,7 @@ end:
        return action;
 }
 
-static const
-struct argpar_opt_descr add_trigger_options[] = {
+static const struct argpar_opt_descr add_trigger_options[] = {
        { OPT_HELP, 'h', "help", false },
        { OPT_LIST_OPTIONS, '\0', "list-options", false },
        { OPT_CONDITION, '\0', "condition", true },
@@ -2181,8 +2105,7 @@ struct argpar_opt_descr add_trigger_options[] = {
        ARGPAR_OPT_DESCR_SENTINEL,
 };
 
-static
-void lttng_actions_destructor(void *p)
+static void lttng_actions_destructor(void *p)
 {
        struct lttng_action *action = (lttng_action *) p;
 
@@ -2211,24 +2134,21 @@ int cmd_add_trigger(int argc, const char **argv)
        lttng_dynamic_pointer_array_init(&actions, lttng_actions_destructor);
 
        if (lttng_opt_mi) {
-               mi_writer = mi_lttng_writer_create(
-                               fileno(stdout), lttng_opt_mi);
+               mi_writer = mi_lttng_writer_create(fileno(stdout), lttng_opt_mi);
                if (!mi_writer) {
                        ret = CMD_ERROR;
                        goto error;
                }
 
                /* Open command element. */
-               ret = mi_lttng_writer_command_open(mi_writer,
-                               mi_lttng_element_command_add_trigger);
+               ret = mi_lttng_writer_command_open(mi_writer, mi_lttng_element_command_add_trigger);
                if (ret) {
                        ret = CMD_ERROR;
                        goto error;
                }
 
                /* Open output element. */
-               ret = mi_lttng_writer_open_element(
-                               mi_writer, mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(mi_writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto error;
@@ -2242,19 +2162,21 @@ int cmd_add_trigger(int argc, const char **argv)
                const char *arg;
 
                argpar_iter_destroy(argpar_iter);
-               argpar_iter = argpar_iter_create(my_argc, my_argv,
-                       add_trigger_options);
+               argpar_iter = argpar_iter_create(my_argc, my_argv, add_trigger_options);
                if (!argpar_iter) {
                        ERR("Failed to create argpar iter.");
                        goto error;
                }
 
-               status = parse_next_item(argpar_iter, &argpar_item,
-                       argc - my_argc, my_argv, true, &argpar_error, NULL);
+               status = parse_next_item(argpar_iter,
+                                        &argpar_item,
+                                        argc - my_argc,
+                                        my_argv,
+                                        true,
+                                        &argpar_error,
+                                        NULL);
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR) {
-
-                       if (argpar_error_type(argpar_error) ==
-                                       ARGPAR_ERROR_TYPE_MISSING_OPT_ARG) {
+                       if (argpar_error_type(argpar_error) == ARGPAR_ERROR_TYPE_MISSING_OPT_ARG) {
                                int opt_id = argpar_error_opt_descr(argpar_error, NULL)->id;
 
                                if (opt_id == OPT_CONDITION) {
@@ -2274,8 +2196,7 @@ int cmd_add_trigger(int argc, const char **argv)
                LTTNG_ASSERT(status == PARSE_NEXT_ITEM_STATUS_OK);
 
                if (argpar_item_type(argpar_item) == ARGPAR_ITEM_TYPE_NON_OPT) {
-                       ERR("Unexpected argument `%s`.",
-                               argpar_item_non_opt_arg(argpar_item));
+                       ERR("Unexpected argument `%s`.", argpar_item_non_opt_arg(argpar_item));
                        goto error;
                }
 
@@ -2303,9 +2224,12 @@ int cmd_add_trigger(int argc, const char **argv)
                                goto error;
                        }
 
-                       condition = parse_condition(arg, &my_argc, &my_argv,
-                               argc - my_argc, argc - my_argc - ingested_args,
-                               my_argv[-ingested_args]);
+                       condition = parse_condition(arg,
+                                                   &my_argc,
+                                                   &my_argv,
+                                                   argc - my_argc,
+                                                   argc - my_argc - ingested_args,
+                                                   my_argv[-ingested_args]);
                        if (!condition) {
                                /*
                                 * An error message was already printed by
@@ -2318,9 +2242,12 @@ int cmd_add_trigger(int argc, const char **argv)
                }
                case OPT_ACTION:
                {
-                       action = parse_action(arg, &my_argc, &my_argv,
-                               argc - my_argc,  argc - my_argc - ingested_args,
-                               my_argv[-ingested_args]);
+                       action = parse_action(arg,
+                                             &my_argc,
+                                             &my_argv,
+                                             argc - my_argc,
+                                             argc - my_argc - ingested_args,
+                                             my_argv[-ingested_args]);
                        if (!action) {
                                /*
                                 * An error message was already printed by
@@ -2329,8 +2256,7 @@ int cmd_add_trigger(int argc, const char **argv)
                                goto error;
                        }
 
-                       ret = lttng_dynamic_pointer_array_add_pointer(
-                                       &actions, action);
+                       ret = lttng_dynamic_pointer_array_add_pointer(&actions, action);
                        if (ret) {
                                ERR("Failed to add pointer to pointer array.");
                                goto error;
@@ -2351,8 +2277,7 @@ int cmd_add_trigger(int argc, const char **argv)
                }
                case OPT_OWNER_UID:
                {
-                       if (!assign_string(&owner_uid, arg,
-                                       "--owner-uid")) {
+                       if (!assign_string(&owner_uid, arg, "--owner-uid")) {
                                goto error;
                        }
 
@@ -2427,8 +2352,7 @@ int cmd_add_trigger(int argc, const char **argv)
        }
 
        if (ret_code != LTTNG_OK) {
-               ERR("Failed to register trigger: %s.",
-                               lttng_strerror(-ret_code));
+               ERR("Failed to register trigger: %s.", lttng_strerror(-ret_code));
                goto error;
        }
 
@@ -2440,8 +2364,7 @@ int cmd_add_trigger(int argc, const char **argv)
        } else {
                const char *returned_trigger_name;
                const enum lttng_trigger_status trigger_status =
-                               lttng_trigger_get_name(trigger,
-                                               &returned_trigger_name);
+                       lttng_trigger_get_name(trigger, &returned_trigger_name);
 
                if (trigger_status != LTTNG_TRIGGER_STATUS_OK) {
                        WARN("Failed to retrieve the added trigger's name.");
@@ -2469,8 +2392,8 @@ end:
                        goto cleanup;
                }
 
-               mi_ret = mi_lttng_writer_write_element_bool(mi_writer,
-                               mi_lttng_element_command_success, ret ? 0 : 1);
+               mi_ret = mi_lttng_writer_write_element_bool(
+                       mi_writer, mi_lttng_element_command_success, ret ? 0 : 1);
                if (mi_ret) {
                        ret = 1;
                        goto cleanup;
index 887c61f0ef99569e07afd36c16893e5460f2658c..b3829c499dfd4186aeb5fe62454f5888ddc50a72 100644 (file)
@@ -6,28 +6,29 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/utils.hpp>
+
+#include <lttng/lttng.h>
+
 #include <popt.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <stdbool.h>
-#include <lttng/lttng.h>
-
-#include "../command.hpp"
-
-#include <common/mi-lttng.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/utils.hpp>
 
 static int opt_clear_all;
 
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-clear.1.h>
-;
+       ;
 #endif
 
 /* Mi writer */
@@ -40,10 +41,10 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",      'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"all",       'a', POPT_ARG_VAL, &opt_clear_all, 1, 0, 0},
-       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "all", 'a', POPT_ARG_VAL, &opt_clear_all, 1, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 /*
@@ -51,8 +52,7 @@ static struct poptOption long_options[] = {
  */
 static int clear_session(struct lttng_session *session)
 {
-       enum lttng_clear_handle_status status =
-                       LTTNG_CLEAR_HANDLE_STATUS_OK;
+       enum lttng_clear_handle_status status = LTTNG_CLEAR_HANDLE_STATUS_OK;
        struct lttng_clear_handle *handle = NULL;
        enum lttng_error_code ret_code;
        bool printed_wait_msg = false;
@@ -65,13 +65,12 @@ static int clear_session(struct lttng_session *session)
        }
 
        do {
-               status = lttng_clear_handle_wait_for_completion(handle,
-                               DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US / USEC_PER_MSEC);
+               status = lttng_clear_handle_wait_for_completion(
+                       handle, DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US / USEC_PER_MSEC);
                switch (status) {
                case LTTNG_CLEAR_HANDLE_STATUS_TIMEOUT:
                        if (!printed_wait_msg) {
-                               _MSG("Waiting for clear of session \"%s\"",
-                                               session->name);
+                               _MSG("Waiting for clear of session \"%s\"", session->name);
                                printed_wait_msg = true;
                        }
                        _MSG(".");
@@ -81,7 +80,7 @@ static int clear_session(struct lttng_session *session)
                        break;
                default:
                        ERR("Failed to wait for the completion of clear for session \"%s\"",
-                                       session->name);
+                           session->name);
                        ret = -1;
                        goto error;
                }
@@ -98,8 +97,7 @@ static int clear_session(struct lttng_session *session)
                goto error;
        }
 
-       MSG("%sSession \"%s\" cleared", printed_wait_msg ? "\n" : "",
-                       session->name);
+       MSG("%sSession \"%s\" cleared", printed_wait_msg ? "\n" : "", session->name);
        printed_wait_msg = false;
 
        if (lttng_opt_mi) {
@@ -151,7 +149,7 @@ error:
 int cmd_clear(int argc, const char **argv)
 {
        int opt;
-       int ret = CMD_SUCCESS , i, command_ret = CMD_SUCCESS, success = 1;
+       int ret = CMD_SUCCESS, i, command_ret = CMD_SUCCESS, success = 1;
        static poptContext pc;
        char *session_name = NULL;
        const char *arg_session_name = NULL;
@@ -187,16 +185,14 @@ int cmd_clear(int argc, const char **argv)
                }
 
                /* Open command element */
-               ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_clear);
+               ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_clear);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -286,8 +282,8 @@ mi_closing:
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success, success);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, success);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
index fde027fe57e465bdd4dd6539f05304958356a766..985dde992b1e5a7ef3edc090bd762121641044bc 100644 (file)
@@ -7,30 +7,30 @@
  */
 
 #define _LGPL_SOURCE
-#include <ctype.h>
-#include <popt.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <common/compat/time.hpp>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/wait.h>
-
-#include <common/mi-lttng.hpp>
-
 #include "../command.hpp"
 #include "../utils.hpp"
 
+#include <common/compat/time.hpp>
 #include <common/defaults.hpp>
+#include <common/mi-lttng.hpp>
+#include <common/path.hpp>
 #include <common/sessiond-comm/sessiond-comm.hpp>
 #include <common/uri.hpp>
 #include <common/utils.hpp>
-#include <common/path.hpp>
+
 #include <lttng/lttng.h>
 
+#include <ctype.h>
+#include <popt.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
 static char *opt_output_path;
 static char *opt_url;
 static char *opt_ctrl_url;
@@ -44,7 +44,7 @@ static uint32_t opt_live_timer;
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-create.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -63,18 +63,18 @@ enum output_type {
 static struct mi_writer *writer;
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL},
-       {"output", 'o', POPT_ARG_STRING, &opt_output_path, 0, NULL, NULL},
-       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {"set-url",        'U', POPT_ARG_STRING, &opt_url, 0, 0, 0},
-       {"ctrl-url",       'C', POPT_ARG_STRING, &opt_ctrl_url, 0, 0, 0},
-       {"data-url",       'D', POPT_ARG_STRING, &opt_data_url, 0, 0, 0},
-       {"no-output",       0, POPT_ARG_VAL, &opt_no_output, 1, 0, 0},
-       {"no-consumer",     0, POPT_ARG_VAL, &opt_no_consumer, 1, 0, 0},
-       {"snapshot",        0, POPT_ARG_VAL, &opt_snapshot, 1, 0, 0},
-       {"live",            0, POPT_ARG_INT | POPT_ARGFLAG_OPTIONAL, 0, OPT_LIVE_TIMER, 0, 0},
-       {"shm-path",        0, POPT_ARG_STRING, &opt_shm_path, 0, 0, 0},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
+       { "output", 'o', POPT_ARG_STRING, &opt_output_path, 0, NULL, NULL },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { "set-url", 'U', POPT_ARG_STRING, &opt_url, 0, 0, 0 },
+       { "ctrl-url", 'C', POPT_ARG_STRING, &opt_ctrl_url, 0, 0, 0 },
+       { "data-url", 'D', POPT_ARG_STRING, &opt_data_url, 0, 0, 0 },
+       { "no-output", 0, POPT_ARG_VAL, &opt_no_output, 1, 0, 0 },
+       { "no-consumer", 0, POPT_ARG_VAL, &opt_no_consumer, 1, 0, 0 },
+       { "snapshot", 0, POPT_ARG_VAL, &opt_snapshot, 1, 0, 0 },
+       { "live", 0, POPT_ARG_INT | POPT_ARGFLAG_OPTIONAL, 0, OPT_LIVE_TIMER, 0, 0 },
+       { "shm-path", 0, POPT_ARG_STRING, &opt_shm_path, 0, 0, 0 },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 /*
@@ -128,8 +128,7 @@ end:
        return ret;
 }
 
-static
-struct lttng_session_descriptor *create_session_descriptor(const char *session_name)
+static struct lttng_session_descriptor *create_session_descriptor(const char *session_name)
 {
        ssize_t uri_count;
        enum output_type output_type;
@@ -150,12 +149,12 @@ struct lttng_session_descriptor *create_session_descriptor(const char *session_n
                        ERR("Failed to expand output path.");
                        goto end;
                }
-               ret = lttng_strncpy(local_output_path, expanded_output_path,
-                               sizeof(local_output_path));
+               ret = lttng_strncpy(
+                       local_output_path, expanded_output_path, sizeof(local_output_path));
                free(expanded_output_path);
                if (ret) {
                        ERR("Output path exceeds the maximal supported length (%zu bytes)",
-                                       sizeof(local_output_path));
+                           sizeof(local_output_path));
                        goto end;
                }
        } else if (opt_url || opt_ctrl_url) {
@@ -177,11 +176,11 @@ struct lttng_session_descriptor *create_session_descriptor(const char *session_n
                                ERR("Unrecognized URL format.");
                                goto end;
                        }
-                       ret = lttng_strncpy(local_output_path, uris[0].dst.path,
-                                       sizeof(local_output_path));
+                       ret = lttng_strncpy(
+                               local_output_path, uris[0].dst.path, sizeof(local_output_path));
                        if (ret) {
                                ERR("Output path exceeds the maximal supported length (%zu bytes)",
-                                               sizeof(local_output_path));
+                                   sizeof(local_output_path));
                        }
                        break;
                case 2:
@@ -201,48 +200,42 @@ struct lttng_session_descriptor *create_session_descriptor(const char *session_n
                case OUTPUT_UNSPECIFIED:
                case OUTPUT_LOCAL:
                        descriptor = lttng_session_descriptor_snapshot_local_create(
-                                       session_name,
-                                       output_type == OUTPUT_LOCAL ?
-                                               local_output_path : NULL);
+                               session_name,
+                               output_type == OUTPUT_LOCAL ? local_output_path : NULL);
                        break;
                case OUTPUT_NONE:
-                       descriptor = lttng_session_descriptor_snapshot_create(
-                                       session_name);
+                       descriptor = lttng_session_descriptor_snapshot_create(session_name);
                        break;
                case OUTPUT_NETWORK:
                        descriptor = lttng_session_descriptor_snapshot_network_create(
-                                       session_name, uri_str1, uri_str2);
+                               session_name, uri_str1, uri_str2);
                        break;
                default:
                        abort();
                }
        } else if (opt_live_timer) {
                /* Live session. */
-               if (output_type != OUTPUT_UNSPECIFIED &&
-                               output_type != OUTPUT_NETWORK) {
+               if (output_type != OUTPUT_UNSPECIFIED && output_type != OUTPUT_NETWORK) {
                        ERR("Unsupported output type specified for live session.");
                        goto end;
                }
                descriptor = lttng_session_descriptor_live_network_create(
-                               session_name, uri_str1, uri_str2,
-                               opt_live_timer);
+                       session_name, uri_str1, uri_str2, opt_live_timer);
        } else {
                /* Regular session. */
                switch (output_type) {
                case OUTPUT_UNSPECIFIED:
                case OUTPUT_LOCAL:
                        descriptor = lttng_session_descriptor_local_create(
-                                       session_name,
-                                       output_type == OUTPUT_LOCAL ?
-                                               local_output_path : NULL);
+                               session_name,
+                               output_type == OUTPUT_LOCAL ? local_output_path : NULL);
                        break;
                case OUTPUT_NONE:
-                       descriptor = lttng_session_descriptor_create(
-                                       session_name);
+                       descriptor = lttng_session_descriptor_create(session_name);
                        break;
                case OUTPUT_NETWORK:
                        descriptor = lttng_session_descriptor_network_create(
-                                       session_name, uri_str1, uri_str2);
+                               session_name, uri_str1, uri_str2);
                        break;
                default:
                        abort();
@@ -255,11 +248,10 @@ struct lttng_session_descriptor *create_session_descriptor(const char *session_n
                 * Auto-launch the relay daemon when a live session
                 * is created using default URLs.
                 */
-               if (!opt_url && !opt_ctrl_url && !opt_data_url &&
-                               opt_live_timer && !check_relayd()) {
+               if (!opt_url && !opt_ctrl_url && !opt_data_url && opt_live_timer &&
+                   !check_relayd()) {
                        int ret;
-                       const char *pathname = opt_relayd_path ? :
-                                       INSTALL_BIN_PATH "/lttng-relayd";
+                       const char *pathname = opt_relayd_path ?: INSTALL_BIN_PATH "/lttng-relayd";
 
                        ret = spawn_relayd(pathname, 0);
                        if (ret < 0) {
@@ -293,8 +285,7 @@ static int create_session(const char *session_name)
        /* Validate options. */
        if (session_name) {
                if (strlen(session_name) > NAME_MAX) {
-                       ERR("Session name too long. Length must be lower or equal to %d",
-                                       NAME_MAX);
+                       ERR("Session name too long. Length must be lower or equal to %d", NAME_MAX);
                        ret = CMD_ERROR;
                        goto error;
                }
@@ -303,13 +294,14 @@ static int create_session(const char *session_name)
                 * Both are reserved for the default session name. See bug #449 to
                 * understand why we need to check both here.
                 */
-               if ((strncmp(session_name, DEFAULT_SESSION_NAME "-",
-                                       strlen(DEFAULT_SESSION_NAME) + 1) == 0) ||
-                               (strncmp(session_name, DEFAULT_SESSION_NAME,
-                                       strlen(DEFAULT_SESSION_NAME)) == 0 &&
-                               strlen(session_name) == strlen(DEFAULT_SESSION_NAME))) {
+               if ((strncmp(session_name,
+                            DEFAULT_SESSION_NAME "-",
+                            strlen(DEFAULT_SESSION_NAME) + 1) == 0) ||
+                   (strncmp(session_name, DEFAULT_SESSION_NAME, strlen(DEFAULT_SESSION_NAME)) ==
+                            0 &&
+                    strlen(session_name) == strlen(DEFAULT_SESSION_NAME))) {
                        ERR("%s is a reserved keyword for default session(s)",
-                                       DEFAULT_SESSION_NAME);
+                           DEFAULT_SESSION_NAME);
                        ret = CMD_ERROR;
                        goto error;
                }
@@ -339,8 +331,8 @@ static int create_session(const char *session_name)
                goto error;
        }
 
-       descriptor_status = lttng_session_descriptor_get_session_name(
-               session_descriptor, &created_session_name);
+       descriptor_status = lttng_session_descriptor_get_session_name(session_descriptor,
+                                                                     &created_session_name);
        if (descriptor_status != LTTNG_SESSION_DESCRIPTOR_STATUS_OK) {
                ERR("Failed to obtain created session name");
                ret = CMD_ERROR;
@@ -349,8 +341,7 @@ static int create_session(const char *session_name)
 
        ret = lttng_list_sessions(&sessions);
        if (ret < 0) {
-               ERR("Failed to fetch properties of created session: %s",
-                               lttng_strerror(ret));
+               ERR("Failed to fetch properties of created session: %s", lttng_strerror(ret));
                ret = CMD_ERROR;
                goto error;
        }
@@ -379,9 +370,7 @@ static int create_session(const char *session_name)
                        time_t creation_time_t;
                        size_t strftime_ret;
 
-                       ret_code = lttng_session_get_creation_time(
-                                       created_session,
-                                       &creation_time);
+                       ret_code = lttng_session_get_creation_time(created_session, &creation_time);
                        if (ret_code != LTTNG_OK) {
                                ERR("%s", lttng_strerror(-ret_code));
                                ret = CMD_ERROR;
@@ -395,8 +384,9 @@ static int create_session(const char *session_name)
                                goto error;
                        }
                        strftime_ret = strftime(datetime_suffix,
-                                       sizeof(datetime_suffix),
-                                       "-%Y%m%d-%H%M%S", timeinfo);
+                                               sizeof(datetime_suffix),
+                                               "-%Y%m%d-%H%M%S",
+                                               timeinfo);
                        if (strftime_ret == 0) {
                                ERR("Failed to format session creation time.");
                                ret = CMD_ERROR;
@@ -404,16 +394,18 @@ static int create_session(const char *session_name)
                        }
                }
 
-               ret = snprintf(shm_path, sizeof(shm_path),
-                               "%s/%s%s", opt_shm_path, created_session_name,
-                               datetime_suffix);
+               ret = snprintf(shm_path,
+                              sizeof(shm_path),
+                              "%s/%s%s",
+                              opt_shm_path,
+                              created_session_name,
+                              datetime_suffix);
                if (ret < 0 || ret >= sizeof(shm_path)) {
                        ERR("Failed to format the shared memory path.");
                        ret = CMD_ERROR;
                        goto error;
                }
-               ret = lttng_set_session_shm_path(created_session_name,
-                               shm_path);
+               ret = lttng_set_session_shm_path(created_session_name, shm_path);
                if (ret < 0) {
                        lttng_destroy_session(created_session_name);
                        ret = CMD_ERROR;
@@ -433,8 +425,7 @@ static int create_session(const char *session_name)
                MSG("Traces will be output to %s", created_session->path);
 
                if (opt_live_timer) {
-                       MSG("Live timer interval set to %u %s", opt_live_timer,
-                                       USEC_UNIT);
+                       MSG("Live timer interval set to %u %s", opt_live_timer, USEC_UNIT);
                }
        } else if (opt_snapshot) {
                struct lttng_snapshot_output_list *list;
@@ -451,10 +442,8 @@ static int create_session(const char *session_name)
                while ((iter = lttng_snapshot_output_list_get_next(list))) {
                        const char *url = NULL;
 
-                       url = lttng_snapshot_output_get_ctrl_url(
-                                       iter);
-                       ret = lttng_strncpy(snapshot_url, url,
-                                       sizeof(snapshot_url));
+                       url = lttng_snapshot_output_get_ctrl_url(iter);
+                       ret = lttng_strncpy(snapshot_url, url, sizeof(snapshot_url));
                        if (ret) {
                                snapshot_url[0] = '\0';
                                ERR("Failed to retrieve snapshot output destination");
@@ -464,8 +453,7 @@ static int create_session(const char *session_name)
                lttng_snapshot_output_list_destroy(list);
 
                if (*snapshot_url) {
-                       MSG("Default snapshot output set to %s",
-                                       snapshot_url);
+                       MSG("Default snapshot output set to %s", snapshot_url);
                }
                MSG("Every channel enabled for this session will be set to mmap output and default to overwrite mode.");
        }
@@ -512,15 +500,14 @@ static int spawn_sessiond(const char *pathname)
                /*
                 * Spawn session daemon in daemon mode.
                 */
-               execlp(pathname, "lttng-sessiond",
-                               "--daemonize", NULL);
+               execlp(pathname, "lttng-sessiond", "--daemonize", NULL);
                /* execlp only returns if error happened */
                if (errno == ENOENT) {
                        ERR("No session daemon found. Use --sessiond-path.");
                } else {
                        PERROR("execlp");
                }
-               kill(getppid(), SIGTERM);       /* wake parent */
+               kill(getppid(), SIGTERM); /* wake parent */
                exit(EXIT_FAILURE);
        } else if (pid > 0) {
                /*
@@ -541,19 +528,18 @@ static int spawn_sessiond(const char *pathname)
                        }
 
                        if (WIFSIGNALED(status)) {
-                               ERR("Session daemon was killed by signal %d",
-                                               WTERMSIG(status));
+                               ERR("Session daemon was killed by signal %d", WTERMSIG(status));
                                ret = -1;
-                               goto end;
+                               goto end;
                        } else if (WIFEXITED(status)) {
                                DBG("Session daemon terminated normally (exit status: %d)",
-                                               WEXITSTATUS(status));
+                                   WEXITSTATUS(status));
 
                                if (WEXITSTATUS(status) != 0) {
                                        ERR("Session daemon terminated with an error (exit status: %d)",
-                                                       WEXITSTATUS(status));
+                                           WEXITSTATUS(status));
                                        ret = -1;
-                                       goto end;
+                                       goto end;
                                }
                                break;
                        }
@@ -621,14 +607,12 @@ static int launch_sessiond(void)
        ret = spawn_sessiond(pathname);
 end:
        if (ret) {
-               ERR("Problem occurred while launching session daemon (%s)",
-                               pathname);
+               ERR("Problem occurred while launching session daemon (%s)", pathname);
        }
        return ret;
 }
 
-static
-int validate_url_option_combination(void)
+static int validate_url_option_combination(void)
 {
        int ret = 0;
        int used_count = 0;
@@ -683,7 +667,7 @@ int cmd_create(int argc, const char **argv)
                                /* Set up default values. */
                                opt_live_timer = (uint32_t) DEFAULT_LTTNG_LIVE_TIMER;
                                DBG("Session live timer interval set to default value %d",
-                                               opt_live_timer);
+                                   opt_live_timer);
                                break;
                        }
 
@@ -745,16 +729,14 @@ int cmd_create(int argc, const char **argv)
                }
 
                /* Open command element */
-               ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_create);
+               ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_create);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -785,8 +767,8 @@ int cmd_create(int argc, const char **argv)
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success, success);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, success);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
index 9b5978bddc4962719260a6f5c44bb5bf7b07d2f8..6291dd36f1c0af7971e90793ddc8efdc3f70a0f1 100644 (file)
@@ -6,21 +6,22 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/utils.hpp>
+
+#include <lttng/lttng.h>
+
 #include <popt.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <stdbool.h>
-#include <lttng/lttng.h>
-
-#include "../command.hpp"
-
-#include <common/mi-lttng.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/utils.hpp>
 
 static int opt_destroy_all;
 static int opt_no_wait;
@@ -28,7 +29,7 @@ static int opt_no_wait;
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-destroy.1.h>
-;
+       ;
 #endif
 
 /* Mi writer */
@@ -41,11 +42,11 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",      'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"all",       'a', POPT_ARG_VAL, &opt_destroy_all, 1, 0, 0},
-       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {"no-wait",   'n', POPT_ARG_VAL, &opt_no_wait, 1, 0, 0},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "all", 'a', POPT_ARG_VAL, &opt_destroy_all, 1, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { "no-wait", 'n', POPT_ARG_VAL, &opt_no_wait, 1, 0, 0 },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 /*
@@ -87,8 +88,7 @@ static int destroy_session(struct lttng_session *session)
                         */
                        if (ret) {
                                if (!printed_destroy_msg) {
-                                       _MSG("Destroying session %s",
-                                                       session->name);
+                                       _MSG("Destroying session %s", session->name);
                                        newline_needed = true;
                                        printed_destroy_msg = true;
                                        fflush(stdout);
@@ -124,8 +124,7 @@ static int destroy_session(struct lttng_session *session)
 
        do {
                status = lttng_destruction_handle_wait_for_completion(
-                               handle, DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US /
-                                                       USEC_PER_MSEC);
+                       handle, DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US / USEC_PER_MSEC);
                switch (status) {
                case LTTNG_DESTRUCTION_HANDLE_STATUS_TIMEOUT:
                        if (!printed_destroy_msg) {
@@ -140,8 +139,8 @@ static int destroy_session(struct lttng_session *session)
                        break;
                default:
                        ERR("%sFailed to wait for the completion of the destruction of session \"%s\"",
-                                       newline_needed ? "\n" : "",
-                                       session->name);
+                           newline_needed ? "\n" : "",
+                           session->name);
                        newline_needed = false;
                        ret = -1;
                        goto error;
@@ -151,7 +150,7 @@ static int destroy_session(struct lttng_session *session)
        status = lttng_destruction_handle_get_result(handle, &ret_code);
        if (status != LTTNG_DESTRUCTION_HANDLE_STATUS_OK) {
                ERR("%sFailed to get the result of session destruction",
-                               newline_needed ? "\n" : "");
+                   newline_needed ? "\n" : "");
                ret = -1;
                newline_needed = false;
                goto error;
@@ -161,11 +160,10 @@ static int destroy_session(struct lttng_session *session)
                goto error;
        }
 
-       status = lttng_destruction_handle_get_rotation_state(
-                       handle, &rotation_state);
+       status = lttng_destruction_handle_get_rotation_state(handle, &rotation_state);
        if (status != LTTNG_DESTRUCTION_HANDLE_STATUS_OK) {
                ERR("%sFailed to get rotation state from destruction handle",
-                               newline_needed ? "\n" : "");
+                   newline_needed ? "\n" : "");
                newline_needed = false;
                goto skip_wait_rotation;
        }
@@ -177,14 +175,12 @@ static int destroy_session(struct lttng_session *session)
        {
                const struct lttng_trace_archive_location *location;
 
-               status = lttng_destruction_handle_get_archive_location(
-                               handle, &location);
+               status = lttng_destruction_handle_get_archive_location(handle, &location);
                if (status == LTTNG_DESTRUCTION_HANDLE_STATUS_OK) {
-                       ret = print_trace_archive_location(
-                                       location, session->name);
+                       ret = print_trace_archive_location(location, session->name);
                        if (ret) {
                                ERR("%sFailed to print the location of trace archive",
-                                               newline_needed ? "\n" : "");
+                                   newline_needed ? "\n" : "");
                                newline_needed = false;
                                goto skip_wait_rotation;
                        }
@@ -194,13 +190,12 @@ static int destroy_session(struct lttng_session *session)
        /* fall-through. */
        default:
                ERR("%sFailed to get the location of the rotation performed during the session's destruction",
-                               newline_needed ? "\n" : "");
+                   newline_needed ? "\n" : "");
                newline_needed = false;
                goto skip_wait_rotation;
        }
 skip_wait_rotation:
-       MSG("%sSession %s destroyed", newline_needed ? "\n" : "",
-                       session->name);
+       MSG("%sSession %s destroyed", newline_needed ? "\n" : "", session->name);
        newline_needed = false;
        if (stats_str) {
                MSG("%s", stats_str);
@@ -250,8 +245,8 @@ static int destroy_all_sessions(struct lttng_session *sessions, int count)
 
                if (ret < 0) {
                        ERR("%s during the destruction of session \"%s\"",
-                                       lttng_strerror(ret),
-                                       sessions[i].name);
+                           lttng_strerror(ret),
+                           sessions[i].name);
                        /* Continue to next session. */
                        error_occurred = true;
                }
@@ -266,7 +261,7 @@ static int destroy_all_sessions(struct lttng_session *sessions, int count)
 int cmd_destroy(int argc, const char **argv)
 {
        int opt;
-       int ret = CMD_SUCCESS , i, command_ret = CMD_SUCCESS, success = 1;
+       int ret = CMD_SUCCESS, i, command_ret = CMD_SUCCESS, success = 1;
        static poptContext pc;
        char *session_name = NULL;
        const char *arg_session_name = NULL;
@@ -303,16 +298,14 @@ int cmd_destroy(int argc, const char **argv)
                }
 
                /* Open command element */
-               ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_destroy);
+               ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_destroy);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -369,8 +362,8 @@ int cmd_destroy(int argc, const char **argv)
                                if (command_ret) {
                                        success = 0;
                                        ERR("%s during the destruction of session \"%s\"",
-                                                       lttng_strerror(command_ret),
-                                                       sessions[i].name);
+                                           lttng_strerror(command_ret),
+                                           sessions[i].name);
                                }
                        }
                }
@@ -402,8 +395,8 @@ mi_closing:
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success, success);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, success);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
index ff9bd91c8e818d91ebf0c42877474545befbb048..8bc9861f93a4a2fcd495887e4b173b8eedd983c4 100644 (file)
@@ -6,6 +6,12 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+
+#include <lttng/domain-internal.hpp>
+
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/mi-lttng.hpp>
-#include <lttng/domain-internal.hpp>
-
-#include "../command.hpp"
-
 static int opt_kernel;
 static char *opt_session_name;
 static int opt_userspace;
@@ -26,7 +27,7 @@ static int opt_userspace;
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-disable-channel.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -40,16 +41,15 @@ static struct mi_writer *writer;
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",           'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"session",        's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0},
-       {"kernel",         'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
-       {"userspace",      'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0},
-       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
+       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0 },
+       { "userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
-static int mi_partial_channel_print(char *channel_name, unsigned int enabled,
-               int success)
+static int mi_partial_channel_print(char *channel_name, unsigned int enabled, int success)
 {
        int ret;
 
@@ -63,22 +63,19 @@ static int mi_partial_channel_print(char *channel_name, unsigned int enabled,
        }
 
        /* Name */
-       ret = mi_lttng_writer_write_element_string(writer, config_element_name,
-                       channel_name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, channel_name);
        if (ret) {
                goto end;
        }
 
        /* Enabled ? */
-       ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled,
-                       enabled);
+       ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled, enabled);
        if (ret) {
                goto end;
        }
 
        /* Success ? */
-       ret = mi_lttng_writer_write_element_bool(writer,
-                       mi_lttng_element_success, success);
+       ret = mi_lttng_writer_write_element_bool(writer, mi_lttng_element_success, success);
        if (ret) {
                goto end;
        }
@@ -128,7 +125,6 @@ static int disable_channels(char *session_name, char *channel_list)
                        ret = CMD_ERROR;
                        goto error;
                }
-
        }
 
        /* Strip channel list */
@@ -138,8 +134,10 @@ static int disable_channels(char *session_name, char *channel_list)
 
                ret = lttng_disable_channel(handle, channel_name);
                if (ret < 0) {
-                       ERR("Channel %s: %s (session %s)", channel_name,
-                                       lttng_strerror(ret), session_name);
+                       ERR("Channel %s: %s (session %s)",
+                           channel_name,
+                           lttng_strerror(ret),
+                           session_name);
                        warn = 1;
 
                        /*
@@ -154,8 +152,9 @@ static int disable_channels(char *session_name, char *channel_list)
 
                } else {
                        MSG("%s channel %s disabled for session %s",
-                                       lttng_domain_type_str(dom.type),
-                                       channel_name, session_name);
+                           lttng_domain_type_str(dom.type),
+                           channel_name,
+                           session_name);
                        enabled = 0;
                        success = 1;
                }
@@ -230,8 +229,7 @@ int cmd_disable_channels(int argc, const char **argv)
                }
        }
 
-       ret = print_missing_or_multiple_domains(
-                       opt_kernel + opt_userspace, false);
+       ret = print_missing_or_multiple_domains(opt_kernel + opt_userspace, false);
        if (ret) {
                ret = CMD_ERROR;
                goto end;
@@ -278,15 +276,14 @@ int cmd_disable_channels(int argc, const char **argv)
 
                /* Open command element */
                ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_disable_channel);
+                                                  mi_lttng_element_command_disable_channel);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -308,8 +305,7 @@ int cmd_disable_channels(int argc, const char **argv)
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_success, success);
+               ret = mi_lttng_writer_write_element_bool(writer, mi_lttng_element_success, success);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
index bf8ed6e3005004c679381e3929b1f27101ddc6dd..6d9e09d046d4f05345df35aec6c8bea7c8065ef8 100644 (file)
@@ -6,6 +6,12 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+
+#include <lttng/domain-internal.hpp>
+
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/mi-lttng.hpp>
-#include <lttng/domain-internal.hpp>
-
-#include "../command.hpp"
-
 static int opt_kernel;
 static char *opt_channel_name;
 static char *opt_session_name;
@@ -32,7 +33,7 @@ static int opt_event_type;
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-disable-event.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -50,38 +51,35 @@ static struct mi_writer *writer;
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",           'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"session",        's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0},
-       {"all-events",     'a', POPT_ARG_VAL, &opt_disable_all, 1, 0, 0},
-       {"channel",        'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0},
-       {"jul",            'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0},
-       {"log4j",          'l', POPT_ARG_VAL, &opt_log4j, 1, 0, 0},
-       {"python",         'p', POPT_ARG_VAL, &opt_python, 1, 0, 0},
-       {"kernel",         'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
-       {"userspace",      'u', POPT_ARG_VAL, &opt_userspace, 1, 0, 0},
-       {"syscall",          0, POPT_ARG_NONE, 0, OPT_TYPE_SYSCALL, 0, 0},
-       {"probe",            0, POPT_ARG_NONE, 0, OPT_TYPE_PROBE, 0, 0},
-       {"tracepoint",       0, POPT_ARG_NONE, 0, OPT_TYPE_TRACEPOINT, 0, 0},
-       {"function",         0, POPT_ARG_NONE, 0, OPT_TYPE_FUNCTION, 0, 0},
-       {"all",              0, POPT_ARG_NONE, 0, OPT_TYPE_ALL, 0, 0},
-       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
+       { "all-events", 'a', POPT_ARG_VAL, &opt_disable_all, 1, 0, 0 },
+       { "channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0 },
+       { "jul", 'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0 },
+       { "log4j", 'l', POPT_ARG_VAL, &opt_log4j, 1, 0, 0 },
+       { "python", 'p', POPT_ARG_VAL, &opt_python, 1, 0, 0 },
+       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0 },
+       { "userspace", 'u', POPT_ARG_VAL, &opt_userspace, 1, 0, 0 },
+       { "syscall", 0, POPT_ARG_NONE, 0, OPT_TYPE_SYSCALL, 0, 0 },
+       { "probe", 0, POPT_ARG_NONE, 0, OPT_TYPE_PROBE, 0, 0 },
+       { "tracepoint", 0, POPT_ARG_NONE, 0, OPT_TYPE_TRACEPOINT, 0, 0 },
+       { "function", 0, POPT_ARG_NONE, 0, OPT_TYPE_FUNCTION, 0, 0 },
+       { "all", 0, POPT_ARG_NONE, 0, OPT_TYPE_ALL, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
-static
-const char *print_channel_name(const char *name)
+static const char *print_channel_name(const char *name)
 {
-       return name ? : DEFAULT_CHANNEL_NAME;
+       return name ?: DEFAULT_CHANNEL_NAME;
 }
 
-static
-const char *print_raw_channel_name(const char *name)
+static const char *print_raw_channel_name(const char *name)
 {
-       return name ? : "<default>";
+       return name ?: "<default>";
 }
 
-static
-const char *print_event_type(const enum lttng_event_type ev_type)
+static const char *print_event_type(const enum lttng_event_type ev_type)
 {
        switch (ev_type) {
        case LTTNG_EVENT_ALL:
@@ -119,22 +117,19 @@ static int mi_print_event(const char *event_name, int enabled, int success)
        }
 
        /* Print the name of event */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_name, event_name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, event_name);
        if (ret) {
                goto end;
        }
 
        /* Print enabled ? */
-       ret = mi_lttng_writer_write_element_bool(writer,
-                       config_element_enabled, enabled);
+       ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled, enabled);
        if (ret) {
                goto end;
        }
 
        /* Success ? */
-       ret = mi_lttng_writer_write_element_bool(writer,
-                       mi_lttng_element_command_success, success);
+       ret = mi_lttng_writer_write_element_bool(writer, mi_lttng_element_command_success, success);
        if (ret) {
                goto end;
        }
@@ -192,8 +187,8 @@ static int disable_events(char *session_name, char *event_list)
                        goto end;
                }
 
-               ret = mi_lttng_writer_write_element_string(writer,
-                               config_element_name, print_channel_name(channel_name));
+               ret = mi_lttng_writer_write_element_string(
+                       writer, config_element_name, print_channel_name(channel_name));
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -225,9 +220,9 @@ static int disable_events(char *session_name, char *event_list)
                        enabled = 0;
                        success = 1;
                        MSG("All %s events of type %s are disabled in channel %s",
-                                       lttng_domain_type_str(dom.type),
-                                       print_event_type((lttng_event_type) opt_event_type),
-                                       print_channel_name(channel_name));
+                           lttng_domain_type_str(dom.type),
+                           print_event_type((lttng_event_type) opt_event_type),
+                           print_channel_name(channel_name));
                }
 
                if (lttng_opt_mi) {
@@ -248,13 +243,13 @@ static int disable_events(char *session_name, char *event_list)
                        command_ret = lttng_disable_event_ext(handle, &event, channel_name, NULL);
                        if (command_ret < 0) {
                                ERR("%s of type %s : %s (channel %s, session %s)",
-                                               event_name,
-                                               print_event_type((lttng_event_type) opt_event_type),
-                                               lttng_strerror(command_ret),
-                                               command_ret == -LTTNG_ERR_NEED_CHANNEL_NAME
-                                                       ? print_raw_channel_name(channel_name)
-                                                       : print_channel_name(channel_name),
-                                               session_name);
+                                   event_name,
+                                   print_event_type((lttng_event_type) opt_event_type),
+                                   lttng_strerror(command_ret),
+                                   command_ret == -LTTNG_ERR_NEED_CHANNEL_NAME ?
+                                           print_raw_channel_name(channel_name) :
+                                           print_channel_name(channel_name),
+                                   session_name);
                                warn = 1;
                                success = 0;
                                /*
@@ -264,11 +259,11 @@ static int disable_events(char *session_name, char *event_list)
                                enabled = 1;
                        } else {
                                MSG("%s %s of type %s disabled in channel %s for session %s",
-                                               lttng_domain_type_str(dom.type),
-                                               event_name,
-                                               print_event_type((lttng_event_type) opt_event_type),
-                                               print_channel_name(channel_name),
-                                               session_name);
+                                   lttng_domain_type_str(dom.type),
+                                   event_name,
+                                   print_event_type((lttng_event_type) opt_event_type),
+                                   print_channel_name(channel_name),
+                                   session_name);
                                success = 1;
                                enabled = 0;
                        }
@@ -369,17 +364,15 @@ int cmd_disable_events(int argc, const char **argv)
        }
 
        ret = print_missing_or_multiple_domains(
-                       opt_kernel + opt_userspace + opt_jul + opt_log4j +
-                                       opt_python,
-                       true);
+               opt_kernel + opt_userspace + opt_jul + opt_log4j + opt_python, true);
        if (ret) {
                ret = CMD_ERROR;
                goto end;
        }
 
        /* Ust and agent only support ALL event type */
-       if ((opt_userspace || opt_jul || opt_log4j || opt_python)
-                       && opt_event_type != LTTNG_EVENT_ALL) {
+       if ((opt_userspace || opt_jul || opt_log4j || opt_python) &&
+           opt_event_type != LTTNG_EVENT_ALL) {
                ERR("Disabling userspace and agent (-j | -l | -p) event(s) based on instrumentation type is not supported.\n");
                ret = CMD_ERROR;
                goto end;
@@ -427,16 +420,14 @@ int cmd_disable_events(int argc, const char **argv)
                }
 
                /* Open command element */
-               ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_disable_event);
+               ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_disable_event);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -457,8 +448,8 @@ int cmd_disable_events(int argc, const char **argv)
                        goto end;
                }
 
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success, success);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, success);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
index c2b6728ae758f0da0117213d5027d7b3ed7a0a01..162cec17c8640633982346d6438402a2d91f0801 100644 (file)
@@ -6,6 +6,15 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+
+#include <lttng/lttng.h>
+
+#include <ctype.h>
+#include <inttypes.h>
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <inttypes.h>
-#include <ctype.h>
-
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/mi-lttng.hpp>
-
-#include "../command.hpp"
-#include <lttng/lttng.h>
 
 static char *opt_session_name;
 static struct mi_writer *writer;
@@ -28,7 +29,7 @@ static struct mi_writer *writer;
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-disable-rotation.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -40,12 +41,12 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",        'h',  POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"list-options", 0,   POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {"session",     's',  POPT_ARG_STRING, &opt_session_name, 0, 0, 0},
-       {"timer",        0,   POPT_ARG_NONE, 0, OPT_TIMER, 0, 0},
-       {"size",         0,   POPT_ARG_NONE, 0, OPT_SIZE, 0, 0},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
+       { "timer", 0, POPT_ARG_NONE, 0, OPT_TIMER, 0, 0 },
+       { "size", 0, POPT_ARG_NONE, 0, OPT_SIZE, 0, 0 },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 static const char *schedule_type_str[] = {
@@ -53,10 +54,10 @@ static const char *schedule_type_str[] = {
        "size-based",
 };
 
-static const struct lttng_rotation_schedule *get_schedule(
-               const char *session_name,
-               const struct lttng_rotation_schedules *schedules,
-               enum lttng_rotation_schedule_type schedule_type)
+static const struct lttng_rotation_schedule *
+get_schedule(const char *session_name,
+            const struct lttng_rotation_schedules *schedules,
+            enum lttng_rotation_schedule_type schedule_type)
 {
        unsigned int count, i;
        enum lttng_rotation_status status;
@@ -65,7 +66,7 @@ static const struct lttng_rotation_schedule *get_schedule(
        status = lttng_rotation_schedules_get_count(schedules, &count);
        if (status != LTTNG_ROTATION_STATUS_OK) {
                ERR("Unable to determine the number of rotation schedules of session %s",
-                               session_name);
+                   session_name);
                goto end;
        }
 
@@ -74,13 +75,11 @@ static const struct lttng_rotation_schedule *get_schedule(
 
                schedule = lttng_rotation_schedules_get_at_index(schedules, i);
                if (!schedule) {
-                       ERR("Unable to retrieve rotation schedule at index %u",
-                                       i);
+                       ERR("Unable to retrieve rotation schedule at index %u", i);
                        goto end;
                }
 
-               if (lttng_rotation_schedule_get_type(schedule) ==
-                               schedule_type) {
+               if (lttng_rotation_schedule_get_type(schedule) == schedule_type) {
                        ret = schedule;
                        break;
                }
@@ -88,14 +87,14 @@ static const struct lttng_rotation_schedule *get_schedule(
 
        if (!ret) {
                ERR("No %s rotation schedule active on session %s",
-                               schedule_type_str[schedule_type], session_name);
+                   schedule_type_str[schedule_type],
+                   session_name);
        }
 end:
        return ret;
 }
 
-static struct lttng_rotation_schedule *create_empty_schedule(
-               enum lttng_rotation_schedule_type type)
+static struct lttng_rotation_schedule *create_empty_schedule(enum lttng_rotation_schedule_type type)
 {
        struct lttng_rotation_schedule *schedule = NULL;
 
@@ -113,7 +112,7 @@ static struct lttng_rotation_schedule *create_empty_schedule(
 }
 
 static enum cmd_error_code remove_schedule(const char *session_name,
-               enum lttng_rotation_schedule_type schedule_type)
+                                          enum lttng_rotation_schedule_type schedule_type)
 {
        enum cmd_error_code cmd_ret;
        int ret;
@@ -136,8 +135,7 @@ static enum cmd_error_code remove_schedule(const char *session_name,
 
        ret = lttng_session_list_rotation_schedules(session_name, &schedules);
        if (ret != LTTNG_OK) {
-               ERR("Failed to list rotation schedules of session %s",
-                               session_name);
+               ERR("Failed to list rotation schedules of session %s", session_name);
                goto error;
        }
 
@@ -160,30 +158,27 @@ static enum cmd_error_code remove_schedule(const char *session_name,
        status = lttng_session_remove_rotation_schedule(session_name, schedule);
        switch (status) {
        case LTTNG_ROTATION_STATUS_OK:
-               MSG("Disabled %s rotation on session %s",
-                               schedule_type_name, session_name);
+               MSG("Disabled %s rotation on session %s", schedule_type_name, session_name);
                cmd_ret = CMD_SUCCESS;
                break;
        case LTTNG_ROTATION_STATUS_SCHEDULE_NOT_SET:
-               ERR("No %s rotation schedule set on session %s",
-                               schedule_type_name,
-                               session_name);
+               ERR("No %s rotation schedule set on session %s", schedule_type_name, session_name);
                cmd_ret = CMD_ERROR;
                break;
        case LTTNG_ROTATION_STATUS_ERROR:
        case LTTNG_ROTATION_STATUS_INVALID:
        default:
                ERR("Failed to disable %s rotation schedule on session %s",
-                               schedule_type_name, session_name);
+                   schedule_type_name,
+                   session_name);
                cmd_ret = CMD_ERROR;
                break;
        }
 
 skip_removal:
        if (lttng_opt_mi) {
-               ret = mi_lttng_rotation_schedule_result(writer,
-                               schedule ? schedule : empty_schedule,
-                               cmd_ret == CMD_SUCCESS);
+               ret = mi_lttng_rotation_schedule_result(
+                       writer, schedule ? schedule : empty_schedule, cmd_ret == CMD_SUCCESS);
                if (ret < 0) {
                        goto error;
                }
@@ -259,14 +254,13 @@ int cmd_disable_rotation(int argc, const char **argv)
 
                /* Open command element */
                ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_disable_rotation);
+                                                  mi_lttng_element_command_disable_rotation);
                if (ret) {
                        goto error;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        goto error;
                }
@@ -280,14 +274,13 @@ int cmd_disable_rotation(int argc, const char **argv)
 
        if (lttng_opt_mi) {
                ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_rotation_schedule_results);
+                                                  mi_lttng_element_rotation_schedule_results);
                if (ret) {
                        goto error;
                }
 
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_session_name,
-                               session_name);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, mi_lttng_element_session_name, session_name);
                if (ret) {
                        goto error;
                }
@@ -298,16 +291,15 @@ int cmd_disable_rotation(int argc, const char **argv)
                 * Continue processing even on error as multiple schedules can
                 * be specified at once.
                 */
-               cmd_ret = remove_schedule(session_name,
-                               LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC);
+               cmd_ret = remove_schedule(session_name, LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC);
        }
 
        if (size_rotation) {
                enum cmd_error_code tmp_ret;
 
                /* Don't overwrite cmd_ret if it already indicates an error. */
-               tmp_ret = remove_schedule(session_name,
-                               LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD);
+               tmp_ret =
+                       remove_schedule(session_name, LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD);
                cmd_ret = cmd_ret ? cmd_ret : tmp_ret;
        }
 
@@ -329,9 +321,8 @@ close_command:
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success,
-                               cmd_ret == CMD_SUCCESS);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, cmd_ret == CMD_SUCCESS);
                if (ret) {
                        goto error;
                }
index 64317190978882cbc07d0135a695e725dfb1aaf0..c0a35d05dbd7f37584a5765e82763ff20a0b1ada 100644 (file)
@@ -6,6 +6,17 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+#include "../utils.hpp"
+
+#include <common/mi-lttng.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/utils.hpp>
+
+#include <lttng/domain-internal.hpp>
+
+#include <ctype.h>
+#include <inttypes.h>
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <inttypes.h>
-#include <ctype.h>
-
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/utils.hpp>
-#include <common/mi-lttng.hpp>
-
-#include <lttng/domain-internal.hpp>
-
-#include "../command.hpp"
-#include "../utils.hpp"
-
 
 static struct lttng_channel chan_opts;
 static int opt_kernel;
@@ -48,7 +47,7 @@ static struct mi_writer *writer;
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-enable-channel.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -74,26 +73,26 @@ const char *output_splice = "splice";
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",           'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"session",        's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0},
-       {"kernel",         'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
-       {"userspace",      'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0},
-       {"discard",        0,   POPT_ARG_NONE, 0, OPT_DISCARD, 0, 0},
-       {"overwrite",      0,   POPT_ARG_NONE, 0, OPT_OVERWRITE, 0, 0},
-       {"subbuf-size",    0,   POPT_ARG_STRING, 0, OPT_SUBBUF_SIZE, 0, 0},
-       {"num-subbuf",     0,   POPT_ARG_INT, 0, OPT_NUM_SUBBUF, 0, 0},
-       {"switch-timer",   0,   POPT_ARG_INT, 0, OPT_SWITCH_TIMER, 0, 0},
-       {"monitor-timer",  0,   POPT_ARG_INT, 0, OPT_MONITOR_TIMER, 0, 0},
-       {"read-timer",     0,   POPT_ARG_INT, 0, OPT_READ_TIMER, 0, 0},
-       {"list-options",   0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {"output",         0,   POPT_ARG_STRING, &opt_output, 0, 0, 0},
-       {"buffers-uid",    0,   POPT_ARG_VAL, &opt_buffer_uid, 1, 0, 0},
-       {"buffers-pid",    0,   POPT_ARG_VAL, &opt_buffer_pid, 1, 0, 0},
-       {"buffers-global", 0,   POPT_ARG_VAL, &opt_buffer_global, 1, 0, 0},
-       {"tracefile-size", 'C',   POPT_ARG_INT, 0, OPT_TRACEFILE_SIZE, 0, 0},
-       {"tracefile-count", 'W',   POPT_ARG_INT, 0, OPT_TRACEFILE_COUNT, 0, 0},
-       {"blocking-timeout",     0,   POPT_ARG_INT, 0, OPT_BLOCKING_TIMEOUT, 0, 0},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
+       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0 },
+       { "userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0 },
+       { "discard", 0, POPT_ARG_NONE, 0, OPT_DISCARD, 0, 0 },
+       { "overwrite", 0, POPT_ARG_NONE, 0, OPT_OVERWRITE, 0, 0 },
+       { "subbuf-size", 0, POPT_ARG_STRING, 0, OPT_SUBBUF_SIZE, 0, 0 },
+       { "num-subbuf", 0, POPT_ARG_INT, 0, OPT_NUM_SUBBUF, 0, 0 },
+       { "switch-timer", 0, POPT_ARG_INT, 0, OPT_SWITCH_TIMER, 0, 0 },
+       { "monitor-timer", 0, POPT_ARG_INT, 0, OPT_MONITOR_TIMER, 0, 0 },
+       { "read-timer", 0, POPT_ARG_INT, 0, OPT_READ_TIMER, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { "output", 0, POPT_ARG_STRING, &opt_output, 0, 0, 0 },
+       { "buffers-uid", 0, POPT_ARG_VAL, &opt_buffer_uid, 1, 0, 0 },
+       { "buffers-pid", 0, POPT_ARG_VAL, &opt_buffer_pid, 1, 0, 0 },
+       { "buffers-global", 0, POPT_ARG_VAL, &opt_buffer_global, 1, 0, 0 },
+       { "tracefile-size", 'C', POPT_ARG_INT, 0, OPT_TRACEFILE_SIZE, 0, 0 },
+       { "tracefile-count", 'W', POPT_ARG_INT, 0, OPT_TRACEFILE_COUNT, 0, 0 },
+       { "blocking-timeout", 0, POPT_ARG_INT, 0, OPT_BLOCKING_TIMEOUT, 0, 0 },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 /*
@@ -186,15 +185,16 @@ static int enable_channel(char *session_name, char *channel_list)
 
        if (chan_opts.attr.tracefile_size == 0 && chan_opts.attr.tracefile_count) {
                ERR("Missing option --tracefile-size. "
-                               "A file count without a size won't do anything.");
+                   "A file count without a size won't do anything.");
                ret = CMD_ERROR;
                goto error;
        }
 
        if ((chan_opts.attr.tracefile_size > 0) &&
-                       (chan_opts.attr.tracefile_size < chan_opts.attr.subbuf_size)) {
+           (chan_opts.attr.tracefile_size < chan_opts.attr.subbuf_size)) {
                WARN("Tracefile size rounded up from (%" PRIu64 ") to subbuffer size (%" PRIu64 ")",
-                               chan_opts.attr.tracefile_size, chan_opts.attr.subbuf_size);
+                    chan_opts.attr.tracefile_size,
+                    chan_opts.attr.subbuf_size);
                chan_opts.attr.tracefile_size = chan_opts.attr.subbuf_size;
        }
 
@@ -206,7 +206,9 @@ static int enable_channel(char *session_name, char *channel_list)
                        chan_opts.attr.output = LTTNG_EVENT_SPLICE;
                } else {
                        ERR("Unknown output type %s. Possible values are: %s, %s\n",
-                                       opt_output, output_mmap, output_splice);
+                           opt_output,
+                           output_mmap,
+                           output_splice);
                        ret = CMD_ERROR;
                        goto error;
                }
@@ -236,7 +238,7 @@ static int enable_channel(char *session_name, char *channel_list)
                /* Validate channel name's length */
                if (strlen(channel_name) >= sizeof(chan_opts.name)) {
                        ERR("Channel name is too long (max. %zu characters)",
-                                       sizeof(chan_opts.name) - 1);
+                           sizeof(chan_opts.name) - 1);
                        error = 1;
                        goto skip_enable;
                }
@@ -260,7 +262,7 @@ static int enable_channel(char *session_name, char *channel_list)
                channel->attr.extended.ptr = extended_ptr;
                if (opt_monitor_timer.set) {
                        ret = lttng_channel_set_monitor_timer_interval(channel,
-                                       opt_monitor_timer.interval);
+                                                                      opt_monitor_timer.interval);
                        if (ret) {
                                ERR("Failed to set the channel's monitor timer interval");
                                error = 1;
@@ -269,7 +271,7 @@ static int enable_channel(char *session_name, char *channel_list)
                }
                if (opt_blocking_timeout.set) {
                        ret = lttng_channel_set_blocking_timeout(channel,
-                                       opt_blocking_timeout.value);
+                                                                opt_blocking_timeout.value);
                        if (ret) {
                                ERR("Failed to set the channel's blocking timeout");
                                error = 1;
@@ -286,30 +288,36 @@ static int enable_channel(char *session_name, char *channel_list)
                        case LTTNG_ERR_KERN_CHAN_EXIST:
                        case LTTNG_ERR_UST_CHAN_EXIST:
                        case LTTNG_ERR_CHAN_EXIST:
-                               WARN("Channel %s: %s (session %s)", channel_name,
-                                               lttng_strerror(ret), session_name);
+                               WARN("Channel %s: %s (session %s)",
+                                    channel_name,
+                                    lttng_strerror(ret),
+                                    session_name);
                                warn = 1;
                                break;
                        case LTTNG_ERR_INVALID_CHANNEL_NAME:
                                ERR("Invalid channel name: \"%s\". "
                                    "Channel names may not start with '.', and "
-                                   "may not contain '/'.", channel_name);
+                                   "may not contain '/'.",
+                                   channel_name);
                                error = 1;
                                break;
                        default:
-                               ERR("Channel %s: %s (session %s)", channel_name,
-                                               lttng_strerror(ret), session_name);
+                               ERR("Channel %s: %s (session %s)",
+                                   channel_name,
+                                   lttng_strerror(ret),
+                                   session_name);
                                error = 1;
                                break;
                        }
                } else {
                        MSG("%s channel %s enabled for session %s",
-                                       lttng_domain_type_str(dom.type),
-                                       channel_name, session_name);
+                           lttng_domain_type_str(dom.type),
+                           channel_name,
+                           session_name);
                        success = 1;
                }
 
-skip_enable:
+       skip_enable:
                if (lttng_opt_mi) {
                        /* Mi print the channel element and leave it open */
                        ret = mi_lttng_channel(writer, channel, 1);
@@ -319,8 +327,8 @@ skip_enable:
                        }
 
                        /* Individual Success ? */
-                       ret = mi_lttng_writer_write_element_bool(writer,
-                                       mi_lttng_element_command_success, success);
+                       ret = mi_lttng_writer_write_element_bool(
+                               writer, mi_lttng_element_command_success, success);
                        if (ret) {
                                ret = CMD_ERROR;
                                goto error;
@@ -420,7 +428,8 @@ int cmd_enable_channels(int argc, const char **argv)
 
                        /* Parse the size */
                        opt_arg = poptGetOptArg(pc);
-                       if (utils_parse_size_suffix(opt_arg, &chan_opts.attr.subbuf_size) < 0 || !chan_opts.attr.subbuf_size) {
+                       if (utils_parse_size_suffix(opt_arg, &chan_opts.attr.subbuf_size) < 0 ||
+                           !chan_opts.attr.subbuf_size) {
                                ERR("Wrong value in --subbuf-size parameter: %s", opt_arg);
                                ret = CMD_ERROR;
                                goto end;
@@ -431,19 +440,22 @@ int cmd_enable_channels(int argc, const char **argv)
                        rounded_size = 1ULL << order;
                        if (rounded_size < chan_opts.attr.subbuf_size) {
                                ERR("The subbuf size (%" PRIu64 ") is rounded and overflows!",
-                                               chan_opts.attr.subbuf_size);
+                                   chan_opts.attr.subbuf_size);
                                ret = CMD_ERROR;
                                goto end;
                        }
 
                        if (rounded_size != chan_opts.attr.subbuf_size) {
-                               WARN("The subbuf size (%" PRIu64 ") is rounded to the next power of 2 (%" PRIu64 ")",
-                                               chan_opts.attr.subbuf_size, rounded_size);
+                               WARN("The subbuf size (%" PRIu64
+                                    ") is rounded to the next power of 2 (%" PRIu64 ")",
+                                    chan_opts.attr.subbuf_size,
+                                    rounded_size);
                                chan_opts.attr.subbuf_size = rounded_size;
                        }
 
                        /* Should now be power of 2 */
-                       LTTNG_ASSERT(!((chan_opts.attr.subbuf_size - 1) & chan_opts.attr.subbuf_size));
+                       LTTNG_ASSERT(
+                               !((chan_opts.attr.subbuf_size - 1) & chan_opts.attr.subbuf_size));
 
                        DBG("Channel subbuf size set to %" PRIu64, chan_opts.attr.subbuf_size);
                        break;
@@ -466,20 +478,24 @@ int cmd_enable_channels(int argc, const char **argv)
                        LTTNG_ASSERT(order >= 0);
                        rounded_size = 1ULL << order;
                        if (rounded_size < chan_opts.attr.num_subbuf) {
-                               ERR("The number of subbuffers (%" PRIu64 ") is rounded and overflows!",
-                                               chan_opts.attr.num_subbuf);
+                               ERR("The number of subbuffers (%" PRIu64
+                                   ") is rounded and overflows!",
+                                   chan_opts.attr.num_subbuf);
                                ret = CMD_ERROR;
                                goto end;
                        }
 
                        if (rounded_size != chan_opts.attr.num_subbuf) {
-                               WARN("The number of subbuffers (%" PRIu64 ") is rounded to the next power of 2 (%" PRIu64 ")",
-                                               chan_opts.attr.num_subbuf, rounded_size);
+                               WARN("The number of subbuffers (%" PRIu64
+                                    ") is rounded to the next power of 2 (%" PRIu64 ")",
+                                    chan_opts.attr.num_subbuf,
+                                    rounded_size);
                                chan_opts.attr.num_subbuf = rounded_size;
                        }
 
                        /* Should now be power of 2 */
-                       LTTNG_ASSERT(!((chan_opts.attr.num_subbuf - 1) & chan_opts.attr.num_subbuf));
+                       LTTNG_ASSERT(
+                               !((chan_opts.attr.num_subbuf - 1) & chan_opts.attr.num_subbuf));
 
                        DBG("Channel subbuf num set to %" PRIu64, chan_opts.attr.num_subbuf);
                        break;
@@ -504,8 +520,8 @@ int cmd_enable_channels(int argc, const char **argv)
                        }
                        chan_opts.attr.switch_timer_interval = (uint32_t) v;
                        DBG("Channel switch timer interval set to %d %s",
-                                       chan_opts.attr.switch_timer_interval,
-                                       USEC_UNIT);
+                           chan_opts.attr.switch_timer_interval,
+                           USEC_UNIT);
                        break;
                }
                case OPT_READ_TIMER:
@@ -528,8 +544,8 @@ int cmd_enable_channels(int argc, const char **argv)
                        }
                        chan_opts.attr.read_timer_interval = (uint32_t) v;
                        DBG("Channel read timer interval set to %d %s",
-                                       chan_opts.attr.read_timer_interval,
-                                       USEC_UNIT);
+                           chan_opts.attr.read_timer_interval,
+                           USEC_UNIT);
                        break;
                }
                case OPT_MONITOR_TIMER:
@@ -547,8 +563,8 @@ int cmd_enable_channels(int argc, const char **argv)
                        opt_monitor_timer.interval = (uint64_t) v;
                        opt_monitor_timer.set = true;
                        DBG("Channel monitor timer interval set to %" PRIu64 " %s",
-                                       opt_monitor_timer.interval,
-                                       USEC_UNIT);
+                           opt_monitor_timer.interval,
+                           USEC_UNIT);
                        break;
                }
                case OPT_BLOCKING_TIMEOUT:
@@ -589,7 +605,8 @@ int cmd_enable_channels(int argc, const char **argv)
                         */
                        v_msec = v / 1000;
                        if (v_msec != (int32_t) v_msec) {
-                               ERR("32-bit milliseconds overflow in --blocking-timeout parameter: %s", opt_arg);
+                               ERR("32-bit milliseconds overflow in --blocking-timeout parameter: %s",
+                                   opt_arg);
                                ret = CMD_ERROR;
                                goto end;
                        }
@@ -597,10 +614,9 @@ int cmd_enable_channels(int argc, const char **argv)
                        opt_blocking_timeout.value = (int64_t) v;
                        opt_blocking_timeout.set = true;
                        DBG("Channel blocking timeout set to %" PRId64 " %s%s",
-                                       opt_blocking_timeout.value,
-                                       USEC_UNIT,
-                                       opt_blocking_timeout.value == 0 ?
-                                               " (non-blocking)" : "");
+                           opt_blocking_timeout.value,
+                           USEC_UNIT,
+                           opt_blocking_timeout.value == 0 ? " (non-blocking)" : "");
                        break;
                }
                case OPT_USERSPACE:
@@ -614,7 +630,7 @@ int cmd_enable_channels(int argc, const char **argv)
                                goto end;
                        }
                        DBG("Maximum tracefile size set to %" PRIu64,
-                                       chan_opts.attr.tracefile_size);
+                           chan_opts.attr.tracefile_size);
                        break;
                case OPT_TRACEFILE_COUNT:
                {
@@ -635,7 +651,7 @@ int cmd_enable_channels(int argc, const char **argv)
                        }
                        chan_opts.attr.tracefile_count = (uint32_t) v;
                        DBG("Maximum tracefile count set to %" PRIu64,
-                                       chan_opts.attr.tracefile_count);
+                           chan_opts.attr.tracefile_count);
                        break;
                }
                case OPT_LIST_OPTIONS:
@@ -652,17 +668,16 @@ int cmd_enable_channels(int argc, const char **argv)
                }
        }
 
-       ret = print_missing_or_multiple_domains(
-                       opt_kernel + opt_userspace, false);
+       ret = print_missing_or_multiple_domains(opt_kernel + opt_userspace, false);
        if (ret) {
                ret = CMD_ERROR;
                goto end;
        }
 
        if (chan_opts.attr.overwrite == 1 && opt_blocking_timeout.set &&
-                       opt_blocking_timeout.value != 0) {
+           opt_blocking_timeout.value != 0) {
                ERR("You cannot specify --overwrite and --blocking-timeout=N, "
-                       "where N is different than 0");
+                   "where N is different than 0");
                ret = CMD_ERROR;
                goto end;
        }
@@ -677,15 +692,14 @@ int cmd_enable_channels(int argc, const char **argv)
 
                /* Open command element */
                ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_enable_channels);
+                                                  mi_lttng_element_command_enable_channels);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -742,8 +756,8 @@ mi_closing:
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success, success);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, success);
                if (ret) {
                        goto end;
                }
index 2c20eea1997d11b4b862e559ccc9fc0a37317396..5c655bb4332cc9177e261e1d4b2d38daa18025ec 100644 (file)
@@ -6,33 +6,33 @@
  */
 
 #define _LGPL_SOURCE
+#include <common/compat/getenv.hpp>
+#include <common/compat/string.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/string-utils/string-utils.hpp>
+#include <common/utils.hpp>
+
+#include <ctype.h>
+#include <inttypes.h>
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <inttypes.h>
-#include <ctype.h>
-
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/compat/string.hpp>
-#include <common/compat/getenv.hpp>
-#include <common/string-utils/string-utils.hpp>
-#include <common/utils.hpp>
 
 /* Mi dependancy */
+#include "../command.hpp"
+#include "../loglevel.hpp"
+#include "../uprobe.hpp"
+
 #include <common/mi-lttng.hpp>
 
 #include <lttng/domain-internal.hpp>
 #include <lttng/event-internal.hpp>
 
-#include "../command.hpp"
-#include "../loglevel.hpp"
-#include "../uprobe.hpp"
-
 #if (LTTNG_SYMBOL_NAME_LEN == 256)
-#define LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API    "255"
+#define LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API "255"
 #endif
 
 static int opt_event_type;
@@ -55,7 +55,7 @@ static char *opt_exclude;
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-enable-event.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -78,26 +78,26 @@ static struct mi_writer *writer;
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",           'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"session",        's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0},
-       {"all",            'a', POPT_ARG_VAL, &opt_enable_all, 1, 0, 0},
-       {"channel",        'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0},
-       {"kernel",         'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
-       {"userspace",      'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0},
-       {"jul",            'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0},
-       {"log4j",          'l', POPT_ARG_VAL, &opt_log4j, 1, 0, 0},
-       {"python",         'p', POPT_ARG_VAL, &opt_python, 1, 0, 0},
-       {"tracepoint",     0,   POPT_ARG_NONE, 0, OPT_TRACEPOINT, 0, 0},
-       {"probe",          0,   POPT_ARG_STRING, &opt_probe, OPT_PROBE, 0, 0},
-       {"userspace-probe",0,   POPT_ARG_STRING, &opt_userspace_probe, OPT_USERSPACE_PROBE, 0, 0},
-       {"function",       0,   POPT_ARG_STRING, &opt_function, OPT_FUNCTION, 0, 0},
-       {"syscall",        0,   POPT_ARG_NONE, 0, OPT_SYSCALL, 0, 0},
-       {"loglevel",       0,     POPT_ARG_STRING, 0, OPT_LOGLEVEL, 0, 0},
-       {"loglevel-only",  0,     POPT_ARG_STRING, 0, OPT_LOGLEVEL_ONLY, 0, 0},
-       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {"filter",         'f', POPT_ARG_STRING, &opt_filter, OPT_FILTER, 0, 0},
-       {"exclude",        'x', POPT_ARG_STRING, &opt_exclude, OPT_EXCLUDE, 0, 0},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
+       { "all", 'a', POPT_ARG_VAL, &opt_enable_all, 1, 0, 0 },
+       { "channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0 },
+       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0 },
+       { "userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0 },
+       { "jul", 'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0 },
+       { "log4j", 'l', POPT_ARG_VAL, &opt_log4j, 1, 0, 0 },
+       { "python", 'p', POPT_ARG_VAL, &opt_python, 1, 0, 0 },
+       { "tracepoint", 0, POPT_ARG_NONE, 0, OPT_TRACEPOINT, 0, 0 },
+       { "probe", 0, POPT_ARG_STRING, &opt_probe, OPT_PROBE, 0, 0 },
+       { "userspace-probe", 0, POPT_ARG_STRING, &opt_userspace_probe, OPT_USERSPACE_PROBE, 0, 0 },
+       { "function", 0, POPT_ARG_STRING, &opt_function, OPT_FUNCTION, 0, 0 },
+       { "syscall", 0, POPT_ARG_NONE, 0, OPT_SYSCALL, 0, 0 },
+       { "loglevel", 0, POPT_ARG_STRING, 0, OPT_LOGLEVEL, 0, 0 },
+       { "loglevel-only", 0, POPT_ARG_STRING, 0, OPT_LOGLEVEL_ONLY, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { "filter", 'f', POPT_ARG_STRING, &opt_filter, OPT_FILTER, 0, 0 },
+       { "exclude", 'x', POPT_ARG_STRING, &opt_exclude, OPT_EXCLUDE, 0, 0 },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 /*
@@ -108,7 +108,7 @@ static int parse_probe_opts(struct lttng_event *ev, char *opt)
        int ret = CMD_SUCCESS;
        int match;
        char s_hex[19];
-#define S_HEX_LEN_SCANF_IS_A_BROKEN_API "18"   /* 18 is (19 - 1) (\0 is extra) */
+#define S_HEX_LEN_SCANF_IS_A_BROKEN_API "18" /* 18 is (19 - 1) (\0 is extra) */
        char name[LTTNG_SYMBOL_NAME_LEN];
 
        if (opt == NULL) {
@@ -117,8 +117,11 @@ static int parse_probe_opts(struct lttng_event *ev, char *opt)
        }
 
        /* Check for symbol+offset */
-       match = sscanf(opt, "%" LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API
-                       "[^'+']+%" S_HEX_LEN_SCANF_IS_A_BROKEN_API "s", name, s_hex);
+       match = sscanf(opt,
+                      "%" LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API
+                      "[^'+']+%" S_HEX_LEN_SCANF_IS_A_BROKEN_API "s",
+                      name,
+                      s_hex);
        if (match == 2) {
                strncpy(ev->attr.probe.symbol_name, name, LTTNG_SYMBOL_NAME_LEN);
                ev->attr.probe.symbol_name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
@@ -136,8 +139,7 @@ static int parse_probe_opts(struct lttng_event *ev, char *opt)
 
        /* Check for symbol */
        if (isalpha(name[0]) || name[0] == '_') {
-               match = sscanf(opt, "%" LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API "s",
-                       name);
+               match = sscanf(opt, "%" LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API "s", name);
                if (match == 1) {
                        strncpy(ev->attr.probe.symbol_name, name, LTTNG_SYMBOL_NAME_LEN);
                        ev->attr.probe.symbol_name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
@@ -176,23 +178,20 @@ end:
        return ret;
 }
 
-static
-const char *print_channel_name(const char *name)
+static const char *print_channel_name(const char *name)
 {
-       return name ? : DEFAULT_CHANNEL_NAME;
+       return name ?: DEFAULT_CHANNEL_NAME;
 }
 
-static
-const char *print_raw_channel_name(const char *name)
+static const char *print_raw_channel_name(const char *name)
 {
-       return name ? : "<default>";
+       return name ?: "<default>";
 }
 
 /*
  * Mi print exlcusion list
  */
-static
-int mi_print_exclusion(const struct lttng_dynamic_pointer_array *exclusions)
+static int mi_print_exclusion(const struct lttng_dynamic_pointer_array *exclusions)
 {
        int ret;
        size_t i;
@@ -211,11 +210,11 @@ int mi_print_exclusion(const struct lttng_dynamic_pointer_array *exclusions)
        }
 
        for (i = 0; i < count; i++) {
-               const char *exclusion = (const char *) lttng_dynamic_pointer_array_get_pointer(
-                               exclusions, i);
+               const char *exclusion =
+                       (const char *) lttng_dynamic_pointer_array_get_pointer(exclusions, i);
 
-               ret = mi_lttng_writer_write_element_string(writer,
-                               config_element_exclusion, exclusion);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, config_element_exclusion, exclusion);
                if (ret) {
                        goto end;
                }
@@ -231,8 +230,7 @@ end:
 /*
  * Return allocated string for pretty-printing exclusion names.
  */
-static
-char *print_exclusions(const struct lttng_dynamic_pointer_array *exclusions)
+static char *print_exclusions(const struct lttng_dynamic_pointer_array *exclusions)
 {
        int length = 0;
        size_t i;
@@ -246,8 +244,8 @@ char *print_exclusions(const struct lttng_dynamic_pointer_array *exclusions)
 
        /* Calculate total required length. */
        for (i = 0; i < count; i++) {
-               const char *exclusion = (const char *) lttng_dynamic_pointer_array_get_pointer(
-                               exclusions, i);
+               const char *exclusion =
+                       (const char *) lttng_dynamic_pointer_array_get_pointer(exclusions, i);
 
                length += strlen(exclusion) + 4;
        }
@@ -260,8 +258,8 @@ char *print_exclusions(const struct lttng_dynamic_pointer_array *exclusions)
 
        strncpy(ret, preamble, length);
        for (i = 0; i < count; i++) {
-               const char *exclusion = (const char *) lttng_dynamic_pointer_array_get_pointer(
-                               exclusions, i);
+               const char *exclusion =
+                       (const char *) lttng_dynamic_pointer_array_get_pointer(exclusions, i);
 
                strcat(ret, "\"");
                strcat(ret, exclusion);
@@ -274,8 +272,7 @@ char *print_exclusions(const struct lttng_dynamic_pointer_array *exclusions)
        return ret;
 }
 
-static
-int check_exclusion_subsets(const char *event_name, const char *exclusion)
+static int check_exclusion_subsets(const char *event_name, const char *exclusion)
 {
        bool warn = false;
        int ret = 0;
@@ -298,7 +295,9 @@ int check_exclusion_subsets(const char *event_name, const char *exclusion)
                if (*x == '*') {
                        /* Event is a subset of the excluder */
                        ERR("Event %s: %s excludes all events from %s",
-                               event_name, exclusion, event_name);
+                           event_name,
+                           exclusion,
+                           event_name);
                        goto error;
                }
 
@@ -310,7 +309,7 @@ int check_exclusion_subsets(const char *event_name, const char *exclusion)
                        goto end;
                }
 
-cmp_chars:
+       cmp_chars:
                if (*x != *e) {
                        warn = true;
                        break;
@@ -328,21 +327,22 @@ error:
 end:
        if (warn) {
                WARN("Event %s: %s does not exclude any events from %s",
-                       event_name, exclusion, event_name);
+                    event_name,
+                    exclusion,
+                    event_name);
        }
 
        return ret;
 }
 
 int validate_exclusion_list(const char *event_name,
-               const struct lttng_dynamic_pointer_array *exclusions)
+                           const struct lttng_dynamic_pointer_array *exclusions)
 {
        int ret;
 
        /* Event name must be a valid globbing pattern to allow exclusions. */
        if (!strutils_is_star_glob_pattern(event_name)) {
-               ERR("Event %s: Exclusions can only be used with a globbing pattern",
-                       event_name);
+               ERR("Event %s: Exclusions can only be used with a globbing pattern", event_name);
                goto error;
        }
 
@@ -358,11 +358,11 @@ int validate_exclusion_list(const char *event_name,
 
                for (i = 0; i < num_exclusions; i++) {
                        const char *exclusion =
-                                       (const char *) lttng_dynamic_pointer_array_get_pointer(
-                                                       exclusions, i);
+                               (const char *) lttng_dynamic_pointer_array_get_pointer(exclusions,
+                                                                                      i);
 
                        if (!strutils_is_star_glob_pattern(exclusion) ||
-                                       strutils_is_star_at_the_end_only_glob_pattern(exclusion)) {
+                           strutils_is_star_at_the_end_only_glob_pattern(exclusion)) {
                                ret = check_exclusion_subsets(event_name, exclusion);
                                if (ret) {
                                        goto error;
@@ -382,8 +382,8 @@ end:
 }
 
 static int create_exclusion_list_and_validate(const char *event_name,
-               const char *exclusions_arg,
-               struct lttng_dynamic_pointer_array *exclusions)
+                                             const char *exclusions_arg,
+                                             struct lttng_dynamic_pointer_array *exclusions)
 {
        int ret = 0;
 
@@ -393,8 +393,7 @@ static int create_exclusion_list_and_validate(const char *event_name,
                goto error;
        }
 
-       if (validate_exclusion_list(event_name, exclusions) !=
-                       0) {
+       if (validate_exclusion_list(event_name, exclusions) != 0) {
                goto error;
        }
 
@@ -409,17 +408,17 @@ end:
 }
 
 static void warn_on_truncated_exclusion_names(const struct lttng_dynamic_pointer_array *exclusions,
-       int *warn)
+                                             int *warn)
 {
        size_t i;
        const size_t num_exclusions = lttng_dynamic_pointer_array_get_count(exclusions);
 
        for (i = 0; i < num_exclusions; i++) {
-               const char * const exclusion = (const char *) lttng_dynamic_pointer_array_get_pointer(exclusions, i);
+               const char *const exclusion =
+                       (const char *) lttng_dynamic_pointer_array_get_pointer(exclusions, i);
 
                if (strlen(exclusion) >= LTTNG_SYMBOL_NAME_LEN) {
-                       WARN("Event exclusion \"%s\" will be truncated",
-                                       exclusion);
+                       WARN("Event exclusion \"%s\" will be truncated", exclusion);
                        *warn = 1;
                }
        }
@@ -485,7 +484,7 @@ static int enable_events(char *session_name, char *event_list)
                case LTTNG_DOMAIN_LOG4J:
                case LTTNG_DOMAIN_PYTHON:
                        ERR("Event name exclusions are not yet implemented for %s events",
-                                       lttng_domain_type_str(dom.type));
+                           lttng_domain_type_str(dom.type));
                        ret = CMD_ERROR;
                        goto error;
                case LTTNG_DOMAIN_UST:
@@ -511,7 +510,7 @@ static int enable_events(char *session_name, char *event_list)
                case LTTNG_EVENT_USERSPACE_PROBE:
                case LTTNG_EVENT_FUNCTION:
                        ERR("Filter expressions are not supported for %s events",
-                                       get_event_type_str((lttng_event_type) opt_event_type));
+                           get_event_type_str((lttng_event_type) opt_event_type));
                        ret = CMD_ERROR;
                        goto error;
                default:
@@ -557,23 +556,27 @@ static int enable_events(char *session_name, char *event_list)
                                if (opt_userspace) {
                                        enum lttng_loglevel loglevel;
 
-                                       name_search_ret = loglevel_name_to_value(opt_loglevel, &loglevel);
+                                       name_search_ret =
+                                               loglevel_name_to_value(opt_loglevel, &loglevel);
                                        ev->loglevel = (int) loglevel;
                                } else if (opt_jul) {
                                        enum lttng_loglevel_jul loglevel;
 
-                                       name_search_ret = loglevel_jul_name_to_value(opt_loglevel, &loglevel);
+                                       name_search_ret =
+                                               loglevel_jul_name_to_value(opt_loglevel, &loglevel);
                                        ev->loglevel = (int) loglevel;
                                } else if (opt_log4j) {
                                        enum lttng_loglevel_log4j loglevel;
 
-                                       name_search_ret = loglevel_log4j_name_to_value(opt_loglevel, &loglevel);
+                                       name_search_ret = loglevel_log4j_name_to_value(opt_loglevel,
+                                                                                      &loglevel);
                                        ev->loglevel = (int) loglevel;
                                } else {
                                        /* python domain. */
                                        enum lttng_loglevel_python loglevel;
 
-                                       name_search_ret = loglevel_python_name_to_value(opt_loglevel, &loglevel);
+                                       name_search_ret = loglevel_python_name_to_value(
+                                               opt_loglevel, &loglevel);
                                        ev->loglevel = (int) loglevel;
                                }
 
@@ -597,47 +600,49 @@ static int enable_events(char *session_name, char *event_list)
                }
 
                if (opt_exclude) {
-                       ret = create_exclusion_list_and_validate("*",
-                               opt_exclude, &exclusions);
+                       ret = create_exclusion_list_and_validate("*", opt_exclude, &exclusions);
                        if (ret) {
                                ret = CMD_ERROR;
                                goto error;
                        }
 
                        ev->exclusion = 1;
-                       warn_on_truncated_exclusion_names(&exclusions,
-                               &warn);
+                       warn_on_truncated_exclusion_names(&exclusions, &warn);
                }
                if (!opt_filter) {
-                       ret = lttng_enable_event_with_exclusions(handle,
-                                       ev, channel_name,
-                                       NULL,
-                                       lttng_dynamic_pointer_array_get_count(&exclusions),
-                                       (char **) exclusions.array.buffer.data);
+                       ret = lttng_enable_event_with_exclusions(
+                               handle,
+                               ev,
+                               channel_name,
+                               NULL,
+                               lttng_dynamic_pointer_array_get_count(&exclusions),
+                               (char **) exclusions.array.buffer.data);
                        if (ret < 0) {
                                switch (-ret) {
                                case LTTNG_ERR_KERN_EVENT_EXIST:
                                        WARN("Kernel events already enabled (channel %s, session %s)",
-                                                       print_channel_name(channel_name), session_name);
+                                            print_channel_name(channel_name),
+                                            session_name);
                                        warn = 1;
                                        break;
                                case LTTNG_ERR_TRACE_ALREADY_STARTED:
                                {
-                                       const char *msg = "The command tried to enable an event in a new domain for a session that has already been started once.";
+                                       const char *msg =
+                                               "The command tried to enable an event in a new domain for a session that has already been started once.";
                                        ERR("Events: %s (channel %s, session %s)",
-                                                       msg,
-                                                       print_channel_name(channel_name),
-                                                       session_name);
+                                           msg,
+                                           print_channel_name(channel_name),
+                                           session_name);
                                        error = 1;
                                        break;
                                }
                                default:
                                        ERR("Events: %s (channel %s, session %s)",
-                                                       lttng_strerror(ret),
-                                                       ret == -LTTNG_ERR_NEED_CHANNEL_NAME
-                                                               ? print_raw_channel_name(channel_name)
-                                                               : print_channel_name(channel_name),
-                                                       session_name);
+                                           lttng_strerror(ret),
+                                           ret == -LTTNG_ERR_NEED_CHANNEL_NAME ?
+                                                   print_raw_channel_name(channel_name) :
+                                                   print_channel_name(channel_name),
+                                           session_name);
                                        error = 1;
                                        break;
                                }
@@ -655,10 +660,10 @@ static int enable_events(char *session_name, char *event_list)
                                                goto end;
                                        }
                                        MSG("All %s tracepoints%s are enabled in channel %s for loglevel %s",
-                                                       lttng_domain_type_str(dom.type),
-                                                       exclusion_string,
-                                                       print_channel_name(channel_name),
-                                                       opt_loglevel);
+                                           lttng_domain_type_str(dom.type),
+                                           exclusion_string,
+                                           print_channel_name(channel_name),
+                                           opt_loglevel);
                                        free(exclusion_string);
                                } else {
                                        char *exclusion_string = print_exclusions(&exclusions);
@@ -669,17 +674,17 @@ static int enable_events(char *session_name, char *event_list)
                                                goto end;
                                        }
                                        MSG("All %s tracepoints%s are enabled in channel %s",
-                                                       lttng_domain_type_str(dom.type),
-                                                       exclusion_string,
-                                                       print_channel_name(channel_name));
+                                           lttng_domain_type_str(dom.type),
+                                           exclusion_string,
+                                           print_channel_name(channel_name));
                                        free(exclusion_string);
                                }
                                break;
                        case LTTNG_EVENT_SYSCALL:
                                if (opt_kernel) {
                                        MSG("All %s system calls are enabled in channel %s",
-                                                       lttng_domain_type_str(dom.type),
-                                                       print_channel_name(channel_name));
+                                           lttng_domain_type_str(dom.type),
+                                           print_channel_name(channel_name));
                                }
                                break;
                        case LTTNG_EVENT_ALL:
@@ -692,10 +697,10 @@ static int enable_events(char *session_name, char *event_list)
                                                goto end;
                                        }
                                        MSG("All %s events%s are enabled in channel %s for loglevel %s",
-                                                       lttng_domain_type_str(dom.type),
-                                                       exclusion_string,
-                                                       print_channel_name(channel_name),
-                                                       opt_loglevel);
+                                           lttng_domain_type_str(dom.type),
+                                           exclusion_string,
+                                           print_channel_name(channel_name),
+                                           opt_loglevel);
                                        free(exclusion_string);
                                } else {
                                        char *exclusion_string = print_exclusions(&exclusions);
@@ -706,9 +711,9 @@ static int enable_events(char *session_name, char *event_list)
                                                goto end;
                                        }
                                        MSG("All %s events%s are enabled in channel %s",
-                                                       lttng_domain_type_str(dom.type),
-                                                       exclusion_string,
-                                                       print_channel_name(channel_name));
+                                           lttng_domain_type_str(dom.type),
+                                           exclusion_string,
+                                           print_channel_name(channel_name));
                                        free(exclusion_string);
                                }
                                break;
@@ -722,35 +727,42 @@ static int enable_events(char *session_name, char *event_list)
                }
 
                if (opt_filter) {
-                       command_ret = lttng_enable_event_with_exclusions(handle, ev, channel_name,
-                                       opt_filter,
-                                       lttng_dynamic_pointer_array_get_count(&exclusions),
-                                       (char **) exclusions.array.buffer.data);
+                       command_ret = lttng_enable_event_with_exclusions(
+                               handle,
+                               ev,
+                               channel_name,
+                               opt_filter,
+                               lttng_dynamic_pointer_array_get_count(&exclusions),
+                               (char **) exclusions.array.buffer.data);
                        if (command_ret < 0) {
                                switch (-command_ret) {
                                case LTTNG_ERR_FILTER_EXIST:
                                        WARN("Filter on all events is already enabled"
-                                                       " (channel %s, session %s)",
-                                               print_channel_name(channel_name), session_name);
+                                            " (channel %s, session %s)",
+                                            print_channel_name(channel_name),
+                                            session_name);
                                        warn = 1;
                                        break;
                                case LTTNG_ERR_TRACE_ALREADY_STARTED:
                                {
-                                       const char *msg = "The command tried to enable an event in a new domain for a session that has already been started once.";
+                                       const char *msg =
+                                               "The command tried to enable an event in a new domain for a session that has already been started once.";
                                        ERR("All events: %s (channel %s, session %s, filter \'%s\')",
-                                                       msg,
-                                                       print_channel_name(channel_name),
-                                                       session_name, opt_filter);
+                                           msg,
+                                           print_channel_name(channel_name),
+                                           session_name,
+                                           opt_filter);
                                        error = 1;
                                        break;
                                }
                                default:
                                        ERR("All events: %s (channel %s, session %s, filter \'%s\')",
-                                                       lttng_strerror(command_ret),
-                                                       command_ret == -LTTNG_ERR_NEED_CHANNEL_NAME
-                                                               ? print_raw_channel_name(channel_name)
-                                                               : print_channel_name(channel_name),
-                                                       session_name, opt_filter);
+                                           lttng_strerror(command_ret),
+                                           command_ret == -LTTNG_ERR_NEED_CHANNEL_NAME ?
+                                                   print_raw_channel_name(channel_name) :
+                                                   print_channel_name(channel_name),
+                                           session_name,
+                                           opt_filter);
                                        error = 1;
                                        break;
                                }
@@ -792,8 +804,8 @@ static int enable_events(char *session_name, char *event_list)
                        }
 
                        /* Success ? */
-                       ret = mi_lttng_writer_write_element_bool(writer,
-                                       mi_lttng_element_command_success, success);
+                       ret = mi_lttng_writer_write_element_bool(
+                               writer, mi_lttng_element_command_success, success);
                        if (ret) {
                                ret = CMD_ERROR;
                                goto error;
@@ -821,11 +833,11 @@ static int enable_events(char *session_name, char *event_list)
                /* Kernel tracer action */
                if (opt_kernel) {
                        DBG("Enabling kernel event %s for channel %s",
-                                       event_name,
-                                       print_channel_name(channel_name));
+                           event_name,
+                           print_channel_name(channel_name));
 
                        switch (opt_event_type) {
-                       case LTTNG_EVENT_ALL:   /* Enable tracepoints and syscalls */
+                       case LTTNG_EVENT_ALL: /* Enable tracepoints and syscalls */
                                /* If event name differs from *, select tracepoint. */
                                if (strcmp(ev->name, "*")) {
                                        ev->type = LTTNG_EVENT_TRACEPOINT;
@@ -890,12 +902,14 @@ static int enable_events(char *session_name, char *event_list)
 
                        /* kernel loglevels not implemented */
                        ev->loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
-               } else if (opt_userspace) {             /* User-space tracer action */
-                       DBG("Enabling UST event %s for channel %s, loglevel %s", event_name,
-                                       print_channel_name(channel_name), opt_loglevel ? : "<all>");
+               } else if (opt_userspace) { /* User-space tracer action */
+                       DBG("Enabling UST event %s for channel %s, loglevel %s",
+                           event_name,
+                           print_channel_name(channel_name),
+                           opt_loglevel ?: "<all>");
 
                        switch (opt_event_type) {
-                       case LTTNG_EVENT_ALL:   /* Default behavior is tracepoint */
+                       case LTTNG_EVENT_ALL: /* Default behavior is tracepoint */
                                /* Fall-through */
                        case LTTNG_EVENT_TRACEPOINT:
                                /* Copy name and type of the event */
@@ -915,7 +929,8 @@ static int enable_events(char *session_name, char *event_list)
 
                        if (opt_exclude) {
                                ev->exclusion = 1;
-                               if (opt_event_type != LTTNG_EVENT_ALL && opt_event_type != LTTNG_EVENT_TRACEPOINT) {
+                               if (opt_event_type != LTTNG_EVENT_ALL &&
+                                   opt_event_type != LTTNG_EVENT_TRACEPOINT) {
                                        ERR("Exclusion option can only be used with tracepoint events");
                                        ret = CMD_ERROR;
                                        goto error;
@@ -923,21 +938,20 @@ static int enable_events(char *session_name, char *event_list)
                                /* Free previously allocated items. */
                                lttng_dynamic_pointer_array_reset(&exclusions);
                                ret = create_exclusion_list_and_validate(
-                                       event_name, opt_exclude,
-                                       &exclusions);
+                                       event_name, opt_exclude, &exclusions);
                                if (ret) {
                                        ret = CMD_ERROR;
                                        goto error;
                                }
 
-                               warn_on_truncated_exclusion_names(
-                                       &exclusions, &warn);
+                               warn_on_truncated_exclusion_names(&exclusions, &warn);
                        }
 
                        ev->loglevel_type = (lttng_loglevel_type) opt_loglevel_type;
                        if (opt_loglevel) {
                                enum lttng_loglevel loglevel;
-                               const int name_search_ret = loglevel_name_to_value(opt_loglevel, &loglevel);
+                               const int name_search_ret =
+                                       loglevel_name_to_value(opt_loglevel, &loglevel);
 
                                if (name_search_ret == -1) {
                                        ERR("Unknown loglevel %s", opt_loglevel);
@@ -951,7 +965,7 @@ static int enable_events(char *session_name, char *event_list)
                        }
                } else if (opt_jul || opt_log4j || opt_python) {
                        if (opt_event_type != LTTNG_EVENT_ALL &&
-                                       opt_event_type != LTTNG_EVENT_TRACEPOINT) {
+                           opt_event_type != LTTNG_EVENT_TRACEPOINT) {
                                ERR("Event type not supported for domain.");
                                ret = CMD_UNSUPPORTED;
                                goto error;
@@ -964,18 +978,21 @@ static int enable_events(char *session_name, char *event_list)
                                if (opt_jul) {
                                        enum lttng_loglevel_jul loglevel;
 
-                                       name_search_ret = loglevel_jul_name_to_value(opt_loglevel, &loglevel);
+                                       name_search_ret =
+                                               loglevel_jul_name_to_value(opt_loglevel, &loglevel);
                                        ev->loglevel = (int) loglevel;
                                } else if (opt_log4j) {
                                        enum lttng_loglevel_log4j loglevel;
 
-                                       name_search_ret = loglevel_log4j_name_to_value(opt_loglevel, &loglevel);
+                                       name_search_ret = loglevel_log4j_name_to_value(opt_loglevel,
+                                                                                      &loglevel);
                                        ev->loglevel = (int) loglevel;
                                } else {
                                        /* python domain. */
                                        enum lttng_loglevel_python loglevel;
 
-                                       name_search_ret = loglevel_python_name_to_value(opt_loglevel, &loglevel);
+                                       name_search_ret = loglevel_python_name_to_value(
+                                               opt_loglevel, &loglevel);
                                        ev->loglevel = (int) loglevel;
                                }
 
@@ -1003,11 +1020,13 @@ static int enable_events(char *session_name, char *event_list)
                if (!opt_filter) {
                        char *exclusion_string;
 
-                       command_ret = lttng_enable_event_with_exclusions(handle,
-                                       ev, channel_name,
-                                       NULL,
-                                       lttng_dynamic_pointer_array_get_count(&exclusions),
-                                       (char **) exclusions.array.buffer.data);
+                       command_ret = lttng_enable_event_with_exclusions(
+                               handle,
+                               ev,
+                               channel_name,
+                               NULL,
+                               lttng_dynamic_pointer_array_get_count(&exclusions),
+                               (char **) exclusions.array.buffer.data);
                        exclusion_string = print_exclusions(&exclusions);
                        if (!exclusion_string) {
                                PERROR("Cannot allocate exclusion_string");
@@ -1019,36 +1038,41 @@ static int enable_events(char *session_name, char *event_list)
                                switch (-command_ret) {
                                case LTTNG_ERR_KERN_EVENT_EXIST:
                                        WARN("Kernel event %s%s already enabled (channel %s, session %s)",
-                                                       event_name,
-                                                       exclusion_string,
-                                                       print_channel_name(channel_name), session_name);
+                                            event_name,
+                                            exclusion_string,
+                                            print_channel_name(channel_name),
+                                            session_name);
                                        warn = 1;
                                        break;
                                case LTTNG_ERR_TRACE_ALREADY_STARTED:
                                {
-                                       const char *msg = "The command tried to enable an event in a new domain for a session that has already been started once.";
-                                       ERR("Event %s%s: %s (channel %s, session %s)", event_name,
-                                                       exclusion_string,
-                                                       msg,
-                                                       print_channel_name(channel_name),
-                                                       session_name);
+                                       const char *msg =
+                                               "The command tried to enable an event in a new domain for a session that has already been started once.";
+                                       ERR("Event %s%s: %s (channel %s, session %s)",
+                                           event_name,
+                                           exclusion_string,
+                                           msg,
+                                           print_channel_name(channel_name),
+                                           session_name);
                                        error = 1;
                                        break;
                                }
                                case LTTNG_ERR_SDT_PROBE_SEMAPHORE:
                                        ERR("SDT probes %s guarded by semaphores are not supported (channel %s, session %s)",
-                                                       event_name, print_channel_name(channel_name),
-                                                       session_name);
+                                           event_name,
+                                           print_channel_name(channel_name),
+                                           session_name);
                                        error = 1;
                                        break;
                                default:
-                                       ERR("Event %s%s: %s (channel %s, session %s)", event_name,
-                                                       exclusion_string,
-                                                       lttng_strerror(command_ret),
-                                                       command_ret == -LTTNG_ERR_NEED_CHANNEL_NAME
-                                                               ? print_raw_channel_name(channel_name)
-                                                               : print_channel_name(channel_name),
-                                                       session_name);
+                                       ERR("Event %s%s: %s (channel %s, session %s)",
+                                           event_name,
+                                           exclusion_string,
+                                           lttng_strerror(command_ret),
+                                           command_ret == -LTTNG_ERR_NEED_CHANNEL_NAME ?
+                                                   print_raw_channel_name(channel_name) :
+                                                   print_channel_name(channel_name),
+                                           session_name);
                                        error = 1;
                                        break;
                                }
@@ -1058,10 +1082,10 @@ static int enable_events(char *session_name, char *event_list)
                                case LTTNG_DOMAIN_KERNEL:
                                case LTTNG_DOMAIN_UST:
                                        MSG("%s event %s%s created in channel %s",
-                                               lttng_domain_type_str(dom.type),
-                                               event_name,
-                                               exclusion_string,
-                                               print_channel_name(channel_name));
+                                           lttng_domain_type_str(dom.type),
+                                           event_name,
+                                           exclusion_string,
+                                           print_channel_name(channel_name));
                                        break;
                                case LTTNG_DOMAIN_JUL:
                                case LTTNG_DOMAIN_LOG4J:
@@ -1071,9 +1095,9 @@ static int enable_events(char *session_name, char *event_list)
                                         * name for agent domains.
                                         */
                                        MSG("%s event %s%s enabled",
-                                               lttng_domain_type_str(dom.type),
-                                               event_name,
-                                               exclusion_string);
+                                           lttng_domain_type_str(dom.type),
+                                           event_name,
+                                           exclusion_string);
                                        break;
                                default:
                                        abort();
@@ -1088,10 +1112,13 @@ static int enable_events(char *session_name, char *event_list)
                        /* Filter present */
                        ev->filter = 1;
 
-                       command_ret = lttng_enable_event_with_exclusions(handle, ev, channel_name,
-                                       opt_filter,
-                                       lttng_dynamic_pointer_array_get_count(&exclusions),
-                                       (char **) exclusions.array.buffer.data);
+                       command_ret = lttng_enable_event_with_exclusions(
+                               handle,
+                               ev,
+                               channel_name,
+                               opt_filter,
+                               lttng_dynamic_pointer_array_get_count(&exclusions),
+                               (char **) exclusions.array.buffer.data);
                        exclusion_string = print_exclusions(&exclusions);
                        if (!exclusion_string) {
                                PERROR("Cannot allocate exclusion_string");
@@ -1102,31 +1129,37 @@ static int enable_events(char *session_name, char *event_list)
                                switch (-command_ret) {
                                case LTTNG_ERR_FILTER_EXIST:
                                        WARN("Filter on event %s%s is already enabled"
-                                                       " (channel %s, session %s)",
-                                               event_name,
-                                               exclusion_string,
-                                               print_channel_name(channel_name), session_name);
+                                            " (channel %s, session %s)",
+                                            event_name,
+                                            exclusion_string,
+                                            print_channel_name(channel_name),
+                                            session_name);
                                        warn = 1;
                                        break;
                                case LTTNG_ERR_TRACE_ALREADY_STARTED:
                                {
-                                       const char *msg = "The command tried to enable an event in a new domain for a session that has already been started once.";
-                                       ERR("Event %s%s: %s (channel %s, session %s, filter \'%s\')", ev->name,
-                                                       exclusion_string,
-                                                       msg,
-                                                       print_channel_name(channel_name),
-                                                       session_name, opt_filter);
+                                       const char *msg =
+                                               "The command tried to enable an event in a new domain for a session that has already been started once.";
+                                       ERR("Event %s%s: %s (channel %s, session %s, filter \'%s\')",
+                                           ev->name,
+                                           exclusion_string,
+                                           msg,
+                                           print_channel_name(channel_name),
+                                           session_name,
+                                           opt_filter);
                                        error = 1;
                                        break;
                                }
                                default:
-                                       ERR("Event %s%s: %s (channel %s, session %s, filter \'%s\')", ev->name,
-                                                       exclusion_string,
-                                                       lttng_strerror(command_ret),
-                                                       command_ret == -LTTNG_ERR_NEED_CHANNEL_NAME
-                                                               ? print_raw_channel_name(channel_name)
-                                                               : print_channel_name(channel_name),
-                                                       session_name, opt_filter);
+                                       ERR("Event %s%s: %s (channel %s, session %s, filter \'%s\')",
+                                           ev->name,
+                                           exclusion_string,
+                                           lttng_strerror(command_ret),
+                                           command_ret == -LTTNG_ERR_NEED_CHANNEL_NAME ?
+                                                   print_raw_channel_name(channel_name) :
+                                                   print_channel_name(channel_name),
+                                           session_name,
+                                           opt_filter);
                                        error = 1;
                                        break;
                                }
@@ -1134,8 +1167,9 @@ static int enable_events(char *session_name, char *event_list)
 
                        } else {
                                MSG("Event %s%s: Filter '%s' successfully set",
-                                               event_name, exclusion_string,
-                                               opt_filter);
+                                   event_name,
+                                   exclusion_string,
+                                   opt_filter);
                        }
                        free(exclusion_string);
                }
@@ -1162,8 +1196,8 @@ static int enable_events(char *session_name, char *event_list)
                        }
 
                        /* Success ? */
-                       ret = mi_lttng_writer_write_element_bool(writer,
-                                       mi_lttng_element_command_success, success);
+                       ret = mi_lttng_writer_write_element_bool(
+                               writer, mi_lttng_element_command_success, success);
                        if (ret) {
                                ret = CMD_ERROR;
                                goto end;
@@ -1288,9 +1322,7 @@ int cmd_enable_events(int argc, const char **argv)
        }
 
        ret = print_missing_or_multiple_domains(
-                       opt_kernel + opt_userspace + opt_jul + opt_log4j +
-                                       opt_python,
-                       true);
+               opt_kernel + opt_userspace + opt_jul + opt_log4j + opt_python, true);
        if (ret) {
                ret = CMD_ERROR;
                goto end;
@@ -1305,16 +1337,14 @@ int cmd_enable_events(int argc, const char **argv)
                }
 
                /* Open command element */
-               ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_enable_event);
+               ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_enable_event);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -1371,8 +1401,8 @@ mi_closing:
                        goto end;
                }
 
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success, success);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, success);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -1405,4 +1435,3 @@ end:
        poptFreeContext(pc);
        return ret;
 }
-
index 1b79da148065b6f0ace1d3d9eaebb8676f8239b7..d65eecb5e58a097fc221e9d22cbabc112f2a19da 100644 (file)
@@ -6,6 +6,16 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/utils.hpp>
+
+#include <lttng/lttng.h>
+
+#include <ctype.h>
+#include <inttypes.h>
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <inttypes.h>
-#include <ctype.h>
-
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/mi-lttng.hpp>
-#include <common/utils.hpp>
-
-#include "../command.hpp"
-#include <lttng/lttng.h>
 
 static char *opt_session_name;
 static struct mi_writer *writer;
@@ -29,7 +30,7 @@ static struct mi_writer *writer;
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-enable-rotation.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -41,12 +42,12 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",        'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {"session",     's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0},
-       {"timer",        0,   POPT_ARG_INT, 0, OPT_TIMER, 0, 0},
-       {"size",         0,   POPT_ARG_INT, 0, OPT_SIZE, 0, 0},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
+       { "timer", 0, POPT_ARG_INT, 0, OPT_TIMER, 0, 0 },
+       { "size", 0, POPT_ARG_INT, 0, OPT_SIZE, 0, 0 },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 static const char *schedule_type_str[] = {
@@ -55,7 +56,8 @@ static const char *schedule_type_str[] = {
 };
 
 static enum cmd_error_code add_schedule(const char *session_name,
-               enum lttng_rotation_schedule_type schedule_type, uint64_t value)
+                                       enum lttng_rotation_schedule_type schedule_type,
+                                       uint64_t value)
 {
        enum cmd_error_code ret = CMD_SUCCESS;
        struct lttng_rotation_schedule *schedule = NULL;
@@ -69,8 +71,7 @@ static enum cmd_error_code add_schedule(const char *session_name,
                        ret = CMD_ERROR;
                        goto end;
                }
-               status = lttng_rotation_schedule_periodic_set_period(schedule,
-                               value);
+               status = lttng_rotation_schedule_periodic_set_period(schedule, value);
                break;
        case LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD:
                schedule = lttng_rotation_schedule_size_threshold_create();
@@ -78,8 +79,7 @@ static enum cmd_error_code add_schedule(const char *session_name,
                        ret = CMD_ERROR;
                        goto end;
                }
-               status = lttng_rotation_schedule_size_threshold_set_threshold(
-                               schedule, value);
+               status = lttng_rotation_schedule_size_threshold_set_threshold(schedule, value);
                break;
        default:
                ERR("Unknown schedule type");
@@ -96,8 +96,7 @@ static enum cmd_error_code add_schedule(const char *session_name,
                ret = CMD_ERROR;
                goto end;
        default:
-               ERR("Unknown error occurred setting %s rotation schedule",
-                               schedule_type_name);
+               ERR("Unknown error occurred setting %s rotation schedule", schedule_type_name);
                ret = CMD_ERROR;
                goto end;
        }
@@ -109,32 +108,36 @@ static enum cmd_error_code add_schedule(const char *session_name,
                switch (schedule_type) {
                case LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC:
                        MSG("Enabled %s rotations every %" PRIu64 " %s on session %s",
-                                       schedule_type_name, value, USEC_UNIT, session_name);
+                           schedule_type_name,
+                           value,
+                           USEC_UNIT,
+                           session_name);
                        break;
                case LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD:
                        MSG("Enabled %s rotations every %" PRIu64 " bytes written on session %s",
-                                       schedule_type_name, value, session_name);
+                           schedule_type_name,
+                           value,
+                           session_name);
                        break;
                default:
                        abort();
                }
                break;
        case LTTNG_ROTATION_STATUS_INVALID:
-               ERR("Invalid parameter for %s rotation schedule",
-                               schedule_type_name);
+               ERR("Invalid parameter for %s rotation schedule", schedule_type_name);
                ret = CMD_ERROR;
                break;
        case LTTNG_ROTATION_STATUS_SCHEDULE_ALREADY_SET:
                ERR("A %s rotation schedule is already set on session %s",
-                               schedule_type_name,
-                               session_name);
+                   schedule_type_name,
+                   session_name);
                ret = CMD_ERROR;
                break;
        case LTTNG_ROTATION_STATUS_ERROR:
        default:
                ERR("Failed to enable %s rotation schedule on session %s",
-                               schedule_type_name,
-                               session_name);
+                   schedule_type_name,
+                   session_name);
                ret = CMD_ERROR;
                break;
        }
@@ -142,8 +145,7 @@ static enum cmd_error_code add_schedule(const char *session_name,
        if (lttng_opt_mi) {
                int mi_ret;
 
-               mi_ret = mi_lttng_rotation_schedule_result(writer,
-                               schedule, ret == CMD_SUCCESS);
+               mi_ret = mi_lttng_rotation_schedule_result(writer, schedule, ret == CMD_SUCCESS);
                if (mi_ret < 0) {
                        ret = CMD_ERROR;
                        goto end;
@@ -245,14 +247,13 @@ int cmd_enable_rotation(int argc, const char **argv)
 
                /* Open command element */
                ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_enable_rotation);
+                                                  mi_lttng_element_command_enable_rotation);
                if (ret) {
                        goto error;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        goto error;
                }
@@ -266,14 +267,13 @@ int cmd_enable_rotation(int argc, const char **argv)
 
        if (lttng_opt_mi) {
                ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_rotation_schedule_results);
+                                                  mi_lttng_element_rotation_schedule_results);
                if (ret) {
                        goto error;
                }
 
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_session_name,
-                               session_name);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, mi_lttng_element_session_name, session_name);
                if (ret) {
                        goto error;
                }
@@ -284,18 +284,16 @@ int cmd_enable_rotation(int argc, const char **argv)
                 * Continue processing even on error as multiple schedules can
                 * be specified at once.
                 */
-               cmd_ret = add_schedule(session_name,
-                               LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC,
-                               timer_us);
+               cmd_ret =
+                       add_schedule(session_name, LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC, timer_us);
        }
 
        if (size_rotation) {
                enum cmd_error_code tmp_ret;
 
                /* Don't overwrite cmd_ret if it already indicates an error. */
-               tmp_ret = add_schedule(session_name,
-                               LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD,
-                               size_bytes);
+               tmp_ret = add_schedule(
+                       session_name, LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD, size_bytes);
                cmd_ret = cmd_ret ? cmd_ret : tmp_ret;
        }
 
@@ -317,9 +315,8 @@ close_command:
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success,
-                               cmd_ret == CMD_SUCCESS);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, cmd_ret == CMD_SUCCESS);
                if (ret) {
                        goto error;
                }
index 9822b47eb90b0e5cf0e7eb940f4a04fa458a64ba..5f6d86685b0892bdaf059140fe5bb27bbf7f50a0 100644 (file)
@@ -6,27 +6,28 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/utils.hpp>
+
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "../command.hpp"
-#include <common/utils.hpp>
-
 #ifdef LTTNG_EMBED_HELP
 static const char *help_msg =
 #include <lttng-help.1.h>
-;
+       ;
 #endif
 
 static const char *lttng_help_msg =
 #ifdef LTTNG_EMBED_HELP
 #include <lttng.1.h>
 #else
-NULL
+       NULL
 #endif
-;
+       ;
 
 enum {
        OPT_HELP = 1,
@@ -35,9 +36,9 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",      'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 /*
index 5f52a57f6dcd4973faad510c66461bb65c6c0d01..eacaa6354f045a9b00bb54f588f5bd754639a7cd 100644 (file)
@@ -8,19 +8,20 @@
 
 #include <stdint.h>
 #define _LGPL_SOURCE
-#include <inttypes.h>
-#include <popt.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "../command.hpp"
 
 #include <common/mi-lttng.hpp>
 #include <common/time.hpp>
 #include <common/tracker.hpp>
+
 #include <lttng/domain-internal.hpp>
 #include <lttng/lttng.h>
 
-#include "../command.hpp"
+#include <inttypes.h>
+#include <popt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 static int opt_userspace;
 static int opt_kernel;
@@ -39,7 +40,7 @@ const char *indent8 = "        ";
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-list.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -56,18 +57,18 @@ static struct lttng_session the_listed_session;
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",        'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"kernel",      'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
-       {"jul", 'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0},
-       {"log4j",       'l', POPT_ARG_VAL, &opt_log4j, 1, 0, 0},
-       {"python",      'p', POPT_ARG_VAL, &opt_python, 1, 0, 0},
-       {"userspace",   'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0},
-       {"channel",     'c', POPT_ARG_STRING, &opt_channel, 0, 0, 0},
-       {"domain",      'd', POPT_ARG_VAL, &opt_domain, 1, 0, 0},
-       {"fields",      'f', POPT_ARG_VAL, &opt_fields, 1, 0, 0},
-       {"syscall",     'S', POPT_ARG_VAL, &opt_syscall, 1, 0, 0},
-       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0 },
+       { "jul", 'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0 },
+       { "log4j", 'l', POPT_ARG_VAL, &opt_log4j, 1, 0, 0 },
+       { "python", 'p', POPT_ARG_VAL, &opt_python, 1, 0, 0 },
+       { "userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0 },
+       { "channel", 'c', POPT_ARG_STRING, &opt_channel, 0, 0, 0 },
+       { "domain", 'd', POPT_ARG_VAL, &opt_domain, 1, 0, 0 },
+       { "fields", 'f', POPT_ARG_VAL, &opt_fields, 1, 0, 0 },
+       { "syscall", 'S', POPT_ARG_VAL, &opt_syscall, 1, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 /*
@@ -109,14 +110,17 @@ end:
        return cmdline;
 }
 
-static
-const char *active_string(int value)
+static const char *active_string(int value)
 {
        switch (value) {
-       case 0: return "inactive";
-       case 1: return "active";
-       case -1: return "";
-       default: return NULL;
+       case 0:
+               return "inactive";
+       case 1:
+               return "active";
+       case -1:
+               return "";
+       default:
+               return NULL;
        }
 }
 
@@ -130,19 +134,21 @@ static const char *snapshot_string(int value)
        }
 }
 
-static
-const char *enabled_string(int value)
+static const char *enabled_string(int value)
 {
        switch (value) {
-       case 0: return " [disabled]";
-       case 1: return " [enabled]";
-       case -1: return "";
-       default: return NULL;
+       case 0:
+               return " [disabled]";
+       case 1:
+               return " [enabled]";
+       case -1:
+               return "";
+       default:
+               return NULL;
        }
 }
 
-static
-const char *safe_string(const char *str)
+static const char *safe_string(const char *str)
 {
        return str ? str : "";
 }
@@ -188,7 +194,7 @@ static char *get_exclusion_names_msg(struct lttng_event *event)
        char *exclusion_msg = NULL;
        char *at;
        size_t i;
-       const char * const exclusion_fmt = " [exclusions: ";
+       const char *const exclusion_fmt = " [exclusions: ";
        const size_t exclusion_fmt_len = strlen(exclusion_fmt);
 
        exclusion_count = lttng_event_get_exclusion_name_count(event);
@@ -208,9 +214,8 @@ static char *get_exclusion_names_msg(struct lttng_event *event)
         * a comma per entry, the entry count (fixed-size), a closing
         * bracket, and a trailing \0.
         */
-       exclusion_msg = (char *) malloc(exclusion_count +
-                       exclusion_count * LTTNG_SYMBOL_NAME_LEN +
-                       exclusion_fmt_len + 1);
+       exclusion_msg = (char *) malloc(exclusion_count + exclusion_count * LTTNG_SYMBOL_NAME_LEN +
+                                       exclusion_fmt_len + 1);
        if (!exclusion_msg) {
                goto end;
        }
@@ -277,7 +282,8 @@ static void print_userspace_probe_location(struct lttng_event *event)
 
                MSG("%sType: Function", indent8);
                function_name = lttng_userspace_probe_location_function_get_function_name(location);
-               binary_path = realpath(lttng_userspace_probe_location_function_get_binary_path(location), NULL);
+               binary_path = realpath(
+                       lttng_userspace_probe_location_function_get_binary_path(location), NULL);
 
                MSG("%sBinary path:   %s", indent8, binary_path ? binary_path : "NULL");
                MSG("%sFunction:      %s()", indent8, function_name ? function_name : "NULL");
@@ -303,10 +309,15 @@ static void print_userspace_probe_location(struct lttng_event *event)
 
                MSG("%sType: Tracepoint", indent8);
                probe_name = lttng_userspace_probe_location_tracepoint_get_probe_name(location);
-               provider_name = lttng_userspace_probe_location_tracepoint_get_provider_name(location);
-               binary_path = realpath(lttng_userspace_probe_location_tracepoint_get_binary_path(location), NULL);
+               provider_name =
+                       lttng_userspace_probe_location_tracepoint_get_provider_name(location);
+               binary_path = realpath(
+                       lttng_userspace_probe_location_tracepoint_get_binary_path(location), NULL);
                MSG("%sBinary path:   %s", indent8, binary_path ? binary_path : "NULL");
-               MSG("%sTracepoint:    %s:%s", indent8, provider_name ? provider_name : "NULL", probe_name ? probe_name : "NULL");
+               MSG("%sTracepoint:    %s:%s",
+                   indent8,
+                   provider_name ? provider_name : "NULL",
+                   probe_name ? probe_name : "NULL");
                switch (lookup_type) {
                case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT:
                        MSG("%sLookup method: SDT", indent8);
@@ -354,30 +365,30 @@ static void print_events(struct lttng_event *event)
        {
                if (event->loglevel != -1) {
                        MSG("%s%s (loglevel%s %s (%d)) (type: tracepoint)%s%s%s",
-                                       indent6, event->name,
-                                       logleveltype_string(
-                                                       event->loglevel_type),
-                                       mi_lttng_loglevel_string(
-                                                       event->loglevel,
-                                                       the_handle->domain.type),
-                                       event->loglevel,
-                                       enabled_string(event->enabled),
-                                       safe_string(exclusion_msg),
-                                       safe_string(filter_msg));
+                           indent6,
+                           event->name,
+                           logleveltype_string(event->loglevel_type),
+                           mi_lttng_loglevel_string(event->loglevel, the_handle->domain.type),
+                           event->loglevel,
+                           enabled_string(event->enabled),
+                           safe_string(exclusion_msg),
+                           safe_string(filter_msg));
                } else {
                        MSG("%s%s (type: tracepoint)%s%s%s",
-                               indent6,
-                               event->name,
-                               enabled_string(event->enabled),
-                               safe_string(exclusion_msg),
-                               safe_string(filter_msg));
+                           indent6,
+                           event->name,
+                           enabled_string(event->enabled),
+                           safe_string(exclusion_msg),
+                           safe_string(filter_msg));
                }
                break;
        }
        case LTTNG_EVENT_FUNCTION:
-               MSG("%s%s (type: function)%s%s", indent6,
-                               event->name, enabled_string(event->enabled),
-                               safe_string(filter_msg));
+               MSG("%s%s (type: function)%s%s",
+                   indent6,
+                   event->name,
+                   enabled_string(event->enabled),
+                   safe_string(filter_msg));
                if (event->attr.probe.addr != 0) {
                        MSG("%saddr: 0x%" PRIx64, indent8, event->attr.probe.addr);
                } else {
@@ -386,9 +397,11 @@ static void print_events(struct lttng_event *event)
                }
                break;
        case LTTNG_EVENT_PROBE:
-               MSG("%s%s (type: probe)%s%s", indent6,
-                               event->name, enabled_string(event->enabled),
-                               safe_string(filter_msg));
+               MSG("%s%s (type: probe)%s%s",
+                   indent6,
+                   event->name,
+                   enabled_string(event->enabled),
+                   safe_string(filter_msg));
                if (event->attr.probe.addr != 0) {
                        MSG("%saddr: 0x%" PRIx64, indent8, event->attr.probe.addr);
                } else {
@@ -400,22 +413,27 @@ static void print_events(struct lttng_event *event)
                print_userspace_probe_location(event);
                break;
        case LTTNG_EVENT_FUNCTION_ENTRY:
-               MSG("%s%s (type: function)%s%s", indent6,
-                               event->name, enabled_string(event->enabled),
-                               safe_string(filter_msg));
+               MSG("%s%s (type: function)%s%s",
+                   indent6,
+                   event->name,
+                   enabled_string(event->enabled),
+                   safe_string(filter_msg));
                MSG("%ssymbol: \"%s\"", indent8, event->attr.ftrace.symbol_name);
                break;
        case LTTNG_EVENT_SYSCALL:
-               MSG("%s%s%s%s%s%s", indent6, event->name,
-                               (opt_syscall ? "" : " (type:syscall)"),
-                               enabled_string(event->enabled),
-                               bitness_event(event->flags),
-                               safe_string(filter_msg));
+               MSG("%s%s%s%s%s%s",
+                   indent6,
+                   event->name,
+                   (opt_syscall ? "" : " (type:syscall)"),
+                   enabled_string(event->enabled),
+                   bitness_event(event->flags),
+                   safe_string(filter_msg));
                break;
        case LTTNG_EVENT_NOOP:
-               MSG("%s (type: noop)%s%s", indent6,
-                               enabled_string(event->enabled),
-                               safe_string(filter_msg));
+               MSG("%s (type: noop)%s%s",
+                   indent6,
+                   enabled_string(event->enabled),
+                   safe_string(filter_msg));
                break;
        case LTTNG_EVENT_ALL:
                /* Fall-through. */
@@ -431,7 +449,7 @@ static void print_events(struct lttng_event *event)
 
 static const char *field_type(struct lttng_event_field *field)
 {
-       switch(field->type) {
+       switch (field->type) {
        case LTTNG_EVENT_FIELD_INTEGER:
                return "integer";
        case LTTNG_EVENT_FIELD_ENUM:
@@ -441,7 +459,7 @@ static const char *field_type(struct lttng_event_field *field)
        case LTTNG_EVENT_FIELD_STRING:
                return "string";
        case LTTNG_EVENT_FIELD_OTHER:
-       default:        /* fall-through */
+       default: /* fall-through */
                return "unknown";
        }
 }
@@ -454,16 +472,19 @@ static void print_event_field(struct lttng_event_field *field)
        if (!field->field_name[0]) {
                return;
        }
-       MSG("%sfield: %s (%s)%s", indent8, field->field_name,
-               field_type(field), field->nowrite ? " [no write]" : "");
+       MSG("%sfield: %s (%s)%s",
+           indent8,
+           field->field_name,
+           field_type(field),
+           field->nowrite ? " [no write]" : "");
 }
 
 /*
  * Machine interface
  * Jul and ust event listing
  */
-static int mi_list_agent_ust_events(struct lttng_event *events, int count,
-               struct lttng_domain *domain)
+static int
+mi_list_agent_ust_events(struct lttng_event *events, int count, struct lttng_domain *domain)
 {
        int ret, i;
        pid_t cur_pid = 0;
@@ -492,8 +513,7 @@ static int mi_list_agent_ust_events(struct lttng_event *events, int count,
                if (cur_pid != events[i].pid) {
                        if (pid_element_open) {
                                /* Close the previous events and pid element */
-                               ret = mi_lttng_close_multi_element(
-                                               the_writer, 2);
+                               ret = mi_lttng_close_multi_element(the_writer, 2);
                                if (ret) {
                                        goto end;
                                }
@@ -509,8 +529,7 @@ static int mi_list_agent_ust_events(struct lttng_event *events, int count,
 
                        if (!pid_element_open) {
                                /* Open and write a pid element */
-                               ret = mi_lttng_pid(the_writer, cur_pid, cmdline,
-                                               1);
+                               ret = mi_lttng_pid(the_writer, cur_pid, cmdline, 1);
                                if (ret) {
                                        goto error;
                                }
@@ -527,8 +546,7 @@ static int mi_list_agent_ust_events(struct lttng_event *events, int count,
                }
 
                /* Write an event */
-               ret = mi_lttng_event(the_writer, &events[i], 0,
-                               the_handle->domain.type);
+               ret = mi_lttng_event(the_writer, &events[i], 0, the_handle->domain.type);
                if (ret) {
                        goto end;
                }
@@ -584,8 +602,7 @@ static int list_agent_events(void)
 
        size = lttng_list_tracepoints(handle, &event_list);
        if (size < 0) {
-               ERR("Unable to list %s events: %s", agent_domain_str,
-                               lttng_strerror(size));
+               ERR("Unable to list %s events: %s", agent_domain_str, lttng_strerror(size));
                ret = CMD_ERROR;
                goto end;
        }
@@ -599,8 +616,7 @@ static int list_agent_events(void)
                }
        } else {
                /* Pretty print */
-               MSG("%s events (Logger name):\n-------------------------",
-                               agent_domain_str);
+               MSG("%s events (Logger name):\n-------------------------", agent_domain_str);
 
                if (size == 0) {
                        MSG("None");
@@ -700,8 +716,8 @@ end:
  * Machine interface
  * List all ust event with their fields
  */
-static int mi_list_ust_event_fields(struct lttng_event_field *fields, int count,
-               struct lttng_domain *domain)
+static int
+mi_list_ust_event_fields(struct lttng_event_field *fields, int count, struct lttng_domain *domain)
 {
        int ret, i;
        pid_t cur_pid = 0;
@@ -735,16 +751,14 @@ static int mi_list_ust_event_fields(struct lttng_event_field *fields, int count,
                        if (pid_element_open) {
                                if (event_element_open) {
                                        /* Close the previous field element and event. */
-                                       ret = mi_lttng_close_multi_element(
-                                                       the_writer, 2);
+                                       ret = mi_lttng_close_multi_element(the_writer, 2);
                                        if (ret) {
                                                goto end;
                                        }
                                        event_element_open = 0;
                                }
                                /* Close the previous events, pid element */
-                               ret = mi_lttng_close_multi_element(
-                                               the_writer, 2);
+                               ret = mi_lttng_close_multi_element(the_writer, 2);
                                if (ret) {
                                        goto end;
                                }
@@ -755,8 +769,7 @@ static int mi_list_ust_event_fields(struct lttng_event_field *fields, int count,
                        cmdline = get_cmdline_by_pid(cur_pid);
                        if (!pid_element_open) {
                                /* Open and write a pid element */
-                               ret = mi_lttng_pid(the_writer, cur_pid, cmdline,
-                                               1);
+                               ret = mi_lttng_pid(the_writer, cur_pid, cmdline, 1);
                                if (ret) {
                                        goto error;
                                }
@@ -776,21 +789,19 @@ static int mi_list_ust_event_fields(struct lttng_event_field *fields, int count,
                if (strcmp(cur_event.name, fields[i].event.name) != 0) {
                        if (event_element_open) {
                                /* Close the previous fields element and the previous event */
-                               ret = mi_lttng_close_multi_element(
-                                               the_writer, 2);
+                               ret = mi_lttng_close_multi_element(the_writer, 2);
                                if (ret) {
                                        goto end;
                                }
                                event_element_open = 0;
                        }
 
-                       memcpy(&cur_event, &fields[i].event,
-                                       sizeof(cur_event));
+                       memcpy(&cur_event, &fields[i].event, sizeof(cur_event));
 
                        if (!event_element_open) {
                                /* Open and write the event */
-                               ret = mi_lttng_event(the_writer, &cur_event, 1,
-                                               the_handle->domain.type);
+                               ret = mi_lttng_event(
+                                       the_writer, &cur_event, 1, the_handle->domain.type);
                                if (ret) {
                                        goto end;
                                }
@@ -884,8 +895,7 @@ static int list_ust_event_fields(void)
                        }
                        if (strcmp(cur_event.name, event_field_list[i].event.name) != 0) {
                                print_events(&event_field_list[i].event);
-                               memcpy(&cur_event, &event_field_list[i].event,
-                                               sizeof(cur_event));
+                               memcpy(&cur_event, &event_field_list[i].event, sizeof(cur_event));
                        }
                        print_event_field(&event_field_list[i]);
                }
@@ -904,8 +914,7 @@ end:
  * Machine interface
  * Print a list of kernel events
  */
-static int mi_list_kernel_events(struct lttng_event *events, int count,
-               struct lttng_domain *domain)
+static int mi_list_kernel_events(struct lttng_event *events, int count, struct lttng_domain *domain)
 {
        int ret, i;
 
@@ -928,8 +937,7 @@ static int mi_list_kernel_events(struct lttng_event *events, int count,
        }
 
        for (i = 0; i < count; i++) {
-               ret = mi_lttng_event(the_writer, &events[i], 0,
-                               the_handle->domain.type);
+               ret = mi_lttng_event(the_writer, &events[i], 0, the_handle->domain.type);
                if (ret) {
                        goto end;
                }
@@ -1017,8 +1025,7 @@ static int mi_list_syscalls(struct lttng_event *events, int count)
        }
 
        for (i = 0; i < count; i++) {
-               ret = mi_lttng_event(the_writer, &events[i], 0,
-                               the_handle->domain.type);
+               ret = mi_lttng_event(the_writer, &events[i], 0, the_handle->domain.type);
                if (ret) {
                        goto end;
                }
@@ -1091,8 +1098,7 @@ static int mi_list_session_agent_events(struct lttng_event *events, int count)
        }
 
        for (i = 0; i < count; i++) {
-               ret = mi_lttng_event(the_writer, &events[i], 0,
-                               the_handle->domain.type);
+               ret = mi_lttng_event(the_writer, &events[i], 0, the_handle->domain.type);
                if (ret) {
                        goto end;
                }
@@ -1142,8 +1148,7 @@ static int list_session_agent_events(void)
                        char *filter_msg = NULL;
                        struct lttng_event *event = &events[i];
 
-                       ret = lttng_event_get_filter_expression(event,
-                                       &filter_str);
+                       ret = lttng_event_get_filter_expression(event, &filter_str);
                        if (ret) {
                                filter_msg = strdup(" [failed to retrieve filter]");
                        } else if (filter_str) {
@@ -1152,22 +1157,21 @@ static int list_session_agent_events(void)
                                }
                        }
 
-                       if (event->loglevel_type !=
-                                       LTTNG_EVENT_LOGLEVEL_ALL) {
-                               MSG("%s- %s%s (loglevel%s %s)%s", indent4,
-                                               event->name,
-                                               enabled_string(event->enabled),
-                                               logleveltype_string(
-                                                               event->loglevel_type),
-                                               mi_lttng_loglevel_string(
-                                                               event->loglevel,
-                                                               the_handle->domain
-                                                                               .type),
-                                               safe_string(filter_msg));
+                       if (event->loglevel_type != LTTNG_EVENT_LOGLEVEL_ALL) {
+                               MSG("%s- %s%s (loglevel%s %s)%s",
+                                   indent4,
+                                   event->name,
+                                   enabled_string(event->enabled),
+                                   logleveltype_string(event->loglevel_type),
+                                   mi_lttng_loglevel_string(event->loglevel,
+                                                            the_handle->domain.type),
+                                   safe_string(filter_msg));
                        } else {
-                               MSG("%s- %s%s%s", indent4, event->name,
-                                               enabled_string(event->enabled),
-                                               safe_string(filter_msg));
+                               MSG("%s- %s%s%s",
+                                   indent4,
+                                   event->name,
+                                   enabled_string(event->enabled),
+                                   safe_string(filter_msg));
                        }
                        free(filter_msg);
                }
@@ -1196,8 +1200,7 @@ static int mi_list_events(struct lttng_event *events, int count)
        }
 
        for (i = 0; i < count; i++) {
-               ret = mi_lttng_event(the_writer, &events[i], 0,
-                               the_handle->domain.type);
+               ret = mi_lttng_event(the_writer, &events[i], 0, the_handle->domain.type);
                if (ret) {
                        goto end;
                }
@@ -1252,8 +1255,7 @@ error:
        return ret;
 }
 
-static
-void print_timer(const char *timer_name, uint32_t space_count, int64_t value)
+static void print_timer(const char *timer_name, uint32_t space_count, int64_t value)
 {
        uint32_t i;
 
@@ -1278,29 +1280,25 @@ static void print_channel(struct lttng_channel *channel)
        uint64_t discarded_events, lost_packets, monitor_timer_interval;
        int64_t blocking_timeout;
 
-       ret = lttng_channel_get_discarded_event_count(channel,
-                       &discarded_events);
+       ret = lttng_channel_get_discarded_event_count(channel, &discarded_events);
        if (ret) {
                ERR("Failed to retrieve discarded event count of channel");
                return;
        }
 
-       ret = lttng_channel_get_lost_packet_count(channel,
-                       &lost_packets);
+       ret = lttng_channel_get_lost_packet_count(channel, &lost_packets);
        if (ret) {
                ERR("Failed to retrieve lost packet count of channel");
                return;
        }
 
-       ret = lttng_channel_get_monitor_timer_interval(channel,
-                       &monitor_timer_interval);
+       ret = lttng_channel_get_monitor_timer_interval(channel, &monitor_timer_interval);
        if (ret) {
                ERR("Failed to retrieve monitor interval of channel");
                return;
        }
 
-       ret = lttng_channel_get_blocking_timeout(channel,
-                       &blocking_timeout);
+       ret = lttng_channel_get_blocking_timeout(channel, &blocking_timeout);
        if (ret) {
                ERR("Failed to retrieve blocking timeout of channel");
                return;
@@ -1313,34 +1311,35 @@ static void print_channel(struct lttng_channel *channel)
        MSG("%sSub-buffer count: %" PRIu64, indent6, channel->attr.num_subbuf);
 
        print_timer("Switch timer", 5, channel->attr.switch_timer_interval);
-       print_timer("Read timer",  7, channel->attr.read_timer_interval);
+       print_timer("Read timer", 7, channel->attr.read_timer_interval);
        print_timer("Monitor timer", 4, monitor_timer_interval);
 
        if (!channel->attr.overwrite) {
                if (blocking_timeout == -1) {
                        MSG("%sBlocking timeout: infinite", indent6);
                } else {
-                       MSG("%sBlocking timeout: %" PRId64 " %s", indent6,
-                                       blocking_timeout, USEC_UNIT);
+                       MSG("%sBlocking timeout: %" PRId64 " %s",
+                           indent6,
+                           blocking_timeout,
+                           USEC_UNIT);
                }
        }
 
-       MSG("%sTrace file count: %" PRIu64 " per stream", indent6,
-                       channel->attr.tracefile_count == 0 ?
-                               1 : channel->attr.tracefile_count);
-       if (channel->attr.tracefile_size != 0 ) {
-               MSG("%sTrace file size:  %" PRIu64 " bytes", indent6,
-                               channel->attr.tracefile_size);
+       MSG("%sTrace file count: %" PRIu64 " per stream",
+           indent6,
+           channel->attr.tracefile_count == 0 ? 1 : channel->attr.tracefile_count);
+       if (channel->attr.tracefile_size != 0) {
+               MSG("%sTrace file size:  %" PRIu64 " bytes", indent6, channel->attr.tracefile_size);
        } else {
                MSG("%sTrace file size:  %s", indent6, "unlimited");
        }
        switch (channel->attr.output) {
-               case LTTNG_EVENT_SPLICE:
-                       MSG("%sOutput mode:      splice", indent6);
-                       break;
-               case LTTNG_EVENT_MMAP:
-                       MSG("%sOutput mode:      mmap", indent6);
-                       break;
+       case LTTNG_EVENT_SPLICE:
+               MSG("%sOutput mode:      splice", indent6);
+               break;
+       case LTTNG_EVENT_MMAP:
+               MSG("%sOutput mode:      mmap", indent6);
+               break;
        }
 
        MSG("\n%sStatistics:", indent4);
@@ -1376,8 +1375,7 @@ skip_stats_printing:
  * Print a list of channel
  *
  */
-static int mi_list_channels(struct lttng_channel *channels, int count,
-               const char *channel_name)
+static int mi_list_channels(struct lttng_channel *channels, int count, const char *channel_name)
 {
        int i, ret;
        unsigned int chan_found = 0;
@@ -1441,7 +1439,7 @@ static int list_channels(const char *channel_name)
        unsigned int chan_found = 0;
        struct lttng_channel *channels = NULL;
 
-       DBG("Listing channel(s) (%s)", channel_name ? : "<all>");
+       DBG("Listing channel(s) (%s)", channel_name ?: "<all>");
 
        count = lttng_list_channels(the_handle, &channels);
        if (count < 0) {
@@ -1534,7 +1532,7 @@ static const char *get_capitalized_process_attr_str(enum lttng_process_attr proc
 }
 
 static int handle_process_attr_status(enum lttng_process_attr process_attr,
-               enum lttng_process_attr_tracker_handle_status status)
+                                     enum lttng_process_attr_tracker_handle_status status)
 {
        int ret = CMD_SUCCESS;
 
@@ -1545,18 +1543,18 @@ static int handle_process_attr_status(enum lttng_process_attr process_attr,
                break;
        case LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_COMMUNICATION_ERROR:
                ERR("Communication occurred while fetching %s tracker",
-                               lttng_process_attr_to_string(process_attr));
+                   lttng_process_attr_to_string(process_attr));
                ret = CMD_ERROR;
                break;
        case LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_SESSION_DOES_NOT_EXIST:
                ERR("Failed to get the inclusion set of the %s tracker: session `%s` no longer exists",
-                               lttng_process_attr_to_string(process_attr),
-                               the_handle->session_name);
+                   lttng_process_attr_to_string(process_attr),
+                   the_handle->session_name);
                ret = CMD_ERROR;
                break;
        default:
                ERR("Unknown error occurred while fetching the inclusion set of the %s tracker",
-                               lttng_process_attr_to_string(process_attr));
+                   lttng_process_attr_to_string(process_attr));
                ret = CMD_ERROR;
                break;
        }
@@ -1578,11 +1576,10 @@ end:
        return ret;
 }
 
-static inline bool is_value_type_name(
-               enum lttng_process_attr_value_type value_type)
+static inline bool is_value_type_name(enum lttng_process_attr_value_type value_type)
 {
        return value_type == LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME ||
-              value_type == LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME;
+               value_type == LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME;
 }
 
 /*
@@ -1599,24 +1596,23 @@ static int list_process_attr_tracker(enum lttng_process_attr process_attr)
        const struct lttng_process_attr_values *values;
        struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
 
-       ret_code = lttng_session_get_tracker_handle(the_handle->session_name,
-                       the_handle->domain.type, process_attr, &tracker_handle);
+       ret_code = lttng_session_get_tracker_handle(
+               the_handle->session_name, the_handle->domain.type, process_attr, &tracker_handle);
        if (ret_code != LTTNG_OK) {
-               ERR("Failed to get process attribute tracker handle: %s",
-                               lttng_strerror(ret_code));
+               ERR("Failed to get process attribute tracker handle: %s", lttng_strerror(ret_code));
                ret = CMD_ERROR;
                goto end;
        }
 
-       handle_status = lttng_process_attr_tracker_handle_get_inclusion_set(
-                       tracker_handle, &values);
+       handle_status =
+               lttng_process_attr_tracker_handle_get_inclusion_set(tracker_handle, &values);
        ret = handle_process_attr_status(process_attr, handle_status);
        if (ret != CMD_SUCCESS) {
                goto end;
        }
 
-       handle_status = lttng_process_attr_tracker_handle_get_tracking_policy(
-                       tracker_handle, &policy);
+       handle_status =
+               lttng_process_attr_tracker_handle_get_tracking_policy(tracker_handle, &policy);
        ret = handle_process_attr_status(process_attr, handle_status);
        if (ret != CMD_SUCCESS) {
                goto end;
@@ -1624,8 +1620,8 @@ static int list_process_attr_tracker(enum lttng_process_attr process_attr)
 
        {
                char *process_attr_name;
-               const int print_ret = asprintf(&process_attr_name, "%ss:",
-                               get_capitalized_process_attr_str(process_attr));
+               const int print_ret = asprintf(
+                       &process_attr_name, "%ss:", get_capitalized_process_attr_str(process_attr));
 
                if (print_ret == -1) {
                        ret = CMD_FATAL;
@@ -1650,8 +1646,8 @@ static int list_process_attr_tracker(enum lttng_process_attr process_attr)
                goto end;
        default:
                ERR("Unknown tracking policy encoutered while listing the %s process attribute tracker of session `%s`",
-                               lttng_process_attr_to_string(process_attr),
-                               the_handle->session_name);
+                   lttng_process_attr_to_string(process_attr),
+                   the_handle->session_name);
                ret = CMD_FATAL;
                goto end;
        }
@@ -1659,8 +1655,8 @@ static int list_process_attr_tracker(enum lttng_process_attr process_attr)
        values_status = lttng_process_attr_values_get_count(values, &count);
        if (values_status != LTTNG_PROCESS_ATTR_VALUES_STATUS_OK) {
                ERR("Failed to get the count of values in the inclusion set of the %s process attribute tracker of session `%s`",
-                               lttng_process_attr_to_string(process_attr),
-                               the_handle->session_name);
+                   lttng_process_attr_to_string(process_attr),
+                   the_handle->session_name);
                ret = CMD_FATAL;
                goto end;
        }
@@ -1678,8 +1674,7 @@ static int list_process_attr_tracker(enum lttng_process_attr process_attr)
        /* Mi tracker_id element */
        if (the_writer) {
                /* Open tracker_id and targets elements */
-               ret = mi_lttng_process_attribute_tracker_open(
-                               the_writer, process_attr);
+               ret = mi_lttng_process_attribute_tracker_open(the_writer, process_attr);
                if (ret) {
                        goto end;
                }
@@ -1687,8 +1682,7 @@ static int list_process_attr_tracker(enum lttng_process_attr process_attr)
 
        for (i = 0; i < count; i++) {
                const enum lttng_process_attr_value_type value_type =
-                               lttng_process_attr_values_get_type_at_index(
-                                               values, i);
+                       lttng_process_attr_values_get_type_at_index(values, i);
                int64_t integral_value = INT64_MAX;
                const char *name = "error";
 
@@ -1700,8 +1694,7 @@ static int list_process_attr_tracker(enum lttng_process_attr process_attr)
                {
                        pid_t pid;
 
-                       values_status = lttng_process_attr_values_get_pid_at_index(
-                                       values, i, &pid);
+                       values_status = lttng_process_attr_values_get_pid_at_index(values, i, &pid);
                        integral_value = (int64_t) pid;
                        break;
                }
@@ -1709,8 +1702,7 @@ static int list_process_attr_tracker(enum lttng_process_attr process_attr)
                {
                        uid_t uid;
 
-                       values_status = lttng_process_attr_values_get_uid_at_index(
-                                       values, i, &uid);
+                       values_status = lttng_process_attr_values_get_uid_at_index(values, i, &uid);
                        integral_value = (int64_t) uid;
                        break;
                }
@@ -1718,18 +1710,17 @@ static int list_process_attr_tracker(enum lttng_process_attr process_attr)
                {
                        gid_t gid;
 
-                       values_status = lttng_process_attr_values_get_gid_at_index(
-                                       values, i, &gid);
+                       values_status = lttng_process_attr_values_get_gid_at_index(values, i, &gid);
                        integral_value = (int64_t) gid;
                        break;
                }
                case LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME:
-                       values_status = lttng_process_attr_values_get_user_name_at_index(
-                                       values, i, &name);
+                       values_status =
+                               lttng_process_attr_values_get_user_name_at_index(values, i, &name);
                        break;
                case LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME:
-                       values_status = lttng_process_attr_values_get_group_name_at_index(
-                                       values, i, &name);
+                       values_status =
+                               lttng_process_attr_values_get_group_name_at_index(values, i, &name);
                        break;
                default:
                        ret = CMD_ERROR;
@@ -1755,14 +1746,10 @@ static int list_process_attr_tracker(enum lttng_process_attr process_attr)
                /* Mi */
                if (the_writer) {
                        ret = is_value_type_name(value_type) ?
-                                             mi_lttng_string_process_attribute_value(
-                                                       the_writer,
-                                                       process_attr, name,
-                                                       false) :
-                                             mi_lttng_integral_process_attribute_value(
-                                                       the_writer,
-                                                       process_attr,
-                                                       integral_value, false);
+                               mi_lttng_string_process_attribute_value(
+                                       the_writer, process_attr, name, false) :
+                               mi_lttng_integral_process_attribute_value(
+                                       the_writer, process_attr, integral_value, false);
                        if (ret) {
                                goto end;
                        }
@@ -1806,8 +1793,7 @@ static int list_trackers(const struct lttng_domain *domain)
                        goto end;
                }
                /* vpid tracker */
-               ret = list_process_attr_tracker(
-                               LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID);
+               ret = list_process_attr_tracker(LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID);
                if (ret) {
                        goto end;
                }
@@ -1817,8 +1803,7 @@ static int list_trackers(const struct lttng_domain *domain)
                        goto end;
                }
                /* vuid tracker */
-               ret = list_process_attr_tracker(
-                               LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID);
+               ret = list_process_attr_tracker(LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID);
                if (ret) {
                        goto end;
                }
@@ -1828,28 +1813,24 @@ static int list_trackers(const struct lttng_domain *domain)
                        goto end;
                }
                /* vgid tracker */
-               ret = list_process_attr_tracker(
-                               LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID);
+               ret = list_process_attr_tracker(LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID);
                if (ret) {
                        goto end;
                }
                break;
        case LTTNG_DOMAIN_UST:
                /* vpid tracker */
-               ret = list_process_attr_tracker(
-                               LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID);
+               ret = list_process_attr_tracker(LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID);
                if (ret) {
                        goto end;
                }
                /* vuid tracker */
-               ret = list_process_attr_tracker(
-                               LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID);
+               ret = list_process_attr_tracker(LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID);
                if (ret) {
                        goto end;
                }
                /* vgid tracker */
-               ret = list_process_attr_tracker(
-                               LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID);
+               ret = list_process_attr_tracker(LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID);
                if (ret) {
                        goto end;
                }
@@ -1870,50 +1851,47 @@ end:
        return ret;
 }
 
-static enum cmd_error_code print_periodic_rotation_schedule(
-               const struct lttng_rotation_schedule *schedule)
+static enum cmd_error_code
+print_periodic_rotation_schedule(const struct lttng_rotation_schedule *schedule)
 {
        enum cmd_error_code ret;
        enum lttng_rotation_status status;
        uint64_t value;
 
-       status = lttng_rotation_schedule_periodic_get_period(schedule,
-                       &value);
+       status = lttng_rotation_schedule_periodic_get_period(schedule, &value);
        if (status != LTTNG_ROTATION_STATUS_OK) {
                ERR("Failed to retrieve period parameter from periodic rotation schedule.");
                ret = CMD_ERROR;
                goto end;
        }
 
-       MSG("    timer period: %" PRIu64" %s", value, USEC_UNIT);
+       MSG("    timer period: %" PRIu64 " %s", value, USEC_UNIT);
        ret = CMD_SUCCESS;
 end:
        return ret;
 }
 
-static enum cmd_error_code print_size_threshold_rotation_schedule(
-               const struct lttng_rotation_schedule *schedule)
+static enum cmd_error_code
+print_size_threshold_rotation_schedule(const struct lttng_rotation_schedule *schedule)
 {
        enum cmd_error_code ret;
        enum lttng_rotation_status status;
        uint64_t value;
 
-       status = lttng_rotation_schedule_size_threshold_get_threshold(schedule,
-                       &value);
+       status = lttng_rotation_schedule_size_threshold_get_threshold(schedule, &value);
        if (status != LTTNG_ROTATION_STATUS_OK) {
                ERR("Failed to retrieve size parameter from size-based rotation schedule.");
                ret = CMD_ERROR;
                goto end;
        }
 
-       MSG("    size threshold: %" PRIu64" bytes", value);
+       MSG("    size threshold: %" PRIu64 " bytes", value);
        ret = CMD_SUCCESS;
 end:
        return ret;
 }
 
-static enum cmd_error_code print_rotation_schedule(
-               const struct lttng_rotation_schedule *schedule)
+static enum cmd_error_code print_rotation_schedule(const struct lttng_rotation_schedule *schedule)
 {
        enum cmd_error_code ret;
 
@@ -1962,8 +1940,7 @@ static enum cmd_error_code list_rotate_settings(const char *session_name)
 
        MSG("Automatic rotation schedules:");
        if (lttng_opt_mi) {
-               ret = mi_lttng_writer_open_element(the_writer,
-                               mi_lttng_element_rotation_schedules);
+               ret = mi_lttng_writer_open_element(the_writer, mi_lttng_element_rotation_schedules);
                if (ret) {
                        cmd_ret = CMD_ERROR;
                        goto end;
@@ -2016,8 +1993,7 @@ end:
  * Find the session with session_name as name
  * and print his informations.
  */
-static int mi_list_session(const char *session_name,
-               struct lttng_session *sessions, int count)
+static int mi_list_session(const char *session_name, struct lttng_session *sessions, int count)
 {
        int ret, i;
        unsigned int session_found = 0;
@@ -2130,29 +2106,34 @@ static int list_sessions(const char *session_name)
                        if (session_name != NULL) {
                                if (strncmp(sessions[i].name, session_name, NAME_MAX) == 0) {
                                        session_found = 1;
-                                       MSG("Recording session %s: [%s%s]", session_name,
-                                                       active_string(sessions[i].enabled),
-                                                       snapshot_string(sessions[i].snapshot_mode));
+                                       MSG("Recording session %s: [%s%s]",
+                                           session_name,
+                                           active_string(sessions[i].enabled),
+                                           snapshot_string(sessions[i].snapshot_mode));
                                        if (*sessions[i].path) {
-                                               MSG("%sTrace output: %s\n", indent4, sessions[i].path);
+                                               MSG("%sTrace output: %s\n",
+                                                   indent4,
+                                                   sessions[i].path);
                                        }
                                        memcpy(&the_listed_session,
-                                                       &sessions[i],
-                                                       sizeof(the_listed_session));
+                                              &sessions[i],
+                                              sizeof(the_listed_session));
                                        break;
                                }
                        } else {
-                               MSG("  %d) %s [%s%s]", i + 1,
-                                               sessions[i].name,
-                                               active_string(sessions[i].enabled),
-                                               snapshot_string(sessions[i].snapshot_mode));
+                               MSG("  %d) %s [%s%s]",
+                                   i + 1,
+                                   sessions[i].name,
+                                   active_string(sessions[i].enabled),
+                                   snapshot_string(sessions[i].snapshot_mode));
                                if (*sessions[i].path) {
                                        MSG("%sTrace output: %s", indent4, sessions[i].path);
                                }
                                if (sessions[i].live_timer_interval != 0) {
-                                       MSG("%sLive timer interval: %u %s", indent4,
-                                                       sessions[i].live_timer_interval,
-                                                       USEC_UNIT);
+                                       MSG("%sLive timer interval: %u %s",
+                                           indent4,
+                                           sessions[i].live_timer_interval,
+                                           USEC_UNIT);
                                }
                                MSG("");
                        }
@@ -2174,7 +2155,6 @@ end:
        return ret;
 }
 
-
 /*
  * Machine Interface
  * list available domain(s) for a session.
@@ -2212,7 +2192,6 @@ static int list_domains(const char *session_name)
        int i, count, ret = CMD_SUCCESS;
        struct lttng_domain *domains = NULL;
 
-
        count = lttng_list_domains(session_name, &domains);
        if (count < 0) {
                ret = CMD_ERROR;
@@ -2305,24 +2284,21 @@ int cmd_list(int argc, const char **argv)
 
        /* Mi check */
        if (lttng_opt_mi) {
-               the_writer = mi_lttng_writer_create(
-                               fileno(stdout), lttng_opt_mi);
+               the_writer = mi_lttng_writer_create(fileno(stdout), lttng_opt_mi);
                if (!the_writer) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open command element */
-               ret = mi_lttng_writer_command_open(
-                               the_writer, mi_lttng_element_command_list);
+               ret = mi_lttng_writer_command_open(the_writer, mi_lttng_element_command_list);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(
-                               the_writer, mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(the_writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -2369,8 +2345,7 @@ int cmd_list(int argc, const char **argv)
        }
 
        if (arg_session_name == NULL) {
-               if (!opt_kernel && !opt_userspace && !opt_jul && !opt_log4j
-                               && !opt_python) {
+               if (!opt_kernel && !opt_userspace && !opt_jul && !opt_log4j && !opt_python) {
                        ret = list_sessions(NULL);
                        if (ret) {
                                goto end;
@@ -2449,10 +2424,8 @@ int cmd_list(int argc, const char **argv)
                                if (ret) {
                                        goto end;
                                }
-
                        }
 
-
                        /* Trackers */
                        ret = list_trackers(&domain);
                        if (ret) {
@@ -2467,14 +2440,12 @@ int cmd_list(int argc, const char **argv)
 
                        if (lttng_opt_mi) {
                                /* Close domain and domain element */
-                               ret = mi_lttng_close_multi_element(
-                                               the_writer, 2);
+                               ret = mi_lttng_close_multi_element(the_writer, 2);
                        }
                        if (ret) {
                                goto end;
                        }
 
-
                } else {
                        int i, nb_domain;
 
@@ -2502,8 +2473,9 @@ int cmd_list(int argc, const char **argv)
                                case LTTNG_DOMAIN_UST:
                                        MSG("=== Domain: User space ===\n");
                                        MSG("Buffering scheme: %s\n",
-                                                       domains[i].buf_type ==
-                                                       LTTNG_BUFFER_PER_PID ? "per-process" : "per-user");
+                                           domains[i].buf_type == LTTNG_BUFFER_PER_PID ?
+                                                   "per-process" :
+                                                   "per-user");
                                        break;
                                case LTTNG_DOMAIN_JUL:
                                        MSG("=== Domain: java.util.logging (JUL) ===\n");
@@ -2520,8 +2492,7 @@ int cmd_list(int argc, const char **argv)
                                }
 
                                if (lttng_opt_mi) {
-                                       ret = mi_lttng_domain(the_writer,
-                                                       &domains[i], 1);
+                                       ret = mi_lttng_domain(the_writer, &domains[i], 1);
                                        if (ret) {
                                                ret = CMD_ERROR;
                                                goto end;
@@ -2533,16 +2504,15 @@ int cmd_list(int argc, const char **argv)
                                        lttng_destroy_handle(the_handle);
                                }
 
-                               the_handle = lttng_create_handle(
-                                               arg_session_name, &domains[i]);
+                               the_handle = lttng_create_handle(arg_session_name, &domains[i]);
                                if (the_handle == NULL) {
                                        ret = CMD_FATAL;
                                        goto end;
                                }
 
                                if (domains[i].type == LTTNG_DOMAIN_JUL ||
-                                               domains[i].type == LTTNG_DOMAIN_LOG4J ||
-                                               domains[i].type == LTTNG_DOMAIN_PYTHON) {
+                                   domains[i].type == LTTNG_DOMAIN_LOG4J ||
+                                   domains[i].type == LTTNG_DOMAIN_PYTHON) {
                                        ret = list_session_agent_events();
                                        if (ret) {
                                                goto end;
@@ -2568,22 +2538,19 @@ int cmd_list(int argc, const char **argv)
                                        goto end;
                                }
 
-next_domain:
+                       next_domain:
                                if (lttng_opt_mi) {
                                        /* Close domain element */
-                                       ret = mi_lttng_writer_close_element(
-                                                       the_writer);
+                                       ret = mi_lttng_writer_close_element(the_writer);
                                        if (ret) {
                                                ret = CMD_ERROR;
                                                goto end;
                                        }
                                }
-
                        }
                        if (lttng_opt_mi) {
                                /* Close the domains, session and sessions element */
-                               ret = mi_lttng_close_multi_element(
-                                               the_writer, 3);
+                               ret = mi_lttng_close_multi_element(the_writer, 3);
                                if (ret) {
                                        ret = CMD_ERROR;
                                        goto end;
index e7075844520eaeb7da3a90f086545e047969ac5c..78be73ea758062d96322cab5c2e54c1643d8f6e7 100644 (file)
@@ -5,99 +5,89 @@
  *
  */
 
-#include <stdio.h>
-
 #include "../command.hpp"
-
-#include "common/argpar/argpar.h"
 #include "common/argpar-utils/argpar-utils.hpp"
+#include "common/argpar/argpar.h"
 #include "common/dynamic-array.hpp"
 #include "common/mi-lttng.hpp"
+
+#include <stdio.h>
 /* For lttng_condition_type_str(). */
 #include "lttng/condition/condition-internal.hpp"
-#include "lttng/condition/event-rule-matches.h"
 #include "lttng/condition/event-rule-matches-internal.hpp"
+#include "lttng/condition/event-rule-matches.h"
 /* For lttng_domain_type_str(). */
 #include "lttng/domain-internal.hpp"
 /* For lttng_event_rule_kernel_syscall_emission_site_str() */
-#include "lttng/event-rule/kernel-syscall-internal.hpp"
 #include "../loglevel.hpp"
+#include "lttng/event-rule/kernel-syscall-internal.hpp"
+
 #include <lttng/lttng.h>
 
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-list-triggers.1.h>
-;
+       ;
 #endif
 
 #define INDENTATION_LEVEL_STR "  "
 
 typedef enum lttng_event_rule_status (*event_rule_logging_get_name_pattern)(
-               const struct lttng_event_rule *rule, const char **pattern);
+       const struct lttng_event_rule *rule, const char **pattern);
 typedef enum lttng_event_rule_status (*event_rule_logging_get_filter)(
-               const struct lttng_event_rule *rule, const char **expression);
+       const struct lttng_event_rule *rule, const char **expression);
 typedef enum lttng_event_rule_status (*event_rule_logging_get_log_level_rule)(
-               const struct lttng_event_rule *rule,
-               const struct lttng_log_level_rule **log_level_rule);
+       const struct lttng_event_rule *rule, const struct lttng_log_level_rule **log_level_rule);
 
 enum {
        OPT_HELP,
        OPT_LIST_OPTIONS,
 };
 
-static const
-struct argpar_opt_descr list_trigger_options[] = {
+static const struct argpar_opt_descr list_trigger_options[] = {
        { OPT_HELP, 'h', "help", false },
        { OPT_LIST_OPTIONS, '\0', "list-options", false },
        ARGPAR_OPT_DESCR_SENTINEL,
 };
 
-static void print_condition_session_consumed_size(
-               const struct lttng_condition *condition)
+static void print_condition_session_consumed_size(const struct lttng_condition *condition)
 {
        enum lttng_condition_status condition_status;
        const char *session_name;
        uint64_t threshold;
 
        condition_status =
-                       lttng_condition_session_consumed_size_get_session_name(
-                                       condition, &session_name);
+               lttng_condition_session_consumed_size_get_session_name(condition, &session_name);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
-       lttng_condition_session_consumed_size_get_threshold(
-                       condition, &threshold);
+       lttng_condition_session_consumed_size_get_threshold(condition, &threshold);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
        MSG("    session name: %s", session_name);
        MSG("    threshold: %" PRIu64 " bytes", threshold);
 }
 
-static void print_condition_buffer_usage(
-               const struct lttng_condition *condition)
+static void print_condition_buffer_usage(const struct lttng_condition *condition)
 {
        enum lttng_condition_status condition_status;
        const char *session_name, *channel_name;
        enum lttng_domain_type domain_type;
        uint64_t threshold;
 
-       condition_status = lttng_condition_buffer_usage_get_session_name(
-                       condition, &session_name);
+       condition_status = lttng_condition_buffer_usage_get_session_name(condition, &session_name);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
-       condition_status = lttng_condition_buffer_usage_get_channel_name(
-                       condition, &channel_name);
+       condition_status = lttng_condition_buffer_usage_get_channel_name(condition, &channel_name);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
-       condition_status = lttng_condition_buffer_usage_get_domain_type(
-                       condition, &domain_type);
+       condition_status = lttng_condition_buffer_usage_get_domain_type(condition, &domain_type);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
        MSG("    session name: %s", session_name);
        MSG("    channel name: %s", channel_name);
        MSG("    domain: %s", lttng_domain_type_str(domain_type));
 
-       condition_status = lttng_condition_buffer_usage_get_threshold(
-                       condition, &threshold);
+       condition_status = lttng_condition_buffer_usage_get_threshold(condition, &threshold);
        if (condition_status == LTTNG_CONDITION_STATUS_OK) {
                MSG("    threshold (bytes): %" PRIu64, threshold);
        } else {
@@ -105,23 +95,21 @@ static void print_condition_buffer_usage(
 
                LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_UNSET);
 
-               condition_status =
-                               lttng_condition_buffer_usage_get_threshold_ratio(
-                                               condition, &threshold_ratio);
+               condition_status = lttng_condition_buffer_usage_get_threshold_ratio(
+                       condition, &threshold_ratio);
                LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
                MSG("    threshold (ratio): %.2f", threshold_ratio);
        }
 }
 
-static void print_condition_session_rotation(
-               const struct lttng_condition *condition)
+static void print_condition_session_rotation(const struct lttng_condition *condition)
 {
        enum lttng_condition_status condition_status;
        const char *session_name;
 
-       condition_status = lttng_condition_session_rotation_get_session_name(
-                       condition, &session_name);
+       condition_status =
+               lttng_condition_session_rotation_get_session_name(condition, &session_name);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
        MSG("    session name: %s", session_name);
@@ -133,8 +121,8 @@ static void print_condition_session_rotation(
  * values (a value can fall between two labels). In those cases, NULL is
  * returned.
  */
-static const char *get_pretty_loglevel_name(
-               enum lttng_event_rule_type event_rule_type, int loglevel)
+static const char *get_pretty_loglevel_name(enum lttng_event_rule_type event_rule_type,
+                                           int loglevel)
 {
        const char *name = NULL;
 
@@ -158,8 +146,7 @@ static const char *get_pretty_loglevel_name(
        return name;
 }
 
-static
-void print_event_rule_user_tracepoint(const struct lttng_event_rule *event_rule)
+static void print_event_rule_user_tracepoint(const struct lttng_event_rule *event_rule)
 {
        enum lttng_event_rule_status event_rule_status;
        const char *pattern;
@@ -169,22 +156,20 @@ void print_event_rule_user_tracepoint(const struct lttng_event_rule *event_rule)
        unsigned int exclusions_count;
        int i;
 
-       event_rule_status = lttng_event_rule_user_tracepoint_get_name_pattern(
-                       event_rule, &pattern);
+       event_rule_status = lttng_event_rule_user_tracepoint_get_name_pattern(event_rule, &pattern);
        LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
 
        _MSG("    rule: %s (type: user tracepoint", pattern);
 
-       event_rule_status = lttng_event_rule_user_tracepoint_get_filter(
-                       event_rule, &filter);
+       event_rule_status = lttng_event_rule_user_tracepoint_get_filter(event_rule, &filter);
        if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
                _MSG(", filter: %s", filter);
        } else {
                LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
        }
 
-       event_rule_status = lttng_event_rule_user_tracepoint_get_log_level_rule(
-                       event_rule, &log_level_rule);
+       event_rule_status =
+               lttng_event_rule_user_tracepoint_get_log_level_rule(event_rule, &log_level_rule);
        if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
                enum lttng_log_level_rule_status llr_status;
                const char *log_level_op;
@@ -193,13 +178,13 @@ void print_event_rule_user_tracepoint(const struct lttng_event_rule *event_rule)
                switch (lttng_log_level_rule_get_type(log_level_rule)) {
                case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
                        log_level_op = "is";
-                       llr_status = lttng_log_level_rule_exactly_get_level(
-                                       log_level_rule, &log_level);
+                       llr_status =
+                               lttng_log_level_rule_exactly_get_level(log_level_rule, &log_level);
                        break;
                case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
                        log_level_op = "at least";
                        llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                                       log_level_rule, &log_level);
+                               log_level_rule, &log_level);
                        break;
                default:
                        abort();
@@ -207,11 +192,10 @@ void print_event_rule_user_tracepoint(const struct lttng_event_rule *event_rule)
 
                LTTNG_ASSERT(llr_status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
 
-               pretty_loglevel_name = get_pretty_loglevel_name(
-                               LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT, log_level);
+               pretty_loglevel_name =
+                       get_pretty_loglevel_name(LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT, log_level);
                if (pretty_loglevel_name) {
-                       _MSG(", log level %s %s", log_level_op,
-                                       pretty_loglevel_name);
+                       _MSG(", log level %s %s", log_level_op, pretty_loglevel_name);
                } else {
                        _MSG(", log level %s %d", log_level_op, log_level);
                }
@@ -220,14 +204,15 @@ void print_event_rule_user_tracepoint(const struct lttng_event_rule *event_rule)
        }
 
        event_rule_status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(
-                       event_rule, &exclusions_count);
+               event_rule, &exclusions_count);
        LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
        if (exclusions_count > 0) {
                _MSG(", exclusions: ");
                for (i = 0; i < exclusions_count; i++) {
                        const char *exclusion;
 
-                       event_rule_status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
+                       event_rule_status =
+                               lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
                                        event_rule, i, &exclusion);
                        LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
 
@@ -238,21 +223,19 @@ void print_event_rule_user_tracepoint(const struct lttng_event_rule *event_rule)
        MSG(")");
 }
 
-static
-void print_event_rule_kernel_tracepoint(const struct lttng_event_rule *event_rule)
+static void print_event_rule_kernel_tracepoint(const struct lttng_event_rule *event_rule)
 {
        enum lttng_event_rule_status event_rule_status;
        const char *pattern;
        const char *filter;
 
-       event_rule_status = lttng_event_rule_kernel_tracepoint_get_name_pattern(
-                       event_rule, &pattern);
+       event_rule_status =
+               lttng_event_rule_kernel_tracepoint_get_name_pattern(event_rule, &pattern);
        LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
 
        _MSG("    rule: %s (type: kernel tracepoint", pattern);
 
-       event_rule_status = lttng_event_rule_kernel_tracepoint_get_filter(
-                       event_rule, &filter);
+       event_rule_status = lttng_event_rule_kernel_tracepoint_get_filter(event_rule, &filter);
        if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
                _MSG(", filter: %s", filter);
        } else {
@@ -262,8 +245,7 @@ void print_event_rule_kernel_tracepoint(const struct lttng_event_rule *event_rul
        MSG(")");
 }
 
-static
-void print_event_rule_logging(const struct lttng_event_rule *event_rule)
+static void print_event_rule_logging(const struct lttng_event_rule *event_rule)
 {
        enum lttng_event_rule_status event_rule_status;
        enum lttng_event_rule_type event_rule_type = lttng_event_rule_get_type(event_rule);
@@ -279,27 +261,21 @@ void print_event_rule_logging(const struct lttng_event_rule *event_rule)
 
        switch (event_rule_type) {
        case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
-               logging_get_name_pattern =
-                               lttng_event_rule_jul_logging_get_name_pattern;
+               logging_get_name_pattern = lttng_event_rule_jul_logging_get_name_pattern;
                logging_get_filter = lttng_event_rule_jul_logging_get_filter;
-               logging_get_log_level_rule =
-                               lttng_event_rule_jul_logging_get_log_level_rule;
+               logging_get_log_level_rule = lttng_event_rule_jul_logging_get_log_level_rule;
                type_str = "jul";
                break;
        case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
-               logging_get_name_pattern =
-                               lttng_event_rule_log4j_logging_get_name_pattern;
+               logging_get_name_pattern = lttng_event_rule_log4j_logging_get_name_pattern;
                logging_get_filter = lttng_event_rule_log4j_logging_get_filter;
-               logging_get_log_level_rule =
-                               lttng_event_rule_log4j_logging_get_log_level_rule;
+               logging_get_log_level_rule = lttng_event_rule_log4j_logging_get_log_level_rule;
                type_str = "log4j";
                break;
        case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
-               logging_get_name_pattern =
-                               lttng_event_rule_python_logging_get_name_pattern;
+               logging_get_name_pattern = lttng_event_rule_python_logging_get_name_pattern;
                logging_get_filter = lttng_event_rule_python_logging_get_filter;
-               logging_get_log_level_rule =
-                               lttng_event_rule_python_logging_get_log_level_rule;
+               logging_get_log_level_rule = lttng_event_rule_python_logging_get_log_level_rule;
                type_str = "python";
                break;
        default:
@@ -307,22 +283,19 @@ void print_event_rule_logging(const struct lttng_event_rule *event_rule)
                break;
        }
 
-       event_rule_status = logging_get_name_pattern(
-                       event_rule, &pattern);
+       event_rule_status = logging_get_name_pattern(event_rule, &pattern);
        LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
 
        _MSG("    rule: %s (type: %s:logging", pattern, type_str);
 
-       event_rule_status = logging_get_filter(
-                       event_rule, &filter);
+       event_rule_status = logging_get_filter(event_rule, &filter);
        if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
                _MSG(", filter: %s", filter);
        } else {
                LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
        }
 
-       event_rule_status = logging_get_log_level_rule(
-                       event_rule, &log_level_rule);
+       event_rule_status = logging_get_log_level_rule(event_rule, &log_level_rule);
        if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
                enum lttng_log_level_rule_status llr_status;
                const char *log_level_op;
@@ -331,13 +304,13 @@ void print_event_rule_logging(const struct lttng_event_rule *event_rule)
                switch (lttng_log_level_rule_get_type(log_level_rule)) {
                case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
                        log_level_op = "is";
-                       llr_status = lttng_log_level_rule_exactly_get_level(
-                                       log_level_rule, &log_level);
+                       llr_status =
+                               lttng_log_level_rule_exactly_get_level(log_level_rule, &log_level);
                        break;
                case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
                        log_level_op = "at least";
                        llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                                       log_level_rule, &log_level);
+                               log_level_rule, &log_level);
                        break;
                default:
                        abort();
@@ -345,11 +318,9 @@ void print_event_rule_logging(const struct lttng_event_rule *event_rule)
 
                LTTNG_ASSERT(llr_status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
 
-               pretty_loglevel_name = get_pretty_loglevel_name(
-                               event_rule_type, log_level);
+               pretty_loglevel_name = get_pretty_loglevel_name(event_rule_type, log_level);
                if (pretty_loglevel_name) {
-                       _MSG(", log level %s %s", log_level_op,
-                                       pretty_loglevel_name);
+                       _MSG(", log level %s %s", log_level_op, pretty_loglevel_name);
                } else {
                        _MSG(", log level %s %d", log_level_op, log_level);
                }
@@ -360,8 +331,7 @@ void print_event_rule_logging(const struct lttng_event_rule *event_rule)
        MSG(")");
 }
 
-static void print_kernel_probe_location(
-               const struct lttng_kernel_probe_location *location)
+static void print_kernel_probe_location(const struct lttng_kernel_probe_location *location)
 {
        enum lttng_kernel_probe_location_status status;
        switch (lttng_kernel_probe_location_get_type(location)) {
@@ -369,8 +339,7 @@ static void print_kernel_probe_location(
        {
                uint64_t address;
 
-               status = lttng_kernel_probe_location_address_get_address(
-                               location, &address);
+               status = lttng_kernel_probe_location_address_get_address(location, &address);
                if (status != LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK) {
                        ERR("Getting kernel probe location address failed.");
                        goto end;
@@ -385,15 +354,13 @@ static void print_kernel_probe_location(
                uint64_t offset;
                const char *symbol_name;
 
-               symbol_name = lttng_kernel_probe_location_symbol_get_name(
-                               location);
+               symbol_name = lttng_kernel_probe_location_symbol_get_name(location);
                if (!symbol_name) {
                        ERR("Getting kernel probe location symbol name failed.");
                        goto end;
                }
 
-               status = lttng_kernel_probe_location_symbol_get_offset(
-                               location, &offset);
+               status = lttng_kernel_probe_location_symbol_get_offset(location, &offset);
                if (status != LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK) {
                        ERR("Getting kernel probe location address failed.");
                        goto end;
@@ -414,8 +381,7 @@ end:
        return;
 }
 
-static
-void print_event_rule_kernel_probe(const struct lttng_event_rule *event_rule)
+static void print_event_rule_kernel_probe(const struct lttng_event_rule *event_rule)
 {
        enum lttng_event_rule_status event_rule_status;
        const char *name;
@@ -429,8 +395,7 @@ void print_event_rule_kernel_probe(const struct lttng_event_rule *event_rule)
                goto end;
        }
 
-       event_rule_status = lttng_event_rule_kernel_kprobe_get_location(
-                       event_rule, &location);
+       event_rule_status = lttng_event_rule_kernel_kprobe_get_location(event_rule, &location);
        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                ERR("Failed to get kprobe event rule's location.");
                goto end;
@@ -446,8 +411,7 @@ end:
        return;
 }
 
-static
-void print_event_rule_userspace_probe(const struct lttng_event_rule *event_rule)
+static void print_event_rule_userspace_probe(const struct lttng_event_rule *event_rule)
 {
        enum lttng_event_rule_status event_rule_status;
        const char *name;
@@ -456,15 +420,13 @@ void print_event_rule_userspace_probe(const struct lttng_event_rule *event_rule)
 
        LTTNG_ASSERT(lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE);
 
-       event_rule_status = lttng_event_rule_kernel_uprobe_get_event_name(
-                       event_rule, &name);
+       event_rule_status = lttng_event_rule_kernel_uprobe_get_event_name(event_rule, &name);
        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                ERR("Failed to get uprobe event rule's name.");
                goto end;
        }
 
-       event_rule_status = lttng_event_rule_kernel_uprobe_get_location(
-                       event_rule, &location);
+       event_rule_status = lttng_event_rule_kernel_uprobe_get_location(event_rule, &location);
        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                ERR("Failed to get uprobe event rule's location.");
                goto end;
@@ -472,18 +434,15 @@ void print_event_rule_userspace_probe(const struct lttng_event_rule *event_rule)
 
        _MSG("    rule: %s (type: kernel:uprobe, ", name);
 
-       userspace_probe_location_type =
-                       lttng_userspace_probe_location_get_type(location);
+       userspace_probe_location_type = lttng_userspace_probe_location_get_type(location);
 
        switch (userspace_probe_location_type) {
        case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION:
        {
                const char *binary_path, *function_name;
 
-               binary_path = lttng_userspace_probe_location_function_get_binary_path(
-                               location);
-               function_name = lttng_userspace_probe_location_function_get_function_name(
-                               location);
+               binary_path = lttng_userspace_probe_location_function_get_binary_path(location);
+               function_name = lttng_userspace_probe_location_function_get_function_name(location);
 
                _MSG("location type: ELF, location: %s:%s", binary_path, function_name);
                break;
@@ -492,13 +451,14 @@ void print_event_rule_userspace_probe(const struct lttng_event_rule *event_rule)
        {
                const char *binary_path, *provider_name, *probe_name;
 
-               binary_path = lttng_userspace_probe_location_tracepoint_get_binary_path(
-                               location);
-               provider_name = lttng_userspace_probe_location_tracepoint_get_provider_name(
-                               location);
-               probe_name = lttng_userspace_probe_location_tracepoint_get_probe_name(
-                               location);
-               _MSG("location type: SDT, location: %s:%s:%s", binary_path, provider_name, probe_name);
+               binary_path = lttng_userspace_probe_location_tracepoint_get_binary_path(location);
+               provider_name =
+                       lttng_userspace_probe_location_tracepoint_get_provider_name(location);
+               probe_name = lttng_userspace_probe_location_tracepoint_get_probe_name(location);
+               _MSG("location type: SDT, location: %s:%s:%s",
+                    binary_path,
+                    provider_name,
+                    probe_name);
                break;
        }
        default:
@@ -511,8 +471,7 @@ end:
        return;
 }
 
-static
-void print_event_rule_syscall(const struct lttng_event_rule *event_rule)
+static void print_event_rule_syscall(const struct lttng_event_rule *event_rule)
 {
        const char *pattern, *filter;
        enum lttng_event_rule_status event_rule_status;
@@ -520,19 +479,16 @@ void print_event_rule_syscall(const struct lttng_event_rule *event_rule)
 
        LTTNG_ASSERT(lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL);
 
-       emission_site =
-               lttng_event_rule_kernel_syscall_get_emission_site(event_rule);
+       emission_site = lttng_event_rule_kernel_syscall_get_emission_site(event_rule);
 
-       event_rule_status = lttng_event_rule_kernel_syscall_get_name_pattern(
-                       event_rule, &pattern);
+       event_rule_status = lttng_event_rule_kernel_syscall_get_name_pattern(event_rule, &pattern);
        LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
 
-       _MSG("    rule: %s (type: kernel:syscall:%s", pattern,
-                       lttng_event_rule_kernel_syscall_emission_site_str(
-                                       emission_site));
+       _MSG("    rule: %s (type: kernel:syscall:%s",
+            pattern,
+            lttng_event_rule_kernel_syscall_emission_site_str(emission_site));
 
-       event_rule_status = lttng_event_rule_kernel_syscall_get_filter(
-                       event_rule, &filter);
+       event_rule_status = lttng_event_rule_kernel_syscall_get_filter(event_rule, &filter);
        if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
                _MSG(", filter: %s", filter);
        } else {
@@ -542,11 +498,9 @@ void print_event_rule_syscall(const struct lttng_event_rule *event_rule)
        MSG(")");
 }
 
-static
-void print_event_rule(const struct lttng_event_rule *event_rule)
+static void print_event_rule(const struct lttng_event_rule *event_rule)
 {
-       const enum lttng_event_rule_type event_rule_type =
-                       lttng_event_rule_get_type(event_rule);
+       const enum lttng_event_rule_type event_rule_type = lttng_event_rule_get_type(event_rule);
 
        switch (event_rule_type) {
        case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
@@ -574,8 +528,7 @@ void print_event_rule(const struct lttng_event_rule *event_rule)
        }
 }
 
-static
-void print_one_event_expr(const struct lttng_event_expr *event_expr)
+static void print_one_event_expr(const struct lttng_event_expr *event_expr)
 {
        enum lttng_event_expr_type type;
 
@@ -586,8 +539,7 @@ void print_one_event_expr(const struct lttng_event_expr *event_expr)
        {
                const char *name;
 
-               name = lttng_event_expr_event_payload_field_get_name(
-                               event_expr);
+               name = lttng_event_expr_event_payload_field_get_name(event_expr);
                _MSG("%s", name);
 
                break;
@@ -596,8 +548,7 @@ void print_one_event_expr(const struct lttng_event_expr *event_expr)
        {
                const char *name;
 
-               name = lttng_event_expr_channel_context_field_get_name(
-                               event_expr);
+               name = lttng_event_expr_channel_context_field_get_name(event_expr);
                _MSG("$ctx.%s", name);
 
                break;
@@ -607,10 +558,9 @@ void print_one_event_expr(const struct lttng_event_expr *event_expr)
                const char *provider_name;
                const char *type_name;
 
-               provider_name = lttng_event_expr_app_specific_context_field_get_provider_name(
-                               event_expr);
-               type_name = lttng_event_expr_app_specific_context_field_get_type_name(
-                               event_expr);
+               provider_name =
+                       lttng_event_expr_app_specific_context_field_get_provider_name(event_expr);
+               type_name = lttng_event_expr_app_specific_context_field_get_type_name(event_expr);
 
                _MSG("$app.%s:%s", provider_name, type_name);
 
@@ -622,14 +572,12 @@ void print_one_event_expr(const struct lttng_event_expr *event_expr)
                const struct lttng_event_expr *parent_expr;
                enum lttng_event_expr_status status;
 
-               parent_expr = lttng_event_expr_array_field_element_get_parent_expr(
-                               event_expr);
+               parent_expr = lttng_event_expr_array_field_element_get_parent_expr(event_expr);
                LTTNG_ASSERT(parent_expr != NULL);
 
                print_one_event_expr(parent_expr);
 
-               status = lttng_event_expr_array_field_element_get_index(
-                               event_expr, &index);
+               status = lttng_event_expr_array_field_element_get_index(event_expr, &index);
                LTTNG_ASSERT(status == LTTNG_EVENT_EXPR_STATUS_OK);
 
                _MSG("[%u]", index);
@@ -641,8 +589,7 @@ void print_one_event_expr(const struct lttng_event_expr *event_expr)
        }
 }
 
-static
-void print_indentation(unsigned int indentation_level)
+static void print_indentation(unsigned int indentation_level)
 {
        unsigned int i;
 
@@ -651,9 +598,8 @@ void print_indentation(unsigned int indentation_level)
        }
 }
 
-static
-void print_error_query_results(struct lttng_error_query_results *results,
-               unsigned int base_indentation_level)
+static void print_error_query_results(struct lttng_error_query_results *results,
+                                     unsigned int base_indentation_level)
 {
        unsigned int i, count, printed_errors_count = 0;
        enum lttng_error_query_results_status results_status;
@@ -673,24 +619,20 @@ void print_error_query_results(struct lttng_error_query_results *results,
                const char *result_description;
                uint64_t result_value;
 
-               results_status = lttng_error_query_results_get_result(
-                               results, &result, i);
+               results_status = lttng_error_query_results_get_result(results, &result, i);
                LTTNG_ASSERT(results_status == LTTNG_ERROR_QUERY_RESULTS_STATUS_OK);
 
-               result_status = lttng_error_query_result_get_name(
-                               result, &result_name);
+               result_status = lttng_error_query_result_get_name(result, &result_name);
                LTTNG_ASSERT(result_status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
-               result_status = lttng_error_query_result_get_description(
-                               result, &result_description);
+               result_status =
+                       lttng_error_query_result_get_description(result, &result_description);
                LTTNG_ASSERT(result_status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
 
-
                if (lttng_error_query_result_get_type(result) ==
-                               LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER) {
-                       result_status = lttng_error_query_result_counter_get_value(
-                                       result, &result_value);
-                       LTTNG_ASSERT(result_status ==
-                                       LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
+                   LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER) {
+                       result_status =
+                               lttng_error_query_result_counter_get_value(result, &result_value);
+                       LTTNG_ASSERT(result_status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
                        if (result_value == 0) {
                                continue;
                        }
@@ -704,7 +646,8 @@ void print_error_query_results(struct lttng_error_query_results *results,
                        MSG("");
                        print_indentation(base_indentation_level + 1);
                        _MSG("Unknown error query result type for result '%s' (%s)",
-                                       result_name, result_description);
+                            result_name,
+                            result_description);
                        continue;
                }
        }
@@ -714,22 +657,19 @@ void print_error_query_results(struct lttng_error_query_results *results,
        }
 }
 
-static void print_condition_event_rule_matches(
-               const struct lttng_condition *condition)
+static void print_condition_event_rule_matches(const struct lttng_condition *condition)
 {
        const struct lttng_event_rule *event_rule;
        enum lttng_condition_status condition_status;
        unsigned int cap_desc_count, i;
 
-       condition_status = lttng_condition_event_rule_matches_get_rule(
-                       condition, &event_rule);
+       condition_status = lttng_condition_event_rule_matches_get_rule(condition, &event_rule);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
        print_event_rule(event_rule);
 
-       condition_status =
-                       lttng_condition_event_rule_matches_get_capture_descriptor_count(
-                                       condition, &cap_desc_count);
+       condition_status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
+               condition, &cap_desc_count);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
        if (cap_desc_count > 0) {
@@ -737,8 +677,8 @@ static void print_condition_event_rule_matches(
 
                for (i = 0; i < cap_desc_count; i++) {
                        const struct lttng_event_expr *cap_desc =
-                                       lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
-                                                       condition, i);
+                               lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
+                                       condition, i);
 
                        _MSG("      - ");
                        print_one_event_expr(cap_desc);
@@ -748,8 +688,8 @@ static void print_condition_event_rule_matches(
 }
 
 static void print_action_errors(const struct lttng_trigger *trigger,
-               const uint64_t *action_path_indexes,
-               size_t action_path_length)
+                               const uint64_t *action_path_indexes,
+                               size_t action_path_length)
 {
        enum lttng_error_code error_query_ret;
        struct lttng_error_query_results *results = NULL;
@@ -757,8 +697,8 @@ static void print_action_errors(const struct lttng_trigger *trigger,
        uid_t trigger_uid;
        enum lttng_trigger_status trigger_status;
        struct lttng_error_query *query;
-       struct lttng_action_path *action_path = lttng_action_path_create(
-                       action_path_indexes, action_path_length);
+       struct lttng_action_path *action_path =
+               lttng_action_path_create(action_path_indexes, action_path_length);
 
        LTTNG_ASSERT(action_path);
 
@@ -774,12 +714,13 @@ static void print_action_errors(const struct lttng_trigger *trigger,
        trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
        LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
-       error_query_ret = lttng_error_query_execute(
-                       query, lttng_session_daemon_command_endpoint, &results);
+       error_query_ret =
+               lttng_error_query_execute(query, lttng_session_daemon_command_endpoint, &results);
        if (error_query_ret != LTTNG_OK) {
                ERR("Failed to query errors of trigger '%s' (owner uid: %d): %s",
-                               trigger_name, (int) trigger_uid,
-                               lttng_strerror(-error_query_ret));
+                   trigger_name,
+                   (int) trigger_uid,
+                   lttng_strerror(-error_query_ret));
                goto end;
        }
 
@@ -792,11 +733,10 @@ end:
        lttng_action_path_destroy(action_path);
 }
 
-static
-void print_one_action(const struct lttng_trigger *trigger,
-               const struct lttng_action *action,
-               const uint64_t *action_path_indexes,
-               size_t action_path_length)
+static void print_one_action(const struct lttng_trigger *trigger,
+                            const struct lttng_action *action,
+                            const uint64_t *action_path_indexes,
+                            size_t action_path_length)
 {
        enum lttng_action_type action_type;
        enum lttng_action_status action_status;
@@ -810,47 +750,40 @@ void print_one_action(const struct lttng_trigger *trigger,
        case LTTNG_ACTION_TYPE_NOTIFY:
                _MSG("notify");
 
-               action_status = lttng_action_notify_get_rate_policy(
-                               action, &policy);
+               action_status = lttng_action_notify_get_rate_policy(action, &policy);
                if (action_status != LTTNG_ACTION_STATUS_OK) {
                        ERR("Failed to retrieve rate policy.");
                        goto end;
                }
                break;
        case LTTNG_ACTION_TYPE_START_SESSION:
-               action_status = lttng_action_start_session_get_session_name(
-                               action, &value);
+               action_status = lttng_action_start_session_get_session_name(action, &value);
                LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
                _MSG("start session `%s`", value);
 
-               action_status = lttng_action_start_session_get_rate_policy(
-                               action, &policy);
+               action_status = lttng_action_start_session_get_rate_policy(action, &policy);
                if (action_status != LTTNG_ACTION_STATUS_OK) {
                        ERR("Failed to retrieve rate policy.");
                        goto end;
                }
                break;
        case LTTNG_ACTION_TYPE_STOP_SESSION:
-               action_status = lttng_action_stop_session_get_session_name(
-                               action, &value);
+               action_status = lttng_action_stop_session_get_session_name(action, &value);
                LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
                _MSG("stop session `%s`", value);
 
-               action_status = lttng_action_stop_session_get_rate_policy(
-                               action, &policy);
+               action_status = lttng_action_stop_session_get_rate_policy(action, &policy);
                if (action_status != LTTNG_ACTION_STATUS_OK) {
                        ERR("Failed to retrieve rate policy.");
                        goto end;
                }
                break;
        case LTTNG_ACTION_TYPE_ROTATE_SESSION:
-               action_status = lttng_action_rotate_session_get_session_name(
-                               action, &value);
+               action_status = lttng_action_rotate_session_get_session_name(action, &value);
                LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
                _MSG("rotate session `%s`", value);
 
-               action_status = lttng_action_rotate_session_get_rate_policy(
-                               action, &policy);
+               action_status = lttng_action_rotate_session_get_rate_policy(action, &policy);
                if (action_status != LTTNG_ACTION_STATUS_OK) {
                        ERR("Failed to retrieve rate policy.");
                        goto end;
@@ -860,13 +793,11 @@ void print_one_action(const struct lttng_trigger *trigger,
        {
                const struct lttng_snapshot_output *output;
 
-               action_status = lttng_action_snapshot_session_get_session_name(
-                               action, &value);
+               action_status = lttng_action_snapshot_session_get_session_name(action, &value);
                LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
                _MSG("snapshot session `%s`", value);
 
-               action_status = lttng_action_snapshot_session_get_output(
-                               action, &output);
+               action_status = lttng_action_snapshot_session_get_output(action, &output);
                if (action_status == LTTNG_ACTION_STATUS_OK) {
                        const char *name;
                        uint64_t max_size;
@@ -909,8 +840,7 @@ void print_one_action(const struct lttng_trigger *trigger,
                        }
                }
 
-               action_status = lttng_action_snapshot_session_get_rate_policy(
-                               action, &policy);
+               action_status = lttng_action_snapshot_session_get_rate_policy(action, &policy);
                if (action_status != LTTNG_ACTION_STATUS_OK) {
                        ERR("Failed to retrieve rate policy.");
                        goto end;
@@ -930,8 +860,8 @@ void print_one_action(const struct lttng_trigger *trigger,
 
                switch (policy_type) {
                case LTTNG_RATE_POLICY_TYPE_EVERY_N:
-                       policy_status = lttng_rate_policy_every_n_get_interval(
-                                       policy, &policy_value);
+                       policy_status =
+                               lttng_rate_policy_every_n_get_interval(policy, &policy_value);
                        if (policy_status != LTTNG_RATE_POLICY_STATUS_OK) {
                                ERR("Failed to get action rate policy interval");
                                goto end;
@@ -940,21 +870,17 @@ void print_one_action(const struct lttng_trigger *trigger,
                                /* The default is 1 so print only when it is a
                                 * special case.
                                 */
-                               _MSG(", rate policy: every %" PRIu64
-                                    " occurrences",
-                                               policy_value);
+                               _MSG(", rate policy: every %" PRIu64 " occurrences", policy_value);
                        }
                        break;
                case LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N:
-                       policy_status = lttng_rate_policy_once_after_n_get_threshold(
-                                       policy, &policy_value);
+                       policy_status =
+                               lttng_rate_policy_once_after_n_get_threshold(policy, &policy_value);
                        if (policy_status != LTTNG_RATE_POLICY_STATUS_OK) {
                                ERR("Failed to get action rate policy interval");
                                goto end;
                        }
-                       _MSG(", rate policy: once after %" PRIu64
-                            " occurrences",
-                                       policy_value);
+                       _MSG(", rate policy: once after %" PRIu64 " occurrences", policy_value);
                        break;
                default:
                        abort();
@@ -962,23 +888,20 @@ void print_one_action(const struct lttng_trigger *trigger,
        }
 
        MSG("");
-       print_action_errors(trigger, action_path_indexes,
-                       action_path_length);
+       print_action_errors(trigger, action_path_indexes, action_path_length);
 
 end:
        return;
 }
 
-static
-void print_trigger_errors(const struct lttng_trigger *trigger)
+static void print_trigger_errors(const struct lttng_trigger *trigger)
 {
        enum lttng_error_code error_query_ret;
        struct lttng_error_query_results *results = NULL;
        enum lttng_trigger_status trigger_status;
        const char *trigger_name;
        uid_t trigger_uid;
-       struct lttng_error_query *query =
-                       lttng_error_query_trigger_create(trigger);
+       struct lttng_error_query *query = lttng_error_query_trigger_create(trigger);
 
        LTTNG_ASSERT(query);
        /*
@@ -990,12 +913,13 @@ void print_trigger_errors(const struct lttng_trigger *trigger)
        trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
        LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
-       error_query_ret = lttng_error_query_execute(
-                       query, lttng_session_daemon_command_endpoint, &results);
+       error_query_ret =
+               lttng_error_query_execute(query, lttng_session_daemon_command_endpoint, &results);
        if (error_query_ret != LTTNG_OK) {
                ERR("Failed to query errors of trigger '%s' (owner uid: %d): %s",
-                               trigger_name, (int) trigger_uid,
-                               lttng_strerror(-error_query_ret));
+                   trigger_name,
+                   (int) trigger_uid,
+                   lttng_strerror(-error_query_ret));
                goto end;
        }
 
@@ -1007,16 +931,14 @@ end:
        lttng_error_query_results_destroy(results);
 }
 
-static
-void print_condition_errors(const struct lttng_trigger *trigger)
+static void print_condition_errors(const struct lttng_trigger *trigger)
 {
        enum lttng_error_code error_query_ret;
        struct lttng_error_query_results *results = NULL;
        enum lttng_trigger_status trigger_status;
        const char *trigger_name;
        uid_t trigger_uid;
-       struct lttng_error_query *query =
-                       lttng_error_query_condition_create(trigger);
+       struct lttng_error_query *query = lttng_error_query_condition_create(trigger);
 
        LTTNG_ASSERT(query);
        /*
@@ -1028,12 +950,13 @@ void print_condition_errors(const struct lttng_trigger *trigger)
        trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
        LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
-       error_query_ret = lttng_error_query_execute(
-                       query, lttng_session_daemon_command_endpoint, &results);
+       error_query_ret =
+               lttng_error_query_execute(query, lttng_session_daemon_command_endpoint, &results);
        if (error_query_ret != LTTNG_OK) {
                ERR("Failed to query errors of condition of trigger '%s' (owner uid: %d): %s",
-                               trigger_name, (int) trigger_uid,
-                               lttng_strerror(-error_query_ret));
+                   trigger_name,
+                   (int) trigger_uid,
+                   lttng_strerror(-error_query_ret));
                goto end;
        }
 
@@ -1045,8 +968,7 @@ end:
        lttng_error_query_results_destroy(results);
 }
 
-static
-void print_one_trigger(const struct lttng_trigger *trigger)
+static void print_one_trigger(const struct lttng_trigger *trigger)
 {
        const struct lttng_condition *condition;
        enum lttng_condition_type condition_type;
@@ -1111,12 +1033,10 @@ void print_one_trigger(const struct lttng_trigger *trigger)
                for (i = 0; i < count; i++) {
                        const uint64_t action_path_index = i;
                        const struct lttng_action *subaction =
-                                       lttng_action_list_get_at_index(
-                                                       action, i);
+                               lttng_action_list_get_at_index(action, i);
 
                        _MSG("    ");
-                       print_one_action(trigger, subaction, &action_path_index,
-                                       1);
+                       print_one_action(trigger, subaction, &action_path_index, 1);
                }
        } else {
                _MSG(" action:");
@@ -1128,8 +1048,7 @@ end:
        return;
 }
 
-static
-int compare_triggers_by_name(const void *a, const void *b)
+static int compare_triggers_by_name(const void *a, const void *b)
 {
        const struct lttng_trigger *trigger_a = *((const struct lttng_trigger **) a);
        const struct lttng_trigger *trigger_b = *((const struct lttng_trigger **) b);
@@ -1165,8 +1084,7 @@ static int print_sorted_triggers(const struct lttng_triggers *triggers)
        for (i = 0; i < num_triggers; i++) {
                int add_ret;
                const char *unused_name;
-               const struct lttng_trigger *trigger =
-                               lttng_triggers_get_at_index(triggers, i);
+               const struct lttng_trigger *trigger = lttng_triggers_get_at_index(triggers, i);
 
                trigger_status = lttng_trigger_get_name(trigger, &unused_name);
                switch (trigger_status) {
@@ -1179,24 +1097,23 @@ static int print_sorted_triggers(const struct lttng_triggers *triggers)
                        abort();
                }
 
-               add_ret = lttng_dynamic_pointer_array_add_pointer(
-                               &sorted_triggers, (void *) trigger);
+               add_ret =
+                       lttng_dynamic_pointer_array_add_pointer(&sorted_triggers, (void *) trigger);
                if (add_ret) {
                        ERR("Failed to allocate array of struct lttng_trigger *.");
                        goto error;
                }
        }
 
-       qsort(sorted_triggers.array.buffer.data, num_triggers,
-                       sizeof(struct lttng_trigger *),
-                       compare_triggers_by_name);
+       qsort(sorted_triggers.array.buffer.data,
+             num_triggers,
+             sizeof(struct lttng_trigger *),
+             compare_triggers_by_name);
 
-       for (i = 0; i < lttng_dynamic_pointer_array_get_count(&sorted_triggers);
-                       i++) {
-               const struct lttng_trigger *trigger_to_print = (const struct lttng_trigger
-                                               *)
-                               lttng_dynamic_pointer_array_get_pointer(
-                                               &sorted_triggers, i);
+       for (i = 0; i < lttng_dynamic_pointer_array_get_count(&sorted_triggers); i++) {
+               const struct lttng_trigger *trigger_to_print =
+                       (const struct lttng_trigger *) lttng_dynamic_pointer_array_get_pointer(
+                               &sorted_triggers, i);
 
                print_one_trigger(trigger_to_print);
        }
@@ -1211,19 +1128,17 @@ end:
        return ret;
 }
 
-static enum lttng_error_code mi_error_query_trigger_callback(
-               const struct lttng_trigger *trigger,
-               struct lttng_error_query_results **results)
+static enum lttng_error_code
+mi_error_query_trigger_callback(const struct lttng_trigger *trigger,
+                               struct lttng_error_query_results **results)
 {
        enum lttng_error_code ret_code;
-       struct lttng_error_query *query =
-                       lttng_error_query_trigger_create(trigger);
+       struct lttng_error_query *query = lttng_error_query_trigger_create(trigger);
 
        LTTNG_ASSERT(results);
        LTTNG_ASSERT(query);
 
-       ret_code = lttng_error_query_execute(
-                       query, lttng_session_daemon_command_endpoint, results);
+       ret_code = lttng_error_query_execute(query, lttng_session_daemon_command_endpoint, results);
        if (ret_code != LTTNG_OK) {
                enum lttng_trigger_status trigger_status;
                const char *trigger_name;
@@ -1232,33 +1147,31 @@ static enum lttng_error_code mi_error_query_trigger_callback(
                trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
                LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
-               trigger_status = lttng_trigger_get_owner_uid(
-                               trigger, &trigger_uid);
+               trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
                LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
                ERR("Failed to query errors of trigger '%s' (owner uid: %d): %s",
-                               trigger_name, (int) trigger_uid,
-                               lttng_strerror(-ret_code));
+                   trigger_name,
+                   (int) trigger_uid,
+                   lttng_strerror(-ret_code));
        }
 
        lttng_error_query_destroy(query);
        return ret_code;
 }
 
-static enum lttng_error_code mi_error_query_action_callback(
-               const struct lttng_trigger *trigger,
-               const struct lttng_action_path *action_path,
-               struct lttng_error_query_results **results)
+static enum lttng_error_code
+mi_error_query_action_callback(const struct lttng_trigger *trigger,
+                              const struct lttng_action_path *action_path,
+                              struct lttng_error_query_results **results)
 {
        enum lttng_error_code ret_code;
-       struct lttng_error_query *query =
-                       lttng_error_query_action_create(trigger, action_path);
+       struct lttng_error_query *query = lttng_error_query_action_create(trigger, action_path);
 
        LTTNG_ASSERT(results);
        LTTNG_ASSERT(query);
 
-       ret_code = lttng_error_query_execute(
-                       query, lttng_session_daemon_command_endpoint, results);
+       ret_code = lttng_error_query_execute(query, lttng_session_daemon_command_endpoint, results);
        if (ret_code != LTTNG_OK) {
                enum lttng_trigger_status trigger_status;
                const char *trigger_name;
@@ -1267,32 +1180,30 @@ static enum lttng_error_code mi_error_query_action_callback(
                trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
                LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
-               trigger_status = lttng_trigger_get_owner_uid(
-                               trigger, &trigger_uid);
+               trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
                LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
                ERR("Failed to query errors of an action for trigger '%s' (owner uid: %d): %s",
-                               trigger_name, (int) trigger_uid,
-                               lttng_strerror(-ret_code));
+                   trigger_name,
+                   (int) trigger_uid,
+                   lttng_strerror(-ret_code));
        }
 
        lttng_error_query_destroy(query);
        return ret_code;
 }
 
-static enum lttng_error_code mi_error_query_condition_callback(
-               const struct lttng_trigger *trigger,
-               struct lttng_error_query_results **results)
+static enum lttng_error_code
+mi_error_query_condition_callback(const struct lttng_trigger *trigger,
+                                 struct lttng_error_query_results **results)
 {
        enum lttng_error_code ret_code;
-       struct lttng_error_query *query =
-                       lttng_error_query_condition_create(trigger);
+       struct lttng_error_query *query = lttng_error_query_condition_create(trigger);
 
        LTTNG_ASSERT(results);
        LTTNG_ASSERT(query);
 
-       ret_code = lttng_error_query_execute(
-                       query, lttng_session_daemon_command_endpoint, results);
+       ret_code = lttng_error_query_execute(query, lttng_session_daemon_command_endpoint, results);
        if (ret_code != LTTNG_OK) {
                enum lttng_trigger_status trigger_status;
                const char *trigger_name;
@@ -1301,13 +1212,13 @@ static enum lttng_error_code mi_error_query_condition_callback(
                trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
                LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
-               trigger_status = lttng_trigger_get_owner_uid(
-                               trigger, &trigger_uid);
+               trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
                LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
                ERR("Failed to query errors of of condition for condition of trigger '%s' (owner uid: %d): %s",
-                               trigger_name, (int) trigger_uid,
-                               lttng_strerror(-ret_code));
+                   trigger_name,
+                   (int) trigger_uid,
+                   lttng_strerror(-ret_code));
        }
 
        lttng_error_query_destroy(query);
@@ -1334,10 +1245,9 @@ int cmd_list_triggers(int argc, const char **argv)
        while (true) {
                enum parse_next_item_status status;
 
-               status = parse_next_item(argpar_iter, &argpar_item, 1, argv,
-                       true, NULL, NULL);
+               status = parse_next_item(argpar_iter, &argpar_item, 1, argv, true, NULL, NULL);
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR ||
-                               status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
+                   status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
                        goto error;
                } else if (status == PARSE_NEXT_ITEM_STATUS_END) {
                        break;
@@ -1346,8 +1256,7 @@ int cmd_list_triggers(int argc, const char **argv)
                assert(status == PARSE_NEXT_ITEM_STATUS_OK);
 
                if (argpar_item_type(argpar_item) == ARGPAR_ITEM_TYPE_OPT) {
-                       const struct argpar_opt_descr *descr =
-                               argpar_item_opt_descr(argpar_item);
+                       const struct argpar_opt_descr *descr = argpar_item_opt_descr(argpar_item);
 
                        switch (descr->id) {
                        case OPT_HELP:
@@ -1356,8 +1265,7 @@ int cmd_list_triggers(int argc, const char **argv)
                                goto end;
 
                        case OPT_LIST_OPTIONS:
-                               list_cmd_options_argpar(
-                                               stdout, list_trigger_options);
+                               list_cmd_options_argpar(stdout, list_trigger_options);
                                ret = 0;
                                goto end;
 
@@ -1366,8 +1274,7 @@ int cmd_list_triggers(int argc, const char **argv)
                        }
 
                } else {
-                       ERR("Unexpected argument: %s",
-                               argpar_item_non_opt_arg(argpar_item));
+                       ERR("Unexpected argument: %s", argpar_item_non_opt_arg(argpar_item));
                }
        }
 
@@ -1378,8 +1285,7 @@ int cmd_list_triggers(int argc, const char **argv)
        }
 
        if (lttng_opt_mi) {
-               mi_writer = mi_lttng_writer_create(
-                               fileno(stdout), lttng_opt_mi);
+               mi_writer = mi_lttng_writer_create(fileno(stdout), lttng_opt_mi);
                if (!mi_writer) {
                        ret = CMD_ERROR;
                        goto end;
@@ -1387,15 +1293,14 @@ int cmd_list_triggers(int argc, const char **argv)
 
                /* Open command element. */
                ret = mi_lttng_writer_command_open(mi_writer,
-                               mi_lttng_element_command_list_trigger);
+                                                  mi_lttng_element_command_list_trigger);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element. */
-               ret = mi_lttng_writer_open_element(
-                               mi_writer, mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(mi_writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -1409,11 +1314,9 @@ int cmd_list_triggers(int argc, const char **argv)
                        .action_cb = mi_error_query_action_callback,
                };
 
-               ret = lttng_triggers_mi_serialize(
-                               triggers, mi_writer, &callbacks);
+               ret = lttng_triggers_mi_serialize(triggers, mi_writer, &callbacks);
                if (ret != LTTNG_OK) {
-                       ERR("Error printing MI triggers: %s.",
-                                       lttng_strerror(-ret));
+                       ERR("Error printing MI triggers: %s.", lttng_strerror(-ret));
                        goto error;
                }
        } else {
index 2ab005f2a3a029546a370e8141e0cf1af9c3531f..1f962f05a8b781d6cbb70ea2c653f7d2013d65be 100644 (file)
@@ -6,18 +6,19 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/config/session-config.hpp>
+#include <common/mi-lttng.hpp>
+
+#include <lttng/lttng.h>
+
 #include <inttypes.h>
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include <common/mi-lttng.hpp>
-#include <common/config/session-config.hpp>
-#include <lttng/lttng.h>
-
-#include "../command.hpp"
-
 static char *the_opt_input_path;
 static char *the_opt_override_url;
 static char *the_opt_override_session_name;
@@ -29,7 +30,7 @@ static const char *the_session_name;
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-load.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -43,14 +44,14 @@ static struct mi_writer *the_writer;
 
 static struct poptOption the_load_opts[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",          'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"all",           'a', POPT_ARG_NONE, 0, OPT_ALL, 0, 0},
-       {"input-path",    'i', POPT_ARG_STRING, &the_opt_input_path, 0, 0, 0},
-       {"force",         'f', POPT_ARG_NONE, 0, OPT_FORCE, 0, 0},
-       {"override-url",    0, POPT_ARG_STRING, &the_opt_override_url, 0, 0, 0},
-       {"override-name",   0, POPT_ARG_STRING, &the_opt_override_session_name, 0, 0, 0},
-       {"list-options",    0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "all", 'a', POPT_ARG_NONE, 0, OPT_ALL, 0, 0 },
+       { "input-path", 'i', POPT_ARG_STRING, &the_opt_input_path, 0, 0, 0 },
+       { "force", 'f', POPT_ARG_NONE, 0, OPT_FORCE, 0, 0 },
+       { "override-url", 0, POPT_ARG_STRING, &the_opt_override_url, 0, 0, 0 },
+       { "override-name", 0, POPT_ARG_STRING, &the_opt_override_session_name, 0, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 static int mi_partial_session(const char *session_name)
@@ -65,8 +66,7 @@ static int mi_partial_session(const char *session_name)
                goto end;
        }
 
-       ret = mi_lttng_writer_write_element_string(the_writer, config_element_name,
-                       session_name);
+       ret = mi_lttng_writer_write_element_string(the_writer, config_element_name, session_name);
        if (ret) {
                goto end;
        }
@@ -104,8 +104,8 @@ static int mi_load_print(const char *session_name)
 
        /* Path element */
        if (the_opt_input_path) {
-               ret = mi_lttng_writer_write_element_string(the_writer, config_element_path,
-                               the_opt_input_path);
+               ret = mi_lttng_writer_write_element_string(
+                       the_writer, config_element_path, the_opt_input_path);
                if (ret) {
                        goto end;
                }
@@ -119,8 +119,8 @@ static int mi_load_print(const char *session_name)
 
        /* Session name override element */
        if (the_opt_override_session_name) {
-               ret = mi_lttng_writer_write_element_string(the_writer,
-                               config_element_name, the_opt_override_session_name);
+               ret = mi_lttng_writer_write_element_string(
+                       the_writer, config_element_name, the_opt_override_session_name);
                if (ret) {
                        goto end;
                }
@@ -128,9 +128,8 @@ static int mi_load_print(const char *session_name)
 
        /* Session url override element */
        if (the_opt_override_url) {
-               ret = mi_lttng_writer_write_element_string(the_writer,
-                               mi_lttng_element_load_override_url,
-                               the_opt_override_url);
+               ret = mi_lttng_writer_write_element_string(
+                       the_writer, mi_lttng_element_load_override_url, the_opt_override_url);
                if (ret) {
                        goto end;
                }
@@ -212,16 +211,14 @@ int cmd_load(int argc, const char **argv)
                }
 
                /* Open command element */
-               ret = mi_lttng_writer_command_open(the_writer,
-                               mi_lttng_element_command_load);
+               ret = mi_lttng_writer_command_open(the_writer, mi_lttng_element_command_load);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(the_writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(the_writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -252,8 +249,7 @@ int cmd_load(int argc, const char **argv)
                input_path = NULL;
        }
 
-       ret = lttng_load_session_attr_set_input_url(session_attr,
-                       input_path);
+       ret = lttng_load_session_attr_set_input_url(session_attr, input_path);
        if (ret) {
                ERR("Invalid input path");
                ret = CMD_ERROR;
@@ -261,8 +257,7 @@ int cmd_load(int argc, const char **argv)
        }
 
        /* Set the session name. NULL means all sessions should be loaded */
-       ret = lttng_load_session_attr_set_session_name(session_attr,
-                       the_session_name);
+       ret = lttng_load_session_attr_set_session_name(session_attr, the_session_name);
        if (ret) {
                ERR("Invalid session name");
                ret = CMD_ERROR;
@@ -279,8 +274,7 @@ int cmd_load(int argc, const char **argv)
 
        /* Set the overrides attributes if any */
        if (the_opt_override_url) {
-               ret = lttng_load_session_attr_set_override_url(session_attr,
-                               the_opt_override_url);
+               ret = lttng_load_session_attr_set_override_url(session_attr, the_opt_override_url);
                if (ret) {
                        ERR("Url override is invalid");
                        goto end;
@@ -293,8 +287,8 @@ int cmd_load(int argc, const char **argv)
                        ret = CMD_ERROR;
                        goto end;
                }
-               ret = lttng_load_session_attr_set_override_session_name(session_attr,
-                               the_opt_override_session_name);
+               ret = lttng_load_session_attr_set_override_session_name(
+                       session_attr, the_opt_override_session_name);
                if (ret) {
                        ERR("Failed to set session name override");
                        ret = CMD_ERROR;
@@ -313,8 +307,7 @@ int cmd_load(int argc, const char **argv)
                } else if (the_session_name) {
                        ret = config_init((char *) the_session_name);
                        if (ret < 0) {
-                               WARN("Could not set %s as the default session",
-                                               the_session_name);
+                               WARN("Could not set %s as the default session", the_session_name);
                        }
                        MSG("Session %s has been loaded successfully", the_session_name);
                } else {
@@ -322,8 +315,7 @@ int cmd_load(int argc, const char **argv)
                }
 
                if (the_opt_override_session_name) {
-                       MSG("Session name overridden with %s",
-                                       the_opt_override_session_name);
+                       MSG("Session name overridden with %s", the_opt_override_session_name);
                }
 
                if (the_opt_override_url) {
@@ -350,8 +342,8 @@ int cmd_load(int argc, const char **argv)
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(the_writer,
-                               mi_lttng_element_command_success, success);
+               ret = mi_lttng_writer_write_element_bool(
+                       the_writer, mi_lttng_element_command_success, success);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
index 38e99b4a408a2891298c729c6f28319732bdcd1b..9dd702ec30cae3b14c90e5a5e0849dd134f9bc82 100644 (file)
@@ -6,6 +6,10 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+
 #include <ctype.h>
 #include <popt.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 
-#include <common/mi-lttng.hpp>
-
-#include "../command.hpp"
-
 static char *opt_session_name;
 static char *session_name = NULL;
 
@@ -25,7 +25,7 @@ static int metadata_regenerate(int argc, const char **argv);
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-metadata.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -38,16 +38,39 @@ static struct mi_writer *writer;
 
 static struct poptOption long_options[] = {
        /* { longName, shortName, argInfo, argPtr, value, descrip, argDesc, } */
-       { "help",               'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0, },
-       { "session",            's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0},
-       { "list-options",       0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, 0, 0, },
-       { "list-commands",      0, POPT_ARG_NONE, NULL, OPT_LIST_COMMANDS, NULL, NULL},
-       { 0, 0, 0, 0, 0, 0, 0, },
+       {
+               "help",
+               'h',
+               POPT_ARG_NONE,
+               0,
+               OPT_HELP,
+               0,
+               0,
+       },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
+       {
+               "list-options",
+               0,
+               POPT_ARG_NONE,
+               NULL,
+               OPT_LIST_OPTIONS,
+               0,
+               0,
+       },
+       { "list-commands", 0, POPT_ARG_NONE, NULL, OPT_LIST_COMMANDS, NULL, NULL },
+       {
+               0,
+               0,
+               0,
+               0,
+               0,
+               0,
+               0,
+       },
 };
 
 static struct cmd_struct actions[] = {
-       { "regenerate", metadata_regenerate },
-       { NULL, NULL }  /* Array closure */
+       { "regenerate", metadata_regenerate }, { NULL, NULL } /* Array closure */
 };
 
 /*
@@ -66,8 +89,7 @@ static int count_arguments(const char **argv)
        return i;
 }
 
-static int metadata_regenerate(int argc,
-               const char **argv __attribute__((unused)))
+static int metadata_regenerate(int argc, const char **argv __attribute__((unused)))
 {
        int ret;
 
@@ -106,16 +128,16 @@ static int handle_command(const char **argv)
                if (strcmp(argv[0], cmd->name) == 0) {
                        if (lttng_opt_mi) {
                                /* Action element */
-                               ret = mi_lttng_writer_open_element(writer,
-                                               mi_lttng_element_command_metadata_action);
+                               ret = mi_lttng_writer_open_element(
+                                       writer, mi_lttng_element_command_metadata_action);
                                if (ret) {
                                        ret = CMD_ERROR;
                                        goto end;
                                }
 
                                /* Name of the action */
-                               ret = mi_lttng_writer_write_element_string(writer,
-                                               config_element_name, argv[0]);
+                               ret = mi_lttng_writer_write_element_string(
+                                       writer, config_element_name, argv[0]);
                                if (ret) {
                                        ret = CMD_ERROR;
                                        goto end;
@@ -168,16 +190,14 @@ int cmd_metadata(int argc, const char **argv)
                        goto end;
                }
                /* Open command element */
-               ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_metadata);
+               ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_metadata);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -226,8 +246,8 @@ int cmd_metadata(int argc, const char **argv)
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success, success);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, success);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
index 936b7d7ca3111247ece764c2ae981714151f1eff..728c7310819085bdc7c9355e8da0010f6cdf4e9f 100644 (file)
@@ -6,6 +6,10 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+
 #include <ctype.h>
 #include <popt.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 
-#include <common/mi-lttng.hpp>
-
-#include "../command.hpp"
-
 static char *opt_session_name;
 static char *session_name = NULL;
 
@@ -26,7 +26,7 @@ static int regenerate_statedump(int argc, const char **argv);
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-regenerate.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -39,17 +39,41 @@ static struct mi_writer *writer;
 
 static struct poptOption long_options[] = {
        /* { longName, shortName, argInfo, argPtr, value, descrip, argDesc, } */
-       { "help",               'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0, },
-       { "session",            's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0},
-       { "list-options",       0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, 0, 0, },
-       { "list-commands",      0, POPT_ARG_NONE, NULL, OPT_LIST_COMMANDS, NULL, NULL},
-       { 0, 0, 0, 0, 0, 0, 0, },
+       {
+               "help",
+               'h',
+               POPT_ARG_NONE,
+               0,
+               OPT_HELP,
+               0,
+               0,
+       },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
+       {
+               "list-options",
+               0,
+               POPT_ARG_NONE,
+               NULL,
+               OPT_LIST_OPTIONS,
+               0,
+               0,
+       },
+       { "list-commands", 0, POPT_ARG_NONE, NULL, OPT_LIST_COMMANDS, NULL, NULL },
+       {
+               0,
+               0,
+               0,
+               0,
+               0,
+               0,
+               0,
+       },
 };
 
 static struct cmd_struct actions[] = {
        { "metadata", regenerate_metadata },
        { "statedump", regenerate_statedump },
-       { NULL, NULL }  /* Array closure */
+       { NULL, NULL } /* Array closure */
 };
 
 /*
@@ -68,8 +92,7 @@ static int count_arguments(const char **argv)
        return i;
 }
 
-static int regenerate_metadata(int argc,
-               const char **argv __attribute__((unused)))
+static int regenerate_metadata(int argc, const char **argv __attribute__((unused)))
 {
        int ret;
 
@@ -88,8 +111,7 @@ end:
        return ret;
 }
 
-static int regenerate_statedump(int argc,
-               const char **argv __attribute__((unused)))
+static int regenerate_statedump(int argc, const char **argv __attribute__((unused)))
 {
        int ret;
 
@@ -126,16 +148,16 @@ static int handle_command(const char **argv)
                if (strcmp(argv[0], cmd->name) == 0) {
                        if (lttng_opt_mi) {
                                /* Action element */
-                               ret = mi_lttng_writer_open_element(writer,
-                                               mi_lttng_element_command_regenerate_action);
+                               ret = mi_lttng_writer_open_element(
+                                       writer, mi_lttng_element_command_regenerate_action);
                                if (ret) {
                                        ret = CMD_ERROR;
                                        goto end;
                                }
 
                                /* Name of the action */
-                               ret = mi_lttng_writer_write_element_string(writer,
-                                               config_element_name, argv[0]);
+                               ret = mi_lttng_writer_write_element_string(
+                                       writer, config_element_name, argv[0]);
                                if (ret) {
                                        ret = CMD_ERROR;
                                        goto end;
@@ -188,16 +210,14 @@ int cmd_regenerate(int argc, const char **argv)
                        goto end;
                }
                /* Open command element */
-               ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_regenerate);
+               ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_regenerate);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -246,8 +266,8 @@ int cmd_regenerate(int argc, const char **argv)
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success, success);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, success);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
index 65b5e79a9b4b18b562e536772b87bfd4f94e0a89..53e71c87d94b0b09eca8ae3427996d049a849d6d 100644 (file)
@@ -6,16 +6,18 @@
  */
 
 #include "../command.hpp"
-#include "common/argpar/argpar.h"
 #include "common/argpar-utils/argpar-utils.hpp"
+#include "common/argpar/argpar.h"
 #include "common/mi-lttng.hpp"
+
 #include <lttng/lttng.h>
+
 #include <stdio.h>
 
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-remove-trigger.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -24,16 +26,14 @@ enum {
        OPT_OWNER_UID,
 };
 
-static const
-struct argpar_opt_descr remove_trigger_options[] = {
+static const struct argpar_opt_descr remove_trigger_options[] = {
        { OPT_HELP, 'h', "help", false },
        { OPT_LIST_OPTIONS, '\0', "list-options", false },
        { OPT_OWNER_UID, '\0', "owner-uid", true },
        ARGPAR_OPT_DESCR_SENTINEL,
 };
 
-static
-bool assign_string(char **dest, const char *src, const char *opt_name)
+static bool assign_string(char **dest, const char *src, const char *opt_name)
 {
        bool ret;
 
@@ -75,8 +75,7 @@ int cmd_remove_trigger(int argc, const char **argv)
        struct mi_writer *mi_writer = NULL;
 
        if (lttng_opt_mi) {
-               mi_writer = mi_lttng_writer_create(
-                               fileno(stdout), lttng_opt_mi);
+               mi_writer = mi_lttng_writer_create(fileno(stdout), lttng_opt_mi);
                if (!mi_writer) {
                        ret = CMD_ERROR;
                        goto error;
@@ -84,15 +83,14 @@ int cmd_remove_trigger(int argc, const char **argv)
 
                /* Open command element. */
                ret = mi_lttng_writer_command_open(mi_writer,
-                               mi_lttng_element_command_remove_trigger);
+                                                  mi_lttng_element_command_remove_trigger);
                if (ret) {
                        ret = CMD_ERROR;
                        goto error;
                }
 
                /* Open output element. */
-               ret = mi_lttng_writer_open_element(
-                               mi_writer, mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(mi_writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto error;
@@ -111,10 +109,9 @@ int cmd_remove_trigger(int argc, const char **argv)
        while (true) {
                enum parse_next_item_status status;
 
-               status = parse_next_item(argpar_iter, &argpar_item, 1, argv,
-                       true, NULL, NULL);
+               status = parse_next_item(argpar_iter, &argpar_item, 1, argv, true, NULL, NULL);
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR ||
-                               status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
+                   status == PARSE_NEXT_ITEM_STATUS_ERROR_MEMORY) {
                        goto error;
                } else if (status == PARSE_NEXT_ITEM_STATUS_END) {
                        break;
@@ -123,8 +120,7 @@ int cmd_remove_trigger(int argc, const char **argv)
                assert(status == PARSE_NEXT_ITEM_STATUS_OK);
 
                if (argpar_item_type(argpar_item) == ARGPAR_ITEM_TYPE_OPT) {
-                       const struct argpar_opt_descr *descr =
-                               argpar_item_opt_descr(argpar_item);
+                       const struct argpar_opt_descr *descr = argpar_item_opt_descr(argpar_item);
                        const char *arg = argpar_item_opt_arg(argpar_item);
 
                        switch (descr->id) {
@@ -133,14 +129,12 @@ int cmd_remove_trigger(int argc, const char **argv)
                                ret = 0;
                                goto end;
                        case OPT_LIST_OPTIONS:
-                               list_cmd_options_argpar(stdout,
-                                       remove_trigger_options);
+                               list_cmd_options_argpar(stdout, remove_trigger_options);
                                ret = 0;
                                goto end;
                        case OPT_OWNER_UID:
                        {
-                               if (!assign_string(&owner_uid, arg,
-                                               "--owner-uid")) {
+                               if (!assign_string(&owner_uid, arg, "--owner-uid")) {
                                        goto error;
                                }
                                break;
@@ -203,8 +197,7 @@ int cmd_remove_trigger(int argc, const char **argv)
                        abort();
                }
 
-               trigger_status = lttng_trigger_get_owner_uid(
-                               trigger, &trigger_uid);
+               trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
                LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
                if (trigger_uid == uid && strcmp(trigger_name, name) == 0) {
@@ -225,8 +218,7 @@ int cmd_remove_trigger(int argc, const char **argv)
        }
 
        if (lttng_opt_mi) {
-               ret_code = lttng_trigger_mi_serialize(
-                               trigger_to_remove, mi_writer, NULL);
+               ret_code = lttng_trigger_mi_serialize(trigger_to_remove, mi_writer, NULL);
                if (ret_code != LTTNG_OK) {
                        goto error;
                }
@@ -249,8 +241,8 @@ end:
                        goto cleanup;
                }
 
-               mi_ret = mi_lttng_writer_write_element_bool(mi_writer,
-                               mi_lttng_element_command_success, ret ? 0 : 1);
+               mi_ret = mi_lttng_writer_write_element_bool(
+                       mi_writer, mi_lttng_element_command_success, ret ? 0 : 1);
                if (mi_ret) {
                        ret = 1;
                        goto cleanup;
index 27263da16b5b0441de69d0e64beb91157fb3d598..79324cdc533e3867046584aa962e501eef8b4618 100644 (file)
@@ -6,6 +6,15 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+
+#include <lttng/lttng.h>
+
+#include <ctype.h>
+#include <inttypes.h>
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <inttypes.h>
-#include <ctype.h>
-
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/mi-lttng.hpp>
-
-#include "../command.hpp"
-#include <lttng/lttng.h>
 
 static int opt_no_wait;
 static struct mi_writer *writer;
@@ -28,7 +29,7 @@ static struct mi_writer *writer;
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-rotate.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -38,10 +39,10 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",      'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {"no-wait",   'n', POPT_ARG_VAL, &opt_no_wait, 1, 0, 0},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { "no-wait", 'n', POPT_ARG_VAL, &opt_no_wait, 1, 0, 0 },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 static int rotate_tracing(char *session_name)
@@ -82,8 +83,7 @@ static int rotate_tracing(char *session_name)
        }
 
        do {
-               rotation_status = lttng_rotation_handle_get_state(handle,
-                               &rotation_state);
+               rotation_status = lttng_rotation_handle_get_state(handle, &rotation_state);
                if (rotation_status != LTTNG_ROTATION_STATUS_OK) {
                        MSG("");
                        ERR("Failed to query the state of the rotation.");
@@ -110,8 +110,7 @@ static int rotate_tracing(char *session_name)
 skip_wait:
        switch (rotation_state) {
        case LTTNG_ROTATION_STATE_COMPLETED:
-               rotation_status = lttng_rotation_handle_get_archive_location(
-                               handle, &location);
+               rotation_status = lttng_rotation_handle_get_archive_location(handle, &location);
                if (rotation_status != LTTNG_ROTATION_STATUS_OK) {
                        ERR("Failed to retrieve the rotation's completed chunk archive location.");
                        cmd_ret = CMD_ERROR;
@@ -132,11 +131,9 @@ skip_wait:
        }
 
        if (!lttng_opt_mi && print_location) {
-               ret = print_trace_archive_location(location,
-                               session_name);
+               ret = print_trace_archive_location(location, session_name);
        } else if (lttng_opt_mi) {
-               ret = mi_lttng_rotate(writer, session_name, rotation_state,
-                               location);
+               ret = mi_lttng_rotate(writer, session_name, rotation_state, location);
        }
 
        if (ret < 0) {
@@ -211,16 +208,14 @@ int cmd_rotate(int argc, const char **argv)
                }
 
                /* Open rotate command */
-               ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_rotate);
+               ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_rotate);
                if (ret) {
                        cmd_ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        cmd_ret = CMD_ERROR;
                        goto end;
@@ -238,9 +233,8 @@ int cmd_rotate(int argc, const char **argv)
                        goto end;
                }
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success,
-                               cmd_ret == CMD_SUCCESS);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, cmd_ret == CMD_SUCCESS);
                if (ret) {
                        cmd_ret = CMD_ERROR;
                        goto end;
index 91e80394e734d8fb0621490379faa14d75da295c..0a2a370bd1ea5b6ab6acf24a6bc826e98bc688e6 100644 (file)
@@ -6,17 +6,18 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+
+#include <lttng/lttng.h>
+
 #include <inttypes.h>
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include <common/mi-lttng.hpp>
-
-#include "../command.hpp"
-#include <lttng/lttng.h>
-
 static char *opt_output_path;
 static bool opt_force;
 static bool opt_save_all;
@@ -25,7 +26,7 @@ static struct mi_writer *writer;
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-save.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -37,12 +38,12 @@ enum {
 
 static struct poptOption save_opts[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",        'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL},
-       {"all",         'a', POPT_ARG_NONE, NULL, OPT_ALL, NULL, NULL},
-       {"output-path", 'o', POPT_ARG_STRING, &opt_output_path, 0, NULL, NULL},
-       {"force",       'f', POPT_ARG_NONE, NULL, OPT_FORCE, NULL, NULL},
-       {"list-options",  0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
+       { "all", 'a', POPT_ARG_NONE, NULL, OPT_ALL, NULL, NULL },
+       { "output-path", 'o', POPT_ARG_STRING, &opt_output_path, 0, NULL, NULL },
+       { "force", 'f', POPT_ARG_NONE, NULL, OPT_FORCE, NULL, NULL },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 static int mi_partial_session(const char *session_name)
@@ -57,8 +58,7 @@ static int mi_partial_session(const char *session_name)
                goto end;
        }
 
-       ret = mi_lttng_writer_write_element_string(writer, config_element_name,
-                       session_name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, session_name);
        if (ret) {
                goto end;
        }
@@ -96,8 +96,8 @@ static int mi_save_print(const char *session_name)
 
        /* Path element */
        if (opt_output_path) {
-               ret = mi_lttng_writer_write_element_string(writer, config_element_path,
-                               opt_output_path);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, config_element_path, opt_output_path);
                if (ret) {
                        goto end;
                }
@@ -190,16 +190,14 @@ int cmd_save(int argc, const char **argv)
                }
 
                /* Open command element */
-               ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_save);
+               ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_save);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end_destroy;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end_destroy;
@@ -213,13 +211,13 @@ int cmd_save(int argc, const char **argv)
        } else {
                /* Inform the user of what just happened on success. */
                if (arg_session_name && opt_output_path) {
-                       MSG("Session %s saved successfully in %s.", arg_session_name,
-                                       opt_output_path);
+                       MSG("Session %s saved successfully in %s.",
+                           arg_session_name,
+                           opt_output_path);
                } else if (arg_session_name && !opt_output_path) {
                        MSG("Session %s saved successfully.", arg_session_name);
                } else if (!arg_session_name && opt_output_path) {
-                       MSG("All sessions have been saved successfully in %s.",
-                                       opt_output_path);
+                       MSG("All sessions have been saved successfully in %s.", opt_output_path);
                } else {
                        MSG("All sessions have been saved successfully.");
                }
@@ -243,8 +241,8 @@ int cmd_save(int argc, const char **argv)
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success, success);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, success);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end_destroy;
index dfd247a22e674d74b366c06a0194b5898d8c9d4f..621c8af36c18d1432bec60039f2f02739e624b95 100644 (file)
@@ -6,6 +6,10 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/mi-lttng.hpp>
-
-#include "../command.hpp"
-
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-set-session.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -33,9 +33,9 @@ static struct mi_writer *writer;
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",           'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"list-options",   0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 /*
@@ -64,8 +64,7 @@ static int mi_print(const char *session_name)
        }
 
        /* Session name */
-       ret = mi_lttng_writer_write_element_string(writer , config_element_name,
-                       session_name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, session_name);
        if (ret) {
                goto end;
        }
@@ -90,8 +89,7 @@ static int set_session(const char *session_name)
        struct lttng_session *sessions;
 
        if (session_name && strlen(session_name) > NAME_MAX) {
-               ERR("Session name too long. Length must be lower or equal to %d",
-                       NAME_MAX);
+               ERR("Session name too long. Length must be lower or equal to %d", NAME_MAX);
                ret = CMD_ERROR;
                goto end;
        }
@@ -182,16 +180,14 @@ int cmd_set_session(int argc, const char **argv)
                }
 
                /* Open command element */
-               ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_set_session);
+               ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_set_session);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -213,8 +209,8 @@ int cmd_set_session(int argc, const char **argv)
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success, success);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, success);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
index 3cb66c5557406ed3585d80f1f4c4185cda51be9e..4075b71989e81981b0ea545a4e02af05edfb8b28 100644 (file)
@@ -6,6 +6,13 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+#include <common/utils.hpp>
+
+#include <lttng/lttng.h>
+
 #include <inttypes.h>
 #include <popt.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/utils.hpp>
-#include <common/mi-lttng.hpp>
-#include <lttng/lttng.h>
-
-#include "../command.hpp"
-
 static const char *opt_session_name;
 static const char *opt_output_name;
 static const char *opt_data_url;
@@ -39,7 +40,7 @@ static const char *indent4 = "    ";
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-snapshot.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -53,15 +54,15 @@ static struct mi_writer *writer;
 
 static struct poptOption snapshot_opts[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",      'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"session",      's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0},
-       {"ctrl-url",     'C', POPT_ARG_STRING, &opt_ctrl_url, 0, 0, 0},
-       {"data-url",     'D', POPT_ARG_STRING, &opt_data_url, 0, 0, 0},
-       {"name",         'n', POPT_ARG_STRING, &opt_output_name, 0, 0, 0},
-       {"max-size",     'm', POPT_ARG_STRING, 0, OPT_MAX_SIZE, 0, 0},
-       {"list-options",   0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {"list-commands",  0, POPT_ARG_NONE, NULL, OPT_LIST_COMMANDS, NULL, NULL},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 },
+       { "ctrl-url", 'C', POPT_ARG_STRING, &opt_ctrl_url, 0, 0, 0 },
+       { "data-url", 'D', POPT_ARG_STRING, &opt_data_url, 0, 0, 0 },
+       { "name", 'n', POPT_ARG_STRING, &opt_output_name, 0, 0, 0 },
+       { "max-size", 'm', POPT_ARG_STRING, 0, OPT_MAX_SIZE, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { "list-commands", 0, POPT_ARG_NONE, NULL, OPT_LIST_COMMANDS, NULL, NULL },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 static struct cmd_struct actions[] = {
@@ -69,7 +70,7 @@ static struct cmd_struct actions[] = {
        { "del-output", cmd_del_output },
        { "list-output", cmd_list_output },
        { "record", cmd_record },
-       { NULL, NULL }  /* Array closure */
+       { NULL, NULL } /* Array closure */
 };
 
 /*
@@ -158,8 +159,7 @@ static int list_output(void)
        MSG("Snapshot output list for session %s", current_session_name);
 
        if (lttng_opt_mi) {
-               ret = mi_lttng_snapshot_output_session_name(writer,
-                               current_session_name);
+               ret = mi_lttng_snapshot_output_session_name(writer, current_session_name);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -168,16 +168,18 @@ static int list_output(void)
 
        while ((s_iter = lttng_snapshot_output_list_get_next(list)) != NULL) {
                if (lttng_snapshot_output_get_maxsize(s_iter)) {
-                       MSG("%s[%" PRIu32 "] %s: %s (max size: %" PRIu64 " bytes)", indent4,
-                                       lttng_snapshot_output_get_id(s_iter),
-                                       lttng_snapshot_output_get_name(s_iter),
-                                       lttng_snapshot_output_get_ctrl_url(s_iter),
-                                       lttng_snapshot_output_get_maxsize(s_iter));
+                       MSG("%s[%" PRIu32 "] %s: %s (max size: %" PRIu64 " bytes)",
+                           indent4,
+                           lttng_snapshot_output_get_id(s_iter),
+                           lttng_snapshot_output_get_name(s_iter),
+                           lttng_snapshot_output_get_ctrl_url(s_iter),
+                           lttng_snapshot_output_get_maxsize(s_iter));
                } else {
-                       MSG("%s[%" PRIu32 "] %s: %s", indent4,
-                                       lttng_snapshot_output_get_id(s_iter),
-                                       lttng_snapshot_output_get_name(s_iter),
-                                       lttng_snapshot_output_get_ctrl_url(s_iter));
+                       MSG("%s[%" PRIu32 "] %s: %s",
+                           indent4,
+                           lttng_snapshot_output_get_id(s_iter),
+                           lttng_snapshot_output_get_name(s_iter),
+                           lttng_snapshot_output_get_ctrl_url(s_iter));
                }
                output_seen = 1;
                if (lttng_opt_mi) {
@@ -248,15 +250,16 @@ static int del_output(uint32_t id, const char *name)
 
        if (id != UINT32_MAX) {
                MSG("Snapshot output id %" PRIu32 " successfully deleted for session %s",
-                               id, current_session_name);
+                   id,
+                   current_session_name);
        } else {
                MSG("Snapshot output %s successfully deleted for session %s",
-                               name, current_session_name);
+                   name,
+                   current_session_name);
        }
 
        if (lttng_opt_mi) {
-               ret = mi_lttng_snapshot_del_output(writer, id, name,
-                               current_session_name);
+               ret = mi_lttng_snapshot_del_output(writer, id, name, current_session_name);
                if (ret) {
                        ret = CMD_ERROR;
                }
@@ -297,7 +300,9 @@ static int add_output(const char *url)
        n_ptr = lttng_snapshot_output_get_name(output);
        if (*n_ptr == '\0') {
                int pret;
-               pret = snprintf(name, sizeof(name), DEFAULT_SNAPSHOT_NAME "-%" PRIu32,
+               pret = snprintf(name,
+                               sizeof(name),
+                               DEFAULT_SNAPSHOT_NAME "-%" PRIu32,
                                lttng_snapshot_output_get_id(output));
                if (pret < 0) {
                        PERROR("snprintf add output name");
@@ -305,21 +310,21 @@ static int add_output(const char *url)
                n_ptr = name;
        }
 
-       MSG("Snapshot output successfully added for session %s",
-                       current_session_name);
+       MSG("Snapshot output successfully added for session %s", current_session_name);
        if (opt_max_size) {
                MSG("  [%" PRIu32 "] %s: %s (max size: %" PRIu64 " bytes)",
-                               lttng_snapshot_output_get_id(output), n_ptr,
-                               lttng_snapshot_output_get_ctrl_url(output),
-                               lttng_snapshot_output_get_maxsize(output));
+                   lttng_snapshot_output_get_id(output),
+                   n_ptr,
+                   lttng_snapshot_output_get_ctrl_url(output),
+                   lttng_snapshot_output_get_maxsize(output));
        } else {
                MSG("  [%" PRIu32 "] %s: %s",
-                               lttng_snapshot_output_get_id(output), n_ptr,
-                               lttng_snapshot_output_get_ctrl_url(output));
+                   lttng_snapshot_output_get_id(output),
+                   n_ptr,
+                   lttng_snapshot_output_get_ctrl_url(output));
        }
        if (lttng_opt_mi) {
-               ret = mi_lttng_snapshot_add_output(writer, current_session_name,
-                               n_ptr, output);
+               ret = mi_lttng_snapshot_add_output(writer, current_session_name, n_ptr, output);
                if (ret) {
                        ret = CMD_ERROR;
                }
@@ -344,7 +349,7 @@ static int cmd_add_output(int argc, const char **argv)
                switch (-ret) {
                case LTTNG_ERR_SNAPSHOT_UNSUPPORTED:
                        ERR("Session \"%s\" contains a channel that is incompatible with the snapshot functionality.\nMake sure all channels are configured in 'mmap' output mode.",
-                                       current_session_name);
+                           current_session_name);
                        ret = CMD_ERROR;
                        break;
                default:
@@ -385,7 +390,7 @@ end:
 }
 
 static int cmd_list_output(int argc __attribute__((unused)),
-               const char **argv __attribute__((unused)))
+                          const char **argv __attribute__((unused)))
 {
        int ret;
 
@@ -421,13 +426,11 @@ static int record(const char *url)
        if (url) {
                MSG("Snapshot written at: %s", url);
        } else if (opt_ctrl_url) {
-               MSG("Snapshot written to ctrl: %s, data: %s", opt_ctrl_url,
-                               opt_data_url);
+               MSG("Snapshot written to ctrl: %s, data: %s", opt_ctrl_url, opt_data_url);
        }
 
        if (lttng_opt_mi) {
-               ret = mi_lttng_snapshot_record(writer, url, opt_ctrl_url,
-                               opt_data_url);
+               ret = mi_lttng_snapshot_record(writer, url, opt_ctrl_url, opt_data_url);
                if (ret) {
                        ret = CMD_ERROR;
                }
@@ -463,8 +466,7 @@ static enum cmd_error_code handle_command(const char **argv)
                goto end;
        }
 
-       if ((!opt_ctrl_url && opt_data_url) ||
-                       (opt_ctrl_url && !opt_data_url)) {
+       if ((!opt_ctrl_url && opt_data_url) || (opt_ctrl_url && !opt_data_url)) {
                ERR("URLs must be specified for both data and control");
                cmd_ret = CMD_ERROR;
                goto end;
@@ -482,24 +484,24 @@ static enum cmd_error_code handle_command(const char **argv)
 
                        if (lttng_opt_mi) {
                                /* Action element */
-                               mi_ret = mi_lttng_writer_open_element(writer,
-                                               mi_lttng_element_command_action);
+                               mi_ret = mi_lttng_writer_open_element(
+                                       writer, mi_lttng_element_command_action);
                                if (mi_ret) {
                                        cmd_ret = CMD_ERROR;
                                        goto end;
                                }
 
                                /* Name of the action */
-                               mi_ret = mi_lttng_writer_write_element_string(writer,
-                                               config_element_name, argv[0]);
+                               mi_ret = mi_lttng_writer_write_element_string(
+                                       writer, config_element_name, argv[0]);
                                if (mi_ret) {
                                        cmd_ret = CMD_ERROR;
                                        goto end;
                                }
 
                                /* Open output element */
-                               mi_ret = mi_lttng_writer_open_element(writer,
-                                               mi_lttng_element_command_output);
+                               mi_ret = mi_lttng_writer_open_element(
+                                       writer, mi_lttng_element_command_output);
                                if (mi_ret) {
                                        cmd_ret = CMD_ERROR;
                                        goto end;
@@ -544,7 +546,6 @@ static enum cmd_error_code handle_command(const char **argv)
                                cmd_ret = CMD_SUCCESS;
                        }
 
-
                        if (lttng_opt_mi) {
                                /* Close output and action element */
                                mi_ret = mi_lttng_close_multi_element(writer, 2);
@@ -587,16 +588,14 @@ int cmd_snapshot(int argc, const char **argv)
                }
 
                /* Open command element */
-               mi_ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_snapshot);
+               mi_ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_snapshot);
                if (mi_ret) {
                        cmd_ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               mi_ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               mi_ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (mi_ret) {
                        cmd_ret = CMD_ERROR;
                        goto end;
@@ -624,12 +623,10 @@ int cmd_snapshot(int argc, const char **argv)
                {
                        uint64_t val;
                        char *max_size_arg = poptGetOptArg(pc);
-                       const int parse_ret = utils_parse_size_suffix(
-                                       (char *) max_size_arg, &val);
+                       const int parse_ret = utils_parse_size_suffix((char *) max_size_arg, &val);
 
                        if (parse_ret < 0) {
-                               ERR("Unable to handle max-size value %s",
-                                               max_size_arg);
+                               ERR("Unable to handle max-size value %s", max_size_arg);
                                cmd_ret = CMD_ERROR;
                                free(max_size_arg);
                                goto end;
@@ -667,9 +664,8 @@ int cmd_snapshot(int argc, const char **argv)
                }
 
                /* Success ? */
-               mi_ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success,
-                               cmd_ret == CMD_SUCCESS);
+               mi_ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, cmd_ret == CMD_SUCCESS);
                if (mi_ret) {
                        cmd_ret = CMD_ERROR;
                        goto end;
index 9a54d2227812f6022ddb284cdfba8075f0270951..e00cac4c6ad6d8395a2a224d7ff40ec3ab979fcc 100644 (file)
@@ -6,6 +6,11 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/mi-lttng.hpp>
-
-#include "../command.hpp"
-
-
 static struct mi_writer *writer;
 
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-start.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -35,9 +34,9 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",      'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 static int mi_print_session(char *session_name, int enabled)
@@ -51,14 +50,12 @@ static int mi_print_session(char *session_name, int enabled)
        }
 
        /* Print session name element */
-       ret = mi_lttng_writer_write_element_string(writer, config_element_name,
-                       session_name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, session_name);
        if (ret) {
                goto end;
        }
 
-       ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled,
-                       enabled);
+       ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled, enabled);
        if (ret) {
                goto end;
        }
@@ -173,16 +170,14 @@ int cmd_start(int argc, const char **argv)
                }
 
                /* Open command element */
-               ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_start);
+               ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_start);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -192,8 +187,7 @@ int cmd_start(int argc, const char **argv)
                 * Open sessions element
                 * For validation purpose
                 */
-               ret = mi_lttng_writer_open_element(writer,
-                       config_element_sessions);
+               ret = mi_lttng_writer_open_element(writer, config_element_sessions);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -215,8 +209,8 @@ int cmd_start(int argc, const char **argv)
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success, success);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, success);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
index a77830ece028d002ba0cf97ac30019ff585d7267..cd05bf313be1915a2f2bfe4851182b4710ea03b0 100644 (file)
@@ -6,6 +6,10 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+#include "../utils.hpp"
+
+#include <config.h>
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include "../command.hpp"
-#include "../utils.hpp"
-#include <config.h>
-
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-status.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -31,9 +31,9 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",        'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL},
-       {"list-options", 0,  POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 static int status(void)
index ed235bc2989c2c72feb46b31417cacf4e4a4fc4f..37b00417d40c0a30a1c04ca83bfbc5c4c710110c 100644 (file)
@@ -6,6 +6,11 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/mi-lttng.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/mi-lttng.hpp>
-
-#include "../command.hpp"
-
 static int opt_no_wait;
 static struct mi_writer *writer;
 
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-stop.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -35,10 +35,10 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",      'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {"no-wait",   'n', POPT_ARG_VAL, &opt_no_wait, 1, 0, 0},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { "no-wait", 'n', POPT_ARG_VAL, &opt_no_wait, 1, 0, 0 },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 /*
@@ -57,15 +57,13 @@ static int mi_print_session(char *session_name, int enabled)
        }
 
        /* Print session name element */
-       ret = mi_lttng_writer_write_element_string(writer, config_element_name,
-                       session_name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, session_name);
        if (ret) {
                goto end;
        }
 
        /* Is enabled ? */
-       ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled,
-                       enabled);
+       ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled, enabled);
        if (ret) {
                goto end;
        }
@@ -191,16 +189,14 @@ int cmd_stop(int argc, const char **argv)
                }
 
                /* Open command element */
-               ret = mi_lttng_writer_command_open(writer,
-                               mi_lttng_element_command_stop);
+               ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_stop);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -210,8 +206,7 @@ int cmd_stop(int argc, const char **argv)
                 * Open sessions element
                 * For validation
                 */
-               ret = mi_lttng_writer_open_element(writer,
-                               config_element_sessions);
+               ret = mi_lttng_writer_open_element(writer, config_element_sessions);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
@@ -242,8 +237,8 @@ int cmd_stop(int argc, const char **argv)
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success, success);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, success);
                if (ret) {
                        ret = CMD_ERROR;
                        goto end;
index e311304f4aa40bf10a491dab12d2b6f41402ab56..b5320f08f1a54dadc9202e8c5f49de1ca80ba19c 100644 (file)
@@ -8,6 +8,16 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/dynamic-array.hpp>
+#include <common/dynamic-buffer.hpp>
+#include <common/mi-lttng.hpp>
+#include <common/optional.hpp>
+#include <common/tracker.hpp>
+
+#include <lttng/lttng.h>
+
 #include <ctype.h>
 #include <popt.h>
 #include <stdbool.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-
 #include <urcu/list.h>
 
-#include <common/dynamic-array.hpp>
-#include <common/mi-lttng.hpp>
-#include <common/optional.hpp>
-#include <common/dynamic-buffer.hpp>
-#include <common/tracker.hpp>
-
-#include <lttng/lttng.h>
-
-#include "../command.hpp"
-
 namespace {
 struct process_attr_command_args {
        enum lttng_process_attr process_attr;
@@ -66,26 +65,130 @@ static char *opt_str_arg;
 
 static struct poptOption long_options[] = {
        /* { longName, shortName, argInfo, argPtr, value, descrip, argDesc, } */
-       { "help",               'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0, },
-       { "session",            's', POPT_ARG_STRING, &opt_session_name, OPT_SESSION, 0, 0, },
-       { "kernel",             'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0, },
-       { "userspace",          'u', POPT_ARG_VAL, &opt_userspace, 1, 0, 0, },
-       { "pid",                'p', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_str_arg, OPT_PID, 0, 0, },
-       { "vpid",               0, POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_str_arg, OPT_VPID, 0, 0, },
-       { "uid",                0, POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_str_arg, OPT_UID, 0, 0, },
-       { "vuid",               0, POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_str_arg, OPT_VUID, 0, 0, },
-       { "gid",                0, POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_str_arg, OPT_GID, 0, 0, },
-       { "vgid",               0, POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_str_arg, OPT_VGID, 0, 0, },
-       { "all",                'a', POPT_ARG_NONE, 0, OPT_ALL, 0, 0, },
-       { "list-options",       0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, 0, 0, },
-       { 0, 0, 0, 0, 0, 0, 0, },
+       {
+               "help",
+               'h',
+               POPT_ARG_NONE,
+               0,
+               OPT_HELP,
+               0,
+               0,
+       },
+       {
+               "session",
+               's',
+               POPT_ARG_STRING,
+               &opt_session_name,
+               OPT_SESSION,
+               0,
+               0,
+       },
+       {
+               "kernel",
+               'k',
+               POPT_ARG_VAL,
+               &opt_kernel,
+               1,
+               0,
+               0,
+       },
+       {
+               "userspace",
+               'u',
+               POPT_ARG_VAL,
+               &opt_userspace,
+               1,
+               0,
+               0,
+       },
+       {
+               "pid",
+               'p',
+               POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL,
+               &opt_str_arg,
+               OPT_PID,
+               0,
+               0,
+       },
+       {
+               "vpid",
+               0,
+               POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL,
+               &opt_str_arg,
+               OPT_VPID,
+               0,
+               0,
+       },
+       {
+               "uid",
+               0,
+               POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL,
+               &opt_str_arg,
+               OPT_UID,
+               0,
+               0,
+       },
+       {
+               "vuid",
+               0,
+               POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL,
+               &opt_str_arg,
+               OPT_VUID,
+               0,
+               0,
+       },
+       {
+               "gid",
+               0,
+               POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL,
+               &opt_str_arg,
+               OPT_GID,
+               0,
+               0,
+       },
+       {
+               "vgid",
+               0,
+               POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL,
+               &opt_str_arg,
+               OPT_VGID,
+               0,
+               0,
+       },
+       {
+               "all",
+               'a',
+               POPT_ARG_NONE,
+               0,
+               OPT_ALL,
+               0,
+               0,
+       },
+       {
+               "list-options",
+               0,
+               POPT_ARG_NONE,
+               NULL,
+               OPT_LIST_OPTIONS,
+               0,
+               0,
+       },
+       {
+               0,
+               0,
+               0,
+               0,
+               0,
+               0,
+               0,
+       },
 };
 
 static struct process_attr_command_args
-               process_attr_commands[LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID + 1];
+       process_attr_commands[LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID + 1];
 
 static void process_attr_command_init(struct process_attr_command_args *cmd,
-               enum lttng_process_attr process_attr)
+                                     enum lttng_process_attr process_attr)
 {
        cmd->process_attr = process_attr;
        cmd->all = false;
@@ -133,7 +236,7 @@ static bool ust_process_attr_supported(enum lttng_process_attr *process_attr)
                break;
        default:
                ERR("The %s process attribute cannot be tracked in the user space domain.",
-                               lttng_process_attr_to_string(*process_attr));
+                   lttng_process_attr_to_string(*process_attr));
                supported = false;
                break;
        }
@@ -153,22 +256,19 @@ static const char *get_mi_element_command(enum cmd_type cmd_type)
 }
 
 static enum cmd_error_code run_command_all(enum cmd_type cmd_type,
-               const char *session_name,
-               enum lttng_domain_type domain_type,
-               enum lttng_process_attr process_attr,
-               struct mi_writer *writer)
+                                          const char *session_name,
+                                          enum lttng_domain_type domain_type,
+                                          enum lttng_process_attr process_attr,
+                                          struct mi_writer *writer)
 {
        struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
-       const enum lttng_error_code handle_ret_code =
-                       lttng_session_get_tracker_handle(session_name,
-                                       domain_type, process_attr,
-                                       &tracker_handle);
+       const enum lttng_error_code handle_ret_code = lttng_session_get_tracker_handle(
+               session_name, domain_type, process_attr, &tracker_handle);
        enum cmd_error_code cmd_ret = CMD_SUCCESS;
        enum lttng_process_attr_tracker_handle_status status;
 
        if (writer) {
-               const int ret = mi_lttng_all_process_attribute_value(
-                               writer, process_attr, true);
+               const int ret = mi_lttng_all_process_attribute_value(writer, process_attr, true);
                if (ret) {
                        cmd_ret = CMD_FATAL;
                        goto end;
@@ -182,18 +282,17 @@ static enum cmd_error_code run_command_all(enum cmd_type cmd_type,
        }
 
        status = lttng_process_attr_tracker_handle_set_tracking_policy(
-                       tracker_handle,
-                       cmd_type == CMD_TRACK ?
-                                       LTTNG_TRACKING_POLICY_INCLUDE_ALL :
+               tracker_handle,
+               cmd_type == CMD_TRACK ? LTTNG_TRACKING_POLICY_INCLUDE_ALL :
                                        LTTNG_TRACKING_POLICY_EXCLUDE_ALL);
        switch (status) {
        case LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK:
                if (cmd_type == CMD_TRACK) {
                        MSG("%s tracking policy set to `include all`",
-                                       get_capitalized_process_attr_str(process_attr));
+                           get_capitalized_process_attr_str(process_attr));
                } else {
                        MSG("%s tracking policy set to `exclude all`",
-                                       get_capitalized_process_attr_str(process_attr));
+                           get_capitalized_process_attr_str(process_attr));
                }
                break;
        case LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_SESSION_DOES_NOT_EXIST:
@@ -201,17 +300,15 @@ static enum cmd_error_code run_command_all(enum cmd_type cmd_type,
                break;
        default:
                ERR("Unknown error encountered while setting tracking policy of %s tracker to `%s`",
-                               lttng_process_attr_to_string(process_attr),
-                               cmd_type == CMD_TRACK ? "include all" :
-                                                       "exclude all");
+                   lttng_process_attr_to_string(process_attr),
+                   cmd_type == CMD_TRACK ? "include all" : "exclude all");
                cmd_ret = CMD_FATAL;
                break;
        }
 end:
        if (writer) {
-               int ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_success,
-                               cmd_ret == CMD_SUCCESS);
+               int ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_success, cmd_ret == CMD_SUCCESS);
 
                if (ret) {
                        cmd_ret = CMD_FATAL;
@@ -225,17 +322,15 @@ end:
 }
 
 static enum cmd_error_code run_command_string(enum cmd_type cmd_type,
-               const char *session_name,
-               enum lttng_domain_type domain_type,
-               enum lttng_process_attr process_attr,
-               const char *_args,
-               struct mi_writer *writer)
+                                             const char *session_name,
+                                             enum lttng_domain_type domain_type,
+                                             enum lttng_process_attr process_attr,
+                                             const char *_args,
+                                             struct mi_writer *writer)
 {
        struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
-       const enum lttng_error_code handle_ret_code =
-                       lttng_session_get_tracker_handle(session_name,
-                                       domain_type, process_attr,
-                                       &tracker_handle);
+       const enum lttng_error_code handle_ret_code = lttng_session_get_tracker_handle(
+               session_name, domain_type, process_attr, &tracker_handle);
        enum cmd_error_code cmd_ret = CMD_SUCCESS;
        const char *one_value_str;
        char *args = strdup(_args);
@@ -263,15 +358,14 @@ static enum cmd_error_code run_command_string(enum cmd_type cmd_type,
 
                if (!policy_set) {
                        status = lttng_process_attr_tracker_handle_get_tracking_policy(
-                                       tracker_handle, &policy);
+                               tracker_handle, &policy);
                        if (status != LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK) {
                                break;
                        }
 
                        if (policy != LTTNG_TRACKING_POLICY_INCLUDE_SET) {
                                status = lttng_process_attr_tracker_handle_set_tracking_policy(
-                                               tracker_handle,
-                                               LTTNG_TRACKING_POLICY_INCLUDE_SET);
+                                       tracker_handle, LTTNG_TRACKING_POLICY_INCLUDE_SET);
                                if (status != LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK) {
                                        break;
                                }
@@ -280,13 +374,11 @@ static enum cmd_error_code run_command_string(enum cmd_type cmd_type,
                }
 
                if (is_numerical_argument) {
-                       const unsigned long one_value_int =
-                                       strtoul(one_value_str, NULL, 10);
+                       const unsigned long one_value_int = strtoul(one_value_str, NULL, 10);
 
                        if (writer) {
                                ret = mi_lttng_integral_process_attribute_value(
-                                               writer, process_attr,
-                                               (int64_t) one_value_int, true);
+                                       writer, process_attr, (int64_t) one_value_int, true);
                                if (ret) {
                                        cmd_ret = CMD_FATAL;
                                        goto end;
@@ -296,57 +388,45 @@ static enum cmd_error_code run_command_string(enum cmd_type cmd_type,
                        switch (process_attr) {
                        case LTTNG_PROCESS_ATTR_PROCESS_ID:
                                status = cmd_type == CMD_TRACK ?
-                                                        lttng_process_attr_process_id_tracker_handle_add_pid(
-                                                                        tracker_handle,
-                                                                        (pid_t) one_value_int) :
-                                                        lttng_process_attr_process_id_tracker_handle_remove_pid(
-                                                                        tracker_handle,
-                                                                        (pid_t) one_value_int);
+                                       lttng_process_attr_process_id_tracker_handle_add_pid(
+                                               tracker_handle, (pid_t) one_value_int) :
+                                       lttng_process_attr_process_id_tracker_handle_remove_pid(
+                                               tracker_handle, (pid_t) one_value_int);
                                break;
                        case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID:
                                status = cmd_type == CMD_TRACK ?
-                                                        lttng_process_attr_virtual_process_id_tracker_handle_add_pid(
-                                                                        tracker_handle,
-                                                                        (pid_t) one_value_int) :
-                                                        lttng_process_attr_virtual_process_id_tracker_handle_remove_pid(
-                                                                        tracker_handle,
-                                                                        (pid_t) one_value_int);
+                                       lttng_process_attr_virtual_process_id_tracker_handle_add_pid(
+                                               tracker_handle, (pid_t) one_value_int) :
+                                       lttng_process_attr_virtual_process_id_tracker_handle_remove_pid(
+                                               tracker_handle, (pid_t) one_value_int);
                                break;
                        case LTTNG_PROCESS_ATTR_USER_ID:
                                status = cmd_type == CMD_TRACK ?
-                                                        lttng_process_attr_user_id_tracker_handle_add_uid(
-                                                                        tracker_handle,
-                                                                        (uid_t) one_value_int) :
-                                                        lttng_process_attr_user_id_tracker_handle_remove_uid(
-                                                                        tracker_handle,
-                                                                        (uid_t) one_value_int);
+                                       lttng_process_attr_user_id_tracker_handle_add_uid(
+                                               tracker_handle, (uid_t) one_value_int) :
+                                       lttng_process_attr_user_id_tracker_handle_remove_uid(
+                                               tracker_handle, (uid_t) one_value_int);
                                break;
                        case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID:
                                status = cmd_type == CMD_TRACK ?
-                                                        lttng_process_attr_virtual_user_id_tracker_handle_add_uid(
-                                                                        tracker_handle,
-                                                                        (uid_t) one_value_int) :
-                                                        lttng_process_attr_virtual_user_id_tracker_handle_remove_uid(
-                                                                        tracker_handle,
-                                                                        (uid_t) one_value_int);
+                                       lttng_process_attr_virtual_user_id_tracker_handle_add_uid(
+                                               tracker_handle, (uid_t) one_value_int) :
+                                       lttng_process_attr_virtual_user_id_tracker_handle_remove_uid(
+                                               tracker_handle, (uid_t) one_value_int);
                                break;
                        case LTTNG_PROCESS_ATTR_GROUP_ID:
                                status = cmd_type == CMD_TRACK ?
-                                                        lttng_process_attr_group_id_tracker_handle_add_gid(
-                                                                        tracker_handle,
-                                                                        (gid_t) one_value_int) :
-                                                        lttng_process_attr_group_id_tracker_handle_remove_gid(
-                                                                        tracker_handle,
-                                                                        (gid_t) one_value_int);
+                                       lttng_process_attr_group_id_tracker_handle_add_gid(
+                                               tracker_handle, (gid_t) one_value_int) :
+                                       lttng_process_attr_group_id_tracker_handle_remove_gid(
+                                               tracker_handle, (gid_t) one_value_int);
                                break;
                        case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
                                status = cmd_type == CMD_TRACK ?
-                                                        lttng_process_attr_virtual_group_id_tracker_handle_add_gid(
-                                                                        tracker_handle,
-                                                                        (gid_t) one_value_int) :
-                                                        lttng_process_attr_virtual_group_id_tracker_handle_remove_gid(
-                                                                        tracker_handle,
-                                                                        (gid_t) one_value_int);
+                                       lttng_process_attr_virtual_group_id_tracker_handle_add_gid(
+                                               tracker_handle, (gid_t) one_value_int) :
+                                       lttng_process_attr_virtual_group_id_tracker_handle_remove_gid(
+                                               tracker_handle, (gid_t) one_value_int);
                                break;
                        default:
                                abort();
@@ -355,8 +435,7 @@ static enum cmd_error_code run_command_string(enum cmd_type cmd_type,
                } else {
                        if (writer) {
                                ret = mi_lttng_string_process_attribute_value(
-                                               writer, process_attr,
-                                               one_value_str, true);
+                                       writer, process_attr, one_value_str, true);
                                if (ret) {
                                        cmd_ret = CMD_FATAL;
                                        goto end;
@@ -366,53 +445,43 @@ static enum cmd_error_code run_command_string(enum cmd_type cmd_type,
                        switch (process_attr) {
                        case LTTNG_PROCESS_ATTR_USER_ID:
                                status = cmd_type == CMD_TRACK ?
-                                                        lttng_process_attr_user_id_tracker_handle_add_user_name(
-                                                                        tracker_handle,
-                                                                        one_value_str) :
-                                                        lttng_process_attr_user_id_tracker_handle_remove_user_name(
-                                                                        tracker_handle,
-                                                                        one_value_str);
+                                       lttng_process_attr_user_id_tracker_handle_add_user_name(
+                                               tracker_handle, one_value_str) :
+                                       lttng_process_attr_user_id_tracker_handle_remove_user_name(
+                                               tracker_handle, one_value_str);
                                break;
                        case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID:
                                status = cmd_type == CMD_TRACK ?
-                                                        lttng_process_attr_virtual_user_id_tracker_handle_add_user_name(
-                                                                        tracker_handle,
-                                                                        one_value_str) :
-                                                        lttng_process_attr_virtual_user_id_tracker_handle_remove_user_name(
-                                                                        tracker_handle,
-                                                                        one_value_str);
+                                       lttng_process_attr_virtual_user_id_tracker_handle_add_user_name(
+                                               tracker_handle, one_value_str) :
+                                       lttng_process_attr_virtual_user_id_tracker_handle_remove_user_name(
+                                               tracker_handle, one_value_str);
                                break;
                        case LTTNG_PROCESS_ATTR_GROUP_ID:
                                status = cmd_type == CMD_TRACK ?
-                                                        lttng_process_attr_group_id_tracker_handle_add_group_name(
-                                                                        tracker_handle,
-                                                                        one_value_str) :
-                                                        lttng_process_attr_group_id_tracker_handle_remove_group_name(
-                                                                        tracker_handle,
-                                                                        one_value_str);
+                                       lttng_process_attr_group_id_tracker_handle_add_group_name(
+                                               tracker_handle, one_value_str) :
+                                       lttng_process_attr_group_id_tracker_handle_remove_group_name(
+                                               tracker_handle, one_value_str);
                                break;
                        case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
                                status = cmd_type == CMD_TRACK ?
-                                                        lttng_process_attr_virtual_group_id_tracker_handle_add_group_name(
-                                                                        tracker_handle,
-                                                                        one_value_str) :
-                                                        lttng_process_attr_virtual_group_id_tracker_handle_remove_group_name(
-                                                                        tracker_handle,
-                                                                        one_value_str);
+                                       lttng_process_attr_virtual_group_id_tracker_handle_add_group_name(
+                                               tracker_handle, one_value_str) :
+                                       lttng_process_attr_virtual_group_id_tracker_handle_remove_group_name(
+                                               tracker_handle, one_value_str);
                                break;
                        default:
                                ERR("%s is not a valid %s value; expected an integer",
-                                               one_value_str,
-                                               lttng_process_attr_to_string(
-                                                               process_attr));
+                                   one_value_str,
+                                   lttng_process_attr_to_string(process_attr));
                                cmd_ret = CMD_FATAL;
                                goto end;
                        }
                }
 
-               ret = asprintf(&prettified_arg,
-                               is_numerical_argument ? "%s" : "`%s`",
-                               one_value_str);
+               ret = asprintf(
+                       &prettified_arg, is_numerical_argument ? "%s" : "`%s`", one_value_str);
                if (ret < 0) {
                        PERROR("Failed to format argument `%s`", one_value_str);
                        cmd_ret = CMD_FATAL;
@@ -423,14 +492,12 @@ static enum cmd_error_code run_command_string(enum cmd_type cmd_type,
                case LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK:
                        if (cmd_type == CMD_TRACK) {
                                MSG("Added %s to the %s tracker inclusion set",
-                                               one_value_str,
-                                               lttng_process_attr_to_string(
-                                                               process_attr));
+                                   one_value_str,
+                                   lttng_process_attr_to_string(process_attr));
                        } else {
                                MSG("Removed %s from the %s tracker inclusion set",
-                                               one_value_str,
-                                               lttng_process_attr_to_string(
-                                                               process_attr));
+                                   one_value_str,
+                                   lttng_process_attr_to_string(process_attr));
                        }
                        break;
                case LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_SESSION_DOES_NOT_EXIST:
@@ -438,15 +505,13 @@ static enum cmd_error_code run_command_string(enum cmd_type cmd_type,
                        break;
                case LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_EXISTS:
                        WARN("%s is already in the %s inclusion set",
-                                       prettified_arg,
-                                       lttng_process_attr_to_string(
-                                                       process_attr));
+                            prettified_arg,
+                            lttng_process_attr_to_string(process_attr));
                        break;
                case LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_MISSING:
                        WARN("%s is not in the %s the inclusion set",
-                                       prettified_arg,
-                                       lttng_process_attr_to_string(
-                                                       process_attr));
+                            prettified_arg,
+                            lttng_process_attr_to_string(process_attr));
                        break;
                case LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_USER_NOT_FOUND:
                        ERR("User %s was not found", prettified_arg);
@@ -458,21 +523,18 @@ static enum cmd_error_code run_command_string(enum cmd_type cmd_type,
                        break;
                default:
                        ERR("Unknown error encountered while %s %s %s %s tracker's inclusion set",
-                                       cmd_type == CMD_TRACK ? "adding" :
-                                                               "removing",
-                                       lttng_process_attr_to_string(
-                                                       process_attr),
-                                       prettified_arg,
-                                       cmd_type == CMD_TRACK ? "to" : "from");
+                           cmd_type == CMD_TRACK ? "adding" : "removing",
+                           lttng_process_attr_to_string(process_attr),
+                           prettified_arg,
+                           cmd_type == CMD_TRACK ? "to" : "from");
                        cmd_ret = CMD_FATAL;
                        break;
                }
                free(prettified_arg);
 
                if (writer) {
-                       ret = mi_lttng_writer_write_element_bool(writer,
-                                       mi_lttng_element_success,
-                                       cmd_ret == CMD_SUCCESS);
+                       ret = mi_lttng_writer_write_element_bool(
+                               writer, mi_lttng_element_success, cmd_ret == CMD_SUCCESS);
 
                        if (ret) {
                                cmd_ret = CMD_FATAL;
@@ -489,17 +551,16 @@ end:
 }
 
 static enum cmd_error_code run_command(enum cmd_type cmd_type,
-               const char *session_name,
-               const struct process_attr_command_args *command_args,
-               struct mi_writer *writer)
+                                      const char *session_name,
+                                      const struct process_attr_command_args *command_args,
+                                      struct mi_writer *writer)
 {
-       const enum lttng_domain_type domain_type =
-                       opt_kernel ? LTTNG_DOMAIN_KERNEL : LTTNG_DOMAIN_UST;
+       const enum lttng_domain_type domain_type = opt_kernel ? LTTNG_DOMAIN_KERNEL :
+                                                               LTTNG_DOMAIN_UST;
        enum cmd_error_code cmd_ret = CMD_SUCCESS;
        unsigned int i;
        const unsigned int string_arg_count =
-                       lttng_dynamic_pointer_array_get_count(
-                                       &command_args->string_args);
+               lttng_dynamic_pointer_array_get_count(&command_args->string_args);
        enum lttng_process_attr process_attr = command_args->process_attr;
 
        if (opt_userspace) {
@@ -516,8 +577,7 @@ static enum cmd_error_code run_command(enum cmd_type cmd_type,
 
        if (writer) {
                /* Open tracker and trackers elements */
-               const int ret = mi_lttng_process_attribute_tracker_open(
-                               writer, process_attr);
+               const int ret = mi_lttng_process_attribute_tracker_open(writer, process_attr);
                if (ret) {
                        cmd_ret = CMD_FATAL;
                        goto end;
@@ -525,17 +585,17 @@ static enum cmd_error_code run_command(enum cmd_type cmd_type,
        }
 
        if (command_args->all) {
-               cmd_ret = run_command_all(cmd_type, session_name, domain_type,
-                               process_attr, writer);
+               cmd_ret =
+                       run_command_all(cmd_type, session_name, domain_type, process_attr, writer);
        } else {
                bool error_occurred = false;
 
                for (i = 0; i < string_arg_count; i++) {
                        const char *arg = (const char *) lttng_dynamic_pointer_array_get_pointer(
-                                       &command_args->string_args, i);
+                               &command_args->string_args, i);
 
-                       cmd_ret = run_command_string(cmd_type, session_name,
-                                       domain_type, process_attr, arg, writer);
+                       cmd_ret = run_command_string(
+                               cmd_type, session_name, domain_type, process_attr, arg, writer);
                        if (cmd_ret != CMD_SUCCESS) {
                                error_occurred = true;
                                if (cmd_ret == CMD_FATAL) {
@@ -551,8 +611,7 @@ static enum cmd_error_code run_command(enum cmd_type cmd_type,
 
        if (writer) {
                /* Close tracker and trackers elements */
-               const int ret = mi_lttng_close_multi_element(
-                               writer, 2);
+               const int ret = mi_lttng_close_multi_element(writer, 2);
                if (ret) {
                        cmd_ret = CMD_FATAL;
                        goto end;
@@ -566,17 +625,16 @@ end:
  * Add/remove tracker to/from session.
  */
 static int cmd_track_untrack(enum cmd_type cmd_type,
-               int argc,
-               const char **argv,
-               const char *help_msg __attribute__((unused)))
+                            int argc,
+                            const char **argv,
+                            const char *help_msg __attribute__((unused)))
 {
        int opt, ret = 0;
        bool sub_command_failed = false;
        bool opt_all = false;
        unsigned int selected_process_attr_tracker_count = 0;
        const unsigned int command_count =
-                       sizeof(process_attr_commands) /
-                       sizeof(struct process_attr_command_args);
+               sizeof(process_attr_commands) / sizeof(struct process_attr_command_args);
        enum cmd_error_code command_ret = CMD_SUCCESS;
        static poptContext pc;
        char *session_name = NULL;
@@ -620,8 +678,7 @@ static int cmd_track_untrack(enum cmd_type cmd_type,
                                continue;
                        }
                        ret = lttng_dynamic_pointer_array_add_pointer(
-                                       &process_attr_commands[opt].string_args,
-                                       opt_str_arg);
+                               &process_attr_commands[opt].string_args, opt_str_arg);
                        if (ret) {
                                ERR("Allocation failed while parsing command arguments");
                                command_ret = CMD_ERROR;
@@ -637,8 +694,7 @@ static int cmd_track_untrack(enum cmd_type cmd_type,
                }
        }
 
-       ret = print_missing_or_multiple_domains(
-                       opt_kernel + opt_userspace, false);
+       ret = print_missing_or_multiple_domains(opt_kernel + opt_userspace, false);
        if (ret) {
                command_ret = CMD_ERROR;
                goto end;
@@ -660,8 +716,7 @@ static int cmd_track_untrack(enum cmd_type cmd_type,
                        }
                        process_attr_commands[i].all = true;
                        if (lttng_dynamic_pointer_array_get_count(
-                                           &process_attr_commands[i]
-                                                            .string_args)) {
+                                   &process_attr_commands[i].string_args)) {
                                ERR("The --all option cannot be used with a list of process attribute values");
                                command_ret = CMD_ERROR;
                                goto end;
@@ -673,12 +728,10 @@ static int cmd_track_untrack(enum cmd_type cmd_type,
                                continue;
                        }
                        if (lttng_dynamic_pointer_array_get_count(
-                                   &process_attr_commands[i]
-                                   .string_args) == 0) {
+                                   &process_attr_commands[i].string_args) == 0) {
                                ERR("No process attribute value specified for %s tracker",
-                                               get_capitalized_process_attr_str(
-                                                               process_attr_commands[i]
-                                                                               .process_attr));
+                                   get_capitalized_process_attr_str(
+                                           process_attr_commands[i].process_attr));
                                command_ret = CMD_ERROR;
                                goto end;
                        }
@@ -713,16 +766,14 @@ static int cmd_track_untrack(enum cmd_type cmd_type,
 
        if (writer) {
                /* Open command element */
-               ret = mi_lttng_writer_command_open(writer,
-                               get_mi_element_command(cmd_type));
+               ret = mi_lttng_writer_command_open(writer, get_mi_element_command(cmd_type));
                if (ret) {
                        command_ret = CMD_ERROR;
                        goto end;
                }
 
                /* Open output element */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_command_output);
+               ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
                if (ret) {
                        command_ret = CMD_ERROR;
                        goto end;
@@ -739,8 +790,8 @@ static int cmd_track_untrack(enum cmd_type cmd_type,
                if (!process_attr_commands[i].requested) {
                        continue;
                }
-               command_ret = run_command(cmd_type, session_name,
-                               &process_attr_commands[i], writer);
+               command_ret =
+                       run_command(cmd_type, session_name, &process_attr_commands[i], writer);
                if (command_ret != CMD_SUCCESS) {
                        sub_command_failed = true;
                        if (command_ret == CMD_FATAL) {
@@ -759,9 +810,8 @@ static int cmd_track_untrack(enum cmd_type cmd_type,
                }
 
                /* Success ? */
-               ret = mi_lttng_writer_write_element_bool(writer,
-                               mi_lttng_element_command_success,
-                               !sub_command_failed);
+               ret = mi_lttng_writer_write_element_bool(
+                       writer, mi_lttng_element_command_success, !sub_command_failed);
                if (ret) {
                        command_ret = CMD_ERROR;
                        goto end;
@@ -800,9 +850,9 @@ int cmd_track(int argc, const char **argv)
 #ifdef LTTNG_EMBED_HELP
 #include <lttng-track.1.h>
 #else
-       NULL
+               NULL
 #endif
-       ;
+               ;
 
        return cmd_track_untrack(CMD_TRACK, argc, argv, help_msg);
 }
@@ -813,9 +863,9 @@ int cmd_untrack(int argc, const char **argv)
 #ifdef LTTNG_EMBED_HELP
 #include <lttng-untrack.1.h>
 #else
-       NULL
+               NULL
 #endif
-       ;
+               ;
 
        return cmd_track_untrack(CMD_UNTRACK, argc, argv, help_msg);
 }
index e4aed95ad8ac3ad442442240098598c9e05ffe95..0e59b8dbfb8af31e7dd5677e4d796146d9ddae28 100644 (file)
@@ -6,6 +6,11 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+#include "version.hpp"
+
+#include <common/mi-lttng.hpp>
+
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/mi-lttng.hpp>
-
-#include "../command.hpp"
-#include "version.hpp"
-
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-version.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -34,9 +34,9 @@ static const char *lttng_license = "lttng is free software and under the GPL lic
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",      'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 /*
@@ -71,24 +71,21 @@ static int print_mi(void)
        }
 
        /* Open the command element */
-       ret = mi_lttng_writer_command_open(writer,
-                       mi_lttng_element_command_version);
+       ret = mi_lttng_writer_command_open(writer, mi_lttng_element_command_version);
        if (ret) {
                ret = CMD_ERROR;
                goto error;
        }
 
        /* Beginning of output */
-       ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_command_output);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output);
        if (ret) {
                ret = CMD_ERROR;
                goto error;
        }
 
        /* Print the machine interface of version */
-       ret = mi_lttng_version(writer, &version,
-                       VERSION_DESCRIPTION, lttng_license);
+       ret = mi_lttng_version(writer, &version, VERSION_DESCRIPTION, lttng_license);
        if (ret) {
                ret = CMD_ERROR;
                goto error;
@@ -147,7 +144,7 @@ int cmd_version(int argc, const char **argv)
                ret = print_mi();
        } else {
                MSG("lttng version " VERSION " - " VERSION_NAME "%s",
-                       GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION);
+                   GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION);
                MSG("\n" VERSION_DESCRIPTION "\n");
                MSG("Web site: https://lttng.org");
                MSG("\n%s", lttng_license);
index cff6941f58b96933bd7cde48bdf257536338045a..d2ac61bb57365f2039188ac12565f88408c8b8cb 100644 (file)
@@ -6,6 +6,10 @@
  */
 
 #define _LGPL_SOURCE
+#include "../command.hpp"
+
+#include <common/spawn-viewer.hpp>
+
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/spawn-viewer.hpp>
-#include "../command.hpp"
-
 static char *opt_viewer;
 static char *opt_trace_path;
 
 #ifdef LTTNG_EMBED_HELP
 static const char help_msg[] =
 #include <lttng-view.1.h>
-;
+       ;
 #endif
 
 enum {
@@ -33,11 +34,11 @@ enum {
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"help",        'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
-       {"list-options", 0,  POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
-       {"viewer",      'e', POPT_ARG_STRING, &opt_viewer, 0, 0, 0},
-       {"trace-path",  't', POPT_ARG_STRING, &opt_trace_path, 0, 0, 0},
-       {0, 0, 0, 0, 0, 0, 0}
+       { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 },
+       { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL },
+       { "viewer", 'e', POPT_ARG_STRING, &opt_viewer, 0, 0, 0 },
+       { "trace-path", 't', POPT_ARG_STRING, &opt_trace_path, 0, 0, 0 },
+       { 0, 0, 0, 0, 0, 0, 0 }
 };
 
 /* Is the session we are trying to view is in live mode. */
@@ -58,8 +59,7 @@ static char *build_live_path(char *session_name)
                goto error;
        }
 
-       ret = asprintf(&path, "net://localhost/host/%s/%s", hostname,
-                       session_name);
+       ret = asprintf(&path, "net://localhost/host/%s/%s", hostname, session_name);
        if (ret < 0) {
                PERROR("asprintf live path");
                goto error;
@@ -122,8 +122,7 @@ static int view_trace(const char *arg_session_name)
                /* Getting all sessions */
                count = lttng_list_sessions(&sessions);
                if (count < 0) {
-                       ERR("Unable to list sessions. Session name %s not found.",
-                                       session_name);
+                       ERR("Unable to list sessions. Session name %s not found.", session_name);
                        MSG("Is there a session daemon running?");
                        ret = CMD_ERROR;
                        goto free_error;
@@ -149,7 +148,7 @@ static int view_trace(const char *arg_session_name)
 
                if (sessions[i].enabled && !session_live_mode) {
                        WARN("Session %s is running. Please stop it before reading it.",
-                                       session_name);
+                            session_name);
                        ret = CMD_ERROR;
                        goto free_sessions;
                }
index 33550eb3778fe5fb636c0700618b153804f84057..44630b681135843eab58022294c89479dc003d19 100644 (file)
@@ -6,6 +6,12 @@
  */
 
 #define _LGPL_SOURCE
+#include "conf.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/errno.hpp>
+#include <common/utils.hpp>
+
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/compat/errno.hpp>
-#include <common/common.hpp>
-#include <common/utils.hpp>
-
-#include "conf.hpp"
-
 /*
  * Returns the path with '/CONFIG_FILENAME' added to it;
  * path will be NULL if an error occurs.
@@ -167,15 +167,14 @@ int config_exists(const char *path)
        return S_ISREG(info.st_mode) || S_ISDIR(info.st_mode);
 }
 
-static
-int _config_read_session_name(const char *path, char **name)
+static int _config_read_session_name(const char *path, char **name)
 {
        int ret = 0;
        FILE *fp;
        char var[NAME_MAX], *session_name;
 
 #if (NAME_MAX == 255)
-#define NAME_MAX_SCANF_IS_A_BROKEN_API "254"
+#define NAME_MAX_SCANF_IS_A_BROKEN_API "254"
 #endif
 
        session_name = calloc<char>(NAME_MAX);
@@ -192,9 +191,11 @@ int _config_read_session_name(const char *path, char **name)
        }
 
        while (!feof(fp)) {
-               if ((ret = fscanf(fp, "%" NAME_MAX_SCANF_IS_A_BROKEN_API
-                               "[^'=']=%" NAME_MAX_SCANF_IS_A_BROKEN_API "s\n",
-                               var, session_name)) != 2) {
+               if ((ret = fscanf(fp,
+                                 "%" NAME_MAX_SCANF_IS_A_BROKEN_API
+                                 "[^'=']=%" NAME_MAX_SCANF_IS_A_BROKEN_API "s\n",
+                                 var,
+                                 session_name)) != 2) {
                        if (ret == -1) {
                                ERR("Missing session=NAME in config file.");
                                goto error_close;
index 6b9881a025bcd8004982b059fd4fd99e4f96657a..4c8619168e995cd528f00f3f62c9085759834668 100644 (file)
@@ -6,9 +6,10 @@
  */
 
 #include "loglevel.hpp"
+
+#include <ctype.h>
 #include <string.h>
 #include <strings.h>
-#include <ctype.h>
 
 namespace {
 struct loglevel_name_value {
@@ -17,8 +18,7 @@ struct loglevel_name_value {
 };
 } /* namespace */
 
-static
-const struct loglevel_name_value loglevel_values[] = {
+static const struct loglevel_name_value loglevel_values[] = {
        { .name = "EMERG", .value = LTTNG_LOGLEVEL_EMERG },
        { .name = "TRACE_EMERG", .value = LTTNG_LOGLEVEL_EMERG },
        { .name = "ALERT", .value = LTTNG_LOGLEVEL_ALERT },
@@ -58,8 +58,7 @@ const struct loglevel_name_value loglevel_values[] = {
        { .name = "TRACE_DEBUG", .value = LTTNG_LOGLEVEL_DEBUG },
 };
 
-static
-const struct loglevel_name_value loglevel_log4j_values[] = {
+static const struct loglevel_name_value loglevel_log4j_values[] = {
        { .name = "OFF", .value = LTTNG_LOGLEVEL_LOG4J_OFF },
        { .name = "LOG4J_OFF", .value = LTTNG_LOGLEVEL_LOG4J_OFF },
        { .name = "FATAL", .value = LTTNG_LOGLEVEL_LOG4J_FATAL },
@@ -78,8 +77,7 @@ const struct loglevel_name_value loglevel_log4j_values[] = {
        { .name = "LOG4J_ALL", .value = LTTNG_LOGLEVEL_LOG4J_ALL },
 };
 
-static
-const struct loglevel_name_value loglevel_jul_values[] = {
+static const struct loglevel_name_value loglevel_jul_values[] = {
        { .name = "OFF", .value = LTTNG_LOGLEVEL_JUL_OFF },
        { .name = "JUL_OFF", .value = LTTNG_LOGLEVEL_JUL_OFF },
        { .name = "SEVERE", .value = LTTNG_LOGLEVEL_JUL_SEVERE },
@@ -100,8 +98,7 @@ const struct loglevel_name_value loglevel_jul_values[] = {
        { .name = "JUL_ALL", .value = LTTNG_LOGLEVEL_JUL_ALL },
 };
 
-static
-const struct loglevel_name_value loglevel_python_values[] = {
+static const struct loglevel_name_value loglevel_python_values[] = {
        { .name = "CRITICAL", .value = LTTNG_LOGLEVEL_PYTHON_CRITICAL },
        { .name = "PYTHON_CRITICAL", .value = LTTNG_LOGLEVEL_PYTHON_CRITICAL },
        { .name = "ERROR", .value = LTTNG_LOGLEVEL_PYTHON_ERROR },
@@ -116,15 +113,14 @@ const struct loglevel_name_value loglevel_python_values[] = {
        { .name = "PYTHON_NOTSET", .value = LTTNG_LOGLEVEL_PYTHON_NOTSET },
 };
 
-static
-bool string_equal_insensitive(const char *a, const char *b)
+static bool string_equal_insensitive(const char *a, const char *b)
 {
        return strcasecmp(a, b) == 0;
 }
 
-static
-int lookup_value_from_name(const struct loglevel_name_value values[],
-               size_t values_count, const char *name)
+static int lookup_value_from_name(const struct loglevel_name_value values[],
+                                 size_t values_count,
+                                 const char *name)
 {
        size_t i;
        int ret = -1;
@@ -146,10 +142,10 @@ end:
 }
 
 static bool loglevel_parse_range_string_common(const char *str,
-               const struct loglevel_name_value *nvs,
-               size_t nvs_count,
-               int *min,
-               int *max)
+                                              const struct loglevel_name_value *nvs,
+                                              size_t nvs_count,
+                                              int *min,
+                                              int *max)
 {
        bool ret;
        int i;
@@ -214,8 +210,7 @@ end:
 
 int loglevel_name_to_value(const char *name, enum lttng_loglevel *loglevel)
 {
-       int ret = lookup_value_from_name(loglevel_values,
-                       ARRAY_SIZE(loglevel_values), name);
+       int ret = lookup_value_from_name(loglevel_values, ARRAY_SIZE(loglevel_values), name);
 
        if (ret >= 0) {
                *loglevel = (typeof(*loglevel)) ret;
@@ -226,12 +221,12 @@ int loglevel_name_to_value(const char *name, enum lttng_loglevel *loglevel)
 }
 
 bool loglevel_parse_range_string(const char *str,
-               enum lttng_loglevel *min,
-               enum lttng_loglevel *max)
+                                enum lttng_loglevel *min,
+                                enum lttng_loglevel *max)
 {
        int min_int, max_int;
-       bool ret = loglevel_parse_range_string_common(str, loglevel_values,
-                       ARRAY_SIZE(loglevel_values), &min_int, &max_int);
+       bool ret = loglevel_parse_range_string_common(
+               str, loglevel_values, ARRAY_SIZE(loglevel_values), &min_int, &max_int);
 
        *min = (lttng_loglevel) min_int;
        *max = (lttng_loglevel) max_int;
@@ -239,12 +234,10 @@ bool loglevel_parse_range_string(const char *str,
        return ret;
 }
 
-int loglevel_log4j_name_to_value(
-               const char *name, enum lttng_loglevel_log4j *loglevel)
+int loglevel_log4j_name_to_value(const char *name, enum lttng_loglevel_log4j *loglevel)
 {
-       int ret = lookup_value_from_name(loglevel_log4j_values,
-                       ARRAY_SIZE(loglevel_log4j_values),
-                       name);
+       int ret = lookup_value_from_name(
+               loglevel_log4j_values, ARRAY_SIZE(loglevel_log4j_values), name);
 
        if (ret >= 0) {
                *loglevel = (typeof(*loglevel)) ret;
@@ -255,13 +248,12 @@ int loglevel_log4j_name_to_value(
 }
 
 bool loglevel_log4j_parse_range_string(const char *str,
-               enum lttng_loglevel_log4j *min,
-               enum lttng_loglevel_log4j *max)
+                                      enum lttng_loglevel_log4j *min,
+                                      enum lttng_loglevel_log4j *max)
 {
        int min_int, max_int;
-       bool ret = loglevel_parse_range_string_common(str,
-                       loglevel_log4j_values,
-                       ARRAY_SIZE(loglevel_log4j_values), &min_int, &max_int);
+       bool ret = loglevel_parse_range_string_common(
+               str, loglevel_log4j_values, ARRAY_SIZE(loglevel_log4j_values), &min_int, &max_int);
 
        *min = (lttng_loglevel_log4j) min_int;
        *max = (lttng_loglevel_log4j) max_int;
@@ -269,12 +261,10 @@ bool loglevel_log4j_parse_range_string(const char *str,
        return ret;
 }
 
-int loglevel_jul_name_to_value(
-               const char *name, enum lttng_loglevel_jul *loglevel)
+int loglevel_jul_name_to_value(const char *name, enum lttng_loglevel_jul *loglevel)
 {
-       int ret = lookup_value_from_name(loglevel_jul_values,
-                       ARRAY_SIZE(loglevel_jul_values),
-                       name);
+       int ret =
+               lookup_value_from_name(loglevel_jul_values, ARRAY_SIZE(loglevel_jul_values), name);
 
        if (ret >= 0) {
                *loglevel = (typeof(*loglevel)) ret;
@@ -285,12 +275,12 @@ int loglevel_jul_name_to_value(
 }
 
 bool loglevel_jul_parse_range_string(const char *str,
-               enum lttng_loglevel_jul *min,
-               enum lttng_loglevel_jul *max)
+                                    enum lttng_loglevel_jul *min,
+                                    enum lttng_loglevel_jul *max)
 {
        int min_int, max_int;
-       bool ret = loglevel_parse_range_string_common(str, loglevel_jul_values,
-                       ARRAY_SIZE(loglevel_jul_values), &min_int, &max_int);
+       bool ret = loglevel_parse_range_string_common(
+               str, loglevel_jul_values, ARRAY_SIZE(loglevel_jul_values), &min_int, &max_int);
 
        *min = (lttng_loglevel_jul) min_int;
        *max = (lttng_loglevel_jul) max_int;
@@ -298,12 +288,10 @@ bool loglevel_jul_parse_range_string(const char *str,
        return ret;
 }
 
-int loglevel_python_name_to_value(
-               const char *name, enum lttng_loglevel_python *loglevel)
+int loglevel_python_name_to_value(const char *name, enum lttng_loglevel_python *loglevel)
 {
-       int ret = lookup_value_from_name(loglevel_python_values,
-                       ARRAY_SIZE(loglevel_python_values),
-                       name);
+       int ret = lookup_value_from_name(
+               loglevel_python_values, ARRAY_SIZE(loglevel_python_values), name);
 
        if (ret >= 0) {
                *loglevel = (typeof(*loglevel)) ret;
@@ -314,13 +302,15 @@ int loglevel_python_name_to_value(
 }
 
 bool loglevel_python_parse_range_string(const char *str,
-               enum lttng_loglevel_python *min,
-               enum lttng_loglevel_python *max)
+                                       enum lttng_loglevel_python *min,
+                                       enum lttng_loglevel_python *max)
 {
        int min_int, max_int;
        bool ret = loglevel_parse_range_string_common(str,
-                       loglevel_python_values,
-                       ARRAY_SIZE(loglevel_python_values), &min_int, &max_int);
+                                                     loglevel_python_values,
+                                                     ARRAY_SIZE(loglevel_python_values),
+                                                     &min_int,
+                                                     &max_int);
 
        *min = (lttng_loglevel_python) min_int;
        *max = (lttng_loglevel_python) max_int;
@@ -328,9 +318,8 @@ bool loglevel_python_parse_range_string(const char *str,
        return ret;
 }
 
-static
-const char *lookup_name_from_value(const struct loglevel_name_value values[],
-               size_t values_count, int loglevel)
+static const char *
+lookup_name_from_value(const struct loglevel_name_value values[], size_t values_count, int loglevel)
 {
        size_t i;
        const char *name = NULL;
@@ -349,24 +338,23 @@ end:
 
 const char *loglevel_value_to_name(int loglevel)
 {
-       return lookup_name_from_value(
-                       loglevel_values, ARRAY_SIZE(loglevel_values), loglevel);
+       return lookup_name_from_value(loglevel_values, ARRAY_SIZE(loglevel_values), loglevel);
 }
 
 const char *loglevel_log4j_value_to_name(int loglevel)
 {
-       return lookup_name_from_value(loglevel_log4j_values,
-                       ARRAY_SIZE(loglevel_log4j_values), loglevel);
+       return lookup_name_from_value(
+               loglevel_log4j_values, ARRAY_SIZE(loglevel_log4j_values), loglevel);
 }
 
 const char *loglevel_jul_value_to_name(int loglevel)
 {
-       return lookup_name_from_value(loglevel_jul_values,
-                       ARRAY_SIZE(loglevel_jul_values), loglevel);
+       return lookup_name_from_value(
+               loglevel_jul_values, ARRAY_SIZE(loglevel_jul_values), loglevel);
 }
 
 const char *loglevel_python_value_to_name(int loglevel)
 {
-       return lookup_name_from_value(loglevel_python_values,
-                       ARRAY_SIZE(loglevel_python_values), loglevel);
+       return lookup_name_from_value(
+               loglevel_python_values, ARRAY_SIZE(loglevel_python_values), loglevel);
 }
index 7e70c3afce4f9e22b03e628bdda0b6344635d6ae..d02733a09aa18fbdcfa40563fac30b5a26ffaab0 100644 (file)
@@ -6,6 +6,16 @@
  */
 
 #define _LGPL_SOURCE
+#include "command.hpp"
+#include "version.hpp"
+
+#include <common/compat/getenv.hpp>
+#include <common/error.hpp>
+#include <common/utils.hpp>
+
+#include <lttng/lttng.h>
+
+#include <ctype.h>
 #include <getopt.h>
 #include <signal.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <unistd.h>
-#include <ctype.h>
-
-#include <lttng/lttng.h>
-#include <common/error.hpp>
-#include <common/compat/getenv.hpp>
-#include <common/utils.hpp>
-
-#include "command.hpp"
-#include "version.hpp"
 
 static const char *help_msg =
 #ifdef LTTNG_EMBED_HELP
 #include <lttng.1.h>
 #else
-NULL
+       NULL
 #endif
-;
+       ;
 
 /* Variables */
 static const char *progname;
@@ -47,61 +48,60 @@ enum {
 };
 
 /* Getopt options. No first level command. */
-static struct option long_options[] = {
-       {"version",          0, NULL, 'V'},
-       {"help",             0, NULL, 'h'},
-       {"group",            1, NULL, 'g'},
-       {"verbose",          0, NULL, 'v'},
-       {"quiet",            0, NULL, 'q'},
-       {"mi",               1, NULL, 'm'},
-       {"no-sessiond",      0, NULL, 'n'},
-       {"sessiond-path",    1, NULL, OPT_SESSION_PATH},
-       {"relayd-path",      1, NULL, OPT_RELAYD_PATH},
-       {"list-options",     0, NULL, OPT_DUMP_OPTIONS},
-       {"list-commands",    0, NULL, OPT_DUMP_COMMANDS},
-       {NULL, 0, NULL, 0}
-};
+static struct option long_options[] = { { "version", 0, NULL, 'V' },
+                                       { "help", 0, NULL, 'h' },
+                                       { "group", 1, NULL, 'g' },
+                                       { "verbose", 0, NULL, 'v' },
+                                       { "quiet", 0, NULL, 'q' },
+                                       { "mi", 1, NULL, 'm' },
+                                       { "no-sessiond", 0, NULL, 'n' },
+                                       { "sessiond-path", 1, NULL, OPT_SESSION_PATH },
+                                       { "relayd-path", 1, NULL, OPT_RELAYD_PATH },
+                                       { "list-options", 0, NULL, OPT_DUMP_OPTIONS },
+                                       { "list-commands", 0, NULL, OPT_DUMP_COMMANDS },
+                                       { NULL, 0, NULL, 0 } };
 
 /* First level command */
-static struct cmd_struct commands[] =  {
-       { "add-context", cmd_add_context},
-       { "add-trigger", cmd_add_trigger},
-       { "create", cmd_create},
-       { "clear", cmd_clear},
-       { "destroy", cmd_destroy},
-       { "disable-channel", cmd_disable_channels},
-       { "disable-event", cmd_disable_events},
-       { "enable-channel", cmd_enable_channels},
-       { "enable-event", cmd_enable_events},
-       { "help", NULL},
-       { "list", cmd_list},
-       { "list-triggers", cmd_list_triggers},
-       { "load", cmd_load},
-       { "metadata", cmd_metadata},
-       { "regenerate", cmd_regenerate},
-       { "remove-trigger", cmd_remove_trigger},
-       { "rotate", cmd_rotate},
-       { "enable-rotation", cmd_enable_rotation},
-       { "disable-rotation", cmd_disable_rotation},
-       { "save", cmd_save},
-       { "set-session", cmd_set_session},
-       { "snapshot", cmd_snapshot},
-       { "start", cmd_start},
-       { "status", cmd_status},
-       { "stop", cmd_stop},
-       { "track", cmd_track},
-       { "untrack", cmd_untrack},
-       { "version", cmd_version},
-       { "view", cmd_view},
-       { NULL, NULL}   /* Array closure */
+static struct cmd_struct commands[] = {
+       { "add-context", cmd_add_context },
+       { "add-trigger", cmd_add_trigger },
+       { "create", cmd_create },
+       { "clear", cmd_clear },
+       { "destroy", cmd_destroy },
+       { "disable-channel", cmd_disable_channels },
+       { "disable-event", cmd_disable_events },
+       { "enable-channel", cmd_enable_channels },
+       { "enable-event", cmd_enable_events },
+       { "help", NULL },
+       { "list", cmd_list },
+       { "list-triggers", cmd_list_triggers },
+       { "load", cmd_load },
+       { "metadata", cmd_metadata },
+       { "regenerate", cmd_regenerate },
+       { "remove-trigger", cmd_remove_trigger },
+       { "rotate", cmd_rotate },
+       { "enable-rotation", cmd_enable_rotation },
+       { "disable-rotation", cmd_disable_rotation },
+       { "save", cmd_save },
+       { "set-session", cmd_set_session },
+       { "snapshot", cmd_snapshot },
+       { "start", cmd_start },
+       { "status", cmd_status },
+       { "stop", cmd_stop },
+       { "track", cmd_track },
+       { "untrack", cmd_untrack },
+       { "version", cmd_version },
+       { "view", cmd_view },
+       { NULL, NULL } /* Array closure */
 };
 
 static void version(FILE *ofp)
 {
-       fprintf(ofp, "%s (LTTng Trace Control) " VERSION" - " VERSION_NAME "%s%s\n",
-                       progname,
-                       GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION,
-                       EXTRA_VERSION_NAME[0] == '\0' ? "" : " - " EXTRA_VERSION_NAME);
+       fprintf(ofp,
+               "%s (LTTng Trace Control) " VERSION " - " VERSION_NAME "%s%s\n",
+               progname,
+               GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION,
+               EXTRA_VERSION_NAME[0] == '\0' ? "" : " - " EXTRA_VERSION_NAME);
 }
 
 /*
@@ -150,8 +150,7 @@ static void list_options(FILE *ofp)
 /*
  * clean_exit
  */
-__attribute__((noreturn))
-static void clean_exit(int code)
+__attribute__((noreturn)) static void clean_exit(int code)
 {
        DBG("Clean exit");
        exit(code);
@@ -165,13 +164,13 @@ static void clean_exit(int code)
 static void sighandler(int sig)
 {
        switch (sig) {
-               case SIGTERM:
-                       DBG("SIGTERM caught");
-                       clean_exit(EXIT_FAILURE);
-                       break;
-               default:
-                       DBG("Unknown signal %d caught", sig);
-                       break;
+       case SIGTERM:
+               DBG("SIGTERM caught");
+               clean_exit(EXIT_FAILURE);
+               break;
+       default:
+               DBG("Unknown signal %d caught", sig);
+               break;
        }
 
        return;
@@ -227,7 +226,7 @@ static int handle_command(int argc, char **argv)
 
        /* Special case for help command which needs the commands array */
        if (strcmp(argv[0], "help") == 0) {
-               ret = cmd_help(argc, (const char**) argv, commands);
+               ret = cmd_help(argc, (const char **) argv, commands);
                goto end;
        }
 
@@ -235,7 +234,7 @@ static int handle_command(int argc, char **argv)
        while (cmd->name != NULL) {
                /* Find command */
                if (strcmp(argv[0], cmd->name) == 0) {
-                       ret = cmd->func(argc, (const char**) argv);
+                       ret = cmd->func(argc, (const char **) argv);
                        goto end;
                }
                i++;
@@ -335,7 +334,8 @@ static int parse_args(int argc, char **argv)
        int opt, ret;
 
        if (lttng_is_setuid_setgid()) {
-               ERR("'%s' is not allowed to be executed as a setuid/setgid binary for security reasons. Aborting.", argv[0]);
+               ERR("'%s' is not allowed to be executed as a setuid/setgid binary for security reasons. Aborting.",
+                   argv[0]);
                clean_exit(EXIT_FAILURE);
        }
 
@@ -432,10 +432,9 @@ static int parse_args(int argc, char **argv)
        case CMD_UNDEFINED:
                if (!command_exists(*(argv + optind))) {
                        MSG("lttng: %s is not an lttng command. See 'lttng --help'.",
-                                       *(argv + optind));
+                           *(argv + optind));
                } else {
-                       ERR("Unrecognized argument used with \'%s\' command",
-                                       *(argv + optind));
+                       ERR("Unrecognized argument used with \'%s\' command", *(argv + optind));
                }
                break;
        case CMD_FATAL:
@@ -458,7 +457,6 @@ error:
        return ret;
 }
 
-
 /*
  *  main
  */
index c6a2d9429090f3ce2141f0fbdd66ecc51272ff75..1a750d91b09bb8233c7fbe9c318d500242e92dd0 100644 (file)
@@ -5,19 +5,17 @@
  *
  */
 
-#include "uprobe.hpp"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
+#include "command.hpp"
 #include "common/compat/getenv.hpp"
+#include "common/path.hpp"
 #include "common/string-utils/string-utils.hpp"
 #include "common/utils.hpp"
-#include "common/path.hpp"
 #include "lttng/constant.h"
+#include "uprobe.hpp"
 
-#include "command.hpp"
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 /*
  * Walk the directories in the PATH environment variable to find the target
@@ -28,8 +26,7 @@
  * LTTNG_PATH_MAX bytes long.
  * On failure, returns -1;
  */
-static
-int walk_command_search_path(const char *binary, char *binary_full_path)
+static int walk_command_search_path(const char *binary, char *binary_full_path)
 {
        char *tentative_binary_path = NULL;
        char *command_search_path = NULL;
@@ -86,14 +83,14 @@ int walk_command_search_path(const char *binary, char *binary_full_path)
                 * Build the tentative path to the binary using the current
                 * search directory and the name of the binary.
                 */
-               ret = snprintf(tentative_binary_path, LTTNG_PATH_MAX, "%s/%s",
-                               curr_search_dir, binary);
+               ret = snprintf(
+                       tentative_binary_path, LTTNG_PATH_MAX, "%s/%s", curr_search_dir, binary);
                if (ret < 0) {
                        goto free_binary_path;
                }
                if (ret < LTTNG_PATH_MAX) {
-                        /*
-                         * Use STAT(2) to see if the file exists.
+                       /*
+                        * Use STAT(2) to see if the file exists.
                         */
                        ret = stat(tentative_binary_path, &stat_output);
                        if (ret == 0) {
@@ -102,18 +99,17 @@ int walk_command_search_path(const char *binary, char *binary_full_path)
                                 * symlink and not a special file (e.g.
                                 * device).
                                 */
-                               if (S_ISREG(stat_output.st_mode)
-                                               || S_ISLNK(stat_output.st_mode)) {
+                               if (S_ISREG(stat_output.st_mode) || S_ISLNK(stat_output.st_mode)) {
                                        /*
                                         * Found a match, set the out parameter
                                         * and return success.
                                         */
                                        ret = lttng_strncpy(binary_full_path,
-                                                       tentative_binary_path,
-                                                       LTTNG_PATH_MAX);
+                                                           tentative_binary_path,
+                                                           LTTNG_PATH_MAX);
                                        if (ret == -1) {
                                                ERR("Source path does not fit "
-                                                       "in destination buffer.");
+                                                   "in destination buffer.");
                                        }
                                        goto free_binary_path;
                                }
@@ -144,8 +140,7 @@ end:
  * elf:/path/to/binary:my_symbol+0x323
  * elf:/path/to/binary:my_symbol+43
  */
-static
-int warn_userspace_probe_syntax(const char *symbol)
+static int warn_userspace_probe_syntax(const char *symbol)
 {
        int ret;
 
@@ -197,7 +192,7 @@ error:
  * target_path to the path to the binary.
  */
 int parse_userspace_probe_opts(const char *opt,
-               struct lttng_userspace_probe_location **probe_location)
+                              struct lttng_userspace_probe_location **probe_location)
 {
        int ret = CMD_SUCCESS;
        size_t num_token = 0;
@@ -239,7 +234,9 @@ int parse_userspace_probe_opts(const char *opt,
        case 2:
                /* When the probe type is omitted we assume ELF for now. */
        case 3:
-               if (num_token == 3 && strcmp((const char *) lttng_dynamic_pointer_array_get_pointer(&tokens, 0), "elf") == 0) {
+               if (num_token == 3 &&
+                   strcmp((const char *) lttng_dynamic_pointer_array_get_pointer(&tokens, 0),
+                          "elf") == 0) {
                        target_path = (char *) lttng_dynamic_pointer_array_get_pointer(&tokens, 1);
                        symbol_name = (char *) lttng_dynamic_pointer_array_get_pointer(&tokens, 2);
                } else if (num_token == 2) {
@@ -249,8 +246,7 @@ int parse_userspace_probe_opts(const char *opt,
                        ret = CMD_ERROR;
                        goto end;
                }
-               lookup_method =
-                       lttng_userspace_probe_location_lookup_method_function_elf_create();
+               lookup_method = lttng_userspace_probe_location_lookup_method_function_elf_create();
                if (!lookup_method) {
                        WARN("Failed to create ELF lookup method");
                        ret = CMD_ERROR;
@@ -258,9 +254,11 @@ int parse_userspace_probe_opts(const char *opt,
                }
                break;
        case 4:
-               if (strcmp((const char *) lttng_dynamic_pointer_array_get_pointer(&tokens, 0), "sdt") == 0) {
+               if (strcmp((const char *) lttng_dynamic_pointer_array_get_pointer(&tokens, 0),
+                          "sdt") == 0) {
                        target_path = (char *) lttng_dynamic_pointer_array_get_pointer(&tokens, 1);
-                       provider_name = (char *) lttng_dynamic_pointer_array_get_pointer(&tokens, 2);
+                       provider_name =
+                               (char *) lttng_dynamic_pointer_array_get_pointer(&tokens, 2);
                        probe_name = (char *) lttng_dynamic_pointer_array_get_pointer(&tokens, 3);
                } else {
                        ret = CMD_ERROR;
@@ -340,7 +338,7 @@ int parse_userspace_probe_opts(const char *opt,
                }
 
                probe_location_local = lttng_userspace_probe_location_function_create(
-                               real_target_path, symbol_name, lookup_method);
+                       real_target_path, symbol_name, lookup_method);
                if (!probe_location_local) {
                        WARN("Failed to create function probe location");
                        ret = CMD_ERROR;
@@ -352,7 +350,7 @@ int parse_userspace_probe_opts(const char *opt,
                break;
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT:
                probe_location_local = lttng_userspace_probe_location_tracepoint_create(
-                               real_target_path, provider_name, probe_name, lookup_method);
+                       real_target_path, provider_name, probe_name, lookup_method);
                if (!probe_location_local) {
                        WARN("Failed to create function probe location");
                        ret = CMD_ERROR;
index 9a9f39bf2529b1cd6328f5052b73672715d12663..37327128384c482bdf21859289c77495574d223b 100644 (file)
@@ -6,24 +6,24 @@
  */
 
 #define _LGPL_SOURCE
-#include <stdlib.h>
-#include <ctype.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <signal.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <inttypes.h>
-#include <unistd.h>
+#include "command.hpp"
+#include "conf.hpp"
+#include "utils.hpp"
 
+#include <common/defaults.hpp>
 #include <common/error.hpp>
 #include <common/utils.hpp>
-#include <common/defaults.hpp>
 
-#include "conf.hpp"
-#include "utils.hpp"
-#include "command.hpp"
+#include <arpa/inet.h>
+#include <ctype.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <netinet/in.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 static const char *str_all = "ALL";
 static const char *str_tracepoint = "Tracepoint";
@@ -32,8 +32,7 @@ static const char *str_probe = "Probe";
 static const char *str_userspace_probe = "Userspace Probe";
 static const char *str_function = "Function";
 
-static
-char *_get_session_name(int quiet)
+static char *_get_session_name(int quiet)
 {
        const char *path;
        char *session_name = NULL;
@@ -46,7 +45,7 @@ char *_get_session_name(int quiet)
 
        /* Get session name from config */
        session_name = quiet ? config_read_session_name_quiet(path) :
-               config_read_session_name(path);
+                              config_read_session_name(path);
        if (session_name == NULL) {
                goto error;
        }
@@ -146,8 +145,7 @@ void list_cmd_options_argpar(FILE *ofp, const struct argpar_opt_descr *options)
  * significant bit (from 1 to 32 on 32-bit, from 1 to 64 on 64-bit).
  */
 #if defined(__i386) || defined(__x86_64)
-static inline
-unsigned int fls_u32(uint32_t x)
+static inline unsigned int fls_u32(uint32_t x)
 {
        int r;
 
@@ -155,15 +153,15 @@ unsigned int fls_u32(uint32_t x)
            "jnz 1f\n\t"
            "movl $-1,%0\n\t"
            "1:\n\t"
-           : "=r" (r) : "rm" (x));
+           : "=r"(r)
+           : "rm"(x));
        return r + 1;
 }
 #define HAS_FLS_U32
 #endif
 
 #if defined(__x86_64) && defined(__LP64__)
-static inline
-unsigned int fls_u64(uint64_t x)
+static inline unsigned int fls_u64(uint64_t x)
 {
        long r;
 
@@ -171,15 +169,15 @@ unsigned int fls_u64(uint64_t x)
            "jnz 1f\n\t"
            "movq $-1,%0\n\t"
            "1:\n\t"
-           : "=r" (r) : "rm" (x));
+           : "=r"(r)
+           : "rm"(x));
        return r + 1;
 }
 #define HAS_FLS_U64
 #endif
 
 #ifndef HAS_FLS_U64
-static __attribute__((unused))
-unsigned int fls_u64(uint64_t x)
+static __attribute__((unused)) unsigned int fls_u64(uint64_t x)
 {
        unsigned int r = 64;
 
@@ -215,8 +213,7 @@ unsigned int fls_u64(uint64_t x)
 #endif
 
 #ifndef HAS_FLS_U32
-static __attribute__((unused))
-unsigned int fls_u32(uint32_t x)
+static __attribute__((unused)) unsigned int fls_u32(uint32_t x)
 {
        unsigned int r = 32;
 
@@ -246,8 +243,7 @@ unsigned int fls_u32(uint32_t x)
 }
 #endif
 
-static
-unsigned int fls_ulong(unsigned long x)
+static unsigned int fls_ulong(unsigned long x)
 {
 #if (CAA_BITS_PER_LONG == 32)
        return fls_u32(x);
@@ -355,7 +351,7 @@ int spawn_relayd(const char *pathname, int port)
                } else {
                        PERROR("execlp");
                }
-               kill(getppid(), SIGTERM);       /* wake parent */
+               kill(getppid(), SIGTERM); /* wake parent */
                exit(EXIT_FAILURE);
        } else if (pid > 0) {
                goto end;
@@ -416,16 +412,13 @@ error_socket:
        return ret;
 }
 
-int print_missing_or_multiple_domains(unsigned int domain_count,
-               bool include_agent_domains)
+int print_missing_or_multiple_domains(unsigned int domain_count, bool include_agent_domains)
 {
        int ret = 0;
 
        if (domain_count == 0) {
                ERR("Please specify a domain (--kernel/--userspace%s).",
-                               include_agent_domains ?
-                                               "/--jul/--log4j/--python" :
-                                               "");
+                   include_agent_domains ? "/--jul/--log4j/--python" : "");
                ret = -1;
        } else if (domain_count > 1) {
                ERR("Only one domain must be specified.");
@@ -475,7 +468,8 @@ int get_session_stats_str(const char *session_name, char **out_str)
                }
        }
        if (!selected_session) {
-               ERR("Failed to retrieve session \"%s\" description while printing session statistics.", session_name);
+               ERR("Failed to retrieve session \"%s\" description while printing session statistics.",
+                   session_name);
                ret = -1;
                goto end;
        }
@@ -486,8 +480,8 @@ int get_session_stats_str(const char *session_name, char **out_str)
                goto end;
        }
        for (domain_idx = 0; domain_idx < nb_domains; domain_idx++) {
-               struct lttng_handle *handle = lttng_create_handle(session_name,
-                               &domains[domain_idx]);
+               struct lttng_handle *handle =
+                       lttng_create_handle(session_name, &domains[domain_idx]);
 
                if (!handle) {
                        ERR("Failed to create session handle while printing session statistics.");
@@ -502,18 +496,16 @@ int get_session_stats_str(const char *session_name, char **out_str)
                        uint64_t discarded_events = 0, lost_packets = 0;
                        struct lttng_channel *channel = &channels[channel_idx];
 
-                       ret = lttng_channel_get_discarded_event_count(channel,
-                                       &discarded_events);
+                       ret = lttng_channel_get_discarded_event_count(channel, &discarded_events);
                        if (ret) {
                                ERR("Failed to retrieve discarded event count from channel %s",
-                                               channel->name);
+                                   channel->name);
                        }
 
-                       ret = lttng_channel_get_lost_packet_count(channel,
-                                       &lost_packets);
+                       ret = lttng_channel_get_lost_packet_count(channel, &lost_packets);
                        if (ret) {
                                ERR("Failed to retrieve lost packet count from channel %s",
-                                               channel->name);
+                                   channel->name);
                        }
 
                        discarded_events_total += discarded_events;
@@ -522,30 +514,26 @@ int get_session_stats_str(const char *session_name, char **out_str)
                lttng_destroy_handle(handle);
        }
 
-       print_discarded_events = discarded_events_total > 0 &&
-                                !selected_session->snapshot_mode;
-       print_lost_packets = lost_packets_total > 0 &&
-                            !selected_session->snapshot_mode;
+       print_discarded_events = discarded_events_total > 0 && !selected_session->snapshot_mode;
+       print_lost_packets = lost_packets_total > 0 && !selected_session->snapshot_mode;
 
        if (print_discarded_events && print_lost_packets) {
                ret = asprintf(&stats_str,
-                               "Warning: %" PRIu64
-                               " events were discarded and %" PRIu64
-                               " packets were lost, please refer to "
-                               "the documentation on channel configuration.",
-                               discarded_events_total, lost_packets_total);
+                              "Warning: %" PRIu64 " events were discarded and %" PRIu64
+                              " packets were lost, please refer to "
+                              "the documentation on channel configuration.",
+                              discarded_events_total,
+                              lost_packets_total);
        } else if (print_discarded_events) {
                ret = asprintf(&stats_str,
-                               "Warning: %" PRIu64
-                               " events were discarded, please refer to "
-                               "the documentation on channel configuration.",
-                               discarded_events_total);
+                              "Warning: %" PRIu64 " events were discarded, please refer to "
+                              "the documentation on channel configuration.",
+                              discarded_events_total);
        } else if (print_lost_packets) {
                ret = asprintf(&stats_str,
-                               "Warning: %" PRIu64
-                               " packets were lost, please refer to "
-                               "the documentation on channel configuration.",
-                               lost_packets_total);
+                              "Warning: %" PRIu64 " packets were lost, please refer to "
+                              "the documentation on channel configuration.",
+                              lost_packets_total);
        } else {
                ret = 0;
        }
@@ -579,9 +567,8 @@ int show_cmd_help(const char *cmd_name, const char *help_msg)
        return ret;
 }
 
-int print_trace_archive_location(
-               const struct lttng_trace_archive_location *location,
-               const char *session_name)
+int print_trace_archive_location(const struct lttng_trace_archive_location *location,
+                                const char *session_name)
 {
        int ret = 0;
        enum lttng_trace_archive_location_type location_type;
@@ -590,15 +577,14 @@ int print_trace_archive_location(
 
        location_type = lttng_trace_archive_location_get_type(location);
 
-       _MSG("Trace chunk archive for session %s is now readable",
-                       session_name);
+       _MSG("Trace chunk archive for session %s is now readable", session_name);
        switch (location_type) {
        case LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL:
        {
                const char *absolute_path;
 
-               status = lttng_trace_archive_location_local_get_absolute_path(
-                               location, &absolute_path);
+               status = lttng_trace_archive_location_local_get_absolute_path(location,
+                                                                             &absolute_path);
                if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
                        ret = -1;
                        goto end;
@@ -614,36 +600,33 @@ int print_trace_archive_location(
                enum lttng_trace_archive_location_relay_protocol_type protocol;
 
                /* Fetch all relay location parameters. */
-               status = lttng_trace_archive_location_relay_get_protocol_type(
-                               location, &protocol);
+               status = lttng_trace_archive_location_relay_get_protocol_type(location, &protocol);
                if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
 
-               status = lttng_trace_archive_location_relay_get_host(
-                               location, &host);
+               status = lttng_trace_archive_location_relay_get_host(location, &host);
                if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
 
-               status = lttng_trace_archive_location_relay_get_control_port(
-                               location, &control_port);
+               status = lttng_trace_archive_location_relay_get_control_port(location,
+                                                                            &control_port);
                if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
 
-               status = lttng_trace_archive_location_relay_get_data_port(
-                               location, &data_port);
+               status = lttng_trace_archive_location_relay_get_data_port(location, &data_port);
                if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
 
-               status = lttng_trace_archive_location_relay_get_relative_path(
-                               location, &relative_path);
+               status = lttng_trace_archive_location_relay_get_relative_path(location,
+                                                                             &relative_path);
                if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
                        ret = -1;
                        goto end;
@@ -658,9 +641,12 @@ int print_trace_archive_location(
                        break;
                }
 
-               MSG(" on relay %s://%s/%s [control port %" PRIu16 ", data port %"
-                               PRIu16 "]", protocol_str, host,
-                               relative_path, control_port, data_port);
+               MSG(" on relay %s://%s/%s [control port %" PRIu16 ", data port %" PRIu16 "]",
+                   protocol_str,
+                   host,
+                   relative_path,
+                   control_port,
+                   data_port);
                printed_location = true;
                break;
        }
index bc9e3580a769632f6f09000eb05318d84501bc24..5811ef298601b1c77fee81028bd7fc88542ffba9 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <common/error.hpp>
 #include <common/mi-lttng.hpp>
+
 #include <lttng/action/action-internal.hpp>
 #include <lttng/action/list-internal.hpp>
 #include <lttng/action/notify-internal.hpp>
@@ -45,14 +46,14 @@ enum lttng_action_type lttng_action_get_type(const struct lttng_action *action)
 }
 
 void lttng_action_init(struct lttng_action *action,
-               enum lttng_action_type type,
-               action_validate_cb validate,
-               action_serialize_cb serialize,
-               action_equal_cb equal,
-               action_destroy_cb destroy,
-               action_get_rate_policy_cb get_rate_policy,
-               action_add_error_query_results_cb add_error_query_results,
-               action_mi_serialize_cb mi)
+                      enum lttng_action_type type,
+                      action_validate_cb validate,
+                      action_serialize_cb serialize,
+                      action_equal_cb equal,
+                      action_destroy_cb destroy,
+                      action_get_rate_policy_cb get_rate_policy,
+                      action_add_error_query_results_cb add_error_query_results,
+                      action_mi_serialize_cb mi)
 {
        urcu_ref_init(&action->ref);
        action->type = type;
@@ -69,11 +70,9 @@ void lttng_action_init(struct lttng_action *action,
        action->execution_failure_counter = 0;
 }
 
-static
-void action_destroy_ref(struct urcu_ref *ref)
+static void action_destroy_ref(struct urcu_ref *ref)
 {
-       struct lttng_action *action =
-                       lttng::utils::container_of(ref, &lttng_action::ref);
+       struct lttng_action *action = lttng::utils::container_of(ref, &lttng_action::ref);
 
        action->destroy(action);
 }
@@ -118,16 +117,14 @@ end:
        return valid;
 }
 
-int lttng_action_serialize(struct lttng_action *action,
-               struct lttng_payload *payload)
+int lttng_action_serialize(struct lttng_action *action, struct lttng_payload *payload)
 {
        int ret;
        struct lttng_action_comm action_comm = {
                .action_type = (int8_t) action->type,
        };
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &action_comm,
-                       sizeof(action_comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &action_comm, sizeof(action_comm));
        if (ret) {
                goto end;
        }
@@ -141,14 +138,13 @@ end:
 }
 
 ssize_t lttng_action_create_from_payload(struct lttng_payload_view *view,
-               struct lttng_action **action)
+                                        struct lttng_action **action)
 {
        ssize_t consumed_len, specific_action_consumed_len;
        action_create_from_payload_cb create_from_payload_cb;
        const struct lttng_action_comm *action_comm;
        const struct lttng_payload_view action_comm_view =
-                       lttng_payload_view_from_view(
-                                       view, 0, sizeof(*action_comm));
+               lttng_payload_view_from_view(view, 0, sizeof(*action_comm));
 
        if (!view || !action) {
                consumed_len = -1;
@@ -164,36 +160,31 @@ ssize_t lttng_action_create_from_payload(struct lttng_payload_view *view,
        action_comm = (const struct lttng_action_comm *) action_comm_view.buffer.data;
 
        DBG("Create action from payload: action-type=%s",
-                       lttng_action_type_string((lttng_action_type) action_comm->action_type));
+           lttng_action_type_string((lttng_action_type) action_comm->action_type));
 
        switch (action_comm->action_type) {
        case LTTNG_ACTION_TYPE_NOTIFY:
                create_from_payload_cb = lttng_action_notify_create_from_payload;
                break;
        case LTTNG_ACTION_TYPE_ROTATE_SESSION:
-               create_from_payload_cb =
-                               lttng_action_rotate_session_create_from_payload;
+               create_from_payload_cb = lttng_action_rotate_session_create_from_payload;
                break;
        case LTTNG_ACTION_TYPE_SNAPSHOT_SESSION:
-               create_from_payload_cb =
-                               lttng_action_snapshot_session_create_from_payload;
+               create_from_payload_cb = lttng_action_snapshot_session_create_from_payload;
                break;
        case LTTNG_ACTION_TYPE_START_SESSION:
-               create_from_payload_cb =
-                               lttng_action_start_session_create_from_payload;
+               create_from_payload_cb = lttng_action_start_session_create_from_payload;
                break;
        case LTTNG_ACTION_TYPE_STOP_SESSION:
-               create_from_payload_cb =
-                               lttng_action_stop_session_create_from_payload;
+               create_from_payload_cb = lttng_action_stop_session_create_from_payload;
                break;
        case LTTNG_ACTION_TYPE_LIST:
                create_from_payload_cb = lttng_action_list_create_from_payload;
                break;
        default:
                ERR("Failed to create action from payload, unhandled action type: action-type=%u (%s)",
-                               action_comm->action_type,
-                               lttng_action_type_string(
-                                               (lttng_action_type) action_comm->action_type));
+                   action_comm->action_type,
+                   lttng_action_type_string((lttng_action_type) action_comm->action_type));
                consumed_len = -1;
                goto end;
        }
@@ -201,12 +192,10 @@ ssize_t lttng_action_create_from_payload(struct lttng_payload_view *view,
        {
                /* Create buffer view for the action-type-specific data. */
                struct lttng_payload_view specific_action_view =
-                               lttng_payload_view_from_view(view,
-                                               sizeof(struct lttng_action_comm),
-                                               -1);
+                       lttng_payload_view_from_view(view, sizeof(struct lttng_action_comm), -1);
 
-               specific_action_consumed_len = create_from_payload_cb(
-                               &specific_action_view, action);
+               specific_action_consumed_len =
+                       create_from_payload_cb(&specific_action_view, action);
        }
        if (specific_action_consumed_len < 0) {
                ERR("Failed to create specific action from buffer.");
@@ -216,15 +205,13 @@ ssize_t lttng_action_create_from_payload(struct lttng_payload_view *view,
 
        LTTNG_ASSERT(*action);
 
-       consumed_len = sizeof(struct lttng_action_comm) +
-                      specific_action_consumed_len;
+       consumed_len = sizeof(struct lttng_action_comm) + specific_action_consumed_len;
 
 end:
        return consumed_len;
 }
 
-bool lttng_action_is_equal(const struct lttng_action *a,
-               const struct lttng_action *b)
+bool lttng_action_is_equal(const struct lttng_action *a, const struct lttng_action *b)
 {
        bool is_equal = false;
 
@@ -278,39 +265,36 @@ bool lttng_action_should_execute(const struct lttng_action *action)
                goto end;
        }
 
-       execute = lttng_rate_policy_should_execute(
-                       policy, action->execution_request_counter);
+       execute = lttng_rate_policy_should_execute(policy, action->execution_request_counter);
 end:
        return execute;
 }
 
-enum lttng_action_status lttng_action_add_error_query_results(
-               const struct lttng_action *action,
-               struct lttng_error_query_results *results)
+enum lttng_action_status
+lttng_action_add_error_query_results(const struct lttng_action *action,
+                                    struct lttng_error_query_results *results)
 {
        return action->add_error_query_results(action, results);
 }
 
-enum lttng_action_status lttng_action_generic_add_error_query_results(
-               const struct lttng_action *action,
-               struct lttng_error_query_results *results)
+enum lttng_action_status
+lttng_action_generic_add_error_query_results(const struct lttng_action *action,
+                                            struct lttng_error_query_results *results)
 {
        enum lttng_action_status action_status;
        struct lttng_error_query_result *error_counter = NULL;
-       const uint64_t execution_failure_counter =
-                       uatomic_read(&action->execution_failure_counter);
+       const uint64_t execution_failure_counter = uatomic_read(&action->execution_failure_counter);
 
        error_counter = lttng_error_query_result_counter_create(
-                       "total execution failures",
-                       "Aggregated count of errors encountered when executing the action",
-                       execution_failure_counter);
+               "total execution failures",
+               "Aggregated count of errors encountered when executing the action",
+               execution_failure_counter);
        if (!error_counter) {
                action_status = LTTNG_ACTION_STATUS_ERROR;
                goto end;
        }
 
-       if (lttng_error_query_results_add_result(
-                           results, error_counter)) {
+       if (lttng_error_query_results_add_result(results, error_counter)) {
                action_status = LTTNG_ACTION_STATUS_ERROR;
                goto end;
        }
@@ -323,12 +307,12 @@ end:
        return action_status;
 }
 
-enum lttng_error_code lttng_action_mi_serialize(const struct lttng_trigger *trigger,
-               const struct lttng_action *action,
-               struct mi_writer *writer,
-               const struct mi_lttng_error_query_callbacks
-                               *error_query_callbacks,
-               struct lttng_dynamic_array *action_path_indexes)
+enum lttng_error_code
+lttng_action_mi_serialize(const struct lttng_trigger *trigger,
+                         const struct lttng_action *action,
+                         struct mi_writer *writer,
+                         const struct mi_lttng_error_query_callbacks *error_query_callbacks,
+                         struct lttng_dynamic_array *action_path_indexes)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -349,8 +333,8 @@ enum lttng_error_code lttng_action_mi_serialize(const struct lttng_trigger *trig
                 * Recursion is safe since action lists can't be nested for
                 * the moment.
                 */
-               ret_code = lttng_action_list_mi_serialize(trigger, action, writer,
-                               error_query_callbacks, action_path_indexes);
+               ret_code = lttng_action_list_mi_serialize(
+                       trigger, action, writer, error_query_callbacks, action_path_indexes);
                if (ret_code != LTTNG_OK) {
                        goto end;
                }
@@ -369,29 +353,25 @@ enum lttng_error_code lttng_action_mi_serialize(const struct lttng_trigger *trig
        if (error_query_callbacks && error_query_callbacks->action_cb) {
                const uint64_t *action_path_indexes_raw_pointer = NULL;
                const size_t action_path_indexes_size =
-                               lttng_dynamic_array_get_count(
-                                               action_path_indexes);
+                       lttng_dynamic_array_get_count(action_path_indexes);
 
                if (action_path_indexes_size != 0) {
                        action_path_indexes_raw_pointer =
-                                       (const uint64_t *) action_path_indexes
-                                                       ->buffer.data;
+                               (const uint64_t *) action_path_indexes->buffer.data;
                }
 
-               action_path = lttng_action_path_create(
-                               action_path_indexes_raw_pointer,
-                               action_path_indexes_size);
+               action_path = lttng_action_path_create(action_path_indexes_raw_pointer,
+                                                      action_path_indexes_size);
                LTTNG_ASSERT(action_path);
 
                ret_code = error_query_callbacks->action_cb(
-                               trigger, action_path, &error_query_results);
+                       trigger, action_path, &error_query_results);
                if (ret_code != LTTNG_OK) {
                        goto end;
                }
 
                /* Serialize the error query results. */
-               ret_code = lttng_error_query_results_mi_serialize(
-                               error_query_results, writer);
+               ret_code = lttng_error_query_results_mi_serialize(error_query_results, writer);
                if (ret_code != LTTNG_OK) {
                        goto end;
                }
index 4de7d81e8a04eeed57210a5b7b08a87e2e6d78df..a4b2a02f2b7571f66aa36b6e6a1719434aeb5a11 100644 (file)
 #include <common/mi-lttng.hpp>
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
+
 #include <lttng/action/action-internal.hpp>
 #include <lttng/action/list-internal.hpp>
 #include <lttng/action/list.h>
 
-#define IS_LIST_ACTION(action) \
-       (lttng_action_get_type(action) == LTTNG_ACTION_TYPE_LIST)
+#define IS_LIST_ACTION(action) (lttng_action_get_type(action) == LTTNG_ACTION_TYPE_LIST)
 
 namespace {
 struct lttng_action_list {
@@ -43,16 +43,15 @@ static void destroy_lttng_action_list_element(void *ptr)
        lttng_action_destroy(element);
 }
 
-static struct lttng_action_list *action_list_from_action(
-               const struct lttng_action *action)
+static struct lttng_action_list *action_list_from_action(const struct lttng_action *action)
 {
        LTTNG_ASSERT(action);
 
        return lttng::utils::container_of(action, &lttng_action_list::parent);
 }
 
-static const struct lttng_action_list *action_list_from_action_const(
-               const struct lttng_action *action)
+static const struct lttng_action_list *
+action_list_from_action_const(const struct lttng_action *action)
 {
        LTTNG_ASSERT(action);
 
@@ -73,8 +72,8 @@ static bool lttng_action_list_validate(struct lttng_action *action)
 
        for (i = 0; i < count; i++) {
                struct lttng_action *child =
-                               (lttng_action *) lttng_dynamic_pointer_array_get_pointer(
-                                               &action_list->actions, i);
+                       (lttng_action *) lttng_dynamic_pointer_array_get_pointer(
+                               &action_list->actions, i);
 
                LTTNG_ASSERT(child);
 
@@ -90,20 +89,17 @@ end:
        return valid;
 }
 
-static bool lttng_action_list_is_equal(
-               const struct lttng_action *_a, const struct lttng_action *_b)
+static bool lttng_action_list_is_equal(const struct lttng_action *_a, const struct lttng_action *_b)
 {
        bool is_equal = false;
        unsigned int i;
        unsigned int a_count, b_count;
 
-       if (lttng_action_list_get_count(_a, &a_count) !=
-                       LTTNG_ACTION_STATUS_OK) {
+       if (lttng_action_list_get_count(_a, &a_count) != LTTNG_ACTION_STATUS_OK) {
                goto end;
        }
 
-       if (lttng_action_list_get_count(_b, &b_count) !=
-                       LTTNG_ACTION_STATUS_OK) {
+       if (lttng_action_list_get_count(_b, &b_count) != LTTNG_ACTION_STATUS_OK) {
                goto end;
        }
 
@@ -112,10 +108,8 @@ static bool lttng_action_list_is_equal(
        }
 
        for (i = 0; i < a_count; i++) {
-               const struct lttng_action *child_a =
-                       lttng_action_list_get_at_index(_a, i);
-               const struct lttng_action *child_b =
-                       lttng_action_list_get_at_index(_b, i);
+               const struct lttng_action *child_a = lttng_action_list_get_at_index(_a, i);
+               const struct lttng_action *child_b = lttng_action_list_get_at_index(_b, i);
 
                LTTNG_ASSERT(child_a);
                LTTNG_ASSERT(child_b);
@@ -130,8 +124,7 @@ end:
        return is_equal;
 }
 
-static int lttng_action_list_serialize(
-               struct lttng_action *action, struct lttng_payload *payload)
+static int lttng_action_list_serialize(struct lttng_action *action, struct lttng_payload *payload)
 {
        struct lttng_action_list *action_list;
        struct lttng_action_list_comm comm;
@@ -150,8 +143,7 @@ static int lttng_action_list_serialize(
 
        comm.action_count = count;
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &comm, sizeof(comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
        if (ret) {
                ret = -1;
                goto end;
@@ -159,8 +151,8 @@ static int lttng_action_list_serialize(
 
        for (i = 0; i < count; i++) {
                struct lttng_action *child =
-                               (lttng_action *) lttng_dynamic_pointer_array_get_pointer(
-                                               &action_list->actions, i);
+                       (lttng_action *) lttng_dynamic_pointer_array_get_pointer(
+                               &action_list->actions, i);
 
                LTTNG_ASSERT(child);
 
@@ -192,9 +184,8 @@ end:
        return;
 }
 
-ssize_t lttng_action_list_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_action **p_action)
+ssize_t lttng_action_list_create_from_payload(struct lttng_payload_view *view,
+                                             struct lttng_action **p_action)
 {
        ssize_t consumed_len;
        const struct lttng_action_list_comm *comm;
@@ -215,17 +206,15 @@ ssize_t lttng_action_list_create_from_payload(
 
        for (i = 0; i < comm->action_count; i++) {
                ssize_t consumed_len_child;
-               struct lttng_payload_view child_view =
-                               lttng_payload_view_from_view(view, consumed_len,
-                                               view->buffer.size - consumed_len);
+               struct lttng_payload_view child_view = lttng_payload_view_from_view(
+                       view, consumed_len, view->buffer.size - consumed_len);
 
                if (!lttng_payload_view_is_valid(&child_view)) {
                        consumed_len = -1;
                        goto end;
                }
 
-               consumed_len_child = lttng_action_create_from_payload(
-                               &child_view, &child_action);
+               consumed_len_child = lttng_action_create_from_payload(&child_view, &child_action);
                if (consumed_len_child < 0) {
                        consumed_len = -1;
                        goto end;
@@ -252,9 +241,9 @@ end:
        return consumed_len;
 }
 
-static enum lttng_action_status lttng_action_list_add_error_query_results(
-               const struct lttng_action *action,
-               struct lttng_error_query_results *results)
+static enum lttng_action_status
+lttng_action_list_add_error_query_results(const struct lttng_action *action,
+                                         struct lttng_error_query_results *results)
 {
        unsigned int i, count;
        enum lttng_action_status action_status;
@@ -266,10 +255,9 @@ static enum lttng_action_status lttng_action_list_add_error_query_results(
 
        for (i = 0; i < count; i++) {
                struct lttng_action *inner_action =
-                               lttng_action_list_borrow_mutable_at_index(action, i);
+                       lttng_action_list_borrow_mutable_at_index(action, i);
 
-               action_status = lttng_action_add_error_query_results(
-                               inner_action, results);
+               action_status = lttng_action_add_error_query_results(inner_action, results);
                if (action_status != LTTNG_ACTION_STATUS_OK) {
                        goto end;
                }
@@ -278,13 +266,12 @@ end:
        return action_status;
 }
 
-enum lttng_error_code lttng_action_list_mi_serialize(
-               const struct lttng_trigger *trigger,
-               const struct lttng_action *action,
-               struct mi_writer *writer,
-               const struct mi_lttng_error_query_callbacks
-                               *error_query_callbacks,
-               struct lttng_dynamic_array *action_path_indexes)
+enum lttng_error_code
+lttng_action_list_mi_serialize(const struct lttng_trigger *trigger,
+                              const struct lttng_action *action,
+                              struct mi_writer *writer,
+                              const struct mi_lttng_error_query_callbacks *error_query_callbacks,
+                              struct lttng_dynamic_array *action_path_indexes)
 {
        int ret;
        struct lttng_action_list *action_list;
@@ -296,8 +283,7 @@ enum lttng_error_code lttng_action_list_mi_serialize(
        LTTNG_ASSERT(writer);
 
        /* Open action list. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_action_list);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_action_list);
        if (ret) {
                goto mi_error;
        }
@@ -306,8 +292,7 @@ enum lttng_error_code lttng_action_list_mi_serialize(
        action_list = action_list_from_action(action);
        count = lttng_dynamic_pointer_array_get_count(&action_list->actions);
        for (i = 0; i < count; i++) {
-               const struct lttng_action *child =
-                               lttng_action_list_get_at_index(action, i);
+               const struct lttng_action *child = lttng_action_list_get_at_index(action, i);
                const uint64_t index = (uint64_t) i;
 
                LTTNG_ASSERT(child);
@@ -319,23 +304,21 @@ enum lttng_error_code lttng_action_list_mi_serialize(
                 * tree in-order and to re-use the dynamic array instead of
                 * copying it at every level.
                 */
-               ret = lttng_dynamic_array_add_element(
-                               action_path_indexes, &index);
+               ret = lttng_dynamic_array_add_element(action_path_indexes, &index);
                if (ret) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto end;
                }
 
-               ret_code = lttng_action_mi_serialize(trigger, child, writer,
-                               error_query_callbacks, action_path_indexes);
+               ret_code = lttng_action_mi_serialize(
+                       trigger, child, writer, error_query_callbacks, action_path_indexes);
                if (ret_code != LTTNG_OK) {
                        goto end;
                }
 
-               ret = lttng_dynamic_array_remove_element(action_path_indexes,
-                               lttng_dynamic_array_get_count(
-                                               action_path_indexes) -
-                                               1);
+               ret = lttng_dynamic_array_remove_element(
+                       action_path_indexes,
+                       lttng_dynamic_array_get_count(action_path_indexes) - 1);
                if (ret) {
                        ret_code = LTTNG_ERR_UNK;
                        goto end;
@@ -374,20 +357,24 @@ struct lttng_action *lttng_action_list_create(void)
         * The mi for the list is handled at the lttng_action_mi level to ease
         * action path management for error query.
         */
-       lttng_action_init(action, LTTNG_ACTION_TYPE_LIST,
-                       lttng_action_list_validate, lttng_action_list_serialize,
-                       lttng_action_list_is_equal, lttng_action_list_destroy,
-                       NULL, lttng_action_list_add_error_query_results, NULL);
-
-       lttng_dynamic_pointer_array_init(&action_list->actions,
-                       destroy_lttng_action_list_element);
+       lttng_action_init(action,
+                         LTTNG_ACTION_TYPE_LIST,
+                         lttng_action_list_validate,
+                         lttng_action_list_serialize,
+                         lttng_action_list_is_equal,
+                         lttng_action_list_destroy,
+                         NULL,
+                         lttng_action_list_add_error_query_results,
+                         NULL);
+
+       lttng_dynamic_pointer_array_init(&action_list->actions, destroy_lttng_action_list_element);
 
 end:
        return action;
 }
 
-enum lttng_action_status lttng_action_list_add_action(
-               struct lttng_action *list, struct lttng_action *action)
+enum lttng_action_status lttng_action_list_add_action(struct lttng_action *list,
+                                                     struct lttng_action *action)
 {
        struct lttng_action_list *action_list;
        enum lttng_action_status status;
@@ -409,8 +396,7 @@ enum lttng_action_status lttng_action_list_add_action(
 
        action_list = action_list_from_action(list);
 
-       ret = lttng_dynamic_pointer_array_add_pointer(&action_list->actions,
-                       action);
+       ret = lttng_dynamic_pointer_array_add_pointer(&action_list->actions, action);
        if (ret < 0) {
                status = LTTNG_ACTION_STATUS_ERROR;
                goto end;
@@ -423,8 +409,8 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_list_get_count(
-               const struct lttng_action *list, unsigned int *count)
+enum lttng_action_status lttng_action_list_get_count(const struct lttng_action *list,
+                                                    unsigned int *count)
 {
        const struct lttng_action_list *action_list;
        enum lttng_action_status status = LTTNG_ACTION_STATUS_OK;
@@ -441,21 +427,20 @@ end:
        return status;
 }
 
-const struct lttng_action *lttng_action_list_get_at_index(
-               const struct lttng_action *list, unsigned int index)
+const struct lttng_action *lttng_action_list_get_at_index(const struct lttng_action *list,
+                                                         unsigned int index)
 {
        return lttng_action_list_borrow_mutable_at_index(list, index);
 }
 
-struct lttng_action *lttng_action_list_borrow_mutable_at_index(
-               const struct lttng_action *list, unsigned int index)
+struct lttng_action *lttng_action_list_borrow_mutable_at_index(const struct lttng_action *list,
+                                                              unsigned int index)
 {
        unsigned int count;
        const struct lttng_action_list *action_list;
        struct lttng_action *action = NULL;
 
-       if (lttng_action_list_get_count(list, &count) !=
-                       LTTNG_ACTION_STATUS_OK) {
+       if (lttng_action_list_get_count(list, &count) != LTTNG_ACTION_STATUS_OK) {
                goto end;
        }
 
@@ -465,7 +450,7 @@ struct lttng_action *lttng_action_list_borrow_mutable_at_index(
 
        action_list = action_list_from_action_const(list);
        action = (lttng_action *) lttng_dynamic_pointer_array_get_pointer(&action_list->actions,
-                       index);
+                                                                         index);
 end:
        return action;
 }
index d58dcbe3621b54e1dd139e91a90b743257637a34..678e1a09d4517b570a85638a0f0d80d8338338ba 100644 (file)
@@ -8,32 +8,30 @@
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/mi-lttng.hpp>
+
 #include <lttng/action/action-internal.hpp>
 #include <lttng/action/notify-internal.hpp>
 #include <lttng/action/rate-policy-internal.hpp>
 #include <lttng/lttng-error.h>
 
-#define IS_NOTIFY_ACTION(action) \
-       (lttng_action_get_type(action) == LTTNG_ACTION_TYPE_NOTIFY)
+#define IS_NOTIFY_ACTION(action) (lttng_action_get_type(action) == LTTNG_ACTION_TYPE_NOTIFY)
 
-static struct lttng_action_notify *action_notify_from_action(
-               struct lttng_action *action)
+static struct lttng_action_notify *action_notify_from_action(struct lttng_action *action)
 {
        LTTNG_ASSERT(action);
 
        return lttng::utils::container_of(action, &lttng_action_notify::parent);
 }
 
-static const struct lttng_action_notify *action_notify_from_action_const(
-               const struct lttng_action *action)
+static const struct lttng_action_notify *
+action_notify_from_action_const(const struct lttng_action *action)
 {
        LTTNG_ASSERT(action);
 
        return lttng::utils::container_of(action, &lttng_action_notify::parent);
 }
 
-static
-void lttng_action_notify_destroy(struct lttng_action *action)
+static void lttng_action_notify_destroy(struct lttng_action *action)
 {
        struct lttng_action_notify *notify_action;
        notify_action = action_notify_from_action(action);
@@ -41,9 +39,7 @@ void lttng_action_notify_destroy(struct lttng_action *action)
        free(notify_action);
 }
 
-static
-int lttng_action_notify_serialize(struct lttng_action *action,
-               struct lttng_payload *payload)
+static int lttng_action_notify_serialize(struct lttng_action *action, struct lttng_payload *payload)
 {
        int ret;
        struct lttng_action_notify *notify_action;
@@ -63,9 +59,7 @@ end:
        return ret;
 }
 
-static
-bool lttng_action_notify_is_equal(const struct lttng_action *a,
-               const struct lttng_action *b)
+static bool lttng_action_notify_is_equal(const struct lttng_action *a, const struct lttng_action *b)
 {
        const struct lttng_action_notify *_a, *_b;
 
@@ -83,8 +77,8 @@ lttng_action_notify_internal_get_rate_policy(const struct lttng_action *action)
        return _action->policy;
 }
 
-static enum lttng_error_code lttng_action_notify_mi_serialize(
-               const struct lttng_action *action, struct mi_writer *writer)
+static enum lttng_error_code lttng_action_notify_mi_serialize(const struct lttng_action *action,
+                                                             struct mi_writer *writer)
 {
        int ret;
        enum lttng_action_status status;
@@ -100,8 +94,7 @@ static enum lttng_error_code lttng_action_notify_mi_serialize(
        LTTNG_ASSERT(policy != NULL);
 
        /* Open action notify. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_action_notify);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_action_notify);
        if (ret) {
                goto mi_error;
        }
@@ -143,13 +136,15 @@ struct lttng_action *lttng_action_notify_create(void)
                goto end;
        }
 
-       lttng_action_init(&notify->parent, LTTNG_ACTION_TYPE_NOTIFY, NULL,
-                       lttng_action_notify_serialize,
-                       lttng_action_notify_is_equal,
-                       lttng_action_notify_destroy,
-                       lttng_action_notify_internal_get_rate_policy,
-                       lttng_action_generic_add_error_query_results,
-                       lttng_action_notify_mi_serialize);
+       lttng_action_init(&notify->parent,
+                         LTTNG_ACTION_TYPE_NOTIFY,
+                         NULL,
+                         lttng_action_notify_serialize,
+                         lttng_action_notify_is_equal,
+                         lttng_action_notify_destroy,
+                         lttng_action_notify_internal_get_rate_policy,
+                         lttng_action_generic_add_error_query_results,
+                         lttng_action_notify_mi_serialize);
 
        notify->policy = policy;
        policy = NULL;
@@ -163,17 +158,15 @@ end:
        return action;
 }
 
-ssize_t lttng_action_notify_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_action **action)
+ssize_t lttng_action_notify_create_from_payload(struct lttng_payload_view *view,
+                                               struct lttng_action **action)
 {
        enum lttng_action_status status;
        ssize_t consumed_length;
        struct lttng_rate_policy *rate_policy = NULL;
        struct lttng_action *_action = NULL;
 
-       consumed_length = lttng_rate_policy_create_from_payload(
-                       view, &rate_policy);
+       consumed_length = lttng_rate_policy_create_from_payload(view, &rate_policy);
        if (!rate_policy) {
                consumed_length = -1;
                goto end;
@@ -200,9 +193,8 @@ end:
        return consumed_length;
 }
 
-enum lttng_action_status lttng_action_notify_set_rate_policy(
-               struct lttng_action *action,
-               const struct lttng_rate_policy *policy)
+enum lttng_action_status lttng_action_notify_set_rate_policy(struct lttng_action *action,
+                                                            const struct lttng_rate_policy *policy)
 {
        enum lttng_action_status status;
        struct lttng_action_notify *notify_action;
@@ -234,9 +226,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_notify_get_rate_policy(
-               const struct lttng_action *action,
-               const struct lttng_rate_policy **policy)
+enum lttng_action_status
+lttng_action_notify_get_rate_policy(const struct lttng_action *action,
+                                   const struct lttng_rate_policy **policy)
 {
        enum lttng_action_status status;
        const struct lttng_action_notify *notify_action;
index 612ade8c31a69e7696312c9882c145b1700335e4..0e8d8ec8a8a7b599dda4f3dd9aac80bcb7f475d7 100644 (file)
@@ -14,8 +14,7 @@ struct lttng_action_path_comm {
 } LTTNG_PACKED;
 } /* namespace */
 
-struct lttng_action_path *lttng_action_path_create(
-               const uint64_t *indexes, size_t index_count)
+struct lttng_action_path *lttng_action_path_create(const uint64_t *indexes, size_t index_count)
 {
        int ret;
        size_t i;
@@ -33,8 +32,7 @@ struct lttng_action_path *lttng_action_path_create(
        lttng_dynamic_array_init(&path->indexes, sizeof(uint64_t), NULL);
 
        for (i = 0; i < index_count; i++) {
-               ret = lttng_dynamic_array_add_element(
-                               &path->indexes, &indexes[i]);
+               ret = lttng_dynamic_array_add_element(&path->indexes, &indexes[i]);
                if (ret) {
                        goto error;
                }
@@ -48,8 +46,8 @@ end:
        return path;
 }
 
-enum lttng_action_path_status lttng_action_path_get_index_count(
-               const struct lttng_action_path *path, size_t *index_count)
+enum lttng_action_path_status
+lttng_action_path_get_index_count(const struct lttng_action_path *path, size_t *index_count)
 {
        enum lttng_action_path_status status;
 
@@ -65,21 +63,17 @@ end:
 }
 
 enum lttng_action_path_status lttng_action_path_get_index_at_index(
-               const struct lttng_action_path *path,
-               size_t path_index,
-               uint64_t *out_index)
+       const struct lttng_action_path *path, size_t path_index, uint64_t *out_index)
 {
        enum lttng_action_path_status status;
 
-       if (!path || !out_index ||
-                       path_index >= lttng_dynamic_array_get_count(
-                               &path->indexes)) {
+       if (!path || !out_index || path_index >= lttng_dynamic_array_get_count(&path->indexes)) {
                status = LTTNG_ACTION_PATH_STATUS_INVALID;
                goto end;
        }
 
-       *out_index = *((typeof(out_index)) lttng_dynamic_array_get_element(
-                       &path->indexes, path_index));
+       *out_index =
+               *((typeof(out_index)) lttng_dynamic_array_get_element(&path->indexes, path_index));
        status = LTTNG_ACTION_PATH_STATUS_OK;
 end:
        return status;
@@ -97,8 +91,7 @@ end:
        return;
 }
 
-int lttng_action_path_copy(const struct lttng_action_path *src,
-               struct lttng_action_path **dst)
+int lttng_action_path_copy(const struct lttng_action_path *src, struct lttng_action_path **dst)
 {
        int ret;
        struct lttng_action_path *new_path;
@@ -107,9 +100,8 @@ int lttng_action_path_copy(const struct lttng_action_path *src,
        LTTNG_ASSERT(dst);
 
        new_path = lttng_action_path_create(
-                       (uint64_t *) lttng_dynamic_array_get_element(
-                               &src->indexes, 0), 
-                       lttng_dynamic_array_get_count(&src->indexes));
+               (uint64_t *) lttng_dynamic_array_get_element(&src->indexes, 0),
+               lttng_dynamic_array_get_count(&src->indexes));
        if (!new_path) {
                ret = -1;
        } else {
@@ -120,15 +112,14 @@ int lttng_action_path_copy(const struct lttng_action_path *src,
        return ret;
 }
 
-ssize_t lttng_action_path_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_action_path **_action_path)
+ssize_t lttng_action_path_create_from_payload(struct lttng_payload_view *view,
+                                             struct lttng_action_path **_action_path)
 {
        ssize_t consumed_size = 0, ret = -1;
        const struct lttng_action_path_comm *header;
        struct lttng_action_path *action_path = NULL;
        const struct lttng_payload_view header_view =
-                       lttng_payload_view_from_view(view, 0, sizeof(*header));
+               lttng_payload_view_from_view(view, 0, sizeof(*header));
 
        if (!lttng_payload_view_is_valid(&header_view)) {
                goto end;
@@ -142,22 +133,17 @@ ssize_t lttng_action_path_create_from_payload(
         * single non-list action. Handle it differently since a payload view of
         * size 0 is considered invalid.
         */
-       if (header->index_count != 0)
-       {
-               const struct lttng_payload_view indexes_view =
-                               lttng_payload_view_from_view(view,
-                                               consumed_size,
-                                               header->index_count *
-                                                               sizeof(uint64_t));
+       if (header->index_count != 0) {
+               const struct lttng_payload_view indexes_view = lttng_payload_view_from_view(
+                       view, consumed_size, header->index_count * sizeof(uint64_t));
 
                if (!lttng_payload_view_is_valid(&indexes_view)) {
                        goto end;
                }
 
                consumed_size += indexes_view.buffer.size;
-               action_path = lttng_action_path_create(
-                               (const uint64_t *) indexes_view.buffer.data,
-                               header->index_count);
+               action_path = lttng_action_path_create((const uint64_t *) indexes_view.buffer.data,
+                                                      header->index_count);
                if (!action_path) {
                        goto end;
                }
@@ -175,7 +161,7 @@ end:
 }
 
 int lttng_action_path_serialize(const struct lttng_action_path *action_path,
-               struct lttng_payload *payload)
+                               struct lttng_payload *payload)
 {
        int ret;
        size_t index_count, i;
@@ -189,22 +175,20 @@ int lttng_action_path_serialize(const struct lttng_action_path *action_path,
        }
 
        comm.index_count = (uint32_t) index_count;
-       ret = lttng_dynamic_buffer_append(&payload->buffer,
-                       &comm,
-                       sizeof(struct lttng_action_path_comm));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &comm, sizeof(struct lttng_action_path_comm));
 
        for (i = 0; i < index_count; i++) {
                uint64_t path_index;
 
-               status = lttng_action_path_get_index_at_index(
-                               action_path, i, &path_index);
+               status = lttng_action_path_get_index_at_index(action_path, i, &path_index);
                if (status != LTTNG_ACTION_PATH_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
 
-               ret = lttng_dynamic_buffer_append(&payload->buffer, &path_index,
-                               sizeof(path_index));
+               ret = lttng_dynamic_buffer_append(
+                       &payload->buffer, &path_index, sizeof(path_index));
                if (ret) {
                        goto end;
                }
index 303b4a781765ab71f4a739073c0ac168b95b71c0..a25ee3e1572bfd79e6c5312f1cce8df32cea1d59 100644 (file)
 #include <common/mi-lttng.hpp>
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
-#include <limits.h>
+
 #include <lttng/action/rate-policy-internal.hpp>
 #include <lttng/action/rate-policy.h>
+
+#include <limits.h>
 #include <stdbool.h>
 #include <sys/types.h>
 
 #define IS_EVERY_N_RATE_POLICY(policy) \
        (lttng_rate_policy_get_type(policy) == LTTNG_RATE_POLICY_TYPE_EVERY_N)
 
-#define IS_ONCE_AFTER_N_RATE_POLICY(policy)    \
-       (lttng_rate_policy_get_type(policy) == \
-                       LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N)
+#define IS_ONCE_AFTER_N_RATE_POLICY(policy) \
+       (lttng_rate_policy_get_type(policy) == LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N)
 
 typedef void (*rate_policy_destroy_cb)(struct lttng_rate_policy *rate_policy);
 typedef int (*rate_policy_serialize_cb)(struct lttng_rate_policy *rate_policy,
-               struct lttng_payload *payload);
+                                       struct lttng_payload *payload);
 typedef bool (*rate_policy_equal_cb)(const struct lttng_rate_policy *a,
-               const struct lttng_rate_policy *b);
-typedef ssize_t (*rate_policy_create_from_payload_cb)(
-               struct lttng_payload_view *view,
-               struct lttng_rate_policy **rate_policy);
-typedef struct lttng_rate_policy *(*rate_policy_copy_cb)(
-               const struct lttng_rate_policy *source);
+                                    const struct lttng_rate_policy *b);
+typedef ssize_t (*rate_policy_create_from_payload_cb)(struct lttng_payload_view *view,
+                                                     struct lttng_rate_policy **rate_policy);
+typedef struct lttng_rate_policy *(*rate_policy_copy_cb)(const struct lttng_rate_policy *source);
 typedef enum lttng_error_code (*rate_policy_mi_serialize_cb)(
-               const struct lttng_rate_policy *rate_policy,
-               struct mi_writer *writer);
+       const struct lttng_rate_policy *rate_policy, struct mi_writer *writer);
 
 struct lttng_rate_policy {
        enum lttng_rate_policy_type type;
@@ -75,23 +73,22 @@ struct lttng_rate_policy_every_n_comm {
 
 /* Forward declaration. */
 static void lttng_rate_policy_init(struct lttng_rate_policy *rate_policy,
-               enum lttng_rate_policy_type type,
-               rate_policy_serialize_cb serialize,
-               rate_policy_equal_cb equal,
-               rate_policy_destroy_cb destroy,
-               rate_policy_copy_cb copy,
-               rate_policy_mi_serialize_cb mi);
+                                  enum lttng_rate_policy_type type,
+                                  rate_policy_serialize_cb serialize,
+                                  rate_policy_equal_cb equal,
+                                  rate_policy_destroy_cb destroy,
+                                  rate_policy_copy_cb copy,
+                                  rate_policy_mi_serialize_cb mi);
 
 /* Forward declaration. Every n */
-static bool lttng_rate_policy_every_n_should_execute(
-               const struct lttng_rate_policy *policy, uint64_t counter);
+static bool lttng_rate_policy_every_n_should_execute(const struct lttng_rate_policy *policy,
+                                                    uint64_t counter);
 
 /* Forward declaration. Once after N */
-static bool lttng_rate_policy_once_after_n_should_execute(
-               const struct lttng_rate_policy *policy, uint64_t counter);
+static bool lttng_rate_policy_once_after_n_should_execute(const struct lttng_rate_policy *policy,
+                                                         uint64_t counter);
 
-const char *lttng_rate_policy_type_string(
-               enum lttng_rate_policy_type rate_policy_type)
+const char *lttng_rate_policy_type_string(enum lttng_rate_policy_type rate_policy_type)
 {
        switch (rate_policy_type) {
        case LTTNG_RATE_POLICY_TYPE_EVERY_N:
@@ -103,19 +100,18 @@ const char *lttng_rate_policy_type_string(
        }
 }
 
-enum lttng_rate_policy_type lttng_rate_policy_get_type(
-               const struct lttng_rate_policy *policy)
+enum lttng_rate_policy_type lttng_rate_policy_get_type(const struct lttng_rate_policy *policy)
 {
        return policy ? policy->type : LTTNG_RATE_POLICY_TYPE_UNKNOWN;
 }
 
 void lttng_rate_policy_init(struct lttng_rate_policy *rate_policy,
-               enum lttng_rate_policy_type type,
-               rate_policy_serialize_cb serialize,
-               rate_policy_equal_cb equal,
-               rate_policy_destroy_cb destroy,
-               rate_policy_copy_cb copy,
-               rate_policy_mi_serialize_cb mi)
+                           enum lttng_rate_policy_type type,
+                           rate_policy_serialize_cb serialize,
+                           rate_policy_equal_cb equal,
+                           rate_policy_destroy_cb destroy,
+                           rate_policy_copy_cb copy,
+                           rate_policy_mi_serialize_cb mi)
 {
        rate_policy->type = type;
        rate_policy->serialize = serialize;
@@ -135,15 +131,15 @@ void lttng_rate_policy_destroy(struct lttng_rate_policy *rate_policy)
 }
 
 int lttng_rate_policy_serialize(struct lttng_rate_policy *rate_policy,
-               struct lttng_payload *payload)
+                               struct lttng_payload *payload)
 {
        int ret;
        struct lttng_rate_policy_comm rate_policy_comm = {
-                       .rate_policy_type = (int8_t) rate_policy->type,
+               .rate_policy_type = (int8_t) rate_policy->type,
        };
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &rate_policy_comm,
-                       sizeof(rate_policy_comm));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &rate_policy_comm, sizeof(rate_policy_comm));
        if (ret) {
                goto end;
        }
@@ -156,15 +152,15 @@ end:
        return ret;
 }
 
-static ssize_t lttng_rate_policy_once_after_n_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_rate_policy **rate_policy)
+static ssize_t
+lttng_rate_policy_once_after_n_create_from_payload(struct lttng_payload_view *view,
+                                                  struct lttng_rate_policy **rate_policy)
 {
        ssize_t consumed_len = -1;
        struct lttng_rate_policy *policy = NULL;
        const struct lttng_rate_policy_once_after_n_comm *comm;
        const struct lttng_payload_view comm_view =
-                       lttng_payload_view_from_view(view, 0, sizeof(*comm));
+               lttng_payload_view_from_view(view, 0, sizeof(*comm));
 
        if (!view || !rate_policy) {
                consumed_len = -1;
@@ -177,8 +173,7 @@ static ssize_t lttng_rate_policy_once_after_n_create_from_payload(
                goto end;
        }
 
-       comm = (const struct lttng_rate_policy_once_after_n_comm *)
-                              comm_view.buffer.data;
+       comm = (const struct lttng_rate_policy_once_after_n_comm *) comm_view.buffer.data;
 
        policy = lttng_rate_policy_once_after_n_create(comm->threshold);
        if (policy == NULL) {
@@ -193,15 +188,14 @@ end:
        return consumed_len;
 }
 
-static ssize_t lttng_rate_policy_every_n_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_rate_policy **rate_policy)
+static ssize_t lttng_rate_policy_every_n_create_from_payload(struct lttng_payload_view *view,
+                                                            struct lttng_rate_policy **rate_policy)
 {
        ssize_t consumed_len = -1;
        struct lttng_rate_policy *policy = NULL;
        const struct lttng_rate_policy_every_n_comm *comm;
        const struct lttng_payload_view comm_view =
-                       lttng_payload_view_from_view(view, 0, sizeof(*comm));
+               lttng_payload_view_from_view(view, 0, sizeof(*comm));
 
        if (!view || !rate_policy) {
                consumed_len = -1;
@@ -214,8 +208,7 @@ static ssize_t lttng_rate_policy_every_n_create_from_payload(
                goto end;
        }
 
-       comm = (const struct lttng_rate_policy_every_n_comm *)
-                              comm_view.buffer.data;
+       comm = (const struct lttng_rate_policy_every_n_comm *) comm_view.buffer.data;
 
        policy = lttng_rate_policy_every_n_create(comm->interval);
        if (policy == NULL) {
@@ -231,14 +224,13 @@ end:
 }
 
 ssize_t lttng_rate_policy_create_from_payload(struct lttng_payload_view *view,
-               struct lttng_rate_policy **rate_policy)
+                                             struct lttng_rate_policy **rate_policy)
 {
        ssize_t consumed_len, specific_rate_policy_consumed_len;
        rate_policy_create_from_payload_cb create_from_payload_cb;
        const struct lttng_rate_policy_comm *rate_policy_comm;
        const struct lttng_payload_view rate_policy_comm_view =
-               lttng_payload_view_from_view(
-                       view, 0, sizeof(*rate_policy_comm));
+               lttng_payload_view_from_view(view, 0, sizeof(*rate_policy_comm));
 
        if (!view || !rate_policy) {
                consumed_len = -1;
@@ -251,27 +243,25 @@ ssize_t lttng_rate_policy_create_from_payload(struct lttng_payload_view *view,
                goto end;
        }
 
-       rate_policy_comm = (const struct lttng_rate_policy_comm *)
-                                          rate_policy_comm_view.buffer.data;
+       rate_policy_comm =
+               (const struct lttng_rate_policy_comm *) rate_policy_comm_view.buffer.data;
 
        DBG("Create rate_policy from payload: rate-policy-type=%s",
-               lttng_rate_policy_type_string(
-                       (lttng_rate_policy_type) rate_policy_comm->rate_policy_type));
+           lttng_rate_policy_type_string(
+                   (lttng_rate_policy_type) rate_policy_comm->rate_policy_type));
 
        switch (rate_policy_comm->rate_policy_type) {
        case LTTNG_RATE_POLICY_TYPE_EVERY_N:
-               create_from_payload_cb =
-                               lttng_rate_policy_every_n_create_from_payload;
+               create_from_payload_cb = lttng_rate_policy_every_n_create_from_payload;
                break;
        case LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N:
-               create_from_payload_cb =
-                               lttng_rate_policy_once_after_n_create_from_payload;
+               create_from_payload_cb = lttng_rate_policy_once_after_n_create_from_payload;
                break;
        default:
                ERR("Failed to create rate-policy from payload, unhandled rate-policy type: rate-policy-type=%u (%s)",
-                               rate_policy_comm->rate_policy_type,
-                               lttng_rate_policy_type_string(
-                                       (lttng_rate_policy_type) rate_policy_comm->rate_policy_type));
+                   rate_policy_comm->rate_policy_type,
+                   lttng_rate_policy_type_string(
+                           (lttng_rate_policy_type) rate_policy_comm->rate_policy_type));
                consumed_len = -1;
                goto end;
        }
@@ -279,13 +269,11 @@ ssize_t lttng_rate_policy_create_from_payload(struct lttng_payload_view *view,
        {
                /* Create buffer view for the rate_policy-type-specific data.
                 */
-               struct lttng_payload_view specific_rate_policy_view =
-                               lttng_payload_view_from_view(view,
-                                               sizeof(struct lttng_rate_policy_comm),
-                                               -1);
+               struct lttng_payload_view specific_rate_policy_view = lttng_payload_view_from_view(
+                       view, sizeof(struct lttng_rate_policy_comm), -1);
 
-               specific_rate_policy_consumed_len = create_from_payload_cb(
-                               &specific_rate_policy_view, rate_policy);
+               specific_rate_policy_consumed_len =
+                       create_from_payload_cb(&specific_rate_policy_view, rate_policy);
        }
        if (specific_rate_policy_consumed_len < 0) {
                ERR("Failed to create specific rate_policy from buffer.");
@@ -295,15 +283,14 @@ ssize_t lttng_rate_policy_create_from_payload(struct lttng_payload_view *view,
 
        LTTNG_ASSERT(*rate_policy);
 
-       consumed_len = sizeof(struct lttng_rate_policy_comm) +
-                       specific_rate_policy_consumed_len;
+       consumed_len = sizeof(struct lttng_rate_policy_comm) + specific_rate_policy_consumed_len;
 
 end:
        return consumed_len;
 }
 
 bool lttng_rate_policy_is_equal(const struct lttng_rate_policy *a,
-               const struct lttng_rate_policy *b)
+                               const struct lttng_rate_policy *b)
 {
        bool is_equal = false;
 
@@ -326,16 +313,13 @@ end:
        return is_equal;
 }
 
-bool lttng_rate_policy_should_execute(
-               const struct lttng_rate_policy *policy, uint64_t counter)
+bool lttng_rate_policy_should_execute(const struct lttng_rate_policy *policy, uint64_t counter)
 {
        switch (policy->type) {
        case LTTNG_RATE_POLICY_TYPE_EVERY_N:
-               return lttng_rate_policy_every_n_should_execute(
-                               policy, counter);
+               return lttng_rate_policy_every_n_should_execute(policy, counter);
        case LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N:
-               return lttng_rate_policy_once_after_n_should_execute(
-                               policy, counter);
+               return lttng_rate_policy_once_after_n_should_execute(policy, counter);
        default:
                abort();
                break;
@@ -343,8 +327,8 @@ bool lttng_rate_policy_should_execute(
 }
 
 /* Every N */
-static struct lttng_rate_policy_every_n *rate_policy_every_n_from_rate_policy(
-               struct lttng_rate_policy *policy)
+static struct lttng_rate_policy_every_n *
+rate_policy_every_n_from_rate_policy(struct lttng_rate_policy *policy)
 {
        LTTNG_ASSERT(policy);
 
@@ -352,16 +336,15 @@ static struct lttng_rate_policy_every_n *rate_policy_every_n_from_rate_policy(
 }
 
 static const struct lttng_rate_policy_every_n *
-rate_policy_every_n_from_rate_policy_const(
-               const struct lttng_rate_policy *policy)
+rate_policy_every_n_from_rate_policy_const(const struct lttng_rate_policy *policy)
 {
        LTTNG_ASSERT(policy);
 
        return lttng::utils::container_of(policy, &lttng_rate_policy_every_n::parent);
 }
 
-static int lttng_rate_policy_every_n_serialize(
-               struct lttng_rate_policy *policy, struct lttng_payload *payload)
+static int lttng_rate_policy_every_n_serialize(struct lttng_rate_policy *policy,
+                                              struct lttng_payload *payload)
 {
        int ret;
 
@@ -374,14 +357,12 @@ static int lttng_rate_policy_every_n_serialize(
        every_n_policy = rate_policy_every_n_from_rate_policy(policy);
        comm.interval = every_n_policy->interval;
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &comm, sizeof(comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
        return ret;
 }
 
-static bool lttng_rate_policy_every_n_is_equal(
-               const struct lttng_rate_policy *_a,
-               const struct lttng_rate_policy *_b)
+static bool lttng_rate_policy_every_n_is_equal(const struct lttng_rate_policy *_a,
+                                              const struct lttng_rate_policy *_b)
 {
        bool is_equal = false;
        const struct lttng_rate_policy_every_n *a, *b;
@@ -415,8 +396,8 @@ end:
        return;
 }
 
-static struct lttng_rate_policy *lttng_rate_policy_every_n_copy(
-               const struct lttng_rate_policy *source)
+static struct lttng_rate_policy *
+lttng_rate_policy_every_n_copy(const struct lttng_rate_policy *source)
 {
        struct lttng_rate_policy *copy = NULL;
        const struct lttng_rate_policy_every_n *every_n_policy;
@@ -432,9 +413,9 @@ end:
        return copy;
 }
 
-static enum lttng_error_code lttng_rate_policy_every_n_mi_serialize(
-               const struct lttng_rate_policy *rate_policy,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_rate_policy_every_n_mi_serialize(const struct lttng_rate_policy *rate_policy,
+                                      struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -444,20 +425,17 @@ static enum lttng_error_code lttng_rate_policy_every_n_mi_serialize(
        LTTNG_ASSERT(IS_EVERY_N_RATE_POLICY(rate_policy));
        LTTNG_ASSERT(writer);
 
-       every_n_policy = rate_policy_every_n_from_rate_policy_const(
-                       rate_policy);
+       every_n_policy = rate_policy_every_n_from_rate_policy_const(rate_policy);
 
        /* Open rate_policy_every_n element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_rate_policy_every_n);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_rate_policy_every_n);
        if (ret) {
                goto mi_error;
        }
 
        /* Interval. */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       mi_lttng_element_rate_policy_every_n_interval,
-                       every_n_policy->interval);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, mi_lttng_element_rate_policy_every_n_interval, every_n_policy->interval);
        if (ret) {
                goto mi_error;
        }
@@ -494,12 +472,13 @@ struct lttng_rate_policy *lttng_rate_policy_every_n_create(uint64_t interval)
                goto end;
        }
 
-       lttng_rate_policy_init(&policy->parent, LTTNG_RATE_POLICY_TYPE_EVERY_N,
-                       lttng_rate_policy_every_n_serialize,
-                       lttng_rate_policy_every_n_is_equal,
-                       lttng_rate_policy_every_n_destroy,
-                       lttng_rate_policy_every_n_copy,
-                       lttng_rate_policy_every_n_mi_serialize);
+       lttng_rate_policy_init(&policy->parent,
+                              LTTNG_RATE_POLICY_TYPE_EVERY_N,
+                              lttng_rate_policy_every_n_serialize,
+                              lttng_rate_policy_every_n_is_equal,
+                              lttng_rate_policy_every_n_destroy,
+                              lttng_rate_policy_every_n_copy,
+                              lttng_rate_policy_every_n_mi_serialize);
 
        policy->interval = interval;
 
@@ -511,8 +490,8 @@ end:
        return _policy;
 }
 
-enum lttng_rate_policy_status lttng_rate_policy_every_n_get_interval(
-               const struct lttng_rate_policy *policy, uint64_t *interval)
+enum lttng_rate_policy_status
+lttng_rate_policy_every_n_get_interval(const struct lttng_rate_policy *policy, uint64_t *interval)
 {
        const struct lttng_rate_policy_every_n *every_n_policy;
        enum lttng_rate_policy_status status;
@@ -530,8 +509,8 @@ end:
        return status;
 }
 
-static bool lttng_rate_policy_every_n_should_execute(
-               const struct lttng_rate_policy *policy, uint64_t counter)
+static bool lttng_rate_policy_every_n_should_execute(const struct lttng_rate_policy *policy,
+                                                    uint64_t counter)
 {
        const struct lttng_rate_policy_every_n *every_n_policy;
        LTTNG_ASSERT(policy);
@@ -545,10 +524,10 @@ static bool lttng_rate_policy_every_n_should_execute(
 
        execute = (counter % every_n_policy->interval) == 0;
 
-       DBG("Policy every N = %" PRIu64
-           ": execution %s. Execution count: %" PRIu64,
-                       every_n_policy->interval,
-                       execute ? "accepted" : "denied", counter);
+       DBG("Policy every N = %" PRIu64 ": execution %s. Execution count: %" PRIu64,
+           every_n_policy->interval,
+           execute ? "accepted" : "denied",
+           counter);
 
        return execute;
 }
@@ -560,21 +539,18 @@ rate_policy_once_after_n_from_rate_policy(struct lttng_rate_policy *policy)
 {
        LTTNG_ASSERT(policy);
 
-       return lttng::utils::container_of(
-                       policy, &lttng_rate_policy_once_after_n::parent);
+       return lttng::utils::container_of(policy, &lttng_rate_policy_once_after_n::parent);
 }
 
 static const struct lttng_rate_policy_once_after_n *
-rate_policy_once_after_n_from_rate_policy_const(
-               const struct lttng_rate_policy *policy)
+rate_policy_once_after_n_from_rate_policy_const(const struct lttng_rate_policy *policy)
 {
        LTTNG_ASSERT(policy);
 
-       return lttng::utils::container_of(
-                       policy, &lttng_rate_policy_once_after_n::parent);
+       return lttng::utils::container_of(policy, &lttng_rate_policy_once_after_n::parent);
 }
-static int lttng_rate_policy_once_after_n_serialize(
-               struct lttng_rate_policy *policy, struct lttng_payload *payload)
+static int lttng_rate_policy_once_after_n_serialize(struct lttng_rate_policy *policy,
+                                                   struct lttng_payload *payload)
 {
        int ret;
 
@@ -587,14 +563,12 @@ static int lttng_rate_policy_once_after_n_serialize(
        once_after_n_policy = rate_policy_once_after_n_from_rate_policy(policy);
        comm.threshold = once_after_n_policy->threshold;
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &comm, sizeof(comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
        return ret;
 }
 
-static bool lttng_rate_policy_once_after_n_is_equal(
-               const struct lttng_rate_policy *_a,
-               const struct lttng_rate_policy *_b)
+static bool lttng_rate_policy_once_after_n_is_equal(const struct lttng_rate_policy *_a,
+                                                   const struct lttng_rate_policy *_b)
 {
        bool is_equal = false;
        const struct lttng_rate_policy_once_after_n *a, *b;
@@ -612,8 +586,7 @@ end:
        return is_equal;
 }
 
-static void lttng_rate_policy_once_after_n_destroy(
-               struct lttng_rate_policy *policy)
+static void lttng_rate_policy_once_after_n_destroy(struct lttng_rate_policy *policy)
 {
        struct lttng_rate_policy_once_after_n *once_after_n_policy;
 
@@ -629,8 +602,8 @@ end:
        return;
 }
 
-static struct lttng_rate_policy *lttng_rate_policy_once_after_n_copy(
-               const struct lttng_rate_policy *source)
+static struct lttng_rate_policy *
+lttng_rate_policy_once_after_n_copy(const struct lttng_rate_policy *source)
 {
        struct lttng_rate_policy *copy = NULL;
        const struct lttng_rate_policy_once_after_n *once_after_n_policy;
@@ -639,18 +612,16 @@ static struct lttng_rate_policy *lttng_rate_policy_once_after_n_copy(
                goto end;
        }
 
-       once_after_n_policy =
-                       rate_policy_once_after_n_from_rate_policy_const(source);
-       copy = lttng_rate_policy_once_after_n_create(
-                       once_after_n_policy->threshold);
+       once_after_n_policy = rate_policy_once_after_n_from_rate_policy_const(source);
+       copy = lttng_rate_policy_once_after_n_create(once_after_n_policy->threshold);
 
 end:
        return copy;
 }
 
-static enum lttng_error_code lttng_rate_policy_once_after_n_mi_serialize(
-               const struct lttng_rate_policy *rate_policy,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_rate_policy_once_after_n_mi_serialize(const struct lttng_rate_policy *rate_policy,
+                                           struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -660,20 +631,19 @@ static enum lttng_error_code lttng_rate_policy_once_after_n_mi_serialize(
        LTTNG_ASSERT(IS_ONCE_AFTER_N_RATE_POLICY(rate_policy));
        LTTNG_ASSERT(writer);
 
-       once_after_n_policy = rate_policy_once_after_n_from_rate_policy_const(
-                       rate_policy);
+       once_after_n_policy = rate_policy_once_after_n_from_rate_policy_const(rate_policy);
 
        /* Open rate_policy_once_after_n. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_rate_policy_once_after_n);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_rate_policy_once_after_n);
        if (ret) {
                goto mi_error;
        }
 
        /* Threshold. */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       mi_lttng_element_rate_policy_once_after_n_threshold,
-                       once_after_n_policy->threshold);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer,
+               mi_lttng_element_rate_policy_once_after_n_threshold,
+               once_after_n_policy->threshold);
        if (ret) {
                goto mi_error;
        }
@@ -693,8 +663,7 @@ end:
        return ret_code;
 }
 
-struct lttng_rate_policy *lttng_rate_policy_once_after_n_create(
-               uint64_t threshold)
+struct lttng_rate_policy *lttng_rate_policy_once_after_n_create(uint64_t threshold)
 {
        struct lttng_rate_policy_once_after_n *policy = NULL;
        struct lttng_rate_policy *_policy = NULL;
@@ -710,12 +679,12 @@ struct lttng_rate_policy *lttng_rate_policy_once_after_n_create(
        }
 
        lttng_rate_policy_init(&policy->parent,
-                       LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N,
-                       lttng_rate_policy_once_after_n_serialize,
-                       lttng_rate_policy_once_after_n_is_equal,
-                       lttng_rate_policy_once_after_n_destroy,
-                       lttng_rate_policy_once_after_n_copy,
-                       lttng_rate_policy_once_after_n_mi_serialize);
+                              LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N,
+                              lttng_rate_policy_once_after_n_serialize,
+                              lttng_rate_policy_once_after_n_is_equal,
+                              lttng_rate_policy_once_after_n_destroy,
+                              lttng_rate_policy_once_after_n_copy,
+                              lttng_rate_policy_once_after_n_mi_serialize);
 
        policy->threshold = threshold;
 
@@ -727,8 +696,9 @@ end:
        return _policy;
 }
 
-enum lttng_rate_policy_status lttng_rate_policy_once_after_n_get_threshold(
-               const struct lttng_rate_policy *policy, uint64_t *threshold)
+enum lttng_rate_policy_status
+lttng_rate_policy_once_after_n_get_threshold(const struct lttng_rate_policy *policy,
+                                            uint64_t *threshold)
 {
        const struct lttng_rate_policy_once_after_n *once_after_n_policy;
        enum lttng_rate_policy_status status;
@@ -738,8 +708,7 @@ enum lttng_rate_policy_status lttng_rate_policy_once_after_n_get_threshold(
                goto end;
        }
 
-       once_after_n_policy =
-                       rate_policy_once_after_n_from_rate_policy_const(policy);
+       once_after_n_policy = rate_policy_once_after_n_from_rate_policy_const(policy);
        *threshold = once_after_n_policy->threshold;
        status = LTTNG_RATE_POLICY_STATUS_OK;
 end:
@@ -747,36 +716,33 @@ end:
        return status;
 }
 
-struct lttng_rate_policy *lttng_rate_policy_copy(
-               const struct lttng_rate_policy *source)
+struct lttng_rate_policy *lttng_rate_policy_copy(const struct lttng_rate_policy *source)
 {
        LTTNG_ASSERT(source->copy);
        return source->copy(source);
 }
 
-static bool lttng_rate_policy_once_after_n_should_execute(
-               const struct lttng_rate_policy *policy, uint64_t counter)
+static bool lttng_rate_policy_once_after_n_should_execute(const struct lttng_rate_policy *policy,
+                                                         uint64_t counter)
 {
        const struct lttng_rate_policy_once_after_n *once_after_n_policy;
        bool execute = false;
        LTTNG_ASSERT(policy);
 
-       once_after_n_policy =
-                       rate_policy_once_after_n_from_rate_policy_const(policy);
+       once_after_n_policy = rate_policy_once_after_n_from_rate_policy_const(policy);
 
        execute = counter == once_after_n_policy->threshold;
 
-       DBG("Policy once after N = %" PRIu64
-           ": execution %s. Execution count: %" PRIu64,
-                       once_after_n_policy->threshold,
-                       execute ? "accepted" : "denied", counter);
+       DBG("Policy once after N = %" PRIu64 ": execution %s. Execution count: %" PRIu64,
+           once_after_n_policy->threshold,
+           execute ? "accepted" : "denied",
+           counter);
 
        return counter == once_after_n_policy->threshold;
 }
 
-enum lttng_error_code lttng_rate_policy_mi_serialize(
-               const struct lttng_rate_policy *rate_policy,
-               struct mi_writer *writer)
+enum lttng_error_code lttng_rate_policy_mi_serialize(const struct lttng_rate_policy *rate_policy,
+                                                    struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -786,8 +752,7 @@ enum lttng_error_code lttng_rate_policy_mi_serialize(
        LTTNG_ASSERT(rate_policy->mi_serialize);
 
        /* Open rate policy element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_rate_policy);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_rate_policy);
        if (ret) {
                goto mi_error;
        }
index b25731484891788f64e34b804baf4882b25929b7..18b1e9ef24cf71fd57c501a60937983c0b46021d 100644 (file)
@@ -8,6 +8,7 @@
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/mi-lttng.hpp>
+
 #include <lttng/action/action-internal.hpp>
 #include <lttng/action/rate-policy-internal.hpp>
 #include <lttng/action/rate-policy.h>
@@ -41,11 +42,10 @@ struct lttng_action_rotate_session_comm {
 } /* namespace */
 
 static const struct lttng_rate_policy *
-lttng_action_rotate_session_internal_get_rate_policy(
-               const struct lttng_action *action);
+lttng_action_rotate_session_internal_get_rate_policy(const struct lttng_action *action);
 
-static struct lttng_action_rotate_session *action_rotate_session_from_action(
-               struct lttng_action *action)
+static struct lttng_action_rotate_session *
+action_rotate_session_from_action(struct lttng_action *action)
 {
        LTTNG_ASSERT(action);
 
@@ -74,7 +74,7 @@ static bool lttng_action_rotate_session_validate(struct lttng_action *action)
 
        /* A non-empty session name is mandatory. */
        if (!action_rotate_session->session_name ||
-                       strlen(action_rotate_session->session_name) == 0) {
+           strlen(action_rotate_session->session_name) == 0) {
                valid = false;
                goto end;
        }
@@ -84,8 +84,8 @@ end:
        return valid;
 }
 
-static bool lttng_action_rotate_session_is_equal(
-               const struct lttng_action *_a, const struct lttng_action *_b)
+static bool lttng_action_rotate_session_is_equal(const struct lttng_action *_a,
+                                                const struct lttng_action *_b)
 {
        bool is_equal = false;
        const struct lttng_action_rotate_session *a, *b;
@@ -104,8 +104,8 @@ static bool lttng_action_rotate_session_is_equal(
 end:
        return is_equal;
 }
-static int lttng_action_rotate_session_serialize(
-               struct lttng_action *action, struct lttng_payload *payload)
+static int lttng_action_rotate_session_serialize(struct lttng_action *action,
+                                                struct lttng_payload *payload)
 {
        struct lttng_action_rotate_session *action_rotate_session;
        struct lttng_action_rotate_session_comm comm;
@@ -120,27 +120,25 @@ static int lttng_action_rotate_session_serialize(
        LTTNG_ASSERT(action_rotate_session->session_name);
 
        DBG("Serializing rotate session action: session-name: %s",
-                       action_rotate_session->session_name);
+           action_rotate_session->session_name);
 
        session_name_len = strlen(action_rotate_session->session_name) + 1;
        comm.session_name_len = session_name_len;
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &comm, sizeof(comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
        if (ret) {
                ret = -1;
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer,
-                       action_rotate_session->session_name, session_name_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, action_rotate_session->session_name, session_name_len);
        if (ret) {
                ret = -1;
                goto end;
        }
 
-       ret = lttng_rate_policy_serialize(
-                       action_rotate_session->policy, payload);
+       ret = lttng_rate_policy_serialize(action_rotate_session->policy, payload);
        if (ret) {
                ret = -1;
                goto end;
@@ -167,9 +165,8 @@ end:
        return;
 }
 
-ssize_t lttng_action_rotate_session_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_action **p_action)
+ssize_t lttng_action_rotate_session_create_from_payload(struct lttng_payload_view *view,
+                                                       struct lttng_action **p_action)
 {
        ssize_t consumed_len, ret;
        const struct lttng_action_rotate_session_comm *comm;
@@ -188,7 +185,7 @@ ssize_t lttng_action_rotate_session_create_from_payload(
        session_name = (const char *) &comm->data;
 
        if (!lttng_buffer_view_contains_string(
-                       &view->buffer, session_name, comm->session_name_len)) {
+                   &view->buffer, session_name, comm->session_name_len)) {
                consumed_len = -1;
                goto end;
        }
@@ -197,10 +194,8 @@ ssize_t lttng_action_rotate_session_create_from_payload(
        /* Rate policy. */
        {
                struct lttng_payload_view policy_view =
-                               lttng_payload_view_from_view(
-                                               view, consumed_len, -1);
-               ret = lttng_rate_policy_create_from_payload(
-                               &policy_view, &policy);
+                       lttng_payload_view_from_view(view, consumed_len, -1);
+               ret = lttng_rate_policy_create_from_payload(&policy_view, &policy);
                if (ret < 0) {
                        consumed_len = -1;
                        goto end;
@@ -208,8 +203,7 @@ ssize_t lttng_action_rotate_session_create_from_payload(
                consumed_len += ret;
        }
 
-       status = lttng_action_rotate_session_set_session_name(
-                       action, session_name);
+       status = lttng_action_rotate_session_set_session_name(action, session_name);
        if (status != LTTNG_ACTION_STATUS_OK) {
                consumed_len = -1;
                goto end;
@@ -232,8 +226,9 @@ end:
        return consumed_len;
 }
 
-static enum lttng_error_code lttng_action_rotate_session_mi_serialize(
-               const struct lttng_action *action, struct mi_writer *writer)
+static enum lttng_error_code
+lttng_action_rotate_session_mi_serialize(const struct lttng_action *action,
+                                        struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -244,8 +239,7 @@ static enum lttng_error_code lttng_action_rotate_session_mi_serialize(
        LTTNG_ASSERT(action);
        LTTNG_ASSERT(IS_ROTATE_SESSION_ACTION(action));
 
-       status = lttng_action_rotate_session_get_session_name(
-                       action, &session_name);
+       status = lttng_action_rotate_session_get_session_name(action, &session_name);
        LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
        LTTNG_ASSERT(session_name != NULL);
 
@@ -254,15 +248,14 @@ static enum lttng_error_code lttng_action_rotate_session_mi_serialize(
        LTTNG_ASSERT(policy != NULL);
 
        /* Open action rotate session element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_action_rotate_session);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_action_rotate_session);
        if (ret) {
                goto mi_error;
        }
 
        /* Session name. */
        ret = mi_lttng_writer_write_element_string(
-                       writer, mi_lttng_element_session_name, session_name);
+               writer, mi_lttng_element_session_name, session_name);
        if (ret) {
                goto mi_error;
        }
@@ -306,17 +299,16 @@ struct lttng_action *lttng_action_rotate_session_create(void)
        }
 
        lttng_action_init(&action_rotate->parent,
-                       LTTNG_ACTION_TYPE_ROTATE_SESSION,
-                       lttng_action_rotate_session_validate,
-                       lttng_action_rotate_session_serialize,
-                       lttng_action_rotate_session_is_equal,
-                       lttng_action_rotate_session_destroy,
-                       lttng_action_rotate_session_internal_get_rate_policy,
-                       lttng_action_generic_add_error_query_results,
-                       lttng_action_rotate_session_mi_serialize);
-
-       status = lttng_action_rotate_session_set_rate_policy(
-                       &action_rotate->parent, policy);
+                         LTTNG_ACTION_TYPE_ROTATE_SESSION,
+                         lttng_action_rotate_session_validate,
+                         lttng_action_rotate_session_serialize,
+                         lttng_action_rotate_session_is_equal,
+                         lttng_action_rotate_session_destroy,
+                         lttng_action_rotate_session_internal_get_rate_policy,
+                         lttng_action_generic_add_error_query_results,
+                         lttng_action_rotate_session_mi_serialize);
+
+       status = lttng_action_rotate_session_set_rate_policy(&action_rotate->parent, policy);
        if (status != LTTNG_ACTION_STATUS_OK) {
                lttng_action_destroy(&action_rotate->parent);
                action_rotate = NULL;
@@ -328,14 +320,14 @@ end:
        return action_rotate ? &action_rotate->parent : nullptr;
 }
 
-enum lttng_action_status lttng_action_rotate_session_set_session_name(
-               struct lttng_action *action, const char *session_name)
+enum lttng_action_status lttng_action_rotate_session_set_session_name(struct lttng_action *action,
+                                                                     const char *session_name)
 {
        struct lttng_action_rotate_session *action_rotate_session;
        enum lttng_action_status status;
 
        if (!action || !IS_ROTATE_SESSION_ACTION(action) || !session_name ||
-                       strlen(session_name) == 0) {
+           strlen(session_name) == 0) {
                status = LTTNG_ACTION_STATUS_INVALID;
                goto end;
        }
@@ -355,8 +347,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_rotate_session_get_session_name(
-               const struct lttng_action *action, const char **session_name)
+enum lttng_action_status
+lttng_action_rotate_session_get_session_name(const struct lttng_action *action,
+                                            const char **session_name)
 {
        const struct lttng_action_rotate_session *action_rotate_session;
        enum lttng_action_status status;
@@ -375,9 +368,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_rotate_session_set_rate_policy(
-               struct lttng_action *action,
-               const struct lttng_rate_policy *policy)
+enum lttng_action_status
+lttng_action_rotate_session_set_rate_policy(struct lttng_action *action,
+                                           const struct lttng_rate_policy *policy)
 {
        enum lttng_action_status status;
        struct lttng_action_rotate_session *rotate_session_action;
@@ -409,9 +402,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_rotate_session_get_rate_policy(
-               const struct lttng_action *action,
-               const struct lttng_rate_policy **policy)
+enum lttng_action_status
+lttng_action_rotate_session_get_rate_policy(const struct lttng_action *action,
+                                           const struct lttng_rate_policy **policy)
 {
        enum lttng_action_status status;
        const struct lttng_action_rotate_session *rotate_session_action;
@@ -430,8 +423,7 @@ end:
 }
 
 static const struct lttng_rate_policy *
-lttng_action_rotate_session_internal_get_rate_policy(
-               const struct lttng_action *action)
+lttng_action_rotate_session_internal_get_rate_policy(const struct lttng_action *action)
 {
        const struct lttng_action_rotate_session *_action;
        _action = action_rotate_session_from_action_const(action);
index 6af260c93e35a3e7cb2659429cd0a6f0f849bf53..4456d2cd9e67edbf22479122db21498604a3a769 100644 (file)
@@ -11,7 +11,7 @@
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
 #include <common/snapshot.hpp>
-#include <inttypes.h>
+
 #include <lttng/action/action-internal.hpp>
 #include <lttng/action/rate-policy-internal.hpp>
 #include <lttng/action/rate-policy.h>
@@ -20,6 +20,8 @@
 #include <lttng/snapshot-internal.hpp>
 #include <lttng/snapshot.h>
 
+#include <inttypes.h>
+
 #define IS_SNAPSHOT_SESSION_ACTION(action) \
        (lttng_action_get_type(action) == LTTNG_ACTION_TYPE_SNAPSHOT_SESSION)
 
@@ -58,16 +60,14 @@ struct lttng_action_snapshot_session_comm {
 } /* namespace */
 
 static const struct lttng_rate_policy *
-lttng_action_snapshot_session_internal_get_rate_policy(
-               const struct lttng_action *action);
+lttng_action_snapshot_session_internal_get_rate_policy(const struct lttng_action *action);
 
 static struct lttng_action_snapshot_session *
 action_snapshot_session_from_action(struct lttng_action *action)
 {
        LTTNG_ASSERT(action);
 
-       return lttng::utils::container_of(
-                       action, &lttng_action_snapshot_session::parent);
+       return lttng::utils::container_of(action, &lttng_action_snapshot_session::parent);
 }
 
 static const struct lttng_action_snapshot_session *
@@ -75,8 +75,7 @@ action_snapshot_session_from_action_const(const struct lttng_action *action)
 {
        LTTNG_ASSERT(action);
 
-       return lttng::utils::container_of(
-                       action, &lttng_action_snapshot_session::parent);
+       return lttng::utils::container_of(action, &lttng_action_snapshot_session::parent);
 }
 
 static bool lttng_action_snapshot_session_validate(struct lttng_action *action)
@@ -92,12 +91,12 @@ static bool lttng_action_snapshot_session_validate(struct lttng_action *action)
 
        /* A non-empty session name is mandatory. */
        if (!action_snapshot_session->session_name ||
-                       strlen(action_snapshot_session->session_name) == 0) {
+           strlen(action_snapshot_session->session_name) == 0) {
                goto end;
        }
 
        if (action_snapshot_session->output &&
-                       !lttng_snapshot_output_validate(action_snapshot_session->output)) {
+           !lttng_snapshot_output_validate(action_snapshot_session->output)) {
                goto end;
        }
 
@@ -106,8 +105,8 @@ end:
        return valid;
 }
 
-static bool lttng_action_snapshot_session_is_equal(
-               const struct lttng_action *_a, const struct lttng_action *_b)
+static bool lttng_action_snapshot_session_is_equal(const struct lttng_action *_a,
+                                                  const struct lttng_action *_b)
 {
        bool is_equal = false;
        const struct lttng_action_snapshot_session *a, *b;
@@ -122,8 +121,7 @@ static bool lttng_action_snapshot_session_is_equal(
                goto end;
        }
 
-       if (a->output && b->output &&
-                       !lttng_snapshot_output_is_equal(a->output, b->output)) {
+       if (a->output && b->output && !lttng_snapshot_output_is_equal(a->output, b->output)) {
                goto end;
        } else if (!!a->output != !!b->output) {
                goto end;
@@ -139,8 +137,8 @@ static size_t serialize_strlen(const char *str)
        return str ? strlen(str) + 1 : 0;
 }
 
-static int lttng_action_snapshot_session_serialize(
-               struct lttng_action *action, struct lttng_payload *payload)
+static int lttng_action_snapshot_session_serialize(struct lttng_action *action,
+                                                  struct lttng_payload *payload)
 {
        struct lttng_action_snapshot_session *action_snapshot_session;
        struct lttng_action_snapshot_session_comm comm = {};
@@ -153,24 +151,21 @@ static int lttng_action_snapshot_session_serialize(
        size_before_comm = payload->buffer.size;
 
        action_snapshot_session = action_snapshot_session_from_action(action);
-       comm.session_name_len =
-               serialize_strlen(action_snapshot_session->session_name);
+       comm.session_name_len = serialize_strlen(action_snapshot_session->session_name);
 
        /* Add header. */
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &comm, sizeof(comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
        if (ret) {
                goto end;
        }
 
        LTTNG_ASSERT(action_snapshot_session->session_name);
        DBG("Serializing snapshot session action: session-name: %s",
-                       action_snapshot_session->session_name);
+           action_snapshot_session->session_name);
 
        /* Add session name. */
-       ret = lttng_dynamic_buffer_append(&payload->buffer,
-                       action_snapshot_session->session_name,
-                       comm.session_name_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, action_snapshot_session->session_name, comm.session_name_len);
        if (ret) {
                goto end;
        }
@@ -180,18 +175,15 @@ static int lttng_action_snapshot_session_serialize(
                const size_t size_before_output = payload->buffer.size;
                struct lttng_action_snapshot_session_comm *comm_in_payload;
 
-               ret = lttng_snapshot_output_serialize(
-                               action_snapshot_session->output,
-                               payload);
+               ret = lttng_snapshot_output_serialize(action_snapshot_session->output, payload);
                if (ret) {
                        goto end;
                }
 
-               comm_in_payload = (typeof(comm_in_payload))(
-                               payload->buffer.data + size_before_comm);
+               comm_in_payload =
+                       (typeof(comm_in_payload)) (payload->buffer.data + size_before_comm);
                /* Adjust action length in header. */
-               comm_in_payload->snapshot_output_len =
-                               payload->buffer.size - size_before_output;
+               comm_in_payload->snapshot_output_len = payload->buffer.size - size_before_output;
        }
 
        /* Serialize the rate policy. */
@@ -199,18 +191,16 @@ static int lttng_action_snapshot_session_serialize(
                const size_t size_before_output = payload->buffer.size;
                struct lttng_action_snapshot_session_comm *comm_in_payload;
 
-               ret = lttng_rate_policy_serialize(
-                               action_snapshot_session->policy, payload);
+               ret = lttng_rate_policy_serialize(action_snapshot_session->policy, payload);
                if (ret) {
                        ret = -1;
                        goto end;
                }
 
-               comm_in_payload = (typeof(comm_in_payload))(
-                               payload->buffer.data + size_before_comm);
+               comm_in_payload =
+                       (typeof(comm_in_payload)) (payload->buffer.data + size_before_comm);
                /* Adjust rate policy length in header. */
-               comm_in_payload->rate_policy_len =
-                               payload->buffer.size - size_before_output;
+               comm_in_payload->rate_policy_len = payload->buffer.size - size_before_output;
        }
 
 end:
@@ -236,9 +226,8 @@ end:
        return;
 }
 
-ssize_t lttng_action_snapshot_session_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_action **p_action)
+ssize_t lttng_action_snapshot_session_create_from_payload(struct lttng_payload_view *view,
+                                                         struct lttng_action **p_action)
 {
        ssize_t consumed_len;
        const char *variable_data;
@@ -248,8 +237,7 @@ ssize_t lttng_action_snapshot_session_create_from_payload(
        struct lttng_rate_policy *policy = NULL;
        const struct lttng_action_snapshot_session_comm *comm;
        const struct lttng_payload_view snapshot_session_comm_view =
-                       lttng_payload_view_from_view(
-                               view, 0, sizeof(*comm));
+               lttng_payload_view_from_view(view, 0, sizeof(*comm));
 
        action = lttng_action_snapshot_session_create();
        if (!action) {
@@ -267,12 +255,11 @@ ssize_t lttng_action_snapshot_session_create_from_payload(
        consumed_len = sizeof(struct lttng_action_snapshot_session_comm);
 
        if (!lttng_buffer_view_contains_string(
-                       &view->buffer, variable_data, comm->session_name_len)) {
+                   &view->buffer, variable_data, comm->session_name_len)) {
                goto error;
        }
 
-       status = lttng_action_snapshot_session_set_session_name(
-                       action, variable_data);
+       status = lttng_action_snapshot_session_set_session_name(action, variable_data);
        if (status != LTTNG_ACTION_STATUS_OK) {
                goto error;
        }
@@ -285,28 +272,24 @@ ssize_t lttng_action_snapshot_session_create_from_payload(
                ssize_t snapshot_output_consumed_len;
                enum lttng_action_status action_status;
                struct lttng_payload_view snapshot_output_buffer_view =
-                       lttng_payload_view_from_view(view, consumed_len,
-                               comm->snapshot_output_len);
+                       lttng_payload_view_from_view(view, consumed_len, comm->snapshot_output_len);
 
                if (!lttng_payload_view_is_valid(&snapshot_output_buffer_view)) {
                        ERR("Failed to create buffer view for snapshot output.");
                        goto error;
                }
 
-               snapshot_output_consumed_len =
-                               lttng_snapshot_output_create_from_payload(
-                                               &snapshot_output_buffer_view,
-                                               &snapshot_output);
+               snapshot_output_consumed_len = lttng_snapshot_output_create_from_payload(
+                       &snapshot_output_buffer_view, &snapshot_output);
                if (snapshot_output_consumed_len != comm->snapshot_output_len) {
                        ERR("Failed to deserialize snapshot output object: "
-                                       "consumed-len: %zd, expected-len: %" PRIu32,
-                                       snapshot_output_consumed_len,
-                                       comm->snapshot_output_len);
+                           "consumed-len: %zd, expected-len: %" PRIu32,
+                           snapshot_output_consumed_len,
+                           comm->snapshot_output_len);
                        goto error;
                }
 
-               action_status = lttng_action_snapshot_session_set_output(
-                       action, snapshot_output);
+               action_status = lttng_action_snapshot_session_set_output(action, snapshot_output);
                if (action_status != LTTNG_ACTION_STATUS_OK) {
                        goto error;
                }
@@ -326,8 +309,7 @@ ssize_t lttng_action_snapshot_session_create_from_payload(
        {
                ssize_t rate_policy_consumed_len;
                struct lttng_payload_view policy_view =
-                               lttng_payload_view_from_view(view, consumed_len,
-                                               comm->rate_policy_len);
+                       lttng_payload_view_from_view(view, consumed_len, comm->rate_policy_len);
 
                if (!lttng_payload_view_is_valid(&policy_view)) {
                        ERR("Failed to create buffer view for rate policy.");
@@ -335,8 +317,7 @@ ssize_t lttng_action_snapshot_session_create_from_payload(
                }
 
                rate_policy_consumed_len =
-                               lttng_rate_policy_create_from_payload(
-                                               &policy_view, &policy);
+                       lttng_rate_policy_create_from_payload(&policy_view, &policy);
                if (rate_policy_consumed_len < 0) {
                        goto error;
                }
@@ -344,13 +325,12 @@ ssize_t lttng_action_snapshot_session_create_from_payload(
                if (rate_policy_consumed_len != comm->rate_policy_len) {
                        ERR("Failed to deserialize rate policy object: "
                            "consumed-len: %zd, expected-len: %" PRIu32,
-                                       rate_policy_consumed_len,
-                                       comm->rate_policy_len);
+                           rate_policy_consumed_len,
+                           comm->rate_policy_len);
                        goto error;
                }
 
-               status = lttng_action_snapshot_session_set_rate_policy(
-                               action, policy);
+               status = lttng_action_snapshot_session_set_rate_policy(action, policy);
                if (status != LTTNG_ACTION_STATUS_OK) {
                        goto error;
                }
@@ -375,8 +355,9 @@ end:
        return consumed_len;
 }
 
-static enum lttng_error_code lttng_action_snapshot_session_mi_serialize(
-               const struct lttng_action *action, struct mi_writer *writer)
+static enum lttng_error_code
+lttng_action_snapshot_session_mi_serialize(const struct lttng_action *action,
+                                          struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -388,8 +369,7 @@ static enum lttng_error_code lttng_action_snapshot_session_mi_serialize(
        LTTNG_ASSERT(action);
        LTTNG_ASSERT(IS_SNAPSHOT_SESSION_ACTION(action));
 
-       status = lttng_action_snapshot_session_get_session_name(
-                       action, &session_name);
+       status = lttng_action_snapshot_session_get_session_name(action, &session_name);
        LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
        LTTNG_ASSERT(session_name != NULL);
 
@@ -398,15 +378,14 @@ static enum lttng_error_code lttng_action_snapshot_session_mi_serialize(
        LTTNG_ASSERT(policy != NULL);
 
        /* Open action snapshot session element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_action_snapshot_session);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_action_snapshot_session);
        if (ret) {
                goto mi_error;
        }
 
        /* Session name. */
        ret = mi_lttng_writer_write_element_string(
-                       writer, mi_lttng_element_session_name, session_name);
+               writer, mi_lttng_element_session_name, session_name);
        if (ret) {
                goto mi_error;
        }
@@ -463,17 +442,16 @@ struct lttng_action *lttng_action_snapshot_session_create(void)
        }
 
        lttng_action_init(&action_snapshot->parent,
-                       LTTNG_ACTION_TYPE_SNAPSHOT_SESSION,
-                       lttng_action_snapshot_session_validate,
-                       lttng_action_snapshot_session_serialize,
-                       lttng_action_snapshot_session_is_equal,
-                       lttng_action_snapshot_session_destroy,
-                       lttng_action_snapshot_session_internal_get_rate_policy,
-                       lttng_action_generic_add_error_query_results,
-                       lttng_action_snapshot_session_mi_serialize);
-
-       status = lttng_action_snapshot_session_set_rate_policy(
-                       &action_snapshot->parent, policy);
+                         LTTNG_ACTION_TYPE_SNAPSHOT_SESSION,
+                         lttng_action_snapshot_session_validate,
+                         lttng_action_snapshot_session_serialize,
+                         lttng_action_snapshot_session_is_equal,
+                         lttng_action_snapshot_session_destroy,
+                         lttng_action_snapshot_session_internal_get_rate_policy,
+                         lttng_action_generic_add_error_query_results,
+                         lttng_action_snapshot_session_mi_serialize);
+
+       status = lttng_action_snapshot_session_set_rate_policy(&action_snapshot->parent, policy);
        if (status != LTTNG_ACTION_STATUS_OK) {
                lttng_action_destroy(&action_snapshot->parent);
                action_snapshot = NULL;
@@ -485,14 +463,14 @@ end:
        return action_snapshot ? &action_snapshot->parent : nullptr;
 }
 
-enum lttng_action_status lttng_action_snapshot_session_set_session_name(
-               struct lttng_action *action, const char *session_name)
+enum lttng_action_status lttng_action_snapshot_session_set_session_name(struct lttng_action *action,
+                                                                       const char *session_name)
 {
        struct lttng_action_snapshot_session *action_snapshot_session;
        enum lttng_action_status status;
 
        if (!action || !IS_SNAPSHOT_SESSION_ACTION(action) || !session_name ||
-                       strlen(session_name) == 0) {
+           strlen(session_name) == 0) {
                status = LTTNG_ACTION_STATUS_INVALID;
                goto end;
        }
@@ -512,8 +490,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_snapshot_session_get_session_name(
-               const struct lttng_action *action, const char **session_name)
+enum lttng_action_status
+lttng_action_snapshot_session_get_session_name(const struct lttng_action *action,
+                                              const char **session_name)
 {
        const struct lttng_action_snapshot_session *action_snapshot_session;
        enum lttng_action_status status;
@@ -537,9 +516,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_snapshot_session_set_output(
-               struct lttng_action *action,
-               struct lttng_snapshot_output *output)
+enum lttng_action_status
+lttng_action_snapshot_session_set_output(struct lttng_action *action,
+                                        struct lttng_snapshot_output *output)
 {
        struct lttng_action_snapshot_session *action_snapshot_session;
        enum lttng_action_status status;
@@ -560,14 +539,14 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_snapshot_session_get_output(
-               const struct lttng_action *action,
-               const struct lttng_snapshot_output **output)
+enum lttng_action_status
+lttng_action_snapshot_session_get_output(const struct lttng_action *action,
+                                        const struct lttng_snapshot_output **output)
 {
        const struct lttng_action_snapshot_session *action_snapshot_session;
        enum lttng_action_status status;
 
-       if (!action || !IS_SNAPSHOT_SESSION_ACTION(action)|| !output) {
+       if (!action || !IS_SNAPSHOT_SESSION_ACTION(action) || !output) {
                status = LTTNG_ACTION_STATUS_INVALID;
                goto end;
        }
@@ -585,9 +564,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_snapshot_session_set_rate_policy(
-               struct lttng_action *action,
-               const struct lttng_rate_policy *policy)
+enum lttng_action_status
+lttng_action_snapshot_session_set_rate_policy(struct lttng_action *action,
+                                             const struct lttng_rate_policy *policy)
 {
        enum lttng_action_status status;
        struct lttng_action_snapshot_session *snapshot_session_action;
@@ -619,9 +598,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_snapshot_session_get_rate_policy(
-               const struct lttng_action *action,
-               const struct lttng_rate_policy **policy)
+enum lttng_action_status
+lttng_action_snapshot_session_get_rate_policy(const struct lttng_action *action,
+                                             const struct lttng_rate_policy **policy)
 {
        enum lttng_action_status status;
        const struct lttng_action_snapshot_session *snapshot_session_action;
@@ -631,8 +610,7 @@ enum lttng_action_status lttng_action_snapshot_session_get_rate_policy(
                goto end;
        }
 
-       snapshot_session_action =
-                       action_snapshot_session_from_action_const(action);
+       snapshot_session_action = action_snapshot_session_from_action_const(action);
 
        *policy = snapshot_session_action->policy;
        status = LTTNG_ACTION_STATUS_OK;
@@ -641,8 +619,7 @@ end:
 }
 
 static const struct lttng_rate_policy *
-lttng_action_snapshot_session_internal_get_rate_policy(
-               const struct lttng_action *action)
+lttng_action_snapshot_session_internal_get_rate_policy(const struct lttng_action *action)
 {
        const struct lttng_action_snapshot_session *_action;
        _action = action_snapshot_session_from_action_const(action);
index 2c9f799727e43ad454ab32610c16fe14000b68a6..9438b39ed6085e29c2cc3e6d08a521ca9334c3b7 100644 (file)
@@ -8,6 +8,7 @@
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/mi-lttng.hpp>
+
 #include <lttng/action/action-internal.hpp>
 #include <lttng/action/rate-policy-internal.hpp>
 #include <lttng/action/rate-policy.h>
@@ -41,11 +42,10 @@ struct lttng_action_start_session_comm {
 } /* namespace */
 
 static const struct lttng_rate_policy *
-lttng_action_start_session_internal_get_rate_policy(
-               const struct lttng_action *action);
+lttng_action_start_session_internal_get_rate_policy(const struct lttng_action *action);
 
-static struct lttng_action_start_session *action_start_session_from_action(
-               struct lttng_action *action)
+static struct lttng_action_start_session *
+action_start_session_from_action(struct lttng_action *action)
 {
        LTTNG_ASSERT(action);
 
@@ -74,7 +74,7 @@ static bool lttng_action_start_session_validate(struct lttng_action *action)
 
        /* A non-empty session name is mandatory. */
        if (!action_start_session->session_name ||
-                       strlen(action_start_session->session_name) == 0) {
+           strlen(action_start_session->session_name) == 0) {
                valid = false;
                goto end;
        }
@@ -84,8 +84,8 @@ end:
        return valid;
 }
 
-static bool lttng_action_start_session_is_equal(
-               const struct lttng_action *_a, const struct lttng_action *_b)
+static bool lttng_action_start_session_is_equal(const struct lttng_action *_a,
+                                               const struct lttng_action *_b)
 {
        bool is_equal = false;
        struct lttng_action_start_session *a, *b;
@@ -105,8 +105,8 @@ end:
        return is_equal;
 }
 
-static int lttng_action_start_session_serialize(
-               struct lttng_action *action, struct lttng_payload *payload)
+static int lttng_action_start_session_serialize(struct lttng_action *action,
+                                               struct lttng_payload *payload)
 {
        struct lttng_action_start_session *action_start_session;
        struct lttng_action_start_session_comm comm;
@@ -121,7 +121,7 @@ static int lttng_action_start_session_serialize(
        LTTNG_ASSERT(action_start_session->session_name);
 
        DBG("Serializing start session action: session-name: %s",
-                       action_start_session->session_name);
+           action_start_session->session_name);
 
        session_name_len = strlen(action_start_session->session_name) + 1;
        comm.session_name_len = session_name_len;
@@ -132,15 +132,14 @@ static int lttng_action_start_session_serialize(
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer,
-                       action_start_session->session_name, session_name_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, action_start_session->session_name, session_name_len);
        if (ret) {
                ret = -1;
                goto end;
        }
 
-       ret = lttng_rate_policy_serialize(
-                       action_start_session->policy, payload);
+       ret = lttng_rate_policy_serialize(action_start_session->policy, payload);
        if (ret) {
                ret = -1;
                goto end;
@@ -169,9 +168,8 @@ end:
        return;
 }
 
-ssize_t lttng_action_start_session_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_action **p_action)
+ssize_t lttng_action_start_session_create_from_payload(struct lttng_payload_view *view,
+                                                      struct lttng_action **p_action)
 {
        ssize_t consumed_len, ret;
        const struct lttng_action_start_session_comm *comm;
@@ -184,8 +182,8 @@ ssize_t lttng_action_start_session_create_from_payload(
        session_name = (const char *) &comm->data;
 
        /* Session name */
-       if (!lttng_buffer_view_contains_string(&view->buffer, session_name,
-                           comm->session_name_len)) {
+       if (!lttng_buffer_view_contains_string(
+                   &view->buffer, session_name, comm->session_name_len)) {
                consumed_len = -1;
                goto end;
        }
@@ -194,10 +192,8 @@ ssize_t lttng_action_start_session_create_from_payload(
        /* Rate policy. */
        {
                struct lttng_payload_view policy_view =
-                               lttng_payload_view_from_view(
-                                               view, consumed_len, -1);
-               ret = lttng_rate_policy_create_from_payload(
-                               &policy_view, &policy);
+                       lttng_payload_view_from_view(view, consumed_len, -1);
+               ret = lttng_rate_policy_create_from_payload(&policy_view, &policy);
                if (ret < 0) {
                        consumed_len = -1;
                        goto end;
@@ -211,8 +207,7 @@ ssize_t lttng_action_start_session_create_from_payload(
                goto end;
        }
 
-       status = lttng_action_start_session_set_session_name(
-                       action, session_name);
+       status = lttng_action_start_session_set_session_name(action, session_name);
        if (status != LTTNG_ACTION_STATUS_OK) {
                consumed_len = -1;
                goto end;
@@ -235,8 +230,8 @@ end:
        return consumed_len;
 }
 
-static enum lttng_error_code lttng_action_start_session_mi_serialize(
-               const struct lttng_action *action, struct mi_writer *writer)
+static enum lttng_error_code
+lttng_action_start_session_mi_serialize(const struct lttng_action *action, struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -247,8 +242,7 @@ static enum lttng_error_code lttng_action_start_session_mi_serialize(
        LTTNG_ASSERT(action);
        LTTNG_ASSERT(IS_START_SESSION_ACTION(action));
 
-       status = lttng_action_start_session_get_session_name(
-                       action, &session_name);
+       status = lttng_action_start_session_get_session_name(action, &session_name);
        LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
        LTTNG_ASSERT(session_name != NULL);
 
@@ -257,15 +251,14 @@ static enum lttng_error_code lttng_action_start_session_mi_serialize(
        LTTNG_ASSERT(policy != NULL);
 
        /* Open action start session element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_action_start_session);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_action_start_session);
        if (ret) {
                goto mi_error;
        }
 
        /* Session name. */
        ret = mi_lttng_writer_write_element_string(
-                       writer, mi_lttng_element_session_name, session_name);
+               writer, mi_lttng_element_session_name, session_name);
        if (ret) {
                goto mi_error;
        }
@@ -309,17 +302,16 @@ struct lttng_action *lttng_action_start_session_create(void)
        }
 
        lttng_action_init(&action_start->parent,
-                       LTTNG_ACTION_TYPE_START_SESSION,
-                       lttng_action_start_session_validate,
-                       lttng_action_start_session_serialize,
-                       lttng_action_start_session_is_equal,
-                       lttng_action_start_session_destroy,
-                       lttng_action_start_session_internal_get_rate_policy,
-                       lttng_action_generic_add_error_query_results,
-                       lttng_action_start_session_mi_serialize);
-
-       status = lttng_action_start_session_set_rate_policy(
-                       &action_start->parent, policy);
+                         LTTNG_ACTION_TYPE_START_SESSION,
+                         lttng_action_start_session_validate,
+                         lttng_action_start_session_serialize,
+                         lttng_action_start_session_is_equal,
+                         lttng_action_start_session_destroy,
+                         lttng_action_start_session_internal_get_rate_policy,
+                         lttng_action_generic_add_error_query_results,
+                         lttng_action_start_session_mi_serialize);
+
+       status = lttng_action_start_session_set_rate_policy(&action_start->parent, policy);
        if (status != LTTNG_ACTION_STATUS_OK) {
                lttng_action_destroy(&action_start->parent);
                action_start = NULL;
@@ -331,14 +323,14 @@ end:
        return &action_start->parent;
 }
 
-enum lttng_action_status lttng_action_start_session_set_session_name(
-               struct lttng_action *action, const char *session_name)
+enum lttng_action_status lttng_action_start_session_set_session_name(struct lttng_action *action,
+                                                                    const char *session_name)
 {
        struct lttng_action_start_session *action_start_session;
        enum lttng_action_status status;
 
        if (!action || !IS_START_SESSION_ACTION(action) || !session_name ||
-                       strlen(session_name) == 0) {
+           strlen(session_name) == 0) {
                status = LTTNG_ACTION_STATUS_INVALID;
                goto end;
        }
@@ -358,8 +350,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_start_session_get_session_name(
-               const struct lttng_action *action, const char **session_name)
+enum lttng_action_status
+lttng_action_start_session_get_session_name(const struct lttng_action *action,
+                                           const char **session_name)
 {
        const struct lttng_action_start_session *action_start_session;
        enum lttng_action_status status;
@@ -378,9 +371,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_start_session_set_rate_policy(
-               struct lttng_action *action,
-               const struct lttng_rate_policy *policy)
+enum lttng_action_status
+lttng_action_start_session_set_rate_policy(struct lttng_action *action,
+                                          const struct lttng_rate_policy *policy)
 {
        enum lttng_action_status status;
        struct lttng_action_start_session *start_session_action;
@@ -412,9 +405,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_start_session_get_rate_policy(
-               const struct lttng_action *action,
-               const struct lttng_rate_policy **policy)
+enum lttng_action_status
+lttng_action_start_session_get_rate_policy(const struct lttng_action *action,
+                                          const struct lttng_rate_policy **policy)
 {
        enum lttng_action_status status;
        const struct lttng_action_start_session *start_session_action;
@@ -433,8 +426,7 @@ end:
 }
 
 static const struct lttng_rate_policy *
-lttng_action_start_session_internal_get_rate_policy(
-               const struct lttng_action *action)
+lttng_action_start_session_internal_get_rate_policy(const struct lttng_action *action)
 {
        const struct lttng_action_start_session *_action;
        _action = action_start_session_from_action_const(action);
index 08a6665dd0c196b63dbe3ee255f8037cf872027c..1a01f39255d927616ca8f66301f6e35af9c5f14e 100644 (file)
@@ -8,6 +8,7 @@
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/mi-lttng.hpp>
+
 #include <lttng/action/action-internal.hpp>
 #include <lttng/action/rate-policy-internal.hpp>
 #include <lttng/action/rate-policy.h>
@@ -41,11 +42,10 @@ struct lttng_action_stop_session_comm {
 } /* namespace */
 
 static const struct lttng_rate_policy *
-lttng_action_stop_session_internal_get_rate_policy(
-               const struct lttng_action *action);
+lttng_action_stop_session_internal_get_rate_policy(const struct lttng_action *action);
 
-static struct lttng_action_stop_session *action_stop_session_from_action(
-               struct lttng_action *action)
+static struct lttng_action_stop_session *
+action_stop_session_from_action(struct lttng_action *action)
 {
        LTTNG_ASSERT(action);
 
@@ -73,8 +73,7 @@ static bool lttng_action_stop_session_validate(struct lttng_action *action)
        action_stop_session = action_stop_session_from_action(action);
 
        /* A non-empty session name is mandatory. */
-       if (!action_stop_session->session_name ||
-                       strlen(action_stop_session->session_name) == 0) {
+       if (!action_stop_session->session_name || strlen(action_stop_session->session_name) == 0) {
                valid = false;
                goto end;
        }
@@ -84,8 +83,8 @@ end:
        return valid;
 }
 
-static bool lttng_action_stop_session_is_equal(
-               const struct lttng_action *_a, const struct lttng_action *_b)
+static bool lttng_action_stop_session_is_equal(const struct lttng_action *_a,
+                                              const struct lttng_action *_b)
 {
        bool is_equal = false;
        const struct lttng_action_stop_session *a, *b;
@@ -105,8 +104,8 @@ end:
        return is_equal;
 }
 
-static int lttng_action_stop_session_serialize(
-               struct lttng_action *action, struct lttng_payload *payload)
+static int lttng_action_stop_session_serialize(struct lttng_action *action,
+                                              struct lttng_payload *payload)
 {
        struct lttng_action_stop_session *action_stop_session;
        struct lttng_action_stop_session_comm comm;
@@ -120,21 +119,19 @@ static int lttng_action_stop_session_serialize(
 
        LTTNG_ASSERT(action_stop_session->session_name);
 
-       DBG("Serializing stop session action: session-name: %s",
-                       action_stop_session->session_name);
+       DBG("Serializing stop session action: session-name: %s", action_stop_session->session_name);
 
        session_name_len = strlen(action_stop_session->session_name) + 1;
        comm.session_name_len = session_name_len;
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &comm, sizeof(comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
        if (ret) {
                ret = -1;
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer,
-                       action_stop_session->session_name, session_name_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, action_stop_session->session_name, session_name_len);
        if (ret) {
                ret = -1;
                goto end;
@@ -169,9 +166,8 @@ end:
        return;
 }
 
-ssize_t lttng_action_stop_session_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_action **p_action)
+ssize_t lttng_action_stop_session_create_from_payload(struct lttng_payload_view *view,
+                                                     struct lttng_action **p_action)
 {
        ssize_t consumed_len, ret;
        const struct lttng_action_stop_session_comm *comm;
@@ -185,7 +181,7 @@ ssize_t lttng_action_stop_session_create_from_payload(
 
        /* Session name. */
        if (!lttng_buffer_view_contains_string(
-                       &view->buffer, session_name, comm->session_name_len)) {
+                   &view->buffer, session_name, comm->session_name_len)) {
                consumed_len = -1;
                goto end;
        }
@@ -194,10 +190,8 @@ ssize_t lttng_action_stop_session_create_from_payload(
        /* Rate policy. */
        {
                struct lttng_payload_view policy_view =
-                               lttng_payload_view_from_view(
-                                               view, consumed_len, -1);
-               ret = lttng_rate_policy_create_from_payload(
-                               &policy_view, &policy);
+                       lttng_payload_view_from_view(view, consumed_len, -1);
+               ret = lttng_rate_policy_create_from_payload(&policy_view, &policy);
                if (ret < 0) {
                        consumed_len = -1;
                        goto end;
@@ -211,8 +205,7 @@ ssize_t lttng_action_stop_session_create_from_payload(
                goto end;
        }
 
-       status = lttng_action_stop_session_set_session_name(
-                       action, session_name);
+       status = lttng_action_stop_session_set_session_name(action, session_name);
        if (status != LTTNG_ACTION_STATUS_OK) {
                consumed_len = -1;
                goto end;
@@ -235,8 +228,8 @@ end:
        return consumed_len;
 }
 
-static enum lttng_error_code lttng_action_stop_session_mi_serialize(
-               const struct lttng_action *action, struct mi_writer *writer)
+static enum lttng_error_code
+lttng_action_stop_session_mi_serialize(const struct lttng_action *action, struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -247,8 +240,7 @@ static enum lttng_error_code lttng_action_stop_session_mi_serialize(
        LTTNG_ASSERT(action);
        LTTNG_ASSERT(IS_STOP_SESSION_ACTION(action));
 
-       status = lttng_action_stop_session_get_session_name(
-                       action, &session_name);
+       status = lttng_action_stop_session_get_session_name(action, &session_name);
        LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
        LTTNG_ASSERT(session_name != NULL);
 
@@ -257,15 +249,14 @@ static enum lttng_error_code lttng_action_stop_session_mi_serialize(
        LTTNG_ASSERT(policy != NULL);
 
        /* Open action stop session. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_action_start_session);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_action_start_session);
        if (ret) {
                goto mi_error;
        }
 
        /* Session name. */
        ret = mi_lttng_writer_write_element_string(
-                       writer, mi_lttng_element_session_name, session_name);
+               writer, mi_lttng_element_session_name, session_name);
        if (ret) {
                goto mi_error;
        }
@@ -308,17 +299,17 @@ struct lttng_action *lttng_action_stop_session_create(void)
                goto end;
        }
 
-       lttng_action_init(&action_stop->parent, LTTNG_ACTION_TYPE_STOP_SESSION,
-                       lttng_action_stop_session_validate,
-                       lttng_action_stop_session_serialize,
-                       lttng_action_stop_session_is_equal,
-                       lttng_action_stop_session_destroy,
-                       lttng_action_stop_session_internal_get_rate_policy,
-                       lttng_action_generic_add_error_query_results,
-                       lttng_action_stop_session_mi_serialize);
-
-       status = lttng_action_stop_session_set_rate_policy(
-                       &action_stop->parent, policy);
+       lttng_action_init(&action_stop->parent,
+                         LTTNG_ACTION_TYPE_STOP_SESSION,
+                         lttng_action_stop_session_validate,
+                         lttng_action_stop_session_serialize,
+                         lttng_action_stop_session_is_equal,
+                         lttng_action_stop_session_destroy,
+                         lttng_action_stop_session_internal_get_rate_policy,
+                         lttng_action_generic_add_error_query_results,
+                         lttng_action_stop_session_mi_serialize);
+
+       status = lttng_action_stop_session_set_rate_policy(&action_stop->parent, policy);
        if (status != LTTNG_ACTION_STATUS_OK) {
                lttng_action_destroy(&action_stop->parent);
                action_stop = NULL;
@@ -330,14 +321,14 @@ end:
        return &action_stop->parent;
 }
 
-enum lttng_action_status lttng_action_stop_session_set_session_name(
-               struct lttng_action *action, const char *session_name)
+enum lttng_action_status lttng_action_stop_session_set_session_name(struct lttng_action *action,
+                                                                   const char *session_name)
 {
        struct lttng_action_stop_session *action_stop_session;
        enum lttng_action_status status;
 
        if (!action || !IS_STOP_SESSION_ACTION(action) || !session_name ||
-                       strlen(session_name) == 0) {
+           strlen(session_name) == 0) {
                status = LTTNG_ACTION_STATUS_INVALID;
                goto end;
        }
@@ -357,8 +348,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_stop_session_get_session_name(
-               const struct lttng_action *action, const char **session_name)
+enum lttng_action_status
+lttng_action_stop_session_get_session_name(const struct lttng_action *action,
+                                          const char **session_name)
 {
        const struct lttng_action_stop_session *action_stop_session;
        enum lttng_action_status status;
@@ -377,9 +369,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_stop_session_set_rate_policy(
-               struct lttng_action *action,
-               const struct lttng_rate_policy *policy)
+enum lttng_action_status
+lttng_action_stop_session_set_rate_policy(struct lttng_action *action,
+                                         const struct lttng_rate_policy *policy)
 {
        enum lttng_action_status status;
        struct lttng_action_stop_session *stop_session_action;
@@ -409,9 +401,9 @@ end:
        return status;
 }
 
-enum lttng_action_status lttng_action_stop_session_get_rate_policy(
-               const struct lttng_action *action,
-               const struct lttng_rate_policy **policy)
+enum lttng_action_status
+lttng_action_stop_session_get_rate_policy(const struct lttng_action *action,
+                                         const struct lttng_rate_policy **policy)
 {
        enum lttng_action_status status;
        const struct lttng_action_stop_session *stop_session_action;
@@ -430,8 +422,7 @@ end:
 }
 
 static const struct lttng_rate_policy *
-lttng_action_stop_session_internal_get_rate_policy(
-               const struct lttng_action *action)
+lttng_action_stop_session_internal_get_rate_policy(const struct lttng_action *action)
 {
        const struct lttng_action_stop_session *_action;
        _action = action_stop_session_from_action_const(action);
index 0beff92adfc7598bb02cc2389a406e517a84ae52..c244f402944be0f99747f045dac9ef19f1dd63b8 100644 (file)
@@ -7,11 +7,11 @@
 
 #include "argpar-utils.hpp"
 
-#include <stdio.h>
-
 #include <common/error.hpp>
 #include <common/string-utils/string-utils.hpp>
 
+#include <stdio.h>
+
 /*
  * Given argpar error status `status` and error `error`, return a formatted
  * error message describing the error.
  *
  * The returned string must be freed by the caller.
  */
-static ATTR_FORMAT_PRINTF(4, 0)
-char *format_arg_error_v(const struct argpar_error *error, int argc_offset,
-               const char **argv, const char *context_fmt, va_list args)
+static ATTR_FORMAT_PRINTF(4, 0) char *format_arg_error_v(const struct argpar_error *error,
+                                                        int argc_offset,
+                                                        const char **argv,
+                                                        const char *context_fmt,
+                                                        va_list args)
 {
        char *str = NULL;
        char *str_ret = NULL;
@@ -50,16 +52,18 @@ char *format_arg_error_v(const struct argpar_error *error, int argc_offset,
                }
        }
 
-       switch (argpar_error_type(error))
-       {
+       switch (argpar_error_type(error)) {
        case ARGPAR_ERROR_TYPE_MISSING_OPT_ARG:
        {
                const int orig_index = argpar_error_orig_index(error);
                const char *arg = argv[orig_index];
 
                ret = strutils_appendf(&str,
-                       WHILE_PARSING_ARG_N_ARG_FMT "Missing required argument for option `%s`",
-                       orig_index + 1 + argc_offset, argv[orig_index], arg);
+                                      WHILE_PARSING_ARG_N_ARG_FMT
+                                      "Missing required argument for option `%s`",
+                                      orig_index + 1 + argc_offset,
+                                      argv[orig_index],
+                                      arg);
                if (ret < 0) {
                        goto end;
                }
@@ -69,19 +73,24 @@ char *format_arg_error_v(const struct argpar_error *error, int argc_offset,
        case ARGPAR_ERROR_TYPE_UNEXPECTED_OPT_ARG:
        {
                bool is_short;
-               const struct argpar_opt_descr *descr =
-                       argpar_error_opt_descr(error, &is_short);
+               const struct argpar_opt_descr *descr = argpar_error_opt_descr(error, &is_short);
                int orig_index = argpar_error_orig_index(error);
                const char *arg = argv[orig_index];
 
                if (is_short) {
                        ret = strutils_appendf(&str,
-                               WHILE_PARSING_ARG_N_ARG_FMT "Unexpected argument for option `-%c`",
-                               orig_index + 1 + argc_offset, arg, descr->short_name);
+                                              WHILE_PARSING_ARG_N_ARG_FMT
+                                              "Unexpected argument for option `-%c`",
+                                              orig_index + 1 + argc_offset,
+                                              arg,
+                                              descr->short_name);
                } else {
                        ret = strutils_appendf(&str,
-                               WHILE_PARSING_ARG_N_ARG_FMT "Unexpected argument for option `--%s`",
-                               orig_index + 1 + argc_offset, arg, descr->long_name);
+                                              WHILE_PARSING_ARG_N_ARG_FMT
+                                              "Unexpected argument for option `--%s`",
+                                              orig_index + 1 + argc_offset,
+                                              arg,
+                                              descr->long_name);
                }
 
                if (ret < 0) {
@@ -96,8 +105,10 @@ char *format_arg_error_v(const struct argpar_error *error, int argc_offset,
                const char *unknown_opt = argpar_error_unknown_opt_name(error);
 
                ret = strutils_appendf(&str,
-                       WHILE_PARSING_ARG_N_ARG_FMT "Unknown option `%s`",
-                       orig_index + 1 + argc_offset, argv[orig_index], unknown_opt);
+                                      WHILE_PARSING_ARG_N_ARG_FMT "Unknown option `%s`",
+                                      orig_index + 1 + argc_offset,
+                                      argv[orig_index],
+                                      unknown_opt);
 
                if (ret < 0) {
                        goto end;
@@ -106,7 +117,7 @@ char *format_arg_error_v(const struct argpar_error *error, int argc_offset,
                break;
        }
        default:
-               abort ();
+               abort();
        }
 
        str_ret = str;
@@ -118,10 +129,13 @@ end:
 }
 
 enum parse_next_item_status parse_next_item(struct argpar_iter *iter,
-               const struct argpar_item **item, int argc_offset,
-               const char **argv, bool unknown_opt_is_error,
-               const struct argpar_error **error_out,
-               const char *context_fmt, ...)
+                                           const struct argpar_item **item,
+                                           int argc_offset,
+                                           const char **argv,
+                                           bool unknown_opt_is_error,
+                                           const struct argpar_error **error_out,
+                                           const char *context_fmt,
+                                           ...)
 {
        enum argpar_iter_next_status status;
        const struct argpar_error *error = NULL;
@@ -141,14 +155,13 @@ enum parse_next_item_status parse_next_item(struct argpar_iter *iter,
                char *err_str;
 
                if (argpar_error_type(error) == ARGPAR_ERROR_TYPE_UNKNOWN_OPT &&
-                               !unknown_opt_is_error) {
+                   !unknown_opt_is_error) {
                        ret = PARSE_NEXT_ITEM_STATUS_END;
                        break;
                }
 
                va_start(args, context_fmt);
-               err_str = format_arg_error_v(error, argc_offset, argv,
-                       context_fmt, args);
+               err_str = format_arg_error_v(error, argc_offset, argv, context_fmt, args);
                va_end(args);
 
                if (err_str) {
index 9498423cae64efb38d1b5e55fbccd1db879bdd82..bb5d9ea340ef47e5fe9214b4690a40a68c61ae1a 100644 (file)
@@ -9,8 +9,7 @@
 #include <common/dynamic-buffer.hpp>
 #include <common/error.hpp>
 
-struct lttng_buffer_view lttng_buffer_view_init(
-               const char *src, size_t offset, ptrdiff_t len)
+struct lttng_buffer_view lttng_buffer_view_init(const char *src, size_t offset, ptrdiff_t len)
 {
        struct lttng_buffer_view view = { .data = src + offset, .size = (size_t) len };
        return view;
@@ -21,9 +20,8 @@ bool lttng_buffer_view_is_valid(const struct lttng_buffer_view *view)
        return view && view->data && view->size > 0;
 }
 
-struct lttng_buffer_view lttng_buffer_view_from_view(
-               const struct lttng_buffer_view *src, size_t offset,
-               ptrdiff_t len)
+struct lttng_buffer_view
+lttng_buffer_view_from_view(const struct lttng_buffer_view *src, size_t offset, ptrdiff_t len)
 {
        struct lttng_buffer_view view = { .data = NULL, .size = 0 };
 
@@ -31,13 +29,17 @@ struct lttng_buffer_view lttng_buffer_view_from_view(
 
        if (offset > src->size) {
                ERR("Attempt to create buffer view from another view with invalid offset (offset > source size): source size = %zu, offset in source = %zu, length = %zd",
-                               src->size, offset, len);
+                   src->size,
+                   offset,
+                   len);
                goto end;
        }
 
        if (len != -1 && len > (src->size - offset)) {
                ERR("Attempt to create buffer view from another view with invalid length (length > space left after offset in source): source size = %zu, offset in source = %zu, length = %zd",
-                               src->size, offset, len);
+                   src->size,
+                   offset,
+                   len);
                goto end;
        }
 
@@ -48,8 +50,7 @@ end:
 }
 
 struct lttng_buffer_view lttng_buffer_view_from_dynamic_buffer(
-               const struct lttng_dynamic_buffer *src, size_t offset,
-               ptrdiff_t len)
+       const struct lttng_dynamic_buffer *src, size_t offset, ptrdiff_t len)
 {
        struct lttng_buffer_view view = { .data = NULL, .size = 0 };
 
@@ -57,13 +58,17 @@ struct lttng_buffer_view lttng_buffer_view_from_dynamic_buffer(
 
        if (offset > src->size) {
                ERR("Attempt to create buffer view from a dynamic buffer with invalid offset (offset > source size): source size = %zu, offset in source = %zu, length = %zd",
-                               src->size, offset, len);
+                   src->size,
+                   offset,
+                   len);
                goto end;
        }
 
        if (len != -1 && len > (src->size - offset)) {
                ERR("Attempt to create buffer view from a dynamic buffer with invalid length (length > space left after offset in source): source size = %zu, offset in source = %zu, length = %zd",
-                               src->size, offset, len);
+                   src->size,
+                   offset,
+                   len);
                goto end;
        }
 
@@ -74,8 +79,8 @@ end:
 }
 
 bool lttng_buffer_view_contains_string(const struct lttng_buffer_view *buf,
-               const char *str,
-               size_t len_with_null_terminator)
+                                      const char *str,
+                                      size_t len_with_null_terminator)
 {
        const char *past_buf_end;
        size_t max_str_len_with_null_terminator;
index c32f3900b8d4332d32e0a9eb5b771dc40b82fe85..00b4f5e7bca300cb6d513b38a7c640b016978cc1 100644 (file)
@@ -6,16 +6,14 @@
  */
 
 #include "bytecode.hpp"
+#include "common/align.hpp"
 
-#include <errno.h>
 #include <algorithm>
-
-#include "common/align.hpp"
+#include <errno.h>
 
 #define INIT_ALLOC_SIZE 4
 
-static inline
-int get_count_order(unsigned int count)
+static inline int get_count_order(unsigned int count)
 {
        int order;
 
@@ -39,8 +37,7 @@ int bytecode_init(struct lttng_bytecode_alloc **fb)
        }
 }
 
-static
-int32_t bytecode_reserve(struct lttng_bytecode_alloc **fb, uint32_t align, uint32_t len)
+static int32_t bytecode_reserve(struct lttng_bytecode_alloc **fb, uint32_t align, uint32_t len)
 {
        int32_t ret;
        uint32_t padding = lttng_offset_align((*fb)->b.len, align);
@@ -54,8 +51,7 @@ int32_t bytecode_reserve(struct lttng_bytecode_alloc **fb, uint32_t align, uint3
        if (new_alloc_len > old_alloc_len) {
                struct lttng_bytecode_alloc *newptr;
 
-               new_alloc_len =
-                       std::max(1U << get_count_order(new_alloc_len), old_alloc_len << 1);
+               new_alloc_len = std::max(1U << get_count_order(new_alloc_len), old_alloc_len << 1);
                newptr = (lttng_bytecode_alloc *) realloc(*fb, new_alloc_len);
                if (!newptr)
                        return -ENOMEM;
@@ -70,8 +66,7 @@ int32_t bytecode_reserve(struct lttng_bytecode_alloc **fb, uint32_t align, uint3
        return ret;
 }
 
-int bytecode_push(struct lttng_bytecode_alloc **fb, const void *data,
-               uint32_t align, uint32_t len)
+int bytecode_push(struct lttng_bytecode_alloc **fb, const void *data, uint32_t align, uint32_t len)
 {
        int32_t offset;
 
@@ -83,9 +78,10 @@ int bytecode_push(struct lttng_bytecode_alloc **fb, const void *data,
 }
 
 int bytecode_push_logical(struct lttng_bytecode_alloc **fb,
-               struct logical_op *data,
-               uint32_t align, uint32_t len,
-               uint16_t *skip_offset)
+                         struct logical_op *data,
+                         uint32_t align,
+                         uint32_t len,
+                         uint16_t *skip_offset)
 {
        int32_t offset;
 
@@ -93,9 +89,8 @@ int bytecode_push_logical(struct lttng_bytecode_alloc **fb,
        if (offset < 0)
                return offset;
        memcpy(&(*fb)->b.data[offset], data, len);
-       *skip_offset =
-               (char *) &((struct logical_op *) &(*fb)->b.data[offset])->skip_offset
-                       - (char *) &(*fb)->b.data[0];
+       *skip_offset = (char *) &((struct logical_op *) &(*fb)->b.data[offset])->skip_offset -
+               (char *) &(*fb)->b.data[0];
        return 0;
 }
 
@@ -156,14 +151,12 @@ end:
        return ret;
 }
 
-int bytecode_push_get_index_u64(struct lttng_bytecode_alloc **bytecode,
-               uint64_t index)
+int bytecode_push_get_index_u64(struct lttng_bytecode_alloc **bytecode, uint64_t index)
 {
        int ret;
        struct load_op *insn;
        struct get_index_u64 index_op_data;
-       const uint32_t insn_len =
-                       sizeof(struct load_op) + sizeof(struct get_index_u64);
+       const uint32_t insn_len = sizeof(struct load_op) + sizeof(struct get_index_u64);
 
        insn = (load_op *) calloc(insn_len, 1);
        if (!insn) {
@@ -182,8 +175,8 @@ end:
 }
 
 int bytecode_push_get_symbol(struct lttng_bytecode_alloc **bytecode,
-               struct lttng_bytecode_alloc **bytecode_reloc,
-               const char *symbol)
+                            struct lttng_bytecode_alloc **bytecode_reloc,
+                            const char *symbol)
 {
        int ret;
        struct load_op *insn;
@@ -191,8 +184,7 @@ int bytecode_push_get_symbol(struct lttng_bytecode_alloc **bytecode,
        uint32_t reloc_offset_u32;
        uint16_t reloc_offset;
        uint32_t bytecode_reloc_offset_u32;
-       const uint32_t insn_len =
-                       sizeof(struct load_op) + sizeof(struct get_symbol);
+       const uint32_t insn_len = sizeof(struct load_op) + sizeof(struct get_symbol);
 
        insn = (load_op *) calloc(insn_len, 1);
        if (!insn) {
@@ -206,8 +198,7 @@ int bytecode_push_get_symbol(struct lttng_bytecode_alloc **bytecode,
         * Get offset in the reloc portion at which the symbol name
         * will end up at (GET_SYMBOL's operand points there).
         */
-       bytecode_reloc_offset_u32 = bytecode_get_len(&(*bytecode_reloc)->b) +
-                       sizeof(reloc_offset);
+       bytecode_reloc_offset_u32 = bytecode_get_len(&(*bytecode_reloc)->b) + sizeof(reloc_offset);
        symbol_offset.offset = (uint16_t) bytecode_reloc_offset_u32;
        memcpy(insn->data, &symbol_offset, sizeof(symbol_offset));
 
@@ -229,8 +220,7 @@ int bytecode_push_get_symbol(struct lttng_bytecode_alloc **bytecode,
        }
 
        /* Append reloc offset. */
-       ret = bytecode_push(bytecode_reloc, &reloc_offset,
-                       1, sizeof(reloc_offset));
+       ret = bytecode_push(bytecode_reloc, &reloc_offset, 1, sizeof(reloc_offset));
        if (ret) {
                goto end;
        }
@@ -248,11 +238,9 @@ end:
  *
  * Return allocated bytecode or NULL on error.
  */
-struct lttng_bytecode *lttng_bytecode_copy(
-               const struct lttng_bytecode *orig_f)
+struct lttng_bytecode *lttng_bytecode_copy(const struct lttng_bytecode *orig_f)
 {
-       lttng_bytecode *bytecode
-               = zmalloc<lttng_bytecode>(sizeof(*bytecode) + orig_f->len);
+       lttng_bytecode *bytecode = zmalloc<lttng_bytecode>(sizeof(*bytecode) + orig_f->len);
        if (!bytecode) {
                goto error;
        }
index 5bef795589d75c4349cdf05fe31b65a77369698f..cde53130d3f091245f1bc7e380b0d77834b14ae4 100644 (file)
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/sessiond-comm/sessiond-comm.hpp>
+
 #include <lttng/channel-internal.hpp>
 #include <lttng/channel.h>
 #include <lttng/constant.h>
 #include <lttng/userspace-probe-internal.hpp>
 
-static enum lttng_error_code flatten_lttng_channels(
-               struct lttng_dynamic_pointer_array *channels,
-               struct lttng_channel **flattened_channels);
+static enum lttng_error_code flatten_lttng_channels(struct lttng_dynamic_pointer_array *channels,
+                                                   struct lttng_channel **flattened_channels);
 
-static enum lttng_error_code channel_list_create_from_buffer(
-               const struct lttng_buffer_view *buffer,
-               uint32_t count,
-               struct lttng_dynamic_pointer_array *channel_list);
+static enum lttng_error_code
+channel_list_create_from_buffer(const struct lttng_buffer_view *buffer,
+                               uint32_t count,
+                               struct lttng_dynamic_pointer_array *channel_list);
 
 static void channel_list_destructor(void *ptr)
 {
@@ -93,7 +93,7 @@ end:
 }
 
 ssize_t lttng_channel_create_from_buffer(const struct lttng_buffer_view *view,
-               struct lttng_channel **channel)
+                                        struct lttng_channel **channel)
 {
        ssize_t ret, offset = 0;
        struct lttng_channel *local_channel = nullptr;
@@ -122,34 +122,29 @@ ssize_t lttng_channel_create_from_buffer(const struct lttng_buffer_view *view,
        /* lttng_trigger_comm header */
        {
                const struct lttng_buffer_view comm_view =
-                               lttng_buffer_view_from_view(view, offset,
-                                               sizeof(*channel_comm));
+                       lttng_buffer_view_from_view(view, offset, sizeof(*channel_comm));
 
                if (!lttng_buffer_view_is_valid(&comm_view)) {
                        ret = -1;
                        goto end;
                }
 
-               channel_comm = (const struct lttng_channel_comm *)
-                                              comm_view.data;
+               channel_comm = (const struct lttng_channel_comm *) comm_view.data;
                offset += sizeof(*channel_comm);
        }
 
        {
                const char *name;
                const struct lttng_buffer_view name_view =
-                               lttng_buffer_view_from_view(view, offset,
-                                               channel_comm->name_len);
+                       lttng_buffer_view_from_view(view, offset, channel_comm->name_len);
 
                name = name_view.data;
-               if (!lttng_buffer_view_contains_string(
-                                   &name_view, name, channel_comm->name_len)) {
+               if (!lttng_buffer_view_contains_string(&name_view, name, channel_comm->name_len)) {
                        ret = -1;
                        goto end;
                }
 
-               ret = lttng_strncpy(local_channel->name, name,
-                               sizeof(local_channel->name));
+               ret = lttng_strncpy(local_channel->name, name, sizeof(local_channel->name));
                if (ret) {
                        goto end;
                }
@@ -164,15 +159,12 @@ ssize_t lttng_channel_create_from_buffer(const struct lttng_buffer_view *view,
        local_channel->attr.overwrite = channel_comm->overwrite;
        local_channel->attr.subbuf_size = channel_comm->subbuf_size;
        local_channel->attr.num_subbuf = channel_comm->num_subbuf;
-       local_channel->attr.switch_timer_interval =
-                       channel_comm->switch_timer_interval;
-       local_channel->attr.read_timer_interval =
-                       channel_comm->read_timer_interval;
+       local_channel->attr.switch_timer_interval = channel_comm->switch_timer_interval;
+       local_channel->attr.read_timer_interval = channel_comm->read_timer_interval;
        local_channel->attr.output = (enum lttng_event_output) channel_comm->output;
        local_channel->attr.tracefile_size = channel_comm->tracefile_size;
        local_channel->attr.tracefile_count = channel_comm->tracefile_count;
-       local_channel->attr.live_timer_interval =
-                       channel_comm->live_timer_interval;
+       local_channel->attr.live_timer_interval = channel_comm->live_timer_interval;
 
        extended->discarded_events = channel_comm->discarded_events;
        extended->lost_packets = channel_comm->lost_packets;
@@ -188,8 +180,7 @@ end:
        return ret;
 }
 
-int lttng_channel_serialize(
-               struct lttng_channel *channel, struct lttng_dynamic_buffer *buf)
+int lttng_channel_serialize(struct lttng_channel *channel, struct lttng_dynamic_buffer *buf)
 {
        int ret;
        size_t name_len;
@@ -219,8 +210,7 @@ int lttng_channel_serialize(
        channel_comm.overwrite = channel->attr.overwrite;
        channel_comm.subbuf_size = channel->attr.subbuf_size;
        channel_comm.num_subbuf = channel->attr.num_subbuf;
-       channel_comm.switch_timer_interval =
-                       channel->attr.switch_timer_interval;
+       channel_comm.switch_timer_interval = channel->attr.switch_timer_interval;
        channel_comm.read_timer_interval = channel->attr.read_timer_interval;
        channel_comm.output = channel->attr.output;
        channel_comm.tracefile_size = channel->attr.tracefile_size;
@@ -234,8 +224,7 @@ int lttng_channel_serialize(
        channel_comm.blocking_timeout = extended->blocking_timeout;
 
        /* Header */
-       ret = lttng_dynamic_buffer_append(
-                       buf, &channel_comm, sizeof(channel_comm));
+       ret = lttng_dynamic_buffer_append(buf, &channel_comm, sizeof(channel_comm));
        if (ret) {
                goto end;
        }
@@ -250,7 +239,7 @@ end:
 }
 
 void lttng_channel_set_default_extended_attr(struct lttng_domain *domain,
-               struct lttng_channel_extended *extended_attr)
+                                            struct lttng_channel_extended *extended_attr)
 {
        assert(domain);
        assert(extended_attr);
@@ -259,26 +248,23 @@ void lttng_channel_set_default_extended_attr(struct lttng_domain *domain,
 
        switch (domain->type) {
        case LTTNG_DOMAIN_KERNEL:
-               extended_attr->monitor_timer_interval =
-                               DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER;
-               extended_attr->blocking_timeout =
-                               DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT;
+               extended_attr->monitor_timer_interval = DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER;
+               extended_attr->blocking_timeout = DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT;
                break;
        case LTTNG_DOMAIN_UST:
                switch (domain->buf_type) {
                case LTTNG_BUFFER_PER_UID:
                        extended_attr->monitor_timer_interval =
-                                       DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER;
-                       extended_attr->blocking_timeout =
-                                       DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT;
+                               DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER;
+                       extended_attr->blocking_timeout = DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT;
                        break;
                case LTTNG_BUFFER_PER_PID:
                default:
                        if (extended_attr) {
                                extended_attr->monitor_timer_interval =
-                                               DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER;
+                                       DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER;
                                extended_attr->blocking_timeout =
-                                               DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT;
+                                       DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT;
                        }
                        break;
                }
@@ -288,10 +274,10 @@ void lttng_channel_set_default_extended_attr(struct lttng_domain *domain,
        }
 }
 
-static enum lttng_error_code channel_list_create_from_buffer(
-               const struct lttng_buffer_view *view,
-               unsigned int count,
-               struct lttng_dynamic_pointer_array *channel_list)
+static enum lttng_error_code
+channel_list_create_from_buffer(const struct lttng_buffer_view *view,
+                               unsigned int count,
+                               struct lttng_dynamic_pointer_array *channel_list)
 {
        enum lttng_error_code ret_code;
        int ret, i;
@@ -304,10 +290,9 @@ static enum lttng_error_code channel_list_create_from_buffer(
                ssize_t channel_size;
                struct lttng_channel *channel = nullptr;
                const struct lttng_buffer_view channel_view =
-                               lttng_buffer_view_from_view(view, offset, -1);
+                       lttng_buffer_view_from_view(view, offset, -1);
 
-               channel_size = lttng_channel_create_from_buffer(
-                               &channel_view, &channel);
+               channel_size = lttng_channel_create_from_buffer(&channel_view, &channel);
                if (channel_size < 0) {
                        ret_code = LTTNG_ERR_INVALID;
                        goto end;
@@ -335,7 +320,7 @@ end:
 }
 
 static enum lttng_error_code flatten_lttng_channels(struct lttng_dynamic_pointer_array *channels,
-               struct lttng_channel **flattened_channels)
+                                                   struct lttng_channel **flattened_channels)
 {
        enum lttng_error_code ret_code;
        int ret, i;
@@ -356,8 +341,7 @@ static enum lttng_error_code flatten_lttng_channels(struct lttng_dynamic_pointer
         * We must ensure that "local_flattened_channels" is never resized so as
         * to preserve the validity of the flattened objects.
         */
-       ret = lttng_dynamic_buffer_set_capacity(
-                       &local_flattened_channels, storage_req);
+       ret = lttng_dynamic_buffer_set_capacity(&local_flattened_channels, storage_req);
        if (ret) {
                ret_code = LTTNG_ERR_NOMEM;
                goto end;
@@ -365,17 +349,17 @@ static enum lttng_error_code flatten_lttng_channels(struct lttng_dynamic_pointer
 
        /* Start by laying the struct lttng_channel */
        for (i = 0; i < nb_channels; i++) {
-               const auto *element = (const struct lttng_channel *)
-                               lttng_dynamic_pointer_array_get_pointer(
-                                               channels, i);
+               const auto *element =
+                       (const struct lttng_channel *) lttng_dynamic_pointer_array_get_pointer(
+                               channels, i);
 
                if (!element) {
                        ret_code = LTTNG_ERR_FATAL;
                        goto end;
                }
 
-               ret = lttng_dynamic_buffer_append(&local_flattened_channels,
-                               element, sizeof(struct lttng_channel));
+               ret = lttng_dynamic_buffer_append(
+                       &local_flattened_channels, element, sizeof(struct lttng_channel));
                if (ret) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto end;
@@ -384,21 +368,22 @@ static enum lttng_error_code flatten_lttng_channels(struct lttng_dynamic_pointer
 
        /* Flatten the extended data */
        for (i = 0; i < nb_channels; i++) {
-               const auto *element = (const struct lttng_channel *)
-                               lttng_dynamic_pointer_array_get_pointer(
-                                               channels, i);
+               const auto *element =
+                       (const struct lttng_channel *) lttng_dynamic_pointer_array_get_pointer(
+                               channels, i);
                /*
                 * Sample the location of the flattened channel we are about
                 * to modify.
                 */
-               auto *channel = (struct lttng_channel *)
-                               (local_flattened_channels.data + (sizeof(struct lttng_channel) * i));
+               auto *channel = (struct lttng_channel *) (local_flattened_channels.data +
+                                                         (sizeof(struct lttng_channel) * i));
                /*
                 * Sample the location of the extended attributes we are about
                 * to add.
                 */
-               const auto *channel_extended = (struct lttng_channel_extended *)
-                               (local_flattened_channels.data + local_flattened_channels.size);
+               const auto *channel_extended =
+                       (struct lttng_channel_extended *) (local_flattened_channels.data +
+                                                          local_flattened_channels.size);
 
                if (!element) {
                        ret_code = LTTNG_ERR_FATAL;
@@ -406,8 +391,8 @@ static enum lttng_error_code flatten_lttng_channels(struct lttng_dynamic_pointer
                }
 
                ret = lttng_dynamic_buffer_append(&local_flattened_channels,
-                               element->attr.extended.ptr,
-                               sizeof(struct lttng_channel_extended));
+                                                 element->attr.extended.ptr,
+                                                 sizeof(struct lttng_channel_extended));
                if (ret) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto end;
@@ -430,9 +415,7 @@ end:
 }
 
 enum lttng_error_code lttng_channels_create_and_flatten_from_buffer(
-               const struct lttng_buffer_view *view,
-               uint32_t count,
-               struct lttng_channel **channels)
+       const struct lttng_buffer_view *view, uint32_t count, struct lttng_channel **channels)
 {
        enum lttng_error_code ret_code;
        struct lttng_dynamic_pointer_array local_channels;
@@ -442,10 +425,9 @@ enum lttng_error_code lttng_channels_create_and_flatten_from_buffer(
        /* Deserialize the channels */
        {
                const struct lttng_buffer_view channels_view =
-                               lttng_buffer_view_from_view(view, 0, -1);
+                       lttng_buffer_view_from_view(view, 0, -1);
 
-               ret_code = channel_list_create_from_buffer(
-                               &channels_view, count, &local_channels);
+               ret_code = channel_list_create_from_buffer(&channels_view, count, &local_channels);
                if (ret_code != LTTNG_OK) {
                        goto end;
                }
index 13ba512b8884699d325d90aad36e22e1d9c41c70..f259d45774615c555daf2e213a525c19b4a57f4c 100644 (file)
@@ -8,12 +8,12 @@
 #define _LGPL_SOURCE
 #include <common/compat/fcntl.hpp>
 #include <common/macros.hpp>
+
 #include <unistd.h>
 
 #ifdef __linux__
 
-int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
-               unsigned int flags)
+int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
 {
 #ifdef HAVE_SYNC_FILE_RANGE
        return sync_file_range(fd, offset, nbytes, flags);
index cd4bf1769a739c189576716096304dea956aa70a..782c65b133d3ed94c1f138b74b80c4d5464477c1 100644 (file)
@@ -6,76 +6,77 @@
  */
 
 #include <common/compat/directory-handle.hpp>
+#include <common/credentials.hpp>
+#include <common/dynamic-array.hpp>
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/runas.hpp>
-#include <common/credentials.hpp>
+
 #include <lttng/constant.h>
-#include <common/dynamic-array.hpp>
 
-#include <sys/types.h>
-#include <sys/stat.h>
+#include <dirent.h>
 #include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 #include <unistd.h>
-#include <dirent.h>
 
 /*
  * This compatibility layer shares a common "base" that is implemented
  * in terms of an internal API. This file contains two implementations
  * of the internal API below.
  */
-static
-int lttng_directory_handle_mkdir(
-               const struct lttng_directory_handle *handle,
-               const char *path, mode_t mode);
-static
-int _run_as_mkdir(const struct lttng_directory_handle *handle, const char *path,
-               mode_t mode, uid_t uid, gid_t gid);
-static
-int _run_as_mkdir_recursive(const struct lttng_directory_handle *handle,
-               const char *path, mode_t mode, uid_t uid, gid_t gid);
-static
-int lttng_directory_handle_open(const struct lttng_directory_handle *handle,
-               const char *filename, int flags, mode_t mode);
-static
-int _run_as_open(const struct lttng_directory_handle *handle,
-               const char *filename,
-               int flags, mode_t mode, uid_t uid, gid_t gid);
-static
-int lttng_directory_handle_unlink(
-               const struct lttng_directory_handle *handle,
-               const char *filename);
-static
-int _run_as_unlink(const struct lttng_directory_handle *handle,
-               const char *filename, uid_t uid, gid_t gid);
-static
-int _lttng_directory_handle_rename(
-               const struct lttng_directory_handle *old_handle,
-               const char *old_name,
-               const struct lttng_directory_handle *new_handle,
-               const char *new_name);
-static
-int _run_as_rename(const struct lttng_directory_handle *old_handle,
-               const char *old_name,
-               const struct lttng_directory_handle *new_handle,
-               const char *new_name, uid_t uid, gid_t gid);
-static
-DIR *lttng_directory_handle_opendir(const struct lttng_directory_handle *handle,
-               const char *path);
-static
-int lttng_directory_handle_rmdir(
-               const struct lttng_directory_handle *handle, const char *name);
-static
-int _run_as_rmdir(const struct lttng_directory_handle *handle,
-               const char *name, uid_t uid, gid_t gid);
-static
-int _run_as_rmdir_recursive(
-               const struct lttng_directory_handle *handle, const char *name,
-               uid_t uid, gid_t gid, int flags);
-static
-void lttng_directory_handle_invalidate(struct lttng_directory_handle *handle);
-static
-void lttng_directory_handle_release(struct urcu_ref *ref);
+static int lttng_directory_handle_mkdir(const struct lttng_directory_handle *handle,
+                                       const char *path,
+                                       mode_t mode);
+static int _run_as_mkdir(const struct lttng_directory_handle *handle,
+                        const char *path,
+                        mode_t mode,
+                        uid_t uid,
+                        gid_t gid);
+static int _run_as_mkdir_recursive(const struct lttng_directory_handle *handle,
+                                  const char *path,
+                                  mode_t mode,
+                                  uid_t uid,
+                                  gid_t gid);
+static int lttng_directory_handle_open(const struct lttng_directory_handle *handle,
+                                      const char *filename,
+                                      int flags,
+                                      mode_t mode);
+static int _run_as_open(const struct lttng_directory_handle *handle,
+                       const char *filename,
+                       int flags,
+                       mode_t mode,
+                       uid_t uid,
+                       gid_t gid);
+static int lttng_directory_handle_unlink(const struct lttng_directory_handle *handle,
+                                        const char *filename);
+static int _run_as_unlink(const struct lttng_directory_handle *handle,
+                         const char *filename,
+                         uid_t uid,
+                         gid_t gid);
+static int _lttng_directory_handle_rename(const struct lttng_directory_handle *old_handle,
+                                         const char *old_name,
+                                         const struct lttng_directory_handle *new_handle,
+                                         const char *new_name);
+static int _run_as_rename(const struct lttng_directory_handle *old_handle,
+                         const char *old_name,
+                         const struct lttng_directory_handle *new_handle,
+                         const char *new_name,
+                         uid_t uid,
+                         gid_t gid);
+static DIR *lttng_directory_handle_opendir(const struct lttng_directory_handle *handle,
+                                          const char *path);
+static int lttng_directory_handle_rmdir(const struct lttng_directory_handle *handle,
+                                       const char *name);
+static int
+_run_as_rmdir(const struct lttng_directory_handle *handle, const char *name, uid_t uid, gid_t gid);
+static int _run_as_rmdir_recursive(const struct lttng_directory_handle *handle,
+                                  const char *name,
+                                  uid_t uid,
+                                  gid_t gid,
+                                  int flags);
+static void lttng_directory_handle_invalidate(struct lttng_directory_handle *handle);
+static void lttng_directory_handle_release(struct urcu_ref *ref);
 
 #ifdef HAVE_DIRFD
 
@@ -101,16 +102,16 @@ void lttng_directory_handle_release(struct urcu_ref *ref);
 
 struct lttng_directory_handle *lttng_directory_handle_create(const char *path)
 {
-       lttng_directory_handle cwd_handle {};
+       lttng_directory_handle cwd_handle{};
        cwd_handle.dirfd = AT_FDCWD;
 
        /* Open a handle to the CWD if NULL is passed. */
        return lttng_directory_handle_create_from_handle(path, &cwd_handle);
 }
 
-struct lttng_directory_handle *lttng_directory_handle_create_from_handle(
-               const char *path,
-               const struct lttng_directory_handle *ref_handle)
+struct lttng_directory_handle *
+lttng_directory_handle_create_from_handle(const char *path,
+                                         const struct lttng_directory_handle *ref_handle)
 {
        int dirfd;
        struct lttng_directory_handle *handle = NULL;
@@ -143,8 +144,7 @@ error_close:
        return NULL;
 }
 
-struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd(
-               int dirfd)
+struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd(int dirfd)
 {
        int ret;
        struct lttng_directory_handle *handle = zmalloc<lttng_directory_handle>();
@@ -171,12 +171,11 @@ end:
        return handle;
 }
 
-static
-void lttng_directory_handle_release(struct urcu_ref *ref)
+static void lttng_directory_handle_release(struct urcu_ref *ref)
 {
        int ret;
        struct lttng_directory_handle *handle =
-                       lttng::utils::container_of(ref, &lttng_directory_handle::ref);
+               lttng::utils::container_of(ref, &lttng_directory_handle::ref);
 
        if (handle->destroy_cb) {
                handle->destroy_cb(handle, handle->destroy_cb_data);
@@ -194,8 +193,8 @@ end:
        free(handle);
 }
 
-struct lttng_directory_handle *lttng_directory_handle_copy(
-               const struct lttng_directory_handle *handle)
+struct lttng_directory_handle *
+lttng_directory_handle_copy(const struct lttng_directory_handle *handle)
 {
        struct lttng_directory_handle *new_handle = NULL;
 
@@ -208,8 +207,7 @@ struct lttng_directory_handle *lttng_directory_handle_copy(
                        PERROR("Failed to duplicate directory file descriptor of directory handle");
                        goto end;
                }
-               new_handle = lttng_directory_handle_create_from_dirfd(
-                               new_dirfd);
+               new_handle = lttng_directory_handle_create_from_dirfd(new_dirfd);
                if (!new_handle && close(new_dirfd)) {
                        PERROR("Failed to close directory file descriptor of directory handle");
                }
@@ -219,105 +217,105 @@ end:
 }
 
 bool lttng_directory_handle_equals(const struct lttng_directory_handle *lhs,
-               const struct lttng_directory_handle *rhs)
+                                  const struct lttng_directory_handle *rhs)
 {
        return lhs->directory_inode == rhs->directory_inode;
 }
 
-static
-void lttng_directory_handle_invalidate(struct lttng_directory_handle *handle)
+static void lttng_directory_handle_invalidate(struct lttng_directory_handle *handle)
 {
        handle->dirfd = -1;
 }
 
 int lttng_directory_handle_stat(const struct lttng_directory_handle *handle,
-               const char *path, struct stat *st)
+                               const char *path,
+                               struct stat *st)
 {
        return fstatat(handle->dirfd, path, st, 0);
 }
 
-bool lttng_directory_handle_uses_fd(
-               const struct lttng_directory_handle *handle)
+bool lttng_directory_handle_uses_fd(const struct lttng_directory_handle *handle)
 {
        return handle->dirfd != AT_FDCWD;
 }
 
-static
-int lttng_directory_handle_mkdir(
-               const struct lttng_directory_handle *handle,
-               const char *path, mode_t mode)
+static int lttng_directory_handle_mkdir(const struct lttng_directory_handle *handle,
+                                       const char *path,
+                                       mode_t mode)
 {
        return mkdirat(handle->dirfd, path, mode);
 }
 
-static
-int lttng_directory_handle_open(const struct lttng_directory_handle *handle,
-               const char *filename, int flags, mode_t mode)
+static int lttng_directory_handle_open(const struct lttng_directory_handle *handle,
+                                      const char *filename,
+                                      int flags,
+                                      mode_t mode)
 {
        return openat(handle->dirfd, filename, flags, mode);
 }
 
-static
-int _run_as_open(const struct lttng_directory_handle *handle,
-               const char *filename,
-               int flags, mode_t mode, uid_t uid, gid_t gid)
+static int _run_as_open(const struct lttng_directory_handle *handle,
+                       const char *filename,
+                       int flags,
+                       mode_t mode,
+                       uid_t uid,
+                       gid_t gid)
 {
        return run_as_openat(handle->dirfd, filename, flags, mode, uid, gid);
 }
 
-static
-int _run_as_unlink(const struct lttng_directory_handle *handle,
-               const char *filename, uid_t uid, gid_t gid)
+static int _run_as_unlink(const struct lttng_directory_handle *handle,
+                         const char *filename,
+                         uid_t uid,
+                         gid_t gid)
 {
        return run_as_unlinkat(handle->dirfd, filename, uid, gid);
 }
 
-static
-int lttng_directory_handle_unlink(
-               const struct lttng_directory_handle *handle,
-               const char *filename)
+static int lttng_directory_handle_unlink(const struct lttng_directory_handle *handle,
+                                        const char *filename)
 {
        return unlinkat(handle->dirfd, filename, 0);
 }
 
-static
-int _run_as_mkdir(const struct lttng_directory_handle *handle,
-               const char *path, mode_t mode, uid_t uid, gid_t gid)
+static int _run_as_mkdir(const struct lttng_directory_handle *handle,
+                        const char *path,
+                        mode_t mode,
+                        uid_t uid,
+                        gid_t gid)
 {
        return run_as_mkdirat(handle->dirfd, path, mode, uid, gid);
 }
 
-static
-int _run_as_mkdir_recursive(const struct lttng_directory_handle *handle,
-               const char *path, mode_t mode, uid_t uid, gid_t gid)
+static int _run_as_mkdir_recursive(const struct lttng_directory_handle *handle,
+                                  const char *path,
+                                  mode_t mode,
+                                  uid_t uid,
+                                  gid_t gid)
 {
        return run_as_mkdirat_recursive(handle->dirfd, path, mode, uid, gid);
 }
 
-static
-int _lttng_directory_handle_rename(
-               const struct lttng_directory_handle *old_handle,
-               const char *old_name,
-               const struct lttng_directory_handle *new_handle,
-               const char *new_name)
+static int _lttng_directory_handle_rename(const struct lttng_directory_handle *old_handle,
+                                         const char *old_name,
+                                         const struct lttng_directory_handle *new_handle,
+                                         const char *new_name)
 {
-       return renameat(old_handle->dirfd, old_name,
-                       new_handle->dirfd, new_name);
+       return renameat(old_handle->dirfd, old_name, new_handle->dirfd, new_name);
 }
 
-static
-int _run_as_rename(const struct lttng_directory_handle *old_handle,
-               const char *old_name,
-               const struct lttng_directory_handle *new_handle,
-               const char *new_name, uid_t uid, gid_t gid)
+static int _run_as_rename(const struct lttng_directory_handle *old_handle,
+                         const char *old_name,
+                         const struct lttng_directory_handle *new_handle,
+                         const char *new_name,
+                         uid_t uid,
+                         gid_t gid)
 {
-       return run_as_renameat(old_handle->dirfd, old_name, new_handle->dirfd,
-                       new_name, uid, gid);
+       return run_as_renameat(old_handle->dirfd, old_name, new_handle->dirfd, new_name, uid, gid);
 }
 
-static
-DIR *lttng_directory_handle_opendir(const struct lttng_directory_handle *handle,
-               const char *path)
+static DIR *lttng_directory_handle_opendir(const struct lttng_directory_handle *handle,
+                                          const char *path)
 {
        DIR *dir_stream = NULL;
        int fd = openat(handle->dirfd, path, O_RDONLY);
@@ -342,9 +340,8 @@ end:
        return dir_stream;
 }
 
-static
-int lttng_directory_handle_rmdir(
-               const struct lttng_directory_handle *handle, const char *name)
+static int lttng_directory_handle_rmdir(const struct lttng_directory_handle *handle,
+                                       const char *name)
 {
        int ret = unlinkat(handle->dirfd, name, AT_REMOVEDIR);
        if (ret) {
@@ -354,44 +351,44 @@ int lttng_directory_handle_rmdir(
        return ret;
 }
 
-static
-int _run_as_rmdir(const struct lttng_directory_handle *handle,
-               const char *name, uid_t uid, gid_t gid)
+static int
+_run_as_rmdir(const struct lttng_directory_handle *handle, const char *name, uid_t uid, gid_t gid)
 {
        return run_as_rmdirat(handle->dirfd, name, uid, gid);
 }
 
-static
-int _run_as_rmdir_recursive(
-               const struct lttng_directory_handle *handle, const char *name,
-               uid_t uid, gid_t gid, int flags)
+static int _run_as_rmdir_recursive(const struct lttng_directory_handle *handle,
+                                  const char *name,
+                                  uid_t uid,
+                                  gid_t gid,
+                                  int flags)
 {
        return run_as_rmdirat_recursive(handle->dirfd, name, uid, gid, flags);
 }
 
 #else /* HAVE_DIRFD */
 
-static
-int get_full_path(const struct lttng_directory_handle *handle,
-               const char *subdirectory, char *fullpath, size_t size)
+static int get_full_path(const struct lttng_directory_handle *handle,
+                        const char *subdirectory,
+                        char *fullpath,
+                        size_t size)
 {
        int ret;
-       const bool subdirectory_is_absolute =
-                       subdirectory && *subdirectory == '/';
-       const char * const base = subdirectory_is_absolute ?
-                       subdirectory : handle->base_path;
-       const char * const end = subdirectory && !subdirectory_is_absolute ?
-                       subdirectory : NULL;
+       const bool subdirectory_is_absolute = subdirectory && *subdirectory == '/';
+       const char *const base = subdirectory_is_absolute ? subdirectory : handle->base_path;
+       const char *const end = subdirectory && !subdirectory_is_absolute ? subdirectory : NULL;
        const size_t base_len = strlen(base);
        const size_t end_len = end ? strlen(end) : 0;
        const bool add_separator_slash = end && base[base_len - 1] != '/';
        const bool add_trailing_slash = end && end[end_len - 1] != '/';
 
-       ret = snprintf(fullpath, size, "%s%s%s%s",
-                       base,
-                       add_separator_slash ? "/" : "",
-                       end ? end : "",
-                       add_trailing_slash ? "/" : "");
+       ret = snprintf(fullpath,
+                      size,
+                      "%s%s%s%s",
+                      base,
+                      add_separator_slash ? "/" : "",
+                      end ? end : "",
+                      add_trailing_slash ? "/" : "");
        if (ret == -1 || ret >= size) {
                ERR("Failed to format subdirectory from directory handle");
                ret = -1;
@@ -402,8 +399,7 @@ end:
        return ret;
 }
 
-static
-struct lttng_directory_handle *_lttng_directory_handle_create(char *path)
+static struct lttng_directory_handle *_lttng_directory_handle_create(char *path)
 {
        struct lttng_directory_handle *handle = zmalloc<lttng_directory_handle>();
 
@@ -416,8 +412,7 @@ end:
        return handle;
 }
 
-struct lttng_directory_handle *lttng_directory_handle_create(
-               const char *path)
+struct lttng_directory_handle *lttng_directory_handle_create(const char *path)
 {
        int ret;
        const char *cwd = "";
@@ -448,11 +443,13 @@ struct lttng_directory_handle *lttng_directory_handle_create(
                add_cwd_slash = cwd[cwd_len - 1] != '/';
        }
 
-       ret = snprintf(handle_buf, sizeof(handle_buf), "%s%s%s%s",
-                       cwd,
-                       add_cwd_slash ? "/" : "",
-                       path ? : "",
-                       add_trailing_slash ? "/" : "");
+       ret = snprintf(handle_buf,
+                      sizeof(handle_buf),
+                      "%s%s%s%s",
+                      cwd,
+                      add_cwd_slash ? "/" : "",
+                      path ?: "",
+                      add_trailing_slash ? "/" : "");
        if (ret == -1 || ret >= LTTNG_PATH_MAX) {
                ERR("Failed to initialize directory handle, failed to format directory path");
                goto end;
@@ -463,9 +460,9 @@ end:
        return new_handle;
 }
 
-struct lttng_directory_handle *lttng_directory_handle_create_from_handle(
-               const char *path,
-               const struct lttng_directory_handle *ref_handle)
+struct lttng_directory_handle *
+lttng_directory_handle_create_from_handle(const char *path,
+                                         const struct lttng_directory_handle *ref_handle)
 {
        int ret;
        size_t path_len, handle_path_len;
@@ -484,14 +481,12 @@ struct lttng_directory_handle *lttng_directory_handle_create_from_handle(
                char full_path[LTTNG_PATH_MAX];
 
                /* Best effort for logging purposes. */
-               ret = get_full_path(ref_handle, path, full_path,
-                               sizeof(full_path));
+               ret = get_full_path(ref_handle, path, full_path, sizeof(full_path));
                if (ret) {
                        full_path[0] = '\0';
                }
 
-               ERR("Failed to initialize directory handle to \"%s\": not a directory",
-                               full_path);
+               ERR("Failed to initialize directory handle to \"%s\": not a directory", full_path);
                goto end;
        }
        if (!path) {
@@ -518,11 +513,11 @@ struct lttng_directory_handle *lttng_directory_handle_create_from_handle(
 
        add_trailing_slash = path[path_len - 1] != '/';
 
-       handle_path_len = strlen(ref_handle->base_path) + path_len +
-                       !!add_trailing_slash;
+       handle_path_len = strlen(ref_handle->base_path) + path_len + !!add_trailing_slash;
        if (handle_path_len >= LTTNG_PATH_MAX) {
                ERR("Failed to initialize directory handle as the resulting path's length (%zu bytes) exceeds the maximal allowed length (%d bytes)",
-                               handle_path_len, LTTNG_PATH_MAX);
+                   handle_path_len,
+                   LTTNG_PATH_MAX);
                goto end;
        }
        new_path = zmalloc<char>(handle_path_len);
@@ -531,10 +526,11 @@ struct lttng_directory_handle *lttng_directory_handle_create_from_handle(
                goto end;
        }
 
-       ret = sprintf(new_handle->base_path, "%s%s%s",
-                       ref_handle->base_path,
-                       path,
-                       add_trailing_slash ? "/" : "");
+       ret = sprintf(new_handle->base_path,
+                     "%s%s%s",
+                     ref_handle->base_path,
+                     path,
+                     add_trailing_slash ? "/" : "");
        if (ret == -1 || ret >= handle_path_len) {
                ERR("Failed to initialize directory handle: path formatting failed");
                goto end;
@@ -546,26 +542,24 @@ end:
        return new_handle;
 }
 
-struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd(
-               int dirfd)
+struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd(int dirfd)
 {
        LTTNG_ASSERT(dirfd == AT_FDCWD);
        return lttng_directory_handle_create(NULL);
 }
 
-static
-void lttng_directory_handle_release(struct urcu_ref *ref)
+static void lttng_directory_handle_release(struct urcu_ref *ref)
 {
        struct lttng_directory_handle *handle =
-                       lttng::utils::container_of(ref, &lttng_directory_handle::ref);
+               lttng::utils::container_of(ref, &lttng_directory_handle::ref);
 
        free(handle->base_path);
        lttng_directory_handle_invalidate(handle);
        free(handle);
 }
 
-struct lttng_directory_handle *lttng_directory_handle_copy(
-               const struct lttng_directory_handle *handle)
+struct lttng_directory_handle *
+lttng_directory_handle_copy(const struct lttng_directory_handle *handle)
 {
        struct lttng_directory_handle *new_handle = NULL;
        char *new_path = NULL;
@@ -582,19 +576,19 @@ end:
 }
 
 bool lttng_directory_handle_equals(const struct lttng_directory_handle *lhs,
-               const struct lttng_directory_handle *rhs)
+                                  const struct lttng_directory_handle *rhs)
 {
        return strcmp(lhs->base_path, rhs->base_path) == 0;
 }
 
-static
-void lttng_directory_handle_invalidate(struct lttng_directory_handle *handle)
+static void lttng_directory_handle_invalidate(struct lttng_directory_handle *handle)
 {
        handle->base_path = NULL;
 }
 
 int lttng_directory_handle_stat(const struct lttng_directory_handle *handle,
-               const char *subdirectory, struct stat *st)
+                               const char *subdirectory,
+                               struct stat *st)
 {
        int ret;
        char fullpath[LTTNG_PATH_MAX];
@@ -610,15 +604,14 @@ end:
        return ret;
 }
 
-bool lttng_directory_handle_uses_fd(
-               const struct lttng_directory_handle *handle)
+bool lttng_directory_handle_uses_fd(const struct lttng_directory_handle *handle)
 {
        return false;
 }
 
-static
-int lttng_directory_handle_mkdir(const struct lttng_directory_handle *handle,
-               const char *subdirectory, mode_t mode)
+static int lttng_directory_handle_mkdir(const struct lttng_directory_handle *handle,
+                                       const char *subdirectory,
+                                       mode_t mode)
 {
        int ret;
        char fullpath[LTTNG_PATH_MAX];
@@ -634,9 +627,10 @@ end:
        return ret;
 }
 
-static
-int lttng_directory_handle_open(const struct lttng_directory_handle *handle,
-               const char *filename, int flags, mode_t mode)
+static int lttng_directory_handle_open(const struct lttng_directory_handle *handle,
+                                      const char *filename,
+                                      int flags,
+                                      mode_t mode)
 {
        int ret;
        char fullpath[LTTNG_PATH_MAX];
@@ -652,10 +646,8 @@ end:
        return ret;
 }
 
-static
-int lttng_directory_handle_unlink(
-               const struct lttng_directory_handle *handle,
-               const char *filename)
+static int lttng_directory_handle_unlink(const struct lttng_directory_handle *handle,
+                                        const char *filename)
 {
        int ret;
        char fullpath[LTTNG_PATH_MAX];
@@ -671,9 +663,11 @@ end:
        return ret;
 }
 
-static
-int _run_as_mkdir(const struct lttng_directory_handle *handle, const char *path,
-               mode_t mode, uid_t uid, gid_t gid)
+static int _run_as_mkdir(const struct lttng_directory_handle *handle,
+                        const char *path,
+                        mode_t mode,
+                        uid_t uid,
+                        gid_t gid)
 {
        int ret;
        char fullpath[LTTNG_PATH_MAX];
@@ -689,10 +683,12 @@ end:
        return ret;
 }
 
-static
-int _run_as_open(const struct lttng_directory_handle *handle,
-               const char *filename,
-               int flags, mode_t mode, uid_t uid, gid_t gid)
+static int _run_as_open(const struct lttng_directory_handle *handle,
+                       const char *filename,
+                       int flags,
+                       mode_t mode,
+                       uid_t uid,
+                       gid_t gid)
 {
        int ret;
        char fullpath[LTTNG_PATH_MAX];
@@ -708,9 +704,10 @@ end:
        return ret;
 }
 
-static
-int _run_as_unlink(const struct lttng_directory_handle *handle,
-               const char *filename, uid_t uid, gid_t gid)
+static int _run_as_unlink(const struct lttng_directory_handle *handle,
+                         const char *filename,
+                         uid_t uid,
+                         gid_t gid)
 {
        int ret;
        char fullpath[LTTNG_PATH_MAX];
@@ -726,9 +723,11 @@ end:
        return ret;
 }
 
-static
-int _run_as_mkdir_recursive(const struct lttng_directory_handle *handle,
-               const char *path, mode_t mode, uid_t uid, gid_t gid)
+static int _run_as_mkdir_recursive(const struct lttng_directory_handle *handle,
+                                  const char *path,
+                                  mode_t mode,
+                                  uid_t uid,
+                                  gid_t gid)
 {
        int ret;
        char fullpath[LTTNG_PATH_MAX];
@@ -744,25 +743,21 @@ end:
        return ret;
 }
 
-static
-int _lttng_directory_handle_rename(
-               const struct lttng_directory_handle *old_handle,
-               const char *old_name,
-               const struct lttng_directory_handle *new_handle,
-               const char *new_name)
+static int _lttng_directory_handle_rename(const struct lttng_directory_handle *old_handle,
+                                         const char *old_name,
+                                         const struct lttng_directory_handle *new_handle,
+                                         const char *new_name)
 {
        int ret;
        char old_fullpath[LTTNG_PATH_MAX];
        char new_fullpath[LTTNG_PATH_MAX];
 
-       ret = get_full_path(old_handle, old_name, old_fullpath,
-                       sizeof(old_fullpath));
+       ret = get_full_path(old_handle, old_name, old_fullpath, sizeof(old_fullpath));
        if (ret) {
                errno = ENOMEM;
                goto end;
        }
-       ret = get_full_path(new_handle, new_name, new_fullpath,
-                       sizeof(new_fullpath));
+       ret = get_full_path(new_handle, new_name, new_fullpath, sizeof(new_fullpath));
        if (ret) {
                errno = ENOMEM;
                goto end;
@@ -773,24 +768,23 @@ end:
        return ret;
 }
 
-static
-int _run_as_rename(const struct lttng_directory_handle *old_handle,
-               const char *old_name,
-               const struct lttng_directory_handle *new_handle,
-               const char *new_name, uid_t uid, gid_t gid)
+static int _run_as_rename(const struct lttng_directory_handle *old_handle,
+                         const char *old_name,
+                         const struct lttng_directory_handle *new_handle,
+                         const char *new_name,
+                         uid_t uid,
+                         gid_t gid)
 {
        int ret;
        char old_fullpath[LTTNG_PATH_MAX];
        char new_fullpath[LTTNG_PATH_MAX];
 
-       ret = get_full_path(old_handle, old_name, old_fullpath,
-                       sizeof(old_fullpath));
+       ret = get_full_path(old_handle, old_name, old_fullpath, sizeof(old_fullpath));
        if (ret) {
                errno = ENOMEM;
                goto end;
        }
-       ret = get_full_path(new_handle, new_name, new_fullpath,
-                       sizeof(new_fullpath));
+       ret = get_full_path(new_handle, new_name, new_fullpath, sizeof(new_fullpath));
        if (ret) {
                errno = ENOMEM;
                goto end;
@@ -801,9 +795,8 @@ end:
        return ret;
 }
 
-static
-DIR *lttng_directory_handle_opendir(const struct lttng_directory_handle *handle,
-               const char *path)
+static DIR *lttng_directory_handle_opendir(const struct lttng_directory_handle *handle,
+                                          const char *path)
 {
        int ret;
        DIR *dir_stream = NULL;
@@ -820,9 +813,8 @@ end:
        return dir_stream;
 }
 
-static
-int lttng_directory_handle_rmdir(
-               const struct lttng_directory_handle *handle, const char *name)
+static int lttng_directory_handle_rmdir(const struct lttng_directory_handle *handle,
+                                       const char *name)
 {
        int ret;
        char fullpath[LTTNG_PATH_MAX];
@@ -838,9 +830,8 @@ end:
        return ret;
 }
 
-static
-int _run_as_rmdir(const struct lttng_directory_handle *handle,
-               const char *name, uid_t uid, gid_t gid)
+static int
+_run_as_rmdir(const struct lttng_directory_handle *handle, const char *name, uid_t uid, gid_t gid)
 {
        int ret;
        char fullpath[LTTNG_PATH_MAX];
@@ -856,10 +847,11 @@ end:
        return ret;
 }
 
-static
-int _run_as_rmdir_recursive(
-               const struct lttng_directory_handle *handle, const char *name,
-               uid_t uid, gid_t gid, int flags)
+static int _run_as_rmdir_recursive(const struct lttng_directory_handle *handle,
+                                  const char *name,
+                                  uid_t uid,
+                                  gid_t gid,
+                                  int flags)
 {
        int ret;
        char fullpath[LTTNG_PATH_MAX];
@@ -888,9 +880,9 @@ end:
  *
  * Checking the path for existence allows us to work around this behaviour.
  */
-static
-int create_directory_check_exists(const struct lttng_directory_handle *handle,
-               const char *path, mode_t mode)
+static int create_directory_check_exists(const struct lttng_directory_handle *handle,
+                                        const char *path,
+                                        mode_t mode)
 {
        int ret = 0;
        struct stat st;
@@ -919,9 +911,9 @@ end:
        return ret;
 }
 
-static
-int create_directory_recursive(const struct lttng_directory_handle *handle,
-               const char *path, mode_t mode)
+static int create_directory_recursive(const struct lttng_directory_handle *handle,
+                                     const char *path,
+                                     mode_t mode)
 {
        char *p, tmp[LTTNG_PATH_MAX];
        size_t len;
@@ -932,7 +924,8 @@ int create_directory_recursive(const struct lttng_directory_handle *handle,
        ret = lttng_strncpy(tmp, path, sizeof(tmp));
        if (ret) {
                ERR("Failed to create directory: provided path's length (%zu bytes) exceeds the maximal allowed length (%zu bytes)",
-                               strlen(path) + 1, sizeof(tmp));
+                   strlen(path) + 1,
+                   sizeof(tmp));
                goto error;
        }
 
@@ -944,19 +937,16 @@ int create_directory_recursive(const struct lttng_directory_handle *handle,
        for (p = tmp + 1; *p; p++) {
                if (*p == '/') {
                        *p = 0;
-                       if (tmp[strlen(tmp) - 1] == '.' &&
-                                       tmp[strlen(tmp) - 2] == '.' &&
-                                       tmp[strlen(tmp) - 3] == '/') {
-                               ERR("Using '/../' is not permitted in the trace path (%s)",
-                                               tmp);
+                       if (tmp[strlen(tmp) - 1] == '.' && tmp[strlen(tmp) - 2] == '.' &&
+                           tmp[strlen(tmp) - 3] == '/') {
+                               ERR("Using '/../' is not permitted in the trace path (%s)", tmp);
                                ret = -1;
                                goto error;
                        }
                        ret = create_directory_check_exists(handle, tmp, mode);
                        if (ret < 0) {
                                if (errno != EACCES) {
-                                       PERROR("Failed to create directory \"%s\"",
-                                                       path);
+                                       PERROR("Failed to create directory \"%s\"", path);
                                        ret = -errno;
                                        goto error;
                                }
@@ -988,95 +978,96 @@ void lttng_directory_handle_put(struct lttng_directory_handle *handle)
        urcu_ref_put(&handle->ref, lttng_directory_handle_release);
 }
 
-int lttng_directory_handle_create_subdirectory_as_user(
-               const struct lttng_directory_handle *handle,
-               const char *subdirectory,
-               mode_t mode, const struct lttng_credentials *creds)
+int lttng_directory_handle_create_subdirectory_as_user(const struct lttng_directory_handle *handle,
+                                                      const char *subdirectory,
+                                                      mode_t mode,
+                                                      const struct lttng_credentials *creds)
 {
        int ret;
 
        if (!creds) {
                /* Run as current user. */
-               ret = create_directory_check_exists(handle,
-                               subdirectory, mode);
+               ret = create_directory_check_exists(handle, subdirectory, mode);
        } else {
-               ret = _run_as_mkdir(handle, subdirectory, mode,
-                               lttng_credentials_get_uid(creds),
-                               lttng_credentials_get_gid(creds));
+               ret = _run_as_mkdir(handle,
+                                   subdirectory,
+                                   mode,
+                                   lttng_credentials_get_uid(creds),
+                                   lttng_credentials_get_gid(creds));
        }
 
        return ret;
 }
 
 int lttng_directory_handle_create_subdirectory_recursive_as_user(
-               const struct lttng_directory_handle *handle,
-               const char *subdirectory_path,
-               mode_t mode, const struct lttng_credentials *creds)
+       const struct lttng_directory_handle *handle,
+       const char *subdirectory_path,
+       mode_t mode,
+       const struct lttng_credentials *creds)
 {
        int ret;
 
        if (!creds) {
                /* Run as current user. */
-               ret = create_directory_recursive(handle,
-                               subdirectory_path, mode);
+               ret = create_directory_recursive(handle, subdirectory_path, mode);
        } else {
-               ret = _run_as_mkdir_recursive(handle, subdirectory_path,
-                               mode, lttng_credentials_get_uid(creds), lttng_credentials_get_gid(creds));
+               ret = _run_as_mkdir_recursive(handle,
+                                             subdirectory_path,
+                                             mode,
+                                             lttng_credentials_get_uid(creds),
+                                             lttng_credentials_get_gid(creds));
        }
 
        return ret;
 }
 
-int lttng_directory_handle_create_subdirectory(
-               const struct lttng_directory_handle *handle,
-               const char *subdirectory,
-               mode_t mode)
+int lttng_directory_handle_create_subdirectory(const struct lttng_directory_handle *handle,
+                                              const char *subdirectory,
+                                              mode_t mode)
 {
-       return lttng_directory_handle_create_subdirectory_as_user(
-                       handle, subdirectory, mode, NULL);
+       return lttng_directory_handle_create_subdirectory_as_user(handle, subdirectory, mode, NULL);
 }
 
 int lttng_directory_handle_create_subdirectory_recursive(
-               const struct lttng_directory_handle *handle,
-               const char *subdirectory_path,
-               mode_t mode)
+       const struct lttng_directory_handle *handle, const char *subdirectory_path, mode_t mode)
 {
        return lttng_directory_handle_create_subdirectory_recursive_as_user(
-                       handle, subdirectory_path, mode, NULL);
+               handle, subdirectory_path, mode, NULL);
 }
 
-int lttng_directory_handle_open_file_as_user(
-               const struct lttng_directory_handle *handle,
-               const char *filename,
-               int flags, mode_t mode,
-               const struct lttng_credentials *creds)
+int lttng_directory_handle_open_file_as_user(const struct lttng_directory_handle *handle,
+                                            const char *filename,
+                                            int flags,
+                                            mode_t mode,
+                                            const struct lttng_credentials *creds)
 {
        int ret;
 
        if (!creds) {
                /* Run as current user. */
-               ret = lttng_directory_handle_open(handle, filename, flags,
-                               mode);
+               ret = lttng_directory_handle_open(handle, filename, flags, mode);
        } else {
-               ret = _run_as_open(handle, filename, flags, mode,
-                               lttng_credentials_get_uid(creds), lttng_credentials_get_gid(creds));
+               ret = _run_as_open(handle,
+                                  filename,
+                                  flags,
+                                  mode,
+                                  lttng_credentials_get_uid(creds),
+                                  lttng_credentials_get_gid(creds));
        }
        return ret;
 }
 
-int lttng_directory_handle_open_file(
-               const struct lttng_directory_handle *handle,
-               const char *filename,
-               int flags, mode_t mode)
+int lttng_directory_handle_open_file(const struct lttng_directory_handle *handle,
+                                    const char *filename,
+                                    int flags,
+                                    mode_t mode)
 {
-       return lttng_directory_handle_open_file_as_user(handle, filename, flags,
-                       mode, NULL);
+       return lttng_directory_handle_open_file_as_user(handle, filename, flags, mode, NULL);
 }
 
-int lttng_directory_handle_unlink_file_as_user(
-               const struct lttng_directory_handle *handle,
-               const char *filename,
-               const struct lttng_credentials *creds)
+int lttng_directory_handle_unlink_file_as_user(const struct lttng_directory_handle *handle,
+                                              const char *filename,
+                                              const struct lttng_credentials *creds)
 {
        int ret;
 
@@ -1084,61 +1075,60 @@ int lttng_directory_handle_unlink_file_as_user(
                /* Run as current user. */
                ret = lttng_directory_handle_unlink(handle, filename);
        } else {
-               ret = _run_as_unlink(handle, filename, lttng_credentials_get_uid(creds), lttng_credentials_get_gid(creds));
+               ret = _run_as_unlink(handle,
+                                    filename,
+                                    lttng_credentials_get_uid(creds),
+                                    lttng_credentials_get_gid(creds));
        }
        return ret;
 }
 
-int lttng_directory_handle_unlink_file(
-               const struct lttng_directory_handle *handle,
-               const char *filename)
+int lttng_directory_handle_unlink_file(const struct lttng_directory_handle *handle,
+                                      const char *filename)
 {
-       return lttng_directory_handle_unlink_file_as_user(handle,
-                       filename, NULL);
+       return lttng_directory_handle_unlink_file_as_user(handle, filename, NULL);
 }
 
-int lttng_directory_handle_rename(
-               const struct lttng_directory_handle *old_handle,
-               const char *old_name,
-               const struct lttng_directory_handle *new_handle,
-               const char *new_name)
+int lttng_directory_handle_rename(const struct lttng_directory_handle *old_handle,
+                                 const char *old_name,
+                                 const struct lttng_directory_handle *new_handle,
+                                 const char *new_name)
 {
-       return lttng_directory_handle_rename_as_user(old_handle, old_name,
-                       new_handle, new_name, NULL);
+       return lttng_directory_handle_rename_as_user(
+               old_handle, old_name, new_handle, new_name, NULL);
 }
 
-int lttng_directory_handle_rename_as_user(
-               const struct lttng_directory_handle *old_handle,
-               const char *old_name,
-               const struct lttng_directory_handle *new_handle,
-               const char *new_name,
-               const struct lttng_credentials *creds)
+int lttng_directory_handle_rename_as_user(const struct lttng_directory_handle *old_handle,
+                                         const char *old_name,
+                                         const struct lttng_directory_handle *new_handle,
+                                         const char *new_name,
+                                         const struct lttng_credentials *creds)
 {
        int ret;
 
        if (!creds) {
                /* Run as current user. */
-               ret = _lttng_directory_handle_rename(old_handle,
-                               old_name, new_handle, new_name);
+               ret = _lttng_directory_handle_rename(old_handle, old_name, new_handle, new_name);
        } else {
-               ret = _run_as_rename(old_handle, old_name, new_handle,
-                               new_name, lttng_credentials_get_uid(creds), lttng_credentials_get_gid(creds));
+               ret = _run_as_rename(old_handle,
+                                    old_name,
+                                    new_handle,
+                                    new_name,
+                                    lttng_credentials_get_uid(creds),
+                                    lttng_credentials_get_gid(creds));
        }
        return ret;
 }
 
-int lttng_directory_handle_remove_subdirectory(
-               const struct lttng_directory_handle *handle,
-               const char *name)
+int lttng_directory_handle_remove_subdirectory(const struct lttng_directory_handle *handle,
+                                              const char *name)
 {
-       return lttng_directory_handle_remove_subdirectory_as_user(handle, name,
-                       NULL);
+       return lttng_directory_handle_remove_subdirectory_as_user(handle, name, NULL);
 }
 
-int lttng_directory_handle_remove_subdirectory_as_user(
-               const struct lttng_directory_handle *handle,
-               const char *name,
-               const struct lttng_credentials *creds)
+int lttng_directory_handle_remove_subdirectory_as_user(const struct lttng_directory_handle *handle,
+                                                      const char *name,
+                                                      const struct lttng_credentials *creds)
 {
        int ret;
 
@@ -1146,7 +1136,10 @@ int lttng_directory_handle_remove_subdirectory_as_user(
                /* Run as current user. */
                ret = lttng_directory_handle_rmdir(handle, name);
        } else {
-               ret = _run_as_rmdir(handle, name, lttng_credentials_get_uid(creds), lttng_credentials_get_gid(creds));
+               ret = _run_as_rmdir(handle,
+                                   name,
+                                   lttng_credentials_get_uid(creds),
+                                   lttng_credentials_get_gid(creds));
        }
        return ret;
 }
@@ -1161,8 +1154,7 @@ struct rmdir_frame {
 };
 } /* namespace */
 
-static
-void rmdir_frame_fini(void *data)
+static void rmdir_frame_fini(void *data)
 {
        int ret;
        struct rmdir_frame *frame = (rmdir_frame *) data;
@@ -1173,9 +1165,8 @@ void rmdir_frame_fini(void *data)
        }
 }
 
-static
-int remove_directory_recursive(const struct lttng_directory_handle *handle,
-               const char *path, int flags)
+static int
+remove_directory_recursive(const struct lttng_directory_handle *handle, const char *path, int flags)
 {
        int ret;
        struct lttng_dynamic_array frames;
@@ -1190,19 +1181,18 @@ int remove_directory_recursive(const struct lttng_directory_handle *handle,
        const char separator = '/';
 
        lttng_dynamic_buffer_init(&current_path);
-       lttng_dynamic_array_init(&frames, sizeof(struct rmdir_frame),
-                       rmdir_frame_fini);
+       lttng_dynamic_array_init(&frames, sizeof(struct rmdir_frame), rmdir_frame_fini);
 
-       if (flags & ~(LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG |
-                                   LTTNG_DIRECTORY_HANDLE_FAIL_NON_EMPTY_FLAG)) {
+       if (flags &
+           ~(LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG |
+             LTTNG_DIRECTORY_HANDLE_FAIL_NON_EMPTY_FLAG)) {
                ERR("Unknown flags %d", flags);
                ret = -1;
                goto end;
        }
 
        if (!initial_frame.dir) {
-               if (flags & LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG &&
-                               errno == ENOENT) {
+               if (flags & LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG && errno == ENOENT) {
                        DBG("Cannot rmdir \"%s\": root does not exist", path);
                        ret = 0;
                        goto end;
@@ -1220,8 +1210,7 @@ int remove_directory_recursive(const struct lttng_directory_handle *handle,
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(
-                       &current_path, path, initial_frame.path_size);
+       ret = lttng_dynamic_buffer_append(&current_path, path, initial_frame.path_size);
        if (ret) {
                ERR("Failed to set initial path during recursive directory removal");
                ret = -1;
@@ -1231,47 +1220,40 @@ int remove_directory_recursive(const struct lttng_directory_handle *handle,
        while (lttng_dynamic_array_get_count(&frames) > 0) {
                struct dirent *entry;
                struct rmdir_frame *current_frame =
-                               (rmdir_frame *) lttng_dynamic_array_get_element(
-                                               &frames, current_frame_idx);
+                       (rmdir_frame *) lttng_dynamic_array_get_element(&frames, current_frame_idx);
 
                LTTNG_ASSERT(current_frame->dir);
-               ret = lttng_dynamic_buffer_set_size(
-                               &current_path, current_frame->path_size);
+               ret = lttng_dynamic_buffer_set_size(&current_path, current_frame->path_size);
                LTTNG_ASSERT(!ret);
                current_path.data[current_path.size - 1] = '\0';
 
                while ((entry = readdir(current_frame->dir))) {
                        struct stat st;
 
-                       if (!strcmp(entry->d_name, ".") ||
-                                       !strcmp(entry->d_name, "..")) {
+                       if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")) {
                                continue;
                        }
 
                        /* Set current_path to the entry's path. */
-                       ret = lttng_dynamic_buffer_set_size(
-                                       &current_path, current_path.size - 1);
+                       ret = lttng_dynamic_buffer_set_size(&current_path, current_path.size - 1);
                        LTTNG_ASSERT(!ret);
-                       ret = lttng_dynamic_buffer_append(&current_path,
-                                       &separator, sizeof(separator));
+                       ret = lttng_dynamic_buffer_append(
+                               &current_path, &separator, sizeof(separator));
                        if (ret) {
                                goto end;
                        }
-                       ret = lttng_dynamic_buffer_append(&current_path,
-                                       entry->d_name,
-                                       strlen(entry->d_name) + 1);
+                       ret = lttng_dynamic_buffer_append(
+                               &current_path, entry->d_name, strlen(entry->d_name) + 1);
                        if (ret) {
                                goto end;
                        }
 
-                       if (lttng_directory_handle_stat(
-                                           handle, current_path.data, &st)) {
+                       if (lttng_directory_handle_stat(handle, current_path.data, &st)) {
                                if ((flags & LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG) &&
-                                               errno == ENOENT) {
+                                   errno == ENOENT) {
                                        break;
                                }
-                               PERROR("Failed to stat \"%s\"",
-                                               current_path.data);
+                               PERROR("Failed to stat \"%s\"", current_path.data);
                                ret = -1;
                                goto end;
                        }
@@ -1283,23 +1265,22 @@ int remove_directory_recursive(const struct lttng_directory_handle *handle,
                                } else {
                                        /* Not empty, abort. */
                                        DBG("Directory \"%s\" is not empty; refusing to remove directory",
-                                                       current_path.data);
+                                           current_path.data);
                                        ret = -1;
                                        goto end;
                                }
                        } else {
                                struct rmdir_frame new_frame = {
                                        .parent_frame_idx = (ssize_t) current_frame_idx,
-                                       .dir = lttng_directory_handle_opendir(
-                                                       handle,
-                                                       current_path.data),
+                                       .dir = lttng_directory_handle_opendir(handle,
+                                                                             current_path.data),
                                        .empty = true,
                                        .path_size = current_path.size,
                                };
 
                                if (!new_frame.dir) {
                                        if (flags & LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG &&
-                                                       errno == ENOENT) {
+                                           errno == ENOENT) {
                                                DBG("Non-existing directory stream during recursive directory removal");
                                                break;
                                        } else {
@@ -1308,8 +1289,7 @@ int remove_directory_recursive(const struct lttng_directory_handle *handle,
                                                goto end;
                                        }
                                }
-                               ret = lttng_dynamic_array_add_element(
-                                               &frames, &new_frame);
+                               ret = lttng_dynamic_array_add_element(&frames, &new_frame);
                                if (ret) {
                                        ERR("Failed to push context frame during recursive directory removal");
                                        rmdir_frame_fini(&new_frame);
@@ -1326,13 +1306,12 @@ int remove_directory_recursive(const struct lttng_directory_handle *handle,
 
                /* Pop rmdir frame. */
                if (current_frame->empty) {
-                       ret = lttng_directory_handle_rmdir(
-                                       handle, current_path.data);
+                       ret = lttng_directory_handle_rmdir(handle, current_path.data);
                        if (ret) {
                                if ((flags & LTTNG_DIRECTORY_HANDLE_FAIL_NON_EMPTY_FLAG) ||
-                                               errno != ENOENT) {
+                                   errno != ENOENT) {
                                        PERROR("Failed to remove \"%s\" during recursive directory removal",
-                                                       current_path.data);
+                                              current_path.data);
                                        goto end;
                                }
                                DBG("Non-existing directory stream during recursive directory removal");
@@ -1340,13 +1319,12 @@ int remove_directory_recursive(const struct lttng_directory_handle *handle,
                } else if (current_frame->parent_frame_idx >= 0) {
                        struct rmdir_frame *parent_frame;
 
-                       parent_frame = (rmdir_frame *) lttng_dynamic_array_get_element(&frames,
-                                       current_frame->parent_frame_idx);
+                       parent_frame = (rmdir_frame *) lttng_dynamic_array_get_element(
+                               &frames, current_frame->parent_frame_idx);
                        LTTNG_ASSERT(parent_frame);
                        parent_frame->empty = false;
                }
-               ret = lttng_dynamic_array_remove_element(
-                               &frames, current_frame_idx);
+               ret = lttng_dynamic_array_remove_element(&frames, current_frame_idx);
                if (ret) {
                        ERR("Failed to pop context frame during recursive directory removal");
                        goto end;
@@ -1360,19 +1338,17 @@ end:
 }
 
 int lttng_directory_handle_remove_subdirectory_recursive(
-               const struct lttng_directory_handle *handle,
-               const char *name,
-               int flags)
+       const struct lttng_directory_handle *handle, const char *name, int flags)
 {
        return lttng_directory_handle_remove_subdirectory_recursive_as_user(
-                       handle, name, NULL, flags);
+               handle, name, NULL, flags);
 }
 
 int lttng_directory_handle_remove_subdirectory_recursive_as_user(
-               const struct lttng_directory_handle *handle,
-               const char *name,
-               const struct lttng_credentials *creds,
-               int flags)
+       const struct lttng_directory_handle *handle,
+       const char *name,
+       const struct lttng_credentials *creds,
+       int flags)
 {
        int ret;
 
@@ -1380,8 +1356,11 @@ int lttng_directory_handle_remove_subdirectory_recursive_as_user(
                /* Run as current user. */
                ret = remove_directory_recursive(handle, name, flags);
        } else {
-               ret = _run_as_rmdir_recursive(handle, name, lttng_credentials_get_uid(creds),
-                               lttng_credentials_get_gid(creds), flags);
+               ret = _run_as_rmdir_recursive(handle,
+                                             name,
+                                             lttng_credentials_get_uid(creds),
+                                             lttng_credentials_get_gid(creds),
+                                             flags);
        }
        return ret;
 }
index dfe05d59eec70afd3aaf6e9daffe83f733ac5132..38720039500903bce7e5134f82cc23b0adb9dcf7 100644 (file)
@@ -7,22 +7,22 @@
  */
 
 #define _LGPL_SOURCE
-#include <stdlib.h>
-#include <stdbool.h>
+#include "poll.hpp"
 
 #include <common/defaults.hpp>
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/utils.hpp>
 
-#include "poll.hpp"
+#include <stdbool.h>
+#include <stdlib.h>
 
 #ifdef HAVE_EPOLL
 
 #include <fcntl.h>
 #include <limits.h>
-#include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 #include <unistd.h>
 
 /*
@@ -42,8 +42,7 @@ static unsigned int poll_max_size;
  *
  * Return 0 on success or else -1 with the current events pointer untouched.
  */
-static int resize_poll_event(struct lttng_poll_event *events,
-               uint32_t new_size)
+static int resize_poll_event(struct lttng_poll_event *events, uint32_t new_size)
 {
        struct epoll_event *ptr;
 
@@ -56,8 +55,7 @@ static int resize_poll_event(struct lttng_poll_event *events,
        }
        if (new_size > events->alloc_size) {
                /* Zero newly allocated memory */
-               memset(ptr + events->alloc_size, 0,
-                       (new_size - events->alloc_size) * sizeof(*ptr));
+               memset(ptr + events->alloc_size, 0, (new_size - events->alloc_size) * sizeof(*ptr));
        }
        events->events = ptr;
        events->alloc_size = new_size;
@@ -245,8 +243,7 @@ error:
 /*
  * Wait on epoll set. This is a blocking call of timeout value.
  */
-int compat_epoll_wait(struct lttng_poll_event *events, int timeout,
-               bool interruptible)
+int compat_epoll_wait(struct lttng_poll_event *events, int timeout, bool interruptible)
 {
        int ret;
        uint32_t new_size;
@@ -362,8 +359,7 @@ static unsigned int poll_max_size;
  *
  * Return 0 on success or else -1 with the current events pointer untouched.
  */
-static int resize_poll_event(struct compat_poll_event_array *array,
-               uint32_t new_size)
+static int resize_poll_event(struct compat_poll_event_array *array, uint32_t new_size)
 {
        struct pollfd *ptr;
 
@@ -381,8 +377,7 @@ static int resize_poll_event(struct compat_poll_event_array *array,
        }
        if (new_size > array->alloc_size) {
                /* Zero newly allocated memory */
-               memset(ptr + array->alloc_size, 0,
-                       (new_size - array->alloc_size) * sizeof(*ptr));
+               memset(ptr + array->alloc_size, 0, (new_size - array->alloc_size) * sizeof(*ptr));
        }
        array->events = ptr;
        array->alloc_size = new_size;
@@ -413,8 +408,7 @@ static int update_current_events(struct lttng_poll_event *events)
                        goto error;
                }
        }
-       memcpy(wait->events, current->events,
-                       current->nb_fd * sizeof(*current->events));
+       memcpy(wait->events, current->events, current->nb_fd * sizeof(*current->events));
 
        /* Update is done. */
        events->need_update = 0;
@@ -480,8 +474,7 @@ error:
 /*
  * Add fd to pollfd data structure with requested events.
  */
-int compat_poll_add(struct lttng_poll_event *events, int fd,
-               uint32_t req_events)
+int compat_poll_add(struct lttng_poll_event *events, int fd, uint32_t req_events)
 {
        int new_size, ret, i;
        struct compat_poll_event_array *current;
@@ -526,14 +519,13 @@ error:
 /*
  * Modify an fd's events..
  */
-int compat_poll_mod(struct lttng_poll_event *events, int fd,
-               uint32_t req_events)
+int compat_poll_mod(struct lttng_poll_event *events, int fd, uint32_t req_events)
 {
        int i;
        struct compat_poll_event_array *current;
 
-       if (events == NULL || events->current.nb_fd == 0 ||
-                       events->current.events == NULL || fd < 0) {
+       if (events == NULL || events->current.nb_fd == 0 || events->current.events == NULL ||
+           fd < 0) {
                ERR("Bad compat poll mod arguments");
                goto error;
        }
@@ -568,8 +560,8 @@ int compat_poll_del(struct lttng_poll_event *events, int fd)
        uint32_t new_size;
        struct compat_poll_event_array *current;
 
-       if (events == NULL || events->current.nb_fd == 0 ||
-                       events->current.events == NULL || fd < 0) {
+       if (events == NULL || events->current.nb_fd == 0 || events->current.events == NULL ||
+           fd < 0) {
                goto error;
        }
 
@@ -596,8 +588,8 @@ int compat_poll_del(struct lttng_poll_event *events, int fd)
 
        /* Resize array if needed. */
        new_size = 1U << utils_get_count_order_u32(current->nb_fd);
-       if (new_size != current->alloc_size && new_size >= current->init_size
-                       && current->nb_fd != 0) {
+       if (new_size != current->alloc_size && new_size >= current->init_size &&
+           current->nb_fd != 0) {
                ret = resize_poll_event(current, new_size);
                if (ret < 0) {
                        goto error;
@@ -616,8 +608,7 @@ error:
 /*
  * Wait on poll() with timeout. Blocking call.
  */
-int compat_poll_wait(struct lttng_poll_event *events, int timeout,
-               bool interruptible)
+int compat_poll_wait(struct lttng_poll_event *events, int timeout, bool interruptible)
 {
        int ret, active_fd_count;
        size_t pos = 0, consecutive_entries = 0, non_idle_pos;
@@ -675,7 +666,8 @@ int compat_poll_wait(struct lttng_poll_event *events, int timeout,
                non_idle_pos = pos;
 
                /* Look for next non-idle entry. */
-               while (events->wait.events[++non_idle_pos].revents == 0);
+               while (events->wait.events[++non_idle_pos].revents == 0)
+                       ;
 
                /* Swap idle and non-idle entries. */
                idle_entry = *current;
index 6830877a189e63f6fc98405eb6a54fd6e2933db8..e1af44b1c2eb0d4de73c28fa5f83b783538fbda1 100644 (file)
@@ -8,42 +8,38 @@
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/mi-lttng.hpp>
-#include <float.h>
+
 #include <lttng/condition/buffer-usage-internal.hpp>
 #include <lttng/condition/condition-internal.hpp>
+
+#include <float.h>
 #include <math.h>
 #include <time.h>
 
-#define IS_USAGE_CONDITION(condition) ( \
-       lttng_condition_get_type(condition) == LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW || \
-       lttng_condition_get_type(condition) == LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH   \
-       )
+#define IS_USAGE_CONDITION(condition)                                                    \
+       (lttng_condition_get_type(condition) == LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW || \
+        lttng_condition_get_type(condition) == LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH)
 
-static
-bool is_usage_evaluation(const struct lttng_evaluation *evaluation)
+static bool is_usage_evaluation(const struct lttng_evaluation *evaluation)
 {
        enum lttng_condition_type type = lttng_evaluation_get_type(evaluation);
 
        return type == LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW ||
-                       type == LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH;
+               type == LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH;
 }
 
-static
-void lttng_condition_buffer_usage_destroy(struct lttng_condition *condition)
+static void lttng_condition_buffer_usage_destroy(struct lttng_condition *condition)
 {
        struct lttng_condition_buffer_usage *usage;
 
-       usage = lttng::utils::container_of(condition,
-                       &lttng_condition_buffer_usage::parent);
+       usage = lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
 
        free(usage->session_name);
        free(usage->channel_name);
        free(usage);
 }
 
-static
-bool lttng_condition_buffer_usage_validate(
-               const struct lttng_condition *condition)
+static bool lttng_condition_buffer_usage_validate(const struct lttng_condition *condition)
 {
        bool valid = false;
        struct lttng_condition_buffer_usage *usage;
@@ -52,8 +48,7 @@ bool lttng_condition_buffer_usage_validate(
                goto end;
        }
 
-       usage = lttng::utils::container_of(condition,
-                       &lttng_condition_buffer_usage::parent);
+       usage = lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
        if (!usage->session_name) {
                ERR("Invalid buffer condition: a target session name must be set.");
                goto end;
@@ -76,10 +71,8 @@ end:
        return valid;
 }
 
-static
-int lttng_condition_buffer_usage_serialize(
-               const struct lttng_condition *condition,
-               struct lttng_payload *payload)
+static int lttng_condition_buffer_usage_serialize(const struct lttng_condition *condition,
+                                                 struct lttng_payload *payload)
 {
        int ret;
        struct lttng_condition_buffer_usage *usage;
@@ -92,13 +85,11 @@ int lttng_condition_buffer_usage_serialize(
        }
 
        DBG("Serializing buffer usage condition");
-       usage = lttng::utils::container_of(condition,
-                       &lttng_condition_buffer_usage::parent);
+       usage = lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
 
        session_name_len = strlen(usage->session_name) + 1;
        channel_name_len = strlen(usage->channel_name) + 1;
-       if (session_name_len > LTTNG_NAME_MAX ||
-                       channel_name_len > LTTNG_NAME_MAX) {
+       if (session_name_len > LTTNG_NAME_MAX || channel_name_len > LTTNG_NAME_MAX) {
                ret = -1;
                goto end;
        }
@@ -114,20 +105,17 @@ int lttng_condition_buffer_usage_serialize(
                usage_comm.threshold_ratio = usage->threshold_ratio.value;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &usage_comm,
-                       sizeof(usage_comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &usage_comm, sizeof(usage_comm));
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, usage->session_name,
-                       session_name_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, usage->session_name, session_name_len);
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, usage->channel_name,
-                       channel_name_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, usage->channel_name, channel_name_len);
        if (ret) {
                goto end;
        }
@@ -135,9 +123,8 @@ end:
        return ret;
 }
 
-static
-bool lttng_condition_buffer_usage_is_equal(const struct lttng_condition *_a,
-               const struct lttng_condition *_b)
+static bool lttng_condition_buffer_usage_is_equal(const struct lttng_condition *_a,
+                                                 const struct lttng_condition *_b)
 {
        bool is_equal = false;
        struct lttng_condition_buffer_usage *a, *b;
@@ -146,7 +133,7 @@ bool lttng_condition_buffer_usage_is_equal(const struct lttng_condition *_a,
        b = lttng::utils::container_of(_b, &lttng_condition_buffer_usage::parent);
 
        if ((a->threshold_ratio.set && !b->threshold_ratio.set) ||
-                       (a->threshold_bytes.set && !b->threshold_bytes.set)) {
+           (a->threshold_bytes.set && !b->threshold_bytes.set)) {
                goto end;
        }
 
@@ -193,9 +180,9 @@ end:
        return is_equal;
 }
 
-static enum lttng_error_code lttng_condition_buffer_usage_mi_serialize(
-               const struct lttng_condition *condition,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_condition_buffer_usage_mi_serialize(const struct lttng_condition *condition,
+                                         struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -210,22 +197,18 @@ static enum lttng_error_code lttng_condition_buffer_usage_mi_serialize(
        LTTNG_ASSERT(condition);
        LTTNG_ASSERT(IS_USAGE_CONDITION(condition));
 
-       status = lttng_condition_buffer_usage_get_session_name(
-                       condition, &session_name);
+       status = lttng_condition_buffer_usage_get_session_name(condition, &session_name);
        LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
        LTTNG_ASSERT(session_name);
 
-       status = lttng_condition_buffer_usage_get_channel_name(
-                       condition, &channel_name);
+       status = lttng_condition_buffer_usage_get_channel_name(condition, &channel_name);
        LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
        LTTNG_ASSERT(session_name);
 
-       status = lttng_condition_buffer_usage_get_domain_type(
-                       condition, &domain_type);
+       status = lttng_condition_buffer_usage_get_domain_type(condition, &domain_type);
        LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
 
-       status = lttng_condition_buffer_usage_get_threshold(
-                       condition, &threshold_bytes);
+       status = lttng_condition_buffer_usage_get_threshold(condition, &threshold_bytes);
        if (status == LTTNG_CONDITION_STATUS_OK) {
                is_threshold_bytes = true;
        } else if (status != LTTNG_CONDITION_STATUS_UNSET) {
@@ -235,19 +218,17 @@ static enum lttng_error_code lttng_condition_buffer_usage_mi_serialize(
        }
 
        if (!is_threshold_bytes) {
-               status = lttng_condition_buffer_usage_get_threshold_ratio(
-                               condition, &threshold_ratio);
+               status = lttng_condition_buffer_usage_get_threshold_ratio(condition,
+                                                                         &threshold_ratio);
                LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
        }
 
        switch (lttng_condition_get_type(condition)) {
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH:
-               condition_type_str =
-                               mi_lttng_element_condition_buffer_usage_high;
+               condition_type_str = mi_lttng_element_condition_buffer_usage_high;
                break;
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW:
-               condition_type_str =
-                               mi_lttng_element_condition_buffer_usage_low;
+               condition_type_str = mi_lttng_element_condition_buffer_usage_low;
                break;
        default:
                abort();
@@ -262,39 +243,36 @@ static enum lttng_error_code lttng_condition_buffer_usage_mi_serialize(
 
        /* Session name. */
        ret = mi_lttng_writer_write_element_string(
-                       writer, mi_lttng_element_session_name, session_name);
+               writer, mi_lttng_element_session_name, session_name);
        if (ret) {
                goto mi_error;
        }
 
        /* Channel name. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_condition_channel_name, channel_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_condition_channel_name, channel_name);
        if (ret) {
                goto mi_error;
        }
 
        /* Domain. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_domain,
-                       mi_lttng_domaintype_string(domain_type));
+       ret = mi_lttng_writer_write_element_string(
+               writer, config_element_domain, mi_lttng_domaintype_string(domain_type));
        if (ret) {
                goto mi_error;
        }
 
        if (is_threshold_bytes) {
                /* Usage in bytes. */
-               ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                               mi_lttng_element_condition_threshold_bytes,
-                               threshold_bytes);
+               ret = mi_lttng_writer_write_element_unsigned_int(
+                       writer, mi_lttng_element_condition_threshold_bytes, threshold_bytes);
                if (ret) {
                        goto mi_error;
                }
        } else {
                /* Ratio. */
-               ret = mi_lttng_writer_write_element_double(writer,
-                               mi_lttng_element_condition_threshold_ratio,
-                               threshold_ratio);
+               ret = mi_lttng_writer_write_element_double(
+                       writer, mi_lttng_element_condition_threshold_ratio, threshold_ratio);
                if (ret) {
                        goto mi_error;
                }
@@ -315,9 +293,7 @@ end:
        return ret_code;
 }
 
-static
-struct lttng_condition *lttng_condition_buffer_usage_create(
-               enum lttng_condition_type type)
+static struct lttng_condition *lttng_condition_buffer_usage_create(enum lttng_condition_type type)
 {
        struct lttng_condition_buffer_usage *condition;
 
@@ -337,19 +313,16 @@ struct lttng_condition *lttng_condition_buffer_usage_create(
 
 struct lttng_condition *lttng_condition_buffer_usage_low_create(void)
 {
-       return lttng_condition_buffer_usage_create(
-                       LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW);
+       return lttng_condition_buffer_usage_create(LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW);
 }
 
 struct lttng_condition *lttng_condition_buffer_usage_high_create(void)
 {
-       return lttng_condition_buffer_usage_create(
-                       LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH);
+       return lttng_condition_buffer_usage_create(LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH);
 }
 
-static
-ssize_t init_condition_from_payload(struct lttng_condition *condition,
-               struct lttng_payload_view *src_view)
+static ssize_t init_condition_from_payload(struct lttng_condition *condition,
+                                          struct lttng_payload_view *src_view)
 {
        ssize_t ret, condition_size;
        enum lttng_condition_status status;
@@ -358,8 +331,7 @@ ssize_t init_condition_from_payload(struct lttng_condition *condition,
        struct lttng_buffer_view names_view;
        const struct lttng_condition_buffer_usage_comm *condition_comm;
        const struct lttng_payload_view condition_comm_view =
-                       lttng_payload_view_from_view(
-                                       src_view, 0, sizeof(*condition_comm));
+               lttng_payload_view_from_view(src_view, 0, sizeof(*condition_comm));
 
        if (!lttng_payload_view_is_valid(&condition_comm_view)) {
                ERR("Failed to initialize from malformed condition buffer: buffer too short to contain header");
@@ -368,30 +340,28 @@ ssize_t init_condition_from_payload(struct lttng_condition *condition,
        }
 
        condition_comm = (typeof(condition_comm)) condition_comm_view.buffer.data;
-       names_view = lttng_buffer_view_from_view(&src_view->buffer,
-                       sizeof(*condition_comm), -1);
+       names_view = lttng_buffer_view_from_view(&src_view->buffer, sizeof(*condition_comm), -1);
 
        if (condition_comm->session_name_len > LTTNG_NAME_MAX ||
-                       condition_comm->channel_name_len > LTTNG_NAME_MAX) {
+           condition_comm->channel_name_len > LTTNG_NAME_MAX) {
                ERR("Failed to initialize from malformed condition buffer: name exceeds LTTNG_MAX_NAME");
                ret = -1;
                goto end;
        }
 
        if (names_view.size <
-                       (condition_comm->session_name_len +
-                       condition_comm->channel_name_len)) {
+           (condition_comm->session_name_len + condition_comm->channel_name_len)) {
                ERR("Failed to initialize from malformed condition buffer: buffer too short to contain element names");
                ret = -1;
                goto end;
        }
 
        if (condition_comm->threshold_set_in_bytes) {
-               status = lttng_condition_buffer_usage_set_threshold(condition,
-                               condition_comm->threshold_bytes);
+               status = lttng_condition_buffer_usage_set_threshold(
+                       condition, condition_comm->threshold_bytes);
        } else {
                status = lttng_condition_buffer_usage_set_threshold_ratio(
-                               condition, condition_comm->threshold_ratio);
+                       condition, condition_comm->threshold_ratio);
        }
 
        if (status != LTTNG_CONDITION_STATUS_OK) {
@@ -401,17 +371,16 @@ ssize_t init_condition_from_payload(struct lttng_condition *condition,
        }
 
        if (condition_comm->domain_type <= LTTNG_DOMAIN_NONE ||
-                       condition_comm->domain_type > LTTNG_DOMAIN_PYTHON) {
+           condition_comm->domain_type > LTTNG_DOMAIN_PYTHON) {
                /* Invalid domain value. */
                ERR("Invalid domain type value (%i) found in condition buffer",
-                               (int) condition_comm->domain_type);
+                   (int) condition_comm->domain_type);
                ret = -1;
                goto end;
        }
 
        domain_type = (enum lttng_domain_type) condition_comm->domain_type;
-       status = lttng_condition_buffer_usage_set_domain_type(condition,
-                       domain_type);
+       status = lttng_condition_buffer_usage_set_domain_type(condition, domain_type);
        if (status != LTTNG_CONDITION_STATUS_OK) {
                ERR("Failed to set buffer usage condition domain");
                ret = -1;
@@ -432,16 +401,14 @@ ssize_t init_condition_from_payload(struct lttng_condition *condition,
                goto end;
        }
 
-       status = lttng_condition_buffer_usage_set_session_name(condition,
-                       session_name);
+       status = lttng_condition_buffer_usage_set_session_name(condition, session_name);
        if (status != LTTNG_CONDITION_STATUS_OK) {
                ERR("Failed to set buffer usage session name");
                ret = -1;
                goto end;
        }
 
-       status = lttng_condition_buffer_usage_set_channel_name(condition,
-                       channel_name);
+       status = lttng_condition_buffer_usage_set_channel_name(condition, channel_name);
        if (status != LTTNG_CONDITION_STATUS_OK) {
                ERR("Failed to set buffer usage channel name");
                ret = -1;
@@ -453,21 +420,18 @@ ssize_t init_condition_from_payload(struct lttng_condition *condition,
                goto end;
        }
 
-       condition_size = sizeof(*condition_comm) +
-                       (ssize_t) condition_comm->session_name_len +
-                       (ssize_t) condition_comm->channel_name_len;
+       condition_size = sizeof(*condition_comm) + (ssize_t) condition_comm->session_name_len +
+               (ssize_t) condition_comm->channel_name_len;
        ret = condition_size;
 end:
        return ret;
 }
 
-ssize_t lttng_condition_buffer_usage_low_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_condition **_condition)
+ssize_t lttng_condition_buffer_usage_low_create_from_payload(struct lttng_payload_view *view,
+                                                            struct lttng_condition **_condition)
 {
        ssize_t ret;
-       struct lttng_condition *condition =
-                       lttng_condition_buffer_usage_low_create();
+       struct lttng_condition *condition = lttng_condition_buffer_usage_low_create();
 
        if (!_condition || !condition) {
                ret = -1;
@@ -486,13 +450,11 @@ error:
        return ret;
 }
 
-ssize_t lttng_condition_buffer_usage_high_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_condition **_condition)
+ssize_t lttng_condition_buffer_usage_high_create_from_payload(struct lttng_payload_view *view,
+                                                             struct lttng_condition **_condition)
 {
        ssize_t ret;
-       struct lttng_condition *condition =
-                       lttng_condition_buffer_usage_high_create();
+       struct lttng_condition *condition = lttng_condition_buffer_usage_high_create();
 
        if (!_condition || !condition) {
                ret = -1;
@@ -511,28 +473,24 @@ error:
        return ret;
 }
 
-static
-struct lttng_evaluation *create_evaluation_from_payload(
-               enum lttng_condition_type type,
-               struct lttng_payload_view *view)
+static struct lttng_evaluation *create_evaluation_from_payload(enum lttng_condition_type type,
+                                                              struct lttng_payload_view *view)
 {
-       const struct lttng_evaluation_buffer_usage_comm *comm =
-                       (typeof(comm)) view->buffer.data;
+       const struct lttng_evaluation_buffer_usage_comm *comm = (typeof(comm)) view->buffer.data;
        struct lttng_evaluation *evaluation = NULL;
 
        if (view->buffer.size < sizeof(*comm)) {
                goto end;
        }
 
-       evaluation = lttng_evaluation_buffer_usage_create(type,
-                       comm->buffer_use, comm->buffer_capacity);
+       evaluation =
+               lttng_evaluation_buffer_usage_create(type, comm->buffer_use, comm->buffer_capacity);
 end:
        return evaluation;
 }
 
-ssize_t lttng_evaluation_buffer_usage_low_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_evaluation **_evaluation)
+ssize_t lttng_evaluation_buffer_usage_low_create_from_payload(struct lttng_payload_view *view,
+                                                             struct lttng_evaluation **_evaluation)
 {
        ssize_t ret;
        struct lttng_evaluation *evaluation = NULL;
@@ -542,8 +500,7 @@ ssize_t lttng_evaluation_buffer_usage_low_create_from_payload(
                goto error;
        }
 
-       evaluation = create_evaluation_from_payload(
-                       LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW, view);
+       evaluation = create_evaluation_from_payload(LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW, view);
        if (!evaluation) {
                ret = -1;
                goto error;
@@ -557,9 +514,9 @@ error:
        return ret;
 }
 
-ssize_t lttng_evaluation_buffer_usage_high_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_evaluation **_evaluation)
+ssize_t
+lttng_evaluation_buffer_usage_high_create_from_payload(struct lttng_payload_view *view,
+                                                      struct lttng_evaluation **_evaluation)
 {
        ssize_t ret;
        struct lttng_evaluation *evaluation = NULL;
@@ -569,8 +526,7 @@ ssize_t lttng_evaluation_buffer_usage_high_create_from_payload(
                goto error;
        }
 
-       evaluation = create_evaluation_from_payload(
-                       LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH, view);
+       evaluation = create_evaluation_from_payload(LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH, view);
        if (!evaluation) {
                ret = -1;
                goto error;
@@ -585,21 +541,18 @@ error:
 }
 
 enum lttng_condition_status
-lttng_condition_buffer_usage_get_threshold_ratio(
-               const struct lttng_condition *condition,
-               double *threshold_ratio)
+lttng_condition_buffer_usage_get_threshold_ratio(const struct lttng_condition *condition,
+                                                double *threshold_ratio)
 {
        struct lttng_condition_buffer_usage *usage;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
 
-       if (!condition || !IS_USAGE_CONDITION(condition) ||
-                       !threshold_ratio) {
+       if (!condition || !IS_USAGE_CONDITION(condition) || !threshold_ratio) {
                status = LTTNG_CONDITION_STATUS_INVALID;
                goto end;
        }
 
-       usage = lttng::utils::container_of(condition,
-                       &lttng_condition_buffer_usage::parent);
+       usage = lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
        if (!usage->threshold_ratio.set) {
                status = LTTNG_CONDITION_STATUS_UNSET;
                goto end;
@@ -611,21 +564,19 @@ end:
 
 /* threshold_ratio expressed as [0.0, 1.0]. */
 enum lttng_condition_status
-lttng_condition_buffer_usage_set_threshold_ratio(
-               struct lttng_condition *condition, double threshold_ratio)
+lttng_condition_buffer_usage_set_threshold_ratio(struct lttng_condition *condition,
+                                                double threshold_ratio)
 {
        struct lttng_condition_buffer_usage *usage;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
 
-       if (!condition || !IS_USAGE_CONDITION(condition) ||
-                       threshold_ratio < 0.0 ||
-                       threshold_ratio > 1.0) {
+       if (!condition || !IS_USAGE_CONDITION(condition) || threshold_ratio < 0.0 ||
+           threshold_ratio > 1.0) {
                status = LTTNG_CONDITION_STATUS_INVALID;
                goto end;
        }
 
-       usage = lttng::utils::container_of(condition,
-                       &lttng_condition_buffer_usage::parent);
+       usage = lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
        usage->threshold_ratio.set = true;
        usage->threshold_bytes.set = false;
        usage->threshold_ratio.value = threshold_ratio;
@@ -634,9 +585,8 @@ end:
 }
 
 enum lttng_condition_status
-lttng_condition_buffer_usage_get_threshold(
-               const struct lttng_condition *condition,
-               uint64_t *threshold_bytes)
+lttng_condition_buffer_usage_get_threshold(const struct lttng_condition *condition,
+                                          uint64_t *threshold_bytes)
 {
        struct lttng_condition_buffer_usage *usage;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
@@ -646,8 +596,7 @@ lttng_condition_buffer_usage_get_threshold(
                goto end;
        }
 
-       usage = lttng::utils::container_of(condition,
-                       &lttng_condition_buffer_usage::parent);
+       usage = lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
        if (!usage->threshold_bytes.set) {
                status = LTTNG_CONDITION_STATUS_UNSET;
                goto end;
@@ -658,8 +607,8 @@ end:
 }
 
 enum lttng_condition_status
-lttng_condition_buffer_usage_set_threshold(
-               struct lttng_condition *condition, uint64_t threshold_bytes)
+lttng_condition_buffer_usage_set_threshold(struct lttng_condition *condition,
+                                          uint64_t threshold_bytes)
 {
        struct lttng_condition_buffer_usage *usage;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
@@ -669,8 +618,7 @@ lttng_condition_buffer_usage_set_threshold(
                goto end;
        }
 
-       usage = lttng::utils::container_of(condition,
-                       &lttng_condition_buffer_usage::parent);
+       usage = lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
        usage->threshold_ratio.set = false;
        usage->threshold_bytes.set = true;
        usage->threshold_bytes.value = threshold_bytes;
@@ -679,9 +627,8 @@ end:
 }
 
 enum lttng_condition_status
-lttng_condition_buffer_usage_get_session_name(
-               const struct lttng_condition *condition,
-               const char **session_name)
+lttng_condition_buffer_usage_get_session_name(const struct lttng_condition *condition,
+                                             const char **session_name)
 {
        struct lttng_condition_buffer_usage *usage;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
@@ -691,8 +638,7 @@ lttng_condition_buffer_usage_get_session_name(
                goto end;
        }
 
-       usage = lttng::utils::container_of(condition,
-                       &lttng_condition_buffer_usage::parent);
+       usage = lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
        if (!usage->session_name) {
                status = LTTNG_CONDITION_STATUS_UNSET;
                goto end;
@@ -703,21 +649,20 @@ end:
 }
 
 enum lttng_condition_status
-lttng_condition_buffer_usage_set_session_name(
-               struct lttng_condition *condition, const char *session_name)
+lttng_condition_buffer_usage_set_session_name(struct lttng_condition *condition,
+                                             const char *session_name)
 {
        char *session_name_copy;
        struct lttng_condition_buffer_usage *usage;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
 
        if (!condition || !IS_USAGE_CONDITION(condition) || !session_name ||
-                       strlen(session_name) == 0) {
+           strlen(session_name) == 0) {
                status = LTTNG_CONDITION_STATUS_INVALID;
                goto end;
        }
 
-       usage = lttng::utils::container_of(condition,
-                       &lttng_condition_buffer_usage::parent);
+       usage = lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
        session_name_copy = strdup(session_name);
        if (!session_name_copy) {
                status = LTTNG_CONDITION_STATUS_ERROR;
@@ -733,9 +678,8 @@ end:
 }
 
 enum lttng_condition_status
-lttng_condition_buffer_usage_get_channel_name(
-               const struct lttng_condition *condition,
-               const char **channel_name)
+lttng_condition_buffer_usage_get_channel_name(const struct lttng_condition *condition,
+                                             const char **channel_name)
 {
        struct lttng_condition_buffer_usage *usage;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
@@ -745,8 +689,7 @@ lttng_condition_buffer_usage_get_channel_name(
                goto end;
        }
 
-       usage = lttng::utils::container_of(condition,
-                       &lttng_condition_buffer_usage::parent);
+       usage = lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
        if (!usage->channel_name) {
                status = LTTNG_CONDITION_STATUS_UNSET;
                goto end;
@@ -757,21 +700,20 @@ end:
 }
 
 enum lttng_condition_status
-lttng_condition_buffer_usage_set_channel_name(
-               struct lttng_condition *condition, const char *channel_name)
+lttng_condition_buffer_usage_set_channel_name(struct lttng_condition *condition,
+                                             const char *channel_name)
 {
        char *channel_name_copy;
        struct lttng_condition_buffer_usage *usage;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
 
        if (!condition || !IS_USAGE_CONDITION(condition) || !channel_name ||
-                       strlen(channel_name) == 0) {
+           strlen(channel_name) == 0) {
                status = LTTNG_CONDITION_STATUS_INVALID;
                goto end;
        }
 
-       usage = lttng::utils::container_of(condition,
-                       &lttng_condition_buffer_usage::parent);
+       usage = lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
        channel_name_copy = strdup(channel_name);
        if (!channel_name_copy) {
                status = LTTNG_CONDITION_STATUS_ERROR;
@@ -787,9 +729,8 @@ end:
 }
 
 enum lttng_condition_status
-lttng_condition_buffer_usage_get_domain_type(
-               const struct lttng_condition *condition,
-               enum lttng_domain_type *type)
+lttng_condition_buffer_usage_get_domain_type(const struct lttng_condition *condition,
+                                            enum lttng_domain_type *type)
 {
        struct lttng_condition_buffer_usage *usage;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
@@ -799,8 +740,7 @@ lttng_condition_buffer_usage_get_domain_type(
                goto end;
        }
 
-       usage = lttng::utils::container_of(condition,
-                       &lttng_condition_buffer_usage::parent);
+       usage = lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
        if (!usage->domain.set) {
                status = LTTNG_CONDITION_STATUS_UNSET;
                goto end;
@@ -811,56 +751,48 @@ end:
 }
 
 enum lttng_condition_status
-lttng_condition_buffer_usage_set_domain_type(
-               struct lttng_condition *condition, enum lttng_domain_type type)
+lttng_condition_buffer_usage_set_domain_type(struct lttng_condition *condition,
+                                            enum lttng_domain_type type)
 {
        struct lttng_condition_buffer_usage *usage;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
 
-       if (!condition || !IS_USAGE_CONDITION(condition) ||
-                       type == LTTNG_DOMAIN_NONE) {
+       if (!condition || !IS_USAGE_CONDITION(condition) || type == LTTNG_DOMAIN_NONE) {
                status = LTTNG_CONDITION_STATUS_INVALID;
                goto end;
        }
 
-       usage = lttng::utils::container_of(condition,
-                       &lttng_condition_buffer_usage::parent);
+       usage = lttng::utils::container_of(condition, &lttng_condition_buffer_usage::parent);
        usage->domain.set = true;
        usage->domain.type = type;
 end:
        return status;
 }
 
-static
-int lttng_evaluation_buffer_usage_serialize(
-               const struct lttng_evaluation *evaluation,
-               struct lttng_payload *payload)
+static int lttng_evaluation_buffer_usage_serialize(const struct lttng_evaluation *evaluation,
+                                                  struct lttng_payload *payload)
 {
        struct lttng_evaluation_buffer_usage *usage;
        struct lttng_evaluation_buffer_usage_comm comm;
 
-       usage = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_buffer_usage::parent);
+       usage = lttng::utils::container_of(evaluation, &lttng_evaluation_buffer_usage::parent);
        comm.buffer_use = usage->buffer_use;
        comm.buffer_capacity = usage->buffer_capacity;
 
-       return lttng_dynamic_buffer_append(
-                       &payload->buffer, &comm, sizeof(comm));
+       return lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
 }
 
-static
-void lttng_evaluation_buffer_usage_destroy(
-               struct lttng_evaluation *evaluation)
+static void lttng_evaluation_buffer_usage_destroy(struct lttng_evaluation *evaluation)
 {
        struct lttng_evaluation_buffer_usage *usage;
 
-       usage = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_buffer_usage::parent);
+       usage = lttng::utils::container_of(evaluation, &lttng_evaluation_buffer_usage::parent);
        free(usage);
 }
 
-struct lttng_evaluation *lttng_evaluation_buffer_usage_create(
-               enum lttng_condition_type type, uint64_t use, uint64_t capacity)
+struct lttng_evaluation *lttng_evaluation_buffer_usage_create(enum lttng_condition_type type,
+                                                             uint64_t use,
+                                                             uint64_t capacity)
 {
        struct lttng_evaluation_buffer_usage *usage;
 
@@ -883,8 +815,8 @@ end:
  * evaluate to "true".
  */
 enum lttng_evaluation_status
-lttng_evaluation_buffer_usage_get_usage_ratio(
-               const struct lttng_evaluation *evaluation, double *usage_ratio)
+lttng_evaluation_buffer_usage_get_usage_ratio(const struct lttng_evaluation *evaluation,
+                                             double *usage_ratio)
 {
        struct lttng_evaluation_buffer_usage *usage;
        enum lttng_evaluation_status status = LTTNG_EVALUATION_STATUS_OK;
@@ -894,18 +826,15 @@ lttng_evaluation_buffer_usage_get_usage_ratio(
                goto end;
        }
 
-       usage = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_buffer_usage::parent);
-       *usage_ratio = (double) usage->buffer_use /
-                       (double) usage->buffer_capacity;
+       usage = lttng::utils::container_of(evaluation, &lttng_evaluation_buffer_usage::parent);
+       *usage_ratio = (double) usage->buffer_use / (double) usage->buffer_capacity;
 end:
        return status;
 }
 
 enum lttng_evaluation_status
-lttng_evaluation_buffer_usage_get_usage(
-               const struct lttng_evaluation *evaluation,
-               uint64_t *usage_bytes)
+lttng_evaluation_buffer_usage_get_usage(const struct lttng_evaluation *evaluation,
+                                       uint64_t *usage_bytes)
 {
        struct lttng_evaluation_buffer_usage *usage;
        enum lttng_evaluation_status status = LTTNG_EVALUATION_STATUS_OK;
@@ -915,8 +844,7 @@ lttng_evaluation_buffer_usage_get_usage(
                goto end;
        }
 
-       usage = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_buffer_usage::parent);
+       usage = lttng::utils::container_of(evaluation, &lttng_evaluation_buffer_usage::parent);
        *usage_bytes = usage->buffer_use;
 end:
        return status;
index 1efab164d8c39610b509c32a1e898cf041836623..a814330eb817c453ca5a9f085897716d457f6fbc 100644 (file)
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/mi-lttng.hpp>
+
 #include <lttng/condition/buffer-usage-internal.hpp>
 #include <lttng/condition/condition-internal.hpp>
 #include <lttng/condition/event-rule-matches-internal.hpp>
 #include <lttng/condition/session-consumed-size-internal.hpp>
 #include <lttng/condition/session-rotation-internal.hpp>
 #include <lttng/error-query-internal.hpp>
+
 #include <stdbool.h>
 
-enum lttng_condition_type lttng_condition_get_type(
-               const struct lttng_condition *condition)
+enum lttng_condition_type lttng_condition_get_type(const struct lttng_condition *condition)
 {
        return condition ? condition->type : LTTNG_CONDITION_TYPE_UNKNOWN;
 }
@@ -31,8 +32,7 @@ void lttng_condition_destroy(struct lttng_condition *condition)
 
 static void condition_destroy_ref(struct urcu_ref *ref)
 {
-       struct lttng_condition *condition =
-               lttng::utils::container_of(ref, &lttng_condition::ref);
+       struct lttng_condition *condition = lttng::utils::container_of(ref, &lttng_condition::ref);
 
        condition->destroy(condition);
 }
@@ -52,7 +52,6 @@ void lttng_condition_put(struct lttng_condition *condition)
        urcu_ref_put(&condition->ref, condition_destroy_ref);
 }
 
-
 bool lttng_condition_validate(const struct lttng_condition *condition)
 {
        bool valid;
@@ -74,7 +73,7 @@ end:
 }
 
 int lttng_condition_serialize(const struct lttng_condition *condition,
-               struct lttng_payload *payload)
+                             struct lttng_payload *payload)
 {
        int ret;
        struct lttng_condition_comm condition_comm = {};
@@ -86,8 +85,8 @@ int lttng_condition_serialize(const struct lttng_condition *condition,
 
        condition_comm.condition_type = (int8_t) condition->type;
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &condition_comm,
-                       sizeof(condition_comm));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &condition_comm, sizeof(condition_comm));
        if (ret) {
                goto end;
        }
@@ -100,8 +99,7 @@ end:
        return ret;
 }
 
-bool lttng_condition_is_equal(const struct lttng_condition *a,
-               const struct lttng_condition *b)
+bool lttng_condition_is_equal(const struct lttng_condition *a, const struct lttng_condition *b)
 {
        bool is_equal = false;
 
@@ -123,16 +121,14 @@ end:
        return is_equal;
 }
 
-ssize_t lttng_condition_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_condition **condition)
+ssize_t lttng_condition_create_from_payload(struct lttng_payload_view *view,
+                                           struct lttng_condition **condition)
 {
        ssize_t ret, condition_size = 0;
        condition_create_from_payload_cb create_from_payload = NULL;
        const struct lttng_condition_comm *condition_comm;
        const struct lttng_payload_view condition_comm_view =
-                       lttng_payload_view_from_view(
-                                       view, 0, sizeof(*condition_comm));
+               lttng_payload_view_from_view(view, 0, sizeof(*condition_comm));
 
        if (!view || !condition) {
                ret = -1;
@@ -163,23 +159,22 @@ ssize_t lttng_condition_create_from_payload(
                create_from_payload = lttng_condition_session_rotation_ongoing_create_from_payload;
                break;
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED:
-               create_from_payload = lttng_condition_session_rotation_completed_create_from_payload;
+               create_from_payload =
+                       lttng_condition_session_rotation_completed_create_from_payload;
                break;
        case LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES:
-               create_from_payload =
-                               lttng_condition_event_rule_matches_create_from_payload;
+               create_from_payload = lttng_condition_event_rule_matches_create_from_payload;
                break;
        default:
                ERR("Attempted to create condition of unknown type (%i)",
-                               (int) condition_comm->condition_type);
+                   (int) condition_comm->condition_type);
                ret = -1;
                goto end;
        }
 
        if (create_from_payload) {
                struct lttng_payload_view condition_view =
-                               lttng_payload_view_from_view(view,
-                                       sizeof(*condition_comm), -1);
+                       lttng_payload_view_from_view(view, sizeof(*condition_comm), -1);
 
                ret = create_from_payload(&condition_view, condition);
                if (ret < 0) {
@@ -196,8 +191,7 @@ end:
        return ret;
 }
 
-void lttng_condition_init(struct lttng_condition *condition,
-               enum lttng_condition_type type)
+void lttng_condition_init(struct lttng_condition *condition, enum lttng_condition_type type)
 {
        condition->type = type;
        urcu_ref_init(&condition->ref);
@@ -232,11 +226,11 @@ const char *lttng_condition_type_str(enum lttng_condition_type type)
        }
 }
 
-enum lttng_error_code lttng_condition_mi_serialize(
-               const struct lttng_trigger *trigger,
-               const struct lttng_condition *condition,
-               struct mi_writer *writer,
-               const struct mi_lttng_error_query_callbacks *error_query_callbacks)
+enum lttng_error_code
+lttng_condition_mi_serialize(const struct lttng_trigger *trigger,
+                            const struct lttng_condition *condition,
+                            struct mi_writer *writer,
+                            const struct mi_lttng_error_query_callbacks *error_query_callbacks)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -260,14 +254,12 @@ enum lttng_error_code lttng_condition_mi_serialize(
 
        /* Serialize error query results for the action. */
        if (error_query_callbacks && error_query_callbacks->action_cb) {
-               ret_code = error_query_callbacks->condition_cb(
-                               trigger, &error_query_results);
+               ret_code = error_query_callbacks->condition_cb(trigger, &error_query_results);
                if (ret_code != LTTNG_OK) {
                        goto end;
                }
 
-               ret_code = lttng_error_query_results_mi_serialize(
-                               error_query_results, writer);
+               ret_code = lttng_error_query_results_mi_serialize(error_query_results, writer);
                if (ret_code != LTTNG_OK) {
                        goto end;
                }
index d302500c68a10aeefb381cc92e877167140586c9..41743e0e7d0495f87bb7690263c4fdab5b43acbc 100644 (file)
@@ -8,8 +8,7 @@
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/mi-lttng.hpp>
-#include <inttypes.h>
-#include <limits.h>
+
 #include <lttng/condition/condition-internal.hpp>
 #include <lttng/condition/event-rule-matches-internal.hpp>
 #include <lttng/condition/event-rule-matches.h>
 #include <lttng/event-field-value-internal.hpp>
 #include <lttng/event-rule/event-rule-internal.hpp>
 #include <lttng/lttng-error.h>
+
+#include <vendor/msgpack/msgpack.h>
+
+#include <inttypes.h>
+#include <limits.h>
 #include <stdbool.h>
 #include <stdint.h>
-#include <vendor/msgpack/msgpack.h>
 
 #define IS_EVENT_RULE_MATCHES_CONDITION(condition) \
-       (lttng_condition_get_type(condition) ==    \
-                       LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES)
+       (lttng_condition_get_type(condition) == LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES)
 
-static bool is_event_rule_matches_evaluation(
-               const struct lttng_evaluation *evaluation)
+static bool is_event_rule_matches_evaluation(const struct lttng_evaluation *evaluation)
 {
        enum lttng_condition_type type = lttng_evaluation_get_type(evaluation);
 
        return type == LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES;
 }
 
-static bool lttng_condition_event_rule_matches_validate(
-               const struct lttng_condition *condition);
-static int lttng_condition_event_rule_matches_serialize(
-               const struct lttng_condition *condition,
-               struct lttng_payload *payload);
-static bool lttng_condition_event_rule_matches_is_equal(
-               const struct lttng_condition *_a,
-               const struct lttng_condition *_b);
-static void lttng_condition_event_rule_matches_destroy(
-               struct lttng_condition *condition);
-
-static bool lttng_condition_event_rule_matches_validate(
-               const struct lttng_condition *condition)
+static bool lttng_condition_event_rule_matches_validate(const struct lttng_condition *condition);
+static int lttng_condition_event_rule_matches_serialize(const struct lttng_condition *condition,
+                                                       struct lttng_payload *payload);
+static bool lttng_condition_event_rule_matches_is_equal(const struct lttng_condition *_a,
+                                                       const struct lttng_condition *_b);
+static void lttng_condition_event_rule_matches_destroy(struct lttng_condition *condition);
+
+static bool lttng_condition_event_rule_matches_validate(const struct lttng_condition *condition)
 {
        bool valid = false;
        struct lttng_condition_event_rule_matches *event_rule;
@@ -55,8 +51,8 @@ static bool lttng_condition_event_rule_matches_validate(
                goto end;
        }
 
-       event_rule = lttng::utils::container_of(condition,
-                       &lttng_condition_event_rule_matches::parent);
+       event_rule =
+               lttng::utils::container_of(condition, &lttng_condition_event_rule_matches::parent);
        if (!event_rule->rule) {
                ERR("Invalid on event condition: a rule must be set");
                goto end;
@@ -119,15 +115,15 @@ static const char *msgpack_object_type_str(msgpack_object_type type)
  * Encoding is the length of `str` plus one (for the null character),
  * and then the string, including its null terminator.
  */
-static
-int serialize_cstr(const char *str, struct lttng_dynamic_buffer *buf)
+static int serialize_cstr(const char *str, struct lttng_dynamic_buffer *buf)
 {
        int ret;
        const uint32_t len = strlen(str) + 1;
 
        /* Serialize the length, including the null terminator. */
        DBG("Serializing C string's length (including null terminator): "
-                       "%" PRIu32, len);
+           "%" PRIu32,
+           len);
        ret = lttng_dynamic_buffer_append(buf, &len, sizeof(len));
        if (ret) {
                goto end;
@@ -147,9 +143,7 @@ end:
 /*
  * Serializes the event expression `expr` into `buf`.
  */
-static
-int serialize_event_expr(const struct lttng_event_expr *expr,
-               struct lttng_payload *payload)
+static int serialize_event_expr(const struct lttng_event_expr *expr, struct lttng_payload *payload)
 {
        const uint8_t type = expr->type;
        int ret;
@@ -167,12 +161,10 @@ int serialize_event_expr(const struct lttng_event_expr *expr,
        case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
        {
                const struct lttng_event_expr_field *field_expr =
-                               lttng::utils::container_of(expr,
-                                       &lttng_event_expr_field::parent);
+                       lttng::utils::container_of(expr, &lttng_event_expr_field::parent);
 
                /* Serialize the field name. */
-               DBG("Serializing field event expression's field name: '%s'",
-                               field_expr->name);
+               DBG("Serializing field event expression's field name: '%s'", field_expr->name);
                ret = serialize_cstr(field_expr->name, &payload->buffer);
                if (ret) {
                        goto end;
@@ -183,13 +175,13 @@ int serialize_event_expr(const struct lttng_event_expr *expr,
        case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
        {
                const struct lttng_event_expr_app_specific_context_field *field_expr =
-                               lttng::utils::container_of(expr,
-                                       &lttng_event_expr_app_specific_context_field::parent);
+                       lttng::utils::container_of(
+                               expr, &lttng_event_expr_app_specific_context_field::parent);
 
                /* Serialize the provider name. */
                DBG("Serializing app-specific context field event expression's "
-                               "provider name: '%s'",
-                               field_expr->provider_name);
+                   "provider name: '%s'",
+                   field_expr->provider_name);
                ret = serialize_cstr(field_expr->provider_name, &payload->buffer);
                if (ret) {
                        goto end;
@@ -197,8 +189,8 @@ int serialize_event_expr(const struct lttng_event_expr *expr,
 
                /* Serialize the type name. */
                DBG("Serializing app-specific context field event expression's "
-                               "type name: '%s'",
-                               field_expr->provider_name);
+                   "type name: '%s'",
+                   field_expr->provider_name);
                ret = serialize_cstr(field_expr->type_name, &payload->buffer);
                if (ret) {
                        goto end;
@@ -209,13 +201,14 @@ int serialize_event_expr(const struct lttng_event_expr *expr,
        case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
        {
                const struct lttng_event_expr_array_field_element *elem_expr =
-                               lttng::utils::container_of(expr,
-                                       &lttng_event_expr_array_field_element::parent);
+                       lttng::utils::container_of(expr,
+                                                  &lttng_event_expr_array_field_element::parent);
                const uint32_t index = elem_expr->index;
 
                /* Serialize the index. */
                DBG("Serializing array field element event expression's "
-                               "index: %u", elem_expr->index);
+                   "index: %u",
+                   elem_expr->index);
                ret = lttng_dynamic_buffer_append(&payload->buffer, &index, sizeof(index));
                if (ret) {
                        goto end;
@@ -223,7 +216,7 @@ int serialize_event_expr(const struct lttng_event_expr *expr,
 
                /* Serialize the parent array field expression. */
                DBG("Serializing array field element event expression's "
-                               "parent array field event expression");
+                   "parent array field event expression");
                ret = serialize_event_expr(elem_expr->array_field_expr, payload);
                if (ret) {
                        goto end;
@@ -241,11 +234,10 @@ end:
 
 static struct lttng_capture_descriptor *
 lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
-               const struct lttng_condition *condition, unsigned int index)
+       const struct lttng_condition *condition, unsigned int index)
 {
-       const struct lttng_condition_event_rule_matches
-                       *event_rule_matches_cond = lttng::utils::container_of(condition,
-                                       &lttng_condition_event_rule_matches::parent);
+       const struct lttng_condition_event_rule_matches *event_rule_matches_cond =
+               lttng::utils::container_of(condition, &lttng_condition_event_rule_matches::parent);
        struct lttng_capture_descriptor *desc = NULL;
        unsigned int count;
        enum lttng_condition_status status;
@@ -254,8 +246,7 @@ lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
                goto end;
        }
 
-       status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
-                       condition, &count);
+       status = lttng_condition_event_rule_matches_get_capture_descriptor_count(condition, &count);
        if (status != LTTNG_CONDITION_STATUS_OK) {
                goto end;
        }
@@ -265,14 +256,13 @@ lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
        }
 
        desc = (lttng_capture_descriptor *) lttng_dynamic_pointer_array_get_pointer(
-                       &event_rule_matches_cond->capture_descriptors, index);
+               &event_rule_matches_cond->capture_descriptors, index);
 end:
        return desc;
 }
 
-static int lttng_condition_event_rule_matches_serialize(
-               const struct lttng_condition *condition,
-               struct lttng_payload *payload)
+static int lttng_condition_event_rule_matches_serialize(const struct lttng_condition *condition,
+                                                       struct lttng_payload *payload)
 {
        int ret;
        struct lttng_condition_event_rule_matches *event_rule_matches_condition;
@@ -286,38 +276,36 @@ static int lttng_condition_event_rule_matches_serialize(
        }
 
        DBG("Serializing on event condition");
-       event_rule_matches_condition = lttng::utils::container_of(condition,
-                       &lttng_condition_event_rule_matches::parent);
+       event_rule_matches_condition =
+               lttng::utils::container_of(condition, &lttng_condition_event_rule_matches::parent);
 
        DBG("Serializing on event condition's event rule");
-       ret = lttng_event_rule_serialize(
-                       event_rule_matches_condition->rule, payload);
+       ret = lttng_event_rule_serialize(event_rule_matches_condition->rule, payload);
        if (ret) {
                goto end;
        }
 
        status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
-                       condition, &capture_descr_count);
+               condition, &capture_descr_count);
        if (status != LTTNG_CONDITION_STATUS_OK) {
                ret = -1;
                goto end;
        };
 
        DBG("Serializing on event condition's capture descriptor count: %" PRIu32,
-                       capture_descr_count);
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &capture_descr_count,
-                       sizeof(capture_descr_count));
+           capture_descr_count);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &capture_descr_count, sizeof(capture_descr_count));
        if (ret) {
                goto end;
        }
 
        for (i = 0; i < capture_descr_count; i++) {
                const struct lttng_capture_descriptor *desc =
-                               lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
-                                               condition, i);
+                       lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
+                               condition, i);
 
-               DBG("Serializing on event condition's capture descriptor %" PRIu32,
-                               i);
+               DBG("Serializing on event condition's capture descriptor %" PRIu32, i);
                ret = serialize_event_expr(desc->event_expression, payload);
                if (ret) {
                        goto end;
@@ -328,10 +316,8 @@ end:
        return ret;
 }
 
-static
-bool capture_descriptors_are_equal(
-               const struct lttng_condition *condition_a,
-               const struct lttng_condition *condition_b)
+static bool capture_descriptors_are_equal(const struct lttng_condition *condition_a,
+                                         const struct lttng_condition *condition_b)
 {
        bool is_equal = true;
        unsigned int capture_descr_count_a;
@@ -340,13 +326,13 @@ bool capture_descriptors_are_equal(
        enum lttng_condition_status status;
 
        status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
-                       condition_a, &capture_descr_count_a);
+               condition_a, &capture_descr_count_a);
        if (status != LTTNG_CONDITION_STATUS_OK) {
                goto not_equal;
        }
 
        status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
-                       condition_b, &capture_descr_count_b);
+               condition_b, &capture_descr_count_b);
        if (status != LTTNG_CONDITION_STATUS_OK) {
                goto not_equal;
        }
@@ -357,11 +343,11 @@ bool capture_descriptors_are_equal(
 
        for (i = 0; i < capture_descr_count_a; i++) {
                const struct lttng_event_expr *expr_a =
-                               lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
-                                               condition_a, i);
+                       lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
+                               condition_a, i);
                const struct lttng_event_expr *expr_b =
-                               lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
-                                               condition_b, i);
+                       lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
+                               condition_b, i);
 
                if (!lttng_event_expr_is_equal(expr_a, expr_b)) {
                        goto not_equal;
@@ -377,9 +363,8 @@ end:
        return is_equal;
 }
 
-static bool lttng_condition_event_rule_matches_is_equal(
-               const struct lttng_condition *_a,
-               const struct lttng_condition *_b)
+static bool lttng_condition_event_rule_matches_is_equal(const struct lttng_condition *_a,
+                                                       const struct lttng_condition *_b)
 {
        bool is_equal = false;
        struct lttng_condition_event_rule_matches *a, *b;
@@ -404,34 +389,30 @@ end:
        return is_equal;
 }
 
-static void lttng_condition_event_rule_matches_destroy(
-               struct lttng_condition *condition)
+static void lttng_condition_event_rule_matches_destroy(struct lttng_condition *condition)
 {
        struct lttng_condition_event_rule_matches *event_rule_matches_condition;
 
-       event_rule_matches_condition = lttng::utils::container_of(condition,
-                       &lttng_condition_event_rule_matches::parent);
+       event_rule_matches_condition =
+               lttng::utils::container_of(condition, &lttng_condition_event_rule_matches::parent);
 
        lttng_event_rule_put(event_rule_matches_condition->rule);
-       lttng_dynamic_pointer_array_reset(
-                       &event_rule_matches_condition->capture_descriptors);
+       lttng_dynamic_pointer_array_reset(&event_rule_matches_condition->capture_descriptors);
        free(event_rule_matches_condition);
 }
 
-static
-void destroy_capture_descriptor(void *ptr)
+static void destroy_capture_descriptor(void *ptr)
 {
-       struct lttng_capture_descriptor *desc =
-                       (struct lttng_capture_descriptor *) ptr;
+       struct lttng_capture_descriptor *desc = (struct lttng_capture_descriptor *) ptr;
 
        lttng_event_expr_destroy(desc->event_expression);
        free(desc->bytecode);
        free(desc);
 }
 
-static enum lttng_error_code lttng_condition_event_rule_matches_mi_serialize(
-               const struct lttng_condition *condition,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_condition_event_rule_matches_mi_serialize(const struct lttng_condition *condition,
+                                               struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -448,12 +429,11 @@ static enum lttng_error_code lttng_condition_event_rule_matches_mi_serialize(
        LTTNG_ASSERT(rule != NULL);
 
        status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
-                       condition, &capture_descriptor_count);
+               condition, &capture_descriptor_count);
        LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
 
        /* Open condition event rule matches element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_condition_event_rule_matches);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_condition_event_rule_matches);
        if (ret) {
                goto mi_error;
        }
@@ -465,8 +445,7 @@ static enum lttng_error_code lttng_condition_event_rule_matches_mi_serialize(
        }
 
        /* Open the capture descriptors element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_capture_descriptors);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_capture_descriptors);
        if (ret) {
                goto mi_error;
        }
@@ -475,7 +454,7 @@ static enum lttng_error_code lttng_condition_event_rule_matches_mi_serialize(
                const struct lttng_event_expr *descriptor = NULL;
 
                descriptor = lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
-                               condition, i);
+                       condition, i);
                LTTNG_ASSERT(descriptor);
 
                ret_code = lttng_event_expr_mi_serialize(descriptor, writer);
@@ -504,8 +483,7 @@ end:
        return ret_code;
 }
 
-struct lttng_condition *lttng_condition_event_rule_matches_create(
-               struct lttng_event_rule *rule)
+struct lttng_condition *lttng_condition_event_rule_matches_create(struct lttng_event_rule *rule)
 {
        struct lttng_condition *parent = NULL;
        struct lttng_condition_event_rule_matches *condition = NULL;
@@ -519,12 +497,9 @@ struct lttng_condition *lttng_condition_event_rule_matches_create(
                return NULL;
        }
 
-       lttng_condition_init(&condition->parent,
-                       LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
-       condition->parent.validate =
-                       lttng_condition_event_rule_matches_validate,
-       condition->parent.serialize =
-                       lttng_condition_event_rule_matches_serialize,
+       lttng_condition_init(&condition->parent, LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
+       condition->parent.validate = lttng_condition_event_rule_matches_validate,
+       condition->parent.serialize = lttng_condition_event_rule_matches_serialize,
        condition->parent.equal = lttng_condition_event_rule_matches_is_equal,
        condition->parent.destroy = lttng_condition_event_rule_matches_destroy,
        condition->parent.mi_serialize = lttng_condition_event_rule_matches_mi_serialize,
@@ -534,20 +509,17 @@ struct lttng_condition *lttng_condition_event_rule_matches_create(
        rule = NULL;
 
        lttng_dynamic_pointer_array_init(&condition->capture_descriptors,
-                       destroy_capture_descriptor);
+                                        destroy_capture_descriptor);
 
        parent = &condition->parent;
 end:
        return parent;
 }
 
-static
-uint64_t uint_from_buffer(const struct lttng_buffer_view *view, size_t size,
-               size_t *offset)
+static uint64_t uint_from_buffer(const struct lttng_buffer_view *view, size_t size, size_t *offset)
 {
        uint64_t ret;
-       const struct lttng_buffer_view uint_view =
-                       lttng_buffer_view_from_view(view, *offset, size);
+       const struct lttng_buffer_view uint_view = lttng_buffer_view_from_view(view, *offset, size);
 
        if (!lttng_buffer_view_is_valid(&uint_view)) {
                ret = UINT64_C(-1);
@@ -579,9 +551,7 @@ end:
        return ret;
 }
 
-static
-const char *str_from_buffer(const struct lttng_buffer_view *view,
-               size_t *offset)
+static const char *str_from_buffer(const struct lttng_buffer_view *view, size_t *offset)
 {
        uint64_t len;
        const char *ret;
@@ -607,9 +577,8 @@ end:
        return ret;
 }
 
-static
-struct lttng_event_expr *event_expr_from_payload(
-               struct lttng_payload_view *view, size_t *offset)
+static struct lttng_event_expr *event_expr_from_payload(struct lttng_payload_view *view,
+                                                       size_t *offset)
 {
        struct lttng_event_expr *expr = NULL;
        const char *str;
@@ -652,15 +621,13 @@ struct lttng_event_expr *event_expr_from_payload(
                        goto error;
                }
 
-               expr = lttng_event_expr_app_specific_context_field_create(
-                               provider_name, type_name);
+               expr = lttng_event_expr_app_specific_context_field_create(provider_name, type_name);
                break;
        }
        case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
        {
                struct lttng_event_expr *array_field_expr;
-               const uint64_t index = uint_from_buffer(
-                               &view->buffer, sizeof(uint32_t), offset);
+               const uint64_t index = uint_from_buffer(&view->buffer, sizeof(uint32_t), offset);
 
                if (index == UINT64_C(-1)) {
                        goto error;
@@ -673,8 +640,8 @@ struct lttng_event_expr *event_expr_from_payload(
                }
 
                /* Move ownership of `array_field_expr` to new expression. */
-               expr = lttng_event_expr_array_field_element_create(
-                               array_field_expr, (unsigned int) index);
+               expr = lttng_event_expr_array_field_element_create(array_field_expr,
+                                                                  (unsigned int) index);
                if (!expr) {
                        /* `array_field_expr` not moved: destroy it. */
                        lttng_event_expr_destroy(array_field_expr);
@@ -684,7 +651,7 @@ struct lttng_event_expr *event_expr_from_payload(
        }
        default:
                ERR("Invalid event expression type encoutered while deserializing event expression: type = %" PRIu64,
-                               type);
+                   type);
                goto error;
        }
 
@@ -698,9 +665,8 @@ end:
        return expr;
 }
 
-ssize_t lttng_condition_event_rule_matches_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_condition **_condition)
+ssize_t lttng_condition_event_rule_matches_create_from_payload(struct lttng_payload_view *view,
+                                                              struct lttng_condition **_condition)
 {
        ssize_t consumed_length;
        size_t offset = 0;
@@ -716,10 +682,10 @@ ssize_t lttng_condition_event_rule_matches_create_from_payload(
        /* Struct lttng_event_rule. */
        {
                struct lttng_payload_view event_rule_view =
-                               lttng_payload_view_from_view(view, offset, -1);
+                       lttng_payload_view_from_view(view, offset, -1);
 
-               event_rule_length = lttng_event_rule_create_from_payload(
-                               &event_rule_view, &event_rule);
+               event_rule_length =
+                       lttng_event_rule_create_from_payload(&event_rule_view, &event_rule);
        }
 
        if (event_rule_length < 0 || !event_rule) {
@@ -744,16 +710,15 @@ ssize_t lttng_condition_event_rule_matches_create_from_payload(
        /* Capture descriptors. */
        for (i = 0; i < capture_descr_count; i++) {
                enum lttng_condition_status status;
-               struct lttng_event_expr *expr = event_expr_from_payload(
-                               view, &offset);
+               struct lttng_event_expr *expr = event_expr_from_payload(view, &offset);
 
                if (!expr) {
                        goto error;
                }
 
                /* Move ownership of `expr` to `condition`. */
-               status = lttng_condition_event_rule_matches_append_capture_descriptor(
-                               condition, expr);
+               status = lttng_condition_event_rule_matches_append_capture_descriptor(condition,
+                                                                                     expr);
                if (status != LTTNG_CONDITION_STATUS_OK) {
                        /* `expr` not moved: destroy it. */
                        lttng_event_expr_destroy(expr);
@@ -776,21 +741,19 @@ end:
 }
 
 enum lttng_condition_status
-lttng_condition_event_rule_matches_borrow_rule_mutable(
-               const struct lttng_condition *condition,
-               struct lttng_event_rule **rule)
+lttng_condition_event_rule_matches_borrow_rule_mutable(const struct lttng_condition *condition,
+                                                      struct lttng_event_rule **rule)
 {
        struct lttng_condition_event_rule_matches *event_rule;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
 
-       if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition) ||
-                       !rule) {
+       if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition) || !rule) {
                status = LTTNG_CONDITION_STATUS_INVALID;
                goto end;
        }
 
-       event_rule = lttng::utils::container_of(condition,
-                       &lttng_condition_event_rule_matches::parent);
+       event_rule =
+               lttng::utils::container_of(condition, &lttng_condition_event_rule_matches::parent);
        if (!event_rule->rule) {
                status = LTTNG_CONDITION_STATUS_UNSET;
                goto end;
@@ -801,56 +764,50 @@ end:
        return status;
 }
 
-enum lttng_condition_status lttng_condition_event_rule_matches_get_rule(
-               const struct lttng_condition *condition,
-               const struct lttng_event_rule **rule)
+enum lttng_condition_status
+lttng_condition_event_rule_matches_get_rule(const struct lttng_condition *condition,
+                                           const struct lttng_event_rule **rule)
 {
        struct lttng_event_rule *mutable_rule = NULL;
        const enum lttng_condition_status status =
-                       lttng_condition_event_rule_matches_borrow_rule_mutable(
-                                       condition, &mutable_rule);
+               lttng_condition_event_rule_matches_borrow_rule_mutable(condition, &mutable_rule);
 
        *rule = mutable_rule;
        return status;
 }
 
-void lttng_condition_event_rule_matches_set_error_counter_index(
-               struct lttng_condition *condition, uint64_t error_counter_index)
+void lttng_condition_event_rule_matches_set_error_counter_index(struct lttng_condition *condition,
+                                                               uint64_t error_counter_index)
 {
        struct lttng_condition_event_rule_matches *event_rule_matches_cond =
-                       lttng::utils::container_of(condition,
-                                       &lttng_condition_event_rule_matches::parent);
+               lttng::utils::container_of(condition, &lttng_condition_event_rule_matches::parent);
 
-       LTTNG_OPTIONAL_SET(&event_rule_matches_cond->error_counter_index,
-                       error_counter_index);
+       LTTNG_OPTIONAL_SET(&event_rule_matches_cond->error_counter_index, error_counter_index);
 }
 
-uint64_t lttng_condition_event_rule_matches_get_error_counter_index(
-               const struct lttng_condition *condition)
+uint64_t
+lttng_condition_event_rule_matches_get_error_counter_index(const struct lttng_condition *condition)
 {
-       const struct lttng_condition_event_rule_matches
-                       *event_rule_matches_cond = lttng::utils::container_of(condition,
-                                       &lttng_condition_event_rule_matches::parent);
+       const struct lttng_condition_event_rule_matches *event_rule_matches_cond =
+               lttng::utils::container_of(condition, &lttng_condition_event_rule_matches::parent);
 
        return LTTNG_OPTIONAL_GET(event_rule_matches_cond->error_counter_index);
 }
 
 enum lttng_condition_status
-lttng_condition_event_rule_matches_append_capture_descriptor(
-               struct lttng_condition *condition,
-               struct lttng_event_expr *expr)
+lttng_condition_event_rule_matches_append_capture_descriptor(struct lttng_condition *condition,
+                                                            struct lttng_event_expr *expr)
 {
        int ret;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
        struct lttng_condition_event_rule_matches *event_rule_matches_cond =
-                       lttng::utils::container_of(condition,
-                                       &lttng_condition_event_rule_matches::parent);
+               lttng::utils::container_of(condition, &lttng_condition_event_rule_matches::parent);
        struct lttng_capture_descriptor *descriptor = NULL;
        const struct lttng_event_rule *rule = NULL;
 
        /* Only accept l-values. */
-       if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition) ||
-                       !expr || !lttng_event_expr_is_lvalue(expr)) {
+       if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition) || !expr ||
+           !lttng_event_expr_is_lvalue(expr)) {
                status = LTTNG_CONDITION_STATUS_INVALID;
                goto end;
        }
@@ -860,7 +817,7 @@ lttng_condition_event_rule_matches_append_capture_descriptor(
                goto end;
        }
 
-       switch(lttng_event_rule_get_type(rule)) {
+       switch (lttng_event_rule_get_type(rule)) {
        case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
        case LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT:
        case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
@@ -891,9 +848,8 @@ lttng_condition_event_rule_matches_append_capture_descriptor(
        descriptor->event_expression = expr;
        descriptor->bytecode = NULL;
 
-       ret = lttng_dynamic_pointer_array_add_pointer(
-                       &event_rule_matches_cond->capture_descriptors,
-                       descriptor);
+       ret = lttng_dynamic_pointer_array_add_pointer(&event_rule_matches_cond->capture_descriptors,
+                                                     descriptor);
        if (ret) {
                status = LTTNG_CONDITION_STATUS_ERROR;
                goto end;
@@ -906,37 +862,33 @@ end:
        return status;
 }
 
-enum lttng_condition_status
-lttng_condition_event_rule_matches_get_capture_descriptor_count(
-               const struct lttng_condition *condition, unsigned int *count)
+enum lttng_condition_status lttng_condition_event_rule_matches_get_capture_descriptor_count(
+       const struct lttng_condition *condition, unsigned int *count)
 {
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
-       const struct lttng_condition_event_rule_matches
-                       *event_rule_matches_condition = lttng::utils::container_of(condition,
-                                       &lttng_condition_event_rule_matches::parent);
+       const struct lttng_condition_event_rule_matches *event_rule_matches_condition =
+               lttng::utils::container_of(condition, &lttng_condition_event_rule_matches::parent);
 
-       if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition) ||
-                       !count) {
+       if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition) || !count) {
                status = LTTNG_CONDITION_STATUS_INVALID;
                goto end;
        }
 
        *count = lttng_dynamic_pointer_array_get_count(
-                       &event_rule_matches_condition->capture_descriptors);
+               &event_rule_matches_condition->capture_descriptors);
 
 end:
        return status;
 }
 
-const struct lttng_event_expr *
-lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
-               const struct lttng_condition *condition, unsigned int index)
+const struct lttng_event_expr *lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
+       const struct lttng_condition *condition, unsigned int index)
 {
        const struct lttng_event_expr *expr = NULL;
        const struct lttng_capture_descriptor *desc = NULL;
 
        desc = lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
-                       condition, index);
+               condition, index);
        if (desc == NULL) {
                goto end;
        }
@@ -947,9 +899,9 @@ end:
 }
 
 ssize_t lttng_evaluation_event_rule_matches_create_from_payload(
-               const struct lttng_condition_event_rule_matches *condition,
-               struct lttng_payload_view *view,
-               struct lttng_evaluation **_evaluation)
+       const struct lttng_condition_event_rule_matches *condition,
+       struct lttng_payload_view *view,
+       struct lttng_evaluation **_evaluation)
 {
        ssize_t ret, offset = 0;
        struct lttng_evaluation *evaluation = NULL;
@@ -963,21 +915,22 @@ ssize_t lttng_evaluation_event_rule_matches_create_from_payload(
 
        {
                const struct lttng_payload_view current_view =
-                               lttng_payload_view_from_view(view, offset, -1);
+                       lttng_payload_view_from_view(view, offset, -1);
 
                if (current_view.buffer.size < sizeof(capture_payload_size)) {
                        ret = -1;
                        goto error;
                }
 
-               memcpy(&capture_payload_size, current_view.buffer.data,
-                               sizeof(capture_payload_size));
+               memcpy(&capture_payload_size,
+                      current_view.buffer.data,
+                      sizeof(capture_payload_size));
        }
        offset += sizeof(capture_payload_size);
 
        if (capture_payload_size > 0) {
                const struct lttng_payload_view current_view =
-                               lttng_payload_view_from_view(view, offset, -1);
+                       lttng_payload_view_from_view(view, offset, -1);
 
                if (current_view.buffer.size < capture_payload_size) {
                        ret = -1;
@@ -988,7 +941,7 @@ ssize_t lttng_evaluation_event_rule_matches_create_from_payload(
        }
 
        evaluation = lttng_evaluation_event_rule_matches_create(
-                       condition, capture_payload, capture_payload_size, true);
+               condition, capture_payload, capture_payload_size, true);
        if (!evaluation) {
                ret = -1;
                goto error;
@@ -1004,26 +957,24 @@ error:
        return ret;
 }
 
-static int lttng_evaluation_event_rule_matches_serialize(
-               const struct lttng_evaluation *evaluation,
-               struct lttng_payload *payload)
+static int lttng_evaluation_event_rule_matches_serialize(const struct lttng_evaluation *evaluation,
+                                                        struct lttng_payload *payload)
 {
        int ret = 0;
        struct lttng_evaluation_event_rule_matches *hit;
        uint32_t capture_payload_size;
 
-       hit = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_event_rule_matches::parent);
+       hit = lttng::utils::container_of(evaluation, &lttng_evaluation_event_rule_matches::parent);
 
        capture_payload_size = (uint32_t) hit->capture_payload.size;
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &capture_payload_size,
-                       sizeof(capture_payload_size));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &capture_payload_size, sizeof(capture_payload_size));
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, hit->capture_payload.data,
-                       hit->capture_payload.size);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, hit->capture_payload.data, hit->capture_payload.size);
        if (ret) {
                goto end;
        }
@@ -1032,8 +983,7 @@ end:
        return ret;
 }
 
-static
-bool msgpack_str_is_equal(const struct msgpack_object *obj, const char *str)
+static bool msgpack_str_is_equal(const struct msgpack_object *obj, const char *str)
 {
        bool is_equal = true;
 
@@ -1053,9 +1003,8 @@ end:
        return is_equal;
 }
 
-static
-const msgpack_object *get_msgpack_map_obj(const struct msgpack_object *map_obj,
-               const char *name)
+static const msgpack_object *get_msgpack_map_obj(const struct msgpack_object *map_obj,
+                                                const char *name)
 {
        const msgpack_object *ret = NULL;
        size_t i;
@@ -1077,21 +1026,18 @@ end:
        return ret;
 }
 
-static void lttng_evaluation_event_rule_matches_destroy(
-               struct lttng_evaluation *evaluation)
+static void lttng_evaluation_event_rule_matches_destroy(struct lttng_evaluation *evaluation)
 {
        struct lttng_evaluation_event_rule_matches *hit;
 
-       hit = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_event_rule_matches::parent);
+       hit = lttng::utils::container_of(evaluation, &lttng_evaluation_event_rule_matches::parent);
        lttng_dynamic_buffer_reset(&hit->capture_payload);
        lttng_event_field_value_destroy(hit->captured_values);
        free(hit);
 }
 
-static
-int event_field_value_from_obj(const msgpack_object *obj,
-               struct lttng_event_field_value **field_val)
+static int event_field_value_from_obj(const msgpack_object *obj,
+                                     struct lttng_event_field_value **field_val)
 {
        int ret = 0;
 
@@ -1104,21 +1050,18 @@ int event_field_value_from_obj(const msgpack_object *obj,
                *field_val = NULL;
                goto end;
        case MSGPACK_OBJECT_POSITIVE_INTEGER:
-               *field_val = lttng_event_field_value_uint_create(
-                               obj->via.u64);
+               *field_val = lttng_event_field_value_uint_create(obj->via.u64);
                break;
        case MSGPACK_OBJECT_NEGATIVE_INTEGER:
-               *field_val = lttng_event_field_value_int_create(
-                               obj->via.i64);
+               *field_val = lttng_event_field_value_int_create(obj->via.i64);
                break;
        case MSGPACK_OBJECT_FLOAT32:
        case MSGPACK_OBJECT_FLOAT64:
-               *field_val = lttng_event_field_value_real_create(
-                               obj->via.f64);
+               *field_val = lttng_event_field_value_real_create(obj->via.f64);
                break;
        case MSGPACK_OBJECT_STR:
-               *field_val = lttng_event_field_value_string_create_with_size(
-                               obj->via.str.ptr, obj->via.str.size);
+               *field_val = lttng_event_field_value_string_create_with_size(obj->via.str.ptr,
+                                                                            obj->via.str.size);
                break;
        case MSGPACK_OBJECT_ARRAY:
        {
@@ -1133,18 +1076,16 @@ int event_field_value_from_obj(const msgpack_object *obj,
                        const msgpack_object *elem_obj = &obj->via.array.ptr[i];
                        struct lttng_event_field_value *elem_field_val;
 
-                       ret = event_field_value_from_obj(elem_obj,
-                                       &elem_field_val);
+                       ret = event_field_value_from_obj(elem_obj, &elem_field_val);
                        if (ret) {
                                goto error;
                        }
 
                        if (elem_field_val) {
-                               ret = lttng_event_field_value_array_append(
-                                               *field_val, elem_field_val);
+                               ret = lttng_event_field_value_array_append(*field_val,
+                                                                          elem_field_val);
                        } else {
-                               ret = lttng_event_field_value_array_append_unavailable(
-                                               *field_val);
+                               ret = lttng_event_field_value_array_append_unavailable(*field_val);
                        }
 
                        if (ret) {
@@ -1179,7 +1120,7 @@ int event_field_value_from_obj(const msgpack_object *obj,
 
                if (inner_obj->type != MSGPACK_OBJECT_STR) {
                        ERR("Map object's `type` entry is not a string: type = %s",
-                                       msgpack_object_type_str(inner_obj->type));
+                           msgpack_object_type_str(inner_obj->type));
                        goto error;
                }
 
@@ -1195,14 +1136,12 @@ int event_field_value_from_obj(const msgpack_object *obj,
                }
 
                if (inner_obj->type == MSGPACK_OBJECT_POSITIVE_INTEGER) {
-                       *field_val = lttng_event_field_value_enum_uint_create(
-                                       inner_obj->via.u64);
+                       *field_val = lttng_event_field_value_enum_uint_create(inner_obj->via.u64);
                } else if (inner_obj->type == MSGPACK_OBJECT_NEGATIVE_INTEGER) {
-                       *field_val = lttng_event_field_value_enum_int_create(
-                                       inner_obj->via.i64);
+                       *field_val = lttng_event_field_value_enum_int_create(inner_obj->via.i64);
                } else {
                        ERR("Map object's `value` entry is not an integer: type = %s",
-                                       msgpack_object_type_str(inner_obj->type));
+                           msgpack_object_type_str(inner_obj->type));
                        goto error;
                }
 
@@ -1218,25 +1157,22 @@ int event_field_value_from_obj(const msgpack_object *obj,
 
                if (inner_obj->type != MSGPACK_OBJECT_ARRAY) {
                        ERR("Map object's `labels` entry is not an array: type = %s",
-                                       msgpack_object_type_str(inner_obj->type));
+                           msgpack_object_type_str(inner_obj->type));
                        goto error;
                }
 
-               for (label_i = 0; label_i < inner_obj->via.array.size;
-                               label_i++) {
+               for (label_i = 0; label_i < inner_obj->via.array.size; label_i++) {
                        int iret;
-                       const msgpack_object *elem_obj =
-                                       &inner_obj->via.array.ptr[label_i];
+                       const msgpack_object *elem_obj = &inner_obj->via.array.ptr[label_i];
 
                        if (elem_obj->type != MSGPACK_OBJECT_STR) {
                                ERR("Map object's `labels` entry's type is not a string: type = %s",
-                                               msgpack_object_type_str(elem_obj->type));
+                                   msgpack_object_type_str(elem_obj->type));
                                goto error;
                        }
 
                        iret = lttng_event_field_value_enum_append_label_with_size(
-                                       *field_val, elem_obj->via.str.ptr,
-                                       elem_obj->via.str.size);
+                               *field_val, elem_obj->via.str.ptr, elem_obj->via.str.size);
                        if (iret) {
                                goto error;
                        }
@@ -1245,8 +1181,7 @@ int event_field_value_from_obj(const msgpack_object *obj,
                break;
        }
        default:
-               ERR("Unexpected object type: type = %s",
-                               msgpack_object_type_str(obj->type));
+               ERR("Unexpected object type: type = %s", msgpack_object_type_str(obj->type));
                goto error;
        }
 
@@ -1265,10 +1200,10 @@ end:
        return ret;
 }
 
-static struct lttng_event_field_value *event_field_value_from_capture_payload(
-               const struct lttng_condition_event_rule_matches *condition,
-               const char *capture_payload,
-               size_t capture_payload_size)
+static struct lttng_event_field_value *
+event_field_value_from_capture_payload(const struct lttng_condition_event_rule_matches *condition,
+                                      const char *capture_payload,
+                                      size_t capture_payload_size)
 {
        struct lttng_event_field_value *ret = NULL;
        msgpack_unpacked unpacked;
@@ -1285,13 +1220,13 @@ static struct lttng_event_field_value *event_field_value_from_capture_payload(
        msgpack_unpacked_init(&unpacked);
 
        /* Decode. */
-       unpack_return = msgpack_unpack_next(&unpacked, capture_payload,
-                       capture_payload_size, NULL);
+       unpack_return = msgpack_unpack_next(&unpacked, capture_payload, capture_payload_size, NULL);
        if (unpack_return != MSGPACK_UNPACK_SUCCESS) {
                ERR("msgpack_unpack_next() failed to decode the "
-                               "MessagePack-encoded capture payload: "
-                               "size = %zu, ret = %d",
-                               capture_payload_size, unpack_return);
+                   "MessagePack-encoded capture payload: "
+                   "size = %zu, ret = %d",
+                   capture_payload_size,
+                   unpack_return);
                goto error;
        }
 
@@ -1300,7 +1235,7 @@ static struct lttng_event_field_value *event_field_value_from_capture_payload(
 
        if (root_obj->type != MSGPACK_OBJECT_ARRAY) {
                ERR("Expecting an array as the root object: type = %s",
-                               msgpack_object_type_str(root_obj->type));
+                   msgpack_object_type_str(root_obj->type));
                goto error;
        }
 
@@ -1322,14 +1257,13 @@ static struct lttng_event_field_value *event_field_value_from_capture_payload(
         *
         * 3. Append it to `ret` (the root array event field value).
         */
-       count = lttng_dynamic_pointer_array_get_count(
-                       &condition->capture_descriptors);
+       count = lttng_dynamic_pointer_array_get_count(&condition->capture_descriptors);
        LTTNG_ASSERT(count > 0);
 
        for (i = 0; i < count; i++) {
                const struct lttng_capture_descriptor *capture_descriptor =
-                               lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
-                                               &condition->parent, i);
+                       lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
+                               &condition->parent, i);
                const msgpack_object *elem_obj;
                struct lttng_event_field_value *elem_field_val;
                int iret;
@@ -1337,18 +1271,15 @@ static struct lttng_event_field_value *event_field_value_from_capture_payload(
                LTTNG_ASSERT(capture_descriptor);
 
                elem_obj = &root_array_obj->ptr[i];
-               iret = event_field_value_from_obj(elem_obj,
-                               &elem_field_val);
+               iret = event_field_value_from_obj(elem_obj, &elem_field_val);
                if (iret) {
                        goto error;
                }
 
                if (elem_field_val) {
-                       iret = lttng_event_field_value_array_append(ret,
-                                       elem_field_val);
+                       iret = lttng_event_field_value_array_append(ret, elem_field_val);
                } else {
-                       iret = lttng_event_field_value_array_append_unavailable(
-                                       ret);
+                       iret = lttng_event_field_value_array_append_unavailable(ret);
                }
 
                if (iret) {
@@ -1369,10 +1300,10 @@ end:
 }
 
 struct lttng_evaluation *lttng_evaluation_event_rule_matches_create(
-               const struct lttng_condition_event_rule_matches *condition,
-               const char *capture_payload,
-               size_t capture_payload_size,
-               bool decode_capture_payload)
+       const struct lttng_condition_event_rule_matches *condition,
+       const char *capture_payload,
+       size_t capture_payload_size,
+       bool decode_capture_payload)
 {
        struct lttng_evaluation_event_rule_matches *hit;
        struct lttng_evaluation *evaluation = NULL;
@@ -1386,22 +1317,18 @@ struct lttng_evaluation *lttng_evaluation_event_rule_matches_create(
 
        if (capture_payload) {
                const int ret = lttng_dynamic_buffer_append(
-                               &hit->capture_payload, capture_payload,
-                               capture_payload_size);
+                       &hit->capture_payload, capture_payload, capture_payload_size);
                if (ret) {
                        ERR("Failed to initialize capture payload of event rule evaluation");
                        goto error;
                }
 
                if (decode_capture_payload) {
-                       hit->captured_values =
-                                       event_field_value_from_capture_payload(
-                                               condition,
-                                               capture_payload,
-                                               capture_payload_size);
+                       hit->captured_values = event_field_value_from_capture_payload(
+                               condition, capture_payload, capture_payload_size);
                        if (!hit->captured_values) {
                                ERR("Failed to decode the capture payload: size = %zu",
-                                               capture_payload_size);
+                                   capture_payload_size);
                                goto error;
                        }
                }
@@ -1424,21 +1351,18 @@ error:
 
 enum lttng_evaluation_event_rule_matches_status
 lttng_evaluation_event_rule_matches_get_captured_values(
-               const struct lttng_evaluation *evaluation,
-               const struct lttng_event_field_value **field_val)
+       const struct lttng_evaluation *evaluation, const struct lttng_event_field_value **field_val)
 {
        struct lttng_evaluation_event_rule_matches *hit;
        enum lttng_evaluation_event_rule_matches_status status =
-                       LTTNG_EVALUATION_EVENT_RULE_MATCHES_STATUS_OK;
+               LTTNG_EVALUATION_EVENT_RULE_MATCHES_STATUS_OK;
 
-       if (!evaluation || !is_event_rule_matches_evaluation(evaluation) ||
-                       !field_val) {
+       if (!evaluation || !is_event_rule_matches_evaluation(evaluation) || !field_val) {
                status = LTTNG_EVALUATION_EVENT_RULE_MATCHES_STATUS_INVALID;
                goto end;
        }
 
-       hit = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_event_rule_matches::parent);
+       hit = lttng::utils::container_of(evaluation, &lttng_evaluation_event_rule_matches::parent);
        if (!hit->captured_values) {
                status = LTTNG_EVALUATION_EVENT_RULE_MATCHES_STATUS_NONE;
                goto end;
@@ -1450,9 +1374,8 @@ end:
        return status;
 }
 
-enum lttng_error_code
-lttng_condition_event_rule_matches_generate_capture_descriptor_bytecode(
-               struct lttng_condition *condition)
+enum lttng_error_code lttng_condition_event_rule_matches_generate_capture_descriptor_bytecode(
+       struct lttng_condition *condition)
 {
        enum lttng_error_code ret;
        enum lttng_condition_status status;
@@ -1463,8 +1386,8 @@ lttng_condition_event_rule_matches_generate_capture_descriptor_bytecode(
                goto end;
        }
 
-       status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
-                       condition, &capture_count);
+       status = lttng_condition_event_rule_matches_get_capture_descriptor_count(condition,
+                                                                                &capture_count);
        if (status != LTTNG_CONDITION_STATUS_OK) {
                ret = LTTNG_ERR_FATAL;
                goto end;
@@ -1472,8 +1395,8 @@ lttng_condition_event_rule_matches_generate_capture_descriptor_bytecode(
 
        for (i = 0; i < capture_count; i++) {
                struct lttng_capture_descriptor *local_capture_desc =
-                               lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
-                                               condition, i);
+                       lttng_condition_event_rule_matches_get_internal_capture_descriptor_at_index(
+                               condition, i);
                int bytecode_ret;
 
                if (local_capture_desc == NULL) {
@@ -1482,9 +1405,8 @@ lttng_condition_event_rule_matches_generate_capture_descriptor_bytecode(
                }
 
                /* Generate the bytecode. */
-               bytecode_ret = lttng_event_expr_to_bytecode(
-                               local_capture_desc->event_expression,
-                               &local_capture_desc->bytecode);
+               bytecode_ret = lttng_event_expr_to_bytecode(local_capture_desc->event_expression,
+                                                           &local_capture_desc->bytecode);
                if (bytecode_ret < 0 || local_capture_desc->bytecode == NULL) {
                        ret = LTTNG_ERR_INVALID_CAPTURE_EXPRESSION;
                        goto end;
@@ -1498,13 +1420,11 @@ end:
        return ret;
 }
 
-const struct lttng_bytecode *
-lttng_condition_event_rule_matches_get_capture_bytecode_at_index(
-               const struct lttng_condition *condition, unsigned int index)
+const struct lttng_bytecode *lttng_condition_event_rule_matches_get_capture_bytecode_at_index(
+       const struct lttng_condition *condition, unsigned int index)
 {
-       const struct lttng_condition_event_rule_matches
-                       *event_rule_matches_cond = lttng::utils::container_of(condition,
-                                       &lttng_condition_event_rule_matches::parent);
+       const struct lttng_condition_event_rule_matches *event_rule_matches_cond =
+               lttng::utils::container_of(condition, &lttng_condition_event_rule_matches::parent);
        struct lttng_capture_descriptor *desc = NULL;
        struct lttng_bytecode *bytecode = NULL;
        unsigned int count;
@@ -1514,8 +1434,7 @@ lttng_condition_event_rule_matches_get_capture_bytecode_at_index(
                goto end;
        }
 
-       status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
-                       condition, &count);
+       status = lttng_condition_event_rule_matches_get_capture_descriptor_count(condition, &count);
        if (status != LTTNG_CONDITION_STATUS_OK) {
                goto end;
        }
@@ -1525,7 +1444,7 @@ lttng_condition_event_rule_matches_get_capture_bytecode_at_index(
        }
 
        desc = (lttng_capture_descriptor *) lttng_dynamic_pointer_array_get_pointer(
-                       &event_rule_matches_cond->capture_descriptors, index);
+               &event_rule_matches_cond->capture_descriptors, index);
        if (desc == NULL) {
                goto end;
        }
index 69951b5c27d1ecc728e9f4574c7c6db231b89747..6c6fb60c05fbaf482800d40194fc461d3e225fe7 100644 (file)
@@ -8,36 +8,33 @@
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/mi-lttng.hpp>
-#include <float.h>
+
 #include <lttng/condition/condition-internal.hpp>
 #include <lttng/condition/session-consumed-size-internal.hpp>
 #include <lttng/constant.h>
+
+#include <float.h>
 #include <math.h>
 #include <time.h>
 
-#define IS_CONSUMED_SIZE_CONDITION(condition) ( \
-       lttng_condition_get_type(condition) == LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE \
-       )
+#define IS_CONSUMED_SIZE_CONDITION(condition) \
+       (lttng_condition_get_type(condition) == LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE)
 
-#define IS_CONSUMED_SIZE_EVALUATION(evaluation) ( \
-       lttng_evaluation_get_type(evaluation) == LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE \
-       )
+#define IS_CONSUMED_SIZE_EVALUATION(evaluation) \
+       (lttng_evaluation_get_type(evaluation) == LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE)
 
-static
-void lttng_condition_session_consumed_size_destroy(struct lttng_condition *condition)
+static void lttng_condition_session_consumed_size_destroy(struct lttng_condition *condition)
 {
        struct lttng_condition_session_consumed_size *consumed_size;
 
        consumed_size = lttng::utils::container_of(condition,
-                       &lttng_condition_session_consumed_size::parent);
+                                                  &lttng_condition_session_consumed_size::parent);
 
        free(consumed_size->session_name);
        free(consumed_size);
 }
 
-static
-bool lttng_condition_session_consumed_size_validate(
-               const struct lttng_condition *condition)
+static bool lttng_condition_session_consumed_size_validate(const struct lttng_condition *condition)
 {
        bool valid = false;
        struct lttng_condition_session_consumed_size *consumed;
@@ -47,7 +44,7 @@ bool lttng_condition_session_consumed_size_validate(
        }
 
        consumed = lttng::utils::container_of(condition,
-                       &lttng_condition_session_consumed_size::parent);
+                                             &lttng_condition_session_consumed_size::parent);
        if (!consumed->session_name) {
                ERR("Invalid session consumed size condition: a target session name must be set.");
                goto end;
@@ -62,10 +59,8 @@ end:
        return valid;
 }
 
-static
-int lttng_condition_session_consumed_size_serialize(
-               const struct lttng_condition *condition,
-               struct lttng_payload *payload)
+static int lttng_condition_session_consumed_size_serialize(const struct lttng_condition *condition,
+                                                          struct lttng_payload *payload)
 {
        int ret;
        size_t session_name_len;
@@ -79,7 +74,7 @@ int lttng_condition_session_consumed_size_serialize(
 
        DBG("Serializing session consumed size condition");
        consumed = lttng::utils::container_of(condition,
-                       &lttng_condition_session_consumed_size::parent);
+                                             &lttng_condition_session_consumed_size::parent);
 
        session_name_len = strlen(consumed->session_name) + 1;
        if (session_name_len > LTTNG_NAME_MAX) {
@@ -87,18 +82,16 @@ int lttng_condition_session_consumed_size_serialize(
                goto end;
        }
 
-       consumed_comm.consumed_threshold_bytes =
-                       consumed->consumed_threshold_bytes.value;
+       consumed_comm.consumed_threshold_bytes = consumed->consumed_threshold_bytes.value;
        consumed_comm.session_name_len = (uint32_t) session_name_len;
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &consumed_comm,
-                       sizeof(consumed_comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &consumed_comm, sizeof(consumed_comm));
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, consumed->session_name,
-                       session_name_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, consumed->session_name, session_name_len);
        if (ret) {
                goto end;
        }
@@ -106,9 +99,8 @@ end:
        return ret;
 }
 
-static
-bool lttng_condition_session_consumed_size_is_equal(const struct lttng_condition *_a,
-               const struct lttng_condition *_b)
+static bool lttng_condition_session_consumed_size_is_equal(const struct lttng_condition *_a,
+                                                          const struct lttng_condition *_b)
 {
        bool is_equal = false;
        struct lttng_condition_session_consumed_size *a, *b;
@@ -137,10 +129,9 @@ end:
        return is_equal;
 }
 
-static
-enum lttng_error_code lttng_condition_session_consumed_size_mi_serialize(
-               const struct lttng_condition *condition,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_condition_session_consumed_size_mi_serialize(const struct lttng_condition *condition,
+                                                  struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -152,33 +143,30 @@ enum lttng_error_code lttng_condition_session_consumed_size_mi_serialize(
        LTTNG_ASSERT(writer);
        LTTNG_ASSERT(IS_CONSUMED_SIZE_CONDITION(condition));
 
-       status = lttng_condition_session_consumed_size_get_session_name(
-                       condition, &session_name);
+       status = lttng_condition_session_consumed_size_get_session_name(condition, &session_name);
        LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
        LTTNG_ASSERT(session_name);
 
-       status = lttng_condition_session_consumed_size_get_threshold(
-                       condition, &threshold_bytes);
+       status = lttng_condition_session_consumed_size_get_threshold(condition, &threshold_bytes);
        LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
 
        /* Open condition session consumed size element. */
        ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_condition_session_consumed_size);
+                                          mi_lttng_element_condition_session_consumed_size);
        if (ret) {
                goto mi_error;
        }
 
        /* Session name. */
        ret = mi_lttng_writer_write_element_string(
-                       writer, mi_lttng_element_session_name, session_name);
+               writer, mi_lttng_element_session_name, session_name);
        if (ret) {
                goto mi_error;
        }
 
        /* Threshold in bytes. */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       mi_lttng_element_condition_threshold_bytes,
-                       threshold_bytes);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, mi_lttng_element_condition_threshold_bytes, threshold_bytes);
        if (ret) {
                goto mi_error;
        }
@@ -216,17 +204,16 @@ struct lttng_condition *lttng_condition_session_consumed_size_create(void)
        return &condition->parent;
 }
 
-static
-ssize_t init_condition_from_payload(struct lttng_condition *condition,
-               struct lttng_payload_view *src_view)
+static ssize_t init_condition_from_payload(struct lttng_condition *condition,
+                                          struct lttng_payload_view *src_view)
 {
        ssize_t ret, condition_size;
        enum lttng_condition_status status;
        const char *session_name;
        struct lttng_buffer_view session_name_view;
        const struct lttng_condition_session_consumed_size_comm *condition_comm;
-       struct lttng_payload_view condition_comm_view = lttng_payload_view_from_view(
-                       src_view, 0, sizeof(*condition_comm));
+       struct lttng_payload_view condition_comm_view =
+               lttng_payload_view_from_view(src_view, 0, sizeof(*condition_comm));
 
        if (!lttng_payload_view_is_valid(&condition_comm_view)) {
                ERR("Failed to initialize from malformed condition buffer: buffer too short to contain header");
@@ -235,8 +222,8 @@ ssize_t init_condition_from_payload(struct lttng_condition *condition,
        }
 
        condition_comm = (typeof(condition_comm)) condition_comm_view.buffer.data;
-       session_name_view = lttng_buffer_view_from_view(&src_view->buffer,
-                       sizeof(*condition_comm), condition_comm->session_name_len);
+       session_name_view = lttng_buffer_view_from_view(
+               &src_view->buffer, sizeof(*condition_comm), condition_comm->session_name_len);
 
        if (condition_comm->session_name_len > LTTNG_NAME_MAX) {
                ERR("Failed to initialize from malformed condition buffer: name exceeds LTTNG_MAX_NAME");
@@ -250,8 +237,8 @@ ssize_t init_condition_from_payload(struct lttng_condition *condition,
                goto end;
        }
 
-       status = lttng_condition_session_consumed_size_set_threshold(condition,
-                       condition_comm->consumed_threshold_bytes);
+       status = lttng_condition_session_consumed_size_set_threshold(
+               condition, condition_comm->consumed_threshold_bytes);
        if (status != LTTNG_CONDITION_STATUS_OK) {
                ERR("Failed to initialize session consumed size condition threshold");
                ret = -1;
@@ -265,8 +252,7 @@ ssize_t init_condition_from_payload(struct lttng_condition *condition,
                goto end;
        }
 
-       status = lttng_condition_session_consumed_size_set_session_name(condition,
-                       session_name);
+       status = lttng_condition_session_consumed_size_set_session_name(condition, session_name);
        if (status != LTTNG_CONDITION_STATUS_OK) {
                ERR("Failed to set session consumed size condition's session name");
                ret = -1;
@@ -278,20 +264,18 @@ ssize_t init_condition_from_payload(struct lttng_condition *condition,
                goto end;
        }
 
-       condition_size = sizeof(*condition_comm) +
-                       (ssize_t) condition_comm->session_name_len;
+       condition_size = sizeof(*condition_comm) + (ssize_t) condition_comm->session_name_len;
        ret = condition_size;
 end:
        return ret;
 }
 
-ssize_t lttng_condition_session_consumed_size_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_condition **_condition)
+ssize_t
+lttng_condition_session_consumed_size_create_from_payload(struct lttng_payload_view *view,
+                                                         struct lttng_condition **_condition)
 {
        ssize_t ret;
-       struct lttng_condition *condition =
-                       lttng_condition_session_consumed_size_create();
+       struct lttng_condition *condition = lttng_condition_session_consumed_size_create();
 
        if (!_condition || !condition) {
                ret = -1;
@@ -310,27 +294,25 @@ error:
        return ret;
 }
 
-static
-struct lttng_evaluation *create_evaluation_from_payload(
-               const struct lttng_payload_view *view)
+static struct lttng_evaluation *
+create_evaluation_from_payload(const struct lttng_payload_view *view)
 {
        const struct lttng_evaluation_session_consumed_size_comm *comm =
-                       (typeof(comm)) view->buffer.data;
+               (typeof(comm)) view->buffer.data;
        struct lttng_evaluation *evaluation = NULL;
 
        if (view->buffer.size < sizeof(*comm)) {
                goto end;
        }
 
-       evaluation = lttng_evaluation_session_consumed_size_create(
-                       comm->session_consumed);
+       evaluation = lttng_evaluation_session_consumed_size_create(comm->session_consumed);
 end:
        return evaluation;
 }
 
-ssize_t lttng_evaluation_session_consumed_size_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_evaluation **_evaluation)
+ssize_t
+lttng_evaluation_session_consumed_size_create_from_payload(struct lttng_payload_view *view,
+                                                          struct lttng_evaluation **_evaluation)
 {
        ssize_t ret;
        struct lttng_evaluation *evaluation = NULL;
@@ -355,9 +337,8 @@ error:
 }
 
 enum lttng_condition_status
-lttng_condition_session_consumed_size_get_threshold(
-               const struct lttng_condition *condition,
-               uint64_t *consumed_threshold_bytes)
+lttng_condition_session_consumed_size_get_threshold(const struct lttng_condition *condition,
+                                                   uint64_t *consumed_threshold_bytes)
 {
        struct lttng_condition_session_consumed_size *consumed;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
@@ -368,7 +349,7 @@ lttng_condition_session_consumed_size_get_threshold(
        }
 
        consumed = lttng::utils::container_of(condition,
-                       &lttng_condition_session_consumed_size::parent);
+                                             &lttng_condition_session_consumed_size::parent);
        if (!consumed->consumed_threshold_bytes.set) {
                status = LTTNG_CONDITION_STATUS_UNSET;
                goto end;
@@ -379,8 +360,8 @@ end:
 }
 
 enum lttng_condition_status
-lttng_condition_session_consumed_size_set_threshold(
-               struct lttng_condition *condition, uint64_t consumed_threshold_bytes)
+lttng_condition_session_consumed_size_set_threshold(struct lttng_condition *condition,
+                                                   uint64_t consumed_threshold_bytes)
 {
        struct lttng_condition_session_consumed_size *consumed;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
@@ -391,7 +372,7 @@ lttng_condition_session_consumed_size_set_threshold(
        }
 
        consumed = lttng::utils::container_of(condition,
-                       &lttng_condition_session_consumed_size::parent);
+                                             &lttng_condition_session_consumed_size::parent);
        consumed->consumed_threshold_bytes.set = true;
        consumed->consumed_threshold_bytes.value = consumed_threshold_bytes;
 end:
@@ -399,9 +380,8 @@ end:
 }
 
 enum lttng_condition_status
-lttng_condition_session_consumed_size_get_session_name(
-               const struct lttng_condition *condition,
-               const char **session_name)
+lttng_condition_session_consumed_size_get_session_name(const struct lttng_condition *condition,
+                                                      const char **session_name)
 {
        struct lttng_condition_session_consumed_size *consumed;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
@@ -412,7 +392,7 @@ lttng_condition_session_consumed_size_get_session_name(
        }
 
        consumed = lttng::utils::container_of(condition,
-                       &lttng_condition_session_consumed_size::parent);
+                                             &lttng_condition_session_consumed_size::parent);
        if (!consumed->session_name) {
                status = LTTNG_CONDITION_STATUS_UNSET;
                goto end;
@@ -423,21 +403,21 @@ end:
 }
 
 enum lttng_condition_status
-lttng_condition_session_consumed_size_set_session_name(
-               struct lttng_condition *condition, const char *session_name)
+lttng_condition_session_consumed_size_set_session_name(struct lttng_condition *condition,
+                                                      const char *session_name)
 {
        char *session_name_copy;
        struct lttng_condition_session_consumed_size *consumed;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
 
-       if (!condition || !IS_CONSUMED_SIZE_CONDITION(condition) ||
-                       !session_name || strlen(session_name) == 0) {
+       if (!condition || !IS_CONSUMED_SIZE_CONDITION(condition) || !session_name ||
+           strlen(session_name) == 0) {
                status = LTTNG_CONDITION_STATUS_INVALID;
                goto end;
        }
 
        consumed = lttng::utils::container_of(condition,
-                       &lttng_condition_session_consumed_size::parent);
+                                             &lttng_condition_session_consumed_size::parent);
        session_name_copy = strdup(session_name);
        if (!session_name_copy) {
                status = LTTNG_CONDITION_STATUS_ERROR;
@@ -452,34 +432,29 @@ end:
        return status;
 }
 
-static
-int lttng_evaluation_session_consumed_size_serialize(
-               const struct lttng_evaluation *evaluation,
-               struct lttng_payload *payload)
+static int
+lttng_evaluation_session_consumed_size_serialize(const struct lttng_evaluation *evaluation,
+                                                struct lttng_payload *payload)
 {
        struct lttng_evaluation_session_consumed_size *consumed;
        struct lttng_evaluation_session_consumed_size_comm comm;
 
        consumed = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_session_consumed_size::parent);
+                                             &lttng_evaluation_session_consumed_size::parent);
        comm.session_consumed = consumed->session_consumed;
-       return lttng_dynamic_buffer_append(
-                       &payload->buffer, &comm, sizeof(comm));
+       return lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
 }
 
-static
-void lttng_evaluation_session_consumed_size_destroy(
-               struct lttng_evaluation *evaluation)
+static void lttng_evaluation_session_consumed_size_destroy(struct lttng_evaluation *evaluation)
 {
        struct lttng_evaluation_session_consumed_size *consumed;
 
        consumed = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_session_consumed_size::parent);
+                                             &lttng_evaluation_session_consumed_size::parent);
        free(consumed);
 }
 
-struct lttng_evaluation *lttng_evaluation_session_consumed_size_create(
-               uint64_t consumed)
+struct lttng_evaluation *lttng_evaluation_session_consumed_size_create(uint64_t consumed)
 {
        struct lttng_evaluation_session_consumed_size *consumed_eval;
 
@@ -497,21 +472,19 @@ end:
 }
 
 enum lttng_evaluation_status
-lttng_evaluation_session_consumed_size_get_consumed_size(
-               const struct lttng_evaluation *evaluation,
-               uint64_t *session_consumed)
+lttng_evaluation_session_consumed_size_get_consumed_size(const struct lttng_evaluation *evaluation,
+                                                        uint64_t *session_consumed)
 {
        struct lttng_evaluation_session_consumed_size *consumed;
        enum lttng_evaluation_status status = LTTNG_EVALUATION_STATUS_OK;
 
-       if (!evaluation || !IS_CONSUMED_SIZE_EVALUATION(evaluation) ||
-                       !session_consumed) {
+       if (!evaluation || !IS_CONSUMED_SIZE_EVALUATION(evaluation) || !session_consumed) {
                status = LTTNG_EVALUATION_STATUS_INVALID;
                goto end;
        }
 
        consumed = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_session_consumed_size::parent);
+                                             &lttng_evaluation_session_consumed_size::parent);
        *session_consumed = consumed->session_consumed;
 end:
        return status;
index 7f0896f927adba5b38df6f964eb8ab14e348f9e4..a60e4fcf2f05a607d6b6effb1b411713af2f78e7 100644 (file)
@@ -8,32 +8,25 @@
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/mi-lttng.hpp>
+
 #include <lttng/condition/condition-internal.hpp>
 #include <lttng/condition/session-rotation-internal.hpp>
 #include <lttng/location-internal.hpp>
+
 #include <stdbool.h>
 
-static
-bool lttng_condition_session_rotation_validate(
-               const struct lttng_condition *condition);
-static
-int lttng_condition_session_rotation_serialize(
-               const struct lttng_condition *condition,
-               struct lttng_payload *payload);
-static
-bool lttng_condition_session_rotation_is_equal(const struct lttng_condition *_a,
-               const struct lttng_condition *_b);
-static
-void lttng_condition_session_rotation_destroy(
-               struct lttng_condition *condition);
-
-static
-enum lttng_error_code lttng_condition_session_rotation_mi_serialize(
-               const struct lttng_condition *condition,
-               struct mi_writer *writer);
-
-static const
-struct lttng_condition rotation_condition_template = {
+static bool lttng_condition_session_rotation_validate(const struct lttng_condition *condition);
+static int lttng_condition_session_rotation_serialize(const struct lttng_condition *condition,
+                                                     struct lttng_payload *payload);
+static bool lttng_condition_session_rotation_is_equal(const struct lttng_condition *_a,
+                                                     const struct lttng_condition *_b);
+static void lttng_condition_session_rotation_destroy(struct lttng_condition *condition);
+
+static enum lttng_error_code
+lttng_condition_session_rotation_mi_serialize(const struct lttng_condition *condition,
+                                             struct mi_writer *writer);
+
+static const struct lttng_condition rotation_condition_template = {
        {},
        LTTNG_CONDITION_TYPE_UNKNOWN, /* type unset, shall be set on creation. */
        lttng_condition_session_rotation_validate,
@@ -43,42 +36,33 @@ struct lttng_condition rotation_condition_template = {
        lttng_condition_session_rotation_mi_serialize,
 };
 
-static
-int lttng_evaluation_session_rotation_serialize(
-               const struct lttng_evaluation *evaluation,
-               struct lttng_payload *payload);
-static
-void lttng_evaluation_session_rotation_destroy(
-               struct lttng_evaluation *evaluation);
+static int lttng_evaluation_session_rotation_serialize(const struct lttng_evaluation *evaluation,
+                                                      struct lttng_payload *payload);
+static void lttng_evaluation_session_rotation_destroy(struct lttng_evaluation *evaluation);
 
-static const
-struct lttng_evaluation rotation_evaluation_template = {
+static const struct lttng_evaluation rotation_evaluation_template = {
        LTTNG_CONDITION_TYPE_UNKNOWN, /* type unset, shall be set on creation. */
        lttng_evaluation_session_rotation_serialize,
        lttng_evaluation_session_rotation_destroy,
 };
 
-static
-bool is_rotation_condition(const struct lttng_condition *condition)
+static bool is_rotation_condition(const struct lttng_condition *condition)
 {
        enum lttng_condition_type type = lttng_condition_get_type(condition);
 
        return type == LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING ||
-                       type == LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED;
+               type == LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED;
 }
 
-static
-bool is_rotation_evaluation(const struct lttng_evaluation *evaluation)
+static bool is_rotation_evaluation(const struct lttng_evaluation *evaluation)
 {
        enum lttng_condition_type type = lttng_evaluation_get_type(evaluation);
 
        return type == LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING ||
-                       type == LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED;
+               type == LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED;
 }
 
-static
-bool lttng_condition_session_rotation_validate(
-               const struct lttng_condition *condition)
+static bool lttng_condition_session_rotation_validate(const struct lttng_condition *condition)
 {
        bool valid = false;
        struct lttng_condition_session_rotation *rotation;
@@ -87,8 +71,7 @@ bool lttng_condition_session_rotation_validate(
                goto end;
        }
 
-       rotation = lttng::utils::container_of(condition,
-                       &lttng_condition_session_rotation::parent);
+       rotation = lttng::utils::container_of(condition, &lttng_condition_session_rotation::parent);
        if (!rotation->session_name) {
                ERR("Invalid session rotation condition: a target session name must be set.");
                goto end;
@@ -99,10 +82,8 @@ end:
        return valid;
 }
 
-static
-int lttng_condition_session_rotation_serialize(
-               const struct lttng_condition *condition,
-               struct lttng_payload *payload)
+static int lttng_condition_session_rotation_serialize(const struct lttng_condition *condition,
+                                                     struct lttng_payload *payload)
 {
        int ret;
        size_t session_name_len;
@@ -115,8 +96,7 @@ int lttng_condition_session_rotation_serialize(
        }
 
        DBG("Serializing session rotation condition");
-       rotation = lttng::utils::container_of(condition,
-                       &lttng_condition_session_rotation::parent);
+       rotation = lttng::utils::container_of(condition, &lttng_condition_session_rotation::parent);
 
        session_name_len = strlen(rotation->session_name) + 1;
        if (session_name_len > LTTNG_NAME_MAX) {
@@ -125,13 +105,12 @@ int lttng_condition_session_rotation_serialize(
        }
 
        rotation_comm.session_name_len = session_name_len;
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &rotation_comm,
-                       sizeof(rotation_comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &rotation_comm, sizeof(rotation_comm));
        if (ret) {
                goto end;
        }
-       ret = lttng_dynamic_buffer_append(&payload->buffer,
-                       rotation->session_name, session_name_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, rotation->session_name, session_name_len);
        if (ret) {
                goto end;
        }
@@ -139,9 +118,8 @@ end:
        return ret;
 }
 
-static
-bool lttng_condition_session_rotation_is_equal(const struct lttng_condition *_a,
-               const struct lttng_condition *_b)
+static bool lttng_condition_session_rotation_is_equal(const struct lttng_condition *_a,
+                                                     const struct lttng_condition *_b)
 {
        bool is_equal = false;
        struct lttng_condition_session_rotation *a, *b;
@@ -150,14 +128,12 @@ bool lttng_condition_session_rotation_is_equal(const struct lttng_condition *_a,
        b = lttng::utils::container_of(_b, &lttng_condition_session_rotation::parent);
 
        /* Both session names must be set or both must be unset. */
-       if ((a->session_name && !b->session_name) ||
-                       (!a->session_name && b->session_name)) {
+       if ((a->session_name && !b->session_name) || (!a->session_name && b->session_name)) {
                WARN("Comparing session rotation conditions with uninitialized session names.");
                goto end;
        }
 
-       if (a->session_name && b->session_name &&
-                       strcmp(a->session_name, b->session_name)) {
+       if (a->session_name && b->session_name && strcmp(a->session_name, b->session_name)) {
                goto end;
        }
 
@@ -166,22 +142,18 @@ end:
        return is_equal;
 }
 
-static
-void lttng_condition_session_rotation_destroy(
-               struct lttng_condition *condition)
+static void lttng_condition_session_rotation_destroy(struct lttng_condition *condition)
 {
        struct lttng_condition_session_rotation *rotation;
 
-       rotation = lttng::utils::container_of(condition,
-                       &lttng_condition_session_rotation::parent);
+       rotation = lttng::utils::container_of(condition, &lttng_condition_session_rotation::parent);
 
        free(rotation->session_name);
        free(rotation);
 }
 
-static
-struct lttng_condition *lttng_condition_session_rotation_create(
-               enum lttng_condition_type type)
+static struct lttng_condition *
+lttng_condition_session_rotation_create(enum lttng_condition_type type)
 {
        struct lttng_condition_session_rotation *condition;
 
@@ -190,8 +162,7 @@ struct lttng_condition *lttng_condition_session_rotation_create(
                return NULL;
        }
 
-       memcpy(&condition->parent, &rotation_condition_template,
-                       sizeof(condition->parent));
+       memcpy(&condition->parent, &rotation_condition_template, sizeof(condition->parent));
        lttng_condition_init(&condition->parent, type);
        return &condition->parent;
 }
@@ -199,18 +170,17 @@ struct lttng_condition *lttng_condition_session_rotation_create(
 struct lttng_condition *lttng_condition_session_rotation_ongoing_create(void)
 {
        return lttng_condition_session_rotation_create(
-                       LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING);
+               LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING);
 }
 
 struct lttng_condition *lttng_condition_session_rotation_completed_create(void)
 {
        return lttng_condition_session_rotation_create(
-                       LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED);
+               LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED);
 }
 
-static
-ssize_t init_condition_from_payload(struct lttng_condition *condition,
-               struct lttng_payload_view *src_view)
+static ssize_t init_condition_from_payload(struct lttng_condition *condition,
+                                          struct lttng_payload_view *src_view)
 {
        ssize_t ret, condition_size;
        enum lttng_condition_status status;
@@ -218,8 +188,7 @@ ssize_t init_condition_from_payload(struct lttng_condition *condition,
        struct lttng_buffer_view name_view;
        const struct lttng_condition_session_rotation_comm *condition_comm;
        struct lttng_payload_view condition_comm_view =
-                       lttng_payload_view_from_view(
-                                       src_view, 0, sizeof(*condition_comm));
+               lttng_payload_view_from_view(src_view, 0, sizeof(*condition_comm));
 
        if (!lttng_payload_view_is_valid(&condition_comm_view)) {
                ERR("Failed to initialize from malformed condition buffer: buffer too short to contain header");
@@ -228,8 +197,8 @@ ssize_t init_condition_from_payload(struct lttng_condition *condition,
        }
 
        condition_comm = (typeof(condition_comm)) src_view->buffer.data;
-       name_view = lttng_buffer_view_from_view(&src_view->buffer,
-                                               sizeof(*condition_comm), condition_comm->session_name_len);
+       name_view = lttng_buffer_view_from_view(
+               &src_view->buffer, sizeof(*condition_comm), condition_comm->session_name_len);
 
        if (!lttng_buffer_view_is_valid(&name_view)) {
                ERR("Failed to initialize from malformed condition buffer: buffer too short to contain session name");
@@ -250,8 +219,7 @@ ssize_t init_condition_from_payload(struct lttng_condition *condition,
                goto end;
        }
 
-       status = lttng_condition_session_rotation_set_session_name(condition,
-                       session_name);
+       status = lttng_condition_session_rotation_set_session_name(condition, session_name);
        if (status != LTTNG_CONDITION_STATUS_OK) {
                ERR("Failed to set buffer consumed session name");
                ret = -1;
@@ -263,18 +231,16 @@ ssize_t init_condition_from_payload(struct lttng_condition *condition,
                goto end;
        }
 
-       condition_size = sizeof(*condition_comm) +
-                       (ssize_t) condition_comm->session_name_len;
+       condition_size = sizeof(*condition_comm) + (ssize_t) condition_comm->session_name_len;
        ret = condition_size;
 end:
        return ret;
 }
 
-static
-ssize_t lttng_condition_session_rotation_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_condition **_condition,
-               enum lttng_condition_type type)
+static ssize_t
+lttng_condition_session_rotation_create_from_payload(struct lttng_payload_view *view,
+                                                    struct lttng_condition **_condition,
+                                                    enum lttng_condition_type type)
 {
        ssize_t ret;
        struct lttng_condition *condition = NULL;
@@ -308,28 +274,24 @@ error:
        return ret;
 }
 
-ssize_t lttng_condition_session_rotation_ongoing_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_condition **condition)
+ssize_t
+lttng_condition_session_rotation_ongoing_create_from_payload(struct lttng_payload_view *view,
+                                                            struct lttng_condition **condition)
 {
-       return lttng_condition_session_rotation_create_from_payload(view,
-                       condition,
-                       LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING);
+       return lttng_condition_session_rotation_create_from_payload(
+               view, condition, LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING);
 }
 
-ssize_t lttng_condition_session_rotation_completed_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_condition **condition)
+ssize_t
+lttng_condition_session_rotation_completed_create_from_payload(struct lttng_payload_view *view,
+                                                              struct lttng_condition **condition)
 {
-       return lttng_condition_session_rotation_create_from_payload(view,
-                       condition,
-                       LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED);
+       return lttng_condition_session_rotation_create_from_payload(
+               view, condition, LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED);
 }
 
-static
-struct lttng_evaluation *lttng_evaluation_session_rotation_create(
-               enum lttng_condition_type type, uint64_t id,
-               struct lttng_trace_archive_location *location)
+static struct lttng_evaluation *lttng_evaluation_session_rotation_create(
+       enum lttng_condition_type type, uint64_t id, struct lttng_trace_archive_location *location)
 {
        struct lttng_evaluation_session_rotation *evaluation;
 
@@ -338,8 +300,7 @@ struct lttng_evaluation *lttng_evaluation_session_rotation_create(
                return NULL;
        }
 
-       memcpy(&evaluation->parent, &rotation_evaluation_template,
-                       sizeof(evaluation->parent));
+       memcpy(&evaluation->parent, &rotation_evaluation_template, sizeof(evaluation->parent));
        lttng_evaluation_init(&evaluation->parent, type);
        evaluation->id = id;
        if (location) {
@@ -349,18 +310,15 @@ struct lttng_evaluation *lttng_evaluation_session_rotation_create(
        return &evaluation->parent;
 }
 
-static
-ssize_t create_evaluation_from_payload(
-               enum lttng_condition_type type,
-               struct lttng_payload_view *view,
-               struct lttng_evaluation **_evaluation)
+static ssize_t create_evaluation_from_payload(enum lttng_condition_type type,
+                                             struct lttng_payload_view *view,
+                                             struct lttng_evaluation **_evaluation)
 {
        ssize_t ret, size;
        struct lttng_evaluation *evaluation = NULL;
        struct lttng_trace_archive_location *location = NULL;
        const struct lttng_evaluation_session_rotation_comm *comm;
-       struct lttng_payload_view comm_view = lttng_payload_view_from_view(
-                       view, 0, sizeof(*comm));
+       struct lttng_payload_view comm_view = lttng_payload_view_from_view(view, 0, sizeof(*comm));
 
        if (!lttng_payload_view_is_valid(&comm_view)) {
                goto error;
@@ -370,23 +328,20 @@ ssize_t create_evaluation_from_payload(
        size = sizeof(*comm);
        if (comm->has_location) {
                const struct lttng_buffer_view location_view =
-                               lttng_buffer_view_from_view(
-                                               &view->buffer, sizeof(*comm), -1);
+                       lttng_buffer_view_from_view(&view->buffer, sizeof(*comm), -1);
 
                if (!lttng_buffer_view_is_valid(&location_view)) {
                        goto error;
                }
 
-               ret = lttng_trace_archive_location_create_from_buffer(
-                               &location_view, &location);
+               ret = lttng_trace_archive_location_create_from_buffer(&location_view, &location);
                if (ret < 0) {
                        goto error;
                }
                size += ret;
        }
 
-       evaluation = lttng_evaluation_session_rotation_create(type, comm->id,
-                       location);
+       evaluation = lttng_evaluation_session_rotation_create(type, comm->id, location);
        if (!evaluation) {
                goto error;
        }
@@ -401,11 +356,10 @@ error:
        return -1;
 }
 
-static
-ssize_t lttng_evaluation_session_rotation_create_from_payload(
-               enum lttng_condition_type type,
-               struct lttng_payload_view *view,
-               struct lttng_evaluation **_evaluation)
+static ssize_t
+lttng_evaluation_session_rotation_create_from_payload(enum lttng_condition_type type,
+                                                     struct lttng_payload_view *view,
+                                                     struct lttng_evaluation **_evaluation)
 {
        ssize_t ret;
        struct lttng_evaluation *evaluation = NULL;
@@ -427,44 +381,38 @@ error:
        return ret;
 }
 
-ssize_t lttng_evaluation_session_rotation_ongoing_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_evaluation **evaluation)
+ssize_t
+lttng_evaluation_session_rotation_ongoing_create_from_payload(struct lttng_payload_view *view,
+                                                             struct lttng_evaluation **evaluation)
 {
        return lttng_evaluation_session_rotation_create_from_payload(
-                       LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING,
-                       view, evaluation);
+               LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING, view, evaluation);
 }
 
 ssize_t lttng_evaluation_session_rotation_completed_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_evaluation **evaluation)
+       struct lttng_payload_view *view, struct lttng_evaluation **evaluation)
 {
        return lttng_evaluation_session_rotation_create_from_payload(
-                       LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED,
-                       view, evaluation);
+               LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED, view, evaluation);
 }
 
-struct lttng_evaluation *lttng_evaluation_session_rotation_ongoing_create(
-               uint64_t id)
+struct lttng_evaluation *lttng_evaluation_session_rotation_ongoing_create(uint64_t id)
 {
        return lttng_evaluation_session_rotation_create(
-                       LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING, id,
-                       NULL);
+               LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING, id, NULL);
 }
 
-struct lttng_evaluation *lttng_evaluation_session_rotation_completed_create(
-               uint64_t id, struct lttng_trace_archive_location *location)
+struct lttng_evaluation *
+lttng_evaluation_session_rotation_completed_create(uint64_t id,
+                                                  struct lttng_trace_archive_location *location)
 {
        return lttng_evaluation_session_rotation_create(
-                       LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED, id,
-                       location);
+               LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED, id, location);
 }
 
 enum lttng_condition_status
-lttng_condition_session_rotation_get_session_name(
-               const struct lttng_condition *condition,
-               const char **session_name)
+lttng_condition_session_rotation_get_session_name(const struct lttng_condition *condition,
+                                                 const char **session_name)
 {
        struct lttng_condition_session_rotation *rotation;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
@@ -474,8 +422,7 @@ lttng_condition_session_rotation_get_session_name(
                goto end;
        }
 
-       rotation = lttng::utils::container_of(condition,
-                       &lttng_condition_session_rotation::parent);
+       rotation = lttng::utils::container_of(condition, &lttng_condition_session_rotation::parent);
        if (!rotation->session_name) {
                status = LTTNG_CONDITION_STATUS_UNSET;
                goto end;
@@ -486,21 +433,20 @@ end:
 }
 
 enum lttng_condition_status
-lttng_condition_session_rotation_set_session_name(
-               struct lttng_condition *condition, const char *session_name)
+lttng_condition_session_rotation_set_session_name(struct lttng_condition *condition,
+                                                 const char *session_name)
 {
        char *session_name_copy;
        struct lttng_condition_session_rotation *rotation;
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
 
-       if (!condition || !is_rotation_condition(condition) ||
-                       !session_name || strlen(session_name) == 0) {
+       if (!condition || !is_rotation_condition(condition) || !session_name ||
+           strlen(session_name) == 0) {
                status = LTTNG_CONDITION_STATUS_INVALID;
                goto end;
        }
 
-       rotation = lttng::utils::container_of(condition,
-                       &lttng_condition_session_rotation::parent);
+       rotation = lttng::utils::container_of(condition, &lttng_condition_session_rotation::parent);
        session_name_copy = strdup(session_name);
        if (!session_name_copy) {
                status = LTTNG_CONDITION_STATUS_ERROR;
@@ -513,48 +459,41 @@ end:
        return status;
 }
 
-static
-int lttng_evaluation_session_rotation_serialize(
-               const struct lttng_evaluation *evaluation,
-               struct lttng_payload *payload)
+static int lttng_evaluation_session_rotation_serialize(const struct lttng_evaluation *evaluation,
+                                                      struct lttng_payload *payload)
 {
        int ret;
        struct lttng_evaluation_session_rotation *rotation;
        struct lttng_evaluation_session_rotation_comm comm = {};
 
-       rotation = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_session_rotation::parent);
+       rotation =
+               lttng::utils::container_of(evaluation, &lttng_evaluation_session_rotation::parent);
        comm.id = rotation->id;
        comm.has_location = !!rotation->location;
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &comm, sizeof(comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
        if (ret) {
                goto end;
        }
        if (!rotation->location) {
                goto end;
        }
-       ret = lttng_trace_archive_location_serialize(rotation->location,
-                       &payload->buffer);
+       ret = lttng_trace_archive_location_serialize(rotation->location, &payload->buffer);
 end:
        return ret;
 }
 
-static
-void lttng_evaluation_session_rotation_destroy(
-               struct lttng_evaluation *evaluation)
+static void lttng_evaluation_session_rotation_destroy(struct lttng_evaluation *evaluation)
 {
        struct lttng_evaluation_session_rotation *rotation;
 
-       rotation = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_session_rotation::parent);
+       rotation =
+               lttng::utils::container_of(evaluation, &lttng_evaluation_session_rotation::parent);
        lttng_trace_archive_location_put(rotation->location);
        free(rotation);
 }
 
 enum lttng_evaluation_status
-lttng_evaluation_session_rotation_get_id(
-               const struct lttng_evaluation *evaluation, uint64_t *id)
+lttng_evaluation_session_rotation_get_id(const struct lttng_evaluation *evaluation, uint64_t *id)
 {
        const struct lttng_evaluation_session_rotation *rotation;
        enum lttng_evaluation_status status = LTTNG_EVALUATION_STATUS_OK;
@@ -564,8 +503,8 @@ lttng_evaluation_session_rotation_get_id(
                goto end;
        }
 
-       rotation = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_session_rotation::parent);
+       rotation =
+               lttng::utils::container_of(evaluation, &lttng_evaluation_session_rotation::parent);
        *id = rotation->id;
 end:
        return status;
@@ -577,31 +516,29 @@ end:
  * trace archive location. Hence, users of liblttng-ctl have no visibility of
  * the reference counting of archive locations.
  */
-enum lttng_evaluation_status
-lttng_evaluation_session_rotation_completed_get_location(
-               const struct lttng_evaluation *evaluation,
-               const struct lttng_trace_archive_location **location)
+enum lttng_evaluation_status lttng_evaluation_session_rotation_completed_get_location(
+       const struct lttng_evaluation *evaluation,
+       const struct lttng_trace_archive_location **location)
 {
        const struct lttng_evaluation_session_rotation *rotation;
        enum lttng_evaluation_status status = LTTNG_EVALUATION_STATUS_OK;
 
        if (!evaluation || !location ||
-                       evaluation->type != LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED) {
+           evaluation->type != LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED) {
                status = LTTNG_EVALUATION_STATUS_INVALID;
                goto end;
        }
 
-       rotation = lttng::utils::container_of(evaluation,
-                       &lttng_evaluation_session_rotation::parent);
+       rotation =
+               lttng::utils::container_of(evaluation, &lttng_evaluation_session_rotation::parent);
        *location = rotation->location;
 end:
        return status;
 }
 
-static
-enum lttng_error_code lttng_condition_session_rotation_mi_serialize(
-               const struct lttng_condition *condition,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_condition_session_rotation_mi_serialize(const struct lttng_condition *condition,
+                                             struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -615,20 +552,17 @@ enum lttng_error_code lttng_condition_session_rotation_mi_serialize(
 
        switch (lttng_condition_get_type(condition)) {
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED:
-               type_element_str =
-                               mi_lttng_element_condition_session_rotation_completed;
+               type_element_str = mi_lttng_element_condition_session_rotation_completed;
                break;
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING:
-               type_element_str =
-                               mi_lttng_element_condition_session_rotation_ongoing;
+               type_element_str = mi_lttng_element_condition_session_rotation_ongoing;
                break;
        default:
                abort();
                break;
        }
 
-       status = lttng_condition_session_rotation_get_session_name(
-                       condition, &session_name);
+       status = lttng_condition_session_rotation_get_session_name(condition, &session_name);
        LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
        LTTNG_ASSERT(session_name);
 
@@ -640,7 +574,7 @@ enum lttng_error_code lttng_condition_session_rotation_mi_serialize(
 
        /* Session name. */
        ret = mi_lttng_writer_write_element_string(
-                       writer, mi_lttng_element_session_name, session_name);
+               writer, mi_lttng_element_session_name, session_name);
        if (ret) {
                goto mi_error;
        }
index 8f96b7f21e638a122fef392a4a5ed0e7dd3a86bf..5f3c44dba06a6fd391534c6f9944783523559bb4 100644 (file)
@@ -7,35 +7,36 @@
 
 #include "lttng/tracker.h"
 #define _LGPL_SOURCE
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdbool.h>
+#include "config-internal.hpp"
+#include "session-config.hpp"
 
+#include <common/compat/getenv.hpp>
 #include <common/defaults.hpp>
+#include <common/dynamic-buffer.hpp>
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/utils.hpp>
-#include <common/dynamic-buffer.hpp>
-#include <common/compat/getenv.hpp>
+
 #include <lttng/lttng-error.h>
-#include <libxml/parser.h>
-#include <libxml/valid.h>
-#include <libxml/xmlschemas.h>
-#include <libxml/tree.h>
 #include <lttng/lttng.h>
-#include <lttng/snapshot.h>
 #include <lttng/rotation.h>
+#include <lttng/snapshot.h>
 #include <lttng/userspace-probe.h>
 
-#include "session-config.hpp"
-#include "config-internal.hpp"
+#include <ctype.h>
+#include <dirent.h>
+#include <inttypes.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/valid.h>
+#include <libxml/xmlschemas.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #define CONFIG_USERSPACE_PROBE_LOOKUP_METHOD_NAME_MAX_LEN 7
 
@@ -47,185 +48,189 @@ struct session_config_validation_ctx {
 };
 } /* namespace */
 
-const char * const config_element_all = "all";
+const char *const config_element_all = "all";
 LTTNG_EXPORT const char *config_xml_encoding = "UTF-8";
-LTTNG_EXPORT size_t config_xml_encoding_bytes_per_char = 2;    /* Size of the encoding's largest character */
+LTTNG_EXPORT size_t config_xml_encoding_bytes_per_char = 2; /* Size of the encoding's largest
+                                                              character */
 LTTNG_EXPORT const char *config_xml_indent_string = "\t";
 LTTNG_EXPORT const char *config_xml_true = "true";
 LTTNG_EXPORT const char *config_xml_false = "false";
 
-const char * const config_element_channel = "channel";
-const char * const config_element_channels = "channels";
-const char * const config_element_domain = "domain";
-const char * const config_element_domains = "domains";
-const char * const config_element_event = "event";
-const char * const config_element_events = "events";
-const char * const config_element_context = "context";
-const char * const config_element_contexts = "contexts";
-const char * const config_element_attributes = "attributes";
-const char * const config_element_exclusion = "exclusion";
-const char * const config_element_exclusions = "exclusions";
-const char * const config_element_function_attributes = "function_attributes";
-const char * const config_element_probe_attributes = "probe_attributes";
-const char * const config_element_symbol_name = "symbol_name";
-const char * const config_element_address = "address";
-const char * const config_element_offset = "offset";
-
-const char * const config_element_userspace_probe_lookup = "lookup_method";
-const char * const config_element_userspace_probe_lookup_function_default = "DEFAULT";
-const char * const config_element_userspace_probe_lookup_function_elf = "ELF";
-const char * const config_element_userspace_probe_lookup_tracepoint_sdt = "SDT";
-const char * const config_element_userspace_probe_location_binary_path = "binary_path";
-const char * const config_element_userspace_probe_function_attributes = "userspace_probe_function_attributes";
-const char * const config_element_userspace_probe_function_location_function_name = "function_name";
-const char * const config_element_userspace_probe_tracepoint_attributes = "userspace_probe_tracepoint_attributes";
-const char * const config_element_userspace_probe_tracepoint_location_provider_name = "provider_name";
-const char * const config_element_userspace_probe_tracepoint_location_probe_name = "probe_name";
-
-const char * const config_element_name = "name";
-const char * const config_element_enabled = "enabled";
-const char * const config_element_overwrite_mode = "overwrite_mode";
-const char * const config_element_subbuf_size = "subbuffer_size";
-const char * const config_element_num_subbuf = "subbuffer_count";
-const char * const config_element_switch_timer_interval = "switch_timer_interval";
-const char * const config_element_read_timer_interval = "read_timer_interval";
-const char * const config_element_monitor_timer_interval = "monitor_timer_interval";
-const char * const config_element_blocking_timeout = "blocking_timeout";
-const char * const config_element_output = "output";
-const char * const config_element_output_type = "output_type";
-const char * const config_element_tracefile_size = "tracefile_size";
-const char * const config_element_tracefile_count = "tracefile_count";
-const char * const config_element_live_timer_interval = "live_timer_interval";
-const char * const config_element_discarded_events = "discarded_events";
-const char * const config_element_lost_packets = "lost_packets";
-const char * const config_element_type = "type";
-const char * const config_element_buffer_type = "buffer_type";
-const char * const config_element_session = "session";
-const char * const config_element_sessions = "sessions";
-const char * const config_element_context_perf = "perf";
-const char * const config_element_context_app = "app";
-const char * const config_element_context_app_provider_name = "provider_name";
-const char * const config_element_context_app_ctx_name = "ctx_name";
-const char * const config_element_config = "config";
-const char * const config_element_started = "started";
-const char * const config_element_snapshot_mode = "snapshot_mode";
-const char * const config_element_loglevel = "loglevel";
-const char * const config_element_loglevel_type = "loglevel_type";
-const char * const config_element_filter = "filter";
-const char * const config_element_filter_expression = "filter_expression";
-const char * const config_element_snapshot_outputs = "snapshot_outputs";
-const char * const config_element_consumer_output = "consumer_output";
-const char * const config_element_destination = "destination";
-const char * const config_element_path = "path";
-const char * const config_element_net_output = "net_output";
-const char * const config_element_control_uri = "control_uri";
-const char * const config_element_data_uri = "data_uri";
-const char * const config_element_max_size = "max_size";
-const char * const config_element_pid = "pid";
-const char * const config_element_pids = "pids";
-const char * const config_element_shared_memory_path = "shared_memory_path";
-
-const char * const config_element_process_attr_id = "id";
-const char * const config_element_process_attr_tracker_pid = "pid_process_attr_tracker";
-const char * const config_element_process_attr_tracker_vpid = "vpid_process_attr_tracker";
-const char * const config_element_process_attr_tracker_uid = "uid_process_attr_tracker";
-const char * const config_element_process_attr_tracker_vuid = "vuid_process_attr_tracker";
-const char * const config_element_process_attr_tracker_gid = "gid_process_attr_tracker";
-const char * const config_element_process_attr_tracker_vgid = "vgid_process_attr_tracker";
-const char * const config_element_process_attr_trackers = "process_attr_trackers";
-const char * const config_element_process_attr_values = "process_attr_values";
-const char * const config_element_process_attr_value_type = "process_attr_value_type";
-const char * const config_element_process_attr_pid_value = "pid";
-const char * const config_element_process_attr_vpid_value = "vpid";
-const char * const config_element_process_attr_uid_value = "uid";
-const char * const config_element_process_attr_vuid_value = "vuid";
-const char * const config_element_process_attr_gid_value = "gid";
-const char * const config_element_process_attr_vgid_value = "vgid";
-const char * const config_element_process_attr_tracker_type = "process_attr_tracker_type";
+const char *const config_element_channel = "channel";
+const char *const config_element_channels = "channels";
+const char *const config_element_domain = "domain";
+const char *const config_element_domains = "domains";
+const char *const config_element_event = "event";
+const char *const config_element_events = "events";
+const char *const config_element_context = "context";
+const char *const config_element_contexts = "contexts";
+const char *const config_element_attributes = "attributes";
+const char *const config_element_exclusion = "exclusion";
+const char *const config_element_exclusions = "exclusions";
+const char *const config_element_function_attributes = "function_attributes";
+const char *const config_element_probe_attributes = "probe_attributes";
+const char *const config_element_symbol_name = "symbol_name";
+const char *const config_element_address = "address";
+const char *const config_element_offset = "offset";
+
+const char *const config_element_userspace_probe_lookup = "lookup_method";
+const char *const config_element_userspace_probe_lookup_function_default = "DEFAULT";
+const char *const config_element_userspace_probe_lookup_function_elf = "ELF";
+const char *const config_element_userspace_probe_lookup_tracepoint_sdt = "SDT";
+const char *const config_element_userspace_probe_location_binary_path = "binary_path";
+const char *const config_element_userspace_probe_function_attributes =
+       "userspace_probe_function_attributes";
+const char *const config_element_userspace_probe_function_location_function_name = "function_name";
+const char *const config_element_userspace_probe_tracepoint_attributes =
+       "userspace_probe_tracepoint_attributes";
+const char *const config_element_userspace_probe_tracepoint_location_provider_name =
+       "provider_name";
+const char *const config_element_userspace_probe_tracepoint_location_probe_name = "probe_name";
+
+const char *const config_element_name = "name";
+const char *const config_element_enabled = "enabled";
+const char *const config_element_overwrite_mode = "overwrite_mode";
+const char *const config_element_subbuf_size = "subbuffer_size";
+const char *const config_element_num_subbuf = "subbuffer_count";
+const char *const config_element_switch_timer_interval = "switch_timer_interval";
+const char *const config_element_read_timer_interval = "read_timer_interval";
+const char *const config_element_monitor_timer_interval = "monitor_timer_interval";
+const char *const config_element_blocking_timeout = "blocking_timeout";
+const char *const config_element_output = "output";
+const char *const config_element_output_type = "output_type";
+const char *const config_element_tracefile_size = "tracefile_size";
+const char *const config_element_tracefile_count = "tracefile_count";
+const char *const config_element_live_timer_interval = "live_timer_interval";
+const char *const config_element_discarded_events = "discarded_events";
+const char *const config_element_lost_packets = "lost_packets";
+const char *const config_element_type = "type";
+const char *const config_element_buffer_type = "buffer_type";
+const char *const config_element_session = "session";
+const char *const config_element_sessions = "sessions";
+const char *const config_element_context_perf = "perf";
+const char *const config_element_context_app = "app";
+const char *const config_element_context_app_provider_name = "provider_name";
+const char *const config_element_context_app_ctx_name = "ctx_name";
+const char *const config_element_config = "config";
+const char *const config_element_started = "started";
+const char *const config_element_snapshot_mode = "snapshot_mode";
+const char *const config_element_loglevel = "loglevel";
+const char *const config_element_loglevel_type = "loglevel_type";
+const char *const config_element_filter = "filter";
+const char *const config_element_filter_expression = "filter_expression";
+const char *const config_element_snapshot_outputs = "snapshot_outputs";
+const char *const config_element_consumer_output = "consumer_output";
+const char *const config_element_destination = "destination";
+const char *const config_element_path = "path";
+const char *const config_element_net_output = "net_output";
+const char *const config_element_control_uri = "control_uri";
+const char *const config_element_data_uri = "data_uri";
+const char *const config_element_max_size = "max_size";
+const char *const config_element_pid = "pid";
+const char *const config_element_pids = "pids";
+const char *const config_element_shared_memory_path = "shared_memory_path";
+
+const char *const config_element_process_attr_id = "id";
+const char *const config_element_process_attr_tracker_pid = "pid_process_attr_tracker";
+const char *const config_element_process_attr_tracker_vpid = "vpid_process_attr_tracker";
+const char *const config_element_process_attr_tracker_uid = "uid_process_attr_tracker";
+const char *const config_element_process_attr_tracker_vuid = "vuid_process_attr_tracker";
+const char *const config_element_process_attr_tracker_gid = "gid_process_attr_tracker";
+const char *const config_element_process_attr_tracker_vgid = "vgid_process_attr_tracker";
+const char *const config_element_process_attr_trackers = "process_attr_trackers";
+const char *const config_element_process_attr_values = "process_attr_values";
+const char *const config_element_process_attr_value_type = "process_attr_value_type";
+const char *const config_element_process_attr_pid_value = "pid";
+const char *const config_element_process_attr_vpid_value = "vpid";
+const char *const config_element_process_attr_uid_value = "uid";
+const char *const config_element_process_attr_vuid_value = "vuid";
+const char *const config_element_process_attr_gid_value = "gid";
+const char *const config_element_process_attr_vgid_value = "vgid";
+const char *const config_element_process_attr_tracker_type = "process_attr_tracker_type";
 
 /* Used for support of legacy tracker serialization (< 2.12). */
-const char * const config_element_trackers_legacy = "trackers";
-const char * const config_element_pid_tracker_legacy = "pid_tracker";
-const char * const config_element_tracker_targets_legacy = "targets";
-const char * const config_element_tracker_pid_legacy = "pid";
-
-const char * const config_element_rotation_schedules = "rotation_schedules";
-const char * const config_element_rotation_schedule_periodic = "periodic";
-const char * const config_element_rotation_schedule_periodic_time_us = "time_us";
-const char * const config_element_rotation_schedule_size_threshold = "size_threshold";
-const char * const config_element_rotation_schedule_size_threshold_bytes = "bytes";
-
-const char * const config_domain_type_kernel = "KERNEL";
-const char * const config_domain_type_ust = "UST";
-const char * const config_domain_type_jul = "JUL";
-const char * const config_domain_type_log4j = "LOG4J";
-const char * const config_domain_type_python = "PYTHON";
-
-const char * const config_buffer_type_per_pid = "PER_PID";
-const char * const config_buffer_type_per_uid = "PER_UID";
-const char * const config_buffer_type_global = "GLOBAL";
-
-const char * const config_overwrite_mode_discard = "DISCARD";
-const char * const config_overwrite_mode_overwrite = "OVERWRITE";
-
-const char * const config_output_type_splice = "SPLICE";
-const char * const config_output_type_mmap = "MMAP";
-
-const char * const config_loglevel_type_all = "ALL";
-const char * const config_loglevel_type_range = "RANGE";
-const char * const config_loglevel_type_single = "SINGLE";
-
-const char * const config_event_type_all = "ALL";
-const char * const config_event_type_tracepoint = "TRACEPOINT";
-const char * const config_event_type_probe = "PROBE";
-const char * const config_event_type_userspace_probe = "USERSPACE_PROBE";
-const char * const config_event_type_function = "FUNCTION";
-const char * const config_event_type_function_entry = "FUNCTION_ENTRY";
-const char * const config_event_type_noop = "NOOP";
-const char * const config_event_type_syscall = "SYSCALL";
-const char * const config_event_type_kprobe = "KPROBE";
-const char * const config_event_type_kretprobe = "KRETPROBE";
-
-const char * const config_event_context_pid = "PID";
-const char * const config_event_context_procname = "PROCNAME";
-const char * const config_event_context_prio = "PRIO";
-const char * const config_event_context_nice = "NICE";
-const char * const config_event_context_vpid = "VPID";
-const char * const config_event_context_tid = "TID";
-const char * const config_event_context_vtid = "VTID";
-const char * const config_event_context_ppid = "PPID";
-const char * const config_event_context_vppid = "VPPID";
-const char * const config_event_context_pthread_id = "PTHREAD_ID";
-const char * const config_event_context_hostname = "HOSTNAME";
-const char * const config_event_context_ip = "IP";
-const char * const config_event_context_perf_thread_counter = "PERF_THREAD_COUNTER";
-const char * const config_event_context_app = "APP";
-const char * const config_event_context_interruptible = "INTERRUPTIBLE";
-const char * const config_event_context_preemptible = "PREEMPTIBLE";
-const char * const config_event_context_need_reschedule = "NEED_RESCHEDULE";
-const char * const config_event_context_migratable = "MIGRATABLE";
-const char * const config_event_context_callstack_user= "CALLSTACK_USER";
-const char * const config_event_context_callstack_kernel = "CALLSTACK_KERNEL";
-const char * const config_event_context_cgroup_ns = "CGROUP_NS";
-const char * const config_event_context_ipc_ns = "IPC_NS";
-const char * const config_event_context_mnt_ns = "MNT_NS";
-const char * const config_event_context_net_ns = "NET_NS";
-const char * const config_event_context_pid_ns = "PID_NS";
-const char * const config_event_context_time_ns = "TIME_NS";
-const char * const config_event_context_user_ns = "USER_NS";
-const char * const config_event_context_uts_ns = "UTS_NS";
-const char * const config_event_context_uid = "UID";
-const char * const config_event_context_euid = "EUID";
-const char * const config_event_context_suid = "SUID";
-const char * const config_event_context_gid = "GID";
-const char * const config_event_context_egid = "EGID";
-const char * const config_event_context_sgid = "SGID";
-const char * const config_event_context_vuid = "VUID";
-const char * const config_event_context_veuid = "VEUID";
-const char * const config_event_context_vsuid = "VSUID";
-const char * const config_event_context_vgid = "VGID";
-const char * const config_event_context_vegid = "VEGID";
-const char * const config_event_context_vsgid = "VSGID";
+const char *const config_element_trackers_legacy = "trackers";
+const char *const config_element_pid_tracker_legacy = "pid_tracker";
+const char *const config_element_tracker_targets_legacy = "targets";
+const char *const config_element_tracker_pid_legacy = "pid";
+
+const char *const config_element_rotation_schedules = "rotation_schedules";
+const char *const config_element_rotation_schedule_periodic = "periodic";
+const char *const config_element_rotation_schedule_periodic_time_us = "time_us";
+const char *const config_element_rotation_schedule_size_threshold = "size_threshold";
+const char *const config_element_rotation_schedule_size_threshold_bytes = "bytes";
+
+const char *const config_domain_type_kernel = "KERNEL";
+const char *const config_domain_type_ust = "UST";
+const char *const config_domain_type_jul = "JUL";
+const char *const config_domain_type_log4j = "LOG4J";
+const char *const config_domain_type_python = "PYTHON";
+
+const char *const config_buffer_type_per_pid = "PER_PID";
+const char *const config_buffer_type_per_uid = "PER_UID";
+const char *const config_buffer_type_global = "GLOBAL";
+
+const char *const config_overwrite_mode_discard = "DISCARD";
+const char *const config_overwrite_mode_overwrite = "OVERWRITE";
+
+const char *const config_output_type_splice = "SPLICE";
+const char *const config_output_type_mmap = "MMAP";
+
+const char *const config_loglevel_type_all = "ALL";
+const char *const config_loglevel_type_range = "RANGE";
+const char *const config_loglevel_type_single = "SINGLE";
+
+const char *const config_event_type_all = "ALL";
+const char *const config_event_type_tracepoint = "TRACEPOINT";
+const char *const config_event_type_probe = "PROBE";
+const char *const config_event_type_userspace_probe = "USERSPACE_PROBE";
+const char *const config_event_type_function = "FUNCTION";
+const char *const config_event_type_function_entry = "FUNCTION_ENTRY";
+const char *const config_event_type_noop = "NOOP";
+const char *const config_event_type_syscall = "SYSCALL";
+const char *const config_event_type_kprobe = "KPROBE";
+const char *const config_event_type_kretprobe = "KRETPROBE";
+
+const char *const config_event_context_pid = "PID";
+const char *const config_event_context_procname = "PROCNAME";
+const char *const config_event_context_prio = "PRIO";
+const char *const config_event_context_nice = "NICE";
+const char *const config_event_context_vpid = "VPID";
+const char *const config_event_context_tid = "TID";
+const char *const config_event_context_vtid = "VTID";
+const char *const config_event_context_ppid = "PPID";
+const char *const config_event_context_vppid = "VPPID";
+const char *const config_event_context_pthread_id = "PTHREAD_ID";
+const char *const config_event_context_hostname = "HOSTNAME";
+const char *const config_event_context_ip = "IP";
+const char *const config_event_context_perf_thread_counter = "PERF_THREAD_COUNTER";
+const char *const config_event_context_app = "APP";
+const char *const config_event_context_interruptible = "INTERRUPTIBLE";
+const char *const config_event_context_preemptible = "PREEMPTIBLE";
+const char *const config_event_context_need_reschedule = "NEED_RESCHEDULE";
+const char *const config_event_context_migratable = "MIGRATABLE";
+const char *const config_event_context_callstack_user = "CALLSTACK_USER";
+const char *const config_event_context_callstack_kernel = "CALLSTACK_KERNEL";
+const char *const config_event_context_cgroup_ns = "CGROUP_NS";
+const char *const config_event_context_ipc_ns = "IPC_NS";
+const char *const config_event_context_mnt_ns = "MNT_NS";
+const char *const config_event_context_net_ns = "NET_NS";
+const char *const config_event_context_pid_ns = "PID_NS";
+const char *const config_event_context_time_ns = "TIME_NS";
+const char *const config_event_context_user_ns = "USER_NS";
+const char *const config_event_context_uts_ns = "UTS_NS";
+const char *const config_event_context_uid = "UID";
+const char *const config_event_context_euid = "EUID";
+const char *const config_event_context_suid = "SUID";
+const char *const config_event_context_gid = "GID";
+const char *const config_event_context_egid = "EGID";
+const char *const config_event_context_sgid = "SGID";
+const char *const config_event_context_vuid = "VUID";
+const char *const config_event_context_veuid = "VEUID";
+const char *const config_event_context_vsuid = "VSUID";
+const char *const config_event_context_vgid = "VGID";
+const char *const config_event_context_vegid = "VEGID";
+const char *const config_event_context_vsgid = "VSGID";
 
 /* Deprecated symbols */
 LTTNG_EXPORT const char *config_element_perf;
@@ -303,14 +308,12 @@ struct config_writer *config_writer_create(int fd_output, int indent)
        }
 
        writer->writer = xmlNewTextWriter(buffer);
-       ret = xmlTextWriterStartDocument(writer->writer, NULL,
-               config_xml_encoding, NULL);
+       ret = xmlTextWriterStartDocument(writer->writer, NULL, config_xml_encoding, NULL);
        if (ret < 0) {
                goto error_destroy;
        }
 
-       ret = xmlTextWriterSetIndentString(writer->writer,
-               BAD_CAST config_xml_indent_string);
+       ret = xmlTextWriterSetIndentString(writer->writer, BAD_CAST config_xml_indent_string);
        if (ret) {
                goto error_destroy;
        }
@@ -350,8 +353,7 @@ end:
        return ret;
 }
 
-int config_writer_open_element(struct config_writer *writer,
-       const char *element_name)
+int config_writer_open_element(struct config_writer *writer, const char *element_name)
 {
        int ret;
        xmlChar *encoded_element_name;
@@ -373,8 +375,7 @@ end:
        return ret >= 0 ? 0 : ret;
 }
 
-int config_writer_write_attribute(struct config_writer *writer,
-               const char *name, const char *value)
+int config_writer_write_attribute(struct config_writer *writer, const char *name, const char *value)
 {
        int ret;
        xmlChar *encoded_name = NULL;
@@ -397,8 +398,7 @@ int config_writer_write_attribute(struct config_writer *writer,
                goto end;
        }
 
-       ret = xmlTextWriterWriteAttribute(writer->writer, encoded_name,
-                       encoded_value);
+       ret = xmlTextWriterWriteAttribute(writer->writer, encoded_name, encoded_value);
 end:
        xmlFree(encoded_name);
        xmlFree(encoded_value);
@@ -420,7 +420,8 @@ end:
 }
 
 int config_writer_write_element_unsigned_int(struct config_writer *writer,
-               const char *element_name, uint64_t value)
+                                            const char *element_name,
+                                            uint64_t value)
 {
        int ret;
        xmlChar *encoded_element_name;
@@ -436,15 +437,16 @@ int config_writer_write_element_unsigned_int(struct config_writer *writer,
                goto end;
        }
 
-       ret = xmlTextWriterWriteFormatElement(writer->writer,
-               encoded_element_name, "%" PRIu64, value);
+       ret = xmlTextWriterWriteFormatElement(
+               writer->writer, encoded_element_name, "%" PRIu64, value);
        xmlFree(encoded_element_name);
 end:
        return ret >= 0 ? 0 : ret;
 }
 
 int config_writer_write_element_signed_int(struct config_writer *writer,
-               const char *element_name, int64_t value)
+                                          const char *element_name,
+                                          int64_t value)
 {
        int ret;
        xmlChar *encoded_element_name;
@@ -460,23 +462,24 @@ int config_writer_write_element_signed_int(struct config_writer *writer,
                goto end;
        }
 
-       ret = xmlTextWriterWriteFormatElement(writer->writer,
-               encoded_element_name, "%" PRIi64, value);
+       ret = xmlTextWriterWriteFormatElement(
+               writer->writer, encoded_element_name, "%" PRIi64, value);
        xmlFree(encoded_element_name);
 end:
        return ret >= 0 ? 0 : ret;
 }
 
 int config_writer_write_element_bool(struct config_writer *writer,
-               const char *element_name, int value)
+                                    const char *element_name,
+                                    int value)
 {
-       return config_writer_write_element_string(writer, element_name,
-               value ? config_xml_true : config_xml_false);
+       return config_writer_write_element_string(
+               writer, element_name, value ? config_xml_true : config_xml_false);
 }
 
 int config_writer_write_element_double(struct config_writer *writer,
-               const char *element_name,
-               double value)
+                                      const char *element_name,
+                                      double value)
 {
        int ret;
        xmlChar *encoded_element_name;
@@ -492,22 +495,21 @@ int config_writer_write_element_double(struct config_writer *writer,
                goto end;
        }
 
-       ret = xmlTextWriterWriteFormatElement(
-                       writer->writer, encoded_element_name, "%f", value);
+       ret = xmlTextWriterWriteFormatElement(writer->writer, encoded_element_name, "%f", value);
        xmlFree(encoded_element_name);
 end:
        return ret >= 0 ? 0 : ret;
 }
 
 int config_writer_write_element_string(struct config_writer *writer,
-               const char *element_name, const char *value)
+                                      const char *element_name,
+                                      const char *value)
 {
        int ret;
        xmlChar *encoded_element_name = NULL;
        xmlChar *encoded_value = NULL;
 
-       if (!writer || !writer->writer || !element_name || !element_name[0] ||
-               !value) {
+       if (!writer || !writer->writer || !element_name || !element_name[0] || !value) {
                ret = -1;
                goto end;
        }
@@ -524,16 +526,16 @@ int config_writer_write_element_string(struct config_writer *writer,
                goto end;
        }
 
-       ret = xmlTextWriterWriteElement(writer->writer, encoded_element_name,
-                       encoded_value);
+       ret = xmlTextWriterWriteElement(writer->writer, encoded_element_name, encoded_value);
 end:
        xmlFree(encoded_element_name);
        xmlFree(encoded_value);
        return ret >= 0 ? 0 : ret;
 }
 
-static ATTR_FORMAT_PRINTF(2, 3)
-void xml_error_handler(void *ctx __attribute__((unused)), const char *format, ...)
+static ATTR_FORMAT_PRINTF(2, 3) void xml_error_handler(void *ctx __attribute__((unused)),
+                                                      const char *format,
+                                                      ...)
 {
        char *errMsg;
        va_list args;
@@ -551,9 +553,7 @@ void xml_error_handler(void *ctx __attribute__((unused)), const char *format, ..
        free(errMsg);
 }
 
-static
-void fini_session_config_validation_ctx(
-       struct session_config_validation_ctx *ctx)
+static void fini_session_config_validation_ctx(struct session_config_validation_ctx *ctx)
 {
        if (ctx->parser_ctx) {
                xmlSchemaFreeParserCtxt(ctx->parser_ctx);
@@ -570,8 +570,7 @@ void fini_session_config_validation_ctx(
        memset(ctx, 0, sizeof(struct session_config_validation_ctx));
 }
 
-static
-char *get_session_config_xsd_path(void)
+static char *get_session_config_xsd_path(void)
 {
        char *xsd_path;
        const char *base_path = lttng_secure_getenv(DEFAULT_SESSION_CONFIG_XSD_PATH_ENV);
@@ -583,8 +582,7 @@ char *get_session_config_xsd_path(void)
        }
 
        base_path_len = strlen(base_path);
-       max_path_len = base_path_len +
-               sizeof(DEFAULT_SESSION_CONFIG_XSD_FILENAME) + 1;
+       max_path_len = base_path_len + sizeof(DEFAULT_SESSION_CONFIG_XSD_FILENAME) + 1;
        xsd_path = zmalloc<char>(max_path_len);
        if (!xsd_path) {
                goto end;
@@ -600,9 +598,7 @@ end:
        return xsd_path;
 }
 
-static
-int init_session_config_validation_ctx(
-       struct session_config_validation_ctx *ctx)
+static int init_session_config_validation_ctx(struct session_config_validation_ctx *ctx)
 {
        int ret;
        char *xsd_path = get_session_config_xsd_path();
@@ -618,8 +614,7 @@ int init_session_config_validation_ctx(
                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                goto end;
        }
-       xmlSchemaSetParserErrors(ctx->parser_ctx, xml_error_handler,
-               xml_error_handler, NULL);
+       xmlSchemaSetParserErrors(ctx->parser_ctx, xml_error_handler, xml_error_handler, NULL);
 
        ctx->schema = xmlSchemaParse(ctx->parser_ctx);
        if (!ctx->schema) {
@@ -635,8 +630,8 @@ int init_session_config_validation_ctx(
                goto end;
        }
 
-       xmlSchemaSetValidErrors(ctx->schema_validation_ctx, xml_error_handler,
-                       xml_error_handler, NULL);
+       xmlSchemaSetValidErrors(
+               ctx->schema_validation_ctx, xml_error_handler, xml_error_handler, NULL);
        ret = 0;
 
 end:
@@ -648,8 +643,7 @@ end:
        return ret;
 }
 
-static
-int parse_uint(xmlChar *str, uint64_t *val)
+static int parse_uint(xmlChar *str, uint64_t *val)
 {
        int ret;
        char *endptr;
@@ -670,8 +664,7 @@ end:
        return ret;
 }
 
-static
-int parse_int(xmlChar *str, int64_t *val)
+static int parse_int(xmlChar *str, int64_t *val)
 {
        int ret;
        char *endptr;
@@ -692,8 +685,7 @@ end:
        return ret;
 }
 
-static
-int parse_bool(xmlChar *str, int *val)
+static int parse_bool(xmlChar *str, int *val)
 {
        int ret = 0;
 
@@ -702,23 +694,20 @@ int parse_bool(xmlChar *str, int *val)
                goto end;
        }
 
-       if (!strcmp((const char *) str, config_xml_true) ||
-                       !strcmp((const char *) str, "1")) {
+       if (!strcmp((const char *) str, config_xml_true) || !strcmp((const char *) str, "1")) {
                *val = 1;
        } else if (!strcmp((const char *) str, config_xml_false) ||
-                       !strcmp((const char *) str, "0")) {
+                  !strcmp((const char *) str, "0")) {
                *val = 0;
        } else {
-               WARN("Invalid boolean value encountered (%s).",
-                       (const char *) str);
+               WARN("Invalid boolean value encountered (%s).", (const char *) str);
                ret = -1;
        }
 end:
        return ret;
 }
 
-static
-int get_domain_type(xmlChar *domain)
+static int get_domain_type(xmlChar *domain)
 {
        int ret;
 
@@ -745,8 +734,7 @@ error:
        return -1;
 }
 
-static
-int get_buffer_type(xmlChar *buffer_type)
+static int get_buffer_type(xmlChar *buffer_type)
 {
        int ret;
 
@@ -769,8 +757,7 @@ error:
        return -1;
 }
 
-static
-int get_overwrite_mode(xmlChar *overwrite_mode)
+static int get_overwrite_mode(xmlChar *overwrite_mode)
 {
        int ret;
 
@@ -780,8 +767,7 @@ int get_overwrite_mode(xmlChar *overwrite_mode)
 
        if (!strcmp((char *) overwrite_mode, config_overwrite_mode_overwrite)) {
                ret = 1;
-       } else if (!strcmp((char *) overwrite_mode,
-               config_overwrite_mode_discard)) {
+       } else if (!strcmp((char *) overwrite_mode, config_overwrite_mode_discard)) {
                ret = 0;
        } else {
                goto error;
@@ -792,8 +778,7 @@ error:
        return -1;
 }
 
-static
-int get_output_type(xmlChar *output_type)
+static int get_output_type(xmlChar *output_type)
 {
        int ret;
 
@@ -814,8 +799,7 @@ error:
        return -1;
 }
 
-static
-int get_event_type(xmlChar *event_type)
+static int get_event_type(xmlChar *event_type)
 {
        int ret;
 
@@ -829,13 +813,11 @@ int get_event_type(xmlChar *event_type)
                ret = LTTNG_EVENT_TRACEPOINT;
        } else if (!strcmp((char *) event_type, config_event_type_probe)) {
                ret = LTTNG_EVENT_PROBE;
-       } else if (!strcmp((char *) event_type,
-                               config_event_type_userspace_probe)) {
+       } else if (!strcmp((char *) event_type, config_event_type_userspace_probe)) {
                ret = LTTNG_EVENT_USERSPACE_PROBE;
        } else if (!strcmp((char *) event_type, config_event_type_function)) {
                ret = LTTNG_EVENT_FUNCTION;
-       } else if (!strcmp((char *) event_type,
-                               config_event_type_function_entry)) {
+       } else if (!strcmp((char *) event_type, config_event_type_function_entry)) {
                ret = LTTNG_EVENT_FUNCTION_ENTRY;
        } else if (!strcmp((char *) event_type, config_event_type_noop)) {
                ret = LTTNG_EVENT_NOOP;
@@ -850,8 +832,7 @@ error:
        return -1;
 }
 
-static
-int get_loglevel_type(xmlChar *loglevel_type)
+static int get_loglevel_type(xmlChar *loglevel_type)
 {
        int ret;
 
@@ -861,11 +842,9 @@ int get_loglevel_type(xmlChar *loglevel_type)
 
        if (!strcmp((char *) loglevel_type, config_loglevel_type_all)) {
                ret = LTTNG_EVENT_LOGLEVEL_ALL;
-       } else if (!strcmp((char *) loglevel_type,
-               config_loglevel_type_range)) {
+       } else if (!strcmp((char *) loglevel_type, config_loglevel_type_range)) {
                ret = LTTNG_EVENT_LOGLEVEL_RANGE;
-       } else if (!strcmp((char *) loglevel_type,
-               config_loglevel_type_single)) {
+       } else if (!strcmp((char *) loglevel_type, config_loglevel_type_single)) {
                ret = LTTNG_EVENT_LOGLEVEL_SINGLE;
        } else {
                goto error;
@@ -879,8 +858,7 @@ error:
 /*
  * Return the context type or -1 on error.
  */
-static
-int get_context_type(xmlChar *context_type)
+static int get_context_type(xmlChar *context_type)
 {
        int ret;
 
@@ -890,116 +868,79 @@ int get_context_type(xmlChar *context_type)
 
        if (!strcmp((char *) context_type, config_event_context_pid)) {
                ret = LTTNG_EVENT_CONTEXT_PID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_procname)) {
+       } else if (!strcmp((char *) context_type, config_event_context_procname)) {
                ret = LTTNG_EVENT_CONTEXT_PROCNAME;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_prio)) {
+       } else if (!strcmp((char *) context_type, config_event_context_prio)) {
                ret = LTTNG_EVENT_CONTEXT_PRIO;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_nice)) {
+       } else if (!strcmp((char *) context_type, config_event_context_nice)) {
                ret = LTTNG_EVENT_CONTEXT_NICE;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_vpid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_vpid)) {
                ret = LTTNG_EVENT_CONTEXT_VPID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_tid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_tid)) {
                ret = LTTNG_EVENT_CONTEXT_TID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_vtid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_vtid)) {
                ret = LTTNG_EVENT_CONTEXT_VTID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_ppid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_ppid)) {
                ret = LTTNG_EVENT_CONTEXT_PPID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_vppid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_vppid)) {
                ret = LTTNG_EVENT_CONTEXT_VPPID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_pthread_id)) {
+       } else if (!strcmp((char *) context_type, config_event_context_pthread_id)) {
                ret = LTTNG_EVENT_CONTEXT_PTHREAD_ID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_hostname)) {
+       } else if (!strcmp((char *) context_type, config_event_context_hostname)) {
                ret = LTTNG_EVENT_CONTEXT_HOSTNAME;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_ip)) {
+       } else if (!strcmp((char *) context_type, config_event_context_ip)) {
                ret = LTTNG_EVENT_CONTEXT_IP;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_interruptible)) {
+       } else if (!strcmp((char *) context_type, config_event_context_interruptible)) {
                ret = LTTNG_EVENT_CONTEXT_INTERRUPTIBLE;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_preemptible)) {
+       } else if (!strcmp((char *) context_type, config_event_context_preemptible)) {
                ret = LTTNG_EVENT_CONTEXT_PREEMPTIBLE;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_need_reschedule)) {
+       } else if (!strcmp((char *) context_type, config_event_context_need_reschedule)) {
                ret = LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_migratable)) {
+       } else if (!strcmp((char *) context_type, config_event_context_migratable)) {
                ret = LTTNG_EVENT_CONTEXT_MIGRATABLE;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_callstack_user)) {
+       } else if (!strcmp((char *) context_type, config_event_context_callstack_user)) {
                ret = LTTNG_EVENT_CONTEXT_CALLSTACK_USER;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_callstack_kernel)) {
+       } else if (!strcmp((char *) context_type, config_event_context_callstack_kernel)) {
                ret = LTTNG_EVENT_CONTEXT_CALLSTACK_KERNEL;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_cgroup_ns)) {
+       } else if (!strcmp((char *) context_type, config_event_context_cgroup_ns)) {
                ret = LTTNG_EVENT_CONTEXT_CGROUP_NS;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_ipc_ns)) {
+       } else if (!strcmp((char *) context_type, config_event_context_ipc_ns)) {
                ret = LTTNG_EVENT_CONTEXT_IPC_NS;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_mnt_ns)) {
+       } else if (!strcmp((char *) context_type, config_event_context_mnt_ns)) {
                ret = LTTNG_EVENT_CONTEXT_MNT_NS;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_net_ns)) {
+       } else if (!strcmp((char *) context_type, config_event_context_net_ns)) {
                ret = LTTNG_EVENT_CONTEXT_NET_NS;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_pid_ns)) {
+       } else if (!strcmp((char *) context_type, config_event_context_pid_ns)) {
                ret = LTTNG_EVENT_CONTEXT_PID_NS;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_time_ns)) {
+       } else if (!strcmp((char *) context_type, config_event_context_time_ns)) {
                ret = LTTNG_EVENT_CONTEXT_TIME_NS;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_user_ns)) {
+       } else if (!strcmp((char *) context_type, config_event_context_user_ns)) {
                ret = LTTNG_EVENT_CONTEXT_USER_NS;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_uts_ns)) {
+       } else if (!strcmp((char *) context_type, config_event_context_uts_ns)) {
                ret = LTTNG_EVENT_CONTEXT_UTS_NS;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_uid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_uid)) {
                ret = LTTNG_EVENT_CONTEXT_UID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_euid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_euid)) {
                ret = LTTNG_EVENT_CONTEXT_EUID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_suid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_suid)) {
                ret = LTTNG_EVENT_CONTEXT_SUID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_gid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_gid)) {
                ret = LTTNG_EVENT_CONTEXT_GID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_egid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_egid)) {
                ret = LTTNG_EVENT_CONTEXT_EGID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_sgid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_sgid)) {
                ret = LTTNG_EVENT_CONTEXT_SGID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_vuid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_vuid)) {
                ret = LTTNG_EVENT_CONTEXT_VUID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_veuid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_veuid)) {
                ret = LTTNG_EVENT_CONTEXT_VEUID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_vsuid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_vsuid)) {
                ret = LTTNG_EVENT_CONTEXT_VSUID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_vgid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_vgid)) {
                ret = LTTNG_EVENT_CONTEXT_VGID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_vegid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_vegid)) {
                ret = LTTNG_EVENT_CONTEXT_VEGID;
-       } else if (!strcmp((char *) context_type,
-               config_event_context_vsgid)) {
+       } else if (!strcmp((char *) context_type, config_event_context_vsgid)) {
                ret = LTTNG_EVENT_CONTEXT_VSGID;
        } else {
                goto error;
@@ -1010,14 +951,12 @@ error:
        return -1;
 }
 
-static
-int init_domain(xmlNodePtr domain_node, struct lttng_domain *domain)
+static int init_domain(xmlNodePtr domain_node, struct lttng_domain *domain)
 {
        int ret;
        xmlNodePtr node;
 
-       for (node = xmlFirstElementChild(domain_node); node;
-               node = xmlNextElementSibling(node)) {
+       for (node = xmlFirstElementChild(domain_node); node; node = xmlNextElementSibling(node)) {
                if (!strcmp((const char *) node->name, config_element_type)) {
                        /* domain type */
                        xmlChar *node_content = xmlNodeGetContent(node);
@@ -1034,8 +973,7 @@ int init_domain(xmlNodePtr domain_node, struct lttng_domain *domain)
                        }
 
                        domain->type = (lttng_domain_type) ret;
-               } else if (!strcmp((const char *) node->name,
-                       config_element_buffer_type)) {
+               } else if (!strcmp((const char *) node->name, config_element_buffer_type)) {
                        /* buffer type */
                        xmlChar *node_content = xmlNodeGetContent(node);
                        if (!node_content) {
@@ -1058,14 +996,12 @@ end:
        return ret;
 }
 
-static
-int get_net_output_uris(xmlNodePtr net_output_node, char **control_uri,
-       char **data_uri)
+static int get_net_output_uris(xmlNodePtr net_output_node, char **control_uri, char **data_uri)
 {
        xmlNodePtr node;
 
        for (node = xmlFirstElementChild(net_output_node); node;
-               node = xmlNextElementSibling(node)) {
+            node = xmlNextElementSibling(node)) {
                if (!strcmp((const char *) node->name, config_element_control_uri)) {
                        /* control_uri */
                        *control_uri = (char *) xmlNodeGetContent(node);
@@ -1084,9 +1020,7 @@ int get_net_output_uris(xmlNodePtr net_output_node, char **control_uri,
        return *control_uri || *data_uri ? 0 : -LTTNG_ERR_LOAD_INVALID_CONFIG;
 }
 
-static
-int process_consumer_output(xmlNodePtr consumer_output_node,
-       struct consumer_output *output)
+static int process_consumer_output(xmlNodePtr consumer_output_node, struct consumer_output *output)
 {
        int ret;
        xmlNodePtr node;
@@ -1094,7 +1028,7 @@ int process_consumer_output(xmlNodePtr consumer_output_node,
        LTTNG_ASSERT(output);
 
        for (node = xmlFirstElementChild(consumer_output_node); node;
-                       node = xmlNextElementSibling(node)) {
+            node = xmlNextElementSibling(node)) {
                if (!strcmp((const char *) node->name, config_element_enabled)) {
                        xmlChar *enabled_str = xmlNodeGetContent(node);
 
@@ -1119,8 +1053,7 @@ int process_consumer_output(xmlNodePtr consumer_output_node,
                                goto end;
                        }
 
-                       if (!strcmp((const char *) output_type_node->name,
-                                       config_element_path)) {
+                       if (!strcmp((const char *) output_type_node->name, config_element_path)) {
                                /* path */
                                output->path = (char *) xmlNodeGetContent(output_type_node);
                                if (!output->path) {
@@ -1129,8 +1062,8 @@ int process_consumer_output(xmlNodePtr consumer_output_node,
                                }
                        } else {
                                /* net_output */
-                               ret = get_net_output_uris(output_type_node,
-                                               &output->control_uri, &output->data_uri);
+                               ret = get_net_output_uris(
+                                       output_type_node, &output->control_uri, &output->data_uri);
                                if (ret) {
                                        goto end;
                                }
@@ -1149,9 +1082,9 @@ end:
        return ret;
 }
 
-static
-int create_snapshot_session(const char *session_name, xmlNodePtr output_node,
-               const struct config_load_session_override_attr *overrides)
+static int create_snapshot_session(const char *session_name,
+                                  xmlNodePtr output_node,
+                                  const struct config_load_session_override_attr *overrides)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -1182,10 +1115,9 @@ int create_snapshot_session(const char *session_name, xmlNodePtr output_node,
        snapshot_output_list_node = xmlFirstElementChild(output_node);
 
        /* Parse and create snapshot outputs */
-       for (snapshot_output_node =
-                       xmlFirstElementChild(snapshot_output_list_node);
-                       snapshot_output_node; snapshot_output_node =
-                       xmlNextElementSibling(snapshot_output_node)) {
+       for (snapshot_output_node = xmlFirstElementChild(snapshot_output_list_node);
+            snapshot_output_node;
+            snapshot_output_node = xmlNextElementSibling(snapshot_output_node)) {
                char *name = NULL;
                uint64_t max_size = UINT64_MAX;
                struct consumer_output output = {};
@@ -1195,17 +1127,15 @@ int create_snapshot_session(const char *session_name, xmlNodePtr output_node,
                const char *path = NULL;
 
                for (node = xmlFirstElementChild(snapshot_output_node); node;
-                               node = xmlNextElementSibling(node)) {
-                       if (!strcmp((const char *) node->name,
-                               config_element_name)) {
+                    node = xmlNextElementSibling(node)) {
+                       if (!strcmp((const char *) node->name, config_element_name)) {
                                /* name */
                                name = (char *) xmlNodeGetContent(node);
                                if (!name) {
                                        ret = -LTTNG_ERR_NOMEM;
                                        goto error_snapshot_output;
                                }
-                       } else if (!strcmp((const char *) node->name,
-                               config_element_max_size)) {
+                       } else if (!strcmp((const char *) node->name, config_element_max_size)) {
                                xmlChar *content = xmlNodeGetContent(node);
 
                                /* max_size */
@@ -1269,23 +1199,21 @@ int create_snapshot_session(const char *session_name, xmlNodePtr output_node,
                }
 
                if (path) {
-                       ret = lttng_snapshot_output_set_ctrl_url(path,
-                                       snapshot_output);
+                       ret = lttng_snapshot_output_set_ctrl_url(path, snapshot_output);
                        if (ret) {
                                goto error_snapshot_output;
                        }
                } else {
                        if (control_uri) {
                                ret = lttng_snapshot_output_set_ctrl_url(control_uri,
-                                               snapshot_output);
+                                                                        snapshot_output);
                                if (ret) {
                                        goto error_snapshot_output;
                                }
                        }
 
                        if (data_uri) {
-                               ret = lttng_snapshot_output_set_data_url(data_uri,
-                                               snapshot_output);
+                               ret = lttng_snapshot_output_set_data_url(data_uri, snapshot_output);
                                if (ret) {
                                        goto error_snapshot_output;
                                }
@@ -1293,7 +1221,7 @@ int create_snapshot_session(const char *session_name, xmlNodePtr output_node,
                }
 
                ret = lttng_snapshot_add_output(session_name, snapshot_output);
-error_snapshot_output:
+       error_snapshot_output:
                free(name);
                free(output.path);
                free(output.control_uri);
@@ -1308,11 +1236,10 @@ end:
        return ret;
 }
 
-static
-int create_session(const char *name,
-       xmlNodePtr output_node,
-       uint64_t live_timer_interval,
-       const struct config_load_session_override_attr *overrides)
+static int create_session(const char *name,
+                         xmlNodePtr output_node,
+                         uint64_t live_timer_interval,
+                         const struct config_load_session_override_attr *overrides)
 {
        int ret = 0;
        enum lttng_error_code ret_code;
@@ -1333,9 +1260,9 @@ int create_session(const char *name,
                }
 
                if (strcmp((const char *) consumer_output_node->name,
-                       config_element_consumer_output)) {
+                          config_element_consumer_output)) {
                        WARN("Invalid output type, expected %s node",
-                               config_element_consumer_output);
+                            config_element_consumer_output);
                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                        goto end;
                }
@@ -1385,10 +1312,10 @@ int create_session(const char *name,
                         * NULL is passed here and will be set right after.
                         */
                        session_descriptor = lttng_session_descriptor_live_network_create(
-                                       name, control_uri, data_uri, live_timer_interval);
+                               name, control_uri, data_uri, live_timer_interval);
                } else {
                        session_descriptor = lttng_session_descriptor_network_create(
-                                       name, control_uri, data_uri);
+                               name, control_uri, data_uri);
                }
 
        } else if (path != nullptr) {
@@ -1417,10 +1344,8 @@ end:
        return ret;
 }
 
-static
-struct lttng_userspace_probe_location *
-process_userspace_probe_function_attribute_node(
-               xmlNodePtr attribute_node)
+static struct lttng_userspace_probe_location *
+process_userspace_probe_function_attribute_node(xmlNodePtr attribute_node)
 {
        xmlNodePtr function_attribute_node;
        char *function_name = NULL, *binary_path = NULL;
@@ -1433,30 +1358,27 @@ process_userspace_probe_function_attribute_node(
         * and check at the end if everything we need for this location type is
         * there.
         */
-       for (function_attribute_node =
-                       xmlFirstElementChild(attribute_node);
-                       function_attribute_node;
-                       function_attribute_node = xmlNextElementSibling(
-                               function_attribute_node)) {
+       for (function_attribute_node = xmlFirstElementChild(attribute_node);
+            function_attribute_node;
+            function_attribute_node = xmlNextElementSibling(function_attribute_node)) {
                /* Handle function name, binary path and lookup method. */
                if (!strcmp((const char *) function_attribute_node->name,
-                                       config_element_userspace_probe_function_location_function_name)) {
+                           config_element_userspace_probe_function_location_function_name)) {
                        function_name = (char *) xmlNodeGetContent(function_attribute_node);
                        if (!function_name) {
                                goto error;
                        }
                } else if (!strcmp((const char *) function_attribute_node->name,
-                                       config_element_userspace_probe_location_binary_path)) {
+                                  config_element_userspace_probe_location_binary_path)) {
                        binary_path = (char *) xmlNodeGetContent(function_attribute_node);
                        if (!binary_path) {
                                goto error;
                        }
                } else if (!strcmp((const char *) function_attribute_node->name,
-                                       config_element_userspace_probe_lookup)) {
+                                  config_element_userspace_probe_lookup)) {
                        char *lookup_method_name;
 
-                       lookup_method_name = (char *) xmlNodeGetContent(
-                                       function_attribute_node);
+                       lookup_method_name = (char *) xmlNodeGetContent(function_attribute_node);
                        if (!lookup_method_name) {
                                goto error;
                        }
@@ -1465,9 +1387,12 @@ process_userspace_probe_function_attribute_node(
                         * function_default lookup method defaults to
                         * function_elf lookup method at the moment.
                         */
-                       if (!strcmp(lookup_method_name, config_element_userspace_probe_lookup_function_elf)
-                                       || !strcmp(lookup_method_name, config_element_userspace_probe_lookup_function_default)) {
-                               lookup_method = lttng_userspace_probe_location_lookup_method_function_elf_create();
+                       if (!strcmp(lookup_method_name,
+                                   config_element_userspace_probe_lookup_function_elf) ||
+                           !strcmp(lookup_method_name,
+                                   config_element_userspace_probe_lookup_function_default)) {
+                               lookup_method =
+                                       lttng_userspace_probe_location_lookup_method_function_elf_create();
                                if (!lookup_method) {
                                        PERROR("Error creating function default/ELF lookup method");
                                }
@@ -1486,10 +1411,8 @@ process_userspace_probe_function_attribute_node(
                /* Check if all the necessary fields were found. */
                if (binary_path && function_name && lookup_method) {
                        /* Ownership of lookup_method is transferred. */
-                       location =
-                               lttng_userspace_probe_location_function_create(
-                                               binary_path, function_name,
-                                               lookup_method);
+                       location = lttng_userspace_probe_location_function_create(
+                               binary_path, function_name, lookup_method);
                        lookup_method = NULL;
                        goto error;
                }
@@ -1501,10 +1424,8 @@ error:
        return location;
 }
 
-static
-struct lttng_userspace_probe_location *
-process_userspace_probe_tracepoint_attribute_node(
-               xmlNodePtr attribute_node)
+static struct lttng_userspace_probe_location *
+process_userspace_probe_tracepoint_attribute_node(xmlNodePtr attribute_node)
 {
        xmlNodePtr tracepoint_attribute_node;
        char *probe_name = NULL, *provider_name = NULL, *binary_path = NULL;
@@ -1517,40 +1438,38 @@ process_userspace_probe_tracepoint_attribute_node(
         * and check at the end if everything we need for this location type is
         * there.
         */
-       for (tracepoint_attribute_node =
-               xmlFirstElementChild(attribute_node); tracepoint_attribute_node;
-               tracepoint_attribute_node = xmlNextElementSibling(
-                               tracepoint_attribute_node)) {
+       for (tracepoint_attribute_node = xmlFirstElementChild(attribute_node);
+            tracepoint_attribute_node;
+            tracepoint_attribute_node = xmlNextElementSibling(tracepoint_attribute_node)) {
                if (!strcmp((const char *) tracepoint_attribute_node->name,
-                                       config_element_userspace_probe_tracepoint_location_probe_name)) {
+                           config_element_userspace_probe_tracepoint_location_probe_name)) {
                        probe_name = (char *) xmlNodeGetContent(tracepoint_attribute_node);
                        if (!probe_name) {
                                goto error;
                        }
                } else if (!strcmp((const char *) tracepoint_attribute_node->name,
-                                       config_element_userspace_probe_tracepoint_location_provider_name)) {
+                                  config_element_userspace_probe_tracepoint_location_provider_name)) {
                        provider_name = (char *) xmlNodeGetContent(tracepoint_attribute_node);
                        if (!provider_name) {
                                goto error;
                        }
                } else if (!strcmp((const char *) tracepoint_attribute_node->name,
-                                       config_element_userspace_probe_location_binary_path)) {
+                                  config_element_userspace_probe_location_binary_path)) {
                        binary_path = (char *) xmlNodeGetContent(tracepoint_attribute_node);
                        if (!binary_path) {
                                goto error;
                        }
                } else if (!strcmp((const char *) tracepoint_attribute_node->name,
-                                       config_element_userspace_probe_lookup)) {
+                                  config_element_userspace_probe_lookup)) {
                        char *lookup_method_name;
 
-                       lookup_method_name = (char *) xmlNodeGetContent(
-                                       tracepoint_attribute_node);
+                       lookup_method_name = (char *) xmlNodeGetContent(tracepoint_attribute_node);
                        if (!lookup_method_name) {
                                goto error;
                        }
 
                        if (!strcmp(lookup_method_name,
-                                               config_element_userspace_probe_lookup_tracepoint_sdt)) {
+                                   config_element_userspace_probe_lookup_tracepoint_sdt)) {
                                lookup_method =
                                        lttng_userspace_probe_location_lookup_method_tracepoint_sdt_create();
                                if (!lookup_method) {
@@ -1572,10 +1491,8 @@ process_userspace_probe_tracepoint_attribute_node(
                /* Check if all the necessary fields were found. */
                if (binary_path && provider_name && probe_name && lookup_method) {
                        /* Ownership of lookup_method is transferred. */
-                       location =
-                               lttng_userspace_probe_location_tracepoint_create(
-                                               binary_path, provider_name,
-                                               probe_name, lookup_method);
+                       location = lttng_userspace_probe_location_tracepoint_create(
+                               binary_path, provider_name, probe_name, lookup_method);
                        lookup_method = NULL;
                        goto error;
                }
@@ -1588,17 +1505,15 @@ error:
        return location;
 }
 
-static
-int process_probe_attribute_node(xmlNodePtr probe_attribute_node,
-       struct lttng_event_probe_attr *attr)
+static int process_probe_attribute_node(xmlNodePtr probe_attribute_node,
+                                       struct lttng_event_probe_attr *attr)
 {
        int ret;
 
        LTTNG_ASSERT(probe_attribute_node);
        LTTNG_ASSERT(attr);
 
-       if (!strcmp((const char *) probe_attribute_node->name,
-               config_element_address)) {
+       if (!strcmp((const char *) probe_attribute_node->name, config_element_address)) {
                xmlChar *content;
                uint64_t addr = 0;
 
@@ -1617,8 +1532,7 @@ int process_probe_attribute_node(xmlNodePtr probe_attribute_node,
                }
 
                attr->addr = addr;
-       } else if (!strcmp((const char *) probe_attribute_node->name,
-               config_element_offset)) {
+       } else if (!strcmp((const char *) probe_attribute_node->name, config_element_offset)) {
                xmlChar *content;
                uint64_t offset = 0;
 
@@ -1637,8 +1551,7 @@ int process_probe_attribute_node(xmlNodePtr probe_attribute_node,
                }
 
                attr->offset = offset;
-       } else if (!strcmp((const char *) probe_attribute_node->name,
-               config_element_symbol_name)) {
+       } else if (!strcmp((const char *) probe_attribute_node->name, config_element_symbol_name)) {
                xmlChar *content;
 
                /* symbol_name */
@@ -1648,14 +1561,13 @@ int process_probe_attribute_node(xmlNodePtr probe_attribute_node,
                        goto end;
                }
 
-               ret = lttng_strncpy(attr->symbol_name,
-                               (const char *) content,
-                               LTTNG_SYMBOL_NAME_LEN);
+               ret = lttng_strncpy(
+                       attr->symbol_name, (const char *) content, LTTNG_SYMBOL_NAME_LEN);
                if (ret == -1) {
-                       ERR("symbol name \"%s\"'s length (%zu) exceeds the maximal permitted length (%d) in session configuration",
-                                       (const char *) content,
-                                       strlen((const char *) content),
-                                       LTTNG_SYMBOL_NAME_LEN);
+                       ERR("symbol name \"%s\"'s length (%zu) exceeds the maximal permitted length (%d) in session configuration",
+                           (const char *) content,
+                           strlen((const char *) content),
+                           LTTNG_SYMBOL_NAME_LEN);
                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                        free(content);
                        goto end;
@@ -1667,9 +1579,10 @@ end:
        return ret;
 }
 
-static
-int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
-       const char *channel_name, const enum process_event_node_phase phase)
+static int process_event_node(xmlNodePtr event_node,
+                             struct lttng_handle *handle,
+                             const char *channel_name,
+                             const enum process_event_node_phase phase)
 {
        int ret = 0, i;
        xmlNodePtr node;
@@ -1689,8 +1602,7 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
        }
 
        /* Initialize default log level which varies by domain */
-       switch (handle->domain.type)
-       {
+       switch (handle->domain.type) {
        case LTTNG_DOMAIN_JUL:
                event->loglevel = LTTNG_LOGLEVEL_JUL_ALL;
                break;
@@ -1708,8 +1620,7 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                abort();
        }
 
-       for (node = xmlFirstElementChild(event_node); node;
-               node = xmlNextElementSibling(node)) {
+       for (node = xmlFirstElementChild(event_node); node; node = xmlNextElementSibling(node)) {
                if (!strcmp((const char *) node->name, config_element_name)) {
                        xmlChar *content;
 
@@ -1720,21 +1631,19 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                                goto end;
                        }
 
-                       ret = lttng_strncpy(event->name,
-                                       (const char *) content,
-                                       LTTNG_SYMBOL_NAME_LEN);
+                       ret = lttng_strncpy(
+                               event->name, (const char *) content, LTTNG_SYMBOL_NAME_LEN);
                        if (ret == -1) {
                                WARN("Event \"%s\"'s name length (%zu) exceeds the maximal permitted length (%d) in session configuration",
-                                               (const char *) content,
-                                               strlen((const char *) content),
-                                               LTTNG_SYMBOL_NAME_LEN);
+                                    (const char *) content,
+                                    strlen((const char *) content),
+                                    LTTNG_SYMBOL_NAME_LEN);
                                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                free(content);
                                goto end;
                        }
                        free(content);
-               } else if (!strcmp((const char *) node->name,
-                       config_element_enabled)) {
+               } else if (!strcmp((const char *) node->name, config_element_enabled)) {
                        xmlChar *content = xmlNodeGetContent(node);
 
                        /* enabled */
@@ -1749,8 +1658,7 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                goto end;
                        }
-               } else if (!strcmp((const char *) node->name,
-                       config_element_type)) {
+               } else if (!strcmp((const char *) node->name, config_element_type)) {
                        xmlChar *content = xmlNodeGetContent(node);
 
                        /* type */
@@ -1767,8 +1675,7 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                        }
 
                        event->type = (lttng_event_type) ret;
-               } else if (!strcmp((const char *) node->name,
-                       config_element_loglevel_type)) {
+               } else if (!strcmp((const char *) node->name, config_element_loglevel_type)) {
                        xmlChar *content = xmlNodeGetContent(node);
 
                        /* loglevel_type */
@@ -1785,8 +1692,7 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                        }
 
                        event->loglevel_type = (lttng_loglevel_type) ret;
-               } else if (!strcmp((const char *) node->name,
-                       config_element_loglevel)) {
+               } else if (!strcmp((const char *) node->name, config_element_loglevel)) {
                        xmlChar *content;
                        int64_t loglevel = 0;
 
@@ -1811,10 +1717,8 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                        }
 
                        event->loglevel = loglevel;
-               } else if (!strcmp((const char *) node->name,
-                       config_element_filter)) {
-                       xmlChar *content =
-                               xmlNodeGetContent(node);
+               } else if (!strcmp((const char *) node->name, config_element_filter)) {
+                       xmlChar *content = xmlNodeGetContent(node);
 
                        /* filter */
                        if (!content) {
@@ -1829,8 +1733,7 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                                ret = -LTTNG_ERR_NOMEM;
                                goto end;
                        }
-               } else if (!strcmp((const char *) node->name,
-                       config_element_exclusions)) {
+               } else if (!strcmp((const char *) node->name, config_element_exclusions)) {
                        xmlNodePtr exclusion_node;
                        int exclusion_index = 0;
 
@@ -1857,9 +1760,8 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                        }
 
                        for (exclusion_node = xmlFirstElementChild(node); exclusion_node;
-                                       exclusion_node = xmlNextElementSibling(exclusion_node)) {
-                               xmlChar *content =
-                                       xmlNodeGetContent(exclusion_node);
+                            exclusion_node = xmlNextElementSibling(exclusion_node)) {
+                               xmlChar *content = xmlNodeGetContent(exclusion_node);
 
                                if (!content) {
                                        ret = -LTTNG_ERR_NOMEM;
@@ -1876,8 +1778,7 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                        }
 
                        event->exclusion = 1;
-               } else if (!strcmp((const char *) node->name,
-                       config_element_attributes)) {
+               } else if (!strcmp((const char *) node->name, config_element_attributes)) {
                        xmlNodePtr attribute_node = xmlFirstElementChild(node);
 
                        /* attributes */
@@ -1887,23 +1788,22 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                        }
 
                        if (!strcmp((const char *) attribute_node->name,
-                                               config_element_probe_attributes)) {
+                                   config_element_probe_attributes)) {
                                xmlNodePtr probe_attribute_node;
 
                                /* probe_attributes */
-                               for (probe_attribute_node =
-                                       xmlFirstElementChild(attribute_node); probe_attribute_node;
-                                       probe_attribute_node = xmlNextElementSibling(
-                                                       probe_attribute_node)) {
-
+                               for (probe_attribute_node = xmlFirstElementChild(attribute_node);
+                                    probe_attribute_node;
+                                    probe_attribute_node =
+                                            xmlNextElementSibling(probe_attribute_node)) {
                                        ret = process_probe_attribute_node(probe_attribute_node,
-                                                       &event->attr.probe);
+                                                                          &event->attr.probe);
                                        if (ret) {
                                                goto end;
                                        }
                                }
                        } else if (!strcmp((const char *) attribute_node->name,
-                                               config_element_function_attributes)) {
+                                          config_element_function_attributes)) {
                                size_t sym_len;
                                xmlChar *content;
                                xmlNodePtr symbol_node = xmlFirstElementChild(attribute_node);
@@ -1924,8 +1824,7 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                                }
 
                                ret = lttng_strncpy(
-                                               event->attr.ftrace.symbol_name,
-                                               (char *) content, sym_len);
+                                       event->attr.ftrace.symbol_name, (char *) content, sym_len);
                                if (ret == -1) {
                                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                        free(content);
@@ -1933,43 +1832,39 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                                }
                                free(content);
                        } else if (!strcmp((const char *) attribute_node->name,
-                                               config_element_userspace_probe_tracepoint_attributes)) {
+                                          config_element_userspace_probe_tracepoint_attributes)) {
                                struct lttng_userspace_probe_location *location;
 
-                               location = process_userspace_probe_tracepoint_attribute_node(attribute_node);
+                               location = process_userspace_probe_tracepoint_attribute_node(
+                                       attribute_node);
                                if (!location) {
                                        WARN("Error processing userspace probe tracepoint attribute");
                                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                        goto end;
                                }
-                               ret = lttng_event_set_userspace_probe_location(
-                                               event, location);
+                               ret = lttng_event_set_userspace_probe_location(event, location);
                                if (ret) {
                                        WARN("Error setting userspace probe location field");
-                                       lttng_userspace_probe_location_destroy(
-                                                       location);
+                                       lttng_userspace_probe_location_destroy(location);
                                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                        goto end;
                                }
                        } else if (!strcmp((const char *) attribute_node->name,
-                                               config_element_userspace_probe_function_attributes)) {
+                                          config_element_userspace_probe_function_attributes)) {
                                struct lttng_userspace_probe_location *location;
 
-                               location =
-                                       process_userspace_probe_function_attribute_node(
-                                                       attribute_node);
+                               location = process_userspace_probe_function_attribute_node(
+                                       attribute_node);
                                if (!location) {
                                        WARN("Error processing userspace probe function attribute");
                                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                        goto end;
                                }
 
-                               ret = lttng_event_set_userspace_probe_location(
-                                               event, location);
+                               ret = lttng_event_set_userspace_probe_location(event, location);
                                if (ret) {
                                        WARN("Error setting userspace probe location field");
-                                       lttng_userspace_probe_location_destroy(
-                                                       location);
+                                       lttng_userspace_probe_location_destroy(location);
                                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                        goto end;
                                }
@@ -1982,8 +1877,8 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
        }
 
        if ((event->enabled && phase == ENABLE) || phase == CREATION) {
-               ret = lttng_enable_event_with_exclusions(handle, event, channel_name,
-                               filter_expression, exclusion_count, exclusions);
+               ret = lttng_enable_event_with_exclusions(
+                       handle, event, channel_name, filter_expression, exclusion_count, exclusions);
                if (ret < 0) {
                        WARN("Enabling event (name:%s) on load failed.", event->name);
                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
@@ -2002,9 +1897,8 @@ end:
        return ret;
 }
 
-static
-int process_events_node(xmlNodePtr events_node, struct lttng_handle *handle,
-       const char *channel_name)
+static int
+process_events_node(xmlNodePtr events_node, struct lttng_handle *handle, const char *channel_name)
 {
        int ret = 0;
        struct lttng_event event;
@@ -2014,8 +1908,7 @@ int process_events_node(xmlNodePtr events_node, struct lttng_handle *handle,
        LTTNG_ASSERT(handle);
        LTTNG_ASSERT(channel_name);
 
-       for (node = xmlFirstElementChild(events_node); node;
-               node = xmlNextElementSibling(node)) {
+       for (node = xmlFirstElementChild(events_node); node; node = xmlNextElementSibling(node)) {
                ret = process_event_node(node, handle, channel_name, CREATION);
                if (ret) {
                        goto end;
@@ -2035,8 +1928,7 @@ int process_events_node(xmlNodePtr events_node, struct lttng_handle *handle,
                goto end;
        }
 
-       for (node = xmlFirstElementChild(events_node); node;
-                       node = xmlNextElementSibling(node)) {
+       for (node = xmlFirstElementChild(events_node); node; node = xmlNextElementSibling(node)) {
                ret = process_event_node(node, handle, channel_name, ENABLE);
                if (ret) {
                        goto end;
@@ -2047,10 +1939,10 @@ end:
        return ret;
 }
 
-static
-int process_channel_attr_node(xmlNodePtr attr_node,
-               struct lttng_channel *channel, xmlNodePtr *contexts_node,
-               xmlNodePtr *events_node)
+static int process_channel_attr_node(xmlNodePtr attr_node,
+                                    struct lttng_channel *channel,
+                                    xmlNodePtr *contexts_node,
+                                    xmlNodePtr *events_node)
 {
        int ret;
 
@@ -2069,21 +1961,18 @@ int process_channel_attr_node(xmlNodePtr attr_node,
                        goto end;
                }
 
-               ret = lttng_strncpy(channel->name,
-                               (const char *) content,
-                               LTTNG_SYMBOL_NAME_LEN);
+               ret = lttng_strncpy(channel->name, (const char *) content, LTTNG_SYMBOL_NAME_LEN);
                if (ret == -1) {
                        WARN("Channel \"%s\"'s name length (%zu) exceeds the maximal permitted length (%d) in session configuration",
-                                       (const char *) content,
-                                       strlen((const char *) content),
-                                       LTTNG_SYMBOL_NAME_LEN);
+                            (const char *) content,
+                            strlen((const char *) content),
+                            LTTNG_SYMBOL_NAME_LEN);
                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                        free(content);
                        goto end;
                }
                free(content);
-       } else if (!strcmp((const char *) attr_node->name,
-                       config_element_enabled)) {
+       } else if (!strcmp((const char *) attr_node->name, config_element_enabled)) {
                xmlChar *content;
                int enabled;
 
@@ -2102,8 +1991,7 @@ int process_channel_attr_node(xmlNodePtr attr_node,
                }
 
                channel->enabled = enabled;
-       } else if (!strcmp((const char *) attr_node->name,
-                       config_element_overwrite_mode)) {
+       } else if (!strcmp((const char *) attr_node->name, config_element_overwrite_mode)) {
                xmlChar *content;
 
                /* overwrite_mode */
@@ -2121,8 +2009,7 @@ int process_channel_attr_node(xmlNodePtr attr_node,
                }
 
                channel->attr.overwrite = ret;
-       } else if (!strcmp((const char *) attr_node->name,
-                       config_element_subbuf_size)) {
+       } else if (!strcmp((const char *) attr_node->name, config_element_subbuf_size)) {
                xmlChar *content;
 
                /* subbuffer_size */
@@ -2138,8 +2025,7 @@ int process_channel_attr_node(xmlNodePtr attr_node,
                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                        goto end;
                }
-       } else if (!strcmp((const char *) attr_node->name,
-                       config_element_num_subbuf)) {
+       } else if (!strcmp((const char *) attr_node->name, config_element_num_subbuf)) {
                xmlChar *content;
 
                /* subbuffer_count */
@@ -2155,8 +2041,7 @@ int process_channel_attr_node(xmlNodePtr attr_node,
                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                        goto end;
                }
-       } else if (!strcmp((const char *) attr_node->name,
-                       config_element_switch_timer_interval)) {
+       } else if (!strcmp((const char *) attr_node->name, config_element_switch_timer_interval)) {
                xmlChar *content;
                uint64_t switch_timer_interval = 0;
 
@@ -2180,10 +2065,8 @@ int process_channel_attr_node(xmlNodePtr attr_node,
                        goto end;
                }
 
-               channel->attr.switch_timer_interval =
-                       switch_timer_interval;
-       } else if (!strcmp((const char *) attr_node->name,
-                       config_element_read_timer_interval)) {
+               channel->attr.switch_timer_interval = switch_timer_interval;
+       } else if (!strcmp((const char *) attr_node->name, config_element_read_timer_interval)) {
                xmlChar *content;
                uint64_t read_timer_interval = 0;
 
@@ -2207,10 +2090,8 @@ int process_channel_attr_node(xmlNodePtr attr_node,
                        goto end;
                }
 
-               channel->attr.read_timer_interval =
-                       read_timer_interval;
-       } else if (!strcmp((const char *) attr_node->name,
-                       config_element_output_type)) {
+               channel->attr.read_timer_interval = read_timer_interval;
+       } else if (!strcmp((const char *) attr_node->name, config_element_output_type)) {
                xmlChar *content;
 
                /* output_type */
@@ -2228,8 +2109,7 @@ int process_channel_attr_node(xmlNodePtr attr_node,
                }
 
                channel->attr.output = (lttng_event_output) ret;
-       } else if (!strcmp((const char *) attr_node->name,
-                       config_element_tracefile_size)) {
+       } else if (!strcmp((const char *) attr_node->name, config_element_tracefile_size)) {
                xmlChar *content;
 
                /* tracefile_size */
@@ -2245,8 +2125,7 @@ int process_channel_attr_node(xmlNodePtr attr_node,
                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                        goto end;
                }
-       } else if (!strcmp((const char *) attr_node->name,
-                       config_element_tracefile_count)) {
+       } else if (!strcmp((const char *) attr_node->name, config_element_tracefile_count)) {
                xmlChar *content;
 
                /* tracefile_count */
@@ -2262,8 +2141,7 @@ int process_channel_attr_node(xmlNodePtr attr_node,
                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                        goto end;
                }
-       } else if (!strcmp((const char *) attr_node->name,
-                       config_element_live_timer_interval)) {
+       } else if (!strcmp((const char *) attr_node->name, config_element_live_timer_interval)) {
                xmlChar *content;
                uint64_t live_timer_interval = 0;
 
@@ -2287,10 +2165,8 @@ int process_channel_attr_node(xmlNodePtr attr_node,
                        goto end;
                }
 
-               channel->attr.live_timer_interval =
-                       live_timer_interval;
-       } else if (!strcmp((const char *) attr_node->name,
-                       config_element_monitor_timer_interval)) {
+               channel->attr.live_timer_interval = live_timer_interval;
+       } else if (!strcmp((const char *) attr_node->name, config_element_monitor_timer_interval)) {
                xmlChar *content;
                uint64_t monitor_timer_interval = 0;
 
@@ -2308,14 +2184,12 @@ int process_channel_attr_node(xmlNodePtr attr_node,
                        goto end;
                }
 
-               ret = lttng_channel_set_monitor_timer_interval(channel,
-                       monitor_timer_interval);
+               ret = lttng_channel_set_monitor_timer_interval(channel, monitor_timer_interval);
                if (ret) {
                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                        goto end;
                }
-       } else if (!strcmp((const char *) attr_node->name,
-                       config_element_blocking_timeout)) {
+       } else if (!strcmp((const char *) attr_node->name, config_element_blocking_timeout)) {
                xmlChar *content;
                int64_t blocking_timeout = 0;
 
@@ -2333,14 +2207,12 @@ int process_channel_attr_node(xmlNodePtr attr_node,
                        goto end;
                }
 
-               ret = lttng_channel_set_blocking_timeout(channel,
-                       blocking_timeout);
+               ret = lttng_channel_set_blocking_timeout(channel, blocking_timeout);
                if (ret) {
                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                        goto end;
                }
-       } else if (!strcmp((const char *) attr_node->name,
-                       config_element_events)) {
+       } else if (!strcmp((const char *) attr_node->name, config_element_events)) {
                /* events */
                *events_node = attr_node;
        } else {
@@ -2352,9 +2224,8 @@ end:
        return ret;
 }
 
-static
-int process_context_node(xmlNodePtr context_node,
-       struct lttng_handle *handle, const char *channel_name)
+static int
+process_context_node(xmlNodePtr context_node, struct lttng_handle *handle, const char *channel_name)
 {
        int ret;
        struct lttng_event_context context;
@@ -2370,8 +2241,7 @@ int process_context_node(xmlNodePtr context_node,
 
        memset(&context, 0, sizeof(context));
 
-       if (!strcmp((const char *) context_child_node->name,
-               config_element_type)) {
+       if (!strcmp((const char *) context_child_node->name, config_element_type)) {
                /* type */
                xmlChar *content = xmlNodeGetContent(context_child_node);
 
@@ -2388,19 +2258,16 @@ int process_context_node(xmlNodePtr context_node,
                }
 
                context.ctx = (lttng_event_context_type) ret;
-       } else if (!strcmp((const char *) context_child_node->name,
-               config_element_context_perf)) {
+       } else if (!strcmp((const char *) context_child_node->name, config_element_context_perf)) {
                /* perf */
                xmlNodePtr perf_attr_node;
 
                context.ctx = handle->domain.type == LTTNG_DOMAIN_KERNEL ?
                        LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER :
                        LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER;
-               for (perf_attr_node = xmlFirstElementChild(context_child_node);
-                       perf_attr_node; perf_attr_node =
-                               xmlNextElementSibling(perf_attr_node)) {
-                       if (!strcmp((const char *) perf_attr_node->name,
-                               config_element_type)) {
+               for (perf_attr_node = xmlFirstElementChild(context_child_node); perf_attr_node;
+                    perf_attr_node = xmlNextElementSibling(perf_attr_node)) {
+                       if (!strcmp((const char *) perf_attr_node->name, config_element_type)) {
                                xmlChar *content;
                                uint64_t type = 0;
 
@@ -2426,7 +2293,7 @@ int process_context_node(xmlNodePtr context_node,
 
                                context.u.perf_counter.type = type;
                        } else if (!strcmp((const char *) perf_attr_node->name,
-                               config_element_config)) {
+                                          config_element_config)) {
                                xmlChar *content;
                                uint64_t config = 0;
 
@@ -2446,7 +2313,7 @@ int process_context_node(xmlNodePtr context_node,
 
                                context.u.perf_counter.config = config;
                        } else if (!strcmp((const char *) perf_attr_node->name,
-                               config_element_name)) {
+                                          config_element_name)) {
                                xmlChar *content;
 
                                /* name */
@@ -2457,13 +2324,13 @@ int process_context_node(xmlNodePtr context_node,
                                }
 
                                ret = lttng_strncpy(context.u.perf_counter.name,
-                                               (const char *) content,
-                                               LTTNG_SYMBOL_NAME_LEN);
+                                                   (const char *) content,
+                                                   LTTNG_SYMBOL_NAME_LEN);
                                if (ret == -1) {
                                        WARN("Perf counter \"%s\"'s name length (%zu) exceeds the maximal permitted length (%d) in session configuration",
-                                                       (const char *) content,
-                                                       strlen((const char *) content),
-                                                       LTTNG_SYMBOL_NAME_LEN);
+                                            (const char *) content,
+                                            strlen((const char *) content),
+                                            LTTNG_SYMBOL_NAME_LEN);
                                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                        free(content);
                                        goto end;
@@ -2471,21 +2338,18 @@ int process_context_node(xmlNodePtr context_node,
                                free(content);
                        }
                }
-       } else if (!strcmp((const char *) context_child_node->name,
-               config_element_context_app)) {
+       } else if (!strcmp((const char *) context_child_node->name, config_element_context_app)) {
                /* application context */
                xmlNodePtr app_ctx_node;
 
                context.ctx = LTTNG_EVENT_CONTEXT_APP_CONTEXT;
-               for (app_ctx_node = xmlFirstElementChild(context_child_node);
-                               app_ctx_node; app_ctx_node =
-                               xmlNextElementSibling(app_ctx_node)) {
+               for (app_ctx_node = xmlFirstElementChild(context_child_node); app_ctx_node;
+                    app_ctx_node = xmlNextElementSibling(app_ctx_node)) {
                        xmlChar *content;
-                       char **target = strcmp(
-                               (const char *) app_ctx_node->name,
-                               config_element_context_app_provider_name) == 0 ?
-                                       &context.u.app_ctx.provider_name :
-                                       &context.u.app_ctx.ctx_name;
+                       char **target = strcmp((const char *) app_ctx_node->name,
+                                              config_element_context_app_provider_name) == 0 ?
+                               &context.u.app_ctx.provider_name :
+                               &context.u.app_ctx.ctx_name;
 
                        content = xmlNodeGetContent(app_ctx_node);
                        if (!content) {
@@ -2510,15 +2374,15 @@ end:
        return ret;
 }
 
-static
-int process_contexts_node(xmlNodePtr contexts_node,
-       struct lttng_handle *handle, const char *channel_name)
+static int process_contexts_node(xmlNodePtr contexts_node,
+                                struct lttng_handle *handle,
+                                const char *channel_name)
 {
        int ret = 0;
        xmlNodePtr context_node;
 
        for (context_node = xmlFirstElementChild(contexts_node); context_node;
-                       context_node = xmlNextElementSibling(context_node)) {
+            context_node = xmlNextElementSibling(context_node)) {
                ret = process_context_node(context_node, handle, channel_name);
                if (ret) {
                        goto end;
@@ -2529,11 +2393,11 @@ end:
 }
 
 static int get_tracker_elements(enum lttng_process_attr process_attr,
-               const char **element_id_tracker,
-               const char **element_value_type,
-               const char **element_value,
-               const char **element_value_alias,
-               const char **element_name)
+                               const char **element_id_tracker,
+                               const char **element_value_type,
+                               const char **element_value,
+                               const char **element_value_alias,
+                               const char **element_name)
 {
        int ret = 0;
 
@@ -2586,8 +2450,7 @@ static int get_tracker_elements(enum lttng_process_attr process_attr,
        return ret;
 }
 
-static int process_legacy_pid_tracker_node(
-               xmlNodePtr trackers_node, struct lttng_handle *handle)
+static int process_legacy_pid_tracker_node(xmlNodePtr trackers_node, struct lttng_handle *handle)
 {
        int ret = 0, child_count;
        xmlNodePtr targets_node = NULL;
@@ -2600,34 +2463,32 @@ static int process_legacy_pid_tracker_node(
        enum lttng_error_code tracker_handle_ret_code;
        struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
        enum lttng_process_attr_tracker_handle_status status;
-       const enum lttng_process_attr process_attr =
-                       handle->domain.type == LTTNG_DOMAIN_UST ?
-                                       LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID :
-                                       LTTNG_PROCESS_ATTR_PROCESS_ID;
+       const enum lttng_process_attr process_attr = handle->domain.type == LTTNG_DOMAIN_UST ?
+               LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID :
+               LTTNG_PROCESS_ATTR_PROCESS_ID;
 
        LTTNG_ASSERT(handle);
 
        tracker_handle_ret_code = lttng_session_get_tracker_handle(
-                       handle->session_name, handle->domain.type,
-                       process_attr,
-                       &tracker_handle);
+               handle->session_name, handle->domain.type, process_attr, &tracker_handle);
        if (tracker_handle_ret_code != LTTNG_OK) {
                ret = LTTNG_ERR_INVALID;
                goto end;
        }
 
-       ret = get_tracker_elements(process_attr, &element_id_tracker,
-                       &element_target_id, &element_id, &element_id_alias,
-                       &element_name);
+       ret = get_tracker_elements(process_attr,
+                                  &element_id_tracker,
+                                  &element_target_id,
+                                  &element_id,
+                                  &element_id_alias,
+                                  &element_name);
        if (ret) {
                goto end;
        }
 
        /* Get the targets node */
-       for (node = xmlFirstElementChild(trackers_node); node;
-                       node = xmlNextElementSibling(node)) {
-               if (!strcmp((const char *) node->name,
-                               config_element_tracker_targets_legacy)) {
+       for (node = xmlFirstElementChild(trackers_node); node; node = xmlNextElementSibling(node)) {
+               if (!strcmp((const char *) node->name, config_element_tracker_targets_legacy)) {
                        targets_node = node;
                        break;
                }
@@ -2641,24 +2502,22 @@ static int process_legacy_pid_tracker_node(
        /* Go through all id target node */
        child_count = xmlChildElementCount(targets_node);
        status = lttng_process_attr_tracker_handle_set_tracking_policy(
-                       tracker_handle,
-                       child_count == 0 ? LTTNG_TRACKING_POLICY_EXCLUDE_ALL :
-                                          LTTNG_TRACKING_POLICY_INCLUDE_SET);
+               tracker_handle,
+               child_count == 0 ? LTTNG_TRACKING_POLICY_EXCLUDE_ALL :
+                                  LTTNG_TRACKING_POLICY_INCLUDE_SET);
        if (status != LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK) {
                ret = LTTNG_ERR_UNK;
                goto end;
        }
 
        /* Add all tracked values. */
-       for (node = xmlFirstElementChild(targets_node); node;
-                       node = xmlNextElementSibling(node)) {
+       for (node = xmlFirstElementChild(targets_node); node; node = xmlNextElementSibling(node)) {
                xmlNodePtr pid_target_node = node;
 
                /* get pid_target node and track it */
                for (node = xmlFirstElementChild(pid_target_node); node;
-                               node = xmlNextElementSibling(node)) {
-                       if (!strcmp((const char *) node->name,
-                                           config_element_tracker_pid_legacy)) {
+                    node = xmlNextElementSibling(node)) {
+                       if (!strcmp((const char *) node->name, config_element_tracker_pid_legacy)) {
                                int64_t id;
                                xmlChar *content = xmlNodeGetContent(node);
 
@@ -2676,14 +2535,14 @@ static int process_legacy_pid_tracker_node(
 
                                switch (process_attr) {
                                case LTTNG_PROCESS_ATTR_PROCESS_ID:
-                                       status = lttng_process_attr_process_id_tracker_handle_add_pid(
-                                                       tracker_handle,
-                                                       (pid_t) id);
+                                       status =
+                                               lttng_process_attr_process_id_tracker_handle_add_pid(
+                                                       tracker_handle, (pid_t) id);
                                        break;
                                case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID:
-                                       status = lttng_process_attr_virtual_process_id_tracker_handle_add_pid(
-                                                       tracker_handle,
-                                                       (pid_t) id);
+                                       status =
+                                               lttng_process_attr_virtual_process_id_tracker_handle_add_pid(
+                                                       tracker_handle, (pid_t) id);
                                        break;
                                default:
                                        ret = LTTNG_ERR_INVALID;
@@ -2715,11 +2574,11 @@ static int process_legacy_pid_tracker_node(
 end:
        lttng_process_attr_tracker_handle_destroy(tracker_handle);
        return ret;
- }
+}
 
 static int process_id_tracker_node(xmlNodePtr id_tracker_node,
-               struct lttng_handle *handle,
-               enum lttng_process_attr process_attr)
+                                  struct lttng_handle *handle,
+                                  enum lttng_process_attr process_attr)
 {
        int ret = 0, child_count;
        xmlNodePtr values_node = NULL;
@@ -2737,25 +2596,26 @@ static int process_id_tracker_node(xmlNodePtr id_tracker_node,
        LTTNG_ASSERT(id_tracker_node);
 
        tracker_handle_ret_code = lttng_session_get_tracker_handle(
-                       handle->session_name, handle->domain.type, process_attr,
-                       &tracker_handle);
+               handle->session_name, handle->domain.type, process_attr, &tracker_handle);
        if (tracker_handle_ret_code != LTTNG_OK) {
                ret = LTTNG_ERR_INVALID;
                goto end;
        }
 
-       ret = get_tracker_elements(process_attr, &element_id_tracker,
-                       &element_target_id, &element_id, &element_id_alias,
-                       &element_name);
+       ret = get_tracker_elements(process_attr,
+                                  &element_id_tracker,
+                                  &element_target_id,
+                                  &element_id,
+                                  &element_id_alias,
+                                  &element_name);
        if (ret) {
                goto end;
        }
 
        /* get the values node */
        for (node = xmlFirstElementChild(id_tracker_node); node;
-                       node = xmlNextElementSibling(node)) {
-               if (!strcmp((const char *) node->name,
-                               config_element_process_attr_values)) {
+            node = xmlNextElementSibling(node)) {
+               if (!strcmp((const char *) node->name, config_element_process_attr_values)) {
                        values_node = node;
                        break;
                }
@@ -2769,26 +2629,24 @@ static int process_id_tracker_node(xmlNodePtr id_tracker_node,
        /* Go through all id target node */
        child_count = xmlChildElementCount(values_node);
        status = lttng_process_attr_tracker_handle_set_tracking_policy(
-                       tracker_handle,
-                       child_count == 0 ? LTTNG_TRACKING_POLICY_EXCLUDE_ALL :
-                                          LTTNG_TRACKING_POLICY_INCLUDE_SET);
+               tracker_handle,
+               child_count == 0 ? LTTNG_TRACKING_POLICY_EXCLUDE_ALL :
+                                  LTTNG_TRACKING_POLICY_INCLUDE_SET);
        if (status != LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK) {
                ret = LTTNG_ERR_UNK;
                goto end;
        }
 
        /* Add all tracked values. */
-       for (node = xmlFirstElementChild(values_node); node;
-                       node = xmlNextElementSibling(node)) {
+       for (node = xmlFirstElementChild(values_node); node; node = xmlNextElementSibling(node)) {
                xmlNodePtr id_target_node = node;
 
                /* get id node and track it */
                for (node = xmlFirstElementChild(id_target_node); node;
-                               node = xmlNextElementSibling(node)) {
+                    node = xmlNextElementSibling(node)) {
                        if (!strcmp((const char *) node->name, element_id) ||
-                                       (element_id_alias &&
-                                                       !strcmp((const char *) node->name,
-                                                                       element_id_alias))) {
+                           (element_id_alias &&
+                            !strcmp((const char *) node->name, element_id_alias))) {
                                int64_t id;
                                xmlChar *content = xmlNodeGetContent(node);
 
@@ -2806,42 +2664,39 @@ static int process_id_tracker_node(xmlNodePtr id_tracker_node,
 
                                switch (process_attr) {
                                case LTTNG_PROCESS_ATTR_PROCESS_ID:
-                                       status = lttng_process_attr_process_id_tracker_handle_add_pid(
-                                                       tracker_handle,
-                                                       (pid_t) id);
+                                       status =
+                                               lttng_process_attr_process_id_tracker_handle_add_pid(
+                                                       tracker_handle, (pid_t) id);
                                        break;
                                case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID:
-                                       status = lttng_process_attr_virtual_process_id_tracker_handle_add_pid(
-                                                       tracker_handle,
-                                                       (pid_t) id);
+                                       status =
+                                               lttng_process_attr_virtual_process_id_tracker_handle_add_pid(
+                                                       tracker_handle, (pid_t) id);
                                        break;
                                case LTTNG_PROCESS_ATTR_USER_ID:
                                        status = lttng_process_attr_user_id_tracker_handle_add_uid(
-                                                       tracker_handle,
-                                                       (uid_t) id);
+                                               tracker_handle, (uid_t) id);
                                        break;
                                case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID:
-                                       status = lttng_process_attr_virtual_user_id_tracker_handle_add_uid(
-                                                       tracker_handle,
-                                                       (uid_t) id);
+                                       status =
+                                               lttng_process_attr_virtual_user_id_tracker_handle_add_uid(
+                                                       tracker_handle, (uid_t) id);
                                        break;
                                case LTTNG_PROCESS_ATTR_GROUP_ID:
                                        status = lttng_process_attr_group_id_tracker_handle_add_gid(
-                                                       tracker_handle,
-                                                       (gid_t) id);
+                                               tracker_handle, (gid_t) id);
                                        break;
                                case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
-                                       status = lttng_process_attr_virtual_group_id_tracker_handle_add_gid(
-                                                       tracker_handle,
-                                                       (gid_t) id);
+                                       status =
+                                               lttng_process_attr_virtual_group_id_tracker_handle_add_gid(
+                                                       tracker_handle, (gid_t) id);
                                        break;
                                default:
                                        ret = LTTNG_ERR_INVALID;
                                        goto end;
                                }
                        } else if (element_name &&
-                                       !strcmp((const char *) node->name,
-                                                       element_name)) {
+                                  !strcmp((const char *) node->name, element_name)) {
                                xmlChar *content = xmlNodeGetContent(node);
 
                                if (!content) {
@@ -2851,24 +2706,24 @@ static int process_id_tracker_node(xmlNodePtr id_tracker_node,
 
                                switch (process_attr) {
                                case LTTNG_PROCESS_ATTR_USER_ID:
-                                       status = lttng_process_attr_user_id_tracker_handle_add_user_name(
-                                                       tracker_handle,
-                                                       (const char *) content);
+                                       status =
+                                               lttng_process_attr_user_id_tracker_handle_add_user_name(
+                                                       tracker_handle, (const char *) content);
                                        break;
                                case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID:
-                                       status = lttng_process_attr_virtual_user_id_tracker_handle_add_user_name(
-                                                       tracker_handle,
-                                                       (const char *) content);
+                                       status =
+                                               lttng_process_attr_virtual_user_id_tracker_handle_add_user_name(
+                                                       tracker_handle, (const char *) content);
                                        break;
                                case LTTNG_PROCESS_ATTR_GROUP_ID:
-                                       status = lttng_process_attr_group_id_tracker_handle_add_group_name(
-                                                       tracker_handle,
-                                                       (const char *) content);
+                                       status =
+                                               lttng_process_attr_group_id_tracker_handle_add_group_name(
+                                                       tracker_handle, (const char *) content);
                                        break;
                                case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
-                                       status = lttng_process_attr_virtual_group_id_tracker_handle_add_group_name(
-                                                       tracker_handle,
-                                                       (const char *) content);
+                                       status =
+                                               lttng_process_attr_virtual_group_id_tracker_handle_add_group_name(
+                                                       tracker_handle, (const char *) content);
                                        break;
                                default:
                                        free(content);
@@ -2904,8 +2759,7 @@ end:
        return ret;
 }
 
-static
-int process_domain_node(xmlNodePtr domain_node, const char *session_name)
+static int process_domain_node(xmlNodePtr domain_node, const char *session_name)
 {
        int ret;
        struct lttng_domain domain {};
@@ -2935,10 +2789,8 @@ int process_domain_node(xmlNodePtr domain_node, const char *session_name)
        }
 
        /* get the channels node */
-       for (node = xmlFirstElementChild(domain_node); node;
-               node = xmlNextElementSibling(node)) {
-               if (!strcmp((const char *) node->name,
-                       config_element_channels)) {
+       for (node = xmlFirstElementChild(domain_node); node; node = xmlNextElementSibling(node)) {
+               if (!strcmp((const char *) node->name, config_element_channels)) {
                        channels_node = node;
                        break;
                }
@@ -2949,8 +2801,7 @@ int process_domain_node(xmlNodePtr domain_node, const char *session_name)
        }
 
        /* create all channels */
-       for (node = xmlFirstElementChild(channels_node); node;
-               node = xmlNextElementSibling(node)) {
+       for (node = xmlFirstElementChild(channels_node); node; node = xmlNextElementSibling(node)) {
                const enum lttng_domain_type original_domain = domain.type;
                xmlNodePtr contexts_node = NULL;
                xmlNodePtr events_node = NULL;
@@ -2982,11 +2833,10 @@ int process_domain_node(xmlNodePtr domain_node, const char *session_name)
                        goto end;
                }
 
-               for (channel_attr_node = xmlFirstElementChild(node);
-                       channel_attr_node; channel_attr_node =
-                       xmlNextElementSibling(channel_attr_node)) {
-                       ret = process_channel_attr_node(channel_attr_node,
-                               channel, &contexts_node, &events_node);
+               for (channel_attr_node = xmlFirstElementChild(node); channel_attr_node;
+                    channel_attr_node = xmlNextElementSibling(channel_attr_node)) {
+                       ret = process_channel_attr_node(
+                               channel_attr_node, channel, &contexts_node, &events_node);
                        if (ret) {
                                goto end;
                        }
@@ -3005,8 +2855,7 @@ int process_domain_node(xmlNodePtr domain_node, const char *session_name)
                        goto end;
                }
 
-               ret = process_contexts_node(contexts_node, handle,
-                       channel->name);
+               ret = process_contexts_node(contexts_node, handle, channel->name);
                if (ret) {
                        goto end;
                }
@@ -3016,16 +2865,13 @@ int process_domain_node(xmlNodePtr domain_node, const char *session_name)
        channel = NULL;
 
        /* get the trackers node */
-       for (node = xmlFirstElementChild(domain_node); node;
-                       node = xmlNextElementSibling(node)) {
-               if (!strcmp((const char *) node->name,
-                                   config_element_process_attr_trackers) ||
-                               !strcmp((const char *) node->name,
-                                               config_element_trackers_legacy)) {
+       for (node = xmlFirstElementChild(domain_node); node; node = xmlNextElementSibling(node)) {
+               if (!strcmp((const char *) node->name, config_element_process_attr_trackers) ||
+                   !strcmp((const char *) node->name, config_element_trackers_legacy)) {
                        if (trackers_node) {
                                ERR("Only one instance of `%s` or `%s` is allowed in a session configuration",
-                                               config_element_process_attr_trackers,
-                                               config_element_trackers_legacy);
+                                   config_element_process_attr_trackers,
+                                   config_element_trackers_legacy);
                                ret = -1;
                                goto end;
                        }
@@ -3038,64 +2884,56 @@ int process_domain_node(xmlNodePtr domain_node, const char *session_name)
                goto end;
        }
 
-       for (node = xmlFirstElementChild(trackers_node); node;
-                       node = xmlNextElementSibling(node)) {
-               if (!strcmp((const char *) node->name,
-                                   config_element_process_attr_tracker_pid)) {
+       for (node = xmlFirstElementChild(trackers_node); node; node = xmlNextElementSibling(node)) {
+               if (!strcmp((const char *) node->name, config_element_process_attr_tracker_pid)) {
                        pid_tracker_node = node;
-                       ret = process_id_tracker_node(pid_tracker_node, handle,
-                                       LTTNG_PROCESS_ATTR_PROCESS_ID);
+                       ret = process_id_tracker_node(
+                               pid_tracker_node, handle, LTTNG_PROCESS_ATTR_PROCESS_ID);
                        if (ret) {
                                goto end;
                        }
                }
-               if (!strcmp((const char *) node->name,
-                                   config_element_process_attr_tracker_vpid)) {
+               if (!strcmp((const char *) node->name, config_element_process_attr_tracker_vpid)) {
                        vpid_tracker_node = node;
-                       ret = process_id_tracker_node(vpid_tracker_node, handle,
-                                       LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID);
+                       ret = process_id_tracker_node(
+                               vpid_tracker_node, handle, LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID);
                        if (ret) {
                                goto end;
                        }
                }
-               if (!strcmp((const char *) node->name,
-                                   config_element_process_attr_tracker_uid)) {
+               if (!strcmp((const char *) node->name, config_element_process_attr_tracker_uid)) {
                        uid_tracker_node = node;
-                       ret = process_id_tracker_node(uid_tracker_node, handle,
-                                       LTTNG_PROCESS_ATTR_USER_ID);
+                       ret = process_id_tracker_node(
+                               uid_tracker_node, handle, LTTNG_PROCESS_ATTR_USER_ID);
                        if (ret) {
                                goto end;
                        }
                }
-               if (!strcmp((const char *) node->name,
-                                   config_element_process_attr_tracker_vuid)) {
+               if (!strcmp((const char *) node->name, config_element_process_attr_tracker_vuid)) {
                        vuid_tracker_node = node;
-                       ret = process_id_tracker_node(vuid_tracker_node, handle,
-                                       LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID);
+                       ret = process_id_tracker_node(
+                               vuid_tracker_node, handle, LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID);
                        if (ret) {
                                goto end;
                        }
                }
-               if (!strcmp((const char *) node->name,
-                                   config_element_process_attr_tracker_gid)) {
+               if (!strcmp((const char *) node->name, config_element_process_attr_tracker_gid)) {
                        gid_tracker_node = node;
-                       ret = process_id_tracker_node(gid_tracker_node, handle,
-                                       LTTNG_PROCESS_ATTR_GROUP_ID);
+                       ret = process_id_tracker_node(
+                               gid_tracker_node, handle, LTTNG_PROCESS_ATTR_GROUP_ID);
                        if (ret) {
                                goto end;
                        }
                }
-               if (!strcmp((const char *) node->name,
-                                   config_element_process_attr_tracker_vgid)) {
+               if (!strcmp((const char *) node->name, config_element_process_attr_tracker_vgid)) {
                        vgid_tracker_node = node;
-                       ret = process_id_tracker_node(vgid_tracker_node, handle,
-                                       LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID);
+                       ret = process_id_tracker_node(
+                               vgid_tracker_node, handle, LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID);
                        if (ret) {
                                goto end;
                        }
                }
-               if (!strcmp((const char *) node->name,
-                                   config_element_pid_tracker_legacy)) {
+               if (!strcmp((const char *) node->name, config_element_pid_tracker_legacy)) {
                        ret = process_legacy_pid_tracker_node(node, handle);
                        if (ret) {
                                goto end;
@@ -3109,21 +2947,18 @@ end:
        return ret;
 }
 
-static
-int add_periodic_rotation(const char *name, uint64_t time_us)
+static int add_periodic_rotation(const char *name, uint64_t time_us)
 {
        int ret;
        enum lttng_rotation_status status;
-       struct lttng_rotation_schedule *periodic =
-                       lttng_rotation_schedule_periodic_create();
+       struct lttng_rotation_schedule *periodic = lttng_rotation_schedule_periodic_create();
 
        if (!periodic) {
                ret = -LTTNG_ERR_NOMEM;
                goto error;
        }
 
-       status = lttng_rotation_schedule_periodic_set_period(periodic,
-                       time_us);
+       status = lttng_rotation_schedule_periodic_set_period(periodic, time_us);
        if (status != LTTNG_ROTATION_STATUS_OK) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
@@ -3147,21 +2982,18 @@ error:
        return ret;
 }
 
-static
-int add_size_rotation(const char *name, uint64_t size_bytes)
+static int add_size_rotation(const char *name, uint64_t size_bytes)
 {
        int ret;
        enum lttng_rotation_status status;
-       struct lttng_rotation_schedule *size =
-                       lttng_rotation_schedule_size_threshold_create();
+       struct lttng_rotation_schedule *size = lttng_rotation_schedule_size_threshold_create();
 
        if (!size) {
                ret = -LTTNG_ERR_NOMEM;
                goto error;
        }
 
-       status = lttng_rotation_schedule_size_threshold_set_threshold(size,
-                       size_bytes);
+       status = lttng_rotation_schedule_size_threshold_set_threshold(size, size_bytes);
        if (status != LTTNG_ROTATION_STATUS_OK) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
@@ -3185,28 +3017,25 @@ error:
        return ret;
 }
 
-static
-int process_session_rotation_schedules_node(
-               xmlNodePtr schedules_node,
-               uint64_t *rotation_timer_interval,
-               uint64_t *rotation_size)
+static int process_session_rotation_schedules_node(xmlNodePtr schedules_node,
+                                                  uint64_t *rotation_timer_interval,
+                                                  uint64_t *rotation_size)
 {
        int ret = 0;
        xmlNodePtr child;
 
-       for (child = xmlFirstElementChild(schedules_node);
-                       child;
-                       child = xmlNextElementSibling(child)) {
+       for (child = xmlFirstElementChild(schedules_node); child;
+            child = xmlNextElementSibling(child)) {
                if (!strcmp((const char *) child->name,
-                               config_element_rotation_schedule_periodic)) {
+                           config_element_rotation_schedule_periodic)) {
                        xmlChar *content;
                        xmlNodePtr time_us_node;
 
                        /* periodic rotation schedule */
                        time_us_node = xmlFirstElementChild(child);
                        if (!time_us_node ||
-                                       strcmp((const char *) time_us_node->name,
-                                               config_element_rotation_schedule_periodic_time_us)) {
+                           strcmp((const char *) time_us_node->name,
+                                  config_element_rotation_schedule_periodic_time_us)) {
                                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                goto end;
                        }
@@ -3224,15 +3053,15 @@ int process_session_rotation_schedules_node(
                                goto end;
                        }
                } else if (!strcmp((const char *) child->name,
-                               config_element_rotation_schedule_size_threshold)) {
+                                  config_element_rotation_schedule_size_threshold)) {
                        xmlChar *content;
                        xmlNodePtr bytes_node;
 
                        /* size_threshold rotation schedule */
                        bytes_node = xmlFirstElementChild(child);
                        if (!bytes_node ||
-                                       strcmp((const char *) bytes_node->name,
-                                               config_element_rotation_schedule_size_threshold_bytes)) {
+                           strcmp((const char *) bytes_node->name,
+                                  config_element_rotation_schedule_size_threshold_bytes)) {
                                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                goto end;
                        }
@@ -3256,15 +3085,13 @@ end:
        return ret;
 }
 
-static
-int process_session_node(xmlNodePtr session_node, const char *session_name,
-               int overwrite,
-               const struct config_load_session_override_attr *overrides)
+static int process_session_node(xmlNodePtr session_node,
+                               const char *session_name,
+                               int overwrite,
+                               const struct config_load_session_override_attr *overrides)
 {
        int ret, started = -1, snapshot_mode = -1;
-       uint64_t live_timer_interval = UINT64_MAX,
-                        rotation_timer_interval = 0,
-                        rotation_size = 0;
+       uint64_t live_timer_interval = UINT64_MAX, rotation_timer_interval = 0, rotation_size = 0;
        xmlChar *name = NULL;
        xmlChar *shm_path = NULL;
        xmlNodePtr domains_node = NULL;
@@ -3277,10 +3104,8 @@ int process_session_node(xmlNodePtr session_node, const char *session_name,
        struct lttng_domain *log4j_domain = NULL;
        struct lttng_domain *python_domain = NULL;
 
-       for (node = xmlFirstElementChild(session_node); node;
-               node = xmlNextElementSibling(node)) {
-               if (!name && !strcmp((const char *) node->name,
-                       config_element_name)) {
+       for (node = xmlFirstElementChild(session_node); node; node = xmlNextElementSibling(node)) {
+               if (!name && !strcmp((const char *) node->name, config_element_name)) {
                        /* name */
                        xmlChar *node_content = xmlNodeGetContent(node);
                        if (!node_content) {
@@ -3289,12 +3114,12 @@ int process_session_node(xmlNodePtr session_node, const char *session_name,
                        }
 
                        name = node_content;
-               } else if (!domains_node && !strcmp((const char *) node->name,
-                       config_element_domains)) {
+               } else if (!domains_node &&
+                          !strcmp((const char *) node->name, config_element_domains)) {
                        /* domains */
                        domains_node = node;
-               } else if (started == -1 && !strcmp((const char *) node->name,
-                       config_element_started)) {
+               } else if (started == -1 &&
+                          !strcmp((const char *) node->name, config_element_started)) {
                        /* started */
                        xmlChar *node_content = xmlNodeGetContent(node);
                        if (!node_content) {
@@ -3308,12 +3133,12 @@ int process_session_node(xmlNodePtr session_node, const char *session_name,
                                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                goto error;
                        }
-               } else if (!output_node && !strcmp((const char *) node->name,
-                       config_element_output)) {
+               } else if (!output_node &&
+                          !strcmp((const char *) node->name, config_element_output)) {
                        /* output */
                        output_node = node;
-               } else if (!shm_path && !strcmp((const char *) node->name,
-                       config_element_shared_memory_path)) {
+               } else if (!shm_path &&
+                          !strcmp((const char *) node->name, config_element_shared_memory_path)) {
                        /* shared memory path */
                        xmlChar *node_content = xmlNodeGetContent(node);
                        if (!node_content) {
@@ -3328,9 +3153,9 @@ int process_session_node(xmlNodePtr session_node, const char *session_name,
                         * rotation_timer_interval.
                         */
                        for (attributes_child = xmlFirstElementChild(node); attributes_child;
-                                       attributes_child = xmlNextElementSibling(attributes_child)) {
+                            attributes_child = xmlNextElementSibling(attributes_child)) {
                                if (!strcmp((const char *) attributes_child->name,
-                                                       config_element_snapshot_mode)) {
+                                           config_element_snapshot_mode)) {
                                        /* snapshot_mode */
                                        xmlChar *snapshot_mode_content =
                                                xmlNodeGetContent(attributes_child);
@@ -3346,7 +3171,7 @@ int process_session_node(xmlNodePtr session_node, const char *session_name,
                                                goto error;
                                        }
                                } else if (!strcmp((const char *) attributes_child->name,
-                                                       config_element_live_timer_interval)) {
+                                                  config_element_live_timer_interval)) {
                                        /* live_timer_interval */
                                        xmlChar *timer_interval_content =
                                                xmlNodeGetContent(attributes_child);
@@ -3355,23 +3180,23 @@ int process_session_node(xmlNodePtr session_node, const char *session_name,
                                                goto error;
                                        }
 
-                                       ret = parse_uint(timer_interval_content, &live_timer_interval);
+                                       ret = parse_uint(timer_interval_content,
+                                                        &live_timer_interval);
                                        free(timer_interval_content);
                                        if (ret) {
                                                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                                goto error;
                                        }
                                } else if (!strcmp((const char *) attributes_child->name,
-                                                       config_element_rotation_schedules)) {
+                                                  config_element_rotation_schedules)) {
                                        ret = process_session_rotation_schedules_node(
-                                                       attributes_child,
-                                                       &rotation_timer_interval,
-                                                       &rotation_size);
+                                               attributes_child,
+                                               &rotation_timer_interval,
+                                               &rotation_size);
                                        if (ret) {
                                                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                                goto error;
                                        }
-
                                }
                        }
                }
@@ -3390,8 +3215,7 @@ int process_session_node(xmlNodePtr session_node, const char *session_name,
        }
 
        /* Init domains to create the session handles */
-       for (node = xmlFirstElementChild(domains_node); node;
-               node = xmlNextElementSibling(node)) {
+       for (node = xmlFirstElementChild(domains_node); node; node = xmlNextElementSibling(node)) {
                lttng_domain *domain = zmalloc<lttng_domain>();
 
                if (!domain) {
@@ -3445,7 +3269,7 @@ int process_session_node(xmlNodePtr session_node, const char *session_name,
                        goto domain_init_error;
                }
                continue;
-domain_init_error:
+       domain_init_error:
                free(domain);
                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                goto error;
@@ -3477,31 +3301,26 @@ domain_init_error:
 
        /* Create session type depending on output type */
        if (snapshot_mode && snapshot_mode != -1) {
-               ret = create_snapshot_session((const char *) name, output_node,
-                               overrides);
-       } else if (live_timer_interval &&
-               live_timer_interval != UINT64_MAX) {
-               ret = create_session((const char *) name,
-                               output_node, live_timer_interval, overrides);
+               ret = create_snapshot_session((const char *) name, output_node, overrides);
+       } else if (live_timer_interval && live_timer_interval != UINT64_MAX) {
+               ret = create_session(
+                       (const char *) name, output_node, live_timer_interval, overrides);
        } else {
                /* regular session */
-               ret = create_session((const char *) name,
-                               output_node, UINT64_MAX, overrides);
+               ret = create_session((const char *) name, output_node, UINT64_MAX, overrides);
        }
        if (ret) {
                goto error;
        }
 
        if (shm_path) {
-               ret = lttng_set_session_shm_path((const char *) name,
-                               (const char *) shm_path);
+               ret = lttng_set_session_shm_path((const char *) name, (const char *) shm_path);
                if (ret) {
                        goto error;
                }
        }
 
-       for (node = xmlFirstElementChild(domains_node); node;
-               node = xmlNextElementSibling(node)) {
+       for (node = xmlFirstElementChild(domains_node); node; node = xmlNextElementSibling(node)) {
                ret = process_domain_node(node, (const char *) name);
                if (ret) {
                        goto end;
@@ -3509,15 +3328,13 @@ domain_init_error:
        }
 
        if (rotation_timer_interval) {
-               ret = add_periodic_rotation((const char *) name,
-                               rotation_timer_interval);
+               ret = add_periodic_rotation((const char *) name, rotation_timer_interval);
                if (ret < 0) {
                        goto error;
                }
        }
        if (rotation_size) {
-               ret = add_size_rotation((const char *) name,
-                               rotation_size);
+               ret = add_size_rotation((const char *) name, rotation_size);
                if (ret < 0) {
                        goto error;
                }
@@ -3532,8 +3349,7 @@ domain_init_error:
 
 end:
        if (ret < 0) {
-               ERR("Failed to load session %s: %s", (const char *) name,
-                       lttng_strerror(ret));
+               ERR("Failed to load session %s: %s", (const char *) name, lttng_strerror(ret));
                lttng_destroy_session((const char *) name);
        }
 
@@ -3573,10 +3389,11 @@ valid:
        return 1;
 }
 
-static
-int load_session_from_file(const char *path, const char *session_name,
-       struct session_config_validation_ctx *validation_ctx, int overwrite,
-       const struct config_load_session_override_attr *overrides)
+static int load_session_from_file(const char *path,
+                                 const char *session_name,
+                                 struct session_config_validation_ctx *validation_ctx,
+                                 int overwrite,
+                                 const struct config_load_session_override_attr *overrides)
 {
        int ret, session_found = !session_name;
        xmlDocPtr doc = NULL;
@@ -3615,11 +3432,9 @@ int load_session_from_file(const char *path, const char *session_name,
                goto end;
        }
 
-       for (session_node = xmlFirstElementChild(sessions_node);
-               session_node; session_node =
-                       xmlNextElementSibling(session_node)) {
-               ret = process_session_node(session_node,
-                       session_name, overwrite, overrides);
+       for (session_node = xmlFirstElementChild(sessions_node); session_node;
+            session_node = xmlNextElementSibling(session_node)) {
+               ret = process_session_node(session_node, session_name, overwrite, overrides);
                if (!session_name && ret) {
                        /* Loading error occurred. */
                        goto end;
@@ -3648,10 +3463,11 @@ end:
        return ret;
 }
 
-static
-int load_session_from_path(const char *path, const char *session_name,
-       struct session_config_validation_ctx *validation_ctx, int overwrite,
-       const struct config_load_session_override_attr *overrides)
+static int load_session_from_path(const char *path,
+                                 const char *session_name,
+                                 struct session_config_validation_ctx *validation_ctx,
+                                 int overwrite,
+                                 const struct config_load_session_override_attr *overrides)
 {
        int ret, session_found = !session_name;
        DIR *directory = NULL;
@@ -3664,7 +3480,9 @@ int load_session_from_path(const char *path, const char *session_name,
        lttng_dynamic_buffer_init(&file_path);
        if (path_len >= LTTNG_PATH_MAX) {
                ERR("Session configuration load path \"%s\" length (%zu) exceeds the maximal length allowed (%d)",
-                               path, path_len, LTTNG_PATH_MAX);
+                   path,
+                   path_len,
+                   LTTNG_PATH_MAX);
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -3686,21 +3504,20 @@ int load_session_from_path(const char *path, const char *session_name,
        if (directory) {
                size_t file_path_root_len;
 
-               ret = lttng_dynamic_buffer_set_capacity(&file_path,
-                               LTTNG_PATH_MAX);
+               ret = lttng_dynamic_buffer_set_capacity(&file_path, LTTNG_PATH_MAX);
                if (ret) {
                        ret = -LTTNG_ERR_NOMEM;
                        goto end;
                }
 
-               ret = lttng_dynamic_buffer_append(&file_path, path, path_len);
+               ret = lttng_dynamic_buffer_append(&file_path, path, path_len);
                if (ret) {
                        ret = -LTTNG_ERR_NOMEM;
                        goto end;
                }
 
                if (file_path.data[file_path.size - 1] != '/') {
-                       ret = lttng_dynamic_buffer_append(&file_path, "/", 1);
+                       ret = lttng_dynamic_buffer_append(&file_path, "/", 1);
                        if (ret) {
                                ret = -LTTNG_ERR_NOMEM;
                                goto end;
@@ -3730,7 +3547,8 @@ int load_session_from_path(const char *path, const char *session_name,
                        /* Reached end of dir stream or error out. */
                        if (!result) {
                                if (errno) {
-                                       PERROR("Failed to enumerate the contents of path \"%s\" while loading session, readdir returned", path);
+                                       PERROR("Failed to enumerate the contents of path \"%s\" while loading session, readdir returned",
+                                              path);
                                        ret = -LTTNG_ERR_LOAD_IO_FAIL;
                                        goto end;
                                }
@@ -3739,38 +3557,36 @@ int load_session_from_path(const char *path, const char *session_name,
 
                        file_name_len = strlen(result->d_name);
 
-                       if (file_name_len <=
-                               sizeof(DEFAULT_SESSION_CONFIG_FILE_EXTENSION)) {
+                       if (file_name_len <= sizeof(DEFAULT_SESSION_CONFIG_FILE_EXTENSION)) {
                                continue;
                        }
 
                        if (file_path.size + file_name_len >= LTTNG_PATH_MAX) {
                                WARN("Ignoring file \"%s\" since the path's length (%zu) would exceed the maximal permitted size (%d)",
-                                               result->d_name,
-                                               /* +1 to account for NULL terminator. */
-                                               file_path.size + file_name_len + 1,
-                                               LTTNG_PATH_MAX);
+                                    result->d_name,
+                                    /* +1 to account for NULL terminator. */
+                                    file_path.size + file_name_len + 1,
+                                    LTTNG_PATH_MAX);
                                continue;
                        }
 
                        /* Does the file end with .lttng? */
                        if (strcmp(DEFAULT_SESSION_CONFIG_FILE_EXTENSION,
-                                       result->d_name + file_name_len - sizeof(
-                                       DEFAULT_SESSION_CONFIG_FILE_EXTENSION) + 1)) {
+                                  result->d_name + file_name_len -
+                                          sizeof(DEFAULT_SESSION_CONFIG_FILE_EXTENSION) + 1)) {
                                continue;
                        }
 
-                       ret = lttng_dynamic_buffer_append(&file_path, result->d_name,
-                                       file_name_len + 1);
+                       ret = lttng_dynamic_buffer_append(
+                               &file_path, result->d_name, file_name_len + 1);
                        if (ret) {
                                ret = -LTTNG_ERR_NOMEM;
                                goto end;
                        }
 
-                       ret = load_session_from_file(file_path.data, session_name,
-                               validation_ctx, overwrite, overrides);
-                       if (session_name &&
-                                       (!ret || ret != -LTTNG_ERR_LOAD_SESSION_NOENT)) {
+                       ret = load_session_from_file(
+                               file_path.data, session_name, validation_ctx, overwrite, overrides);
+                       if (session_name && (!ret || ret != -LTTNG_ERR_LOAD_SESSION_NOENT)) {
                                session_found = 1;
                                break;
                        }
@@ -3781,16 +3597,15 @@ int load_session_from_path(const char *path, const char *session_name,
                         * Reset the buffer's size to the location of the
                         * path's trailing '/'.
                         */
-                       ret = lttng_dynamic_buffer_set_size(&file_path,
-                                       file_path_root_len);
+                       ret = lttng_dynamic_buffer_set_size(&file_path, file_path_root_len);
                        if (ret) {
                                ret = -LTTNG_ERR_UNK;
                                goto end;
                        }
                }
        } else {
-               ret = load_session_from_file(path, session_name,
-                       validation_ctx, overwrite, overrides);
+               ret = load_session_from_file(
+                       path, session_name, validation_ctx, overwrite, overrides);
                if (ret) {
                        goto end;
                }
@@ -3844,9 +3659,11 @@ invalid:
        return 0;
 }
 
-int config_load_session(const char *path, const char *session_name,
-               int overwrite, unsigned int autoload,
-               const struct config_load_session_override_attr *overrides)
+int config_load_session(const char *path,
+                       const char *session_name,
+                       int overwrite,
+                       unsigned int autoload,
+                       const struct config_load_session_override_attr *overrides)
 {
        int ret;
        bool session_loaded = false;
@@ -3872,10 +3689,11 @@ int config_load_session(const char *path, const char *session_name,
                         * continue loading the system wide sessions.
                         */
                        if (autoload) {
-                               ret = snprintf(path_buf, sizeof(path_buf),
-                                               DEFAULT_SESSION_HOME_CONFIGPATH
-                                               "/" DEFAULT_SESSION_CONFIG_AUTOLOAD,
-                                               home_path);
+                               ret = snprintf(path_buf,
+                                              sizeof(path_buf),
+                                              DEFAULT_SESSION_HOME_CONFIGPATH
+                                              "/" DEFAULT_SESSION_CONFIG_AUTOLOAD,
+                                              home_path);
                                if (ret < 0) {
                                        PERROR("snprintf session autoload home config path");
                                        ret = -LTTNG_ERR_INVALID;
@@ -3892,9 +3710,10 @@ int config_load_session(const char *path, const char *session_name,
                                        path_ptr = path_buf;
                                }
                        } else {
-                               ret = snprintf(path_buf, sizeof(path_buf),
-                                               DEFAULT_SESSION_HOME_CONFIGPATH,
-                                               home_path);
+                               ret = snprintf(path_buf,
+                                              sizeof(path_buf),
+                                              DEFAULT_SESSION_HOME_CONFIGPATH,
+                                              home_path);
                                if (ret < 0) {
                                        PERROR("snprintf session home config path");
                                        ret = -LTTNG_ERR_INVALID;
@@ -3903,8 +3722,11 @@ int config_load_session(const char *path, const char *session_name,
                                path_ptr = path_buf;
                        }
                        if (path_ptr) {
-                               ret = load_session_from_path(path_ptr, session_name,
-                                               &validation_ctx, overwrite, overrides);
+                               ret = load_session_from_path(path_ptr,
+                                                            session_name,
+                                                            &validation_ctx,
+                                                            overwrite,
+                                                            overrides);
                                if (ret && ret != -LTTNG_ERR_LOAD_SESSION_NOENT) {
                                        goto end;
                                }
@@ -3921,8 +3743,8 @@ int config_load_session(const char *path, const char *session_name,
 
                /* Try system wide configuration directory. */
                if (autoload) {
-                       sys_path = DEFAULT_SESSION_SYSTEM_CONFIGPATH "/"
-                               DEFAULT_SESSION_CONFIG_AUTOLOAD;
+                       sys_path = DEFAULT_SESSION_SYSTEM_CONFIGPATH
+                               "/" DEFAULT_SESSION_CONFIG_AUTOLOAD;
                        ret = validate_path_creds(sys_path);
                        if (ret) {
                                path_ptr = sys_path;
@@ -3933,8 +3755,8 @@ int config_load_session(const char *path, const char *session_name,
                }
 
                if (path_ptr) {
-                       ret = load_session_from_path(path_ptr, session_name,
-                                       &validation_ctx, overwrite, overrides);
+                       ret = load_session_from_path(
+                               path_ptr, session_name, &validation_ctx, overwrite, overrides);
                        if (!ret) {
                                session_loaded = true;
                        }
@@ -3960,8 +3782,8 @@ int config_load_session(const char *path, const char *session_name,
                        goto end;
                }
 
-               ret = load_session_from_path(path, session_name,
-                       &validation_ctx, overwrite, overrides);
+               ret = load_session_from_path(
+                       path, session_name, &validation_ctx, overwrite, overrides);
        }
 end:
        fini_session_config_validation_ctx(&validation_ctx);
@@ -3980,8 +3802,7 @@ end:
        return ret;
 }
 
-static
-void __attribute__((destructor)) session_config_exit(void)
+static void __attribute__((destructor)) session_config_exit(void)
 {
        xmlCleanupParser();
 }
index 274ecf48fa71275ee28803f850049b7ab882f763..410722d07ff74b6ce83cca86ccfebf9860e5b325 100644 (file)
@@ -7,20 +7,20 @@
  */
 
 #define _LGPL_SOURCE
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <inttypes.h>
+#include "consumer-metadata-cache.hpp"
 
 #include <common/common.hpp>
-#include <common/utils.hpp>
+#include <common/consumer/consumer.hpp>
 #include <common/sessiond-comm/sessiond-comm.hpp>
 #include <common/ust-consumer/ust-consumer.hpp>
-#include <common/consumer/consumer.hpp>
+#include <common/utils.hpp>
 
-#include "consumer-metadata-cache.hpp"
+#include <inttypes.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 enum metadata_cache_update_version_status {
        METADATA_CACHE_UPDATE_STATUS_VERSION_UPDATED,
@@ -32,8 +32,7 @@ extern struct lttng_consumer_global_data the_consumer_data;
 /*
  * Reset the metadata cache.
  */
-static
-void metadata_cache_reset(struct consumer_metadata_cache *cache)
+static void metadata_cache_reset(struct consumer_metadata_cache *cache)
 {
        const int ret = lttng_dynamic_buffer_set_size(&cache->contents, 0);
 
@@ -45,8 +44,8 @@ void metadata_cache_reset(struct consumer_metadata_cache *cache)
  * If it did, reset the metadata cache.
  * The metadata cache lock MUST be held.
  */
-static enum metadata_cache_update_version_status metadata_cache_update_version(
-               struct consumer_metadata_cache *cache, uint64_t version)
+static enum metadata_cache_update_version_status
+metadata_cache_update_version(struct consumer_metadata_cache *cache, uint64_t version)
 {
        enum metadata_cache_update_version_status status;
 
@@ -74,8 +73,10 @@ end:
  */
 enum consumer_metadata_cache_write_status
 consumer_metadata_cache_write(struct consumer_metadata_cache *cache,
-               unsigned int offset, unsigned int len, uint64_t version,
-               const char *data)
+                             unsigned int offset,
+                             unsigned int len,
+                             uint64_t version,
+                             const char *data)
 {
        int ret = 0;
        enum consumer_metadata_cache_write_status status;
@@ -87,15 +88,14 @@ consumer_metadata_cache_write(struct consumer_metadata_cache *cache,
        original_size = cache->contents.size;
 
        if (metadata_cache_update_version(cache, version) ==
-                       METADATA_CACHE_UPDATE_STATUS_VERSION_UPDATED) {
+           METADATA_CACHE_UPDATE_STATUS_VERSION_UPDATED) {
                metadata_cache_reset(cache);
                cache_is_invalidated = true;
        }
 
        DBG("Writing %u bytes from offset %u in metadata cache", len, offset);
        if (offset + len > cache->contents.size) {
-               ret = lttng_dynamic_buffer_set_size(
-                               &cache->contents, offset + len);
+               ret = lttng_dynamic_buffer_set_size(&cache->contents, offset + len);
                if (ret) {
                        ERR("Extending metadata cache");
                        status = CONSUMER_METADATA_CACHE_WRITE_STATUS_ERROR;
@@ -142,19 +142,17 @@ int consumer_metadata_cache_allocate(struct lttng_consumer_channel *channel)
        }
 
        lttng_dynamic_buffer_init(&channel->metadata_cache->contents);
-       ret = lttng_dynamic_buffer_set_capacity(
-                       &channel->metadata_cache->contents,
-                       DEFAULT_METADATA_CACHE_SIZE);
+       ret = lttng_dynamic_buffer_set_capacity(&channel->metadata_cache->contents,
+                                               DEFAULT_METADATA_CACHE_SIZE);
        if (ret) {
                PERROR("Failed to pre-allocate metadata cache storage of %d bytes on creation",
-                               DEFAULT_METADATA_CACHE_SIZE);
+                      DEFAULT_METADATA_CACHE_SIZE);
                ret = -1;
                goto end_free_mutex;
        }
 
        DBG("Allocated metadata cache: current capacity = %zu",
-                       lttng_dynamic_buffer_get_capacity_left(
-                                       &channel->metadata_cache->contents));
+           lttng_dynamic_buffer_get_capacity_left(&channel->metadata_cache->contents));
 
        ret = 0;
        goto end;
@@ -189,7 +187,8 @@ void consumer_metadata_cache_destroy(struct lttng_consumer_channel *channel)
  * Return 0 if everything has been flushed, 1 if there is data not flushed.
  */
 int consumer_metadata_cache_flushed(struct lttng_consumer_channel *channel,
-               uint64_t offset, int timer)
+                                   uint64_t offset,
+                                   int timer)
 {
        int ret = 0;
        struct lttng_consumer_stream *metadata_stream;
@@ -223,8 +222,7 @@ int consumer_metadata_cache_flushed(struct lttng_consumer_channel *channel,
 
        if (metadata_stream->ust_metadata_pushed >= offset) {
                ret = 0;
-       } else if (channel->metadata_stream->endpoint_status !=
-                       CONSUMER_ENDPOINT_ACTIVE) {
+       } else if (channel->metadata_stream->endpoint_status != CONSUMER_ENDPOINT_ACTIVE) {
                /* An inactive endpoint means we don't have to flush anymore. */
                ret = 0;
        } else {
index b30e9aac0680eb6795a763f836a5da8ff18349fa..2816d1a37cb28a9d544e61fb874dc4e3a2468a9a 100644 (file)
@@ -8,17 +8,12 @@
  */
 
 #define _LGPL_SOURCE
-#include <inttypes.h>
-#include <sys/mman.h>
-#include <unistd.h>
+#include "consumer-stream.hpp"
 
 #include <common/common.hpp>
 #include <common/consumer/consumer-timer.hpp>
-#include <common/consumer/consumer-timer.hpp>
-#include <common/consumer/consumer.hpp>
 #include <common/consumer/consumer.hpp>
 #include <common/consumer/metadata-bucket.hpp>
-#include <common/consumer/metadata-bucket.hpp>
 #include <common/index/index.hpp>
 #include <common/kernel-consumer/kernel-consumer.hpp>
 #include <common/kernel-ctl/kernel-ctl.hpp>
 #include <common/ust-consumer/ust-consumer.hpp>
 #include <common/utils.hpp>
 
-#include "consumer-stream.hpp"
+#include <inttypes.h>
+#include <sys/mman.h>
+#include <unistd.h>
 
 /*
  * RCU call to free stream. MUST only be used with call_rcu().
  */
 static void free_stream_rcu(struct rcu_head *head)
 {
-       struct lttng_ht_node_u64 *node =
-               lttng::utils::container_of(head, &lttng_ht_node_u64::head);
+       struct lttng_ht_node_u64 *node = lttng::utils::container_of(head, &lttng_ht_node_u64::head);
        struct lttng_consumer_stream *stream =
                lttng::utils::container_of(node, &lttng_consumer_stream::node);
 
@@ -81,7 +77,7 @@ static void consumer_stream_metadata_assert_locked_all(struct lttng_consumer_str
 
 /* Only used for data streams. */
 static int consumer_stream_update_stats(struct lttng_consumer_stream *stream,
-               const struct stream_subbuffer *subbuf)
+                                       const struct stream_subbuffer *subbuf)
 {
        int ret = 0;
        uint64_t sequence_number;
@@ -103,13 +99,12 @@ static int consumer_stream_update_stats(struct lttng_consumer_stream *stream,
        if (stream->last_sequence_number == -1ULL) {
                stream->last_sequence_number = sequence_number;
        } else if (sequence_number > stream->last_sequence_number) {
-               stream->chan->lost_packets += sequence_number -
-                               stream->last_sequence_number - 1;
+               stream->chan->lost_packets += sequence_number - stream->last_sequence_number - 1;
        } else {
                /* seq <= last_sequence_number */
-               ERR("Sequence number inconsistent : prev = %" PRIu64
-                   ", current = %" PRIu64,
-                               stream->last_sequence_number, sequence_number);
+               ERR("Sequence number inconsistent : prev = %" PRIu64 ", current = %" PRIu64,
+                   stream->last_sequence_number,
+                   sequence_number);
                ret = -1;
                goto end;
        }
@@ -120,13 +115,10 @@ static int consumer_stream_update_stats(struct lttng_consumer_stream *stream,
                 * Overflow has occurred. We assume only one wrap-around
                 * has occurred.
                 */
-               stream->chan->discarded_events +=
-                               (1ULL << (CAA_BITS_PER_LONG - 1)) -
-                               stream->last_discarded_events +
-                               discarded_events;
+               stream->chan->discarded_events += (1ULL << (CAA_BITS_PER_LONG - 1)) -
+                       stream->last_discarded_events + discarded_events;
        } else {
-               stream->chan->discarded_events += discarded_events -
-                                                 stream->last_discarded_events;
+               stream->chan->discarded_events += discarded_events - stream->last_discarded_events;
        }
        stream->last_discarded_events = discarded_events;
        ret = 0;
@@ -135,40 +127,37 @@ end:
        return ret;
 }
 
-static
-void ctf_packet_index_populate(struct ctf_packet_index *index,
-               off_t offset, const struct stream_subbuffer *subbuffer)
+static void ctf_packet_index_populate(struct ctf_packet_index *index,
+                                     off_t offset,
+                                     const struct stream_subbuffer *subbuffer)
 {
        *index = (typeof(*index)){
                .offset = htobe64(offset),
                .packet_size = htobe64(subbuffer->info.data.packet_size),
                .content_size = htobe64(subbuffer->info.data.content_size),
-               .timestamp_begin = htobe64(
-                               subbuffer->info.data.timestamp_begin),
-               .timestamp_end = htobe64(
-                               subbuffer->info.data.timestamp_end),
-               .events_discarded = htobe64(
-                               subbuffer->info.data.events_discarded),
+               .timestamp_begin = htobe64(subbuffer->info.data.timestamp_begin),
+               .timestamp_end = htobe64(subbuffer->info.data.timestamp_end),
+               .events_discarded = htobe64(subbuffer->info.data.events_discarded),
                .stream_id = htobe64(subbuffer->info.data.stream_id),
-               .stream_instance_id = htobe64(
-                               subbuffer->info.data.stream_instance_id.is_set ?
-                               subbuffer->info.data.stream_instance_id.value : -1ULL),
-               .packet_seq_num = htobe64(
-                               subbuffer->info.data.sequence_number.is_set ?
-                               subbuffer->info.data.sequence_number.value : -1ULL),
+               .stream_instance_id =
+                       htobe64(subbuffer->info.data.stream_instance_id.is_set ?
+                                       subbuffer->info.data.stream_instance_id.value :
+                                       -1ULL),
+               .packet_seq_num = htobe64(subbuffer->info.data.sequence_number.is_set ?
+                                                 subbuffer->info.data.sequence_number.value :
+                                                 -1ULL),
        };
 }
 
-static ssize_t consumer_stream_consume_mmap(
-               struct lttng_consumer_local_data *ctx __attribute__((unused)),
-               struct lttng_consumer_stream *stream,
-               const struct stream_subbuffer *subbuffer)
+static ssize_t consumer_stream_consume_mmap(struct lttng_consumer_local_data *ctx
+                                           __attribute__((unused)),
+                                           struct lttng_consumer_stream *stream,
+                                           const struct stream_subbuffer *subbuffer)
 {
        const unsigned long padding_size =
-                       subbuffer->info.data.padded_subbuf_size -
-                       subbuffer->info.data.subbuf_size;
+               subbuffer->info.data.padded_subbuf_size - subbuffer->info.data.subbuf_size;
        const ssize_t written_bytes = lttng_consumer_on_read_subbuffer_mmap(
-                       stream, &subbuffer->buffer.buffer, padding_size);
+               stream, &subbuffer->buffer.buffer, padding_size);
 
        if (stream->net_seq_idx == -1ULL) {
                /*
@@ -177,8 +166,8 @@ static ssize_t consumer_stream_consume_mmap(
                 */
                if (written_bytes != subbuffer->info.data.padded_subbuf_size) {
                        DBG("Failed to write the entire padded subbuffer on disk (written_bytes: %zd, padded subbuffer size %lu)",
-                                       written_bytes,
-                                       subbuffer->info.data.padded_subbuf_size);
+                           written_bytes,
+                           subbuffer->info.data.padded_subbuf_size);
                }
        } else {
                /*
@@ -187,8 +176,8 @@ static ssize_t consumer_stream_consume_mmap(
                 */
                if (written_bytes != subbuffer->info.data.subbuf_size) {
                        DBG("Failed to write only the subbuffer over the network (written_bytes: %zd, subbuffer size %lu)",
-                                       written_bytes,
-                                       subbuffer->info.data.subbuf_size);
+                           written_bytes,
+                           subbuffer->info.data.subbuf_size);
                }
        }
 
@@ -203,18 +192,17 @@ static ssize_t consumer_stream_consume_mmap(
        return written_bytes;
 }
 
-static ssize_t consumer_stream_consume_splice(
-               struct lttng_consumer_local_data *ctx,
-               struct lttng_consumer_stream *stream,
-               const struct stream_subbuffer *subbuffer)
+static ssize_t consumer_stream_consume_splice(struct lttng_consumer_local_data *ctx,
+                                             struct lttng_consumer_stream *stream,
+                                             const struct stream_subbuffer *subbuffer)
 {
        const ssize_t written_bytes = lttng_consumer_on_read_subbuffer_splice(
-                       ctx, stream, subbuffer->info.data.padded_subbuf_size, 0);
+               ctx, stream, subbuffer->info.data.padded_subbuf_size, 0);
 
        if (written_bytes != subbuffer->info.data.padded_subbuf_size) {
                DBG("Failed to write the entire padded subbuffer (written_bytes: %zd, padded subbuffer size %lu)",
-                               written_bytes,
-                               subbuffer->info.data.padded_subbuf_size);
+                   written_bytes,
+                   subbuffer->info.data.padded_subbuf_size);
        }
 
        /*
@@ -228,10 +216,9 @@ static ssize_t consumer_stream_consume_splice(
        return written_bytes;
 }
 
-static int consumer_stream_send_index(
-               struct lttng_consumer_stream *stream,
-               const struct stream_subbuffer *subbuffer,
-               struct lttng_consumer_local_data *ctx __attribute__((unused)))
+static int consumer_stream_send_index(struct lttng_consumer_stream *stream,
+                                     const struct stream_subbuffer *subbuffer,
+                                     struct lttng_consumer_local_data *ctx __attribute__((unused)))
 {
        off_t packet_offset = 0;
        struct ctf_packet_index index = {};
@@ -241,8 +228,7 @@ static int consumer_stream_send_index(
         * effect this sub-buffer from the offset.
         */
        if (stream->net_seq_idx == (uint64_t) -1ULL) {
-               packet_offset = stream->out_fd_offset -
-                               subbuffer->info.data.padded_subbuf_size;
+               packet_offset = stream->out_fd_offset - subbuffer->info.data.padded_subbuf_size;
        }
 
        ctf_packet_index_populate(&index, packet_offset, subbuffer);
@@ -256,7 +242,7 @@ static int consumer_stream_send_index(
  * indicating that there is no metadata available for that stream.
  */
 static int do_sync_metadata(struct lttng_consumer_stream *metadata,
-               struct lttng_consumer_local_data *ctx)
+                           struct lttng_consumer_local_data *ctx)
 {
        int ret;
        enum sync_metadata_status status;
@@ -373,8 +359,7 @@ end_unlock_mutex:
  *
  * Return 0 on success or else a negative value.
  */
-int consumer_stream_sync_metadata(struct lttng_consumer_local_data *ctx,
-               uint64_t session_id)
+int consumer_stream_sync_metadata(struct lttng_consumer_local_data *ctx, uint64_t session_id)
 {
        int ret;
        struct lttng_consumer_stream *stream = NULL;
@@ -391,8 +376,13 @@ int consumer_stream_sync_metadata(struct lttng_consumer_local_data *ctx,
        /* Search the metadata associated with the session id of the given stream. */
 
        cds_lfht_for_each_entry_duplicate(ht->ht,
-                       ht->hash_fct(&session_id, lttng_ht_seed), ht->match_fct,
-                       &session_id, &iter.iter, stream, node_session_id.node) {
+                                         ht->hash_fct(&session_id, lttng_ht_seed),
+                                         ht->match_fct,
+                                         &session_id,
+                                         &iter.iter,
+                                         stream,
+                                         node_session_id.node)
+       {
                if (!stream->metadata_flag) {
                        continue;
                }
@@ -414,10 +404,9 @@ end:
        return ret;
 }
 
-static int consumer_stream_sync_metadata_index(
-               struct lttng_consumer_stream *stream,
-               const struct stream_subbuffer *subbuffer,
-               struct lttng_consumer_local_data *ctx)
+static int consumer_stream_sync_metadata_index(struct lttng_consumer_stream *stream,
+                                              const struct stream_subbuffer *subbuffer,
+                                              struct lttng_consumer_local_data *ctx)
 {
        bool missed_metadata_flush;
        int ret;
@@ -469,17 +458,15 @@ end:
  * of the metadata stream in the kernel. If it was updated, set the reset flag
  * on the stream.
  */
-static
-int metadata_stream_check_version(struct lttng_consumer_stream *stream,
-       const struct stream_subbuffer *subbuffer)
+static int metadata_stream_check_version(struct lttng_consumer_stream *stream,
+                                        const struct stream_subbuffer *subbuffer)
 {
        if (stream->metadata_version == subbuffer->info.metadata.version) {
                goto end;
        }
 
        DBG("New metadata version detected");
-       consumer_stream_metadata_set_version(stream,
-                       subbuffer->info.metadata.version);
+       consumer_stream_metadata_set_version(stream, subbuffer->info.metadata.version);
 
        if (stream->read_subbuffer_ops.reset_metadata) {
                stream->read_subbuffer_ops.reset_metadata(stream);
@@ -489,9 +476,7 @@ end:
        return 0;
 }
 
-static
-bool stream_is_rotating_to_null_chunk(
-               const struct lttng_consumer_stream *stream)
+static bool stream_is_rotating_to_null_chunk(const struct lttng_consumer_stream *stream)
 {
        bool rotating_to_null_chunk = false;
 
@@ -500,16 +485,15 @@ bool stream_is_rotating_to_null_chunk(
                goto end;
        }
 
-       if (stream->trace_chunk == stream->chan->trace_chunk ||
-                       !stream->chan->trace_chunk) {
+       if (stream->trace_chunk == stream->chan->trace_chunk || !stream->chan->trace_chunk) {
                rotating_to_null_chunk = true;
        }
 end:
        return rotating_to_null_chunk;
 }
 
-enum consumer_stream_open_packet_status consumer_stream_open_packet(
-               struct lttng_consumer_stream *stream)
+enum consumer_stream_open_packet_status
+consumer_stream_open_packet(struct lttng_consumer_stream *stream)
 {
        int ret;
        enum consumer_stream_open_packet_status status;
@@ -518,20 +502,21 @@ enum consumer_stream_open_packet_status consumer_stream_open_packet(
        ret = lttng_consumer_sample_snapshot_positions(stream);
        if (ret < 0) {
                ERR("Failed to snapshot positions before post-rotation empty packet flush: stream id = %" PRIu64
-                               ", channel name = %s, session id = %" PRIu64,
-                               stream->key, stream->chan->name,
-                               stream->chan->session_id);
+                   ", channel name = %s, session id = %" PRIu64,
+                   stream->key,
+                   stream->chan->name,
+                   stream->chan->session_id);
                status = CONSUMER_STREAM_OPEN_PACKET_STATUS_ERROR;
                goto end;
        }
 
-       ret = lttng_consumer_get_produced_snapshot(
-                       stream, &produced_pos_before);
+       ret = lttng_consumer_get_produced_snapshot(stream, &produced_pos_before);
        if (ret < 0) {
                ERR("Failed to read produced position before post-rotation empty packet flush: stream id = %" PRIu64
-                               ", channel name = %s, session id = %" PRIu64,
-                               stream->key, stream->chan->name,
-                               stream->chan->session_id);
+                   ", channel name = %s, session id = %" PRIu64,
+                   stream->key,
+                   stream->chan->name,
+                   stream->chan->session_id);
                status = CONSUMER_STREAM_OPEN_PACKET_STATUS_ERROR;
                goto end;
        }
@@ -539,9 +524,10 @@ enum consumer_stream_open_packet_status consumer_stream_open_packet(
        ret = consumer_stream_flush_buffer(stream, 0);
        if (ret) {
                ERR("Failed to flush an empty packet at rotation point: stream id = %" PRIu64
-                               ", channel name = %s, session id = %" PRIu64,
-                               stream->key, stream->chan->name,
-                               stream->chan->session_id);
+                   ", channel name = %s, session id = %" PRIu64,
+                   stream->key,
+                   stream->chan->name,
+                   stream->chan->session_id);
                status = CONSUMER_STREAM_OPEN_PACKET_STATUS_ERROR;
                goto end;
        }
@@ -549,9 +535,10 @@ enum consumer_stream_open_packet_status consumer_stream_open_packet(
        ret = lttng_consumer_sample_snapshot_positions(stream);
        if (ret < 0) {
                ERR("Failed to snapshot positions after post-rotation empty packet flush: stream id = %" PRIu64
-                               ", channel name = %s, session id = %" PRIu64,
-                               stream->key, stream->chan->name,
-                               stream->chan->session_id);
+                   ", channel name = %s, session id = %" PRIu64,
+                   stream->key,
+                   stream->chan->name,
+                   stream->chan->session_id);
                status = CONSUMER_STREAM_OPEN_PACKET_STATUS_ERROR;
                goto end;
        }
@@ -559,9 +546,10 @@ enum consumer_stream_open_packet_status consumer_stream_open_packet(
        ret = lttng_consumer_get_produced_snapshot(stream, &produced_pos_after);
        if (ret < 0) {
                ERR("Failed to read produced position after post-rotation empty packet flush: stream id = %" PRIu64
-                               ", channel name = %s, session id = %" PRIu64,
-                               stream->key, stream->chan->name,
-                               stream->chan->session_id);
+                   ", channel name = %s, session id = %" PRIu64,
+                   stream->key,
+                   stream->chan->name,
+                   stream->chan->session_id);
                status = CONSUMER_STREAM_OPEN_PACKET_STATUS_ERROR;
                goto end;
        }
@@ -571,8 +559,8 @@ enum consumer_stream_open_packet_status consumer_stream_open_packet(
         * positons before and after the flush.
         */
        status = produced_pos_before != produced_pos_after ?
-                       CONSUMER_STREAM_OPEN_PACKET_STATUS_OPENED :
-                       CONSUMER_STREAM_OPEN_PACKET_STATUS_NO_SPACE;
+               CONSUMER_STREAM_OPEN_PACKET_STATUS_OPENED :
+               CONSUMER_STREAM_OPEN_PACKET_STATUS_NO_SPACE;
        if (status == CONSUMER_STREAM_OPEN_PACKET_STATUS_OPENED) {
                stream->opened_packet_in_current_trace_chunk = true;
        }
@@ -589,25 +577,26 @@ end:
  * ring-buffer. In that case, a second attempt is performed after consuming
  * a packet since that will have freed enough space in the ring-buffer.
  */
-static
-int post_consume_open_new_packet(struct lttng_consumer_stream *stream,
-               const struct stream_subbuffer *subbuffer __attribute__((unused)),
-               struct lttng_consumer_local_data *ctx __attribute__((unused)))
+static int post_consume_open_new_packet(struct lttng_consumer_stream *stream,
+                                       const struct stream_subbuffer *subbuffer
+                                       __attribute__((unused)),
+                                       struct lttng_consumer_local_data *ctx
+                                       __attribute__((unused)))
 {
        int ret = 0;
 
-       if (!stream->opened_packet_in_current_trace_chunk &&
-                       stream->trace_chunk &&
-                       !stream_is_rotating_to_null_chunk(stream)) {
+       if (!stream->opened_packet_in_current_trace_chunk && stream->trace_chunk &&
+           !stream_is_rotating_to_null_chunk(stream)) {
                const enum consumer_stream_open_packet_status status =
-                               consumer_stream_open_packet(stream);
+                       consumer_stream_open_packet(stream);
 
                switch (status) {
                case CONSUMER_STREAM_OPEN_PACKET_STATUS_OPENED:
                        DBG("Opened a packet after consuming a packet rotation: stream id = %" PRIu64
-                                       ", channel name = %s, session id = %" PRIu64,
-                                       stream->key, stream->chan->name,
-                                       stream->chan->session_id);
+                           ", channel name = %s, session id = %" PRIu64,
+                           stream->key,
+                           stream->chan->name,
+                           stream->chan->session_id);
                        stream->opened_packet_in_current_trace_chunk = true;
                        break;
                case CONSUMER_STREAM_OPEN_PACKET_STATUS_NO_SPACE:
@@ -618,9 +607,10 @@ int post_consume_open_new_packet(struct lttng_consumer_stream *stream,
                         * anyhow.
                         */
                        DBG("No space left to open a packet after consuming a packet: stream id = %" PRIu64
-                                       ", channel name = %s, session id = %" PRIu64,
-                                       stream->key, stream->chan->name,
-                                       stream->chan->session_id);
+                           ", channel name = %s, session id = %" PRIu64,
+                           stream->key,
+                           stream->chan->name,
+                           stream->chan->session_id);
                        stream->opened_packet_in_current_trace_chunk = true;
                        break;
                case CONSUMER_STREAM_OPEN_PACKET_STATUS_ERROR:
@@ -638,18 +628,17 @@ end:
        return ret;
 }
 
-struct lttng_consumer_stream *consumer_stream_create(
-               struct lttng_consumer_channel *channel,
-               uint64_t channel_key,
-               uint64_t stream_key,
-               const char *channel_name,
-               uint64_t relayd_id,
-               uint64_t session_id,
-               struct lttng_trace_chunk *trace_chunk,
-               int cpu,
-               int *alloc_ret,
-               enum consumer_channel_type type,
-               unsigned int monitor)
+struct lttng_consumer_stream *consumer_stream_create(struct lttng_consumer_channel *channel,
+                                                    uint64_t channel_key,
+                                                    uint64_t stream_key,
+                                                    const char *channel_name,
+                                                    uint64_t relayd_id,
+                                                    uint64_t session_id,
+                                                    struct lttng_trace_chunk *trace_chunk,
+                                                    int cpu,
+                                                    int *alloc_ret,
+                                                    enum consumer_channel_type type,
+                                                    unsigned int monitor)
 {
        int ret;
        struct lttng_consumer_stream *stream;
@@ -698,8 +687,7 @@ struct lttng_consumer_stream *consumer_stream_create(
                pthread_mutex_init(&stream->metadata_rdv_lock, NULL);
        } else {
                /* Format stream name to <channel_name>_<cpu_number> */
-               ret = snprintf(stream->name, sizeof(stream->name), "%s_%d",
-                               channel_name, cpu);
+               ret = snprintf(stream->name, sizeof(stream->name), "%s_%d", channel_name, cpu);
                if (ret < 0) {
                        PERROR("snprintf stream name");
                        goto error;
@@ -730,63 +718,55 @@ struct lttng_consumer_stream *consumer_stream_create(
        /* Init session id node with the stream session id */
        lttng_ht_node_init_u64(&stream->node_session_id, stream->session_id);
 
-       DBG3("Allocated stream %s (key %" PRIu64 ", chan_key %" PRIu64
-                       " relayd_id %" PRIu64 ", session_id %" PRIu64,
-                       stream->name, stream->key, channel_key,
-                       stream->net_seq_idx, stream->session_id);
+       DBG3("Allocated stream %s (key %" PRIu64 ", chan_key %" PRIu64 " relayd_id %" PRIu64
+            ", session_id %" PRIu64,
+            stream->name,
+            stream->key,
+            channel_key,
+            stream->net_seq_idx,
+            stream->session_id);
 
        rcu_read_unlock();
 
-       lttng_dynamic_array_init(&stream->read_subbuffer_ops.post_consume_cbs,
-                       sizeof(post_consume_cb), NULL);
+       lttng_dynamic_array_init(
+               &stream->read_subbuffer_ops.post_consume_cbs, sizeof(post_consume_cb), NULL);
 
        if (type == CONSUMER_CHANNEL_TYPE_METADATA) {
-               stream->read_subbuffer_ops.lock =
-                               consumer_stream_metadata_lock_all;
-               stream->read_subbuffer_ops.unlock =
-                               consumer_stream_metadata_unlock_all;
+               stream->read_subbuffer_ops.lock = consumer_stream_metadata_lock_all;
+               stream->read_subbuffer_ops.unlock = consumer_stream_metadata_unlock_all;
                stream->read_subbuffer_ops.assert_locked =
-                               consumer_stream_metadata_assert_locked_all;
-               stream->read_subbuffer_ops.pre_consume_subbuffer =
-                               metadata_stream_check_version;
+                       consumer_stream_metadata_assert_locked_all;
+               stream->read_subbuffer_ops.pre_consume_subbuffer = metadata_stream_check_version;
        } else {
                const post_consume_cb post_consume_index_op = channel->is_live ?
-                               consumer_stream_sync_metadata_index :
-                               consumer_stream_send_index;
-               const post_consume_cb post_consume_open_new_packet_ =
-                               post_consume_open_new_packet;
-
-               ret = lttng_dynamic_array_add_element(
-                               &stream->read_subbuffer_ops.post_consume_cbs,
-                               &post_consume_index_op);
+                       consumer_stream_sync_metadata_index :
+                       consumer_stream_send_index;
+               const post_consume_cb post_consume_open_new_packet_ = post_consume_open_new_packet;
+
+               ret = lttng_dynamic_array_add_element(&stream->read_subbuffer_ops.post_consume_cbs,
+                                                     &post_consume_index_op);
                if (ret) {
                        PERROR("Failed to add `send index` callback to stream's post consumption callbacks");
                        goto error;
                }
 
-               ret = lttng_dynamic_array_add_element(
-                               &stream->read_subbuffer_ops.post_consume_cbs,
-                               &post_consume_open_new_packet_);
+               ret = lttng_dynamic_array_add_element(&stream->read_subbuffer_ops.post_consume_cbs,
+                                                     &post_consume_open_new_packet_);
                if (ret) {
                        PERROR("Failed to add `open new packet` callback to stream's post consumption callbacks");
                        goto error;
                }
 
                stream->read_subbuffer_ops.lock = consumer_stream_data_lock_all;
-               stream->read_subbuffer_ops.unlock =
-                               consumer_stream_data_unlock_all;
-               stream->read_subbuffer_ops.assert_locked =
-                               consumer_stream_data_assert_locked_all;
-               stream->read_subbuffer_ops.pre_consume_subbuffer =
-                               consumer_stream_update_stats;
+               stream->read_subbuffer_ops.unlock = consumer_stream_data_unlock_all;
+               stream->read_subbuffer_ops.assert_locked = consumer_stream_data_assert_locked_all;
+               stream->read_subbuffer_ops.pre_consume_subbuffer = consumer_stream_update_stats;
        }
 
        if (channel->output == CONSUMER_CHANNEL_MMAP) {
-               stream->read_subbuffer_ops.consume_subbuffer =
-                               consumer_stream_consume_mmap;
+               stream->read_subbuffer_ops.consume_subbuffer = consumer_stream_consume_mmap;
        } else {
-               stream->read_subbuffer_ops.consume_subbuffer =
-                               consumer_stream_consume_splice;
+               stream->read_subbuffer_ops.consume_subbuffer = consumer_stream_consume_splice;
        }
 
        return stream;
@@ -811,7 +791,7 @@ end:
  * a hash table before calling this.
  */
 void consumer_stream_relayd_close(struct lttng_consumer_stream *stream,
-               struct consumer_relayd_sock_pair *relayd)
+                                 struct consumer_relayd_sock_pair *relayd)
 {
        int ret;
 
@@ -825,18 +805,17 @@ void consumer_stream_relayd_close(struct lttng_consumer_stream *stream,
 
        /* Closing streams requires to lock the control socket. */
        pthread_mutex_lock(&relayd->ctrl_sock_mutex);
-       ret = relayd_send_close_stream(&relayd->control_sock,
-                       stream->relayd_stream_id,
-                       stream->next_net_seq_num - 1);
+       ret = relayd_send_close_stream(
+               &relayd->control_sock, stream->relayd_stream_id, stream->next_net_seq_num - 1);
        pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
        if (ret < 0) {
-               ERR("Relayd send close stream failed. Cleaning up relayd %" PRIu64 ".", relayd->net_seq_idx);
+               ERR("Relayd send close stream failed. Cleaning up relayd %" PRIu64 ".",
+                   relayd->net_seq_idx);
                lttng_consumer_cleanup_relayd(relayd);
        }
 
        /* Both conditions are met, we destroy the relayd. */
-       if (uatomic_read(&relayd->refcount) == 0 &&
-                       uatomic_read(&relayd->destroy_flag)) {
+       if (uatomic_read(&relayd->refcount) == 0 && uatomic_read(&relayd->destroy_flag)) {
                consumer_destroy_relayd(relayd);
        }
        stream->net_seq_idx = (uint64_t) -1ULL;
@@ -891,8 +870,7 @@ void consumer_stream_close_output(struct lttng_consumer_stream *stream)
  * The consumer data lock MUST be acquired.
  * The stream lock MUST be acquired.
  */
-void consumer_stream_delete(struct lttng_consumer_stream *stream,
-               struct lttng_ht *ht)
+void consumer_stream_delete(struct lttng_consumer_stream *stream, struct lttng_ht *ht)
 {
        int ret;
        struct lttng_ht_iter iter;
@@ -1028,8 +1006,7 @@ static void destroy_close_stream(struct lttng_consumer_stream *stream)
  * Decrement the stream's channel refcount and if down to 0, return the channel
  * pointer so it can be destroyed by the caller or NULL if not.
  */
-static struct lttng_consumer_channel *unref_channel(
-               struct lttng_consumer_stream *stream)
+static struct lttng_consumer_channel *unref_channel(struct lttng_consumer_stream *stream)
 {
        struct lttng_consumer_channel *free_chan = NULL;
 
@@ -1037,8 +1014,8 @@ static struct lttng_consumer_channel *unref_channel(
        LTTNG_ASSERT(stream->chan);
 
        /* Update refcount of channel and see if we need to destroy it. */
-       if (!uatomic_sub_return(&stream->chan->refcount, 1)
-                       && !uatomic_read(&stream->chan->nb_init_stream_left)) {
+       if (!uatomic_sub_return(&stream->chan->refcount, 1) &&
+           !uatomic_read(&stream->chan->nb_init_stream_left)) {
                free_chan = stream->chan;
        }
 
@@ -1053,8 +1030,7 @@ static struct lttng_consumer_channel *unref_channel(
  * This MUST be called WITHOUT the consumer data and stream lock acquired if
  * the stream is in _monitor_ mode else it does not matter.
  */
-void consumer_stream_destroy(struct lttng_consumer_stream *stream,
-               struct lttng_ht *ht)
+void consumer_stream_destroy(struct lttng_consumer_stream *stream, struct lttng_ht *ht)
 {
        LTTNG_ASSERT(stream);
 
@@ -1077,7 +1053,6 @@ void consumer_stream_destroy(struct lttng_consumer_stream *stream,
                        /* Remove every reference of the stream in the consumer. */
                        consumer_stream_delete(stream, ht);
 
-
                        destroy_close_stream(stream);
 
                        /* Update channel's refcount of the stream. */
@@ -1118,7 +1093,7 @@ void consumer_stream_destroy(struct lttng_consumer_stream *stream,
  * Return 0 on success or else a negative value.
  */
 int consumer_stream_write_index(struct lttng_consumer_stream *stream,
-               struct ctf_packet_index *element)
+                               struct ctf_packet_index *element)
 {
        int ret;
 
@@ -1131,21 +1106,25 @@ int consumer_stream_write_index(struct lttng_consumer_stream *stream,
                relayd = consumer_find_relayd(stream->net_seq_idx);
                if (relayd) {
                        pthread_mutex_lock(&relayd->ctrl_sock_mutex);
-                       ret = relayd_send_index(&relayd->control_sock, element,
-                               stream->relayd_stream_id, stream->next_net_seq_num - 1);
+                       ret = relayd_send_index(&relayd->control_sock,
+                                               element,
+                                               stream->relayd_stream_id,
+                                               stream->next_net_seq_num - 1);
                        if (ret < 0) {
                                /*
                                 * Communication error with lttng-relayd,
                                 * perform cleanup now
                                 */
-                               ERR("Relayd send index failed. Cleaning up relayd %" PRIu64 ".", relayd->net_seq_idx);
+                               ERR("Relayd send index failed. Cleaning up relayd %" PRIu64 ".",
+                                   relayd->net_seq_idx);
                                lttng_consumer_cleanup_relayd(relayd);
                                ret = -1;
                        }
                        pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
                } else {
                        ERR("Stream %" PRIu64 " relayd ID %" PRIu64 " unknown. Can't write index.",
-                                       stream->key, stream->net_seq_idx);
+                           stream->key,
+                           stream->net_seq_idx);
                        ret = -1;
                }
        } else {
@@ -1164,8 +1143,7 @@ error:
        return ret;
 }
 
-int consumer_stream_create_output_files(struct lttng_consumer_stream *stream,
-               bool create_index)
+int consumer_stream_create_output_files(struct lttng_consumer_stream *stream, bool create_index)
 {
        int ret;
        enum lttng_trace_chunk_status chunk_status;
@@ -1176,10 +1154,13 @@ int consumer_stream_create_output_files(struct lttng_consumer_stream *stream,
        ASSERT_LOCKED(stream->lock);
        LTTNG_ASSERT(stream->trace_chunk);
 
-       ret = utils_stream_file_path(stream->chan->pathname, stream->name,
-                       stream->chan->tracefile_size,
-                       stream->tracefile_count_current, NULL,
-                       stream_path, sizeof(stream_path));
+       ret = utils_stream_file_path(stream->chan->pathname,
+                                    stream->name,
+                                    stream->chan->tracefile_size,
+                                    stream->tracefile_count_current,
+                                    NULL,
+                                    stream_path,
+                                    sizeof(stream_path));
        if (ret < 0) {
                goto end;
        }
@@ -1187,16 +1168,15 @@ int consumer_stream_create_output_files(struct lttng_consumer_stream *stream,
        if (stream->out_fd >= 0) {
                ret = close(stream->out_fd);
                if (ret < 0) {
-                       PERROR("Failed to close stream file \"%s\"",
-                                       stream->name);
+                       PERROR("Failed to close stream file \"%s\"", stream->name);
                        goto end;
                }
                stream->out_fd = -1;
        }
 
        DBG("Opening stream output file \"%s\"", stream_path);
-       chunk_status = lttng_trace_chunk_open_file(stream->trace_chunk, stream_path,
-                       flags, mode, &stream->out_fd, false);
+       chunk_status = lttng_trace_chunk_open_file(
+               stream->trace_chunk, stream_path, flags, mode, &stream->out_fd, false);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ERR("Failed to open stream file \"%s\"", stream->name);
                ret = -1;
@@ -1207,14 +1187,16 @@ int consumer_stream_create_output_files(struct lttng_consumer_stream *stream,
                if (stream->index_file) {
                        lttng_index_file_put(stream->index_file);
                }
-               chunk_status = lttng_index_file_create_from_trace_chunk(
-                               stream->trace_chunk,
-                               stream->chan->pathname,
-                               stream->name,
-                               stream->chan->tracefile_size,
-                               stream->tracefile_count_current,
-                               CTF_INDEX_MAJOR, CTF_INDEX_MINOR,
-                               false, &stream->index_file);
+               chunk_status =
+                       lttng_index_file_create_from_trace_chunk(stream->trace_chunk,
+                                                                stream->chan->pathname,
+                                                                stream->name,
+                                                                stream->chan->tracefile_size,
+                                                                stream->tracefile_count_current,
+                                                                CTF_INDEX_MAJOR,
+                                                                CTF_INDEX_MINOR,
+                                                                false,
+                                                                &stream->index_file);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ret = -1;
                        goto end;
@@ -1234,8 +1216,7 @@ int consumer_stream_rotate_output_files(struct lttng_consumer_stream *stream)
 
        stream->tracefile_count_current++;
        if (stream->chan->tracefile_count > 0) {
-               stream->tracefile_count_current %=
-                               stream->chan->tracefile_count;
+               stream->tracefile_count_current %= stream->chan->tracefile_count;
        }
 
        DBG("Rotating output files of stream \"%s\"", stream->name);
@@ -1258,8 +1239,7 @@ bool consumer_stream_is_deleted(struct lttng_consumer_stream *stream)
        return cds_lfht_is_node_deleted(&stream->node.node);
 }
 
-static ssize_t metadata_bucket_flush(
-               const struct stream_subbuffer *buffer, void *data)
+static ssize_t metadata_bucket_flush(const struct stream_subbuffer *buffer, void *data)
 {
        ssize_t ret;
        struct lttng_consumer_stream *stream = (lttng_consumer_stream *) data;
@@ -1272,10 +1252,10 @@ end:
        return ret;
 }
 
-static ssize_t metadata_bucket_consume(
-               struct lttng_consumer_local_data *unused __attribute__((unused)),
-               struct lttng_consumer_stream *stream,
-               const struct stream_subbuffer *subbuffer)
+static ssize_t metadata_bucket_consume(struct lttng_consumer_local_data *unused
+                                      __attribute__((unused)),
+                                      struct lttng_consumer_stream *stream,
+                                      const struct stream_subbuffer *subbuffer)
 {
        ssize_t ret;
        enum metadata_bucket_status status;
@@ -1293,8 +1273,7 @@ static ssize_t metadata_bucket_consume(
        return ret;
 }
 
-int consumer_stream_enable_metadata_bucketization(
-               struct lttng_consumer_stream *stream)
+int consumer_stream_enable_metadata_bucketization(struct lttng_consumer_stream *stream)
 {
        int ret = 0;
 
@@ -1302,8 +1281,7 @@ int consumer_stream_enable_metadata_bucketization(
        LTTNG_ASSERT(!stream->metadata_bucket);
        LTTNG_ASSERT(stream->chan->output == CONSUMER_CHANNEL_MMAP);
 
-       stream->metadata_bucket = metadata_bucket_create(
-                       metadata_bucket_flush, stream);
+       stream->metadata_bucket = metadata_bucket_create(metadata_bucket_flush, stream);
        if (!stream->metadata_bucket) {
                ret = -1;
                goto end;
@@ -1314,8 +1292,8 @@ end:
        return ret;
 }
 
-void consumer_stream_metadata_set_version(
-               struct lttng_consumer_stream *stream, uint64_t new_version)
+void consumer_stream_metadata_set_version(struct lttng_consumer_stream *stream,
+                                         uint64_t new_version)
 {
        LTTNG_ASSERT(new_version > stream->metadata_version);
        stream->metadata_version = new_version;
@@ -1326,8 +1304,7 @@ void consumer_stream_metadata_set_version(
        }
 }
 
-int consumer_stream_flush_buffer(struct lttng_consumer_stream *stream,
-               bool producer_active)
+int consumer_stream_flush_buffer(struct lttng_consumer_stream *stream, bool producer_active)
 {
        int ret = 0;
 
index 8dae11fa2d5b465ccc3dab61f2aed7b948ab518a..fa496336d8643e84018e2ca286018b70078fad50 100644 (file)
@@ -7,24 +7,22 @@
  */
 
 #define _LGPL_SOURCE
-#include <inttypes.h>
-#include <signal.h>
-
-#include <bin/lttng-consumerd/health-consumerd.hpp>
 #include <common/common.hpp>
 #include <common/compat/endian.hpp>
-#include <common/kernel-ctl/kernel-ctl.hpp>
-#include <common/kernel-consumer/kernel-consumer.hpp>
 #include <common/consumer/consumer-stream.hpp>
-#include <common/consumer/consumer-timer.hpp>
 #include <common/consumer/consumer-testpoint.hpp>
+#include <common/consumer/consumer-timer.hpp>
+#include <common/kernel-consumer/kernel-consumer.hpp>
+#include <common/kernel-ctl/kernel-ctl.hpp>
 #include <common/ust-consumer/ust-consumer.hpp>
 
+#include <bin/lttng-consumerd/health-consumerd.hpp>
+#include <inttypes.h>
+#include <signal.h>
+
 typedef int (*sample_positions_cb)(struct lttng_consumer_stream *stream);
-typedef int (*get_consumed_cb)(struct lttng_consumer_stream *stream,
-               unsigned long *consumed);
-typedef int (*get_produced_cb)(struct lttng_consumer_stream *stream,
-               unsigned long *produced);
+typedef int (*get_consumed_cb)(struct lttng_consumer_stream *stream, unsigned long *consumed);
+typedef int (*get_produced_cb)(struct lttng_consumer_stream *stream, unsigned long *produced);
 typedef int (*flush_index_cb)(struct lttng_consumer_stream *stream);
 
 static struct timer_signal_data timer_signal = {
@@ -76,8 +74,7 @@ static int the_channel_monitor_pipe = -1;
  * while consumer_timer_switch_stop() is called. It would result in
  * deadlocks.
  */
-static void metadata_switch_timer(struct lttng_consumer_local_data *ctx,
-               siginfo_t *si)
+static void metadata_switch_timer(struct lttng_consumer_local_data *ctx, siginfo_t *si)
 {
        int ret;
        struct lttng_consumer_channel *channel;
@@ -119,8 +116,7 @@ static void metadata_switch_timer(struct lttng_consumer_local_data *ctx,
        }
 }
 
-static int send_empty_index(struct lttng_consumer_stream *stream, uint64_t ts,
-               uint64_t stream_id)
+static int send_empty_index(struct lttng_consumer_stream *stream, uint64_t ts, uint64_t stream_id)
 {
        int ret;
        struct ctf_packet_index index;
@@ -175,8 +171,7 @@ end:
        return ret;
 }
 
-static int check_stream(struct lttng_consumer_stream *stream,
-               flush_index_cb flush_index)
+static int check_stream(struct lttng_consumer_stream *stream, flush_index_cb flush_index)
 {
        int ret;
 
@@ -195,14 +190,14 @@ static int check_stream(struct lttng_consumer_stream *stream,
                ret = pthread_mutex_trylock(&stream->lock);
                switch (ret) {
                case 0:
-                       break;  /* We have the lock. */
+                       break; /* We have the lock. */
                case EBUSY:
                        pthread_mutex_lock(&stream->metadata_timer_lock);
                        if (stream->waiting_on_metadata) {
                                ret = 0;
                                stream->missed_metadata_flush = true;
                                pthread_mutex_unlock(&stream->metadata_timer_lock);
-                               goto end;       /* Bail out. */
+                               goto end; /* Bail out. */
                        }
                        pthread_mutex_unlock(&stream->metadata_timer_lock);
                        /* Try again. */
@@ -267,18 +262,16 @@ end:
 /*
  * Execute action on a live timer
  */
-static void live_timer(struct lttng_consumer_local_data *ctx,
-               siginfo_t *si)
+static void live_timer(struct lttng_consumer_local_data *ctx, siginfo_t *si)
 {
        int ret;
        struct lttng_consumer_channel *channel;
        struct lttng_consumer_stream *stream;
        struct lttng_ht_iter iter;
        const struct lttng_ht *ht = the_consumer_data.stream_per_chan_id_ht;
-       const flush_index_cb flush_index =
-                       ctx->type == LTTNG_CONSUMER_KERNEL ?
-                                       consumer_flush_kernel_index :
-                                       consumer_flush_ust_index;
+       const flush_index_cb flush_index = ctx->type == LTTNG_CONSUMER_KERNEL ?
+               consumer_flush_kernel_index :
+               consumer_flush_ust_index;
 
        channel = (lttng_consumer_channel *) si->si_value.sival_ptr;
        LTTNG_ASSERT(channel);
@@ -291,9 +284,13 @@ static void live_timer(struct lttng_consumer_local_data *ctx,
 
        rcu_read_lock();
        cds_lfht_for_each_entry_duplicate(ht->ht,
-                       ht->hash_fct(&channel->key, lttng_ht_seed),
-                       ht->match_fct, &channel->key, &iter.iter,
-                       stream, node_channel_id.node) {
+                                         ht->hash_fct(&channel->key, lttng_ht_seed),
+                                         ht->match_fct,
+                                         &channel->key,
+                                         &iter.iter,
+                                         stream,
+                                         node_channel_id.node)
+       {
                ret = check_stream(stream, flush_index);
                if (ret < 0) {
                        goto error_unlock;
@@ -307,8 +304,7 @@ error:
        return;
 }
 
-static
-void consumer_timer_signal_thread_qs(unsigned int signr)
+static void consumer_timer_signal_thread_qs(unsigned int signr)
 {
        sigset_t pending_set;
        int ret;
@@ -365,10 +361,10 @@ void consumer_timer_signal_thread_qs(unsigned int signr)
  * Returns a negative value on error, 0 if a timer was created, and
  * a positive value if no timer was created (not an error).
  */
-static
-int consumer_channel_timer_start(timer_t *timer_id,
-               struct lttng_consumer_channel *channel,
-               unsigned int timer_interval_us, int signal)
+static int consumer_channel_timer_start(timer_t *timer_id,
+                                       struct lttng_consumer_channel *channel,
+                                       unsigned int timer_interval_us,
+                                       int signal)
 {
        int ret = 0, delete_ret;
        struct sigevent sev = {};
@@ -412,8 +408,7 @@ error_destroy_timer:
        goto end;
 }
 
-static
-int consumer_channel_timer_stop(timer_t *timer_id, int signal)
+static int consumer_channel_timer_stop(timer_t *timer_id, int signal)
 {
        int ret = 0;
 
@@ -433,15 +428,17 @@ end:
  * Set the channel's switch timer.
  */
 void consumer_timer_switch_start(struct lttng_consumer_channel *channel,
-               unsigned int switch_timer_interval_us)
+                                unsigned int switch_timer_interval_us)
 {
        int ret;
 
        LTTNG_ASSERT(channel);
        LTTNG_ASSERT(channel->key);
 
-       ret = consumer_channel_timer_start(&channel->switch_timer, channel,
-                       switch_timer_interval_us, LTTNG_CONSUMER_SIG_SWITCH);
+       ret = consumer_channel_timer_start(&channel->switch_timer,
+                                          channel,
+                                          switch_timer_interval_us,
+                                          LTTNG_CONSUMER_SIG_SWITCH);
 
        channel->switch_timer_enabled = !!(ret == 0);
 }
@@ -455,8 +452,7 @@ void consumer_timer_switch_stop(struct lttng_consumer_channel *channel)
 
        LTTNG_ASSERT(channel);
 
-       ret = consumer_channel_timer_stop(&channel->switch_timer,
-                       LTTNG_CONSUMER_SIG_SWITCH);
+       ret = consumer_channel_timer_stop(&channel->switch_timer, LTTNG_CONSUMER_SIG_SWITCH);
        if (ret == -1) {
                ERR("Failed to stop switch timer");
        }
@@ -468,15 +464,15 @@ void consumer_timer_switch_stop(struct lttng_consumer_channel *channel)
  * Set the channel's live timer.
  */
 void consumer_timer_live_start(struct lttng_consumer_channel *channel,
-               unsigned int live_timer_interval_us)
+                              unsigned int live_timer_interval_us)
 {
        int ret;
 
        LTTNG_ASSERT(channel);
        LTTNG_ASSERT(channel->key);
 
-       ret = consumer_channel_timer_start(&channel->live_timer, channel,
-                       live_timer_interval_us, LTTNG_CONSUMER_SIG_LIVE);
+       ret = consumer_channel_timer_start(
+               &channel->live_timer, channel, live_timer_interval_us, LTTNG_CONSUMER_SIG_LIVE);
 
        channel->live_timer_enabled = !!(ret == 0);
 }
@@ -490,8 +486,7 @@ void consumer_timer_live_stop(struct lttng_consumer_channel *channel)
 
        LTTNG_ASSERT(channel);
 
-       ret = consumer_channel_timer_stop(&channel->live_timer,
-                       LTTNG_CONSUMER_SIG_LIVE);
+       ret = consumer_channel_timer_stop(&channel->live_timer, LTTNG_CONSUMER_SIG_LIVE);
        if (ret == -1) {
                ERR("Failed to stop live timer");
        }
@@ -506,7 +501,7 @@ void consumer_timer_live_stop(struct lttng_consumer_channel *channel)
  * a positive value if no timer was created (not an error).
  */
 int consumer_timer_monitor_start(struct lttng_consumer_channel *channel,
-               unsigned int monitor_timer_interval_us)
+                                unsigned int monitor_timer_interval_us)
 {
        int ret;
 
@@ -514,8 +509,10 @@ int consumer_timer_monitor_start(struct lttng_consumer_channel *channel,
        LTTNG_ASSERT(channel->key);
        LTTNG_ASSERT(!channel->monitor_timer_enabled);
 
-       ret = consumer_channel_timer_start(&channel->monitor_timer, channel,
-                       monitor_timer_interval_us, LTTNG_CONSUMER_SIG_MONITOR);
+       ret = consumer_channel_timer_start(&channel->monitor_timer,
+                                          channel,
+                                          monitor_timer_interval_us,
+                                          LTTNG_CONSUMER_SIG_MONITOR);
        channel->monitor_timer_enabled = !!(ret == 0);
        return ret;
 }
@@ -530,8 +527,7 @@ int consumer_timer_monitor_stop(struct lttng_consumer_channel *channel)
        LTTNG_ASSERT(channel);
        LTTNG_ASSERT(channel->monitor_timer_enabled);
 
-       ret = consumer_channel_timer_stop(&channel->monitor_timer,
-                       LTTNG_CONSUMER_SIG_MONITOR);
+       ret = consumer_channel_timer_stop(&channel->monitor_timer, LTTNG_CONSUMER_SIG_MONITOR);
        if (ret == -1) {
                ERR("Failed to stop live timer");
                goto end;
@@ -562,11 +558,13 @@ int consumer_signal_init(void)
        return 0;
 }
 
-static
-int sample_channel_positions(struct lttng_consumer_channel *channel,
-               uint64_t *_highest_use, uint64_t *_lowest_use, uint64_t *_total_consumed,
-               sample_positions_cb sample, get_consumed_cb get_consumed,
-               get_produced_cb get_produced)
+static int sample_channel_positions(struct lttng_consumer_channel *channel,
+                                   uint64_t *_highest_use,
+                                   uint64_t *_lowest_use,
+                                   uint64_t *_total_consumed,
+                                   sample_positions_cb sample,
+                                   get_consumed_cb get_consumed,
+                                   get_produced_cb get_produced)
 {
        int ret = 0;
        struct lttng_ht_iter iter;
@@ -580,9 +578,13 @@ int sample_channel_positions(struct lttng_consumer_channel *channel,
        rcu_read_lock();
 
        cds_lfht_for_each_entry_duplicate(ht->ht,
-                       ht->hash_fct(&channel->key, lttng_ht_seed),
-                       ht->match_fct, &channel->key,
-                       &iter.iter, stream, node_channel_id.node) {
+                                         ht->hash_fct(&channel->key, lttng_ht_seed),
+                                         ht->match_fct,
+                                         &channel->key,
+                                         &iter.iter,
+                                         stream,
+                                         node_channel_id.node)
+       {
                unsigned long produced, consumed, usage;
 
                empty_channel = false;
@@ -594,7 +596,8 @@ int sample_channel_positions(struct lttng_consumer_channel *channel,
 
                ret = sample(stream);
                if (ret) {
-                       ERR("Failed to take buffer position snapshot in monitor timer (ret = %d)", ret);
+                       ERR("Failed to take buffer position snapshot in monitor timer (ret = %d)",
+                           ret);
                        pthread_mutex_unlock(&stream->lock);
                        goto end;
                }
@@ -641,8 +644,7 @@ end:
 void sample_and_send_channel_buffer_stats(struct lttng_consumer_channel *channel)
 {
        int ret;
-       int channel_monitor_pipe =
-                       consumer_timer_thread_get_channel_monitor_pipe();
+       int channel_monitor_pipe = consumer_timer_thread_get_channel_monitor_pipe();
        struct lttcomm_consumer_channel_monitor_msg msg = {
                .key = channel->key,
                .session_id = channel->session_id,
@@ -677,8 +679,8 @@ void sample_and_send_channel_buffer_stats(struct lttng_consumer_channel *channel
                abort();
        }
 
-       ret = sample_channel_positions(channel, &highest, &lowest,
-                       &total_consumed, sample, get_consumed, get_produced);
+       ret = sample_channel_positions(
+               channel, &highest, &lowest, &total_consumed, sample, get_consumed, get_produced);
        if (ret) {
                return;
        }
@@ -700,14 +702,16 @@ void sample_and_send_channel_buffer_stats(struct lttng_consumer_channel *channel
                if (errno == EAGAIN) {
                        /* Not an error, the sample is merely dropped. */
                        DBG("Channel monitor pipe is full; dropping sample for channel key = %" PRIu64,
-                                       channel->key);
+                           channel->key);
                } else {
                        PERROR("write to the channel monitor pipe");
                }
        } else {
                DBG("Sent channel monitoring sample for channel key %" PRIu64
-                               ", (highest = %" PRIu64 ", lowest = %" PRIu64 ")",
-                               channel->key, msg.highest, msg.lowest);
+                   ", (highest = %" PRIu64 ", lowest = %" PRIu64 ")",
+                   channel->key,
+                   msg.highest,
+                   msg.lowest);
                channel->last_consumed_size_sample_sent = msg.consumed_since_last_sample;
        }
 }
index f97c119705451c1f2080e99327de6488e9283062..b059eaf52c58397166b564988136dbd59b1b0036 100644 (file)
@@ -8,18 +8,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <inttypes.h>
-#include <poll.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <bin/lttng-consumerd/health-consumerd.hpp>
 #include <common/align.hpp>
 #include <common/common.hpp>
 #include <common/compat/endian.hpp>
 #include <common/ust-consumer/ust-consumer.hpp>
 #include <common/utils.hpp>
 
+#include <bin/lttng-consumerd/health-consumerd.hpp>
+#include <inttypes.h>
+#include <poll.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+
 lttng_consumer_global_data the_consumer_data;
 
 enum consumer_channel_action {
@@ -55,8 +55,8 @@ enum consumer_channel_action {
 namespace {
 struct consumer_channel_msg {
        enum consumer_channel_action action;
-       struct lttng_consumer_channel *chan;    /* add */
-       uint64_t key;                           /* del */
+       struct lttng_consumer_channel *chan; /* add */
+       uint64_t key; /* del */
 };
 
 /*
@@ -118,9 +118,9 @@ static void notify_health_quit_pipe(int *pipe)
 }
 
 static void notify_channel_pipe(struct lttng_consumer_local_data *ctx,
-               struct lttng_consumer_channel *chan,
-               uint64_t key,
-               enum consumer_channel_action action)
+                               struct lttng_consumer_channel *chan,
+                               uint64_t key,
+                               enum consumer_channel_action action)
 {
        struct consumer_channel_msg msg;
        ssize_t ret;
@@ -136,16 +136,15 @@ static void notify_channel_pipe(struct lttng_consumer_local_data *ctx,
        }
 }
 
-void notify_thread_del_channel(struct lttng_consumer_local_data *ctx,
-               uint64_t key)
+void notify_thread_del_channel(struct lttng_consumer_local_data *ctx, uint64_t key)
 {
        notify_channel_pipe(ctx, NULL, key, CONSUMER_CHANNEL_DEL);
 }
 
 static int read_channel_pipe(struct lttng_consumer_local_data *ctx,
-               struct lttng_consumer_channel **chan,
-               uint64_t *key,
-               enum consumer_channel_action *action)
+                            struct lttng_consumer_channel **chan,
+                            uint64_t *key,
+                            enum consumer_channel_action *action)
 {
        struct consumer_channel_msg msg;
        ssize_t ret;
@@ -173,8 +172,7 @@ static void clean_channel_stream_list(struct lttng_consumer_channel *channel)
        LTTNG_ASSERT(channel);
 
        /* Delete streams that might have been left in the stream list. */
-       cds_list_for_each_entry_safe(stream, stmp, &channel->streams.head,
-                       send_node) {
+       cds_list_for_each_entry_safe (stream, stmp, &channel->streams.head, send_node) {
                /*
                 * Once a stream is added to this list, the buffers were created so we
                 * have a guarantee that this call will succeed. Setting the monitor
@@ -190,8 +188,7 @@ static void clean_channel_stream_list(struct lttng_consumer_channel *channel)
  * Find a stream. The consumer_data.lock must be locked during this
  * call.
  */
-static struct lttng_consumer_stream *find_stream(uint64_t key,
-               struct lttng_ht *ht)
+static struct lttng_consumer_stream *find_stream(uint64_t key, struct lttng_ht *ht)
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_u64 *node;
@@ -291,8 +288,7 @@ static void steal_channel_key(uint64_t key)
 
 static void free_channel_rcu(struct rcu_head *head)
 {
-       struct lttng_ht_node_u64 *node =
-               lttng::utils::container_of(head, &lttng_ht_node_u64::head);
+       struct lttng_ht_node_u64 *node = lttng::utils::container_of(head, &lttng_ht_node_u64::head);
        struct lttng_consumer_channel *channel =
                lttng::utils::container_of(node, &lttng_consumer_channel::node);
 
@@ -315,8 +311,7 @@ static void free_channel_rcu(struct rcu_head *head)
  */
 static void free_relayd_rcu(struct rcu_head *head)
 {
-       struct lttng_ht_node_u64 *node =
-               lttng::utils::container_of(head, &lttng_ht_node_u64::head);
+       struct lttng_ht_node_u64 *node = lttng::utils::container_of(head, &lttng_ht_node_u64::head);
        struct consumer_relayd_sock_pair *relayd =
                lttng::utils::container_of(node, &consumer_relayd_sock_pair::node);
 
@@ -414,8 +409,7 @@ void consumer_del_channel(struct lttng_consumer_channel *channel)
                LTTNG_ASSERT(!ret);
 
                iter.iter.node = &channel->channels_by_session_id_ht_node.node;
-               ret = lttng_ht_del(the_consumer_data.channels_by_session_id_ht,
-                               &iter);
+               ret = lttng_ht_del(the_consumer_data.channels_by_session_id_ht, &iter);
                LTTNG_ASSERT(!ret);
                rcu_read_unlock();
        }
@@ -438,8 +432,7 @@ static void cleanup_relayd_ht(void)
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(the_consumer_data.relayd_ht->ht, &iter.iter,
-                       relayd, node.node) {
+       cds_lfht_for_each_entry (the_consumer_data.relayd_ht->ht, &iter.iter, relayd, node.node) {
                consumer_destroy_relayd(relayd);
        }
 
@@ -456,7 +449,7 @@ static void cleanup_relayd_ht(void)
  * because we handle the write/read race with a pipe wakeup for each thread.
  */
 static void update_endpoint_status_by_netidx(uint64_t net_seq_idx,
-               enum consumer_endpoint_status status)
+                                            enum consumer_endpoint_status status)
 {
        struct lttng_ht_iter iter;
        struct lttng_consumer_stream *stream;
@@ -466,7 +459,7 @@ static void update_endpoint_status_by_netidx(uint64_t net_seq_idx,
        rcu_read_lock();
 
        /* Let's begin with metadata */
-       cds_lfht_for_each_entry(metadata_ht->ht, &iter.iter, stream, node.node) {
+       cds_lfht_for_each_entry (metadata_ht->ht, &iter.iter, stream, node.node) {
                if (stream->net_seq_idx == net_seq_idx) {
                        uatomic_set(&stream->endpoint_status, status);
                        DBG("Delete flag set to metadata stream %d", stream->wait_fd);
@@ -474,7 +467,7 @@ static void update_endpoint_status_by_netidx(uint64_t net_seq_idx,
        }
 
        /* Follow up by the data streams */
-       cds_lfht_for_each_entry(data_ht->ht, &iter.iter, stream, node.node) {
+       cds_lfht_for_each_entry (data_ht->ht, &iter.iter, stream, node.node) {
                if (stream->net_seq_idx == net_seq_idx) {
                        uatomic_set(&stream->endpoint_status, status);
                        DBG("Delete flag set to data stream %d", stream->wait_fd);
@@ -547,8 +540,7 @@ void consumer_flag_relayd_for_destroy(struct consumer_relayd_sock_pair *relayd)
  *
  * One this call returns, the stream object is not longer usable nor visible.
  */
-void consumer_del_stream(struct lttng_consumer_stream *stream,
-               struct lttng_ht *ht)
+void consumer_del_stream(struct lttng_consumer_stream *stream, struct lttng_ht *ht)
 {
        consumer_stream_destroy(stream, ht);
 }
@@ -566,12 +558,10 @@ void consumer_del_stream_for_metadata(struct lttng_consumer_stream *stream)
        consumer_stream_destroy(stream, metadata_ht);
 }
 
-void consumer_stream_update_channel_attributes(
-               struct lttng_consumer_stream *stream,
-               struct lttng_consumer_channel *channel)
+void consumer_stream_update_channel_attributes(struct lttng_consumer_stream *stream,
+                                              struct lttng_consumer_channel *channel)
 {
-       stream->channel_read_only_attributes.tracefile_size =
-                       channel->tracefile_size;
+       stream->channel_read_only_attributes.tracefile_size = channel->tracefile_size;
 }
 
 /*
@@ -597,16 +587,14 @@ void consumer_add_data_stream(struct lttng_consumer_stream *stream)
 
        lttng_ht_add_unique_u64(ht, &stream->node);
 
-       lttng_ht_add_u64(the_consumer_data.stream_per_chan_id_ht,
-                       &stream->node_channel_id);
+       lttng_ht_add_u64(the_consumer_data.stream_per_chan_id_ht, &stream->node_channel_id);
 
        /*
         * Add stream to the stream_list_ht of the consumer data. No need to steal
         * the key since the HT does not use it and we allow to add redundant keys
         * into this table.
         */
-       lttng_ht_add_u64(the_consumer_data.stream_list_ht,
-                       &stream->node_session_id);
+       lttng_ht_add_u64(the_consumer_data.stream_list_ht, &stream->node_session_id);
 
        /*
         * When nb_init_stream_left reaches 0, we don't need to trigger any action
@@ -645,8 +633,7 @@ static int add_relayd(struct consumer_relayd_sock_pair *relayd)
        LTTNG_ASSERT(relayd);
        ASSERT_RCU_READ_LOCKED();
 
-       lttng_ht_lookup(the_consumer_data.relayd_ht, &relayd->net_seq_idx,
-                       &iter);
+       lttng_ht_lookup(the_consumer_data.relayd_ht, &relayd->net_seq_idx, &iter);
        node = lttng_ht_iter_get_node_u64(&iter);
        if (node != NULL) {
                goto end;
@@ -660,8 +647,7 @@ end:
 /*
  * Allocate and return a consumer relayd socket.
  */
-static struct consumer_relayd_sock_pair *consumer_allocate_relayd_sock_pair(
-               uint64_t net_seq_idx)
+static struct consumer_relayd_sock_pair *consumer_allocate_relayd_sock_pair(uint64_t net_seq_idx)
 {
        struct consumer_relayd_sock_pair *obj = NULL;
 
@@ -723,8 +709,7 @@ error:
  *
  * Returns 0 on success, < 0 on error
  */
-int consumer_send_relayd_stream(struct lttng_consumer_stream *stream,
-               char *path)
+int consumer_send_relayd_stream(struct lttng_consumer_stream *stream, char *path)
 {
        int ret = 0;
        struct consumer_relayd_sock_pair *relayd;
@@ -739,14 +724,18 @@ int consumer_send_relayd_stream(struct lttng_consumer_stream *stream,
        if (relayd != NULL) {
                /* Add stream on the relayd */
                pthread_mutex_lock(&relayd->ctrl_sock_mutex);
-               ret = relayd_add_stream(&relayd->control_sock, stream->name,
-                               get_consumer_domain(), path, &stream->relayd_stream_id,
-                               stream->chan->tracefile_size,
-                               stream->chan->tracefile_count,
-                               stream->trace_chunk);
+               ret = relayd_add_stream(&relayd->control_sock,
+                                       stream->name,
+                                       get_consumer_domain(),
+                                       path,
+                                       &stream->relayd_stream_id,
+                                       stream->chan->tracefile_size,
+                                       stream->chan->tracefile_count,
+                                       stream->trace_chunk);
                pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
                if (ret < 0) {
-                       ERR("Relayd add stream failed. Cleaning up relayd %" PRIu64".", relayd->net_seq_idx);
+                       ERR("Relayd add stream failed. Cleaning up relayd %" PRIu64 ".",
+                           relayd->net_seq_idx);
                        lttng_consumer_cleanup_relayd(relayd);
                        goto end;
                }
@@ -755,13 +744,16 @@ int consumer_send_relayd_stream(struct lttng_consumer_stream *stream,
                stream->sent_to_relayd = 1;
        } else {
                ERR("Stream %" PRIu64 " relayd ID %" PRIu64 " unknown. Can't send it.",
-                               stream->key, stream->net_seq_idx);
+                   stream->key,
+                   stream->net_seq_idx);
                ret = -1;
                goto end;
        }
 
        DBG("Stream %s with key %" PRIu64 " sent to relayd id %" PRIu64,
-                       stream->name, stream->key, stream->net_seq_idx);
+           stream->name,
+           stream->key,
+           stream->net_seq_idx);
 
 end:
        rcu_read_unlock();
@@ -789,13 +781,13 @@ int consumer_send_relayd_streams_sent(uint64_t net_seq_idx)
                ret = relayd_streams_sent(&relayd->control_sock);
                pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
                if (ret < 0) {
-                       ERR("Relayd streams sent failed. Cleaning up relayd %" PRIu64".", relayd->net_seq_idx);
+                       ERR("Relayd streams sent failed. Cleaning up relayd %" PRIu64 ".",
+                           relayd->net_seq_idx);
                        lttng_consumer_cleanup_relayd(relayd);
                        goto end;
                }
        } else {
-               ERR("Relayd ID %" PRIu64 " unknown. Can't send streams_sent.",
-                               net_seq_idx);
+               ERR("Relayd ID %" PRIu64 " unknown. Can't send streams_sent.", net_seq_idx);
                ret = -1;
                goto end;
        }
@@ -831,8 +823,9 @@ void close_relayd_stream(struct lttng_consumer_stream *stream)
  * Return destination file descriptor or negative value on error.
  */
 static int write_relayd_stream_header(struct lttng_consumer_stream *stream,
-               size_t data_size, unsigned long padding,
-               struct consumer_relayd_sock_pair *relayd)
+                                     size_t data_size,
+                                     unsigned long padding,
+                                     struct consumer_relayd_sock_pair *relayd)
 {
        int outfd = -1, ret;
        struct lttcomm_relayd_data_hdr data_hdr;
@@ -869,8 +862,7 @@ static int write_relayd_stream_header(struct lttng_consumer_stream *stream,
                data_hdr.net_seq_num = htobe64(stream->next_net_seq_num);
                /* Other fields are zeroed previously */
 
-               ret = relayd_send_data_hdr(&relayd->data_sock, &data_hdr,
-                               sizeof(data_hdr));
+               ret = relayd_send_data_hdr(&relayd->data_sock, &data_hdr, sizeof(data_hdr));
                if (ret < 0) {
                        goto error;
                }
@@ -893,13 +885,11 @@ int consumer_metadata_wakeup_pipe(const struct lttng_consumer_channel *channel)
 {
        int ret = 0;
 
-       DBG("Waking up metadata poll thread (writing to pipe): channel name = '%s'",
-                       channel->name);
+       DBG("Waking up metadata poll thread (writing to pipe): channel name = '%s'", channel->name);
        if (channel->monitor && channel->metadata_stream) {
                const char dummy = 'c';
-               const ssize_t write_ret = lttng_write(
-                               channel->metadata_stream->ust_metadata_poll_pipe[1],
-                               &dummy, 1);
+               const ssize_t write_ret =
+                       lttng_write(channel->metadata_stream->ust_metadata_poll_pipe[1], &dummy, 1);
 
                if (write_ret < 1) {
                        if (errno == EWOULDBLOCK) {
@@ -929,8 +919,7 @@ end:
  *
  * The caller must hold the channel and stream locks.
  */
-static
-int consumer_metadata_stream_dump(struct lttng_consumer_stream *stream)
+static int consumer_metadata_stream_dump(struct lttng_consumer_stream *stream)
 {
        int ret;
 
@@ -966,10 +955,8 @@ int consumer_metadata_stream_dump(struct lttng_consumer_stream *stream)
        return ret;
 }
 
-static
-int lttng_consumer_channel_set_trace_chunk(
-               struct lttng_consumer_channel *channel,
-               struct lttng_trace_chunk *new_trace_chunk)
+static int lttng_consumer_channel_set_trace_chunk(struct lttng_consumer_channel *channel,
+                                                 struct lttng_trace_chunk *new_trace_chunk)
 {
        pthread_mutex_lock(&channel->lock);
        if (channel->is_deleted) {
@@ -989,8 +976,7 @@ int lttng_consumer_channel_set_trace_chunk(
         * chunk is already held by the caller.
         */
        if (new_trace_chunk) {
-               const bool acquired_reference = lttng_trace_chunk_get(
-                               new_trace_chunk);
+               const bool acquired_reference = lttng_trace_chunk_get(new_trace_chunk);
 
                LTTNG_ASSERT(acquired_reference);
        }
@@ -1009,28 +995,27 @@ end:
  * On error, return NULL.
  */
 struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
-               uint64_t session_id,
-               const uint64_t *chunk_id,
-               const char *pathname,
-               const char *name,
-               uint64_t relayd_id,
-               enum lttng_event_output output,
-               uint64_t tracefile_size,
-               uint64_t tracefile_count,
-               uint64_t session_id_per_pid,
-               unsigned int monitor,
-               unsigned int live_timer_interval,
-               bool is_in_live_session,
-               const char *root_shm_path,
-               const char *shm_path)
+                                                        uint64_t session_id,
+                                                        const uint64_t *chunk_id,
+                                                        const char *pathname,
+                                                        const char *name,
+                                                        uint64_t relayd_id,
+                                                        enum lttng_event_output output,
+                                                        uint64_t tracefile_size,
+                                                        uint64_t tracefile_count,
+                                                        uint64_t session_id_per_pid,
+                                                        unsigned int monitor,
+                                                        unsigned int live_timer_interval,
+                                                        bool is_in_live_session,
+                                                        const char *root_shm_path,
+                                                        const char *shm_path)
 {
        struct lttng_consumer_channel *channel = NULL;
        struct lttng_trace_chunk *trace_chunk = NULL;
 
        if (chunk_id) {
                trace_chunk = lttng_trace_chunk_registry_find_chunk(
-                               the_consumer_data.chunk_registry, session_id,
-                               *chunk_id);
+                       the_consumer_data.chunk_registry, session_id, *chunk_id);
                if (!trace_chunk) {
                        ERR("Failed to find trace chunk reference during creation of channel");
                        goto end;
@@ -1099,15 +1084,13 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
        }
 
        lttng_ht_node_init_u64(&channel->node, channel->key);
-       lttng_ht_node_init_u64(&channel->channels_by_session_id_ht_node,
-                       channel->session_id);
+       lttng_ht_node_init_u64(&channel->channels_by_session_id_ht_node, channel->session_id);
 
        channel->wait_fd = -1;
        CDS_INIT_LIST_HEAD(&channel->streams.head);
 
        if (trace_chunk) {
-               int ret = lttng_consumer_channel_set_trace_chunk(channel,
-                               trace_chunk);
+               int ret = lttng_consumer_channel_set_trace_chunk(channel, trace_chunk);
                if (ret) {
                        goto error;
                }
@@ -1130,7 +1113,7 @@ error:
  * Always return 0 indicating success.
  */
 int consumer_add_channel(struct lttng_consumer_channel *channel,
-               struct lttng_consumer_local_data *ctx)
+                        struct lttng_consumer_local_data *ctx)
 {
        pthread_mutex_lock(&the_consumer_data.lock);
        pthread_mutex_lock(&channel->lock);
@@ -1146,7 +1129,7 @@ int consumer_add_channel(struct lttng_consumer_channel *channel,
        rcu_read_lock();
        lttng_ht_add_unique_u64(the_consumer_data.channel_ht, &channel->node);
        lttng_ht_add_u64(the_consumer_data.channels_by_session_id_ht,
-                       &channel->channels_by_session_id_ht_node);
+                        &channel->channels_by_session_id_ht_node);
        rcu_read_unlock();
        channel->is_published = true;
 
@@ -1169,8 +1152,10 @@ int consumer_add_channel(struct lttng_consumer_channel *channel,
  * Returns the number of fds in the structures.
  */
 static int update_poll_array(struct lttng_consumer_local_data *ctx,
-               struct pollfd **pollfd, struct lttng_consumer_stream **local_stream,
-               struct lttng_ht *ht, int *nb_inactive_fd)
+                            struct pollfd **pollfd,
+                            struct lttng_consumer_stream **local_stream,
+                            struct lttng_ht *ht,
+                            int *nb_inactive_fd)
 {
        int i = 0;
        struct lttng_ht_iter iter;
@@ -1184,7 +1169,7 @@ static int update_poll_array(struct lttng_consumer_local_data *ctx,
        DBG("Updating poll fd array");
        *nb_inactive_fd = 0;
        rcu_read_lock();
-       cds_lfht_for_each_entry(ht->ht, &iter.iter, stream, node.node) {
+       cds_lfht_for_each_entry (ht->ht, &iter.iter, stream, node.node) {
                /*
                 * Only active streams with an active end point can be added to the
                 * poll set and local stream storage of the thread.
@@ -1255,8 +1240,7 @@ restart:
 /*
  * Set the error socket.
  */
-void lttng_consumer_set_error_sock(struct lttng_consumer_local_data *ctx,
-               int sock)
+void lttng_consumer_set_error_sock(struct lttng_consumer_local_data *ctx, int sock)
 {
        ctx->consumer_error_socket = sock;
 }
@@ -1264,8 +1248,7 @@ void lttng_consumer_set_error_sock(struct lttng_consumer_local_data *ctx,
 /*
  * Set the command socket path.
  */
-void lttng_consumer_set_command_sock_path(
-               struct lttng_consumer_local_data *ctx, char *sock)
+void lttng_consumer_set_command_sock_path(struct lttng_consumer_local_data *ctx, char *sock)
 {
        ctx->consumer_command_sock_path = sock;
 }
@@ -1277,8 +1260,8 @@ void lttng_consumer_set_command_sock_path(
 int lttng_consumer_send_error(struct lttng_consumer_local_data *ctx, int cmd)
 {
        if (ctx->consumer_error_socket > 0) {
-               return lttcomm_send_unix_sock(ctx->consumer_error_socket, &cmd,
-                               sizeof(enum lttcomm_sessiond_command));
+               return lttcomm_send_unix_sock(
+                       ctx->consumer_error_socket, &cmd, sizeof(enum lttcomm_sessiond_command));
        }
 
        return 0;
@@ -1296,8 +1279,7 @@ void lttng_consumer_cleanup(void)
 
        rcu_read_lock();
 
-       cds_lfht_for_each_entry(the_consumer_data.channel_ht->ht, &iter.iter,
-                       channel, node.node) {
+       cds_lfht_for_each_entry (the_consumer_data.channel_ht->ht, &iter.iter, channel, node.node) {
                consumer_del_channel(channel);
        }
 
@@ -1329,12 +1311,12 @@ void lttng_consumer_cleanup(void)
         * session daemon and not emptying the registry would cause an assertion
         * to hit.
         */
-       trace_chunks_left = lttng_trace_chunk_registry_put_each_chunk(
-                       the_consumer_data.chunk_registry);
+       trace_chunks_left =
+               lttng_trace_chunk_registry_put_each_chunk(the_consumer_data.chunk_registry);
        if (trace_chunks_left) {
                ERR("%u trace chunks are leaked by lttng-consumerd. "
-                               "This can be caused by an internal error of the session daemon.",
-                               trace_chunks_left);
+                   "This can be caused by an internal error of the session daemon.",
+                   trace_chunks_left);
        }
        /* Run all callbacks freeing each chunk. */
        rcu_barrier();
@@ -1357,13 +1339,10 @@ void lttng_consumer_should_exit(struct lttng_consumer_local_data *ctx)
        DBG("Consumer flag that it should quit");
 }
 
-
 /*
  * Flush pending writes to trace output disk file.
  */
-static
-void lttng_consumer_sync_trace_file(struct lttng_consumer_stream *stream,
-               off_t orig_offset)
+static void lttng_consumer_sync_trace_file(struct lttng_consumer_stream *stream, off_t orig_offset)
 {
        int ret;
        int outfd = stream->out_fd;
@@ -1377,11 +1356,11 @@ void lttng_consumer_sync_trace_file(struct lttng_consumer_stream *stream,
        if (orig_offset < stream->max_sb_size) {
                return;
        }
-       lttng_sync_file_range(outfd, orig_offset - stream->max_sb_size,
-                       stream->max_sb_size,
-                       SYNC_FILE_RANGE_WAIT_BEFORE
-                       | SYNC_FILE_RANGE_WRITE
-                       | SYNC_FILE_RANGE_WAIT_AFTER);
+       lttng_sync_file_range(outfd,
+                             orig_offset - stream->max_sb_size,
+                             stream->max_sb_size,
+                             SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
+                                     SYNC_FILE_RANGE_WAIT_AFTER);
        /*
         * Give hints to the kernel about how we access the file:
         * POSIX_FADV_DONTNEED : we won't re-access data in a near future after
@@ -1396,8 +1375,8 @@ void lttng_consumer_sync_trace_file(struct lttng_consumer_stream *stream,
         * defined. So it can be expected to lead to lower throughput in
         * streaming.
         */
-       ret = posix_fadvise(outfd, orig_offset - stream->max_sb_size,
-                       stream->max_sb_size, POSIX_FADV_DONTNEED);
+       ret = posix_fadvise(
+               outfd, orig_offset - stream->max_sb_size, stream->max_sb_size, POSIX_FADV_DONTNEED);
        if (ret && ret != -ENOSYS) {
                errno = ret;
                PERROR("posix_fadvise on fd %i", outfd);
@@ -1418,19 +1397,20 @@ void lttng_consumer_sync_trace_file(struct lttng_consumer_stream *stream,
  *
  * Returns a pointer to the new context or NULL on error.
  */
-struct lttng_consumer_local_data *lttng_consumer_create(
-               enum lttng_consumer_type type,
-               ssize_t (*buffer_ready)(struct lttng_consumer_stream *stream,
-                       struct lttng_consumer_local_data *ctx, bool locked_by_caller),
-               int (*recv_channel)(struct lttng_consumer_channel *channel),
-               int (*recv_stream)(struct lttng_consumer_stream *stream),
-               int (*update_stream)(uint64_t stream_key, uint32_t state))
+struct lttng_consumer_local_data *
+lttng_consumer_create(enum lttng_consumer_type type,
+                     ssize_t (*buffer_ready)(struct lttng_consumer_stream *stream,
+                                             struct lttng_consumer_local_data *ctx,
+                                             bool locked_by_caller),
+                     int (*recv_channel)(struct lttng_consumer_channel *channel),
+                     int (*recv_stream)(struct lttng_consumer_stream *stream),
+                     int (*update_stream)(uint64_t stream_key, uint32_t state))
 {
        int ret;
        struct lttng_consumer_local_data *ctx;
 
        LTTNG_ASSERT(the_consumer_data.type == LTTNG_CONSUMER_UNKNOWN ||
-                       the_consumer_data.type == type);
+                    the_consumer_data.type == type);
        the_consumer_data.type = type;
 
        ctx = zmalloc<lttng_consumer_local_data>();
@@ -1506,7 +1486,7 @@ static void destroy_data_stream_ht(struct lttng_ht *ht)
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(ht->ht, &iter.iter, stream, node.node) {
+       cds_lfht_for_each_entry (ht->ht, &iter.iter, stream, node.node) {
                /*
                 * Ignore return value since we are currently cleaning up so any error
                 * can't be handled.
@@ -1532,7 +1512,7 @@ static void destroy_metadata_stream_ht(struct lttng_ht *ht)
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(ht->ht, &iter.iter, stream, node.node) {
+       cds_lfht_for_each_entry (ht->ht, &iter.iter, stream, node.node) {
                /*
                 * Ignore return value since we are currently cleaning up so any error
                 * can't be handled.
@@ -1581,9 +1561,8 @@ void lttng_consumer_destroy(struct lttng_consumer_local_data *ctx)
 /*
  * Write the metadata stream id on the specified file descriptor.
  */
-static int write_relayd_metadata_id(int fd,
-               struct lttng_consumer_stream *stream,
-               unsigned long padding)
+static int
+write_relayd_metadata_id(int fd, struct lttng_consumer_stream *stream, unsigned long padding)
 {
        ssize_t ret;
        struct lttcomm_relayd_metadata_payload hdr;
@@ -1610,7 +1589,8 @@ static int write_relayd_metadata_id(int fd,
                goto end;
        }
        DBG("Metadata stream id %" PRIu64 " with padding %lu written before data",
-                       stream->relayd_stream_id, padding);
+           stream->relayd_stream_id,
+           padding);
 
 end:
        return (int) ret;
@@ -1627,10 +1607,9 @@ end:
  *
  * Returns the number of bytes written
  */
-ssize_t lttng_consumer_on_read_subbuffer_mmap(
-               struct lttng_consumer_stream *stream,
-               const struct lttng_buffer_view *buffer,
-               unsigned long padding)
+ssize_t lttng_consumer_on_read_subbuffer_mmap(struct lttng_consumer_stream *stream,
+                                             const struct lttng_buffer_view *buffer,
+                                             unsigned long padding)
 {
        ssize_t ret = 0;
        off_t orig_offset = stream->out_fd_offset;
@@ -1643,8 +1622,7 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap(
 
        /* RCU lock for the relayd pointer */
        rcu_read_lock();
-       LTTNG_ASSERT(stream->net_seq_idx != (uint64_t) -1ULL ||
-                       stream->trace_chunk);
+       LTTNG_ASSERT(stream->net_seq_idx != (uint64_t) -1ULL || stream->trace_chunk);
 
        /* Flag that the current stream if set for network streaming. */
        if (stream->net_seq_idx != (uint64_t) -1ULL) {
@@ -1668,8 +1646,8 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap(
                        pthread_mutex_lock(&relayd->ctrl_sock_mutex);
                        if (stream->reset_metadata_flag) {
                                ret = relayd_reset_metadata(&relayd->control_sock,
-                                               stream->relayd_stream_id,
-                                               stream->metadata_version);
+                                                           stream->relayd_stream_id,
+                                                           stream->metadata_version);
                                if (ret < 0) {
                                        relayd_hang_up = 1;
                                        goto write_error;
@@ -1712,8 +1690,8 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap(
                 * Check if we need to change the tracefile before writing the packet.
                 */
                if (stream->chan->tracefile_size > 0 &&
-                               (stream->tracefile_size_current + buffer->size) >
-                               stream->chan->tracefile_size) {
+                   (stream->tracefile_size_current + buffer->size) >
+                           stream->chan->tracefile_size) {
                        ret = consumer_stream_rotate_output_files(stream);
                        if (ret) {
                                goto end;
@@ -1752,8 +1730,7 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap(
                        DBG("Consumer mmap write detected relayd hang up");
                } else {
                        /* Unhandled error, print it and stop function right now. */
-                       PERROR("Error in write mmap (ret %zd != write_len %zu)", ret,
-                                       write_len);
+                       PERROR("Error in write mmap (ret %zd != write_len %zu)", ret, write_len);
                }
                goto write_error;
        }
@@ -1762,8 +1739,8 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap(
        /* This call is useless on a socket so better save a syscall. */
        if (!relayd) {
                /* This won't block, but will start writeout asynchronously */
-               lttng_sync_file_range(outfd, stream->out_fd_offset, write_len,
-                               SYNC_FILE_RANGE_WRITE);
+               lttng_sync_file_range(
+                       outfd, stream->out_fd_offset, write_len, SYNC_FILE_RANGE_WRITE);
                stream->out_fd_offset += write_len;
                lttng_consumer_sync_trace_file(stream, orig_offset);
        }
@@ -1774,7 +1751,7 @@ write_error:
         * cleanup the relayd object and all associated streams.
         */
        if (relayd && relayd_hang_up) {
-               ERR("Relayd hangup. Cleaning up relayd %" PRIu64".", relayd->net_seq_idx);
+               ERR("Relayd hangup. Cleaning up relayd %" PRIu64 ".", relayd->net_seq_idx);
                lttng_consumer_cleanup_relayd(relayd);
        }
 
@@ -1795,10 +1772,10 @@ end:
  *
  * Returns the number of bytes spliced.
  */
-ssize_t lttng_consumer_on_read_subbuffer_splice(
-               struct lttng_consumer_local_data *ctx,
-               struct lttng_consumer_stream *stream, unsigned long len,
-               unsigned long padding)
+ssize_t lttng_consumer_on_read_subbuffer_splice(struct lttng_consumer_local_data *ctx,
+                                               struct lttng_consumer_stream *stream,
+                                               unsigned long len,
+                                               unsigned long padding)
 {
        ssize_t ret = 0, written = 0, ret_splice = 0;
        loff_t offset = 0;
@@ -1848,16 +1825,15 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(
 
                        if (stream->reset_metadata_flag) {
                                ret = relayd_reset_metadata(&relayd->control_sock,
-                                               stream->relayd_stream_id,
-                                               stream->metadata_version);
+                                                           stream->relayd_stream_id,
+                                                           stream->metadata_version);
                                if (ret < 0) {
                                        relayd_hang_up = 1;
                                        goto write_error;
                                }
                                stream->reset_metadata_flag = 0;
                        }
-                       ret = write_relayd_metadata_id(splice_pipe[1], stream,
-                                       padding);
+                       ret = write_relayd_metadata_id(splice_pipe[1], stream, padding);
                        if (ret < 0) {
                                written = ret;
                                relayd_hang_up = 1;
@@ -1891,8 +1867,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(
                 * Check if we need to change the tracefile before writing the packet.
                 */
                if (stream->chan->tracefile_size > 0 &&
-                               (stream->tracefile_size_current + len) >
-                               stream->chan->tracefile_size) {
+                   (stream->tracefile_size_current + len) > stream->chan->tracefile_size) {
                        ret = consumer_stream_rotate_output_files(stream);
                        if (ret < 0) {
                                written = ret;
@@ -1906,9 +1881,12 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(
 
        while (len > 0) {
                DBG("splice chan to pipe offset %lu of len %lu (fd : %d, pipe: %d)",
-                               (unsigned long)offset, len, fd, splice_pipe[1]);
-               ret_splice = splice(fd, &offset, splice_pipe[1], NULL, len,
-                               SPLICE_F_MOVE | SPLICE_F_MORE);
+                   (unsigned long) offset,
+                   len,
+                   fd,
+                   splice_pipe[1]);
+               ret_splice = splice(
+                       fd, &offset, splice_pipe[1], NULL, len, SPLICE_F_MOVE | SPLICE_F_MORE);
                DBG("splice chan to pipe, ret %zd", ret_splice);
                if (ret_splice < 0) {
                        ret = errno;
@@ -1933,10 +1911,13 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(
                }
 
                /* Splice data out */
-               ret_splice = splice(splice_pipe[0], NULL, outfd, NULL,
-                               ret_splice, SPLICE_F_MOVE | SPLICE_F_MORE);
-               DBG("Consumer splice pipe to file (out_fd: %d), ret %zd",
-                               outfd, ret_splice);
+               ret_splice = splice(splice_pipe[0],
+                                   NULL,
+                                   outfd,
+                                   NULL,
+                                   ret_splice,
+                                   SPLICE_F_MOVE | SPLICE_F_MORE);
+               DBG("Consumer splice pipe to file (out_fd: %d), ret %zd", outfd, ret_splice);
                if (ret_splice < 0) {
                        ret = errno;
                        written = -ret;
@@ -1949,8 +1930,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(
                         */
                        ret = errno;
                        written += ret_splice;
-                       PERROR("Wrote more data than requested %zd (len: %lu)", ret_splice,
-                                       len);
+                       PERROR("Wrote more data than requested %zd (len: %lu)", ret_splice, len);
                        goto splice_error;
                } else {
                        /* All good, update current len and continue. */
@@ -1960,8 +1940,8 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(
                /* This call is useless on a socket so better save a syscall. */
                if (!relayd) {
                        /* This won't block, but will start writeout asynchronously */
-                       lttng_sync_file_range(outfd, stream->out_fd_offset, ret_splice,
-                                       SYNC_FILE_RANGE_WRITE);
+                       lttng_sync_file_range(
+                               outfd, stream->out_fd_offset, ret_splice, SYNC_FILE_RANGE_WRITE);
                        stream->out_fd_offset += ret_splice;
                }
                stream->output_written += ret_splice;
@@ -1978,7 +1958,7 @@ write_error:
         * cleanup the relayd object and all associated streams.
         */
        if (relayd && relayd_hang_up) {
-               ERR("Relayd hangup. Cleaning up relayd %" PRIu64".", relayd->net_seq_idx);
+               ERR("Relayd hangup. Cleaning up relayd %" PRIu64 ".", relayd->net_seq_idx);
                lttng_consumer_cleanup_relayd(relayd);
                /* Skip splice error so the consumer does not fail */
                goto end;
@@ -2051,8 +2031,7 @@ int lttng_consumer_take_snapshot(struct lttng_consumer_stream *stream)
  *
  * Returns 0 on success, < 0 on error
  */
-int lttng_consumer_get_produced_snapshot(struct lttng_consumer_stream *stream,
-               unsigned long *pos)
+int lttng_consumer_get_produced_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos)
 {
        switch (the_consumer_data.type) {
        case LTTNG_CONSUMER_KERNEL:
@@ -2072,8 +2051,7 @@ int lttng_consumer_get_produced_snapshot(struct lttng_consumer_stream *stream,
  *
  * Returns 0 on success, < 0 on error
  */
-int lttng_consumer_get_consumed_snapshot(struct lttng_consumer_stream *stream,
-               unsigned long *pos)
+int lttng_consumer_get_consumed_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos)
 {
        switch (the_consumer_data.type) {
        case LTTNG_CONSUMER_KERNEL:
@@ -2089,7 +2067,8 @@ int lttng_consumer_get_consumed_snapshot(struct lttng_consumer_stream *stream,
 }
 
 int lttng_consumer_recv_cmd(struct lttng_consumer_local_data *ctx,
-               int sock, struct pollfd *consumer_sockpoll)
+                           int sock,
+                           struct pollfd *consumer_sockpoll)
 {
        switch (the_consumer_data.type) {
        case LTTNG_CONSUMER_KERNEL:
@@ -2104,8 +2083,7 @@ int lttng_consumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        }
 }
 
-static
-void lttng_consumer_close_all_metadata(void)
+static void lttng_consumer_close_all_metadata(void)
 {
        switch (the_consumer_data.type) {
        case LTTNG_CONSUMER_KERNEL:
@@ -2134,8 +2112,7 @@ void lttng_consumer_close_all_metadata(void)
 /*
  * Clean up a metadata stream and free its memory.
  */
-void consumer_del_metadata_stream(struct lttng_consumer_stream *stream,
-               struct lttng_ht *ht)
+void consumer_del_metadata_stream(struct lttng_consumer_stream *stream, struct lttng_ht *ht)
 {
        struct lttng_consumer_channel *channel = NULL;
        bool free_channel = false;
@@ -2172,8 +2149,8 @@ void consumer_del_metadata_stream(struct lttng_consumer_stream *stream,
        consumer_stream_destroy_buffers(stream);
 
        /* Atomically decrement channel refcount since other threads can use it. */
-       if (!uatomic_sub_return(&channel->refcount, 1)
-                       && !uatomic_read(&channel->nb_init_stream_left)) {
+       if (!uatomic_sub_return(&channel->refcount, 1) &&
+           !uatomic_read(&channel->nb_init_stream_left)) {
                /* Go for channel deletion! */
                free_channel = true;
        }
@@ -2252,16 +2229,14 @@ void consumer_add_metadata_stream(struct lttng_consumer_stream *stream)
 
        lttng_ht_add_unique_u64(ht, &stream->node);
 
-       lttng_ht_add_u64(the_consumer_data.stream_per_chan_id_ht,
-                       &stream->node_channel_id);
+       lttng_ht_add_u64(the_consumer_data.stream_per_chan_id_ht, &stream->node_channel_id);
 
        /*
         * Add stream to the stream_list_ht of the consumer data. No need to steal
         * the key since the HT does not use it and we allow to add redundant keys
         * into this table.
         */
-       lttng_ht_add_u64(the_consumer_data.stream_list_ht,
-                       &stream->node_session_id);
+       lttng_ht_add_u64(the_consumer_data.stream_list_ht, &stream->node_session_id);
 
        rcu_read_unlock();
 
@@ -2282,7 +2257,7 @@ static void validate_endpoint_status_data_stream(void)
        DBG("Consumer delete flagged data stream");
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(data_ht->ht, &iter.iter, stream, node.node) {
+       cds_lfht_for_each_entry (data_ht->ht, &iter.iter, stream, node.node) {
                /* Validate delete flag of the stream */
                if (stream->endpoint_status == CONSUMER_ENDPOINT_ACTIVE) {
                        continue;
@@ -2296,8 +2271,7 @@ static void validate_endpoint_status_data_stream(void)
 /*
  * Delete metadata stream that are flagged for deletion (endpoint_status).
  */
-static void validate_endpoint_status_metadata_stream(
-               struct lttng_poll_event *pollset)
+static void validate_endpoint_status_metadata_stream(struct lttng_poll_event *pollset)
 {
        struct lttng_ht_iter iter;
        struct lttng_consumer_stream *stream;
@@ -2307,7 +2281,7 @@ static void validate_endpoint_status_metadata_stream(
        LTTNG_ASSERT(pollset);
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(metadata_ht->ht, &iter.iter, stream, node.node) {
+       cds_lfht_for_each_entry (metadata_ht->ht, &iter.iter, stream, node.node) {
                /* Validate delete flag of the stream */
                if (stream->endpoint_status == CONSUMER_ENDPOINT_ACTIVE) {
                        continue;
@@ -2358,8 +2332,7 @@ void *consumer_thread_metadata_poll(void *data)
                goto end_poll;
        }
 
-       ret = lttng_poll_add(&events,
-                       lttng_pipe_get_readfd(ctx->consumer_metadata_pipe), LPOLLIN);
+       ret = lttng_poll_add(&events, lttng_pipe_get_readfd(ctx->consumer_metadata_pipe), LPOLLIN);
        if (ret < 0) {
                goto end;
        }
@@ -2368,13 +2341,12 @@ void *consumer_thread_metadata_poll(void *data)
        DBG("Metadata main loop started");
 
        while (1) {
-restart:
+       restart:
                health_code_update();
                health_poll_entry();
                DBG("Metadata poll wait");
                ret = lttng_poll_wait(&events, -1);
-               DBG("Metadata poll return from wait with %d fd(s)",
-                               LTTNG_POLL_GETNB(&events));
+               DBG("Metadata poll return from wait with %d fd(s)", LTTNG_POLL_GETNB(&events));
                health_poll_exit();
                DBG("Metadata event caught in thread");
                if (ret < 0) {
@@ -2383,7 +2355,7 @@ restart:
                                goto restart;
                        }
                        if (LTTNG_POLL_GETNB(&events) == 0) {
-                               err = 0;        /* All is OK */
+                               err = 0; /* All is OK */
                        }
                        goto end;
                }
@@ -2402,17 +2374,20 @@ restart:
                                        ssize_t pipe_len;
 
                                        pipe_len = lttng_pipe_read(ctx->consumer_metadata_pipe,
-                                                       &stream, sizeof(stream));
+                                                                  &stream,
+                                                                  sizeof(stream));
                                        if (pipe_len < sizeof(stream)) {
                                                if (pipe_len < 0) {
                                                        PERROR("read metadata stream");
                                                }
                                                /*
-                                                * Remove the pipe from the poll set and continue the loop
-                                                * since their might be data to consume.
+                                                * Remove the pipe from the poll set and continue
+                                                * the loop since their might be data to consume.
                                                 */
-                                               lttng_poll_del(&events,
-                                                               lttng_pipe_get_readfd(ctx->consumer_metadata_pipe));
+                                               lttng_poll_del(
+                                                       &events,
+                                                       lttng_pipe_get_readfd(
+                                                               ctx->consumer_metadata_pipe));
                                                lttng_pipe_read_close(ctx->consumer_metadata_pipe);
                                                continue;
                                        }
@@ -2425,22 +2400,26 @@ restart:
                                        }
 
                                        DBG("Adding metadata stream %d to poll set",
-                                                       stream->wait_fd);
+                                           stream->wait_fd);
 
                                        /* Add metadata stream to the global poll events list */
-                                       lttng_poll_add(&events, stream->wait_fd, LPOLLIN | LPOLLPRI);
-                               }else if (revents & (LPOLLERR | LPOLLHUP)) {
+                                       lttng_poll_add(
+                                               &events, stream->wait_fd, LPOLLIN | LPOLLPRI);
+                               } else if (revents & (LPOLLERR | LPOLLHUP)) {
                                        DBG("Metadata thread pipe hung up");
                                        /*
                                         * Remove the pipe from the poll set and continue the loop
                                         * since their might be data to consume.
                                         */
-                                       lttng_poll_del(&events,
-                                                       lttng_pipe_get_readfd(ctx->consumer_metadata_pipe));
+                                       lttng_poll_del(
+                                               &events,
+                                               lttng_pipe_get_readfd(ctx->consumer_metadata_pipe));
                                        lttng_pipe_read_close(ctx->consumer_metadata_pipe);
                                        continue;
                                } else {
-                                       ERR("Unexpected poll events %u for sock %d", revents, pollfd);
+                                       ERR("Unexpected poll events %u for sock %d",
+                                           revents,
+                                           pollfd);
                                        goto end;
                                }
 
@@ -2457,8 +2436,7 @@ restart:
                        node = lttng_ht_iter_get_node_u64(&iter);
                        LTTNG_ASSERT(node);
 
-                       stream = caa_container_of(node, struct lttng_consumer_stream,
-                                       node);
+                       stream = caa_container_of(node, struct lttng_consumer_stream, node);
 
                        if (revents & (LPOLLIN | LPOLLPRI)) {
                                /* Get the data out of the metadata file descriptor */
@@ -2486,9 +2464,8 @@ restart:
                        } else if (revents & (LPOLLERR | LPOLLHUP)) {
                                DBG("Metadata fd %d is hup|err.", pollfd);
                                if (!stream->hangup_flush_done &&
-                                               (the_consumer_data.type == LTTNG_CONSUMER32_UST ||
-                                                               the_consumer_data.type ==
-                                                                               LTTNG_CONSUMER64_UST)) {
+                                   (the_consumer_data.type == LTTNG_CONSUMER32_UST ||
+                                    the_consumer_data.type == LTTNG_CONSUMER64_UST)) {
                                        DBG("Attempting to flush and consume the UST buffers");
                                        lttng_ustconsumer_on_stream_hangup(stream);
 
@@ -2498,10 +2475,10 @@ restart:
 
                                                len = ctx->on_buffer_ready(stream, ctx, false);
                                                /*
-                                                * We don't check the return value here since if we get
-                                                * a negative len, it means an error occurred thus we
-                                                * simply remove it from the poll set and free the
-                                                * stream.
+                                                * We don't check the return value here since if we
+                                                * get a negative len, it means an error occurred
+                                                * thus we simply remove it from the poll set and
+                                                * free the stream.
                                                 */
                                        } while (len > 0);
                                }
@@ -2593,21 +2570,23 @@ void *consumer_thread_data_poll(void *data)
                        local_stream = NULL;
 
                        /* Allocate for all fds */
-                       pollfd = calloc<struct pollfd>(the_consumer_data.stream_count + nb_pipes_fd);
+                       pollfd =
+                               calloc<struct pollfd>(the_consumer_data.stream_count + nb_pipes_fd);
                        if (pollfd == NULL) {
                                PERROR("pollfd malloc");
                                pthread_mutex_unlock(&the_consumer_data.lock);
                                goto end;
                        }
 
-                       local_stream = calloc<lttng_consumer_stream *>(the_consumer_data.stream_count + nb_pipes_fd);
+                       local_stream = calloc<lttng_consumer_stream *>(
+                               the_consumer_data.stream_count + nb_pipes_fd);
                        if (local_stream == NULL) {
                                PERROR("local_stream malloc");
                                pthread_mutex_unlock(&the_consumer_data.lock);
                                goto end;
                        }
-                       ret = update_poll_array(ctx, &pollfd, local_stream,
-                                       data_ht, &nb_inactive_fd);
+                       ret = update_poll_array(
+                               ctx, &pollfd, local_stream, data_ht, &nb_inactive_fd);
                        if (ret < 0) {
                                ERR("Error in allocating pollfd or local_outfds");
                                lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_POLL_ERROR);
@@ -2620,9 +2599,8 @@ void *consumer_thread_data_poll(void *data)
                pthread_mutex_unlock(&the_consumer_data.lock);
 
                /* No FDs and consumer_quit, consumer_cleanup the thread */
-               if (nb_fd == 0 && nb_inactive_fd == 0 &&
-                               CMM_LOAD_SHARED(consumer_quit) == 1) {
-                       err = 0;        /* All is OK */
+               if (nb_fd == 0 && nb_inactive_fd == 0 && CMM_LOAD_SHARED(consumer_quit) == 1) {
+                       err = 0; /* All is OK */
                        goto end;
                }
                /* poll on the array of fds */
@@ -2665,8 +2643,8 @@ void *consumer_thread_data_poll(void *data)
                        ssize_t pipe_readlen;
 
                        DBG("consumer_data_pipe wake up");
-                       pipe_readlen = lttng_pipe_read(ctx->consumer_data_pipe,
-                                       &new_stream, sizeof(new_stream));
+                       pipe_readlen = lttng_pipe_read(
+                               ctx->consumer_data_pipe, &new_stream, sizeof(new_stream));
                        if (pipe_readlen < sizeof(new_stream)) {
                                PERROR("Consumer data pipe");
                                /* Continue so we can at least handle the current stream(s). */
@@ -2692,8 +2670,8 @@ void *consumer_thread_data_poll(void *data)
                        char dummy;
                        ssize_t pipe_readlen;
 
-                       pipe_readlen = lttng_pipe_read(ctx->consumer_wakeup_pipe, &dummy,
-                                       sizeof(dummy));
+                       pipe_readlen =
+                               lttng_pipe_read(ctx->consumer_wakeup_pipe, &dummy, sizeof(dummy));
                        if (pipe_readlen < 0) {
                                PERROR("Consumer data wakeup pipe");
                        }
@@ -2718,7 +2696,8 @@ void *consumer_thread_data_poll(void *data)
                                        consumer_del_stream(local_stream[i], data_ht);
                                        local_stream[i] = NULL;
                                } else if (len > 0) {
-                                       local_stream[i]->has_data_left_to_be_read_before_teardown = 1;
+                                       local_stream[i]->has_data_left_to_be_read_before_teardown =
+                                               1;
                                }
                        }
                }
@@ -2738,9 +2717,8 @@ void *consumer_thread_data_poll(void *data)
                        if (local_stream[i] == NULL) {
                                continue;
                        }
-                       if ((pollfd[i].revents & POLLIN) ||
-                                       local_stream[i]->hangup_flush_done ||
-                                       local_stream[i]->has_data) {
+                       if ((pollfd[i].revents & POLLIN) || local_stream[i]->hangup_flush_done ||
+                           local_stream[i]->has_data) {
                                DBG("Normal read on fd %d", pollfd[i].fd);
                                len = ctx->on_buffer_ready(local_stream[i], ctx, false);
                                /* it's ok to have an unavailable sub-buffer */
@@ -2749,7 +2727,8 @@ void *consumer_thread_data_poll(void *data)
                                        consumer_del_stream(local_stream[i], data_ht);
                                        local_stream[i] = NULL;
                                } else if (len > 0) {
-                                       local_stream[i]->has_data_left_to_be_read_before_teardown = 1;
+                                       local_stream[i]->has_data_left_to_be_read_before_teardown =
+                                               1;
                                }
                        }
                }
@@ -2761,12 +2740,12 @@ void *consumer_thread_data_poll(void *data)
                        if (local_stream[i] == NULL) {
                                continue;
                        }
-                       if (!local_stream[i]->hangup_flush_done
-                                       && (pollfd[i].revents & (POLLHUP | POLLERR | POLLNVAL))
-                                       && (the_consumer_data.type == LTTNG_CONSUMER32_UST
-                                               || the_consumer_data.type == LTTNG_CONSUMER64_UST)) {
+                       if (!local_stream[i]->hangup_flush_done &&
+                           (pollfd[i].revents & (POLLHUP | POLLERR | POLLNVAL)) &&
+                           (the_consumer_data.type == LTTNG_CONSUMER32_UST ||
+                            the_consumer_data.type == LTTNG_CONSUMER64_UST)) {
                                DBG("fd %d is hup|err|nval. Attempting flush and read.",
-                                               pollfd[i].fd);
+                                   pollfd[i].fd);
                                lttng_ustconsumer_on_stream_hangup(local_stream[i]);
                                /* Attempt read again, for the data we just flushed. */
                                local_stream[i]->has_data_left_to_be_read_before_teardown = 1;
@@ -2844,8 +2823,7 @@ error_testpoint:
  * allow the poll() on the stream read-side to detect when the
  * write-side (application) finally closes them.
  */
-static
-void consumer_close_channel_streams(struct lttng_consumer_channel *channel)
+static void consumer_close_channel_streams(struct lttng_consumer_channel *channel)
 {
        struct lttng_ht *ht;
        struct lttng_consumer_stream *stream;
@@ -2855,9 +2833,13 @@ void consumer_close_channel_streams(struct lttng_consumer_channel *channel)
 
        rcu_read_lock();
        cds_lfht_for_each_entry_duplicate(ht->ht,
-                       ht->hash_fct(&channel->key, lttng_ht_seed),
-                       ht->match_fct, &channel->key,
-                       &iter.iter, stream, node_channel_id.node) {
+                                         ht->hash_fct(&channel->key, lttng_ht_seed),
+                                         ht->match_fct,
+                                         &channel->key,
+                                         &iter.iter,
+                                         stream,
+                                         node_channel_id.node)
+       {
                /*
                 * Protect against teardown with mutex.
                 */
@@ -2903,7 +2885,7 @@ static void destroy_channel_ht(struct lttng_ht *ht)
        }
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(ht->ht, &iter.iter, channel, wait_fd_node.node) {
+       cds_lfht_for_each_entry (ht->ht, &iter.iter, channel, wait_fd_node.node) {
                ret = lttng_ht_del(ht, &iter);
                LTTNG_ASSERT(ret != 0);
        }
@@ -2964,13 +2946,12 @@ void *consumer_thread_channel_poll(void *data)
        DBG("Channel main loop started");
 
        while (1) {
-restart:
+       restart:
                health_code_update();
                DBG("Channel poll wait");
                health_poll_entry();
                ret = lttng_poll_wait(&events, -1);
-               DBG("Channel poll return from wait with %d fd(s)",
-                               LTTNG_POLL_GETNB(&events));
+               DBG("Channel poll return from wait with %d fd(s)", LTTNG_POLL_GETNB(&events));
                health_poll_exit();
                DBG("Channel event caught in thread");
                if (ret < 0) {
@@ -2979,7 +2960,7 @@ restart:
                                goto restart;
                        }
                        if (LTTNG_POLL_GETNB(&events) == 0) {
-                               err = 0;        /* All is OK */
+                               err = 0; /* All is OK */
                        }
                        goto end;
                }
@@ -3003,41 +2984,45 @@ restart:
                                                if (ret < 0) {
                                                        ERR("Error reading channel pipe");
                                                }
-                                               lttng_poll_del(&events, ctx->consumer_channel_pipe[0]);
+                                               lttng_poll_del(&events,
+                                                              ctx->consumer_channel_pipe[0]);
                                                continue;
                                        }
 
                                        switch (action) {
                                        case CONSUMER_CHANNEL_ADD:
-                                               DBG("Adding channel %d to poll set",
-                                                       chan->wait_fd);
+                                               DBG("Adding channel %d to poll set", chan->wait_fd);
 
                                                lttng_ht_node_init_u64(&chan->wait_fd_node,
-                                                       chan->wait_fd);
+                                                                      chan->wait_fd);
                                                rcu_read_lock();
                                                lttng_ht_add_unique_u64(channel_ht,
-                                                               &chan->wait_fd_node);
+                                                                       &chan->wait_fd_node);
                                                rcu_read_unlock();
                                                /* Add channel to the global poll events list */
-                                               // FIXME: Empty flag on a pipe pollset, this might hang on FreeBSD.
+                                               // FIXME: Empty flag on a pipe pollset, this might
+                                               // hang on FreeBSD.
                                                lttng_poll_add(&events, chan->wait_fd, 0);
                                                break;
                                        case CONSUMER_CHANNEL_DEL:
                                        {
                                                /*
-                                                * This command should never be called if the channel
-                                                * has streams monitored by either the data or metadata
-                                                * thread. The consumer only notify this thread with a
-                                                * channel del. command if it receives a destroy
-                                                * channel command from the session daemon that send it
-                                                * if a command prior to the GET_CHANNEL failed.
+                                                * This command should never be called if the
+                                                * channel has streams monitored by either the data
+                                                * or metadata thread. The consumer only notify this
+                                                * thread with a channel del. command if it receives
+                                                * a destroy channel command from the session daemon
+                                                * that send it if a command prior to the
+                                                * GET_CHANNEL failed.
                                                 */
 
                                                rcu_read_lock();
                                                chan = consumer_find_channel(key);
                                                if (!chan) {
                                                        rcu_read_unlock();
-                                                       ERR("UST consumer get channel key %" PRIu64 " not found for del channel", key);
+                                                       ERR("UST consumer get channel key %" PRIu64
+                                                           " not found for del channel",
+                                                           key);
                                                        break;
                                                }
                                                lttng_poll_del(&events, chan->wait_fd);
@@ -3051,7 +3036,8 @@ restart:
                                                case LTTNG_CONSUMER32_UST:
                                                case LTTNG_CONSUMER64_UST:
                                                        health_code_update();
-                                                       /* Destroy streams that might have been left in the stream list. */
+                                                       /* Destroy streams that might have been left
+                                                        * in the stream list. */
                                                        clean_channel_stream_list(chan);
                                                        break;
                                                default:
@@ -3060,8 +3046,8 @@ restart:
                                                }
 
                                                /*
-                                                * Release our own refcount. Force channel deletion even if
-                                                * streams were not initialized.
+                                                * Release our own refcount. Force channel deletion
+                                                * even if streams were not initialized.
                                                 */
                                                if (!uatomic_sub_return(&chan->refcount, 1)) {
                                                        consumer_del_channel(chan);
@@ -3071,10 +3057,11 @@ restart:
                                        }
                                        case CONSUMER_CHANNEL_QUIT:
                                                /*
-                                                * Remove the pipe from the poll set and continue the loop
-                                                * since their might be data to consume.
+                                                * Remove the pipe from the poll set and continue
+                                                * the loop since their might be data to consume.
                                                 */
-                                               lttng_poll_del(&events, ctx->consumer_channel_pipe[0]);
+                                               lttng_poll_del(&events,
+                                                              ctx->consumer_channel_pipe[0]);
                                                continue;
                                        default:
                                                ERR("Unknown action");
@@ -3089,7 +3076,9 @@ restart:
                                        lttng_poll_del(&events, ctx->consumer_channel_pipe[0]);
                                        continue;
                                } else {
-                                       ERR("Unexpected poll events %u for sock %d", revents, pollfd);
+                                       ERR("Unexpected poll events %u for sock %d",
+                                           revents,
+                                           pollfd);
                                        goto end;
                                }
 
@@ -3106,8 +3095,7 @@ restart:
                        node = lttng_ht_iter_get_node_u64(&iter);
                        LTTNG_ASSERT(node);
 
-                       chan = caa_container_of(node, struct lttng_consumer_channel,
-                                       wait_fd_node);
+                       chan = caa_container_of(node, struct lttng_consumer_channel, wait_fd_node);
 
                        /* Check for error event */
                        if (revents & (LPOLLERR | LPOLLHUP)) {
@@ -3125,8 +3113,8 @@ restart:
                                consumer_close_channel_streams(chan);
 
                                /* Release our own refcount */
-                               if (!uatomic_sub_return(&chan->refcount, 1)
-                                               && !uatomic_read(&chan->nb_init_stream_left)) {
+                               if (!uatomic_sub_return(&chan->refcount, 1) &&
+                                   !uatomic_read(&chan->nb_init_stream_left)) {
                                        consumer_del_channel(chan);
                                }
                        } else {
@@ -3159,7 +3147,8 @@ error_testpoint:
 }
 
 static int set_metadata_socket(struct lttng_consumer_local_data *ctx,
-               struct pollfd *sockpoll, int client_socket)
+                              struct pollfd *sockpoll,
+                              int client_socket)
 {
        int ret;
 
@@ -3303,7 +3292,7 @@ void *consumer_thread_sessiond_poll(void *data)
                }
                if (CMM_LOAD_SHARED(consumer_quit)) {
                        DBG("consumer_thread_receive_fds received quit from signal");
-                       err = 0;        /* All is OK */
+                       err = 0; /* All is OK */
                        goto end;
                }
                DBG("Received command on sock");
@@ -3364,18 +3353,17 @@ error_testpoint:
 }
 
 static int post_consume(struct lttng_consumer_stream *stream,
-               const struct stream_subbuffer *subbuffer,
-               struct lttng_consumer_local_data *ctx)
+                       const struct stream_subbuffer *subbuffer,
+                       struct lttng_consumer_local_data *ctx)
 {
        size_t i;
        int ret = 0;
-       const size_t count = lttng_dynamic_array_get_count(
-                       &stream->read_subbuffer_ops.post_consume_cbs);
+       const size_t count =
+               lttng_dynamic_array_get_count(&stream->read_subbuffer_ops.post_consume_cbs);
 
        for (i = 0; i < count; i++) {
                const post_consume_cb op = *(post_consume_cb *) lttng_dynamic_array_get_element(
-                               &stream->read_subbuffer_ops.post_consume_cbs,
-                               i);
+                       &stream->read_subbuffer_ops.post_consume_cbs, i);
 
                ret = op(stream, subbuffer, ctx);
                if (ret) {
@@ -3387,8 +3375,8 @@ end:
 }
 
 ssize_t lttng_consumer_read_subbuffer(struct lttng_consumer_stream *stream,
-               struct lttng_consumer_local_data *ctx,
-               bool locked_by_caller)
+                                     struct lttng_consumer_local_data *ctx,
+                                     bool locked_by_caller)
 {
        ssize_t ret, written_bytes = 0;
        int rotation_ret;
@@ -3421,8 +3409,7 @@ ssize_t lttng_consumer_read_subbuffer(struct lttng_consumer_stream *stream,
                }
        }
 
-       get_next_status = stream->read_subbuffer_ops.get_next_subbuffer(
-                       stream, &subbuffer);
+       get_next_status = stream->read_subbuffer_ops.get_next_subbuffer(stream, &subbuffer);
        switch (get_next_status) {
        case GET_NEXT_SUBBUFFER_STATUS_OK:
                break;
@@ -3437,14 +3424,12 @@ ssize_t lttng_consumer_read_subbuffer(struct lttng_consumer_stream *stream,
                abort();
        }
 
-       ret = stream->read_subbuffer_ops.pre_consume_subbuffer(
-                       stream, &subbuffer);
+       ret = stream->read_subbuffer_ops.pre_consume_subbuffer(stream, &subbuffer);
        if (ret) {
                goto error_put_subbuf;
        }
 
-       written_bytes = stream->read_subbuffer_ops.consume_subbuffer(
-                       ctx, stream, &subbuffer);
+       written_bytes = stream->read_subbuffer_ops.consume_subbuffer(ctx, stream, &subbuffer);
        if (written_bytes <= 0) {
                ERR("Error consuming subbuffer: (%zd)", written_bytes);
                ret = (int) written_bytes;
@@ -3525,8 +3510,7 @@ int lttng_consumer_init(void)
                goto error;
        }
 
-       the_consumer_data.channels_by_session_id_ht =
-                       lttng_ht_new(0, LTTNG_HT_TYPE_U64);
+       the_consumer_data.channels_by_session_id_ht = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
        if (!the_consumer_data.channels_by_session_id_ht) {
                goto error;
        }
@@ -3541,8 +3525,7 @@ int lttng_consumer_init(void)
                goto error;
        }
 
-       the_consumer_data.stream_per_chan_id_ht =
-                       lttng_ht_new(0, LTTNG_HT_TYPE_U64);
+       the_consumer_data.stream_per_chan_id_ht = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
        if (!the_consumer_data.stream_per_chan_id_ht) {
                goto error;
        }
@@ -3575,15 +3558,15 @@ error:
  * The caller MUST acquire a RCU read side lock before calling it.
  */
 void consumer_add_relayd_socket(uint64_t net_seq_idx,
-               int sock_type,
-               struct lttng_consumer_local_data *ctx,
-               int sock,
-               struct pollfd *consumer_sockpoll,
-               uint64_t sessiond_id,
-               uint64_t relayd_session_id,
-               uint32_t relayd_version_major,
-               uint32_t relayd_version_minor,
-               enum lttcomm_sock_proto relayd_socket_protocol)
+                               int sock_type,
+                               struct lttng_consumer_local_data *ctx,
+                               int sock,
+                               struct pollfd *consumer_sockpoll,
+                               uint64_t sessiond_id,
+                               uint64_t relayd_session_id,
+                               uint32_t relayd_version_major,
+                               uint32_t relayd_version_minor,
+                               enum lttcomm_sock_proto relayd_socket_protocol)
 {
        int fd = -1, ret = -1, relayd_created = 0;
        enum lttcomm_return_code ret_code = LTTCOMM_CONSUMERD_SUCCESS;
@@ -3640,7 +3623,7 @@ void consumer_add_relayd_socket(uint64_t net_seq_idx,
        /* Get relayd socket from session daemon */
        ret = lttcomm_recv_fds_unix_sock(sock, &fd, 1);
        if (ret != sizeof(fd)) {
-               fd = -1;        /* Just in case it gets set with an invalid value. */
+               fd = -1; /* Just in case it gets set with an invalid value. */
 
                /*
                 * Failing to receive FDs might indicate a major problem such as
@@ -3661,8 +3644,7 @@ void consumer_add_relayd_socket(uint64_t net_seq_idx,
        case LTTNG_STREAM_CONTROL:
                /* Copy received lttcomm socket */
                ret = lttcomm_populate_sock_from_open_socket(
-                               &relayd->control_sock.sock, fd,
-                               relayd_socket_protocol);
+                       &relayd->control_sock.sock, fd, relayd_socket_protocol);
 
                /* Assign version values. */
                relayd->control_sock.major = relayd_version_major;
@@ -3674,8 +3656,7 @@ void consumer_add_relayd_socket(uint64_t net_seq_idx,
        case LTTNG_STREAM_DATA:
                /* Copy received lttcomm socket */
                ret = lttcomm_populate_sock_from_open_socket(
-                               &relayd->data_sock.sock, fd,
-                               relayd_socket_protocol);
+                       &relayd->data_sock.sock, fd, relayd_socket_protocol);
                /* Assign version values. */
                relayd->data_sock.major = relayd_version_major;
                relayd->data_sock.minor = relayd_version_minor;
@@ -3692,8 +3673,9 @@ void consumer_add_relayd_socket(uint64_t net_seq_idx,
        }
 
        DBG("Consumer %s socket created successfully with net idx %" PRIu64 " (fd: %d)",
-                       sock_type == LTTNG_STREAM_CONTROL ? "control" : "data",
-                       relayd->net_seq_idx, fd);
+           sock_type == LTTNG_STREAM_CONTROL ? "control" : "data",
+           relayd->net_seq_idx,
+           fd);
        /*
         * We gave the ownership of the fd to the relayd structure. Set the
         * fd to -1 so we don't call close() on it in the error path below.
@@ -3750,8 +3732,7 @@ static struct consumer_relayd_sock_pair *find_relayd_by_session_id(uint64_t id)
        ASSERT_RCU_READ_LOCKED();
 
        /* Iterate over all relayd since they are indexed by net_seq_idx. */
-       cds_lfht_for_each_entry(the_consumer_data.relayd_ht->ht, &iter.iter,
-                       relayd, node.node) {
+       cds_lfht_for_each_entry (the_consumer_data.relayd_ht->ht, &iter.iter, relayd, node.node) {
                /*
                 * Check by sessiond id which is unique here where the relayd session
                 * id might not be when having multiple relayd.
@@ -3805,9 +3786,13 @@ int consumer_data_pending(uint64_t id)
        ht = the_consumer_data.stream_list_ht;
 
        cds_lfht_for_each_entry_duplicate(ht->ht,
-                       ht->hash_fct(&id, lttng_ht_seed),
-                       ht->match_fct, &id,
-                       &iter.iter, stream, node_session_id.node) {
+                                         ht->hash_fct(&id, lttng_ht_seed),
+                                         ht->match_fct,
+                                         &id,
+                                         &iter.iter,
+                                         stream,
+                                         node_session_id.node)
+       {
                pthread_mutex_lock(&stream->lock);
 
                /*
@@ -3835,8 +3820,7 @@ int consumer_data_pending(uint64_t id)
 
                /* Send init command for data pending. */
                pthread_mutex_lock(&relayd->ctrl_sock_mutex);
-               ret = relayd_begin_data_pending(&relayd->control_sock,
-                               relayd->relayd_session_id);
+               ret = relayd_begin_data_pending(&relayd->control_sock, relayd->relayd_session_id);
                if (ret < 0) {
                        pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
                        /* Communication error thus the relayd so no data pending. */
@@ -3844,23 +3828,28 @@ int consumer_data_pending(uint64_t id)
                }
 
                cds_lfht_for_each_entry_duplicate(ht->ht,
-                               ht->hash_fct(&id, lttng_ht_seed),
-                               ht->match_fct, &id,
-                               &iter.iter, stream, node_session_id.node) {
+                                                 ht->hash_fct(&id, lttng_ht_seed),
+                                                 ht->match_fct,
+                                                 &id,
+                                                 &iter.iter,
+                                                 stream,
+                                                 node_session_id.node)
+               {
                        if (stream->metadata_flag) {
                                ret = relayd_quiescent_control(&relayd->control_sock,
-                                               stream->relayd_stream_id);
+                                                              stream->relayd_stream_id);
                        } else {
                                ret = relayd_data_pending(&relayd->control_sock,
-                                               stream->relayd_stream_id,
-                                               stream->next_net_seq_num - 1);
+                                                         stream->relayd_stream_id,
+                                                         stream->next_net_seq_num - 1);
                        }
 
                        if (ret == 1) {
                                pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
                                goto data_pending;
                        } else if (ret < 0) {
-                               ERR("Relayd data pending failed. Cleaning up relayd %" PRIu64".", relayd->net_seq_idx);
+                               ERR("Relayd data pending failed. Cleaning up relayd %" PRIu64 ".",
+                                   relayd->net_seq_idx);
                                lttng_consumer_cleanup_relayd(relayd);
                                pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
                                goto data_not_pending;
@@ -3868,11 +3857,12 @@ int consumer_data_pending(uint64_t id)
                }
 
                /* Send end command for data pending. */
-               ret = relayd_end_data_pending(&relayd->control_sock,
-                               relayd->relayd_session_id, &is_data_inflight);
+               ret = relayd_end_data_pending(
+                       &relayd->control_sock, relayd->relayd_session_id, &is_data_inflight);
                pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
                if (ret < 0) {
-                       ERR("Relayd end data pending failed. Cleaning up relayd %" PRIu64".", relayd->net_seq_idx);
+                       ERR("Relayd end data pending failed. Cleaning up relayd %" PRIu64 ".",
+                           relayd->net_seq_idx);
                        lttng_consumer_cleanup_relayd(relayd);
                        goto data_not_pending;
                }
@@ -3920,8 +3910,7 @@ int consumer_send_status_msg(int sock, int ret_code)
  *
  * Return the sendmsg() return value.
  */
-int consumer_send_status_channel(int sock,
-               struct lttng_consumer_channel *channel)
+int consumer_send_status_channel(int sock, struct lttng_consumer_channel *channel)
 {
        struct lttcomm_consumer_status_channel msg;
 
@@ -3940,25 +3929,27 @@ int consumer_send_status_channel(int sock,
 }
 
 unsigned long consumer_get_consume_start_pos(unsigned long consumed_pos,
-               unsigned long produced_pos, uint64_t nb_packets_per_stream,
-               uint64_t max_sb_size)
+                                            unsigned long produced_pos,
+                                            uint64_t nb_packets_per_stream,
+                                            uint64_t max_sb_size)
 {
        unsigned long start_pos;
 
        if (!nb_packets_per_stream) {
-               return consumed_pos;    /* Grab everything */
+               return consumed_pos; /* Grab everything */
        }
        start_pos = produced_pos - lttng_offset_align_floor(produced_pos, max_sb_size);
        start_pos -= max_sb_size * nb_packets_per_stream;
        if ((long) (start_pos - consumed_pos) < 0) {
-               return consumed_pos;    /* Grab everything */
+               return consumed_pos; /* Grab everything */
        }
        return start_pos;
 }
 
 /* Stream lock must be held by the caller. */
 static int sample_stream_positions(struct lttng_consumer_stream *stream,
-                           unsigned long *produced, unsigned long *consumed)
+                                  unsigned long *produced,
+                                  unsigned long *consumed)
 {
        int ret;
 
@@ -3996,7 +3987,8 @@ end:
  * Returns 0 on success, < 0 on error
  */
 int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
-               uint64_t key, uint64_t relayd_id)
+                                 uint64_t key,
+                                 uint64_t relayd_id)
 {
        int ret;
        struct lttng_consumer_stream *stream;
@@ -4016,25 +4008,28 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
 
        DBG("Consumer sample rotate position for channel %" PRIu64, key);
 
-       lttng_dynamic_array_init(&stream_rotation_positions,
-                       sizeof(struct relayd_stream_rotation_position), NULL);
+       lttng_dynamic_array_init(
+               &stream_rotation_positions, sizeof(struct relayd_stream_rotation_position), NULL);
        lttng_dynamic_pointer_array_init(&streams_packet_to_open, NULL);
 
        rcu_read_lock();
 
        pthread_mutex_lock(&channel->lock);
        LTTNG_ASSERT(channel->trace_chunk);
-       chunk_status = lttng_trace_chunk_get_id(channel->trace_chunk,
-                       &next_chunk_id);
+       chunk_status = lttng_trace_chunk_get_id(channel->trace_chunk, &next_chunk_id);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ret = -1;
                goto end_unlock_channel;
        }
 
        cds_lfht_for_each_entry_duplicate(ht->ht,
-                       ht->hash_fct(&channel->key, lttng_ht_seed),
-                       ht->match_fct, &channel->key, &iter.iter,
-                       stream, node_channel_id.node) {
+                                         ht->hash_fct(&channel->key, lttng_ht_seed),
+                                         ht->match_fct,
+                                         &channel->key,
+                                         &iter.iter,
+                                         stream,
+                                         node_channel_id.node)
+       {
                unsigned long produced_pos = 0, consumed_pos = 0;
 
                health_code_update();
@@ -4093,7 +4088,8 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                                         * for this stream during this trace
                                         * chunk's lifetime.
                                         */
-                                       ret = sample_stream_positions(stream, &produced_pos, &consumed_pos);
+                                       ret = sample_stream_positions(
+                                               stream, &produced_pos, &consumed_pos);
                                        if (ret) {
                                                goto end_unlock_stream;
                                        }
@@ -4109,9 +4105,9 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                                                uint64_t trace_chunk_id;
 
                                                chunk_status = lttng_trace_chunk_get_name(
-                                                               stream->trace_chunk,
-                                                               &trace_chunk_name,
-                                                               NULL);
+                                                       stream->trace_chunk,
+                                                       &trace_chunk_name,
+                                                       NULL);
                                                if (chunk_status == LTTNG_TRACE_CHUNK_STATUS_NONE) {
                                                        trace_chunk_name = "none";
                                                }
@@ -4121,15 +4117,17 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                                                 * never anonymous.
                                                 */
                                                chunk_status = lttng_trace_chunk_get_id(
-                                                               stream->trace_chunk,
-                                                               &trace_chunk_id);
+                                                       stream->trace_chunk, &trace_chunk_id);
                                                LTTNG_ASSERT(chunk_status ==
-                                                               LTTNG_TRACE_CHUNK_STATUS_OK);
+                                                            LTTNG_TRACE_CHUNK_STATUS_OK);
 
                                                DBG("Unable to open packet for stream during trace chunk's lifetime. "
-                                                               "Flushing an empty packet to prevent an empty file from being created: "
-                                                               "stream id = %" PRIu64 ", trace chunk name = `%s`, trace chunk id = %" PRIu64,
-                                                               stream->key, trace_chunk_name, trace_chunk_id);
+                                                   "Flushing an empty packet to prevent an empty file from being created: "
+                                                   "stream id = %" PRIu64
+                                                   ", trace chunk name = `%s`, trace chunk id = %" PRIu64,
+                                                   stream->key,
+                                                   trace_chunk_name,
+                                                   trace_chunk_id);
                                        }
                                }
                        }
@@ -4141,7 +4139,7 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                        ret = consumer_stream_flush_buffer(stream, flush_active);
                        if (ret < 0) {
                                ERR("Failed to flush stream %" PRIu64 " during channel rotation",
-                                               stream->key);
+                                   stream->key);
                                goto end_unlock_stream;
                        }
                }
@@ -4152,15 +4150,13 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                        goto end_unlock_stream;
                }
                if (!ret) {
-                       ret = lttng_consumer_get_produced_snapshot(stream,
-                                       &produced_pos);
+                       ret = lttng_consumer_get_produced_snapshot(stream, &produced_pos);
                        if (ret < 0) {
                                ERR("Failed to sample produced position during channel rotation");
                                goto end_unlock_stream;
                        }
 
-                       ret = lttng_consumer_get_consumed_snapshot(stream,
-                                       &consumed_pos);
+                       ret = lttng_consumer_get_consumed_snapshot(stream, &consumed_pos);
                        if (ret < 0) {
                                ERR("Failed to sample consumed position during channel rotation");
                                goto end_unlock_stream;
@@ -4173,12 +4169,16 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                produced_pos = lttng_align_floor(produced_pos, stream->max_sb_size);
                if (consumed_pos == produced_pos) {
                        DBG("Set rotate ready for stream %" PRIu64 " produced = %lu consumed = %lu",
-                                       stream->key, produced_pos, consumed_pos);
+                           stream->key,
+                           produced_pos,
+                           consumed_pos);
                        stream->rotate_ready = true;
                } else {
                        DBG("Different consumed and produced positions "
-                                       "for stream %" PRIu64 " produced = %lu consumed = %lu",
-                                       stream->key, produced_pos, consumed_pos);
+                           "for stream %" PRIu64 " produced = %lu consumed = %lu",
+                           stream->key,
+                           produced_pos,
+                           consumed_pos);
                }
                /*
                 * The rotation position is based on the packet_seq_num of the
@@ -4197,14 +4197,15 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                         * not implement packet sequence number.
                         */
                        ERR("Failure to rotate stream %" PRIu64 ": sequence number unavailable",
-                                       stream->key);
+                           stream->key);
                        ret = -1;
                        goto end_unlock_stream;
                }
                stream->rotate_position = stream->last_sequence_number + 1 +
-                               ((produced_pos - consumed_pos) / stream->max_sb_size);
+                       ((produced_pos - consumed_pos) / stream->max_sb_size);
                DBG("Set rotation position for stream %" PRIu64 " at position %" PRIu64,
-                               stream->key, stream->rotate_position);
+                   stream->key,
+                   stream->rotate_position);
 
                if (!is_local_trace) {
                        /*
@@ -4217,9 +4218,8 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                                .rotate_at_seq_num = stream->rotate_position,
                        };
 
-                       ret = lttng_dynamic_array_add_element(
-                                       &stream_rotation_positions,
-                                       &position);
+                       ret = lttng_dynamic_array_add_element(&stream_rotation_positions,
+                                                             &position);
                        if (ret) {
                                ERR("Failed to allocate stream rotation position");
                                goto end_unlock_stream;
@@ -4279,8 +4279,8 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                         * is performed in a stream that has no active trace
                         * chunk.
                         */
-                       ret = lttng_dynamic_pointer_array_add_pointer(
-                                       &streams_packet_to_open, stream);
+                       ret = lttng_dynamic_pointer_array_add_pointer(&streams_packet_to_open,
+                                                                     stream);
                        if (ret) {
                                PERROR("Failed to add a stream pointer to array of streams in which to open a packet");
                                ret = -1;
@@ -4301,28 +4301,27 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                }
 
                pthread_mutex_lock(&relayd->ctrl_sock_mutex);
-               ret = relayd_rotate_streams(&relayd->control_sock, stream_count,
-                               rotating_to_new_chunk ? &next_chunk_id : NULL,
-                               (const struct relayd_stream_rotation_position *)
-                                               stream_rotation_positions.buffer
-                                                               .data);
+               ret = relayd_rotate_streams(&relayd->control_sock,
+                                           stream_count,
+                                           rotating_to_new_chunk ? &next_chunk_id : NULL,
+                                           (const struct relayd_stream_rotation_position *)
+                                                   stream_rotation_positions.buffer.data);
                pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
                if (ret < 0) {
                        ERR("Relayd rotate stream failed. Cleaning up relayd %" PRIu64,
-                                       relayd->net_seq_idx);
+                           relayd->net_seq_idx);
                        lttng_consumer_cleanup_relayd(relayd);
                        goto end_unlock_channel;
                }
        }
 
        for (stream_idx = 0;
-                       stream_idx < lttng_dynamic_pointer_array_get_count(
-                               &streams_packet_to_open);
-                       stream_idx++) {
+            stream_idx < lttng_dynamic_pointer_array_get_count(&streams_packet_to_open);
+            stream_idx++) {
                enum consumer_stream_open_packet_status status;
 
                stream = (lttng_consumer_stream *) lttng_dynamic_pointer_array_get_pointer(
-                               &streams_packet_to_open, stream_idx);
+                       &streams_packet_to_open, stream_idx);
 
                pthread_mutex_lock(&stream->lock);
                status = consumer_stream_open_packet(stream);
@@ -4331,8 +4330,9 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                case CONSUMER_STREAM_OPEN_PACKET_STATUS_OPENED:
                        DBG("Opened a packet after a rotation: stream id = %" PRIu64
                            ", channel name = %s, session id = %" PRIu64,
-                                       stream->key, stream->chan->name,
-                                       stream->chan->session_id);
+                           stream->key,
+                           stream->chan->name,
+                           stream->chan->session_id);
                        break;
                case CONSUMER_STREAM_OPEN_PACKET_STATUS_NO_SPACE:
                        /*
@@ -4342,8 +4342,9 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                         */
                        DBG("No space left to open a packet after a rotation: stream id = %" PRIu64
                            ", channel name = %s, session id = %" PRIu64,
-                                       stream->key, stream->chan->name,
-                                       stream->chan->session_id);
+                           stream->key,
+                           stream->chan->name,
+                           stream->chan->session_id);
                        break;
                case CONSUMER_STREAM_OPEN_PACKET_STATUS_ERROR:
                        /* Logged by callee. */
@@ -4369,8 +4370,7 @@ end:
        return ret;
 }
 
-static
-int consumer_clear_buffer(struct lttng_consumer_stream *stream)
+static int consumer_clear_buffer(struct lttng_consumer_stream *stream)
 {
        int ret = 0;
        unsigned long consumed_pos_before, consumed_pos_after;
@@ -4423,23 +4423,20 @@ end:
        return ret;
 }
 
-static
-int consumer_clear_stream(struct lttng_consumer_stream *stream)
+static int consumer_clear_stream(struct lttng_consumer_stream *stream)
 {
        int ret;
 
        ret = consumer_stream_flush_buffer(stream, 1);
        if (ret < 0) {
-               ERR("Failed to flush stream %" PRIu64 " during channel clear",
-                               stream->key);
+               ERR("Failed to flush stream %" PRIu64 " during channel clear", stream->key);
                ret = LTTCOMM_CONSUMERD_FATAL;
                goto error;
        }
 
        ret = consumer_clear_buffer(stream);
        if (ret < 0) {
-               ERR("Failed to clear stream %" PRIu64 " during channel clear",
-                               stream->key);
+               ERR("Failed to clear stream %" PRIu64 " during channel clear", stream->key);
                ret = LTTCOMM_CONSUMERD_FATAL;
                goto error;
        }
@@ -4449,15 +4446,14 @@ error:
        return ret;
 }
 
-static
-int consumer_clear_unmonitored_channel(struct lttng_consumer_channel *channel)
+static int consumer_clear_unmonitored_channel(struct lttng_consumer_channel *channel)
 {
        int ret;
        struct lttng_consumer_stream *stream;
 
        rcu_read_lock();
        pthread_mutex_lock(&channel->lock);
-       cds_list_for_each_entry(stream, &channel->streams.head, send_node) {
+       cds_list_for_each_entry (stream, &channel->streams.head, send_node) {
                health_code_update();
                pthread_mutex_lock(&stream->lock);
                ret = consumer_clear_stream(stream);
@@ -4485,11 +4481,12 @@ error_unlock:
  */
 int lttng_consumer_stream_is_rotate_ready(struct lttng_consumer_stream *stream)
 {
-       DBG("Check is rotate ready for stream %" PRIu64
-                       " ready %u rotate_position %" PRIu64
-                       " last_sequence_number %" PRIu64,
-                       stream->key, stream->rotate_ready,
-                       stream->rotate_position, stream->last_sequence_number);
+       DBG("Check is rotate ready for stream %" PRIu64 " ready %u rotate_position %" PRIu64
+           " last_sequence_number %" PRIu64,
+           stream->key,
+           stream->rotate_ready,
+           stream->rotate_position,
+           stream->last_sequence_number);
        if (stream->rotate_ready) {
                return 1;
        }
@@ -4502,13 +4499,12 @@ int lttng_consumer_stream_is_rotate_ready(struct lttng_consumer_stream *stream)
         */
        if (stream->sequence_number_unavailable) {
                ERR("Internal error: rotation used on stream %" PRIu64
-                               " with unavailable sequence number",
-                               stream->key);
+                   " with unavailable sequence number",
+                   stream->key);
                return -1;
        }
 
-       if (stream->rotate_position == -1ULL ||
-                       stream->last_sequence_number == -1ULL) {
+       if (stream->rotate_position == -1ULL || stream->last_sequence_number == -1ULL) {
                return 0;
        }
 
@@ -4519,11 +4515,11 @@ int lttng_consumer_stream_is_rotate_ready(struct lttng_consumer_stream *stream)
         * packet of the current chunk, hence the "rotate_position - 1".
         */
 
-       DBG("Check is rotate ready for stream %" PRIu64
-                       " last_sequence_number %" PRIu64
-                       " rotate_position %" PRIu64,
-                       stream->key, stream->last_sequence_number,
-                       stream->rotate_position);
+       DBG("Check is rotate ready for stream %" PRIu64 " last_sequence_number %" PRIu64
+           " rotate_position %" PRIu64,
+           stream->key,
+           stream->last_sequence_number,
+           stream->rotate_position);
        if (stream->last_sequence_number >= stream->rotate_position - 1) {
                return 1;
        }
@@ -4536,8 +4532,7 @@ int lttng_consumer_stream_is_rotate_ready(struct lttng_consumer_stream *stream)
  */
 void lttng_consumer_reset_stream_rotate_state(struct lttng_consumer_stream *stream)
 {
-       DBG("lttng_consumer_reset_stream_rotate_state for stream %" PRIu64,
-                       stream->key);
+       DBG("lttng_consumer_reset_stream_rotate_state for stream %" PRIu64, stream->key);
        stream->rotate_position = -1ULL;
        stream->rotate_ready = false;
 }
@@ -4545,14 +4540,13 @@ void lttng_consumer_reset_stream_rotate_state(struct lttng_consumer_stream *stre
 /*
  * Perform the rotation a local stream file.
  */
-static
-int rotate_local_stream(struct lttng_consumer_stream *stream)
+static int rotate_local_stream(struct lttng_consumer_stream *stream)
 {
        int ret = 0;
 
        DBG("Rotate local stream: stream key %" PRIu64 ", channel key %" PRIu64,
-                       stream->key,
-                       stream->chan->key);
+           stream->key,
+           stream->chan->key);
        stream->tracefile_size_current = 0;
        stream->tracefile_count_current = 0;
 
@@ -4560,7 +4554,7 @@ int rotate_local_stream(struct lttng_consumer_stream *stream)
                ret = close(stream->out_fd);
                if (ret) {
                        PERROR("Failed to close stream out_fd of channel \"%s\"",
-                               stream->chan->name);
+                              stream->chan->name);
                }
                stream->out_fd = -1;
        }
@@ -4606,8 +4600,7 @@ int lttng_consumer_rotate_stream(struct lttng_consumer_stream *stream)
                 * anything until a new trace chunk is created.
                 */
                stream->trace_chunk = NULL;
-       } else if (stream->chan->trace_chunk &&
-                       !lttng_trace_chunk_get(stream->chan->trace_chunk)) {
+       } else if (stream->chan->trace_chunk && !lttng_trace_chunk_get(stream->chan->trace_chunk)) {
                ERR("Failed to acquire a reference to channel's trace chunk during stream rotation");
                ret = -1;
                goto error;
@@ -4663,8 +4656,7 @@ error:
  *
  * Returns 0 on success, < 0 on error
  */
-int lttng_consumer_rotate_ready_streams(struct lttng_consumer_channel *channel,
-               uint64_t key)
+int lttng_consumer_rotate_ready_streams(struct lttng_consumer_channel *channel, uint64_t key)
 {
        int ret;
        struct lttng_consumer_stream *stream;
@@ -4678,9 +4670,13 @@ int lttng_consumer_rotate_ready_streams(struct lttng_consumer_channel *channel,
        DBG("Consumer rotate ready streams in channel %" PRIu64, key);
 
        cds_lfht_for_each_entry_duplicate(ht->ht,
-                       ht->hash_fct(&channel->key, lttng_ht_seed),
-                       ht->match_fct, &channel->key, &iter.iter,
-                       stream, node_channel_id.node) {
+                                         ht->hash_fct(&channel->key, lttng_ht_seed),
+                                         ht->match_fct,
+                                         &channel->key,
+                                         &iter.iter,
+                                         stream,
+                                         node_channel_id.node)
+       {
                health_code_update();
 
                pthread_mutex_lock(&stream->chan->lock);
@@ -4708,9 +4704,8 @@ end:
        return ret;
 }
 
-enum lttcomm_return_code lttng_consumer_init_command(
-               struct lttng_consumer_local_data *ctx,
-               const lttng_uuid& sessiond_uuid)
+enum lttcomm_return_code lttng_consumer_init_command(struct lttng_consumer_local_data *ctx,
+                                                    const lttng_uuid& sessiond_uuid)
 {
        enum lttcomm_return_code ret;
        char uuid_str[LTTNG_UUID_STR_LEN];
@@ -4729,13 +4724,14 @@ end:
        return ret;
 }
 
-enum lttcomm_return_code lttng_consumer_create_trace_chunk(
-               const uint64_t *relayd_id, uint64_t session_id,
-               uint64_t chunk_id,
-               time_t chunk_creation_timestamp,
-               const char *chunk_override_name,
-               const struct lttng_credentials *credentials,
-               struct lttng_directory_handle *chunk_directory_handle)
+enum lttcomm_return_code
+lttng_consumer_create_trace_chunk(const uint64_t *relayd_id,
+                                 uint64_t session_id,
+                                 uint64_t chunk_id,
+                                 time_t chunk_creation_timestamp,
+                                 const char *chunk_override_name,
+                                 const struct lttng_credentials *credentials,
+                                 struct lttng_directory_handle *chunk_directory_handle)
 {
        int ret;
        enum lttcomm_return_code ret_code = LTTCOMM_CONSUMERD_SUCCESS;
@@ -4750,8 +4746,7 @@ enum lttcomm_return_code lttng_consumer_create_trace_chunk(
 
        if (relayd_id) {
                /* Only used for logging purposes. */
-               ret = snprintf(relayd_id_buffer, sizeof(relayd_id_buffer),
-                               "%" PRIu64, *relayd_id);
+               ret = snprintf(relayd_id_buffer, sizeof(relayd_id_buffer), "%" PRIu64, *relayd_id);
                if (ret > 0 && ret < sizeof(relayd_id_buffer)) {
                        relayd_id_str = relayd_id_buffer;
                } else {
@@ -4762,18 +4757,18 @@ enum lttcomm_return_code lttng_consumer_create_trace_chunk(
        /* Local protocol error. */
        LTTNG_ASSERT(chunk_creation_timestamp);
        ret = time_to_iso8601_str(chunk_creation_timestamp,
-                       creation_timestamp_buffer,
-                       sizeof(creation_timestamp_buffer));
-       creation_timestamp_str = !ret ? creation_timestamp_buffer :
-                       "(formatting error)";
+                                 creation_timestamp_buffer,
+                                 sizeof(creation_timestamp_buffer));
+       creation_timestamp_str = !ret ? creation_timestamp_buffer : "(formatting error)";
 
        DBG("Consumer create trace chunk command: relay_id = %s"
-                       ", session_id = %" PRIu64 ", chunk_id = %" PRIu64
-                       ", chunk_override_name = %s"
-                       ", chunk_creation_timestamp = %s",
-                       relayd_id_str, session_id, chunk_id,
-                       chunk_override_name ? : "(none)",
-                       creation_timestamp_str);
+           ", session_id = %" PRIu64 ", chunk_id = %" PRIu64 ", chunk_override_name = %s"
+           ", chunk_creation_timestamp = %s",
+           relayd_id_str,
+           session_id,
+           chunk_id,
+           chunk_override_name ?: "(none)",
+           creation_timestamp_str);
 
        /*
         * The trace chunk registry, as used by the consumer daemon, implicitly
@@ -4789,8 +4784,7 @@ enum lttcomm_return_code lttng_consumer_create_trace_chunk(
         * the session daemon through the LTTNG_CONSUMER_CREATE_TRACE_CHUNK
         * and LTTNG_CONSUMER_DESTROY_TRACE_CHUNK commands.
         */
-       created_chunk = lttng_trace_chunk_create(chunk_id,
-                       chunk_creation_timestamp, NULL);
+       created_chunk = lttng_trace_chunk_create(chunk_id, chunk_creation_timestamp, NULL);
        if (!created_chunk) {
                ERR("Failed to create trace chunk");
                ret_code = LTTCOMM_CONSUMERD_CREATE_TRACE_CHUNK_FAILED;
@@ -4798,8 +4792,7 @@ enum lttcomm_return_code lttng_consumer_create_trace_chunk(
        }
 
        if (chunk_override_name) {
-               chunk_status = lttng_trace_chunk_override_name(created_chunk,
-                               chunk_override_name);
+               chunk_status = lttng_trace_chunk_override_name(created_chunk, chunk_override_name);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ret_code = LTTCOMM_CONSUMERD_CREATE_TRACE_CHUNK_FAILED;
                        goto error;
@@ -4807,8 +4800,7 @@ enum lttcomm_return_code lttng_consumer_create_trace_chunk(
        }
 
        if (chunk_directory_handle) {
-               chunk_status = lttng_trace_chunk_set_credentials(created_chunk,
-                               credentials);
+               chunk_status = lttng_trace_chunk_set_credentials(created_chunk, credentials);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ERR("Failed to set trace chunk credentials");
                        ret_code = LTTCOMM_CONSUMERD_CREATE_TRACE_CHUNK_FAILED;
@@ -4818,8 +4810,7 @@ enum lttcomm_return_code lttng_consumer_create_trace_chunk(
                 * The consumer daemon has no ownership of the chunk output
                 * directory.
                 */
-               chunk_status = lttng_trace_chunk_set_as_user(created_chunk,
-                               chunk_directory_handle);
+               chunk_status = lttng_trace_chunk_set_as_user(created_chunk, chunk_directory_handle);
                chunk_directory_handle = NULL;
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ERR("Failed to set trace chunk's directory handle");
@@ -4829,8 +4820,7 @@ enum lttcomm_return_code lttng_consumer_create_trace_chunk(
        }
 
        published_chunk = lttng_trace_chunk_registry_publish_chunk(
-                       the_consumer_data.chunk_registry, session_id,
-                       created_chunk);
+               the_consumer_data.chunk_registry, session_id, created_chunk);
        lttng_trace_chunk_put(created_chunk);
        created_chunk = NULL;
        if (!published_chunk) {
@@ -4841,14 +4831,15 @@ enum lttcomm_return_code lttng_consumer_create_trace_chunk(
 
        rcu_read_lock();
        cds_lfht_for_each_entry_duplicate(
-                       the_consumer_data.channels_by_session_id_ht->ht,
-                       the_consumer_data.channels_by_session_id_ht->hash_fct(
-                                       &session_id, lttng_ht_seed),
-                       the_consumer_data.channels_by_session_id_ht->match_fct,
-                       &session_id, &iter.iter, channel,
-                       channels_by_session_id_ht_node.node) {
-               ret = lttng_consumer_channel_set_trace_chunk(channel,
-                               published_chunk);
+               the_consumer_data.channels_by_session_id_ht->ht,
+               the_consumer_data.channels_by_session_id_ht->hash_fct(&session_id, lttng_ht_seed),
+               the_consumer_data.channels_by_session_id_ht->match_fct,
+               &session_id,
+               &iter.iter,
+               channel,
+               channels_by_session_id_ht_node.node)
+       {
+               ret = lttng_consumer_channel_set_trace_chunk(channel, published_chunk);
                if (ret) {
                        /*
                         * Roll-back the creation of this chunk.
@@ -4864,12 +4855,16 @@ enum lttcomm_return_code lttng_consumer_create_trace_chunk(
 
                        DBG("Failed to set new trace chunk on existing channels, rolling back");
                        close_ret = lttng_consumer_close_trace_chunk(relayd_id,
-                                       session_id, chunk_id,
-                                       chunk_creation_timestamp, NULL,
-                                       path);
+                                                                    session_id,
+                                                                    chunk_id,
+                                                                    chunk_creation_timestamp,
+                                                                    NULL,
+                                                                    path);
                        if (close_ret != LTTCOMM_CONSUMERD_SUCCESS) {
-                               ERR("Failed to roll-back the creation of new chunk: session_id = %" PRIu64 ", chunk_id = %" PRIu64,
-                                               session_id, chunk_id);
+                               ERR("Failed to roll-back the creation of new chunk: session_id = %" PRIu64
+                                   ", chunk_id = %" PRIu64,
+                                   session_id,
+                                   chunk_id);
                        }
 
                        ret_code = LTTCOMM_CONSUMERD_CREATE_TRACE_CHUNK_FAILED;
@@ -4883,8 +4878,7 @@ enum lttcomm_return_code lttng_consumer_create_trace_chunk(
                relayd = consumer_find_relayd(*relayd_id);
                if (relayd) {
                        pthread_mutex_lock(&relayd->ctrl_sock_mutex);
-                       ret = relayd_create_trace_chunk(
-                                       &relayd->control_sock, published_chunk);
+                       ret = relayd_create_trace_chunk(&relayd->control_sock, published_chunk);
                        pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
                } else {
                        ERR("Failed to find relay daemon socket: relayd_id = %" PRIu64, *relayd_id);
@@ -4895,14 +4889,16 @@ enum lttcomm_return_code lttng_consumer_create_trace_chunk(
                        char path[LTTNG_PATH_MAX];
 
                        close_ret = lttng_consumer_close_trace_chunk(relayd_id,
-                                       session_id,
-                                       chunk_id,
-                                       chunk_creation_timestamp,
-                                       NULL, path);
+                                                                    session_id,
+                                                                    chunk_id,
+                                                                    chunk_creation_timestamp,
+                                                                    NULL,
+                                                                    path);
                        if (close_ret != LTTCOMM_CONSUMERD_SUCCESS) {
-                               ERR("Failed to roll-back the creation of new chunk: session_id = %" PRIu64 ", chunk_id = %" PRIu64,
-                                               session_id,
-                                               chunk_id);
+                               ERR("Failed to roll-back the creation of new chunk: session_id = %" PRIu64
+                                   ", chunk_id = %" PRIu64,
+                                   session_id,
+                                   chunk_id);
                        }
 
                        ret_code = LTTCOMM_CONSUMERD_CREATE_TRACE_CHUNK_FAILED;
@@ -4918,11 +4914,13 @@ error:
        return ret_code;
 }
 
-enum lttcomm_return_code lttng_consumer_close_trace_chunk(
-               const uint64_t *relayd_id, uint64_t session_id,
-               uint64_t chunk_id, time_t chunk_close_timestamp,
-               const enum lttng_trace_chunk_command_type *close_command,
-               char *path)
+enum lttcomm_return_code
+lttng_consumer_close_trace_chunk(const uint64_t *relayd_id,
+                                uint64_t session_id,
+                                uint64_t chunk_id,
+                                time_t chunk_close_timestamp,
+                                const enum lttng_trace_chunk_command_type *close_command,
+                                char *path)
 {
        enum lttcomm_return_code ret_code = LTTCOMM_CONSUMERD_SUCCESS;
        struct lttng_trace_chunk *chunk;
@@ -4937,8 +4935,7 @@ enum lttcomm_return_code lttng_consumer_close_trace_chunk(
                int ret;
 
                /* Only used for logging purposes. */
-               ret = snprintf(relayd_id_buffer, sizeof(relayd_id_buffer),
-                               "%" PRIu64, *relayd_id);
+               ret = snprintf(relayd_id_buffer, sizeof(relayd_id_buffer), "%" PRIu64, *relayd_id);
                if (ret > 0 && ret < sizeof(relayd_id_buffer)) {
                        relayd_id_str = relayd_id_buffer;
                } else {
@@ -4946,36 +4943,34 @@ enum lttcomm_return_code lttng_consumer_close_trace_chunk(
                }
        }
        if (close_command) {
-               close_command_name = lttng_trace_chunk_command_type_get_name(
-                               *close_command);
+               close_command_name = lttng_trace_chunk_command_type_get_name(*close_command);
        }
 
        DBG("Consumer close trace chunk command: relayd_id = %s"
-                       ", session_id = %" PRIu64 ", chunk_id = %" PRIu64
-                       ", close command = %s",
-                       relayd_id_str, session_id, chunk_id,
-                       close_command_name);
+           ", session_id = %" PRIu64 ", chunk_id = %" PRIu64 ", close command = %s",
+           relayd_id_str,
+           session_id,
+           chunk_id,
+           close_command_name);
 
        chunk = lttng_trace_chunk_registry_find_chunk(
-                       the_consumer_data.chunk_registry, session_id, chunk_id);
+               the_consumer_data.chunk_registry, session_id, chunk_id);
        if (!chunk) {
-               ERR("Failed to find chunk: session_id = %" PRIu64
-                               ", chunk_id = %" PRIu64,
-                               session_id, chunk_id);
+               ERR("Failed to find chunk: session_id = %" PRIu64 ", chunk_id = %" PRIu64,
+                   session_id,
+                   chunk_id);
                ret_code = LTTCOMM_CONSUMERD_UNKNOWN_TRACE_CHUNK;
                goto end;
        }
 
-       chunk_status = lttng_trace_chunk_set_close_timestamp(chunk,
-                       chunk_close_timestamp);
+       chunk_status = lttng_trace_chunk_set_close_timestamp(chunk, chunk_close_timestamp);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ret_code = LTTCOMM_CONSUMERD_CLOSE_TRACE_CHUNK_FAILED;
                goto end;
        }
 
        if (close_command) {
-               chunk_status = lttng_trace_chunk_set_close_command(
-                               chunk, *close_command);
+               chunk_status = lttng_trace_chunk_set_close_command(chunk, *close_command);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ret_code = LTTCOMM_CONSUMERD_CLOSE_TRACE_CHUNK_FAILED;
                        goto end;
@@ -4988,8 +4983,7 @@ enum lttcomm_return_code lttng_consumer_close_trace_chunk(
         * current chunk found in the session's channels.
         */
        rcu_read_lock();
-       cds_lfht_for_each_entry(the_consumer_data.channel_ht->ht, &iter.iter,
-                       channel, node.node) {
+       cds_lfht_for_each_entry (the_consumer_data.channel_ht->ht, &iter.iter, channel, node.node) {
                int ret;
 
                /*
@@ -5019,13 +5013,10 @@ enum lttcomm_return_code lttng_consumer_close_trace_chunk(
                relayd = consumer_find_relayd(*relayd_id);
                if (relayd) {
                        pthread_mutex_lock(&relayd->ctrl_sock_mutex);
-                       ret = relayd_close_trace_chunk(
-                                       &relayd->control_sock, chunk,
-                                       path);
+                       ret = relayd_close_trace_chunk(&relayd->control_sock, chunk, path);
                        pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
                } else {
-                       ERR("Failed to find relay daemon socket: relayd_id = %" PRIu64,
-                                       *relayd_id);
+                       ERR("Failed to find relay daemon socket: relayd_id = %" PRIu64, *relayd_id);
                }
 
                if (!relayd || ret) {
@@ -5046,9 +5037,8 @@ end:
        return ret_code;
 }
 
-enum lttcomm_return_code lttng_consumer_trace_chunk_exists(
-               const uint64_t *relayd_id, uint64_t session_id,
-               uint64_t chunk_id)
+enum lttcomm_return_code
+lttng_consumer_trace_chunk_exists(const uint64_t *relayd_id, uint64_t session_id, uint64_t chunk_id)
 {
        int ret;
        enum lttcomm_return_code ret_code;
@@ -5060,8 +5050,7 @@ enum lttcomm_return_code lttng_consumer_trace_chunk_exists(
 
        if (relayd_id) {
                /* Only used for logging purposes. */
-               ret = snprintf(relayd_id_buffer, sizeof(relayd_id_buffer),
-                               "%" PRIu64, *relayd_id);
+               ret = snprintf(relayd_id_buffer, sizeof(relayd_id_buffer), "%" PRIu64, *relayd_id);
                if (ret > 0 && ret < sizeof(relayd_id_buffer)) {
                        relayd_id_str = relayd_id_buffer;
                } else {
@@ -5070,19 +5059,18 @@ enum lttcomm_return_code lttng_consumer_trace_chunk_exists(
        }
 
        DBG("Consumer trace chunk exists command: relayd_id = %s"
-                       ", chunk_id = %" PRIu64, relayd_id_str,
-                       chunk_id);
+           ", chunk_id = %" PRIu64,
+           relayd_id_str,
+           chunk_id);
        ret = lttng_trace_chunk_registry_chunk_exists(
-                       the_consumer_data.chunk_registry, session_id, chunk_id,
-                       &chunk_exists_local);
+               the_consumer_data.chunk_registry, session_id, chunk_id, &chunk_exists_local);
        if (ret) {
                /* Internal error. */
                ERR("Failed to query the existence of a trace chunk");
                ret_code = LTTCOMM_CONSUMERD_FATAL;
                goto end;
        }
-       DBG("Trace chunk %s locally",
-                       chunk_exists_local ? "exists" : "does not exist");
+       DBG("Trace chunk %s locally", chunk_exists_local ? "exists" : "does not exist");
        if (chunk_exists_local) {
                ret_code = LTTCOMM_CONSUMERD_TRACE_CHUNK_EXISTS_LOCAL;
                goto end;
@@ -5100,8 +5088,7 @@ enum lttcomm_return_code lttng_consumer_trace_chunk_exists(
        }
        DBG("Looking up existence of trace chunk on relay daemon");
        pthread_mutex_lock(&relayd->ctrl_sock_mutex);
-       ret = relayd_trace_chunk_exists(&relayd->control_sock, chunk_id,
-                       &chunk_exists_remote);
+       ret = relayd_trace_chunk_exists(&relayd->control_sock, chunk_id, &chunk_exists_remote);
        pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
        if (ret < 0) {
                ERR("Failed to look-up the existence of trace chunk on relay daemon");
@@ -5109,11 +5096,9 @@ enum lttcomm_return_code lttng_consumer_trace_chunk_exists(
                goto end_rcu_unlock;
        }
 
-       ret_code = chunk_exists_remote ?
-                       LTTCOMM_CONSUMERD_TRACE_CHUNK_EXISTS_REMOTE :
-                       LTTCOMM_CONSUMERD_UNKNOWN_TRACE_CHUNK;
-       DBG("Trace chunk %s on relay daemon",
-                       chunk_exists_remote ? "exists" : "does not exist");
+       ret_code = chunk_exists_remote ? LTTCOMM_CONSUMERD_TRACE_CHUNK_EXISTS_REMOTE :
+                                        LTTCOMM_CONSUMERD_UNKNOWN_TRACE_CHUNK;
+       DBG("Trace chunk %s on relay daemon", chunk_exists_remote ? "exists" : "does not exist");
 
 end_rcu_unlock:
        rcu_read_unlock();
@@ -5121,8 +5106,7 @@ end:
        return ret_code;
 }
 
-static
-int consumer_clear_monitored_channel(struct lttng_consumer_channel *channel)
+static int consumer_clear_monitored_channel(struct lttng_consumer_channel *channel)
 {
        struct lttng_ht *ht;
        struct lttng_consumer_stream *stream;
@@ -5133,9 +5117,13 @@ int consumer_clear_monitored_channel(struct lttng_consumer_channel *channel)
 
        rcu_read_lock();
        cds_lfht_for_each_entry_duplicate(ht->ht,
-                       ht->hash_fct(&channel->key, lttng_ht_seed),
-                       ht->match_fct, &channel->key,
-                       &iter.iter, stream, node_channel_id.node) {
+                                         ht->hash_fct(&channel->key, lttng_ht_seed),
+                                         ht->match_fct,
+                                         &channel->key,
+                                         &iter.iter,
+                                         stream,
+                                         node_channel_id.node)
+       {
                /*
                 * Protect against teardown with mutex.
                 */
@@ -5185,8 +5173,7 @@ end:
        return ret;
 }
 
-enum lttcomm_return_code lttng_consumer_open_channel_packets(
-               struct lttng_consumer_channel *channel)
+enum lttcomm_return_code lttng_consumer_open_channel_packets(struct lttng_consumer_channel *channel)
 {
        struct lttng_consumer_stream *stream;
        enum lttcomm_return_code ret = LTTCOMM_CONSUMERD_SUCCESS;
@@ -5198,7 +5185,7 @@ enum lttcomm_return_code lttng_consumer_open_channel_packets(
        }
 
        rcu_read_lock();
-       cds_list_for_each_entry(stream, &channel->streams.head, send_node) {
+       cds_list_for_each_entry (stream, &channel->streams.head, send_node) {
                enum consumer_stream_open_packet_status status;
 
                pthread_mutex_lock(&stream->lock);
@@ -5210,16 +5197,18 @@ enum lttcomm_return_code lttng_consumer_open_channel_packets(
                switch (status) {
                case CONSUMER_STREAM_OPEN_PACKET_STATUS_OPENED:
                        DBG("Opened a packet in \"open channel packets\" command: stream id = %" PRIu64
-                                       ", channel name = %s, session id = %" PRIu64,
-                                       stream->key, stream->chan->name,
-                                       stream->chan->session_id);
+                           ", channel name = %s, session id = %" PRIu64,
+                           stream->key,
+                           stream->chan->name,
+                           stream->chan->session_id);
                        stream->opened_packet_in_current_trace_chunk = true;
                        break;
                case CONSUMER_STREAM_OPEN_PACKET_STATUS_NO_SPACE:
                        DBG("No space left to open a packet in \"open channel packets\" command: stream id = %" PRIu64
-                                       ", channel name = %s, session id = %" PRIu64,
-                                       stream->key, stream->chan->name,
-                                       stream->chan->session_id);
+                           ", channel name = %s, session id = %" PRIu64,
+                           stream->key,
+                           stream->chan->name,
+                           stream->chan->session_id);
                        break;
                case CONSUMER_STREAM_OPEN_PACKET_STATUS_ERROR:
                        /*
@@ -5227,11 +5216,12 @@ enum lttcomm_return_code lttng_consumer_open_channel_packets(
                         * failing. Report an unknown error.
                         */
                        ERR("Failed to flush empty buffer in \"open channel packets\" command: stream id = %" PRIu64
-                                       ", channel id = %" PRIu64
-                                       ", channel name = %s"
-                                       ", session id = %" PRIu64,
-                                       stream->key, channel->key,
-                                       channel->name, channel->session_id);
+                           ", channel id = %" PRIu64 ", channel name = %s"
+                           ", session id = %" PRIu64,
+                           stream->key,
+                           channel->key,
+                           channel->name,
+                           channel->session_id);
                        ret = LTTCOMM_CONSUMERD_UNKNOWN_ERROR;
                        goto error_unlock;
                default:
index f9c35e22ce4c4d3e25521c53e02d91dc9694c1eb..dbcc76acb904cf584c7ab867493ffd9d1c158ba6 100644 (file)
@@ -10,8 +10,8 @@
 #include <common/buffer-view.hpp>
 #include <common/consumer/consumer.hpp>
 #include <common/dynamic-buffer.hpp>
-#include <common/macros.hpp>
 #include <common/error.hpp>
+#include <common/macros.hpp>
 
 struct metadata_bucket {
        struct lttng_dynamic_buffer content;
@@ -22,8 +22,7 @@ struct metadata_bucket {
        unsigned int buffer_count;
 };
 
-struct metadata_bucket *metadata_bucket_create(
-               metadata_bucket_flush_cb flush, void *data)
+struct metadata_bucket *metadata_bucket_create(metadata_bucket_flush_cb flush, void *data)
 {
        metadata_bucket *bucket = zmalloc<metadata_bucket>();
        if (!bucket) {
@@ -46,7 +45,8 @@ void metadata_bucket_destroy(struct metadata_bucket *bucket)
 
        if (bucket->content.size > 0) {
                WARN("Stream metadata bucket destroyed with remaining data: size = %zu, buffer count = %u",
-                               bucket->content.size, bucket->buffer_count);
+                    bucket->content.size,
+                    bucket->buffer_count);
        }
 
        lttng_dynamic_buffer_reset(&bucket->content);
@@ -61,24 +61,22 @@ void metadata_bucket_reset(struct metadata_bucket *bucket)
 }
 
 enum metadata_bucket_status metadata_bucket_fill(struct metadata_bucket *bucket,
-               const struct stream_subbuffer *buffer)
+                                                const struct stream_subbuffer *buffer)
 {
        ssize_t ret;
        struct lttng_buffer_view flushed_view;
        struct stream_subbuffer flushed_subbuffer;
        enum metadata_bucket_status status;
-       const bool should_flush =
-                       LTTNG_OPTIONAL_GET(buffer->info.metadata.coherent);
+       const bool should_flush = LTTNG_OPTIONAL_GET(buffer->info.metadata.coherent);
        const size_t padding_this_buffer =
-                       buffer->info.metadata.padded_subbuf_size -
-                       buffer->info.metadata.subbuf_size;
+               buffer->info.metadata.padded_subbuf_size - buffer->info.metadata.subbuf_size;
        size_t flush_size;
 
        DBG("Metadata bucket filled with %zu bytes buffer view, sub-buffer size: %lu, padded sub-buffer size: %lu, coherent: %s",
-                       buffer->buffer.buffer.size,
-                       buffer->info.metadata.subbuf_size,
-                       buffer->info.metadata.padded_subbuf_size,
-                       buffer->info.metadata.coherent.value ? "true" : "false");
+           buffer->buffer.buffer.size,
+           buffer->info.metadata.subbuf_size,
+           buffer->info.metadata.padded_subbuf_size,
+           buffer->info.metadata.coherent.value ? "true" : "false");
        /*
         * If no metadata was accumulated and this buffer should be
         * flushed, don't copy it unecessarily; just flush it directly.
@@ -98,8 +96,7 @@ enum metadata_bucket_status metadata_bucket_fill(struct metadata_bucket *bucket,
                 * the bucket is not sent, which is what really matters
                 * from an efficiency point of view.
                 */
-               ret = lttng_dynamic_buffer_append_view(
-                       &bucket->content, &buffer->buffer.buffer);
+               ret = lttng_dynamic_buffer_append_view(&bucket->content, &buffer->buffer.buffer);
                if (ret) {
                        status = METADATA_BUCKET_STATUS_ERROR;
                        goto end;
@@ -138,8 +135,9 @@ enum metadata_bucket_status metadata_bucket_fill(struct metadata_bucket *bucket,
        };
 
        DBG("Metadata bucket flushing %zu bytes (%u sub-buffer%s)",
-                       flushed_view.size, bucket->buffer_count,
-                       bucket->buffer_count > 1 ? "s" : "");
+           flushed_view.size,
+           bucket->buffer_count,
+           bucket->buffer_count > 1 ? "s" : "");
        ret = bucket->flush.fn(&flushed_subbuffer, bucket->flush.data);
        if (ret >= 0) {
                status = METADATA_BUCKET_STATUS_OK;
index a4111ad9002e9a29fcd073b4b4c6f93b41041040..b85a39abd92f6a19c53ef60e2bb3c7e2d0e77990 100644 (file)
@@ -6,13 +6,14 @@
  */
 
 #include "context.hpp"
-#include <stddef.h>
-#include <string.h>
+
 #include <common/error.hpp>
 #include <common/macros.hpp>
 
-int parse_application_context(const char *str, char **out_provider_name,
-               char **out_ctx_name)
+#include <stddef.h>
+#include <string.h>
+
+int parse_application_context(const char *str, char **out_provider_name, char **out_ctx_name)
 {
        const char app_ctx_prefix[] = "$app.";
        char *provider_name = NULL, *ctx_name = NULL;
@@ -46,8 +47,7 @@ int parse_application_context(const char *str, char **out_provider_name,
         * No colon found or no ctx name ("$app.provider:") or no provider name
         * given ("$app.:..."), which is invalid.
         */
-       if (!colon_pos || colon_pos == len ||
-                       colon_pos == sizeof(app_ctx_prefix)) {
+       if (!colon_pos || colon_pos == len || colon_pos == sizeof(app_ctx_prefix)) {
                goto not_found;
        }
 
@@ -57,8 +57,7 @@ int parse_application_context(const char *str, char **out_provider_name,
                PERROR("malloc provider_name");
                goto not_found;
        }
-       strncpy(provider_name, str + sizeof(app_ctx_prefix) - 1,
-                       provider_name_len - 1);
+       strncpy(provider_name, str + sizeof(app_ctx_prefix) - 1, provider_name_len - 1);
 
        ctx_name_len = len - colon_pos;
        ctx_name = calloc<char>(ctx_name_len);
@@ -76,4 +75,3 @@ not_found:
        free(ctx_name);
        return -1;
 }
-
index f936736db4919760dcc5c42094c35497d25ddb7b..6c9d258aeb6567ded9ff58f5f10dbc7c0f73117c 100644 (file)
@@ -5,9 +5,10 @@
  *
  */
 
-#include <stdbool.h>
 #include "credentials.hpp"
 
+#include <stdbool.h>
+
 uid_t lttng_credentials_get_uid(const struct lttng_credentials *creds)
 {
        return LTTNG_OPTIONAL_GET(creds->uid);
@@ -19,7 +20,7 @@ gid_t lttng_credentials_get_gid(const struct lttng_credentials *creds)
 }
 
 bool lttng_credentials_is_equal_uid(const struct lttng_credentials *a,
-               const struct lttng_credentials *b)
+                                   const struct lttng_credentials *b)
 {
        LTTNG_ASSERT(a);
        LTTNG_ASSERT(b);
@@ -38,7 +39,7 @@ bool lttng_credentials_is_equal_uid(const struct lttng_credentials *a,
 }
 
 bool lttng_credentials_is_equal_gid(const struct lttng_credentials *a,
-               const struct lttng_credentials *b)
+                                   const struct lttng_credentials *b)
 {
        LTTNG_ASSERT(a);
        LTTNG_ASSERT(b);
@@ -57,11 +58,10 @@ bool lttng_credentials_is_equal_gid(const struct lttng_credentials *a,
 }
 
 bool lttng_credentials_is_equal(const struct lttng_credentials *a,
-               const struct lttng_credentials *b)
+                               const struct lttng_credentials *b)
 {
        LTTNG_ASSERT(a);
        LTTNG_ASSERT(b);
 
-       return lttng_credentials_is_equal_uid(a, b) &&
-                       lttng_credentials_is_equal_gid(a, b);
+       return lttng_credentials_is_equal_uid(a, b) && lttng_credentials_is_equal_gid(a, b);
 }
index 0ed35556e81a52a87c8a94e8295e10a1fd1f3eca..489f0144c8fbc26ce489d70efbaefdeb71854f04 100644 (file)
@@ -7,19 +7,17 @@
  */
 
 #define _LGPL_SOURCE
-#include <unistd.h>
 #include <common/compat/paths.hpp>
+#include <common/daemonize.hpp>
+#include <common/error.hpp>
+
 #include <fcntl.h>
-#include <sys/wait.h>
 #include <stdlib.h>
-
+#include <sys/wait.h>
+#include <unistd.h>
 #include <urcu/system.h>
 
-#include <common/daemonize.hpp>
-#include <common/error.hpp>
-
-int lttng_daemonize(pid_t *child_ppid, int *completion_flag,
-               int close_fds)
+int lttng_daemonize(pid_t *child_ppid, int *completion_flag, int close_fds)
 {
        pid_t pid;
 
index d79e42a6b63b5a35490f42798412b98c68417d59..05a8b9cfa0baa4febfa5015621bc13a62e9135d7 100644 (file)
@@ -6,16 +6,16 @@
  */
 
 #define _LGPL_SOURCE
-#include <stddef.h>
-#include <unistd.h>
-#include <stdbool.h>
-#include <sys/resource.h>
-#include <pthread.h>
-#include <algorithm>
-
 #include "defaults.hpp"
-#include "macros.hpp"
 #include "error.hpp"
+#include "macros.hpp"
+
+#include <algorithm>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <sys/resource.h>
+#include <unistd.h>
 
 static int pthread_attr_init_done;
 static pthread_attr_t tattr;
@@ -90,16 +90,15 @@ static void __attribute__((constructor)) init_default_pthread_attr(void)
                goto error_destroy;
        }
        DBG("Stack size limits: soft %lld, hard %lld bytes",
-                       (long long) rlim.rlim_cur,
-                       (long long) rlim.rlim_max);
+           (long long) rlim.rlim_cur,
+           (long long) rlim.rlim_max);
 
        /*
         * getrlimit() may return a stack size of "-1", meaning "unlimited".
         * In this case, we impose a known-good default minimum value which will
         * override the libc's default stack size if it is smaller.
         */
-       system_ss = rlim.rlim_cur != -1 ? rlim.rlim_cur :
-                       DEFAULT_LTTNG_THREAD_STACK_SIZE;
+       system_ss = rlim.rlim_cur != -1 ? rlim.rlim_cur : DEFAULT_LTTNG_THREAD_STACK_SIZE;
 
        /* Get pthread default thread stack size. */
        ret = pthread_attr_getstacksize(&tattr, &pthread_ss);
@@ -112,13 +111,14 @@ static void __attribute__((constructor)) init_default_pthread_attr(void)
        selected_ss = std::max(pthread_ss, system_ss);
        if (selected_ss < DEFAULT_LTTNG_THREAD_STACK_SIZE) {
                DBG("Default stack size is too small, setting it to %zu bytes",
-                       (size_t) DEFAULT_LTTNG_THREAD_STACK_SIZE);
+                   (size_t) DEFAULT_LTTNG_THREAD_STACK_SIZE);
                selected_ss = DEFAULT_LTTNG_THREAD_STACK_SIZE;
        }
 
        if (rlim.rlim_max > 0 && selected_ss > rlim.rlim_max) {
                WARN("Your system's stack size restrictions (%zu bytes) may be too low for the LTTng daemons to function properly, please set the stack size limit to at least %zu bytes to ensure reliable operation",
-                       (size_t) rlim.rlim_max, (size_t) DEFAULT_LTTNG_THREAD_STACK_SIZE);
+                    (size_t) rlim.rlim_max,
+                    (size_t) DEFAULT_LTTNG_THREAD_STACK_SIZE);
                selected_ss = (size_t) rlim.rlim_max;
        }
 
index 2c39c66e1ac6e4459a2860e09bb833f9034ecf25..768c7a310bd28c2fb2aac87c85808e0676224257 100644 (file)
@@ -5,8 +5,8 @@
  *
  */
 
-#include "lttng/domain-internal.hpp"
 #include "common/macros.hpp"
+#include "lttng/domain-internal.hpp"
 
 const char *lttng_domain_type_str(enum lttng_domain_type domain_type)
 {
index ddc691bb13e76f4e5d0472584f5568b83633f523..030dd459d5dcaea729217b89f0aaad880d5e4b89 100644 (file)
@@ -8,8 +8,8 @@
 #include <common/dynamic-array.hpp>
 
 void lttng_dynamic_array_init(struct lttng_dynamic_array *array,
-               size_t element_size,
-               lttng_dynamic_array_element_destructor destructor)
+                             size_t element_size,
+                             lttng_dynamic_array_element_destructor destructor)
 {
        lttng_dynamic_buffer_init(&array->buffer);
        array->element_size = element_size;
@@ -17,8 +17,7 @@ void lttng_dynamic_array_init(struct lttng_dynamic_array *array,
        array->destructor = destructor;
 }
 
-int lttng_dynamic_array_set_count(struct lttng_dynamic_array *array,
-               size_t new_element_count)
+int lttng_dynamic_array_set_count(struct lttng_dynamic_array *array, size_t new_element_count)
 {
        int ret;
 
@@ -31,8 +30,7 @@ int lttng_dynamic_array_set_count(struct lttng_dynamic_array *array,
                size_t i;
 
                for (i = new_element_count; i < array->size; i++) {
-                       void *element = lttng_dynamic_array_get_element(
-                                       array, i);
+                       void *element = lttng_dynamic_array_get_element(array, i);
 
                        array->destructor(element);
                }
@@ -40,13 +38,12 @@ int lttng_dynamic_array_set_count(struct lttng_dynamic_array *array,
 
        array->size = new_element_count;
        ret = lttng_dynamic_buffer_set_size(&array->buffer,
-                       new_element_count * array->element_size);
+                                           new_element_count * array->element_size);
 end:
        return ret;
 }
 
-int lttng_dynamic_array_add_element(struct lttng_dynamic_array *array,
-               const void *element)
+int lttng_dynamic_array_add_element(struct lttng_dynamic_array *array, const void *element)
 {
        int ret;
 
@@ -55,8 +52,7 @@ int lttng_dynamic_array_add_element(struct lttng_dynamic_array *array,
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&array->buffer, element,
-                       array->element_size);
+       ret = lttng_dynamic_buffer_append(&array->buffer, element, array->element_size);
        if (ret) {
                goto end;
        }
@@ -65,25 +61,23 @@ end:
        return ret;
 }
 
-int lttng_dynamic_array_remove_element(struct lttng_dynamic_array *array,
-               size_t element_index)
+int lttng_dynamic_array_remove_element(struct lttng_dynamic_array *array, size_t element_index)
 {
-       void *element = lttng_dynamic_array_get_element(array,
-                       element_index);
+       void *element = lttng_dynamic_array_get_element(array, element_index);
 
        if (array->destructor) {
                array->destructor(element);
        }
        if (element_index != lttng_dynamic_array_get_count(array) - 1) {
-               void *next_element = lttng_dynamic_array_get_element(array,
-                               element_index + 1);
+               void *next_element = lttng_dynamic_array_get_element(array, element_index + 1);
 
-               memmove(element, next_element,
-                               (array->size - element_index - 1) * array->element_size);
+               memmove(element,
+                       next_element,
+                       (array->size - element_index - 1) * array->element_size);
        }
        array->size--;
        return lttng_dynamic_buffer_set_size(&array->buffer,
-                       array->buffer.size - array->element_size);
+                                            array->buffer.size - array->element_size);
 }
 
 void lttng_dynamic_array_reset(struct lttng_dynamic_array *array)
@@ -92,8 +86,7 @@ void lttng_dynamic_array_reset(struct lttng_dynamic_array *array)
                size_t i;
 
                for (i = 0; i < lttng_dynamic_array_get_count(array); i++) {
-                       array->destructor(lttng_dynamic_array_get_element(array,
-                                       i));
+                       array->destructor(lttng_dynamic_array_get_element(array, i));
                }
        }
 
@@ -107,8 +100,7 @@ void lttng_dynamic_array_clear(struct lttng_dynamic_array *array)
                size_t i;
 
                for (i = 0; i < lttng_dynamic_array_get_count(array); i++) {
-                       array->destructor(lttng_dynamic_array_get_element(array,
-                                       i));
+                       array->destructor(lttng_dynamic_array_get_element(array, i));
                }
        }
 
@@ -116,19 +108,17 @@ void lttng_dynamic_array_clear(struct lttng_dynamic_array *array)
        array->size = 0;
 }
 
-void lttng_dynamic_pointer_array_init(
-               struct lttng_dynamic_pointer_array *array,
-               lttng_dynamic_pointer_array_destructor destructor)
+void lttng_dynamic_pointer_array_init(struct lttng_dynamic_pointer_array *array,
+                                     lttng_dynamic_pointer_array_destructor destructor)
 {
        lttng_dynamic_array_init(&array->array, sizeof(void *), destructor);
-}      
+}
 
-int lttng_dynamic_pointer_array_remove_pointer(
-               struct lttng_dynamic_pointer_array *array, size_t index)
+int lttng_dynamic_pointer_array_remove_pointer(struct lttng_dynamic_pointer_array *array,
+                                              size_t index)
 {
        int ret;
-       const lttng_dynamic_array_element_destructor destructor =
-                       array->array.destructor;
+       const lttng_dynamic_array_element_destructor destructor = array->array.destructor;
 
        /*
         * Prevent the destructor from being used by the underlying
@@ -136,8 +126,7 @@ int lttng_dynamic_pointer_array_remove_pointer(
         */
        array->array.destructor = NULL;
        if (destructor) {
-               destructor(lttng_dynamic_pointer_array_get_pointer(array,
-                               index));
+               destructor(lttng_dynamic_pointer_array_get_pointer(array, index));
        }
        ret = lttng_dynamic_array_remove_element(&array->array, index);
        array->array.destructor = destructor;
@@ -145,15 +134,13 @@ int lttng_dynamic_pointer_array_remove_pointer(
 }
 
 /* Release any memory used by the dynamic array. */
-void lttng_dynamic_pointer_array_reset(
-               struct lttng_dynamic_pointer_array *array)
+void lttng_dynamic_pointer_array_reset(struct lttng_dynamic_pointer_array *array)
 {
        if (array->array.destructor) {
                size_t i, count = lttng_dynamic_pointer_array_get_count(array);
 
                for (i = 0; i < count; i++) {
-                       void *ptr = lttng_dynamic_pointer_array_get_pointer(
-                                       array, i);
+                       void *ptr = lttng_dynamic_pointer_array_get_pointer(array, i);
                        array->array.destructor(ptr);
                }
                /*
@@ -165,11 +152,9 @@ void lttng_dynamic_pointer_array_reset(
        lttng_dynamic_array_reset(&array->array);
 }
 
-void lttng_dynamic_pointer_array_clear(
-               struct lttng_dynamic_pointer_array *array)
+void lttng_dynamic_pointer_array_clear(struct lttng_dynamic_pointer_array *array)
 {
-       const lttng_dynamic_array_element_destructor destructor =
-                       array->array.destructor;
+       const lttng_dynamic_array_element_destructor destructor = array->array.destructor;
 
        /*
         * Prevent the destructor from being used by the underlying
@@ -180,8 +165,7 @@ void lttng_dynamic_pointer_array_clear(
                size_t i, count = lttng_dynamic_pointer_array_get_count(array);
 
                for (i = 0; i < count; i++) {
-                       void *ptr = lttng_dynamic_pointer_array_get_pointer(
-                                       array, i);
+                       void *ptr = lttng_dynamic_pointer_array_get_pointer(array, i);
                        destructor(ptr);
                }
        }
index a12e1485d02132b77b60d153062c1b06879d21d1..be6257720c882f6782a46760272f705da12e594c 100644 (file)
@@ -5,16 +5,15 @@
  *
  */
 
-#include <common/dynamic-buffer.hpp>
 #include <common/buffer-view.hpp>
+#include <common/dynamic-buffer.hpp>
 #include <common/utils.hpp>
 
 /*
  * Round to (upper) power of two, val is returned if it already is a power of
  * two.
  */
-static
-size_t round_to_power_of_2(size_t val)
+static size_t round_to_power_of_2(size_t val)
 {
        size_t rounded;
        const int order = utils_get_count_order_u64(val);
@@ -32,8 +31,7 @@ void lttng_dynamic_buffer_init(struct lttng_dynamic_buffer *buffer)
        memset(buffer, 0, sizeof(*buffer));
 }
 
-int lttng_dynamic_buffer_append(struct lttng_dynamic_buffer *buffer,
-               const void *buf, size_t len)
+int lttng_dynamic_buffer_append(struct lttng_dynamic_buffer *buffer, const void *buf, size_t len)
 {
        int ret = 0;
 
@@ -49,9 +47,8 @@ int lttng_dynamic_buffer_append(struct lttng_dynamic_buffer *buffer,
 
        LTTNG_ASSERT(buffer->_capacity >= buffer->size);
        if (buffer->_capacity < (len + buffer->size)) {
-               ret = lttng_dynamic_buffer_set_capacity(buffer,
-                               buffer->_capacity +
-                               (len - (buffer->_capacity - buffer->size)));
+               ret = lttng_dynamic_buffer_set_capacity(
+                       buffer, buffer->_capacity + (len - (buffer->_capacity - buffer->size)));
                if (ret) {
                        goto end;
                }
@@ -64,7 +61,7 @@ end:
 }
 
 int lttng_dynamic_buffer_append_buffer(struct lttng_dynamic_buffer *dst_buffer,
-               const struct lttng_dynamic_buffer *src_buffer)
+                                      const struct lttng_dynamic_buffer *src_buffer)
 {
        int ret;
 
@@ -73,14 +70,13 @@ int lttng_dynamic_buffer_append_buffer(struct lttng_dynamic_buffer *dst_buffer,
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(dst_buffer, src_buffer->data,
-                       src_buffer->size);
+       ret = lttng_dynamic_buffer_append(dst_buffer, src_buffer->data, src_buffer->size);
 end:
        return ret;
 }
 
 int lttng_dynamic_buffer_append_view(struct lttng_dynamic_buffer *buffer,
-               const struct lttng_buffer_view *src)
+                                    const struct lttng_buffer_view *src)
 {
        int ret;
 
@@ -89,14 +85,12 @@ int lttng_dynamic_buffer_append_view(struct lttng_dynamic_buffer *buffer,
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(buffer, src->data,
-                       src->size);
+       ret = lttng_dynamic_buffer_append(buffer, src->data, src->size);
 end:
        return ret;
 }
 
-int lttng_dynamic_buffer_set_size(struct lttng_dynamic_buffer *buffer,
-               size_t new_size)
+int lttng_dynamic_buffer_set_size(struct lttng_dynamic_buffer *buffer, size_t new_size)
 {
        int ret = 0;
 
@@ -134,13 +128,11 @@ end:
        return ret;
 }
 
-int lttng_dynamic_buffer_set_capacity(struct lttng_dynamic_buffer *buffer,
-               size_t demanded_capacity)
+int lttng_dynamic_buffer_set_capacity(struct lttng_dynamic_buffer *buffer, size_t demanded_capacity)
 {
        int ret = 0;
        void *new_buf;
-       size_t new_capacity = demanded_capacity ?
-                       round_to_power_of_2(demanded_capacity) : 0;
+       size_t new_capacity = demanded_capacity ? round_to_power_of_2(demanded_capacity) : 0;
 
        if (!buffer || demanded_capacity < buffer->size) {
                /*
@@ -181,8 +173,7 @@ void lttng_dynamic_buffer_reset(struct lttng_dynamic_buffer *buffer)
        buffer->data = NULL;
 }
 
-size_t lttng_dynamic_buffer_get_capacity_left(
-               struct lttng_dynamic_buffer *buffer)
+size_t lttng_dynamic_buffer_get_capacity_left(struct lttng_dynamic_buffer *buffer)
 {
        if (!buffer) {
                return 0;
index 52d3d22d315fabfdcbd711544e869520a4b48b22..8724c156962b1443f7adc2200252fd7db13969df 100644 (file)
@@ -7,18 +7,16 @@
 
 #include <lttng/endpoint-internal.hpp>
 
-static
-struct lttng_endpoint lttng_session_daemon_notification_endpoint_instance = {
+static struct lttng_endpoint lttng_session_daemon_notification_endpoint_instance = {
        .type = LTTNG_ENDPOINT_TYPE_DEFAULT_SESSIOND_NOTIFICATION,
 };
 
-static
-struct lttng_endpoint lttng_session_daemon_command_endpoint_instance = {
+static struct lttng_endpoint lttng_session_daemon_command_endpoint_instance = {
        .type = LTTNG_ENDPOINT_TYPE_DEFAULT_SESSIOND_COMMAND,
 };
 
 struct lttng_endpoint *lttng_session_daemon_notification_endpoint =
-               &lttng_session_daemon_notification_endpoint_instance;
+       &lttng_session_daemon_notification_endpoint_instance;
 
 struct lttng_endpoint *lttng_session_daemon_command_endpoint =
-               &lttng_session_daemon_command_endpoint_instance;
+       &lttng_session_daemon_command_endpoint_instance;
index d3831ae81b86bf6c509c42818119fc937394cde2..ca9eb6dd28b70f6b831c4b851dbcaf6278f07223 100644 (file)
 #include <common/macros.hpp>
 #include <common/mi-lttng.hpp>
 #include <common/sessiond-comm/sessiond-comm.hpp>
+
 #include <lttng/action/action-internal.hpp>
 #include <lttng/action/list-internal.hpp>
 #include <lttng/action/path-internal.hpp>
 #include <lttng/error-query-internal.hpp>
 #include <lttng/error-query.h>
 #include <lttng/trigger/trigger-internal.hpp>
+
 #include <stddef.h>
 
 struct lttng_error_query {
@@ -88,18 +90,15 @@ struct lttng_error_query_results_comm {
 } LTTNG_PACKED;
 } /* namespace */
 
-static
-enum lttng_error_code lttng_error_query_result_mi_serialize(
-               const struct lttng_error_query_result *result,
-               struct mi_writer *writer);
+static enum lttng_error_code
+lttng_error_query_result_mi_serialize(const struct lttng_error_query_result *result,
+                                     struct mi_writer *writer);
 
-static
-enum lttng_error_code lttng_error_query_result_counter_mi_serialize(
-               const struct lttng_error_query_result *result,
-               struct mi_writer *writer);
+static enum lttng_error_code
+lttng_error_query_result_counter_mi_serialize(const struct lttng_error_query_result *result,
+                                             struct mi_writer *writer);
 
-struct lttng_error_query *lttng_error_query_trigger_create(
-               const struct lttng_trigger *trigger)
+struct lttng_error_query *lttng_error_query_trigger_create(const struct lttng_trigger *trigger)
 {
        struct lttng_error_query_trigger *query = NULL;
        struct lttng_trigger *trigger_copy = NULL;
@@ -129,8 +128,7 @@ end:
        return query ? &query->parent : NULL;
 }
 
-struct lttng_error_query *lttng_error_query_condition_create(
-               const struct lttng_trigger *trigger)
+struct lttng_error_query *lttng_error_query_condition_create(const struct lttng_trigger *trigger)
 {
        struct lttng_error_query_condition *query = NULL;
        struct lttng_trigger *trigger_copy = NULL;
@@ -160,17 +158,15 @@ end:
        return query ? &query->parent : NULL;
 }
 
-static
-struct lttng_action *get_trigger_action_from_path(
-               struct lttng_trigger *trigger,
-               const struct lttng_action_path *action_path)
+static struct lttng_action *
+get_trigger_action_from_path(struct lttng_trigger *trigger,
+                            const struct lttng_action_path *action_path)
 {
        size_t index_count, i;
        enum lttng_action_path_status path_status;
        struct lttng_action *current_action = NULL;
 
-       path_status = lttng_action_path_get_index_count(
-                       action_path, &index_count);
+       path_status = lttng_action_path_get_index_count(action_path, &index_count);
        if (path_status != LTTNG_ACTION_PATH_STATUS_OK) {
                goto end;
        }
@@ -179,10 +175,9 @@ struct lttng_action *get_trigger_action_from_path(
        for (i = 0; i < index_count; i++) {
                uint64_t path_index;
 
-               path_status = lttng_action_path_get_index_at_index(
-                               action_path, i, &path_index);
-               current_action = lttng_action_list_borrow_mutable_at_index(
-                               current_action, path_index);
+               path_status = lttng_action_path_get_index_at_index(action_path, i, &path_index);
+               current_action =
+                       lttng_action_list_borrow_mutable_at_index(current_action, path_index);
                if (!current_action) {
                        /* Invalid action path. */
                        goto end;
@@ -193,28 +188,25 @@ end:
        return current_action;
 }
 
-static
-bool is_valid_action_path(const struct lttng_trigger *trigger,
-               const struct lttng_action_path *action_path)
+static bool is_valid_action_path(const struct lttng_trigger *trigger,
+                                const struct lttng_action_path *action_path)
 {
        /*
         * While 'trigger's constness is casted-away, the trigger and resulting
         * action are not modified; we merely check for the action's existence.
         */
-       return !!get_trigger_action_from_path(
-                       (struct lttng_trigger *) trigger, action_path);
+       return !!get_trigger_action_from_path((struct lttng_trigger *) trigger, action_path);
 }
 
-struct lttng_error_query *lttng_error_query_action_create(
-               const struct lttng_trigger *trigger,
-               const struct lttng_action_path *action_path)
+struct lttng_error_query *
+lttng_error_query_action_create(const struct lttng_trigger *trigger,
+                               const struct lttng_action_path *action_path)
 {
        struct lttng_error_query_action *query = NULL;
        struct lttng_trigger *trigger_copy = NULL;
        int ret_copy;
 
-       if (!trigger || !action_path ||
-                       !is_valid_action_path(trigger, action_path)) {
+       if (!trigger || !action_path || !is_valid_action_path(trigger, action_path)) {
                goto end;
        }
 
@@ -256,7 +248,7 @@ void lttng_error_query_destroy(struct lttng_error_query *query)
        case LTTNG_ERROR_QUERY_TARGET_TYPE_TRIGGER:
        {
                struct lttng_error_query_trigger *trigger_query =
-                               lttng::utils::container_of(query, &lttng_error_query_trigger::parent);
+                       lttng::utils::container_of(query, &lttng_error_query_trigger::parent);
 
                lttng_trigger_put(trigger_query->trigger);
                free(trigger_query);
@@ -264,8 +256,8 @@ void lttng_error_query_destroy(struct lttng_error_query *query)
        }
        case LTTNG_ERROR_QUERY_TARGET_TYPE_CONDITION:
        {
-               struct lttng_error_query_condition *condition_query = lttng::utils::container_of(
-                               query, &lttng_error_query_condition::parent);
+               struct lttng_error_query_condition *condition_query =
+                       lttng::utils::container_of(query, &lttng_error_query_condition::parent);
 
                lttng_trigger_put(condition_query->trigger);
                free(condition_query);
@@ -273,8 +265,8 @@ void lttng_error_query_destroy(struct lttng_error_query *query)
        }
        case LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION:
        {
-               struct lttng_error_query_action *action_query = lttng::utils::container_of(
-                               query, &lttng_error_query_action::parent);
+               struct lttng_error_query_action *action_query =
+                       lttng::utils::container_of(query, &lttng_error_query_action::parent);
 
                lttng_trigger_put(action_query->trigger);
                lttng_action_path_destroy(action_query->action_path);
@@ -286,29 +278,25 @@ void lttng_error_query_destroy(struct lttng_error_query *query)
        }
 }
 
-static
-int lttng_error_query_result_counter_serialize(
-               const struct lttng_error_query_result *result,
-               struct lttng_payload *payload)
+static int lttng_error_query_result_counter_serialize(const struct lttng_error_query_result *result,
+                                                     struct lttng_payload *payload)
 {
        const struct lttng_error_query_result_counter *counter_result;
 
        LTTNG_ASSERT(result->type == LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER);
-       counter_result = lttng::utils::container_of(
-                       result, &lttng_error_query_result_counter::parent);
+       counter_result =
+               lttng::utils::container_of(result, &lttng_error_query_result_counter::parent);
 
        lttng_error_query_result_counter_comm comm = {
                .value = counter_result->value,
        };
 
-       return lttng_dynamic_buffer_append(&payload->buffer,
-                       &comm,
-                       sizeof(struct lttng_error_query_result_counter_comm));
+       return lttng_dynamic_buffer_append(
+               &payload->buffer, &comm, sizeof(struct lttng_error_query_result_counter_comm));
 }
 
-int lttng_error_query_result_serialize(
-               const struct lttng_error_query_result *result,
-               struct lttng_payload *payload)
+int lttng_error_query_result_serialize(const struct lttng_error_query_result *result,
+                                      struct lttng_payload *payload)
 {
        int ret;
        struct lttng_error_query_result_comm header;
@@ -318,24 +306,22 @@ int lttng_error_query_result_serialize(
        header.description_len = (typeof(header.name_len)) strlen(result->description) + 1;
 
        /* Header. */
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &header, sizeof(header));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &header, sizeof(header));
        if (ret) {
                ERR("Failed to append error query result communication header to payload");
                goto end;
        }
 
        /* Name. */
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, result->name, header.name_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, result->name, header.name_len);
        if (ret) {
                ERR("Failed to append error query result name to payload");
                goto end;
        }
 
        /* Description. */
-       ret = lttng_dynamic_buffer_append(&payload->buffer, result->description,
-                       header.description_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, result->description, header.description_len);
        if (ret) {
                ERR("Failed to append error query result description to payload");
                goto end;
@@ -344,8 +330,7 @@ int lttng_error_query_result_serialize(
        /* Type-specific payload. */
        switch (result->type) {
        case LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER:
-               ret = lttng_error_query_result_counter_serialize(
-                               result, payload);
+               ret = lttng_error_query_result_counter_serialize(result, payload);
                if (ret) {
                        ERR("Failed to serialize counter error query result");
                        goto end;
@@ -359,12 +344,10 @@ end:
        return ret;
 }
 
-static
-int lttng_error_query_result_init(
-               struct lttng_error_query_result *result,
-               enum lttng_error_query_result_type result_type,
-               const char *name,
-               const char *description)
+static int lttng_error_query_result_init(struct lttng_error_query_result *result,
+                                        enum lttng_error_query_result_type result_type,
+                                        const char *name,
+                                        const char *description)
 {
        int ret;
 
@@ -412,8 +395,7 @@ void lttng_error_query_result_destroy(struct lttng_error_query_result *counter)
 }
 
 struct lttng_error_query_result *
-lttng_error_query_result_counter_create(
-               const char *name, const char *description, uint64_t value)
+lttng_error_query_result_counter_create(const char *name, const char *description, uint64_t value)
 {
        int init_ret;
        struct lttng_error_query_result_counter *counter;
@@ -424,9 +406,8 @@ lttng_error_query_result_counter_create(
                goto end;
        }
 
-       init_ret = lttng_error_query_result_init(&counter->parent,
-                       LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER, name,
-                       description);
+       init_ret = lttng_error_query_result_init(
+               &counter->parent, LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER, name, description);
        if (init_ret) {
                goto error;
        }
@@ -439,8 +420,7 @@ end:
        return counter ? &counter->parent : NULL;
 }
 
-static
-void destroy_result(void *ptr)
+static void destroy_result(void *ptr)
 {
        struct lttng_error_query_result *result = (typeof(result)) ptr;
 
@@ -461,22 +441,19 @@ end:
        return set;
 }
 
-int lttng_error_query_results_add_result(
-               struct lttng_error_query_results *results,
-               struct lttng_error_query_result *result)
+int lttng_error_query_results_add_result(struct lttng_error_query_results *results,
+                                        struct lttng_error_query_result *result)
 {
-       return lttng_dynamic_pointer_array_add_pointer(
-                       &results->results, result);
+       return lttng_dynamic_pointer_array_add_pointer(&results->results, result);
 }
 
-ssize_t lttng_error_query_result_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_error_query_result **result)
+ssize_t lttng_error_query_result_create_from_payload(struct lttng_payload_view *view,
+                                                    struct lttng_error_query_result **result)
 {
        ssize_t used_size = 0;
        struct lttng_error_query_result_comm *header;
        struct lttng_payload_view header_view =
-                       lttng_payload_view_from_view(view, 0, sizeof(*header));
+               lttng_payload_view_from_view(view, 0, sizeof(*header));
        const char *name;
        const char *description;
 
@@ -490,14 +467,11 @@ ssize_t lttng_error_query_result_create_from_payload(
 
        {
                struct lttng_payload_view name_view =
-                               lttng_payload_view_from_view(view, used_size,
-                                               header->name_len);
+                       lttng_payload_view_from_view(view, used_size, header->name_len);
 
                if (!lttng_payload_view_is_valid(&name_view) ||
-                               !lttng_buffer_view_contains_string(
-                                               &name_view.buffer,
-                                               name_view.buffer.data,
-                                               header->name_len)) {
+                   !lttng_buffer_view_contains_string(
+                           &name_view.buffer, name_view.buffer.data, header->name_len)) {
                        used_size = -1;
                        goto end;
                }
@@ -508,14 +482,12 @@ ssize_t lttng_error_query_result_create_from_payload(
 
        {
                struct lttng_payload_view description_view =
-                               lttng_payload_view_from_view(view, used_size,
-                                               header->description_len);
+                       lttng_payload_view_from_view(view, used_size, header->description_len);
 
                if (!lttng_payload_view_is_valid(&description_view) ||
-                               !lttng_buffer_view_contains_string(
-                                               &description_view.buffer,
-                                               description_view.buffer.data,
-                                               header->description_len)) {
+                   !lttng_buffer_view_contains_string(&description_view.buffer,
+                                                      description_view.buffer.data,
+                                                      header->description_len)) {
                        used_size = -1;
                        goto end;
                }
@@ -529,8 +501,7 @@ ssize_t lttng_error_query_result_create_from_payload(
        {
                struct lttng_error_query_result_counter_comm *counter;
                struct lttng_payload_view counter_payload_view =
-                               lttng_payload_view_from_view(view, used_size,
-                                               sizeof(*counter));
+                       lttng_payload_view_from_view(view, used_size, sizeof(*counter));
 
                if (!lttng_payload_view_is_valid(&counter_payload_view)) {
                        used_size = -1;
@@ -538,8 +509,8 @@ ssize_t lttng_error_query_result_create_from_payload(
                }
 
                counter = (typeof(counter)) counter_payload_view.buffer.data;
-               *result = lttng_error_query_result_counter_create(
-                               name, description, counter->value);
+               *result =
+                       lttng_error_query_result_counter_create(name, description, counter->value);
                if (!*result) {
                        used_size = -1;
                        goto end;
@@ -557,14 +528,12 @@ end:
        return used_size;
 }
 
-int lttng_error_query_results_serialize(
-               const struct lttng_error_query_results *results,
-               struct lttng_payload *payload)
+int lttng_error_query_results_serialize(const struct lttng_error_query_results *results,
+                                       struct lttng_payload *payload)
 {
        int ret;
        size_t result_index;
-       const size_t result_count = lttng_dynamic_pointer_array_get_count(
-                       &results->results);
+       const size_t result_count = lttng_dynamic_pointer_array_get_count(&results->results);
        struct lttng_error_query_results_comm header;
 
        header.count = (decltype(header.count)) result_count;
@@ -578,10 +547,9 @@ int lttng_error_query_results_serialize(
 
        /* Results. */
        for (result_index = 0; result_index < result_count; result_index++) {
-               const struct lttng_error_query_result *result = (typeof(result))
-                               lttng_dynamic_pointer_array_get_pointer(
-                                               &results->results,
-                                               result_index);
+               const struct lttng_error_query_result *result =
+                       (typeof(result)) lttng_dynamic_pointer_array_get_pointer(&results->results,
+                                                                                result_index);
 
                ret = lttng_error_query_result_serialize(result, payload);
                if (ret) {
@@ -593,15 +561,14 @@ end:
        return ret;
 }
 
-ssize_t lttng_error_query_results_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_error_query_results **_results)
+ssize_t lttng_error_query_results_create_from_payload(struct lttng_payload_view *view,
+                                                     struct lttng_error_query_results **_results)
 {
        size_t result_index;
        ssize_t total_used_size = 0;
        struct lttng_error_query_results_comm *header;
        struct lttng_payload_view header_view =
-                       lttng_payload_view_from_view(view, 0, sizeof(*header));
+               lttng_payload_view_from_view(view, 0, sizeof(*header));
        struct lttng_error_query_results *results = NULL;
 
        if (!lttng_payload_view_is_valid(&header_view)) {
@@ -622,16 +589,14 @@ ssize_t lttng_error_query_results_create_from_payload(
                ssize_t used_size;
                struct lttng_error_query_result *result;
                struct lttng_payload_view result_view =
-                               lttng_payload_view_from_view(
-                                               view, total_used_size, -1);
+                       lttng_payload_view_from_view(view, total_used_size, -1);
 
                if (!lttng_payload_view_is_valid(&result_view)) {
                        total_used_size = -1;
                        goto end;
                }
 
-               used_size = lttng_error_query_result_create_from_payload(
-                               &result_view, &result);
+               used_size = lttng_error_query_result_create_from_payload(&result_view, &result);
                if (used_size < 0) {
                        total_used_size = -1;
                        goto end;
@@ -639,8 +604,7 @@ ssize_t lttng_error_query_results_create_from_payload(
 
                total_used_size += used_size;
 
-               if (lttng_dynamic_pointer_array_add_pointer(
-                                   &results->results, result)) {
+               if (lttng_dynamic_pointer_array_add_pointer(&results->results, result)) {
                        lttng_error_query_result_destroy(result);
                        total_used_size = -1;
                        goto end;
@@ -654,13 +618,12 @@ end:
        return total_used_size;
 }
 
-static
-int lttng_error_query_trigger_serialize(const struct lttng_error_query *query,
-               struct lttng_payload *payload)
+static int lttng_error_query_trigger_serialize(const struct lttng_error_query *query,
+                                              struct lttng_payload *payload)
 {
        int ret;
        const struct lttng_error_query_trigger *query_trigger =
-                       lttng::utils::container_of(query, &lttng_error_query_trigger::parent);
+               lttng::utils::container_of(query, &lttng_error_query_trigger::parent);
 
        if (!lttng_trigger_validate(query_trigger->trigger)) {
                ret = -1;
@@ -676,13 +639,12 @@ end:
        return ret;
 }
 
-static
-int lttng_error_query_condition_serialize(const struct lttng_error_query *query,
-               struct lttng_payload *payload)
+static int lttng_error_query_condition_serialize(const struct lttng_error_query *query,
+                                                struct lttng_payload *payload)
 {
        int ret;
        const struct lttng_error_query_condition *query_trigger =
-                       lttng::utils::container_of(query, &lttng_error_query_condition::parent);
+               lttng::utils::container_of(query, &lttng_error_query_condition::parent);
 
        if (!lttng_trigger_validate(query_trigger->trigger)) {
                ret = -1;
@@ -698,13 +660,12 @@ end:
        return ret;
 }
 
-static
-int lttng_error_query_action_serialize(const struct lttng_error_query *query,
-               struct lttng_payload *payload)
+static int lttng_error_query_action_serialize(const struct lttng_error_query *query,
+                                             struct lttng_payload *payload)
 {
        int ret;
        const struct lttng_error_query_action *query_action =
-                       lttng::utils::container_of(query, &lttng_error_query_action::parent);
+               lttng::utils::container_of(query, &lttng_error_query_action::parent);
 
        if (!lttng_trigger_validate(query_action->trigger)) {
                ret = -1;
@@ -725,59 +686,58 @@ end:
        return ret;
 }
 
-enum lttng_error_query_target_type lttng_error_query_get_target_type(
-               const struct lttng_error_query *query)
+enum lttng_error_query_target_type
+lttng_error_query_get_target_type(const struct lttng_error_query *query)
 {
        return query->target_type;
 }
 
-const struct lttng_trigger *lttng_error_query_trigger_borrow_target(
-               const struct lttng_error_query *query)
+const struct lttng_trigger *
+lttng_error_query_trigger_borrow_target(const struct lttng_error_query *query)
 {
        const struct lttng_error_query_trigger *query_trigger =
-                       lttng::utils::container_of(query, &lttng_error_query_trigger::parent);
+               lttng::utils::container_of(query, &lttng_error_query_trigger::parent);
 
        return query_trigger->trigger;
 }
 
-const struct lttng_trigger *lttng_error_query_condition_borrow_target(
-               const struct lttng_error_query *query)
+const struct lttng_trigger *
+lttng_error_query_condition_borrow_target(const struct lttng_error_query *query)
 {
        const struct lttng_error_query_condition *query_trigger =
-                       lttng::utils::container_of(query, &lttng_error_query_condition::parent);
+               lttng::utils::container_of(query, &lttng_error_query_condition::parent);
 
        return query_trigger->trigger;
 }
 
-const struct lttng_trigger *lttng_error_query_action_borrow_trigger_target(
-               const struct lttng_error_query *query)
+const struct lttng_trigger *
+lttng_error_query_action_borrow_trigger_target(const struct lttng_error_query *query)
 {
        const struct lttng_error_query_action *query_action =
-                       lttng::utils::container_of(query, &lttng_error_query_action::parent);
+               lttng::utils::container_of(query, &lttng_error_query_action::parent);
 
        return query_action->trigger;
 }
 
-struct lttng_action *lttng_error_query_action_borrow_action_target(
-               const struct lttng_error_query *query, struct lttng_trigger *trigger)
+struct lttng_action *
+lttng_error_query_action_borrow_action_target(const struct lttng_error_query *query,
+                                             struct lttng_trigger *trigger)
 {
        const struct lttng_error_query_action *query_action =
-                       lttng::utils::container_of(query, &lttng_error_query_action::parent);
+               lttng::utils::container_of(query, &lttng_error_query_action::parent);
 
-       return get_trigger_action_from_path(
-                       trigger, query_action->action_path);
+       return get_trigger_action_from_path(trigger, query_action->action_path);
 }
 
 int lttng_error_query_serialize(const struct lttng_error_query *query,
-               struct lttng_payload *payload)
+                               struct lttng_payload *payload)
 {
        int ret;
        struct lttng_error_query_comm header;
 
        header.target_type = (decltype(header.target_type)) query->target_type;
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &header, sizeof(header));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &header, sizeof(header));
        if (ret) {
                ERR("Failed to append error query header to payload");
                goto end;
@@ -813,13 +773,13 @@ end:
 }
 
 ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view,
-               struct lttng_error_query **query)
+                                             struct lttng_error_query **query)
 {
        ssize_t used_size = 0;
        struct lttng_error_query_comm *header;
        struct lttng_trigger *trigger = NULL;
        struct lttng_payload_view header_view =
-                       lttng_payload_view_from_view(view, 0, sizeof(*header));
+               lttng_payload_view_from_view(view, 0, sizeof(*header));
 
        if (!lttng_payload_view_is_valid(&header_view)) {
                ERR("Failed to map error query header");
@@ -835,16 +795,14 @@ ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view,
        {
                ssize_t trigger_used_size;
                struct lttng_payload_view trigger_view =
-                               lttng_payload_view_from_view(
-                                               view, used_size, -1);
+                       lttng_payload_view_from_view(view, used_size, -1);
 
                if (!lttng_payload_view_is_valid(&trigger_view)) {
                        used_size = -1;
                        goto end;
                }
 
-               trigger_used_size = lttng_trigger_create_from_payload(
-                               &trigger_view, &trigger);
+               trigger_used_size = lttng_trigger_create_from_payload(&trigger_view, &trigger);
                if (trigger_used_size < 0) {
                        used_size = -1;
                        goto end;
@@ -864,16 +822,14 @@ ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view,
        {
                ssize_t trigger_used_size;
                struct lttng_payload_view trigger_view =
-                               lttng_payload_view_from_view(
-                                               view, used_size, -1);
+                       lttng_payload_view_from_view(view, used_size, -1);
 
                if (!lttng_payload_view_is_valid(&trigger_view)) {
                        used_size = -1;
                        goto end;
                }
 
-               trigger_used_size = lttng_trigger_create_from_payload(
-                               &trigger_view, &trigger);
+               trigger_used_size = lttng_trigger_create_from_payload(&trigger_view, &trigger);
                if (trigger_used_size < 0) {
                        used_size = -1;
                        goto end;
@@ -896,16 +852,15 @@ ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view,
                {
                        ssize_t trigger_used_size;
                        struct lttng_payload_view trigger_view =
-                                       lttng_payload_view_from_view(
-                                                       view, used_size, -1);
+                               lttng_payload_view_from_view(view, used_size, -1);
 
                        if (!lttng_payload_view_is_valid(&trigger_view)) {
                                used_size = -1;
                                goto end;
                        }
 
-                       trigger_used_size = lttng_trigger_create_from_payload(
-                                       &trigger_view, &trigger);
+                       trigger_used_size =
+                               lttng_trigger_create_from_payload(&trigger_view, &trigger);
                        if (trigger_used_size < 0) {
                                used_size = -1;
                                goto end;
@@ -917,8 +872,7 @@ ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view,
                {
                        ssize_t action_path_used_size;
                        struct lttng_payload_view action_path_view =
-                                       lttng_payload_view_from_view(
-                                                       view, used_size, -1);
+                               lttng_payload_view_from_view(view, used_size, -1);
 
                        if (!lttng_payload_view_is_valid(&action_path_view)) {
                                used_size = -1;
@@ -926,7 +880,7 @@ ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view,
                        }
 
                        action_path_used_size = lttng_action_path_create_from_payload(
-                                       &action_path_view, &action_path);
+                               &action_path_view, &action_path);
                        if (action_path_used_size < 0) {
                                used_size = -1;
                                goto end;
@@ -935,8 +889,7 @@ ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view,
                        used_size += action_path_used_size;
                }
 
-               *query = lttng_error_query_action_create(
-                               trigger, action_path);
+               *query = lttng_error_query_action_create(trigger, action_path);
                lttng_action_path_destroy(action_path);
                if (!*query) {
                        used_size = -1;
@@ -955,9 +908,9 @@ end:
        return used_size;
 }
 
-enum lttng_error_query_results_status lttng_error_query_results_get_count(
-               const struct lttng_error_query_results *results,
-               unsigned int *count)
+enum lttng_error_query_results_status
+lttng_error_query_results_get_count(const struct lttng_error_query_results *results,
+                                   unsigned int *count)
 {
        enum lttng_error_query_results_status status;
 
@@ -973,10 +926,9 @@ end:
 }
 
 enum lttng_error_query_results_status
-lttng_error_query_results_get_result(
-               const struct lttng_error_query_results *results,
-               const struct lttng_error_query_result **result,
-               unsigned int index)
+lttng_error_query_results_get_result(const struct lttng_error_query_results *results,
+                                    const struct lttng_error_query_result **result,
+                                    unsigned int index)
 {
        unsigned int result_count;
        enum lttng_error_query_results_status status;
@@ -996,16 +948,15 @@ lttng_error_query_results_get_result(
                goto end;
        }
 
-       *result = (typeof(*result)) lttng_dynamic_pointer_array_get_pointer(
-                       &results->results, index);
+       *result =
+               (typeof(*result)) lttng_dynamic_pointer_array_get_pointer(&results->results, index);
        LTTNG_ASSERT(*result);
        status = LTTNG_ERROR_QUERY_RESULTS_STATUS_OK;
 end:
        return status;
 }
 
-void lttng_error_query_results_destroy(
-               struct lttng_error_query_results *results)
+void lttng_error_query_results_destroy(struct lttng_error_query_results *results)
 {
        if (!results) {
                return;
@@ -1021,9 +972,8 @@ lttng_error_query_result_get_type(const struct lttng_error_query_result *result)
        return result ? result->type : LTTNG_ERROR_QUERY_RESULT_TYPE_UNKNOWN;
 }
 
-enum lttng_error_query_result_status lttng_error_query_result_get_name(
-               const struct lttng_error_query_result *result,
-               const char **name)
+enum lttng_error_query_result_status
+lttng_error_query_result_get_name(const struct lttng_error_query_result *result, const char **name)
 {
        enum lttng_error_query_result_status status;
 
@@ -1038,9 +988,9 @@ end:
        return status;
 }
 
-enum lttng_error_query_result_status lttng_error_query_result_get_description(
-               const struct lttng_error_query_result *result,
-               const char **description)
+enum lttng_error_query_result_status
+lttng_error_query_result_get_description(const struct lttng_error_query_result *result,
+                                        const char **description)
 {
        enum lttng_error_query_result_status status;
 
@@ -1055,21 +1005,20 @@ end:
        return status;
 }
 
-enum lttng_error_query_result_status lttng_error_query_result_counter_get_value(
-               const struct lttng_error_query_result *result,
-               uint64_t *value)
+enum lttng_error_query_result_status
+lttng_error_query_result_counter_get_value(const struct lttng_error_query_result *result,
+                                          uint64_t *value)
 {
        enum lttng_error_query_result_status status;
        const struct lttng_error_query_result_counter *counter_result;
 
-       if (!result || !value ||
-                       result->type != LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER) {
+       if (!result || !value || result->type != LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER) {
                status = LTTNG_ERROR_QUERY_RESULT_STATUS_INVALID_PARAMETER;
                goto end;
        }
 
-       counter_result = lttng::utils::container_of(
-                       result, &lttng_error_query_result_counter::parent);
+       counter_result =
+               lttng::utils::container_of(result, &lttng_error_query_result_counter::parent);
 
        *value = counter_result->value;
        status = LTTNG_ERROR_QUERY_RESULT_STATUS_OK;
@@ -1077,10 +1026,9 @@ end:
        return status;
 }
 
-static
-enum lttng_error_code lttng_error_query_result_counter_mi_serialize(
-               const struct lttng_error_query_result *result,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_error_query_result_counter_mi_serialize(const struct lttng_error_query_result *result,
+                                             struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -1094,16 +1042,14 @@ enum lttng_error_code lttng_error_query_result_counter_mi_serialize(
        LTTNG_ASSERT(status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
 
        /* Open error query result counter element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_error_query_result_counter);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_error_query_result_counter);
        if (ret) {
                goto mi_error;
        }
 
        /* Value. */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       mi_lttng_element_error_query_result_counter_value,
-                       value);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, mi_lttng_element_error_query_result_counter_value, value);
        if (ret) {
                goto mi_error;
        }
@@ -1123,10 +1069,9 @@ end:
        return ret_code;
 }
 
-static
-enum lttng_error_code lttng_error_query_result_mi_serialize(
-               const struct lttng_error_query_result *result,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_error_query_result_mi_serialize(const struct lttng_error_query_result *result,
+                                     struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -1143,28 +1088,25 @@ enum lttng_error_code lttng_error_query_result_mi_serialize(
        result_status = lttng_error_query_result_get_name(result, &name);
        LTTNG_ASSERT(result_status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
 
-       result_status = lttng_error_query_result_get_description(
-                       result, &description);
+       result_status = lttng_error_query_result_get_description(result, &description);
        LTTNG_ASSERT(result_status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
 
        /* Open error query result element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_error_query_result);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_error_query_result);
        if (ret) {
                goto mi_error;
        }
 
        /* Name. */
        ret = mi_lttng_writer_write_element_string(
-                       writer, mi_lttng_element_error_query_result_name, name);
+               writer, mi_lttng_element_error_query_result_name, name);
        if (ret) {
                goto mi_error;
        }
 
        /* Description. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_error_query_result_description,
-                       description);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_error_query_result_description, description);
        if (ret) {
                goto mi_error;
        }
@@ -1172,8 +1114,7 @@ enum lttng_error_code lttng_error_query_result_mi_serialize(
        /* Serialize the result according to its sub type. */
        switch (type) {
        case LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER:
-               ret_code = lttng_error_query_result_counter_mi_serialize(
-                               result, writer);
+               ret_code = lttng_error_query_result_counter_mi_serialize(result, writer);
                break;
        default:
                abort();
@@ -1198,9 +1139,9 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code lttng_error_query_results_mi_serialize(
-               const struct lttng_error_query_results *results,
-               struct mi_writer *writer)
+enum lttng_error_code
+lttng_error_query_results_mi_serialize(const struct lttng_error_query_results *results,
+                                      struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -1211,8 +1152,7 @@ enum lttng_error_code lttng_error_query_results_mi_serialize(
        LTTNG_ASSERT(writer);
 
        /* Open error query results element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_error_query_results);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_error_query_results);
        if (ret) {
                goto mi_error;
        }
@@ -1223,8 +1163,7 @@ enum lttng_error_code lttng_error_query_results_mi_serialize(
        for (i = 0; i < count; i++) {
                const struct lttng_error_query_result *result;
 
-               results_status = lttng_error_query_results_get_result(
-                               results, &result, i);
+               results_status = lttng_error_query_results_get_result(results, &result, i);
                LTTNG_ASSERT(results_status == LTTNG_ERROR_QUERY_RESULTS_STATUS_OK);
 
                /* A single error query result. */
index 150d2e53fbfe75ef02517a766356eea7db809f7d..ab09053ccfb1465179139187069e73954a0b6f97 100644 (file)
@@ -6,18 +6,19 @@
  */
 
 #define _LGPL_SOURCE
-#include <inttypes.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
+#include "error.hpp"
 
 #include <common/common.hpp>
-#include <common/thread.hpp>
 #include <common/compat/errno.hpp>
 #include <common/compat/getenv.hpp>
+#include <common/thread.hpp>
+
 #include <lttng/lttng-error.h>
 
-#include "error.hpp"
+#include <inttypes.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <string.h>
 
 /*
  * lttng_opt_abort_on_error: unset: -1, disabled: 0, enabled: 1.
@@ -49,9 +50,13 @@ const char *log_add_time(void)
        }
 
        /* Format time in the TLS variable. */
-       ret = snprintf(URCU_TLS(error_log_time).str, sizeof(URCU_TLS(error_log_time).str),
-                       "%02d:%02d:%02d.%09ld",
-                       tm.tm_hour, tm.tm_min, tm.tm_sec, tp.tv_nsec);
+       ret = snprintf(URCU_TLS(error_log_time).str,
+                      sizeof(URCU_TLS(error_log_time).str),
+                      "%02d:%02d:%02d.%09ld",
+                      tm.tm_hour,
+                      tm.tm_min,
+                      tm.tm_sec,
+                      tp.tv_nsec);
        if (ret < 0) {
                goto error;
        }
@@ -84,8 +89,7 @@ void logger_set_thread_name(const char *name, bool set_pthread_name)
 /*
  * Human readable error message.
  */
-static
-const char *lttng_error_code_str(lttng_error_code code)
+static const char *lttng_error_code_str(lttng_error_code code)
 {
        switch (code) {
        case LTTNG_OK:
index 2b57de62cbb5ab07c37cceb9e38bd63188390194..150e1c3f91f950ff02f9d75c2e5aa0e0a8b9bbdc 100644 (file)
@@ -5,32 +5,33 @@
  *
  */
 
+#include <common/error.hpp>
+#include <common/macros.hpp>
+
+#include <lttng/condition/buffer-usage-internal.hpp>
 #include <lttng/condition/condition-internal.hpp>
 #include <lttng/condition/evaluation-internal.hpp>
-#include <lttng/condition/buffer-usage-internal.hpp>
+#include <lttng/condition/event-rule-matches-internal.hpp>
 #include <lttng/condition/session-consumed-size-internal.hpp>
 #include <lttng/condition/session-rotation-internal.hpp>
-#include <lttng/condition/event-rule-matches-internal.hpp>
-#include <common/macros.hpp>
-#include <common/error.hpp>
+
 #include <stdbool.h>
 
-void lttng_evaluation_init(struct lttng_evaluation *evaluation,
-               enum lttng_condition_type type)
+void lttng_evaluation_init(struct lttng_evaluation *evaluation, enum lttng_condition_type type)
 {
        evaluation->type = type;
 }
 
 int lttng_evaluation_serialize(const struct lttng_evaluation *evaluation,
-               struct lttng_payload *payload)
+                              struct lttng_payload *payload)
 {
        int ret;
        struct lttng_evaluation_comm evaluation_comm;
 
        evaluation_comm.type = (int8_t) evaluation->type;
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &evaluation_comm,
-                       sizeof(evaluation_comm));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &evaluation_comm, sizeof(evaluation_comm));
        if (ret) {
                goto end;
        }
@@ -45,19 +46,16 @@ end:
        return ret;
 }
 
-ssize_t lttng_evaluation_create_from_payload(
-               const struct lttng_condition *condition,
-               struct lttng_payload_view *src_view,
-               struct lttng_evaluation **evaluation)
+ssize_t lttng_evaluation_create_from_payload(const struct lttng_condition *condition,
+                                            struct lttng_payload_view *src_view,
+                                            struct lttng_evaluation **evaluation)
 {
        ssize_t ret, evaluation_size = 0;
        const struct lttng_evaluation_comm *evaluation_comm;
        struct lttng_payload_view evaluation_comm_view =
-                       lttng_payload_view_from_view(
-                                       src_view, 0, sizeof(*evaluation_comm));
+               lttng_payload_view_from_view(src_view, 0, sizeof(*evaluation_comm));
        struct lttng_payload_view evaluation_view =
-                       lttng_payload_view_from_view(src_view,
-                                       sizeof(*evaluation_comm), -1);
+               lttng_payload_view_from_view(src_view, sizeof(*evaluation_comm), -1);
 
        if (!src_view || !evaluation) {
                ret = -1;
@@ -74,24 +72,24 @@ ssize_t lttng_evaluation_create_from_payload(
 
        switch ((enum lttng_condition_type) evaluation_comm->type) {
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW:
-               ret = lttng_evaluation_buffer_usage_low_create_from_payload(
-                               &evaluation_view, evaluation);
+               ret = lttng_evaluation_buffer_usage_low_create_from_payload(&evaluation_view,
+                                                                           evaluation);
                if (ret < 0) {
                        goto end;
                }
                evaluation_size += ret;
                break;
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH:
-               ret = lttng_evaluation_buffer_usage_high_create_from_payload(
-                               &evaluation_view, evaluation);
+               ret = lttng_evaluation_buffer_usage_high_create_from_payload(&evaluation_view,
+                                                                            evaluation);
                if (ret < 0) {
                        goto end;
                }
                evaluation_size += ret;
                break;
        case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE:
-               ret = lttng_evaluation_session_consumed_size_create_from_payload(
-                               &evaluation_view, evaluation);
+               ret = lttng_evaluation_session_consumed_size_create_from_payload(&evaluation_view,
+                                                                                evaluation);
                if (ret < 0) {
                        goto end;
                }
@@ -99,7 +97,7 @@ ssize_t lttng_evaluation_create_from_payload(
                break;
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING:
                ret = lttng_evaluation_session_rotation_ongoing_create_from_payload(
-                               &evaluation_view, evaluation);
+                       &evaluation_view, evaluation);
                if (ret < 0) {
                        goto end;
                }
@@ -107,7 +105,7 @@ ssize_t lttng_evaluation_create_from_payload(
                break;
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED:
                ret = lttng_evaluation_session_rotation_completed_create_from_payload(
-                               &evaluation_view, evaluation);
+                       &evaluation_view, evaluation);
                if (ret < 0) {
                        goto end;
                }
@@ -115,12 +113,12 @@ ssize_t lttng_evaluation_create_from_payload(
                break;
        case LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES:
                LTTNG_ASSERT(condition);
-               LTTNG_ASSERT(condition->type ==
-                               LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
+               LTTNG_ASSERT(condition->type == LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
                ret = lttng_evaluation_event_rule_matches_create_from_payload(
-                               lttng::utils::container_of(condition,
-                                               &lttng_condition_event_rule_matches::parent),
-                               &evaluation_view, evaluation);
+                       lttng::utils::container_of(condition,
+                                                  &lttng_condition_event_rule_matches::parent),
+                       &evaluation_view,
+                       evaluation);
                if (ret < 0) {
                        goto end;
                }
@@ -128,7 +126,7 @@ ssize_t lttng_evaluation_create_from_payload(
                break;
        default:
                ERR("Attempted to create evaluation of unknown type (%i)",
-                               (int) evaluation_comm->type);
+                   (int) evaluation_comm->type);
                ret = -1;
                goto end;
        }
@@ -138,8 +136,7 @@ end:
        return ret;
 }
 
-enum lttng_condition_type lttng_evaluation_get_type(
-               const struct lttng_evaluation *evaluation)
+enum lttng_condition_type lttng_evaluation_get_type(const struct lttng_evaluation *evaluation)
 {
        return evaluation ? evaluation->type : LTTNG_CONDITION_TYPE_UNKNOWN;
 }
index 0dd0398f2797c379499663635c91c8258673d6b0..3218503165130c9a3edfbb33e9b82622439007a0 100644 (file)
@@ -8,18 +8,18 @@
  */
 
 #define _LGPL_SOURCE
-#include <stddef.h>
-
 #include <common/bytecode/bytecode.hpp>
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/mi-lttng.hpp>
+
 #include <lttng/event-expr-internal.hpp>
 #include <lttng/event-expr.h>
+
+#include <stddef.h>
 #include <stdio.h>
 
-enum lttng_event_expr_type lttng_event_expr_get_type(
-               const struct lttng_event_expr *expr)
+enum lttng_event_expr_type lttng_event_expr_get_type(const struct lttng_event_expr *expr)
 {
        enum lttng_event_expr_type type;
 
@@ -34,9 +34,7 @@ end:
        return type;
 }
 
-static
-struct lttng_event_expr *create_empty_expr(enum lttng_event_expr_type type,
-               size_t size)
+static struct lttng_event_expr *create_empty_expr(enum lttng_event_expr_type type, size_t size)
 {
        struct lttng_event_expr *expr;
 
@@ -51,13 +49,11 @@ end:
        return expr;
 }
 
-static
-struct lttng_event_expr_field *create_field_event_expr(
-               enum lttng_event_expr_type type,
-               const char *name)
+static struct lttng_event_expr_field *create_field_event_expr(enum lttng_event_expr_type type,
+                                                             const char *name)
 {
        struct lttng_event_expr_field *expr = lttng::utils::container_of(
-                       create_empty_expr(type, sizeof(*expr)), &lttng_event_expr_field::parent);
+               create_empty_expr(type, sizeof(*expr)), &lttng_event_expr_field::parent);
 
        if (!expr) {
                goto error;
@@ -81,8 +77,7 @@ end:
        return expr;
 }
 
-struct lttng_event_expr *lttng_event_expr_event_payload_field_create(
-               const char *field_name)
+struct lttng_event_expr *lttng_event_expr_event_payload_field_create(const char *field_name)
 {
        struct lttng_event_expr *expr = NULL;
 
@@ -90,16 +85,14 @@ struct lttng_event_expr *lttng_event_expr_event_payload_field_create(
                goto end;
        }
 
-       expr = &create_field_event_expr(
-                       LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD,
-                       field_name)->parent;
+       expr = &create_field_event_expr(LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD, field_name)
+                       ->parent;
 
 end:
        return expr;
 }
 
-struct lttng_event_expr *lttng_event_expr_channel_context_field_create(
-               const char *field_name)
+struct lttng_event_expr *lttng_event_expr_channel_context_field_create(const char *field_name)
 {
        struct lttng_event_expr *expr = NULL;
 
@@ -107,16 +100,15 @@ struct lttng_event_expr *lttng_event_expr_channel_context_field_create(
                goto end;
        }
 
-       expr = &create_field_event_expr(
-                       LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD,
-                       field_name)->parent;
+       expr = &create_field_event_expr(LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD, field_name)
+                       ->parent;
 
 end:
        return expr;
 }
 
-struct lttng_event_expr *lttng_event_expr_app_specific_context_field_create(
-               const char *provider_name, const char *type_name)
+struct lttng_event_expr *
+lttng_event_expr_app_specific_context_field_create(const char *provider_name, const char *type_name)
 {
        struct lttng_event_expr_app_specific_context_field *expr = NULL;
        struct lttng_event_expr *ret_parent_expr;
@@ -125,10 +117,9 @@ struct lttng_event_expr *lttng_event_expr_app_specific_context_field_create(
                goto error;
        }
 
-       expr = lttng::utils::container_of(create_empty_expr(
-                       LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD,
-                       sizeof(*expr)),
-                       &lttng_event_expr_app_specific_context_field::parent);
+       expr = lttng::utils::container_of(
+               create_empty_expr(LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD, sizeof(*expr)),
+               &lttng_event_expr_app_specific_context_field::parent);
        if (!expr) {
                goto error;
        }
@@ -156,23 +147,21 @@ end:
        return ret_parent_expr;
 }
 
-struct lttng_event_expr *lttng_event_expr_array_field_element_create(
-               struct lttng_event_expr *array_field_expr,
-               unsigned int index)
+struct lttng_event_expr *
+lttng_event_expr_array_field_element_create(struct lttng_event_expr *array_field_expr,
+                                           unsigned int index)
 {
        struct lttng_event_expr_array_field_element *expr = NULL;
        struct lttng_event_expr *ret_parent_expr;
 
        /* The parent array field expression must be an l-value */
-       if (!array_field_expr ||
-                       !lttng_event_expr_is_lvalue(array_field_expr)) {
+       if (!array_field_expr || !lttng_event_expr_is_lvalue(array_field_expr)) {
                goto error;
        }
 
-       expr = lttng::utils::container_of(create_empty_expr(
-                       LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT,
-                       sizeof(*expr)),
-                       &lttng_event_expr_array_field_element::parent);
+       expr = lttng::utils::container_of(
+               create_empty_expr(LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT, sizeof(*expr)),
+               &lttng_event_expr_array_field_element::parent);
        if (!expr) {
                goto error;
        }
@@ -189,8 +178,7 @@ end:
        return ret_parent_expr;
 }
 
-const char *lttng_event_expr_event_payload_field_get_name(
-               const struct lttng_event_expr *expr)
+const char *lttng_event_expr_event_payload_field_get_name(const struct lttng_event_expr *expr)
 {
        const char *ret = NULL;
 
@@ -198,15 +186,13 @@ const char *lttng_event_expr_event_payload_field_get_name(
                goto end;
        }
 
-       ret = lttng::utils::container_of(expr,
-                       &lttng_event_expr_field::parent)->name;
+       ret = lttng::utils::container_of(expr, &lttng_event_expr_field::parent)->name;
 
 end:
        return ret;
 }
 
-const char *lttng_event_expr_channel_context_field_get_name(
-               const struct lttng_event_expr *expr)
+const char *lttng_event_expr_channel_context_field_get_name(const struct lttng_event_expr *expr)
 {
        const char *ret = NULL;
 
@@ -214,15 +200,14 @@ const char *lttng_event_expr_channel_context_field_get_name(
                goto end;
        }
 
-       ret = lttng::utils::container_of(expr,
-                       &lttng_event_expr_field::parent)->name;
+       ret = lttng::utils::container_of(expr, &lttng_event_expr_field::parent)->name;
 
 end:
        return ret;
 }
 
-const char *lttng_event_expr_app_specific_context_field_get_provider_name(
-               const struct lttng_event_expr *expr)
+const char *
+lttng_event_expr_app_specific_context_field_get_provider_name(const struct lttng_event_expr *expr)
 {
        const char *ret = NULL;
 
@@ -230,15 +215,15 @@ const char *lttng_event_expr_app_specific_context_field_get_provider_name(
                goto end;
        }
 
-       ret = lttng::utils::container_of(expr,
-                       &lttng_event_expr_app_specific_context_field::parent)->provider_name;
+       ret = lttng::utils::container_of(expr, &lttng_event_expr_app_specific_context_field::parent)
+                     ->provider_name;
 
 end:
        return ret;
 }
 
-const char *lttng_event_expr_app_specific_context_field_get_type_name(
-               const struct lttng_event_expr *expr)
+const char *
+lttng_event_expr_app_specific_context_field_get_type_name(const struct lttng_event_expr *expr)
 {
        const char *ret = NULL;
 
@@ -246,16 +231,15 @@ const char *lttng_event_expr_app_specific_context_field_get_type_name(
                goto end;
        }
 
-       ret = lttng::utils::container_of(expr,
-                       &lttng_event_expr_app_specific_context_field::parent)->type_name;
+       ret = lttng::utils::container_of(expr, &lttng_event_expr_app_specific_context_field::parent)
+                     ->type_name;
 
 end:
        return ret;
 }
 
 const struct lttng_event_expr *
-lttng_event_expr_array_field_element_get_parent_expr(
-               const struct lttng_event_expr *expr)
+lttng_event_expr_array_field_element_get_parent_expr(const struct lttng_event_expr *expr)
 {
        const struct lttng_event_expr *ret = NULL;
 
@@ -263,33 +247,33 @@ lttng_event_expr_array_field_element_get_parent_expr(
                goto end;
        }
 
-       ret = lttng::utils::container_of(expr,
-                       &lttng_event_expr_array_field_element::parent)->array_field_expr;
+       ret = lttng::utils::container_of(expr, &lttng_event_expr_array_field_element::parent)
+                     ->array_field_expr;
 
 end:
        return ret;
 }
 
-enum lttng_event_expr_status lttng_event_expr_array_field_element_get_index(
-               const struct lttng_event_expr *expr, unsigned int *index)
+enum lttng_event_expr_status
+lttng_event_expr_array_field_element_get_index(const struct lttng_event_expr *expr,
+                                              unsigned int *index)
 {
        enum lttng_event_expr_status ret = LTTNG_EVENT_EXPR_STATUS_OK;
 
-       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT ||
-                       !index) {
+       if (!expr || expr->type != LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT || !index) {
                ret = LTTNG_EVENT_EXPR_STATUS_INVALID;
                goto end;
        }
 
-       *index = lttng::utils::container_of(expr,
-                       &lttng_event_expr_array_field_element::parent)->index;
+       *index = lttng::utils::container_of(expr, &lttng_event_expr_array_field_element::parent)
+                        ->index;
 
 end:
        return ret;
 }
 
 bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a,
-               const struct lttng_event_expr *expr_b)
+                              const struct lttng_event_expr *expr_b)
 {
        bool is_equal = true;
 
@@ -313,11 +297,9 @@ bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a,
        case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
        {
                const struct lttng_event_expr_field *field_expr_a =
-                               lttng::utils::container_of(expr_a,
-                                       &lttng_event_expr_field::parent);
+                       lttng::utils::container_of(expr_a, &lttng_event_expr_field::parent);
                const struct lttng_event_expr_field *field_expr_b =
-                               lttng::utils::container_of(expr_b,
-                                       &lttng_event_expr_field::parent);
+                       lttng::utils::container_of(expr_b, &lttng_event_expr_field::parent);
 
                if (strcmp(field_expr_a->name, field_expr_b->name) != 0) {
                        goto not_equal;
@@ -328,19 +310,17 @@ bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a,
        case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
        {
                const struct lttng_event_expr_app_specific_context_field *field_expr_a =
-                               lttng::utils::container_of(expr_a,
-                                       &lttng_event_expr_app_specific_context_field::parent);
+                       lttng::utils::container_of(
+                               expr_a, &lttng_event_expr_app_specific_context_field::parent);
                const struct lttng_event_expr_app_specific_context_field *field_expr_b =
-                               lttng::utils::container_of(expr_b,
-                                       &lttng_event_expr_app_specific_context_field::parent);
+                       lttng::utils::container_of(
+                               expr_b, &lttng_event_expr_app_specific_context_field::parent);
 
-               if (strcmp(field_expr_a->provider_name,
-                               field_expr_b->provider_name) != 0) {
+               if (strcmp(field_expr_a->provider_name, field_expr_b->provider_name) != 0) {
                        goto not_equal;
                }
 
-               if (strcmp(field_expr_a->type_name,
-                               field_expr_b->type_name) != 0) {
+               if (strcmp(field_expr_a->type_name, field_expr_b->type_name) != 0) {
                        goto not_equal;
                }
 
@@ -349,14 +329,14 @@ bool lttng_event_expr_is_equal(const struct lttng_event_expr *expr_a,
        case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
        {
                const struct lttng_event_expr_array_field_element *elem_expr_a =
-                               lttng::utils::container_of(expr_a,
-                                       &lttng_event_expr_array_field_element::parent);
+                       lttng::utils::container_of(expr_a,
+                                                  &lttng_event_expr_array_field_element::parent);
                const struct lttng_event_expr_array_field_element *elem_expr_b =
-                               lttng::utils::container_of(expr_b,
-                                       &lttng_event_expr_array_field_element::parent);
+                       lttng::utils::container_of(expr_b,
+                                                  &lttng_event_expr_array_field_element::parent);
 
                if (!lttng_event_expr_is_equal(elem_expr_a->array_field_expr,
-                               elem_expr_b->array_field_expr)) {
+                                              elem_expr_b->array_field_expr)) {
                        goto not_equal;
                }
 
@@ -390,8 +370,7 @@ void lttng_event_expr_destroy(struct lttng_event_expr *expr)
        case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
        {
                struct lttng_event_expr_field *field_expr =
-                               lttng::utils::container_of(expr,
-                                       &lttng_event_expr_field::parent);
+                       lttng::utils::container_of(expr, &lttng_event_expr_field::parent);
 
                free(field_expr->name);
                break;
@@ -399,8 +378,8 @@ void lttng_event_expr_destroy(struct lttng_event_expr *expr)
        case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
        {
                struct lttng_event_expr_app_specific_context_field *field_expr =
-                               lttng::utils::container_of(expr,
-                                       &lttng_event_expr_app_specific_context_field::parent);
+                       lttng::utils::container_of(
+                               expr, &lttng_event_expr_app_specific_context_field::parent);
 
                free(field_expr->provider_name);
                free(field_expr->type_name);
@@ -408,9 +387,8 @@ void lttng_event_expr_destroy(struct lttng_event_expr *expr)
        }
        case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
        {
-               struct lttng_event_expr_array_field_element *elem_expr =
-                               lttng::utils::container_of(expr,
-                                       &lttng_event_expr_array_field_element::parent);
+               struct lttng_event_expr_array_field_element *elem_expr = lttng::utils::container_of(
+                       expr, &lttng_event_expr_array_field_element::parent);
 
                lttng_event_expr_destroy(elem_expr->array_field_expr);
                break;
@@ -426,8 +404,8 @@ end:
 }
 
 static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
-               struct lttng_bytecode_alloc **bytecode,
-               struct lttng_bytecode_alloc **bytecode_reloc)
+                                           struct lttng_bytecode_alloc **bytecode,
+                                           struct lttng_bytecode_alloc **bytecode_reloc)
 {
        int status;
        enum lttng_event_expr_status event_expr_status;
@@ -450,8 +428,7 @@ static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
                        goto end;
                }
 
-               status = bytecode_push_get_symbol(
-                               bytecode, bytecode_reloc, name);
+               status = bytecode_push_get_symbol(bytecode, bytecode_reloc, name);
                if (status) {
                        ERR("Failed to push 'get symbol %s' in bytecode", name);
                        goto end;
@@ -476,8 +453,7 @@ static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
                        goto end;
                }
 
-               status = bytecode_push_get_symbol(
-                               bytecode, bytecode_reloc, name);
+               status = bytecode_push_get_symbol(bytecode, bytecode_reloc, name);
                if (status) {
                        ERR("Failed to push 'get symbol %s' in bytecode", name);
                        goto end;
@@ -497,16 +473,14 @@ static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
                        goto end;
                }
 
-               provider_name = lttng_event_expr_app_specific_context_field_get_provider_name(
-                               expr);
+               provider_name = lttng_event_expr_app_specific_context_field_get_provider_name(expr);
                if (!provider_name) {
                        ERR("Failed to get application context provider name from event expression");
                        status = -1;
                        goto end;
                }
 
-               type_name = lttng_event_expr_app_specific_context_field_get_type_name(
-                               expr);
+               type_name = lttng_event_expr_app_specific_context_field_get_type_name(expr);
                if (!type_name) {
                        ERR("Failed to get application context type name from event expression");
                        status = -1;
@@ -519,17 +493,18 @@ static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
                ret = asprintf(&name, "%s:%s", provider_name, type_name);
                if (ret < 0) {
                        PERROR("Failed to format application specific context: provider_name = '%s', type_name = '%s'",
-                                       provider_name, type_name);
+                              provider_name,
+                              type_name);
                        status = -1;
                        goto end;
                }
 
-               status = bytecode_push_get_symbol(
-                               bytecode, bytecode_reloc, name);
+               status = bytecode_push_get_symbol(bytecode, bytecode_reloc, name);
                free(name);
                if (status) {
                        ERR("Failed to push 'get symbol %s:%s' in bytecode",
-                                       provider_name, type_name);
+                           provider_name,
+                           type_name);
                        goto end;
                }
 
@@ -540,23 +515,19 @@ static int event_expr_to_bytecode_recursive(const struct lttng_event_expr *expr,
                unsigned int index;
                const struct lttng_event_expr *parent;
 
-               parent = lttng_event_expr_array_field_element_get_parent_expr(
-                               expr);
+               parent = lttng_event_expr_array_field_element_get_parent_expr(expr);
                if (!parent) {
                        ERR("Failed to get parent expression from array event expression");
                        status = -1;
                        goto end;
                }
 
-               status = event_expr_to_bytecode_recursive(
-                               parent, bytecode, bytecode_reloc);
+               status = event_expr_to_bytecode_recursive(parent, bytecode, bytecode_reloc);
                if (status) {
                        goto end;
                }
 
-               event_expr_status =
-                               lttng_event_expr_array_field_element_get_index(
-                                               expr, &index);
+               event_expr_status = lttng_event_expr_array_field_element_get_index(expr, &index);
                if (event_expr_status != LTTNG_EVENT_EXPR_STATUS_OK) {
                        ERR("Failed to get array field element index from event expression");
                        status = -1;
@@ -581,7 +552,7 @@ end:
 }
 
 int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr,
-               struct lttng_bytecode **bytecode_out)
+                                struct lttng_bytecode **bytecode_out)
 {
        int status;
        struct return_op ret_insn;
@@ -600,8 +571,7 @@ int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr,
                goto end;
        }
 
-       status = event_expr_to_bytecode_recursive(
-                       expr, &bytecode, &bytecode_reloc);
+       status = event_expr_to_bytecode_recursive(expr, &bytecode, &bytecode_reloc);
        if (status) {
                /* Errors already logged. */
                goto end;
@@ -612,8 +582,8 @@ int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr,
 
        /* Append symbol table to bytecode. */
        bytecode->b.reloc_table_offset = bytecode_get_len(&bytecode->b);
-       status = bytecode_push(&bytecode, bytecode_reloc->b.data, 1,
-                       bytecode_get_len(&bytecode_reloc->b));
+       status = bytecode_push(
+               &bytecode, bytecode_reloc->b.data, 1, bytecode_get_len(&bytecode_reloc->b));
        if (status) {
                ERR("Failed to push symbol table to bytecode");
                goto end;
@@ -638,10 +608,9 @@ end:
        return status;
 }
 
-static
-enum lttng_error_code lttng_event_expr_event_payload_field_mi_serialize(
-               const struct lttng_event_expr *expression,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_expr_event_payload_field_mi_serialize(const struct lttng_event_expr *expression,
+                                                 struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -655,15 +624,13 @@ enum lttng_error_code lttng_event_expr_event_payload_field_mi_serialize(
        LTTNG_ASSERT(name);
 
        /* Open event expr payload field element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_event_expr_payload_field);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_expr_payload_field);
        if (ret) {
                goto mi_error;
        }
 
        /* Name. */
-       ret = mi_lttng_writer_write_element_string(
-                       writer, config_element_name, name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, name);
        if (ret) {
                goto mi_error;
        }
@@ -683,10 +650,9 @@ end:
        return ret_code;
 }
 
-static
-enum lttng_error_code lttng_event_expr_channel_context_field_mi_serialize(
-               const struct lttng_event_expr *expression,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_expr_channel_context_field_mi_serialize(const struct lttng_event_expr *expression,
+                                                   struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -701,14 +667,13 @@ enum lttng_error_code lttng_event_expr_channel_context_field_mi_serialize(
 
        /* Open event expr channel context field element. */
        ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_event_expr_channel_context_field);
+                                          mi_lttng_element_event_expr_channel_context_field);
        if (ret) {
                goto mi_error;
        }
 
        /* Name. */
-       ret = mi_lttng_writer_write_element_string(
-                       writer, config_element_name, name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, name);
        if (ret) {
                goto mi_error;
        }
@@ -728,10 +693,9 @@ end:
        return ret_code;
 }
 
-static
-enum lttng_error_code lttng_event_expr_app_specific_context_field_mi_serialize(
-               const struct lttng_event_expr *expression,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_expr_app_specific_context_field_mi_serialize(const struct lttng_event_expr *expression,
+                                                        struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -740,35 +704,31 @@ enum lttng_error_code lttng_event_expr_app_specific_context_field_mi_serialize(
 
        LTTNG_ASSERT(expression);
        LTTNG_ASSERT(writer);
-       LTTNG_ASSERT(expression->type ==
-                       LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD);
+       LTTNG_ASSERT(expression->type == LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD);
 
-       provider_name = lttng_event_expr_app_specific_context_field_get_provider_name(
-                       expression);
+       provider_name = lttng_event_expr_app_specific_context_field_get_provider_name(expression);
        LTTNG_ASSERT(provider_name);
 
-       type_name = lttng_event_expr_app_specific_context_field_get_type_name(
-                       expression);
+       type_name = lttng_event_expr_app_specific_context_field_get_type_name(expression);
        LTTNG_ASSERT(provider_name);
 
        /* Open event expr app specific context field element. */
        ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_event_expr_app_specific_context_field);
+                                          mi_lttng_element_event_expr_app_specific_context_field);
        if (ret) {
                goto mi_error;
        }
 
        /* Provider name. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_event_expr_provider_name,
-                       provider_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_event_expr_provider_name, provider_name);
        if (ret) {
                goto mi_error;
        }
 
        /* Type name. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_event_expr_type_name, type_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_event_expr_type_name, type_name);
        if (ret) {
                goto mi_error;
        }
@@ -788,10 +748,9 @@ end:
        return ret_code;
 }
 
-static
-enum lttng_error_code lttng_event_expr_array_field_element_mi_serialize(
-               const struct lttng_event_expr *expression,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_expr_array_field_element_mi_serialize(const struct lttng_event_expr *expression,
+                                                 struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -803,24 +762,21 @@ enum lttng_error_code lttng_event_expr_array_field_element_mi_serialize(
        LTTNG_ASSERT(writer);
        LTTNG_ASSERT(expression->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT);
 
-       status = lttng_event_expr_array_field_element_get_index(
-                       expression, &index);
+       status = lttng_event_expr_array_field_element_get_index(expression, &index);
        LTTNG_ASSERT(status == LTTNG_EVENT_EXPR_STATUS_OK);
 
-       parent_expr = lttng_event_expr_array_field_element_get_parent_expr(
-                       expression);
+       parent_expr = lttng_event_expr_array_field_element_get_parent_expr(expression);
        LTTNG_ASSERT(parent_expr != NULL);
 
        /* Open event expr array field element. */
-       ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_event_expr_array_field_element);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_expr_array_field_element);
        if (ret) {
                goto mi_error;
        }
 
        /* Index. */
        ret = mi_lttng_writer_write_element_unsigned_int(
-                       writer, mi_lttng_element_event_expr_index, index);
+               writer, mi_lttng_element_event_expr_index, index);
        if (ret) {
                goto mi_error;
        }
@@ -846,9 +802,8 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code lttng_event_expr_mi_serialize(
-               const struct lttng_event_expr *expression,
-               struct mi_writer *writer)
+enum lttng_error_code lttng_event_expr_mi_serialize(const struct lttng_event_expr *expression,
+                                                   struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -863,20 +818,17 @@ enum lttng_error_code lttng_event_expr_mi_serialize(
 
        switch (expression->type) {
        case LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD:
-               ret_code = lttng_event_expr_event_payload_field_mi_serialize(
-                               expression, writer);
+               ret_code = lttng_event_expr_event_payload_field_mi_serialize(expression, writer);
                break;
        case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
-               ret_code = lttng_event_expr_channel_context_field_mi_serialize(
-                               expression, writer);
+               ret_code = lttng_event_expr_channel_context_field_mi_serialize(expression, writer);
                break;
        case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
-               ret_code = lttng_event_expr_app_specific_context_field_mi_serialize(
-                               expression, writer);
+               ret_code = lttng_event_expr_app_specific_context_field_mi_serialize(expression,
+                                                                                   writer);
                break;
        case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
-               ret_code = lttng_event_expr_array_field_element_mi_serialize(
-                               expression, writer);
+               ret_code = lttng_event_expr_array_field_element_mi_serialize(expression, writer);
                break;
        default:
                abort();
index baa3972ff6fba589304dd25febc3de38fd539dba..3d3d55ab75cf4e115830283610151f6335e99f28 100644 (file)
  */
 
 #define _LGPL_SOURCE
-#include <stddef.h>
-#include <stdbool.h>
-
 #include <common/error.hpp>
 #include <common/macros.hpp>
+
 #include <lttng/event-field-value-internal.hpp>
 
-static
-struct lttng_event_field_value *create_empty_field_val(
-               enum lttng_event_field_value_type type, size_t size)
+#include <stdbool.h>
+#include <stddef.h>
+
+static struct lttng_event_field_value *
+create_empty_field_val(enum lttng_event_field_value_type type, size_t size)
 {
        struct lttng_event_field_value *field_val;
 
@@ -34,15 +34,14 @@ end:
        return field_val;
 }
 
-struct lttng_event_field_value *lttng_event_field_value_uint_create(
-               uint64_t val)
+struct lttng_event_field_value *lttng_event_field_value_uint_create(uint64_t val)
 {
        struct lttng_event_field_value_uint *field_val;
 
-       field_val = lttng::utils::container_of(create_empty_field_val(
-                       LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT,
-                       sizeof(*field_val)),
-                       &lttng_event_field_value_uint::parent);
+       field_val = lttng::utils::container_of(
+               create_empty_field_val(LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT,
+                                      sizeof(*field_val)),
+               &lttng_event_field_value_uint::parent);
        if (!field_val) {
                goto error;
        }
@@ -57,15 +56,13 @@ end:
        return &field_val->parent;
 }
 
-struct lttng_event_field_value *lttng_event_field_value_int_create(
-               int64_t val)
+struct lttng_event_field_value *lttng_event_field_value_int_create(int64_t val)
 {
        struct lttng_event_field_value_int *field_val;
 
-       field_val = lttng::utils::container_of(create_empty_field_val(
-                       LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT,
-                       sizeof(*field_val)),
-                       &lttng_event_field_value_int::parent);
+       field_val = lttng::utils::container_of(
+               create_empty_field_val(LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT, sizeof(*field_val)),
+               &lttng_event_field_value_int::parent);
        if (!field_val) {
                goto error;
        }
@@ -80,14 +77,13 @@ end:
        return &field_val->parent;
 }
 
-static
-struct lttng_event_field_value_enum *create_enum_field_val(
-               enum lttng_event_field_value_type type, size_t size)
+static struct lttng_event_field_value_enum *
+create_enum_field_val(enum lttng_event_field_value_type type, size_t size)
 {
        struct lttng_event_field_value_enum *field_val;
 
        field_val = lttng::utils::container_of(create_empty_field_val(type, size),
-                       &lttng_event_field_value_enum::parent);
+                                              &lttng_event_field_value_enum::parent);
        if (!field_val) {
                goto error;
        }
@@ -102,15 +98,14 @@ end:
        return field_val;
 }
 
-struct lttng_event_field_value *lttng_event_field_value_enum_uint_create(
-               uint64_t val)
+struct lttng_event_field_value *lttng_event_field_value_enum_uint_create(uint64_t val)
 {
        struct lttng_event_field_value_enum_uint *field_val;
 
-       field_val = lttng::utils::container_of(create_enum_field_val(
-                       LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM,
-                       sizeof(*field_val)),
-                       &lttng_event_field_value_enum_uint::parent);
+       field_val = lttng::utils::container_of(
+               create_enum_field_val(LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM,
+                                     sizeof(*field_val)),
+               &lttng_event_field_value_enum_uint::parent);
        if (!field_val) {
                goto error;
        }
@@ -125,15 +120,13 @@ end:
        return &field_val->parent.parent;
 }
 
-struct lttng_event_field_value *lttng_event_field_value_enum_int_create(
-               int64_t val)
+struct lttng_event_field_value *lttng_event_field_value_enum_int_create(int64_t val)
 {
        struct lttng_event_field_value_enum_int *field_val;
 
-       field_val = lttng::utils::container_of(create_enum_field_val(
-                       LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM,
-                       sizeof(*field_val)),
-                       &lttng_event_field_value_enum_int::parent);
+       field_val = lttng::utils::container_of(
+               create_enum_field_val(LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM, sizeof(*field_val)),
+               &lttng_event_field_value_enum_int::parent);
        if (!field_val) {
                goto error;
        }
@@ -151,10 +144,8 @@ end:
 struct lttng_event_field_value *lttng_event_field_value_real_create(double val)
 {
        struct lttng_event_field_value_real *field_val = lttng::utils::container_of(
-                       create_empty_field_val(
-                               LTTNG_EVENT_FIELD_VALUE_TYPE_REAL,
-                               sizeof(*field_val)),
-                       &lttng_event_field_value_real::parent);
+               create_empty_field_val(LTTNG_EVENT_FIELD_VALUE_TYPE_REAL, sizeof(*field_val)),
+               &lttng_event_field_value_real::parent);
 
        if (!field_val) {
                goto error;
@@ -170,14 +161,12 @@ end:
        return &field_val->parent;
 }
 
-struct lttng_event_field_value *lttng_event_field_value_string_create_with_size(
-               const char *val, size_t size)
+struct lttng_event_field_value *lttng_event_field_value_string_create_with_size(const char *val,
+                                                                               size_t size)
 {
        struct lttng_event_field_value_string *field_val = lttng::utils::container_of(
-                       create_empty_field_val(
-                               LTTNG_EVENT_FIELD_VALUE_TYPE_STRING,
-                               sizeof(*field_val)),
-                       &lttng_event_field_value_string::parent);
+               create_empty_field_val(LTTNG_EVENT_FIELD_VALUE_TYPE_STRING, sizeof(*field_val)),
+               &lttng_event_field_value_string::parent);
 
        if (!field_val) {
                goto error;
@@ -206,16 +195,13 @@ end:
        return &field_val->parent;
 }
 
-struct lttng_event_field_value *lttng_event_field_value_string_create(
-               const char *val)
+struct lttng_event_field_value *lttng_event_field_value_string_create(const char *val)
 {
        LTTNG_ASSERT(val);
-       return lttng_event_field_value_string_create_with_size(val,
-                       strlen(val));
+       return lttng_event_field_value_string_create_with_size(val, strlen(val));
 }
 
-static
-void destroy_field_val(void *field_val)
+static void destroy_field_val(void *field_val)
 {
        lttng_event_field_value_destroy((lttng_event_field_value *) field_val);
 }
@@ -223,10 +209,8 @@ void destroy_field_val(void *field_val)
 struct lttng_event_field_value *lttng_event_field_value_array_create(void)
 {
        struct lttng_event_field_value_array *field_val = lttng::utils::container_of(
-                       create_empty_field_val(
-                               LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY,
-                               sizeof(*field_val)),
-                       &lttng_event_field_value_array::parent);
+               create_empty_field_val(LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY, sizeof(*field_val)),
+               &lttng_event_field_value_array::parent);
 
        if (!field_val) {
                goto error;
@@ -252,27 +236,24 @@ void lttng_event_field_value_destroy(struct lttng_event_field_value *field_val)
        case LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM:
        case LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM:
        {
-               struct lttng_event_field_value_enum *enum_field_val =
-                               lttng::utils::container_of(field_val,
-                                       &lttng_event_field_value_enum::parent);
+               struct lttng_event_field_value_enum *enum_field_val = lttng::utils::container_of(
+                       field_val, &lttng_event_field_value_enum::parent);
 
                lttng_dynamic_pointer_array_reset(&enum_field_val->labels);
                break;
        }
        case LTTNG_EVENT_FIELD_VALUE_TYPE_STRING:
        {
-               struct lttng_event_field_value_string *str_field_val =
-                               lttng::utils::container_of(field_val,
-                                       &lttng_event_field_value_string::parent);
+               struct lttng_event_field_value_string *str_field_val = lttng::utils::container_of(
+                       field_val, &lttng_event_field_value_string::parent);
 
                free(str_field_val->val);
                break;
        }
        case LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY:
        {
-               struct lttng_event_field_value_array *array_field_expr =
-                               lttng::utils::container_of(field_val,
-                                       &lttng_event_field_value_array::parent);
+               struct lttng_event_field_value_array *array_field_expr = lttng::utils::container_of(
+                       field_val, &lttng_event_field_value_array::parent);
 
                lttng_dynamic_pointer_array_reset(&array_field_expr->elems);
                break;
@@ -287,9 +268,9 @@ end:
        return;
 }
 
-int lttng_event_field_value_enum_append_label_with_size(
-               struct lttng_event_field_value *field_val,
-               const char *label, size_t size)
+int lttng_event_field_value_enum_append_label_with_size(struct lttng_event_field_value *field_val,
+                                                       const char *label,
+                                                       size_t size)
 {
        int ret;
        char *new_label;
@@ -303,9 +284,9 @@ int lttng_event_field_value_enum_append_label_with_size(
        }
 
        ret = lttng_dynamic_pointer_array_add_pointer(
-                       &lttng::utils::container_of(field_val,
-                               &lttng_event_field_value_enum::parent)->labels,
-                       new_label);
+               &lttng::utils::container_of(field_val, &lttng_event_field_value_enum::parent)
+                        ->labels,
+               new_label);
        if (ret == 0) {
                new_label = NULL;
        }
@@ -315,39 +296,35 @@ end:
        return ret;
 }
 
-int lttng_event_field_value_enum_append_label(
-               struct lttng_event_field_value *field_val,
-               const char *label)
+int lttng_event_field_value_enum_append_label(struct lttng_event_field_value *field_val,
+                                             const char *label)
 {
        LTTNG_ASSERT(label);
-       return lttng_event_field_value_enum_append_label_with_size(field_val,
-                       label, strlen(label));
+       return lttng_event_field_value_enum_append_label_with_size(field_val, label, strlen(label));
 }
 
-int lttng_event_field_value_array_append(
-               struct lttng_event_field_value *array_field_val,
-               struct lttng_event_field_value *field_val)
+int lttng_event_field_value_array_append(struct lttng_event_field_value *array_field_val,
+                                        struct lttng_event_field_value *field_val)
 {
        LTTNG_ASSERT(array_field_val);
        LTTNG_ASSERT(field_val);
        return lttng_dynamic_pointer_array_add_pointer(
-                       &lttng::utils::container_of(array_field_val,
-                               &lttng_event_field_value_array::parent)->elems,
-                       field_val);
+               &lttng::utils::container_of(array_field_val, &lttng_event_field_value_array::parent)
+                        ->elems,
+               field_val);
 }
 
-int lttng_event_field_value_array_append_unavailable(
-               struct lttng_event_field_value *array_field_val)
+int lttng_event_field_value_array_append_unavailable(struct lttng_event_field_value *array_field_val)
 {
        LTTNG_ASSERT(array_field_val);
        return lttng_dynamic_pointer_array_add_pointer(
-                       &lttng::utils::container_of(array_field_val,
-                               &lttng_event_field_value_array::parent)->elems,
-                       NULL);
+               &lttng::utils::container_of(array_field_val, &lttng_event_field_value_array::parent)
+                        ->elems,
+               NULL);
 }
 
-enum lttng_event_field_value_type lttng_event_field_value_get_type(
-               const struct lttng_event_field_value *field_val)
+enum lttng_event_field_value_type
+lttng_event_field_value_get_type(const struct lttng_event_field_value *field_val)
 {
        enum lttng_event_field_value_type type;
 
@@ -363,8 +340,8 @@ end:
 }
 
 enum lttng_event_field_value_status
-lttng_event_field_value_unsigned_int_get_value(
-               const struct lttng_event_field_value *field_val, uint64_t *val)
+lttng_event_field_value_unsigned_int_get_value(const struct lttng_event_field_value *field_val,
+                                              uint64_t *val)
 {
        enum lttng_event_field_value_status status;
 
@@ -375,17 +352,17 @@ lttng_event_field_value_unsigned_int_get_value(
 
        switch (field_val->type) {
        case LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT:
-               *val = lttng::utils::container_of(field_val,
-                               &lttng_event_field_value_uint::parent)->val;
+               *val = lttng::utils::container_of(field_val, &lttng_event_field_value_uint::parent)
+                              ->val;
                break;
        case LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM:
        {
                const struct lttng_event_field_value_enum *field_val_enum =
-                               lttng::utils::container_of(
-                                               field_val, &lttng_event_field_value_enum::parent);
+                       lttng::utils::container_of(field_val,
+                                                  &lttng_event_field_value_enum::parent);
                const struct lttng_event_field_value_enum_uint *field_val_enum_uint =
-                               lttng::utils::container_of(field_val_enum,
-                                               &lttng_event_field_value_enum_uint::parent);
+                       lttng::utils::container_of(field_val_enum,
+                                                  &lttng_event_field_value_enum_uint::parent);
                *val = field_val_enum_uint->val;
                break;
        }
@@ -401,8 +378,8 @@ end:
 }
 
 enum lttng_event_field_value_status
-lttng_event_field_value_signed_int_get_value(
-               const struct lttng_event_field_value *field_val, int64_t *val)
+lttng_event_field_value_signed_int_get_value(const struct lttng_event_field_value *field_val,
+                                            int64_t *val)
 {
        enum lttng_event_field_value_status status;
 
@@ -413,17 +390,17 @@ lttng_event_field_value_signed_int_get_value(
 
        switch (field_val->type) {
        case LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT:
-               *val = lttng::utils::container_of(field_val,
-                               &lttng_event_field_value_int::parent)->val;
+               *val = lttng::utils::container_of(field_val, &lttng_event_field_value_int::parent)
+                              ->val;
                break;
        case LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM:
        {
-               const struct lttng_event_field_value_enum *field_val_enum = lttng::utils::container_of(
-                               field_val,
-                               &lttng_event_field_value_enum::parent);
+               const struct lttng_event_field_value_enum *field_val_enum =
+                       lttng::utils::container_of(field_val,
+                                                  &lttng_event_field_value_enum::parent);
                const struct lttng_event_field_value_enum_int *field_val_enum_uint =
-                               lttng::utils::container_of(field_val_enum,
-                                               &lttng_event_field_value_enum_int::parent);
+                       lttng::utils::container_of(field_val_enum,
+                                                  &lttng_event_field_value_enum_int::parent);
                *val = field_val_enum_uint->val;
                break;
        }
@@ -439,36 +416,31 @@ end:
 }
 
 enum lttng_event_field_value_status
-lttng_event_field_value_real_get_value(
-               const struct lttng_event_field_value *field_val, double *val)
+lttng_event_field_value_real_get_value(const struct lttng_event_field_value *field_val, double *val)
 {
        enum lttng_event_field_value_status status;
 
-       if (!field_val || field_val->type != LTTNG_EVENT_FIELD_VALUE_TYPE_REAL ||
-                       !val) {
+       if (!field_val || field_val->type != LTTNG_EVENT_FIELD_VALUE_TYPE_REAL || !val) {
                status = LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID;
                goto end;
        }
 
-       *val = lttng::utils::container_of(field_val,
-                       &lttng_event_field_value_real::parent)->val;
+       *val = lttng::utils::container_of(field_val, &lttng_event_field_value_real::parent)->val;
        status = LTTNG_EVENT_FIELD_VALUE_STATUS_OK;
 
 end:
        return status;
 }
 
-static
-bool is_enum_field_val(const struct lttng_event_field_value *field_val)
+static bool is_enum_field_val(const struct lttng_event_field_value *field_val)
 {
        return field_val->type == LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM ||
                field_val->type == LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM;
 }
 
 enum lttng_event_field_value_status
-lttng_event_field_value_enum_get_label_count(
-               const struct lttng_event_field_value *field_val,
-               unsigned int *count)
+lttng_event_field_value_enum_get_label_count(const struct lttng_event_field_value *field_val,
+                                            unsigned int *count)
 {
        enum lttng_event_field_value_status status;
 
@@ -478,17 +450,17 @@ lttng_event_field_value_enum_get_label_count(
        }
 
        *count = (unsigned int) lttng_dynamic_pointer_array_get_count(
-                       &lttng::utils::container_of(field_val,
-                               &lttng_event_field_value_enum::parent)->labels);
+               &lttng::utils::container_of(field_val, &lttng_event_field_value_enum::parent)
+                        ->labels);
        status = LTTNG_EVENT_FIELD_VALUE_STATUS_OK;
 
 end:
        return status;
 }
 
-const char *lttng_event_field_value_enum_get_label_at_index(
-               const struct lttng_event_field_value *field_val,
-               unsigned int index)
+const char *
+lttng_event_field_value_enum_get_label_at_index(const struct lttng_event_field_value *field_val,
+                                               unsigned int index)
 {
        const char *ret;
        const struct lttng_event_field_value_enum *enum_field_val;
@@ -498,8 +470,8 @@ const char *lttng_event_field_value_enum_get_label_at_index(
                goto end;
        }
 
-       enum_field_val = lttng::utils::container_of(field_val,
-                       &lttng_event_field_value_enum::parent);
+       enum_field_val =
+               lttng::utils::container_of(field_val, &lttng_event_field_value_enum::parent);
 
        if (index >= lttng_dynamic_pointer_array_get_count(&enum_field_val->labels)) {
                ret = NULL;
@@ -507,15 +479,15 @@ const char *lttng_event_field_value_enum_get_label_at_index(
        }
 
        ret = (const char *) lttng_dynamic_pointer_array_get_pointer(&enum_field_val->labels,
-                       index);
+                                                                    index);
 
 end:
        return ret;
 }
 
-enum lttng_event_field_value_status lttng_event_field_value_string_get_value(
-               const struct lttng_event_field_value *field_val,
-               const char **value)
+enum lttng_event_field_value_status
+lttng_event_field_value_string_get_value(const struct lttng_event_field_value *field_val,
+                                        const char **value)
 {
        enum lttng_event_field_value_status status;
 
@@ -524,52 +496,50 @@ enum lttng_event_field_value_status lttng_event_field_value_string_get_value(
                goto end;
        }
 
-       *value = lttng::utils::container_of(field_val,
-                       &lttng_event_field_value_string::parent)->val;
+       *value =
+               lttng::utils::container_of(field_val, &lttng_event_field_value_string::parent)->val;
        status = LTTNG_EVENT_FIELD_VALUE_STATUS_OK;
 
 end:
        return status;
 }
 
-enum lttng_event_field_value_status lttng_event_field_value_array_get_length(
-               const struct lttng_event_field_value *field_val,
-               unsigned int *length)
+enum lttng_event_field_value_status
+lttng_event_field_value_array_get_length(const struct lttng_event_field_value *field_val,
+                                        unsigned int *length)
 {
        enum lttng_event_field_value_status status;
 
-       if (!field_val || field_val->type != LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY ||
-                       !length) {
+       if (!field_val || field_val->type != LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY || !length) {
                status = LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID;
                goto end;
        }
 
        *length = (unsigned int) lttng_dynamic_pointer_array_get_count(
-                       &lttng::utils::container_of(field_val,
-                               &lttng_event_field_value_array::parent)->elems);
+               &lttng::utils::container_of(field_val, &lttng_event_field_value_array::parent)
+                        ->elems);
        status = LTTNG_EVENT_FIELD_VALUE_STATUS_OK;
 
 end:
        return status;
 }
 
-enum lttng_event_field_value_status
-lttng_event_field_value_array_get_element_at_index(
-               const struct lttng_event_field_value *field_val,
-               unsigned int index,
-               const struct lttng_event_field_value **elem_field_val)
+enum lttng_event_field_value_status lttng_event_field_value_array_get_element_at_index(
+       const struct lttng_event_field_value *field_val,
+       unsigned int index,
+       const struct lttng_event_field_value **elem_field_val)
 {
        enum lttng_event_field_value_status status;
        const struct lttng_event_field_value_array *array_field_val;
 
        if (!field_val || field_val->type != LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY ||
-                       !elem_field_val) {
+           !elem_field_val) {
                status = LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID;
                goto end;
        }
 
-       array_field_val = lttng::utils::container_of(
-                       field_val, &lttng_event_field_value_array::parent);
+       array_field_val =
+               lttng::utils::container_of(field_val, &lttng_event_field_value_array::parent);
 
        if (index >= lttng_dynamic_pointer_array_get_count(&array_field_val->elems)) {
                status = LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID;
@@ -577,7 +547,7 @@ lttng_event_field_value_array_get_element_at_index(
        }
 
        *elem_field_val = (lttng_event_field_value *) lttng_dynamic_pointer_array_get_pointer(
-                       &array_field_val->elems, index);
+               &array_field_val->elems, index);
        if (*elem_field_val) {
                status = LTTNG_EVENT_FIELD_VALUE_STATUS_OK;
        } else {
index 5139eed5a6dbc44daac914f703fc8ca127c1790c..5ac475f3eafd1a1283b377bb290e5fe586940ec1 100644 (file)
@@ -13,6 +13,7 @@
 #include <common/mi-lttng.hpp>
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
+
 #include <lttng/event-rule/event-rule-internal.hpp>
 #include <lttng/event-rule/jul-logging-internal.hpp>
 #include <lttng/event-rule/kernel-kprobe-internal.hpp>
 #include <lttng/event-rule/log4j-logging-internal.hpp>
 #include <lttng/event-rule/python-logging-internal.hpp>
 #include <lttng/event-rule/user-tracepoint-internal.hpp>
+
 #include <stdbool.h>
 
-enum lttng_event_rule_type lttng_event_rule_get_type(
-               const struct lttng_event_rule *event_rule)
+enum lttng_event_rule_type lttng_event_rule_get_type(const struct lttng_event_rule *event_rule)
 {
        return event_rule ? event_rule->type : LTTNG_EVENT_RULE_TYPE_UNKNOWN;
 }
 
-enum lttng_domain_type lttng_event_rule_get_domain_type(
-               const struct lttng_event_rule *event_rule)
+enum lttng_domain_type lttng_event_rule_get_domain_type(const struct lttng_event_rule *event_rule)
 {
        enum lttng_domain_type domain_type = LTTNG_DOMAIN_NONE;
 
@@ -65,7 +65,7 @@ enum lttng_domain_type lttng_event_rule_get_domain_type(
 static void lttng_event_rule_release(struct urcu_ref *ref)
 {
        struct lttng_event_rule *event_rule =
-                       lttng::utils::container_of(ref, &lttng_event_rule::ref);
+               lttng::utils::container_of(ref, &lttng_event_rule::ref);
 
        LTTNG_ASSERT(event_rule->destroy);
        event_rule->destroy(event_rule);
@@ -97,7 +97,7 @@ end:
 }
 
 int lttng_event_rule_serialize(const struct lttng_event_rule *event_rule,
-               struct lttng_payload *payload)
+                              struct lttng_payload *payload)
 {
        int ret;
        struct lttng_event_rule_comm event_rule_comm = {};
@@ -110,7 +110,7 @@ int lttng_event_rule_serialize(const struct lttng_event_rule *event_rule,
        event_rule_comm.event_rule_type = (int8_t) event_rule->type;
 
        ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &event_rule_comm, sizeof(event_rule_comm));
+               &payload->buffer, &event_rule_comm, sizeof(event_rule_comm));
        if (ret) {
                goto end;
        }
@@ -123,8 +123,7 @@ end:
        return ret;
 }
 
-bool lttng_event_rule_is_equal(const struct lttng_event_rule *a,
-               const struct lttng_event_rule *b)
+bool lttng_event_rule_is_equal(const struct lttng_event_rule *a, const struct lttng_event_rule *b)
 {
        bool is_equal = false;
 
@@ -146,16 +145,14 @@ end:
        return is_equal;
 }
 
-ssize_t lttng_event_rule_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_rule **event_rule)
+ssize_t lttng_event_rule_create_from_payload(struct lttng_payload_view *view,
+                                            struct lttng_event_rule **event_rule)
 {
        ssize_t ret, consumed = 0;
        event_rule_create_from_payload_cb create_from_payload = NULL;
        const struct lttng_event_rule_comm *event_rule_comm;
        const struct lttng_payload_view event_rule_comm_view =
-                       lttng_payload_view_from_view(
-                                       view, 0, sizeof(*event_rule_comm));
+               lttng_payload_view_from_view(view, 0, sizeof(*event_rule_comm));
 
        if (!view || !event_rule) {
                ret = -1;
@@ -179,32 +176,26 @@ ssize_t lttng_event_rule_create_from_payload(
                create_from_payload = lttng_event_rule_kernel_uprobe_create_from_payload;
                break;
        case LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL:
-               create_from_payload =
-                               lttng_event_rule_kernel_syscall_create_from_payload;
+               create_from_payload = lttng_event_rule_kernel_syscall_create_from_payload;
                break;
        case LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT:
-               create_from_payload =
-                               lttng_event_rule_kernel_tracepoint_create_from_payload;
+               create_from_payload = lttng_event_rule_kernel_tracepoint_create_from_payload;
                break;
        case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
-               create_from_payload =
-                               lttng_event_rule_user_tracepoint_create_from_payload;
+               create_from_payload = lttng_event_rule_user_tracepoint_create_from_payload;
                break;
        case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
-               create_from_payload =
-                               lttng_event_rule_jul_logging_create_from_payload;
+               create_from_payload = lttng_event_rule_jul_logging_create_from_payload;
                break;
        case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
-               create_from_payload =
-                               lttng_event_rule_log4j_logging_create_from_payload;
+               create_from_payload = lttng_event_rule_log4j_logging_create_from_payload;
                break;
        case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
-               create_from_payload =
-                               lttng_event_rule_python_logging_create_from_payload;
+               create_from_payload = lttng_event_rule_python_logging_create_from_payload;
                break;
        default:
                ERR("Attempted to create event rule of unknown type (%i)",
-                               (int) event_rule_comm->event_rule_type);
+                   (int) event_rule_comm->event_rule_type);
                ret = -1;
                goto end;
        }
@@ -213,8 +204,7 @@ ssize_t lttng_event_rule_create_from_payload(
 
        {
                struct lttng_payload_view child_view =
-                               lttng_payload_view_from_view(
-                                               view, consumed, -1);
+                       lttng_payload_view_from_view(view, consumed, -1);
 
                ret = create_from_payload(&child_view, event_rule);
                if (ret < 0) {
@@ -234,8 +224,7 @@ end:
        return ret;
 }
 
-void lttng_event_rule_init(struct lttng_event_rule *event_rule,
-               enum lttng_event_rule_type type)
+void lttng_event_rule_init(struct lttng_event_rule *event_rule, enum lttng_event_rule_type type)
 {
        urcu_ref_init(&event_rule->ref);
        event_rule->type = type;
@@ -256,9 +245,9 @@ void lttng_event_rule_put(struct lttng_event_rule *event_rule)
        urcu_ref_put(&event_rule->ref, lttng_event_rule_release);
 }
 
-enum lttng_error_code lttng_event_rule_generate_filter_bytecode(
-               struct lttng_event_rule *rule,
-               const struct lttng_credentials *creds)
+enum lttng_error_code
+lttng_event_rule_generate_filter_bytecode(struct lttng_event_rule *rule,
+                                         const struct lttng_credentials *creds)
 {
        LTTNG_ASSERT(rule->generate_filter_bytecode);
        return rule->generate_filter_bytecode(rule, creds);
@@ -270,8 +259,8 @@ const char *lttng_event_rule_get_filter(const struct lttng_event_rule *rule)
        return rule->get_filter(rule);
 }
 
-const struct lttng_bytecode *lttng_event_rule_get_filter_bytecode(
-               const struct lttng_event_rule *rule)
+const struct lttng_bytecode *
+lttng_event_rule_get_filter_bytecode(const struct lttng_event_rule *rule)
 {
        LTTNG_ASSERT(rule->get_filter_bytecode);
        return rule->get_filter_bytecode(rule);
@@ -279,14 +268,13 @@ const struct lttng_bytecode *lttng_event_rule_get_filter_bytecode(
 
 enum lttng_event_rule_generate_exclusions_status
 lttng_event_rule_generate_exclusions(const struct lttng_event_rule *rule,
-               struct lttng_event_exclusion **exclusions)
+                                    struct lttng_event_exclusion **exclusions)
 {
        LTTNG_ASSERT(rule->generate_exclusions);
        return rule->generate_exclusions(rule, exclusions);
 }
 
-struct lttng_event *lttng_event_rule_generate_lttng_event(
-               const struct lttng_event_rule *rule)
+struct lttng_event *lttng_event_rule_generate_lttng_event(const struct lttng_event_rule *rule)
 {
        LTTNG_ASSERT(rule->generate_lttng_event);
        return rule->generate_lttng_event(rule);
@@ -347,8 +335,8 @@ unsigned long lttng_event_rule_hash(const struct lttng_event_rule *rule)
        return rule->hash(rule);
 }
 
-enum lttng_error_code lttng_event_rule_mi_serialize(
-               const struct lttng_event_rule *rule, struct mi_writer *writer)
+enum lttng_error_code lttng_event_rule_mi_serialize(const struct lttng_event_rule *rule,
+                                                   struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
index 138d9c1020dbcfbda13e5412def50f8dc4bc2f6b..5c836f857abdec19f5c7d93194cb236cdf456502 100644 (file)
@@ -16,6 +16,7 @@
 #include <common/payload.hpp>
 #include <common/runas.hpp>
 #include <common/string-utils/string-utils.hpp>
+
 #include <lttng/event-rule/event-rule-internal.hpp>
 #include <lttng/event-rule/jul-logging-internal.hpp>
 #include <lttng/event.h>
@@ -32,8 +33,7 @@ static void lttng_event_rule_jul_logging_destroy(struct lttng_event_rule *rule)
                return;
        }
 
-       jul_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_jul_logging::parent);
+       jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
 
        lttng_log_level_rule_destroy(jul_logging->log_level_rule);
        free(jul_logging->pattern);
@@ -43,8 +43,7 @@ static void lttng_event_rule_jul_logging_destroy(struct lttng_event_rule *rule)
        free(jul_logging);
 }
 
-static bool lttng_event_rule_jul_logging_validate(
-               const struct lttng_event_rule *rule)
+static bool lttng_event_rule_jul_logging_validate(const struct lttng_event_rule *rule)
 {
        bool valid = false;
        struct lttng_event_rule_jul_logging *jul_logging;
@@ -53,8 +52,7 @@ static bool lttng_event_rule_jul_logging_validate(
                goto end;
        }
 
-       jul_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_jul_logging::parent);
+       jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
 
        /* Required field. */
        if (!jul_logging->pattern) {
@@ -67,9 +65,8 @@ end:
        return valid;
 }
 
-static int lttng_event_rule_jul_logging_serialize(
-               const struct lttng_event_rule *rule,
-               struct lttng_payload *payload)
+static int lttng_event_rule_jul_logging_serialize(const struct lttng_event_rule *rule,
+                                                 struct lttng_payload *payload)
 {
        int ret;
        size_t pattern_len, filter_expression_len, header_offset;
@@ -86,14 +83,12 @@ static int lttng_event_rule_jul_logging_serialize(
        header_offset = payload->buffer.size;
 
        DBG("Serializing jul_logging event rule.");
-       jul_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_jul_logging::parent);
+       jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
 
        pattern_len = strlen(jul_logging->pattern) + 1;
 
        if (jul_logging->filter_expression != NULL) {
-               filter_expression_len =
-                               strlen(jul_logging->filter_expression) + 1;
+               filter_expression_len = strlen(jul_logging->filter_expression) + 1;
        } else {
                filter_expression_len = 0;
        }
@@ -101,20 +96,19 @@ static int lttng_event_rule_jul_logging_serialize(
        jul_logging_comm.pattern_len = pattern_len;
        jul_logging_comm.filter_expression_len = filter_expression_len;
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &jul_logging_comm,
-                       sizeof(jul_logging_comm));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &jul_logging_comm, sizeof(jul_logging_comm));
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, jul_logging->pattern, pattern_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, jul_logging->pattern, pattern_len);
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, jul_logging->filter_expression,
-                       filter_expression_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, jul_logging->filter_expression, filter_expression_len);
        if (ret) {
                goto end;
        }
@@ -127,16 +121,14 @@ static int lttng_event_rule_jul_logging_serialize(
        }
 
        header = (typeof(header)) ((char *) payload->buffer.data + header_offset);
-       header->log_level_rule_len =
-                       payload->buffer.size - size_before_log_level_rule;
+       header->log_level_rule_len = payload->buffer.size - size_before_log_level_rule;
 
 end:
        return ret;
 }
 
-static bool lttng_event_rule_jul_logging_is_equal(
-               const struct lttng_event_rule *_a,
-               const struct lttng_event_rule *_b)
+static bool lttng_event_rule_jul_logging_is_equal(const struct lttng_event_rule *_a,
+                                                 const struct lttng_event_rule *_b)
 {
        bool is_equal = false;
        struct lttng_event_rule_jul_logging *a, *b;
@@ -166,8 +158,7 @@ static bool lttng_event_rule_jul_logging_is_equal(
                goto end;
        }
 
-       if (!lttng_log_level_rule_is_equal(
-                               a->log_level_rule, b->log_level_rule)) {
+       if (!lttng_log_level_rule_is_equal(a->log_level_rule, b->log_level_rule)) {
                goto end;
        }
 
@@ -183,8 +174,7 @@ end:
  *
  * An event with NO loglevel and the name is * will return NULL.
  */
-static int generate_agent_filter(
-               const struct lttng_event_rule *rule, char **_agent_filter)
+static int generate_agent_filter(const struct lttng_event_rule *rule, char **_agent_filter)
 {
        int err;
        int ret = 0;
@@ -211,16 +201,13 @@ static int generate_agent_filter(
                goto end;
        }
 
-
        /* Don't add filter for the '*' event. */
        if (strcmp(pattern, "*") != 0) {
                if (filter) {
-                       err = asprintf(&agent_filter,
-                                       "(%s) && (logger_name == \"%s\")",
-                                       filter, pattern);
+                       err = asprintf(
+                               &agent_filter, "(%s) && (logger_name == \"%s\")", filter, pattern);
                } else {
-                       err = asprintf(&agent_filter, "logger_name == \"%s\"",
-                                       pattern);
+                       err = asprintf(&agent_filter, "logger_name == \"%s\"", pattern);
                }
 
                if (err < 0) {
@@ -230,23 +217,20 @@ static int generate_agent_filter(
                }
        }
 
-       status = lttng_event_rule_jul_logging_get_log_level_rule(
-                       rule, &log_level_rule);
+       status = lttng_event_rule_jul_logging_get_log_level_rule(rule, &log_level_rule);
        if (status == LTTNG_EVENT_RULE_STATUS_OK) {
                enum lttng_log_level_rule_status llr_status;
                const char *op;
                int level;
 
-               switch (lttng_log_level_rule_get_type(log_level_rule))
-               {
+               switch (lttng_log_level_rule_get_type(log_level_rule)) {
                case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
-                       llr_status = lttng_log_level_rule_exactly_get_level(
-                                       log_level_rule, &level);
+                       llr_status = lttng_log_level_rule_exactly_get_level(log_level_rule, &level);
                        op = "==";
                        break;
                case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
                        llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                                       log_level_rule, &level);
+                               log_level_rule, &level);
                        op = ">=";
                        break;
                default:
@@ -262,16 +246,16 @@ static int generate_agent_filter(
                        char *new_filter;
 
                        err = asprintf(&new_filter,
-                                       "(%s) && (int_loglevel %s %d)",
-                                       agent_filter ? agent_filter : filter,
-                                       op, level);
+                                      "(%s) && (int_loglevel %s %d)",
+                                      agent_filter ? agent_filter : filter,
+                                      op,
+                                      level);
                        if (agent_filter) {
                                free(agent_filter);
                        }
                        agent_filter = new_filter;
                } else {
-                       err = asprintf(&agent_filter, "int_loglevel %s %d", op,
-                                       level);
+                       err = asprintf(&agent_filter, "int_loglevel %s %d", op, level);
                }
 
                if (err < 0) {
@@ -290,9 +274,8 @@ end:
 }
 
 static enum lttng_error_code
-lttng_event_rule_jul_logging_generate_filter_bytecode(
-               struct lttng_event_rule *rule,
-               const struct lttng_credentials *creds)
+lttng_event_rule_jul_logging_generate_filter_bytecode(struct lttng_event_rule *rule,
+                                                     const struct lttng_credentials *creds)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -304,8 +287,7 @@ lttng_event_rule_jul_logging_generate_filter_bytecode(
 
        LTTNG_ASSERT(rule);
 
-       jul_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_jul_logging::parent);
+       jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
 
        status = lttng_event_rule_jul_logging_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
@@ -334,8 +316,7 @@ lttng_event_rule_jul_logging_generate_filter_bytecode(
        }
 
        ret = run_as_generate_filter_bytecode(
-                       jul_logging->internal_filter.filter, creds,
-                       &bytecode);
+               jul_logging->internal_filter.filter, creds, &bytecode);
        if (ret) {
                ret_code = LTTNG_ERR_FILTER_INVAL;
                goto end;
@@ -351,48 +332,43 @@ end:
        return ret_code;
 }
 
-static const char *lttng_event_rule_jul_logging_get_internal_filter(
-               const struct lttng_event_rule *rule)
+static const char *
+lttng_event_rule_jul_logging_get_internal_filter(const struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_jul_logging *jul_logging;
 
        LTTNG_ASSERT(rule);
-       jul_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_jul_logging::parent);
+       jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
        return jul_logging->internal_filter.filter;
 }
 
 static const struct lttng_bytecode *
-lttng_event_rule_jul_logging_get_internal_filter_bytecode(
-               const struct lttng_event_rule *rule)
+lttng_event_rule_jul_logging_get_internal_filter_bytecode(const struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_jul_logging *jul_logging;
 
        LTTNG_ASSERT(rule);
-       jul_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_jul_logging::parent);
+       jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
        return jul_logging->internal_filter.bytecode;
 }
 
 static enum lttng_event_rule_generate_exclusions_status
-lttng_event_rule_jul_logging_generate_exclusions(
-               const struct lttng_event_rule *rule __attribute__((unused)),
-               struct lttng_event_exclusion **_exclusions)
+lttng_event_rule_jul_logging_generate_exclusions(const struct lttng_event_rule *rule
+                                                __attribute__((unused)),
+                                                struct lttng_event_exclusion **_exclusions)
 {
        /* Unsupported. */
        *_exclusions = NULL;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
-static unsigned long lttng_event_rule_jul_logging_hash(
-               const struct lttng_event_rule *rule)
+static unsigned long lttng_event_rule_jul_logging_hash(const struct lttng_event_rule *rule)
 {
        unsigned long hash;
        struct lttng_event_rule_jul_logging *tp_rule =
-                       lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
+               lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
 
-       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_JUL_LOGGING,
-                       lttng_ht_seed);
+       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_JUL_LOGGING, lttng_ht_seed);
        hash ^= hash_key_str(tp_rule->pattern, lttng_ht_seed);
 
        if (tp_rule->filter_expression) {
@@ -406,8 +382,8 @@ static unsigned long lttng_event_rule_jul_logging_hash(
        return hash;
 }
 
-static struct lttng_event *lttng_event_rule_jul_logging_generate_lttng_event(
-               const struct lttng_event_rule *rule)
+static struct lttng_event *
+lttng_event_rule_jul_logging_generate_lttng_event(const struct lttng_event_rule *rule)
 {
        int ret;
        const struct lttng_event_rule_jul_logging *jul_logging;
@@ -418,8 +394,7 @@ static struct lttng_event *lttng_event_rule_jul_logging_generate_lttng_event(
        enum lttng_event_rule_status status;
        const struct lttng_log_level_rule *log_level_rule;
 
-       jul_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_jul_logging::parent);
+       jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
 
        local_event = zmalloc<lttng_event>();
        if (!local_event) {
@@ -427,18 +402,15 @@ static struct lttng_event *lttng_event_rule_jul_logging_generate_lttng_event(
        }
 
        local_event->type = LTTNG_EVENT_TRACEPOINT;
-       ret = lttng_strncpy(local_event->name, jul_logging->pattern,
-                           sizeof(local_event->name));
+       ret = lttng_strncpy(local_event->name, jul_logging->pattern, sizeof(local_event->name));
        if (ret) {
                ERR("Truncation occurred when copying event rule pattern to `lttng_event` structure: pattern = '%s'",
-                               jul_logging->pattern);
+                   jul_logging->pattern);
                goto error;
        }
 
-
        /* Map the log level rule to an equivalent lttng_loglevel. */
-       status = lttng_event_rule_jul_logging_get_log_level_rule(
-                       rule, &log_level_rule);
+       status = lttng_event_rule_jul_logging_get_log_level_rule(rule, &log_level_rule);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
                loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
                loglevel_value = 0;
@@ -447,13 +419,13 @@ static struct lttng_event *lttng_event_rule_jul_logging_generate_lttng_event(
 
                switch (lttng_log_level_rule_get_type(log_level_rule)) {
                case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
-                       llr_status = lttng_log_level_rule_exactly_get_level(
-                                       log_level_rule, &loglevel_value);
+                       llr_status = lttng_log_level_rule_exactly_get_level(log_level_rule,
+                                                                           &loglevel_value);
                        loglevel_type = LTTNG_EVENT_LOGLEVEL_SINGLE;
                        break;
                case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
                        llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                                       log_level_rule, &loglevel_value);
+                               log_level_rule, &loglevel_value);
                        loglevel_type = LTTNG_EVENT_LOGLEVEL_RANGE;
                        break;
                default:
@@ -478,8 +450,9 @@ error:
        return event;
 }
 
-static enum lttng_error_code lttng_event_rule_jul_logging_mi_serialize(
-               const struct lttng_event_rule *rule, struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_rule_jul_logging_mi_serialize(const struct lttng_event_rule *rule,
+                                         struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -493,39 +466,35 @@ static enum lttng_error_code lttng_event_rule_jul_logging_mi_serialize(
        LTTNG_ASSERT(writer);
        LTTNG_ASSERT(IS_JUL_LOGGING_EVENT_RULE(rule));
 
-       status = lttng_event_rule_jul_logging_get_name_pattern(
-                       rule, &name_pattern);
+       status = lttng_event_rule_jul_logging_get_name_pattern(rule, &name_pattern);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
        LTTNG_ASSERT(name_pattern);
 
        status = lttng_event_rule_jul_logging_get_filter(rule, &filter);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
-                       status == LTTNG_EVENT_RULE_STATUS_UNSET);
+                    status == LTTNG_EVENT_RULE_STATUS_UNSET);
 
-       status = lttng_event_rule_jul_logging_get_log_level_rule(
-                       rule, &log_level_rule);
+       status = lttng_event_rule_jul_logging_get_log_level_rule(rule, &log_level_rule);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
-                       status == LTTNG_EVENT_RULE_STATUS_UNSET);
+                    status == LTTNG_EVENT_RULE_STATUS_UNSET);
 
        /* Open event rule jul logging element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_event_rule_jul_logging);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_rule_jul_logging);
        if (ret) {
                goto mi_error;
        }
 
        /* Name pattern. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_event_rule_name_pattern, name_pattern);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_event_rule_name_pattern, name_pattern);
        if (ret) {
                goto mi_error;
        }
 
        /* Filter expression. */
        if (filter != NULL) {
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_event_rule_filter_expression,
-                               filter);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, mi_lttng_element_event_rule_filter_expression, filter);
                if (ret) {
                        goto mi_error;
                }
@@ -533,8 +502,7 @@ static enum lttng_error_code lttng_event_rule_jul_logging_mi_serialize(
 
        /* Log level rule. */
        if (log_level_rule) {
-               ret_code = lttng_log_level_rule_mi_serialize(
-                               log_level_rule, writer);
+               ret_code = lttng_log_level_rule_mi_serialize(log_level_rule, writer);
                if (ret_code != LTTNG_OK) {
                        goto end;
                }
@@ -573,16 +541,13 @@ struct lttng_event_rule *lttng_event_rule_jul_logging_create(void)
        tp_rule->parent.equal = lttng_event_rule_jul_logging_is_equal;
        tp_rule->parent.destroy = lttng_event_rule_jul_logging_destroy;
        tp_rule->parent.generate_filter_bytecode =
-                       lttng_event_rule_jul_logging_generate_filter_bytecode;
-       tp_rule->parent.get_filter =
-                       lttng_event_rule_jul_logging_get_internal_filter;
+               lttng_event_rule_jul_logging_generate_filter_bytecode;
+       tp_rule->parent.get_filter = lttng_event_rule_jul_logging_get_internal_filter;
        tp_rule->parent.get_filter_bytecode =
-                       lttng_event_rule_jul_logging_get_internal_filter_bytecode;
-       tp_rule->parent.generate_exclusions =
-                       lttng_event_rule_jul_logging_generate_exclusions;
+               lttng_event_rule_jul_logging_get_internal_filter_bytecode;
+       tp_rule->parent.generate_exclusions = lttng_event_rule_jul_logging_generate_exclusions;
        tp_rule->parent.hash = lttng_event_rule_jul_logging_hash;
-       tp_rule->parent.generate_lttng_event =
-                       lttng_event_rule_jul_logging_generate_lttng_event;
+       tp_rule->parent.generate_lttng_event = lttng_event_rule_jul_logging_generate_lttng_event;
        tp_rule->parent.mi_serialize = lttng_event_rule_jul_logging_mi_serialize;
 
        tp_rule->log_level_rule = NULL;
@@ -598,9 +563,8 @@ end:
        return rule;
 }
 
-ssize_t lttng_event_rule_jul_logging_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_rule **_event_rule)
+ssize_t lttng_event_rule_jul_logging_create_from_payload(struct lttng_payload_view *view,
+                                                        struct lttng_event_rule **_event_rule)
 {
        ssize_t ret, offset = 0;
        enum lttng_event_rule_status status;
@@ -616,8 +580,8 @@ ssize_t lttng_event_rule_jul_logging_create_from_payload(
                goto end;
        }
 
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, sizeof(*jul_logging_comm));
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*jul_logging_comm));
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ERR("Failed to initialize from malformed event rule jul_logging: buffer too short to contain header.");
                ret = -1;
@@ -637,8 +601,8 @@ ssize_t lttng_event_rule_jul_logging_create_from_payload(
        offset += current_buffer_view.size;
 
        /* Map the pattern. */
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, jul_logging_comm->pattern_len);
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, jul_logging_comm->pattern_len);
 
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
@@ -646,8 +610,8 @@ ssize_t lttng_event_rule_jul_logging_create_from_payload(
        }
 
        pattern = current_buffer_view.data;
-       if (!lttng_buffer_view_contains_string(&current_buffer_view, pattern,
-                       jul_logging_comm->pattern_len)) {
+       if (!lttng_buffer_view_contains_string(
+                   &current_buffer_view, pattern, jul_logging_comm->pattern_len)) {
                ret = -1;
                goto end;
        }
@@ -660,8 +624,8 @@ ssize_t lttng_event_rule_jul_logging_create_from_payload(
        }
 
        /* Map the filter_expression. */
-       current_buffer_view = lttng_buffer_view_from_view(&view->buffer, offset,
-                       jul_logging_comm->filter_expression_len);
+       current_buffer_view = lttng_buffer_view_from_view(
+               &view->buffer, offset, jul_logging_comm->filter_expression_len);
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
                goto end;
@@ -669,8 +633,8 @@ ssize_t lttng_event_rule_jul_logging_create_from_payload(
 
        filter_expression = current_buffer_view.data;
        if (!lttng_buffer_view_contains_string(&current_buffer_view,
-                       filter_expression,
-                       jul_logging_comm->filter_expression_len)) {
+                                              filter_expression,
+                                              jul_logging_comm->filter_expression_len)) {
                ret = -1;
                goto end;
        }
@@ -685,12 +649,11 @@ skip_filter_expression:
 
        {
                /* Map the log level rule. */
-               struct lttng_payload_view current_payload_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               jul_logging_comm->log_level_rule_len);
+               struct lttng_payload_view current_payload_view = lttng_payload_view_from_view(
+                       view, offset, jul_logging_comm->log_level_rule_len);
 
-               ret = lttng_log_level_rule_create_from_payload(
-                               &current_payload_view, &log_level_rule);
+               ret = lttng_log_level_rule_create_from_payload(&current_payload_view,
+                                                              &log_level_rule);
                if (ret < 0) {
                        ret = -1;
                        goto end;
@@ -712,8 +675,7 @@ skip_log_level_rule:
        }
 
        if (filter_expression) {
-               status = lttng_event_rule_jul_logging_set_filter(
-                               rule, filter_expression);
+               status = lttng_event_rule_jul_logging_set_filter(rule, filter_expression);
                if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set event rule jul_logging pattern.");
                        ret = -1;
@@ -722,8 +684,7 @@ skip_log_level_rule:
        }
 
        if (log_level_rule) {
-               status = lttng_event_rule_jul_logging_set_log_level_rule(
-                               rule, log_level_rule);
+               status = lttng_event_rule_jul_logging_set_log_level_rule(rule, log_level_rule);
                if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set event rule jul_logging log level rule.");
                        ret = -1;
@@ -740,21 +701,19 @@ end:
        return ret;
 }
 
-enum lttng_event_rule_status lttng_event_rule_jul_logging_set_name_pattern(
-               struct lttng_event_rule *rule, const char *pattern)
+enum lttng_event_rule_status
+lttng_event_rule_jul_logging_set_name_pattern(struct lttng_event_rule *rule, const char *pattern)
 {
        char *pattern_copy = NULL;
        struct lttng_event_rule_jul_logging *jul_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
-       if (!rule || !IS_JUL_LOGGING_EVENT_RULE(rule) || !pattern ||
-                       strlen(pattern) == 0) {
+       if (!rule || !IS_JUL_LOGGING_EVENT_RULE(rule) || !pattern || strlen(pattern) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
 
-       jul_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_jul_logging::parent);
+       jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
        pattern_copy = strdup(pattern);
        if (!pattern_copy) {
                status = LTTNG_EVENT_RULE_STATUS_ERROR;
@@ -772,8 +731,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_jul_logging_get_name_pattern(
-               const struct lttng_event_rule *rule, const char **pattern)
+enum lttng_event_rule_status
+lttng_event_rule_jul_logging_get_name_pattern(const struct lttng_event_rule *rule,
+                                             const char **pattern)
 {
        struct lttng_event_rule_jul_logging *jul_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -783,8 +743,7 @@ enum lttng_event_rule_status lttng_event_rule_jul_logging_get_name_pattern(
                goto end;
        }
 
-       jul_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_jul_logging::parent);
+       jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
        if (!jul_logging->pattern) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
@@ -795,21 +754,19 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_jul_logging_set_filter(
-               struct lttng_event_rule *rule, const char *expression)
+enum lttng_event_rule_status lttng_event_rule_jul_logging_set_filter(struct lttng_event_rule *rule,
+                                                                    const char *expression)
 {
        char *expression_copy = NULL;
        struct lttng_event_rule_jul_logging *jul_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
-       if (!rule || !IS_JUL_LOGGING_EVENT_RULE(rule) || !expression ||
-                       strlen(expression) == 0) {
+       if (!rule || !IS_JUL_LOGGING_EVENT_RULE(rule) || !expression || strlen(expression) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
 
-       jul_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_jul_logging::parent);
+       jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
        expression_copy = strdup(expression);
        if (!expression_copy) {
                PERROR("Failed to copy filter expression");
@@ -827,8 +784,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_jul_logging_get_filter(
-               const struct lttng_event_rule *rule, const char **expression)
+enum lttng_event_rule_status
+lttng_event_rule_jul_logging_get_filter(const struct lttng_event_rule *rule,
+                                       const char **expression)
 {
        struct lttng_event_rule_jul_logging *jul_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -838,8 +796,7 @@ enum lttng_event_rule_status lttng_event_rule_jul_logging_get_filter(
                goto end;
        }
 
-       jul_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_jul_logging::parent);
+       jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
        if (!jul_logging->filter_expression) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
@@ -850,8 +807,7 @@ end:
        return status;
 }
 
-static bool log_level_rule_valid(
-               const struct lttng_log_level_rule *rule __attribute__((unused)))
+static bool log_level_rule_valid(const struct lttng_log_level_rule *rule __attribute__((unused)))
 {
        /*
         * For both JUL and LOG4J custom log level are possible and can
@@ -860,9 +816,9 @@ static bool log_level_rule_valid(
        return true;
 }
 
-enum lttng_event_rule_status lttng_event_rule_jul_logging_set_log_level_rule(
-               struct lttng_event_rule *rule,
-               const struct lttng_log_level_rule *log_level_rule)
+enum lttng_event_rule_status
+lttng_event_rule_jul_logging_set_log_level_rule(struct lttng_event_rule *rule,
+                                               const struct lttng_log_level_rule *log_level_rule)
 {
        struct lttng_event_rule_jul_logging *jul_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -873,8 +829,7 @@ enum lttng_event_rule_status lttng_event_rule_jul_logging_set_log_level_rule(
                goto end;
        }
 
-       jul_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_jul_logging::parent);
+       jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
 
        if (!log_level_rule_valid(log_level_rule)) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
@@ -897,10 +852,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_jul_logging_get_log_level_rule(
-               const struct lttng_event_rule *rule,
-               const struct lttng_log_level_rule **log_level_rule
-               )
+enum lttng_event_rule_status
+lttng_event_rule_jul_logging_get_log_level_rule(const struct lttng_event_rule *rule,
+                                               const struct lttng_log_level_rule **log_level_rule)
 {
        struct lttng_event_rule_jul_logging *jul_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -910,8 +864,7 @@ enum lttng_event_rule_status lttng_event_rule_jul_logging_get_log_level_rule(
                goto end;
        }
 
-       jul_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_jul_logging::parent);
+       jul_logging = lttng::utils::container_of(rule, &lttng_event_rule_jul_logging::parent);
        if (jul_logging->log_level_rule == NULL) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
index 239373aa90136f21bcaf5a885cb2deb8b0de9587..fd4929f327b5b6a750cc4c9ef386a6adfe7777a4 100644 (file)
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
 #include <common/runas.hpp>
-#include <ctype.h>
+
 #include <lttng/constant.h>
 #include <lttng/event-rule/event-rule-internal.hpp>
 #include <lttng/event-rule/event-rule.h>
 #include <lttng/event-rule/kernel-kprobe-internal.hpp>
 #include <lttng/kernel-probe-internal.hpp>
 #include <lttng/kernel-probe.h>
+
+#include <ctype.h>
 #include <stdio.h>
 
 #define IS_KPROBE_EVENT_RULE(rule) \
@@ -41,8 +43,7 @@ static void lttng_event_rule_kernel_kprobe_destroy(struct lttng_event_rule *rule
        free(kprobe);
 }
 
-static bool lttng_event_rule_kernel_kprobe_validate(
-               const struct lttng_event_rule *rule)
+static bool lttng_event_rule_kernel_kprobe_validate(const struct lttng_event_rule *rule)
 {
        bool valid = false;
        struct lttng_event_rule_kernel_kprobe *kprobe;
@@ -60,7 +61,7 @@ static bool lttng_event_rule_kernel_kprobe_validate(
        }
 
        /* Required field. */
-       if(!kprobe->location) {
+       if (!kprobe->location) {
                ERR("Invalid name event rule: a location must be set.");
                goto end;
        }
@@ -70,9 +71,8 @@ end:
        return valid;
 }
 
-static int lttng_event_rule_kernel_kprobe_serialize(
-               const struct lttng_event_rule *rule,
-               struct lttng_payload *payload)
+static int lttng_event_rule_kernel_kprobe_serialize(const struct lttng_event_rule *rule,
+                                                   struct lttng_payload *payload)
 {
        int ret;
        size_t name_len, header_offset, size_before_location;
@@ -93,8 +93,7 @@ static int lttng_event_rule_kernel_kprobe_serialize(
        name_len = strlen(kprobe->name) + 1;
        kprobe_comm.name_len = name_len;
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &kprobe_comm, sizeof(kprobe_comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &kprobe_comm, sizeof(kprobe_comm));
        if (ret) {
                goto end;
        }
@@ -112,8 +111,8 @@ static int lttng_event_rule_kernel_kprobe_serialize(
        }
 
        /* Update the header regarding the probe size. */
-       header = (struct lttng_event_rule_kernel_kprobe_comm*) (
-                       (char *) payload->buffer.data + header_offset);
+       header = (struct lttng_event_rule_kernel_kprobe_comm *) ((char *) payload->buffer.data +
+                                                                header_offset);
        header->location_len = payload->buffer.size - size_before_location;
 
        ret = 0;
@@ -123,7 +122,7 @@ end:
 }
 
 static bool lttng_event_rule_kernel_kprobe_is_equal(const struct lttng_event_rule *_a,
-               const struct lttng_event_rule *_b)
+                                                   const struct lttng_event_rule *_b)
 {
        bool is_equal = false;
        struct lttng_event_rule_kernel_kprobe *a, *b;
@@ -143,65 +142,59 @@ static bool lttng_event_rule_kernel_kprobe_is_equal(const struct lttng_event_rul
                goto end;
        }
 
-       is_equal = lttng_kernel_probe_location_is_equal(
-                       a->location, b->location);
+       is_equal = lttng_kernel_probe_location_is_equal(a->location, b->location);
 end:
        return is_equal;
 }
 
 static enum lttng_error_code lttng_event_rule_kernel_kprobe_generate_filter_bytecode(
-               struct lttng_event_rule *rule __attribute__((unused)),
-               const struct lttng_credentials *creds __attribute__((unused)))
+       struct lttng_event_rule *rule __attribute__((unused)),
+       const struct lttng_credentials *creds __attribute__((unused)))
 {
        /* Nothing to do. */
        return LTTNG_OK;
 }
 
-static const char *lttng_event_rule_kernel_kprobe_get_filter(
-               const struct lttng_event_rule *rule __attribute__((unused)))
+static const char *lttng_event_rule_kernel_kprobe_get_filter(const struct lttng_event_rule *rule
+                                                            __attribute__((unused)))
 {
        /* Not supported. */
        return NULL;
 }
 
 static const struct lttng_bytecode *
-lttng_event_rule_kernel_kprobe_get_filter_bytecode(
-               const struct lttng_event_rule *rule __attribute__((unused)))
+lttng_event_rule_kernel_kprobe_get_filter_bytecode(const struct lttng_event_rule *rule
+                                                  __attribute__((unused)))
 {
        /* Not supported. */
        return NULL;
 }
 
 static enum lttng_event_rule_generate_exclusions_status
-lttng_event_rule_kernel_kprobe_generate_exclusions(
-               const struct lttng_event_rule *rule __attribute__((unused)),
-               struct lttng_event_exclusion **exclusions)
+lttng_event_rule_kernel_kprobe_generate_exclusions(const struct lttng_event_rule *rule
+                                                  __attribute__((unused)),
+                                                  struct lttng_event_exclusion **exclusions)
 {
        /* Not supported. */
        *exclusions = NULL;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
-static unsigned long
-lttng_event_rule_kernel_kprobe_hash(
-               const struct lttng_event_rule *rule)
+static unsigned long lttng_event_rule_kernel_kprobe_hash(const struct lttng_event_rule *rule)
 {
        unsigned long hash;
        struct lttng_event_rule_kernel_kprobe *krule =
-                       lttng::utils::container_of(rule, &lttng_event_rule_kernel_kprobe::parent);
+               lttng::utils::container_of(rule, &lttng_event_rule_kernel_kprobe::parent);
 
-       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE,
-                       lttng_ht_seed);
+       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE, lttng_ht_seed);
        hash ^= hash_key_str(krule->name, lttng_ht_seed);
        hash ^= lttng_kernel_probe_location_hash(krule->location);
 
        return hash;
 }
 
-static
-int kernel_probe_set_location(
-               struct lttng_event_rule_kernel_kprobe *kprobe,
-               const struct lttng_kernel_probe_location *location)
+static int kernel_probe_set_location(struct lttng_event_rule_kernel_kprobe *kprobe,
+                                    const struct lttng_kernel_probe_location *location)
 {
        int ret;
        struct lttng_kernel_probe_location *location_copy = NULL;
@@ -225,9 +218,9 @@ end:
        return ret;
 }
 
-static
-enum lttng_error_code lttng_event_rule_kernel_kprobe_mi_serialize(
-               const struct lttng_event_rule *rule, struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_rule_kernel_kprobe_mi_serialize(const struct lttng_event_rule *rule,
+                                           struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -239,8 +232,7 @@ enum lttng_error_code lttng_event_rule_kernel_kprobe_mi_serialize(
        LTTNG_ASSERT(writer);
        LTTNG_ASSERT(IS_KPROBE_EVENT_RULE(rule));
 
-       status = lttng_event_rule_kernel_kprobe_get_event_name(
-                       rule, &event_name);
+       status = lttng_event_rule_kernel_kprobe_get_event_name(rule, &event_name);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
        LTTNG_ASSERT(event_name);
 
@@ -249,15 +241,14 @@ enum lttng_error_code lttng_event_rule_kernel_kprobe_mi_serialize(
        LTTNG_ASSERT(location);
 
        /* Open event rule kernel kprobe element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_event_rule_kernel_kprobe);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_rule_kernel_kprobe);
        if (ret) {
                goto mi_error;
        }
 
        /* Name. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_event_rule_event_name, event_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_event_rule_event_name, event_name);
        if (ret) {
                goto mi_error;
        }
@@ -283,8 +274,8 @@ end:
        return ret_code;
 }
 
-struct lttng_event_rule *lttng_event_rule_kernel_kprobe_create(
-               const struct lttng_kernel_probe_location *location)
+struct lttng_event_rule *
+lttng_event_rule_kernel_kprobe_create(const struct lttng_kernel_probe_location *location)
 {
        struct lttng_event_rule *rule = NULL;
        struct lttng_event_rule_kernel_kprobe *krule;
@@ -301,12 +292,10 @@ struct lttng_event_rule *lttng_event_rule_kernel_kprobe_create(
        krule->parent.equal = lttng_event_rule_kernel_kprobe_is_equal;
        krule->parent.destroy = lttng_event_rule_kernel_kprobe_destroy;
        krule->parent.generate_filter_bytecode =
-                       lttng_event_rule_kernel_kprobe_generate_filter_bytecode;
+               lttng_event_rule_kernel_kprobe_generate_filter_bytecode;
        krule->parent.get_filter = lttng_event_rule_kernel_kprobe_get_filter;
-       krule->parent.get_filter_bytecode =
-                       lttng_event_rule_kernel_kprobe_get_filter_bytecode;
-       krule->parent.generate_exclusions =
-                       lttng_event_rule_kernel_kprobe_generate_exclusions;
+       krule->parent.get_filter_bytecode = lttng_event_rule_kernel_kprobe_get_filter_bytecode;
+       krule->parent.generate_exclusions = lttng_event_rule_kernel_kprobe_generate_exclusions;
        krule->parent.hash = lttng_event_rule_kernel_kprobe_hash;
        krule->parent.mi_serialize = lttng_event_rule_kernel_kprobe_mi_serialize;
 
@@ -319,9 +308,8 @@ end:
        return rule;
 }
 
-ssize_t lttng_event_rule_kernel_kprobe_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_rule **_event_rule)
+ssize_t lttng_event_rule_kernel_kprobe_create_from_payload(struct lttng_payload_view *view,
+                                                          struct lttng_event_rule **_event_rule)
 {
        ssize_t ret, offset = 0;
        enum lttng_event_rule_status status;
@@ -336,8 +324,8 @@ ssize_t lttng_event_rule_kernel_kprobe_create_from_payload(
                goto end;
        }
 
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, sizeof(*kprobe_comm));
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*kprobe_comm));
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ERR("Failed to initialize from malformed event rule kprobe: buffer too short to contain header.");
                ret = -1;
@@ -352,8 +340,7 @@ ssize_t lttng_event_rule_kernel_kprobe_create_from_payload(
        {
                /* Map the name. */
                struct lttng_payload_view current_payload_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               kprobe_comm->name_len);
+                       lttng_payload_view_from_view(view, offset, kprobe_comm->name_len);
 
                if (!lttng_payload_view_is_valid(&current_payload_view)) {
                        ret = -1;
@@ -362,8 +349,7 @@ ssize_t lttng_event_rule_kernel_kprobe_create_from_payload(
 
                name = current_payload_view.buffer.data;
                if (!lttng_buffer_view_contains_string(
-                               &current_payload_view.buffer, name,
-                               kprobe_comm->name_len)) {
+                           &current_payload_view.buffer, name, kprobe_comm->name_len)) {
                        ret = -1;
                        goto end;
                }
@@ -375,16 +361,15 @@ ssize_t lttng_event_rule_kernel_kprobe_create_from_payload(
        /* Map the kernel probe location. */
        {
                struct lttng_payload_view current_payload_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               kprobe_comm->location_len);
+                       lttng_payload_view_from_view(view, offset, kprobe_comm->location_len);
 
                if (!lttng_payload_view_is_valid(&current_payload_view)) {
                        ret = -1;
                        goto end;
                }
 
-               ret = lttng_kernel_probe_location_create_from_payload(
-                               &current_payload_view, &location);
+               ret = lttng_kernel_probe_location_create_from_payload(&current_payload_view,
+                                                                     &location);
                if (ret < 0) {
                        ret = -1;
                        goto end;
@@ -422,9 +407,9 @@ end:
        return ret;
 }
 
-enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_get_location(
-               const struct lttng_event_rule *rule,
-               const struct lttng_kernel_probe_location **location)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_kprobe_get_location(const struct lttng_event_rule *rule,
+                                           const struct lttng_kernel_probe_location **location)
 {
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
        struct lttng_event_rule_kernel_kprobe *kprobe;
@@ -446,15 +431,14 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_set_event_name(
-               struct lttng_event_rule *rule, const char *name)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_kprobe_set_event_name(struct lttng_event_rule *rule, const char *name)
 {
        char *name_copy = NULL;
        struct lttng_event_rule_kernel_kprobe *kprobe;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
-       if (!rule || !IS_KPROBE_EVENT_RULE(rule) || !name ||
-                       strlen(name) == 0) {
+       if (!rule || !IS_KPROBE_EVENT_RULE(rule) || !name || strlen(name) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
@@ -474,8 +458,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_get_event_name(
-               const struct lttng_event_rule *rule, const char **name)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_kprobe_get_event_name(const struct lttng_event_rule *rule,
+                                             const char **name)
 {
        struct lttng_event_rule_kernel_kprobe *kprobe;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
index 633c4698b3558e1b823005f66fb9338de59648bc..a75280454309569772d43b2533e215b6f87384eb 100644 (file)
@@ -15,6 +15,7 @@
 #include <common/payload.hpp>
 #include <common/runas.hpp>
 #include <common/string-utils/string-utils.hpp>
+
 #include <lttng/event-rule/event-rule-internal.hpp>
 #include <lttng/event-rule/kernel-syscall-internal.hpp>
 
@@ -38,8 +39,7 @@ static void lttng_event_rule_kernel_syscall_destroy(struct lttng_event_rule *rul
        free(syscall);
 }
 
-static bool lttng_event_rule_kernel_syscall_validate(
-               const struct lttng_event_rule *rule)
+static bool lttng_event_rule_kernel_syscall_validate(const struct lttng_event_rule *rule)
 {
        bool valid = false;
        struct lttng_event_rule_kernel_syscall *syscall;
@@ -61,9 +61,8 @@ end:
        return valid;
 }
 
-static int lttng_event_rule_kernel_syscall_serialize(
-               const struct lttng_event_rule *rule,
-               struct lttng_payload *payload)
+static int lttng_event_rule_kernel_syscall_serialize(const struct lttng_event_rule *rule,
+                                                    struct lttng_payload *payload)
 {
        int ret;
        size_t pattern_len, filter_expression_len;
@@ -90,26 +89,24 @@ static int lttng_event_rule_kernel_syscall_serialize(
        syscall_comm.filter_expression_len = filter_expression_len;
        syscall_comm.emission_site = syscall->emission_site;
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &syscall_comm, sizeof(syscall_comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &syscall_comm, sizeof(syscall_comm));
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, syscall->pattern, pattern_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, syscall->pattern, pattern_len);
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer,
-                       syscall->filter_expression, filter_expression_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, syscall->filter_expression, filter_expression_len);
 end:
        return ret;
 }
 
 static bool lttng_event_rule_kernel_syscall_is_equal(const struct lttng_event_rule *_a,
-               const struct lttng_event_rule *_b)
+                                                    const struct lttng_event_rule *_b)
 {
        bool is_equal = false;
        struct lttng_event_rule_kernel_syscall *a, *b;
@@ -141,9 +138,9 @@ end:
        return is_equal;
 }
 
-static enum lttng_error_code lttng_event_rule_kernel_syscall_generate_filter_bytecode(
-               struct lttng_event_rule *rule,
-               const struct lttng_credentials *creds)
+static enum lttng_error_code
+lttng_event_rule_kernel_syscall_generate_filter_bytecode(struct lttng_event_rule *rule,
+                                                        const struct lttng_credentials *creds)
 {
        int ret;
        enum lttng_error_code ret_code = LTTNG_OK;
@@ -182,8 +179,7 @@ static enum lttng_error_code lttng_event_rule_kernel_syscall_generate_filter_byt
                goto end;
        }
 
-       ret = run_as_generate_filter_bytecode(
-                       syscall->internal_filter.filter, creds, &bytecode);
+       ret = run_as_generate_filter_bytecode(syscall->internal_filter.filter, creds, &bytecode);
        if (ret) {
                ret_code = LTTNG_ERR_FILTER_INVAL;
        }
@@ -196,8 +192,8 @@ end:
        return ret_code;
 }
 
-static const char *lttng_event_rule_kernel_syscall_get_internal_filter(
-               const struct lttng_event_rule *rule)
+static const char *
+lttng_event_rule_kernel_syscall_get_internal_filter(const struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_kernel_syscall *syscall;
 
@@ -208,8 +204,7 @@ static const char *lttng_event_rule_kernel_syscall_get_internal_filter(
 }
 
 static const struct lttng_bytecode *
-lttng_event_rule_kernel_syscall_get_internal_filter_bytecode(
-               const struct lttng_event_rule *rule)
+lttng_event_rule_kernel_syscall_get_internal_filter_bytecode(const struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_kernel_syscall *syscall;
 
@@ -220,36 +215,33 @@ lttng_event_rule_kernel_syscall_get_internal_filter_bytecode(
 }
 
 static enum lttng_event_rule_generate_exclusions_status
-lttng_event_rule_kernel_syscall_generate_exclusions(
-               const struct lttng_event_rule *rule __attribute__((unused)),
-               struct lttng_event_exclusion **exclusions)
+lttng_event_rule_kernel_syscall_generate_exclusions(const struct lttng_event_rule *rule
+                                                   __attribute__((unused)),
+                                                   struct lttng_event_exclusion **exclusions)
 {
        /* Unsupported. */
        *exclusions = NULL;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
-static unsigned long
-lttng_event_rule_kernel_syscall_hash(
-               const struct lttng_event_rule *rule)
+static unsigned long lttng_event_rule_kernel_syscall_hash(const struct lttng_event_rule *rule)
 {
        unsigned long hash;
        struct lttng_event_rule_kernel_syscall *syscall_rule =
-                       lttng::utils::container_of(rule, &lttng_event_rule_kernel_syscall::parent);
+               lttng::utils::container_of(rule, &lttng_event_rule_kernel_syscall::parent);
 
-       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL,
-                       lttng_ht_seed);
+       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL, lttng_ht_seed);
        hash ^= hash_key_str(syscall_rule->pattern, lttng_ht_seed);
        if (syscall_rule->filter_expression) {
-               hash ^= hash_key_str(syscall_rule->filter_expression,
-                               lttng_ht_seed);
+               hash ^= hash_key_str(syscall_rule->filter_expression, lttng_ht_seed);
        }
 
        return hash;
 }
 
-static enum lttng_error_code lttng_event_rule_kernel_syscall_mi_serialize(
-               const struct lttng_event_rule *rule, struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_rule_kernel_syscall_mi_serialize(const struct lttng_event_rule *rule,
+                                            struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -264,14 +256,13 @@ static enum lttng_error_code lttng_event_rule_kernel_syscall_mi_serialize(
        LTTNG_ASSERT(writer);
        LTTNG_ASSERT(IS_SYSCALL_EVENT_RULE(rule));
 
-       status = lttng_event_rule_kernel_syscall_get_name_pattern(
-                       rule, &name_pattern);
+       status = lttng_event_rule_kernel_syscall_get_name_pattern(rule, &name_pattern);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
        LTTNG_ASSERT(name_pattern);
 
        status = lttng_event_rule_kernel_syscall_get_filter(rule, &filter);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
-                       status == LTTNG_EVENT_RULE_STATUS_UNSET);
+                    status == LTTNG_EVENT_RULE_STATUS_UNSET);
 
        site_type = lttng_event_rule_kernel_syscall_get_emission_site(rule);
 
@@ -291,32 +282,29 @@ static enum lttng_error_code lttng_event_rule_kernel_syscall_mi_serialize(
        }
 
        /* Open event rule kernel syscall element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_event_rule_kernel_syscall);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_rule_kernel_syscall);
        if (ret) {
                goto mi_error;
        }
 
        /* Emission site. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_event_rule_kernel_syscall_emission_site,
-                       site_type_str);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_event_rule_kernel_syscall_emission_site, site_type_str);
        if (ret) {
                goto mi_error;
        }
 
        /* Name pattern. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_event_rule_name_pattern, name_pattern);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_event_rule_name_pattern, name_pattern);
        if (ret) {
                goto mi_error;
        }
 
        /* Filter. */
        if (filter != NULL) {
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_event_rule_filter_expression,
-                               filter);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, mi_lttng_element_event_rule_filter_expression, filter);
                if (ret) {
                        goto mi_error;
                }
@@ -338,8 +326,7 @@ end:
 }
 
 struct lttng_event_rule *lttng_event_rule_kernel_syscall_create(
-               enum lttng_event_rule_kernel_syscall_emission_site
-                               emission_site)
+       enum lttng_event_rule_kernel_syscall_emission_site emission_site)
 {
        struct lttng_event_rule *rule = NULL;
        struct lttng_event_rule_kernel_syscall *syscall_rule;
@@ -362,20 +349,18 @@ struct lttng_event_rule *lttng_event_rule_kernel_syscall_create(
        }
 
        rule = &syscall_rule->parent;
-       lttng_event_rule_init(
-                       &syscall_rule->parent, LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL);
+       lttng_event_rule_init(&syscall_rule->parent, LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL);
        syscall_rule->parent.validate = lttng_event_rule_kernel_syscall_validate;
        syscall_rule->parent.serialize = lttng_event_rule_kernel_syscall_serialize;
        syscall_rule->parent.equal = lttng_event_rule_kernel_syscall_is_equal;
        syscall_rule->parent.destroy = lttng_event_rule_kernel_syscall_destroy;
        syscall_rule->parent.generate_filter_bytecode =
-                       lttng_event_rule_kernel_syscall_generate_filter_bytecode;
-       syscall_rule->parent.get_filter =
-                       lttng_event_rule_kernel_syscall_get_internal_filter;
+               lttng_event_rule_kernel_syscall_generate_filter_bytecode;
+       syscall_rule->parent.get_filter = lttng_event_rule_kernel_syscall_get_internal_filter;
        syscall_rule->parent.get_filter_bytecode =
-                       lttng_event_rule_kernel_syscall_get_internal_filter_bytecode;
+               lttng_event_rule_kernel_syscall_get_internal_filter_bytecode;
        syscall_rule->parent.generate_exclusions =
-                       lttng_event_rule_kernel_syscall_generate_exclusions;
+               lttng_event_rule_kernel_syscall_generate_exclusions;
        syscall_rule->parent.hash = lttng_event_rule_kernel_syscall_hash;
        syscall_rule->parent.mi_serialize = lttng_event_rule_kernel_syscall_mi_serialize;
 
@@ -393,9 +378,8 @@ end:
        return rule;
 }
 
-ssize_t lttng_event_rule_kernel_syscall_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_rule **_event_rule)
+ssize_t lttng_event_rule_kernel_syscall_create_from_payload(struct lttng_payload_view *view,
+                                                           struct lttng_event_rule **_event_rule)
 {
        ssize_t ret, offset = 0;
        enum lttng_event_rule_status status;
@@ -416,15 +400,16 @@ ssize_t lttng_event_rule_kernel_syscall_create_from_payload(
                goto end;
        }
 
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, sizeof(*syscall_comm));
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*syscall_comm));
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
                goto end;
        }
 
        syscall_comm = (typeof(syscall_comm)) current_buffer_view.data;
-       rule = lttng_event_rule_kernel_syscall_create((lttng_event_rule_kernel_syscall_emission_site) syscall_comm->emission_site);
+       rule = lttng_event_rule_kernel_syscall_create(
+               (lttng_event_rule_kernel_syscall_emission_site) syscall_comm->emission_site);
        if (!rule) {
                ERR("Failed to create event rule syscall");
                ret = -1;
@@ -435,16 +420,16 @@ ssize_t lttng_event_rule_kernel_syscall_create_from_payload(
        offset += current_buffer_view.size;
 
        /* Map the pattern. */
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, syscall_comm->pattern_len);
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, syscall_comm->pattern_len);
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
                goto end;
        }
 
        pattern = current_buffer_view.data;
-       if (!lttng_buffer_view_contains_string(&current_buffer_view, pattern,
-                       syscall_comm->pattern_len)) {
+       if (!lttng_buffer_view_contains_string(
+                   &current_buffer_view, pattern, syscall_comm->pattern_len)) {
                ret = -1;
                goto end;
        }
@@ -457,17 +442,16 @@ ssize_t lttng_event_rule_kernel_syscall_create_from_payload(
        }
 
        /* Map the filter_expression. */
-       current_buffer_view = lttng_buffer_view_from_view(&view->buffer, offset,
-                       syscall_comm->filter_expression_len);
+       current_buffer_view = lttng_buffer_view_from_view(
+               &view->buffer, offset, syscall_comm->filter_expression_len);
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
                goto end;
        }
 
        filter_expression = current_buffer_view.data;
-       if (!lttng_buffer_view_contains_string(&current_buffer_view,
-                               filter_expression,
-                               syscall_comm->filter_expression_len)) {
+       if (!lttng_buffer_view_contains_string(
+                   &current_buffer_view, filter_expression, syscall_comm->filter_expression_len)) {
                ret = -1;
                goto end;
        }
@@ -485,8 +469,7 @@ skip_filter_expression:
        }
 
        if (filter_expression) {
-               status = lttng_event_rule_kernel_syscall_set_filter(
-                               rule, filter_expression);
+               status = lttng_event_rule_kernel_syscall_set_filter(rule, filter_expression);
                if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set event rule syscall pattern");
                        ret = -1;
@@ -502,15 +485,14 @@ end:
        return ret;
 }
 
-enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_name_pattern(
-               struct lttng_event_rule *rule, const char *pattern)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_syscall_set_name_pattern(struct lttng_event_rule *rule, const char *pattern)
 {
        char *pattern_copy = NULL;
        struct lttng_event_rule_kernel_syscall *syscall;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
-       if (!rule || !IS_SYSCALL_EVENT_RULE(rule) || !pattern ||
-                       strlen(pattern) == 0) {
+       if (!rule || !IS_SYSCALL_EVENT_RULE(rule) || !pattern || strlen(pattern) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
@@ -532,8 +514,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_kernel_syscall_get_name_pattern(
-               const struct lttng_event_rule *rule, const char **pattern)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_syscall_get_name_pattern(const struct lttng_event_rule *rule,
+                                                const char **pattern)
 {
        struct lttng_event_rule_kernel_syscall *syscall;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -554,8 +537,8 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_filter(
-               struct lttng_event_rule *rule, const char *expression)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_syscall_set_filter(struct lttng_event_rule *rule, const char *expression)
 {
        char *expression_copy = NULL;
        struct lttng_event_rule_kernel_syscall *syscall;
@@ -563,8 +546,7 @@ enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_filter(
 
        /* TODO: validate that the passed expression is valid. */
 
-       if (!rule || !IS_SYSCALL_EVENT_RULE(rule) || !expression ||
-                       strlen(expression) == 0) {
+       if (!rule || !IS_SYSCALL_EVENT_RULE(rule) || !expression || strlen(expression) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
@@ -586,8 +568,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_kernel_syscall_get_filter(
-               const struct lttng_event_rule *rule, const char **expression)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_syscall_get_filter(const struct lttng_event_rule *rule,
+                                          const char **expression)
 {
        struct lttng_event_rule_kernel_syscall *syscall;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -608,8 +591,7 @@ end:
        return status;
 }
 extern enum lttng_event_rule_kernel_syscall_emission_site
-lttng_event_rule_kernel_syscall_get_emission_site(
-               const struct lttng_event_rule *rule)
+lttng_event_rule_kernel_syscall_get_emission_site(const struct lttng_event_rule *rule)
 {
        enum lttng_event_rule_kernel_syscall_emission_site emission_site =
                LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_UNKNOWN;
@@ -627,7 +609,7 @@ end:
 }
 
 const char *lttng_event_rule_kernel_syscall_emission_site_str(
-               enum lttng_event_rule_kernel_syscall_emission_site emission_site)
+       enum lttng_event_rule_kernel_syscall_emission_site emission_site)
 {
        switch (emission_site) {
        case LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY:
index 939b83fbbe954ec3d8519b8b5891d0207af39246..f1bdecb06e9e4968cfb1bdf5fb31377ac1bf84dc 100644 (file)
@@ -16,6 +16,7 @@
 #include <common/payload.hpp>
 #include <common/runas.hpp>
 #include <common/string-utils/string-utils.hpp>
+
 #include <lttng/event-rule/event-rule-internal.hpp>
 #include <lttng/event-rule/kernel-tracepoint-internal.hpp>
 #include <lttng/event.h>
@@ -31,8 +32,7 @@ static void lttng_event_rule_kernel_tracepoint_destroy(struct lttng_event_rule *
                return;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_kernel_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_kernel_tracepoint::parent);
 
        free(tracepoint->pattern);
        free(tracepoint->filter_expression);
@@ -41,8 +41,7 @@ static void lttng_event_rule_kernel_tracepoint_destroy(struct lttng_event_rule *
        free(tracepoint);
 }
 
-static bool lttng_event_rule_kernel_tracepoint_validate(
-               const struct lttng_event_rule *rule)
+static bool lttng_event_rule_kernel_tracepoint_validate(const struct lttng_event_rule *rule)
 {
        bool valid = false;
        struct lttng_event_rule_kernel_tracepoint *tracepoint;
@@ -51,8 +50,7 @@ static bool lttng_event_rule_kernel_tracepoint_validate(
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_kernel_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_kernel_tracepoint::parent);
 
        /* Required field. */
        if (!tracepoint->pattern) {
@@ -65,9 +63,8 @@ end:
        return valid;
 }
 
-static int lttng_event_rule_kernel_tracepoint_serialize(
-               const struct lttng_event_rule *rule,
-               struct lttng_payload *payload)
+static int lttng_event_rule_kernel_tracepoint_serialize(const struct lttng_event_rule *rule,
+                                                       struct lttng_payload *payload)
 {
        int ret;
        size_t pattern_len, filter_expression_len;
@@ -80,14 +77,12 @@ static int lttng_event_rule_kernel_tracepoint_serialize(
        }
 
        DBG("Serializing kernel tracepoint event rule.");
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_kernel_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_kernel_tracepoint::parent);
 
        pattern_len = strlen(tracepoint->pattern) + 1;
 
        if (tracepoint->filter_expression != NULL) {
-               filter_expression_len =
-                               strlen(tracepoint->filter_expression) + 1;
+               filter_expression_len = strlen(tracepoint->filter_expression) + 1;
        } else {
                filter_expression_len = 0;
        }
@@ -95,20 +90,19 @@ static int lttng_event_rule_kernel_tracepoint_serialize(
        tracepoint_comm.pattern_len = pattern_len;
        tracepoint_comm.filter_expression_len = filter_expression_len;
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &tracepoint_comm,
-                       sizeof(tracepoint_comm));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &tracepoint_comm, sizeof(tracepoint_comm));
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, tracepoint->pattern, pattern_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, tracepoint->pattern, pattern_len);
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, tracepoint->filter_expression,
-                       filter_expression_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, tracepoint->filter_expression, filter_expression_len);
        if (ret) {
                goto end;
        }
@@ -117,9 +111,8 @@ end:
        return ret;
 }
 
-static bool lttng_event_rule_kernel_tracepoint_is_equal(
-               const struct lttng_event_rule *_a,
-               const struct lttng_event_rule *_b)
+static bool lttng_event_rule_kernel_tracepoint_is_equal(const struct lttng_event_rule *_a,
+                                                       const struct lttng_event_rule *_b)
 {
        bool is_equal = false;
        struct lttng_event_rule_kernel_tracepoint *a, *b;
@@ -153,9 +146,8 @@ end:
 }
 
 static enum lttng_error_code
-lttng_event_rule_kernel_tracepoint_generate_filter_bytecode(
-               struct lttng_event_rule *rule,
-               const struct lttng_credentials *creds)
+lttng_event_rule_kernel_tracepoint_generate_filter_bytecode(struct lttng_event_rule *rule,
+                                                           const struct lttng_credentials *creds)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -166,8 +158,7 @@ lttng_event_rule_kernel_tracepoint_generate_filter_bytecode(
 
        LTTNG_ASSERT(rule);
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_kernel_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_kernel_tracepoint::parent);
 
        status = lttng_event_rule_kernel_tracepoint_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
@@ -197,9 +188,7 @@ lttng_event_rule_kernel_tracepoint_generate_filter_bytecode(
                goto end;
        }
 
-       ret = run_as_generate_filter_bytecode(
-                       tracepoint->internal_filter.filter, creds,
-                       &bytecode);
+       ret = run_as_generate_filter_bytecode(tracepoint->internal_filter.filter, creds, &bytecode);
        if (ret) {
                ret_code = LTTNG_ERR_FILTER_INVAL;
                goto end;
@@ -215,48 +204,43 @@ end:
        return ret_code;
 }
 
-static const char *lttng_event_rule_kernel_tracepoint_get_internal_filter(
-               const struct lttng_event_rule *rule)
+static const char *
+lttng_event_rule_kernel_tracepoint_get_internal_filter(const struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_kernel_tracepoint *tracepoint;
 
        LTTNG_ASSERT(rule);
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_kernel_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_kernel_tracepoint::parent);
        return tracepoint->internal_filter.filter;
 }
 
 static const struct lttng_bytecode *
-lttng_event_rule_kernel_tracepoint_get_internal_filter_bytecode(
-               const struct lttng_event_rule *rule)
+lttng_event_rule_kernel_tracepoint_get_internal_filter_bytecode(const struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_kernel_tracepoint *tracepoint;
 
        LTTNG_ASSERT(rule);
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_kernel_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_kernel_tracepoint::parent);
        return tracepoint->internal_filter.bytecode;
 }
 
 static enum lttng_event_rule_generate_exclusions_status
-lttng_event_rule_kernel_tracepoint_generate_exclusions(
-               const struct lttng_event_rule *rule __attribute__((unused)),
-               struct lttng_event_exclusion **_exclusions)
+lttng_event_rule_kernel_tracepoint_generate_exclusions(const struct lttng_event_rule *rule
+                                                      __attribute__((unused)),
+                                                      struct lttng_event_exclusion **_exclusions)
 {
        /* Unsupported. */
        *_exclusions = NULL;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
-static unsigned long lttng_event_rule_kernel_tracepoint_hash(
-               const struct lttng_event_rule *rule)
+static unsigned long lttng_event_rule_kernel_tracepoint_hash(const struct lttng_event_rule *rule)
 {
        unsigned long hash;
-       struct lttng_event_rule_kernel_tracepoint *tp_rule = lttng::utils::container_of(
-                       rule, &lttng_event_rule_kernel_tracepoint::parent);
+       struct lttng_event_rule_kernel_tracepoint *tp_rule =
+               lttng::utils::container_of(rule, &lttng_event_rule_kernel_tracepoint::parent);
 
-       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT,
-                       lttng_ht_seed);
+       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT, lttng_ht_seed);
        hash ^= hash_key_str(tp_rule->pattern, lttng_ht_seed);
 
        if (tp_rule->filter_expression) {
@@ -266,8 +250,9 @@ static unsigned long lttng_event_rule_kernel_tracepoint_hash(
        return hash;
 }
 
-static enum lttng_error_code lttng_event_rule_kernel_tracepoint_mi_serialize(
-               const struct lttng_event_rule *rule, struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_rule_kernel_tracepoint_mi_serialize(const struct lttng_event_rule *rule,
+                                               struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -279,34 +264,31 @@ static enum lttng_error_code lttng_event_rule_kernel_tracepoint_mi_serialize(
        LTTNG_ASSERT(writer);
        LTTNG_ASSERT(IS_KERNEL_TRACEPOINT_EVENT_RULE(rule));
 
-       status = lttng_event_rule_kernel_tracepoint_get_name_pattern(
-                       rule, &name_pattern);
+       status = lttng_event_rule_kernel_tracepoint_get_name_pattern(rule, &name_pattern);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
        LTTNG_ASSERT(name_pattern);
 
        status = lttng_event_rule_kernel_tracepoint_get_filter(rule, &filter);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
-                       status == LTTNG_EVENT_RULE_STATUS_UNSET);
+                    status == LTTNG_EVENT_RULE_STATUS_UNSET);
 
        /* Open event rule kernel tracepoint element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_event_rule_kernel_tracepoint);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_rule_kernel_tracepoint);
        if (ret) {
                goto mi_error;
        }
 
        /* Name pattern. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_event_rule_name_pattern, name_pattern);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_event_rule_name_pattern, name_pattern);
        if (ret) {
                goto mi_error;
        }
 
        /* Filter. */
        if (filter != NULL) {
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_event_rule_filter_expression,
-                               filter);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, mi_lttng_element_event_rule_filter_expression, filter);
                if (ret) {
                        goto mi_error;
                }
@@ -345,13 +327,12 @@ struct lttng_event_rule *lttng_event_rule_kernel_tracepoint_create(void)
        tp_rule->parent.equal = lttng_event_rule_kernel_tracepoint_is_equal;
        tp_rule->parent.destroy = lttng_event_rule_kernel_tracepoint_destroy;
        tp_rule->parent.generate_filter_bytecode =
-                       lttng_event_rule_kernel_tracepoint_generate_filter_bytecode;
-       tp_rule->parent.get_filter =
-                       lttng_event_rule_kernel_tracepoint_get_internal_filter;
+               lttng_event_rule_kernel_tracepoint_generate_filter_bytecode;
+       tp_rule->parent.get_filter = lttng_event_rule_kernel_tracepoint_get_internal_filter;
        tp_rule->parent.get_filter_bytecode =
-                       lttng_event_rule_kernel_tracepoint_get_internal_filter_bytecode;
+               lttng_event_rule_kernel_tracepoint_get_internal_filter_bytecode;
        tp_rule->parent.generate_exclusions =
-                       lttng_event_rule_kernel_tracepoint_generate_exclusions;
+               lttng_event_rule_kernel_tracepoint_generate_exclusions;
        tp_rule->parent.hash = lttng_event_rule_kernel_tracepoint_hash;
        tp_rule->parent.mi_serialize = lttng_event_rule_kernel_tracepoint_mi_serialize;
 
@@ -369,9 +350,9 @@ end:
        return rule;
 }
 
-ssize_t lttng_event_rule_kernel_tracepoint_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_rule **_event_rule)
+ssize_t
+lttng_event_rule_kernel_tracepoint_create_from_payload(struct lttng_payload_view *view,
+                                                      struct lttng_event_rule **_event_rule)
 {
        ssize_t ret, offset = 0;
        enum lttng_event_rule_status status;
@@ -386,8 +367,8 @@ ssize_t lttng_event_rule_kernel_tracepoint_create_from_payload(
                goto end;
        }
 
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, sizeof(*tracepoint_comm));
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*tracepoint_comm));
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ERR("Failed to initialize from malformed event rule kernel tracepoint: buffer too short to contain header.");
                ret = -1;
@@ -400,8 +381,8 @@ ssize_t lttng_event_rule_kernel_tracepoint_create_from_payload(
        offset += current_buffer_view.size;
 
        /* Map the pattern. */
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, tracepoint_comm->pattern_len);
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, tracepoint_comm->pattern_len);
 
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
@@ -409,8 +390,8 @@ ssize_t lttng_event_rule_kernel_tracepoint_create_from_payload(
        }
 
        pattern = current_buffer_view.data;
-       if (!lttng_buffer_view_contains_string(&current_buffer_view, pattern,
-                       tracepoint_comm->pattern_len)) {
+       if (!lttng_buffer_view_contains_string(
+                   &current_buffer_view, pattern, tracepoint_comm->pattern_len)) {
                ret = -1;
                goto end;
        }
@@ -423,8 +404,8 @@ ssize_t lttng_event_rule_kernel_tracepoint_create_from_payload(
        }
 
        /* Map the filter_expression. */
-       current_buffer_view = lttng_buffer_view_from_view(&view->buffer, offset,
-                       tracepoint_comm->filter_expression_len);
+       current_buffer_view = lttng_buffer_view_from_view(
+               &view->buffer, offset, tracepoint_comm->filter_expression_len);
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
                goto end;
@@ -432,8 +413,8 @@ ssize_t lttng_event_rule_kernel_tracepoint_create_from_payload(
 
        filter_expression = current_buffer_view.data;
        if (!lttng_buffer_view_contains_string(&current_buffer_view,
-                       filter_expression,
-                       tracepoint_comm->filter_expression_len)) {
+                                              filter_expression,
+                                              tracepoint_comm->filter_expression_len)) {
                ret = -1;
                goto end;
        }
@@ -458,8 +439,7 @@ skip_filter_expression:
        }
 
        if (filter_expression) {
-               status = lttng_event_rule_kernel_tracepoint_set_filter(
-                               rule, filter_expression);
+               status = lttng_event_rule_kernel_tracepoint_set_filter(rule, filter_expression);
                if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set event rule kernel tracepoint pattern.");
                        ret = -1;
@@ -475,21 +455,20 @@ end:
        return ret;
 }
 
-enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_name_pattern(
-               struct lttng_event_rule *rule, const char *pattern)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_tracepoint_set_name_pattern(struct lttng_event_rule *rule,
+                                                   const char *pattern)
 {
        char *pattern_copy = NULL;
        struct lttng_event_rule_kernel_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
-       if (!rule || !IS_KERNEL_TRACEPOINT_EVENT_RULE(rule) || !pattern ||
-                       strlen(pattern) == 0) {
+       if (!rule || !IS_KERNEL_TRACEPOINT_EVENT_RULE(rule) || !pattern || strlen(pattern) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_kernel_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_kernel_tracepoint::parent);
        pattern_copy = strdup(pattern);
        if (!pattern_copy) {
                status = LTTNG_EVENT_RULE_STATUS_ERROR;
@@ -507,8 +486,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_name_pattern(
-               const struct lttng_event_rule *rule, const char **pattern)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_tracepoint_get_name_pattern(const struct lttng_event_rule *rule,
+                                                   const char **pattern)
 {
        struct lttng_event_rule_kernel_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -518,8 +498,7 @@ enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_name_pattern
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_kernel_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_kernel_tracepoint::parent);
        if (!tracepoint->pattern) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
@@ -530,21 +509,20 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_filter(
-               struct lttng_event_rule *rule, const char *expression)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_tracepoint_set_filter(struct lttng_event_rule *rule, const char *expression)
 {
        char *expression_copy = NULL;
        struct lttng_event_rule_kernel_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
        if (!rule || !IS_KERNEL_TRACEPOINT_EVENT_RULE(rule) || !expression ||
-                       strlen(expression) == 0) {
+           strlen(expression) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_kernel_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_kernel_tracepoint::parent);
        expression_copy = strdup(expression);
        if (!expression_copy) {
                PERROR("Failed to copy filter expression");
@@ -562,8 +540,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_filter(
-               const struct lttng_event_rule *rule, const char **expression)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_tracepoint_get_filter(const struct lttng_event_rule *rule,
+                                             const char **expression)
 {
        struct lttng_event_rule_kernel_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -573,8 +552,7 @@ enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_filter(
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_kernel_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_kernel_tracepoint::parent);
        if (!tracepoint->filter_expression) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
index cee5b2e65b30ccf9979c396b75f68419bd6e32c1..63cc6014e5961362e0f78a3d79d858c57c7f3a36 100644 (file)
@@ -14,6 +14,7 @@
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
 #include <common/runas.hpp>
+
 #include <lttng/event-rule/event-rule-internal.hpp>
 #include <lttng/event-rule/kernel-uprobe-internal.hpp>
 #include <lttng/userspace-probe-internal.hpp>
@@ -32,8 +33,7 @@ static void lttng_event_rule_kernel_uprobe_destroy(struct lttng_event_rule *rule
        free(uprobe);
 }
 
-static bool lttng_event_rule_kernel_uprobe_validate(
-               const struct lttng_event_rule *rule)
+static bool lttng_event_rule_kernel_uprobe_validate(const struct lttng_event_rule *rule)
 {
        bool valid = false;
        struct lttng_event_rule_kernel_uprobe *uprobe;
@@ -60,9 +60,8 @@ end:
        return valid;
 }
 
-static int lttng_event_rule_kernel_uprobe_serialize(
-               const struct lttng_event_rule *rule,
-               struct lttng_payload *payload)
+static int lttng_event_rule_kernel_uprobe_serialize(const struct lttng_event_rule *rule,
+                                                   struct lttng_payload *payload)
 {
        int ret;
        size_t name_len, header_offset, size_before_probe;
@@ -84,13 +83,11 @@ static int lttng_event_rule_kernel_uprobe_serialize(
 
        uprobe_comm.name_len = name_len;
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &uprobe_comm, sizeof(uprobe_comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &uprobe_comm, sizeof(uprobe_comm));
        if (ret) {
                goto end;
        }
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, uprobe->name, name_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, uprobe->name, name_len);
        if (ret) {
                goto end;
        }
@@ -98,16 +95,14 @@ static int lttng_event_rule_kernel_uprobe_serialize(
        size_before_probe = payload->buffer.size;
 
        /* This serialize return the size taken in the buffer. */
-       ret = lttng_userspace_probe_location_serialize(
-                       uprobe->location, payload);
+       ret = lttng_userspace_probe_location_serialize(uprobe->location, payload);
        if (ret < 0) {
                goto end;
        }
 
        /* Update the header regarding the probe size. */
-       header = (struct lttng_event_rule_kernel_uprobe_comm
-                                       *) ((char *) payload->buffer.data +
-                       header_offset);
+       header = (struct lttng_event_rule_kernel_uprobe_comm *) ((char *) payload->buffer.data +
+                                                                header_offset);
        header->location_len = payload->buffer.size - size_before_probe;
 
        ret = 0;
@@ -117,7 +112,7 @@ end:
 }
 
 static bool lttng_event_rule_kernel_uprobe_is_equal(const struct lttng_event_rule *_a,
-               const struct lttng_event_rule *_b)
+                                                   const struct lttng_event_rule *_b)
 {
        bool is_equal = false;
        struct lttng_event_rule_kernel_uprobe *a, *b;
@@ -134,65 +129,59 @@ static bool lttng_event_rule_kernel_uprobe_is_equal(const struct lttng_event_rul
 
        LTTNG_ASSERT(a->location);
        LTTNG_ASSERT(b->location);
-       is_equal = lttng_userspace_probe_location_is_equal(
-                       a->location, b->location);
+       is_equal = lttng_userspace_probe_location_is_equal(a->location, b->location);
 end:
        return is_equal;
 }
 
 static enum lttng_error_code lttng_event_rule_kernel_uprobe_generate_filter_bytecode(
-               struct lttng_event_rule *rule __attribute__((unused)),
-               const struct lttng_credentials *creds __attribute__((unused)))
+       struct lttng_event_rule *rule __attribute__((unused)),
+       const struct lttng_credentials *creds __attribute__((unused)))
 {
        /* Nothing to do. */
        return LTTNG_OK;
 }
 
-static const char *lttng_event_rule_kernel_uprobe_get_filter(
-               const struct lttng_event_rule *rule __attribute__((unused)))
+static const char *lttng_event_rule_kernel_uprobe_get_filter(const struct lttng_event_rule *rule
+                                                            __attribute__((unused)))
 {
        /* Unsupported. */
        return NULL;
 }
 
 static const struct lttng_bytecode *
-lttng_event_rule_kernel_uprobe_get_filter_bytecode(
-               const struct lttng_event_rule *rule __attribute__((unused)))
+lttng_event_rule_kernel_uprobe_get_filter_bytecode(const struct lttng_event_rule *rule
+                                                  __attribute__((unused)))
 {
        /* Unsupported. */
        return NULL;
 }
 
 static enum lttng_event_rule_generate_exclusions_status
-lttng_event_rule_kernel_uprobe_generate_exclusions(
-               const struct lttng_event_rule *rule __attribute__((unused)),
-               struct lttng_event_exclusion **exclusions)
+lttng_event_rule_kernel_uprobe_generate_exclusions(const struct lttng_event_rule *rule
+                                                  __attribute__((unused)),
+                                                  struct lttng_event_exclusion **exclusions)
 {
        /* Unsupported. */
        *exclusions = NULL;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
-static unsigned long
-lttng_event_rule_kernel_uprobe_hash(
-               const struct lttng_event_rule *rule)
+static unsigned long lttng_event_rule_kernel_uprobe_hash(const struct lttng_event_rule *rule)
 {
        unsigned long hash;
        struct lttng_event_rule_kernel_uprobe *urule =
-                       lttng::utils::container_of(rule, &lttng_event_rule_kernel_uprobe::parent);
+               lttng::utils::container_of(rule, &lttng_event_rule_kernel_uprobe::parent);
 
-       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE,
-                       lttng_ht_seed);
+       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE, lttng_ht_seed);
        hash ^= hash_key_str(urule->name, lttng_ht_seed);
        hash ^= lttng_userspace_probe_location_hash(urule->location);
 
        return hash;
 }
 
-static
-int userspace_probe_set_location(
-               struct lttng_event_rule_kernel_uprobe *uprobe,
-               const struct lttng_userspace_probe_location *location)
+static int userspace_probe_set_location(struct lttng_event_rule_kernel_uprobe *uprobe,
+                                       const struct lttng_userspace_probe_location *location)
 {
        int ret;
        struct lttng_userspace_probe_location *location_copy = NULL;
@@ -216,8 +205,9 @@ end:
        return ret;
 }
 
-static enum lttng_error_code lttng_event_rule_kernel_uprobe_mi_serialize(
-               const struct lttng_event_rule *rule, struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_rule_kernel_uprobe_mi_serialize(const struct lttng_event_rule *rule,
+                                           struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -229,8 +219,7 @@ static enum lttng_error_code lttng_event_rule_kernel_uprobe_mi_serialize(
        LTTNG_ASSERT(writer);
        LTTNG_ASSERT(IS_UPROBE_EVENT_RULE(rule));
 
-       status = lttng_event_rule_kernel_uprobe_get_event_name(
-                       rule, &event_name);
+       status = lttng_event_rule_kernel_uprobe_get_event_name(rule, &event_name);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
        LTTNG_ASSERT(event_name);
 
@@ -239,15 +228,14 @@ static enum lttng_error_code lttng_event_rule_kernel_uprobe_mi_serialize(
        LTTNG_ASSERT(location);
 
        /* Open event rule kernel uprobe element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_event_rule_kernel_uprobe);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_rule_kernel_uprobe);
        if (ret) {
                goto mi_error;
        }
 
        /* Event name. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_event_rule_event_name, event_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_event_rule_event_name, event_name);
        if (ret) {
                goto mi_error;
        }
@@ -273,8 +261,8 @@ end:
        return ret_code;
 }
 
-struct lttng_event_rule *lttng_event_rule_kernel_uprobe_create(
-               const struct lttng_userspace_probe_location *location)
+struct lttng_event_rule *
+lttng_event_rule_kernel_uprobe_create(const struct lttng_userspace_probe_location *location)
 {
        struct lttng_event_rule *rule = NULL;
        struct lttng_event_rule_kernel_uprobe *urule;
@@ -291,12 +279,10 @@ struct lttng_event_rule *lttng_event_rule_kernel_uprobe_create(
        urule->parent.equal = lttng_event_rule_kernel_uprobe_is_equal;
        urule->parent.destroy = lttng_event_rule_kernel_uprobe_destroy;
        urule->parent.generate_filter_bytecode =
-                       lttng_event_rule_kernel_uprobe_generate_filter_bytecode;
+               lttng_event_rule_kernel_uprobe_generate_filter_bytecode;
        urule->parent.get_filter = lttng_event_rule_kernel_uprobe_get_filter;
-       urule->parent.get_filter_bytecode =
-                       lttng_event_rule_kernel_uprobe_get_filter_bytecode;
-       urule->parent.generate_exclusions =
-                       lttng_event_rule_kernel_uprobe_generate_exclusions;
+       urule->parent.get_filter_bytecode = lttng_event_rule_kernel_uprobe_get_filter_bytecode;
+       urule->parent.generate_exclusions = lttng_event_rule_kernel_uprobe_generate_exclusions;
        urule->parent.hash = lttng_event_rule_kernel_uprobe_hash;
        urule->parent.mi_serialize = lttng_event_rule_kernel_uprobe_mi_serialize;
 
@@ -309,9 +295,8 @@ end:
        return rule;
 }
 
-ssize_t lttng_event_rule_kernel_uprobe_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_rule **_event_rule)
+ssize_t lttng_event_rule_kernel_uprobe_create_from_payload(struct lttng_payload_view *view,
+                                                          struct lttng_event_rule **_event_rule)
 {
        ssize_t ret, offset = 0;
        const struct lttng_event_rule_kernel_uprobe_comm *uprobe_comm;
@@ -326,8 +311,8 @@ ssize_t lttng_event_rule_kernel_uprobe_create_from_payload(
                goto end;
        }
 
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, sizeof(*uprobe_comm));
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*uprobe_comm));
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ERR("Failed to initialize from malformed event rule uprobe: buffer too short to contain header");
                ret = -1;
@@ -340,16 +325,15 @@ ssize_t lttng_event_rule_kernel_uprobe_create_from_payload(
        offset += current_buffer_view.size;
 
        /* Map the name. */
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, uprobe_comm->name_len);
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, uprobe_comm->name_len);
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
                goto end;
        }
 
        name = current_buffer_view.data;
-       if (!lttng_buffer_view_contains_string(&current_buffer_view, name,
-                       uprobe_comm->name_len)) {
+       if (!lttng_buffer_view_contains_string(&current_buffer_view, name, uprobe_comm->name_len)) {
                ret = -1;
                goto end;
        }
@@ -360,8 +344,7 @@ ssize_t lttng_event_rule_kernel_uprobe_create_from_payload(
        /* Map the location. */
        {
                struct lttng_payload_view current_payload_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               uprobe_comm->location_len);
+                       lttng_payload_view_from_view(view, offset, uprobe_comm->location_len);
 
                if (!lttng_payload_view_is_valid(&current_payload_view)) {
                        ERR("Failed to initialize from malformed event rule uprobe: buffer too short to contain location");
@@ -369,8 +352,8 @@ ssize_t lttng_event_rule_kernel_uprobe_create_from_payload(
                        goto end;
                }
 
-               ret = lttng_userspace_probe_location_create_from_payload(
-                               &current_payload_view, &location);
+               ret = lttng_userspace_probe_location_create_from_payload(&current_payload_view,
+                                                                        &location);
                if (ret < 0) {
                        ret = -1;
                        goto end;
@@ -409,10 +392,9 @@ end:
        return ret;
 }
 
-
-enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_get_location(
-               const struct lttng_event_rule *rule,
-               const struct lttng_userspace_probe_location **location)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_uprobe_get_location(const struct lttng_event_rule *rule,
+                                           const struct lttng_userspace_probe_location **location)
 {
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
@@ -432,8 +414,7 @@ end:
 }
 
 struct lttng_userspace_probe_location *
-lttng_event_rule_kernel_uprobe_get_location_mutable(
-               const struct lttng_event_rule *rule)
+lttng_event_rule_kernel_uprobe_get_location_mutable(const struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_kernel_uprobe *uprobe;
 
@@ -443,15 +424,14 @@ lttng_event_rule_kernel_uprobe_get_location_mutable(
        return uprobe->location;
 }
 
-enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_set_event_name(
-               struct lttng_event_rule *rule, const char *name)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_uprobe_set_event_name(struct lttng_event_rule *rule, const char *name)
 {
        char *name_copy = NULL;
        struct lttng_event_rule_kernel_uprobe *uprobe;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
-       if (!rule || !IS_UPROBE_EVENT_RULE(rule) || !name ||
-                       strlen(name) == 0) {
+       if (!rule || !IS_UPROBE_EVENT_RULE(rule) || !name || strlen(name) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
@@ -473,8 +453,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_get_event_name(
-               const struct lttng_event_rule *rule, const char **name)
+enum lttng_event_rule_status
+lttng_event_rule_kernel_uprobe_get_event_name(const struct lttng_event_rule *rule,
+                                             const char **name)
 {
        struct lttng_event_rule_kernel_uprobe *uprobe;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
index 11e775c3f893f9d4269f76b020d2e9204057c20c..7ca41c124500fcdf4e65ad907f24a64950c47947 100644 (file)
@@ -16,6 +16,7 @@
 #include <common/payload.hpp>
 #include <common/runas.hpp>
 #include <common/string-utils/string-utils.hpp>
+
 #include <lttng/event-rule/event-rule-internal.hpp>
 #include <lttng/event-rule/log4j-logging-internal.hpp>
 #include <lttng/event.h>
@@ -32,8 +33,7 @@ static void lttng_event_rule_log4j_logging_destroy(struct lttng_event_rule *rule
                return;
        }
 
-       log4j_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_log4j_logging::parent);
+       log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
 
        lttng_log_level_rule_destroy(log4j_logging->log_level_rule);
        free(log4j_logging->pattern);
@@ -43,8 +43,7 @@ static void lttng_event_rule_log4j_logging_destroy(struct lttng_event_rule *rule
        free(log4j_logging);
 }
 
-static bool lttng_event_rule_log4j_logging_validate(
-               const struct lttng_event_rule *rule)
+static bool lttng_event_rule_log4j_logging_validate(const struct lttng_event_rule *rule)
 {
        bool valid = false;
        struct lttng_event_rule_log4j_logging *log4j_logging;
@@ -53,8 +52,7 @@ static bool lttng_event_rule_log4j_logging_validate(
                goto end;
        }
 
-       log4j_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_log4j_logging::parent);
+       log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
 
        /* Required field. */
        if (!log4j_logging->pattern) {
@@ -67,9 +65,8 @@ end:
        return valid;
 }
 
-static int lttng_event_rule_log4j_logging_serialize(
-               const struct lttng_event_rule *rule,
-               struct lttng_payload *payload)
+static int lttng_event_rule_log4j_logging_serialize(const struct lttng_event_rule *rule,
+                                                   struct lttng_payload *payload)
 {
        int ret;
        size_t pattern_len, filter_expression_len, header_offset;
@@ -86,14 +83,12 @@ static int lttng_event_rule_log4j_logging_serialize(
        header_offset = payload->buffer.size;
 
        DBG("Serializing log4j_logging event rule.");
-       log4j_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_log4j_logging::parent);
+       log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
 
        pattern_len = strlen(log4j_logging->pattern) + 1;
 
        if (log4j_logging->filter_expression != NULL) {
-               filter_expression_len =
-                               strlen(log4j_logging->filter_expression) + 1;
+               filter_expression_len = strlen(log4j_logging->filter_expression) + 1;
        } else {
                filter_expression_len = 0;
        }
@@ -101,20 +96,19 @@ static int lttng_event_rule_log4j_logging_serialize(
        log4j_logging_comm.pattern_len = pattern_len;
        log4j_logging_comm.filter_expression_len = filter_expression_len;
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &log4j_logging_comm,
-                       sizeof(log4j_logging_comm));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &log4j_logging_comm, sizeof(log4j_logging_comm));
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, log4j_logging->pattern, pattern_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, log4j_logging->pattern, pattern_len);
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, log4j_logging->filter_expression,
-                       filter_expression_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, log4j_logging->filter_expression, filter_expression_len);
        if (ret) {
                goto end;
        }
@@ -127,16 +121,14 @@ static int lttng_event_rule_log4j_logging_serialize(
        }
 
        header = (typeof(header)) ((char *) payload->buffer.data + header_offset);
-       header->log_level_rule_len =
-                       payload->buffer.size - size_before_log_level_rule;
+       header->log_level_rule_len = payload->buffer.size - size_before_log_level_rule;
 
 end:
        return ret;
 }
 
-static bool lttng_event_rule_log4j_logging_is_equal(
-               const struct lttng_event_rule *_a,
-               const struct lttng_event_rule *_b)
+static bool lttng_event_rule_log4j_logging_is_equal(const struct lttng_event_rule *_a,
+                                                   const struct lttng_event_rule *_b)
 {
        bool is_equal = false;
        struct lttng_event_rule_log4j_logging *a, *b;
@@ -166,8 +158,7 @@ static bool lttng_event_rule_log4j_logging_is_equal(
                goto end;
        }
 
-       if (!lttng_log_level_rule_is_equal(
-                               a->log_level_rule, b->log_level_rule)) {
+       if (!lttng_log_level_rule_is_equal(a->log_level_rule, b->log_level_rule)) {
                goto end;
        }
 
@@ -183,8 +174,7 @@ end:
  *
  * An event with NO loglevel and the name is * will return NULL.
  */
-static int generate_agent_filter(
-               const struct lttng_event_rule *rule, char **_agent_filter)
+static int generate_agent_filter(const struct lttng_event_rule *rule, char **_agent_filter)
 {
        int err;
        int ret = 0;
@@ -211,16 +201,13 @@ static int generate_agent_filter(
                goto end;
        }
 
-
        /* Don't add filter for the '*' event. */
        if (strcmp(pattern, "*") != 0) {
                if (filter) {
-                       err = asprintf(&agent_filter,
-                                       "(%s) && (logger_name == \"%s\")",
-                                       filter, pattern);
+                       err = asprintf(
+                               &agent_filter, "(%s) && (logger_name == \"%s\")", filter, pattern);
                } else {
-                       err = asprintf(&agent_filter, "logger_name == \"%s\"",
-                                       pattern);
+                       err = asprintf(&agent_filter, "logger_name == \"%s\"", pattern);
                }
 
                if (err < 0) {
@@ -230,23 +217,20 @@ static int generate_agent_filter(
                }
        }
 
-       status = lttng_event_rule_log4j_logging_get_log_level_rule(
-                       rule, &log_level_rule);
+       status = lttng_event_rule_log4j_logging_get_log_level_rule(rule, &log_level_rule);
        if (status == LTTNG_EVENT_RULE_STATUS_OK) {
                enum lttng_log_level_rule_status llr_status;
                const char *op;
                int level;
 
-               switch (lttng_log_level_rule_get_type(log_level_rule))
-               {
+               switch (lttng_log_level_rule_get_type(log_level_rule)) {
                case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
-                       llr_status = lttng_log_level_rule_exactly_get_level(
-                                       log_level_rule, &level);
+                       llr_status = lttng_log_level_rule_exactly_get_level(log_level_rule, &level);
                        op = "==";
                        break;
                case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
                        llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                                       log_level_rule, &level);
+                               log_level_rule, &level);
                        op = ">=";
                        break;
                default:
@@ -262,16 +246,16 @@ static int generate_agent_filter(
                        char *new_filter;
 
                        err = asprintf(&new_filter,
-                                       "(%s) && (int_loglevel %s %d)",
-                                       agent_filter ? agent_filter : filter,
-                                       op, level);
+                                      "(%s) && (int_loglevel %s %d)",
+                                      agent_filter ? agent_filter : filter,
+                                      op,
+                                      level);
                        if (agent_filter) {
                                free(agent_filter);
                        }
                        agent_filter = new_filter;
                } else {
-                       err = asprintf(&agent_filter, "int_loglevel %s %d", op,
-                                       level);
+                       err = asprintf(&agent_filter, "int_loglevel %s %d", op, level);
                }
 
                if (err < 0) {
@@ -290,9 +274,8 @@ end:
 }
 
 static enum lttng_error_code
-lttng_event_rule_log4j_logging_generate_filter_bytecode(
-               struct lttng_event_rule *rule,
-               const struct lttng_credentials *creds)
+lttng_event_rule_log4j_logging_generate_filter_bytecode(struct lttng_event_rule *rule,
+                                                       const struct lttng_credentials *creds)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -304,8 +287,7 @@ lttng_event_rule_log4j_logging_generate_filter_bytecode(
 
        LTTNG_ASSERT(rule);
 
-       log4j_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_log4j_logging::parent);
+       log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
 
        status = lttng_event_rule_log4j_logging_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
@@ -334,8 +316,7 @@ lttng_event_rule_log4j_logging_generate_filter_bytecode(
        }
 
        ret = run_as_generate_filter_bytecode(
-                       log4j_logging->internal_filter.filter, creds,
-                       &bytecode);
+               log4j_logging->internal_filter.filter, creds, &bytecode);
        if (ret) {
                ret_code = LTTNG_ERR_FILTER_INVAL;
                goto end;
@@ -351,48 +332,43 @@ end:
        return ret_code;
 }
 
-static const char *lttng_event_rule_log4j_logging_get_internal_filter(
-               const struct lttng_event_rule *rule)
+static const char *
+lttng_event_rule_log4j_logging_get_internal_filter(const struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_log4j_logging *log4j_logging;
 
        LTTNG_ASSERT(rule);
-       log4j_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_log4j_logging::parent);
+       log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
        return log4j_logging->internal_filter.filter;
 }
 
 static const struct lttng_bytecode *
-lttng_event_rule_log4j_logging_get_internal_filter_bytecode(
-               const struct lttng_event_rule *rule)
+lttng_event_rule_log4j_logging_get_internal_filter_bytecode(const struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_log4j_logging *log4j_logging;
 
        LTTNG_ASSERT(rule);
-       log4j_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_log4j_logging::parent);
+       log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
        return log4j_logging->internal_filter.bytecode;
 }
 
 static enum lttng_event_rule_generate_exclusions_status
-lttng_event_rule_log4j_logging_generate_exclusions(
-               const struct lttng_event_rule *rule __attribute__((unused)),
-               struct lttng_event_exclusion **_exclusions)
+lttng_event_rule_log4j_logging_generate_exclusions(const struct lttng_event_rule *rule
+                                                  __attribute__((unused)),
+                                                  struct lttng_event_exclusion **_exclusions)
 {
        /* Unsupported. */
        *_exclusions = NULL;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
-static unsigned long lttng_event_rule_log4j_logging_hash(
-               const struct lttng_event_rule *rule)
+static unsigned long lttng_event_rule_log4j_logging_hash(const struct lttng_event_rule *rule)
 {
        unsigned long hash;
        struct lttng_event_rule_log4j_logging *tp_rule =
-                       lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
+               lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
 
-       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING,
-                       lttng_ht_seed);
+       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING, lttng_ht_seed);
        hash ^= hash_key_str(tp_rule->pattern, lttng_ht_seed);
 
        if (tp_rule->filter_expression) {
@@ -406,8 +382,8 @@ static unsigned long lttng_event_rule_log4j_logging_hash(
        return hash;
 }
 
-static struct lttng_event *lttng_event_rule_log4j_logging_generate_lttng_event(
-               const struct lttng_event_rule *rule)
+static struct lttng_event *
+lttng_event_rule_log4j_logging_generate_lttng_event(const struct lttng_event_rule *rule)
 {
        int ret;
        const struct lttng_event_rule_log4j_logging *log4j_logging;
@@ -418,8 +394,7 @@ static struct lttng_event *lttng_event_rule_log4j_logging_generate_lttng_event(
        enum lttng_event_rule_status status;
        const struct lttng_log_level_rule *log_level_rule;
 
-       log4j_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_log4j_logging::parent);
+       log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
 
        local_event = zmalloc<lttng_event>();
        if (!local_event) {
@@ -427,18 +402,15 @@ static struct lttng_event *lttng_event_rule_log4j_logging_generate_lttng_event(
        }
 
        local_event->type = LTTNG_EVENT_TRACEPOINT;
-       ret = lttng_strncpy(local_event->name, log4j_logging->pattern,
-                           sizeof(local_event->name));
+       ret = lttng_strncpy(local_event->name, log4j_logging->pattern, sizeof(local_event->name));
        if (ret) {
                ERR("Truncation occurred when copying event rule pattern to `lttng_event` structure: pattern = '%s'",
-                               log4j_logging->pattern);
+                   log4j_logging->pattern);
                goto error;
        }
 
-
        /* Map the log level rule to an equivalent lttng_loglevel. */
-       status = lttng_event_rule_log4j_logging_get_log_level_rule(
-                       rule, &log_level_rule);
+       status = lttng_event_rule_log4j_logging_get_log_level_rule(rule, &log_level_rule);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
                loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
                loglevel_value = 0;
@@ -447,13 +419,13 @@ static struct lttng_event *lttng_event_rule_log4j_logging_generate_lttng_event(
 
                switch (lttng_log_level_rule_get_type(log_level_rule)) {
                case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
-                       llr_status = lttng_log_level_rule_exactly_get_level(
-                                       log_level_rule, &loglevel_value);
+                       llr_status = lttng_log_level_rule_exactly_get_level(log_level_rule,
+                                                                           &loglevel_value);
                        loglevel_type = LTTNG_EVENT_LOGLEVEL_SINGLE;
                        break;
                case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
                        llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                                       log_level_rule, &loglevel_value);
+                               log_level_rule, &loglevel_value);
                        loglevel_type = LTTNG_EVENT_LOGLEVEL_RANGE;
                        break;
                default:
@@ -478,8 +450,9 @@ error:
        return event;
 }
 
-static enum lttng_error_code lttng_event_rule_log4j_logging_mi_serialize(
-               const struct lttng_event_rule *rule, struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_rule_log4j_logging_mi_serialize(const struct lttng_event_rule *rule,
+                                           struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -492,39 +465,35 @@ static enum lttng_error_code lttng_event_rule_log4j_logging_mi_serialize(
        LTTNG_ASSERT(writer);
        LTTNG_ASSERT(IS_LOG4J_LOGGING_EVENT_RULE(rule));
 
-       status = lttng_event_rule_log4j_logging_get_name_pattern(
-                       rule, &name_pattern);
+       status = lttng_event_rule_log4j_logging_get_name_pattern(rule, &name_pattern);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
        LTTNG_ASSERT(name_pattern);
 
        status = lttng_event_rule_log4j_logging_get_filter(rule, &filter);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
-                       status == LTTNG_EVENT_RULE_STATUS_UNSET);
+                    status == LTTNG_EVENT_RULE_STATUS_UNSET);
 
-       status = lttng_event_rule_log4j_logging_get_log_level_rule(
-                       rule, &log_level_rule);
+       status = lttng_event_rule_log4j_logging_get_log_level_rule(rule, &log_level_rule);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
-                       status == LTTNG_EVENT_RULE_STATUS_UNSET);
+                    status == LTTNG_EVENT_RULE_STATUS_UNSET);
 
        /* Open event rule log4j logging element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_event_rule_log4j_logging);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_rule_log4j_logging);
        if (ret) {
                goto mi_error;
        }
 
        /* Name pattern. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_event_rule_name_pattern, name_pattern);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_event_rule_name_pattern, name_pattern);
        if (ret) {
                goto mi_error;
        }
 
        /* Filter expression. */
        if (filter != NULL) {
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_event_rule_filter_expression,
-                               filter);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, mi_lttng_element_event_rule_filter_expression, filter);
                if (ret) {
                        goto mi_error;
                }
@@ -532,8 +501,7 @@ static enum lttng_error_code lttng_event_rule_log4j_logging_mi_serialize(
 
        /* Log level rule. */
        if (log_level_rule) {
-               ret_code = lttng_log_level_rule_mi_serialize(
-                               log_level_rule, writer);
+               ret_code = lttng_log_level_rule_mi_serialize(log_level_rule, writer);
                if (ret_code != LTTNG_OK) {
                        goto end;
                }
@@ -572,16 +540,13 @@ struct lttng_event_rule *lttng_event_rule_log4j_logging_create(void)
        tp_rule->parent.equal = lttng_event_rule_log4j_logging_is_equal;
        tp_rule->parent.destroy = lttng_event_rule_log4j_logging_destroy;
        tp_rule->parent.generate_filter_bytecode =
-                       lttng_event_rule_log4j_logging_generate_filter_bytecode;
-       tp_rule->parent.get_filter =
-                       lttng_event_rule_log4j_logging_get_internal_filter;
+               lttng_event_rule_log4j_logging_generate_filter_bytecode;
+       tp_rule->parent.get_filter = lttng_event_rule_log4j_logging_get_internal_filter;
        tp_rule->parent.get_filter_bytecode =
-                       lttng_event_rule_log4j_logging_get_internal_filter_bytecode;
-       tp_rule->parent.generate_exclusions =
-                       lttng_event_rule_log4j_logging_generate_exclusions;
+               lttng_event_rule_log4j_logging_get_internal_filter_bytecode;
+       tp_rule->parent.generate_exclusions = lttng_event_rule_log4j_logging_generate_exclusions;
        tp_rule->parent.hash = lttng_event_rule_log4j_logging_hash;
-       tp_rule->parent.generate_lttng_event =
-                       lttng_event_rule_log4j_logging_generate_lttng_event;
+       tp_rule->parent.generate_lttng_event = lttng_event_rule_log4j_logging_generate_lttng_event;
        tp_rule->parent.mi_serialize = lttng_event_rule_log4j_logging_mi_serialize;
 
        tp_rule->log_level_rule = NULL;
@@ -597,9 +562,8 @@ end:
        return rule;
 }
 
-ssize_t lttng_event_rule_log4j_logging_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_rule **_event_rule)
+ssize_t lttng_event_rule_log4j_logging_create_from_payload(struct lttng_payload_view *view,
+                                                          struct lttng_event_rule **_event_rule)
 {
        ssize_t ret, offset = 0;
        enum lttng_event_rule_status status;
@@ -615,8 +579,8 @@ ssize_t lttng_event_rule_log4j_logging_create_from_payload(
                goto end;
        }
 
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, sizeof(*log4j_logging_comm));
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*log4j_logging_comm));
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ERR("Failed to initialize from malformed event rule log4j_logging: buffer too short to contain header.");
                ret = -1;
@@ -636,8 +600,8 @@ ssize_t lttng_event_rule_log4j_logging_create_from_payload(
        offset += current_buffer_view.size;
 
        /* Map the pattern. */
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, log4j_logging_comm->pattern_len);
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, log4j_logging_comm->pattern_len);
 
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
@@ -645,8 +609,8 @@ ssize_t lttng_event_rule_log4j_logging_create_from_payload(
        }
 
        pattern = current_buffer_view.data;
-       if (!lttng_buffer_view_contains_string(&current_buffer_view, pattern,
-                       log4j_logging_comm->pattern_len)) {
+       if (!lttng_buffer_view_contains_string(
+                   &current_buffer_view, pattern, log4j_logging_comm->pattern_len)) {
                ret = -1;
                goto end;
        }
@@ -659,8 +623,8 @@ ssize_t lttng_event_rule_log4j_logging_create_from_payload(
        }
 
        /* Map the filter_expression. */
-       current_buffer_view = lttng_buffer_view_from_view(&view->buffer, offset,
-                       log4j_logging_comm->filter_expression_len);
+       current_buffer_view = lttng_buffer_view_from_view(
+               &view->buffer, offset, log4j_logging_comm->filter_expression_len);
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
                goto end;
@@ -668,8 +632,8 @@ ssize_t lttng_event_rule_log4j_logging_create_from_payload(
 
        filter_expression = current_buffer_view.data;
        if (!lttng_buffer_view_contains_string(&current_buffer_view,
-                       filter_expression,
-                       log4j_logging_comm->filter_expression_len)) {
+                                              filter_expression,
+                                              log4j_logging_comm->filter_expression_len)) {
                ret = -1;
                goto end;
        }
@@ -684,12 +648,11 @@ skip_filter_expression:
 
        {
                /* Map the log level rule. */
-               struct lttng_payload_view current_payload_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               log4j_logging_comm->log_level_rule_len);
+               struct lttng_payload_view current_payload_view = lttng_payload_view_from_view(
+                       view, offset, log4j_logging_comm->log_level_rule_len);
 
-               ret = lttng_log_level_rule_create_from_payload(
-                               &current_payload_view, &log_level_rule);
+               ret = lttng_log_level_rule_create_from_payload(&current_payload_view,
+                                                              &log_level_rule);
                if (ret < 0) {
                        ret = -1;
                        goto end;
@@ -711,8 +674,7 @@ skip_log_level_rule:
        }
 
        if (filter_expression) {
-               status = lttng_event_rule_log4j_logging_set_filter(
-                               rule, filter_expression);
+               status = lttng_event_rule_log4j_logging_set_filter(rule, filter_expression);
                if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set event rule log4j_logging pattern.");
                        ret = -1;
@@ -721,8 +683,7 @@ skip_log_level_rule:
        }
 
        if (log_level_rule) {
-               status = lttng_event_rule_log4j_logging_set_log_level_rule(
-                               rule, log_level_rule);
+               status = lttng_event_rule_log4j_logging_set_log_level_rule(rule, log_level_rule);
                if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set event rule log4j_logging log level rule.");
                        ret = -1;
@@ -739,21 +700,19 @@ end:
        return ret;
 }
 
-enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_name_pattern(
-               struct lttng_event_rule *rule, const char *pattern)
+enum lttng_event_rule_status
+lttng_event_rule_log4j_logging_set_name_pattern(struct lttng_event_rule *rule, const char *pattern)
 {
        char *pattern_copy = NULL;
        struct lttng_event_rule_log4j_logging *log4j_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
-       if (!rule || !IS_LOG4J_LOGGING_EVENT_RULE(rule) || !pattern ||
-                       strlen(pattern) == 0) {
+       if (!rule || !IS_LOG4J_LOGGING_EVENT_RULE(rule) || !pattern || strlen(pattern) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
 
-       log4j_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_log4j_logging::parent);
+       log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
        pattern_copy = strdup(pattern);
        if (!pattern_copy) {
                status = LTTNG_EVENT_RULE_STATUS_ERROR;
@@ -771,8 +730,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_name_pattern(
-               const struct lttng_event_rule *rule, const char **pattern)
+enum lttng_event_rule_status
+lttng_event_rule_log4j_logging_get_name_pattern(const struct lttng_event_rule *rule,
+                                               const char **pattern)
 {
        struct lttng_event_rule_log4j_logging *log4j_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -782,8 +742,7 @@ enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_name_pattern(
                goto end;
        }
 
-       log4j_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_log4j_logging::parent);
+       log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
        if (!log4j_logging->pattern) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
@@ -794,21 +753,19 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_filter(
-               struct lttng_event_rule *rule, const char *expression)
+enum lttng_event_rule_status
+lttng_event_rule_log4j_logging_set_filter(struct lttng_event_rule *rule, const char *expression)
 {
        char *expression_copy = NULL;
        struct lttng_event_rule_log4j_logging *log4j_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
-       if (!rule || !IS_LOG4J_LOGGING_EVENT_RULE(rule) || !expression ||
-                       strlen(expression) == 0) {
+       if (!rule || !IS_LOG4J_LOGGING_EVENT_RULE(rule) || !expression || strlen(expression) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
 
-       log4j_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_log4j_logging::parent);
+       log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
        expression_copy = strdup(expression);
        if (!expression_copy) {
                PERROR("Failed to copy filter expression");
@@ -826,8 +783,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_filter(
-               const struct lttng_event_rule *rule, const char **expression)
+enum lttng_event_rule_status
+lttng_event_rule_log4j_logging_get_filter(const struct lttng_event_rule *rule,
+                                         const char **expression)
 {
        struct lttng_event_rule_log4j_logging *log4j_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -837,8 +795,7 @@ enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_filter(
                goto end;
        }
 
-       log4j_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_log4j_logging::parent);
+       log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
        if (!log4j_logging->filter_expression) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
@@ -849,8 +806,7 @@ end:
        return status;
 }
 
-static bool log_level_rule_valid(
-               const struct lttng_log_level_rule *rule __attribute__((unused)))
+static bool log_level_rule_valid(const struct lttng_log_level_rule *rule __attribute__((unused)))
 {
        /*
         * For both LOG4J custom log level are possible and can
@@ -859,9 +815,9 @@ static bool log_level_rule_valid(
        return true;
 }
 
-enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_log_level_rule(
-               struct lttng_event_rule *rule,
-               const struct lttng_log_level_rule *log_level_rule)
+enum lttng_event_rule_status
+lttng_event_rule_log4j_logging_set_log_level_rule(struct lttng_event_rule *rule,
+                                                 const struct lttng_log_level_rule *log_level_rule)
 {
        struct lttng_event_rule_log4j_logging *log4j_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -872,8 +828,7 @@ enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_log_level_rule(
                goto end;
        }
 
-       log4j_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_log4j_logging::parent);
+       log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
 
        if (!log_level_rule_valid(log_level_rule)) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
@@ -897,9 +852,7 @@ end:
 }
 
 enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_log_level_rule(
-               const struct lttng_event_rule *rule,
-               const struct lttng_log_level_rule **log_level_rule
-               )
+       const struct lttng_event_rule *rule, const struct lttng_log_level_rule **log_level_rule)
 {
        struct lttng_event_rule_log4j_logging *log4j_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -909,8 +862,7 @@ enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_log_level_rule(
                goto end;
        }
 
-       log4j_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_log4j_logging::parent);
+       log4j_logging = lttng::utils::container_of(rule, &lttng_event_rule_log4j_logging::parent);
        if (log4j_logging->log_level_rule == NULL) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
index 47b1e0366a79d94cf942572c5acc64caa85f37cb..40e4f1f022840d039f1f514e74f21d70d83336a4 100644 (file)
@@ -16,6 +16,7 @@
 #include <common/payload.hpp>
 #include <common/runas.hpp>
 #include <common/string-utils/string-utils.hpp>
+
 #include <lttng/event-rule/event-rule-internal.hpp>
 #include <lttng/event-rule/python-logging-internal.hpp>
 #include <lttng/event.h>
@@ -32,8 +33,7 @@ static void lttng_event_rule_python_logging_destroy(struct lttng_event_rule *rul
                return;
        }
 
-       python_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_python_logging::parent);
+       python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
 
        lttng_log_level_rule_destroy(python_logging->log_level_rule);
        free(python_logging->pattern);
@@ -43,8 +43,7 @@ static void lttng_event_rule_python_logging_destroy(struct lttng_event_rule *rul
        free(python_logging);
 }
 
-static bool lttng_event_rule_python_logging_validate(
-               const struct lttng_event_rule *rule)
+static bool lttng_event_rule_python_logging_validate(const struct lttng_event_rule *rule)
 {
        bool valid = false;
        struct lttng_event_rule_python_logging *python_logging;
@@ -53,8 +52,7 @@ static bool lttng_event_rule_python_logging_validate(
                goto end;
        }
 
-       python_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_python_logging::parent);
+       python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
 
        /* Required field. */
        if (!python_logging->pattern) {
@@ -67,9 +65,8 @@ end:
        return valid;
 }
 
-static int lttng_event_rule_python_logging_serialize(
-               const struct lttng_event_rule *rule,
-               struct lttng_payload *payload)
+static int lttng_event_rule_python_logging_serialize(const struct lttng_event_rule *rule,
+                                                    struct lttng_payload *payload)
 {
        int ret;
        size_t pattern_len, filter_expression_len, header_offset;
@@ -86,14 +83,12 @@ static int lttng_event_rule_python_logging_serialize(
        header_offset = payload->buffer.size;
 
        DBG("Serializing python_logging event rule.");
-       python_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_python_logging::parent);
+       python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
 
        pattern_len = strlen(python_logging->pattern) + 1;
 
        if (python_logging->filter_expression != NULL) {
-               filter_expression_len =
-                               strlen(python_logging->filter_expression) + 1;
+               filter_expression_len = strlen(python_logging->filter_expression) + 1;
        } else {
                filter_expression_len = 0;
        }
@@ -101,20 +96,19 @@ static int lttng_event_rule_python_logging_serialize(
        python_logging_comm.pattern_len = pattern_len;
        python_logging_comm.filter_expression_len = filter_expression_len;
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &python_logging_comm,
-                       sizeof(python_logging_comm));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &python_logging_comm, sizeof(python_logging_comm));
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, python_logging->pattern, pattern_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, python_logging->pattern, pattern_len);
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, python_logging->filter_expression,
-                       filter_expression_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, python_logging->filter_expression, filter_expression_len);
        if (ret) {
                goto end;
        }
@@ -127,16 +121,14 @@ static int lttng_event_rule_python_logging_serialize(
        }
 
        header = (typeof(header)) ((char *) payload->buffer.data + header_offset);
-       header->log_level_rule_len =
-                       payload->buffer.size - size_before_log_level_rule;
+       header->log_level_rule_len = payload->buffer.size - size_before_log_level_rule;
 
 end:
        return ret;
 }
 
-static bool lttng_event_rule_python_logging_is_equal(
-               const struct lttng_event_rule *_a,
-               const struct lttng_event_rule *_b)
+static bool lttng_event_rule_python_logging_is_equal(const struct lttng_event_rule *_a,
+                                                    const struct lttng_event_rule *_b)
 {
        bool is_equal = false;
        struct lttng_event_rule_python_logging *a, *b;
@@ -166,8 +158,7 @@ static bool lttng_event_rule_python_logging_is_equal(
                goto end;
        }
 
-       if (!lttng_log_level_rule_is_equal(
-                               a->log_level_rule, b->log_level_rule)) {
+       if (!lttng_log_level_rule_is_equal(a->log_level_rule, b->log_level_rule)) {
                goto end;
        }
 
@@ -183,8 +174,7 @@ end:
  *
  * An event with NO loglevel and the name is * will return NULL.
  */
-static int generate_agent_filter(
-               const struct lttng_event_rule *rule, char **_agent_filter)
+static int generate_agent_filter(const struct lttng_event_rule *rule, char **_agent_filter)
 {
        int err;
        int ret = 0;
@@ -211,16 +201,13 @@ static int generate_agent_filter(
                goto end;
        }
 
-
        /* Don't add filter for the '*' event. */
        if (strcmp(pattern, "*") != 0) {
                if (filter) {
-                       err = asprintf(&agent_filter,
-                                       "(%s) && (logger_name == \"%s\")",
-                                       filter, pattern);
+                       err = asprintf(
+                               &agent_filter, "(%s) && (logger_name == \"%s\")", filter, pattern);
                } else {
-                       err = asprintf(&agent_filter, "logger_name == \"%s\"",
-                                       pattern);
+                       err = asprintf(&agent_filter, "logger_name == \"%s\"", pattern);
                }
 
                if (err < 0) {
@@ -230,23 +217,20 @@ static int generate_agent_filter(
                }
        }
 
-       status = lttng_event_rule_python_logging_get_log_level_rule(
-                       rule, &log_level_rule);
+       status = lttng_event_rule_python_logging_get_log_level_rule(rule, &log_level_rule);
        if (status == LTTNG_EVENT_RULE_STATUS_OK) {
                enum lttng_log_level_rule_status llr_status;
                const char *op;
                int level;
 
-               switch (lttng_log_level_rule_get_type(log_level_rule))
-               {
+               switch (lttng_log_level_rule_get_type(log_level_rule)) {
                case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
-                       llr_status = lttng_log_level_rule_exactly_get_level(
-                                       log_level_rule, &level);
+                       llr_status = lttng_log_level_rule_exactly_get_level(log_level_rule, &level);
                        op = "==";
                        break;
                case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
                        llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                                       log_level_rule, &level);
+                               log_level_rule, &level);
                        op = ">=";
                        break;
                default:
@@ -262,16 +246,16 @@ static int generate_agent_filter(
                        char *new_filter;
 
                        err = asprintf(&new_filter,
-                                       "(%s) && (int_loglevel %s %d)",
-                                       agent_filter ? agent_filter : filter,
-                                       op, level);
+                                      "(%s) && (int_loglevel %s %d)",
+                                      agent_filter ? agent_filter : filter,
+                                      op,
+                                      level);
                        if (agent_filter) {
                                free(agent_filter);
                        }
                        agent_filter = new_filter;
                } else {
-                       err = asprintf(&agent_filter, "int_loglevel %s %d", op,
-                                       level);
+                       err = asprintf(&agent_filter, "int_loglevel %s %d", op, level);
                }
 
                if (err < 0) {
@@ -290,9 +274,8 @@ end:
 }
 
 static enum lttng_error_code
-lttng_event_rule_python_logging_generate_filter_bytecode(
-               struct lttng_event_rule *rule,
-               const struct lttng_credentials *creds)
+lttng_event_rule_python_logging_generate_filter_bytecode(struct lttng_event_rule *rule,
+                                                        const struct lttng_credentials *creds)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -304,8 +287,7 @@ lttng_event_rule_python_logging_generate_filter_bytecode(
 
        LTTNG_ASSERT(rule);
 
-       python_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_python_logging::parent);
+       python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
 
        status = lttng_event_rule_python_logging_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
@@ -334,8 +316,7 @@ lttng_event_rule_python_logging_generate_filter_bytecode(
        }
 
        ret = run_as_generate_filter_bytecode(
-                       python_logging->internal_filter.filter, creds,
-                       &bytecode);
+               python_logging->internal_filter.filter, creds, &bytecode);
        if (ret) {
                ret_code = LTTNG_ERR_FILTER_INVAL;
                goto end;
@@ -351,48 +332,43 @@ end:
        return ret_code;
 }
 
-static const char *lttng_event_rule_python_logging_get_internal_filter(
-               const struct lttng_event_rule *rule)
+static const char *
+lttng_event_rule_python_logging_get_internal_filter(const struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_python_logging *python_logging;
 
        LTTNG_ASSERT(rule);
-       python_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_python_logging::parent);
+       python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
        return python_logging->internal_filter.filter;
 }
 
 static const struct lttng_bytecode *
-lttng_event_rule_python_logging_get_internal_filter_bytecode(
-               const struct lttng_event_rule *rule)
+lttng_event_rule_python_logging_get_internal_filter_bytecode(const struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_python_logging *python_logging;
 
        LTTNG_ASSERT(rule);
-       python_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_python_logging::parent);
+       python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
        return python_logging->internal_filter.bytecode;
 }
 
 static enum lttng_event_rule_generate_exclusions_status
-lttng_event_rule_python_logging_generate_exclusions(
-               const struct lttng_event_rule *rule __attribute__((unused)),
-               struct lttng_event_exclusion **_exclusions)
+lttng_event_rule_python_logging_generate_exclusions(const struct lttng_event_rule *rule
+                                                   __attribute__((unused)),
+                                                   struct lttng_event_exclusion **_exclusions)
 {
        /* Unsupported. */
        *_exclusions = NULL;
        return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
 }
 
-static unsigned long lttng_event_rule_python_logging_hash(
-               const struct lttng_event_rule *rule)
+static unsigned long lttng_event_rule_python_logging_hash(const struct lttng_event_rule *rule)
 {
        unsigned long hash;
        struct lttng_event_rule_python_logging *tp_rule =
-                       lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
+               lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
 
-       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING,
-                       lttng_ht_seed);
+       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING, lttng_ht_seed);
        hash ^= hash_key_str(tp_rule->pattern, lttng_ht_seed);
 
        if (tp_rule->filter_expression) {
@@ -406,8 +382,8 @@ static unsigned long lttng_event_rule_python_logging_hash(
        return hash;
 }
 
-static struct lttng_event *lttng_event_rule_python_logging_generate_lttng_event(
-               const struct lttng_event_rule *rule)
+static struct lttng_event *
+lttng_event_rule_python_logging_generate_lttng_event(const struct lttng_event_rule *rule)
 {
        int ret;
        const struct lttng_event_rule_python_logging *python_logging;
@@ -418,8 +394,7 @@ static struct lttng_event *lttng_event_rule_python_logging_generate_lttng_event(
        enum lttng_event_rule_status status;
        const struct lttng_log_level_rule *log_level_rule;
 
-       python_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_python_logging::parent);
+       python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
 
        local_event = zmalloc<lttng_event>();
        if (!local_event) {
@@ -427,18 +402,15 @@ static struct lttng_event *lttng_event_rule_python_logging_generate_lttng_event(
        }
 
        local_event->type = LTTNG_EVENT_TRACEPOINT;
-       ret = lttng_strncpy(local_event->name, python_logging->pattern,
-                           sizeof(local_event->name));
+       ret = lttng_strncpy(local_event->name, python_logging->pattern, sizeof(local_event->name));
        if (ret) {
                ERR("Truncation occurred when copying event rule pattern to `lttng_event` structure: pattern = '%s'",
-                               python_logging->pattern);
+                   python_logging->pattern);
                goto error;
        }
 
-
        /* Map the log level rule to an equivalent lttng_loglevel. */
-       status = lttng_event_rule_python_logging_get_log_level_rule(
-                       rule, &log_level_rule);
+       status = lttng_event_rule_python_logging_get_log_level_rule(rule, &log_level_rule);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
                loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
                loglevel_value = 0;
@@ -447,13 +419,13 @@ static struct lttng_event *lttng_event_rule_python_logging_generate_lttng_event(
 
                switch (lttng_log_level_rule_get_type(log_level_rule)) {
                case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
-                       llr_status = lttng_log_level_rule_exactly_get_level(
-                                       log_level_rule, &loglevel_value);
+                       llr_status = lttng_log_level_rule_exactly_get_level(log_level_rule,
+                                                                           &loglevel_value);
                        loglevel_type = LTTNG_EVENT_LOGLEVEL_SINGLE;
                        break;
                case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
                        llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                                       log_level_rule, &loglevel_value);
+                               log_level_rule, &loglevel_value);
                        loglevel_type = LTTNG_EVENT_LOGLEVEL_RANGE;
                        break;
                default:
@@ -478,8 +450,9 @@ error:
        return event;
 }
 
-static enum lttng_error_code lttng_event_rule_python_logging_mi_serialize(
-               const struct lttng_event_rule *rule, struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_rule_python_logging_mi_serialize(const struct lttng_event_rule *rule,
+                                            struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -492,39 +465,35 @@ static enum lttng_error_code lttng_event_rule_python_logging_mi_serialize(
        LTTNG_ASSERT(writer);
        LTTNG_ASSERT(IS_PYTHON_LOGGING_EVENT_RULE(rule));
 
-       status = lttng_event_rule_python_logging_get_name_pattern(
-                       rule, &name_pattern);
+       status = lttng_event_rule_python_logging_get_name_pattern(rule, &name_pattern);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
        LTTNG_ASSERT(name_pattern);
 
        status = lttng_event_rule_python_logging_get_filter(rule, &filter);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
-                       status == LTTNG_EVENT_RULE_STATUS_UNSET);
+                    status == LTTNG_EVENT_RULE_STATUS_UNSET);
 
-       status = lttng_event_rule_python_logging_get_log_level_rule(
-                       rule, &log_level_rule);
+       status = lttng_event_rule_python_logging_get_log_level_rule(rule, &log_level_rule);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
-                       status == LTTNG_EVENT_RULE_STATUS_UNSET);
+                    status == LTTNG_EVENT_RULE_STATUS_UNSET);
 
        /* Open event rule python logging element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_event_rule_python_logging);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_rule_python_logging);
        if (ret) {
                goto mi_error;
        }
 
        /* Name pattern. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_event_rule_name_pattern, name_pattern);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_event_rule_name_pattern, name_pattern);
        if (ret) {
                goto mi_error;
        }
 
        /* Filter expression. */
        if (filter != NULL) {
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_event_rule_filter_expression,
-                               filter);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, mi_lttng_element_event_rule_filter_expression, filter);
                if (ret) {
                        goto mi_error;
                }
@@ -532,8 +501,7 @@ static enum lttng_error_code lttng_event_rule_python_logging_mi_serialize(
 
        /* Log level rule. */
        if (log_level_rule) {
-               ret_code = lttng_log_level_rule_mi_serialize(
-                               log_level_rule, writer);
+               ret_code = lttng_log_level_rule_mi_serialize(log_level_rule, writer);
                if (ret_code != LTTNG_OK) {
                        goto end;
                }
@@ -572,16 +540,13 @@ struct lttng_event_rule *lttng_event_rule_python_logging_create(void)
        tp_rule->parent.equal = lttng_event_rule_python_logging_is_equal;
        tp_rule->parent.destroy = lttng_event_rule_python_logging_destroy;
        tp_rule->parent.generate_filter_bytecode =
-                       lttng_event_rule_python_logging_generate_filter_bytecode;
-       tp_rule->parent.get_filter =
-                       lttng_event_rule_python_logging_get_internal_filter;
+               lttng_event_rule_python_logging_generate_filter_bytecode;
+       tp_rule->parent.get_filter = lttng_event_rule_python_logging_get_internal_filter;
        tp_rule->parent.get_filter_bytecode =
-                       lttng_event_rule_python_logging_get_internal_filter_bytecode;
-       tp_rule->parent.generate_exclusions =
-                       lttng_event_rule_python_logging_generate_exclusions;
+               lttng_event_rule_python_logging_get_internal_filter_bytecode;
+       tp_rule->parent.generate_exclusions = lttng_event_rule_python_logging_generate_exclusions;
        tp_rule->parent.hash = lttng_event_rule_python_logging_hash;
-       tp_rule->parent.generate_lttng_event =
-                       lttng_event_rule_python_logging_generate_lttng_event;
+       tp_rule->parent.generate_lttng_event = lttng_event_rule_python_logging_generate_lttng_event;
        tp_rule->parent.mi_serialize = lttng_event_rule_python_logging_mi_serialize;
 
        tp_rule->log_level_rule = NULL;
@@ -597,9 +562,8 @@ end:
        return rule;
 }
 
-ssize_t lttng_event_rule_python_logging_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_rule **_event_rule)
+ssize_t lttng_event_rule_python_logging_create_from_payload(struct lttng_payload_view *view,
+                                                           struct lttng_event_rule **_event_rule)
 {
        ssize_t ret, offset = 0;
        enum lttng_event_rule_status status;
@@ -615,8 +579,8 @@ ssize_t lttng_event_rule_python_logging_create_from_payload(
                goto end;
        }
 
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, sizeof(*python_logging_comm));
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*python_logging_comm));
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ERR("Failed to initialize from malformed event rule python_logging: buffer too short to contain header.");
                ret = -1;
@@ -637,7 +601,7 @@ ssize_t lttng_event_rule_python_logging_create_from_payload(
 
        /* Map the pattern. */
        current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, python_logging_comm->pattern_len);
+               &view->buffer, offset, python_logging_comm->pattern_len);
 
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
@@ -645,8 +609,8 @@ ssize_t lttng_event_rule_python_logging_create_from_payload(
        }
 
        pattern = current_buffer_view.data;
-       if (!lttng_buffer_view_contains_string(&current_buffer_view, pattern,
-                       python_logging_comm->pattern_len)) {
+       if (!lttng_buffer_view_contains_string(
+                   &current_buffer_view, pattern, python_logging_comm->pattern_len)) {
                ret = -1;
                goto end;
        }
@@ -659,8 +623,8 @@ ssize_t lttng_event_rule_python_logging_create_from_payload(
        }
 
        /* Map the filter_expression. */
-       current_buffer_view = lttng_buffer_view_from_view(&view->buffer, offset,
-                       python_logging_comm->filter_expression_len);
+       current_buffer_view = lttng_buffer_view_from_view(
+               &view->buffer, offset, python_logging_comm->filter_expression_len);
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
                goto end;
@@ -668,8 +632,8 @@ ssize_t lttng_event_rule_python_logging_create_from_payload(
 
        filter_expression = current_buffer_view.data;
        if (!lttng_buffer_view_contains_string(&current_buffer_view,
-                       filter_expression,
-                       python_logging_comm->filter_expression_len)) {
+                                              filter_expression,
+                                              python_logging_comm->filter_expression_len)) {
                ret = -1;
                goto end;
        }
@@ -684,12 +648,11 @@ skip_filter_expression:
 
        {
                /* Map the log level rule. */
-               struct lttng_payload_view current_payload_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               python_logging_comm->log_level_rule_len);
+               struct lttng_payload_view current_payload_view = lttng_payload_view_from_view(
+                       view, offset, python_logging_comm->log_level_rule_len);
 
-               ret = lttng_log_level_rule_create_from_payload(
-                               &current_payload_view, &log_level_rule);
+               ret = lttng_log_level_rule_create_from_payload(&current_payload_view,
+                                                              &log_level_rule);
                if (ret < 0) {
                        ret = -1;
                        goto end;
@@ -711,8 +674,7 @@ skip_log_level_rule:
        }
 
        if (filter_expression) {
-               status = lttng_event_rule_python_logging_set_filter(
-                               rule, filter_expression);
+               status = lttng_event_rule_python_logging_set_filter(rule, filter_expression);
                if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set event rule python_logging pattern.");
                        ret = -1;
@@ -721,8 +683,7 @@ skip_log_level_rule:
        }
 
        if (log_level_rule) {
-               status = lttng_event_rule_python_logging_set_log_level_rule(
-                               rule, log_level_rule);
+               status = lttng_event_rule_python_logging_set_log_level_rule(rule, log_level_rule);
                if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set event rule python_logging log level rule.");
                        ret = -1;
@@ -739,21 +700,19 @@ end:
        return ret;
 }
 
-enum lttng_event_rule_status lttng_event_rule_python_logging_set_name_pattern(
-               struct lttng_event_rule *rule, const char *pattern)
+enum lttng_event_rule_status
+lttng_event_rule_python_logging_set_name_pattern(struct lttng_event_rule *rule, const char *pattern)
 {
        char *pattern_copy = NULL;
        struct lttng_event_rule_python_logging *python_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
-       if (!rule || !IS_PYTHON_LOGGING_EVENT_RULE(rule) || !pattern ||
-                       strlen(pattern) == 0) {
+       if (!rule || !IS_PYTHON_LOGGING_EVENT_RULE(rule) || !pattern || strlen(pattern) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
 
-       python_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_python_logging::parent);
+       python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
        pattern_copy = strdup(pattern);
        if (!pattern_copy) {
                status = LTTNG_EVENT_RULE_STATUS_ERROR;
@@ -771,8 +730,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_python_logging_get_name_pattern(
-               const struct lttng_event_rule *rule, const char **pattern)
+enum lttng_event_rule_status
+lttng_event_rule_python_logging_get_name_pattern(const struct lttng_event_rule *rule,
+                                                const char **pattern)
 {
        struct lttng_event_rule_python_logging *python_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -782,8 +742,7 @@ enum lttng_event_rule_status lttng_event_rule_python_logging_get_name_pattern(
                goto end;
        }
 
-       python_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_python_logging::parent);
+       python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
        if (!python_logging->pattern) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
@@ -794,21 +753,20 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_python_logging_set_filter(
-               struct lttng_event_rule *rule, const char *expression)
+enum lttng_event_rule_status
+lttng_event_rule_python_logging_set_filter(struct lttng_event_rule *rule, const char *expression)
 {
        char *expression_copy = NULL;
        struct lttng_event_rule_python_logging *python_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
        if (!rule || !IS_PYTHON_LOGGING_EVENT_RULE(rule) || !expression ||
-                       strlen(expression) == 0) {
+           strlen(expression) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
 
-       python_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_python_logging::parent);
+       python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
        expression_copy = strdup(expression);
        if (!expression_copy) {
                PERROR("Failed to copy filter expression");
@@ -826,8 +784,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_python_logging_get_filter(
-               const struct lttng_event_rule *rule, const char **expression)
+enum lttng_event_rule_status
+lttng_event_rule_python_logging_get_filter(const struct lttng_event_rule *rule,
+                                          const char **expression)
 {
        const struct lttng_event_rule_python_logging *python_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -837,8 +796,7 @@ enum lttng_event_rule_status lttng_event_rule_python_logging_get_filter(
                goto end;
        }
 
-       python_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_python_logging::parent);
+       python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
        if (!python_logging->filter_expression) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
@@ -849,8 +807,7 @@ end:
        return status;
 }
 
-static bool log_level_rule_valid(
-               const struct lttng_log_level_rule *rule __attribute__((unused)))
+static bool log_level_rule_valid(const struct lttng_log_level_rule *rule __attribute__((unused)))
 {
        /*
         * For python, custom log level are possible, it is not clear if
@@ -862,8 +819,7 @@ static bool log_level_rule_valid(
 }
 
 enum lttng_event_rule_status lttng_event_rule_python_logging_set_log_level_rule(
-               struct lttng_event_rule *rule,
-               const struct lttng_log_level_rule *log_level_rule)
+       struct lttng_event_rule *rule, const struct lttng_log_level_rule *log_level_rule)
 {
        struct lttng_event_rule_python_logging *python_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -874,8 +830,7 @@ enum lttng_event_rule_status lttng_event_rule_python_logging_set_log_level_rule(
                goto end;
        }
 
-       python_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_python_logging::parent);
+       python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
 
        if (!log_level_rule_valid(log_level_rule)) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
@@ -899,9 +854,7 @@ end:
 }
 
 enum lttng_event_rule_status lttng_event_rule_python_logging_get_log_level_rule(
-               const struct lttng_event_rule *rule,
-               const struct lttng_log_level_rule **log_level_rule
-               )
+       const struct lttng_event_rule *rule, const struct lttng_log_level_rule **log_level_rule)
 {
        struct lttng_event_rule_python_logging *python_logging;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -911,8 +864,7 @@ enum lttng_event_rule_status lttng_event_rule_python_logging_get_log_level_rule(
                goto end;
        }
 
-       python_logging = lttng::utils::container_of(
-                       rule, &lttng_event_rule_python_logging::parent);
+       python_logging = lttng::utils::container_of(rule, &lttng_event_rule_python_logging::parent);
        if (python_logging->log_level_rule == NULL) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
index 318bc21c805281bbd3fc46f38501be1e8a2e6704..39018f5a3e9cdaded1a177a02980f54ba3bc4971 100644 (file)
@@ -16,6 +16,7 @@
 #include <common/payload.hpp>
 #include <common/runas.hpp>
 #include <common/string-utils/string-utils.hpp>
+
 #include <lttng/event-rule/event-rule-internal.hpp>
 #include <lttng/event-rule/user-tracepoint-internal.hpp>
 #include <lttng/event.h>
@@ -32,8 +33,7 @@ static void lttng_event_rule_user_tracepoint_destroy(struct lttng_event_rule *ru
                return;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
 
        lttng_log_level_rule_destroy(tracepoint->log_level_rule);
        lttng_dynamic_pointer_array_reset(&tracepoint->exclusions);
@@ -44,8 +44,7 @@ static void lttng_event_rule_user_tracepoint_destroy(struct lttng_event_rule *ru
        free(tracepoint);
 }
 
-static bool lttng_event_rule_user_tracepoint_validate(
-               const struct lttng_event_rule *rule)
+static bool lttng_event_rule_user_tracepoint_validate(const struct lttng_event_rule *rule)
 {
        bool valid = false;
        struct lttng_event_rule_user_tracepoint *tracepoint;
@@ -54,8 +53,7 @@ static bool lttng_event_rule_user_tracepoint_validate(
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
 
        /* Required field. */
        if (!tracepoint->pattern) {
@@ -68,9 +66,8 @@ end:
        return valid;
 }
 
-static int lttng_event_rule_user_tracepoint_serialize(
-               const struct lttng_event_rule *rule,
-               struct lttng_payload *payload)
+static int lttng_event_rule_user_tracepoint_serialize(const struct lttng_event_rule *rule,
+                                                     struct lttng_payload *payload)
 {
        int ret, i;
        size_t pattern_len, filter_expression_len, exclusions_len, header_offset;
@@ -90,17 +87,16 @@ static int lttng_event_rule_user_tracepoint_serialize(
        header_offset = payload->buffer.size;
 
        DBG("Serializing user tracepoint event rule.");
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
 
-       status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(rule, &exclusion_count);
+       status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(
+               rule, &exclusion_count);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
 
        pattern_len = strlen(tracepoint->pattern) + 1;
 
        if (tracepoint->filter_expression != NULL) {
-               filter_expression_len =
-                               strlen(tracepoint->filter_expression) + 1;
+               filter_expression_len = strlen(tracepoint->filter_expression) + 1;
        } else {
                filter_expression_len = 0;
        }
@@ -110,7 +106,7 @@ static int lttng_event_rule_user_tracepoint_serialize(
                const char *exclusion;
 
                status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
-                               rule, i, &exclusion);
+                       rule, i, &exclusion);
                LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
 
                /* Length field. */
@@ -124,20 +120,19 @@ static int lttng_event_rule_user_tracepoint_serialize(
        tracepoint_comm.exclusions_count = exclusion_count;
        tracepoint_comm.exclusions_len = exclusions_len;
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &tracepoint_comm,
-                       sizeof(tracepoint_comm));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &tracepoint_comm, sizeof(tracepoint_comm));
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, tracepoint->pattern, pattern_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, tracepoint->pattern, pattern_len);
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, tracepoint->filter_expression,
-                       filter_expression_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, tracepoint->filter_expression, filter_expression_len);
        if (ret) {
                goto end;
        }
@@ -150,21 +145,19 @@ static int lttng_event_rule_user_tracepoint_serialize(
        }
 
        header = (typeof(header)) ((char *) payload->buffer.data + header_offset);
-       header->log_level_rule_len =
-                       payload->buffer.size - size_before_log_level_rule;
+       header->log_level_rule_len = payload->buffer.size - size_before_log_level_rule;
 
        for (i = 0; i < exclusion_count; i++) {
                size_t len;
                const char *exclusion;
 
                status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
-                               rule, i, &exclusion);
+                       rule, i, &exclusion);
                LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
 
                len = strlen(exclusion) + 1;
                /* Append exclusion length, includes the null terminator. */
-               ret = lttng_dynamic_buffer_append(
-                               &payload->buffer, &len, sizeof(uint32_t));
+               ret = lttng_dynamic_buffer_append(&payload->buffer, &len, sizeof(uint32_t));
                if (ret) {
                        goto end;
                }
@@ -172,8 +165,7 @@ static int lttng_event_rule_user_tracepoint_serialize(
                exclusions_appended_len += sizeof(uint32_t);
 
                /* Include the '\0' in the payload. */
-               ret = lttng_dynamic_buffer_append(
-                               &payload->buffer, exclusion, len);
+               ret = lttng_dynamic_buffer_append(&payload->buffer, exclusion, len);
                if (ret) {
                        goto end;
                }
@@ -187,9 +179,8 @@ end:
        return ret;
 }
 
-static bool lttng_event_rule_user_tracepoint_is_equal(
-               const struct lttng_event_rule *_a,
-               const struct lttng_event_rule *_b)
+static bool lttng_event_rule_user_tracepoint_is_equal(const struct lttng_event_rule *_a,
+                                                     const struct lttng_event_rule *_b)
 {
        int i;
        bool is_equal = false;
@@ -230,8 +221,7 @@ static bool lttng_event_rule_user_tracepoint_is_equal(
                goto end;
        }
 
-       if (!lttng_log_level_rule_is_equal(
-                               a->log_level_rule, b->log_level_rule)) {
+       if (!lttng_log_level_rule_is_equal(a->log_level_rule, b->log_level_rule)) {
                goto end;
        }
 
@@ -239,10 +229,10 @@ static bool lttng_event_rule_user_tracepoint_is_equal(
                const char *exclusion_a, *exclusion_b;
 
                status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
-                               _a, i, &exclusion_a);
+                       _a, i, &exclusion_a);
                LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
                status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
-                               _b, i, &exclusion_b);
+                       _b, i, &exclusion_b);
                LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
                if (strcmp(exclusion_a, exclusion_b)) {
                        goto end;
@@ -255,9 +245,8 @@ end:
 }
 
 static enum lttng_error_code
-lttng_event_rule_user_tracepoint_generate_filter_bytecode(
-               struct lttng_event_rule *rule,
-               const struct lttng_credentials *creds)
+lttng_event_rule_user_tracepoint_generate_filter_bytecode(struct lttng_event_rule *rule,
+                                                         const struct lttng_credentials *creds)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -268,8 +257,7 @@ lttng_event_rule_user_tracepoint_generate_filter_bytecode(
 
        LTTNG_ASSERT(rule);
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
 
        status = lttng_event_rule_user_tracepoint_get_filter(rule, &filter);
        if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
@@ -299,9 +287,7 @@ lttng_event_rule_user_tracepoint_generate_filter_bytecode(
                goto end;
        }
 
-       ret = run_as_generate_filter_bytecode(
-                       tracepoint->internal_filter.filter, creds,
-                       &bytecode);
+       ret = run_as_generate_filter_bytecode(tracepoint->internal_filter.filter, creds, &bytecode);
        if (ret) {
                ret_code = LTTNG_ERR_FILTER_INVAL;
                goto end;
@@ -317,33 +303,29 @@ end:
        return ret_code;
 }
 
-static const char *lttng_event_rule_user_tracepoint_get_internal_filter(
-               const struct lttng_event_rule *rule)
+static const char *
+lttng_event_rule_user_tracepoint_get_internal_filter(const struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_user_tracepoint *tracepoint;
 
        LTTNG_ASSERT(rule);
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
        return tracepoint->internal_filter.filter;
 }
 
 static const struct lttng_bytecode *
-lttng_event_rule_user_tracepoint_get_internal_filter_bytecode(
-               const struct lttng_event_rule *rule)
+lttng_event_rule_user_tracepoint_get_internal_filter_bytecode(const struct lttng_event_rule *rule)
 {
        struct lttng_event_rule_user_tracepoint *tracepoint;
 
        LTTNG_ASSERT(rule);
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
        return tracepoint->internal_filter.bytecode;
 }
 
 static enum lttng_event_rule_generate_exclusions_status
-lttng_event_rule_user_tracepoint_generate_exclusions(
-               const struct lttng_event_rule *rule,
-               struct lttng_event_exclusion **_exclusions)
+lttng_event_rule_user_tracepoint_generate_exclusions(const struct lttng_event_rule *rule,
+                                                    struct lttng_event_exclusion **_exclusions)
 {
        unsigned int nb_exclusions = 0, i;
        struct lttng_event_exclusion *exclusions;
@@ -353,7 +335,7 @@ lttng_event_rule_user_tracepoint_generate_exclusions(
        LTTNG_ASSERT(_exclusions);
 
        event_rule_status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(
-                       rule, &nb_exclusions);
+               rule, &nb_exclusions);
        LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
        if (nb_exclusions == 0) {
                /* Nothing to do. */
@@ -362,7 +344,8 @@ lttng_event_rule_user_tracepoint_generate_exclusions(
                goto end;
        }
 
-       exclusions = zmalloc<lttng_event_exclusion>(sizeof(struct lttng_event_exclusion) + (LTTNG_SYMBOL_NAME_LEN * nb_exclusions));
+       exclusions = zmalloc<lttng_event_exclusion>(sizeof(struct lttng_event_exclusion) +
+                                                   (LTTNG_SYMBOL_NAME_LEN * nb_exclusions));
        if (!exclusions) {
                PERROR("Failed to allocate exclusions buffer");
                ret_status = LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_OUT_OF_MEMORY;
@@ -375,14 +358,13 @@ lttng_event_rule_user_tracepoint_generate_exclusions(
                const char *exclusion_str;
 
                event_rule_status =
-                               lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
-                                               rule, i, &exclusion_str);
+                       lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
+                               rule, i, &exclusion_str);
                LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
 
-               copy_ret = lttng_strncpy(
-                               LTTNG_EVENT_EXCLUSION_NAME_AT(exclusions, i),
-                               exclusion_str,
-                               sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusions, i)));
+               copy_ret = lttng_strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusions, i),
+                                        exclusion_str,
+                                        sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusions, i)));
                if (copy_ret) {
                        free(exclusions);
                        exclusions = NULL;
@@ -403,17 +385,15 @@ static void destroy_lttng_exclusions_element(void *ptr)
        free(ptr);
 }
 
-static unsigned long lttng_event_rule_user_tracepoint_hash(
-               const struct lttng_event_rule *rule)
+static unsigned long lttng_event_rule_user_tracepoint_hash(const struct lttng_event_rule *rule)
 {
        unsigned long hash;
        unsigned int i, exclusion_count;
        enum lttng_event_rule_status status;
        struct lttng_event_rule_user_tracepoint *tp_rule =
-                       lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
+               lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
 
-       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT,
-                       lttng_ht_seed);
+       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT, lttng_ht_seed);
        hash ^= hash_key_str(tp_rule->pattern, lttng_ht_seed);
 
        if (tp_rule->filter_expression) {
@@ -424,15 +404,15 @@ static unsigned long lttng_event_rule_user_tracepoint_hash(
                hash ^= lttng_log_level_rule_hash(tp_rule->log_level_rule);
        }
 
-       status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(rule,
-                       &exclusion_count);
+       status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(
+               rule, &exclusion_count);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
 
        for (i = 0; i < exclusion_count; i++) {
                const char *exclusion;
 
                status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
-                               rule, i, &exclusion);
+                       rule, i, &exclusion);
                LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
                hash ^= hash_key_str(exclusion, lttng_ht_seed);
        }
@@ -440,8 +420,9 @@ static unsigned long lttng_event_rule_user_tracepoint_hash(
        return hash;
 }
 
-static enum lttng_error_code lttng_event_rule_user_tracepoint_mi_serialize(
-               const struct lttng_event_rule *rule, struct mi_writer *writer)
+static enum lttng_error_code
+lttng_event_rule_user_tracepoint_mi_serialize(const struct lttng_event_rule *rule,
+                                             struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -455,43 +436,39 @@ static enum lttng_error_code lttng_event_rule_user_tracepoint_mi_serialize(
        LTTNG_ASSERT(writer);
        LTTNG_ASSERT(IS_USER_TRACEPOINT_EVENT_RULE(rule));
 
-       status = lttng_event_rule_user_tracepoint_get_name_pattern(
-                       rule, &name_pattern);
+       status = lttng_event_rule_user_tracepoint_get_name_pattern(rule, &name_pattern);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
        LTTNG_ASSERT(name_pattern);
 
        status = lttng_event_rule_user_tracepoint_get_filter(rule, &filter);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
-                       status == LTTNG_EVENT_RULE_STATUS_UNSET);
+                    status == LTTNG_EVENT_RULE_STATUS_UNSET);
 
-       status = lttng_event_rule_user_tracepoint_get_log_level_rule(
-                       rule, &log_level_rule);
+       status = lttng_event_rule_user_tracepoint_get_log_level_rule(rule, &log_level_rule);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
-                       status == LTTNG_EVENT_RULE_STATUS_UNSET);
+                    status == LTTNG_EVENT_RULE_STATUS_UNSET);
 
        status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(
-                       rule, &exclusion_count);
+               rule, &exclusion_count);
        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
 
        /* Open event rule user tracepoint element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_event_rule_user_tracepoint);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_rule_user_tracepoint);
        if (ret) {
                goto mi_error;
        }
 
        /* Name pattern. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_event_rule_name_pattern, name_pattern);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_event_rule_name_pattern, name_pattern);
        if (ret) {
                goto mi_error;
        }
 
        /* Filter expression. */
        if (filter != NULL) {
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_event_rule_filter_expression,
-                               filter);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, mi_lttng_element_event_rule_filter_expression, filter);
                if (ret) {
                        goto mi_error;
                }
@@ -499,8 +476,7 @@ static enum lttng_error_code lttng_event_rule_user_tracepoint_mi_serialize(
 
        /* Log level rule. */
        if (log_level_rule) {
-               ret_code = lttng_log_level_rule_mi_serialize(
-                               log_level_rule, writer);
+               ret_code = lttng_log_level_rule_mi_serialize(log_level_rule, writer);
                if (ret_code != LTTNG_OK) {
                        goto end;
                }
@@ -510,8 +486,9 @@ static enum lttng_error_code lttng_event_rule_user_tracepoint_mi_serialize(
                int i;
 
                /* Open the exclusion list. */
-               ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusions);
+               ret = mi_lttng_writer_open_element(
+                       writer,
+                       mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusions);
                if (ret) {
                        goto mi_error;
                }
@@ -519,13 +496,15 @@ static enum lttng_error_code lttng_event_rule_user_tracepoint_mi_serialize(
                for (i = 0; i < exclusion_count; i++) {
                        const char *exclusion;
 
-                       status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
+                       status =
+                               lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
                                        rule, i, &exclusion);
                        LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
 
-                       ret = mi_lttng_writer_write_element_string(writer,
-                                       mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusion,
-                                       exclusion);
+                       ret = mi_lttng_writer_write_element_string(
+                               writer,
+                               mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusion,
+                               exclusion);
                        if (ret) {
                                goto mi_error;
                        }
@@ -571,13 +550,11 @@ struct lttng_event_rule *lttng_event_rule_user_tracepoint_create(void)
        tp_rule->parent.equal = lttng_event_rule_user_tracepoint_is_equal;
        tp_rule->parent.destroy = lttng_event_rule_user_tracepoint_destroy;
        tp_rule->parent.generate_filter_bytecode =
-                       lttng_event_rule_user_tracepoint_generate_filter_bytecode;
-       tp_rule->parent.get_filter =
-                       lttng_event_rule_user_tracepoint_get_internal_filter;
+               lttng_event_rule_user_tracepoint_generate_filter_bytecode;
+       tp_rule->parent.get_filter = lttng_event_rule_user_tracepoint_get_internal_filter;
        tp_rule->parent.get_filter_bytecode =
-                       lttng_event_rule_user_tracepoint_get_internal_filter_bytecode;
-       tp_rule->parent.generate_exclusions =
-                       lttng_event_rule_user_tracepoint_generate_exclusions;
+               lttng_event_rule_user_tracepoint_get_internal_filter_bytecode;
+       tp_rule->parent.generate_exclusions = lttng_event_rule_user_tracepoint_generate_exclusions;
        tp_rule->parent.hash = lttng_event_rule_user_tracepoint_hash;
        tp_rule->parent.mi_serialize = lttng_event_rule_user_tracepoint_mi_serialize;
 
@@ -586,8 +563,7 @@ struct lttng_event_rule *lttng_event_rule_user_tracepoint_create(void)
 
        tp_rule->log_level_rule = NULL;
 
-       lttng_dynamic_pointer_array_init(&tp_rule->exclusions,
-                       destroy_lttng_exclusions_element);
+       lttng_dynamic_pointer_array_init(&tp_rule->exclusions, destroy_lttng_exclusions_element);
 
        /* Default pattern is '*'. */
        status = lttng_event_rule_user_tracepoint_set_name_pattern(rule, "*");
@@ -600,9 +576,8 @@ end:
        return rule;
 }
 
-ssize_t lttng_event_rule_user_tracepoint_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_rule **_event_rule)
+ssize_t lttng_event_rule_user_tracepoint_create_from_payload(struct lttng_payload_view *view,
+                                                            struct lttng_event_rule **_event_rule)
 {
        ssize_t ret, offset = 0;
        int i;
@@ -622,8 +597,8 @@ ssize_t lttng_event_rule_user_tracepoint_create_from_payload(
                goto end;
        }
 
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, sizeof(*tracepoint_comm));
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*tracepoint_comm));
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ERR("Failed to initialize from malformed event rule tracepoint: buffer too short to contain header.");
                ret = -1;
@@ -643,8 +618,8 @@ ssize_t lttng_event_rule_user_tracepoint_create_from_payload(
        offset += current_buffer_view.size;
 
        /* Map the pattern. */
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, tracepoint_comm->pattern_len);
+       current_buffer_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, tracepoint_comm->pattern_len);
 
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
@@ -652,8 +627,8 @@ ssize_t lttng_event_rule_user_tracepoint_create_from_payload(
        }
 
        pattern = current_buffer_view.data;
-       if (!lttng_buffer_view_contains_string(&current_buffer_view, pattern,
-                       tracepoint_comm->pattern_len)) {
+       if (!lttng_buffer_view_contains_string(
+                   &current_buffer_view, pattern, tracepoint_comm->pattern_len)) {
                ret = -1;
                goto end;
        }
@@ -666,8 +641,8 @@ ssize_t lttng_event_rule_user_tracepoint_create_from_payload(
        }
 
        /* Map the filter_expression. */
-       current_buffer_view = lttng_buffer_view_from_view(&view->buffer, offset,
-                       tracepoint_comm->filter_expression_len);
+       current_buffer_view = lttng_buffer_view_from_view(
+               &view->buffer, offset, tracepoint_comm->filter_expression_len);
        if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                ret = -1;
                goto end;
@@ -675,8 +650,8 @@ ssize_t lttng_event_rule_user_tracepoint_create_from_payload(
 
        filter_expression = current_buffer_view.data;
        if (!lttng_buffer_view_contains_string(&current_buffer_view,
-                       filter_expression,
-                       tracepoint_comm->filter_expression_len)) {
+                                              filter_expression,
+                                              tracepoint_comm->filter_expression_len)) {
                ret = -1;
                goto end;
        }
@@ -691,12 +666,11 @@ skip_filter_expression:
 
        {
                /* Map the log level rule. */
-               struct lttng_payload_view current_payload_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               tracepoint_comm->log_level_rule_len);
+               struct lttng_payload_view current_payload_view = lttng_payload_view_from_view(
+                       view, offset, tracepoint_comm->log_level_rule_len);
 
-               ret = lttng_log_level_rule_create_from_payload(
-                               &current_payload_view, &log_level_rule);
+               ret = lttng_log_level_rule_create_from_payload(&current_payload_view,
+                                                              &log_level_rule);
                if (ret < 0) {
                        ret = -1;
                        goto end;
@@ -710,8 +684,8 @@ skip_filter_expression:
 
 skip_log_level_rule:
        for (i = 0; i < tracepoint_comm->exclusions_count; i++) {
-               current_buffer_view = lttng_buffer_view_from_view(
-                               &view->buffer, offset, sizeof(*exclusion_len));
+               current_buffer_view =
+                       lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*exclusion_len));
                if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                        ret = -1;
                        goto end;
@@ -720,24 +694,25 @@ skip_log_level_rule:
                exclusion_len = (typeof(exclusion_len)) current_buffer_view.data;
                offset += sizeof(*exclusion_len);
 
-               current_buffer_view = lttng_buffer_view_from_view(
-                               &view->buffer, offset, *exclusion_len);
+               current_buffer_view =
+                       lttng_buffer_view_from_view(&view->buffer, offset, *exclusion_len);
                if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
                        ret = -1;
                        goto end;
                }
 
                exclusion = current_buffer_view.data;
-               if (!lttng_buffer_view_contains_string(&current_buffer_view,
-                               exclusion, *exclusion_len)) {
+               if (!lttng_buffer_view_contains_string(
+                           &current_buffer_view, exclusion, *exclusion_len)) {
                        ret = -1;
                        goto end;
                }
 
-               status = lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(rule, exclusion);
+               status = lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(rule,
+                                                                                    exclusion);
                if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to add event rule user tracepoint exclusion \"%s\".",
-                                       exclusion);
+                           exclusion);
                        ret = -1;
                        goto end;
                }
@@ -754,8 +729,7 @@ skip_log_level_rule:
        }
 
        if (filter_expression) {
-               status = lttng_event_rule_user_tracepoint_set_filter(
-                               rule, filter_expression);
+               status = lttng_event_rule_user_tracepoint_set_filter(rule, filter_expression);
                if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set event rule user tracepoint pattern.");
                        ret = -1;
@@ -764,8 +738,7 @@ skip_log_level_rule:
        }
 
        if (log_level_rule) {
-               status = lttng_event_rule_user_tracepoint_set_log_level_rule(
-                               rule, log_level_rule);
+               status = lttng_event_rule_user_tracepoint_set_log_level_rule(rule, log_level_rule);
                if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set event rule user tracepoint log level rule.");
                        ret = -1;
@@ -783,21 +756,20 @@ end:
        return ret;
 }
 
-enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_name_pattern(
-               struct lttng_event_rule *rule, const char *pattern)
+enum lttng_event_rule_status
+lttng_event_rule_user_tracepoint_set_name_pattern(struct lttng_event_rule *rule,
+                                                 const char *pattern)
 {
        char *pattern_copy = NULL;
        struct lttng_event_rule_user_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
-       if (!rule || !IS_USER_TRACEPOINT_EVENT_RULE(rule) || !pattern ||
-                       strlen(pattern) == 0) {
+       if (!rule || !IS_USER_TRACEPOINT_EVENT_RULE(rule) || !pattern || strlen(pattern) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
        pattern_copy = strdup(pattern);
        if (!pattern_copy) {
                status = LTTNG_EVENT_RULE_STATUS_ERROR;
@@ -815,8 +787,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pattern(
-               const struct lttng_event_rule *rule, const char **pattern)
+enum lttng_event_rule_status
+lttng_event_rule_user_tracepoint_get_name_pattern(const struct lttng_event_rule *rule,
+                                                 const char **pattern)
 {
        struct lttng_event_rule_user_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -826,8 +799,7 @@ enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pattern(
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
        if (!tracepoint->pattern) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
@@ -838,21 +810,20 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_filter(
-               struct lttng_event_rule *rule, const char *expression)
+enum lttng_event_rule_status
+lttng_event_rule_user_tracepoint_set_filter(struct lttng_event_rule *rule, const char *expression)
 {
        char *expression_copy = NULL;
        struct lttng_event_rule_user_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
        if (!rule || !IS_USER_TRACEPOINT_EVENT_RULE(rule) || !expression ||
-                       strlen(expression) == 0) {
+           strlen(expression) == 0) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
        expression_copy = strdup(expression);
        if (!expression_copy) {
                PERROR("Failed to copy filter expression");
@@ -870,8 +841,9 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_filter(
-               const struct lttng_event_rule *rule, const char **expression)
+enum lttng_event_rule_status
+lttng_event_rule_user_tracepoint_get_filter(const struct lttng_event_rule *rule,
+                                           const char **expression)
 {
        struct lttng_event_rule_user_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -881,8 +853,7 @@ enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_filter(
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
        if (!tracepoint->filter_expression) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
@@ -904,8 +875,7 @@ static bool log_level_rule_valid(const struct lttng_log_level_rule *rule)
                status = lttng_log_level_rule_exactly_get_level(rule, &level);
                break;
        case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
-               status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                               rule, &level);
+               status = lttng_log_level_rule_at_least_as_severe_as_get_level(rule, &level);
                break;
        default:
                abort();
@@ -929,8 +899,7 @@ end:
 }
 
 enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_log_level_rule(
-               struct lttng_event_rule *rule,
-               const struct lttng_log_level_rule *log_level_rule)
+       struct lttng_event_rule *rule, const struct lttng_log_level_rule *log_level_rule)
 {
        struct lttng_event_rule_user_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -941,8 +910,7 @@ enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_log_level_rule
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
 
        if (!log_level_rule_valid(log_level_rule)) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
@@ -966,9 +934,7 @@ end:
 }
 
 enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_log_level_rule(
-               const struct lttng_event_rule *rule,
-               const struct lttng_log_level_rule **log_level_rule
-               )
+       const struct lttng_event_rule *rule, const struct lttng_log_level_rule **log_level_rule)
 {
        struct lttng_event_rule_user_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -978,8 +944,7 @@ enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_log_level_rule
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
        if (tracepoint->log_level_rule == NULL) {
                status = LTTNG_EVENT_RULE_STATUS_UNSET;
                goto end;
@@ -990,23 +955,21 @@ end:
        return status;
 }
 
-enum lttng_event_rule_status lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(
-               struct lttng_event_rule *rule,
-               const char *exclusion)
+enum lttng_event_rule_status
+lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(struct lttng_event_rule *rule,
+                                                           const char *exclusion)
 {
        int ret;
        char *exclusion_copy = NULL;
        struct lttng_event_rule_user_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
 
-       if (!rule || !IS_USER_TRACEPOINT_EVENT_RULE(rule) ||
-                       !exclusion) {
+       if (!rule || !IS_USER_TRACEPOINT_EVENT_RULE(rule) || !exclusion) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
 
        if (strlen(exclusion) >= LTTNG_SYMBOL_NAME_LEN) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
@@ -1019,8 +982,7 @@ enum lttng_event_rule_status lttng_event_rule_user_tracepoint_add_name_pattern_e
                goto end;
        }
 
-       ret = lttng_dynamic_pointer_array_add_pointer(&tracepoint->exclusions,
-                       exclusion_copy);
+       ret = lttng_dynamic_pointer_array_add_pointer(&tracepoint->exclusions, exclusion_copy);
        if (ret < 0) {
                status = LTTNG_EVENT_RULE_STATUS_ERROR;
                goto end;
@@ -1033,7 +995,7 @@ end:
 }
 
 enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(
-               const struct lttng_event_rule *rule, unsigned int *count)
+       const struct lttng_event_rule *rule, unsigned int *count)
 {
        struct lttng_event_rule_user_tracepoint *tracepoint;
        enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
@@ -1043,17 +1005,14 @@ enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pattern_e
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
        *count = lttng_dynamic_pointer_array_get_count(&tracepoint->exclusions);
 end:
        return status;
 }
 
 enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
-               const struct lttng_event_rule *rule,
-               unsigned int index,
-               const char **exclusion)
+       const struct lttng_event_rule *rule, unsigned int index, const char **exclusion)
 {
        unsigned int count;
        struct lttng_event_rule_user_tracepoint *tracepoint;
@@ -1064,10 +1023,9 @@ enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pattern_e
                goto end;
        }
 
-       tracepoint = lttng::utils::container_of(
-                       rule, &lttng_event_rule_user_tracepoint::parent);
+       tracepoint = lttng::utils::container_of(rule, &lttng_event_rule_user_tracepoint::parent);
        if (lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(rule, &count) !=
-                       LTTNG_EVENT_RULE_STATUS_OK) {
+           LTTNG_EVENT_RULE_STATUS_OK) {
                goto end;
        }
 
@@ -1075,8 +1033,8 @@ enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pattern_e
                goto end;
        }
 
-       *exclusion = (const char *) lttng_dynamic_pointer_array_get_pointer(
-                       &tracepoint->exclusions, index);
+       *exclusion = (const char *) lttng_dynamic_pointer_array_get_pointer(&tracepoint->exclusions,
+                                                                           index);
 end:
        return status;
 }
index f33518eee4eece45c2c8ce762cb22765a682209b..49e1b136d860b9440838ac992385e2cbe1c99b72 100644 (file)
@@ -71,16 +71,14 @@ error:
        goto end;
 }
 
-static int lttng_event_probe_attr_serialize(
-               const struct lttng_event_probe_attr *probe,
-               struct lttng_payload *payload)
+static int lttng_event_probe_attr_serialize(const struct lttng_event_probe_attr *probe,
+                                           struct lttng_payload *payload)
 {
        int ret;
        size_t symbol_name_len;
        struct lttng_event_probe_attr_comm comm = {};
 
-       symbol_name_len = lttng_strnlen(
-                       probe->symbol_name, sizeof(probe->symbol_name));
+       symbol_name_len = lttng_strnlen(probe->symbol_name, sizeof(probe->symbol_name));
        if (symbol_name_len == sizeof(probe->symbol_name)) {
                /* Not null-termintated. */
                ret = -1;
@@ -94,22 +92,19 @@ static int lttng_event_probe_attr_serialize(
        comm.addr = probe->addr;
        comm.offset = probe->addr;
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &comm, sizeof(comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
        if (ret < 0) {
                ret = -1;
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, probe->symbol_name, symbol_name_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, probe->symbol_name, symbol_name_len);
 end:
        return ret;
 }
 
-static int lttng_event_function_attr_serialize(
-               const struct lttng_event_function_attr *function,
-               struct lttng_payload *payload)
+static int lttng_event_function_attr_serialize(const struct lttng_event_function_attr *function,
+                                              struct lttng_payload *payload)
 {
        int ret;
        size_t symbol_name_len;
@@ -117,8 +112,7 @@ static int lttng_event_function_attr_serialize(
 
        comm.symbol_name_len = 0;
 
-       symbol_name_len = lttng_strnlen(
-                       function->symbol_name, sizeof(function->symbol_name));
+       symbol_name_len = lttng_strnlen(function->symbol_name, sizeof(function->symbol_name));
        if (symbol_name_len == sizeof(function->symbol_name)) {
                /* Not null-termintated. */
                ret = -1;
@@ -130,28 +124,26 @@ static int lttng_event_function_attr_serialize(
 
        comm.symbol_name_len = (uint32_t) symbol_name_len;
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &comm, sizeof(comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
        if (ret < 0) {
                ret = -1;
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer,
-                       function->symbol_name, symbol_name_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, function->symbol_name, symbol_name_len);
 end:
        return ret;
 }
 
-static ssize_t lttng_event_probe_attr_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_probe_attr **probe_attr)
+static ssize_t
+lttng_event_probe_attr_create_from_payload(struct lttng_payload_view *view,
+                                          struct lttng_event_probe_attr **probe_attr)
 {
        ssize_t ret, offset = 0;
        const struct lttng_event_probe_attr_comm *comm;
        struct lttng_event_probe_attr *local_attr = NULL;
-       struct lttng_payload_view comm_view = lttng_payload_view_from_view(
-                       view, offset, sizeof(*comm));
+       struct lttng_payload_view comm_view =
+               lttng_payload_view_from_view(view, offset, sizeof(*comm));
 
        if (!lttng_payload_view_is_valid(&comm_view)) {
                ret = -1;
@@ -173,8 +165,7 @@ static ssize_t lttng_event_probe_attr_create_from_payload(
        {
                const char *name;
                struct lttng_payload_view name_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               comm->symbol_name_len);
+                       lttng_payload_view_from_view(view, offset, comm->symbol_name_len);
 
                if (!lttng_payload_view_is_valid(&name_view)) {
                        ret = -1;
@@ -183,14 +174,13 @@ static ssize_t lttng_event_probe_attr_create_from_payload(
 
                name = name_view.buffer.data;
 
-               if (!lttng_buffer_view_contains_string(&name_view.buffer, name,
-                                   comm->symbol_name_len)) {
+               if (!lttng_buffer_view_contains_string(
+                           &name_view.buffer, name, comm->symbol_name_len)) {
                        ret = -1;
                        goto end;
                }
 
-               ret = lttng_strncpy(local_attr->symbol_name, name,
-                               sizeof(local_attr->symbol_name));
+               ret = lttng_strncpy(local_attr->symbol_name, name, sizeof(local_attr->symbol_name));
                if (ret) {
                        ret = -1;
                        goto end;
@@ -207,15 +197,15 @@ end:
        return ret;
 }
 
-static ssize_t lttng_event_function_attr_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_function_attr **function_attr)
+static ssize_t
+lttng_event_function_attr_create_from_payload(struct lttng_payload_view *view,
+                                             struct lttng_event_function_attr **function_attr)
 {
        ssize_t ret, offset = 0;
        const struct lttng_event_function_attr_comm *comm;
        struct lttng_event_function_attr *local_attr = NULL;
-       struct lttng_payload_view comm_view = lttng_payload_view_from_view(
-                       view, offset, sizeof(*comm));
+       struct lttng_payload_view comm_view =
+               lttng_payload_view_from_view(view, offset, sizeof(*comm));
 
        if (!lttng_payload_view_is_valid(&comm_view)) {
                ret = -1;
@@ -234,8 +224,7 @@ static ssize_t lttng_event_function_attr_create_from_payload(
        {
                const char *name;
                struct lttng_payload_view name_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               comm->symbol_name_len);
+                       lttng_payload_view_from_view(view, offset, comm->symbol_name_len);
 
                if (!lttng_payload_view_is_valid(&name_view)) {
                        ret = -1;
@@ -244,14 +233,13 @@ static ssize_t lttng_event_function_attr_create_from_payload(
 
                name = name_view.buffer.data;
 
-               if (!lttng_buffer_view_contains_string(&name_view.buffer, name,
-                                   comm->symbol_name_len)) {
+               if (!lttng_buffer_view_contains_string(
+                           &name_view.buffer, name, comm->symbol_name_len)) {
                        ret = -1;
                        goto end;
                }
 
-               ret = lttng_strncpy(local_attr->symbol_name, name,
-                               sizeof(local_attr->symbol_name));
+               ret = lttng_strncpy(local_attr->symbol_name, name, sizeof(local_attr->symbol_name));
                if (ret) {
                        ret = -1;
                        goto end;
@@ -268,10 +256,9 @@ end:
        return ret;
 }
 
-static ssize_t lttng_event_exclusions_create_from_payload(
-               struct lttng_payload_view *view,
-               uint32_t count,
-               struct lttng_event_exclusion **exclusions)
+static ssize_t lttng_event_exclusions_create_from_payload(struct lttng_payload_view *view,
+                                                         uint32_t count,
+                                                         struct lttng_event_exclusion **exclusions)
 {
        ssize_t ret, offset = 0;
        const size_t size = (count * LTTNG_SYMBOL_NAME_LEN);
@@ -279,8 +266,8 @@ static ssize_t lttng_event_exclusions_create_from_payload(
        const struct lttng_event_exclusion_comm *comm;
        struct lttng_event_exclusion *local_exclusions;
 
-       local_exclusions = zmalloc<lttng_event_exclusion>(
-                       sizeof(struct lttng_event_exclusion) + size);
+       local_exclusions =
+               zmalloc<lttng_event_exclusion>(sizeof(struct lttng_event_exclusion) + size);
        if (!local_exclusions) {
                ret = -1;
                goto end;
@@ -292,8 +279,7 @@ static ssize_t lttng_event_exclusions_create_from_payload(
                const char *string;
                struct lttng_buffer_view string_view;
                const struct lttng_buffer_view comm_view =
-                               lttng_buffer_view_from_view(&view->buffer,
-                                               offset, sizeof(*comm));
+                       lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*comm));
 
                if (!lttng_buffer_view_is_valid(&comm_view)) {
                        ret = -1;
@@ -303,8 +289,7 @@ static ssize_t lttng_event_exclusions_create_from_payload(
                comm = (typeof(comm)) comm_view.data;
                offset += sizeof(*comm);
 
-               string_view = lttng_buffer_view_from_view(
-                               &view->buffer, offset, comm->len);
+               string_view = lttng_buffer_view_from_view(&view->buffer, offset, comm->len);
 
                if (!lttng_buffer_view_is_valid(&string_view)) {
                        ret = -1;
@@ -313,14 +298,14 @@ static ssize_t lttng_event_exclusions_create_from_payload(
 
                string = string_view.data;
 
-               if (!lttng_buffer_view_contains_string(
-                                   &string_view, string, comm->len)) {
+               if (!lttng_buffer_view_contains_string(&string_view, string, comm->len)) {
                        ret = -1;
                        goto end;
                }
 
-               ret = lttng_strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(local_exclusions, i), string,
-                               sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(local_exclusions, i)));
+               ret = lttng_strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(local_exclusions, i),
+                                   string,
+                                   sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(local_exclusions, i)));
                if (ret) {
                        ret = -1;
                        goto end;
@@ -338,10 +323,10 @@ end:
 }
 
 ssize_t lttng_event_create_from_payload(struct lttng_payload_view *view,
-               struct lttng_event **out_event,
-               struct lttng_event_exclusion **out_exclusion,
-               char **out_filter_expression,
-               struct lttng_bytecode **out_bytecode)
+                                       struct lttng_event **out_event,
+                                       struct lttng_event_exclusion **out_exclusion,
+                                       char **out_filter_expression,
+                                       struct lttng_bytecode **out_bytecode)
 {
        ssize_t ret, offset = 0;
        struct lttng_event *local_event = NULL;
@@ -351,8 +336,7 @@ ssize_t lttng_event_create_from_payload(struct lttng_payload_view *view,
        const struct lttng_event_comm *event_comm;
        struct lttng_event_function_attr *local_function_attr = NULL;
        struct lttng_event_probe_attr *local_probe_attr = NULL;
-       struct lttng_userspace_probe_location *local_userspace_probe_location =
-                       NULL;
+       struct lttng_userspace_probe_location *local_userspace_probe_location = NULL;
 
        /*
         * Only event is obligatory, the other output argument are optional and
@@ -363,8 +347,7 @@ ssize_t lttng_event_create_from_payload(struct lttng_payload_view *view,
 
        {
                struct lttng_payload_view comm_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               sizeof(*event_comm));
+                       lttng_payload_view_from_view(view, offset, sizeof(*event_comm));
 
                if (!lttng_payload_view_is_valid(&comm_view)) {
                        ret = -1;
@@ -392,8 +375,7 @@ ssize_t lttng_event_create_from_payload(struct lttng_payload_view *view,
        {
                const char *name;
                const struct lttng_buffer_view name_view =
-                               lttng_buffer_view_from_view(&view->buffer,
-                                               offset, event_comm->name_len);
+                       lttng_buffer_view_from_view(&view->buffer, offset, event_comm->name_len);
 
                if (!lttng_buffer_view_is_valid(&name_view)) {
                        ret = -1;
@@ -402,14 +384,12 @@ ssize_t lttng_event_create_from_payload(struct lttng_payload_view *view,
 
                name = (const char *) name_view.data;
 
-               if (!lttng_buffer_view_contains_string(
-                                   &name_view, name, event_comm->name_len)) {
+               if (!lttng_buffer_view_contains_string(&name_view, name, event_comm->name_len)) {
                        ret = -1;
                        goto end;
                }
 
-               ret = lttng_strncpy(local_event->name, name,
-                               sizeof(local_event->name));
+               ret = lttng_strncpy(local_event->name, name, sizeof(local_event->name));
                if (ret) {
                        ret = -1;
                        goto end;
@@ -425,16 +405,15 @@ ssize_t lttng_event_create_from_payload(struct lttng_payload_view *view,
 
        {
                struct lttng_payload_view exclusions_view =
-                               lttng_payload_view_from_view(
-                                               view, offset, -1);
+                       lttng_payload_view_from_view(view, offset, -1);
 
                if (!lttng_payload_view_is_valid(&exclusions_view)) {
                        ret = -1;
                        goto end;
                }
 
-               ret = lttng_event_exclusions_create_from_payload(&exclusions_view,
-                               event_comm->exclusion_count, &local_exclusions);
+               ret = lttng_event_exclusions_create_from_payload(
+                       &exclusions_view, event_comm->exclusion_count, &local_exclusions);
                if (ret < 0) {
                        ret = -1;
                        goto end;
@@ -462,9 +441,8 @@ deserialize_filter_expression:
 
        {
                const char *filter_expression_buffer;
-               struct lttng_buffer_view filter_expression_view =
-                               lttng_buffer_view_from_view(&view->buffer, offset,
-                                               event_comm->filter_expression_len);
+               struct lttng_buffer_view filter_expression_view = lttng_buffer_view_from_view(
+                       &view->buffer, offset, event_comm->filter_expression_len);
 
                if (!lttng_buffer_view_is_valid(&filter_expression_view)) {
                        ret = -1;
@@ -474,15 +452,14 @@ deserialize_filter_expression:
                filter_expression_buffer = filter_expression_view.data;
 
                if (!lttng_buffer_view_contains_string(&filter_expression_view,
-                                   filter_expression_buffer,
-                                   event_comm->filter_expression_len)) {
+                                                      filter_expression_buffer,
+                                                      event_comm->filter_expression_len)) {
                        ret = -1;
                        goto end;
                }
 
-               local_filter_expression = lttng_strndup(
-                               filter_expression_buffer,
-                               event_comm->filter_expression_len);
+               local_filter_expression =
+                       lttng_strndup(filter_expression_buffer, event_comm->filter_expression_len);
                if (!local_filter_expression) {
                        ret = -1;
                        goto end;
@@ -504,8 +481,7 @@ deserialize_filter_expression:
        /* Bytecode */
        {
                struct lttng_payload_view bytecode_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               event_comm->bytecode_len);
+                       lttng_payload_view_from_view(view, offset, event_comm->bytecode_len);
 
                if (!lttng_payload_view_is_valid(&bytecode_view)) {
                        ret = -1;
@@ -518,10 +494,8 @@ deserialize_filter_expression:
                        goto end;
                }
 
-               memcpy(local_bytecode, bytecode_view.buffer.data,
-                               event_comm->bytecode_len);
-               if ((local_bytecode->len + sizeof(*local_bytecode)) !=
-                               event_comm->bytecode_len) {
+               memcpy(local_bytecode, bytecode_view.buffer.data, event_comm->bytecode_len);
+               if ((local_bytecode->len + sizeof(*local_bytecode)) != event_comm->bytecode_len) {
                        ret = -1;
                        goto end;
                }
@@ -536,9 +510,8 @@ deserialize_event_type_payload:
                /* Fallthrough */
        case LTTNG_EVENT_PROBE:
        {
-               struct lttng_payload_view probe_attr_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               event_comm->lttng_event_probe_attr_len);
+               struct lttng_payload_view probe_attr_view = lttng_payload_view_from_view(
+                       view, offset, event_comm->lttng_event_probe_attr_len);
 
                if (event_comm->lttng_event_probe_attr_len == 0) {
                        ret = -1;
@@ -550,25 +523,23 @@ deserialize_event_type_payload:
                        goto end;
                }
 
-               ret = lttng_event_probe_attr_create_from_payload(
-                               &probe_attr_view, &local_probe_attr);
+               ret = lttng_event_probe_attr_create_from_payload(&probe_attr_view,
+                                                                &local_probe_attr);
                if (ret < 0 || ret != event_comm->lttng_event_probe_attr_len) {
                        ret = -1;
                        goto end;
                }
 
                /* Copy to the local event. */
-               memcpy(&local_event->attr.probe, local_probe_attr,
-                               sizeof(local_event->attr.probe));
+               memcpy(&local_event->attr.probe, local_probe_attr, sizeof(local_event->attr.probe));
 
                offset += ret;
                break;
        }
        case LTTNG_EVENT_FUNCTION_ENTRY:
        {
-               struct lttng_payload_view function_attr_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               event_comm->lttng_event_function_attr_len);
+               struct lttng_payload_view function_attr_view = lttng_payload_view_from_view(
+                       view, offset, event_comm->lttng_event_function_attr_len);
 
                if (event_comm->lttng_event_function_attr_len == 0) {
                        ret = -1;
@@ -580,16 +551,17 @@ deserialize_event_type_payload:
                        goto end;
                }
 
-               ret = lttng_event_function_attr_create_from_payload(
-                               &function_attr_view, &local_function_attr);
+               ret = lttng_event_function_attr_create_from_payload(&function_attr_view,
+                                                                   &local_function_attr);
                if (ret < 0 || ret != event_comm->lttng_event_function_attr_len) {
                        ret = -1;
                        goto end;
                }
 
                /* Copy to the local event. */
-               memcpy(&local_event->attr.ftrace, local_function_attr,
-                               sizeof(local_event->attr.ftrace));
+               memcpy(&local_event->attr.ftrace,
+                      local_function_attr,
+                      sizeof(local_event->attr.ftrace));
 
                offset += ret;
 
@@ -598,23 +570,21 @@ deserialize_event_type_payload:
        case LTTNG_EVENT_USERSPACE_PROBE:
        {
                struct lttng_payload_view userspace_probe_location_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               event_comm->userspace_probe_location_len);
+                       lttng_payload_view_from_view(
+                               view, offset, event_comm->userspace_probe_location_len);
 
                if (event_comm->userspace_probe_location_len == 0) {
                        ret = -1;
                        goto end;
                }
 
-               if (!lttng_payload_view_is_valid(
-                                   &userspace_probe_location_view)) {
+               if (!lttng_payload_view_is_valid(&userspace_probe_location_view)) {
                        ret = -1;
                        goto end;
                }
 
                ret = lttng_userspace_probe_location_create_from_payload(
-                               &userspace_probe_location_view,
-                               &local_userspace_probe_location);
+                       &userspace_probe_location_view, &local_userspace_probe_location);
                if (ret < 0) {
                        WARN("Failed to create a userspace probe location from the received buffer");
                        ret = -1;
@@ -622,14 +592,17 @@ deserialize_event_type_payload:
                }
 
                if (ret != event_comm->userspace_probe_location_len) {
-                       WARN("Userspace probe location from the received buffer is not the advertised length: header length = %" PRIu32 ", payload length = %zd", event_comm->userspace_probe_location_len, ret);
+                       WARN("Userspace probe location from the received buffer is not the advertised length: header length = %" PRIu32
+                            ", payload length = %zd",
+                            event_comm->userspace_probe_location_len,
+                            ret);
                        ret = -1;
                        goto end;
                }
 
                /* Attach the probe location to the event. */
-               ret = lttng_event_set_userspace_probe_location(
-                               local_event, local_userspace_probe_location);
+               ret = lttng_event_set_userspace_probe_location(local_event,
+                                                              local_userspace_probe_location);
                if (ret) {
                        ret = LTTNG_ERR_PROBE_LOCATION_INVAL;
                        goto end;
@@ -690,12 +663,12 @@ end:
 }
 
 int lttng_event_serialize(const struct lttng_event *event,
-               unsigned int exclusion_count,
-               char **exclusion_list,
-               char *filter_expression,
-               size_t bytecode_len,
-               struct lttng_bytecode *bytecode,
-               struct lttng_payload *payload)
+                         unsigned int exclusion_count,
+                         char **exclusion_list,
+                         char *filter_expression,
+                         size_t bytecode_len,
+                         struct lttng_bytecode *bytecode,
+                         struct lttng_payload *payload)
 {
        int ret;
        unsigned int i;
@@ -744,28 +717,25 @@ int lttng_event_serialize(const struct lttng_event *event,
        event_comm.flags = (int32_t) event->flags;
 
        if (filter_expression) {
-               event_comm.filter_expression_len =
-                               strlen(filter_expression) + 1;
+               event_comm.filter_expression_len = strlen(filter_expression) + 1;
        }
 
        /* Header */
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &event_comm, sizeof(event_comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &event_comm, sizeof(event_comm));
        if (ret) {
                goto end;
        }
 
        /* Event name */
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, event->name, name_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, event->name, name_len);
        if (ret) {
                goto end;
        }
 
        /* Exclusions */
        for (i = 0; i < exclusion_count; i++) {
-               const size_t exclusion_len = lttng_strnlen(
-                               *(exclusion_list + i), LTTNG_SYMBOL_NAME_LEN);
+               const size_t exclusion_len =
+                       lttng_strnlen(*(exclusion_list + i), LTTNG_SYMBOL_NAME_LEN);
                struct lttng_event_exclusion_comm exclusion_header;
 
                exclusion_header.len = (uint32_t) exclusion_len + 1;
@@ -776,14 +746,14 @@ int lttng_event_serialize(const struct lttng_event *event,
                        goto end;
                }
 
-               ret = lttng_dynamic_buffer_append(&payload->buffer,
-                               &exclusion_header, sizeof(exclusion_header));
+               ret = lttng_dynamic_buffer_append(
+                       &payload->buffer, &exclusion_header, sizeof(exclusion_header));
                if (ret) {
                        goto end;
                }
 
-               ret = lttng_dynamic_buffer_append(&payload->buffer,
-                               *(exclusion_list + i), exclusion_len + 1);
+               ret = lttng_dynamic_buffer_append(
+                       &payload->buffer, *(exclusion_list + i), exclusion_len + 1);
                if (ret) {
                        goto end;
                }
@@ -791,9 +761,8 @@ int lttng_event_serialize(const struct lttng_event *event,
 
        /* Filter expression and its bytecode */
        if (filter_expression) {
-               ret = lttng_dynamic_buffer_append(&payload->buffer,
-                               filter_expression,
-                               event_comm.filter_expression_len);
+               ret = lttng_dynamic_buffer_append(
+                       &payload->buffer, filter_expression, event_comm.filter_expression_len);
                if (ret) {
                        goto end;
                }
@@ -803,8 +772,7 @@ int lttng_event_serialize(const struct lttng_event *event,
                 * for listing.
                 */
                if (bytecode) {
-                       ret = lttng_dynamic_buffer_append(&payload->buffer,
-                                       bytecode, bytecode_len);
+                       ret = lttng_dynamic_buffer_append(&payload->buffer, bytecode, bytecode_len);
                        if (ret) {
                                goto end;
                        }
@@ -824,32 +792,28 @@ int lttng_event_serialize(const struct lttng_event *event,
                        goto end;
                }
 
-               header = (struct lttng_event_comm *) ((char *) payload->buffer.data +
-                                                     header_offset);
-               header->lttng_event_probe_attr_len =
-                               payload->buffer.size - size_before_payload;
+               header =
+                       (struct lttng_event_comm *) ((char *) payload->buffer.data + header_offset);
+               header->lttng_event_probe_attr_len = payload->buffer.size - size_before_payload;
 
                break;
        case LTTNG_EVENT_FUNCTION_ENTRY:
-               ret = lttng_event_function_attr_serialize(
-                               &event->attr.ftrace, payload);
+               ret = lttng_event_function_attr_serialize(&event->attr.ftrace, payload);
                if (ret) {
                        ret = -1;
                        goto end;
                }
 
                /* Update the lttng_event_function_attr len. */
-               header = (struct lttng_event_comm *) ((char *) payload->buffer.data +
-                                                     header_offset);
-               header->lttng_event_function_attr_len =
-                               payload->buffer.size - size_before_payload;
+               header =
+                       (struct lttng_event_comm *) ((char *) payload->buffer.data + header_offset);
+               header->lttng_event_function_attr_len = payload->buffer.size - size_before_payload;
 
                break;
        case LTTNG_EVENT_USERSPACE_PROBE:
        {
                const struct lttng_event_extended *ev_ext =
-                               (const struct lttng_event_extended *)
-                                               event->extended.ptr;
+                       (const struct lttng_event_extended *) event->extended.ptr;
 
                assert(event->extended.ptr);
                assert(ev_ext->probe_location);
@@ -860,8 +824,8 @@ int lttng_event_serialize(const struct lttng_event *event,
                         * lttng_userspace_probe_location_serialize returns the
                         * number of bytes that were appended to the buffer.
                         */
-                       ret = lttng_userspace_probe_location_serialize(
-                                       ev_ext->probe_location, payload);
+                       ret = lttng_userspace_probe_location_serialize(ev_ext->probe_location,
+                                                                      payload);
                        if (ret < 0) {
                                goto end;
                        }
@@ -872,7 +836,7 @@ int lttng_event_serialize(const struct lttng_event *event,
                        header = (struct lttng_event_comm *) ((char *) payload->buffer.data +
                                                              header_offset);
                        header->userspace_probe_location_len =
-                                       payload->buffer.size - size_before_payload;
+                               payload->buffer.size - size_before_payload;
                }
                break;
        }
@@ -889,16 +853,15 @@ end:
        return ret;
 }
 
-static ssize_t lttng_event_context_app_populate_from_payload(
-               const struct lttng_payload_view *view,
-               struct lttng_event_context *event_ctx)
+static ssize_t lttng_event_context_app_populate_from_payload(const struct lttng_payload_view *view,
+                                                            struct lttng_event_context *event_ctx)
 {
        ssize_t ret, offset = 0;
        const struct lttng_event_context_app_comm *comm;
        char *provider_name = NULL, *context_name = NULL;
        size_t provider_name_len, context_name_len;
-       const struct lttng_buffer_view comm_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, sizeof(*comm));
+       const struct lttng_buffer_view comm_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*comm));
 
        assert(event_ctx->ctx == LTTNG_EVENT_CONTEXT_APP_CONTEXT);
 
@@ -925,9 +888,7 @@ static ssize_t lttng_event_context_app_populate_from_payload(
        {
                const char *name;
                const struct lttng_buffer_view provider_name_view =
-                               lttng_buffer_view_from_view(&view->buffer,
-                                               offset,
-                                               provider_name_len);
+                       lttng_buffer_view_from_view(&view->buffer, offset, provider_name_len);
 
                if (!lttng_buffer_view_is_valid(&provider_name_view)) {
                        ret = -1;
@@ -936,8 +897,8 @@ static ssize_t lttng_event_context_app_populate_from_payload(
 
                name = provider_name_view.data;
 
-               if (!lttng_buffer_view_contains_string(&provider_name_view,
-                               name, provider_name_len)) {
+               if (!lttng_buffer_view_contains_string(
+                           &provider_name_view, name, provider_name_len)) {
                        ret = -1;
                        goto end;
                }
@@ -954,9 +915,7 @@ static ssize_t lttng_event_context_app_populate_from_payload(
        {
                const char *name;
                const struct lttng_buffer_view context_name_view =
-                               lttng_buffer_view_from_view(
-                                               &view->buffer, offset,
-                                               context_name_len);
+                       lttng_buffer_view_from_view(&view->buffer, offset, context_name_len);
 
                if (!lttng_buffer_view_is_valid(&context_name_view)) {
                        ret = -1;
@@ -965,8 +924,7 @@ static ssize_t lttng_event_context_app_populate_from_payload(
 
                name = context_name_view.data;
 
-               if (!lttng_buffer_view_contains_string(&context_name_view, name,
-                                   context_name_len)) {
+               if (!lttng_buffer_view_contains_string(&context_name_view, name, context_name_len)) {
                        ret = -1;
                        goto end;
                }
@@ -994,21 +952,20 @@ end:
        return ret;
 }
 
-static ssize_t lttng_event_context_perf_counter_populate_from_payload(
-               const struct lttng_payload_view *view,
-               struct lttng_event_context *event_ctx)
+static ssize_t
+lttng_event_context_perf_counter_populate_from_payload(const struct lttng_payload_view *view,
+                                                      struct lttng_event_context *event_ctx)
 {
        int ret;
        ssize_t consumed, offset = 0;
        const struct lttng_event_context_perf_counter_comm *comm;
        size_t name_len;
-       const struct lttng_buffer_view comm_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, sizeof(*comm));
+       const struct lttng_buffer_view comm_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*comm));
 
        assert(event_ctx->ctx == LTTNG_EVENT_CONTEXT_PERF_COUNTER ||
-                       event_ctx->ctx ==
-                                       LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER ||
-                       event_ctx->ctx == LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER);
+              event_ctx->ctx == LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER ||
+              event_ctx->ctx == LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER);
 
        if (!lttng_buffer_view_is_valid(&comm_view)) {
                consumed = -1;
@@ -1023,9 +980,7 @@ static ssize_t lttng_event_context_perf_counter_populate_from_payload(
        {
                const char *name;
                const struct lttng_buffer_view provider_name_view =
-                               lttng_buffer_view_from_view(
-                                               &view->buffer, offset,
-                                               name_len);
+                       lttng_buffer_view_from_view(&view->buffer, offset, name_len);
 
                if (!lttng_buffer_view_is_valid(&provider_name_view)) {
                        consumed = -1;
@@ -1034,14 +989,14 @@ static ssize_t lttng_event_context_perf_counter_populate_from_payload(
 
                name = provider_name_view.data;
 
-               if (!lttng_buffer_view_contains_string(
-                                   &provider_name_view, name, name_len)) {
+               if (!lttng_buffer_view_contains_string(&provider_name_view, name, name_len)) {
                        consumed = -1;
                        goto end;
                }
 
-               ret = lttng_strncpy(event_ctx->u.perf_counter.name, name,
-                               sizeof(event_ctx->u.perf_counter.name));
+               ret = lttng_strncpy(event_ctx->u.perf_counter.name,
+                                   name,
+                                   sizeof(event_ctx->u.perf_counter.name));
                if (ret) {
                        consumed = -1;
                        goto end;
@@ -1058,15 +1013,14 @@ end:
        return consumed;
 }
 
-ssize_t lttng_event_context_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_context **event_ctx)
+ssize_t lttng_event_context_create_from_payload(struct lttng_payload_view *view,
+                                               struct lttng_event_context **event_ctx)
 {
        ssize_t ret, offset = 0;
        const struct lttng_event_context_comm *comm;
        struct lttng_event_context *local_context = NULL;
-       struct lttng_buffer_view comm_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, sizeof(*comm));
+       struct lttng_buffer_view comm_view =
+               lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*comm));
 
        assert(event_ctx);
        assert(view);
@@ -1089,18 +1043,18 @@ ssize_t lttng_event_context_create_from_payload(
 
        {
                struct lttng_payload_view subtype_view =
-                               lttng_payload_view_from_view(view, offset, -1);
+                       lttng_payload_view_from_view(view, offset, -1);
 
                switch (local_context->ctx) {
                case LTTNG_EVENT_CONTEXT_APP_CONTEXT:
-                       ret = lttng_event_context_app_populate_from_payload(
-                                       &subtype_view, local_context);
+                       ret = lttng_event_context_app_populate_from_payload(&subtype_view,
+                                                                           local_context);
                        break;
                case LTTNG_EVENT_CONTEXT_PERF_COUNTER:
                case LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER:
                case LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER:
-                       ret = lttng_event_context_perf_counter_populate_from_payload(
-                                       &subtype_view, local_context);
+                       ret = lttng_event_context_perf_counter_populate_from_payload(&subtype_view,
+                                                                                    local_context);
                        break;
                default:
                        /* Nothing else to deserialize. */
@@ -1124,9 +1078,8 @@ end:
        return ret;
 }
 
-static int lttng_event_context_app_serialize(
-               struct lttng_event_context *context,
-               struct lttng_payload *payload)
+static int lttng_event_context_app_serialize(struct lttng_event_context *context,
+                                            struct lttng_payload *payload)
 {
        int ret;
        struct lttng_event_context_app_comm comm = {};
@@ -1167,22 +1120,19 @@ static int lttng_event_context_app_serialize(
        comm.ctx_name_len = ctx_len;
 
        /* Header */
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm,
-                       sizeof(comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
        if (ret) {
                ret = -1;
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, provider_name,
-                       provider_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, provider_name, provider_len);
        if (ret) {
                ret = -1;
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, ctx_name,
-                       ctx_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, ctx_name, ctx_len);
        if (ret) {
                ret = -1;
                goto end;
@@ -1192,9 +1142,8 @@ end:
        return ret;
 }
 
-static int lttng_event_context_perf_counter_serialize(
-               struct lttng_event_perf_counter_ctx *context,
-               struct lttng_payload *payload)
+static int lttng_event_context_perf_counter_serialize(struct lttng_event_perf_counter_ctx *context,
+                                                     struct lttng_payload *payload)
 {
        int ret;
        struct lttng_event_context_perf_counter_comm comm = {};
@@ -1215,15 +1164,13 @@ static int lttng_event_context_perf_counter_serialize(
        comm.name_len += 1;
 
        /* Header */
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm,
-                       sizeof(comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
        if (ret) {
                ret = -1;
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer, context->name,
-                       comm.name_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, context->name, comm.name_len);
        if (ret) {
                ret = -1;
                goto end;
@@ -1234,7 +1181,7 @@ end:
 }
 
 int lttng_event_context_serialize(struct lttng_event_context *context,
-               struct lttng_payload *payload)
+                                 struct lttng_payload *payload)
 {
        int ret;
        struct lttng_event_context_comm context_comm;
@@ -1247,8 +1194,7 @@ int lttng_event_context_serialize(struct lttng_event_context *context,
        context_comm.type = (uint32_t) context->ctx;
 
        /* Header */
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &context_comm, sizeof(context_comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &context_comm, sizeof(context_comm));
        if (ret) {
                goto end;
        }
@@ -1260,8 +1206,7 @@ int lttng_event_context_serialize(struct lttng_event_context *context,
        case LTTNG_EVENT_CONTEXT_PERF_COUNTER:
        case LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER:
        case LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER:
-               ret = lttng_event_context_perf_counter_serialize(
-                               &context->u.perf_counter, payload);
+               ret = lttng_event_context_perf_counter_serialize(&context->u.perf_counter, payload);
                break;
        default:
                /* Nothing else to serialize. */
@@ -1295,8 +1240,8 @@ void lttng_event_context_destroy(struct lttng_event_context *context)
  * the extension field of the lttng_event struct and simply copies what it can
  * to the internal struct lttng_event of a lttng_event_field.
  */
-static void lttng_event_field_populate_lttng_event_from_event(
-               const struct lttng_event *src, struct lttng_event *destination)
+static void lttng_event_field_populate_lttng_event_from_event(const struct lttng_event *src,
+                                                             struct lttng_event *destination)
 {
        memcpy(destination, src, sizeof(*destination));
 
@@ -1304,24 +1249,21 @@ static void lttng_event_field_populate_lttng_event_from_event(
        destination->extended.ptr = NULL;
 }
 
-ssize_t lttng_event_field_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_field **field)
+ssize_t lttng_event_field_create_from_payload(struct lttng_payload_view *view,
+                                             struct lttng_event_field **field)
 {
        ssize_t ret, offset = 0;
        struct lttng_event_field *local_event_field = NULL;
        struct lttng_event *event = NULL;
        const struct lttng_event_field_comm *comm;
-       const charname = NULL;
+       const char *name = NULL;
 
        assert(field);
        assert(view);
 
        {
                const struct lttng_buffer_view comm_view =
-                               lttng_buffer_view_from_view(
-                                               &view->buffer, offset,
-                                               sizeof(*comm));
+                       lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*comm));
 
                if (!lttng_buffer_view_is_valid(&comm_view)) {
                        ret = -1;
@@ -1345,9 +1287,7 @@ ssize_t lttng_event_field_create_from_payload(
        /* Field name */
        {
                const struct lttng_buffer_view name_view =
-                               lttng_buffer_view_from_view(
-                                               &view->buffer, offset,
-                                               comm->name_len);
+                       lttng_buffer_view_from_view(&view->buffer, offset, comm->name_len);
 
                if (!lttng_buffer_view_is_valid(&name_view)) {
                        ret = -1;
@@ -1356,8 +1296,7 @@ ssize_t lttng_event_field_create_from_payload(
 
                name = name_view.data;
 
-               if (!lttng_buffer_view_contains_string(&name_view,
-                               name_view.data, comm->name_len)) {
+               if (!lttng_buffer_view_contains_string(&name_view, name_view.data, comm->name_len)) {
                        ret = -1;
                        goto end;
                }
@@ -1374,17 +1313,14 @@ ssize_t lttng_event_field_create_from_payload(
        /* Event */
        {
                struct lttng_payload_view event_view =
-                               lttng_payload_view_from_view(
-                                               view, offset,
-                                               comm->event_len);
+                       lttng_payload_view_from_view(view, offset, comm->event_len);
 
                if (!lttng_payload_view_is_valid(&event_view)) {
                        ret = -1;
                        goto end;
                }
 
-               ret = lttng_event_create_from_payload(&event_view, &event, NULL,
-                               NULL, NULL);
+               ret = lttng_event_create_from_payload(&event_view, &event, NULL, NULL, NULL);
                if (ret != comm->event_len) {
                        ret = -1;
                        goto end;
@@ -1396,14 +1332,13 @@ ssize_t lttng_event_field_create_from_payload(
        assert(name);
        assert(event);
 
-       if (lttng_strncpy(local_event_field->field_name, name,
-                       sizeof(local_event_field->field_name))) {
+       if (lttng_strncpy(
+                   local_event_field->field_name, name, sizeof(local_event_field->field_name))) {
                ret = -1;
                goto end;
        }
 
-       lttng_event_field_populate_lttng_event_from_event(
-                       event, &local_event_field->event);
+       lttng_event_field_populate_lttng_event_from_event(event, &local_event_field->event);
 
        *field = local_event_field;
        local_event_field = NULL;
@@ -1415,7 +1350,7 @@ end:
 }
 
 int lttng_event_field_serialize(const struct lttng_event_field *field,
-               struct lttng_payload *payload)
+                               struct lttng_payload *payload)
 {
        int ret;
        size_t header_offset, size_before_event;
@@ -1440,44 +1375,39 @@ int lttng_event_field_serialize(const struct lttng_event_field *field,
        name_len += 1;
 
        event_field_comm.type = field->type;
-       event_field_comm.nowrite = (uint8_t)field->nowrite;
+       event_field_comm.nowrite = (uint8_t) field->nowrite;
        event_field_comm.name_len = name_len;
 
        /* Header */
        ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &event_field_comm,
-                       sizeof(event_field_comm));
+               &payload->buffer, &event_field_comm, sizeof(event_field_comm));
        if (ret) {
                goto end;
        }
 
        /* Field name */
-       ret = lttng_dynamic_buffer_append(&payload->buffer, field->field_name,
-                       name_len);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, field->field_name, name_len);
        if (ret) {
                goto end;
        }
 
        size_before_event = payload->buffer.size;
-       ret = lttng_event_serialize(
-                       &field->event, 0, NULL, NULL, 0, 0, payload);
+       ret = lttng_event_serialize(&field->event, 0, NULL, NULL, 0, 0, payload);
        if (ret) {
                ret = -1;
                goto end;
        }
 
        /* Update the event len. */
-       header = (struct lttng_event_field_comm *)
-                       ((char *) payload->buffer.data +
-                               header_offset);
+       header = (struct lttng_event_field_comm *) ((char *) payload->buffer.data + header_offset);
        header->event_len = payload->buffer.size - size_before_event;
 
 end:
        return ret;
 }
 
-static enum lttng_error_code compute_flattened_size(
-               struct lttng_dynamic_pointer_array *events, size_t *size)
+static enum lttng_error_code compute_flattened_size(struct lttng_dynamic_pointer_array *events,
+                                                   size_t *size)
 {
        enum lttng_error_code ret_code;
        int ret = 0;
@@ -1496,16 +1426,14 @@ static enum lttng_error_code compute_flattened_size(
 
        for (i = 0; i < event_count; i++) {
                int probe_storage_req = 0;
-               const struct event_list_element *element = (const struct event_list_element *)
-                               lttng_dynamic_pointer_array_get_pointer(
-                                               events, i);
+               const struct event_list_element *element =
+                       (const struct event_list_element *) lttng_dynamic_pointer_array_get_pointer(
+                               events, i);
                const struct lttng_userspace_probe_location *location = NULL;
 
-               location = lttng_event_get_userspace_probe_location(
-                               element->event);
+               location = lttng_event_get_userspace_probe_location(element->event);
                if (location) {
-                       ret = lttng_userspace_probe_location_flatten(
-                                       location, NULL);
+                       ret = lttng_userspace_probe_location_flatten(location, NULL);
                        if (ret < 0) {
                                ret_code = LTTNG_ERR_PROBE_LOCATION_INVAL;
                                goto end;
@@ -1519,8 +1447,7 @@ static enum lttng_error_code compute_flattened_size(
                }
 
                if (element->exclusions) {
-                       storage_req += element->exclusions->count *
-                               LTTNG_SYMBOL_NAME_LEN;
+                       storage_req += element->exclusions->count * LTTNG_SYMBOL_NAME_LEN;
                }
 
                /* Padding to ensure the flat probe is aligned. */
@@ -1557,9 +1484,8 @@ end:
  *     - padding to align to 64-bits
  *     - flattened version of userspace_probe_location
  */
-static enum lttng_error_code flatten_lttng_events(
-               struct lttng_dynamic_pointer_array *events,
-               struct lttng_event **flattened_events)
+static enum lttng_error_code flatten_lttng_events(struct lttng_dynamic_pointer_array *events,
+                                                 struct lttng_event **flattened_events)
 {
        enum lttng_error_code ret_code;
        int ret, i;
@@ -1582,8 +1508,7 @@ static enum lttng_error_code flatten_lttng_events(
         * We must ensure that "local_flattened_events" is never resized so as
         * to preserve the validity of the flattened objects.
         */
-       ret = lttng_dynamic_buffer_set_capacity(
-                       &local_flattened_events, storage_req);
+       ret = lttng_dynamic_buffer_set_capacity(&local_flattened_events, storage_req);
        if (ret) {
                ret_code = LTTNG_ERR_NOMEM;
                goto end;
@@ -1591,17 +1516,17 @@ static enum lttng_error_code flatten_lttng_events(
 
        /* Start by laying the struct lttng_event */
        for (i = 0; i < nb_events; i++) {
-               const struct event_list_element *element = (const struct event_list_element *)
-                               lttng_dynamic_pointer_array_get_pointer(
-                                               events, i);
+               const struct event_list_element *element =
+                       (const struct event_list_element *) lttng_dynamic_pointer_array_get_pointer(
+                               events, i);
 
                if (!element) {
                        ret_code = LTTNG_ERR_FATAL;
                        goto end;
                }
 
-               ret = lttng_dynamic_buffer_append(&local_flattened_events,
-                               element->event, sizeof(struct lttng_event));
+               ret = lttng_dynamic_buffer_append(
+                       &local_flattened_events, element->event, sizeof(struct lttng_event));
                if (ret) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto end;
@@ -1609,21 +1534,23 @@ static enum lttng_error_code flatten_lttng_events(
        }
 
        for (i = 0; i < nb_events; i++) {
-               const struct event_list_element *element = (const struct event_list_element *)
-                               lttng_dynamic_pointer_array_get_pointer(events, i);
-               struct lttng_event *event = (struct lttng_event *)
-                       (local_flattened_events.data + (sizeof(struct lttng_event) * i));
+               const struct event_list_element *element =
+                       (const struct event_list_element *) lttng_dynamic_pointer_array_get_pointer(
+                               events, i);
+               struct lttng_event *event =
+                       (struct lttng_event *) (local_flattened_events.data +
+                                               (sizeof(struct lttng_event) * i));
                struct lttng_event_extended *event_extended =
-                       (struct lttng_event_extended *)
-                               (local_flattened_events.data + local_flattened_events.size);
+                       (struct lttng_event_extended *) (local_flattened_events.data +
+                                                        local_flattened_events.size);
                const struct lttng_userspace_probe_location *location = NULL;
 
                assert(element);
 
                /* Insert struct lttng_event_extended. */
                ret = lttng_dynamic_buffer_set_size(&local_flattened_events,
-                               local_flattened_events.size +
-                                               sizeof(*event_extended));
+                                                   local_flattened_events.size +
+                                                           sizeof(*event_extended));
                if (ret) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto end;
@@ -1635,11 +1562,9 @@ static enum lttng_error_code flatten_lttng_events(
                        const size_t len = strlen(element->filter_expression) + 1;
 
                        event_extended->filter_expression =
-                                       local_flattened_events.data +
-                                       local_flattened_events.size;
+                               local_flattened_events.data + local_flattened_events.size;
                        ret = lttng_dynamic_buffer_append(
-                                       &local_flattened_events,
-                                       element->filter_expression, len);
+                               &local_flattened_events, element->filter_expression, len);
                        if (ret) {
                                ret_code = LTTNG_ERR_NOMEM;
                                goto end;
@@ -1648,17 +1573,14 @@ static enum lttng_error_code flatten_lttng_events(
 
                /* Insert exclusions. */
                if (element->exclusions) {
-                       event_extended->exclusions.count =
-                                       element->exclusions->count;
+                       event_extended->exclusions.count = element->exclusions->count;
                        event_extended->exclusions.strings =
-                                       local_flattened_events.data +
-                                       local_flattened_events.size;
+                               local_flattened_events.data + local_flattened_events.size;
 
-                       ret = lttng_dynamic_buffer_append(
-                                       &local_flattened_events,
-                                       element->exclusions->names,
-                                       element->exclusions->count *
-                                                       LTTNG_SYMBOL_NAME_LEN);
+                       ret = lttng_dynamic_buffer_append(&local_flattened_events,
+                                                         element->exclusions->names,
+                                                         element->exclusions->count *
+                                                                 LTTNG_SYMBOL_NAME_LEN);
                        if (ret) {
                                ret_code = LTTNG_ERR_NOMEM;
                                goto end;
@@ -1667,20 +1589,20 @@ static enum lttng_error_code flatten_lttng_events(
 
                /* Insert padding to align to 64-bits. */
                ret = lttng_dynamic_buffer_set_size(&local_flattened_events,
-                               lttng_align_ceil(local_flattened_events.size,
-                                               sizeof(uint64_t)));
+                                                   lttng_align_ceil(local_flattened_events.size,
+                                                                    sizeof(uint64_t)));
                if (ret) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto end;
                }
 
-               location = lttng_event_get_userspace_probe_location(
-                               element->event);
+               location = lttng_event_get_userspace_probe_location(element->event);
                if (location) {
-                       event_extended->probe_location = (struct lttng_userspace_probe_location *)
-                                       (local_flattened_events.data + local_flattened_events.size);
-                       ret = lttng_userspace_probe_location_flatten(
-                                       location, &local_flattened_events);
+                       event_extended->probe_location = (struct lttng_userspace_probe_location
+                                                                 *) (local_flattened_events.data +
+                                                                     local_flattened_events.size);
+                       ret = lttng_userspace_probe_location_flatten(location,
+                                                                    &local_flattened_events);
                        if (ret < 0) {
                                ret_code = LTTNG_ERR_PROBE_LOCATION_INVAL;
                                goto end;
@@ -1697,10 +1619,10 @@ end:
        return ret_code;
 }
 
-static enum lttng_error_code event_list_create_from_payload(
-               struct lttng_payload_view *view,
-               unsigned int count,
-               struct lttng_dynamic_pointer_array *event_list)
+static enum lttng_error_code
+event_list_create_from_payload(struct lttng_payload_view *view,
+                              unsigned int count,
+                              struct lttng_dynamic_pointer_array *event_list)
 {
        enum lttng_error_code ret_code;
        int ret;
@@ -1713,7 +1635,7 @@ static enum lttng_error_code event_list_create_from_payload(
        for (i = 0; i < count; i++) {
                ssize_t event_size;
                struct lttng_payload_view event_view =
-                               lttng_payload_view_from_view(view, offset, -1);
+                       lttng_payload_view_from_view(view, offset, -1);
                struct event_list_element *element = zmalloc<event_list_element>();
 
                if (!element) {
@@ -1725,8 +1647,7 @@ static enum lttng_error_code event_list_create_from_payload(
                 * Lifetime and management of the object is now bound to the
                 * array.
                 */
-               ret = lttng_dynamic_pointer_array_add_pointer(
-                               event_list, element);
+               ret = lttng_dynamic_pointer_array_add_pointer(event_list, element);
                if (ret) {
                        event_list_destructor(element);
                        ret_code = LTTNG_ERR_NOMEM;
@@ -1738,9 +1659,10 @@ static enum lttng_error_code event_list_create_from_payload(
                 * care about it.
                 */
                event_size = lttng_event_create_from_payload(&event_view,
-                               &element->event,
-                               &element->exclusions,
-                               &element->filter_expression, NULL);
+                                                            &element->event,
+                                                            &element->exclusions,
+                                                            &element->filter_expression,
+                                                            NULL);
                if (event_size < 0) {
                        ret_code = LTTNG_ERR_INVALID;
                        goto end;
@@ -1761,9 +1683,7 @@ end:
 }
 
 enum lttng_error_code lttng_events_create_and_flatten_from_payload(
-               struct lttng_payload_view *payload,
-               unsigned int count,
-               struct lttng_event **events)
+       struct lttng_payload_view *payload, unsigned int count, struct lttng_event **events)
 {
        enum lttng_error_code ret = LTTNG_OK;
        struct lttng_dynamic_pointer_array local_events;
@@ -1773,10 +1693,9 @@ enum lttng_error_code lttng_events_create_and_flatten_from_payload(
        /* Deserialize the events. */
        {
                struct lttng_payload_view events_view =
-                               lttng_payload_view_from_view(payload, 0, -1);
+                       lttng_payload_view_from_view(payload, 0, -1);
 
-               ret = event_list_create_from_payload(
-                               &events_view, count, &local_events);
+               ret = event_list_create_from_payload(&events_view, count, &local_events);
                if (ret != LTTNG_OK) {
                        goto end;
                }
@@ -1792,9 +1711,9 @@ end:
        return ret;
 }
 
-static enum lttng_error_code flatten_lttng_event_fields(
-               struct lttng_dynamic_pointer_array *event_fields,
-               struct lttng_event_field **flattened_event_fields)
+static enum lttng_error_code
+flatten_lttng_event_fields(struct lttng_dynamic_pointer_array *event_fields,
+                          struct lttng_event_field **flattened_event_fields)
 {
        int ret, i;
        enum lttng_error_code ret_code;
@@ -1823,8 +1742,7 @@ static enum lttng_error_code flatten_lttng_event_fields(
         * We must ensure that "local_flattened_event_fields" is never resized
         * so as to preserve the validity of the flattened objects.
         */
-       ret = lttng_dynamic_buffer_set_capacity(
-                       &local_flattened_event_fields, storage_req);
+       ret = lttng_dynamic_buffer_set_capacity(&local_flattened_event_fields, storage_req);
        if (ret) {
                ret_code = LTTNG_ERR_NOMEM;
                goto end;
@@ -1832,16 +1750,15 @@ static enum lttng_error_code flatten_lttng_event_fields(
 
        for (i = 0; i < nb_event_field; i++) {
                const struct lttng_event_field *element =
-                               (const struct lttng_event_field *)
-                                       lttng_dynamic_pointer_array_get_pointer(
-                                               event_fields, i);
+                       (const struct lttng_event_field *) lttng_dynamic_pointer_array_get_pointer(
+                               event_fields, i);
 
                if (!element) {
                        ret_code = LTTNG_ERR_FATAL;
                        goto end;
                }
-               ret = lttng_dynamic_buffer_append(&local_flattened_event_fields,
-                               element, sizeof(struct lttng_event_field));
+               ret = lttng_dynamic_buffer_append(
+                       &local_flattened_event_fields, element, sizeof(struct lttng_event_field));
                if (ret) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto end;
@@ -1857,10 +1774,10 @@ end:
        return ret_code;
 }
 
-static enum lttng_error_code event_field_list_create_from_payload(
-               struct lttng_payload_view *view,
-               unsigned int count,
-               struct lttng_dynamic_pointer_array **event_field_list)
+static enum lttng_error_code
+event_field_list_create_from_payload(struct lttng_payload_view *view,
+                                    unsigned int count,
+                                    struct lttng_dynamic_pointer_array **event_field_list)
 {
        enum lttng_error_code ret_code;
        int ret, offset = 0;
@@ -1882,10 +1799,9 @@ static enum lttng_error_code event_field_list_create_from_payload(
                ssize_t event_field_size;
                struct lttng_event_field *field = NULL;
                struct lttng_payload_view event_field_view =
-                               lttng_payload_view_from_view(view, offset, -1);
+                       lttng_payload_view_from_view(view, offset, -1);
 
-               event_field_size = lttng_event_field_create_from_payload(
-                               &event_field_view, &field);
+               event_field_size = lttng_event_field_create_from_payload(&event_field_view, &field);
                if (event_field_size < 0) {
                        ret_code = LTTNG_ERR_INVALID;
                        goto end;
@@ -1921,15 +1837,12 @@ end:
 }
 
 enum lttng_error_code lttng_event_fields_create_and_flatten_from_payload(
-               struct lttng_payload_view *view,
-               unsigned int count,
-               struct lttng_event_field **fields)
+       struct lttng_payload_view *view, unsigned int count, struct lttng_event_field **fields)
 {
        enum lttng_error_code ret_code;
        struct lttng_dynamic_pointer_array *local_event_fields = NULL;
 
-       ret_code = event_field_list_create_from_payload(
-                       view, count, &local_event_fields);
+       ret_code = event_field_list_create_from_payload(view, count, &local_event_fields);
        if (ret_code != LTTNG_OK) {
                goto end;
        }
index 5645d7d91702efe3a0df4779d363fe616acbb78a..05c30fc6d37d198025d4c8d15433ad269bf96d16 100644 (file)
@@ -6,12 +6,14 @@
  */
 
 #include "exception.hpp"
-#include <sstream>
+
 #include <common/error.hpp>
 
+#include <sstream>
+
 namespace {
-std::string format_throw_location(
-               const char *file_name, const char *function_name, unsigned int line_number)
+std::string
+format_throw_location(const char *file_name, const char *function_name, unsigned int line_number)
 {
        std::stringstream location;
 
@@ -23,61 +25,62 @@ std::string format_throw_location(
 } /* namespace */
 
 lttng::ctl::error::error(lttng_error_code error_code,
-               const char *file_name,
-               const char *function_name,
-               unsigned int line_number) :
-       runtime_error(std::string(error_get_str(error_code)), file_name, function_name, line_number),
-       _error_code{error_code}
+                        const char *file_name,
+                        const char *function_name,
+                        unsigned int line_number) :
+       runtime_error(
+               std::string(error_get_str(error_code)), file_name, function_name, line_number),
+       _error_code{ error_code }
 {
 }
 
 lttng::posix_error::posix_error(const std::string& msg,
-               int errno_code,
-               const char *file_name,
-               const char *function_name,
-               unsigned int line_number) :
+                               int errno_code,
+                               const char *file_name,
+                               const char *function_name,
+                               unsigned int line_number) :
        std::system_error(errno_code,
-                       std::generic_category(),
-                       msg + " " + format_throw_location(file_name, function_name, line_number))
+                         std::generic_category(),
+                         msg + " " + format_throw_location(file_name, function_name, line_number))
 {
 }
 
 lttng::runtime_error::runtime_error(const std::string& msg,
-               const char *file_name,
-               const char *function_name,
-               unsigned int line_number) :
+                                   const char *file_name,
+                                   const char *function_name,
+                                   unsigned int line_number) :
        std::runtime_error(msg + " " + format_throw_location(file_name, function_name, line_number))
 {
 }
 
 lttng::unsupported_error::unsupported_error(const std::string& msg,
-               const char *file_name,
-               const char *function_name,
-               unsigned int line_number) :
+                                           const char *file_name,
+                                           const char *function_name,
+                                           unsigned int line_number) :
        std::runtime_error(msg + " " + format_throw_location(file_name, function_name, line_number))
 {
 }
 
 lttng::communication_error::communication_error(const std::string& msg,
-               const char *file_name,
-               const char *function_name,
-               unsigned int line_number) :
+                                               const char *file_name,
+                                               const char *function_name,
+                                               unsigned int line_number) :
        runtime_error(msg, file_name, function_name, line_number)
 {
 }
 
 lttng::protocol_error::protocol_error(const std::string& msg,
-               const char *file_name,
-               const char *function_name,
-               unsigned int line_number) :
+                                     const char *file_name,
+                                     const char *function_name,
+                                     unsigned int line_number) :
        communication_error(msg, file_name, function_name, line_number)
 {
 }
 
 lttng::invalid_argument_error::invalid_argument_error(const std::string& msg,
-               const char *file_name,
-               const char *function_name,
-               unsigned int line_number) :
+                                                     const char *file_name,
+                                                     const char *function_name,
+                                                     unsigned int line_number) :
        runtime_error(msg, file_name, function_name, line_number)
 {
 }
index 8a0d95243bcdfebf4035da2981ff13cbaed454d9..6bc1e9b5246e4ab3d6a7bfa0ef342e9c94edf065 100644 (file)
@@ -5,12 +5,13 @@
  *
  */
 
-#include <unistd.h>
-#include <urcu/ref.h>
-
 #include "fd-handle.hpp"
+
 #include <common/error.hpp>
 
+#include <unistd.h>
+#include <urcu/ref.h>
+
 struct fd_handle {
        struct urcu_ref ref;
        int fd;
@@ -25,7 +26,7 @@ static void fd_handle_release(struct urcu_ref *ref)
        ret = close(handle->fd);
        if (ret == -1) {
                PERROR("Failed to close file descriptor of fd_handle upon release: fd = %d",
-                               handle->fd);
+                      handle->fd);
        }
 
        free(handle);
@@ -37,7 +38,7 @@ struct fd_handle *fd_handle_create(int fd)
 
        if (fd < 0) {
                ERR("Attempted to create an fd_handle from an invalid file descriptor: fd = %d",
-                               fd);
+                   fd);
                goto end;
        }
 
@@ -84,7 +85,8 @@ struct fd_handle *fd_handle_copy(const struct fd_handle *handle)
        const int new_fd = dup(handle->fd);
 
        if (new_fd < 0) {
-               PERROR("Failed to duplicate file descriptor while copying fd_handle: fd = %d", handle->fd);
+               PERROR("Failed to duplicate file descriptor while copying fd_handle: fd = %d",
+                      handle->fd);
                goto end;
        }
 
index 0c24eab5ea016e74b51e818af1bbcbb02c5b24ff..a6239277d9df0aa8ec6a44c5c52d54567e1d5310 100644 (file)
@@ -5,16 +5,8 @@
  *
  */
 
-#include <urcu.h>
-#include <urcu/list.h>
-#include <urcu/rculfhash.h>
-
-#include <fcntl.h>
-#include <inttypes.h>
-#include <pthread.h>
-#include <stdbool.h>
-#include <sys/stat.h>
-#include <sys/types.h>
+#include "fd-tracker.hpp"
+#include "inode.hpp"
 
 #include <common/defaults.hpp>
 #include <common/error.hpp>
 #include <common/macros.hpp>
 #include <common/optional.hpp>
 
-#include "fd-tracker.hpp"
-#include "inode.hpp"
+#include <fcntl.h>
+#include <inttypes.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <urcu.h>
+#include <urcu/list.h>
+#include <urcu/rculfhash.h>
 
 /* Tracker lock must be taken by the user. */
-#define TRACKED_COUNT(tracker)                                 \
-       (tracker->count.suspendable.active +                   \
-                       tracker->count.suspendable.suspended + \
-                       tracker->count.unsuspendable)
+#define TRACKED_COUNT(tracker)                                                      \
+       (tracker->count.suspendable.active + tracker->count.suspendable.suspended + \
+        tracker->count.unsuspendable)
 
 /* Tracker lock must be taken by the user. */
-#define ACTIVE_COUNT(tracker) \
-       (tracker->count.suspendable.active + tracker->count.unsuspendable)
+#define ACTIVE_COUNT(tracker) (tracker->count.suspendable.active + tracker->count.unsuspendable)
 
 /* Tracker lock must be taken by the user. */
 #define SUSPENDED_COUNT(tracker) (tracker->count.suspendable.suspended)
 
 /* Tracker lock must be taken by the user. */
-#define SUSPENDABLE_COUNT(tracker)           \
-       (tracker->count.suspendable.active + \
-                       tracker->count.suspendable.suspended)
+#define SUSPENDABLE_COUNT(tracker) \
+       (tracker->count.suspendable.active + tracker->count.suspendable.suspended)
 
 /* Tracker lock must be taken by the user. */
 #define UNSUSPENDABLE_COUNT(tracker) (tracker->count.unsuspendable)
@@ -138,10 +134,10 @@ struct {
 
 static int match_fd(struct cds_lfht_node *node, const void *key);
 static void unsuspendable_fd_destroy(struct unsuspendable_fd *entry);
-static struct unsuspendable_fd *unsuspendable_fd_create(
-               const char *name, int fd);
+static struct unsuspendable_fd *unsuspendable_fd_create(const char *name, int fd);
 static int open_from_properties(const struct lttng_directory_handle *dir_handle,
-               const char *path, struct open_properties *properties);
+                               const char *path,
+                               struct open_properties *properties);
 
 static void fs_handle_tracked_log(struct fs_handle_tracked *handle);
 static int fs_handle_tracked_suspend(struct fs_handle_tracked *handle);
@@ -151,29 +147,23 @@ static void fs_handle_tracked_put_fd(struct fs_handle *_handle);
 static int fs_handle_tracked_unlink(struct fs_handle *_handle);
 static int fs_handle_tracked_close(struct fs_handle *_handle);
 
-static void fd_tracker_track(
-               struct fd_tracker *tracker, struct fs_handle_tracked *handle);
-static void fd_tracker_untrack(
-               struct fd_tracker *tracker, struct fs_handle_tracked *handle);
-static int fd_tracker_suspend_handles(
-               struct fd_tracker *tracker, unsigned int count);
-static int fd_tracker_restore_handle(
-               struct fd_tracker *tracker, struct fs_handle_tracked *handle);
+static void fd_tracker_track(struct fd_tracker *tracker, struct fs_handle_tracked *handle);
+static void fd_tracker_untrack(struct fd_tracker *tracker, struct fs_handle_tracked *handle);
+static int fd_tracker_suspend_handles(struct fd_tracker *tracker, unsigned int count);
+static int fd_tracker_restore_handle(struct fd_tracker *tracker, struct fs_handle_tracked *handle);
 
 /* Match function of the tracker's unsuspendable_fds hash table. */
 static int match_fd(struct cds_lfht_node *node, const void *key)
 {
-       struct unsuspendable_fd *entry = lttng::utils::container_of(
-                       node, &unsuspendable_fd::tracker_node);
+       struct unsuspendable_fd *entry =
+               lttng::utils::container_of(node, &unsuspendable_fd::tracker_node);
 
-       return hash_match_key_ulong(
-                       (void *) (unsigned long) entry->fd, (void *) key);
+       return hash_match_key_ulong((void *) (unsigned long) entry->fd, (void *) key);
 }
 
 static void delete_unsuspendable_fd(struct rcu_head *head)
 {
-       struct unsuspendable_fd *fd = caa_container_of(
-                       head, struct unsuspendable_fd, rcu_head);
+       struct unsuspendable_fd *fd = caa_container_of(head, struct unsuspendable_fd, rcu_head);
 
        free(fd->name);
        free(fd);
@@ -187,8 +177,7 @@ static void unsuspendable_fd_destroy(struct unsuspendable_fd *entry)
        call_rcu(&entry->rcu_head, delete_unsuspendable_fd);
 }
 
-static struct unsuspendable_fd *unsuspendable_fd_create(
-               const char *name, int fd)
+static struct unsuspendable_fd *unsuspendable_fd_create(const char *name, int fd)
 {
        struct unsuspendable_fd *entry = zmalloc<unsuspendable_fd>();
 
@@ -217,8 +206,10 @@ static void fs_handle_tracked_log(struct fs_handle_tracked *handle)
        lttng_inode_borrow_location(handle->inode, NULL, &path);
 
        if (handle->fd >= 0) {
-               DBG_NO_LOC("    %s [active, fd %d%s]", path, handle->fd,
-                               handle->in_use ? ", in use" : "");
+               DBG_NO_LOC("    %s [active, fd %d%s]",
+                          path,
+                          handle->fd,
+                          handle->in_use ? ", in use" : "");
        } else {
                DBG_NO_LOC("    %s [suspended]", path);
        }
@@ -234,8 +225,7 @@ static int fs_handle_tracked_suspend(struct fs_handle_tracked *handle)
        const struct lttng_directory_handle *node_directory_handle;
 
        pthread_mutex_lock(&handle->lock);
-       lttng_inode_borrow_location(
-                       handle->inode, &node_directory_handle, &path);
+       lttng_inode_borrow_location(handle->inode, &node_directory_handle, &path);
        LTTNG_ASSERT(handle->fd >= 0);
        if (handle->in_use) {
                /* This handle can't be suspended as it is currently in use. */
@@ -243,19 +233,16 @@ static int fs_handle_tracked_suspend(struct fs_handle_tracked *handle)
                goto end;
        }
 
-       ret = lttng_directory_handle_stat(
-                       node_directory_handle, path, &fs_stat);
+       ret = lttng_directory_handle_stat(node_directory_handle, path, &fs_stat);
        if (ret) {
-               PERROR("Filesystem handle to %s cannot be suspended as stat() failed",
-                               path);
+               PERROR("Filesystem handle to %s cannot be suspended as stat() failed", path);
                ret = -errno;
                goto end;
        }
 
        if (fs_stat.st_ino != handle->ino) {
                /* Don't suspend as the handle would not be restorable. */
-               WARN("Filesystem handle to %s cannot be suspended as its inode changed",
-                               path);
+               WARN("Filesystem handle to %s cannot be suspended as its inode changed", path);
                ret = -ENOENT;
                goto end;
        }
@@ -263,20 +250,21 @@ static int fs_handle_tracked_suspend(struct fs_handle_tracked *handle)
        handle->offset = lseek(handle->fd, 0, SEEK_CUR);
        if (handle->offset == -1) {
                WARN("Filesystem handle to %s cannot be suspended as lseek() failed to sample its current position",
-                               path);
+                    path);
                ret = -errno;
                goto end;
        }
 
        ret = close(handle->fd);
        if (ret) {
-               PERROR("Filesystem handle to %s cannot be suspended as close() failed",
-                               path);
+               PERROR("Filesystem handle to %s cannot be suspended as close() failed", path);
                ret = -errno;
                goto end;
        }
        DBG("Suspended filesystem handle to %s (fd %i) at position %" PRId64,
-                       path, handle->fd, handle->offset);
+           path,
+           handle->fd,
+           handle->offset);
        handle->fd = -1;
 end:
        if (ret) {
@@ -293,16 +281,13 @@ static int fs_handle_tracked_restore(struct fs_handle_tracked *handle)
        const char *path;
        const struct lttng_directory_handle *node_directory_handle;
 
-       lttng_inode_borrow_location(
-                       handle->inode, &node_directory_handle, &path);
+       lttng_inode_borrow_location(handle->inode, &node_directory_handle, &path);
 
        LTTNG_ASSERT(handle->fd == -1);
        LTTNG_ASSERT(path);
-       ret = open_from_properties(
-                       node_directory_handle, path, &handle->properties);
+       ret = open_from_properties(node_directory_handle, path, &handle->properties);
        if (ret < 0) {
-               PERROR("Failed to restore filesystem handle to %s, open() failed",
-                               path);
+               PERROR("Failed to restore filesystem handle to %s, open() failed", path);
                ret = -errno;
                goto end;
        }
@@ -310,13 +295,14 @@ static int fs_handle_tracked_restore(struct fs_handle_tracked *handle)
 
        ret = lseek(fd, handle->offset, SEEK_SET);
        if (ret < 0) {
-               PERROR("Failed to restore filesystem handle to %s, lseek() failed",
-                               path);
+               PERROR("Failed to restore filesystem handle to %s, lseek() failed", path);
                ret = -errno;
                goto end;
        }
        DBG("Restored filesystem handle to %s (fd %i) at position %" PRId64,
-                       path, fd, handle->offset);
+           path,
+           fd,
+           handle->offset);
        ret = 0;
        handle->fd = fd;
        fd = -1;
@@ -328,7 +314,8 @@ end:
 }
 
 static int open_from_properties(const struct lttng_directory_handle *dir_handle,
-               const char *path, struct open_properties *properties)
+                               const char *path,
+                               struct open_properties *properties)
 {
        int ret;
 
@@ -339,11 +326,10 @@ static int open_from_properties(const struct lttng_directory_handle *dir_handle,
         * thus it is ignored here.
         */
        if ((properties->flags & O_CREAT) && properties->mode.is_set) {
-               ret = lttng_directory_handle_open_file(dir_handle, path,
-                               properties->flags, properties->mode.value);
+               ret = lttng_directory_handle_open_file(
+                       dir_handle, path, properties->flags, properties->mode.value);
        } else {
-               ret = lttng_directory_handle_open_file(dir_handle, path,
-                               properties->flags, 0);
+               ret = lttng_directory_handle_open_file(dir_handle, path, properties->flags, 0);
        }
        /*
         * Some flags should not be used beyond the initial open() of a
@@ -364,8 +350,7 @@ end:
        return ret;
 }
 
-struct fd_tracker *fd_tracker_create(const char *unlinked_file_path,
-               unsigned int capacity)
+struct fd_tracker *fd_tracker_create(const char *unlinked_file_path, unsigned int capacity)
 {
        struct fd_tracker *tracker = zmalloc<fd_tracker>();
 
@@ -383,8 +368,8 @@ struct fd_tracker *fd_tracker_create(const char *unlinked_file_path,
        CDS_INIT_LIST_HEAD(&tracker->active_handles);
        CDS_INIT_LIST_HEAD(&tracker->suspended_handles);
        tracker->capacity = capacity;
-       tracker->unsuspendable_fds = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0,
-                       CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       tracker->unsuspendable_fds = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!tracker->unsuspendable_fds) {
                ERR("Failed to create fd-tracker's unsuspendable_fds hash table");
                goto error;
@@ -395,13 +380,12 @@ struct fd_tracker *fd_tracker_create(const char *unlinked_file_path,
                goto error;
        }
 
-       tracker->unlinked_file_pool =
-                       lttng_unlinked_file_pool_create(unlinked_file_path);
+       tracker->unlinked_file_pool = lttng_unlinked_file_pool_create(unlinked_file_path);
        if (!tracker->unlinked_file_pool) {
                goto error;
        }
        DBG("File descriptor tracker created with a limit of %u simultaneously-opened FDs",
-                       capacity);
+           capacity);
 end:
        return tracker;
 error:
@@ -429,12 +413,10 @@ void fd_tracker_log(struct fd_tracker *tracker)
        DBG_NO_LOC("    capacity:        %u", tracker->capacity);
 
        DBG_NO_LOC("  Tracked suspendable file descriptors");
-       cds_list_for_each_entry(
-                       handle, &tracker->active_handles, handles_list_node) {
+       cds_list_for_each_entry (handle, &tracker->active_handles, handles_list_node) {
                fs_handle_tracked_log(handle);
        }
-       cds_list_for_each_entry(handle, &tracker->suspended_handles,
-                       handles_list_node) {
+       cds_list_for_each_entry (handle, &tracker->suspended_handles, handles_list_node) {
                fs_handle_tracked_log(handle);
        }
        if (!SUSPENDABLE_COUNT(tracker)) {
@@ -443,11 +425,11 @@ void fd_tracker_log(struct fd_tracker *tracker)
 
        DBG_NO_LOC("  Tracked unsuspendable file descriptors");
        rcu_read_lock();
-       cds_lfht_for_each_entry(tracker->unsuspendable_fds, &iter,
-                       unsuspendable_fd, tracker_node) {
+       cds_lfht_for_each_entry (
+               tracker->unsuspendable_fds, &iter, unsuspendable_fd, tracker_node) {
                DBG_NO_LOC("    %s [active, fd %d]",
-                               unsuspendable_fd->name ?: "Unnamed",
-                               unsuspendable_fd->fd);
+                          unsuspendable_fd->name ?: "Unnamed",
+                          unsuspendable_fd->fd);
        }
        rcu_read_unlock();
        if (!UNSUSPENDABLE_COUNT(tracker)) {
@@ -471,7 +453,7 @@ int fd_tracker_destroy(struct fd_tracker *tracker)
        pthread_mutex_lock(&tracker->lock);
        if (TRACKED_COUNT(tracker)) {
                ERR("A file descriptor leak has been detected: %u tracked file descriptors are still being tracked",
-                               TRACKED_COUNT(tracker));
+                   TRACKED_COUNT(tracker));
                pthread_mutex_unlock(&tracker->lock);
                fd_tracker_log(tracker);
                ret = -1;
@@ -493,21 +475,20 @@ end:
 }
 
 struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker,
-               struct lttng_directory_handle *directory,
-               const char *path,
-               int flags,
-               mode_t *mode)
+                                           struct lttng_directory_handle *directory,
+                                           const char *path,
+                                           int flags,
+                                           mode_t *mode)
 {
        int ret;
        struct fs_handle_tracked *handle = NULL;
        struct stat fd_stat;
-       struct open_properties properties = {
-               .flags = flags,
-               .mode = {
-                       .is_set = !!mode,
-                       .value = static_cast<mode_t>(mode ? *mode : 0),
-               }
-       };
+       struct open_properties properties = { .flags = flags,
+                                             .mode = {
+                                                     .is_set = !!mode,
+                                                     .value =
+                                                             static_cast<mode_t>(mode ? *mode : 0),
+                                             } };
 
        pthread_mutex_lock(&tracker->lock);
        if (ACTIVE_COUNT(tracker) == tracker->capacity) {
@@ -523,7 +504,7 @@ struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker,
                         * the tracker's capacity.
                         */
                        WARN("Cannot open file system handle, too many unsuspendable file descriptors are opened (%u)",
-                                       tracker->count.unsuspendable);
+                            tracker->count.unsuspendable);
                        goto end;
                }
        }
@@ -532,7 +513,7 @@ struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker,
        if (!handle) {
                goto end;
        }
-       handle->parent = (typeof(handle->parent)) {
+       handle->parent = (typeof(handle->parent)){
                .get_fd = fs_handle_tracked_get_fd,
                .put_fd = fs_handle_tracked_put_fd,
                .unlink = fs_handle_tracked_unlink,
@@ -555,9 +536,8 @@ struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker,
 
        handle->properties = properties;
 
-       handle->inode = lttng_inode_registry_get_inode(tracker->inode_registry,
-                       directory, path, handle->fd,
-                       tracker->unlinked_file_pool);
+       handle->inode = lttng_inode_registry_get_inode(
+               tracker->inode_registry, directory, path, handle->fd, tracker->unlinked_file_pool);
        if (!handle->inode) {
                ERR("Failed to get lttng_inode corresponding to file %s", path);
                goto error;
@@ -585,15 +565,13 @@ error_mutex_init:
 }
 
 /* Caller must hold the tracker's lock. */
-static int fd_tracker_suspend_handles(
-               struct fd_tracker *tracker, unsigned int count)
+static int fd_tracker_suspend_handles(struct fd_tracker *tracker, unsigned int count)
 {
        unsigned int left_to_close = count;
        unsigned int attempts_left = tracker->count.suspendable.active;
        struct fs_handle_tracked *handle, *tmp;
 
-       cds_list_for_each_entry_safe(handle, tmp, &tracker->active_handles,
-                       handles_list_node) {
+       cds_list_for_each_entry_safe (handle, tmp, &tracker->active_handles, handles_list_node) {
                int ret;
 
                fd_tracker_untrack(tracker, handle);
@@ -612,11 +590,11 @@ static int fd_tracker_suspend_handles(
 }
 
 int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
-               int *out_fds,
-               const char **names,
-               unsigned int fd_count,
-               fd_open_cb open,
-               void *user_data)
+                                    int *out_fds,
+                                    const char **names,
+                                    unsigned int fd_count,
+                                    fd_open_cb open,
+                                    void *user_data)
 {
        int ret, user_ret, i, fds_to_suspend;
        unsigned int active_fds;
@@ -631,12 +609,10 @@ int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
        pthread_mutex_lock(&tracker->lock);
 
        active_fds = ACTIVE_COUNT(tracker);
-       fds_to_suspend = (int) active_fds + (int) fd_count -
-                       (int) tracker->capacity;
+       fds_to_suspend = (int) active_fds + (int) fd_count - (int) tracker->capacity;
        if (fds_to_suspend > 0) {
                if (fds_to_suspend <= tracker->count.suspendable.active) {
-                       ret = fd_tracker_suspend_handles(
-                                       tracker, fds_to_suspend);
+                       ret = fd_tracker_suspend_handles(tracker, fds_to_suspend);
                        if (ret) {
                                goto end_unlock;
                        }
@@ -647,7 +623,7 @@ int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
                         * tracker's capacity.
                         */
                        WARN("Cannot open unsuspendable fd, too many unsuspendable file descriptors are opened (%u)",
-                                       tracker->count.unsuspendable);
+                            tracker->count.unsuspendable);
                        ret = -EMFILE;
                        goto end_unlock;
                }
@@ -664,8 +640,8 @@ int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
         * of unsuspendable fds.
         */
        for (i = 0; i < fd_count; i++) {
-               struct unsuspendable_fd *entry = unsuspendable_fd_create(
-                               names ? names[i] : NULL, out_fds[i]);
+               struct unsuspendable_fd *entry =
+                       unsuspendable_fd_create(names ? names[i] : NULL, out_fds[i]);
 
                if (!entry) {
                        ret = -1;
@@ -680,11 +656,11 @@ int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
                struct unsuspendable_fd *entry = entries[i];
 
                node = cds_lfht_add_unique(tracker->unsuspendable_fds,
-                               hash_key_ulong((void *) (unsigned long)
-                                                               out_fds[i],
-                                               seed.value),
-                               match_fd, (void *) (unsigned long) out_fds[i],
-                               &entry->tracker_node);
+                                          hash_key_ulong((void *) (unsigned long) out_fds[i],
+                                                         seed.value),
+                                          match_fd,
+                                          (void *) (unsigned long) out_fds[i],
+                                          &entry->tracker_node);
 
                if (node != &entry->tracker_node) {
                        ret = -EEXIST;
@@ -709,10 +685,10 @@ end_free_entries:
 }
 
 int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker,
-               int *fds_in,
-               unsigned int fd_count,
-               fd_close_cb close,
-               void *user_data)
+                                     int *fds_in,
+                                     unsigned int fd_count,
+                                     fd_close_cb close,
+                                     void *user_data)
 {
        int i, ret, user_ret;
        int *fds = NULL;
@@ -745,20 +721,19 @@ int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker,
                struct unsuspendable_fd *entry;
 
                cds_lfht_lookup(tracker->unsuspendable_fds,
-                               hash_key_ulong((void *) (unsigned long) fds[i],
-                                               seed.value),
-                               match_fd, (void *) (unsigned long) fds[i],
+                               hash_key_ulong((void *) (unsigned long) fds[i], seed.value),
+                               match_fd,
+                               (void *) (unsigned long) fds[i],
                                &iter);
                node = cds_lfht_iter_get_node(&iter);
                if (!node) {
                        /* Unknown file descriptor. */
                        WARN("Untracked file descriptor %d passed to fd_tracker_close_unsuspendable_fd()",
-                                       fds[i]);
+                            fds[i]);
                        ret = -EINVAL;
                        goto end_unlock;
                }
-               entry = lttng::utils::container_of(
-                               node, &unsuspendable_fd::tracker_node);
+               entry = lttng::utils::container_of(node, &unsuspendable_fd::tracker_node);
 
                cds_lfht_del(tracker->unsuspendable_fds, node);
                unsuspendable_fd_destroy(entry);
@@ -776,23 +751,19 @@ end:
 }
 
 /* Caller must have taken the tracker's and handle's locks. */
-static void fd_tracker_track(
-               struct fd_tracker *tracker, struct fs_handle_tracked *handle)
+static void fd_tracker_track(struct fd_tracker *tracker, struct fs_handle_tracked *handle)
 {
        if (handle->fd >= 0) {
                tracker->count.suspendable.active++;
-               cds_list_add_tail(&handle->handles_list_node,
-                               &tracker->active_handles);
+               cds_list_add_tail(&handle->handles_list_node, &tracker->active_handles);
        } else {
                tracker->count.suspendable.suspended++;
-               cds_list_add_tail(&handle->handles_list_node,
-                               &tracker->suspended_handles);
+               cds_list_add_tail(&handle->handles_list_node, &tracker->suspended_handles);
        }
 }
 
 /* Caller must have taken the tracker's and handle's locks. */
-static void fd_tracker_untrack(
-               struct fd_tracker *tracker, struct fs_handle_tracked *handle)
+static void fd_tracker_untrack(struct fd_tracker *tracker, struct fs_handle_tracked *handle)
 {
        if (handle->fd >= 0) {
                tracker->count.suspendable.active--;
@@ -803,8 +774,7 @@ static void fd_tracker_untrack(
 }
 
 /* Caller must have taken the tracker's and handle's locks. */
-static int fd_tracker_restore_handle(
-               struct fd_tracker *tracker, struct fs_handle_tracked *handle)
+static int fd_tracker_restore_handle(struct fd_tracker *tracker, struct fs_handle_tracked *handle)
 {
        int ret;
 
@@ -825,7 +795,7 @@ static int fs_handle_tracked_get_fd(struct fs_handle *_handle)
 {
        int ret;
        struct fs_handle_tracked *handle =
-                       lttng::utils::container_of(_handle, &fs_handle_tracked::parent);
+               lttng::utils::container_of(_handle, &fs_handle_tracked::parent);
 
        /*
         * TODO This should be optimized as it is a fairly hot path.
@@ -866,7 +836,7 @@ end:
 static void fs_handle_tracked_put_fd(struct fs_handle *_handle)
 {
        struct fs_handle_tracked *handle =
-                       lttng::utils::container_of(_handle, &fs_handle_tracked::parent);
+               lttng::utils::container_of(_handle, &fs_handle_tracked::parent);
 
        pthread_mutex_lock(&handle->lock);
        handle->in_use = false;
@@ -877,7 +847,7 @@ static int fs_handle_tracked_unlink(struct fs_handle *_handle)
 {
        int ret;
        struct fs_handle_tracked *handle =
-                       lttng::utils::container_of(_handle, &fs_handle_tracked::parent);
+               lttng::utils::container_of(_handle, &fs_handle_tracked::parent);
 
        pthread_mutex_lock(&handle->tracker->lock);
        pthread_mutex_lock(&handle->lock);
@@ -892,7 +862,7 @@ static int fs_handle_tracked_close(struct fs_handle *_handle)
        int ret = 0;
        const char *path = NULL;
        struct fs_handle_tracked *handle =
-                       lttng::utils::container_of(_handle, &fs_handle_tracked::parent);
+               lttng::utils::container_of(_handle, &fs_handle_tracked::parent);
        struct lttng_directory_handle *inode_directory_handle = NULL;
 
        if (!handle) {
@@ -923,9 +893,7 @@ static int fs_handle_tracked_close(struct fs_handle *_handle)
                 * enough to not attempt to recursively acquire the tracker's
                 * lock twice.
                 */
-               inode_directory_handle =
-                               lttng_inode_get_location_directory_handle(
-                                               handle->inode);
+               inode_directory_handle = lttng_inode_get_location_directory_handle(handle->inode);
        }
        fd_tracker_untrack(handle->tracker, handle);
        if (handle->fd >= 0) {
@@ -935,7 +903,8 @@ static int fs_handle_tracked_close(struct fs_handle *_handle)
                 */
                if (close(handle->fd)) {
                        PERROR("Failed to close the file descriptor (%d) of fs handle to %s, close() returned",
-                                       handle->fd, path ? path : "Unknown");
+                              handle->fd,
+                              path ? path : "Unknown");
                }
                handle->fd = -1;
        }
index c00f9d81ff1686e8ec16b30cc32095a53884f12c..b21a82d8731e6d56c7015aba95a87102a45d0e42 100644 (file)
@@ -5,6 +5,8 @@
  *
  */
 
+#include "inode.hpp"
+
 #include <common/defaults.hpp>
 #include <common/error.hpp>
 #include <common/hashtable/utils.hpp>
 #include <common/optional.hpp>
 #include <common/string-utils/format.hpp>
 #include <common/utils.hpp>
-#include <inttypes.h>
+
 #include <lttng/constant.h>
+
+#include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -21,8 +25,6 @@
 #include <urcu/rculfhash.h>
 #include <urcu/ref.h>
 
-#include "inode.hpp"
-
 namespace {
 struct inode_id {
        dev_t device;
@@ -68,9 +70,9 @@ struct {
        bool initialized;
        unsigned long value;
 } seed = {
-               .lock = PTHREAD_MUTEX_INITIALIZER,
-               .initialized = false,
-               .value = 0,
+       .lock = PTHREAD_MUTEX_INITIALIZER,
+       .initialized = false,
+       .value = 0,
 };
 } /* namespace */
 
@@ -78,38 +80,34 @@ static unsigned long lttng_inode_id_hash(const struct inode_id *id)
 {
        uint64_t device = id->device, inode_no = id->inode;
 
-       return hash_key_u64(&device, seed.value) ^
-              hash_key_u64(&inode_no, seed.value);
+       return hash_key_u64(&device, seed.value) ^ hash_key_u64(&inode_no, seed.value);
 }
 
 static int lttng_inode_match(struct cds_lfht_node *node, const void *key)
 {
        const struct inode_id *id = (inode_id *) key;
-       const struct lttng_inode *inode = lttng::utils::container_of(
-                       node, &lttng_inode::registry_node);
+       const struct lttng_inode *inode =
+               lttng::utils::container_of(node, &lttng_inode::registry_node);
 
        return inode->id.device == id->device && inode->id.inode == id->inode;
 }
 
 static void lttng_inode_free(struct rcu_head *head)
 {
-       struct lttng_inode *inode =
-                       lttng::utils::container_of(head, &lttng_inode::rcu_head);
+       struct lttng_inode *inode = lttng::utils::container_of(head, &lttng_inode::rcu_head);
 
        free(inode);
 }
 
-static int lttng_unlinked_file_pool_add_inode(
-               struct lttng_unlinked_file_pool *pool,
-               struct lttng_inode *inode)
+static int lttng_unlinked_file_pool_add_inode(struct lttng_unlinked_file_pool *pool,
+                                             struct lttng_inode *inode)
 {
        int ret;
        const unsigned int unlinked_id = pool->next_id++;
        char *inode_unlinked_name;
        bool reference_acquired;
 
-       DBG("Adding inode of %s to unlinked file pool as id %u",
-                       inode->location.path, unlinked_id);
+       DBG("Adding inode of %s to unlinked file pool as id %u", inode->location.path, unlinked_id);
        ret = asprintf(&inode_unlinked_name, "%u", unlinked_id);
        if (ret < 0) {
                ERR("Failed to format unlinked inode name");
@@ -118,11 +116,9 @@ static int lttng_unlinked_file_pool_add_inode(
        }
 
        if (pool->file_count == 0) {
-               DBG("Creating unlinked files directory at %s",
-                               pool->unlink_directory_path);
+               DBG("Creating unlinked files directory at %s", pool->unlink_directory_path);
                LTTNG_ASSERT(!pool->unlink_directory_handle);
-               ret = utils_mkdir(pool->unlink_directory_path,
-                               S_IRWXU | S_IRWXG, -1, -1);
+               ret = utils_mkdir(pool->unlink_directory_path, S_IRWXU | S_IRWXG, -1, -1);
                if (ret) {
                        if (errno == EEXIST) {
                                /*
@@ -130,34 +126,34 @@ static int lttng_unlinked_file_pool_add_inode(
                                 * error.
                                 */
                                DBG("Unlinked file directory \"%s\" already exists",
-                                               pool->unlink_directory_path);
+                                   pool->unlink_directory_path);
                        } else {
                                PERROR("Failed to create unlinked files directory at %s",
-                                               pool->unlink_directory_path);
+                                      pool->unlink_directory_path);
                                goto end;
                        }
                }
-               pool->unlink_directory_handle = lttng_directory_handle_create(
-                               pool->unlink_directory_path);
+               pool->unlink_directory_handle =
+                       lttng_directory_handle_create(pool->unlink_directory_path);
                if (!pool->unlink_directory_handle) {
                        ERR("Failed to create directory handle to unlinked file pool at %s",
-                                       pool->unlink_directory_path);
+                           pool->unlink_directory_path);
                        ret = -1;
                        goto end;
                }
        }
 
        ret = lttng_directory_handle_rename(inode->location.directory_handle,
-                       inode->location.path, pool->unlink_directory_handle,
-                       inode_unlinked_name);
+                                           inode->location.path,
+                                           pool->unlink_directory_handle,
+                                           inode_unlinked_name);
        if (ret) {
                goto end;
        }
 
        lttng_directory_handle_put(inode->location.directory_handle);
        inode->location.directory_handle = NULL;
-       reference_acquired = lttng_directory_handle_get(
-                       pool->unlink_directory_handle);
+       reference_acquired = lttng_directory_handle_get(pool->unlink_directory_handle);
        LTTNG_ASSERT(reference_acquired);
        inode->location.directory_handle = pool->unlink_directory_handle;
 
@@ -171,20 +167,19 @@ end:
        return ret;
 }
 
-static int lttng_unlinked_file_pool_remove_inode(
-               struct lttng_unlinked_file_pool *pool,
-               struct lttng_inode *inode)
+static int lttng_unlinked_file_pool_remove_inode(struct lttng_unlinked_file_pool *pool,
+                                                struct lttng_inode *inode)
 {
        int ret;
 
        DBG("Removing inode with unlinked id %u from unlinked file pool",
-                       LTTNG_OPTIONAL_GET(inode->unlinked_id));
+           LTTNG_OPTIONAL_GET(inode->unlinked_id));
 
-       ret = lttng_directory_handle_unlink_file(
-                       inode->location.directory_handle, inode->location.path);
+       ret = lttng_directory_handle_unlink_file(inode->location.directory_handle,
+                                                inode->location.path);
        if (ret) {
                PERROR("Failed to unlink file %s from unlinked file directory",
-                               inode->location.path);
+                      inode->location.path);
                goto end;
        }
        free(inode->location.path);
@@ -201,7 +196,7 @@ static int lttng_unlinked_file_pool_remove_inode(
                         * error except through logging.
                         */
                        PERROR("Failed to remove unlinked files directory at %s",
-                                       pool->unlink_directory_path);
+                              pool->unlink_directory_path);
                }
                lttng_directory_handle_put(pool->unlink_directory_handle);
                pool->unlink_directory_handle = NULL;
@@ -225,16 +220,14 @@ static void lttng_inode_destroy(struct lttng_inode *inode)
 
                LTTNG_ASSERT(inode->location.directory_handle);
                LTTNG_ASSERT(inode->location.path);
-               DBG("Removing %s from unlinked file pool",
-                               inode->location.path);
+               DBG("Removing %s from unlinked file pool", inode->location.path);
                ret = lttng_unlinked_file_pool_remove_inode(inode->unlinked_file_pool, inode);
                if (ret) {
                        PERROR("Failed to unlink %s", inode->location.path);
                }
        }
 
-       lttng_directory_handle_put(
-                       inode->location.directory_handle);
+       lttng_directory_handle_put(inode->location.directory_handle);
        inode->location.directory_handle = NULL;
        free(inode->location.path);
        inode->location.path = NULL;
@@ -251,8 +244,7 @@ static void lttng_inode_get(struct lttng_inode *inode)
        urcu_ref_get(&inode->ref);
 }
 
-struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create(
-               const char *path)
+struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create(const char *path)
 {
        struct lttng_unlinked_file_pool *pool = zmalloc<lttng_unlinked_file_pool>();
 
@@ -262,7 +254,7 @@ struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create(
 
        if (!path || *path != '/') {
                ERR("Unlinked file pool must be created with an absolute path, path = \"%s\"",
-                               path ? path : "NULL");
+                   path ? path : "NULL");
                goto error;
        }
 
@@ -278,8 +270,7 @@ error:
        return NULL;
 }
 
-void lttng_unlinked_file_pool_destroy(
-               struct lttng_unlinked_file_pool *pool)
+void lttng_unlinked_file_pool_destroy(struct lttng_unlinked_file_pool *pool)
 {
        if (!pool) {
                return;
@@ -296,13 +287,11 @@ void lttng_inode_put(struct lttng_inode *inode)
        urcu_ref_put(&inode->ref, lttng_inode_release);
 }
 
-struct lttng_directory_handle *
-lttng_inode_get_location_directory_handle(
-               struct lttng_inode *inode)
+struct lttng_directory_handle *lttng_inode_get_location_directory_handle(struct lttng_inode *inode)
 {
        if (inode->location.directory_handle) {
-               const bool reference_acquired = lttng_directory_handle_get(
-                               inode->location.directory_handle);
+               const bool reference_acquired =
+                       lttng_directory_handle_get(inode->location.directory_handle);
 
                LTTNG_ASSERT(reference_acquired);
        }
@@ -310,8 +299,8 @@ lttng_inode_get_location_directory_handle(
 }
 
 void lttng_inode_borrow_location(struct lttng_inode *inode,
-               const struct lttng_directory_handle **out_directory_handle,
-               const char **out_path)
+                                const struct lttng_directory_handle **out_directory_handle,
+                                const char **out_path)
 {
        if (out_directory_handle) {
                *out_directory_handle = inode->location.directory_handle;
@@ -321,24 +310,23 @@ void lttng_inode_borrow_location(struct lttng_inode *inode,
        }
 }
 
-int lttng_inode_rename(
-               struct lttng_inode *inode,
-               struct lttng_directory_handle *old_directory_handle,
-               const char *old_path,
-               struct lttng_directory_handle *new_directory_handle,
-               const char *new_path,
-               bool overwrite)
+int lttng_inode_rename(struct lttng_inode *inode,
+                      struct lttng_directory_handle *old_directory_handle,
+                      const char *old_path,
+                      struct lttng_directory_handle *new_directory_handle,
+                      const char *new_path,
+                      bool overwrite)
 {
        int ret = 0;
        char *new_path_copy = strdup(new_path);
        bool reference_acquired;
 
        DBG("Performing rename of inode from %s to %s with %s directory handles",
-                       old_path, new_path,
-                       lttng_directory_handle_equals(old_directory_handle,
-                                       new_directory_handle) ?
-                                       "identical" :
-                                       "different");
+           old_path,
+           new_path,
+           lttng_directory_handle_equals(old_directory_handle, new_directory_handle) ?
+                   "identical" :
+                   "different");
 
        if (!new_path_copy) {
                ret = -ENOMEM;
@@ -347,7 +335,8 @@ int lttng_inode_rename(
 
        if (inode->unlink_pending) {
                WARN("An attempt to rename an unlinked file from %s to %s has been performed",
-                               old_path, new_path);
+                    old_path,
+                    new_path);
                ret = -ENOENT;
                goto end;
        }
@@ -356,11 +345,9 @@ int lttng_inode_rename(
                /* Verify that file doesn't exist. */
                struct stat statbuf;
 
-               ret = lttng_directory_handle_stat(
-                               new_directory_handle, new_path, &statbuf);
+               ret = lttng_directory_handle_stat(new_directory_handle, new_path, &statbuf);
                if (ret == 0) {
-                       ERR("Refusing to rename %s as the destination already exists",
-                                       old_path);
+                       ERR("Refusing to rename %s as the destination already exists", old_path);
                        ret = -EEXIST;
                        goto end;
                } else if (ret < 0 && errno != ENOENT) {
@@ -370,8 +357,8 @@ int lttng_inode_rename(
                }
        }
 
-       ret = lttng_directory_handle_rename(old_directory_handle, old_path,
-                       new_directory_handle, new_path);
+       ret = lttng_directory_handle_rename(
+               old_directory_handle, old_path, new_directory_handle, new_path);
        if (ret) {
                PERROR("Failed to rename file %s to %s", old_path, new_path);
                ret = -errno;
@@ -399,7 +386,7 @@ int lttng_inode_unlink(struct lttng_inode *inode)
 
        if (inode->unlink_pending) {
                WARN("An attempt to re-unlink %s has been performed, ignoring.",
-                               inode->location.path);
+                    inode->location.path);
                ret = -ENOENT;
                goto end;
        }
@@ -408,11 +395,10 @@ int lttng_inode_unlink(struct lttng_inode *inode)
         * Move to the temporary "deleted" directory until all
         * references are released.
         */
-       ret = lttng_unlinked_file_pool_add_inode(
-                       inode->unlinked_file_pool, inode);
+       ret = lttng_unlinked_file_pool_add_inode(inode->unlinked_file_pool, inode);
        if (ret) {
                PERROR("Failed to add inode \"%s\" to the unlinked file pool",
-                               inode->location.path);
+                      inode->location.path);
                goto end;
        }
        inode->unlink_pending = true;
@@ -421,10 +407,10 @@ end:
 }
 
 static struct lttng_inode *lttng_inode_create(const struct inode_id *id,
-               struct cds_lfht *ht,
-               struct lttng_unlinked_file_pool *unlinked_file_pool,
-               struct lttng_directory_handle *directory_handle,
-               const char *path)
+                                             struct cds_lfht *ht,
+                                             struct lttng_unlinked_file_pool *unlinked_file_pool,
+                                             struct lttng_directory_handle *directory_handle,
+                                             const char *path)
 {
        struct lttng_inode *inode = NULL;
        char *path_copy;
@@ -472,8 +458,8 @@ struct lttng_inode_registry *lttng_inode_registry_create(void)
        }
        pthread_mutex_unlock(&seed.lock);
 
-       registry->inodes = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0,
-                       CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       registry->inodes = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!registry->inodes) {
                goto error;
        }
@@ -484,8 +470,7 @@ error:
        return NULL;
 }
 
-void lttng_inode_registry_destroy(
-               struct lttng_inode_registry *registry)
+void lttng_inode_registry_destroy(struct lttng_inode_registry *registry)
 {
        if (!registry) {
                return;
@@ -498,12 +483,12 @@ void lttng_inode_registry_destroy(
        free(registry);
 }
 
-struct lttng_inode *lttng_inode_registry_get_inode(
-               struct lttng_inode_registry *registry,
-               struct lttng_directory_handle *handle,
-               const char *path,
-               int fd,
-               struct lttng_unlinked_file_pool *unlinked_file_pool)
+struct lttng_inode *
+lttng_inode_registry_get_inode(struct lttng_inode_registry *registry,
+                              struct lttng_directory_handle *handle,
+                              const char *path,
+                              int fd,
+                              struct lttng_unlinked_file_pool *unlinked_file_pool)
 {
        int ret;
        struct stat statbuf;
@@ -522,25 +507,24 @@ struct lttng_inode *lttng_inode_registry_get_inode(
        id.inode = statbuf.st_ino;
 
        rcu_read_lock();
-       cds_lfht_lookup(registry->inodes, lttng_inode_id_hash(&id),
-                       lttng_inode_match, &id, &iter);
+       cds_lfht_lookup(registry->inodes, lttng_inode_id_hash(&id), lttng_inode_match, &id, &iter);
        node = cds_lfht_iter_get_node(&iter);
        if (node) {
-               inode = lttng::utils::container_of(
-                               node, &lttng_inode::registry_node);
+               inode = lttng::utils::container_of(node, &lttng_inode::registry_node);
                lttng_inode_get(inode);
                goto end_unlock;
        }
 
-       inode = lttng_inode_create(&id, registry->inodes, unlinked_file_pool,
-                       handle, path);
+       inode = lttng_inode_create(&id, registry->inodes, unlinked_file_pool, handle, path);
        if (!inode) {
                goto end_unlock;
        }
 
        node = cds_lfht_add_unique(registry->inodes,
-                       lttng_inode_id_hash(&inode->id), lttng_inode_match,
-                       &inode->id, &inode->registry_node);
+                                  lttng_inode_id_hash(&inode->id),
+                                  lttng_inode_match,
+                                  &inode->id,
+                                  &inode->registry_node);
        LTTNG_ASSERT(node == &inode->registry_node);
 end_unlock:
        rcu_read_unlock();
index 1c76e01679eabaa0154690e546caee73bd1abebe..20e4ae872201d9ad538c70c3afb7c9fa9ec34b07 100644 (file)
@@ -44,10 +44,10 @@ static int close_epoll(void *data, int *in_fd __attribute__((unused)))
  * must be tracked.
  */
 int fd_tracker_util_poll_create(struct fd_tracker *tracker,
-               const char *name,
-               struct lttng_poll_event *events,
-               int size,
-               int flags)
+                               const char *name,
+                               struct lttng_poll_event *events,
+                               int size,
+                               int flags)
 {
        int out_fd;
        struct create_args create_args = {
@@ -57,14 +57,12 @@ int fd_tracker_util_poll_create(struct fd_tracker *tracker,
        };
 
        return fd_tracker_open_unsuspendable_fd(
-                       tracker, &out_fd, &name, 1, open_epoll, &create_args);
+               tracker, &out_fd, &name, 1, open_epoll, &create_args);
 }
 
-int fd_tracker_util_poll_clean(
-               struct fd_tracker *tracker, struct lttng_poll_event *events)
+int fd_tracker_util_poll_clean(struct fd_tracker *tracker, struct lttng_poll_event *events)
 {
-       return fd_tracker_close_unsuspendable_fd(
-                       tracker, &events->epfd, 1, close_epoll, events);
+       return fd_tracker_close_unsuspendable_fd(tracker, &events->epfd, 1, close_epoll, events);
 }
 
 #else /* HAVE_EPOLL */
@@ -73,19 +71,17 @@ int fd_tracker_util_poll_clean(
  * The epoll variant of the poll compat layer creates an unsuspendable fd which
  * must be tracked.
  */
-int fd_tracker_util_poll_create(
-               struct fd_tracker *tracker __attribute__((unused)),
-               const char *name __attribute__((unused)),
-               struct lttng_poll_event *events,
-               int size,
-               int flags __attribute__((unused)))
+int fd_tracker_util_poll_create(struct fd_tracker *tracker __attribute__((unused)),
+                               const char *name __attribute__((unused)),
+                               struct lttng_poll_event *events,
+                               int size,
+                               int flags __attribute__((unused)))
 {
        return lttng_poll_create(events, size, flags);
 }
 
-int fd_tracker_util_poll_clean(
-               struct fd_tracker *tracker __attribute__((unused)),
-               struct lttng_poll_event *events)
+int fd_tracker_util_poll_clean(struct fd_tracker *tracker __attribute__((unused)),
+                              struct lttng_poll_event *events)
 {
        lttng_poll_clean(events);
        return 0;
index d4a7329282651b714b0937f3889b42ab9de82e40..9d28e87cd98ba0ebb2a5a65222ca2672e0cf570d 100644 (file)
@@ -8,19 +8,19 @@
 #include <common/error.hpp>
 #include <common/fd-tracker/utils.hpp>
 #include <common/utils.hpp>
+
 #include <lttng/constant.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 
-static
-int open_pipe_cloexec(void *data __attribute__((unused)), int *fds)
+static int open_pipe_cloexec(void *data __attribute__((unused)), int *fds)
 {
        return utils_create_pipe_cloexec(fds);
 }
 
-static
-int close_pipe(void *data __attribute__((unused)), int *pipe)
+static int close_pipe(void *data __attribute__((unused)), int *pipe)
 {
        utils_close_pipe(pipe);
        pipe[0] = pipe[1] = -1;
@@ -32,8 +32,7 @@ int fd_tracker_util_close_fd(void *unused __attribute__((unused)), int *fd)
        return close(*fd);
 }
 
-int fd_tracker_util_pipe_open_cloexec(
-               struct fd_tracker *tracker, const char *name, int *pipe)
+int fd_tracker_util_pipe_open_cloexec(struct fd_tracker *tracker, const char *name, int *pipe)
 {
        int ret;
        const char *name_prefix;
@@ -49,8 +48,8 @@ int fd_tracker_util_pipe_open_cloexec(
                goto end;
        }
 
-       ret = fd_tracker_open_unsuspendable_fd(tracker, pipe,
-                       (const char **) names, 2, open_pipe_cloexec, NULL);
+       ret = fd_tracker_open_unsuspendable_fd(
+               tracker, pipe, (const char **) names, 2, open_pipe_cloexec, NULL);
        free(names[0]);
        free(names[1]);
 end:
@@ -59,8 +58,7 @@ end:
 
 int fd_tracker_util_pipe_close(struct fd_tracker *tracker, int *pipe)
 {
-       return fd_tracker_close_unsuspendable_fd(
-                       tracker, pipe, 2, close_pipe, NULL);
+       return fd_tracker_close_unsuspendable_fd(tracker, pipe, 2, close_pipe, NULL);
 }
 
 namespace {
@@ -71,17 +69,15 @@ struct open_directory_handle_args {
 };
 } /* namespace */
 
-static
-int open_directory_handle(void *_args, int *out_fds)
+static int open_directory_handle(void *_args, int *out_fds)
 {
        int ret = 0;
        struct open_directory_handle_args *args = (open_directory_handle_args *) _args;
        struct lttng_directory_handle *new_handle = NULL;
 
        new_handle = args->in_handle ?
-                       lttng_directory_handle_create_from_handle(
-                               args->path, args->in_handle) :
-                       lttng_directory_handle_create(args->path);
+               lttng_directory_handle_create_from_handle(args->path, args->in_handle) :
+               lttng_directory_handle_create(args->path);
        if (!new_handle) {
                ret = -errno;
                goto end;
@@ -105,15 +101,13 @@ int open_directory_handle(void *_args, int *out_fds)
 #else
                abort();
 #endif
-
        }
 end:
        return ret;
 }
 
 #ifdef HAVE_DIRFD
-static
-int fd_close(void *unused __attribute__((unused)), int *in_fds)
+static int fd_close(void *unused __attribute__((unused)), int *in_fds)
 {
        const int ret = close(in_fds[0]);
 
@@ -121,13 +115,11 @@ int fd_close(void *unused __attribute__((unused)), int *in_fds)
        return ret;
 }
 
-static
-void directory_handle_destroy(
-               struct lttng_directory_handle *handle, void *data)
+static void directory_handle_destroy(struct lttng_directory_handle *handle, void *data)
 {
        struct fd_tracker *tracker = (fd_tracker *) data;
-       const int ret = fd_tracker_close_unsuspendable_fd(
-                       tracker, &handle->dirfd, 1, fd_close, NULL);
+       const int ret =
+               fd_tracker_close_unsuspendable_fd(tracker, &handle->dirfd, 1, fd_close, NULL);
 
        if (ret) {
                ERR("Failed to untrack directory handle file descriptor");
@@ -135,24 +127,21 @@ void directory_handle_destroy(
 }
 #endif
 
-struct lttng_directory_handle *fd_tracker_create_directory_handle(
-               struct fd_tracker *tracker, const char *path)
+struct lttng_directory_handle *fd_tracker_create_directory_handle(struct fd_tracker *tracker,
+                                                                 const char *path)
 {
-       return fd_tracker_create_directory_handle_from_handle(
-                       tracker, NULL, path);
+       return fd_tracker_create_directory_handle_from_handle(tracker, NULL, path);
 }
 
 struct lttng_directory_handle *fd_tracker_create_directory_handle_from_handle(
-               struct fd_tracker *tracker,
-               struct lttng_directory_handle *in_handle,
-               const char *path)
+       struct fd_tracker *tracker, struct lttng_directory_handle *in_handle, const char *path)
 {
        int ret;
        int dirfd = -1;
        char *handle_name = NULL;
        char cwd_path[LTTNG_PATH_MAX] = "working directory";
        struct lttng_directory_handle *new_handle = NULL;
-       open_directory_handle_args open_args {};
+       open_directory_handle_args open_args{};
 
        open_args.in_handle = in_handle;
        open_args.path = path;
@@ -164,18 +153,17 @@ struct lttng_directory_handle *fd_tracker_create_directory_handle_from_handle(
                }
        }
 
-       ret = asprintf(&handle_name, "Directory handle to %s",
-                       path ? path : cwd_path);
+       ret = asprintf(&handle_name, "Directory handle to %s", path ? path : cwd_path);
        if (ret < 0) {
                PERROR("Failed to format directory handle name");
                goto end;
        }
 
-       ret = fd_tracker_open_unsuspendable_fd(tracker, &dirfd,
-                       (const char **) &handle_name, 1, open_directory_handle,
-                       &open_args);
+       ret = fd_tracker_open_unsuspendable_fd(
+               tracker, &dirfd, (const char **) &handle_name, 1, open_directory_handle, &open_args);
        if (ret && ret != ENOTSUP) {
-               ERR("Failed to open directory handle to %s through the fd tracker", path ? path : cwd_path);
+               ERR("Failed to open directory handle to %s through the fd tracker",
+                   path ? path : cwd_path);
        }
        new_handle = open_args.ret_handle;
 
index 5b8082fd48da905e3f95280201dfa682668e444e..e45bfa0eb76dd8926a713efebfea3ada0a0d711b 100644 (file)
@@ -9,17 +9,17 @@
  *
  */
 
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-#include <common/compat/errno.hpp>
 #include <common/bytecode/bytecode.hpp>
+#include <common/compat/errno.hpp>
 #include <common/filter/filter-ast.hpp>
 #include <common/filter/filter-parser.hpp>
 
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
 /* For error.h */
 int lttng_opt_quiet = 1;
 int lttng_opt_verbose;
@@ -29,8 +29,7 @@ int main(int argc, char **argv)
 {
        struct filter_parser_ctx *ctx;
        int ret;
-       int print_xml = 0, generate_ir = 0, generate_bytecode = 0,
-               print_bytecode = 0;
+       int print_xml = 0, generate_ir = 0, generate_bytecode = 0, print_bytecode = 0;
        int argidx;
 
        for (argidx = 1; argidx < argc; argidx++) {
@@ -108,7 +107,7 @@ int main(int argc, char **argv)
                }
                printf("done\n");
                printf("Size of bytecode generated: %u bytes.\n",
-                       bytecode_get_len(&ctx->bytecode->b));
+                      bytecode_get_len(&ctx->bytecode->b));
        }
 
        if (print_bytecode) {
@@ -118,14 +117,12 @@ int main(int argc, char **argv)
                bytecode_len = ctx->bytecode->b.reloc_table_offset;
                printf("Bytecode:\n");
                for (i = 0; i < bytecode_len; i++) {
-                       printf("0x%X ",
-                               ((uint8_t *) ctx->bytecode->b.data)[i]);
+                       printf("0x%X ", ((uint8_t *) ctx->bytecode->b.data)[i]);
                }
                printf("\n");
                printf("Reloc table:\n");
                for (i = bytecode_len; i < len;) {
-                       printf("{ 0x%X, ",
-                               *(uint16_t *) &ctx->bytecode->b.data[i]);
+                       printf("{ 0x%X, ", *(uint16_t *) &ctx->bytecode->b.data[i]);
                        i += sizeof(uint16_t);
                        printf("%s } ", &((char *) ctx->bytecode->b.data)[i]);
                        i += strlen(&((char *) ctx->bytecode->b.data)[i]) + 1;
index f0b248e88155e51e54773163532a90da3e949cca..6a943a2d0640d855bfc25ab57b02b9ba98b39aa0 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include "filter.hpp"
+
 #include <stddef.h>
 
 struct bytecode_symbol_iterator {
@@ -14,8 +15,7 @@ struct bytecode_symbol_iterator {
        size_t offset, len;
 };
 
-struct bytecode_symbol_iterator *bytecode_symbol_iterator_create(
-               struct lttng_bytecode *bytecode)
+struct bytecode_symbol_iterator *bytecode_symbol_iterator_create(struct lttng_bytecode *bytecode)
 {
        struct bytecode_symbol_iterator *it = NULL;
 
@@ -64,10 +64,9 @@ int bytecode_symbol_iterator_get_type(struct bytecode_symbol_iterator *it)
        ret = *((uint16_t *) (it->bytecode + it->offset));
 end:
        return ret;
- }
+}
 
-const char *bytecode_symbol_iterator_get_name(
-               struct bytecode_symbol_iterator *it)
+const char *bytecode_symbol_iterator_get_name(struct bytecode_symbol_iterator *it)
 {
        const char *ret = NULL;
 
index 252a83870e87032b1ab101286c9bf89e783d2dcc..81822137f13ae2122359ef9b3a9a581a5049cb5e 100644 (file)
@@ -9,12 +9,6 @@
  *
  */
 
-#include <stdlib.h>
-#include <string.h>
-#include <common/align.hpp>
-#include <common/compat/errno.hpp>
-#include <common/compat/string.hpp>
-
 #include "common/align.hpp"
 #include "common/bytecode/bytecode.hpp"
 #include "common/compat/string.hpp"
 #include "filter-ast.hpp"
 #include "filter-ir.hpp"
 
-static
-int recursive_visit_gen_bytecode(struct filter_parser_ctx *ctx,
-               struct ir_op *node);
+#include <common/align.hpp>
+#include <common/compat/errno.hpp>
+#include <common/compat/string.hpp>
+
+#include <stdlib.h>
+#include <string.h>
+
+static int recursive_visit_gen_bytecode(struct filter_parser_ctx *ctx, struct ir_op *node);
 
-static
-int bytecode_patch(struct lttng_bytecode_alloc **fb,
-               const void *data,
-               uint16_t offset,
-               uint32_t len)
+static int
+bytecode_patch(struct lttng_bytecode_alloc **fb, const void *data, uint16_t offset, uint32_t len)
 {
        if (offset >= (*fb)->b.len) {
                return -EINVAL;
@@ -40,8 +36,7 @@ int bytecode_patch(struct lttng_bytecode_alloc **fb,
        return 0;
 }
 
-static
-int visit_node_root(struct filter_parser_ctx *ctx, struct ir_op *node)
+static int visit_node_root(struct filter_parser_ctx *ctx, struct ir_op *node)
 {
        int ret;
        struct return_op insn;
@@ -61,10 +56,9 @@ int visit_node_root(struct filter_parser_ctx *ctx, struct ir_op *node)
  * 0: no match
  * < 0: error
  */
-static
-int load_expression_legacy_match(const struct ir_load_expression *exp,
-               enum bytecode_op *op_type,
-               char **symbol)
+static int load_expression_legacy_match(const struct ir_load_expression *exp,
+                                       enum bytecode_op *op_type,
+                                       char **symbol)
 {
        const struct ir_load_expression_op *op;
        bool need_dot = false;
@@ -94,13 +88,13 @@ int load_expression_legacy_match(const struct ir_load_expression *exp,
        case IR_LOAD_EXPRESSION_GET_INDEX:
        case IR_LOAD_EXPRESSION_LOAD_FIELD:
        default:
-               return 0;       /* no match */
+               return 0; /* no match */
        }
 
        for (;;) {
                op = op->next;
                if (!op) {
-                       return 0;       /* no match */
+                       return 0; /* no match */
                }
                switch (op->type) {
                case IR_LOAD_EXPRESSION_LOAD_FIELD:
@@ -114,12 +108,12 @@ int load_expression_legacy_match(const struct ir_load_expression *exp,
                        }
                        break;
                default:
-                       return 0;        /* no match */
+                       return 0; /* no match */
                }
                need_dot = true;
        }
 end:
-       return 1;       /* Legacy match */
+       return 1; /* Legacy match */
 }
 
 /*
@@ -127,14 +121,12 @@ end:
  * 0: no legacy match
  * < 0: error
  */
-static
-int visit_node_load_expression_legacy(struct filter_parser_ctx *ctx,
-               const struct ir_load_expression *exp,
-               const struct ir_load_expression_op *op)
+static int visit_node_load_expression_legacy(struct filter_parser_ctx *ctx,
+                                            const struct ir_load_expression *exp,
+                                            const struct ir_load_expression_op *op)
 {
        struct load_op *insn = NULL;
-       uint32_t insn_len = sizeof(struct load_op)
-               + sizeof(struct field_ref);
+       uint32_t insn_len = sizeof(struct load_op) + sizeof(struct field_ref);
        struct field_ref ref_offset;
        uint32_t reloc_offset_u32;
        uint16_t reloc_offset;
@@ -166,26 +158,22 @@ int visit_node_load_expression_legacy(struct filter_parser_ctx *ctx,
                goto end;
        }
        /* append reloc */
-       ret = bytecode_push(&ctx->bytecode_reloc, &reloc_offset,
-                               1, sizeof(reloc_offset));
+       ret = bytecode_push(&ctx->bytecode_reloc, &reloc_offset, 1, sizeof(reloc_offset));
        if (ret) {
                goto end;
        }
-       ret = bytecode_push(&ctx->bytecode_reloc, symbol,
-                               1, strlen(symbol) + 1);
+       ret = bytecode_push(&ctx->bytecode_reloc, symbol, 1, strlen(symbol) + 1);
        if (ret) {
                goto end;
        }
-       ret = 1;        /* legacy */
+       ret = 1; /* legacy */
 end:
        free(insn);
        free(symbol);
        return ret;
 }
 
-static
-int visit_node_load_expression(struct filter_parser_ctx *ctx,
-               const struct ir_op *node)
+static int visit_node_load_expression(struct filter_parser_ctx *ctx, const struct ir_op *node)
 {
        struct ir_load_expression *exp;
        struct ir_load_expression_op *op;
@@ -209,7 +197,7 @@ int visit_node_load_expression(struct filter_parser_ctx *ctx,
                return ret;
        }
        if (ret > 0) {
-               return 0;       /* legacy */
+               return 0; /* legacy */
        }
 
        for (; op != NULL; op = op->next) {
@@ -226,8 +214,7 @@ int visit_node_load_expression(struct filter_parser_ctx *ctx,
                }
                case IR_LOAD_EXPRESSION_GET_APP_CONTEXT_ROOT:
                {
-                       ret = bytecode_push_get_app_context_root(
-                                       &ctx->bytecode);
+                       ret = bytecode_push_get_app_context_root(&ctx->bytecode);
 
                        if (ret) {
                                return ret;
@@ -247,8 +234,8 @@ int visit_node_load_expression(struct filter_parser_ctx *ctx,
                }
                case IR_LOAD_EXPRESSION_GET_SYMBOL:
                {
-                       ret = bytecode_push_get_symbol(&ctx->bytecode,
-                                       &ctx->bytecode_reloc, op->u.symbol);
+                       ret = bytecode_push_get_symbol(
+                               &ctx->bytecode, &ctx->bytecode_reloc, op->u.symbol);
 
                        if (ret) {
                                return ret;
@@ -258,8 +245,7 @@ int visit_node_load_expression(struct filter_parser_ctx *ctx,
                }
                case IR_LOAD_EXPRESSION_GET_INDEX:
                {
-                       ret = bytecode_push_get_index_u64(
-                                       &ctx->bytecode, op->u.index);
+                       ret = bytecode_push_get_index_u64(&ctx->bytecode, op->u.index);
 
                        if (ret) {
                                return ret;
@@ -288,23 +274,21 @@ int visit_node_load_expression(struct filter_parser_ctx *ctx,
        return 0;
 }
 
-static
-int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node)
+static int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node)
 {
        int ret;
 
        switch (node->data_type) {
        case IR_DATA_UNKNOWN:
        default:
-               fprintf(stderr, "[error] Unknown data type in %s\n",
-                       __func__);
+               fprintf(stderr, "[error] Unknown data type in %s\n", __func__);
                return -EINVAL;
 
        case IR_DATA_STRING:
        {
                struct load_op *insn;
-               uint32_t insn_len = sizeof(struct load_op)
-                       + strlen(node->u.load.u.string.value) + 1;
+               uint32_t insn_len =
+                       sizeof(struct load_op) + strlen(node->u.load.u.string.value) + 1;
 
                insn = (load_op *) calloc(insn_len, 1);
                if (!insn)
@@ -343,8 +327,7 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node)
        case IR_DATA_NUMERIC:
        {
                struct load_op *insn;
-               uint32_t insn_len = sizeof(struct load_op)
-                       + sizeof(struct literal_numeric);
+               uint32_t insn_len = sizeof(struct load_op) + sizeof(struct literal_numeric);
 
                insn = (load_op *) calloc(insn_len, 1);
                if (!insn)
@@ -358,8 +341,7 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node)
        case IR_DATA_FLOAT:
        {
                struct load_op *insn;
-               uint32_t insn_len = sizeof(struct load_op)
-                       + sizeof(struct literal_double);
+               uint32_t insn_len = sizeof(struct load_op) + sizeof(struct literal_double);
 
                insn = (load_op *) calloc(insn_len, 1);
                if (!insn)
@@ -375,8 +357,7 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct ir_op *node)
        }
 }
 
-static
-int visit_node_unary(struct filter_parser_ctx *ctx, struct ir_op *node)
+static int visit_node_unary(struct filter_parser_ctx *ctx, struct ir_op *node)
 {
        int ret;
        struct unary_op insn;
@@ -390,8 +371,7 @@ int visit_node_unary(struct filter_parser_ctx *ctx, struct ir_op *node)
        switch (node->u.unary.type) {
        case AST_UNARY_UNKNOWN:
        default:
-               fprintf(stderr, "[error] Unknown unary node type in %s\n",
-                       __func__);
+               fprintf(stderr, "[error] Unknown unary node type in %s\n", __func__);
                return -EINVAL;
        case AST_UNARY_PLUS:
                /* Nothing to do. */
@@ -412,8 +392,7 @@ int visit_node_unary(struct filter_parser_ctx *ctx, struct ir_op *node)
  * Binary comparator nesting is disallowed. This allows fitting into
  * only 2 registers.
  */
-static
-int visit_node_binary(struct filter_parser_ctx *ctx, struct ir_op *node)
+static int visit_node_binary(struct filter_parser_ctx *ctx, struct ir_op *node)
 {
        int ret;
        struct binary_op insn;
@@ -429,14 +408,12 @@ int visit_node_binary(struct filter_parser_ctx *ctx, struct ir_op *node)
        switch (node->u.binary.type) {
        case AST_OP_UNKNOWN:
        default:
-               fprintf(stderr, "[error] Unknown unary node type in %s\n",
-                       __func__);
+               fprintf(stderr, "[error] Unknown unary node type in %s\n", __func__);
                return -EINVAL;
 
        case AST_OP_AND:
        case AST_OP_OR:
-               fprintf(stderr, "[error] Unexpected logical node type in %s\n",
-                       __func__);
+               fprintf(stderr, "[error] Unexpected logical node type in %s\n", __func__);
                return -EINVAL;
 
        case AST_OP_MUL:
@@ -495,8 +472,7 @@ int visit_node_binary(struct filter_parser_ctx *ctx, struct ir_op *node)
 /*
  * A logical op always return a s64 (1 or 0).
  */
-static
-int visit_node_logical(struct filter_parser_ctx *ctx, struct ir_op *node)
+static int visit_node_logical(struct filter_parser_ctx *ctx, struct ir_op *node)
 {
        int ret;
        struct logical_op insn;
@@ -508,28 +484,26 @@ int visit_node_logical(struct filter_parser_ctx *ctx, struct ir_op *node)
        if (ret)
                return ret;
        /* Cast to s64 if float or field ref */
-       if ((node->u.binary.left->data_type == IR_DATA_FIELD_REF
-                               || node->u.binary.left->data_type == IR_DATA_GET_CONTEXT_REF
-                               || node->u.binary.left->data_type == IR_DATA_EXPRESSION)
-                       || node->u.binary.left->data_type == IR_DATA_FLOAT) {
+       if ((node->u.binary.left->data_type == IR_DATA_FIELD_REF ||
+            node->u.binary.left->data_type == IR_DATA_GET_CONTEXT_REF ||
+            node->u.binary.left->data_type == IR_DATA_EXPRESSION) ||
+           node->u.binary.left->data_type == IR_DATA_FLOAT) {
                struct cast_op cast_insn;
 
-               if (node->u.binary.left->data_type == IR_DATA_FIELD_REF
-                               || node->u.binary.left->data_type == IR_DATA_GET_CONTEXT_REF
-                               || node->u.binary.left->data_type == IR_DATA_EXPRESSION) {
+               if (node->u.binary.left->data_type == IR_DATA_FIELD_REF ||
+                   node->u.binary.left->data_type == IR_DATA_GET_CONTEXT_REF ||
+                   node->u.binary.left->data_type == IR_DATA_EXPRESSION) {
                        cast_insn.op = BYTECODE_OP_CAST_TO_S64;
                } else {
                        cast_insn.op = BYTECODE_OP_CAST_DOUBLE_TO_S64;
                }
-               ret = bytecode_push(&ctx->bytecode, &cast_insn,
-                                       1, sizeof(cast_insn));
+               ret = bytecode_push(&ctx->bytecode, &cast_insn, 1, sizeof(cast_insn));
                if (ret)
                        return ret;
        }
        switch (node->u.logical.type) {
        default:
-               fprintf(stderr, "[error] Unknown node type in %s\n",
-                       __func__);
+               fprintf(stderr, "[error] Unknown node type in %s\n", __func__);
                return -EINVAL;
 
        case AST_OP_AND:
@@ -539,9 +513,8 @@ int visit_node_logical(struct filter_parser_ctx *ctx, struct ir_op *node)
                insn.op = BYTECODE_OP_OR;
                break;
        }
-       insn.skip_offset = (uint16_t) -1UL;     /* Temporary */
-       ret = bytecode_push_logical(&ctx->bytecode, &insn, 1, sizeof(insn),
-                       &skip_offset_loc);
+       insn.skip_offset = (uint16_t) -1UL; /* Temporary */
+       ret = bytecode_push_logical(&ctx->bytecode, &insn, 1, sizeof(insn), &skip_offset_loc);
        if (ret)
                return ret;
        /* Visit right child */
@@ -549,30 +522,29 @@ int visit_node_logical(struct filter_parser_ctx *ctx, struct ir_op *node)
        if (ret)
                return ret;
        /* Cast to s64 if float or field ref */
-       if ((node->u.binary.right->data_type == IR_DATA_FIELD_REF
-                               || node->u.binary.right->data_type == IR_DATA_GET_CONTEXT_REF
-                               || node->u.binary.right->data_type == IR_DATA_EXPRESSION)
-                       || node->u.binary.right->data_type == IR_DATA_FLOAT) {
+       if ((node->u.binary.right->data_type == IR_DATA_FIELD_REF ||
+            node->u.binary.right->data_type == IR_DATA_GET_CONTEXT_REF ||
+            node->u.binary.right->data_type == IR_DATA_EXPRESSION) ||
+           node->u.binary.right->data_type == IR_DATA_FLOAT) {
                struct cast_op cast_insn;
 
-               if (node->u.binary.right->data_type == IR_DATA_FIELD_REF
-                               || node->u.binary.right->data_type == IR_DATA_GET_CONTEXT_REF
-                               || node->u.binary.right->data_type == IR_DATA_EXPRESSION) {
+               if (node->u.binary.right->data_type == IR_DATA_FIELD_REF ||
+                   node->u.binary.right->data_type == IR_DATA_GET_CONTEXT_REF ||
+                   node->u.binary.right->data_type == IR_DATA_EXPRESSION) {
                        cast_insn.op = BYTECODE_OP_CAST_TO_S64;
                } else {
                        cast_insn.op = BYTECODE_OP_CAST_DOUBLE_TO_S64;
                }
-               ret = bytecode_push(&ctx->bytecode, &cast_insn,
-                                       1, sizeof(cast_insn));
+               ret = bytecode_push(&ctx->bytecode, &cast_insn, 1, sizeof(cast_insn));
                if (ret)
                        return ret;
        }
        /* We now know where the logical op can skip. */
        target_loc = (uint16_t) bytecode_get_len(&ctx->bytecode->b);
        ret = bytecode_patch(&ctx->bytecode,
-                       &target_loc,                    /* Offset to jump to */
-                       skip_offset_loc,                /* Where to patch */
-                       sizeof(uint16_t));
+                            &target_loc, /* Offset to jump to */
+                            skip_offset_loc, /* Where to patch */
+                            sizeof(uint16_t));
        return ret;
 }
 
@@ -580,15 +552,12 @@ int visit_node_logical(struct filter_parser_ctx *ctx, struct ir_op *node)
  * Postorder traversal of the tree. We need the children result before
  * we can evaluate the parent.
  */
-static
-int recursive_visit_gen_bytecode(struct filter_parser_ctx *ctx,
-               struct ir_op *node)
+static int recursive_visit_gen_bytecode(struct filter_parser_ctx *ctx, struct ir_op *node)
 {
        switch (node->op) {
        case IR_OP_UNKNOWN:
        default:
-               fprintf(stderr, "[error] Unknown node type in %s\n",
-                       __func__);
+               fprintf(stderr, "[error] Unknown node type in %s\n", __func__);
                return -EINVAL;
 
        case IR_OP_ROOT:
@@ -637,8 +606,10 @@ int filter_visitor_bytecode_generate(struct filter_parser_ctx *ctx)
 
        /* Finally, append symbol table to bytecode */
        ctx->bytecode->b.reloc_table_offset = bytecode_get_len(&ctx->bytecode->b);
-       return bytecode_push(&ctx->bytecode, ctx->bytecode_reloc->b.data,
-                       1, bytecode_get_len(&ctx->bytecode_reloc->b));
+       return bytecode_push(&ctx->bytecode,
+                            ctx->bytecode_reloc->b.data,
+                            1,
+                            bytecode_get_len(&ctx->bytecode_reloc->b));
 
 error:
        filter_bytecode_free(ctx);
index 1bfe66c6f0d5010d71c2d8fe02f774f5eb5744a7..9283fc3d1bfd973d8faefc12d8a833555800d3d2 100644 (file)
@@ -9,25 +9,24 @@
  *
  */
 
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <inttypes.h>
 #include "filter-ast.hpp"
-#include "filter-parser.hpp"
 #include "filter-ir.hpp"
+#include "filter-parser.hpp"
 
 #include <common/compat/errno.hpp>
 #include <common/macros.hpp>
 #include <common/string-utils/string-utils.hpp>
 
-static
-struct ir_op *generate_ir_recursive(struct filter_parser_ctx *ctx,
-               struct filter_node *node, enum ir_side side);
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static struct ir_op *
+generate_ir_recursive(struct filter_parser_ctx *ctx, struct filter_node *node, enum ir_side side);
 
-static
-struct ir_op *make_op_root(struct ir_op *child, enum ir_side side)
+static struct ir_op *make_op_root(struct ir_op *child, enum ir_side side)
 {
        struct ir_op *op;
 
@@ -59,8 +58,7 @@ struct ir_op *make_op_root(struct ir_op *child, enum ir_side side)
        return op;
 }
 
-static
-enum ir_load_string_type get_literal_string_type(const char *string)
+static enum ir_load_string_type get_literal_string_type(const char *string)
 {
        LTTNG_ASSERT(string);
 
@@ -75,8 +73,7 @@ enum ir_load_string_type get_literal_string_type(const char *string)
        return IR_LOAD_STRING_TYPE_PLAIN;
 }
 
-static
-struct ir_op *make_op_load_string(const char *string, enum ir_side side)
+static struct ir_op *make_op_load_string(const char *string, enum ir_side side)
 {
        struct ir_op *op;
 
@@ -96,8 +93,7 @@ struct ir_op *make_op_load_string(const char *string, enum ir_side side)
        return op;
 }
 
-static
-struct ir_op *make_op_load_numeric(int64_t v, enum ir_side side)
+static struct ir_op *make_op_load_numeric(int64_t v, enum ir_side side)
 {
        struct ir_op *op;
 
@@ -113,8 +109,7 @@ struct ir_op *make_op_load_numeric(int64_t v, enum ir_side side)
        return op;
 }
 
-static
-struct ir_op *make_op_load_float(double v, enum ir_side side)
+static struct ir_op *make_op_load_float(double v, enum ir_side side)
 {
        struct ir_op *op;
 
@@ -129,8 +124,7 @@ struct ir_op *make_op_load_float(double v, enum ir_side side)
        return op;
 }
 
-static
-void free_load_expression(struct ir_load_expression *load_expression)
+static void free_load_expression(struct ir_load_expression *load_expression)
 {
        struct ir_load_expression_op *exp_op;
 
@@ -164,8 +158,7 @@ void free_load_expression(struct ir_load_expression *load_expression)
  * Returns the first node of the chain, after initializing the next
  * pointers.
  */
-static
-struct filter_node *load_expression_get_forward_chain(struct filter_node *node)
+static struct filter_node *load_expression_get_forward_chain(struct filter_node *node)
 {
        struct filter_node *prev_node;
 
@@ -181,8 +174,7 @@ struct filter_node *load_expression_get_forward_chain(struct filter_node *node)
        return prev_node;
 }
 
-static
-struct ir_load_expression *create_load_expression(struct filter_node *node)
+static struct ir_load_expression *create_load_expression(struct filter_node *node)
 {
        struct ir_load_expression *load_exp;
        struct ir_load_expression_op *load_exp_op, *prev_op;
@@ -239,15 +231,15 @@ struct ir_load_expression *create_load_expression(struct filter_node *node)
                        goto error;
 
                /* Explore brackets from current node. */
-               for (bracket_node = node->u.expression.next_bracket;
-                               bracket_node != NULL;
-                               bracket_node = bracket_node->u.expression.next_bracket) {
+               for (bracket_node = node->u.expression.next_bracket; bracket_node != NULL;
+                    bracket_node = bracket_node->u.expression.next_bracket) {
                        prev_op = load_exp_op;
                        if (bracket_node->type != NODE_EXPRESSION ||
-                               bracket_node->u.expression.type != AST_EXP_CONSTANT) {
-                                       fprintf(stderr, "[error] Expecting constant index in array expression\n");
-                                       goto error;
-                               }
+                           bracket_node->u.expression.type != AST_EXP_CONSTANT) {
+                               fprintf(stderr,
+                                       "[error] Expecting constant index in array expression\n");
+                               goto error;
+                       }
                        load_exp_op = zmalloc<ir_load_expression_op>();
                        if (!load_exp_op)
                                goto error;
@@ -275,9 +267,7 @@ error:
        return NULL;
 }
 
-static
-struct ir_op *make_op_load_expression(struct filter_node *node,
-               enum ir_side side)
+static struct ir_op *make_op_load_expression(struct filter_node *node, enum ir_side side)
 {
        struct ir_op *op;
 
@@ -300,15 +290,18 @@ error:
        return NULL;
 }
 
-static
-struct ir_op *make_op_unary(enum unary_op_type unary_op_type,
-                       const char *op_str, enum ir_op_signedness signedness,
-                       struct ir_op *child, enum ir_side side)
+static struct ir_op *make_op_unary(enum unary_op_type unary_op_type,
+                                  const char *op_str,
+                                  enum ir_op_signedness signedness,
+                                  struct ir_op *child,
+                                  enum ir_side side)
 {
        struct ir_op *op = NULL;
 
        if (child->data_type == IR_DATA_STRING) {
-               fprintf(stderr, "[error] unary operation '%s' not allowed on string literal\n", op_str);
+               fprintf(stderr,
+                       "[error] unary operation '%s' not allowed on string literal\n",
+                       op_str);
                goto error;
        }
 
@@ -331,51 +324,42 @@ error:
 /*
  * unary + is pretty much useless.
  */
-static
-struct ir_op *make_op_unary_plus(struct ir_op *child, enum ir_side side)
+static struct ir_op *make_op_unary_plus(struct ir_op *child, enum ir_side side)
 {
-       return make_op_unary(AST_UNARY_PLUS, "+", child->signedness,
-                       child, side);
+       return make_op_unary(AST_UNARY_PLUS, "+", child->signedness, child, side);
 }
 
-static
-struct ir_op *make_op_unary_minus(struct ir_op *child, enum ir_side side)
+static struct ir_op *make_op_unary_minus(struct ir_op *child, enum ir_side side)
 {
-       return make_op_unary(AST_UNARY_MINUS, "-", child->signedness,
-                       child, side);
+       return make_op_unary(AST_UNARY_MINUS, "-", child->signedness, child, side);
 }
 
-static
-struct ir_op *make_op_unary_not(struct ir_op *child, enum ir_side side)
+static struct ir_op *make_op_unary_not(struct ir_op *child, enum ir_side side)
 {
-       return make_op_unary(AST_UNARY_NOT, "!", child->signedness,
-                       child, side);
+       return make_op_unary(AST_UNARY_NOT, "!", child->signedness, child, side);
 }
 
-static
-struct ir_op *make_op_unary_bit_not(struct ir_op *child, enum ir_side side)
+static struct ir_op *make_op_unary_bit_not(struct ir_op *child, enum ir_side side)
 {
-       return make_op_unary(AST_UNARY_BIT_NOT, "~", child->signedness,
-                       child, side);
+       return make_op_unary(AST_UNARY_BIT_NOT, "~", child->signedness, child, side);
 }
 
-static
-struct ir_op *make_op_binary_compare(enum op_type bin_op_type,
-               const char *op_str, struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *make_op_binary_compare(enum op_type bin_op_type,
+                                           const char *op_str,
+                                           struct ir_op *left,
+                                           struct ir_op *right,
+                                           enum ir_side side)
 {
        struct ir_op *op = NULL;
 
-       if (left->data_type == IR_DATA_UNKNOWN
-               || right->data_type == IR_DATA_UNKNOWN) {
+       if (left->data_type == IR_DATA_UNKNOWN || right->data_type == IR_DATA_UNKNOWN) {
                fprintf(stderr, "[error] binary operation '%s' has unknown operand type\n", op_str);
                goto error;
-
        }
-       if ((left->data_type == IR_DATA_STRING
-               && (right->data_type == IR_DATA_NUMERIC || right->data_type == IR_DATA_FLOAT))
-               || ((left->data_type == IR_DATA_NUMERIC || left->data_type == IR_DATA_FLOAT) &&
-                       right->data_type == IR_DATA_STRING)) {
+       if ((left->data_type == IR_DATA_STRING &&
+            (right->data_type == IR_DATA_NUMERIC || right->data_type == IR_DATA_FLOAT)) ||
+           ((left->data_type == IR_DATA_NUMERIC || left->data_type == IR_DATA_FLOAT) &&
+            right->data_type == IR_DATA_STRING)) {
                fprintf(stderr, "[error] binary operation '%s' operand type mismatch\n", op_str);
                goto error;
        }
@@ -400,64 +384,52 @@ error:
        return NULL;
 }
 
-static
-struct ir_op *make_op_binary_eq(struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *make_op_binary_eq(struct ir_op *left, struct ir_op *right, enum ir_side side)
 {
        return make_op_binary_compare(AST_OP_EQ, "==", left, right, side);
 }
 
-static
-struct ir_op *make_op_binary_ne(struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *make_op_binary_ne(struct ir_op *left, struct ir_op *right, enum ir_side side)
 {
        return make_op_binary_compare(AST_OP_NE, "!=", left, right, side);
 }
 
-static
-struct ir_op *make_op_binary_gt(struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *make_op_binary_gt(struct ir_op *left, struct ir_op *right, enum ir_side side)
 {
        return make_op_binary_compare(AST_OP_GT, ">", left, right, side);
 }
 
-static
-struct ir_op *make_op_binary_lt(struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *make_op_binary_lt(struct ir_op *left, struct ir_op *right, enum ir_side side)
 {
        return make_op_binary_compare(AST_OP_LT, "<", left, right, side);
 }
 
-static
-struct ir_op *make_op_binary_ge(struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *make_op_binary_ge(struct ir_op *left, struct ir_op *right, enum ir_side side)
 {
        return make_op_binary_compare(AST_OP_GE, ">=", left, right, side);
 }
 
-static
-struct ir_op *make_op_binary_le(struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *make_op_binary_le(struct ir_op *left, struct ir_op *right, enum ir_side side)
 {
        return make_op_binary_compare(AST_OP_LE, "<=", left, right, side);
 }
 
-static
-struct ir_op *make_op_binary_logical(enum op_type bin_op_type,
-               const char *op_str, struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *make_op_binary_logical(enum op_type bin_op_type,
+                                           const char *op_str,
+                                           struct ir_op *left,
+                                           struct ir_op *right,
+                                           enum ir_side side)
 {
        struct ir_op *op = NULL;
 
-       if (left->data_type == IR_DATA_UNKNOWN
-               || right->data_type == IR_DATA_UNKNOWN) {
+       if (left->data_type == IR_DATA_UNKNOWN || right->data_type == IR_DATA_UNKNOWN) {
                fprintf(stderr, "[error] binary operation '%s' has unknown operand type\n", op_str);
                goto error;
-
        }
-       if (left->data_type == IR_DATA_STRING
-               || right->data_type == IR_DATA_STRING) {
-               fprintf(stderr, "[error] logical binary operation '%s' cannot have string operand\n", op_str);
+       if (left->data_type == IR_DATA_STRING || right->data_type == IR_DATA_STRING) {
+               fprintf(stderr,
+                       "[error] logical binary operation '%s' cannot have string operand\n",
+                       op_str);
                goto error;
        }
 
@@ -481,27 +453,30 @@ error:
        return NULL;
 }
 
-static
-struct ir_op *make_op_binary_bitwise(enum op_type bin_op_type,
-               const char *op_str, struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *make_op_binary_bitwise(enum op_type bin_op_type,
+                                           const char *op_str,
+                                           struct ir_op *left,
+                                           struct ir_op *right,
+                                           enum ir_side side)
 {
        struct ir_op *op = NULL;
 
-       if (left->data_type == IR_DATA_UNKNOWN
-               || right->data_type == IR_DATA_UNKNOWN) {
-               fprintf(stderr, "[error] bitwise binary operation '%s' has unknown operand type\n", op_str);
+       if (left->data_type == IR_DATA_UNKNOWN || right->data_type == IR_DATA_UNKNOWN) {
+               fprintf(stderr,
+                       "[error] bitwise binary operation '%s' has unknown operand type\n",
+                       op_str);
                goto error;
-
        }
-       if (left->data_type == IR_DATA_STRING
-               || right->data_type == IR_DATA_STRING) {
-               fprintf(stderr, "[error] bitwise binary operation '%s' cannot have string operand\n", op_str);
+       if (left->data_type == IR_DATA_STRING || right->data_type == IR_DATA_STRING) {
+               fprintf(stderr,
+                       "[error] bitwise binary operation '%s' cannot have string operand\n",
+                       op_str);
                goto error;
        }
-       if (left->data_type == IR_DATA_FLOAT
-               || right->data_type == IR_DATA_FLOAT) {
-               fprintf(stderr, "[error] bitwise binary operation '%s' cannot have floating point operand\n", op_str);
+       if (left->data_type == IR_DATA_FLOAT || right->data_type == IR_DATA_FLOAT) {
+               fprintf(stderr,
+                       "[error] bitwise binary operation '%s' cannot have floating point operand\n",
+                       op_str);
                goto error;
        }
 
@@ -525,65 +500,56 @@ error:
        return NULL;
 }
 
-static
-struct ir_op *make_op_binary_logical_and(struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *
+make_op_binary_logical_and(struct ir_op *left, struct ir_op *right, enum ir_side side)
 {
        return make_op_binary_logical(AST_OP_AND, "&&", left, right, side);
 }
 
-static
-struct ir_op *make_op_binary_logical_or(struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *
+make_op_binary_logical_or(struct ir_op *left, struct ir_op *right, enum ir_side side)
 {
        return make_op_binary_logical(AST_OP_OR, "||", left, right, side);
 }
 
-static
-struct ir_op *make_op_binary_bitwise_rshift(struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *
+make_op_binary_bitwise_rshift(struct ir_op *left, struct ir_op *right, enum ir_side side)
 {
        return make_op_binary_bitwise(AST_OP_BIT_RSHIFT, ">>", left, right, side);
 }
 
-static
-struct ir_op *make_op_binary_bitwise_lshift(struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *
+make_op_binary_bitwise_lshift(struct ir_op *left, struct ir_op *right, enum ir_side side)
 {
        return make_op_binary_bitwise(AST_OP_BIT_LSHIFT, "<<", left, right, side);
 }
 
-static
-struct ir_op *make_op_binary_bitwise_and(struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *
+make_op_binary_bitwise_and(struct ir_op *left, struct ir_op *right, enum ir_side side)
 {
        return make_op_binary_bitwise(AST_OP_BIT_AND, "&", left, right, side);
 }
 
-static
-struct ir_op *make_op_binary_bitwise_or(struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *
+make_op_binary_bitwise_or(struct ir_op *left, struct ir_op *right, enum ir_side side)
 {
        return make_op_binary_bitwise(AST_OP_BIT_OR, "|", left, right, side);
 }
 
-static
-struct ir_op *make_op_binary_bitwise_xor(struct ir_op *left, struct ir_op *right,
-               enum ir_side side)
+static struct ir_op *
+make_op_binary_bitwise_xor(struct ir_op *left, struct ir_op *right, enum ir_side side)
 {
        return make_op_binary_bitwise(AST_OP_BIT_XOR, "^", left, right, side);
 }
 
-static
-void filter_free_ir_recursive(struct ir_op *op)
+static void filter_free_ir_recursive(struct ir_op *op)
 {
        if (!op)
                return;
        switch (op->op) {
        case IR_OP_UNKNOWN:
        default:
-               fprintf(stderr, "[error] Unknown op type in %s\n",
-                       __func__);
+               fprintf(stderr, "[error] Unknown op type in %s\n", __func__);
                break;
        case IR_OP_ROOT:
                filter_free_ir_recursive(op->u.root.child);
@@ -593,7 +559,7 @@ void filter_free_ir_recursive(struct ir_op *op)
                case IR_DATA_STRING:
                        free(op->u.load.u.string.value);
                        break;
-               case IR_DATA_FIELD_REF:         /* fall-through */
+               case IR_DATA_FIELD_REF: /* fall-through */
                case IR_DATA_GET_CONTEXT_REF:
                        free(op->u.load.u.ref);
                        break;
@@ -618,9 +584,8 @@ void filter_free_ir_recursive(struct ir_op *op)
        free(op);
 }
 
-static
-struct ir_op *make_expression(struct filter_parser_ctx *ctx,
-               struct filter_node *node, enum ir_side side)
+static struct ir_op *
+make_expression(struct filter_parser_ctx *ctx, struct filter_node *node, enum ir_side side)
 {
        switch (node->u.expression.type) {
        case AST_EXP_UNKNOWN:
@@ -631,23 +596,19 @@ struct ir_op *make_expression(struct filter_parser_ctx *ctx,
        case AST_EXP_STRING:
                return make_op_load_string(node->u.expression.u.string, side);
        case AST_EXP_CONSTANT:
-               return make_op_load_numeric(node->u.expression.u.constant,
-                                       side);
+               return make_op_load_numeric(node->u.expression.u.constant, side);
        case AST_EXP_FLOAT_CONSTANT:
-               return make_op_load_float(node->u.expression.u.float_constant,
-                                       side);
+               return make_op_load_float(node->u.expression.u.float_constant, side);
        case AST_EXP_IDENTIFIER:
        case AST_EXP_GLOBAL_IDENTIFIER:
                return make_op_load_expression(node, side);
        case AST_EXP_NESTED:
-               return generate_ir_recursive(ctx, node->u.expression.u.child,
-                                       side);
+               return generate_ir_recursive(ctx, node->u.expression.u.child, side);
        }
 }
 
-static
-struct ir_op *make_op(struct filter_parser_ctx *ctx,
-               struct filter_node *node, enum ir_side side)
+static struct ir_op *
+make_op(struct filter_parser_ctx *ctx, struct filter_node *node, enum ir_side side)
 {
        struct ir_op *op = NULL, *lchild, *rchild;
        const char *op_str = "?";
@@ -777,14 +738,12 @@ struct ir_op *make_op(struct filter_parser_ctx *ctx,
        return op;
 
 error_not_supported:
-       fprintf(stderr, "[error] %s: binary operation '%s' not supported\n",
-               __func__, op_str);
+       fprintf(stderr, "[error] %s: binary operation '%s' not supported\n", __func__, op_str);
        return NULL;
 }
 
-static
-struct ir_op *make_unary_op(struct filter_parser_ctx *ctx,
-               struct filter_node *node, enum ir_side side)
+static struct ir_op *
+make_unary_op(struct filter_parser_ctx *ctx, struct filter_node *node, enum ir_side side)
 {
        switch (node->u.unary_op.type) {
        case AST_UNARY_UNKNOWN:
@@ -796,8 +755,7 @@ struct ir_op *make_unary_op(struct filter_parser_ctx *ctx,
        {
                struct ir_op *op, *child;
 
-               child = generate_ir_recursive(ctx, node->u.unary_op.child,
-                                       side);
+               child = generate_ir_recursive(ctx, node->u.unary_op.child, side);
                if (!child)
                        return NULL;
                op = make_op_unary_plus(child, side);
@@ -811,8 +769,7 @@ struct ir_op *make_unary_op(struct filter_parser_ctx *ctx,
        {
                struct ir_op *op, *child;
 
-               child = generate_ir_recursive(ctx, node->u.unary_op.child,
-                                       side);
+               child = generate_ir_recursive(ctx, node->u.unary_op.child, side);
                if (!child)
                        return NULL;
                op = make_op_unary_minus(child, side);
@@ -826,8 +783,7 @@ struct ir_op *make_unary_op(struct filter_parser_ctx *ctx,
        {
                struct ir_op *op, *child;
 
-               child = generate_ir_recursive(ctx, node->u.unary_op.child,
-                                       side);
+               child = generate_ir_recursive(ctx, node->u.unary_op.child, side);
                if (!child)
                        return NULL;
                op = make_op_unary_not(child, side);
@@ -841,8 +797,7 @@ struct ir_op *make_unary_op(struct filter_parser_ctx *ctx,
        {
                struct ir_op *op, *child;
 
-               child = generate_ir_recursive(ctx, node->u.unary_op.child,
-                                       side);
+               child = generate_ir_recursive(ctx, node->u.unary_op.child, side);
                if (!child)
                        return NULL;
                op = make_op_unary_bit_not(child, side);
@@ -857,9 +812,8 @@ struct ir_op *make_unary_op(struct filter_parser_ctx *ctx,
        return NULL;
 }
 
-static
-struct ir_op *generate_ir_recursive(struct filter_parser_ctx *ctx,
-               struct filter_node *node, enum ir_side side)
+static struct ir_op *
+generate_ir_recursive(struct filter_parser_ctx *ctx, struct filter_node *node, enum ir_side side)
 {
        switch (node->type) {
        case NODE_UNKNOWN:
@@ -871,8 +825,7 @@ struct ir_op *generate_ir_recursive(struct filter_parser_ctx *ctx,
        {
                struct ir_op *op, *child;
 
-               child = generate_ir_recursive(ctx, node->u.root.child,
-                                       side);
+               child = generate_ir_recursive(ctx, node->u.root.child, side);
                if (!child)
                        return NULL;
                op = make_op_root(child, side);
index 2699abde8b5379d52f81673d1d0b12ba1affc0e3..1384ff551fc8b37482a33d7e39230c5d226ade7a 100644 (file)
@@ -9,20 +9,19 @@
  *
  */
 
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <inttypes.h>
+#include "filter-ast.hpp"
+#include "filter-ir.hpp"
+#include "filter-parser.hpp"
 
 #include <common/compat/errno.hpp>
 
-#include "filter-ast.hpp"
-#include "filter-parser.hpp"
-#include "filter-ir.hpp"
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
-static
-int check_bin_comparator(struct ir_op *node)
+static int check_bin_comparator(struct ir_op *node)
 {
        switch (node->op) {
        case IR_OP_UNKNOWN:
@@ -40,12 +39,11 @@ int check_bin_comparator(struct ir_op *node)
        {
                int ret;
 
-               if (node->u.binary.left->data_type == IR_DATA_STRING
-                               || node->u.binary.right->data_type
-                                       == IR_DATA_STRING) {
-                       if (node->u.binary.type != AST_OP_EQ
-                                       && node->u.binary.type != AST_OP_NE) {
-                               fprintf(stderr, "[error] Only '==' and '!=' comparators are allowed for strings\n");
+               if (node->u.binary.left->data_type == IR_DATA_STRING ||
+                   node->u.binary.right->data_type == IR_DATA_STRING) {
+                       if (node->u.binary.type != AST_OP_EQ && node->u.binary.type != AST_OP_NE) {
+                               fprintf(stderr,
+                                       "[error] Only '==' and '!=' comparators are allowed for strings\n");
                                return -EINVAL;
                        }
                }
index 9c3dd76737f64f57e3d1a5a5aea34768d4190c54..5ebbc43eeaafd740a182dd473ff020d90aebcc33 100644 (file)
@@ -9,20 +9,20 @@
  *
  */
 
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <inttypes.h>
 #include "filter-ast.hpp"
-#include "filter-parser.hpp"
 #include "filter-ir.hpp"
+#include "filter-parser.hpp"
 
 #include <common/compat/errno.hpp>
 #include <common/macros.hpp>
 
-static
-int check_bin_op_nesting_recursive(struct ir_op *node, int nesting)
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static int check_bin_op_nesting_recursive(struct ir_op *node, int nesting)
 {
        switch (node->op) {
        case IR_OP_UNKNOWN:
@@ -31,34 +31,28 @@ int check_bin_op_nesting_recursive(struct ir_op *node, int nesting)
                return -EINVAL;
 
        case IR_OP_ROOT:
-               return check_bin_op_nesting_recursive(node->u.root.child,
-                               nesting);
+               return check_bin_op_nesting_recursive(node->u.root.child, nesting);
        case IR_OP_LOAD:
                return 0;
        case IR_OP_UNARY:
-               return check_bin_op_nesting_recursive(node->u.unary.child,
-                               nesting);
+               return check_bin_op_nesting_recursive(node->u.unary.child, nesting);
        case IR_OP_BINARY:
        {
                int ret;
 
-               ret = check_bin_op_nesting_recursive(node->u.binary.left,
-                               nesting + 1);
+               ret = check_bin_op_nesting_recursive(node->u.binary.left, nesting + 1);
                if (ret)
                        return ret;
-               return check_bin_op_nesting_recursive(node->u.binary.right,
-                               nesting + 1);
+               return check_bin_op_nesting_recursive(node->u.binary.right, nesting + 1);
        }
        case IR_OP_LOGICAL:
        {
                int ret;
 
-               ret = check_bin_op_nesting_recursive(node->u.logical.left,
-                               nesting);
+               ret = check_bin_op_nesting_recursive(node->u.logical.left, nesting);
                if (ret)
                        return ret;
-               return check_bin_op_nesting_recursive(node->u.logical.right,
-                               nesting);
+               return check_bin_op_nesting_recursive(node->u.logical.right, nesting);
        }
        }
 }
index 446c720db635e9ea0e0eb1d33c9c625f408980d8..517bd5128c9f4d3d6449cd3b876d24fc9e58991b 100644 (file)
@@ -9,22 +9,21 @@
  *
  */
 
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <inttypes.h>
+#include "filter-ast.hpp"
+#include "filter-ir.hpp"
+#include "filter-parser.hpp"
 
 #include <common/compat/errno.hpp>
 #include <common/macros.hpp>
 #include <common/string-utils/string-utils.hpp>
 
-#include "filter-ast.hpp"
-#include "filter-parser.hpp"
-#include "filter-ir.hpp"
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
-static
-int normalize_glob_patterns(struct ir_op *node)
+static int normalize_glob_patterns(struct ir_op *node)
 {
        switch (node->op) {
        case IR_OP_UNKNOWN:
@@ -37,13 +36,11 @@ int normalize_glob_patterns(struct ir_op *node)
        case IR_OP_LOAD:
        {
                if (node->data_type == IR_DATA_STRING) {
-                       enum ir_load_string_type type =
-                               node->u.load.u.string.type;
+                       enum ir_load_string_type type = node->u.load.u.string.type;
                        if (type == IR_LOAD_STRING_TYPE_GLOB_STAR_END ||
-                                       type == IR_LOAD_STRING_TYPE_GLOB_STAR) {
+                           type == IR_LOAD_STRING_TYPE_GLOB_STAR) {
                                LTTNG_ASSERT(node->u.load.u.string.value);
-                               strutils_normalize_star_glob_pattern(
-                                       node->u.load.u.string.value);
+                               strutils_normalize_star_glob_pattern(node->u.load.u.string.value);
                        }
                }
 
index 718098a433403bea810158b9e8b5b2fe27ca030a..f0a236345ad69dc0d8a2322d5e0434da1e7d24c2 100644 (file)
@@ -9,21 +9,20 @@
  *
  */
 
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <inttypes.h>
+#include "filter-ast.hpp"
+#include "filter-ir.hpp"
+#include "filter-parser.hpp"
 
 #include <common/compat/errno.hpp>
 #include <common/macros.hpp>
 
-#include "filter-ast.hpp"
-#include "filter-parser.hpp"
-#include "filter-ir.hpp"
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
-static
-int validate_globbing(struct ir_op *node)
+static int validate_globbing(struct ir_op *node)
 {
        int ret;
 
@@ -45,30 +44,32 @@ int validate_globbing(struct ir_op *node)
                struct ir_op *right = node->u.binary.right;
 
                if (left->op == IR_OP_LOAD && right->op == IR_OP_LOAD &&
-                               left->data_type == IR_DATA_STRING &&
-                               right->data_type == IR_DATA_STRING) {
+                   left->data_type == IR_DATA_STRING && right->data_type == IR_DATA_STRING) {
                        /* Test 1. */
                        if (left->u.load.u.string.type == IR_LOAD_STRING_TYPE_GLOB_STAR &&
-                                       right->u.load.u.string.type != IR_LOAD_STRING_TYPE_PLAIN) {
+                           right->u.load.u.string.type != IR_LOAD_STRING_TYPE_PLAIN) {
                                fprintf(stderr, "[error] Cannot compare two globbing patterns\n");
                                return -1;
                        }
 
                        if (right->u.load.u.string.type == IR_LOAD_STRING_TYPE_GLOB_STAR &&
-                                       left->u.load.u.string.type != IR_LOAD_STRING_TYPE_PLAIN) {
+                           left->u.load.u.string.type != IR_LOAD_STRING_TYPE_PLAIN) {
                                fprintf(stderr, "[error] Cannot compare two globbing patterns\n");
                                return -1;
                        }
                }
 
                if ((left->op == IR_OP_LOAD && left->data_type == IR_DATA_STRING) ||
-                               (right->op == IR_OP_LOAD && right->data_type == IR_DATA_STRING)) {
-                       if ((left->op == IR_OP_LOAD && left->u.load.u.string.type == IR_LOAD_STRING_TYPE_GLOB_STAR) ||
-                                       (right->op == IR_OP_LOAD && right->u.load.u.string.type == IR_LOAD_STRING_TYPE_GLOB_STAR)) {
+                   (right->op == IR_OP_LOAD && right->data_type == IR_DATA_STRING)) {
+                       if ((left->op == IR_OP_LOAD &&
+                            left->u.load.u.string.type == IR_LOAD_STRING_TYPE_GLOB_STAR) ||
+                           (right->op == IR_OP_LOAD &&
+                            right->u.load.u.string.type == IR_LOAD_STRING_TYPE_GLOB_STAR)) {
                                /* Test 2. */
                                if (node->u.binary.type != AST_OP_EQ &&
-                                               node->u.binary.type != AST_OP_NE) {
-                                       fprintf(stderr, "[error] Only the `==` and `!=` operators are allowed with a globbing pattern\n");
+                                   node->u.binary.type != AST_OP_NE) {
+                                       fprintf(stderr,
+                                               "[error] Only the `==` and `!=` operators are allowed with a globbing pattern\n");
                                        return -1;
                                }
                        }
index 9e060ce2b64e4fe77817c0af71fe76e150be308a..fd1feeed6cfcce6fed8c56158e69c90003277644 100644 (file)
@@ -9,18 +9,18 @@
  *
  */
 
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <inttypes.h>
+#include "filter-ast.hpp"
+#include "filter-ir.hpp"
+#include "filter-parser.hpp"
 
-#include <common/macros.hpp>
 #include <common/compat/errno.hpp>
+#include <common/macros.hpp>
 
-#include "filter-ast.hpp"
-#include "filter-parser.hpp"
-#include "filter-ir.hpp"
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
 enum parse_char_result {
        PARSE_CHAR_UNKNOWN = -2,
@@ -28,8 +28,7 @@ enum parse_char_result {
        PARSE_CHAR_NORMAL = 0,
 };
 
-static
-enum parse_char_result parse_char(const char **p)
+static enum parse_char_result parse_char(const char **p)
 {
        switch (**p) {
        case '\\':
@@ -48,8 +47,7 @@ enum parse_char_result parse_char(const char **p)
        }
 }
 
-static
-int validate_string(struct ir_op *node)
+static int validate_string(struct ir_op *node)
 {
        switch (node->op) {
        case IR_OP_UNKNOWN:
@@ -82,8 +80,7 @@ int validate_string(struct ir_op *node)
                                switch (res) {
                                case PARSE_CHAR_UNKNOWN:
                                        ret = -EINVAL;
-                                       fprintf(stderr,
-                                               "Unsupported escape character detected.\n");
+                                       fprintf(stderr, "Unsupported escape character detected.\n");
                                        goto end_load;
                                case PARSE_CHAR_NORMAL:
                                default:
@@ -91,7 +88,7 @@ int validate_string(struct ir_op *node)
                                }
                        }
                }
-end_load:
+       end_load:
                return ret;
        }
        case IR_OP_UNARY:
index 5b531a28979ad7a09eb788fdf55b47d62493cbd8..5d1bdb9d393ee8c2f4a8a9624fa5348537f3000d 100644 (file)
@@ -9,24 +9,23 @@
  *
  */
 
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <inttypes.h>
 #include "filter-ast.hpp"
 #include "filter-parser.hpp"
 
 #include <common/compat/errno.hpp>
 #include <common/macros.hpp>
 
-#define fprintf_dbg(fd, fmt, args...)  fprintf(fd, "%s: " fmt, __func__, ## args)
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
-static
-int recursive_visit_print(struct filter_node *node, FILE *stream, int indent);
+#define fprintf_dbg(fd, fmt, args...) fprintf(fd, "%s: " fmt, __func__, ##args)
 
-static
-void print_tabs(FILE *fd, int depth)
+static int recursive_visit_print(struct filter_node *node, FILE *stream, int indent);
+
+static void print_tabs(FILE *fd, int depth)
 {
        int i;
 
@@ -34,9 +33,7 @@ void print_tabs(FILE *fd, int depth)
                fprintf(fd, "\t");
 }
 
-static
-int recursive_visit_print_expression(struct filter_node *node,
-               FILE *stream, int indent)
+static int recursive_visit_print_expression(struct filter_node *node, FILE *stream, int indent)
 {
        struct filter_node *iter_node;
 
@@ -51,50 +48,47 @@ int recursive_visit_print_expression(struct filter_node *node,
                return -EINVAL;
        case AST_EXP_STRING:
                print_tabs(stream, indent);
-               fprintf(stream, "<string value=\"%s\"/>\n",
-                       node->u.expression.u.string);
+               fprintf(stream, "<string value=\"%s\"/>\n", node->u.expression.u.string);
                break;
        case AST_EXP_CONSTANT:
                print_tabs(stream, indent);
-               fprintf(stream, "<constant value=\"%" PRIu64 "\"/>\n",
+               fprintf(stream,
+                       "<constant value=\"%" PRIu64 "\"/>\n",
                        node->u.expression.u.constant);
                break;
        case AST_EXP_FLOAT_CONSTANT:
                print_tabs(stream, indent);
-               fprintf(stream, "<float_constant value=\"%lg\"/>\n",
+               fprintf(stream,
+                       "<float_constant value=\"%lg\"/>\n",
                        node->u.expression.u.float_constant);
                break;
-       case AST_EXP_IDENTIFIER:                /* fall-through */
+       case AST_EXP_IDENTIFIER: /* fall-through */
        case AST_EXP_GLOBAL_IDENTIFIER:
                print_tabs(stream, indent);
-               fprintf(stream, "<%s value=\"%s\"/>\n",
-                       node->u.expression.type == AST_EXP_IDENTIFIER ?
-                               "identifier" : "global_identifier",
+               fprintf(stream,
+                       "<%s value=\"%s\"/>\n",
+                       node->u.expression.type == AST_EXP_IDENTIFIER ? "identifier" :
+                                                                       "global_identifier",
                        node->u.expression.u.identifier);
                iter_node = node->u.expression.next;
                while (iter_node) {
                        print_tabs(stream, indent);
                        fprintf(stream, "<bracket>\n");
-                       if (recursive_visit_print_expression(iter_node,
-                                       stream, indent + 1)) {
+                       if (recursive_visit_print_expression(iter_node, stream, indent + 1)) {
                                return -EINVAL;
                        }
                        print_tabs(stream, indent);
                        fprintf(stream, "</bracket>\n");
                        iter_node = iter_node->u.expression.next;
-
                }
                break;
        case AST_EXP_NESTED:
-               return recursive_visit_print(node->u.expression.u.child,
-                               stream, indent + 1);
+               return recursive_visit_print(node->u.expression.u.child, stream, indent + 1);
        }
        return 0;
 }
 
-
-static
-int recursive_visit_print(struct filter_node *node, FILE *stream, int indent)
+static int recursive_visit_print(struct filter_node *node, FILE *stream, int indent)
 {
        int ret;
 
@@ -110,16 +104,14 @@ int recursive_visit_print(struct filter_node *node, FILE *stream, int indent)
        case NODE_ROOT:
                print_tabs(stream, indent);
                fprintf(stream, "<root>\n");
-               ret = recursive_visit_print(node->u.root.child, stream,
-                                       indent + 1);
+               ret = recursive_visit_print(node->u.root.child, stream, indent + 1);
                print_tabs(stream, indent);
                fprintf(stream, "</root>\n");
                return ret;
        case NODE_EXPRESSION:
                print_tabs(stream, indent);
                fprintf(stream, "<expression>\n");
-               ret = recursive_visit_print_expression(node, stream,
-                                       indent + 1);
+               ret = recursive_visit_print_expression(node, stream, indent + 1);
                print_tabs(stream, indent);
                fprintf(stream, "</expression>\n");
                return ret;
@@ -188,12 +180,10 @@ int recursive_visit_print(struct filter_node *node, FILE *stream, int indent)
                        break;
                }
                fprintf(stream, ">\n");
-               ret = recursive_visit_print(node->u.op.lchild,
-                                       stream, indent + 1);
+               ret = recursive_visit_print(node->u.op.lchild, stream, indent + 1);
                if (ret)
                        return ret;
-               ret = recursive_visit_print(node->u.op.rchild,
-                                       stream, indent + 1);
+               ret = recursive_visit_print(node->u.op.rchild, stream, indent + 1);
                if (ret)
                        return ret;
                print_tabs(stream, indent);
@@ -221,8 +211,7 @@ int recursive_visit_print(struct filter_node *node, FILE *stream, int indent)
                        break;
                }
                fprintf(stream, ">\n");
-               ret = recursive_visit_print(node->u.unary_op.child,
-                                       stream, indent + 1);
+               ret = recursive_visit_print(node->u.unary_op.child, stream, indent + 1);
                print_tabs(stream, indent);
                fprintf(stream, "</unary_op>\n");
                return ret;
@@ -230,8 +219,7 @@ int recursive_visit_print(struct filter_node *node, FILE *stream, int indent)
        return 0;
 }
 
-int filter_visitor_print_xml(struct filter_parser_ctx *ctx, FILE *stream,
-                       int indent)
+int filter_visitor_print_xml(struct filter_parser_ctx *ctx, FILE *stream, int indent)
 {
        return recursive_visit_print(&ctx->ast->root, stream, indent);
 }
index e178b7e1b4f1e8a99de25e42b10733266353ada0..1b9f7fc9288cae694e21cad369ffc87dc7ea174e 100644 (file)
@@ -7,15 +7,15 @@
  */
 
 #define _LGPL_SOURCE
+#include "futex.hpp"
+
+#include <common/common.hpp>
+
 #include <limits.h>
 #include <unistd.h>
 #include <urcu.h>
 #include <urcu/futex.h>
 
-#include <common/common.hpp>
-
-#include "futex.hpp"
-
 /*
  * This futex wait/wake scheme only works for N wakers / 1 waiters. Hence the
  * "nto1" added to all function signature.
@@ -42,8 +42,7 @@ void futex_wait_update(int32_t *futex, int active)
 {
        if (active) {
                uatomic_set(futex, 1);
-               if (futex_async(futex, FUTEX_WAKE,
-                               INT_MAX, NULL, NULL, 0) < 0) {
+               if (futex_async(futex, FUTEX_WAKE, INT_MAX, NULL, NULL, 0) < 0) {
                        PERROR("futex_async");
                        abort();
                }
@@ -90,7 +89,7 @@ void futex_nto1_wait(int32_t *futex)
                        goto end;
                case EINTR:
                        /* Retry if interrupted by signal. */
-                       break;  /* Get out of switch. Check again. */
+                       break; /* Get out of switch. Check again. */
                default:
                        /* Unexpected error. */
                        PERROR("futex_async");
index 3aa3d79d42210dcfb192a21056c1a1a2319c7716..840a7347936dabb11132eb56b838f961bf3e9bfb 100644 (file)
@@ -6,15 +6,15 @@
  */
 
 #define _LGPL_SOURCE
-#include <string.h>
-#include <urcu.h>
-#include <urcu/compiler.h>
+#include "hashtable.hpp"
+#include "utils.hpp"
 
 #include <common/common.hpp>
 #include <common/defaults.hpp>
 
-#include "hashtable.hpp"
-#include "utils.hpp"
+#include <string.h>
+#include <urcu.h>
+#include <urcu/compiler.h>
 
 /* seed_lock protects both seed_init and lttng_ht_seed. */
 static pthread_mutex_t seed_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -74,8 +74,7 @@ static int match_two_u64(struct cds_lfht_node *node, const void *key)
        return hash_match_key_two_u64((void *) &match_node->key, (void *) key);
 }
 
-static inline
-const char *lttng_ht_type_str(enum lttng_ht_type type)
+static inline const char *lttng_ht_type_str(enum lttng_ht_type type)
 {
        switch (type) {
        case LTTNG_HT_TYPE_STRING:
@@ -116,8 +115,11 @@ struct lttng_ht *lttng_ht_new(unsigned long size, lttng_ht_type type)
                goto error;
        }
 
-       ht->ht = cds_lfht_new(size, min_hash_alloc_size, max_hash_buckets_size,
-                       CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       ht->ht = cds_lfht_new(size,
+                             min_hash_alloc_size,
+                             max_hash_buckets_size,
+                             CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING,
+                             NULL);
        /*
         * There is already an assert in the RCU hashtable code so if the ht is
         * NULL here there is a *huge* problem.
@@ -147,8 +149,7 @@ struct lttng_ht *lttng_ht_new(unsigned long size, lttng_ht_type type)
                goto error;
        }
 
-       DBG3("Created hashtable size %lu at %p of type %s", size, ht->ht,
-                       lttng_ht_type_str(type));
+       DBG3("Created hashtable size %lu at %p of type %s", size, ht->ht, lttng_ht_type_str(type));
 
        return ht;
 
@@ -182,8 +183,7 @@ void lttng_ht_node_init_str(struct lttng_ht_node_str *node, char *key)
 /*
  * Init lttng ht node unsigned long.
  */
-void lttng_ht_node_init_ulong(struct lttng_ht_node_ulong *node,
-               unsigned long key)
+void lttng_ht_node_init_ulong(struct lttng_ht_node_ulong *node, unsigned long key)
 {
        LTTNG_ASSERT(node);
 
@@ -194,8 +194,7 @@ void lttng_ht_node_init_ulong(struct lttng_ht_node_ulong *node,
 /*
  * Init lttng ht node uint64_t.
  */
-void lttng_ht_node_init_u64(struct lttng_ht_node_u64 *node,
-               uint64_t key)
+void lttng_ht_node_init_u64(struct lttng_ht_node_u64 *node, uint64_t key)
 {
        LTTNG_ASSERT(node);
 
@@ -206,8 +205,7 @@ void lttng_ht_node_init_u64(struct lttng_ht_node_u64 *node,
 /*
  * Init lttng ht node with two uint64_t.
  */
-void lttng_ht_node_init_two_u64(struct lttng_ht_node_two_u64 *node,
-               uint64_t key1, uint64_t key2)
+void lttng_ht_node_init_two_u64(struct lttng_ht_node_two_u64 *node, uint64_t key1, uint64_t key2)
 {
        LTTNG_ASSERT(node);
 
@@ -255,21 +253,18 @@ void lttng_ht_node_free_two_u64(struct lttng_ht_node_two_u64 *node)
 /*
  * Lookup function in hashtable.
  */
-void lttng_ht_lookup(struct lttng_ht *ht, const void *key,
-               struct lttng_ht_iter *iter)
+void lttng_ht_lookup(struct lttng_ht *ht, const void *key, struct lttng_ht_iter *iter)
 {
        LTTNG_ASSERT(ht);
        LTTNG_ASSERT(ht->ht);
 
-       cds_lfht_lookup(ht->ht, ht->hash_fct(key, lttng_ht_seed),
-                       ht->match_fct, key, &iter->iter);
+       cds_lfht_lookup(ht->ht, ht->hash_fct(key, lttng_ht_seed), ht->match_fct, key, &iter->iter);
 }
 
 /*
  * Add unique string node to hashtable.
  */
-void lttng_ht_add_unique_str(struct lttng_ht *ht,
-               struct lttng_ht_node_str *node)
+void lttng_ht_add_unique_str(struct lttng_ht *ht, struct lttng_ht_node_str *node)
 {
        struct cds_lfht_node *node_ptr;
        LTTNG_ASSERT(ht);
@@ -278,8 +273,11 @@ void lttng_ht_add_unique_str(struct lttng_ht *ht,
 
        /* RCU read lock protects from ABA. */
        rcu_read_lock();
-       node_ptr = cds_lfht_add_unique(ht->ht, ht->hash_fct(node->key, lttng_ht_seed),
-                       ht->match_fct, node->key, &node->node);
+       node_ptr = cds_lfht_add_unique(ht->ht,
+                                      ht->hash_fct(node->key, lttng_ht_seed),
+                                      ht->match_fct,
+                                      node->key,
+                                      &node->node);
        rcu_read_unlock();
        LTTNG_ASSERT(node_ptr == &node->node);
 }
@@ -287,8 +285,7 @@ void lttng_ht_add_unique_str(struct lttng_ht *ht,
 /*
  * Add string node to hashtable.
  */
-void lttng_ht_add_str(struct lttng_ht *ht,
-               struct lttng_ht_node_str *node)
+void lttng_ht_add_str(struct lttng_ht *ht, struct lttng_ht_node_str *node)
 {
        LTTNG_ASSERT(ht);
        LTTNG_ASSERT(ht->ht);
@@ -296,8 +293,7 @@ void lttng_ht_add_str(struct lttng_ht *ht,
 
        /* RCU read lock protects from ABA. */
        rcu_read_lock();
-       cds_lfht_add(ht->ht, ht->hash_fct(node->key, lttng_ht_seed),
-                       &node->node);
+       cds_lfht_add(ht->ht, ht->hash_fct(node->key, lttng_ht_seed), &node->node);
        rcu_read_unlock();
 }
 
@@ -312,8 +308,7 @@ void lttng_ht_add_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node)
 
        /* RCU read lock protects from ABA. */
        rcu_read_lock();
-       cds_lfht_add(ht->ht, ht->hash_fct((void *) node->key, lttng_ht_seed),
-                       &node->node);
+       cds_lfht_add(ht->ht, ht->hash_fct((void *) node->key, lttng_ht_seed), &node->node);
        rcu_read_unlock();
 }
 
@@ -328,16 +323,14 @@ void lttng_ht_add_u64(struct lttng_ht *ht, struct lttng_ht_node_u64 *node)
 
        /* RCU read lock protects from ABA. */
        rcu_read_lock();
-       cds_lfht_add(ht->ht, ht->hash_fct(&node->key, lttng_ht_seed),
-                       &node->node);
+       cds_lfht_add(ht->ht, ht->hash_fct(&node->key, lttng_ht_seed), &node->node);
        rcu_read_unlock();
 }
 
 /*
  * Add unique unsigned long node to hashtable.
  */
-void lttng_ht_add_unique_ulong(struct lttng_ht *ht,
-               struct lttng_ht_node_ulong *node)
+void lttng_ht_add_unique_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node)
 {
        struct cds_lfht_node *node_ptr;
        LTTNG_ASSERT(ht);
@@ -347,8 +340,10 @@ void lttng_ht_add_unique_ulong(struct lttng_ht *ht,
        /* RCU read lock protects from ABA. */
        rcu_read_lock();
        node_ptr = cds_lfht_add_unique(ht->ht,
-                       ht->hash_fct((void *) node->key, lttng_ht_seed), ht->match_fct,
-                       (void *) node->key, &node->node);
+                                      ht->hash_fct((void *) node->key, lttng_ht_seed),
+                                      ht->match_fct,
+                                      (void *) node->key,
+                                      &node->node);
        rcu_read_unlock();
        LTTNG_ASSERT(node_ptr == &node->node);
 }
@@ -356,8 +351,7 @@ void lttng_ht_add_unique_ulong(struct lttng_ht *ht,
 /*
  * Add unique uint64_t node to hashtable.
  */
-void lttng_ht_add_unique_u64(struct lttng_ht *ht,
-               struct lttng_ht_node_u64 *node)
+void lttng_ht_add_unique_u64(struct lttng_ht *ht, struct lttng_ht_node_u64 *node)
 {
        struct cds_lfht_node *node_ptr;
        LTTNG_ASSERT(ht);
@@ -367,8 +361,10 @@ void lttng_ht_add_unique_u64(struct lttng_ht *ht,
        /* RCU read lock protects from ABA. */
        rcu_read_lock();
        node_ptr = cds_lfht_add_unique(ht->ht,
-                       ht->hash_fct(&node->key, lttng_ht_seed), ht->match_fct,
-                       &node->key, &node->node);
+                                      ht->hash_fct(&node->key, lttng_ht_seed),
+                                      ht->match_fct,
+                                      &node->key,
+                                      &node->node);
        rcu_read_unlock();
        LTTNG_ASSERT(node_ptr == &node->node);
 }
@@ -376,8 +372,7 @@ void lttng_ht_add_unique_u64(struct lttng_ht *ht,
 /*
  * Add unique two uint64_t node to hashtable.
  */
-void lttng_ht_add_unique_two_u64(struct lttng_ht *ht,
-               struct lttng_ht_node_two_u64 *node)
+void lttng_ht_add_unique_two_u64(struct lttng_ht *ht, struct lttng_ht_node_two_u64 *node)
 {
        struct cds_lfht_node *node_ptr;
        LTTNG_ASSERT(ht);
@@ -387,8 +382,10 @@ void lttng_ht_add_unique_two_u64(struct lttng_ht *ht,
        /* RCU read lock protects from ABA. */
        rcu_read_lock();
        node_ptr = cds_lfht_add_unique(ht->ht,
-                       ht->hash_fct((void *) &node->key, lttng_ht_seed), ht->match_fct,
-                       (void *) &node->key, &node->node);
+                                      ht->hash_fct((void *) &node->key, lttng_ht_seed),
+                                      ht->match_fct,
+                                      (void *) &node->key,
+                                      &node->node);
        rcu_read_unlock();
        LTTNG_ASSERT(node_ptr == &node->node);
 }
@@ -397,7 +394,7 @@ void lttng_ht_add_unique_two_u64(struct lttng_ht *ht,
  * Add replace unsigned long node to hashtable.
  */
 struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong(struct lttng_ht *ht,
-               struct lttng_ht_node_ulong *node)
+                                                      struct lttng_ht_node_ulong *node)
 {
        struct cds_lfht_node *node_ptr;
        LTTNG_ASSERT(ht);
@@ -407,8 +404,10 @@ struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong(struct lttng_ht *ht,
        /* RCU read lock protects from ABA. */
        rcu_read_lock();
        node_ptr = cds_lfht_add_replace(ht->ht,
-                       ht->hash_fct((void *) node->key, lttng_ht_seed), ht->match_fct,
-                       (void *) node->key, &node->node);
+                                       ht->hash_fct((void *) node->key, lttng_ht_seed),
+                                       ht->match_fct,
+                                       (void *) node->key,
+                                       &node->node);
        rcu_read_unlock();
        if (!node_ptr) {
                return NULL;
@@ -422,7 +421,7 @@ struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong(struct lttng_ht *ht,
  * Add replace unsigned long node to hashtable.
  */
 struct lttng_ht_node_u64 *lttng_ht_add_replace_u64(struct lttng_ht *ht,
-               struct lttng_ht_node_u64 *node)
+                                                  struct lttng_ht_node_u64 *node)
 {
        struct cds_lfht_node *node_ptr;
        LTTNG_ASSERT(ht);
@@ -432,8 +431,10 @@ struct lttng_ht_node_u64 *lttng_ht_add_replace_u64(struct lttng_ht *ht,
        /* RCU read lock protects from ABA. */
        rcu_read_lock();
        node_ptr = cds_lfht_add_replace(ht->ht,
-                       ht->hash_fct(&node->key, lttng_ht_seed), ht->match_fct,
-                       &node->key, &node->node);
+                                       ht->hash_fct(&node->key, lttng_ht_seed),
+                                       ht->match_fct,
+                                       &node->key,
+                                       &node->node);
        rcu_read_unlock();
        if (!node_ptr) {
                return NULL;
@@ -507,8 +508,7 @@ unsigned long lttng_ht_get_count(struct lttng_ht *ht)
 /*
  * Return lttng ht string node from iterator.
  */
-struct lttng_ht_node_str *lttng_ht_iter_get_node_str(
-               struct lttng_ht_iter *iter)
+struct lttng_ht_node_str *lttng_ht_iter_get_node_str(struct lttng_ht_iter *iter)
 {
        struct cds_lfht_node *node;
 
@@ -523,8 +523,7 @@ struct lttng_ht_node_str *lttng_ht_iter_get_node_str(
 /*
  * Return lttng ht unsigned long node from iterator.
  */
-struct lttng_ht_node_ulong *lttng_ht_iter_get_node_ulong(
-               struct lttng_ht_iter *iter)
+struct lttng_ht_node_ulong *lttng_ht_iter_get_node_ulong(struct lttng_ht_iter *iter)
 {
        struct cds_lfht_node *node;
 
@@ -539,8 +538,7 @@ struct lttng_ht_node_ulong *lttng_ht_iter_get_node_ulong(
 /*
  * Return lttng ht unsigned long node from iterator.
  */
-struct lttng_ht_node_u64 *lttng_ht_iter_get_node_u64(
-               struct lttng_ht_iter *iter)
+struct lttng_ht_node_u64 *lttng_ht_iter_get_node_u64(struct lttng_ht_iter *iter)
 {
        struct cds_lfht_node *node;
 
@@ -555,8 +553,7 @@ struct lttng_ht_node_u64 *lttng_ht_iter_get_node_u64(
 /*
  * Return lttng ht stream and index id node from iterator.
  */
-struct lttng_ht_node_two_u64 *lttng_ht_iter_get_node_two_u64(
-               struct lttng_ht_iter *iter)
+struct lttng_ht_node_two_u64 *lttng_ht_iter_get_node_two_u64(struct lttng_ht_iter *iter)
 {
        struct cds_lfht_node *node;
 
index 516deeb64bbb6dcf8b3550abd0f236616bcec6c2..305660c804ff6319f3d7aea7c36055590858e261 100644 (file)
  */
 
 #define _LGPL_SOURCE
-#include <stdint.h>     /* defines uint32_t etc */
-#include <stdio.h>      /* defines printf for tests */
-#include <string.h>
-#include <sys/param.h>  /* attempt to define endianness */
-#include <time.h>       /* defines time_t for timings in the test */
-#include <urcu/compiler.h>
-
 #include "utils.hpp"
-#include <common/compat/endian.hpp>    /* attempt to define endianness */
+
 #include <common/common.hpp>
+#include <common/compat/endian.hpp> /* attempt to define endianness */
 #include <common/hashtable/hashtable.hpp>
 
+#include <stdint.h> /* defines uint32_t etc */
+#include <stdio.h> /* defines printf for tests */
+#include <string.h>
+#include <sys/param.h> /* attempt to define endianness */
+#include <time.h> /* defines time_t for timings in the test */
+#include <urcu/compiler.h>
+
 /*
  * My best guess at if you are big-endian or little-endian.  This may
  * need adjustment.
  */
-#if (defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && \
-     BYTE_ORDER == LITTLE_ENDIAN) || \
-    (defined(i386) || defined(__i386__) || defined(__i486__) || \
-     defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL))
-# define HASH_LITTLE_ENDIAN 1
-# define HASH_BIG_ENDIAN 0
-#elif (defined(BYTE_ORDER) && defined(BIG_ENDIAN) && \
-       BYTE_ORDER == BIG_ENDIAN) || \
-      (defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel))
-# define HASH_LITTLE_ENDIAN 0
-# define HASH_BIG_ENDIAN 1
+#if (defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && BYTE_ORDER == LITTLE_ENDIAN) ||    \
+       (defined(i386) || defined(__i386__) || defined(__i486__) || defined(__i586__) || \
+        defined(__i686__) || defined(vax) || defined(MIPSEL))
+#define HASH_LITTLE_ENDIAN 1
+#define HASH_BIG_ENDIAN           0
+#elif (defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN) || \
+       (defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel))
+#define HASH_LITTLE_ENDIAN 0
+#define HASH_BIG_ENDIAN           1
 #else
-# define HASH_LITTLE_ENDIAN 0
-# define HASH_BIG_ENDIAN 0
+#define HASH_LITTLE_ENDIAN 0
+#define HASH_BIG_ENDIAN           0
 #endif
 
-#define hashsize(n) ((uint32_t)1<<(n))
-#define hashmask(n) (hashsize(n)-1)
-#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
+#define hashsize(n) ((uint32_t) 1 << (n))
+#define hashmask(n) (hashsize(n) - 1)
+#define rot(x, k)   (((x) << (k)) | ((x) >> (32 - (k))))
 
 /*
  * mix -- mix 3 32-bit values reversibly.
  * on, and rotates are much kinder to the top and bottom bits, so I used
  * rotates.
  */
-#define mix(a,b,c) \
-{ \
-  a -= c;  a ^= rot(c, 4);  c += b; \
-  b -= a;  b ^= rot(a, 6);  a += c; \
-  c -= b;  c ^= rot(b, 8);  b += a; \
-  a -= c;  a ^= rot(c,16);  c += b; \
-  b -= a;  b ^= rot(a,19);  a += c; \
-  c -= b;  c ^= rot(b, 4);  b += a; \
-}
+#define mix(a, b, c)             \
+       {                        \
+               a -= c;          \
+               a ^= rot(c, 4);  \
+               c += b;          \
+               b -= a;          \
+               b ^= rot(a, 6);  \
+               a += c;          \
+               c -= b;          \
+               c ^= rot(b, 8);  \
+               b += a;          \
+               a -= c;          \
+               a ^= rot(c, 16); \
+               c += b;          \
+               b -= a;          \
+               b ^= rot(a, 19); \
+               a += c;          \
+               c -= b;          \
+               c ^= rot(b, 4);  \
+               b += a;          \
+       }
 
 /*
  * final -- final mixing of 3 32-bit values (a,b,c) into c
  *  10  8 15 26 3 22 24
  *  11  8 15 26 3 22 24
  */
-#define final(a,b,c) \
-{ \
-  c ^= b; c -= rot(b,14); \
-  a ^= c; a -= rot(c,11); \
-  b ^= a; b -= rot(a,25); \
-  c ^= b; c -= rot(b,16); \
-  a ^= c; a -= rot(c,4);  \
-  b ^= a; b -= rot(a,14); \
-  c ^= b; c -= rot(b,24); \
-}
+#define final(a, b, c)           \
+       {                        \
+               c ^= b;          \
+               c -= rot(b, 14); \
+               a ^= c;          \
+               a -= rot(c, 11); \
+               b ^= a;          \
+               b -= rot(a, 25); \
+               c ^= b;          \
+               c -= rot(b, 16); \
+               a ^= c;          \
+               a -= rot(c, 4);  \
+               b ^= a;          \
+               b -= rot(a, 14); \
+               c ^= b;          \
+               c -= rot(b, 24); \
+       }
 
 /*
  * k - the key, an array of uint32_t values
  * length - the length of the key, in uint32_ts
  * initval - the previous hash, or an arbitrary value
  */
-static uint32_t __attribute__((unused)) hashword(const uint32_t *k,
-               size_t length, uint32_t initval)
+static uint32_t __attribute__((unused)) hashword(const uint32_t *k, size_t length, uint32_t initval)
 {
        uint32_t a, b, c;
 
@@ -186,27 +203,29 @@ static uint32_t __attribute__((unused)) hashword(const uint32_t *k,
        }
 
        /*----------------------------------- handle the last 3 uint32_t's */
-       switch (length) {       /* all the case statements fall through */
-       case 3: c += k[2]; /* fall through */
-       case 2: b += k[1]; /* fall through */
-       case 1: a += k[0];
+       switch (length) { /* all the case statements fall through */
+       case 3:
+               c += k[2]; /* fall through */
+       case 2:
+               b += k[1]; /* fall through */
+       case 1:
+               a += k[0];
                final(a, b, c);
-       case 0:                 /* case 0: nothing left to add */
+       case 0: /* case 0: nothing left to add */
                break;
        }
        /*---------------------------------------------- report the result */
        return c;
 }
 
-
 /*
  * hashword2() -- same as hashword(), but take two seeds and return two 32-bit
  * values.  pc and pb must both be nonnull, and *pc and *pb must both be
  * initialized with seeds.  If you pass in (*pb)==0, the output (*pc) will be
  * the same as the return value from hashword().
  */
-static void __attribute__((unused)) hashword2(const uint32_t *k, size_t length,
-               uint32_t *pc, uint32_t *pb)
+static void __attribute__((unused))
+hashword2(const uint32_t *k, size_t length, uint32_t *pc, uint32_t *pb)
 {
        uint32_t a, b, c;
 
@@ -224,17 +243,17 @@ static void __attribute__((unused)) hashword2(const uint32_t *k, size_t length,
        }
 
        switch (length) {
-       case 3 :
+       case 3:
                c += k[2];
                /* fall through */
-       case 2 :
+       case 2:
                b += k[1];
                /* fall through */
-       case 1 :
+       case 1:
                a += k[0];
                final(a, b, c);
                /* fall through */
-       case 0:     /* case 0: nothing left to add */
+       case 0: /* case 0: nothing left to add */
                break;
        }
 
@@ -267,29 +286,27 @@ static void __attribute__((unused)) hashword2(const uint32_t *k, size_t length,
  * acceptable.  Do NOT use for cryptographic purposes.
  */
 LTTNG_NO_SANITIZE_ADDRESS
-__attribute__((unused))
-static uint32_t hashlittle(const void *key,
-               size_t length, uint32_t initval)
+__attribute__((unused)) static uint32_t hashlittle(const void *key, size_t length, uint32_t initval)
 {
-       uint32_t a,b,c;
+       uint32_t a, b, c;
        union {
                const void *ptr;
                size_t i;
-       } u;     /* needed for Mac Powerbook G4 */
+       } u; /* needed for Mac Powerbook G4 */
 
        /* Set up the internal state */
-       a = b = c = 0xdeadbeef + ((uint32_t)length) + initval;
+       a = b = c = 0xdeadbeef + ((uint32_t) length) + initval;
 
        u.ptr = key;
        if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
-               const uint32_t *k = (const uint32_t *)key;         /* read 32-bit chunks */
+               const uint32_t *k = (const uint32_t *) key; /* read 32-bit chunks */
 
                /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
                while (length > 12) {
                        a += k[0];
                        b += k[1];
                        c += k[2];
-                       mix(a,b,c);
+                       mix(a, b, c);
                        length -= 12;
                        k += 3;
                }
@@ -306,139 +323,207 @@ static uint32_t hashlittle(const void *key,
 #ifndef VALGRIND
 
                switch (length) {
-               case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
-               case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break;
-               case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break;
-               case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break;
-               case 8 : b+=k[1]; a+=k[0]; break;
-               case 7 : b+=k[1]&0xffffff; a+=k[0]; break;
-               case 6 : b+=k[1]&0xffff; a+=k[0]; break;
-               case 5 : b+=k[1]&0xff; a+=k[0]; break;
-               case 4 : a+=k[0]; break;
-               case 3 : a+=k[0]&0xffffff; break;
-               case 2 : a+=k[0]&0xffff; break;
-               case 1 : a+=k[0]&0xff; break;
-               case 0 : return c;              /* zero length strings require no mixing */
+               case 12:
+                       c += k[2];
+                       b += k[1];
+                       a += k[0];
+                       break;
+               case 11:
+                       c += k[2] & 0xffffff;
+                       b += k[1];
+                       a += k[0];
+                       break;
+               case 10:
+                       c += k[2] & 0xffff;
+                       b += k[1];
+                       a += k[0];
+                       break;
+               case 9:
+                       c += k[2] & 0xff;
+                       b += k[1];
+                       a += k[0];
+                       break;
+               case 8:
+                       b += k[1];
+                       a += k[0];
+                       break;
+               case 7:
+                       b += k[1] & 0xffffff;
+                       a += k[0];
+                       break;
+               case 6:
+                       b += k[1] & 0xffff;
+                       a += k[0];
+                       break;
+               case 5:
+                       b += k[1] & 0xff;
+                       a += k[0];
+                       break;
+               case 4:
+                       a += k[0];
+                       break;
+               case 3:
+                       a += k[0] & 0xffffff;
+                       break;
+               case 2:
+                       a += k[0] & 0xffff;
+                       break;
+               case 1:
+                       a += k[0] & 0xff;
+                       break;
+               case 0:
+                       return c; /* zero length strings require no mixing */
                }
 #else /* make valgrind happy */
                const uint8_t *k8;
 
-               k8 = (const uint8_t *)k;
+               k8 = (const uint8_t *) k;
                switch (length) {
-               case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
-               case 11: c+=((uint32_t)k8[10])<<16;  /* fall through */
-               case 10: c+=((uint32_t)k8[9])<<8;    /* fall through */
-               case 9 : c+=k8[8];                   /* fall through */
-               case 8 : b+=k[1]; a+=k[0]; break;
-               case 7 : b+=((uint32_t)k8[6])<<16;   /* fall through */
-               case 6 : b+=((uint32_t)k8[5])<<8;    /* fall through */
-               case 5 : b+=k8[4];                   /* fall through */
-               case 4 : a+=k[0]; break;
-               case 3 : a+=((uint32_t)k8[2])<<16;   /* fall through */
-               case 2 : a+=((uint32_t)k8[1])<<8;    /* fall through */
-               case 1 : a+=k8[0]; break;
-               case 0 : return c;
+               case 12:
+                       c += k[2];
+                       b += k[1];
+                       a += k[0];
+                       break;
+               case 11:
+                       c += ((uint32_t) k8[10]) << 16; /* fall through */
+               case 10:
+                       c += ((uint32_t) k8[9]) << 8; /* fall through */
+               case 9:
+                       c += k8[8]; /* fall through */
+               case 8:
+                       b += k[1];
+                       a += k[0];
+                       break;
+               case 7:
+                       b += ((uint32_t) k8[6]) << 16; /* fall through */
+               case 6:
+                       b += ((uint32_t) k8[5]) << 8; /* fall through */
+               case 5:
+                       b += k8[4]; /* fall through */
+               case 4:
+                       a += k[0];
+                       break;
+               case 3:
+                       a += ((uint32_t) k8[2]) << 16; /* fall through */
+               case 2:
+                       a += ((uint32_t) k8[1]) << 8; /* fall through */
+               case 1:
+                       a += k8[0];
+                       break;
+               case 0:
+                       return c;
                }
 #endif /* !valgrind */
        } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) {
-               const uint16_t *k = (const uint16_t *)key;         /* read 16-bit chunks */
+               const uint16_t *k = (const uint16_t *) key; /* read 16-bit chunks */
                const uint8_t *k8;
 
                /*--------------- all but last block: aligned reads and different mixing */
                while (length > 12) {
-                       a += k[0] + (((uint32_t)k[1])<<16);
-                       b += k[2] + (((uint32_t)k[3])<<16);
-                       c += k[4] + (((uint32_t)k[5])<<16);
-                       mix(a,b,c);
+                       a += k[0] + (((uint32_t) k[1]) << 16);
+                       b += k[2] + (((uint32_t) k[3]) << 16);
+                       c += k[4] + (((uint32_t) k[5]) << 16);
+                       mix(a, b, c);
                        length -= 12;
                        k += 6;
                }
 
-               k8 = (const uint8_t *)k;
+               k8 = (const uint8_t *) k;
                switch (length) {
                case 12:
-                       c+=k[4]+(((uint32_t)k[5])<<16);
-                       b+=k[2]+(((uint32_t)k[3])<<16);
-                       a+=k[0]+(((uint32_t)k[1])<<16);
+                       c += k[4] + (((uint32_t) k[5]) << 16);
+                       b += k[2] + (((uint32_t) k[3]) << 16);
+                       a += k[0] + (((uint32_t) k[1]) << 16);
                        break;
                case 11:
-                       c+=((uint32_t)k8[10])<<16;     /* fall through */
+                       c += ((uint32_t) k8[10]) << 16; /* fall through */
                case 10:
-                       c+=k[4];
-                       b+=k[2]+(((uint32_t)k[3])<<16);
-                       a+=k[0]+(((uint32_t)k[1])<<16);
+                       c += k[4];
+                       b += k[2] + (((uint32_t) k[3]) << 16);
+                       a += k[0] + (((uint32_t) k[1]) << 16);
                        break;
                case 9:
-                       c+=k8[8];                      /* fall through */
+                       c += k8[8]; /* fall through */
                case 8:
-                       b+=k[2]+(((uint32_t)k[3])<<16);
-                       a+=k[0]+(((uint32_t)k[1])<<16);
+                       b += k[2] + (((uint32_t) k[3]) << 16);
+                       a += k[0] + (((uint32_t) k[1]) << 16);
                        break;
                case 7:
-                       b+=((uint32_t)k8[6])<<16;      /* fall through */
+                       b += ((uint32_t) k8[6]) << 16; /* fall through */
                case 6:
-                       b+=k[2];
-                       a+=k[0]+(((uint32_t)k[1])<<16);
+                       b += k[2];
+                       a += k[0] + (((uint32_t) k[1]) << 16);
                        break;
                case 5:
-                       b+=k8[4];                      /* fall through */
+                       b += k8[4]; /* fall through */
                case 4:
-                       a+=k[0]+(((uint32_t)k[1])<<16);
+                       a += k[0] + (((uint32_t) k[1]) << 16);
                        break;
                case 3:
-                       a+=((uint32_t)k8[2])<<16;      /* fall through */
+                       a += ((uint32_t) k8[2]) << 16; /* fall through */
                case 2:
-                       a+=k[0];
+                       a += k[0];
                        break;
                case 1:
-                       a+=k8[0];
+                       a += k8[0];
                        break;
                case 0:
-                       return c;   /* zero length requires no mixing */
+                       return c; /* zero length requires no mixing */
                }
 
-       } else {    /* need to read the key one byte at a time */
-               const uint8_t *k = (const uint8_t *)key;
+       } else { /* need to read the key one byte at a time */
+               const uint8_t *k = (const uint8_t *) key;
 
                while (length > 12) {
                        a += k[0];
-                       a += ((uint32_t)k[1])<<8;
-                       a += ((uint32_t)k[2])<<16;
-                       a += ((uint32_t)k[3])<<24;
+                       a += ((uint32_t) k[1]) << 8;
+                       a += ((uint32_t) k[2]) << 16;
+                       a += ((uint32_t) k[3]) << 24;
                        b += k[4];
-                       b += ((uint32_t)k[5])<<8;
-                       b += ((uint32_t)k[6])<<16;
-                       b += ((uint32_t)k[7])<<24;
+                       b += ((uint32_t) k[5]) << 8;
+                       b += ((uint32_t) k[6]) << 16;
+                       b += ((uint32_t) k[7]) << 24;
                        c += k[8];
-                       c += ((uint32_t)k[9])<<8;
-                       c += ((uint32_t)k[10])<<16;
-                       c += ((uint32_t)k[11])<<24;
-                       mix(a,b,c);
+                       c += ((uint32_t) k[9]) << 8;
+                       c += ((uint32_t) k[10]) << 16;
+                       c += ((uint32_t) k[11]) << 24;
+                       mix(a, b, c);
                        length -= 12;
                        k += 12;
                }
 
-               switch(length) {                  /* all the case statements fall through */
-               case 12: c+=((uint32_t)k[11])<<24; /* fall through */
-               case 11: c+=((uint32_t)k[10])<<16; /* fall through */
-               case 10: c+=((uint32_t)k[9])<<8; /* fall through */
-               case 9: c+=k[8]; /* fall through */
-               case 8: b+=((uint32_t)k[7])<<24; /* fall through */
-               case 7: b+=((uint32_t)k[6])<<16; /* fall through */
-               case 6: b+=((uint32_t)k[5])<<8; /* fall through */
-               case 5: b+=k[4]; /* fall through */
-               case 4: a+=((uint32_t)k[3])<<24; /* fall through */
-               case 3: a+=((uint32_t)k[2])<<16; /* fall through */
-               case 2: a+=((uint32_t)k[1])<<8; /* fall through */
+               switch (length) { /* all the case statements fall through */
+               case 12:
+                       c += ((uint32_t) k[11]) << 24; /* fall through */
+               case 11:
+                       c += ((uint32_t) k[10]) << 16; /* fall through */
+               case 10:
+                       c += ((uint32_t) k[9]) << 8; /* fall through */
+               case 9:
+                       c += k[8]; /* fall through */
+               case 8:
+                       b += ((uint32_t) k[7]) << 24; /* fall through */
+               case 7:
+                       b += ((uint32_t) k[6]) << 16; /* fall through */
+               case 6:
+                       b += ((uint32_t) k[5]) << 8; /* fall through */
+               case 5:
+                       b += k[4]; /* fall through */
+               case 4:
+                       a += ((uint32_t) k[3]) << 24; /* fall through */
+               case 3:
+                       a += ((uint32_t) k[2]) << 16; /* fall through */
+               case 2:
+                       a += ((uint32_t) k[1]) << 8; /* fall through */
                case 1:
-                       a+=k[0];
+                       a += k[0];
                        break;
                case 0:
                        return c;
                }
        }
 
-       final(a,b,c);
+       final(a, b, c);
        return c;
 }
 
@@ -495,8 +580,7 @@ unsigned long hash_key_str(const void *key, unsigned long seed)
  */
 unsigned long hash_key_two_u64(const void *key, unsigned long seed)
 {
-       const struct lttng_ht_two_u64 *k =
-               (const struct lttng_ht_two_u64 *) key;
+       const struct lttng_ht_two_u64 *k = (const struct lttng_ht_two_u64 *) key;
 
        return hash_key_u64(&k->key1, seed) ^ hash_key_u64(&k->key2, seed);
 }
@@ -542,13 +626,10 @@ int hash_match_key_str(const void *key1, const void *key2)
  */
 int hash_match_key_two_u64(const void *key1, const void *key2)
 {
-       const struct lttng_ht_two_u64 *k1 =
-               (const struct lttng_ht_two_u64 *) key1;
-       const struct lttng_ht_two_u64 *k2 =
-               (const struct lttng_ht_two_u64 *) key2;
+       const struct lttng_ht_two_u64 *k1 = (const struct lttng_ht_two_u64 *) key1;
+       const struct lttng_ht_two_u64 *k2 = (const struct lttng_ht_two_u64 *) key2;
 
-       if (hash_match_key_u64(&k1->key1, &k2->key1) &&
-                       hash_match_key_u64(&k1->key2, &k2->key2)) {
+       if (hash_match_key_u64(&k1->key1, &k2->key1) && hash_match_key_u64(&k1->key2, &k2->key2)) {
                return 1;
        }
 
index 8181eab931c07aa0c131c8157ce85a6584f8d11c..7682131e760e5aa53ad5bd7dd99ee1168214a031 100644 (file)
@@ -7,12 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <algorithm>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-
 #include <common/defaults.hpp>
 #include <common/error.hpp>
 #include <common/macros.hpp>
 
 #include <lttng/health-internal.hpp>
 
+#include <algorithm>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
 /*
  * An application-specific error state for unregistered thread keeps
  * track of thread errors. A thread reporting a health error, normally
@@ -49,18 +49,15 @@ DEFINE_URCU_TLS(struct health_state, health_state);
 /*
  * Initialize health check subsytem.
  */
-static
-void health_init(struct health_app *ha)
+static void health_init(struct health_app *ha)
 {
        /*
         * Get the maximum value between the default delta value and the TCP
         * timeout with a safety net of the default health check delta.
         */
        ha->time_delta.tv_sec = std::max<unsigned long>(
-                       lttcomm_inet_tcp_timeout + DEFAULT_HEALTH_CHECK_DELTA_S,
-                       ha->time_delta.tv_sec);
-       DBG("Health check time delta in seconds set to %lu",
-                       ha->time_delta.tv_sec);
+               lttcomm_inet_tcp_timeout + DEFAULT_HEALTH_CHECK_DELTA_S, ha->time_delta.tv_sec);
+       DBG("Health check time delta in seconds set to %lu", ha->time_delta.tv_sec);
 }
 
 struct health_app *health_app_create(int nr_types)
@@ -113,8 +110,8 @@ static void state_unlock(struct health_app *ha)
 /*
  * Set time difference in res from time_a and time_b.
  */
-static void time_diff(const struct timespec *time_a,
-               const struct timespec *time_b, struct timespec *res)
+static void
+time_diff(const struct timespec *time_a, const struct timespec *time_b, struct timespec *res)
 {
        if (time_a->tv_nsec - time_b->tv_nsec < 0) {
                res->tv_sec = time_a->tv_sec - time_b->tv_sec - 1;
@@ -129,7 +126,8 @@ static void time_diff(const struct timespec *time_a,
  * Return true if time_a - time_b > diff, else false.
  */
 static int time_diff_gt(const struct timespec *time_a,
-               const struct timespec *time_b, const struct timespec *diff)
+                       const struct timespec *time_b,
+                       const struct timespec *diff)
 {
        struct timespec res;
 
@@ -189,8 +187,7 @@ static int validate_state(struct health_app *ha, struct health_state *state)
                state->last = current;
                memcpy(&state->last_time, &current_time, sizeof(current_time));
        } else {
-               if (time_diff_gt(&current_time, &state->last_time,
-                               &ha->time_delta)) {
+               if (time_diff_gt(&current_time, &state->last_time, &ha->time_delta)) {
                        if (current == last && !HEALTH_IS_IN_POLL(current)) {
                                /* error */
                                retval = 0;
@@ -207,8 +204,7 @@ static int validate_state(struct health_app *ha, struct health_state *state)
        }
 
 end:
-       DBG("Health state current %lu, last %lu, ret %d",
-                       current, last, ret);
+       DBG("Health state current %lu, last %lu, ret %d", current, last, ret);
        return retval;
 }
 
@@ -228,7 +224,7 @@ int health_check_state(struct health_app *ha, int type)
 
        state_lock(ha);
 
-       cds_list_for_each_entry(state, &ha->list, node) {
+       cds_list_for_each_entry (state, &ha->list, node) {
                int ret;
 
                if (state->type != type) {
@@ -250,8 +246,7 @@ int health_check_state(struct health_app *ha, int type)
 end:
        state_unlock(ha);
 
-       DBG("Health check for type %d is %s", (int) type,
-                       (retval == 0) ? "BAD" : "GOOD");
+       DBG("Health check for type %d is %s", (int) type, (retval == 0) ? "BAD" : "GOOD");
        return retval;
 }
 
@@ -287,8 +282,7 @@ void health_unregister(struct health_app *ha)
         * the node from the global list.
         */
        if (uatomic_read(&URCU_TLS(health_state).flags) & HEALTH_ERROR) {
-               uatomic_set(&ha->flags[URCU_TLS(health_state).type],
-                               HEALTH_ERROR);
+               uatomic_set(&ha->flags[URCU_TLS(health_state).type], HEALTH_ERROR);
        }
        cds_list_del(&URCU_TLS(health_state).node);
        state_unlock(ha);
index 32778cd205eae16652af36770d768769db62724f..c4f790ddbd729b4f7284f9bb8987801abb1b9f7f 100644 (file)
@@ -5,16 +5,14 @@
  *
  */
 
-#include <inttypes.h>
+#include "error.hpp"
+#include "index-allocator.hpp"
+#include "macros.hpp"
 
+#include <inttypes.h>
 #include <urcu.h>
 #include <urcu/list.h>
 
-#include "macros.hpp"
-#include "error.hpp"
-
-#include "index-allocator.hpp"
-
 struct lttng_index_allocator {
        struct cds_list_head unused_list;
        uint64_t size;
@@ -29,8 +27,7 @@ struct lttng_index {
 };
 } /* namespace */
 
-struct lttng_index_allocator *lttng_index_allocator_create(
-               uint64_t index_count)
+struct lttng_index_allocator *lttng_index_allocator_create(uint64_t index_count)
 {
        struct lttng_index_allocator *allocator = NULL;
 
@@ -55,12 +52,10 @@ uint64_t lttng_index_allocator_get_index_count(struct lttng_index_allocator *all
        return allocator->nb_allocated_indexes;
 }
 
-enum lttng_index_allocator_status lttng_index_allocator_alloc(
-               struct lttng_index_allocator *allocator,
-               uint64_t *allocated_index)
+enum lttng_index_allocator_status
+lttng_index_allocator_alloc(struct lttng_index_allocator *allocator, uint64_t *allocated_index)
 {
-       enum lttng_index_allocator_status status =
-                       LTTNG_INDEX_ALLOCATOR_STATUS_OK;
+       enum lttng_index_allocator_status status = LTTNG_INDEX_ALLOCATOR_STATUS_OK;
 
        if (cds_list_empty(&allocator->unused_list)) {
                if (allocator->position >= allocator->size) {
@@ -73,8 +68,7 @@ enum lttng_index_allocator_status lttng_index_allocator_alloc(
        } else {
                struct lttng_index *index;
 
-               index = cds_list_first_entry(&allocator->unused_list,
-                               typeof(*index), head);
+               index = cds_list_first_entry(&allocator->unused_list, typeof(*index), head);
                cds_list_del(&index->head);
                *allocated_index = index->index;
                free(index);
@@ -85,12 +79,11 @@ end:
        return status;
 }
 
-enum lttng_index_allocator_status lttng_index_allocator_release(
-               struct lttng_index_allocator *allocator, uint64_t idx)
+enum lttng_index_allocator_status
+lttng_index_allocator_release(struct lttng_index_allocator *allocator, uint64_t idx)
 {
        struct lttng_index *index = NULL;
-       enum lttng_index_allocator_status status =
-                       LTTNG_INDEX_ALLOCATOR_STATUS_OK;
+       enum lttng_index_allocator_status status = LTTNG_INDEX_ALLOCATOR_STATUS_OK;
 
        LTTNG_ASSERT(idx < allocator->size);
 
@@ -118,13 +111,11 @@ void lttng_index_allocator_destroy(struct lttng_index_allocator *allocator)
        }
 
        if (lttng_index_allocator_get_index_count(allocator) > 0) {
-               WARN("Destroying index allocator with %" PRIu64
-                               " slot indexes still in use",
-                               lttng_index_allocator_get_index_count(allocator));
+               WARN("Destroying index allocator with %" PRIu64 " slot indexes still in use",
+                    lttng_index_allocator_get_index_count(allocator));
        }
 
-       cds_list_for_each_entry_safe(index, tmp_index,
-                       &allocator->unused_list, head) {
+       cds_list_for_each_entry_safe (index, tmp_index, &allocator->unused_list, head) {
                cds_list_del(&index->head);
                free(index);
        }
index de66ac4bdd3088427fccd5d9a00f0adc5a4a4da9..b1c828303ab8ae05f5d3e01ec952a4260f5be20f 100644 (file)
@@ -8,28 +8,34 @@
  */
 
 #define _LGPL_SOURCE
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
+#include "index.hpp"
 
-#include <lttng/constant.h>
 #include <common/common.hpp>
-#include <common/defaults.hpp>
 #include <common/compat/endian.hpp>
+#include <common/defaults.hpp>
 #include <common/utils.hpp>
 
-#include "index.hpp"
+#include <lttng/constant.h>
 
-#define WRITE_FILE_FLAGS       (O_WRONLY | O_CREAT | O_TRUNC)
-#define READ_ONLY_FILE_FLAGS   O_RDONLY
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#define WRITE_FILE_FLAGS     (O_WRONLY | O_CREAT | O_TRUNC)
+#define READ_ONLY_FILE_FLAGS O_RDONLY
 
-static enum lttng_trace_chunk_status _lttng_index_file_create_from_trace_chunk(
-               struct lttng_trace_chunk *chunk,
-               const char *channel_path, const char *stream_name,
-               uint64_t stream_file_size, uint64_t stream_file_index,
-               uint32_t index_major, uint32_t index_minor,
-               bool unlink_existing_file,
-               int flags, bool expect_no_file, struct lttng_index_file **file)
+static enum lttng_trace_chunk_status
+_lttng_index_file_create_from_trace_chunk(struct lttng_trace_chunk *chunk,
+                                         const char *channel_path,
+                                         const char *stream_name,
+                                         uint64_t stream_file_size,
+                                         uint64_t stream_file_index,
+                                         uint32_t index_major,
+                                         uint32_t index_minor,
+                                         bool unlink_existing_file,
+                                         int flags,
+                                         bool expect_no_file,
+                                         struct lttng_index_file **file)
 {
        struct lttng_index_file *index_file;
        enum lttng_trace_chunk_status chunk_status;
@@ -58,18 +64,24 @@ static enum lttng_trace_chunk_status _lttng_index_file_create_from_trace_chunk(
        } else {
                separator = "/";
        }
-       ret = snprintf(index_directory_path, sizeof(index_directory_path),
-                       "%s%s" DEFAULT_INDEX_DIR, channel_path, separator);
+       ret = snprintf(index_directory_path,
+                      sizeof(index_directory_path),
+                      "%s%s" DEFAULT_INDEX_DIR,
+                      channel_path,
+                      separator);
        if (ret < 0 || ret >= sizeof(index_directory_path)) {
                ERR("Failed to format index directory path");
                chunk_status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto error;
        }
 
-       ret = utils_stream_file_path(index_directory_path, stream_name,
-                       stream_file_size, stream_file_index,
-                       DEFAULT_INDEX_FILE_SUFFIX,
-                       index_file_path, sizeof(index_file_path));
+       ret = utils_stream_file_path(index_directory_path,
+                                    stream_name,
+                                    stream_file_size,
+                                    stream_file_index,
+                                    DEFAULT_INDEX_FILE_SUFFIX,
+                                    index_file_path,
+                                    sizeof(index_file_path));
        if (ret) {
                chunk_status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto error;
@@ -85,16 +97,15 @@ static enum lttng_trace_chunk_status _lttng_index_file_create_from_trace_chunk(
                 * same name afterwards.
                 */
                chunk_status = (lttng_trace_chunk_status) lttng_trace_chunk_unlink_file(
-                               chunk, index_file_path);
+                       chunk, index_file_path);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK &&
-                               !(chunk_status == LTTNG_TRACE_CHUNK_STATUS_ERROR &&
-                                               errno == ENOENT)) {
+                   !(chunk_status == LTTNG_TRACE_CHUNK_STATUS_ERROR && errno == ENOENT)) {
                        goto error;
                }
        }
 
-       chunk_status = lttng_trace_chunk_open_fs_handle(chunk, index_file_path,
-                       flags, mode, &fs_handle, expect_no_file);
+       chunk_status = lttng_trace_chunk_open_fs_handle(
+               chunk, index_file_path, flags, mode, &fs_handle, expect_no_file);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                goto error;
        }
@@ -124,13 +135,15 @@ static enum lttng_trace_chunk_status _lttng_index_file_create_from_trace_chunk(
                }
                if (index_major != be32toh(hdr.index_major)) {
                        ERR("Index major number mismatch: %u, expect %u",
-                               be32toh(hdr.index_major), index_major);
+                           be32toh(hdr.index_major),
+                           index_major);
                        chunk_status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                        goto error;
                }
                if (index_minor != be32toh(hdr.index_minor)) {
                        ERR("Index minor number mismatch: %u, expect %u",
-                               be32toh(hdr.index_minor), index_minor);
+                           be32toh(hdr.index_minor),
+                           index_minor);
                        chunk_status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                        goto error;
                }
@@ -162,30 +175,52 @@ error:
        return chunk_status;
 }
 
-enum lttng_trace_chunk_status lttng_index_file_create_from_trace_chunk(
-               struct lttng_trace_chunk *chunk,
-               const char *channel_path, const char *stream_name,
-               uint64_t stream_file_size, uint64_t stream_file_index,
-               uint32_t index_major, uint32_t index_minor,
-               bool unlink_existing_file, struct lttng_index_file **file)
+enum lttng_trace_chunk_status
+lttng_index_file_create_from_trace_chunk(struct lttng_trace_chunk *chunk,
+                                        const char *channel_path,
+                                        const char *stream_name,
+                                        uint64_t stream_file_size,
+                                        uint64_t stream_file_index,
+                                        uint32_t index_major,
+                                        uint32_t index_minor,
+                                        bool unlink_existing_file,
+                                        struct lttng_index_file **file)
 {
-       return _lttng_index_file_create_from_trace_chunk(chunk, channel_path,
-                       stream_name, stream_file_size, stream_file_index,
-                       index_major, index_minor, unlink_existing_file,
-                       WRITE_FILE_FLAGS, false, file);
+       return _lttng_index_file_create_from_trace_chunk(chunk,
+                                                        channel_path,
+                                                        stream_name,
+                                                        stream_file_size,
+                                                        stream_file_index,
+                                                        index_major,
+                                                        index_minor,
+                                                        unlink_existing_file,
+                                                        WRITE_FILE_FLAGS,
+                                                        false,
+                                                        file);
 }
 
-enum lttng_trace_chunk_status lttng_index_file_create_from_trace_chunk_read_only(
-               struct lttng_trace_chunk *chunk,
-               const char *channel_path, const char *stream_name,
-               uint64_t stream_file_size, uint64_t stream_file_index,
-               uint32_t index_major, uint32_t index_minor,
-               bool expect_no_file, struct lttng_index_file **file)
+enum lttng_trace_chunk_status
+lttng_index_file_create_from_trace_chunk_read_only(struct lttng_trace_chunk *chunk,
+                                                  const char *channel_path,
+                                                  const char *stream_name,
+                                                  uint64_t stream_file_size,
+                                                  uint64_t stream_file_index,
+                                                  uint32_t index_major,
+                                                  uint32_t index_minor,
+                                                  bool expect_no_file,
+                                                  struct lttng_index_file **file)
 {
-       return _lttng_index_file_create_from_trace_chunk(chunk, channel_path,
-                       stream_name, stream_file_size, stream_file_index,
-                       index_major, index_minor, false,
-                       READ_ONLY_FILE_FLAGS, expect_no_file, file);
+       return _lttng_index_file_create_from_trace_chunk(chunk,
+                                                        channel_path,
+                                                        stream_name,
+                                                        stream_file_size,
+                                                        stream_file_index,
+                                                        index_major,
+                                                        index_minor,
+                                                        false,
+                                                        READ_ONLY_FILE_FLAGS,
+                                                        expect_no_file,
+                                                        file);
 }
 
 /*
@@ -194,10 +229,11 @@ enum lttng_trace_chunk_status lttng_index_file_create_from_trace_chunk_read_only
  * Return 0 on success, -1 on error.
  */
 int lttng_index_file_write(const struct lttng_index_file *index_file,
-               const struct ctf_packet_index *element)
+                          const struct ctf_packet_index *element)
 {
        ssize_t ret;
-       const size_t len = index_file->element_len;;
+       const size_t len = index_file->element_len;
+       ;
 
        LTTNG_ASSERT(index_file);
        LTTNG_ASSERT(element);
@@ -223,7 +259,7 @@ error:
  * Return 0 on success, -1 on error.
  */
 int lttng_index_file_read(const struct lttng_index_file *index_file,
-               struct ctf_packet_index *element)
+                         struct ctf_packet_index *element)
 {
        ssize_t ret;
        const size_t len = index_file->element_len;
@@ -256,8 +292,7 @@ void lttng_index_file_get(struct lttng_index_file *index_file)
 
 static void lttng_index_file_release(struct urcu_ref *ref)
 {
-       struct lttng_index_file *index_file = caa_container_of(ref,
-                       struct lttng_index_file, ref);
+       struct lttng_index_file *index_file = caa_container_of(ref, struct lttng_index_file, ref);
 
        if (fs_handle_close(index_file->file)) {
                PERROR("close index fd");
index da204d988c0aa9557979f550080b72384d0d1c28..a9b65960b591081bd29e3bf333927c3b5b3f5559 100644 (file)
@@ -12,6 +12,7 @@
 #include <common/ini-config/ini.hpp>
 #include <common/macros.hpp>
 #include <common/utils.hpp>
+
 #include <ctype.h>
 
 LTTNG_EXPORT const char *config_str_yes = "yes";
@@ -23,14 +24,16 @@ LTTNG_EXPORT const char *config_str_off = "off";
 
 namespace {
 struct handler_filter_args {
-       const charsection;
+       const char *section;
        config_entry_handler_cb handler;
        void *user_data;
 };
 } /* namespace */
 
 static int config_entry_handler_filter(struct handler_filter_args *args,
-               const char *section, const char *name, const char *value)
+                                      const char *section,
+                                      const char *name,
+                                      const char *value)
 {
        int ret = 0;
        struct config_entry entry = { section, name, value };
@@ -53,8 +56,10 @@ end:
        return ret;
 }
 
-int config_get_section_entries(const char *override_path, const char *section,
-               config_entry_handler_cb handler, void *user_data)
+int config_get_section_entries(const char *override_path,
+                              const char *section,
+                              config_entry_handler_cb handler,
+                              void *user_data)
 {
        int ret = 0;
        const char *path;
@@ -72,8 +77,8 @@ int config_get_section_entries(const char *override_path, const char *section,
                 * continue and try the next possible conf. file.
                 */
                (void) ini_parse_file(config_file,
-                               (ini_entry_handler) config_entry_handler_filter,
-                               (void *) &filter);
+                                     (ini_entry_handler) config_entry_handler_filter,
+                                     (void *) &filter);
                fclose(config_file);
        }
 
@@ -82,8 +87,7 @@ int config_get_section_entries(const char *override_path, const char *section,
        if (path) {
                char fullpath[PATH_MAX];
 
-               ret = snprintf(fullpath, sizeof(fullpath),
-                               DEFAULT_DAEMON_HOME_CONFIGPATH, path);
+               ret = snprintf(fullpath, sizeof(fullpath), DEFAULT_DAEMON_HOME_CONFIGPATH, path);
                if (ret < 0) {
                        PERROR("snprintf user conf. path");
                        goto error;
@@ -97,8 +101,8 @@ int config_get_section_entries(const char *override_path, const char *section,
                         * continue and try the next possible conf. file.
                         */
                        (void) ini_parse_file(config_file,
-                                       (ini_entry_handler) config_entry_handler_filter,
-                                       (void *) &filter);
+                                             (ini_entry_handler) config_entry_handler_filter,
+                                             (void *) &filter);
                        fclose(config_file);
                }
        }
@@ -109,12 +113,11 @@ int config_get_section_entries(const char *override_path, const char *section,
                if (config_file) {
                        DBG("Loading daemon command line conf file at %s", override_path);
                        (void) ini_parse_file(config_file,
-                                       (ini_entry_handler) config_entry_handler_filter,
-                                       (void *) &filter);
+                                             (ini_entry_handler) config_entry_handler_filter,
+                                             (void *) &filter);
                        fclose(config_file);
                } else {
-                       ERR("Failed to open daemon configuration file at %s",
-                               override_path);
+                       ERR("Failed to open daemon configuration file at %s", override_path);
                        ret = -ENOENT;
                        goto error;
                }
@@ -157,13 +160,11 @@ int config_parse_value(const char *value)
                lower_str[i] = tolower(value[i]);
        }
 
-       if (!strcmp(lower_str, config_str_yes) ||
-               !strcmp(lower_str, config_str_true) ||
-               !strcmp(lower_str, config_str_on)) {
+       if (!strcmp(lower_str, config_str_yes) || !strcmp(lower_str, config_str_true) ||
+           !strcmp(lower_str, config_str_on)) {
                ret = 1;
-       } else if (!strcmp(lower_str, config_str_no) ||
-               !strcmp(lower_str, config_str_false) ||
-               !strcmp(lower_str, config_str_off)) {
+       } else if (!strcmp(lower_str, config_str_no) || !strcmp(lower_str, config_str_false) ||
+                  !strcmp(lower_str, config_str_off)) {
                ret = 0;
        } else {
                ret = -1;
index ec5a41119e87c17f66b47d3656909ed670c11ea4..978b185fac98073f6e5beccdb952822cc301d183 100644 (file)
  * http://code.google.com/p/inih/
  */
 
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
+#include "ini.hpp"
+
 #include <common/common.hpp>
 
-#include "ini.hpp"
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
 
 #if !INI_USE_STACK
 #include <stdlib.h>
 #endif
 
 #define MAX_SECTION 50
-#define MAX_NAME 50
+#define MAX_NAME    50
 
 /* Strip whitespace chars off end of given string, in place. Return s. */
-static char* rstrip(char* s)
+static char *rstrip(char *s)
 {
-       charp = s + strlen(s);
+       char *p = s + strlen(s);
 
-       while (p > s && isspace((unsigned char)(*--p)))
+       while (p > s && isspace((unsigned char) (*--p)))
                *p = '\0';
        return s;
 }
 
 /* Return pointer to first non-whitespace char in given string. */
-static char* lskip(const char* s)
+static char *lskip(const char *s)
 {
-       while (*s && isspace((unsigned char)(*s)))
+       while (*s && isspace((unsigned char) (*s)))
                s++;
-       return (char*)s;
+       return (char *) s;
 }
 
 /*
@@ -70,19 +71,19 @@ static char* lskip(const char* s)
  * null at end of string if neither found. ';' must be prefixed by a whitespace
  * character to register as a comment.
  */
-static char* find_char_or_comment(const char* s, char c)
+static char *find_char_or_comment(const char *s, char c)
 {
        int was_whitespace = 0;
 
        while (*s && *s != c && !(was_whitespace && *s == ';')) {
-               was_whitespace = isspace((unsigned char)(*s));
+               was_whitespace = isspace((unsigned char) (*s));
                s++;
        }
-       return (char*)s;
+       return (char *) s;
 }
 
 /* Version of strncpy that ensures dest (size bytes) is null-terminated. */
-static char* strncpy0(char* dest, const char* src, size_t size)
+static char *strncpy0(char *dest, const char *src, size_t size)
 {
        strncpy(dest, src, size - 1);
        dest[size - 1] = '\0';
@@ -90,21 +91,21 @@ static char* strncpy0(char* dest, const char* src, size_t size)
 }
 
 /* See documentation in header file. */
-int ini_parse_file(FILE* file, ini_entry_handler handler, void* user)
+int ini_parse_file(FILE *file, ini_entry_handler handler, void *user)
 {
        /* Uses a fair bit of stack (use heap instead if you need to) */
 #if INI_USE_STACK
        char line[INI_MAX_LINE];
 #else
-       charline;
+       char *line;
 #endif
        char section[MAX_SECTION] = "";
        char prev_name[MAX_NAME] = "";
 
-       charstart;
-       charend;
-       charname;
-       charvalue;
+       char *start;
+       char *end;
+       char *name;
+       char *value;
        int lineno = 0;
        int error = 0;
 
@@ -121,9 +122,8 @@ int ini_parse_file(FILE* file, ini_entry_handler handler, void* user)
 
                start = line;
 #if INI_ALLOW_BOM
-               if (lineno == 1 && (unsigned char)start[0] == 0xEF &&
-                       (unsigned char)start[1] == 0xBB &&
-                       (unsigned char)start[2] == 0xBF) {
+               if (lineno == 1 && (unsigned char) start[0] == 0xEF &&
+                   (unsigned char) start[1] == 0xBB && (unsigned char) start[2] == 0xBF) {
                        start += 3;
                }
 #endif
@@ -141,8 +141,7 @@ int ini_parse_file(FILE* file, ini_entry_handler handler, void* user)
                         * continuation of previous name's value
                         * (as per Python ConfigParser).
                         */
-                       if (handler(user, section, prev_name, start) < 0 &&
-                               !error) {
+                       if (handler(user, section, prev_name, start) < 0 && !error) {
                                error = lineno;
                        }
                }
@@ -154,13 +153,11 @@ int ini_parse_file(FILE* file, ini_entry_handler handler, void* user)
                                *end = '\0';
                                strncpy0(section, start + 1, sizeof(section));
                                *prev_name = '\0';
-                       }
-                       else if (!error) {
+                       } else if (!error) {
                                /* No ']' found on section line */
                                error = lineno;
                        }
-               }
-               else if (*start && *start != ';') {
+               } else if (*start && *start != ';') {
                        /* Not a comment, must be a name[=:]value pair */
                        end = find_char_or_comment(start, '=');
                        if (*end != '=') {
@@ -182,12 +179,10 @@ int ini_parse_file(FILE* file, ini_entry_handler handler, void* user)
                                 * handler
                                 */
                                strncpy0(prev_name, name, sizeof(prev_name));
-                               if (handler(user, section, name, value) < 0 &&
-                                       !error) {
+                               if (handler(user, section, name, value) < 0 && !error) {
                                        error = lineno;
                                }
-                       }
-                       else if (!error) {
+                       } else if (!error) {
                                /* No '=' or ':' found on name[=:]value line */
                                error = lineno;
                        }
@@ -202,9 +197,9 @@ int ini_parse_file(FILE* file, ini_entry_handler handler, void* user)
 }
 
 /* See documentation in header file. */
-int ini_parse(const char* filename, ini_entry_handler handler, void* user)
+int ini_parse(const char *filename, ini_entry_handler handler, void *user)
 {
-       FILEfile;
+       FILE *file;
        int error;
 
        file = fopen(filename, "r");
index ce1d3d8293463898d09b1d9f12eeab018dbbbf9e..c40f3b6947ed72f3f4ae735022e3d3994398b770 100644 (file)
@@ -8,37 +8,37 @@
  */
 
 #define _LGPL_SOURCE
-#include <poll.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <stdint.h>
+#include "kernel-consumer.hpp"
 
-#include <bin/lttng-consumerd/health-consumerd.hpp>
+#include <common/buffer-view.hpp>
 #include <common/common.hpp>
-#include <common/kernel-ctl/kernel-ctl.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/sessiond-comm/relayd.hpp>
-#include <common/compat/fcntl.hpp>
 #include <common/compat/endian.hpp>
-#include <common/pipe.hpp>
-#include <common/relayd/relayd.hpp>
-#include <common/utils.hpp>
+#include <common/compat/fcntl.hpp>
 #include <common/consumer/consumer-stream.hpp>
-#include <common/index/index.hpp>
 #include <common/consumer/consumer-timer.hpp>
-#include <common/optional.hpp>
-#include <common/buffer-view.hpp>
 #include <common/consumer/consumer.hpp>
 #include <common/consumer/metadata-bucket.hpp>
+#include <common/index/index.hpp>
+#include <common/kernel-ctl/kernel-ctl.hpp>
+#include <common/optional.hpp>
+#include <common/pipe.hpp>
+#include <common/relayd/relayd.hpp>
+#include <common/sessiond-comm/relayd.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/utils.hpp>
 
-#include "kernel-consumer.hpp"
+#include <bin/lttng-consumerd/health-consumerd.hpp>
+#include <inttypes.h>
+#include <poll.h>
+#include <pthread.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 extern struct lttng_consumer_global_data the_consumer_data;
 extern int consumer_poll_timeout;
@@ -70,8 +70,7 @@ int lttng_kconsumer_take_snapshot(struct lttng_consumer_stream *stream)
  *
  * Returns 0 on success, < 0 on error.
  */
-int lttng_kconsumer_sample_snapshot_positions(
-               struct lttng_consumer_stream *stream)
+int lttng_kconsumer_sample_snapshot_positions(struct lttng_consumer_stream *stream)
 {
        LTTNG_ASSERT(stream);
 
@@ -83,8 +82,7 @@ int lttng_kconsumer_sample_snapshot_positions(
  *
  * Returns 0 on success, < 0 on error
  */
-int lttng_kconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream,
-               unsigned long *pos)
+int lttng_kconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos)
 {
        int ret;
        int infd = stream->wait_fd;
@@ -102,8 +100,7 @@ int lttng_kconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream,
  *
  * Returns 0 on success, < 0 on error
  */
-int lttng_kconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream,
-               unsigned long *pos)
+int lttng_kconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos)
 {
        int ret;
        int infd = stream->wait_fd;
@@ -116,9 +113,7 @@ int lttng_kconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream,
        return ret;
 }
 
-static
-int get_current_subbuf_addr(struct lttng_consumer_stream *stream,
-               const char **addr)
+static int get_current_subbuf_addr(struct lttng_consumer_stream *stream, const char **addr)
 {
        int ret;
        unsigned long mmap_offset;
@@ -142,10 +137,11 @@ error:
  *
  * Returns 0 on success, < 0 on error
  */
-static int lttng_kconsumer_snapshot_channel(
-               struct lttng_consumer_channel *channel,
-               uint64_t key, char *path, uint64_t relayd_id,
-               uint64_t nb_packets_per_stream)
+static int lttng_kconsumer_snapshot_channel(struct lttng_consumer_channel *channel,
+                                           uint64_t key,
+                                           char *path,
+                                           uint64_t relayd_id,
+                                           uint64_t nb_packets_per_stream)
 {
        int ret;
        struct lttng_consumer_stream *stream;
@@ -160,12 +156,12 @@ static int lttng_kconsumer_snapshot_channel(
        /* Splice is not supported yet for channel snapshot. */
        if (channel->output != CONSUMER_CHANNEL_MMAP) {
                ERR("Unsupported output type for channel \"%s\": mmap output is required to record a snapshot",
-                               channel->name);
+                   channel->name);
                ret = -1;
                goto end;
        }
 
-       cds_list_for_each_entry(stream, &channel->streams.head, send_node) {
+       cds_list_for_each_entry (stream, &channel->streams.head, send_node) {
                unsigned long consumed_pos, produced_pos;
 
                health_code_update();
@@ -201,13 +197,11 @@ static int lttng_kconsumer_snapshot_channel(
                                goto error_close_stream_output;
                        }
                } else {
-                       ret = consumer_stream_create_output_files(stream,
-                                       false);
+                       ret = consumer_stream_create_output_files(stream, false);
                        if (ret < 0) {
                                goto error_close_stream_output;
                        }
-                       DBG("Kernel consumer snapshot stream (%" PRIu64 ")",
-                                       stream->key);
+                       DBG("Kernel consumer snapshot stream (%" PRIu64 ")", stream->key);
                }
 
                ret = kernctl_buffer_flush_empty(stream->wait_fd);
@@ -245,9 +239,8 @@ static int lttng_kconsumer_snapshot_channel(
                        goto error_close_stream_output;
                }
 
-               consumed_pos = consumer_get_consume_start_pos(consumed_pos,
-                               produced_pos, nb_packets_per_stream,
-                               stream->max_sb_size);
+               consumed_pos = consumer_get_consume_start_pos(
+                       consumed_pos, produced_pos, nb_packets_per_stream, stream->max_sb_size);
 
                while ((long) (consumed_pos - produced_pos) < 0) {
                        ssize_t read_len;
@@ -287,11 +280,9 @@ static int lttng_kconsumer_snapshot_channel(
                                goto error_put_subbuf;
                        }
 
-                       subbuf_view = lttng_buffer_view_init(
-                                       subbuf_addr, 0, padded_len);
+                       subbuf_view = lttng_buffer_view_init(subbuf_addr, 0, padded_len);
                        read_len = lttng_consumer_on_read_subbuffer_mmap(
-                                       stream, &subbuf_view,
-                                       padded_len - len);
+                               stream, &subbuf_view, padded_len - len);
                        /*
                         * We write the padded len in local tracefiles but the data len
                         * when using a relay. Display the error but continue processing
@@ -300,12 +291,14 @@ static int lttng_kconsumer_snapshot_channel(
                        if (relayd_id != (uint64_t) -1ULL) {
                                if (read_len != len) {
                                        ERR("Error sending to the relay (ret: %zd != len: %lu)",
-                                                       read_len, len);
+                                           read_len,
+                                           len);
                                }
                        } else {
                                if (read_len != padded_len) {
                                        ERR("Error writing to tracefile (ret: %zd != len: %lu)",
-                                                       read_len, padded_len);
+                                           read_len,
+                                           padded_len);
                                }
                        }
 
@@ -347,10 +340,11 @@ end:
  *
  * Returns 0 on success, < 0 on error
  */
-static int lttng_kconsumer_snapshot_metadata(
-               struct lttng_consumer_channel *metadata_channel,
-               uint64_t key, char *path, uint64_t relayd_id,
-               struct lttng_consumer_local_data *ctx)
+static int lttng_kconsumer_snapshot_metadata(struct lttng_consumer_channel *metadata_channel,
+                                            uint64_t key,
+                                            char *path,
+                                            uint64_t relayd_id,
+                                            struct lttng_consumer_local_data *ctx)
 {
        int ret, use_relayd = 0;
        ssize_t ret_read;
@@ -358,8 +352,7 @@ static int lttng_kconsumer_snapshot_metadata(
 
        LTTNG_ASSERT(ctx);
 
-       DBG("Kernel consumer snapshot metadata with key %" PRIu64 " at path %s",
-                       key, path);
+       DBG("Kernel consumer snapshot metadata with key %" PRIu64 " at path %s", key, path);
 
        rcu_read_lock();
 
@@ -381,8 +374,7 @@ static int lttng_kconsumer_snapshot_metadata(
                        goto error_snapshot;
                }
        } else {
-               ret = consumer_stream_create_output_files(metadata_stream,
-                               false);
+               ret = consumer_stream_create_output_files(metadata_stream, false);
                if (ret < 0) {
                        goto error_snapshot;
                }
@@ -393,8 +385,7 @@ static int lttng_kconsumer_snapshot_metadata(
 
                ret_read = lttng_consumer_read_subbuffer(metadata_stream, ctx, true);
                if (ret_read < 0) {
-                       ERR("Kernel snapshot reading metadata subbuffer (ret: %zd)",
-                                       ret_read);
+                       ERR("Kernel snapshot reading metadata subbuffer (ret: %zd)", ret_read);
                        ret = ret_read;
                        goto error_snapshot;
                }
@@ -434,7 +425,8 @@ error_snapshot:
  * Return 1 on success else a negative value or 0.
  */
 int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
-               int sock, struct pollfd *consumer_sockpoll)
+                            int sock,
+                            struct pollfd *consumer_sockpoll)
 {
        int ret_func;
        enum lttcomm_return_code ret_code = LTTCOMM_CONSUMERD_SUCCESS;
@@ -448,8 +440,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                ret_recv = lttcomm_recv_unix_sock(sock, &msg, sizeof(msg));
                if (ret_recv != sizeof(msg)) {
                        if (ret_recv > 0) {
-                               lttng_consumer_send_error(ctx,
-                                               LTTCOMM_CONSUMERD_ERROR_RECV_CMD);
+                               lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_ERROR_RECV_CMD);
                                ret_recv = -1;
                        }
                        return ret_recv;
@@ -471,15 +462,20 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        {
                uint32_t major = msg.u.relayd_sock.major;
                uint32_t minor = msg.u.relayd_sock.minor;
-               enum lttcomm_sock_proto protocol = (enum lttcomm_sock_proto)
-                               msg.u.relayd_sock.relayd_socket_protocol;
+               enum lttcomm_sock_proto protocol =
+                       (enum lttcomm_sock_proto) msg.u.relayd_sock.relayd_socket_protocol;
 
                /* Session daemon status message are handled in the following call. */
                consumer_add_relayd_socket(msg.u.relayd_sock.net_index,
-                               msg.u.relayd_sock.type, ctx, sock,
-                               consumer_sockpoll, msg.u.relayd_sock.session_id,
-                               msg.u.relayd_sock.relayd_session_id, major,
-                               minor, protocol);
+                                          msg.u.relayd_sock.type,
+                                          ctx,
+                                          sock,
+                                          consumer_sockpoll,
+                                          msg.u.relayd_sock.session_id,
+                                          msg.u.relayd_sock.relayd_session_id,
+                                          major,
+                                          minor,
+                                          protocol);
                goto end_nosignal;
        }
        case LTTNG_CONSUMER_ADD_CHANNEL:
@@ -500,19 +496,22 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                health_code_update();
 
                DBG("consumer_add_channel %" PRIu64, msg.u.channel.channel_key);
-               new_channel = consumer_allocate_channel(msg.u.channel.channel_key,
-                               msg.u.channel.session_id,
-                               msg.u.channel.chunk_id.is_set ?
-                                               &chunk_id : NULL,
-                               msg.u.channel.pathname,
-                               msg.u.channel.name,
-                               msg.u.channel.relayd_id, msg.u.channel.output,
-                               msg.u.channel.tracefile_size,
-                               msg.u.channel.tracefile_count, 0,
-                               msg.u.channel.monitor,
-                               msg.u.channel.live_timer_interval,
-                               msg.u.channel.is_live,
-                               NULL, NULL);
+               new_channel =
+                       consumer_allocate_channel(msg.u.channel.channel_key,
+                                                 msg.u.channel.session_id,
+                                                 msg.u.channel.chunk_id.is_set ? &chunk_id : NULL,
+                                                 msg.u.channel.pathname,
+                                                 msg.u.channel.name,
+                                                 msg.u.channel.relayd_id,
+                                                 msg.u.channel.output,
+                                                 msg.u.channel.tracefile_size,
+                                                 msg.u.channel.tracefile_count,
+                                                 0,
+                                                 msg.u.channel.monitor,
+                                                 msg.u.channel.live_timer_interval,
+                                                 msg.u.channel.is_live,
+                                                 NULL,
+                                                 NULL);
                if (new_channel == NULL) {
                        lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_OUTFD_ERROR);
                        goto end_nosignal;
@@ -544,28 +543,22 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                health_code_update();
 
                if (ctx->on_recv_channel != NULL) {
-                       int ret_recv_channel =
-                                       ctx->on_recv_channel(new_channel);
+                       int ret_recv_channel = ctx->on_recv_channel(new_channel);
                        if (ret_recv_channel == 0) {
-                               ret_add_channel = consumer_add_channel(
-                                               new_channel, ctx);
+                               ret_add_channel = consumer_add_channel(new_channel, ctx);
                        } else if (ret_recv_channel < 0) {
                                goto end_nosignal;
                        }
                } else {
-                       ret_add_channel =
-                                       consumer_add_channel(new_channel, ctx);
+                       ret_add_channel = consumer_add_channel(new_channel, ctx);
                }
-               if (msg.u.channel.type == CONSUMER_CHANNEL_TYPE_DATA &&
-                               !ret_add_channel) {
+               if (msg.u.channel.type == CONSUMER_CHANNEL_TYPE_DATA && !ret_add_channel) {
                        int monitor_start_ret;
 
                        DBG("Consumer starting monitor timer");
-                       consumer_timer_live_start(new_channel,
-                                       msg.u.channel.live_timer_interval);
+                       consumer_timer_live_start(new_channel, msg.u.channel.live_timer_interval);
                        monitor_start_ret = consumer_timer_monitor_start(
-                                       new_channel,
-                                       msg.u.channel.monitor_timer_interval);
+                               new_channel, msg.u.channel.monitor_timer_interval);
                        if (monitor_start_ret < 0) {
                                ERR("Starting channel monitoring timer failed");
                                goto end_nosignal;
@@ -576,8 +569,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                /* If we received an error in add_channel, we need to report it. */
                if (ret_add_channel < 0) {
-                       ret_send_status = consumer_send_status_msg(
-                                       sock, ret_add_channel);
+                       ret_send_status = consumer_send_status_msg(sock, ret_add_channel);
                        if (ret_send_status < 0) {
                                goto error_fatal;
                        }
@@ -660,18 +652,17 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                health_code_update();
 
                pthread_mutex_lock(&channel->lock);
-               new_stream = consumer_stream_create(
-                               channel,
-                               channel->key,
-                               fd,
-                               channel->name,
-                               channel->relayd_id,
-                               channel->session_id,
-                               channel->trace_chunk,
-                               msg.u.stream.cpu,
-                               &alloc_ret,
-                               channel->type,
-                               channel->monitor);
+               new_stream = consumer_stream_create(channel,
+                                                   channel->key,
+                                                   fd,
+                                                   channel->name,
+                                                   channel->relayd_id,
+                                                   channel->session_id,
+                                                   channel->trace_chunk,
+                                                   msg.u.stream.cpu,
+                                                   &alloc_ret,
+                                                   channel->type,
+                                                   channel->monitor);
                if (new_stream == NULL) {
                        switch (alloc_ret) {
                        case -ENOMEM:
@@ -685,16 +676,15 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                }
 
                new_stream->wait_fd = fd;
-               ret_get_max_subbuf_size = kernctl_get_max_subbuf_size(
-                               new_stream->wait_fd, &new_stream->max_sb_size);
+               ret_get_max_subbuf_size =
+                       kernctl_get_max_subbuf_size(new_stream->wait_fd, &new_stream->max_sb_size);
                if (ret_get_max_subbuf_size < 0) {
                        pthread_mutex_unlock(&channel->lock);
                        ERR("Failed to get kernel maximal subbuffer size");
                        goto error_add_stream_nosignal;
                }
 
-               consumer_stream_update_channel_attributes(new_stream,
-                               channel);
+               consumer_stream_update_channel_attributes(new_stream, channel);
 
                /*
                 * We've just assigned the channel to the stream so increment the
@@ -737,8 +727,9 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                /* Do not monitor this stream. */
                if (!channel->monitor) {
                        DBG("Kernel consumer add stream %s in no monitor mode with "
-                                       "relayd id %" PRIu64, new_stream->name,
-                                       new_stream->net_seq_idx);
+                           "relayd id %" PRIu64,
+                           new_stream->name,
+                           new_stream->net_seq_idx);
                        cds_list_add(&new_stream->send_node, &channel->streams.head);
                        pthread_mutex_unlock(&new_stream->lock);
                        pthread_mutex_unlock(&channel->lock);
@@ -749,8 +740,8 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                if (new_stream->net_seq_idx != (uint64_t) -1ULL) {
                        int ret_send_relayd_stream;
 
-                       ret_send_relayd_stream = consumer_send_relayd_stream(
-                                       new_stream, new_stream->chan->pathname);
+                       ret_send_relayd_stream =
+                               consumer_send_relayd_stream(new_stream, new_stream->chan->pathname);
                        if (ret_send_relayd_stream < 0) {
                                pthread_mutex_unlock(&new_stream->lock);
                                pthread_mutex_unlock(&channel->lock);
@@ -767,8 +758,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                                int ret_send_relayd_streams_sent;
 
                                ret_send_relayd_streams_sent =
-                                               consumer_send_relayd_streams_sent(
-                                                               new_stream->net_seq_idx);
+                                       consumer_send_relayd_streams_sent(new_stream->net_seq_idx);
                                if (ret_send_relayd_streams_sent < 0) {
                                        pthread_mutex_unlock(&new_stream->lock);
                                        pthread_mutex_unlock(&channel->lock);
@@ -793,12 +783,11 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                health_code_update();
 
-               ret_pipe_write = lttng_pipe_write(
-                               stream_pipe, &new_stream, sizeof(new_stream));
+               ret_pipe_write = lttng_pipe_write(stream_pipe, &new_stream, sizeof(new_stream));
                if (ret_pipe_write < 0) {
                        ERR("Consumer write %s stream to pipe %d",
-                                       new_stream->metadata_flag ? "metadata" : "data",
-                                       lttng_pipe_get_writefd(stream_pipe));
+                           new_stream->metadata_flag ? "metadata" : "data",
+                           lttng_pipe_get_writefd(stream_pipe));
                        if (new_stream->metadata_flag) {
                                consumer_del_stream_for_metadata(new_stream);
                        } else {
@@ -808,12 +797,15 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                }
 
                DBG("Kernel consumer ADD_STREAM %s (fd: %d) %s with relayd id %" PRIu64,
-                               new_stream->name, fd, new_stream->chan->pathname, new_stream->relayd_stream_id);
-end_add_stream:
+                   new_stream->name,
+                   fd,
+                   new_stream->chan->pathname,
+                   new_stream->relayd_stream_id);
+       end_add_stream:
                break;
-error_add_stream_nosignal:
+       error_add_stream_nosignal:
                goto end_nosignal;
-error_add_stream_fatal:
+       error_add_stream_fatal:
                goto error_fatal;
        }
        case LTTNG_CONSUMER_STREAMS_SENT:
@@ -831,8 +823,7 @@ error_add_stream_fatal:
                         * We could not find the channel. Can happen if cpu hotplug
                         * happens while tearing down.
                         */
-                       ERR("Unable to find channel key %" PRIu64,
-                                       msg.u.sent_streams.channel_key);
+                       ERR("Unable to find channel key %" PRIu64, msg.u.sent_streams.channel_key);
                        ret_code = LTTCOMM_CONSUMERD_CHAN_NOT_FOUND;
                }
 
@@ -842,8 +833,7 @@ error_add_stream_fatal:
                 * Send status code to session daemon.
                 */
                ret_send_status = consumer_send_status_msg(sock, ret_code);
-               if (ret_send_status < 0 ||
-                               ret_code != LTTCOMM_CONSUMERD_SUCCESS) {
+               if (ret_send_status < 0 || ret_code != LTTCOMM_CONSUMERD_SUCCESS) {
                        /* Somehow, the session daemon is not responding anymore. */
                        goto error_streams_sent_nosignal;
                }
@@ -863,16 +853,16 @@ error_add_stream_fatal:
                if (msg.u.sent_streams.net_seq_idx != (uint64_t) -1ULL) {
                        int ret_send_relay_streams;
 
-                       ret_send_relay_streams = consumer_send_relayd_streams_sent(
-                                       msg.u.sent_streams.net_seq_idx);
+                       ret_send_relay_streams =
+                               consumer_send_relayd_streams_sent(msg.u.sent_streams.net_seq_idx);
                        if (ret_send_relay_streams < 0) {
                                goto error_streams_sent_nosignal;
                        }
                        channel->streams_sent_to_relayd = true;
                }
-end_error_streams_sent:
+       end_error_streams_sent:
                break;
-error_streams_sent_nosignal:
+       error_streams_sent_nosignal:
                goto end_nosignal;
        }
        case LTTNG_CONSUMER_UPDATE_STREAM:
@@ -932,8 +922,8 @@ error_streams_sent_nosignal:
                health_code_update();
 
                /* Send back returned value to session daemon */
-               ret_send = lttcomm_send_unix_sock(sock, &ret_data_pending,
-                               sizeof(ret_data_pending));
+               ret_send =
+                       lttcomm_send_unix_sock(sock, &ret_data_pending, sizeof(ret_data_pending));
                if (ret_send < 0) {
                        PERROR("send data pending ret code");
                        goto error_fatal;
@@ -960,10 +950,11 @@ error_streams_sent_nosignal:
                                int ret_snapshot;
 
                                ret_snapshot = lttng_kconsumer_snapshot_metadata(
-                                               channel, key,
-                                               msg.u.snapshot_channel.pathname,
-                                               msg.u.snapshot_channel.relayd_id,
-                                               ctx);
+                                       channel,
+                                       key,
+                                       msg.u.snapshot_channel.pathname,
+                                       msg.u.snapshot_channel.relayd_id,
+                                       ctx);
                                if (ret_snapshot < 0) {
                                        ERR("Snapshot metadata failed");
                                        ret_code = LTTCOMM_CONSUMERD_SNAPSHOT_FAILED;
@@ -972,11 +963,11 @@ error_streams_sent_nosignal:
                                int ret_snapshot;
 
                                ret_snapshot = lttng_kconsumer_snapshot_channel(
-                                               channel, key,
-                                               msg.u.snapshot_channel.pathname,
-                                               msg.u.snapshot_channel.relayd_id,
-                                               msg.u.snapshot_channel
-                                                               .nb_packets_per_stream);
+                                       channel,
+                                       key,
+                                       msg.u.snapshot_channel.pathname,
+                                       msg.u.snapshot_channel.relayd_id,
+                                       msg.u.snapshot_channel.nb_packets_per_stream);
                                if (ret_snapshot < 0) {
                                        ERR("Snapshot channel failed");
                                        ret_code = LTTCOMM_CONSUMERD_SNAPSHOT_FAILED;
@@ -1032,7 +1023,7 @@ error_streams_sent_nosignal:
                LTTNG_ASSERT(!uatomic_sub_return(&channel->refcount, 1));
 
                consumer_del_channel(channel);
-end_destroy_channel:
+       end_destroy_channel:
                goto end_nosignal;
        }
        case LTTNG_CONSUMER_DISCARDED_EVENTS:
@@ -1043,13 +1034,14 @@ end_destroy_channel:
                uint64_t id = msg.u.discarded_events.session_id;
                uint64_t key = msg.u.discarded_events.channel_key;
 
-               DBG("Kernel consumer discarded events command for session id %"
-                               PRIu64 ", channel key %" PRIu64, id, key);
+               DBG("Kernel consumer discarded events command for session id %" PRIu64
+                   ", channel key %" PRIu64,
+                   id,
+                   key);
 
                channel = consumer_find_channel(key);
                if (!channel) {
-                       ERR("Kernel consumer discarded events channel %"
-                                       PRIu64 " not found", key);
+                       ERR("Kernel consumer discarded events channel %" PRIu64 " not found", key);
                        count = 0;
                } else {
                        count = channel->discarded_events;
@@ -1074,13 +1066,14 @@ end_destroy_channel:
                uint64_t id = msg.u.lost_packets.session_id;
                uint64_t key = msg.u.lost_packets.channel_key;
 
-               DBG("Kernel consumer lost packets command for session id %"
-                               PRIu64 ", channel key %" PRIu64, id, key);
+               DBG("Kernel consumer lost packets command for session id %" PRIu64
+                   ", channel key %" PRIu64,
+                   id,
+                   key);
 
                channel = consumer_find_channel(key);
                if (!channel) {
-                       ERR("Kernel consumer lost packets channel %"
-                                       PRIu64 " not found", key);
+                       ERR("Kernel consumer lost packets channel %" PRIu64 " not found", key);
                        count = 0;
                } else {
                        count = channel->lost_packets;
@@ -1110,8 +1103,7 @@ end_destroy_channel:
                        goto error_fatal;
                }
 
-               ret_recv = lttcomm_recv_fds_unix_sock(
-                               sock, &channel_monitor_pipe, 1);
+               ret_recv = lttcomm_recv_fds_unix_sock(sock, &channel_monitor_pipe, 1);
                if (ret_recv != sizeof(channel_monitor_pipe)) {
                        ERR("Failed to receive channel monitor pipe");
                        goto error_fatal;
@@ -1119,8 +1111,7 @@ end_destroy_channel:
 
                DBG("Received channel monitor pipe (%d)", channel_monitor_pipe);
                ret_set_channel_monitor_pipe =
-                               consumer_timer_thread_set_channel_monitor_pipe(
-                                               channel_monitor_pipe);
+                       consumer_timer_thread_set_channel_monitor_pipe(channel_monitor_pipe);
                if (!ret_set_channel_monitor_pipe) {
                        int flags;
                        int ret_fcntl;
@@ -1134,8 +1125,7 @@ end_destroy_channel:
                        }
                        flags = ret_fcntl;
 
-                       ret_fcntl = fcntl(channel_monitor_pipe, F_SETFL,
-                                       flags | O_NONBLOCK);
+                       ret_fcntl = fcntl(channel_monitor_pipe, F_SETFL, flags | O_NONBLOCK);
                        if (ret_fcntl == -1) {
                                PERROR("fcntl set O_NONBLOCK flag of the channel monitoring pipe");
                                goto error_fatal;
@@ -1169,8 +1159,7 @@ end_destroy_channel:
                        int ret_rotate_channel;
 
                        ret_rotate_channel = lttng_consumer_rotate_channel(
-                                       channel, key,
-                                       msg.u.rotate_channel.relayd_id);
+                               channel, key, msg.u.rotate_channel.relayd_id);
                        if (ret_rotate_channel < 0) {
                                ERR("Rotate channel failed");
                                ret_code = LTTCOMM_CONSUMERD_ROTATION_FAIL;
@@ -1188,14 +1177,13 @@ end_destroy_channel:
                        /* Rotate the streams that are ready right now. */
                        int ret_rotate;
 
-                       ret_rotate = lttng_consumer_rotate_ready_streams(
-                                       channel, key);
+                       ret_rotate = lttng_consumer_rotate_ready_streams(channel, key);
                        if (ret_rotate < 0) {
                                ERR("Rotate ready streams failed");
                        }
                }
                break;
-error_rotate_channel:
+       error_rotate_channel:
                goto end_nosignal;
        }
        case LTTNG_CONSUMER_CLEAR_CHANNEL:
@@ -1211,8 +1199,7 @@ error_rotate_channel:
                } else {
                        int ret_clear_channel;
 
-                       ret_clear_channel =
-                                       lttng_consumer_clear_channel(channel);
+                       ret_clear_channel = lttng_consumer_clear_channel(channel);
                        if (ret_clear_channel) {
                                ERR("Clear channel failed");
                                ret_code = (lttcomm_return_code) ret_clear_channel;
@@ -1234,11 +1221,11 @@ error_rotate_channel:
                int ret_send_status;
                lttng_uuid sessiond_uuid;
 
-               std::copy(std::begin(msg.u.init.sessiond_uuid), std::end(msg.u.init.sessiond_uuid),
-                               sessiond_uuid.begin());
+               std::copy(std::begin(msg.u.init.sessiond_uuid),
+                         std::end(msg.u.init.sessiond_uuid),
+                         sessiond_uuid.begin());
 
-               ret_code = lttng_consumer_init_command(ctx,
-                               sessiond_uuid);
+               ret_code = lttng_consumer_init_command(ctx, sessiond_uuid);
                health_code_update();
                ret_send_status = consumer_send_status_msg(sock, ret_code);
                if (ret_send_status < 0) {
@@ -1250,17 +1237,16 @@ error_rotate_channel:
        case LTTNG_CONSUMER_CREATE_TRACE_CHUNK:
        {
                const struct lttng_credentials credentials = {
-                       .uid = LTTNG_OPTIONAL_INIT_VALUE(msg.u.create_trace_chunk.credentials.value.uid),
-                       .gid = LTTNG_OPTIONAL_INIT_VALUE(msg.u.create_trace_chunk.credentials.value.gid),
+                       .uid = LTTNG_OPTIONAL_INIT_VALUE(
+                               msg.u.create_trace_chunk.credentials.value.uid),
+                       .gid = LTTNG_OPTIONAL_INIT_VALUE(
+                               msg.u.create_trace_chunk.credentials.value.gid),
                };
-               const bool is_local_trace =
-                               !msg.u.create_trace_chunk.relayd_id.is_set;
-               const uint64_t relayd_id =
-                               msg.u.create_trace_chunk.relayd_id.value;
-               const char *chunk_override_name =
-                               *msg.u.create_trace_chunk.override_name ?
-                                       msg.u.create_trace_chunk.override_name :
-                                       NULL;
+               const bool is_local_trace = !msg.u.create_trace_chunk.relayd_id.is_set;
+               const uint64_t relayd_id = msg.u.create_trace_chunk.relayd_id.value;
+               const char *chunk_override_name = *msg.u.create_trace_chunk.override_name ?
+                       msg.u.create_trace_chunk.override_name :
+                       NULL;
                struct lttng_directory_handle *chunk_directory_handle = NULL;
 
                /*
@@ -1273,24 +1259,21 @@ error_rotate_channel:
                        ssize_t ret_recv;
 
                        /* Acnowledge the reception of the command. */
-                       ret_send_status = consumer_send_status_msg(
-                                       sock, LTTCOMM_CONSUMERD_SUCCESS);
+                       ret_send_status = consumer_send_status_msg(sock, LTTCOMM_CONSUMERD_SUCCESS);
                        if (ret_send_status < 0) {
                                /* Somehow, the session daemon is not responding anymore. */
                                goto end_nosignal;
                        }
 
-                       ret_recv = lttcomm_recv_fds_unix_sock(
-                                       sock, &chunk_dirfd, 1);
+                       ret_recv = lttcomm_recv_fds_unix_sock(sock, &chunk_dirfd, 1);
                        if (ret_recv != sizeof(chunk_dirfd)) {
                                ERR("Failed to receive trace chunk directory file descriptor");
                                goto error_fatal;
                        }
 
-                       DBG("Received trace chunk directory fd (%d)",
-                                       chunk_dirfd);
-                       chunk_directory_handle = lttng_directory_handle_create_from_dirfd(
-                                       chunk_dirfd);
+                       DBG("Received trace chunk directory fd (%d)", chunk_dirfd);
+                       chunk_directory_handle =
+                               lttng_directory_handle_create_from_dirfd(chunk_dirfd);
                        if (!chunk_directory_handle) {
                                ERR("Failed to initialize chunk directory handle from directory file descriptor");
                                if (close(chunk_dirfd)) {
@@ -1301,47 +1284,39 @@ error_rotate_channel:
                }
 
                ret_code = lttng_consumer_create_trace_chunk(
-                               !is_local_trace ? &relayd_id : NULL,
-                               msg.u.create_trace_chunk.session_id,
-                               msg.u.create_trace_chunk.chunk_id,
-                               (time_t) msg.u.create_trace_chunk
-                                               .creation_timestamp,
-                               chunk_override_name,
-                               msg.u.create_trace_chunk.credentials.is_set ?
-                                               &credentials :
-                                               NULL,
-                               chunk_directory_handle);
+                       !is_local_trace ? &relayd_id : NULL,
+                       msg.u.create_trace_chunk.session_id,
+                       msg.u.create_trace_chunk.chunk_id,
+                       (time_t) msg.u.create_trace_chunk.creation_timestamp,
+                       chunk_override_name,
+                       msg.u.create_trace_chunk.credentials.is_set ? &credentials : NULL,
+                       chunk_directory_handle);
                lttng_directory_handle_put(chunk_directory_handle);
                goto end_msg_sessiond;
        }
        case LTTNG_CONSUMER_CLOSE_TRACE_CHUNK:
        {
                enum lttng_trace_chunk_command_type close_command =
-                               (lttng_trace_chunk_command_type) msg.u.close_trace_chunk.close_command.value;
-               const uint64_t relayd_id =
-                               msg.u.close_trace_chunk.relayd_id.value;
+                       (lttng_trace_chunk_command_type) msg.u.close_trace_chunk.close_command.value;
+               const uint64_t relayd_id = msg.u.close_trace_chunk.relayd_id.value;
                struct lttcomm_consumer_close_trace_chunk_reply reply;
                char path[LTTNG_PATH_MAX];
                ssize_t ret_send;
 
                ret_code = lttng_consumer_close_trace_chunk(
-                               msg.u.close_trace_chunk.relayd_id.is_set ?
-                                               &relayd_id :
-                                               NULL,
-                               msg.u.close_trace_chunk.session_id,
-                               msg.u.close_trace_chunk.chunk_id,
-                               (time_t) msg.u.close_trace_chunk.close_timestamp,
-                               msg.u.close_trace_chunk.close_command.is_set ?
-                                               &close_command :
-                                               NULL, path);
+                       msg.u.close_trace_chunk.relayd_id.is_set ? &relayd_id : NULL,
+                       msg.u.close_trace_chunk.session_id,
+                       msg.u.close_trace_chunk.chunk_id,
+                       (time_t) msg.u.close_trace_chunk.close_timestamp,
+                       msg.u.close_trace_chunk.close_command.is_set ? &close_command : NULL,
+                       path);
                reply.ret_code = ret_code;
                reply.path_length = strlen(path) + 1;
                ret_send = lttcomm_send_unix_sock(sock, &reply, sizeof(reply));
                if (ret_send != sizeof(reply)) {
                        goto error_fatal;
                }
-               ret_send = lttcomm_send_unix_sock(
-                               sock, path, reply.path_length);
+               ret_send = lttcomm_send_unix_sock(sock, path, reply.path_length);
                if (ret_send != reply.path_length) {
                        goto error_fatal;
                }
@@ -1349,21 +1324,18 @@ error_rotate_channel:
        }
        case LTTNG_CONSUMER_TRACE_CHUNK_EXISTS:
        {
-               const uint64_t relayd_id =
-                               msg.u.trace_chunk_exists.relayd_id.value;
+               const uint64_t relayd_id = msg.u.trace_chunk_exists.relayd_id.value;
 
                ret_code = lttng_consumer_trace_chunk_exists(
-                               msg.u.trace_chunk_exists.relayd_id.is_set ?
-                                               &relayd_id : NULL,
-                               msg.u.trace_chunk_exists.session_id,
-                               msg.u.trace_chunk_exists.chunk_id);
+                       msg.u.trace_chunk_exists.relayd_id.is_set ? &relayd_id : NULL,
+                       msg.u.trace_chunk_exists.session_id,
+                       msg.u.trace_chunk_exists.chunk_id);
                goto end_msg_sessiond;
        }
        case LTTNG_CONSUMER_OPEN_CHANNEL_PACKETS:
        {
                const uint64_t key = msg.u.open_channel_packets.key;
-               struct lttng_consumer_channel *channel =
-                               consumer_find_channel(key);
+               struct lttng_consumer_channel *channel = consumer_find_channel(key);
 
                if (channel) {
                        pthread_mutex_lock(&channel->lock);
@@ -1421,8 +1393,7 @@ end:
  *
  * Metadata stream lock MUST be acquired.
  */
-enum sync_metadata_status lttng_kconsumer_sync_metadata(
-               struct lttng_consumer_stream *metadata)
+enum sync_metadata_status lttng_kconsumer_sync_metadata(struct lttng_consumer_stream *metadata)
 {
        int ret;
        enum sync_metadata_status status;
@@ -1454,20 +1425,18 @@ end:
        return status;
 }
 
-static
-int extract_common_subbuffer_info(struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuf)
+static int extract_common_subbuffer_info(struct lttng_consumer_stream *stream,
+                                        struct stream_subbuffer *subbuf)
 {
        int ret;
 
-       ret = kernctl_get_subbuf_size(
-                       stream->wait_fd, &subbuf->info.data.subbuf_size);
+       ret = kernctl_get_subbuf_size(stream->wait_fd, &subbuf->info.data.subbuf_size);
        if (ret) {
                goto end;
        }
 
-       ret = kernctl_get_padded_subbuf_size(
-                       stream->wait_fd, &subbuf->info.data.padded_subbuf_size);
+       ret = kernctl_get_padded_subbuf_size(stream->wait_fd,
+                                            &subbuf->info.data.padded_subbuf_size);
        if (ret) {
                goto end;
        }
@@ -1476,9 +1445,8 @@ end:
        return ret;
 }
 
-static
-int extract_metadata_subbuffer_info(struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuf)
+static int extract_metadata_subbuffer_info(struct lttng_consumer_stream *stream,
+                                          struct stream_subbuffer *subbuf)
 {
        int ret;
 
@@ -1487,8 +1455,7 @@ int extract_metadata_subbuffer_info(struct lttng_consumer_stream *stream,
                goto end;
        }
 
-       ret = kernctl_get_metadata_version(
-                       stream->wait_fd, &subbuf->info.metadata.version);
+       ret = kernctl_get_metadata_version(stream->wait_fd, &subbuf->info.metadata.version);
        if (ret) {
                goto end;
        }
@@ -1497,9 +1464,8 @@ end:
        return ret;
 }
 
-static
-int extract_data_subbuffer_info(struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuf)
+static int extract_data_subbuffer_info(struct lttng_consumer_stream *stream,
+                                      struct stream_subbuffer *subbuf)
 {
        int ret;
 
@@ -1508,43 +1474,38 @@ int extract_data_subbuffer_info(struct lttng_consumer_stream *stream,
                goto end;
        }
 
-       ret = kernctl_get_packet_size(
-                       stream->wait_fd, &subbuf->info.data.packet_size);
+       ret = kernctl_get_packet_size(stream->wait_fd, &subbuf->info.data.packet_size);
        if (ret < 0) {
                PERROR("Failed to get sub-buffer packet size");
                goto end;
        }
 
-       ret = kernctl_get_content_size(
-                       stream->wait_fd, &subbuf->info.data.content_size);
+       ret = kernctl_get_content_size(stream->wait_fd, &subbuf->info.data.content_size);
        if (ret < 0) {
                PERROR("Failed to get sub-buffer content size");
                goto end;
        }
 
-       ret = kernctl_get_timestamp_begin(
-                       stream->wait_fd, &subbuf->info.data.timestamp_begin);
+       ret = kernctl_get_timestamp_begin(stream->wait_fd, &subbuf->info.data.timestamp_begin);
        if (ret < 0) {
                PERROR("Failed to get sub-buffer begin timestamp");
                goto end;
        }
 
-       ret = kernctl_get_timestamp_end(
-                       stream->wait_fd, &subbuf->info.data.timestamp_end);
+       ret = kernctl_get_timestamp_end(stream->wait_fd, &subbuf->info.data.timestamp_end);
        if (ret < 0) {
                PERROR("Failed to get sub-buffer end timestamp");
                goto end;
        }
 
-       ret = kernctl_get_events_discarded(
-                       stream->wait_fd, &subbuf->info.data.events_discarded);
+       ret = kernctl_get_events_discarded(stream->wait_fd, &subbuf->info.data.events_discarded);
        if (ret) {
                PERROR("Failed to get sub-buffer events discarded count");
                goto end;
        }
 
        ret = kernctl_get_sequence_number(stream->wait_fd,
-                       &subbuf->info.data.sequence_number.value);
+                                         &subbuf->info.data.sequence_number.value);
        if (ret) {
                /* May not be supported by older LTTng-modules. */
                if (ret != -ENOTTY) {
@@ -1555,15 +1516,13 @@ int extract_data_subbuffer_info(struct lttng_consumer_stream *stream,
                subbuf->info.data.sequence_number.is_set = true;
        }
 
-       ret = kernctl_get_stream_id(
-                       stream->wait_fd, &subbuf->info.data.stream_id);
+       ret = kernctl_get_stream_id(stream->wait_fd, &subbuf->info.data.stream_id);
        if (ret < 0) {
                PERROR("Failed to get stream id");
                goto end;
        }
 
-       ret = kernctl_get_instance_id(stream->wait_fd,
-                       &subbuf->info.data.stream_instance_id.value);
+       ret = kernctl_get_instance_id(stream->wait_fd, &subbuf->info.data.stream_instance_id.value);
        if (ret) {
                /* May not be supported by older LTTng-modules. */
                if (ret != -ENOTTY) {
@@ -1577,10 +1536,8 @@ end:
        return ret;
 }
 
-static
-enum get_next_subbuffer_status get_subbuffer_common(
-               struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuffer)
+static enum get_next_subbuffer_status get_subbuffer_common(struct lttng_consumer_stream *stream,
+                                                          struct stream_subbuffer *subbuffer)
 {
        int ret;
        enum get_next_subbuffer_status status;
@@ -1591,7 +1548,7 @@ enum get_next_subbuffer_status get_subbuffer_common(
                status = GET_NEXT_SUBBUFFER_STATUS_OK;
                break;
        case -ENODATA:
-               case -EAGAIN:
+       case -EAGAIN:
                /*
                 * The caller only expects -ENODATA when there is no data to
                 * read, but the kernel tracer returns -EAGAIN when there is
@@ -1606,8 +1563,7 @@ enum get_next_subbuffer_status get_subbuffer_common(
                goto end;
        }
 
-       ret = stream->read_subbuffer_ops.extract_subbuffer_info(
-               stream, subbuffer);
+       ret = stream->read_subbuffer_ops.extract_subbuffer_info(stream, subbuffer);
        if (ret) {
                status = GET_NEXT_SUBBUFFER_STATUS_ERROR;
        }
@@ -1615,13 +1571,10 @@ end:
        return status;
 }
 
-static
-enum get_next_subbuffer_status get_next_subbuffer_splice(
-               struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuffer)
+static enum get_next_subbuffer_status
+get_next_subbuffer_splice(struct lttng_consumer_stream *stream, struct stream_subbuffer *subbuffer)
 {
-       const enum get_next_subbuffer_status status =
-                       get_subbuffer_common(stream, subbuffer);
+       const enum get_next_subbuffer_status status = get_subbuffer_common(stream, subbuffer);
 
        if (status != GET_NEXT_SUBBUFFER_STATUS_OK) {
                goto end;
@@ -1632,10 +1585,8 @@ end:
        return status;
 }
 
-static
-enum get_next_subbuffer_status get_next_subbuffer_mmap(
-               struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuffer)
+static enum get_next_subbuffer_status get_next_subbuffer_mmap(struct lttng_consumer_stream *stream,
+                                                             struct stream_subbuffer *subbuffer)
 {
        int ret;
        enum get_next_subbuffer_status status;
@@ -1652,29 +1603,27 @@ enum get_next_subbuffer_status get_next_subbuffer_mmap(
                goto end;
        }
 
-       subbuffer->buffer.buffer = lttng_buffer_view_init(
-                       addr, 0, subbuffer->info.data.padded_subbuf_size);
+       subbuffer->buffer.buffer =
+               lttng_buffer_view_init(addr, 0, subbuffer->info.data.padded_subbuf_size);
 end:
        return status;
 }
 
-static
-enum get_next_subbuffer_status get_next_subbuffer_metadata_check(struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuffer)
+static enum get_next_subbuffer_status
+get_next_subbuffer_metadata_check(struct lttng_consumer_stream *stream,
+                                 struct stream_subbuffer *subbuffer)
 {
        int ret;
        const char *addr;
        bool coherent;
        enum get_next_subbuffer_status status;
 
-       ret = kernctl_get_next_subbuf_metadata_check(stream->wait_fd,
-                       &coherent);
+       ret = kernctl_get_next_subbuf_metadata_check(stream->wait_fd, &coherent);
        if (ret) {
                goto end;
        }
 
-       ret = stream->read_subbuffer_ops.extract_subbuffer_info(
-                       stream, subbuffer);
+       ret = stream->read_subbuffer_ops.extract_subbuffer_info(stream, subbuffer);
        if (ret) {
                goto end;
        }
@@ -1686,11 +1635,11 @@ enum get_next_subbuffer_status get_next_subbuffer_metadata_check(struct lttng_co
                goto end;
        }
 
-       subbuffer->buffer.buffer = lttng_buffer_view_init(
-                       addr, 0, subbuffer->info.data.padded_subbuf_size);
+       subbuffer->buffer.buffer =
+               lttng_buffer_view_init(addr, 0, subbuffer->info.data.padded_subbuf_size);
        DBG("Got metadata packet with padded_subbuf_size = %lu, coherent = %s",
-                       subbuffer->info.metadata.padded_subbuf_size,
-                       coherent ? "true" : "false");
+           subbuffer->info.metadata.padded_subbuf_size,
+           coherent ? "true" : "false");
 end:
        /*
         * The caller only expects -ENODATA when there is no data to read, but
@@ -1721,9 +1670,8 @@ end:
        return status;
 }
 
-static
-int put_next_subbuffer(struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuffer __attribute__((unused)))
+static int put_next_subbuffer(struct lttng_consumer_stream *stream,
+                             struct stream_subbuffer *subbuffer __attribute__((unused)))
 {
        const int ret = kernctl_put_next_subbuf(stream->wait_fd);
 
@@ -1739,8 +1687,7 @@ int put_next_subbuffer(struct lttng_consumer_stream *stream,
        return ret;
 }
 
-static
-bool is_get_next_check_metadata_available(int tracer_fd)
+static bool is_get_next_check_metadata_available(int tracer_fd)
 {
        const int ret = kernctl_get_next_subbuf_metadata_check(tracer_fd, NULL);
        const bool available = ret != -ENOTTY;
@@ -1753,17 +1700,14 @@ bool is_get_next_check_metadata_available(int tracer_fd)
        return available;
 }
 
-static
-int signal_metadata(struct lttng_consumer_stream *stream,
-               struct lttng_consumer_local_data *ctx __attribute__((unused)))
+static int signal_metadata(struct lttng_consumer_stream *stream,
+                          struct lttng_consumer_local_data *ctx __attribute__((unused)))
 {
        ASSERT_LOCKED(stream->metadata_rdv_lock);
        return pthread_cond_broadcast(&stream->metadata_rdv) ? -errno : 0;
 }
 
-static
-int lttng_kconsumer_set_stream_ops(
-               struct lttng_consumer_stream *stream)
+static int lttng_kconsumer_set_stream_ops(struct lttng_consumer_stream *stream)
 {
        int ret = 0;
 
@@ -1772,9 +1716,8 @@ int lttng_kconsumer_set_stream_ops(
                if (is_get_next_check_metadata_available(stream->wait_fd)) {
                        DBG("Kernel tracer supports get_next_subbuffer_metadata_check, metadata will be accumulated until a coherent state is reached");
                        stream->read_subbuffer_ops.get_next_subbuffer =
-                                       get_next_subbuffer_metadata_check;
-                       ret = consumer_stream_enable_metadata_bucketization(
-                                       stream);
+                               get_next_subbuffer_metadata_check;
+                       ret = consumer_stream_enable_metadata_bucketization(stream);
                        if (ret) {
                                goto end;
                        }
@@ -1797,23 +1740,18 @@ int lttng_kconsumer_set_stream_ops(
 
        if (!stream->read_subbuffer_ops.get_next_subbuffer) {
                if (stream->chan->output == CONSUMER_CHANNEL_MMAP) {
-                       stream->read_subbuffer_ops.get_next_subbuffer =
-                                       get_next_subbuffer_mmap;
+                       stream->read_subbuffer_ops.get_next_subbuffer = get_next_subbuffer_mmap;
                } else {
-                       stream->read_subbuffer_ops.get_next_subbuffer =
-                                       get_next_subbuffer_splice;
+                       stream->read_subbuffer_ops.get_next_subbuffer = get_next_subbuffer_splice;
                }
        }
 
        if (stream->metadata_flag) {
-               stream->read_subbuffer_ops.extract_subbuffer_info =
-                               extract_metadata_subbuffer_info;
+               stream->read_subbuffer_ops.extract_subbuffer_info = extract_metadata_subbuffer_info;
        } else {
-               stream->read_subbuffer_ops.extract_subbuffer_info =
-                               extract_data_subbuffer_info;
+               stream->read_subbuffer_ops.extract_subbuffer_info = extract_data_subbuffer_info;
                if (stream->chan->is_live) {
-                       stream->read_subbuffer_ops.send_live_beacon =
-                                       consumer_flush_kernel_index;
+                       stream->read_subbuffer_ops.send_live_beacon = consumer_flush_kernel_index;
                }
        }
 
@@ -1833,7 +1771,7 @@ int lttng_kconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
         * no current trace chunk on the parent channel.
         */
        if (stream->net_seq_idx == (uint64_t) -1ULL && stream->chan->monitor &&
-                       stream->chan->trace_chunk) {
+           stream->chan->trace_chunk) {
                ret = consumer_stream_create_output_files(stream, true);
                if (ret) {
                        goto error;
@@ -1851,8 +1789,8 @@ int lttng_kconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
                }
                stream->mmap_len = (size_t) mmap_len;
 
-               stream->mmap_base = mmap(NULL, stream->mmap_len, PROT_READ,
-                               MAP_PRIVATE, stream->wait_fd, 0);
+               stream->mmap_base =
+                       mmap(NULL, stream->mmap_len, PROT_READ, MAP_PRIVATE, stream->wait_fd, 0);
                if (stream->mmap_base == MAP_FAILED) {
                        PERROR("Error mmaping");
                        ret = -1;
@@ -1904,7 +1842,7 @@ int lttng_kconsumer_data_pending(struct lttng_consumer_stream *stream)
                /* There is still data so let's put back this subbuffer. */
                ret = kernctl_put_subbuf(stream->wait_fd);
                LTTNG_ASSERT(ret == 0);
-               ret = 1;   /* Data is pending */
+               ret = 1; /* Data is pending */
                goto end;
        }
 
index 76960307c80abe7924011c22f2f3a3ebccfc626d..5d66acec4e73c9299a37b17fa1c649ce264118a5 100644 (file)
 #include "lttng/tracker.h"
 #define _LGPL_SOURCE
 #define __USE_LINUX_IOCTL_DEFS
-#include <sys/ioctl.h>
-#include <string.h>
+#include "kernel-ctl.hpp"
+#include "kernel-ioctl.hpp"
+
 #include <common/align.hpp>
-#include <common/macros.hpp>
 #include <common/compat/errno.hpp>
-#include <stdarg.h>
+#include <common/macros.hpp>
 #include <common/time.hpp>
 
-#include "kernel-ctl.hpp"
-#include "kernel-ioctl.hpp"
+#include <stdarg.h>
+#include <string.h>
+#include <sys/ioctl.h>
 
 #define LTTNG_IOCTL_CHECK(fildes, request, ...)                         \
        ({                                                              \
                int _ioctl_ret = ioctl(fildes, request, ##__VA_ARGS__); \
-               LTTNG_ASSERT(_ioctl_ret <= 0);                                \
+               LTTNG_ASSERT(_ioctl_ret <= 0);                          \
                !_ioctl_ret ? 0 : -errno;                               \
        })
 
@@ -51,8 +52,7 @@ static int lttng_kernel_abi_use_old_abi = -1;
  * and new request codes.
  * It returns the return value of the ioctl executed.
  */
-static inline int compat_ioctl_no_arg(int fd, unsigned long oldname,
-               unsigned long newname)
+static inline int compat_ioctl_no_arg(int fd, unsigned long oldname, unsigned long newname)
 {
        int ret;
 
@@ -76,8 +76,7 @@ end:
 
 int kernctl_create_session(int fd)
 {
-       return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_SESSION,
-                       LTTNG_KERNEL_ABI_SESSION);
+       return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_SESSION, LTTNG_KERNEL_ABI_SESSION);
 }
 
 /* open the metadata global channel */
@@ -103,8 +102,7 @@ int kernctl_open_metadata(int fd, struct lttng_channel_attr *chops)
                 */
                memcpy(old_channel.padding, chops->padding, sizeof(chops->padding));
 
-               return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_OLD_METADATA,
-                               &old_channel);
+               return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_OLD_METADATA, &old_channel);
        }
 
        memset(&channel, 0, sizeof(channel));
@@ -141,8 +139,7 @@ int kernctl_create_channel(int fd, struct lttng_channel_attr *chops)
                 */
                memcpy(old_channel.padding, chops->padding, sizeof(chops->padding));
 
-               return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_OLD_CHANNEL,
-                               &old_channel);
+               return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_OLD_CHANNEL, &old_channel);
        }
 
        channel.overwrite = chops->overwrite;
@@ -209,12 +206,10 @@ end:
 
 int kernctl_track_pid(int fd, int pid)
 {
-       int ret = LTTNG_IOCTL_CHECK(
-                       fd, LTTNG_KERNEL_ABI_SESSION_TRACK_PID, pid);
+       int ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_TRACK_PID, pid);
 
        if (ret == -ENOSYS) {
-               ret = LTTNG_IOCTL_CHECK(fd,
-                               LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_PID, pid);
+               ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_PID, pid);
        }
 
        return ret;
@@ -222,12 +217,10 @@ int kernctl_track_pid(int fd, int pid)
 
 int kernctl_untrack_pid(int fd, int pid)
 {
-       int ret = LTTNG_IOCTL_CHECK(
-                       fd, LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID, pid);
+       int ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID, pid);
 
        if (ret == -ENOSYS) {
-               ret = LTTNG_IOCTL_CHECK(fd,
-                               LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_PID, pid);
+               ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_PID, pid);
        }
 
        return ret;
@@ -238,8 +231,8 @@ int kernctl_list_tracker_pids(int fd)
        return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_PIDS);
 }
 
-static enum lttng_kernel_abi_tracker_type get_kernel_tracker_type(
-               enum lttng_process_attr process_attr)
+static enum lttng_kernel_abi_tracker_type
+get_kernel_tracker_type(enum lttng_process_attr process_attr)
 {
        switch (process_attr) {
        case LTTNG_PROCESS_ATTR_PROCESS_ID:
@@ -273,8 +266,7 @@ int kernctl_track_id(int fd, enum lttng_process_attr process_attr, int id)
 
        ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_TRACK_ID, &args);
        if (ret == -ENOSYS) {
-               ret = LTTNG_IOCTL_CHECK(fd,
-                               LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_ID, &args);
+               ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_ID, &args);
        }
 
        return ret;
@@ -294,8 +286,7 @@ int kernctl_untrack_id(int fd, enum lttng_process_attr process_attr, int id)
 
        ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_UNTRACK_ID, &args);
        if (ret == -ENOSYS) {
-               ret = LTTNG_IOCTL_CHECK(fd,
-                               LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_ID, &args);
+               ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_ID, &args);
        }
 
        return ret;
@@ -313,12 +304,10 @@ int kernctl_list_tracker_ids(int fd, enum lttng_process_attr process_attr)
                return -1;
        }
 
-       ret = LTTNG_IOCTL_NO_CHECK(
-                       fd, LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_IDS, &args);
+       ret = LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_IDS, &args);
        if (ret == -ENOSYS) {
-               ret = LTTNG_IOCTL_NO_CHECK(fd,
-                               LTTNG_KERNEL_ABI_OLD_SESSION_LIST_TRACKER_IDS,
-                               &args);
+               ret = LTTNG_IOCTL_NO_CHECK(
+                       fd, LTTNG_KERNEL_ABI_OLD_SESSION_LIST_TRACKER_IDS, &args);
        }
 
        return ret;
@@ -344,12 +333,9 @@ int kernctl_session_set_name(int fd, const char *name)
                goto end;
        }
 
-       ret = LTTNG_IOCTL_CHECK(
-                       fd, LTTNG_KERNEL_ABI_SESSION_SET_NAME, &session_name);
+       ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_SET_NAME, &session_name);
        if (ret == -ENOSYS) {
-               ret = LTTNG_IOCTL_CHECK(fd,
-                               LTTNG_KERNEL_ABI_OLD_SESSION_SET_NAME,
-                               &session_name);
+               ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_OLD_SESSION_SET_NAME, &session_name);
        }
 
 end:
@@ -361,18 +347,15 @@ int kernctl_session_set_creation_time(int fd, time_t time)
        int ret;
        struct lttng_kernel_abi_session_creation_time creation_time;
 
-       ret = time_to_iso8601_str(time, creation_time.iso8601,
-                       sizeof(creation_time.iso8601));
+       ret = time_to_iso8601_str(time, creation_time.iso8601, sizeof(creation_time.iso8601));
        if (ret) {
                goto end;
        }
 
-       ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_SET_CREATION_TIME,
-                       &creation_time);
+       ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_SET_CREATION_TIME, &creation_time);
        if (ret == -ENOSYS) {
-               ret = LTTNG_IOCTL_CHECK(fd,
-                               LTTNG_KERNEL_ABI_OLD_SESSION_SET_CREATION_TIME,
-                               &creation_time);
+               ret = LTTNG_IOCTL_CHECK(
+                       fd, LTTNG_KERNEL_ABI_OLD_SESSION_SET_CREATION_TIME, &creation_time);
        }
 
 end:
@@ -381,8 +364,7 @@ end:
 
 int kernctl_create_stream(int fd)
 {
-       return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_STREAM,
-                       LTTNG_KERNEL_ABI_STREAM);
+       return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_STREAM, LTTNG_KERNEL_ABI_STREAM);
 }
 
 int kernctl_create_event(int fd, struct lttng_kernel_abi_event *ev)
@@ -398,27 +380,26 @@ int kernctl_create_event(int fd, struct lttng_kernel_abi_event *ev)
                        old_event.u.kprobe.addr = ev->u.kprobe.addr;
                        old_event.u.kprobe.offset = ev->u.kprobe.offset;
                        memcpy(old_event.u.kprobe.symbol_name,
-                               ev->u.kprobe.symbol_name,
-                               sizeof(old_event.u.kprobe.symbol_name));
+                              ev->u.kprobe.symbol_name,
+                              sizeof(old_event.u.kprobe.symbol_name));
                        break;
                case LTTNG_KERNEL_ABI_KRETPROBE:
                        old_event.u.kretprobe.addr = ev->u.kretprobe.addr;
                        old_event.u.kretprobe.offset = ev->u.kretprobe.offset;
                        memcpy(old_event.u.kretprobe.symbol_name,
-                               ev->u.kretprobe.symbol_name,
-                               sizeof(old_event.u.kretprobe.symbol_name));
+                              ev->u.kretprobe.symbol_name,
+                              sizeof(old_event.u.kretprobe.symbol_name));
                        break;
                case LTTNG_KERNEL_ABI_FUNCTION:
                        memcpy(old_event.u.ftrace.symbol_name,
-                                       ev->u.ftrace.symbol_name,
-                                       sizeof(old_event.u.ftrace.symbol_name));
+                              ev->u.ftrace.symbol_name,
+                              sizeof(old_event.u.ftrace.symbol_name));
                        break;
                default:
                        break;
                }
 
-               return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_OLD_EVENT,
-                               &old_event);
+               return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_OLD_EVENT, &old_event);
        }
        return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_EVENT, ev);
 }
@@ -432,85 +413,74 @@ int kernctl_add_context(int fd, struct lttng_kernel_abi_context *ctx)
                old_ctx.ctx = ctx->ctx;
                /* only type that uses the union */
                if (ctx->ctx == LTTNG_KERNEL_ABI_CONTEXT_PERF_CPU_COUNTER) {
-                       old_ctx.u.perf_counter.type =
-                               ctx->u.perf_counter.type;
-                       old_ctx.u.perf_counter.config =
-                               ctx->u.perf_counter.config;
+                       old_ctx.u.perf_counter.type = ctx->u.perf_counter.type;
+                       old_ctx.u.perf_counter.config = ctx->u.perf_counter.config;
                        memcpy(old_ctx.u.perf_counter.name,
-                               ctx->u.perf_counter.name,
-                               sizeof(old_ctx.u.perf_counter.name));
+                              ctx->u.perf_counter.name,
+                              sizeof(old_ctx.u.perf_counter.name));
                }
-               return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_OLD_CONTEXT,
-                               &old_ctx);
+               return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_OLD_CONTEXT, &old_ctx);
        }
        return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_CONTEXT, ctx);
 }
 
-
 /* Enable event, channel and session LTTNG_IOCTL_CHECK */
 int kernctl_enable(int fd)
 {
-       return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_ENABLE,
-                       LTTNG_KERNEL_ABI_ENABLE);
+       return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_ENABLE, LTTNG_KERNEL_ABI_ENABLE);
 }
 
 /* Disable event, channel and session LTTNG_IOCTL_CHECK */
 int kernctl_disable(int fd)
 {
-       return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_DISABLE,
-                       LTTNG_KERNEL_ABI_DISABLE);
+       return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_DISABLE, LTTNG_KERNEL_ABI_DISABLE);
 }
 
 int kernctl_start_session(int fd)
 {
-       return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_SESSION_START,
-                       LTTNG_KERNEL_ABI_SESSION_START);
+       return compat_ioctl_no_arg(
+               fd, LTTNG_KERNEL_ABI_OLD_SESSION_START, LTTNG_KERNEL_ABI_SESSION_START);
 }
 
 int kernctl_stop_session(int fd)
 {
-       return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_SESSION_STOP,
-                       LTTNG_KERNEL_ABI_SESSION_STOP);
+       return compat_ioctl_no_arg(
+               fd, LTTNG_KERNEL_ABI_OLD_SESSION_STOP, LTTNG_KERNEL_ABI_SESSION_STOP);
 }
 
 int kernctl_create_event_notifier_group(int fd)
 {
-       return LTTNG_IOCTL_NO_CHECK(fd,
-                       LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_CREATE);
+       return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_CREATE);
 }
 
 int kernctl_create_event_notifier_group_notification_fd(int group_fd)
 {
        return LTTNG_IOCTL_NO_CHECK(group_fd,
-                       LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD);
+                                   LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD);
 }
 
-int kernctl_create_event_notifier_group_error_counter(int group_fd,
-               const struct lttng_kernel_abi_counter_conf *error_counter_conf)
+int kernctl_create_event_notifier_group_error_counter(
+       int group_fd, const struct lttng_kernel_abi_counter_conf *error_counter_conf)
 {
-       return LTTNG_IOCTL_NO_CHECK(group_fd, LTTNG_KERNEL_ABI_COUNTER,
-                       error_counter_conf);
+       return LTTNG_IOCTL_NO_CHECK(group_fd, LTTNG_KERNEL_ABI_COUNTER, error_counter_conf);
 }
 
 int kernctl_counter_get_aggregate_value(int counter_fd,
-               struct lttng_kernel_abi_counter_aggregate *value)
+                                       struct lttng_kernel_abi_counter_aggregate *value)
 {
-       return LTTNG_IOCTL_NO_CHECK(counter_fd, LTTNG_KERNEL_ABI_COUNTER_AGGREGATE,
-                       value);
+       return LTTNG_IOCTL_NO_CHECK(counter_fd, LTTNG_KERNEL_ABI_COUNTER_AGGREGATE, value);
 }
 
-int kernctl_counter_clear(int counter_fd,
-               struct lttng_kernel_abi_counter_clear *clear)
+int kernctl_counter_clear(int counter_fd, struct lttng_kernel_abi_counter_clear *clear)
 {
-       return LTTNG_IOCTL_NO_CHECK(counter_fd, LTTNG_KERNEL_ABI_COUNTER_CLEAR,
-                       clear);
+       return LTTNG_IOCTL_NO_CHECK(counter_fd, LTTNG_KERNEL_ABI_COUNTER_CLEAR, clear);
 }
 
 int kernctl_create_event_notifier(int group_fd,
-               const struct lttng_kernel_abi_event_notifier *event_notifier)
+                                 const struct lttng_kernel_abi_event_notifier *event_notifier)
 {
-       return LTTNG_IOCTL_NO_CHECK(group_fd,
-                       LTTNG_KERNEL_ABI_EVENT_NOTIFIER_CREATE, event_notifier);
+       return LTTNG_IOCTL_NO_CHECK(
+               group_fd, LTTNG_KERNEL_ABI_EVENT_NOTIFIER_CREATE, event_notifier);
 }
 
 int kernctl_capture(int fd, const struct lttng_bytecode *capture)
@@ -561,8 +531,8 @@ int kernctl_add_callsite(int fd, struct lttng_kernel_abi_event_callsite *callsit
 
 int kernctl_tracepoint_list(int fd)
 {
-       return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_TRACEPOINT_LIST,
-                       LTTNG_KERNEL_ABI_TRACEPOINT_LIST);
+       return compat_ioctl_no_arg(
+               fd, LTTNG_KERNEL_ABI_OLD_TRACEPOINT_LIST, LTTNG_KERNEL_ABI_TRACEPOINT_LIST);
 }
 
 int kernctl_syscall_list(int fd)
@@ -600,16 +570,15 @@ end:
        return ret;
 }
 
-int kernctl_tracer_abi_version(int fd,
-               struct lttng_kernel_abi_tracer_abi_version *v)
+int kernctl_tracer_abi_version(int fd, struct lttng_kernel_abi_tracer_abi_version *v)
 {
        return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_TRACER_ABI_VERSION, v);
 }
 
 int kernctl_wait_quiescent(int fd)
 {
-       return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_WAIT_QUIESCENT,
-                       LTTNG_KERNEL_ABI_WAIT_QUIESCENT);
+       return compat_ioctl_no_arg(
+               fd, LTTNG_KERNEL_ABI_OLD_WAIT_QUIESCENT, LTTNG_KERNEL_ABI_WAIT_QUIESCENT);
 }
 
 int kernctl_buffer_flush(int fd)
@@ -629,16 +598,14 @@ int kernctl_buffer_clear(int fd)
 
 int kernctl_get_next_subbuf_metadata_check(int fd, bool *consistent)
 {
-       return LTTNG_IOCTL_NO_CHECK(fd,
-                       LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK,
-                       consistent);
+       return LTTNG_IOCTL_NO_CHECK(
+               fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK, consistent);
 }
 
 /* returns the version of the metadata. */
 int kernctl_get_metadata_version(int fd, uint64_t *version)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_METADATA_VERSION,
-                       version);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_METADATA_VERSION, version);
 }
 
 int kernctl_metadata_cache_dump(int fd)
@@ -653,15 +620,13 @@ int kernctl_metadata_cache_dump(int fd)
 /* returns the length to mmap. */
 int kernctl_get_mmap_len(int fd, unsigned long *len)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_LEN,
-                       len);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_LEN, len);
 }
 
 /* returns the maximum size for sub-buffers. */
 int kernctl_get_max_subbuf_size(int fd, unsigned long *len)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_MAX_SUBBUF_SIZE,
-                       len);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_MAX_SUBBUF_SIZE, len);
 }
 
 /*
@@ -672,22 +637,19 @@ int kernctl_get_max_subbuf_size(int fd, unsigned long *len)
 /* returns the offset of the subbuffer belonging to the mmap reader. */
 int kernctl_get_mmap_read_offset(int fd, unsigned long *off)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_READ_OFFSET,
-                       off);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_READ_OFFSET, off);
 }
 
 /* returns the size of the current sub-buffer, without padding (for mmap). */
 int kernctl_get_subbuf_size(int fd, unsigned long *len)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF_SIZE,
-                       len);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF_SIZE, len);
 }
 
 /* returns the size of the current sub-buffer, without padding (for mmap). */
 int kernctl_get_padded_subbuf_size(int fd, unsigned long *len)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_PADDED_SUBBUF_SIZE,
-                       len);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_PADDED_SUBBUF_SIZE, len);
 }
 
 /* Get exclusive read access to the next sub-buffer that can be read. */
@@ -696,7 +658,6 @@ int kernctl_get_next_subbuf(int fd)
        return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF);
 }
 
-
 /* Release exclusive sub-buffer access, move consumer forward. */
 int kernctl_put_next_subbuf(int fd)
 {
@@ -724,22 +685,19 @@ int kernctl_snapshot_sample_positions(int fd)
 /* Get the consumer position (iteration start) */
 int kernctl_snapshot_get_consumed(int fd, unsigned long *pos)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_CONSUMED,
-                       pos);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_CONSUMED, pos);
 }
 
 /* Get the producer position (iteration end) */
 int kernctl_snapshot_get_produced(int fd, unsigned long *pos)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_PRODUCED,
-                       pos);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_PRODUCED, pos);
 }
 
 /* Get exclusive read access to the specified sub-buffer position */
 int kernctl_get_subbuf(int fd, unsigned long *len)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF,
-                       len);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF, len);
 }
 
 /* Release exclusive sub-buffer access */
@@ -751,62 +709,55 @@ int kernctl_put_subbuf(int fd)
 /* Returns the timestamp begin of the current sub-buffer. */
 int kernctl_get_timestamp_begin(int fd, uint64_t *timestamp_begin)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_BEGIN,
-                       timestamp_begin);
+       return LTTNG_IOCTL_CHECK(
+               fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_BEGIN, timestamp_begin);
 }
 
 /* Returns the timestamp end of the current sub-buffer. */
 int kernctl_get_timestamp_end(int fd, uint64_t *timestamp_end)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_END,
-                       timestamp_end);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_END, timestamp_end);
 }
 
 /* Returns the number of discarded events in the current sub-buffer. */
 int kernctl_get_events_discarded(int fd, uint64_t *events_discarded)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_EVENTS_DISCARDED,
-                       events_discarded);
+       return LTTNG_IOCTL_CHECK(
+               fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_EVENTS_DISCARDED, events_discarded);
 }
 
 /* Returns the content size in the current sub-buffer. */
 int kernctl_get_content_size(int fd, uint64_t *content_size)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_CONTENT_SIZE,
-                       content_size);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_CONTENT_SIZE, content_size);
 }
 
 /* Returns the packet size in the current sub-buffer. */
 int kernctl_get_packet_size(int fd, uint64_t *packet_size)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_PACKET_SIZE,
-                       packet_size);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_PACKET_SIZE, packet_size);
 }
 
 /* Returns the stream id of the current sub-buffer. */
 int kernctl_get_stream_id(int fd, uint64_t *stream_id)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_STREAM_ID,
-                       stream_id);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_STREAM_ID, stream_id);
 }
 
 /* Returns the current timestamp. */
 int kernctl_get_current_timestamp(int fd, uint64_t *ts)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_CURRENT_TIMESTAMP,
-                       ts);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_CURRENT_TIMESTAMP, ts);
 }
 
 /* Returns the packet sequence number of the current sub-buffer. */
 int kernctl_get_sequence_number(int fd, uint64_t *seq)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_SEQ_NUM,
-                       seq);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_SEQ_NUM, seq);
 }
 
 /* Returns the stream instance id. */
 int kernctl_get_instance_id(int fd, uint64_t *id)
 {
-       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_INSTANCE_ID,
-                       id);
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_INSTANCE_ID, id);
 }
index b01b44b960a72bf77b92d34ef9fcb41d1657e32d..db900331ee3ddeabbb20bdcb80d796de14e30fe9 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include "lttng/lttng-error.h"
+
 #include <common/error.hpp>
 #include <common/hashtable/hashtable.hpp>
 #include <common/hashtable/utils.hpp>
 #include <common/mi-lttng.hpp>
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
-#include <fcntl.h>
+
 #include <lttng/constant.h>
 #include <lttng/kernel-probe-internal.hpp>
 #include <lttng/kernel-probe.h>
+
+#include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-static
-int lttng_kernel_probe_location_address_serialize(
-               const struct lttng_kernel_probe_location *location,
-               struct lttng_payload *payload);
-
-static
-int lttng_kernel_probe_location_symbol_serialize(
-               const struct lttng_kernel_probe_location *location,
-               struct lttng_payload *payload);
-
-static
-bool lttng_kernel_probe_location_address_is_equal(
-               const struct lttng_kernel_probe_location *a,
-               const struct lttng_kernel_probe_location *b);
-
-static
-bool lttng_kernel_probe_location_symbol_is_equal(
-               const struct lttng_kernel_probe_location *a,
-               const struct lttng_kernel_probe_location *b);
-
-static
-unsigned long lttng_kernel_probe_location_address_hash(
-               const struct lttng_kernel_probe_location *location);
-
-static
-unsigned long lttng_kernel_probe_location_symbol_hash(
-               const struct lttng_kernel_probe_location *location);
-
-static
-enum lttng_error_code lttng_kernel_probe_location_address_mi_serialize(
-               const struct lttng_kernel_probe_location *location,
-               struct mi_writer *writer);
-
-static
-enum lttng_error_code lttng_kernel_probe_location_symbol_mi_serialize(
-               const struct lttng_kernel_probe_location *location,
-               struct mi_writer *writer);
-
-enum lttng_kernel_probe_location_type lttng_kernel_probe_location_get_type(
-               const struct lttng_kernel_probe_location *location)
+static int
+lttng_kernel_probe_location_address_serialize(const struct lttng_kernel_probe_location *location,
+                                             struct lttng_payload *payload);
+
+static int
+lttng_kernel_probe_location_symbol_serialize(const struct lttng_kernel_probe_location *location,
+                                            struct lttng_payload *payload);
+
+static bool
+lttng_kernel_probe_location_address_is_equal(const struct lttng_kernel_probe_location *a,
+                                            const struct lttng_kernel_probe_location *b);
+
+static bool
+lttng_kernel_probe_location_symbol_is_equal(const struct lttng_kernel_probe_location *a,
+                                           const struct lttng_kernel_probe_location *b);
+
+static unsigned long
+lttng_kernel_probe_location_address_hash(const struct lttng_kernel_probe_location *location);
+
+static unsigned long
+lttng_kernel_probe_location_symbol_hash(const struct lttng_kernel_probe_location *location);
+
+static enum lttng_error_code
+lttng_kernel_probe_location_address_mi_serialize(const struct lttng_kernel_probe_location *location,
+                                                struct mi_writer *writer);
+
+static enum lttng_error_code
+lttng_kernel_probe_location_symbol_mi_serialize(const struct lttng_kernel_probe_location *location,
+                                               struct mi_writer *writer);
+
+enum lttng_kernel_probe_location_type
+lttng_kernel_probe_location_get_type(const struct lttng_kernel_probe_location *location)
 {
-       return location ? location->type :
-                       LTTNG_KERNEL_PROBE_LOCATION_TYPE_UNKNOWN;
+       return location ? location->type : LTTNG_KERNEL_PROBE_LOCATION_TYPE_UNKNOWN;
 }
 
-static
-void lttng_kernel_probe_location_address_destroy(
-               struct lttng_kernel_probe_location *location)
+static void
+lttng_kernel_probe_location_address_destroy(struct lttng_kernel_probe_location *location)
 {
        LTTNG_ASSERT(location);
        free(location);
 }
 
-static
-void lttng_kernel_probe_location_symbol_destroy(
-               struct lttng_kernel_probe_location *location)
+static void lttng_kernel_probe_location_symbol_destroy(struct lttng_kernel_probe_location *location)
 {
        struct lttng_kernel_probe_location_symbol *location_symbol = NULL;
 
        LTTNG_ASSERT(location);
 
-       location_symbol = lttng::utils::container_of(location,
-                       &lttng_kernel_probe_location_symbol::parent);
+       location_symbol =
+               lttng::utils::container_of(location, &lttng_kernel_probe_location_symbol::parent);
 
        LTTNG_ASSERT(location_symbol);
 
@@ -91,8 +82,7 @@ void lttng_kernel_probe_location_symbol_destroy(
        free(location);
 }
 
-void lttng_kernel_probe_location_destroy(
-               struct lttng_kernel_probe_location *location)
+void lttng_kernel_probe_location_destroy(struct lttng_kernel_probe_location *location)
 {
        if (!location) {
                return;
@@ -110,8 +100,7 @@ void lttng_kernel_probe_location_destroy(
        }
 }
 
-struct lttng_kernel_probe_location *
-lttng_kernel_probe_location_address_create(uint64_t address)
+struct lttng_kernel_probe_location *lttng_kernel_probe_location_address_create(uint64_t address)
 {
        struct lttng_kernel_probe_location *ret = NULL;
        struct lttng_kernel_probe_location_address *location;
@@ -136,8 +125,7 @@ end:
 }
 
 struct lttng_kernel_probe_location *
-lttng_kernel_probe_location_symbol_create(const char *symbol_name,
-               uint64_t offset)
+lttng_kernel_probe_location_symbol_create(const char *symbol_name, uint64_t offset)
 {
        char *symbol_name_copy = NULL;
        struct lttng_kernel_probe_location *ret = NULL;
@@ -177,78 +165,76 @@ end:
 }
 
 enum lttng_kernel_probe_location_status
-lttng_kernel_probe_location_address_get_address(
-               const struct lttng_kernel_probe_location *location,
-               uint64_t *offset)
+lttng_kernel_probe_location_address_get_address(const struct lttng_kernel_probe_location *location,
+                                               uint64_t *offset)
 {
-       enum lttng_kernel_probe_location_status ret =
-                       LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK;
+       enum lttng_kernel_probe_location_status ret = LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK;
        struct lttng_kernel_probe_location_address *address_location;
 
        LTTNG_ASSERT(offset);
 
-       if (!location || lttng_kernel_probe_location_get_type(location) !=
-                       LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS) {
+       if (!location ||
+           lttng_kernel_probe_location_get_type(location) !=
+                   LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                ret = LTTNG_KERNEL_PROBE_LOCATION_STATUS_INVALID;
                goto end;
        }
 
-       address_location = lttng::utils::container_of(location,
-                       &lttng_kernel_probe_location_address::parent);
+       address_location =
+               lttng::utils::container_of(location, &lttng_kernel_probe_location_address::parent);
        *offset = address_location->address;
 end:
        return ret;
 }
 
-const char *lttng_kernel_probe_location_symbol_get_name(
-               const struct lttng_kernel_probe_location *location)
+const char *
+lttng_kernel_probe_location_symbol_get_name(const struct lttng_kernel_probe_location *location)
 {
        const char *ret = NULL;
        struct lttng_kernel_probe_location_symbol *symbol_location;
 
-       if (!location || lttng_kernel_probe_location_get_type(location) !=
-                       LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET) {
+       if (!location ||
+           lttng_kernel_probe_location_get_type(location) !=
+                   LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                goto end;
        }
 
-       symbol_location = lttng::utils::container_of(location,
-                       &lttng_kernel_probe_location_symbol::parent);
+       symbol_location =
+               lttng::utils::container_of(location, &lttng_kernel_probe_location_symbol::parent);
        ret = symbol_location->symbol_name;
 end:
        return ret;
 }
 
 enum lttng_kernel_probe_location_status
-lttng_kernel_probe_location_symbol_get_offset(
-               const struct lttng_kernel_probe_location *location,
-               uint64_t *offset)
+lttng_kernel_probe_location_symbol_get_offset(const struct lttng_kernel_probe_location *location,
+                                             uint64_t *offset)
 {
-       enum lttng_kernel_probe_location_status ret =
-                       LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK;
+       enum lttng_kernel_probe_location_status ret = LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK;
        struct lttng_kernel_probe_location_symbol *symbol_location;
 
        LTTNG_ASSERT(offset);
 
-       if (!location || lttng_kernel_probe_location_get_type(location) !=
-                       LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET) {
+       if (!location ||
+           lttng_kernel_probe_location_get_type(location) !=
+                   LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                ret = LTTNG_KERNEL_PROBE_LOCATION_STATUS_INVALID;
                goto end;
        }
 
-       symbol_location = lttng::utils::container_of(location,
-                       &lttng_kernel_probe_location_symbol::parent);
+       symbol_location =
+               lttng::utils::container_of(location, &lttng_kernel_probe_location_symbol::parent);
        *offset = symbol_location->offset;
 end:
        return ret;
 }
 
-static
-int lttng_kernel_probe_location_symbol_serialize(
-               const struct lttng_kernel_probe_location *location,
-               struct lttng_payload *payload)
+static int
+lttng_kernel_probe_location_symbol_serialize(const struct lttng_kernel_probe_location *location,
+                                            struct lttng_payload *payload)
 {
        int ret;
        size_t symbol_name_len;
@@ -263,11 +249,11 @@ int lttng_kernel_probe_location_symbol_serialize(
        }
 
        LTTNG_ASSERT(lttng_kernel_probe_location_get_type(location) ==
-                       LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
+                    LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
 
        original_payload_size = payload->buffer.size;
-       location_symbol = lttng::utils::container_of(location,
-                       &lttng_kernel_probe_location_symbol::parent);
+       location_symbol =
+               lttng::utils::container_of(location, &lttng_kernel_probe_location_symbol::parent);
 
        if (!location_symbol->symbol_name) {
                ret = -LTTNG_ERR_INVALID;
@@ -283,16 +269,15 @@ int lttng_kernel_probe_location_symbol_serialize(
        location_symbol_comm.symbol_len = symbol_name_len + 1;
        location_symbol_comm.offset = location_symbol->offset;
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer,
-                       &location_symbol_comm, sizeof(location_symbol_comm));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &location_symbol_comm, sizeof(location_symbol_comm));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer,
-                       location_symbol->symbol_name,
-                       location_symbol_comm.symbol_len);
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, location_symbol->symbol_name, location_symbol_comm.symbol_len);
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -303,10 +288,9 @@ end:
        return ret;
 }
 
-static
-int lttng_kernel_probe_location_address_serialize(
-               const struct lttng_kernel_probe_location *location,
-               struct lttng_payload *payload)
+static int
+lttng_kernel_probe_location_address_serialize(const struct lttng_kernel_probe_location *location,
+                                             struct lttng_payload *payload)
 {
        int ret;
        size_t original_payload_size;
@@ -315,17 +299,16 @@ int lttng_kernel_probe_location_address_serialize(
 
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(lttng_kernel_probe_location_get_type(location) ==
-                       LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
+                    LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
 
        original_payload_size = payload->buffer.size;
-       location_address = lttng::utils::container_of(location,
-                       &lttng_kernel_probe_location_address::parent);
+       location_address =
+               lttng::utils::container_of(location, &lttng_kernel_probe_location_address::parent);
 
        location_address_comm.address = location_address->address;
 
-       ret = lttng_dynamic_buffer_append(&payload->buffer,
-                       &location_address_comm,
-                       sizeof(location_address_comm));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &location_address_comm, sizeof(location_address_comm));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -336,9 +319,8 @@ end:
        return ret;
 }
 
-int lttng_kernel_probe_location_serialize(
-               const struct lttng_kernel_probe_location *location,
-               struct lttng_payload *payload)
+int lttng_kernel_probe_location_serialize(const struct lttng_kernel_probe_location *location,
+                                         struct lttng_payload *payload)
 {
        int ret;
        size_t original_payload_size;
@@ -352,9 +334,8 @@ int lttng_kernel_probe_location_serialize(
 
        original_payload_size = payload->buffer.size;
        location_generic_comm.type = (int8_t) location->type;
-       ret = lttng_dynamic_buffer_append(&payload->buffer,
-                       &location_generic_comm,
-                       sizeof(location_generic_comm));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &location_generic_comm, sizeof(location_generic_comm));
        if (ret) {
                goto end;
        }
@@ -369,10 +350,8 @@ end:
        return ret;
 }
 
-static
-int lttng_kernel_probe_location_symbol_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_kernel_probe_location **location)
+static int lttng_kernel_probe_location_symbol_create_from_payload(
+       struct lttng_payload_view *view, struct lttng_kernel_probe_location **location)
 {
        struct lttng_kernel_probe_location_symbol_comm *location_symbol_comm;
        const char *symbol_name_src;
@@ -386,11 +365,9 @@ int lttng_kernel_probe_location_symbol_create_from_payload(
                goto end;
        }
 
-       location_symbol_comm =
-                       (typeof(location_symbol_comm)) view->buffer.data;
+       location_symbol_comm = (typeof(location_symbol_comm)) view->buffer.data;
 
-       expected_size = sizeof(*location_symbol_comm) +
-                       location_symbol_comm->symbol_len;
+       expected_size = sizeof(*location_symbol_comm) + location_symbol_comm->symbol_len;
 
        if (view->buffer.size < expected_size) {
                ret = -LTTNG_ERR_INVALID;
@@ -399,14 +376,14 @@ int lttng_kernel_probe_location_symbol_create_from_payload(
 
        symbol_name_src = view->buffer.data + sizeof(*location_symbol_comm);
 
-       if (!lttng_buffer_view_contains_string(&view->buffer, symbol_name_src,
-                       location_symbol_comm->symbol_len)) {
+       if (!lttng_buffer_view_contains_string(
+                   &view->buffer, symbol_name_src, location_symbol_comm->symbol_len)) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       *location = lttng_kernel_probe_location_symbol_create(
-                       symbol_name_src, location_symbol_comm->offset);
+       *location = lttng_kernel_probe_location_symbol_create(symbol_name_src,
+                                                             location_symbol_comm->offset);
        if (!(*location)) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -417,10 +394,8 @@ end:
        return ret;
 }
 
-static
-ssize_t lttng_kernel_probe_location_address_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_kernel_probe_location **location)
+static ssize_t lttng_kernel_probe_location_address_create_from_payload(
+       struct lttng_payload_view *view, struct lttng_kernel_probe_location **location)
 {
        struct lttng_kernel_probe_location_address_comm *location_address_comm;
        ssize_t ret = 0;
@@ -435,8 +410,7 @@ ssize_t lttng_kernel_probe_location_address_create_from_payload(
                goto end;
        }
 
-       location_address_comm =
-                       (typeof(location_address_comm)) view->buffer.data;
+       location_address_comm = (typeof(location_address_comm)) view->buffer.data;
 
        *location = lttng_kernel_probe_location_address_create(location_address_comm->address);
        if (!(*location)) {
@@ -449,17 +423,16 @@ end:
        return ret;
 }
 
-ssize_t lttng_kernel_probe_location_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_kernel_probe_location **location)
+ssize_t
+lttng_kernel_probe_location_create_from_payload(struct lttng_payload_view *view,
+                                               struct lttng_kernel_probe_location **location)
 {
        enum lttng_kernel_probe_location_type type;
        ssize_t consumed = 0;
        ssize_t ret;
        const struct lttng_kernel_probe_location_comm *probe_location_comm;
        const struct lttng_payload_view probe_location_comm_view =
-                       lttng_payload_view_from_view(
-                                       view, 0, sizeof(*probe_location_comm));
+               lttng_payload_view_from_view(view, 0, sizeof(*probe_location_comm));
 
        LTTNG_ASSERT(view);
        LTTNG_ASSERT(location);
@@ -477,20 +450,19 @@ ssize_t lttng_kernel_probe_location_create_from_payload(
        case LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET:
        {
                struct lttng_payload_view location_view =
-                               lttng_payload_view_from_view(
-                                               view, consumed, -1);
+                       lttng_payload_view_from_view(view, consumed, -1);
 
-               ret = lttng_kernel_probe_location_symbol_create_from_payload(
-                               &location_view, location);
+               ret = lttng_kernel_probe_location_symbol_create_from_payload(&location_view,
+                                                                            location);
                break;
        }
        case LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS:
        {
                struct lttng_payload_view location_view =
-                               lttng_payload_view_from_view(view, consumed, -1);
+                       lttng_payload_view_from_view(view, consumed, -1);
 
-               ret = lttng_kernel_probe_location_address_create_from_payload(
-                               &location_view, location);
+               ret = lttng_kernel_probe_location_address_create_from_payload(&location_view,
+                                                                             location);
                break;
        }
        default:
@@ -509,25 +481,22 @@ end:
        return ret;
 }
 
-static
-unsigned long lttng_kernel_probe_location_address_hash(
-               const struct lttng_kernel_probe_location *location)
+static unsigned long
+lttng_kernel_probe_location_address_hash(const struct lttng_kernel_probe_location *location)
 {
-       unsigned long hash = hash_key_ulong(
-                       (void *) LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS,
-                       lttng_ht_seed);
-       struct lttng_kernel_probe_location_address *address_location = lttng::utils::container_of(
-                       location, &lttng_kernel_probe_location_address::parent);
+       unsigned long hash =
+               hash_key_ulong((void *) LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS, lttng_ht_seed);
+       struct lttng_kernel_probe_location_address *address_location =
+               lttng::utils::container_of(location, &lttng_kernel_probe_location_address::parent);
 
        hash ^= hash_key_u64(&address_location->address, lttng_ht_seed);
 
        return hash;
 }
 
-static
-bool lttng_kernel_probe_location_address_is_equal(
-               const struct lttng_kernel_probe_location *_a,
-               const struct lttng_kernel_probe_location *_b)
+static bool
+lttng_kernel_probe_location_address_is_equal(const struct lttng_kernel_probe_location *_a,
+                                            const struct lttng_kernel_probe_location *_b)
 {
        bool is_equal = false;
        struct lttng_kernel_probe_location_address *a, *b;
@@ -545,14 +514,13 @@ end:
        return is_equal;
 }
 
-static
-unsigned long lttng_kernel_probe_location_symbol_hash(
-               const struct lttng_kernel_probe_location *location)
+static unsigned long
+lttng_kernel_probe_location_symbol_hash(const struct lttng_kernel_probe_location *location)
 {
-       unsigned long hash = hash_key_ulong(
-                       (void *) LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET, lttng_ht_seed);
-       struct lttng_kernel_probe_location_symbol *symbol_location = lttng::utils::container_of(
-                       location, &lttng_kernel_probe_location_symbol::parent);
+       unsigned long hash = hash_key_ulong((void *) LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET,
+                                           lttng_ht_seed);
+       struct lttng_kernel_probe_location_symbol *symbol_location =
+               lttng::utils::container_of(location, &lttng_kernel_probe_location_symbol::parent);
 
        hash ^= hash_key_str(symbol_location->symbol_name, lttng_ht_seed);
        hash ^= hash_key_u64(&symbol_location->offset, lttng_ht_seed);
@@ -560,18 +528,15 @@ unsigned long lttng_kernel_probe_location_symbol_hash(
        return hash;
 }
 
-static
-bool lttng_kernel_probe_location_symbol_is_equal(
-               const struct lttng_kernel_probe_location *_a,
-               const struct lttng_kernel_probe_location *_b)
+static bool
+lttng_kernel_probe_location_symbol_is_equal(const struct lttng_kernel_probe_location *_a,
+                                           const struct lttng_kernel_probe_location *_b)
 {
        bool is_equal = false;
        struct lttng_kernel_probe_location_symbol *a, *b;
 
-       a = lttng::utils::container_of(_a,
-                       &lttng_kernel_probe_location_symbol::parent);
-       b = lttng::utils::container_of(_b,
-                       &lttng_kernel_probe_location_symbol::parent);
+       a = lttng::utils::container_of(_a, &lttng_kernel_probe_location_symbol::parent);
+       b = lttng::utils::container_of(_b, &lttng_kernel_probe_location_symbol::parent);
 
        LTTNG_ASSERT(a->symbol_name);
        LTTNG_ASSERT(b->symbol_name);
@@ -589,9 +554,8 @@ end:
        return is_equal;
 }
 
-bool lttng_kernel_probe_location_is_equal(
-               const struct lttng_kernel_probe_location *a,
-               const struct lttng_kernel_probe_location *b)
+bool lttng_kernel_probe_location_is_equal(const struct lttng_kernel_probe_location *a,
+                                         const struct lttng_kernel_probe_location *b)
 {
        bool is_equal = false;
 
@@ -614,8 +578,7 @@ end:
 }
 
 static struct lttng_kernel_probe_location *
-lttng_kernel_probe_location_symbol_copy(
-               const struct lttng_kernel_probe_location *location)
+lttng_kernel_probe_location_symbol_copy(const struct lttng_kernel_probe_location *location)
 {
        struct lttng_kernel_probe_location *new_location = NULL;
        enum lttng_kernel_probe_location_status status;
@@ -625,7 +588,7 @@ lttng_kernel_probe_location_symbol_copy(
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
 
-        /* Get probe location offset */
+       /* Get probe location offset */
        status = lttng_kernel_probe_location_symbol_get_offset(location, &offset);
        if (status != LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK) {
                ERR("Get kernel probe location offset failed.");
@@ -639,8 +602,7 @@ lttng_kernel_probe_location_symbol_copy(
        }
 
        /* Create the probe_location */
-       new_location = lttng_kernel_probe_location_symbol_create(
-                       symbol_name, offset);
+       new_location = lttng_kernel_probe_location_symbol_create(symbol_name, offset);
 
        goto end;
 
@@ -650,8 +612,7 @@ end:
        return new_location;
 }
 static struct lttng_kernel_probe_location *
-lttng_kernel_probe_location_address_copy(
-               const struct lttng_kernel_probe_location *location)
+lttng_kernel_probe_location_address_copy(const struct lttng_kernel_probe_location *location)
 {
        struct lttng_kernel_probe_location *new_location = NULL;
        enum lttng_kernel_probe_location_status status;
@@ -678,8 +639,8 @@ end:
        return new_location;
 }
 
-struct lttng_kernel_probe_location *lttng_kernel_probe_location_copy(
-               const struct lttng_kernel_probe_location *location)
+struct lttng_kernel_probe_location *
+lttng_kernel_probe_location_copy(const struct lttng_kernel_probe_location *location)
 {
        struct lttng_kernel_probe_location *new_location = NULL;
        enum lttng_kernel_probe_location_type type;
@@ -691,15 +652,13 @@ struct lttng_kernel_probe_location *lttng_kernel_probe_location_copy(
        type = lttng_kernel_probe_location_get_type(location);
        switch (type) {
        case LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS:
-               new_location =
-                       lttng_kernel_probe_location_address_copy(location);
+               new_location = lttng_kernel_probe_location_address_copy(location);
                if (!new_location) {
                        goto err;
                }
                break;
        case LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET:
-               new_location =
-                       lttng_kernel_probe_location_symbol_copy(location);
+               new_location = lttng_kernel_probe_location_symbol_copy(location);
                if (!new_location) {
                        goto err;
                }
@@ -712,16 +671,14 @@ err:
        return new_location;
 }
 
-unsigned long lttng_kernel_probe_location_hash(
-       const struct lttng_kernel_probe_location *location)
+unsigned long lttng_kernel_probe_location_hash(const struct lttng_kernel_probe_location *location)
 {
        return location->hash(location);
 }
 
-static
-enum lttng_error_code lttng_kernel_probe_location_address_mi_serialize(
-               const struct lttng_kernel_probe_location *location,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_kernel_probe_location_address_mi_serialize(const struct lttng_kernel_probe_location *location,
+                                                struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -732,20 +689,17 @@ enum lttng_error_code lttng_kernel_probe_location_address_mi_serialize(
        LTTNG_ASSERT(writer);
        LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
 
-       status = lttng_kernel_probe_location_address_get_address(
-                       location, &address);
+       status = lttng_kernel_probe_location_address_get_address(location, &address);
        LTTNG_ASSERT(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
 
        /* Open kernel probe location address element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_kernel_probe_location_address);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_kernel_probe_location_address);
        if (ret) {
                goto mi_error;
        }
 
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       mi_lttng_element_kernel_probe_location_address_address,
-                       address);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, mi_lttng_element_kernel_probe_location_address_address, address);
        if (ret) {
                goto mi_error;
        }
@@ -765,10 +719,9 @@ end:
        return ret_code;
 }
 
-static
-enum lttng_error_code lttng_kernel_probe_location_symbol_mi_serialize(
-               const struct lttng_kernel_probe_location *location,
-               struct mi_writer *writer)
+static enum lttng_error_code
+lttng_kernel_probe_location_symbol_mi_serialize(const struct lttng_kernel_probe_location *location,
+                                               struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -778,35 +731,31 @@ enum lttng_error_code lttng_kernel_probe_location_symbol_mi_serialize(
 
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(writer);
-       LTTNG_ASSERT(location->type ==
-                       LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
+       LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
 
        name = lttng_kernel_probe_location_symbol_get_name(location);
        LTTNG_ASSERT(name);
 
-       status = lttng_kernel_probe_location_symbol_get_offset(
-                       location, &offset);
+       status = lttng_kernel_probe_location_symbol_get_offset(location, &offset);
        LTTNG_ASSERT(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
 
        /* Open kernel probe location symbol offset element. */
        ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_kernel_probe_location_symbol_offset);
+                                          mi_lttng_element_kernel_probe_location_symbol_offset);
        if (ret) {
                goto mi_error;
        }
 
        /* Name. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_kernel_probe_location_symbol_offset_name,
-                       name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_kernel_probe_location_symbol_offset_name, name);
        if (ret) {
                goto mi_error;
        }
 
        /* Offset. */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       mi_lttng_element_kernel_probe_location_symbol_offset_offset,
-                       offset);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, mi_lttng_element_kernel_probe_location_symbol_offset_offset, offset);
        if (ret) {
                goto mi_error;
        }
@@ -826,9 +775,9 @@ end:
        return ret_code;
 }
 
-enum lttng_error_code lttng_kernel_probe_location_mi_serialize(
-               const struct lttng_kernel_probe_location *location,
-               struct mi_writer *writer)
+enum lttng_error_code
+lttng_kernel_probe_location_mi_serialize(const struct lttng_kernel_probe_location *location,
+                                        struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -837,8 +786,7 @@ enum lttng_error_code lttng_kernel_probe_location_mi_serialize(
        LTTNG_ASSERT(writer);
 
        /* Open kernel probe location element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_kernel_probe_location);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_kernel_probe_location);
        if (ret) {
                goto mi_error;
        }
index b09430d617e408f76a88c041bc6fc1d5f96c8cf4..7d9a95a711c31e98db842ce19b04bea1b2cd6984 100644 (file)
@@ -5,14 +5,15 @@
  *
  */
 
-#include <lttng/location-internal.hpp>
+#include <common/error.hpp>
 #include <common/macros.hpp>
+
+#include <lttng/location-internal.hpp>
+
 #include <stdlib.h>
-#include <common/error.hpp>
 
-static
-struct lttng_trace_archive_location *lttng_trace_archive_location_create(
-               enum lttng_trace_archive_location_type type)
+static struct lttng_trace_archive_location *
+lttng_trace_archive_location_create(enum lttng_trace_archive_location_type type)
 {
        struct lttng_trace_archive_location *location;
 
@@ -27,11 +28,10 @@ end:
        return location;
 }
 
-static
-void trace_archive_location_destroy_ref(struct urcu_ref *ref)
+static void trace_archive_location_destroy_ref(struct urcu_ref *ref)
 {
        struct lttng_trace_archive_location *location =
-                       lttng::utils::container_of(ref, &lttng_trace_archive_location::ref);
+               lttng::utils::container_of(ref, &lttng_trace_archive_location::ref);
 
        switch (location->type) {
        case LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL:
@@ -62,8 +62,8 @@ void lttng_trace_archive_location_put(struct lttng_trace_archive_location *locat
        urcu_ref_put(&location->ref, trace_archive_location_destroy_ref);
 }
 
-struct lttng_trace_archive_location *lttng_trace_archive_location_local_create(
-               const char *absolute_path)
+struct lttng_trace_archive_location *
+lttng_trace_archive_location_local_create(const char *absolute_path)
 {
        struct lttng_trace_archive_location *location = NULL;
 
@@ -71,8 +71,7 @@ struct lttng_trace_archive_location *lttng_trace_archive_location_local_create(
                goto end;
        }
 
-       location = lttng_trace_archive_location_create(
-                       LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL);
+       location = lttng_trace_archive_location_create(LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL);
        if (!location) {
                goto end;
        }
@@ -90,10 +89,11 @@ error:
 }
 
 struct lttng_trace_archive_location *lttng_trace_archive_location_relay_create(
-               const char *host,
-               enum lttng_trace_archive_location_relay_protocol_type protocol,
-               uint16_t control_port, uint16_t data_port,
-               const char *relative_path)
+       const char *host,
+       enum lttng_trace_archive_location_relay_protocol_type protocol,
+       uint16_t control_port,
+       uint16_t data_port,
+       const char *relative_path)
 {
        struct lttng_trace_archive_location *location = NULL;
 
@@ -101,8 +101,7 @@ struct lttng_trace_archive_location *lttng_trace_archive_location_relay_create(
                goto end;
        }
 
-       location = lttng_trace_archive_location_create(
-                       LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY);
+       location = lttng_trace_archive_location_create(LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY);
        if (!location) {
                goto end;
        }
@@ -126,16 +125,15 @@ error:
        return NULL;
 }
 
-ssize_t lttng_trace_archive_location_create_from_buffer(
-               const struct lttng_buffer_view *view,
-               struct lttng_trace_archive_location **location)
+ssize_t
+lttng_trace_archive_location_create_from_buffer(const struct lttng_buffer_view *view,
+                                               struct lttng_trace_archive_location **location)
 {
        size_t offset = 0;
        const struct lttng_trace_archive_location_comm *location_comm;
        struct lttng_buffer_view location_comm_view;
 
-       location_comm_view = lttng_buffer_view_from_view(view, 0,
-                       sizeof(*location_comm));
+       location_comm_view = lttng_buffer_view_from_view(view, 0, sizeof(*location_comm));
        if (!lttng_buffer_view_is_valid(&location_comm_view)) {
                goto error;
        }
@@ -146,9 +144,8 @@ ssize_t lttng_trace_archive_location_create_from_buffer(
        switch ((enum lttng_trace_archive_location_type) location_comm->type) {
        case LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL:
        {
-               const struct lttng_buffer_view absolute_path_view =
-                               lttng_buffer_view_from_view(view, offset,
-                               location_comm->types.local.absolute_path_len);
+               const struct lttng_buffer_view absolute_path_view = lttng_buffer_view_from_view(
+                       view, offset, location_comm->types.local.absolute_path_len);
 
                if (!lttng_buffer_view_is_valid(&absolute_path_view)) {
                        goto error;
@@ -159,8 +156,7 @@ ssize_t lttng_trace_archive_location_create_from_buffer(
                }
                offset += absolute_path_view.size;
 
-               *location = lttng_trace_archive_location_local_create(
-                               absolute_path_view.data);
+               *location = lttng_trace_archive_location_local_create(absolute_path_view.data);
                if (!*location) {
                        goto error;
                }
@@ -168,17 +164,15 @@ ssize_t lttng_trace_archive_location_create_from_buffer(
        }
        case LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY:
        {
-               const struct lttng_buffer_view hostname_view =
-                               lttng_buffer_view_from_view(view, offset,
-                               location_comm->types.relay.hostname_len);
+               const struct lttng_buffer_view hostname_view = lttng_buffer_view_from_view(
+                       view, offset, location_comm->types.relay.hostname_len);
                const struct lttng_buffer_view relative_path_view =
-                               lttng_buffer_view_from_view(view,
-                               offset + hostname_view.size,
-                               location_comm->types.relay.relative_path_len);
+                       lttng_buffer_view_from_view(view,
+                                                   offset + hostname_view.size,
+                                                   location_comm->types.relay.relative_path_len);
 
                if (!lttng_buffer_view_is_valid(&hostname_view) ||
-                               !lttng_buffer_view_is_valid(
-                                               &relative_path_view)) {
+                   !lttng_buffer_view_is_valid(&relative_path_view)) {
                        goto error;
                }
 
@@ -191,11 +185,12 @@ ssize_t lttng_trace_archive_location_create_from_buffer(
                offset += hostname_view.size + relative_path_view.size;
 
                *location = lttng_trace_archive_location_relay_create(
-                               hostname_view.data,
-                               (enum lttng_trace_archive_location_relay_protocol_type) location_comm->types.relay.protocol,
-                               location_comm->types.relay.ports.control,
-                               location_comm->types.relay.ports.data,
-                               relative_path_view.data);
+                       hostname_view.data,
+                       (enum lttng_trace_archive_location_relay_protocol_type)
+                               location_comm->types.relay.protocol,
+                       location_comm->types.relay.ports.control,
+                       location_comm->types.relay.ports.data,
+                       relative_path_view.data);
                if (!*location) {
                        goto error;
                }
@@ -210,9 +205,8 @@ error:
        return -1;
 }
 
-ssize_t lttng_trace_archive_location_serialize(
-               const struct lttng_trace_archive_location *location,
-               struct lttng_dynamic_buffer *buffer)
+ssize_t lttng_trace_archive_location_serialize(const struct lttng_trace_archive_location *location,
+                                              struct lttng_dynamic_buffer *buffer)
 {
        int ret;
        struct lttng_trace_archive_location_comm location_comm;
@@ -222,26 +216,21 @@ ssize_t lttng_trace_archive_location_serialize(
        switch (location->type) {
        case LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL:
                location_comm.types.local.absolute_path_len =
-                               strlen(location->types.local.absolute_path) + 1;
+                       strlen(location->types.local.absolute_path) + 1;
                break;
        case LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY:
-               location_comm.types.relay.hostname_len =
-                               strlen(location->types.relay.host) + 1;
-               location_comm.types.relay.protocol =
-                               (int8_t) location->types.relay.protocol;
-               location_comm.types.relay.ports.control =
-                               location->types.relay.ports.control;
-               location_comm.types.relay.ports.data =
-                               location->types.relay.ports.data;
+               location_comm.types.relay.hostname_len = strlen(location->types.relay.host) + 1;
+               location_comm.types.relay.protocol = (int8_t) location->types.relay.protocol;
+               location_comm.types.relay.ports.control = location->types.relay.ports.control;
+               location_comm.types.relay.ports.data = location->types.relay.ports.data;
                location_comm.types.relay.relative_path_len =
-                               strlen(location->types.relay.relative_path) + 1;
+                       strlen(location->types.relay.relative_path) + 1;
                break;
        default:
                abort();
        }
 
-       ret = lttng_dynamic_buffer_append(buffer, &location_comm,
-                       sizeof(location_comm));
+       ret = lttng_dynamic_buffer_append(buffer, &location_comm, sizeof(location_comm));
        if (ret) {
                goto error;
        }
@@ -249,22 +238,21 @@ ssize_t lttng_trace_archive_location_serialize(
        switch (location->type) {
        case LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL:
                ret = lttng_dynamic_buffer_append(buffer,
-                               location->types.local.absolute_path,
-                               location_comm.types.local.absolute_path_len);
+                                                 location->types.local.absolute_path,
+                                                 location_comm.types.local.absolute_path_len);
                if (ret) {
                        goto error;
                }
                break;
        case LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY:
-               ret = lttng_dynamic_buffer_append(buffer,
-                               location->types.relay.host,
-                               location_comm.types.relay.hostname_len);
+               ret = lttng_dynamic_buffer_append(
+                       buffer, location->types.relay.host, location_comm.types.relay.hostname_len);
                if (ret) {
                        goto error;
                }
                ret = lttng_dynamic_buffer_append(buffer,
-                               location->types.relay.relative_path,
-                               location_comm.types.relay.relative_path_len);
+                                                 location->types.relay.relative_path,
+                                                 location_comm.types.relay.relative_path_len);
                if (ret) {
                        goto error;
                }
@@ -278,8 +266,8 @@ error:
        return -1;
 }
 
-enum lttng_trace_archive_location_type lttng_trace_archive_location_get_type(
-               const struct lttng_trace_archive_location *location)
+enum lttng_trace_archive_location_type
+lttng_trace_archive_location_get_type(const struct lttng_trace_archive_location *location)
 {
        enum lttng_trace_archive_location_type type;
 
@@ -293,16 +281,13 @@ end:
        return type;
 }
 
-enum lttng_trace_archive_location_status
-lttng_trace_archive_location_local_get_absolute_path(
-               const struct lttng_trace_archive_location *location,
-               const char **absolute_path)
+enum lttng_trace_archive_location_status lttng_trace_archive_location_local_get_absolute_path(
+       const struct lttng_trace_archive_location *location, const char **absolute_path)
 {
-       enum lttng_trace_archive_location_status status =
-                       LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK;
+       enum lttng_trace_archive_location_status status = LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK;
 
        if (!location || !absolute_path ||
-                       location->type != LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL) {
+           location->type != LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL) {
                status = LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_INVALID;
                goto end;
        }
@@ -313,15 +298,12 @@ end:
 }
 
 enum lttng_trace_archive_location_status
-lttng_trace_archive_location_relay_get_host(
-               const struct lttng_trace_archive_location *location,
-               const char **relay_host)
+lttng_trace_archive_location_relay_get_host(const struct lttng_trace_archive_location *location,
+                                           const char **relay_host)
 {
-       enum lttng_trace_archive_location_status status =
-                       LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK;
+       enum lttng_trace_archive_location_status status = LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK;
 
-       if (!location || !relay_host ||
-                       location->type != LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY) {
+       if (!location || !relay_host || location->type != LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY) {
                status = LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_INVALID;
                goto end;
        }
@@ -331,16 +313,13 @@ end:
        return status;
 }
 
-enum lttng_trace_archive_location_status
-lttng_trace_archive_location_relay_get_relative_path(
-               const struct lttng_trace_archive_location *location,
-               const char **relative_path)
+enum lttng_trace_archive_location_status lttng_trace_archive_location_relay_get_relative_path(
+       const struct lttng_trace_archive_location *location, const char **relative_path)
 {
-       enum lttng_trace_archive_location_status status =
-                       LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK;
+       enum lttng_trace_archive_location_status status = LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK;
 
        if (!location || !relative_path ||
-                       location->type != LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY) {
+           location->type != LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY) {
                status = LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_INVALID;
                goto end;
        }
@@ -350,16 +329,13 @@ end:
        return status;
 }
 
-enum lttng_trace_archive_location_status
-lttng_trace_archive_location_relay_get_control_port(
-               const struct lttng_trace_archive_location *location,
-               uint16_t *control_port)
+enum lttng_trace_archive_location_status lttng_trace_archive_location_relay_get_control_port(
+       const struct lttng_trace_archive_location *location, uint16_t *control_port)
 {
-       enum lttng_trace_archive_location_status status =
-                       LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK;
+       enum lttng_trace_archive_location_status status = LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK;
 
        if (!location || !control_port ||
-                       location->type != LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY) {
+           location->type != LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY) {
                status = LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_INVALID;
                goto end;
        }
@@ -369,16 +345,12 @@ end:
        return status;
 }
 
-enum lttng_trace_archive_location_status
-lttng_trace_archive_location_relay_get_data_port(
-               const struct lttng_trace_archive_location *location,
-               uint16_t *data_port)
+enum lttng_trace_archive_location_status lttng_trace_archive_location_relay_get_data_port(
+       const struct lttng_trace_archive_location *location, uint16_t *data_port)
 {
-       enum lttng_trace_archive_location_status status =
-                       LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK;
+       enum lttng_trace_archive_location_status status = LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK;
 
-       if (!location || !data_port ||
-                       location->type != LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY) {
+       if (!location || !data_port || location->type != LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY) {
                status = LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_INVALID;
                goto end;
        }
@@ -388,16 +360,13 @@ end:
        return status;
 }
 
-enum lttng_trace_archive_location_status
-lttng_trace_archive_location_relay_get_protocol_type(
-               const struct lttng_trace_archive_location *location,
-               enum lttng_trace_archive_location_relay_protocol_type *protocol)
+enum lttng_trace_archive_location_status lttng_trace_archive_location_relay_get_protocol_type(
+       const struct lttng_trace_archive_location *location,
+       enum lttng_trace_archive_location_relay_protocol_type *protocol)
 {
-       enum lttng_trace_archive_location_status status =
-                       LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK;
+       enum lttng_trace_archive_location_status status = LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK;
 
-       if (!location || !protocol ||
-                       location->type != LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY) {
+       if (!location || !protocol || location->type != LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY) {
                status = LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_INVALID;
                goto end;
        }
index 4494b31962b7aa760d9fc6043f7d0dabea440bdc..36ff3d153d29e5a3c160744eeb86edfd078cc6e8 100644 (file)
 #include <common/hashtable/utils.hpp>
 #include <common/macros.hpp>
 #include <common/mi-lttng.hpp>
+
 #include <lttng/log-level-rule-internal.hpp>
 #include <lttng/log-level-rule.h>
+
 #include <stdbool.h>
 #include <stdlib.h>
 
 static bool is_log_level_rule_exactly_type(const struct lttng_log_level_rule *rule)
 {
-       enum lttng_log_level_rule_type type =
-                       lttng_log_level_rule_get_type(rule);
+       enum lttng_log_level_rule_type type = lttng_log_level_rule_get_type(rule);
 
        return type == LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY;
 }
 
 static bool is_log_level_rule_at_least_as_severe_type(const struct lttng_log_level_rule *rule)
 {
-
-       enum lttng_log_level_rule_type type =
-                       lttng_log_level_rule_get_type(rule);
+       enum lttng_log_level_rule_type type = lttng_log_level_rule_get_type(rule);
 
        return type == LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS;
 }
 
-enum lttng_log_level_rule_type lttng_log_level_rule_get_type(
-               const struct lttng_log_level_rule *rule)
+enum lttng_log_level_rule_type
+lttng_log_level_rule_get_type(const struct lttng_log_level_rule *rule)
 {
        return rule ? rule->type : LTTNG_LOG_LEVEL_RULE_TYPE_UNKNOWN;
 }
 
-struct lttng_log_level_rule *lttng_log_level_rule_exactly_create(
-               int level)
+struct lttng_log_level_rule *lttng_log_level_rule_exactly_create(int level)
 {
        struct lttng_log_level_rule *rule = NULL;
 
@@ -56,11 +54,10 @@ end:
        return rule;
 }
 
-enum lttng_log_level_rule_status lttng_log_level_rule_exactly_get_level(
-               const struct lttng_log_level_rule *rule, int *level)
+enum lttng_log_level_rule_status
+lttng_log_level_rule_exactly_get_level(const struct lttng_log_level_rule *rule, int *level)
 {
-       enum lttng_log_level_rule_status status =
-                       LTTNG_LOG_LEVEL_RULE_STATUS_OK;
+       enum lttng_log_level_rule_status status = LTTNG_LOG_LEVEL_RULE_STATUS_OK;
 
        if (!rule || !level || !is_log_level_rule_exactly_type(rule)) {
                status = LTTNG_LOG_LEVEL_RULE_STATUS_INVALID;
@@ -72,8 +69,7 @@ end:
        return status;
 }
 
-struct lttng_log_level_rule *
-lttng_log_level_rule_at_least_as_severe_as_create(int level)
+struct lttng_log_level_rule *lttng_log_level_rule_at_least_as_severe_as_create(int level)
 {
        struct lttng_log_level_rule *rule = NULL;
 
@@ -90,13 +86,12 @@ end:
 }
 
 enum lttng_log_level_rule_status
-lttng_log_level_rule_at_least_as_severe_as_get_level(
-               const struct lttng_log_level_rule *rule, int *level)
+lttng_log_level_rule_at_least_as_severe_as_get_level(const struct lttng_log_level_rule *rule,
+                                                    int *level)
 {
        enum lttng_log_level_rule_status status = LTTNG_LOG_LEVEL_RULE_STATUS_OK;
 
-       if (!rule || !level ||
-                       !is_log_level_rule_at_least_as_severe_type(rule)) {
+       if (!rule || !level || !is_log_level_rule_at_least_as_severe_type(rule)) {
                status = LTTNG_LOG_LEVEL_RULE_STATUS_INVALID;
                goto end;
        }
@@ -111,16 +106,14 @@ void lttng_log_level_rule_destroy(struct lttng_log_level_rule *log_level_rule)
        free(log_level_rule);
 }
 
-ssize_t lttng_log_level_rule_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_log_level_rule **_rule)
+ssize_t lttng_log_level_rule_create_from_payload(struct lttng_payload_view *view,
+                                                struct lttng_log_level_rule **_rule)
 {
        ssize_t ret;
        size_t offset = 0;
        struct lttng_log_level_rule *rule = NULL;
        const struct lttng_log_level_rule_comm *comm =
-                       (const struct lttng_log_level_rule_comm *)
-                                       view->buffer.data;
+               (const struct lttng_log_level_rule_comm *) view->buffer.data;
 
        offset += sizeof(*comm);
 
@@ -139,8 +132,7 @@ ssize_t lttng_log_level_rule_create_from_payload(
                rule = lttng_log_level_rule_exactly_create((int) comm->level);
                break;
        case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
-               rule = lttng_log_level_rule_at_least_as_severe_as_create(
-                               (int) comm->level);
+               rule = lttng_log_level_rule_at_least_as_severe_as_create((int) comm->level);
                break;
        default:
                abort();
@@ -159,12 +151,11 @@ end:
 }
 
 int lttng_log_level_rule_serialize(const struct lttng_log_level_rule *rule,
-               struct lttng_payload *payload)
+                                  struct lttng_payload *payload)
 {
        int ret;
        struct lttng_log_level_rule_comm comm;
 
-
        if (!rule) {
                ret = 0;
                goto end;
@@ -174,8 +165,7 @@ int lttng_log_level_rule_serialize(const struct lttng_log_level_rule *rule,
        comm.level = (int32_t) rule->level;
 
        DBG("Serializing log level rule of type %d", rule->type);
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm,
-                       sizeof(comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
        if (ret) {
                goto end;
        }
@@ -185,7 +175,7 @@ end:
 }
 
 bool lttng_log_level_rule_is_equal(const struct lttng_log_level_rule *a,
-               const struct lttng_log_level_rule *b)
+                                  const struct lttng_log_level_rule *b)
 {
        bool is_equal = false;
 
@@ -220,8 +210,7 @@ end:
        return is_equal;
 }
 
-struct lttng_log_level_rule *lttng_log_level_rule_copy(
-               const struct lttng_log_level_rule *source)
+struct lttng_log_level_rule *lttng_log_level_rule_copy(const struct lttng_log_level_rule *source)
 {
        struct lttng_log_level_rule *copy = NULL;
 
@@ -238,10 +227,9 @@ end:
        return copy;
 }
 
-void lttng_log_level_rule_to_loglevel(
-               const struct lttng_log_level_rule *log_level_rule,
-               enum lttng_loglevel_type *loglevel_type,
-               int *loglevel_value)
+void lttng_log_level_rule_to_loglevel(const struct lttng_log_level_rule *log_level_rule,
+                                     enum lttng_loglevel_type *loglevel_type,
+                                     int *loglevel_value)
 {
        LTTNG_ASSERT(log_level_rule);
 
@@ -259,8 +247,7 @@ void lttng_log_level_rule_to_loglevel(
        *loglevel_value = log_level_rule->level;
 }
 
-unsigned long lttng_log_level_rule_hash(
-               const struct lttng_log_level_rule *log_level_rule)
+unsigned long lttng_log_level_rule_hash(const struct lttng_log_level_rule *log_level_rule)
 {
        unsigned long hash;
        enum lttng_log_level_rule_status llr_status;
@@ -273,12 +260,12 @@ unsigned long lttng_log_level_rule_hash(
 
        switch (type) {
        case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
-               llr_status = lttng_log_level_rule_exactly_get_level(
-                               log_level_rule, &log_level_value);
+               llr_status =
+                       lttng_log_level_rule_exactly_get_level(log_level_rule, &log_level_value);
                break;
        case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
-               llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                               log_level_rule, &log_level_value);
+               llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(log_level_rule,
+                                                                                 &log_level_value);
                break;
        default:
                abort();
@@ -289,15 +276,13 @@ unsigned long lttng_log_level_rule_hash(
 
        hash = hash_key_ulong((void *) (unsigned long) type, lttng_ht_seed);
 
-       hash ^= hash_key_ulong((void *) (unsigned long) log_level_value,
-                       lttng_ht_seed);
+       hash ^= hash_key_ulong((void *) (unsigned long) log_level_value, lttng_ht_seed);
 
        return hash;
 }
 
-enum lttng_error_code lttng_log_level_rule_mi_serialize(
-               const struct lttng_log_level_rule *rule,
-               struct mi_writer *writer)
+enum lttng_error_code lttng_log_level_rule_mi_serialize(const struct lttng_log_level_rule *rule,
+                                                       struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -315,8 +300,7 @@ enum lttng_error_code lttng_log_level_rule_mi_serialize(
                break;
        case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
                element_str = mi_lttng_element_log_level_rule_at_least_as_severe_as;
-               status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                               rule, &level);
+               status = lttng_log_level_rule_at_least_as_severe_as_get_level(rule, &level);
                break;
        default:
                abort();
@@ -326,8 +310,7 @@ enum lttng_error_code lttng_log_level_rule_mi_serialize(
        LTTNG_ASSERT(status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
 
        /* Open log level rule element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_log_level_rule);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_log_level_rule);
        if (ret) {
                goto mi_error;
        }
@@ -340,7 +323,7 @@ enum lttng_error_code lttng_log_level_rule_mi_serialize(
 
        /* Level. */
        ret = mi_lttng_writer_write_element_signed_int(
-                       writer, mi_lttng_element_log_level_rule_level, level);
+               writer, mi_lttng_element_log_level_rule_level, level);
        if (ret) {
                goto mi_error;
        }
index e6b8624386914a38de270fbfbb5a45808d0fe6c1..4fa711102ce5cd1a0f262cdcbeb395bebab52806 100644 (file)
@@ -7,12 +7,14 @@
  *
  */
 
-#include <algorithm>
 #include <common/compat/endian.hpp>
 #include <common/error.hpp>
 #include <common/lttng-elf.hpp>
 #include <common/macros.hpp>
 #include <common/readwrite.hpp>
+
+#include <algorithm>
+#include <elf.h>
 #include <fcntl.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <elf.h>
-
-#define BUF_LEN        4096
-#define TEXT_SECTION_NAME      ".text"
-#define SYMBOL_TAB_SECTION_NAME ".symtab"
-#define STRING_TAB_SECTION_NAME ".strtab"
+#define BUF_LEN                                4096
+#define TEXT_SECTION_NAME              ".text"
+#define SYMBOL_TAB_SECTION_NAME                ".symtab"
+#define STRING_TAB_SECTION_NAME                ".strtab"
 #define DYNAMIC_SYMBOL_TAB_SECTION_NAME ".dynsym"
 #define DYNAMIC_STRING_TAB_SECTION_NAME ".dynstr"
-#define NOTE_STAPSDT_SECTION_NAME ".note.stapsdt"
-#define NOTE_STAPSDT_NAME "stapsdt"
-#define NOTE_STAPSDT_TYPE 3
-#define MAX_SECTION_DATA_SIZE   512 * 1024 * 1024
+#define NOTE_STAPSDT_SECTION_NAME      ".note.stapsdt"
+#define NOTE_STAPSDT_NAME              "stapsdt"
+#define NOTE_STAPSDT_TYPE              3
+#define MAX_SECTION_DATA_SIZE          512 * 1024 * 1024
 
 #if BYTE_ORDER == LITTLE_ENDIAN
 #define NATIVE_ELF_ENDIANNESS ELFDATA2LSB
 #define NATIVE_ELF_ENDIANNESS ELFDATA2MSB
 #endif
 
-#define next_4bytes_boundary(x) (typeof(x)) ((((uint64_t)x) + 3) & ~0x03)
-
-#define bswap(x)                               \
-       do {                                    \
-               switch (sizeof(x)) {            \
-               case 8:                         \
-                       x = be64toh((uint64_t)x);               \
-                       break;                  \
-               case 4:                         \
-                       x = be32toh((uint32_t)x);               \
-                       break;                  \
-               case 2:                         \
-                       x = be16toh((uint16_t)x);               \
-                       break;                  \
-               case 1:                         \
-                       break;                  \
-               default:                        \
-                       abort();                \
-               }                               \
+#define next_4bytes_boundary(x) (typeof(x)) ((((uint64_t) x) + 3) & ~0x03)
+
+#define bswap(x)                                   \
+       do {                                       \
+               switch (sizeof(x)) {               \
+               case 8:                            \
+                       x = be64toh((uint64_t) x); \
+                       break;                     \
+               case 4:                            \
+                       x = be32toh((uint32_t) x); \
+                       break;                     \
+               case 2:                            \
+                       x = be16toh((uint16_t) x); \
+                       break;                     \
+               case 1:                            \
+                       break;                     \
+               default:                           \
+                       abort();                   \
+               }                                  \
        } while (0)
 
-#define bswap_shdr(shdr)           \
-       do {                                \
-               bswap((shdr).sh_name);      \
-               bswap((shdr).sh_type);      \
-               bswap((shdr).sh_flags);     \
-               bswap((shdr).sh_addr);      \
+#define bswap_shdr(shdr)                    \
+       do {                                \
+               bswap((shdr).sh_name);      \
+               bswap((shdr).sh_type);      \
+               bswap((shdr).sh_flags);     \
+               bswap((shdr).sh_addr);      \
                bswap((shdr).sh_offset);    \
-               bswap((shdr).sh_size);      \
-               bswap((shdr).sh_link);      \
-               bswap((shdr).sh_info);      \
+               bswap((shdr).sh_size);      \
+               bswap((shdr).sh_link);      \
+               bswap((shdr).sh_info);      \
                bswap((shdr).sh_addralign); \
                bswap((shdr).sh_entsize);   \
        } while (0)
 
-#define bswap_ehdr(ehdr)                               \
-       do {                                            \
-               bswap((ehdr).e_type);                   \
-               bswap((ehdr).e_machine);                \
-               bswap((ehdr).e_version);                \
-               bswap((ehdr).e_entry);                  \
-               bswap((ehdr).e_phoff);                  \
-               bswap((ehdr).e_shoff);                  \
-               bswap((ehdr).e_flags);                  \
-               bswap((ehdr).e_ehsize);                 \
-               bswap((ehdr).e_phentsize);              \
-               bswap((ehdr).e_phnum);                  \
-               bswap((ehdr).e_shentsize);              \
-               bswap((ehdr).e_shnum);                  \
-               bswap((ehdr).e_shstrndx);               \
+#define bswap_ehdr(ehdr)                   \
+       do {                               \
+               bswap((ehdr).e_type);      \
+               bswap((ehdr).e_machine);   \
+               bswap((ehdr).e_version);   \
+               bswap((ehdr).e_entry);     \
+               bswap((ehdr).e_phoff);     \
+               bswap((ehdr).e_shoff);     \
+               bswap((ehdr).e_flags);     \
+               bswap((ehdr).e_ehsize);    \
+               bswap((ehdr).e_phentsize); \
+               bswap((ehdr).e_phnum);     \
+               bswap((ehdr).e_shentsize); \
+               bswap((ehdr).e_shnum);     \
+               bswap((ehdr).e_shstrndx);  \
        } while (0)
 
-#define copy_shdr(src_shdr, dst_shdr)                                  \
-       do {                                                            \
-               (dst_shdr).sh_name = (src_shdr).sh_name;                \
-               (dst_shdr).sh_type = (src_shdr).sh_type;                \
-               (dst_shdr).sh_flags = (src_shdr).sh_flags;              \
-               (dst_shdr).sh_addr = (src_shdr).sh_addr;                \
-               (dst_shdr).sh_offset = (src_shdr).sh_offset;            \
-               (dst_shdr).sh_size = (src_shdr).sh_size;                \
-               (dst_shdr).sh_link = (src_shdr).sh_link;                \
-               (dst_shdr).sh_info = (src_shdr).sh_info;                \
-               (dst_shdr).sh_addralign = (src_shdr).sh_addralign;      \
-               (dst_shdr).sh_entsize = (src_shdr).sh_entsize;          \
+#define copy_shdr(src_shdr, dst_shdr)                              \
+       do {                                                       \
+               (dst_shdr).sh_name = (src_shdr).sh_name;           \
+               (dst_shdr).sh_type = (src_shdr).sh_type;           \
+               (dst_shdr).sh_flags = (src_shdr).sh_flags;         \
+               (dst_shdr).sh_addr = (src_shdr).sh_addr;           \
+               (dst_shdr).sh_offset = (src_shdr).sh_offset;       \
+               (dst_shdr).sh_size = (src_shdr).sh_size;           \
+               (dst_shdr).sh_link = (src_shdr).sh_link;           \
+               (dst_shdr).sh_info = (src_shdr).sh_info;           \
+               (dst_shdr).sh_addralign = (src_shdr).sh_addralign; \
+               (dst_shdr).sh_entsize = (src_shdr).sh_entsize;     \
        } while (0)
 
-#define copy_ehdr(src_ehdr, dst_ehdr)                                  \
-       do {                                                            \
-               (dst_ehdr).e_type = (src_ehdr).e_type;                  \
-               (dst_ehdr).e_machine = (src_ehdr).e_machine;            \
-               (dst_ehdr).e_version = (src_ehdr).e_version;            \
-               (dst_ehdr).e_entry = (src_ehdr).e_entry;                \
-               (dst_ehdr).e_phoff = (src_ehdr).e_phoff;                \
-               (dst_ehdr).e_shoff = (src_ehdr).e_shoff;                \
-               (dst_ehdr).e_flags = (src_ehdr).e_flags;                \
-               (dst_ehdr).e_ehsize = (src_ehdr).e_ehsize;              \
-               (dst_ehdr).e_phentsize = (src_ehdr).e_phentsize;        \
-               (dst_ehdr).e_phnum = (src_ehdr).e_phnum;                \
-               (dst_ehdr).e_shentsize = (src_ehdr).e_shentsize;        \
-               (dst_ehdr).e_shnum = (src_ehdr).e_shnum;                \
-               (dst_ehdr).e_shstrndx = (src_ehdr).e_shstrndx;          \
+#define copy_ehdr(src_ehdr, dst_ehdr)                            \
+       do {                                                     \
+               (dst_ehdr).e_type = (src_ehdr).e_type;           \
+               (dst_ehdr).e_machine = (src_ehdr).e_machine;     \
+               (dst_ehdr).e_version = (src_ehdr).e_version;     \
+               (dst_ehdr).e_entry = (src_ehdr).e_entry;         \
+               (dst_ehdr).e_phoff = (src_ehdr).e_phoff;         \
+               (dst_ehdr).e_shoff = (src_ehdr).e_shoff;         \
+               (dst_ehdr).e_flags = (src_ehdr).e_flags;         \
+               (dst_ehdr).e_ehsize = (src_ehdr).e_ehsize;       \
+               (dst_ehdr).e_phentsize = (src_ehdr).e_phentsize; \
+               (dst_ehdr).e_phnum = (src_ehdr).e_phnum;         \
+               (dst_ehdr).e_shentsize = (src_ehdr).e_shentsize; \
+               (dst_ehdr).e_shnum = (src_ehdr).e_shnum;         \
+               (dst_ehdr).e_shstrndx = (src_ehdr).e_shstrndx;   \
        } while (0)
 
-#define copy_sym(src_sym, dst_sym)                     \
-       do {                                            \
-               dst_sym.st_name = src_sym.st_name;      \
-               dst_sym.st_info = src_sym.st_info;      \
-               dst_sym.st_other = src_sym.st_other;    \
-               dst_sym.st_shndx = src_sym.st_shndx;    \
-               dst_sym.st_value = src_sym.st_value;    \
-               dst_sym.st_size = src_sym.st_size;      \
+#define copy_sym(src_sym, dst_sym)                   \
+       do {                                         \
+               dst_sym.st_name = src_sym.st_name;   \
+               dst_sym.st_info = src_sym.st_info;   \
+               dst_sym.st_other = src_sym.st_other; \
+               dst_sym.st_shndx = src_sym.st_shndx; \
+               dst_sym.st_value = src_sym.st_value; \
+               dst_sym.st_size = src_sym.st_size;   \
        } while (0)
 
 #ifndef ELFCLASSNUM
@@ -183,8 +183,8 @@ struct lttng_elf_shdr {
  */
 struct lttng_elf_sym {
        uint32_t st_name;
-       uint8_t  st_info;
-       uint8_t  st_other;
+       uint8_t st_info;
+       uint8_t st_other;
        uint16_t st_shndx;
        uint64_t st_value;
        uint64_t st_size;
@@ -203,28 +203,24 @@ struct lttng_elf {
        struct lttng_elf_ehdr *ehdr;
 };
 
-static inline
-int is_elf_32_bit(struct lttng_elf *elf)
+static inline int is_elf_32_bit(struct lttng_elf *elf)
 {
        return elf->bitness == ELFCLASS32;
 }
 
-static inline
-int is_elf_native_endian(struct lttng_elf *elf)
+static inline int is_elf_native_endian(struct lttng_elf *elf)
 {
        return elf->endianness == NATIVE_ELF_ENDIANNESS;
 }
 
-static
-int populate_section_header(struct lttng_elf * elf, struct lttng_elf_shdr *shdr,
-               uint32_t index)
+static int
+populate_section_header(struct lttng_elf *elf, struct lttng_elf_shdr *shdr, uint32_t index)
 {
        int ret = 0;
        off_t offset;
 
        /* Compute the offset of the section in the file */
-       offset = (off_t) elf->ehdr->e_shoff
-                       + (off_t) index * elf->ehdr->e_shentsize;
+       offset = (off_t) elf->ehdr->e_shoff + (off_t) index * elf->ehdr->e_shentsize;
 
        if (lseek(elf->fd, offset, SEEK_SET) < 0) {
                PERROR("Error seeking to the beginning of ELF section header");
@@ -262,8 +258,7 @@ error:
        return ret;
 }
 
-static
-int populate_elf_header(struct lttng_elf *elf)
+static int populate_elf_header(struct lttng_elf *elf)
 {
        int ret = 0;
 
@@ -314,9 +309,8 @@ error:
  *
  * 0 is returned on succes, -1 on failure.
  */
-static
-int lttng_elf_get_section_hdr(struct lttng_elf *elf,
-               uint16_t index, struct lttng_elf_shdr *out_header)
+static int
+lttng_elf_get_section_hdr(struct lttng_elf *elf, uint16_t index, struct lttng_elf_shdr *out_header)
 {
        int ret = 0;
 
@@ -347,11 +341,10 @@ error:
  *
  * If no name is found, NULL is returned.
  */
-static
-char *lttng_elf_get_section_name(struct lttng_elf *elf, off_t offset)
+static char *lttng_elf_get_section_name(struct lttng_elf *elf, off_t offset)
 {
        char *name = NULL;
-       size_t name_length = 0, to_read;        /* name_length does not include \0 */
+       size_t name_length = 0, to_read; /* name_length does not include \0 */
 
        if (!elf) {
                goto error;
@@ -396,7 +389,7 @@ end:
         * We found the length of the section name, now seek back to the
         * beginning of the name and copy it in the newly allocated buffer.
         */
-       name = calloc<char>((name_length + 1)); /* + 1 for \0 */
+       name = calloc<char>((name_length + 1)); /* + 1 for \0 */
        if (!name) {
                PERROR("Error allocating ELF section name buffer");
                goto error;
@@ -417,8 +410,7 @@ error:
        return NULL;
 }
 
-static
-int lttng_elf_validate_and_populate(struct lttng_elf *elf)
+static int lttng_elf_validate_and_populate(struct lttng_elf *elf)
 {
        uint8_t version;
        uint8_t e_ident[EI_NIDENT];
@@ -528,8 +520,7 @@ end:
  *
  * Return a pointer to the instance on success, NULL on failure.
  */
-static
-struct lttng_elf *lttng_elf_create(int fd)
+static struct lttng_elf *lttng_elf_create(int fd)
 {
        struct lttng_elf_shdr section_names_shdr;
        struct lttng_elf *elf = NULL;
@@ -568,8 +559,7 @@ struct lttng_elf *lttng_elf_create(int fd)
                goto error;
        }
 
-       ret = lttng_elf_get_section_hdr(
-                       elf, elf->ehdr->e_shstrndx, &section_names_shdr);
+       ret = lttng_elf_get_section_hdr(elf, elf->ehdr->e_shstrndx, &section_names_shdr);
        if (ret) {
                goto error;
        }
@@ -597,8 +587,7 @@ error:
 /*
  * Destroy the given lttng_elf instance.
  */
-static
-void lttng_elf_destroy(struct lttng_elf *elf)
+static void lttng_elf_destroy(struct lttng_elf *elf)
 {
        if (!elf) {
                return;
@@ -612,22 +601,21 @@ void lttng_elf_destroy(struct lttng_elf *elf)
        free(elf);
 }
 
-static
-int lttng_elf_get_section_hdr_by_name(struct lttng_elf *elf,
-               const char *section_name, struct lttng_elf_shdr *section_hdr)
+static int lttng_elf_get_section_hdr_by_name(struct lttng_elf *elf,
+                                            const char *section_name,
+                                            struct lttng_elf_shdr *section_hdr)
 {
        int i;
        char *curr_section_name;
 
        for (i = 0; i < elf->ehdr->e_shnum; ++i) {
                bool name_equal;
-               int ret = lttng_elf_get_section_hdr(elf, i, section_hdr);
+               int ret = lttng_elf_get_section_hdr(elf, i, section_hdr);
 
                if (ret) {
                        break;
                }
-               curr_section_name = lttng_elf_get_section_name(elf,
-                               section_hdr->sh_name);
+               curr_section_name = lttng_elf_get_section_name(elf, section_hdr->sh_name);
                if (!curr_section_name) {
                        continue;
                }
@@ -640,9 +628,7 @@ int lttng_elf_get_section_hdr_by_name(struct lttng_elf *elf,
        return LTTNG_ERR_ELF_PARSING;
 }
 
-static
-char *lttng_elf_get_section_data(struct lttng_elf *elf,
-               struct lttng_elf_shdr *shdr)
+static char *lttng_elf_get_section_data(struct lttng_elf *elf, struct lttng_elf_shdr *shdr)
 {
        int ret;
        off_t section_offset;
@@ -662,8 +648,7 @@ char *lttng_elf_get_section_data(struct lttng_elf *elf,
        }
 
        if (shdr->sh_size > max_alloc_size) {
-               ERR("ELF section size exceeds maximal allowed size of %zu bytes",
-                               max_alloc_size);
+               ERR("ELF section size exceeds maximal allowed size of %zu bytes", max_alloc_size);
                goto error;
        }
        data = calloc<char>(shdr->sh_size);
@@ -692,9 +677,9 @@ error:
  *
  * Returns the offset on success or non-zero in case of failure.
  */
-static
-int lttng_elf_convert_addr_in_text_to_offset(struct lttng_elf *elf_handle,
-               size_t addr, uint64_t *offset)
+static int lttng_elf_convert_addr_in_text_to_offset(struct lttng_elf *elf_handle,
+                                                   size_t addr,
+                                                   uint64_t *offset)
 {
        int ret = 0;
        off_t text_section_offset;
@@ -710,8 +695,7 @@ int lttng_elf_convert_addr_in_text_to_offset(struct lttng_elf *elf_handle,
        }
 
        /* Get a pointer to the .text section header. */
-       ret = lttng_elf_get_section_hdr_by_name(elf_handle,
-                       TEXT_SECTION_NAME, &text_section_hdr);
+       ret = lttng_elf_get_section_hdr_by_name(elf_handle, TEXT_SECTION_NAME, &text_section_hdr);
        if (ret) {
                DBG("Text section not found in binary.");
                ret = LTTNG_ERR_ELF_PARSING;
@@ -720,16 +704,17 @@ int lttng_elf_convert_addr_in_text_to_offset(struct lttng_elf *elf_handle,
 
        text_section_offset = text_section_hdr.sh_offset;
        text_section_addr_beg = text_section_hdr.sh_addr;
-       text_section_addr_end =
-                       text_section_addr_beg + text_section_hdr.sh_size;
+       text_section_addr_end = text_section_addr_beg + text_section_hdr.sh_size;
 
        /*
         * Verify that the address is within the .text section boundaries.
         */
        if (addr < text_section_addr_beg || addr > text_section_addr_end) {
                DBG("Address found is outside of the .text section addr=0x%zx, "
-                       ".text section=[0x%jd - 0x%jd].", addr, (intmax_t)text_section_addr_beg,
-                       (intmax_t)text_section_addr_end);
+                   ".text section=[0x%jd - 0x%jd].",
+                   addr,
+                   (intmax_t) text_section_addr_beg,
+                   (intmax_t) text_section_addr_end);
                ret = LTTNG_ERR_ELF_PARSING;
                goto error;
        }
@@ -767,7 +752,7 @@ int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset)
        struct lttng_elf_shdr strtab_hdr;
        struct lttng_elf *elf = NULL;
 
-       if (!symbol || !offset ) {
+       if (!symbol || !offset) {
                ret = LTTNG_ERR_ELF_PARSING;
                goto end;
        }
@@ -784,13 +769,12 @@ int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset)
         * try to get the dynamic symbol table. All symbols in the dynamic
         * symbol tab are in the (normal) symbol table if it exists.
         */
-       ret = lttng_elf_get_section_hdr_by_name(elf, SYMBOL_TAB_SECTION_NAME,
-                       &symtab_hdr);
+       ret = lttng_elf_get_section_hdr_by_name(elf, SYMBOL_TAB_SECTION_NAME, &symtab_hdr);
        if (ret) {
                DBG("Cannot get ELF Symbol Table section. Trying to get ELF Dynamic Symbol Table section.");
                /* Get the dynamic symbol table section header. */
-               ret = lttng_elf_get_section_hdr_by_name(elf, DYNAMIC_SYMBOL_TAB_SECTION_NAME,
-                               &symtab_hdr);
+               ret = lttng_elf_get_section_hdr_by_name(
+                       elf, DYNAMIC_SYMBOL_TAB_SECTION_NAME, &symtab_hdr);
                if (ret) {
                        DBG("Cannot get ELF Symbol Table nor Dynamic Symbol Table sections.");
                        ret = LTTNG_ERR_ELF_PARSING;
@@ -810,8 +794,7 @@ int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset)
        }
 
        /* Get the string table section header. */
-       ret = lttng_elf_get_section_hdr_by_name(elf, string_table_name,
-                       &strtab_hdr);
+       ret = lttng_elf_get_section_hdr_by_name(elf, string_table_name, &strtab_hdr);
        if (ret) {
                DBG("Cannot get ELF string table section.");
                goto free_symbol_table_data;
@@ -873,7 +856,7 @@ int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset)
                 * Compare with the search symbol. If there is a match set the address
                 * output parameter and return success.
                 */
-               if (strcmp(symbol, curr_sym_str) == 0 ) {
+               if (strcmp(symbol, curr_sym_str) == 0) {
                        sym_found = 1;
                        addr = curr_sym.st_value;
                        break;
@@ -896,7 +879,6 @@ int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset)
                goto free_string_table_data;
        }
 
-
 free_string_table_data:
        free(string_table_data);
 free_symbol_table_data:
@@ -915,8 +897,11 @@ end:
  * the SDT probes are.
  * On failure, returns -1.
  */
-int lttng_elf_get_sdt_probe_offsets(int fd, const char *provider_name,
-               const char *probe_name, uint64_t **offsets, uint32_t *nb_probes)
+int lttng_elf_get_sdt_probe_offsets(int fd,
+                                   const char *provider_name,
+                                   const char *probe_name,
+                                   uint64_t **offsets,
+                                   uint32_t *nb_probes)
 {
        int ret = 0, nb_match = 0;
        struct lttng_elf_shdr stap_note_section_hdr;
@@ -942,16 +927,15 @@ int lttng_elf_get_sdt_probe_offsets(int fd, const char *provider_name,
        }
 
        /* Get the stap note section header. */
-       ret = lttng_elf_get_section_hdr_by_name(elf, NOTE_STAPSDT_SECTION_NAME,
-                       &stap_note_section_hdr);
+       ret = lttng_elf_get_section_hdr_by_name(
+               elf, NOTE_STAPSDT_SECTION_NAME, &stap_note_section_hdr);
        if (ret) {
                DBG("Cannot get ELF stap note section.");
                goto destroy_elf_error;
        }
 
        /* Get the data associated with the stap note section. */
-       stap_note_section_data =
-                       lttng_elf_get_section_data(elf, &stap_note_section_hdr);
+       stap_note_section_data = lttng_elf_get_section_data(elf, &stap_note_section_hdr);
        if (stap_note_section_data == NULL) {
                DBG("Cannot get ELF stap note section data.");
                ret = LTTNG_ERR_ELF_PARSING;
@@ -965,28 +949,26 @@ int lttng_elf_get_sdt_probe_offsets(int fd, const char *provider_name,
        while (1) {
                curr_data_ptr = next_note_ptr;
                /* Check if we have reached the end of the note section. */
-               if (curr_data_ptr >=
-                               curr_note_section_begin +
-                                               stap_note_section_hdr.sh_size) {
+               if (curr_data_ptr >= curr_note_section_begin + stap_note_section_hdr.sh_size) {
                        *nb_probes = nb_match;
                        *offsets = probe_locs;
                        ret = 0;
                        break;
                }
                /* Get name size field. */
-               name_size = next_4bytes_boundary(*(uint32_t*) curr_data_ptr);
+               name_size = next_4bytes_boundary(*(uint32_t *) curr_data_ptr);
                curr_data_ptr += sizeof(uint32_t);
 
                /* Sanity check; a zero name_size is reserved. */
                if (name_size == 0) {
                        DBG("Invalid name size field in SDT probe descriptions"
-                               "section.");
+                           "section.");
                        ret = -1;
                        goto realloc_error;
                }
 
                /* Get description size field. */
-               desc_size = next_4bytes_boundary(*(uint32_t*) curr_data_ptr);
+               desc_size = next_4bytes_boundary(*(uint32_t *) curr_data_ptr);
                curr_data_ptr += sizeof(uint32_t);
 
                /* Get type field. */
@@ -1000,15 +982,14 @@ int lttng_elf_get_sdt_probe_offsets(int fd, const char *provider_name,
                 * name and the descriptor. To move to the next note, we move
                 * the pointer according to those values.
                 */
-               next_note_ptr = next_note_ptr +
-                       (3 * sizeof(uint32_t)) + desc_size + name_size;
+               next_note_ptr = next_note_ptr + (3 * sizeof(uint32_t)) + desc_size + name_size;
 
                /*
                 * Move ptr to the end of the name string (we don't need it)
                 * and go to the next 4 byte alignement.
                 */
                if (note_type != NOTE_STAPSDT_TYPE ||
-                       strncmp(curr_data_ptr, NOTE_STAPSDT_NAME, name_size) != 0) {
+                   strncmp(curr_data_ptr, NOTE_STAPSDT_NAME, name_size) != 0) {
                        continue;
                }
 
@@ -1033,7 +1014,7 @@ int lttng_elf_get_sdt_probe_offsets(int fd, const char *provider_name,
 
                /* Check if the provider and probe name match */
                if (strcmp(provider_name, curr_provider) == 0 &&
-                               strcmp(probe_name, curr_probe) == 0) {
+                   strcmp(probe_name, curr_probe) == 0) {
                        int new_size;
 
                        /*
@@ -1066,8 +1047,8 @@ int lttng_elf_get_sdt_probe_offsets(int fd, const char *provider_name,
                         * Use the virtual address of the probe to compute the offset of
                         * this probe from the beginning of the executable file.
                         */
-                       ret = lttng_elf_convert_addr_in_text_to_offset(elf,
-                                       curr_probe_location, &curr_probe_offset);
+                       ret = lttng_elf_convert_addr_in_text_to_offset(
+                               elf, curr_probe_location, &curr_probe_offset);
                        if (ret) {
                                DBG("Conversion error in SDT.");
                                goto realloc_error;
index 01e89b779811a62be5da524148ba41b21f3cb71a..ac15b7687e2418b5d8d4e692ebcb345c053af80b 100644 (file)
 #include "lttng/tracker.h"
 #define _LGPL_SOURCE
 #include "mi-lttng.hpp"
+
 #include <common/config/session-config.hpp>
 #include <common/defaults.hpp>
 #include <common/tracker.hpp>
+
 #include <lttng/channel.h>
 #include <lttng/snapshot-internal.hpp>
 
-
 #define MI_SCHEMA_MAJOR_VERSION 4
 #define MI_SCHEMA_MINOR_VERSION 1
 
 /* Machine interface namespace URI */
-const char * const mi_lttng_xmlns = "xmlns";
-const char * const mi_lttng_xmlns_xsi = "xmlns:xsi";
-const char * const mi_lttng_w3_schema_uri = "http://www.w3.org/2001/XMLSchema-instance";
-const char * const mi_lttng_schema_location = "xsi:schemaLocation";
-const char * const mi_lttng_schema_location_uri =
-       DEFAULT_LTTNG_MI_NAMESPACE " "
-       "https://lttng.org/xml/schemas/lttng-mi/" XSTR(MI_SCHEMA_MAJOR_VERSION)
-       "/lttng-mi-" XSTR(MI_SCHEMA_MAJOR_VERSION) "."
-       XSTR(MI_SCHEMA_MINOR_VERSION) ".xsd";
-const char * const mi_lttng_schema_version = "schemaVersion";
-const char * const mi_lttng_schema_version_value = XSTR(MI_SCHEMA_MAJOR_VERSION)
-       "." XSTR(MI_SCHEMA_MINOR_VERSION);
+const char *const mi_lttng_xmlns = "xmlns";
+const char *const mi_lttng_xmlns_xsi = "xmlns:xsi";
+const char *const mi_lttng_w3_schema_uri = "http://www.w3.org/2001/XMLSchema-instance";
+const char *const mi_lttng_schema_location = "xsi:schemaLocation";
+const char *const mi_lttng_schema_location_uri = DEFAULT_LTTNG_MI_NAMESPACE
+       " "
+       "https://lttng.org/xml/schemas/lttng-mi/" XSTR(MI_SCHEMA_MAJOR_VERSION) "/lttng-mi-" XSTR(
+               MI_SCHEMA_MAJOR_VERSION) "." XSTR(MI_SCHEMA_MINOR_VERSION) ".xsd";
+const char *const mi_lttng_schema_version = "schemaVersion";
+const char *const mi_lttng_schema_version_value =
+       XSTR(MI_SCHEMA_MAJOR_VERSION) "." XSTR(MI_SCHEMA_MINOR_VERSION);
 
 /* Strings related to command */
-const char * const mi_lttng_element_command = "command";
-const char * const mi_lttng_element_command_action = "snapshot_action";
-const char * const mi_lttng_element_command_add_context = "add-context";
+const char *const mi_lttng_element_command = "command";
+const char *const mi_lttng_element_command_action = "snapshot_action";
+const char *const mi_lttng_element_command_add_context = "add-context";
 const char *const mi_lttng_element_command_add_trigger = "add-trigger";
-const char * const mi_lttng_element_command_create = "create";
-const char * const mi_lttng_element_command_destroy = "destroy";
-const char * const mi_lttng_element_command_disable_channel = "disable-channel";
-const char * const mi_lttng_element_command_disable_event = "disable-event";
-const char * const mi_lttng_element_command_enable_channels = "enable-channel";
-const char * const mi_lttng_element_command_enable_event = "enable-event";
-const char * const mi_lttng_element_command_list = "list";
+const char *const mi_lttng_element_command_create = "create";
+const char *const mi_lttng_element_command_destroy = "destroy";
+const char *const mi_lttng_element_command_disable_channel = "disable-channel";
+const char *const mi_lttng_element_command_disable_event = "disable-event";
+const char *const mi_lttng_element_command_enable_channels = "enable-channel";
+const char *const mi_lttng_element_command_enable_event = "enable-event";
+const char *const mi_lttng_element_command_list = "list";
 const char *const mi_lttng_element_command_list_trigger = "list-trigger";
-const char * const mi_lttng_element_command_load = "load";
-const char * const mi_lttng_element_command_metadata = "metadata";
-const char * const mi_lttng_element_command_metadata_action = "metadata_action";
-const char * const mi_lttng_element_command_regenerate = "regenerate";
-const char * const mi_lttng_element_command_regenerate_action = "regenerate_action";
-const char * const mi_lttng_element_command_name = "name";
-const char * const mi_lttng_element_command_output = "output";
+const char *const mi_lttng_element_command_load = "load";
+const char *const mi_lttng_element_command_metadata = "metadata";
+const char *const mi_lttng_element_command_metadata_action = "metadata_action";
+const char *const mi_lttng_element_command_regenerate = "regenerate";
+const char *const mi_lttng_element_command_regenerate_action = "regenerate_action";
+const char *const mi_lttng_element_command_name = "name";
+const char *const mi_lttng_element_command_output = "output";
 const char *const mi_lttng_element_command_remove_trigger = "remove-trigger";
-const char * const mi_lttng_element_command_save = "save";
-const char * const mi_lttng_element_command_set_session = "set-session";
-const char * const mi_lttng_element_command_snapshot = "snapshot";
-const char * const mi_lttng_element_command_snapshot_add = "add_snapshot";
-const char * const mi_lttng_element_command_snapshot_del = "del_snapshot";
-const char * const mi_lttng_element_command_snapshot_list = "list_snapshot";
-const char * const mi_lttng_element_command_snapshot_record = "record_snapshot";
-const char * const mi_lttng_element_command_start = "start";
-const char * const mi_lttng_element_command_stop = "stop";
-const char * const mi_lttng_element_command_success = "success";
-const char * const mi_lttng_element_command_track = "track";
-const char * const mi_lttng_element_command_untrack = "untrack";
-const char * const mi_lttng_element_command_version = "version";
-const char * const mi_lttng_element_command_rotate = "rotate";
-const char * const mi_lttng_element_command_enable_rotation = "enable-rotation";
-const char * const mi_lttng_element_command_disable_rotation = "disable-rotation";
-const char * const mi_lttng_element_command_clear = "clear";
+const char *const mi_lttng_element_command_save = "save";
+const char *const mi_lttng_element_command_set_session = "set-session";
+const char *const mi_lttng_element_command_snapshot = "snapshot";
+const char *const mi_lttng_element_command_snapshot_add = "add_snapshot";
+const char *const mi_lttng_element_command_snapshot_del = "del_snapshot";
+const char *const mi_lttng_element_command_snapshot_list = "list_snapshot";
+const char *const mi_lttng_element_command_snapshot_record = "record_snapshot";
+const char *const mi_lttng_element_command_start = "start";
+const char *const mi_lttng_element_command_stop = "stop";
+const char *const mi_lttng_element_command_success = "success";
+const char *const mi_lttng_element_command_track = "track";
+const char *const mi_lttng_element_command_untrack = "untrack";
+const char *const mi_lttng_element_command_version = "version";
+const char *const mi_lttng_element_command_rotate = "rotate";
+const char *const mi_lttng_element_command_enable_rotation = "enable-rotation";
+const char *const mi_lttng_element_command_disable_rotation = "disable-rotation";
+const char *const mi_lttng_element_command_clear = "clear";
 
 /* Strings related to version command */
-const char * const mi_lttng_element_version = "version";
-const char * const mi_lttng_element_version_commit = "commit";
-const char * const mi_lttng_element_version_description = "description";
-const char * const mi_lttng_element_version_license = "license";
-const char * const mi_lttng_element_version_major = "major";
-const char * const mi_lttng_element_version_minor = "minor";
-const char * const mi_lttng_element_version_patch_level = "patchLevel";
-const char * const mi_lttng_element_version_str = "string";
-const char * const mi_lttng_element_version_web = "url";
+const char *const mi_lttng_element_version = "version";
+const char *const mi_lttng_element_version_commit = "commit";
+const char *const mi_lttng_element_version_description = "description";
+const char *const mi_lttng_element_version_license = "license";
+const char *const mi_lttng_element_version_major = "major";
+const char *const mi_lttng_element_version_minor = "minor";
+const char *const mi_lttng_element_version_patch_level = "patchLevel";
+const char *const mi_lttng_element_version_str = "string";
+const char *const mi_lttng_element_version_web = "url";
 
 /* String related to a lttng_event_field */
-const char * const mi_lttng_element_event_field = "event_field";
-const char * const mi_lttng_element_event_fields = "event_fields";
+const char *const mi_lttng_element_event_field = "event_field";
+const char *const mi_lttng_element_event_fields = "event_fields";
 
 /* String related to lttng_event_perf_counter_ctx */
-const char * const mi_lttng_element_perf_counter_context = "perf";
+const char *const mi_lttng_element_perf_counter_context = "perf";
 
 /* Strings related to pid */
-const char * const mi_lttng_element_pid_id = "id";
+const char *const mi_lttng_element_pid_id = "id";
 
 /* Strings related to save command */
-const char * const mi_lttng_element_save = "save";
+const char *const mi_lttng_element_save = "save";
 
 /* Strings related to load command */
-const char * const mi_lttng_element_load = "load";
-const char * const mi_lttng_element_load_overrides = "overrides";
-const char * const mi_lttng_element_load_override_url = "url";
+const char *const mi_lttng_element_load = "load";
+const char *const mi_lttng_element_load_overrides = "overrides";
+const char *const mi_lttng_element_load_override_url = "url";
 
 /* General elements of mi_lttng */
-const char * const mi_lttng_element_empty = "";
-const char * const mi_lttng_element_id = "id";
-const char * const mi_lttng_element_nowrite = "nowrite";
-const char * const mi_lttng_element_success = "success";
-const char * const mi_lttng_element_type_enum = "ENUM";
-const char * const mi_lttng_element_type_float = "FLOAT";
-const char * const mi_lttng_element_type_integer = "INTEGER";
-const char * const mi_lttng_element_type_other = "OTHER";
-const char * const mi_lttng_element_type_string = "STRING";
+const char *const mi_lttng_element_empty = "";
+const char *const mi_lttng_element_id = "id";
+const char *const mi_lttng_element_nowrite = "nowrite";
+const char *const mi_lttng_element_success = "success";
+const char *const mi_lttng_element_type_enum = "ENUM";
+const char *const mi_lttng_element_type_float = "FLOAT";
+const char *const mi_lttng_element_type_integer = "INTEGER";
+const char *const mi_lttng_element_type_other = "OTHER";
+const char *const mi_lttng_element_type_string = "STRING";
 
 /* String related to loglevel */
-const char * const mi_lttng_loglevel_str_alert = "TRACE_ALERT";
-const char * const mi_lttng_loglevel_str_crit = "TRACE_CRIT";
-const char * const mi_lttng_loglevel_str_debug = "TRACE_DEBUG";
-const char * const mi_lttng_loglevel_str_debug_function = "TRACE_DEBUG_FUNCTION";
-const char * const mi_lttng_loglevel_str_debug_line = "TRACE_DEBUG_LINE";
-const char * const mi_lttng_loglevel_str_debug_module = "TRACE_DEBUG_MODULE";
-const char * const mi_lttng_loglevel_str_debug_process = "TRACE_DEBUG_PROCESS";
-const char * const mi_lttng_loglevel_str_debug_program = "TRACE_DEBUG_PROGRAM";
-const char * const mi_lttng_loglevel_str_debug_system = "TRACE_DEBUG_SYSTEM";
-const char * const mi_lttng_loglevel_str_debug_unit = "TRACE_DEBUG_UNIT";
-const char * const mi_lttng_loglevel_str_emerg = "TRACE_EMERG";
-const char * const mi_lttng_loglevel_str_err = "TRACE_ERR";
-const char * const mi_lttng_loglevel_str_info = "TRACE_INFO";
-const char * const mi_lttng_loglevel_str_notice = "TRACE_NOTICE";
-const char * const mi_lttng_loglevel_str_unknown = "UNKNOWN";
-const char * const mi_lttng_loglevel_str_warning = "TRACE_WARNING";
+const char *const mi_lttng_loglevel_str_alert = "TRACE_ALERT";
+const char *const mi_lttng_loglevel_str_crit = "TRACE_CRIT";
+const char *const mi_lttng_loglevel_str_debug = "TRACE_DEBUG";
+const char *const mi_lttng_loglevel_str_debug_function = "TRACE_DEBUG_FUNCTION";
+const char *const mi_lttng_loglevel_str_debug_line = "TRACE_DEBUG_LINE";
+const char *const mi_lttng_loglevel_str_debug_module = "TRACE_DEBUG_MODULE";
+const char *const mi_lttng_loglevel_str_debug_process = "TRACE_DEBUG_PROCESS";
+const char *const mi_lttng_loglevel_str_debug_program = "TRACE_DEBUG_PROGRAM";
+const char *const mi_lttng_loglevel_str_debug_system = "TRACE_DEBUG_SYSTEM";
+const char *const mi_lttng_loglevel_str_debug_unit = "TRACE_DEBUG_UNIT";
+const char *const mi_lttng_loglevel_str_emerg = "TRACE_EMERG";
+const char *const mi_lttng_loglevel_str_err = "TRACE_ERR";
+const char *const mi_lttng_loglevel_str_info = "TRACE_INFO";
+const char *const mi_lttng_loglevel_str_notice = "TRACE_NOTICE";
+const char *const mi_lttng_loglevel_str_unknown = "UNKNOWN";
+const char *const mi_lttng_loglevel_str_warning = "TRACE_WARNING";
 
 /* String related to loglevel JUL */
-const char * const mi_lttng_loglevel_str_jul_all = "JUL_ALL";
-const char * const mi_lttng_loglevel_str_jul_config = "JUL_CONFIG";
-const char * const mi_lttng_loglevel_str_jul_fine = "JUL_FINE";
-const char * const mi_lttng_loglevel_str_jul_finer = "JUL_FINER";
-const char * const mi_lttng_loglevel_str_jul_finest = "JUL_FINEST";
-const char * const mi_lttng_loglevel_str_jul_info = "JUL_INFO";
-const char * const mi_lttng_loglevel_str_jul_off = "JUL_OFF";
-const char * const mi_lttng_loglevel_str_jul_severe = "JUL_SEVERE";
-const char * const mi_lttng_loglevel_str_jul_warning = "JUL_WARNING";
+const char *const mi_lttng_loglevel_str_jul_all = "JUL_ALL";
+const char *const mi_lttng_loglevel_str_jul_config = "JUL_CONFIG";
+const char *const mi_lttng_loglevel_str_jul_fine = "JUL_FINE";
+const char *const mi_lttng_loglevel_str_jul_finer = "JUL_FINER";
+const char *const mi_lttng_loglevel_str_jul_finest = "JUL_FINEST";
+const char *const mi_lttng_loglevel_str_jul_info = "JUL_INFO";
+const char *const mi_lttng_loglevel_str_jul_off = "JUL_OFF";
+const char *const mi_lttng_loglevel_str_jul_severe = "JUL_SEVERE";
+const char *const mi_lttng_loglevel_str_jul_warning = "JUL_WARNING";
 
 /* String related to loglevel LOG4J */
-const char * const mi_lttng_loglevel_str_log4j_off = "LOG4J_OFF";
-const char * const mi_lttng_loglevel_str_log4j_fatal = "LOG4J_FATAL";
-const char * const mi_lttng_loglevel_str_log4j_error = "LOG4J_ERROR";
-const char * const mi_lttng_loglevel_str_log4j_warn = "LOG4J_WARN";
-const char * const mi_lttng_loglevel_str_log4j_info = "LOG4J_INFO";
-const char * const mi_lttng_loglevel_str_log4j_debug = "LOG4J_DEBUG";
-const char * const mi_lttng_loglevel_str_log4j_trace = "LOG4J_TRACE";
-const char * const mi_lttng_loglevel_str_log4j_all = "LOG4J_ALL";
+const char *const mi_lttng_loglevel_str_log4j_off = "LOG4J_OFF";
+const char *const mi_lttng_loglevel_str_log4j_fatal = "LOG4J_FATAL";
+const char *const mi_lttng_loglevel_str_log4j_error = "LOG4J_ERROR";
+const char *const mi_lttng_loglevel_str_log4j_warn = "LOG4J_WARN";
+const char *const mi_lttng_loglevel_str_log4j_info = "LOG4J_INFO";
+const char *const mi_lttng_loglevel_str_log4j_debug = "LOG4J_DEBUG";
+const char *const mi_lttng_loglevel_str_log4j_trace = "LOG4J_TRACE";
+const char *const mi_lttng_loglevel_str_log4j_all = "LOG4J_ALL";
 
 /* String related to loglevel Python */
-const char * const mi_lttng_loglevel_str_python_critical = "PYTHON_CRITICAL";
-const char * const mi_lttng_loglevel_str_python_error = "PYTHON_ERROR";
-const char * const mi_lttng_loglevel_str_python_warning = "PYTHON_WARNING";
-const char * const mi_lttng_loglevel_str_python_info = "PYTHON_INFO";
-const char * const mi_lttng_loglevel_str_python_debug = "PYTHON_DEBUG";
-const char * const mi_lttng_loglevel_str_python_notset = "PYTHON_NOTSET";
+const char *const mi_lttng_loglevel_str_python_critical = "PYTHON_CRITICAL";
+const char *const mi_lttng_loglevel_str_python_error = "PYTHON_ERROR";
+const char *const mi_lttng_loglevel_str_python_warning = "PYTHON_WARNING";
+const char *const mi_lttng_loglevel_str_python_info = "PYTHON_INFO";
+const char *const mi_lttng_loglevel_str_python_debug = "PYTHON_DEBUG";
+const char *const mi_lttng_loglevel_str_python_notset = "PYTHON_NOTSET";
 
 /* String related to loglevel type */
-const char * const mi_lttng_loglevel_type_all = "ALL";
-const char * const mi_lttng_loglevel_type_range = "RANGE";
-const char * const mi_lttng_loglevel_type_single = "SINGLE";
-const char * const mi_lttng_loglevel_type_unknown = "UNKNOWN";
+const char *const mi_lttng_loglevel_type_all = "ALL";
+const char *const mi_lttng_loglevel_type_range = "RANGE";
+const char *const mi_lttng_loglevel_type_single = "SINGLE";
+const char *const mi_lttng_loglevel_type_unknown = "UNKNOWN";
 
 /* String related to a lttng_snapshot_output */
-const char * const mi_lttng_element_snapshot_ctrl_url = "ctrl_url";
-const char * const mi_lttng_element_snapshot_data_url = "data_url";
-const char * const mi_lttng_element_snapshot_max_size = "max_size";
-const char * const mi_lttng_element_snapshot_n_ptr = "n_ptr";
-const char * const mi_lttng_element_snapshot_session_name = "session_name";
-const char * const mi_lttng_element_snapshots = "snapshots";
+const char *const mi_lttng_element_snapshot_ctrl_url = "ctrl_url";
+const char *const mi_lttng_element_snapshot_data_url = "data_url";
+const char *const mi_lttng_element_snapshot_max_size = "max_size";
+const char *const mi_lttng_element_snapshot_n_ptr = "n_ptr";
+const char *const mi_lttng_element_snapshot_session_name = "session_name";
+const char *const mi_lttng_element_snapshots = "snapshots";
 
 /* String related to track/untrack command */
-const char * const mi_lttng_element_track_untrack_all_wildcard = "*";
+const char *const mi_lttng_element_track_untrack_all_wildcard = "*";
 
-const char * const mi_lttng_element_session_name = "session_name";
+const char *const mi_lttng_element_session_name = "session_name";
 
 /* String related to rotate command */
-const char * const mi_lttng_element_rotation = "rotation";
-const char * const mi_lttng_element_rotate_status = "status";
-const char * const mi_lttng_element_rotation_schedule = "rotation_schedule";
-const char * const mi_lttng_element_rotation_schedules = "rotation_schedules";
-const char * const mi_lttng_element_rotation_schedule_result = "rotation_schedule_result";
-const char * const mi_lttng_element_rotation_schedule_results = "rotation_schedule_results";
-const char * const mi_lttng_element_rotation_schedule_periodic = "periodic";
-const char * const mi_lttng_element_rotation_schedule_periodic_time_us = "time_us";
-const char * const mi_lttng_element_rotation_schedule_size_threshold = "size_threshold";
-const char * const mi_lttng_element_rotation_schedule_size_threshold_bytes = "bytes";
-const char * const mi_lttng_element_rotation_state = "state";
-const char * const mi_lttng_element_rotation_location = "location";
-const char * const mi_lttng_element_rotation_location_local = "local";
-const char * const mi_lttng_element_rotation_location_local_absolute_path = "absolute_path";
-const char * const mi_lttng_element_rotation_location_relay = "relay";
-const char * const mi_lttng_element_rotation_location_relay_host = "host";
-const char * const mi_lttng_element_rotation_location_relay_control_port = "control_port";
-const char * const mi_lttng_element_rotation_location_relay_data_port = "data_port";
-const char * const mi_lttng_element_rotation_location_relay_protocol = "protocol";
-const char * const mi_lttng_element_rotation_location_relay_relative_path = "relative_path";
+const char *const mi_lttng_element_rotation = "rotation";
+const char *const mi_lttng_element_rotate_status = "status";
+const char *const mi_lttng_element_rotation_schedule = "rotation_schedule";
+const char *const mi_lttng_element_rotation_schedules = "rotation_schedules";
+const char *const mi_lttng_element_rotation_schedule_result = "rotation_schedule_result";
+const char *const mi_lttng_element_rotation_schedule_results = "rotation_schedule_results";
+const char *const mi_lttng_element_rotation_schedule_periodic = "periodic";
+const char *const mi_lttng_element_rotation_schedule_periodic_time_us = "time_us";
+const char *const mi_lttng_element_rotation_schedule_size_threshold = "size_threshold";
+const char *const mi_lttng_element_rotation_schedule_size_threshold_bytes = "bytes";
+const char *const mi_lttng_element_rotation_state = "state";
+const char *const mi_lttng_element_rotation_location = "location";
+const char *const mi_lttng_element_rotation_location_local = "local";
+const char *const mi_lttng_element_rotation_location_local_absolute_path = "absolute_path";
+const char *const mi_lttng_element_rotation_location_relay = "relay";
+const char *const mi_lttng_element_rotation_location_relay_host = "host";
+const char *const mi_lttng_element_rotation_location_relay_control_port = "control_port";
+const char *const mi_lttng_element_rotation_location_relay_data_port = "data_port";
+const char *const mi_lttng_element_rotation_location_relay_protocol = "protocol";
+const char *const mi_lttng_element_rotation_location_relay_relative_path = "relative_path";
 
 /* String related to enum lttng_rotation_state */
-const char * const mi_lttng_rotation_state_str_ongoing = "ONGOING";
-const char * const mi_lttng_rotation_state_str_completed = "COMPLETED";
-const char * const mi_lttng_rotation_state_str_expired = "EXPIRED";
-const char * const mi_lttng_rotation_state_str_error = "ERROR";
+const char *const mi_lttng_rotation_state_str_ongoing = "ONGOING";
+const char *const mi_lttng_rotation_state_str_completed = "COMPLETED";
+const char *const mi_lttng_rotation_state_str_expired = "EXPIRED";
+const char *const mi_lttng_rotation_state_str_error = "ERROR";
 
 /* String related to enum lttng_trace_archive_location_relay_protocol_type */
-const char * const mi_lttng_rotation_location_relay_protocol_str_tcp = "TCP";
+const char *const mi_lttng_rotation_location_relay_protocol_str_tcp = "TCP";
 
 /* String related to rate_policy elements */
 const char *const mi_lttng_element_rate_policy = "rate_policy";
-const char *const mi_lttng_element_rate_policy_every_n =
-               "rate_policy_every_n";
-const char *const mi_lttng_element_rate_policy_once_after_n =
-               "rate_policy_once_after_n";
+const char *const mi_lttng_element_rate_policy_every_n = "rate_policy_every_n";
+const char *const mi_lttng_element_rate_policy_once_after_n = "rate_policy_once_after_n";
 
-const char *const mi_lttng_element_rate_policy_every_n_interval =
-               "interval";
-const char
-               *const mi_lttng_element_rate_policy_once_after_n_threshold =
-                               "threshold";
+const char *const mi_lttng_element_rate_policy_every_n_interval = "interval";
+const char *const mi_lttng_element_rate_policy_once_after_n_threshold = "threshold";
 
 /* String related to action elements */
 const char *const mi_lttng_element_action = "action";
 const char *const mi_lttng_element_action_list = "action_list";
 const char *const mi_lttng_element_action_notify = "action_notify";
-const char *const mi_lttng_element_action_start_session =
-               "action_start_session";
-const char *const mi_lttng_element_action_stop_session =
-               "action_stop_session";
-const char *const mi_lttng_element_action_rotate_session =
-               "action_rotate_session";
-const char *const mi_lttng_element_action_snapshot_session =
-               "action_snapshot_session";
-const char *const mi_lttng_element_action_snapshot_session_output =
-               "output";
+const char *const mi_lttng_element_action_start_session = "action_start_session";
+const char *const mi_lttng_element_action_stop_session = "action_stop_session";
+const char *const mi_lttng_element_action_rotate_session = "action_rotate_session";
+const char *const mi_lttng_element_action_snapshot_session = "action_snapshot_session";
+const char *const mi_lttng_element_action_snapshot_session_output = "output";
 
 /* String related to condition */
 const char *const mi_lttng_element_condition = "condition";
-const char *const mi_lttng_element_condition_buffer_usage_high =
-               "condition_buffer_usage_high";
-const char *const mi_lttng_element_condition_buffer_usage_low =
-               "condition_buffer_usage_low";
-const char *const mi_lttng_element_condition_event_rule_matches =
-               "condition_event_rule_matches";
+const char *const mi_lttng_element_condition_buffer_usage_high = "condition_buffer_usage_high";
+const char *const mi_lttng_element_condition_buffer_usage_low = "condition_buffer_usage_low";
+const char *const mi_lttng_element_condition_event_rule_matches = "condition_event_rule_matches";
 const char *const mi_lttng_element_condition_session_consumed_size =
-               "condition_session_consumed_size";
-const char *const mi_lttng_element_condition_session_rotation =
-               "condition_session_rotation";
-const char
-               *const mi_lttng_element_condition_session_rotation_completed =
-                               "condition_session_rotation_completed";
-const char
-               *const mi_lttng_element_condition_session_rotation_ongoing =
-                               "condition_session_rotation_ongoing";
-
-const char *const mi_lttng_element_condition_channel_name =
-               "channel_name";
-const char *const mi_lttng_element_condition_threshold_bytes =
-               "threshold_bytes";
-const char *const mi_lttng_element_condition_threshold_ratio =
-               "threshold_ratio";
+       "condition_session_consumed_size";
+const char *const mi_lttng_element_condition_session_rotation = "condition_session_rotation";
+const char *const mi_lttng_element_condition_session_rotation_completed =
+       "condition_session_rotation_completed";
+const char *const mi_lttng_element_condition_session_rotation_ongoing =
+       "condition_session_rotation_ongoing";
+
+const char *const mi_lttng_element_condition_channel_name = "channel_name";
+const char *const mi_lttng_element_condition_threshold_bytes = "threshold_bytes";
+const char *const mi_lttng_element_condition_threshold_ratio = "threshold_ratio";
 
 /* String related to capture descriptor */
-const char *const mi_lttng_element_capture_descriptor =
-               "capture_descriptor";
-const char *const mi_lttng_element_capture_descriptors =
-               "capture_descriptors";
+const char *const mi_lttng_element_capture_descriptor = "capture_descriptor";
+const char *const mi_lttng_element_capture_descriptors = "capture_descriptors";
 
 /* String related to event expression */
 const char *const mi_lttng_element_event_expr = "event_expr";
-const char *const mi_lttng_element_event_expr_payload_field =
-               "event_expr_payload_field";
+const char *const mi_lttng_element_event_expr_payload_field = "event_expr_payload_field";
 const char *const mi_lttng_element_event_expr_channel_context_field =
-               "event_expr_channel_context_field";
-const char
-               *const mi_lttng_element_event_expr_app_specific_context_field =
-                               "event_expr_app_specific_context_field";
+       "event_expr_channel_context_field";
+const char *const mi_lttng_element_event_expr_app_specific_context_field =
+       "event_expr_app_specific_context_field";
 const char *const mi_lttng_element_event_expr_array_field_element =
-               "event_expr_array_field_element";
-const char *const mi_lttng_element_event_expr_provider_name =
-               "provider_name";
-const char *const mi_lttng_element_event_expr_type_name =
-               "type_name";
+       "event_expr_array_field_element";
+const char *const mi_lttng_element_event_expr_provider_name = "provider_name";
+const char *const mi_lttng_element_event_expr_type_name = "type_name";
 const char *const mi_lttng_element_event_expr_index = "index";
 
 /* String related to event rule */
 const char *const mi_lttng_element_event_rule = "event_rule";
 
 /* String related to lttng_event_rule_type */
-const char *const mi_lttng_element_event_rule_event_name =
-               "event_name";
-const char *const mi_lttng_element_event_rule_name_pattern =
-               "name_pattern";
-const char *const mi_lttng_element_event_rule_filter_expression =
-               "filter_expression";
-
-const char *const mi_lttng_element_event_rule_jul_logging =
-               "event_rule_jul_logging";
-const char *const mi_lttng_element_event_rule_kernel_kprobe =
-               "event_rule_kernel_kprobe";
-const char *const mi_lttng_element_event_rule_kernel_syscall =
-               "event_rule_kernel_syscall";
-const char *const mi_lttng_element_event_rule_kernel_tracepoint =
-               "event_rule_kernel_tracepoint";
-const char *const mi_lttng_element_event_rule_kernel_uprobe =
-               "event_rule_kernel_uprobe";
-const char *const mi_lttng_element_event_rule_log4j_logging =
-               "event_rule_log4j_logging";
-const char *const mi_lttng_element_event_rule_python_logging =
-               "event_rule_python_logging";
-const char *const mi_lttng_element_event_rule_user_tracepoint =
-               "event_rule_user_tracepoint";
+const char *const mi_lttng_element_event_rule_event_name = "event_name";
+const char *const mi_lttng_element_event_rule_name_pattern = "name_pattern";
+const char *const mi_lttng_element_event_rule_filter_expression = "filter_expression";
+
+const char *const mi_lttng_element_event_rule_jul_logging = "event_rule_jul_logging";
+const char *const mi_lttng_element_event_rule_kernel_kprobe = "event_rule_kernel_kprobe";
+const char *const mi_lttng_element_event_rule_kernel_syscall = "event_rule_kernel_syscall";
+const char *const mi_lttng_element_event_rule_kernel_tracepoint = "event_rule_kernel_tracepoint";
+const char *const mi_lttng_element_event_rule_kernel_uprobe = "event_rule_kernel_uprobe";
+const char *const mi_lttng_element_event_rule_log4j_logging = "event_rule_log4j_logging";
+const char *const mi_lttng_element_event_rule_python_logging = "event_rule_python_logging";
+const char *const mi_lttng_element_event_rule_user_tracepoint = "event_rule_user_tracepoint";
 
 /* String related to lttng_event_rule_kernel_syscall. */
-const char *const
-               mi_lttng_element_event_rule_kernel_syscall_emission_site =
-                               "emission_site";
+const char *const mi_lttng_element_event_rule_kernel_syscall_emission_site = "emission_site";
 
 /* String related to enum lttng_event_rule_kernel_syscall_emission_site. */
-const char *const
-               mi_lttng_event_rule_kernel_syscall_emission_site_entry_exit =
-                               "entry+exit";
-const char
-               *const mi_lttng_event_rule_kernel_syscall_emission_site_entry =
-                               "entry";
-const char *const
-               mi_lttng_event_rule_kernel_syscall_emission_site_exit = "exit";
+const char *const mi_lttng_event_rule_kernel_syscall_emission_site_entry_exit = "entry+exit";
+const char *const mi_lttng_event_rule_kernel_syscall_emission_site_entry = "entry";
+const char *const mi_lttng_event_rule_kernel_syscall_emission_site_exit = "exit";
 
 /* String related to lttng_event_rule_user_tracepoint */
-const char *const
-               mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusions =
-                               "name_pattern_exclusions";
-const char *const
-               mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusion =
-                               "name_pattern_exclusion";
+const char *const mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusions =
+       "name_pattern_exclusions";
+const char *const mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusion =
+       "name_pattern_exclusion";
 
 /* String related to log level rule. */
-const char *const mi_lttng_element_log_level_rule =
-               "log_level_rule";
-const char *const mi_lttng_element_log_level_rule_exactly =
-               "log_level_rule_exactly";
-const char
-               *const mi_lttng_element_log_level_rule_at_least_as_severe_as =
-                               "log_level_rule_at_least_as_severe_as";
+const char *const mi_lttng_element_log_level_rule = "log_level_rule";
+const char *const mi_lttng_element_log_level_rule_exactly = "log_level_rule_exactly";
+const char *const mi_lttng_element_log_level_rule_at_least_as_severe_as =
+       "log_level_rule_at_least_as_severe_as";
 const char *const mi_lttng_element_log_level_rule_level = "level";
 
 /* String related to kernel probe location. */
-const char *const mi_lttng_element_kernel_probe_location =
-               "kernel_probe_location";
-const char
-               *const mi_lttng_element_kernel_probe_location_symbol_offset =
-                               "kernel_probe_location_symbol_offset";
-const char *const
-               mi_lttng_element_kernel_probe_location_symbol_offset_name =
-                               "name";
-const char *const
-               mi_lttng_element_kernel_probe_location_symbol_offset_offset =
-                               "offset";
-
-const char *const mi_lttng_element_kernel_probe_location_address =
-               "kernel_probe_location_address";
-const char
-               *const mi_lttng_element_kernel_probe_location_address_address =
-                               "address";
+const char *const mi_lttng_element_kernel_probe_location = "kernel_probe_location";
+const char *const mi_lttng_element_kernel_probe_location_symbol_offset =
+       "kernel_probe_location_symbol_offset";
+const char *const mi_lttng_element_kernel_probe_location_symbol_offset_name = "name";
+const char *const mi_lttng_element_kernel_probe_location_symbol_offset_offset = "offset";
+
+const char *const mi_lttng_element_kernel_probe_location_address = "kernel_probe_location_address";
+const char *const mi_lttng_element_kernel_probe_location_address_address = "address";
 
 /* String related to userspace probe location. */
-const char *const mi_lttng_element_userspace_probe_location =
-               "userspace_probe_location";
-const char
-               *const mi_lttng_element_userspace_probe_location_binary_path =
-                               "binary_path";
-const char
-               *const mi_lttng_element_userspace_probe_location_function =
-                               "userspace_probe_location_function";
-const char
-               *const mi_lttng_element_userspace_probe_location_function_name =
-                               "name";
-const char
-               *const mi_lttng_element_userspace_probe_location_lookup_method =
-                               "userspace_probe_location_lookup_method";
-const char *const
-               mi_lttng_element_userspace_probe_location_lookup_method_function_default =
-                               "userspace_probe_location_lookup_method_function_default";
-const char *const
-               mi_lttng_element_userspace_probe_location_lookup_method_function_elf =
-                               "userspace_probe_location_lookup_method_function_elf";
-const char *const
-               mi_lttng_element_userspace_probe_location_lookup_method_tracepoint_sdt =
-                               "userspace_probe_location_lookup_method_tracepoint_sdt";
-const char
-               *const mi_lttng_element_userspace_probe_location_tracepoint =
-                               "userspace_probe_location_tracepoint";
-const char *const
-               mi_lttng_element_userspace_probe_location_tracepoint_probe_name =
-                               "probe_name";
-const char *const
-               mi_lttng_element_userspace_probe_location_tracepoint_provider_name =
-                               "provider_name";
+const char *const mi_lttng_element_userspace_probe_location = "userspace_probe_location";
+const char *const mi_lttng_element_userspace_probe_location_binary_path = "binary_path";
+const char *const mi_lttng_element_userspace_probe_location_function =
+       "userspace_probe_location_function";
+const char *const mi_lttng_element_userspace_probe_location_function_name = "name";
+const char *const mi_lttng_element_userspace_probe_location_lookup_method =
+       "userspace_probe_location_lookup_method";
+const char *const mi_lttng_element_userspace_probe_location_lookup_method_function_default =
+       "userspace_probe_location_lookup_method_function_default";
+const char *const mi_lttng_element_userspace_probe_location_lookup_method_function_elf =
+       "userspace_probe_location_lookup_method_function_elf";
+const char *const mi_lttng_element_userspace_probe_location_lookup_method_tracepoint_sdt =
+       "userspace_probe_location_lookup_method_tracepoint_sdt";
+const char *const mi_lttng_element_userspace_probe_location_tracepoint =
+       "userspace_probe_location_tracepoint";
+const char *const mi_lttng_element_userspace_probe_location_tracepoint_probe_name = "probe_name";
+const char *const mi_lttng_element_userspace_probe_location_tracepoint_provider_name =
+       "provider_name";
 
 /* String related to enum
  * lttng_userspace_probe_location_function_instrumentation_type */
-const char *const
-               mi_lttng_element_userspace_probe_location_function_instrumentation_type =
-                               "instrumentation_type";
-const char *const
-               mi_lttng_userspace_probe_location_function_instrumentation_type_entry =
-                               "ENTRY";
+const char *const mi_lttng_element_userspace_probe_location_function_instrumentation_type =
+       "instrumentation_type";
+const char *const mi_lttng_userspace_probe_location_function_instrumentation_type_entry = "ENTRY";
 
 /* String related to trigger */
 const char *const mi_lttng_element_triggers = "triggers";
@@ -415,23 +341,16 @@ const char *const mi_lttng_element_trigger = "trigger";
 const char *const mi_lttng_element_trigger_owner_uid = "owner_uid";
 
 /* String related to error_query. */
-const char *const mi_lttng_element_error_query_result =
-               "error_query_result";
-const char *const mi_lttng_element_error_query_result_counter =
-               "error_query_result_counter";
-const char *const
-               mi_lttng_element_error_query_result_counter_value = "value";
-const char *const mi_lttng_element_error_query_result_description =
-               "description";
-const char *const mi_lttng_element_error_query_result_name =
-               "name";
-const char *const mi_lttng_element_error_query_result_type =
-               "type";
-const char *const mi_lttng_element_error_query_results =
-               "error_query_results";
+const char *const mi_lttng_element_error_query_result = "error_query_result";
+const char *const mi_lttng_element_error_query_result_counter = "error_query_result_counter";
+const char *const mi_lttng_element_error_query_result_counter_value = "value";
+const char *const mi_lttng_element_error_query_result_description = "description";
+const char *const mi_lttng_element_error_query_result_name = "name";
+const char *const mi_lttng_element_error_query_result_type = "type";
+const char *const mi_lttng_element_error_query_results = "error_query_results";
 
 /* String related to add-context command */
-const char * const mi_lttng_element_context_symbol = "symbol";
+const char *const mi_lttng_element_context_symbol = "symbol";
 
 /* Deprecated symbols preserved for ABI compatibility. */
 LTTNG_EXPORT const char *mi_lttng_context_type_perf_counter;
@@ -576,8 +495,7 @@ const char *mi_lttng_logleveltype_string(enum lttng_loglevel_type value)
        }
 }
 
-static
-const char *mi_lttng_eventtype_string(enum lttng_event_type value)
+static const char *mi_lttng_eventtype_string(enum lttng_event_type value)
 {
        switch (value) {
        case LTTNG_EVENT_ALL:
@@ -601,8 +519,7 @@ const char *mi_lttng_eventtype_string(enum lttng_event_type value)
        }
 }
 
-static
-const char *mi_lttng_event_contexttype_string(enum lttng_event_context_type val)
+static const char *mi_lttng_event_contexttype_string(enum lttng_event_context_type val)
 {
        switch (val) {
        case LTTNG_EVENT_CONTEXT_PID:
@@ -689,13 +606,13 @@ const char *mi_lttng_event_contexttype_string(enum lttng_event_context_type val)
 const char *mi_lttng_eventfieldtype_string(enum lttng_event_field_type val)
 {
        switch (val) {
-       case(LTTNG_EVENT_FIELD_INTEGER):
+       case (LTTNG_EVENT_FIELD_INTEGER):
                return mi_lttng_element_type_integer;
-       case(LTTNG_EVENT_FIELD_ENUM):
+       case (LTTNG_EVENT_FIELD_ENUM):
                return mi_lttng_element_type_enum;
-       case(LTTNG_EVENT_FIELD_FLOAT):
+       case (LTTNG_EVENT_FIELD_FLOAT):
                return mi_lttng_element_type_float;
-       case(LTTNG_EVENT_FIELD_STRING):
+       case (LTTNG_EVENT_FIELD_STRING):
                return mi_lttng_element_type_string;
        default:
                return mi_lttng_element_type_other;
@@ -757,7 +674,7 @@ const char *mi_lttng_rotation_state_string(enum lttng_rotation_state value)
 }
 
 const char *mi_lttng_trace_archive_location_relay_protocol_type_string(
-               enum lttng_trace_archive_location_relay_protocol_type value)
+       enum lttng_trace_archive_location_relay_protocol_type value)
 {
        switch (value) {
        case LTTNG_TRACE_ARCHIVE_LOCATION_RELAY_PROTOCOL_TYPE_TCP:
@@ -823,40 +740,36 @@ int mi_lttng_writer_command_open(struct mi_writer *writer, const char *command)
         * A command is always the MI's root node, it must declare the current
         * namespace and schema URIs and the schema's version.
         */
-       ret = config_writer_open_element(writer->writer,
-                       mi_lttng_element_command);
+       ret = config_writer_open_element(writer->writer, mi_lttng_element_command);
        if (ret) {
                goto end;
        }
 
-       ret = config_writer_write_attribute(writer->writer,
-                       mi_lttng_xmlns, DEFAULT_LTTNG_MI_NAMESPACE);
+       ret = config_writer_write_attribute(
+               writer->writer, mi_lttng_xmlns, DEFAULT_LTTNG_MI_NAMESPACE);
        if (ret) {
                goto end;
        }
 
-       ret = config_writer_write_attribute(writer->writer,
-                       mi_lttng_xmlns_xsi, mi_lttng_w3_schema_uri);
+       ret = config_writer_write_attribute(
+               writer->writer, mi_lttng_xmlns_xsi, mi_lttng_w3_schema_uri);
        if (ret) {
                goto end;
        }
 
-       ret = config_writer_write_attribute(writer->writer,
-                       mi_lttng_schema_location,
-                       mi_lttng_schema_location_uri);
+       ret = config_writer_write_attribute(
+               writer->writer, mi_lttng_schema_location, mi_lttng_schema_location_uri);
        if (ret) {
                goto end;
        }
 
-       ret = config_writer_write_attribute(writer->writer,
-                       mi_lttng_schema_version,
-                       mi_lttng_schema_version_value);
+       ret = config_writer_write_attribute(
+               writer->writer, mi_lttng_schema_version, mi_lttng_schema_version_value);
        if (ret) {
                goto end;
        }
 
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_command_name, command);
+       ret = mi_lttng_writer_write_element_string(writer, mi_lttng_element_command_name, command);
 end:
        return ret;
 }
@@ -866,8 +779,7 @@ int mi_lttng_writer_command_close(struct mi_writer *writer)
        return mi_lttng_writer_close_element(writer);
 }
 
-int mi_lttng_writer_open_element(struct mi_writer *writer,
-               const char *element_name)
+int mi_lttng_writer_open_element(struct mi_writer *writer, const char *element_name)
 {
        return config_writer_open_element(writer->writer, element_name);
 }
@@ -877,8 +789,7 @@ int mi_lttng_writer_close_element(struct mi_writer *writer)
        return config_writer_close_element(writer->writer);
 }
 
-int mi_lttng_close_multi_element(struct mi_writer *writer,
-               unsigned int nb_element)
+int mi_lttng_close_multi_element(struct mi_writer *writer, unsigned int nb_element)
 {
        int ret, i;
 
@@ -897,43 +808,44 @@ end:
 }
 
 int mi_lttng_writer_write_element_unsigned_int(struct mi_writer *writer,
-               const char *element_name, uint64_t value)
+                                              const char *element_name,
+                                              uint64_t value)
 {
-       return config_writer_write_element_unsigned_int(writer->writer,
-                       element_name, value);
+       return config_writer_write_element_unsigned_int(writer->writer, element_name, value);
 }
 
 int mi_lttng_writer_write_element_signed_int(struct mi_writer *writer,
-               const char *element_name, int64_t value)
+                                            const char *element_name,
+                                            int64_t value)
 {
-       return config_writer_write_element_signed_int(writer->writer,
-                       element_name, value);
+       return config_writer_write_element_signed_int(writer->writer, element_name, value);
 }
 
 int mi_lttng_writer_write_element_bool(struct mi_writer *writer,
-               const char *element_name, int value)
+                                      const char *element_name,
+                                      int value)
 {
-       return config_writer_write_element_bool(writer->writer,
-                       element_name, value);
+       return config_writer_write_element_bool(writer->writer, element_name, value);
 }
 
 int mi_lttng_writer_write_element_string(struct mi_writer *writer,
-               const char *element_name, const char *value)
+                                        const char *element_name,
+                                        const char *value)
 {
-       return config_writer_write_element_string(writer->writer,
-                       element_name, value);
+       return config_writer_write_element_string(writer->writer, element_name, value);
 }
 
 int mi_lttng_writer_write_element_double(struct mi_writer *writer,
-               const char *element_name,
-               double value)
+                                        const char *element_name,
+                                        double value)
 {
-       return config_writer_write_element_double(
-                       writer->writer, element_name, value);
+       return config_writer_write_element_double(writer->writer, element_name, value);
 }
 
-int mi_lttng_version(struct mi_writer *writer, struct mi_lttng_version_data *version,
-       const char *lttng_description, const char *lttng_license)
+int mi_lttng_version(struct mi_writer *writer,
+                    struct mi_lttng_version_data *version,
+                    const char *lttng_description,
+                    const char *lttng_license)
 {
        int ret;
 
@@ -944,64 +856,64 @@ int mi_lttng_version(struct mi_writer *writer, struct mi_lttng_version_data *ver
        }
 
        /* Version string (contain info like rc etc.) */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_version_str, version->version);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_version_str, version->version);
        if (ret) {
                goto end;
        }
 
        /* Major version number */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       mi_lttng_element_version_major, version->version_major);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, mi_lttng_element_version_major, version->version_major);
        if (ret) {
                goto end;
        }
 
        /* Minor version number */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       mi_lttng_element_version_minor, version->version_minor);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, mi_lttng_element_version_minor, version->version_minor);
        if (ret) {
                goto end;
        }
 
        /* Commit version number */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_version_commit, version->version_commit);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_version_commit, version->version_commit);
        if (ret) {
                goto end;
        }
 
        /* Patch number */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       mi_lttng_element_version_patch_level, version->version_patchlevel);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, mi_lttng_element_version_patch_level, version->version_patchlevel);
        if (ret) {
                goto end;
        }
 
        /* Name of the version */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_name, version->version_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, config_element_name, version->version_name);
        if (ret) {
                goto end;
        }
 
        /* Description mostly related to beer... */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_version_description, lttng_description);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_version_description, lttng_description);
        if (ret) {
                goto end;
        }
 
        /* url */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_version_web, version->package_url);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_version_web, version->package_url);
        if (ret) {
                goto end;
        }
 
        /* License: free as in free beer...no...*speech* */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_version_license, lttng_license);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_version_license, lttng_license);
        if (ret) {
                goto end;
        }
@@ -1018,52 +930,46 @@ int mi_lttng_sessions_open(struct mi_writer *writer)
        return mi_lttng_writer_open_element(writer, config_element_sessions);
 }
 
-int mi_lttng_session(struct mi_writer *writer,
-               struct lttng_session *session, int is_open)
+int mi_lttng_session(struct mi_writer *writer, struct lttng_session *session, int is_open)
 {
        int ret;
 
        LTTNG_ASSERT(session);
 
        /* Open sessions element */
-       ret = mi_lttng_writer_open_element(writer,
-                       config_element_session);
+       ret = mi_lttng_writer_open_element(writer, config_element_session);
        if (ret) {
                goto end;
        }
 
        /* Name of the session */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_name, session->name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, session->name);
        if (ret) {
                goto end;
        }
 
        /* Path */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_path, session->path);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_path, session->path);
        if (ret) {
                goto end;
        }
 
        /* Enabled ? */
-       ret = mi_lttng_writer_write_element_bool(writer,
-                       config_element_enabled, session->enabled);
+       ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled, session->enabled);
        if (ret) {
                goto end;
        }
 
        /* Snapshot mode */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       config_element_snapshot_mode, session->snapshot_mode);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_snapshot_mode, session->snapshot_mode);
        if (ret) {
                goto end;
        }
 
        /* Live timer interval in usec */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       config_element_live_timer_interval,
-                       session->live_timer_interval);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_live_timer_interval, session->live_timer_interval);
        if (ret) {
                goto end;
        }
@@ -1074,7 +980,6 @@ int mi_lttng_session(struct mi_writer *writer,
        }
 end:
        return ret;
-
 }
 
 int mi_lttng_domains_open(struct mi_writer *writer)
@@ -1082,8 +987,7 @@ int mi_lttng_domains_open(struct mi_writer *writer)
        return mi_lttng_writer_open_element(writer, config_element_domains);
 }
 
-int mi_lttng_domain(struct mi_writer *writer,
-               struct lttng_domain *domain, int is_open)
+int mi_lttng_domain(struct mi_writer *writer, struct lttng_domain *domain, int is_open)
 {
        int ret = 0;
        const char *str_domain;
@@ -1099,16 +1003,14 @@ int mi_lttng_domain(struct mi_writer *writer,
 
        /* Domain Type */
        str_domain = mi_lttng_domaintype_string(domain->type);
-       ret = mi_lttng_writer_write_element_string(writer, config_element_type,
-                       str_domain);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_type, str_domain);
        if (ret) {
                goto end;
        }
 
        /* Buffer Type */
-       str_buffer= mi_lttng_buffertype_string(domain->buf_type);
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_buffer_type, str_buffer);
+       str_buffer = mi_lttng_buffertype_string(domain->buf_type);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_buffer_type, str_buffer);
        if (ret) {
                goto end;
        }
@@ -1126,7 +1028,6 @@ int mi_lttng_domain(struct mi_writer *writer,
 
 end:
        return ret;
-
 }
 
 int mi_lttng_channels_open(struct mi_writer *writer)
@@ -1134,8 +1035,7 @@ int mi_lttng_channels_open(struct mi_writer *writer)
        return mi_lttng_writer_open_element(writer, config_element_channels);
 }
 
-int mi_lttng_channel(struct mi_writer *writer,
-               struct lttng_channel *channel, int is_open)
+int mi_lttng_channel(struct mi_writer *writer, struct lttng_channel *channel, int is_open)
 {
        int ret = 0;
 
@@ -1148,15 +1048,13 @@ int mi_lttng_channel(struct mi_writer *writer,
        }
 
        /* Name */
-       ret = mi_lttng_writer_write_element_string(writer, config_element_name,
-                       channel->name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, channel->name);
        if (ret) {
                goto end;
        }
 
        /* Enabled ? */
-       ret = mi_lttng_writer_write_element_bool(writer,
-                       config_element_enabled, channel->enabled);
+       ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled, channel->enabled);
        if (ret) {
                goto end;
        }
@@ -1178,12 +1076,10 @@ end:
        return ret;
 }
 
-int mi_lttng_channel_attr(struct mi_writer *writer,
-               struct lttng_channel_attr *attr)
+int mi_lttng_channel_attr(struct mi_writer *writer, struct lttng_channel_attr *attr)
 {
        int ret = 0;
-       struct lttng_channel *chan = caa_container_of(attr,
-                       struct lttng_channel, attr);
+       struct lttng_channel *chan = caa_container_of(attr, struct lttng_channel, attr);
        uint64_t discarded_events, lost_packets, monitor_timer_interval;
        int64_t blocking_timeout;
 
@@ -1199,14 +1095,12 @@ int mi_lttng_channel_attr(struct mi_writer *writer,
                goto end;
        }
 
-       ret = lttng_channel_get_monitor_timer_interval(chan,
-                       &monitor_timer_interval);
+       ret = lttng_channel_get_monitor_timer_interval(chan, &monitor_timer_interval);
        if (ret) {
                goto end;
        }
 
-       ret = lttng_channel_get_blocking_timeout(chan,
-                       &blocking_timeout);
+       ret = lttng_channel_get_blocking_timeout(chan, &blocking_timeout);
        if (ret) {
                goto end;
        }
@@ -1218,105 +1112,97 @@ int mi_lttng_channel_attr(struct mi_writer *writer,
        }
 
        /* Overwrite */
-       ret = mi_lttng_writer_write_element_string(writer,
+       ret = mi_lttng_writer_write_element_string(
+               writer,
                config_element_overwrite_mode,
-               attr->overwrite ? config_overwrite_mode_overwrite :
-                       config_overwrite_mode_discard);
+               attr->overwrite ? config_overwrite_mode_overwrite : config_overwrite_mode_discard);
        if (ret) {
                goto end;
        }
 
        /* Sub buffer size in byte */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-               config_element_subbuf_size, attr->subbuf_size);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_subbuf_size, attr->subbuf_size);
        if (ret) {
                goto end;
        }
 
        /* Number of subbuffer (power of two) */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-               config_element_num_subbuf,
-               attr->num_subbuf);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_num_subbuf, attr->num_subbuf);
        if (ret) {
                goto end;
        }
 
        /* Switch timer interval in usec */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-               config_element_switch_timer_interval,
-               attr->switch_timer_interval);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_switch_timer_interval, attr->switch_timer_interval);
        if (ret) {
                goto end;
        }
 
        /* Read timer interval in usec */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-               config_element_read_timer_interval,
-               attr->read_timer_interval);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_read_timer_interval, attr->read_timer_interval);
        if (ret) {
                goto end;
        }
 
        /* Monitor timer interval in usec */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-               config_element_monitor_timer_interval,
-               monitor_timer_interval);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_monitor_timer_interval, monitor_timer_interval);
        if (ret) {
                goto end;
        }
 
        /* Retry timeout in usec */
-       ret = mi_lttng_writer_write_element_signed_int(writer,
-               config_element_blocking_timeout,
-               blocking_timeout);
+       ret = mi_lttng_writer_write_element_signed_int(
+               writer, config_element_blocking_timeout, blocking_timeout);
        if (ret) {
                goto end;
        }
 
        /* Event output */
        ret = mi_lttng_writer_write_element_string(writer,
-               config_element_output_type,
-               attr->output == LTTNG_EVENT_SPLICE ?
-               config_output_type_splice : config_output_type_mmap);
+                                                  config_element_output_type,
+                                                  attr->output == LTTNG_EVENT_SPLICE ?
+                                                          config_output_type_splice :
+                                                          config_output_type_mmap);
        if (ret) {
                goto end;
        }
 
        /* Tracefile size in bytes */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-               config_element_tracefile_size, attr->tracefile_size);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_tracefile_size, attr->tracefile_size);
        if (ret) {
                goto end;
        }
 
        /* Count of tracefiles */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-               config_element_tracefile_count,
-               attr->tracefile_count);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_tracefile_count, attr->tracefile_count);
        if (ret) {
                goto end;
        }
 
        /* Live timer interval in usec*/
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-               config_element_live_timer_interval,
-               attr->live_timer_interval);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_live_timer_interval, attr->live_timer_interval);
        if (ret) {
                goto end;
        }
 
        /* Discarded events */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-               config_element_discarded_events,
-               discarded_events);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_discarded_events, discarded_events);
        if (ret) {
                goto end;
        }
 
        /* Lost packets */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-               config_element_lost_packets,
-               lost_packets);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_lost_packets, lost_packets);
        if (ret) {
                goto end;
        }
@@ -1328,11 +1214,9 @@ int mi_lttng_channel_attr(struct mi_writer *writer,
        }
 end:
        return ret;
-
 }
 
-int mi_lttng_event_common_attributes(struct mi_writer *writer,
-               struct lttng_event *event)
+int mi_lttng_event_common_attributes(struct mi_writer *writer, struct lttng_event *event)
 {
        int ret;
        const char *filter_expression;
@@ -1344,22 +1228,20 @@ int mi_lttng_event_common_attributes(struct mi_writer *writer,
        }
 
        /* Event name */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_name, event->name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, event->name);
        if (ret) {
                goto end;
        }
 
        /* Event type */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_type, mi_lttng_eventtype_string(event->type));
+       ret = mi_lttng_writer_write_element_string(
+               writer, config_element_type, mi_lttng_eventtype_string(event->type));
        if (ret) {
                goto end;
        }
 
        /* Is event enabled */
-       ret = mi_lttng_writer_write_element_bool(writer,
-                       config_element_enabled, event->enabled);
+       ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled, event->enabled);
        if (ret) {
                goto end;
        }
@@ -1371,9 +1253,8 @@ int mi_lttng_event_common_attributes(struct mi_writer *writer,
        }
 
        if (filter_expression) {
-               ret = mi_lttng_writer_write_element_string(writer,
-                               config_element_filter_expression,
-                               filter_expression);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, config_element_filter_expression, filter_expression);
                if (ret) {
                        goto end;
                }
@@ -1383,8 +1264,7 @@ end:
        return ret;
 }
 
-static int write_event_exclusions(struct mi_writer *writer,
-               struct lttng_event *event)
+static int write_event_exclusions(struct mi_writer *writer, struct lttng_event *event)
 {
        int i;
        int ret;
@@ -1412,8 +1292,7 @@ static int write_event_exclusions(struct mi_writer *writer,
                        goto end;
                }
 
-               ret = mi_lttng_writer_write_element_string(writer,
-                               config_element_exclusion, name);
+               ret = mi_lttng_writer_write_element_string(writer, config_element_exclusion, name);
                if (ret) {
                        /* Close exclusions */
                        mi_lttng_writer_close_element(writer);
@@ -1429,22 +1308,23 @@ end:
 }
 
 int mi_lttng_event_tracepoint_loglevel(struct mi_writer *writer,
-               struct lttng_event *event, enum lttng_domain_type domain)
+                                      struct lttng_event *event,
+                                      enum lttng_domain_type domain)
 {
        int ret;
 
        /* Event loglevel */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_loglevel,
-                       mi_lttng_loglevel_string(event->loglevel, domain));
+       ret = mi_lttng_writer_write_element_string(
+               writer, config_element_loglevel, mi_lttng_loglevel_string(event->loglevel, domain));
        if (ret) {
                goto end;
        }
 
        /* Log level type */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_loglevel_type,
-                       mi_lttng_logleveltype_string(event->loglevel_type));
+       ret = mi_lttng_writer_write_element_string(
+               writer,
+               config_element_loglevel_type,
+               mi_lttng_logleveltype_string(event->loglevel_type));
        if (ret) {
                goto end;
        }
@@ -1456,15 +1336,13 @@ end:
        return ret;
 }
 
-int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer,
-               struct lttng_event *event)
+int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer, struct lttng_event *event)
 {
        /* event exclusion filter */
        return write_event_exclusions(writer, event);
 }
 
-int mi_lttng_event_function_probe(struct mi_writer *writer,
-               struct lttng_event *event)
+int mi_lttng_event_function_probe(struct mi_writer *writer, struct lttng_event *event)
 {
        int ret;
 
@@ -1480,22 +1358,22 @@ int mi_lttng_event_function_probe(struct mi_writer *writer,
 
        if (event->attr.probe.addr != 0) {
                /* event probe address */
-               ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                               config_element_address, event->attr.probe.addr);
+               ret = mi_lttng_writer_write_element_unsigned_int(
+                       writer, config_element_address, event->attr.probe.addr);
                if (ret) {
                        goto end;
                }
        } else {
                /* event probe offset */
-               ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                               config_element_offset, event->attr.probe.offset);
+               ret = mi_lttng_writer_write_element_unsigned_int(
+                       writer, config_element_offset, event->attr.probe.offset);
                if (ret) {
                        goto end;
                }
 
                /* event probe symbol_name */
-               ret = mi_lttng_writer_write_element_string(writer,
-                               config_element_symbol_name, event->attr.probe.symbol_name);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, config_element_symbol_name, event->attr.probe.symbol_name);
                if (ret) {
                        goto end;
                }
@@ -1507,9 +1385,7 @@ end:
        return ret;
 }
 
-static
-int mi_lttng_event_userspace_probe(struct mi_writer *writer,
-               struct lttng_event *event)
+static int mi_lttng_event_userspace_probe(struct mi_writer *writer, struct lttng_event *event)
 {
        int ret;
        const struct lttng_userspace_probe_location *location;
@@ -1541,25 +1417,27 @@ int mi_lttng_event_userspace_probe(struct mi_writer *writer,
                const char *function_name;
                const char *binary_path;
 
-               ret = mi_lttng_writer_open_element(writer,
-                               config_element_userspace_probe_function_attributes);
+               ret = mi_lttng_writer_open_element(
+                       writer, config_element_userspace_probe_function_attributes);
                if (ret) {
                        goto end;
                }
 
                switch (lookup_type) {
                case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF:
-                       ret = mi_lttng_writer_write_element_string(writer,
-                                       config_element_userspace_probe_lookup,
-                                       config_element_userspace_probe_lookup_function_elf);
+                       ret = mi_lttng_writer_write_element_string(
+                               writer,
+                               config_element_userspace_probe_lookup,
+                               config_element_userspace_probe_lookup_function_elf);
                        if (ret) {
                                goto end;
                        }
                        break;
                case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT:
-                       ret = mi_lttng_writer_write_element_string(writer,
-                                       config_element_userspace_probe_lookup,
-                                       config_element_userspace_probe_lookup_function_default);
+                       ret = mi_lttng_writer_write_element_string(
+                               writer,
+                               config_element_userspace_probe_lookup,
+                               config_element_userspace_probe_lookup_function_default);
                        if (ret) {
                                goto end;
                        }
@@ -1569,16 +1447,17 @@ int mi_lttng_event_userspace_probe(struct mi_writer *writer,
                }
 
                binary_path = lttng_userspace_probe_location_function_get_binary_path(location);
-               ret = mi_lttng_writer_write_element_string(writer,
-                               config_element_userspace_probe_location_binary_path, binary_path);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, config_element_userspace_probe_location_binary_path, binary_path);
                if (ret) {
                        goto end;
                }
 
                function_name = lttng_userspace_probe_location_function_get_function_name(location);
-               ret = mi_lttng_writer_write_element_string(writer,
-                               config_element_userspace_probe_function_location_function_name,
-                               function_name);
+               ret = mi_lttng_writer_write_element_string(
+                       writer,
+                       config_element_userspace_probe_function_location_function_name,
+                       function_name);
                if (ret) {
                        goto end;
                }
@@ -1590,17 +1469,18 @@ int mi_lttng_event_userspace_probe(struct mi_writer *writer,
                const char *probe_name, *provider_name;
                const char *binary_path;
 
-               ret = mi_lttng_writer_open_element(writer,
-                               config_element_userspace_probe_function_attributes);
+               ret = mi_lttng_writer_open_element(
+                       writer, config_element_userspace_probe_function_attributes);
                if (ret) {
                        goto end;
                }
 
                switch (lookup_type) {
                case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT:
-                       ret = mi_lttng_writer_write_element_string(writer,
-                                       config_element_userspace_probe_lookup,
-                                       config_element_userspace_probe_lookup_tracepoint_sdt);
+                       ret = mi_lttng_writer_write_element_string(
+                               writer,
+                               config_element_userspace_probe_lookup,
+                               config_element_userspace_probe_lookup_tracepoint_sdt);
                        if (ret) {
                                goto end;
                        }
@@ -1610,24 +1490,27 @@ int mi_lttng_event_userspace_probe(struct mi_writer *writer,
                }
 
                binary_path = lttng_userspace_probe_location_tracepoint_get_binary_path(location);
-               ret = mi_lttng_writer_write_element_string(writer,
-                               config_element_userspace_probe_location_binary_path,
-                               binary_path);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, config_element_userspace_probe_location_binary_path, binary_path);
                if (ret) {
                        goto end;
                }
 
-               provider_name = lttng_userspace_probe_location_tracepoint_get_provider_name(location);
-               ret = mi_lttng_writer_write_element_string(writer,
-                               config_element_userspace_probe_tracepoint_location_provider_name,
-                               provider_name);
+               provider_name =
+                       lttng_userspace_probe_location_tracepoint_get_provider_name(location);
+               ret = mi_lttng_writer_write_element_string(
+                       writer,
+                       config_element_userspace_probe_tracepoint_location_provider_name,
+                       provider_name);
                if (ret) {
                        goto end;
                }
 
                probe_name = lttng_userspace_probe_location_tracepoint_get_probe_name(location);
-               ret = mi_lttng_writer_write_element_string(writer,
-                               config_element_userspace_probe_tracepoint_location_probe_name, probe_name);
+               ret = mi_lttng_writer_write_element_string(
+                       writer,
+                       config_element_userspace_probe_tracepoint_location_probe_name,
+                       probe_name);
                if (ret) {
                        goto end;
                }
@@ -1642,8 +1525,7 @@ end:
        return ret;
 }
 
-int mi_lttng_event_function_entry(struct mi_writer *writer,
-               struct lttng_event *event)
+int mi_lttng_event_function_entry(struct mi_writer *writer, struct lttng_event *event)
 {
        int ret;
 
@@ -1658,8 +1540,8 @@ int mi_lttng_event_function_entry(struct mi_writer *writer,
        }
 
        /* event probe symbol_name */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_symbol_name, event->attr.ftrace.symbol_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, config_element_symbol_name, event->attr.ftrace.symbol_name);
        if (ret) {
                goto end;
        }
@@ -1676,7 +1558,9 @@ int mi_lttng_events_open(struct mi_writer *writer)
 }
 
 int mi_lttng_event(struct mi_writer *writer,
-               struct lttng_event *event, int is_open, enum lttng_domain_type domain)
+                  struct lttng_event *event,
+                  int is_open,
+                  enum lttng_domain_type domain)
 {
        int ret;
 
@@ -1726,52 +1610,39 @@ end:
 
 int mi_lttng_trackers_open(struct mi_writer *writer)
 {
-       return mi_lttng_writer_open_element(
-                       writer, config_element_process_attr_trackers);
+       return mi_lttng_writer_open_element(writer, config_element_process_attr_trackers);
 }
 
 static int get_tracker_elements(enum lttng_process_attr process_attr,
-               const char **element_process_attr_tracker,
-               const char **element_process_attr_value)
+                               const char **element_process_attr_tracker,
+                               const char **element_process_attr_value)
 {
        int ret = 0;
 
        switch (process_attr) {
        case LTTNG_PROCESS_ATTR_PROCESS_ID:
-               *element_process_attr_tracker =
-                               config_element_process_attr_tracker_pid;
-               *element_process_attr_value =
-                               config_element_process_attr_pid_value;
+               *element_process_attr_tracker = config_element_process_attr_tracker_pid;
+               *element_process_attr_value = config_element_process_attr_pid_value;
                break;
        case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID:
-               *element_process_attr_tracker =
-                               config_element_process_attr_tracker_vpid;
-               *element_process_attr_value =
-                               config_element_process_attr_vpid_value;
+               *element_process_attr_tracker = config_element_process_attr_tracker_vpid;
+               *element_process_attr_value = config_element_process_attr_vpid_value;
                break;
        case LTTNG_PROCESS_ATTR_USER_ID:
-               *element_process_attr_tracker =
-                               config_element_process_attr_tracker_uid;
-               *element_process_attr_value =
-                               config_element_process_attr_uid_value;
+               *element_process_attr_tracker = config_element_process_attr_tracker_uid;
+               *element_process_attr_value = config_element_process_attr_uid_value;
                break;
        case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID:
-               *element_process_attr_tracker =
-                               config_element_process_attr_tracker_vuid;
-               *element_process_attr_value =
-                               config_element_process_attr_vuid_value;
+               *element_process_attr_tracker = config_element_process_attr_tracker_vuid;
+               *element_process_attr_value = config_element_process_attr_vuid_value;
                break;
        case LTTNG_PROCESS_ATTR_GROUP_ID:
-               *element_process_attr_tracker =
-                               config_element_process_attr_tracker_gid;
-               *element_process_attr_value =
-                               config_element_process_attr_gid_value;
+               *element_process_attr_tracker = config_element_process_attr_tracker_gid;
+               *element_process_attr_value = config_element_process_attr_gid_value;
                break;
        case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
-               *element_process_attr_tracker =
-                               config_element_process_attr_tracker_vgid;
-               *element_process_attr_value =
-                               config_element_process_attr_vgid_value;
+               *element_process_attr_tracker = config_element_process_attr_tracker_vgid;
+               *element_process_attr_value = config_element_process_attr_vgid_value;
                break;
        default:
                ret = LTTNG_ERR_SAVE_IO_FAIL;
@@ -1779,14 +1650,13 @@ static int get_tracker_elements(enum lttng_process_attr process_attr,
        return ret;
 }
 
-int mi_lttng_process_attribute_tracker_open(
-               struct mi_writer *writer, enum lttng_process_attr process_attr)
+int mi_lttng_process_attribute_tracker_open(struct mi_writer *writer,
+                                           enum lttng_process_attr process_attr)
 {
        int ret;
        const char *element_tracker, *element_value;
 
-       ret = get_tracker_elements(
-                       process_attr, &element_tracker, &element_value);
+       ret = get_tracker_elements(process_attr, &element_tracker, &element_value);
        if (ret) {
                return ret;
        }
@@ -1812,10 +1682,7 @@ int mi_lttng_pids_open(struct mi_writer *writer)
  * TODO: move the listing of pid for user agent to process semantic on
  * mi api bump. The use of process element break the mi api.
  */
-int mi_lttng_pid(struct mi_writer *writer,
-               pid_t pid,
-               const char *name,
-               int is_open)
+int mi_lttng_pid(struct mi_writer *writer, pid_t pid, const char *name, int is_open)
 {
        int ret;
 
@@ -1826,16 +1693,14 @@ int mi_lttng_pid(struct mi_writer *writer,
        }
 
        /* Writing pid number */
-       ret = mi_lttng_writer_write_element_signed_int(writer,
-                       mi_lttng_element_pid_id, (int)pid);
+       ret = mi_lttng_writer_write_element_signed_int(writer, mi_lttng_element_pid_id, (int) pid);
        if (ret) {
                goto end;
        }
 
        /* Writing name of the process */
        if (name) {
-               ret = mi_lttng_writer_write_element_string(writer, config_element_name,
-                               name);
+               ret = mi_lttng_writer_write_element_string(writer, config_element_name, name);
                if (ret) {
                        goto end;
                }
@@ -1852,19 +1717,17 @@ end:
 
 int mi_lttng_process_attr_values_open(struct mi_writer *writer)
 {
-       return mi_lttng_writer_open_element(
-                       writer, config_element_process_attr_values);
+       return mi_lttng_writer_open_element(writer, config_element_process_attr_values);
 }
 
 int mi_lttng_all_process_attribute_value(struct mi_writer *writer,
-               enum lttng_process_attr process_attr,
-               bool is_open)
+                                        enum lttng_process_attr process_attr,
+                                        bool is_open)
 {
        int ret;
        const char *element_id_tracker, *element_target_id;
 
-       ret = get_tracker_elements(
-                       process_attr, &element_id_tracker, &element_target_id);
+       ret = get_tracker_elements(process_attr, &element_id_tracker, &element_target_id);
        if (ret) {
                return ret;
        }
@@ -1900,15 +1763,14 @@ end:
 }
 
 int mi_lttng_integral_process_attribute_value(struct mi_writer *writer,
-               enum lttng_process_attr process_attr,
-               int64_t value,
-               bool is_open)
+                                             enum lttng_process_attr process_attr,
+                                             int64_t value,
+                                             bool is_open)
 {
        int ret;
        const char *element_id_tracker, *element_target_id;
 
-       ret = get_tracker_elements(
-                       process_attr, &element_id_tracker, &element_target_id);
+       ret = get_tracker_elements(process_attr, &element_id_tracker, &element_target_id);
        if (ret) {
                return ret;
        }
@@ -1924,7 +1786,7 @@ int mi_lttng_integral_process_attribute_value(struct mi_writer *writer,
        }
 
        ret = mi_lttng_writer_write_element_signed_int(
-                       writer, config_element_process_attr_id, value);
+               writer, config_element_process_attr_id, value);
        if (ret) {
                goto end;
        }
@@ -1946,16 +1808,15 @@ end:
 }
 
 int mi_lttng_string_process_attribute_value(struct mi_writer *writer,
-               enum lttng_process_attr process_attr,
-               const char *value,
-               bool is_open)
+                                           enum lttng_process_attr process_attr,
+                                           const char *value,
+                                           bool is_open)
 
 {
        int ret;
        const char *element_id_tracker, *element_target_id;
 
-       ret = get_tracker_elements(
-                       process_attr, &element_id_tracker, &element_target_id);
+       ret = get_tracker_elements(process_attr, &element_id_tracker, &element_target_id);
        if (ret) {
                return ret;
        }
@@ -1970,8 +1831,7 @@ int mi_lttng_string_process_attribute_value(struct mi_writer *writer,
                goto end;
        }
 
-       ret = mi_lttng_writer_write_element_string(
-                       writer, config_element_name, value);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, value);
        if (ret) {
                goto end;
        }
@@ -1997,8 +1857,7 @@ int mi_lttng_event_fields_open(struct mi_writer *writer)
        return mi_lttng_writer_open_element(writer, mi_lttng_element_event_fields);
 }
 
-int mi_lttng_event_field(struct mi_writer *writer,
-               struct lttng_event_field *field)
+int mi_lttng_event_field(struct mi_writer *writer, struct lttng_event_field *field)
 {
        int ret;
 
@@ -2018,22 +1877,21 @@ int mi_lttng_event_field(struct mi_writer *writer,
        }
 
        /* Name */
-       ret = mi_lttng_writer_write_element_string(writer, config_element_name,
-                       field->field_name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, field->field_name);
        if (ret) {
                goto end;
        }
 
        /* Type */
-       ret = mi_lttng_writer_write_element_string(writer, config_element_type,
-                       mi_lttng_eventfieldtype_string(field->type));
+       ret = mi_lttng_writer_write_element_string(
+               writer, config_element_type, mi_lttng_eventfieldtype_string(field->type));
        if (ret) {
                goto end;
        }
 
        /* nowrite  */
-       ret = mi_lttng_writer_write_element_signed_int(writer,
-                       mi_lttng_element_nowrite, field->nowrite);
+       ret = mi_lttng_writer_write_element_signed_int(
+               writer, mi_lttng_element_nowrite, field->nowrite);
        if (ret) {
                goto end;
        }
@@ -2047,34 +1905,32 @@ end:
 }
 
 int mi_lttng_perf_counter_context(struct mi_writer *writer,
-               struct lttng_event_perf_counter_ctx  *perf_context)
+                                 struct lttng_event_perf_counter_ctx *perf_context)
 {
        int ret;
 
        /* Open perf_counter_context */
-       ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_perf_counter_context);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_perf_counter_context);
        if (ret) {
                goto end;
        }
 
        /* Type */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       config_element_type, perf_context->type);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_type, perf_context->type);
        if (ret) {
                goto end;
        }
 
        /* Config */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       config_element_config, perf_context->config);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, config_element_config, perf_context->config);
        if (ret) {
                goto end;
        }
 
        /* Name of the perf counter */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_name, perf_context->name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, perf_context->name);
        if (ret) {
                goto end;
        }
@@ -2085,30 +1941,27 @@ end:
        return ret;
 }
 
-static
-int mi_lttng_app_context(struct mi_writer *writer,
-               const char *provider_name, const char *ctx_name)
+static int
+mi_lttng_app_context(struct mi_writer *writer, const char *provider_name, const char *ctx_name)
 {
        int ret;
 
        /* Open app */
-       ret = mi_lttng_writer_open_element(writer,
-                       config_element_context_app);
+       ret = mi_lttng_writer_open_element(writer, config_element_context_app);
        if (ret) {
                goto end;
        }
 
        /* provider_name */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_context_app_provider_name,
-                       provider_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, config_element_context_app_provider_name, provider_name);
        if (ret) {
                goto end;
        }
 
        /* ctx_name */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_context_app_ctx_name, ctx_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, config_element_context_app_ctx_name, ctx_name);
        if (ret) {
                goto end;
        }
@@ -2119,13 +1972,12 @@ end:
        return ret;
 }
 
-int mi_lttng_context(struct mi_writer *writer,
-               struct lttng_event_context *context, int is_open)
+int mi_lttng_context(struct mi_writer *writer, struct lttng_event_context *context, int is_open)
 {
        int ret;
 
        /* Open context */
-       ret = mi_lttng_writer_open_element(writer , config_element_context);
+       ret = mi_lttng_writer_open_element(writer, config_element_context);
        if (ret) {
                goto end;
        }
@@ -2137,9 +1989,8 @@ int mi_lttng_context(struct mi_writer *writer,
        case LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER:
        case LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER:
        {
-               struct lttng_event_perf_counter_ctx *perf_context =
-                               &context->u.perf_counter;
-               ret =  mi_lttng_perf_counter_context(writer, perf_context);
+               struct lttng_event_perf_counter_ctx *perf_context = &context->u.perf_counter;
+               ret = mi_lttng_perf_counter_context(writer, perf_context);
                if (ret) {
                        goto end;
                }
@@ -2147,9 +1998,8 @@ int mi_lttng_context(struct mi_writer *writer,
        }
        case LTTNG_EVENT_CONTEXT_APP_CONTEXT:
        {
-               ret = mi_lttng_app_context(writer,
-                               context->u.app_ctx.provider_name,
-                               context->u.app_ctx.ctx_name);
+               ret = mi_lttng_app_context(
+                       writer, context->u.app_ctx.provider_name, context->u.app_ctx.ctx_name);
                if (ret) {
                        goto end;
                }
@@ -2157,16 +2007,15 @@ int mi_lttng_context(struct mi_writer *writer,
        }
        default:
        {
-               const char *type_string = mi_lttng_event_contexttype_string(
-                               context->ctx);
+               const char *type_string = mi_lttng_event_contexttype_string(context->ctx);
                if (!type_string) {
                        ret = -LTTNG_ERR_INVALID;
                        goto end;
                }
 
                /* Print context type */
-               ret = mi_lttng_writer_write_element_string(writer,
-                               config_element_type, type_string);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, config_element_type, type_string);
                break;
        }
        }
@@ -2180,8 +2029,7 @@ end:
        return ret;
 }
 
-int mi_lttng_snapshot_output_session_name(struct mi_writer *writer,
-               const char *session_name)
+int mi_lttng_snapshot_output_session_name(struct mi_writer *writer, const char *session_name)
 {
        int ret;
 
@@ -2192,8 +2040,7 @@ int mi_lttng_snapshot_output_session_name(struct mi_writer *writer,
        }
 
        /* Snapshot output list for current session name */
-       ret = mi_lttng_writer_write_element_string(writer, config_element_name,
-                       session_name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, session_name);
        if (ret) {
                goto end;
        }
@@ -2209,48 +2056,45 @@ end:
 }
 
 int mi_lttng_snapshot_list_output(struct mi_writer *writer,
-               const struct lttng_snapshot_output *output)
+                                 const struct lttng_snapshot_output *output)
 {
        int ret;
 
        /* Open element snapshot output */
-       ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_command_snapshot);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_snapshot);
        if (ret) {
                goto end;
        }
 
        /* ID of the snapshot output */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       mi_lttng_element_id, output->id);
+       ret = mi_lttng_writer_write_element_unsigned_int(writer, mi_lttng_element_id, output->id);
        if (ret) {
                goto end;
        }
 
        /* Name of the output */
-       ret = mi_lttng_writer_write_element_string(writer, config_element_name,
-                       output->name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, output->name);
        if (ret) {
                goto end;
        }
 
        /* Destination of the output (ctrl_url)*/
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_snapshot_ctrl_url, output->ctrl_url);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_snapshot_ctrl_url, output->ctrl_url);
        if (ret) {
                goto end;
        }
 
        /* Destination of the output (data_url) */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_snapshot_data_url, output->data_url);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_snapshot_data_url, output->data_url);
        if (ret) {
                goto end;
        }
 
        /* total size of all stream combined */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       mi_lttng_element_snapshot_max_size, output->max_size);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, mi_lttng_element_snapshot_max_size, output->max_size);
        if (ret) {
                goto end;
        }
@@ -2262,26 +2106,25 @@ end:
        return ret;
 }
 
-int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id,
-               const char *name, const char *current_session_name)
+int mi_lttng_snapshot_del_output(struct mi_writer *writer,
+                                int id,
+                                const char *name,
+                                const char *current_session_name)
 {
        int ret;
 
        /* Open element del_snapshot */
-       ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_command_snapshot);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_snapshot);
        if (ret) {
                goto end;
        }
 
-
        if (id != UINT32_MAX) {
                /* "Snapshot output "id" successfully deleted
                 * for "current_session_name"
                 * ID of the snapshot output
                 */
-               ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                               mi_lttng_element_id, id);
+               ret = mi_lttng_writer_write_element_unsigned_int(writer, mi_lttng_element_id, id);
                if (ret) {
                        goto end;
                }
@@ -2290,17 +2133,15 @@ int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id,
                 * for session "current_session_name"
                 * Name of the output
                 */
-               ret = mi_lttng_writer_write_element_string(writer, config_element_name,
-                               name);
+               ret = mi_lttng_writer_write_element_string(writer, config_element_name, name);
                if (ret) {
                        goto end;
                }
        }
 
        /* Snapshot was deleted for session "current_session_name"*/
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_snapshot_session_name,
-                       current_session_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_snapshot_session_name, current_session_name);
        if (ret) {
                goto end;
        }
@@ -2313,49 +2154,47 @@ end:
 }
 
 int mi_lttng_snapshot_add_output(struct mi_writer *writer,
-               const char *current_session_name, const char *n_ptr,
-               struct lttng_snapshot_output *output)
+                                const char *current_session_name,
+                                const char *n_ptr,
+                                struct lttng_snapshot_output *output)
 {
        int ret;
 
        /* Open element snapshot */
-       ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_command_snapshot);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_snapshot);
        if (ret) {
                goto end;
        }
 
        /* Snapshot output id */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       mi_lttng_element_id, output->id);
+       ret = mi_lttng_writer_write_element_unsigned_int(writer, mi_lttng_element_id, output->id);
        if (ret) {
                goto end;
        }
 
        /* Snapshot output names */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       config_element_name, n_ptr);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, n_ptr);
        if (ret) {
                goto end;
        }
 
        /* Destination of the output (ctrl_url)*/
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_snapshot_ctrl_url, output->ctrl_url);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_snapshot_ctrl_url, output->ctrl_url);
        if (ret) {
                goto end;
        }
 
        /* Snapshot added for session "current_session_name"*/
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_snapshot_session_name, current_session_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_snapshot_session_name, current_session_name);
        if (ret) {
                goto end;
        }
 
        /* total size of all stream combined */
-       ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                       mi_lttng_element_snapshot_max_size, output->max_size);
+       ret = mi_lttng_writer_write_element_unsigned_int(
+               writer, mi_lttng_element_snapshot_max_size, output->max_size);
        if (ret) {
                goto end;
        }
@@ -2367,14 +2206,15 @@ end:
        return ret;
 }
 
-int mi_lttng_snapshot_record(struct mi_writer *writer, const char *url,
-               const char *cmdline_ctrl_url, const char *cmdline_data_url)
+int mi_lttng_snapshot_record(struct mi_writer *writer,
+                            const char *url,
+                            const char *cmdline_ctrl_url,
+                            const char *cmdline_data_url)
 {
        int ret;
 
        /* Open element snapshot */
-       ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_command_snapshot);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_snapshot);
        if (ret) {
                goto end;
        }
@@ -2384,22 +2224,22 @@ int mi_lttng_snapshot_record(struct mi_writer *writer, const char *url,
         * else take the command line data and ctrl urls*/
        if (url) {
                /* Destination of the output (ctrl_url)*/
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_snapshot_ctrl_url, url);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, mi_lttng_element_snapshot_ctrl_url, url);
                if (ret) {
                        goto end;
                }
        } else if (cmdline_ctrl_url) {
                /* Destination of the output (ctrl_url)*/
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_snapshot_ctrl_url, cmdline_ctrl_url);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, mi_lttng_element_snapshot_ctrl_url, cmdline_ctrl_url);
                if (ret) {
                        goto end;
                }
 
                /* Destination of the output (data_url) */
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_snapshot_data_url, cmdline_data_url);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, mi_lttng_element_snapshot_data_url, cmdline_data_url);
                if (ret) {
                        goto end;
                }
@@ -2413,7 +2253,7 @@ end:
 }
 
 int mi_lttng_rotation_schedule(struct mi_writer *writer,
-               const struct lttng_rotation_schedule *schedule)
+                              const struct lttng_rotation_schedule *schedule)
 {
        int ret = 0;
        enum lttng_rotation_status status;
@@ -2424,14 +2264,12 @@ int mi_lttng_rotation_schedule(struct mi_writer *writer,
 
        switch (lttng_rotation_schedule_get_type(schedule)) {
        case LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC:
-               status = lttng_rotation_schedule_periodic_get_period(schedule,
-                               &value);
+               status = lttng_rotation_schedule_periodic_get_period(schedule, &value);
                element_name = mi_lttng_element_rotation_schedule_periodic;
                value_name = mi_lttng_element_rotation_schedule_periodic_time_us;
                break;
        case LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD:
-               status = lttng_rotation_schedule_size_threshold_get_threshold(
-                               schedule, &value);
+               status = lttng_rotation_schedule_size_threshold_get_threshold(schedule, &value);
                element_name = mi_lttng_element_rotation_schedule_size_threshold;
                value_name = mi_lttng_element_rotation_schedule_size_threshold_bytes;
                break;
@@ -2455,8 +2293,7 @@ int mi_lttng_rotation_schedule(struct mi_writer *writer,
        }
 
        if (!empty_schedule) {
-               ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                               value_name, value);
+               ret = mi_lttng_writer_write_element_unsigned_int(writer, value_name, value);
                if (ret) {
                        goto end;
                }
@@ -2472,19 +2309,17 @@ end:
 }
 
 int mi_lttng_rotation_schedule_result(struct mi_writer *writer,
-               const struct lttng_rotation_schedule *schedule,
-               bool success)
+                                     const struct lttng_rotation_schedule *schedule,
+                                     bool success)
 {
        int ret = 0;
 
-       ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_rotation_schedule_result);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_rotation_schedule_result);
        if (ret) {
                goto end;
        }
 
-       ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_rotation_schedule);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_rotation_schedule);
        if (ret) {
                goto end;
        }
@@ -2500,8 +2335,7 @@ int mi_lttng_rotation_schedule_result(struct mi_writer *writer,
                goto end;
        }
 
-       ret = mi_lttng_writer_write_element_bool(writer,
-                       mi_lttng_element_command_success, success);
+       ret = mi_lttng_writer_write_element_bool(writer, mi_lttng_element_command_success, success);
        if (ret) {
                goto end;
        }
@@ -2515,9 +2349,8 @@ end:
        return ret;
 }
 
-static
-int mi_lttng_location(struct mi_writer *writer,
-               const struct lttng_trace_archive_location *location)
+static int mi_lttng_location(struct mi_writer *writer,
+                            const struct lttng_trace_archive_location *location)
 {
        int ret = 0;
        enum lttng_trace_archive_location_type location_type;
@@ -2530,23 +2363,23 @@ int mi_lttng_location(struct mi_writer *writer,
        {
                const char *absolute_path;
 
-               status = lttng_trace_archive_location_local_get_absolute_path(
-                               location, &absolute_path);
+               status = lttng_trace_archive_location_local_get_absolute_path(location,
+                                                                             &absolute_path);
                if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
 
                ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_rotation_location_local);
+                                                  mi_lttng_element_rotation_location_local);
                if (ret) {
                        goto end;
                }
 
-
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_rotation_location_local_absolute_path,
-                               absolute_path);
+               ret = mi_lttng_writer_write_element_string(
+                       writer,
+                       mi_lttng_element_rotation_location_local_absolute_path,
+                       absolute_path);
                if (ret) {
                        goto end;
                }
@@ -2565,78 +2398,76 @@ int mi_lttng_location(struct mi_writer *writer,
                enum lttng_trace_archive_location_relay_protocol_type protocol;
 
                /* Fetch all relay location parameters. */
-               status = lttng_trace_archive_location_relay_get_protocol_type(
-                               location, &protocol);
+               status = lttng_trace_archive_location_relay_get_protocol_type(location, &protocol);
                if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
 
-               status = lttng_trace_archive_location_relay_get_host(
-                               location, &host);
+               status = lttng_trace_archive_location_relay_get_host(location, &host);
                if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
 
-               status = lttng_trace_archive_location_relay_get_control_port(
-                               location, &control_port);
+               status = lttng_trace_archive_location_relay_get_control_port(location,
+                                                                            &control_port);
                if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
 
-               status = lttng_trace_archive_location_relay_get_data_port(
-                               location, &data_port);
+               status = lttng_trace_archive_location_relay_get_data_port(location, &data_port);
                if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
 
-               status = lttng_trace_archive_location_relay_get_relative_path(
-                               location, &relative_path);
+               status = lttng_trace_archive_location_relay_get_relative_path(location,
+                                                                             &relative_path);
                if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
 
                ret = mi_lttng_writer_open_element(writer,
-                               mi_lttng_element_rotation_location_relay);
+                                                  mi_lttng_element_rotation_location_relay);
                if (ret) {
                        goto end;
                }
 
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_rotation_location_relay_host,
-                               host);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, mi_lttng_element_rotation_location_relay_host, host);
                if (ret) {
                        goto end;
                }
 
-               ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                               mi_lttng_element_rotation_location_relay_control_port,
-                               control_port);
+               ret = mi_lttng_writer_write_element_unsigned_int(
+                       writer,
+                       mi_lttng_element_rotation_location_relay_control_port,
+                       control_port);
                if (ret) {
                        goto end;
                }
 
-               ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                               mi_lttng_element_rotation_location_relay_data_port,
-                               data_port);
+               ret = mi_lttng_writer_write_element_unsigned_int(
+                       writer, mi_lttng_element_rotation_location_relay_data_port, data_port);
                if (ret) {
                        goto end;
                }
 
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_rotation_location_relay_protocol,
-                               mi_lttng_trace_archive_location_relay_protocol_type_string(protocol));
+               ret = mi_lttng_writer_write_element_string(
+                       writer,
+                       mi_lttng_element_rotation_location_relay_protocol,
+                       mi_lttng_trace_archive_location_relay_protocol_type_string(protocol));
                if (ret) {
                        goto end;
                }
 
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_rotation_location_relay_relative_path,
-                               relative_path);
+               ret = mi_lttng_writer_write_element_string(
+                       writer,
+                       mi_lttng_element_rotation_location_relay_relative_path,
+                       relative_path);
                if (ret) {
                        goto end;
                }
@@ -2656,28 +2487,26 @@ end:
 }
 
 int mi_lttng_rotate(struct mi_writer *writer,
-               const char *session_name,
-               enum lttng_rotation_state rotation_state,
-               const struct lttng_trace_archive_location *location)
+                   const char *session_name,
+                   enum lttng_rotation_state rotation_state,
+                   const struct lttng_trace_archive_location *location)
 {
        int ret;
 
-       ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_rotation);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_rotation);
        if (ret) {
                goto end;
        }
 
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_session_name,
-                       session_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_session_name, session_name);
        if (ret) {
                goto end;
        }
 
        ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_rotation_state,
-                       mi_lttng_rotation_state_string(rotation_state));
+                                                  mi_lttng_element_rotation_state,
+                                                  mi_lttng_rotation_state_string(rotation_state));
        if (ret) {
                goto end;
        }
@@ -2687,8 +2516,7 @@ int mi_lttng_rotate(struct mi_writer *writer,
                goto close_rotation;
        }
 
-       ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_rotation_location);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_rotation_location);
        if (ret) {
                goto end;
        }
index 51e5693cd464fb2bb4ebd96c0c60862da6b5ca3d..694223e92008cbc494bd439628afc9a85a2b4e64 100644 (file)
@@ -5,18 +5,18 @@
  *
  */
 
-#include <lttng/notification/notification-internal.hpp>
+#include <common/payload-view.hpp>
+#include <common/payload.hpp>
+
 #include <lttng/condition/condition-internal.hpp>
-#include <lttng/condition/evaluation-internal.hpp>
 #include <lttng/condition/condition.h>
+#include <lttng/condition/evaluation-internal.hpp>
 #include <lttng/condition/evaluation.h>
+#include <lttng/notification/notification-internal.hpp>
 #include <lttng/trigger/trigger-internal.hpp>
-#include <common/payload.hpp>
-#include <common/payload-view.hpp>
 
-struct lttng_notification *lttng_notification_create(
-               struct lttng_trigger *trigger,
-               struct lttng_evaluation *evaluation)
+struct lttng_notification *lttng_notification_create(struct lttng_trigger *trigger,
+                                                    struct lttng_evaluation *evaluation)
 {
        struct lttng_notification *notification = NULL;
 
@@ -36,7 +36,7 @@ end:
 }
 
 int lttng_notification_serialize(const struct lttng_notification *notification,
-               struct lttng_payload *payload)
+                                struct lttng_payload *payload)
 {
        int ret;
        size_t header_offset, size_before_payload;
@@ -46,15 +46,14 @@ int lttng_notification_serialize(const struct lttng_notification *notification,
        notification_comm.length = 0;
 
        header_offset = payload->buffer.size;
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &notification_comm,
-                       sizeof(notification_comm));
+       ret = lttng_dynamic_buffer_append(
+               &payload->buffer, &notification_comm, sizeof(notification_comm));
        if (ret) {
                goto end;
        }
 
        size_before_payload = payload->buffer.size;
-       ret = lttng_trigger_serialize(notification->trigger,
-                       payload);
+       ret = lttng_trigger_serialize(notification->trigger, payload);
        if (ret) {
                goto end;
        }
@@ -69,20 +68,17 @@ int lttng_notification_serialize(const struct lttng_notification *notification,
        header->length = (uint32_t) (payload->buffer.size - size_before_payload);
 end:
        return ret;
-
 }
 
-ssize_t lttng_notification_create_from_payload(
-               struct lttng_payload_view *src_view,
-               struct lttng_notification **notification)
+ssize_t lttng_notification_create_from_payload(struct lttng_payload_view *src_view,
+                                              struct lttng_notification **notification)
 {
        ssize_t ret, notification_size = 0, trigger_size, evaluation_size;
        struct lttng_trigger *trigger = NULL;
        struct lttng_evaluation *evaluation = NULL;
        const struct lttng_notification_comm *notification_comm;
        const struct lttng_payload_view notification_comm_view =
-                       lttng_payload_view_from_view(
-                                       src_view, 0, sizeof(*notification_comm));
+               lttng_payload_view_from_view(src_view, 0, sizeof(*notification_comm));
 
        if (!src_view || !notification) {
                ret = -1;
@@ -100,11 +96,9 @@ ssize_t lttng_notification_create_from_payload(
        {
                /* struct lttng_condition */
                struct lttng_payload_view condition_view =
-                               lttng_payload_view_from_view(src_view,
-                                               notification_size, -1);
+                       lttng_payload_view_from_view(src_view, notification_size, -1);
 
-               trigger_size = lttng_trigger_create_from_payload(
-                               &condition_view, &trigger);
+               trigger_size = lttng_trigger_create_from_payload(&condition_view, &trigger);
        }
 
        if (trigger_size < 0) {
@@ -117,12 +111,10 @@ ssize_t lttng_notification_create_from_payload(
        {
                /* struct lttng_evaluation */
                struct lttng_payload_view evaluation_view =
-                               lttng_payload_view_from_view(src_view,
-                                               notification_size, -1);
+                       lttng_payload_view_from_view(src_view, notification_size, -1);
 
                evaluation_size = lttng_evaluation_create_from_payload(
-                               lttng_trigger_get_const_condition(trigger),
-                               &evaluation_view, &evaluation);
+                       lttng_trigger_get_const_condition(trigger), &evaluation_view, &evaluation);
        }
 
        if (evaluation_size < 0) {
@@ -133,8 +125,7 @@ ssize_t lttng_notification_create_from_payload(
        notification_size += evaluation_size;
 
        /* Unexpected size of inner-elements; the buffer is corrupted. */
-       if ((ssize_t) notification_comm->length !=
-                       trigger_size + evaluation_size) {
+       if ((ssize_t) notification_comm->length != trigger_size + evaluation_size) {
                ret = -1;
                goto error;
        }
@@ -165,38 +156,37 @@ void lttng_notification_destroy(struct lttng_notification *notification)
        free(notification);
 }
 
-const struct lttng_condition *lttng_notification_get_condition(
-               struct lttng_notification *notification)
+const struct lttng_condition *
+lttng_notification_get_condition(struct lttng_notification *notification)
 {
        return notification ? lttng_trigger_get_const_condition(notification->trigger) : NULL;
 }
 
-const struct lttng_evaluation *lttng_notification_get_evaluation(
-               struct lttng_notification *notification)
+const struct lttng_evaluation *
+lttng_notification_get_evaluation(struct lttng_notification *notification)
 {
        return notification ? notification->evaluation : NULL;
 }
 
-const struct lttng_condition *lttng_notification_get_const_condition(
-               const struct lttng_notification *notification)
+const struct lttng_condition *
+lttng_notification_get_const_condition(const struct lttng_notification *notification)
 {
        return notification ? lttng_trigger_get_const_condition(notification->trigger) : NULL;
 }
 
-const struct lttng_evaluation *lttng_notification_get_const_evaluation(
-               const struct lttng_notification *notification)
+const struct lttng_evaluation *
+lttng_notification_get_const_evaluation(const struct lttng_notification *notification)
 {
        return notification ? notification->evaluation : NULL;
 }
 
-const struct lttng_trigger *lttng_notification_get_const_trigger(
-               const struct lttng_notification *notification)
+const struct lttng_trigger *
+lttng_notification_get_const_trigger(const struct lttng_notification *notification)
 {
        return notification ? notification->trigger : NULL;
 }
 
-const struct lttng_trigger *lttng_notification_get_trigger(
-               struct lttng_notification *notification)
+const struct lttng_trigger *lttng_notification_get_trigger(struct lttng_notification *notification)
 {
        return notification ? notification->trigger : NULL;
 }
index 61e78a5c1d7a583f11b92ce5cbe2e9da20f3c375..cc7cbbc469c0c0c530f79db032bc8353ebc7e20d 100644 (file)
@@ -8,8 +8,8 @@
  */
 
 #define _LGPL_SOURCE
-#include <common/macros.hpp>
 #include <common/common.hpp>
+#include <common/macros.hpp>
 #include <common/path.hpp>
 
 /*
@@ -21,8 +21,7 @@
  *
  * Return a newly-allocated string.
  */
-static
-char *utils_partial_realpath(const char *path)
+static char *utils_partial_realpath(const char *path)
 {
        char *cut_path = NULL, *try_path = NULL, *try_path_prev = NULL;
        const char *next, *prev, *end;
@@ -40,7 +39,7 @@ char *utils_partial_realpath(const char *path)
         * the path given as argument
         */
        end = path + strlen(path);
-       if (*(end-1) == '/') {
+       if (*(end - 1) == '/') {
                end--;
        }
 
@@ -48,7 +47,7 @@ char *utils_partial_realpath(const char *path)
        next = path;
        prev = next;
        /* Only to ensure try_path is not NULL to enter the while */
-       try_path = (char *)next;
+       try_path = (char *) next;
 
        /* Resolve the canonical path of the first part of the path */
        while (try_path != NULL && next != end) {
@@ -135,18 +134,17 @@ char *utils_partial_realpath(const char *path)
                }
 
                /* Concatenate the strings */
-               snprintf(resolved_path, LTTNG_PATH_MAX, "%s%s",
-                               try_path_prev, cut_path);
+               snprintf(resolved_path, LTTNG_PATH_MAX, "%s%s", try_path_prev, cut_path);
 
                /* Free the allocated memory */
                free(cut_path);
                free(try_path_prev);
                cut_path = NULL;
                try_path_prev = NULL;
-       /*
-        * Else, we just copy the path in our resolved_path to
-        * return it as is
-        */
+               /*
+                * Else, we just copy the path in our resolved_path to
+                * return it as is
+                */
        } else {
                strncpy(resolved_path, path, LTTNG_PATH_MAX);
        }
@@ -164,8 +162,7 @@ error:
        return NULL;
 }
 
-static
-int expand_double_slashes_dot_and_dotdot(char *path)
+static int expand_double_slashes_dot_and_dotdot(char *path)
 {
        size_t expanded_path_len, path_len;
        const char *curr_char, *path_last_char, *next_slash, *prev_slash;
@@ -197,7 +194,7 @@ int expand_double_slashes_dot_and_dotdot(char *path)
 
                /* Compute how long is the previous token. */
                curr_token_len = next_slash - curr_char;
-               switch(curr_token_len) {
+               switch (curr_token_len) {
                case 0:
                        /*
                         * The pointer has not move meaning that curr_char is
@@ -230,7 +227,8 @@ int expand_double_slashes_dot_and_dotdot(char *path)
                                 * previous forward slash and substract that
                                 * len to the resulting path.
                                 */
-                               prev_slash = (const char *) lttng_memrchr(path, '/', expanded_path_len);
+                               prev_slash =
+                                       (const char *) lttng_memrchr(path, '/', expanded_path_len);
                                /*
                                 * If prev_slash is NULL, we reached the
                                 * beginning of the path. We can't go back any
@@ -274,8 +272,7 @@ error:
  * The returned string was allocated in the function, it is thus of
  * the responsibility of the caller to free this memory.
  */
-static
-char *_utils_expand_path(const char *path, bool keep_symlink)
+static char *_utils_expand_path(const char *path, bool keep_symlink)
 {
        int ret;
        char *absolute_path = NULL;
@@ -316,11 +313,12 @@ char *_utils_expand_path(const char *path, bool keep_symlink)
                 * Get the number of character in the CWD and allocate an array
                 * to can hold it and the path provided by the caller.
                 */
-               ret = snprintf(absolute_path, LTTNG_PATH_MAX, "%s/%s",
-                               current_working_dir, path);
+               ret = snprintf(absolute_path, LTTNG_PATH_MAX, "%s/%s", current_working_dir, path);
                if (ret >= LTTNG_PATH_MAX) {
                        ERR("Concatenating current working directory %s and path %s exceeds maximal size of %i bytes",
-                                       current_working_dir, path, LTTNG_PATH_MAX);
+                           current_working_dir,
+                           path,
+                           LTTNG_PATH_MAX);
                        goto error;
                }
        }
index d5e67961b54b49b680993b9593986c3166638cea..edb5789a9420ee1e488abfe9b71ef26f6d8a4371 100644 (file)
@@ -5,10 +5,12 @@
  *
  */
 
-#include <common/dynamic-array.hpp>
-#include <common/buffer-view.hpp>
 #include "payload-view.hpp"
 #include "payload.hpp"
+
+#include <common/buffer-view.hpp>
+#include <common/dynamic-array.hpp>
+
 #include <stddef.h>
 
 bool lttng_payload_view_is_valid(const struct lttng_payload_view *view)
@@ -16,25 +18,25 @@ bool lttng_payload_view_is_valid(const struct lttng_payload_view *view)
        return view && lttng_buffer_view_is_valid(&view->buffer);
 }
 
-struct lttng_payload_view lttng_payload_view_from_payload(
-               const struct lttng_payload *payload, size_t offset,
-               ptrdiff_t len)
+struct lttng_payload_view
+lttng_payload_view_from_payload(const struct lttng_payload *payload, size_t offset, ptrdiff_t len)
 {
-       return payload ? (struct lttng_payload_view) {
-               .buffer = lttng_buffer_view_from_dynamic_buffer(
-                       &payload->buffer, offset, len),
-               ._fd_handles = payload->_fd_handles,
-               ._iterator = {},
-       } : (struct lttng_payload_view) {
-               .buffer = {},
-               ._fd_handles = {},
-               ._iterator = {},
-       };
+       return payload ?
+               (struct lttng_payload_view){
+                       .buffer = lttng_buffer_view_from_dynamic_buffer(
+                               &payload->buffer, offset, len),
+                       ._fd_handles = payload->_fd_handles,
+                       ._iterator = {},
+               } :
+               (struct lttng_payload_view){
+                       .buffer = {},
+                       ._fd_handles = {},
+                       ._iterator = {},
+               };
 }
 
-struct lttng_payload_view lttng_payload_view_from_view(
-               struct lttng_payload_view *view, size_t offset,
-               ptrdiff_t len)
+struct lttng_payload_view
+lttng_payload_view_from_view(struct lttng_payload_view *view, size_t offset, ptrdiff_t len)
 {
        return view ? (struct lttng_payload_view) {
                .buffer = lttng_buffer_view_from_view(
@@ -53,50 +55,49 @@ struct lttng_payload_view lttng_payload_view_from_view(
 }
 
 struct lttng_payload_view lttng_payload_view_from_dynamic_buffer(
-               const struct lttng_dynamic_buffer *buffer, size_t offset,
-               ptrdiff_t len)
+       const struct lttng_dynamic_buffer *buffer, size_t offset, ptrdiff_t len)
 {
-       return buffer ? (struct lttng_payload_view) {
-               .buffer = lttng_buffer_view_from_dynamic_buffer(
-                       buffer, offset, len),
-               ._fd_handles = {},
-               ._iterator = {},
-       } : (struct lttng_payload_view) {
-               .buffer = {},
-               ._fd_handles = {},
-               ._iterator = {},
-       };
+       return buffer ?
+               (struct lttng_payload_view){
+                       .buffer = lttng_buffer_view_from_dynamic_buffer(buffer, offset, len),
+                       ._fd_handles = {},
+                       ._iterator = {},
+               } :
+               (struct lttng_payload_view){
+                       .buffer = {},
+                       ._fd_handles = {},
+                       ._iterator = {},
+               };
 }
 
-struct lttng_payload_view lttng_payload_view_from_buffer_view(
-               const struct lttng_buffer_view *view, size_t offset,
-               ptrdiff_t len)
+struct lttng_payload_view lttng_payload_view_from_buffer_view(const struct lttng_buffer_view *view,
+                                                             size_t offset,
+                                                             ptrdiff_t len)
 {
-       return view ? (struct lttng_payload_view) {
-               .buffer = lttng_buffer_view_from_view(
-                       view, offset, len),
-               ._fd_handles = {},
-               ._iterator = {},
-       } : (struct lttng_payload_view) {
-               .buffer = {},
-               ._fd_handles = {},
-               ._iterator = {},
-       };
+       return view ?
+               (struct lttng_payload_view){
+                       .buffer = lttng_buffer_view_from_view(view, offset, len),
+                       ._fd_handles = {},
+                       ._iterator = {},
+               } :
+               (struct lttng_payload_view){
+                       .buffer = {},
+                       ._fd_handles = {},
+                       ._iterator = {},
+               };
 }
 
-struct lttng_payload_view lttng_payload_view_init_from_buffer(
-       const char *src, size_t offset, ptrdiff_t len)
+struct lttng_payload_view
+lttng_payload_view_init_from_buffer(const char *src, size_t offset, ptrdiff_t len)
 {
-       return (struct lttng_payload_view) {
-               .buffer = lttng_buffer_view_init(
-                       src, offset, len),
+       return (struct lttng_payload_view){
+               .buffer = lttng_buffer_view_init(src, offset, len),
                ._fd_handles = {},
                ._iterator = {},
        };
 }
 
-int lttng_payload_view_get_fd_handle_count(
-               const struct lttng_payload_view *payload_view)
+int lttng_payload_view_get_fd_handle_count(const struct lttng_payload_view *payload_view)
 {
        int ret;
        size_t position;
@@ -112,15 +113,14 @@ int lttng_payload_view_get_fd_handle_count(
        }
 
        position = payload_view->_iterator.p_fd_handles_position ?
-                       *payload_view->_iterator.p_fd_handles_position :
-                       payload_view->_iterator.fd_handles_position;
+               *payload_view->_iterator.p_fd_handles_position :
+               payload_view->_iterator.fd_handles_position;
        ret = ret - (int) position;
 end:
        return ret;
 }
 
-struct fd_handle *lttng_payload_view_pop_fd_handle(
-               struct lttng_payload_view *view)
+struct fd_handle *lttng_payload_view_pop_fd_handle(struct lttng_payload_view *view)
 {
        struct fd_handle *handle = NULL;
        size_t fd_handle_count;
@@ -135,11 +135,9 @@ struct fd_handle *lttng_payload_view_pop_fd_handle(
                goto end;
        }
 
-       pos = view->_iterator.p_fd_handles_position ?
-                       view->_iterator.p_fd_handles_position :
-                       &view->_iterator.fd_handles_position;
-       handle = (fd_handle *) lttng_dynamic_pointer_array_get_pointer(&view->_fd_handles,
-                       *pos);
+       pos = view->_iterator.p_fd_handles_position ? view->_iterator.p_fd_handles_position :
+                                                     &view->_iterator.fd_handles_position;
+       handle = (fd_handle *) lttng_dynamic_pointer_array_get_pointer(&view->_fd_handles, *pos);
        (*pos)++;
        fd_handle_get(handle);
 end:
index fa07dae31c840c2fa7661088e9d35ed691e3bad0..ef095554585c934569b04cf7da76f512d51f195d 100644 (file)
@@ -6,12 +6,12 @@
  */
 
 #include "payload.hpp"
+
 #include <common/dynamic-array.hpp>
 #include <common/dynamic-buffer.hpp>
 #include <common/error.hpp>
 
-static
-void release_fd_handle_ref(void *ptr)
+static void release_fd_handle_ref(void *ptr)
 {
        struct fd_handle *fd_handle = (struct fd_handle *) ptr;
 
@@ -22,29 +22,24 @@ void lttng_payload_init(struct lttng_payload *payload)
 {
        LTTNG_ASSERT(payload);
        lttng_dynamic_buffer_init(&payload->buffer);
-       lttng_dynamic_pointer_array_init(&payload->_fd_handles,
-                       release_fd_handle_ref);
+       lttng_dynamic_pointer_array_init(&payload->_fd_handles, release_fd_handle_ref);
 }
 
-int lttng_payload_copy(const struct lttng_payload *src_payload,
-                      struct lttng_payload *dst_payload)
+int lttng_payload_copy(const struct lttng_payload *src_payload, struct lttng_payload *dst_payload)
 {
        int ret;
        size_t i;
 
-       ret = lttng_dynamic_buffer_append_buffer(
-                       &dst_payload->buffer, &src_payload->buffer);
+       ret = lttng_dynamic_buffer_append_buffer(&dst_payload->buffer, &src_payload->buffer);
        if (ret) {
                goto end;
        }
 
-       for (i = 0; i < lttng_dynamic_pointer_array_get_count(
-                                       &src_payload->_fd_handles);
-                       i++) {
+       for (i = 0; i < lttng_dynamic_pointer_array_get_count(&src_payload->_fd_handles); i++) {
                struct fd_handle *new_fd_handle;
                const struct fd_handle *src_fd_handle =
-                               (fd_handle *) lttng_dynamic_pointer_array_get_pointer(
-                                               &src_payload->_fd_handles, i);
+                       (fd_handle *) lttng_dynamic_pointer_array_get_pointer(
+                               &src_payload->_fd_handles, i);
 
                new_fd_handle = fd_handle_copy(src_fd_handle);
                if (!new_fd_handle) {
@@ -80,8 +75,7 @@ void lttng_payload_clear(struct lttng_payload *payload)
        lttng_dynamic_pointer_array_clear(&payload->_fd_handles);
 }
 
-int lttng_payload_push_fd_handle(struct lttng_payload *payload,
-               struct fd_handle *fd_handle)
+int lttng_payload_push_fd_handle(struct lttng_payload *payload, struct fd_handle *fd_handle)
 {
        int ret;
 
@@ -90,8 +84,7 @@ int lttng_payload_push_fd_handle(struct lttng_payload *payload,
                goto end;
        }
 
-       ret = lttng_dynamic_pointer_array_add_pointer(
-                       &payload->_fd_handles, fd_handle);
+       ret = lttng_dynamic_pointer_array_add_pointer(&payload->_fd_handles, fd_handle);
        if (ret) {
                goto end;
        }
index 8bf0c1ff33341e54728d3b0b196f62752fc536c6..1c39ba224a983f0fd346fd4547860593bc565549 100644 (file)
@@ -6,14 +6,14 @@
  */
 
 #define _LGPL_SOURCE
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#include "pipe.hpp"
 
 #include <common/common.hpp>
 
-#include "pipe.hpp"
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 /*
  * Lock read side of a pipe.
@@ -213,8 +213,7 @@ error:
  *
  * Return a newly allocated lttng pipe on success or else NULL.
  */
-struct lttng_pipe *lttng_pipe_named_open(const char *path, mode_t mode,
-               int flags)
+struct lttng_pipe *lttng_pipe_named_open(const char *path, mode_t mode, int flags)
 {
        int ret, fd_r, fd_w;
        struct lttng_pipe *pipe;
@@ -383,8 +382,7 @@ error:
  * Return "count" on success. Return < count on error. errno can be used
  * to check the actual error.
  */
-ssize_t lttng_pipe_write(struct lttng_pipe *pipe, const void *buf,
-               size_t count)
+ssize_t lttng_pipe_write(struct lttng_pipe *pipe, const void *buf, size_t count)
 {
        ssize_t ret;
 
index b5669d097d93f95477a9598e70d5aadfa1cf08e4..8d9bcfd41e0beb09147918c569d03b83fcfbf32e 100644 (file)
@@ -5,8 +5,6 @@
  *
  */
 
-#include <lttng/constant.h>
-
 #include <common/file-descriptor.hpp>
 #include <common/format.hpp>
 #include <common/hashtable/utils.hpp>
@@ -14,6 +12,8 @@
 #include <common/readwrite.hpp>
 #include <common/time.hpp>
 
+#include <lttng/constant.h>
+
 #include <fcntl.h>
 
 #ifdef HAVE_SYS_SYSCALL_H
@@ -66,16 +66,15 @@ void getrandom_nonblock(char *out_data, std::size_t size)
 
        if (ret < 0) {
                LTTNG_THROW_POSIX(
-                               fmt::format("Failed to get true random data using getrandom(): size={}",
-                                               size),
-                               errno);
+                       fmt::format("Failed to get true random data using getrandom(): size={}",
+                                   size),
+                       errno);
        }
 }
 #else /* defined(__linux__) && defined(SYS_getrandom) && defined(HAVE_SYS_RANDOM_H) */
 void getrandom_nonblock(char *out_data, std::size_t size)
 {
-       LTTNG_THROW_RANDOM_PRODUCTION_ERROR(
-                       "getrandom() is not supported by this platform");
+       LTTNG_THROW_RANDOM_PRODUCTION_ERROR("getrandom() is not supported by this platform");
 }
 #endif /* defined(__linux__) && defined(SYS_getrandom) && defined(HAVE_SYS_RANDOM_H) */
 
@@ -91,25 +90,23 @@ lttng::random::seed_t produce_pseudo_random_seed()
        ret = clock_gettime(CLOCK_REALTIME, &real_time);
        if (ret) {
                LTTNG_THROW_POSIX("Failed to read real time while generating pseudo-random seed",
-                               errno);
+                                 errno);
        }
 
        ret = clock_gettime(CLOCK_MONOTONIC, &monotonic_time);
        if (ret) {
                LTTNG_THROW_POSIX(
-                               "Failed to read monotonic time while generating pseudo-random seed",
-                               errno);
+                       "Failed to read monotonic time while generating pseudo-random seed", errno);
        }
 
        ret = gethostname(hostname, sizeof(hostname));
        if (ret) {
                LTTNG_THROW_POSIX("Failed to get host name while generating pseudo-random seed",
-                               errno);
+                                 errno);
        }
 
        hash_seed = (unsigned long) real_time.tv_nsec ^ (unsigned long) real_time.tv_sec ^
-                       (unsigned long) monotonic_time.tv_nsec ^
-                       (unsigned long) monotonic_time.tv_sec;
+               (unsigned long) monotonic_time.tv_nsec ^ (unsigned long) monotonic_time.tv_sec;
        seed = hash_key_ulong((void *) real_time.tv_sec, hash_seed);
        seed ^= hash_key_ulong((void *) real_time.tv_nsec, hash_seed);
        seed ^= hash_key_ulong((void *) monotonic_time.tv_sec, hash_seed);
@@ -128,7 +125,7 @@ lttng::random::seed_t produce_random_seed_from_urandom()
         * Open /dev/urandom as a file_descriptor, or throw on error. The
         * lambda is used to reduce the scope of the raw fd as much as possible.
         */
-       lttng::file_descriptor urandom{[]() {
+       lttng::file_descriptor urandom{ []() {
                const auto urandom_raw_fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC);
 
                if (urandom_raw_fd < 0) {
@@ -136,14 +133,14 @@ lttng::random::seed_t produce_random_seed_from_urandom()
                }
 
                return urandom_raw_fd;
-       }()};
+       }() };
 
        lttng::random::seed_t seed;
        const auto read_ret = lttng_read(urandom.fd(), &seed, sizeof(seed));
        if (read_ret != sizeof(seed)) {
                LTTNG_THROW_POSIX(fmt::format("Failed to read from `/dev/urandom`: size={}",
-                                                 sizeof(seed)),
-                               errno);
+                                             sizeof(seed)),
+                                 errno);
        }
 
        return seed;
@@ -152,9 +149,9 @@ lttng::random::seed_t produce_random_seed_from_urandom()
 } /* namespace */
 
 lttng::random::production_error::production_error(const std::string& msg,
-               const char *file_name,
-               const char *function_name,
-               unsigned int line_number) :
+                                                 const char *file_name,
+                                                 const char *function_name,
+                                                 unsigned int line_number) :
        lttng::runtime_error(msg, file_name, function_name, line_number)
 {
 }
@@ -173,9 +170,10 @@ lttng::random::seed_t lttng::random::produce_best_effort_random_seed()
                return lttng::random::produce_true_random_seed();
        } catch (std::exception& e) {
                WARN("%s",
-                               fmt::format("Failed to produce a random seed using getrandom(), falling back to pseudo-random device seed generation which will block until its pool is initialized: {}",
-                                               e.what())
-                                               .c_str());
+                    fmt::format(
+                            "Failed to produce a random seed using getrandom(), falling back to pseudo-random device seed generation which will block until its pool is initialized: {}",
+                            e.what())
+                            .c_str());
        }
 
        try {
@@ -186,9 +184,9 @@ lttng::random::seed_t lttng::random::produce_best_effort_random_seed()
                produce_random_seed_from_urandom();
        } catch (std::exception& e) {
                WARN("%s",
-                               fmt::format("Failed to produce a random seed from the urandom device: {}",
-                                               e.what())
-                                               .c_str());
+                    fmt::format("Failed to produce a random seed from the urandom device: {}",
+                                e.what())
+                            .c_str());
        }
 
        /* Fallback to time-based seed generation. */
index 8e901c9fec81f0027d120064ed90572765710ea6..a9671a5d9e736df7a0d9dbf5b26c55285d903d14 100644 (file)
@@ -6,12 +6,12 @@
  */
 
 #define _LGPL_SOURCE
-#include <limits.h>
-#include <unistd.h>
+#include "readwrite.hpp"
 
 #include <common/compat/errno.hpp>
 
-#include "readwrite.hpp"
+#include <limits.h>
+#include <unistd.h>
 
 /*
  * lttng_read and lttng_write take care of EINTR and partial read/write.
@@ -40,7 +40,7 @@ ssize_t lttng_read(int fd, void *buf, size_t count)
                ret = read(fd, (char *) buf + i, count - i);
                if (ret < 0) {
                        if (errno == EINTR) {
-                               continue;       /* retry operation */
+                               continue; /* retry operation */
                        } else {
                                goto error;
                        }
@@ -77,7 +77,7 @@ ssize_t lttng_write(int fd, const void *buf, size_t count)
                ret = write(fd, (char *) buf + i, count - i);
                if (ret < 0) {
                        if (errno == EINTR) {
-                               continue;       /* retry operation */
+                               continue; /* retry operation */
                        } else {
                                goto error;
                        }
index 12658dc6856655320203e84e8e542d97130876c5..7bbfc95ff62dd817f8db9641c9e4e31df8d33754 100644 (file)
@@ -6,25 +6,24 @@
  */
 
 #define _LGPL_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <inttypes.h>
+#include "relayd.hpp"
 
 #include <common/common.hpp>
-#include <common/defaults.hpp>
 #include <common/compat/endian.hpp>
 #include <common/compat/string.hpp>
-#include <common/sessiond-comm/relayd.hpp>
+#include <common/defaults.hpp>
 #include <common/index/ctf-index.hpp>
-#include <common/trace-chunk.hpp>
+#include <common/sessiond-comm/relayd.hpp>
 #include <common/string-utils/format.hpp>
+#include <common/trace-chunk.hpp>
 
-#include "relayd.hpp"
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
 
-static
-bool relayd_supports_chunks(const struct lttcomm_relayd_sock *sock)
+static bool relayd_supports_chunks(const struct lttcomm_relayd_sock *sock)
 {
        if (sock->major > 2) {
                return true;
@@ -34,8 +33,7 @@ bool relayd_supports_chunks(const struct lttcomm_relayd_sock *sock)
        return false;
 }
 
-static
-bool relayd_supports_get_configuration(const struct lttcomm_relayd_sock *sock)
+static bool relayd_supports_get_configuration(const struct lttcomm_relayd_sock *sock)
 {
        if (sock->major > 2) {
                return true;
@@ -49,8 +47,10 @@ bool relayd_supports_get_configuration(const struct lttcomm_relayd_sock *sock)
  * Send command. Fill up the header and append the data.
  */
 static int send_command(struct lttcomm_relayd_sock *rsock,
-               enum lttcomm_relayd_command cmd, const void *data, size_t size,
-               int flags)
+                       enum lttcomm_relayd_command cmd,
+                       const void *data,
+                       size_t size,
+                       int flags)
 {
        int ret;
        struct lttcomm_relayd_hdr header;
@@ -87,12 +87,14 @@ static int send_command(struct lttcomm_relayd_sock *rsock,
        }
 
        DBG3("Relayd sending command %s of size %" PRIu64,
-                       lttcomm_relayd_command_str(cmd), buf_size);
+            lttcomm_relayd_command_str(cmd),
+            buf_size);
        ret = rsock->sock.ops->sendmsg(&rsock->sock, buf, buf_size, flags);
        if (ret < 0) {
                PERROR("Failed to send command %s of size %" PRIu64,
-                               lttcomm_relayd_command_str(cmd), buf_size);
-       ret = rsock->sock.ops->sendmsg(&rsock->sock, buf, buf_size, flags);
+                      lttcomm_relayd_command_str(cmd),
+                      buf_size);
+               ret = rsock->sock.ops->sendmsg(&rsock->sock, buf, buf_size, flags);
                ret = -errno;
                goto error;
        }
@@ -123,7 +125,9 @@ static int recv_reply(struct lttcomm_relayd_sock *rsock, void *data, size_t size
                        DBG("Socket %d has performed an orderly shutdown", rsock->sock.fd);
                } else {
                        DBG("Receiving reply failed on sock %d for size %zu with ret %d",
-                                       rsock->sock.fd, size, ret);
+                           rsock->sock.fd,
+                           size,
+                           ret);
                }
                /* Always return -1 here and the caller can use errno. */
                ret = -1;
@@ -141,13 +145,18 @@ error:
  * payload size is introduced.
  */
 static int relayd_create_session_2_11(struct lttcomm_relayd_sock *rsock,
-               const char *session_name, const char *hostname,
-               const char *base_path, int session_live_timer,
-               unsigned int snapshot, uint64_t sessiond_session_id,
-               const lttng_uuid& sessiond_uuid, const uint64_t *current_chunk_id,
-               time_t creation_time, bool session_name_contains_creation_time,
-               struct lttcomm_relayd_create_session_reply_2_11 *reply,
-               char *output_path)
+                                     const char *session_name,
+                                     const char *hostname,
+                                     const char *base_path,
+                                     int session_live_timer,
+                                     unsigned int snapshot,
+                                     uint64_t sessiond_session_id,
+                                     const lttng_uuid& sessiond_uuid,
+                                     const uint64_t *current_chunk_id,
+                                     time_t creation_time,
+                                     bool session_name_contains_creation_time,
+                                     struct lttcomm_relayd_create_session_reply_2_11 *reply,
+                                     char *output_path)
 {
        int ret;
        struct lttcomm_relayd_create_session_2_11 *msg = NULL;
@@ -205,8 +214,7 @@ static int relayd_create_session_2_11(struct lttcomm_relayd_sock *rsock,
        msg->session_id = htobe64(sessiond_session_id);
        msg->session_name_contains_creation_time = session_name_contains_creation_time;
        if (current_chunk_id) {
-               LTTNG_OPTIONAL_SET(&msg->current_chunk_id,
-                               htobe64(*current_chunk_id));
+               LTTNG_OPTIONAL_SET(&msg->current_chunk_id, htobe64(*current_chunk_id));
        }
 
        msg->creation_time = htobe64((uint64_t) creation_time);
@@ -225,8 +233,10 @@ static int relayd_create_session_2_11(struct lttcomm_relayd_sock *rsock,
        reply->generic.ret_code = be32toh(reply->generic.ret_code);
        reply->output_path_length = be32toh(reply->output_path_length);
        if (reply->output_path_length >= LTTNG_PATH_MAX) {
-               ERR("Invalid session output path length in reply (%" PRIu32 " bytes) exceeds maximal allowed length (%d bytes)",
-                               reply->output_path_length, LTTNG_PATH_MAX);
+               ERR("Invalid session output path length in reply (%" PRIu32
+                   " bytes) exceeds maximal allowed length (%d bytes)",
+                   reply->output_path_length,
+                   LTTNG_PATH_MAX);
                ret = -1;
                goto error;
        }
@@ -243,15 +253,16 @@ error:
  * support the live reading capability.
  */
 static int relayd_create_session_2_4(struct lttcomm_relayd_sock *rsock,
-               const char *session_name, const char *hostname,
-               int session_live_timer, unsigned int snapshot,
-               struct lttcomm_relayd_status_session *reply)
+                                    const char *session_name,
+                                    const char *hostname,
+                                    int session_live_timer,
+                                    unsigned int snapshot,
+                                    struct lttcomm_relayd_status_session *reply)
 {
        int ret;
        struct lttcomm_relayd_create_session_2_4 msg;
 
-       if (lttng_strncpy(msg.session_name, session_name,
-                       sizeof(msg.session_name))) {
+       if (lttng_strncpy(msg.session_name, session_name, sizeof(msg.session_name))) {
                ret = -1;
                goto error;
        }
@@ -283,7 +294,7 @@ error:
  * RELAYD_CREATE_SESSION from 2.1 to 2.3.
  */
 static int relayd_create_session_2_1(struct lttcomm_relayd_sock *rsock,
-               struct lttcomm_relayd_status_session *reply)
+                                    struct lttcomm_relayd_status_session *reply)
 {
        int ret;
 
@@ -312,14 +323,18 @@ error:
  * a lttng error code from the relayd.
  */
 int relayd_create_session(struct lttcomm_relayd_sock *rsock,
-               uint64_t *relayd_session_id,
-               const char *session_name, const char *hostname,
-               const char *base_path, int session_live_timer,
-               unsigned int snapshot, uint64_t sessiond_session_id,
-               const lttng_uuid& sessiond_uuid,
-               const uint64_t *current_chunk_id,
-               time_t creation_time, bool session_name_contains_creation_time,
-               char *output_path)
+                         uint64_t *relayd_session_id,
+                         const char *session_name,
+                         const char *hostname,
+                         const char *base_path,
+                         int session_live_timer,
+                         unsigned int snapshot,
+                         uint64_t sessiond_session_id,
+                         const lttng_uuid& sessiond_uuid,
+                         const uint64_t *current_chunk_id,
+                         time_t creation_time,
+                         bool session_name_contains_creation_time,
+                         char *output_path)
 {
        int ret;
        struct lttcomm_relayd_create_session_reply_2_11 reply = {};
@@ -334,17 +349,23 @@ int relayd_create_session(struct lttcomm_relayd_sock *rsock,
                ret = relayd_create_session_2_1(rsock, &reply.generic);
        } else if (rsock->minor >= 4 && rsock->minor < 11) {
                /* From 2.4 to 2.10 */
-               ret = relayd_create_session_2_4(rsock, session_name,
-                               hostname, session_live_timer, snapshot,
-                               &reply.generic);
+               ret = relayd_create_session_2_4(
+                       rsock, session_name, hostname, session_live_timer, snapshot, &reply.generic);
        } else {
                /* From 2.11 to ... */
-               ret = relayd_create_session_2_11(rsock, session_name,
-                               hostname, base_path, session_live_timer, snapshot,
-                               sessiond_session_id, sessiond_uuid,
-                               current_chunk_id, creation_time,
-                               session_name_contains_creation_time,
-                               &reply, output_path);
+               ret = relayd_create_session_2_11(rsock,
+                                                session_name,
+                                                hostname,
+                                                base_path,
+                                                session_live_timer,
+                                                snapshot,
+                                                sessiond_session_id,
+                                                sessiond_uuid,
+                                                current_chunk_id,
+                                                creation_time,
+                                                session_name_contains_creation_time,
+                                                &reply,
+                                                output_path);
        }
 
        if (ret < 0) {
@@ -354,8 +375,7 @@ int relayd_create_session(struct lttcomm_relayd_sock *rsock,
        /* Return session id or negative ret code. */
        if (reply.generic.ret_code != LTTNG_OK) {
                ret = -1;
-               ERR("Relayd create session replied error %d",
-                       reply.generic.ret_code);
+               ERR("Relayd create session replied error %d", reply.generic.ret_code);
                goto error;
        } else {
                ret = 0;
@@ -369,20 +389,19 @@ error:
 }
 
 static int relayd_add_stream_2_1(struct lttcomm_relayd_sock *rsock,
-               const char *channel_name, const char *pathname)
+                                const char *channel_name,
+                                const char *pathname)
 {
        int ret;
        struct lttcomm_relayd_add_stream msg;
 
        memset(&msg, 0, sizeof(msg));
-       if (lttng_strncpy(msg.channel_name, channel_name,
-                               sizeof(msg.channel_name))) {
+       if (lttng_strncpy(msg.channel_name, channel_name, sizeof(msg.channel_name))) {
                ret = -1;
                goto error;
        }
 
-       if (lttng_strncpy(msg.pathname, pathname,
-                               sizeof(msg.pathname))) {
+       if (lttng_strncpy(msg.pathname, pathname, sizeof(msg.pathname))) {
                ret = -1;
                goto error;
        }
@@ -399,21 +418,21 @@ error:
 }
 
 static int relayd_add_stream_2_2(struct lttcomm_relayd_sock *rsock,
-               const char *channel_name, const char *pathname,
-               uint64_t tracefile_size, uint64_t tracefile_count)
+                                const char *channel_name,
+                                const char *pathname,
+                                uint64_t tracefile_size,
+                                uint64_t tracefile_count)
 {
        int ret;
        struct lttcomm_relayd_add_stream_2_2 msg;
 
        memset(&msg, 0, sizeof(msg));
        /* Compat with relayd 2.2 to 2.10 */
-       if (lttng_strncpy(msg.channel_name, channel_name,
-                               sizeof(msg.channel_name))) {
+       if (lttng_strncpy(msg.channel_name, channel_name, sizeof(msg.channel_name))) {
                ret = -1;
                goto error;
        }
-       if (lttng_strncpy(msg.pathname, pathname,
-                               sizeof(msg.pathname))) {
+       if (lttng_strncpy(msg.pathname, pathname, sizeof(msg.pathname))) {
                ret = -1;
                goto error;
        }
@@ -431,9 +450,11 @@ error:
 }
 
 static int relayd_add_stream_2_11(struct lttcomm_relayd_sock *rsock,
-               const char *channel_name, const char *pathname,
-               uint64_t tracefile_size, uint64_t tracefile_count,
-               uint64_t trace_archive_id)
+                                 const char *channel_name,
+                                 const char *pathname,
+                                 uint64_t tracefile_size,
+                                 uint64_t tracefile_count,
+                                 uint64_t trace_archive_id)
 {
        int ret;
        struct lttcomm_relayd_add_stream_2_11 *msg = NULL;
@@ -492,10 +513,14 @@ error:
  *
  * On success return 0 else return ret_code negative value.
  */
-int relayd_add_stream(struct lttcomm_relayd_sock *rsock, const char *channel_name,
-               const char *domain_name, const char *_pathname, uint64_t *stream_id,
-               uint64_t tracefile_size, uint64_t tracefile_count,
-               struct lttng_trace_chunk *trace_chunk)
+int relayd_add_stream(struct lttcomm_relayd_sock *rsock,
+                     const char *channel_name,
+                     const char *domain_name,
+                     const char *_pathname,
+                     uint64_t *stream_id,
+                     uint64_t tracefile_size,
+                     uint64_t tracefile_count,
+                     struct lttng_trace_chunk *trace_chunk)
 {
        int ret;
        struct lttcomm_relayd_status_stream reply;
@@ -517,8 +542,8 @@ int relayd_add_stream(struct lttcomm_relayd_sock *rsock, const char *channel_nam
 
        } else if (rsock->minor > 1 && rsock->minor < 11) {
                /* From 2.2 to 2.10 */
-               ret = relayd_add_stream_2_2(rsock, channel_name, _pathname,
-                               tracefile_size, tracefile_count);
+               ret = relayd_add_stream_2_2(
+                       rsock, channel_name, _pathname, tracefile_size, tracefile_count);
        } else {
                const char *separator;
                enum lttng_trace_chunk_status chunk_status;
@@ -530,24 +555,25 @@ int relayd_add_stream(struct lttcomm_relayd_sock *rsock, const char *channel_nam
                        separator = "/";
                }
 
-               ret = snprintf(pathname, RELAYD_COMM_LTTNG_PATH_MAX, "%s%s%s",
-                               domain_name, separator, _pathname);
+               ret = snprintf(pathname,
+                              RELAYD_COMM_LTTNG_PATH_MAX,
+                              "%s%s%s",
+                              domain_name,
+                              separator,
+                              _pathname);
                if (ret <= 0 || ret >= RELAYD_COMM_LTTNG_PATH_MAX) {
                        ERR("Failed to format stream path: %s",
-                                       ret <= 0 ? "formatting error" :
-                                                       "path exceeds maximal allowed length");
+                           ret <= 0 ? "formatting error" : "path exceeds maximal allowed length");
                        ret = -1;
                        goto error;
                }
 
-               chunk_status = lttng_trace_chunk_get_id(trace_chunk,
-                               &chunk_id);
+               chunk_status = lttng_trace_chunk_get_id(trace_chunk, &chunk_id);
                LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
 
                /* From 2.11 to ...*/
-               ret = relayd_add_stream_2_11(rsock, channel_name, pathname,
-                               tracefile_size, tracefile_count,
-                               chunk_id);
+               ret = relayd_add_stream_2_11(
+                       rsock, channel_name, pathname, tracefile_size, tracefile_count, chunk_id);
        }
 
        if (ret) {
@@ -575,8 +601,7 @@ int relayd_add_stream(struct lttcomm_relayd_sock *rsock, const char *channel_nam
                *stream_id = reply.handle;
        }
 
-       DBG("Relayd stream added successfully with handle %" PRIu64,
-                       reply.handle);
+       DBG("Relayd stream added successfully with handle %" PRIu64, reply.handle);
 
 error:
        return ret;
@@ -651,8 +676,7 @@ int relayd_version_check(struct lttcomm_relayd_sock *rsock)
        /* Code flow error. Safety net. */
        LTTNG_ASSERT(rsock);
 
-       DBG("Relayd version check for major.minor %u.%u", rsock->major,
-                       rsock->minor);
+       DBG("Relayd version check for major.minor %u.%u", rsock->major, rsock->minor);
 
        memset(&msg, 0, sizeof(msg));
        /* Prepare network byte order before transmission. */
@@ -685,7 +709,8 @@ int relayd_version_check(struct lttcomm_relayd_sock *rsock)
                /* Not compatible */
                ret = LTTNG_ERR_RELAYD_VERSION_FAIL;
                DBG2("Relayd version is NOT compatible. Relayd version %u != %u (us)",
-                               msg.major, rsock->major);
+                    msg.major,
+                    rsock->major);
                goto error;
        }
 
@@ -700,7 +725,8 @@ int relayd_version_check(struct lttcomm_relayd_sock *rsock)
 
        /* Version number compatible */
        DBG2("Relayd version is compatible, using protocol version %u.%u",
-                       rsock->major, rsock->minor);
+            rsock->major,
+            rsock->minor);
        ret = 0;
 
 error:
@@ -806,7 +832,8 @@ end:
  * Send data header structure to the relayd.
  */
 int relayd_send_data_hdr(struct lttcomm_relayd_sock *rsock,
-               struct lttcomm_relayd_data_hdr *hdr, size_t size)
+                        struct lttcomm_relayd_data_hdr *hdr,
+                        size_t size)
 {
        int ret;
 
@@ -844,8 +871,9 @@ error:
 /*
  * Send close stream command to the relayd.
  */
-int relayd_send_close_stream(struct lttcomm_relayd_sock *rsock, uint64_t stream_id,
-               uint64_t last_net_seq_num)
+int relayd_send_close_stream(struct lttcomm_relayd_sock *rsock,
+                            uint64_t stream_id,
+                            uint64_t last_net_seq_num)
 {
        int ret;
        struct lttcomm_relayd_close_stream msg;
@@ -894,8 +922,9 @@ error:
  *
  * Return 0 if NOT pending, 1 if so and a negative value on error.
  */
-int relayd_data_pending(struct lttcomm_relayd_sock *rsock, uint64_t stream_id,
-               uint64_t last_net_seq_num)
+int relayd_data_pending(struct lttcomm_relayd_sock *rsock,
+                       uint64_t stream_id,
+                       uint64_t last_net_seq_num)
 {
        int ret;
        struct lttcomm_relayd_data_pending msg;
@@ -911,8 +940,7 @@ int relayd_data_pending(struct lttcomm_relayd_sock *rsock, uint64_t stream_id,
        msg.last_net_seq_num = htobe64(last_net_seq_num);
 
        /* Send command */
-       ret = send_command(rsock, RELAYD_DATA_PENDING, (void *) &msg,
-                       sizeof(msg), 0);
+       ret = send_command(rsock, RELAYD_DATA_PENDING, (void *) &msg, sizeof(msg), 0);
        if (ret < 0) {
                goto error;
        }
@@ -933,8 +961,7 @@ int relayd_data_pending(struct lttcomm_relayd_sock *rsock, uint64_t stream_id,
        /* At this point, the ret code is either 1 or 0 */
        ret = reply.ret_code;
 
-       DBG("Relayd data is %s pending for stream id %" PRIu64,
-                       ret == 1 ? "" : "NOT", stream_id);
+       DBG("Relayd data is %s pending for stream id %" PRIu64, ret == 1 ? "" : "NOT", stream_id);
 
 error:
        return ret;
@@ -943,8 +970,7 @@ error:
 /*
  * Check on the relayd side for a quiescent state on the control socket.
  */
-int relayd_quiescent_control(struct lttcomm_relayd_sock *rsock,
-               uint64_t metadata_stream_id)
+int relayd_quiescent_control(struct lttcomm_relayd_sock *rsock, uint64_t metadata_stream_id)
 {
        int ret;
        struct lttcomm_relayd_quiescent_control msg;
@@ -1036,8 +1062,9 @@ error:
  * Return 0 on success and set is_data_inflight to 0 if no data is being
  * streamed or 1 if it is the case.
  */
-int relayd_end_data_pending(struct lttcomm_relayd_sock *rsock, uint64_t id,
-               unsigned int *is_data_inflight)
+int relayd_end_data_pending(struct lttcomm_relayd_sock *rsock,
+                           uint64_t id,
+                           unsigned int *is_data_inflight)
 {
        int ret, recv_ret;
        struct lttcomm_relayd_end_data_pending msg;
@@ -1083,8 +1110,9 @@ error:
  * Send index to the relayd.
  */
 int relayd_send_index(struct lttcomm_relayd_sock *rsock,
-               struct ctf_packet_index *index, uint64_t relay_stream_id,
-               uint64_t net_seq_num)
+                     struct ctf_packet_index *index,
+                     uint64_t relay_stream_id,
+                     uint64_t net_seq_num)
 {
        int ret;
        struct lttcomm_relayd_index msg;
@@ -1119,11 +1147,13 @@ int relayd_send_index(struct lttcomm_relayd_sock *rsock,
        }
 
        /* Send command */
-       ret = send_command(rsock, RELAYD_SEND_INDEX, &msg,
-               lttcomm_relayd_index_len(lttng_to_index_major(rsock->major,
-                                                               rsock->minor),
-                               lttng_to_index_minor(rsock->major, rsock->minor)),
-                               0);
+       ret = send_command(
+               rsock,
+               RELAYD_SEND_INDEX,
+               &msg,
+               lttcomm_relayd_index_len(lttng_to_index_major(rsock->major, rsock->minor),
+                                        lttng_to_index_minor(rsock->major, rsock->minor)),
+               0);
        if (ret < 0) {
                goto error;
        }
@@ -1152,8 +1182,7 @@ error:
 /*
  * Ask the relay to reset the metadata trace file (regeneration).
  */
-int relayd_reset_metadata(struct lttcomm_relayd_sock *rsock,
-               uint64_t stream_id, uint64_t version)
+int relayd_reset_metadata(struct lttcomm_relayd_sock *rsock, uint64_t stream_id, uint64_t version)
 {
        int ret;
        struct lttcomm_relayd_reset_metadata msg;
@@ -1205,8 +1234,9 @@ error:
 }
 
 int relayd_rotate_streams(struct lttcomm_relayd_sock *sock,
-               unsigned int stream_count, const uint64_t *new_chunk_id,
-               const struct relayd_stream_rotation_position *positions)
+                         unsigned int stream_count,
+                         const uint64_t *new_chunk_id,
+                         const struct relayd_stream_rotation_position *positions)
 {
        int ret;
        unsigned int i;
@@ -1233,8 +1263,8 @@ int relayd_rotate_streams(struct lttcomm_relayd_sock *sock,
        LTTNG_ASSERT(sock);
 
        if (new_chunk_id) {
-               ret = snprintf(new_chunk_id_buf, sizeof(new_chunk_id_buf),
-                               "%" PRIu64, *new_chunk_id);
+               ret = snprintf(
+                       new_chunk_id_buf, sizeof(new_chunk_id_buf), "%" PRIu64, *new_chunk_id);
                if (ret == -1 || ret >= sizeof(new_chunk_id_buf)) {
                        new_chunk_id_str = "formatting error";
                } else {
@@ -1245,7 +1275,8 @@ int relayd_rotate_streams(struct lttcomm_relayd_sock *sock,
        }
 
        DBG("Preparing \"rotate streams\" command payload: new_chunk_id = %s, stream_count = %u",
-                       new_chunk_id_str, stream_count);
+           new_chunk_id_str,
+           stream_count);
 
        ret = lttng_dynamic_buffer_append(&payload, &msg, sizeof(msg));
        if (ret) {
@@ -1254,19 +1285,16 @@ int relayd_rotate_streams(struct lttcomm_relayd_sock *sock,
        }
 
        for (i = 0; i < stream_count; i++) {
-               const struct relayd_stream_rotation_position *position =
-                               &positions[i];
+               const struct relayd_stream_rotation_position *position = &positions[i];
                const struct lttcomm_relayd_stream_rotation_position comm_position = {
                        .stream_id = htobe64(position->stream_id),
-                       .rotate_at_seq_num = htobe64(
-                                       position->rotate_at_seq_num),
+                       .rotate_at_seq_num = htobe64(position->rotate_at_seq_num),
                };
 
                DBG("Rotate stream %" PRIu64 " at sequence number %" PRIu64,
-                               position->stream_id,
-                               position->rotate_at_seq_num);
-               ret = lttng_dynamic_buffer_append(&payload, &comm_position,
-                               sizeof(comm_position));
+                   position->stream_id,
+                   position->rotate_at_seq_num);
+               ret = lttng_dynamic_buffer_append(&payload, &comm_position, sizeof(comm_position));
                if (ret) {
                        ERR("Failed to allocate \"rotate streams\" command payload");
                        goto error;
@@ -1274,8 +1302,7 @@ int relayd_rotate_streams(struct lttcomm_relayd_sock *sock,
        }
 
        /* Send command. */
-       ret = send_command(sock, RELAYD_ROTATE_STREAMS, payload.data,
-                       payload.size, 0);
+       ret = send_command(sock, RELAYD_ROTATE_STREAMS, payload.data, payload.size, 0);
        if (ret < 0) {
                ERR("Failed to send \"rotate stream\" command");
                goto error;
@@ -1303,8 +1330,7 @@ error:
        return ret;
 }
 
-int relayd_create_trace_chunk(struct lttcomm_relayd_sock *sock,
-               struct lttng_trace_chunk *chunk)
+int relayd_create_trace_chunk(struct lttcomm_relayd_sock *sock, struct lttng_trace_chunk *chunk)
 {
        int ret = 0;
        enum lttng_trace_chunk_status status;
@@ -1330,17 +1356,14 @@ int relayd_create_trace_chunk(struct lttcomm_relayd_sock *sock,
                goto end;
        }
 
-       status = lttng_trace_chunk_get_creation_timestamp(
-                       chunk, &creation_timestamp);
+       status = lttng_trace_chunk_get_creation_timestamp(chunk, &creation_timestamp);
        if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                ret = -1;
                goto end;
        }
 
-       status = lttng_trace_chunk_get_name(
-                       chunk, &chunk_name, &overridden_name);
-       if (status != LTTNG_TRACE_CHUNK_STATUS_OK &&
-                       status != LTTNG_TRACE_CHUNK_STATUS_NONE) {
+       status = lttng_trace_chunk_get_name(chunk, &chunk_name, &overridden_name);
+       if (status != LTTNG_TRACE_CHUNK_STATUS_OK && status != LTTNG_TRACE_CHUNK_STATUS_NONE) {
                ret = -1;
                goto end;
        }
@@ -1355,15 +1378,13 @@ int relayd_create_trace_chunk(struct lttcomm_relayd_sock *sock,
                goto end;
        }
        if (chunk_name_length) {
-               ret = lttng_dynamic_buffer_append(
-                               &payload, chunk_name, chunk_name_length);
+               ret = lttng_dynamic_buffer_append(&payload, chunk_name, chunk_name_length);
                if (ret) {
                        goto end;
                }
        }
 
-       ret = send_command(sock, RELAYD_CREATE_TRACE_CHUNK, payload.data,
-                       payload.size, 0);
+       ret = send_command(sock, RELAYD_CREATE_TRACE_CHUNK, payload.data, payload.size, 0);
        if (ret < 0) {
                ERR("Failed to send trace chunk creation command to relay daemon");
                goto end;
@@ -1378,12 +1399,10 @@ int relayd_create_trace_chunk(struct lttcomm_relayd_sock *sock,
        reply.ret_code = be32toh(reply.ret_code);
        if (reply.ret_code != LTTNG_OK) {
                ret = -1;
-               ERR("Relayd trace chunk create replied error %d",
-                               reply.ret_code);
+               ERR("Relayd trace chunk create replied error %d", reply.ret_code);
        } else {
                ret = 0;
-               DBG("Relayd successfully created trace chunk: chunk_id = %" PRIu64,
-                               chunk_id);
+               DBG("Relayd successfully created trace chunk: chunk_id = %" PRIu64, chunk_id);
        }
 
 end:
@@ -1392,8 +1411,8 @@ end:
 }
 
 int relayd_close_trace_chunk(struct lttcomm_relayd_sock *sock,
-               struct lttng_trace_chunk *chunk,
-               char *path)
+                            struct lttng_trace_chunk *chunk,
+                            char *path)
 {
        int ret = 0;
        enum lttng_trace_chunk_status status;
@@ -1422,8 +1441,7 @@ int relayd_close_trace_chunk(struct lttcomm_relayd_sock *sock,
                goto end;
        }
 
-       status = lttng_trace_chunk_get_close_command(chunk,
-                       &close_command.value);
+       status = lttng_trace_chunk_get_close_command(chunk, &close_command.value);
        switch (status) {
        case LTTNG_TRACE_CHUNK_STATUS_OK:
                close_command.is_set = 1;
@@ -1445,8 +1463,7 @@ int relayd_close_trace_chunk(struct lttcomm_relayd_sock *sock,
                },
        };
 
-       ret = send_command(sock, RELAYD_CLOSE_TRACE_CHUNK, &msg, sizeof(msg),
-                       0);
+       ret = send_command(sock, RELAYD_CLOSE_TRACE_CHUNK, &msg, sizeof(msg), 0);
        if (ret < 0) {
                ERR("Failed to send trace chunk close command to relay daemon");
                goto end;
@@ -1479,19 +1496,18 @@ int relayd_close_trace_chunk(struct lttcomm_relayd_sock *sock,
        reply.generic.ret_code = be32toh(reply.generic.ret_code);
        if (reply.generic.ret_code != LTTNG_OK) {
                ret = -1;
-               ERR("Relayd trace chunk close replied error %d",
-                               reply.generic.ret_code);
+               ERR("Relayd trace chunk close replied error %d", reply.generic.ret_code);
        } else {
                ret = 0;
-               DBG("Relayd successfully closed trace chunk: chunk_id = %" PRIu64,
-                               chunk_id);
+               DBG("Relayd successfully closed trace chunk: chunk_id = %" PRIu64, chunk_id);
        }
 end:
        return ret;
 }
 
 int relayd_trace_chunk_exists(struct lttcomm_relayd_sock *sock,
-               uint64_t chunk_id, bool *chunk_exists)
+                             uint64_t chunk_id,
+                             bool *chunk_exists)
 {
        int ret = 0;
        struct lttcomm_relayd_trace_chunk_exists msg = {};
@@ -1505,11 +1521,10 @@ int relayd_trace_chunk_exists(struct lttcomm_relayd_sock *sock,
        }
 
        msg = (typeof(msg)){
-                       .chunk_id = htobe64(chunk_id),
+               .chunk_id = htobe64(chunk_id),
        };
 
-       ret = send_command(sock, RELAYD_TRACE_CHUNK_EXISTS, &msg, sizeof(msg),
-                       0);
+       ret = send_command(sock, RELAYD_TRACE_CHUNK_EXISTS, &msg, sizeof(msg), 0);
        if (ret < 0) {
                ERR("Failed to send trace chunk exists command to relay daemon");
                goto end;
@@ -1524,13 +1539,13 @@ int relayd_trace_chunk_exists(struct lttcomm_relayd_sock *sock,
        reply.generic.ret_code = be32toh(reply.generic.ret_code);
        if (reply.generic.ret_code != LTTNG_OK) {
                ret = -1;
-               ERR("Relayd trace chunk close replied error %d",
-                               reply.generic.ret_code);
+               ERR("Relayd trace chunk close replied error %d", reply.generic.ret_code);
        } else {
                ret = 0;
                DBG("Relayd successfully checked trace chunk existence: chunk_id = %" PRIu64
-                               ", exists = %s", chunk_id,
-                               reply.trace_chunk_exists ? "true" : "false");
+                   ", exists = %s",
+                   chunk_id,
+                   reply.trace_chunk_exists ? "true" : "false");
                *chunk_exists = !!reply.trace_chunk_exists;
        }
 end:
@@ -1538,11 +1553,11 @@ end:
 }
 
 int relayd_get_configuration(struct lttcomm_relayd_sock *sock,
-               uint64_t query_flags,
-               uint64_t *result_flags)
+                            uint64_t query_flags,
+                            uint64_t *result_flags)
 {
        int ret = 0;
-       struct lttcomm_relayd_get_configuration msg = (typeof(msg)) {
+       struct lttcomm_relayd_get_configuration msg = (typeof(msg)){
                .query_flags = htobe64(query_flags),
        };
        struct lttcomm_relayd_get_configuration_reply reply = {};
@@ -1557,8 +1572,7 @@ int relayd_get_configuration(struct lttcomm_relayd_sock *sock,
                goto end;
        }
 
-       ret = send_command(sock, RELAYD_GET_CONFIGURATION, &msg, sizeof(msg),
-                       0);
+       ret = send_command(sock, RELAYD_GET_CONFIGURATION, &msg, sizeof(msg), 0);
        if (ret < 0) {
                ERR("Failed to send get configuration command to relay daemon");
                goto end;
@@ -1573,15 +1587,14 @@ int relayd_get_configuration(struct lttcomm_relayd_sock *sock,
        reply.generic.ret_code = be32toh(reply.generic.ret_code);
        if (reply.generic.ret_code != LTTNG_OK) {
                ret = -1;
-               ERR("Relayd get configuration replied error %d",
-                               reply.generic.ret_code);
+               ERR("Relayd get configuration replied error %d", reply.generic.ret_code);
        } else {
-               reply.relayd_configuration_flags =
-                       be64toh(reply.relayd_configuration_flags);
+               reply.relayd_configuration_flags = be64toh(reply.relayd_configuration_flags);
                ret = 0;
                DBG("Relayd successfully got configuration: query_flags = %" PRIu64
-                               ", results_flags = %" PRIu64, query_flags,
-                               reply.relayd_configuration_flags);
+                   ", results_flags = %" PRIu64,
+                   query_flags,
+                   reply.relayd_configuration_flags);
                *result_flags = reply.relayd_configuration_flags;
        }
 end:
index 2c762d5ee797f3a98c92f1f59527a1a9ae92f37c..e2ed4fed95653c48d9ca05ec717d569cc33087f0 100644 (file)
@@ -8,6 +8,24 @@
  */
 
 #define _LGPL_SOURCE
+#include "runas.hpp"
+
+#include <common/bytecode/bytecode.hpp>
+#include <common/common.hpp>
+#include <common/compat/errno.hpp>
+#include <common/compat/getenv.hpp>
+#include <common/compat/string.hpp>
+#include <common/defaults.hpp>
+#include <common/filter/filter-ast.hpp>
+#include <common/lttng-elf.hpp>
+#include <common/lttng-kernel.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/thread.hpp>
+#include <common/unix.hpp>
+#include <common/utils.hpp>
+
+#include <lttng/constant.h>
+
 #include <fcntl.h>
 #include <grp.h>
 #include <limits.h>
 #include <sys/wait.h>
 #include <unistd.h>
 
-#include <common/bytecode/bytecode.hpp>
-#include <common/lttng-kernel.hpp>
-#include <common/common.hpp>
-#include <common/utils.hpp>
-#include <common/compat/errno.hpp>
-#include <common/compat/getenv.hpp>
-#include <common/compat/string.hpp>
-#include <common/unix.hpp>
-#include <common/defaults.hpp>
-#include <common/lttng-elf.hpp>
-#include <common/thread.hpp>
-
-#include <lttng/constant.h>
-
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/filter/filter-ast.hpp>
-
-#include "runas.hpp"
-
 #define GETPW_BUFFER_FALLBACK_SIZE 4096
 
 enum run_as_cmd {
@@ -178,29 +177,28 @@ struct run_as_ret {
        bool _error;
 } LTTNG_PACKED;
 
-#define COMMAND_IN_FDS(data_ptr) ({                                    \
-       int *fds = NULL;                                                \
-       if (command_properties[data_ptr->cmd].in_fds_offset != -1) {    \
-               fds = (int *) ((char *) data_ptr + command_properties[data_ptr->cmd].in_fds_offset); \
-       }                                                               \
-       fds;                                                            \
-})
-
-#define COMMAND_OUT_FDS(cmd, ret_ptr) ({                               \
-       int *fds = NULL;                                                \
-       if (command_properties[cmd].out_fds_offset != -1) {             \
-               fds = (int *) ((char *) ret_ptr + command_properties[cmd].out_fds_offset); \
-       }                                                               \
-       fds;                                                            \
-})
-
-#define COMMAND_IN_FD_COUNT(data_ptr) ({               \
-       command_properties[data_ptr->cmd].in_fd_count;  \
-})
-
-#define COMMAND_OUT_FD_COUNT(cmd) ({           \
-       command_properties[cmd].out_fd_count;   \
-})
+#define COMMAND_IN_FDS(data_ptr)                                                         \
+       ({                                                                               \
+               int *fds = NULL;                                                         \
+               if (command_properties[data_ptr->cmd].in_fds_offset != -1) {             \
+                       fds = (int *) ((char *) data_ptr +                               \
+                                      command_properties[data_ptr->cmd].in_fds_offset); \
+               }                                                                        \
+               fds;                                                                     \
+       })
+
+#define COMMAND_OUT_FDS(cmd, ret_ptr)                                                              \
+       ({                                                                                         \
+               int *fds = NULL;                                                                   \
+               if (command_properties[cmd].out_fds_offset != -1) {                                \
+                       fds = (int *) ((char *) ret_ptr + command_properties[cmd].out_fds_offset); \
+               }                                                                                  \
+               fds;                                                                               \
+       })
+
+#define COMMAND_IN_FD_COUNT(data_ptr) ({ command_properties[data_ptr->cmd].in_fd_count; })
+
+#define COMMAND_OUT_FD_COUNT(cmd) ({ command_properties[cmd].out_fd_count; })
 
 #define COMMAND_USE_CWD_FD(data_ptr) command_properties[data_ptr->cmd].use_cwd_fd
 
@@ -311,16 +309,14 @@ const struct run_as_command_properties command_properties[] = {
                .use_cwd_fd = false,
        },
        {
-               .in_fds_offset = offsetof(struct run_as_data,
-                               u.extract_elf_symbol_offset.fd),
+               .in_fds_offset = offsetof(struct run_as_data, u.extract_elf_symbol_offset.fd),
                .out_fds_offset = -1,
                .in_fd_count = 1,
                .out_fd_count = 0,
                .use_cwd_fd = false,
        },
        {
-               .in_fds_offset = offsetof(struct run_as_data,
-                               u.extract_sdt_probe_offsets.fd),
+               .in_fds_offset = offsetof(struct run_as_data, u.extract_sdt_probe_offsets.fd),
                .out_fds_offset = -1,
                .in_fd_count = 1,
                .out_fd_count = 0,
@@ -336,7 +332,7 @@ const struct run_as_command_properties command_properties[] = {
 };
 
 struct run_as_worker_data {
-       pid_t pid;      /* Worker PID. */
+       pid_t pid; /* Worker PID. */
        int sockpair[2];
        char *procname;
 };
@@ -348,14 +344,12 @@ pthread_mutex_t worker_lock = PTHREAD_MUTEX_INITIALIZER;
 } /* namespace */
 
 #ifdef VALGRIND
-static
-int use_clone(void)
+static int use_clone(void)
 {
        return 0;
 }
 #else
-static
-int use_clone(void)
+static int use_clone(void)
 {
        return !lttng_secure_getenv("LTTNG_DEBUG_NOCLONE");
 }
@@ -364,8 +358,7 @@ int use_clone(void)
 /*
  * Create recursively directory using the FULL path.
  */
-static
-int _mkdirat_recursive(struct run_as_data *data, struct run_as_ret *ret_value)
+static int _mkdirat_recursive(struct run_as_data *data, struct run_as_ret *ret_value)
 {
        const char *path;
        mode_t mode;
@@ -384,8 +377,7 @@ int _mkdirat_recursive(struct run_as_data *data, struct run_as_ret *ret_value)
        /* Ownership of dirfd is transferred to the handle. */
        data->u.mkdir.dirfd = -1;
        /* Safe to call as we have transitioned to the requested uid/gid. */
-       ret_value->u.ret = lttng_directory_handle_create_subdirectory_recursive(
-                       handle, path, mode);
+       ret_value->u.ret = lttng_directory_handle_create_subdirectory_recursive(handle, path, mode);
        ret_value->_errno = errno;
        ret_value->_error = (ret_value->u.ret) ? true : false;
        lttng_directory_handle_put(handle);
@@ -393,8 +385,7 @@ end:
        return ret_value->u.ret;
 }
 
-static
-int _mkdirat(struct run_as_data *data, struct run_as_ret *ret_value)
+static int _mkdirat(struct run_as_data *data, struct run_as_ret *ret_value)
 {
        const char *path;
        mode_t mode;
@@ -413,8 +404,7 @@ int _mkdirat(struct run_as_data *data, struct run_as_ret *ret_value)
        /* Ownership of dirfd is transferred to the handle. */
        data->u.mkdir.dirfd = -1;
        /* Safe to call as we have transitioned to the requested uid/gid. */
-       ret_value->u.ret = lttng_directory_handle_create_subdirectory(
-                       handle, path, mode);
+       ret_value->u.ret = lttng_directory_handle_create_subdirectory(handle, path, mode);
        ret_value->_errno = errno;
        ret_value->_error = (ret_value->u.ret) ? true : false;
        lttng_directory_handle_put(handle);
@@ -422,8 +412,7 @@ end:
        return ret_value->u.ret;
 }
 
-static
-int _open(struct run_as_data *data, struct run_as_ret *ret_value)
+static int _open(struct run_as_data *data, struct run_as_ret *ret_value)
 {
        int fd;
        struct lttng_directory_handle *handle;
@@ -438,9 +427,8 @@ int _open(struct run_as_data *data, struct run_as_ret *ret_value)
        /* Ownership of dirfd is transferred to the handle. */
        data->u.open.dirfd = -1;
 
-       fd = lttng_directory_handle_open_file(handle,
-                       data->u.open.path, data->u.open.flags,
-                       data->u.open.mode);
+       fd = lttng_directory_handle_open_file(
+               handle, data->u.open.path, data->u.open.flags, data->u.open.mode);
        if (fd < 0) {
                ret_value->u.ret = -1;
                ret_value->u.open.fd = -1;
@@ -456,8 +444,7 @@ end:
        return ret_value->u.ret;
 }
 
-static
-int _unlink(struct run_as_data *data, struct run_as_ret *ret_value)
+static int _unlink(struct run_as_data *data, struct run_as_ret *ret_value)
 {
        struct lttng_directory_handle *handle;
 
@@ -472,8 +459,7 @@ int _unlink(struct run_as_data *data, struct run_as_ret *ret_value)
        /* Ownership of dirfd is transferred to the handle. */
        data->u.unlink.dirfd = -1;
 
-       ret_value->u.ret = lttng_directory_handle_unlink_file(handle,
-                       data->u.unlink.path);
+       ret_value->u.ret = lttng_directory_handle_unlink_file(handle, data->u.unlink.path);
        ret_value->_errno = errno;
        ret_value->_error = (ret_value->u.ret) ? true : false;
        lttng_directory_handle_put(handle);
@@ -481,8 +467,7 @@ end:
        return ret_value->u.ret;
 }
 
-static
-int _rmdir(struct run_as_data *data, struct run_as_ret *ret_value)
+static int _rmdir(struct run_as_data *data, struct run_as_ret *ret_value)
 {
        struct lttng_directory_handle *handle;
 
@@ -497,8 +482,7 @@ int _rmdir(struct run_as_data *data, struct run_as_ret *ret_value)
        /* Ownership of dirfd is transferred to the handle. */
        data->u.rmdir.dirfd = -1;
 
-       ret_value->u.ret = lttng_directory_handle_remove_subdirectory(
-                       handle, data->u.rmdir.path);
+       ret_value->u.ret = lttng_directory_handle_remove_subdirectory(handle, data->u.rmdir.path);
        ret_value->_errno = errno;
        ret_value->_error = (ret_value->u.ret) ? true : false;
        lttng_directory_handle_put(handle);
@@ -506,8 +490,7 @@ end:
        return ret_value->u.ret;
 }
 
-static
-int _rmdir_recursive(struct run_as_data *data, struct run_as_ret *ret_value)
+static int _rmdir_recursive(struct run_as_data *data, struct run_as_ret *ret_value)
 {
        struct lttng_directory_handle *handle;
 
@@ -523,7 +506,7 @@ int _rmdir_recursive(struct run_as_data *data, struct run_as_ret *ret_value)
        data->u.rmdir.dirfd = -1;
 
        ret_value->u.ret = lttng_directory_handle_remove_subdirectory_recursive(
-                       handle, data->u.rmdir.path, data->u.rmdir.flags);
+               handle, data->u.rmdir.path, data->u.rmdir.flags);
        ret_value->_errno = errno;
        ret_value->_error = (ret_value->u.ret) ? true : false;
        lttng_directory_handle_put(handle);
@@ -531,8 +514,7 @@ end:
        return ret_value->u.ret;
 }
 
-static
-int _rename(struct run_as_data *data, struct run_as_ret *ret_value)
+static int _rename(struct run_as_data *data, struct run_as_ret *ret_value)
 {
        const char *old_path, *new_path;
        struct lttng_directory_handle *old_handle = NULL, *new_handle = NULL;
@@ -540,14 +522,12 @@ int _rename(struct run_as_data *data, struct run_as_ret *ret_value)
        old_path = data->u.rename.old_path;
        new_path = data->u.rename.new_path;
 
-       old_handle = lttng_directory_handle_create_from_dirfd(
-                       data->u.rename.dirfds[0]);
+       old_handle = lttng_directory_handle_create_from_dirfd(data->u.rename.dirfds[0]);
        if (!old_handle) {
                ret_value->u.ret = -1;
                goto end;
        }
-       new_handle = lttng_directory_handle_create_from_dirfd(
-                       data->u.rename.dirfds[1]);
+       new_handle = lttng_directory_handle_create_from_dirfd(data->u.rename.dirfds[1]);
        if (!new_handle) {
                ret_value->u.ret = -1;
                goto end;
@@ -557,8 +537,8 @@ int _rename(struct run_as_data *data, struct run_as_ret *ret_value)
        data->u.rename.dirfds[0] = data->u.rename.dirfds[1] = -1;
 
        /* Safe to call as we have transitioned to the requested uid/gid. */
-       ret_value->u.ret = lttng_directory_handle_rename(
-                       old_handle, old_path, new_handle, new_path);
+       ret_value->u.ret =
+               lttng_directory_handle_rename(old_handle, old_path, new_handle, new_path);
 end:
        lttng_directory_handle_put(old_handle);
        lttng_directory_handle_put(new_handle);
@@ -568,17 +548,15 @@ end:
 }
 
 #ifdef HAVE_ELF_H
-static
-int _extract_elf_symbol_offset(struct run_as_data *data,
-               struct run_as_ret *ret_value)
+static int _extract_elf_symbol_offset(struct run_as_data *data, struct run_as_ret *ret_value)
 {
        int ret = 0;
        uint64_t offset;
 
        ret_value->_error = false;
        ret = lttng_elf_get_symbol_offset(data->u.extract_elf_symbol_offset.fd,
-                        data->u.extract_elf_symbol_offset.function,
-                        &offset);
+                                         data->u.extract_elf_symbol_offset.function,
+                                         &offset);
        if (ret) {
                DBG("Failed to extract ELF function offset");
                ret_value->_error = true;
@@ -588,9 +566,7 @@ int _extract_elf_symbol_offset(struct run_as_data *data,
        return ret;
 }
 
-static
-int _extract_sdt_probe_offsets(struct run_as_data *data,
-               struct run_as_ret *ret_value)
+static int _extract_sdt_probe_offsets(struct run_as_data *data, struct run_as_ret *ret_value)
 {
        int ret = 0;
        uint64_t *offsets = NULL;
@@ -599,11 +575,11 @@ int _extract_sdt_probe_offsets(struct run_as_data *data,
        ret_value->_error = false;
 
        /* On success, this call allocates the offsets paramater. */
-       ret = lttng_elf_get_sdt_probe_offsets(
-                       data->u.extract_sdt_probe_offsets.fd,
-                       data->u.extract_sdt_probe_offsets.provider_name,
-                       data->u.extract_sdt_probe_offsets.probe_name,
-                       &offsets, &num_offset);
+       ret = lttng_elf_get_sdt_probe_offsets(data->u.extract_sdt_probe_offsets.fd,
+                                             data->u.extract_sdt_probe_offsets.provider_name,
+                                             data->u.extract_sdt_probe_offsets.probe_name,
+                                             &offsets,
+                                             &num_offset);
 
        if (ret) {
                DBG("Failed to extract SDT probe offsets");
@@ -620,7 +596,8 @@ int _extract_sdt_probe_offsets(struct run_as_data *data,
 
        /* Copy the content of the offsets array to the ret struct. */
        memcpy(ret_value->u.extract_sdt_probe_offsets.offsets,
-                       offsets, num_offset * sizeof(uint64_t));
+              offsets,
+              num_offset * sizeof(uint64_t));
 
        ret_value->u.extract_sdt_probe_offsets.num_offset = num_offset;
 
@@ -630,28 +607,23 @@ end:
        return ret;
 }
 #else
-static
-int _extract_elf_symbol_offset(
-               struct run_as_data *data __attribute__((unused)),
-               struct run_as_ret *ret_value __attribute__((unused)))
+static int _extract_elf_symbol_offset(struct run_as_data *data __attribute__((unused)),
+                                     struct run_as_ret *ret_value __attribute__((unused)))
 {
        ERR("Unimplemented runas command RUN_AS_EXTRACT_ELF_SYMBOL_OFFSET");
        return -1;
 }
 
-static
-int _extract_sdt_probe_offsets(
-               struct run_as_data *data __attribute__((unused)),
-               struct run_as_ret *ret_value __attribute__((unused)))
+static int _extract_sdt_probe_offsets(struct run_as_data *data __attribute__((unused)),
+                                     struct run_as_ret *ret_value __attribute__((unused)))
 {
        ERR("Unimplemented runas command RUN_AS_EXTRACT_SDT_PROBE_OFFSETS");
        return -1;
 }
 #endif
 
-static
-int _generate_filter_bytecode(struct run_as_data *data,
-               struct run_as_ret *ret_value) {
+static int _generate_filter_bytecode(struct run_as_data *data, struct run_as_ret *ret_value)
+{
        int ret = 0;
        const char *filter_expression = NULL;
        struct filter_parser_ctx *ctx = NULL;
@@ -660,7 +632,8 @@ int _generate_filter_bytecode(struct run_as_data *data,
 
        filter_expression = data->u.generate_filter_bytecode.filter_expression;
 
-       if (lttng_strnlen(filter_expression, LTTNG_FILTER_MAX_LEN - 1) == LTTNG_FILTER_MAX_LEN - 1) {
+       if (lttng_strnlen(filter_expression, LTTNG_FILTER_MAX_LEN - 1) ==
+           LTTNG_FILTER_MAX_LEN - 1) {
                ret_value->_error = true;
                ret = -1;
                goto end;
@@ -673,14 +646,12 @@ int _generate_filter_bytecode(struct run_as_data *data,
                goto end;
        }
 
-       DBG("Size of bytecode generated: %u bytes.",
-                       bytecode_get_len(&ctx->bytecode->b));
+       DBG("Size of bytecode generated: %u bytes.", bytecode_get_len(&ctx->bytecode->b));
 
        /* Copy the lttng_bytecode_filter object to the return structure. */
        memcpy(ret_value->u.generate_filter_bytecode.bytecode,
-                       &ctx->bytecode->b,
-                       sizeof(ctx->bytecode->b) +
-                                       bytecode_get_len(&ctx->bytecode->b));
+              &ctx->bytecode->b,
+              sizeof(ctx->bytecode->b) + bytecode_get_len(&ctx->bytecode->b));
 
 end:
        if (ctx) {
@@ -691,8 +662,7 @@ end:
 
        return ret;
 }
-static
-run_as_fct run_as_enum_to_fct(enum run_as_cmd cmd)
+static run_as_fct run_as_enum_to_fct(enum run_as_cmd cmd)
 {
        switch (cmd) {
        case RUN_AS_MKDIR:
@@ -728,16 +698,14 @@ run_as_fct run_as_enum_to_fct(enum run_as_cmd cmd)
        }
 }
 
-static
-int do_send_fds(int sock, const int *fds, unsigned int fd_count)
+static int do_send_fds(int sock, const int *fds, unsigned int fd_count)
 {
        ssize_t len;
        unsigned int i;
 
        for (i = 0; i < fd_count; i++) {
                if (fds[i] < 0) {
-                       DBG("Attempt to send invalid file descriptor (fd = %i)",
-                                       fds[i]);
+                       DBG("Attempt to send invalid file descriptor (fd = %i)", fds[i]);
                        /* Return 0 as this is not a fatal error. */
                        return 0;
                }
@@ -747,8 +715,7 @@ int do_send_fds(int sock, const int *fds, unsigned int fd_count)
        return len < 0 ? -1 : 0;
 }
 
-static
-int do_recv_fds(int sock, int *fds, unsigned int fd_count)
+static int do_recv_fds(int sock, int *fds, unsigned int fd_count)
 {
        int ret = 0;
        unsigned int i;
@@ -774,9 +741,7 @@ end:
        return ret;
 }
 
-static
-int send_fds_to_worker(const run_as_worker_data *worker,
-               const struct run_as_data *data)
+static int send_fds_to_worker(const run_as_worker_data *worker, const struct run_as_data *data)
 {
        int ret = 0;
        unsigned int i;
@@ -788,14 +753,13 @@ int send_fds_to_worker(const run_as_worker_data *worker,
        for (i = 0; i < COMMAND_IN_FD_COUNT(data); i++) {
                if (COMMAND_IN_FDS(data)[i] < 0) {
                        ERR("Refusing to send invalid fd to worker (fd = %i)",
-                                       COMMAND_IN_FDS(data)[i]);
+                           COMMAND_IN_FDS(data)[i]);
                        ret = -1;
                        goto end;
                }
        }
 
-       ret = do_send_fds(worker->sockpair[0], COMMAND_IN_FDS(data),
-                       COMMAND_IN_FD_COUNT(data));
+       ret = do_send_fds(worker->sockpair[0], COMMAND_IN_FDS(data), COMMAND_IN_FD_COUNT(data));
        if (ret < 0) {
                PERROR("Failed to send file descriptor to run-as worker");
                ret = -1;
@@ -805,9 +769,8 @@ end:
        return ret;
 }
 
-static
-int send_fds_to_master(run_as_worker_data *worker, enum run_as_cmd cmd,
-               struct run_as_ret *run_as_ret)
+static int
+send_fds_to_master(run_as_worker_data *worker, enum run_as_cmd cmd, struct run_as_ret *run_as_ret)
 {
        int ret = 0;
        unsigned int i;
@@ -816,8 +779,8 @@ int send_fds_to_master(run_as_worker_data *worker, enum run_as_cmd cmd,
                goto end;
        }
 
-       ret = do_send_fds(worker->sockpair[1], COMMAND_OUT_FDS(cmd, run_as_ret),
-                       COMMAND_OUT_FD_COUNT(cmd));
+       ret = do_send_fds(
+               worker->sockpair[1], COMMAND_OUT_FDS(cmd, run_as_ret), COMMAND_OUT_FD_COUNT(cmd));
        if (ret < 0) {
                PERROR("Failed to send file descriptor to master process");
                goto end;
@@ -829,8 +792,7 @@ int send_fds_to_master(run_as_worker_data *worker, enum run_as_cmd cmd,
                        int ret_close = close(fd);
 
                        if (ret_close < 0) {
-                               PERROR("Failed to close result file descriptor (fd = %i)",
-                                               fd);
+                               PERROR("Failed to close result file descriptor (fd = %i)", fd);
                        }
                }
        }
@@ -838,9 +800,9 @@ end:
        return ret;
 }
 
-static
-int recv_fds_from_worker(const run_as_worker_data *worker, enum run_as_cmd cmd,
-               struct run_as_ret *run_as_ret)
+static int recv_fds_from_worker(const run_as_worker_data *worker,
+                               enum run_as_cmd cmd,
+                               struct run_as_ret *run_as_ret)
 {
        int ret = 0;
 
@@ -848,8 +810,8 @@ int recv_fds_from_worker(const run_as_worker_data *worker, enum run_as_cmd cmd,
                goto end;
        }
 
-       ret = do_recv_fds(worker->sockpair[0], COMMAND_OUT_FDS(cmd, run_as_ret),
-                       COMMAND_OUT_FD_COUNT(cmd));
+       ret = do_recv_fds(
+               worker->sockpair[0], COMMAND_OUT_FDS(cmd, run_as_ret), COMMAND_OUT_FD_COUNT(cmd));
        if (ret < 0) {
                PERROR("Failed to receive file descriptor from run-as worker");
                ret = -1;
@@ -858,8 +820,7 @@ end:
        return ret;
 }
 
-static
-int recv_fds_from_master(run_as_worker_data *worker, struct run_as_data *data)
+static int recv_fds_from_master(run_as_worker_data *worker, struct run_as_data *data)
 {
        int ret = 0;
 
@@ -876,8 +837,7 @@ int recv_fds_from_master(run_as_worker_data *worker, struct run_as_data *data)
                goto end;
        }
 
-       ret = do_recv_fds(worker->sockpair[1], COMMAND_IN_FDS(data),
-                       COMMAND_IN_FD_COUNT(data));
+       ret = do_recv_fds(worker->sockpair[1], COMMAND_IN_FDS(data), COMMAND_IN_FD_COUNT(data));
        if (ret < 0) {
                PERROR("Failed to receive file descriptors from master process");
                ret = -1;
@@ -886,8 +846,7 @@ end:
        return ret;
 }
 
-static
-int cleanup_received_fds(struct run_as_data *data)
+static int cleanup_received_fds(struct run_as_data *data)
 {
        int ret = 0, i;
 
@@ -905,8 +864,7 @@ end:
        return ret;
 }
 
-static int get_user_infos_from_uid(
-               uid_t uid, char **username, gid_t *primary_gid)
+static int get_user_infos_from_uid(uid_t uid, char **username, gid_t *primary_gid)
 {
        int ret;
        char *buf = NULL;
@@ -926,7 +884,7 @@ static int get_user_infos_from_uid(
 
                /* Limit is indeterminate. */
                WARN("Failed to query _SC_GETPW_R_SIZE_MAX as it is "
-                       "indeterminate; falling back to default buffer size");
+                    "indeterminate; falling back to default buffer size");
                raw_get_pw_buf_size = GETPW_BUFFER_FALLBACK_SIZE;
        }
 
@@ -940,14 +898,12 @@ static int get_user_infos_from_uid(
 
        ret = getpwuid_r(uid, &pwd, buf, get_pw_buf_size, &result);
        if (ret < 0) {
-               PERROR("Failed to get user information for user:  uid = %d",
-                               (int) uid);
+               PERROR("Failed to get user information for user:  uid = %d", (int) uid);
                goto error;
        }
 
        if (result == NULL) {
-               ERR("Failed to find user information in password entries: uid = %d",
-                               (int) uid);
+               ERR("Failed to find user information in password entries: uid = %d", (int) uid);
                ret = -1;
                goto error;
        }
@@ -970,8 +926,7 @@ error:
        goto end;
 }
 
-static int demote_creds(
-               uid_t prev_uid, gid_t prev_gid, uid_t new_uid, gid_t new_gid)
+static int demote_creds(uid_t prev_uid, gid_t prev_gid, uid_t new_uid, gid_t new_gid)
 {
        int ret = 0;
        gid_t primary_gid;
@@ -981,8 +936,7 @@ static int demote_creds(
        if (prev_gid != new_gid) {
                ret = setegid(new_gid);
                if (ret < 0) {
-                       PERROR("Failed to set effective group id: new_gid = %d",
-                                       (int) new_gid);
+                       PERROR("Failed to set effective group id: new_gid = %d", (int) new_gid);
                        goto end;
                }
        }
@@ -1022,15 +976,15 @@ static int demote_creds(
                ret = initgroups(username, primary_gid);
                if (ret < 0) {
                        PERROR("Failed to init the supplementary group access list: "
-                                       "username = `%s`, primary gid = %d", username,
-                                       (int) primary_gid);
+                              "username = `%s`, primary gid = %d",
+                              username,
+                              (int) primary_gid);
                        goto end;
                }
 
                ret = seteuid(new_uid);
                if (ret < 0) {
-                       PERROR("Failed to set effective user id: new_uid = %d",
-                                       (int) new_uid);
+                       PERROR("Failed to set effective user id: new_uid = %d", (int) new_uid);
                        goto end;
                }
        }
@@ -1039,8 +993,7 @@ end:
        return ret;
 }
 
-static int promote_creds(
-               uid_t prev_uid, gid_t prev_gid, uid_t new_uid, gid_t new_gid)
+static int promote_creds(uid_t prev_uid, gid_t prev_gid, uid_t new_uid, gid_t new_gid)
 {
        int ret = 0;
        gid_t primary_gid;
@@ -1050,8 +1003,7 @@ static int promote_creds(
        if (prev_gid != new_gid) {
                ret = setegid(new_gid);
                if (ret < 0) {
-                       PERROR("Failed to set effective group id: new_gid = %d",
-                                       (int) new_gid);
+                       PERROR("Failed to set effective group id: new_gid = %d", (int) new_gid);
                        goto end;
                }
        }
@@ -1069,8 +1021,7 @@ static int promote_creds(
                 */
                ret = seteuid(new_uid);
                if (ret < 0) {
-                       PERROR("Failed to set effective user id: new_uid = %d",
-                                       (int) new_uid);
+                       PERROR("Failed to set effective user id: new_uid = %d", (int) new_uid);
                        goto end;
                }
 
@@ -1086,8 +1037,9 @@ static int promote_creds(
                ret = initgroups(username, primary_gid);
                if (ret < 0) {
                        PERROR("Failed to init the supplementary group access "
-                                       "list: username = `%s`, primary gid = %d",
-                                       username, (int) primary_gid)
+                              "list: username = `%s`, primary gid = %d",
+                              username,
+                              (int) primary_gid)
                        goto end;
                }
        }
@@ -1099,8 +1051,7 @@ end:
 /*
  * Return < 0 on error, 0 if OK, 1 on hangup.
  */
-static
-int handle_one_cmd(run_as_worker_data *worker)
+static int handle_one_cmd(run_as_worker_data *worker)
 {
        int ret = 0, promote_ret;
        struct run_as_data data = {};
@@ -1115,8 +1066,7 @@ int handle_one_cmd(run_as_worker_data *worker)
         * The structure contains the command type and all the parameters needed for
         * its execution
         */
-       readlen = lttcomm_recv_unix_sock(worker->sockpair[1], &data,
-                       sizeof(data));
+       readlen = lttcomm_recv_unix_sock(worker->sockpair[1], &data, sizeof(data));
        if (readlen == 0) {
                /* hang up */
                ret = 1;
@@ -1175,8 +1125,7 @@ write_return:
         * Stage 4: Send run_as_ret structure to the master.
         * This structure contain the return value of the command and the errno.
         */
-       writelen = lttcomm_send_unix_sock(worker->sockpair[1], &sendret,
-                       sizeof(sendret));
+       writelen = lttcomm_send_unix_sock(worker->sockpair[1], &sendret, sizeof(sendret));
        if (writelen < sizeof(sendret)) {
                PERROR("lttcomm_send_unix_sock error");
                ret = -1;
@@ -1204,8 +1153,7 @@ end:
        return ret;
 }
 
-static
-int run_as_worker(run_as_worker_data *worker)
+static int run_as_worker(run_as_worker_data *worker)
 {
        int ret;
        ssize_t writelen;
@@ -1227,8 +1175,7 @@ int run_as_worker(run_as_worker_data *worker)
 
        memset(&sendret, 0, sizeof(sendret));
 
-       writelen = lttcomm_send_unix_sock(worker->sockpair[1], &sendret,
-                       sizeof(sendret));
+       writelen = lttcomm_send_unix_sock(worker->sockpair[1], &sendret, sizeof(sendret));
        if (writelen < sizeof(sendret)) {
                PERROR("lttcomm_send_unix_sock error");
                ret = EXIT_FAILURE;
@@ -1243,7 +1190,7 @@ int run_as_worker(run_as_worker_data *worker)
                } else if (ret > 0) {
                        break;
                } else {
-                       continue;       /* Next command. */
+                       continue; /* Next command. */
                }
        }
        ret = EXIT_SUCCESS;
@@ -1251,12 +1198,12 @@ end:
        return ret;
 }
 
-static
-int run_as_cmd(run_as_worker_data *worker,
-               enum run_as_cmd cmd,
-               struct run_as_data *data,
-               struct run_as_ret *ret_value,
-               uid_t uid, gid_t gid)
+static int run_as_cmd(run_as_worker_data *worker,
+                     enum run_as_cmd cmd,
+                     struct run_as_data *data,
+                     struct run_as_ret *ret_value,
+                     uid_t uid,
+                     gid_t gid)
 {
        int ret = 0;
        ssize_t readlen, writelen;
@@ -1269,7 +1216,8 @@ int run_as_cmd(run_as_worker_data *worker,
                        ret = -1;
                        ret_value->_errno = EPERM;
                        ERR("Client (%d)/Server (%d) UID mismatch (and sessiond is not root)",
-                               (int) uid, (int) geteuid());
+                           (int) uid,
+                           (int) geteuid());
                        goto end;
                }
        }
@@ -1281,8 +1229,7 @@ int run_as_cmd(run_as_worker_data *worker,
        /*
         * Stage 1: Send the run_as_data struct to the worker process
         */
-       writelen = lttcomm_send_unix_sock(worker->sockpair[0], data,
-                       sizeof(*data));
+       writelen = lttcomm_send_unix_sock(worker->sockpair[0], data, sizeof(*data));
        if (writelen < sizeof(*data)) {
                PERROR("Error writing message to run_as");
                ret = -1;
@@ -1309,8 +1256,7 @@ int run_as_cmd(run_as_worker_data *worker,
         * Stage 4: Receive the run_as_ret struct containing the return value and
         * errno
         */
-       readlen = lttcomm_recv_unix_sock(worker->sockpair[0], ret_value,
-                       sizeof(*ret_value));
+       readlen = lttcomm_recv_unix_sock(worker->sockpair[0], ret_value, sizeof(*ret_value));
        if (!readlen) {
                ERR("Run-as worker has hung-up during run_as_cmd");
                ret = -1;
@@ -1345,10 +1291,11 @@ end:
 /*
  * This is for debugging ONLY and should not be considered secure.
  */
-static
-int run_as_noworker(enum run_as_cmd cmd,
-               struct run_as_data *data, struct run_as_ret *ret_value,
-               uid_t uid __attribute__((unused)), gid_t gid __attribute__((unused)))
+static int run_as_noworker(enum run_as_cmd cmd,
+                          struct run_as_data *data,
+                          struct run_as_ret *ret_value,
+                          uid_t uid __attribute__((unused)),
+                          gid_t gid __attribute__((unused)))
 {
        int ret, saved_errno;
        mode_t old_mask;
@@ -1369,8 +1316,7 @@ end:
        return ret;
 }
 
-static
-int reset_sighandler(void)
+static int reset_sighandler(void)
 {
        int sig;
 
@@ -1381,8 +1327,7 @@ int reset_sighandler(void)
        return 0;
 }
 
-static
-void worker_sighandler(int sig)
+static void worker_sighandler(int sig)
 {
        const char *signame;
 
@@ -1410,8 +1355,7 @@ void worker_sighandler(int sig)
        }
 }
 
-static
-int set_worker_sighandlers(void)
+static int set_worker_sighandlers(void)
 {
        int ret = 0;
        sigset_t sigset;
@@ -1440,10 +1384,9 @@ end:
        return ret;
 }
 
-static
-int run_as_create_worker_no_lock(const char *procname,
-               post_fork_cleanup_cb clean_up_func,
-               void *clean_up_user_data)
+static int run_as_create_worker_no_lock(const char *procname,
+                                       post_fork_cleanup_cb clean_up_func,
+                                       void *clean_up_user_data)
 {
        pid_t pid;
        int i, ret = 0;
@@ -1537,8 +1480,7 @@ int run_as_create_worker_no_lock(const char *procname,
                worker->sockpair[1] = -1;
                worker->pid = pid;
                /* Wait for worker to become ready. */
-               readlen = lttcomm_recv_unix_sock(worker->sockpair[0],
-                               &recvret, sizeof(recvret));
+               readlen = lttcomm_recv_unix_sock(worker->sockpair[0], &recvret, sizeof(recvret));
                if (readlen < sizeof(recvret)) {
                        ERR("readlen: %zd", readlen);
                        PERROR("Error reading response from run_as at creation");
@@ -1568,8 +1510,7 @@ error_procname_alloc:
        return ret;
 }
 
-static
-void run_as_destroy_worker_no_lock(void)
+static void run_as_destroy_worker_no_lock(void)
 {
        run_as_worker_data *worker = global_worker;
 
@@ -1599,12 +1540,12 @@ void run_as_destroy_worker_no_lock(void)
 
                if (WIFEXITED(status)) {
                        LOG(WEXITSTATUS(status) == 0 ? PRINT_DBG : PRINT_ERR,
-                                       DEFAULT_RUN_AS_WORKER_NAME " terminated with status code %d",
-                                       WEXITSTATUS(status));
+                           DEFAULT_RUN_AS_WORKER_NAME " terminated with status code %d",
+                           WEXITSTATUS(status));
                        break;
                } else if (WIFSIGNALED(status)) {
                        ERR(DEFAULT_RUN_AS_WORKER_NAME " was killed by signal %d",
-                                       WTERMSIG(status));
+                           WTERMSIG(status));
                        break;
                }
        }
@@ -1613,8 +1554,7 @@ void run_as_destroy_worker_no_lock(void)
        global_worker = NULL;
 }
 
-static
-int run_as_restart_worker(run_as_worker_data *worker)
+static int run_as_restart_worker(run_as_worker_data *worker)
 {
        int ret = 0;
        char *procname = NULL;
@@ -1626,7 +1566,7 @@ int run_as_restart_worker(run_as_worker_data *worker)
 
        /* Create a new run_as worker process*/
        ret = run_as_create_worker_no_lock(procname, NULL, NULL);
-       if (ret < 0 ) {
+       if (ret < 0) {
                ERR("Restarting the worker process failed");
                ret = -1;
                goto err;
@@ -1635,9 +1575,11 @@ err:
        return ret;
 }
 
-static
-int run_as(enum run_as_cmd cmd, struct run_as_data *data,
-                  struct run_as_ret *ret_value, uid_t uid, gid_t gid)
+static int run_as(enum run_as_cmd cmd,
+                 struct run_as_data *data,
+                 struct run_as_ret *ret_value,
+                 uid_t uid,
+                 gid_t gid)
 {
        int ret, saved_errno;
 
@@ -1656,7 +1598,7 @@ int run_as(enum run_as_cmd cmd, struct run_as_data *data,
                 */
                if (ret == -1 && saved_errno == EIO) {
                        DBG("Socket closed unexpectedly... "
-                                       "Restarting the worker process");
+                           "Restarting the worker process");
                        ret = run_as_restart_worker(global_worker);
                        if (ret == -1) {
                                ERR("Failed to restart worker process.");
@@ -1677,18 +1619,20 @@ int run_as_mkdir_recursive(const char *path, mode_t mode, uid_t uid, gid_t gid)
        return run_as_mkdirat_recursive(AT_FDCWD, path, mode, uid, gid);
 }
 
-int run_as_mkdirat_recursive(int dirfd, const char *path, mode_t mode,
-               uid_t uid, gid_t gid)
+int run_as_mkdirat_recursive(int dirfd, const char *path, mode_t mode, uid_t uid, gid_t gid)
 {
        int ret;
        struct run_as_data data = {};
        struct run_as_ret run_as_ret = {};
 
        DBG3("mkdirat() recursive fd = %d%s, path = %s, mode = %d, uid = %d, gid = %d",
-                       dirfd, dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
-                       path, (int) mode, (int) uid, (int) gid);
-       ret = lttng_strncpy(data.u.mkdir.path, path,
-                       sizeof(data.u.mkdir.path));
+            dirfd,
+            dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
+            path,
+            (int) mode,
+            (int) uid,
+            (int) gid);
+       ret = lttng_strncpy(data.u.mkdir.path, path, sizeof(data.u.mkdir.path));
        if (ret) {
                ERR("Failed to copy path argument of mkdirat recursive command");
                goto error;
@@ -1697,7 +1641,10 @@ int run_as_mkdirat_recursive(int dirfd, const char *path, mode_t mode,
        data.u.mkdir.mode = mode;
        data.u.mkdir.dirfd = dirfd;
        run_as(dirfd == AT_FDCWD ? RUN_AS_MKDIR_RECURSIVE : RUN_AS_MKDIRAT_RECURSIVE,
-                       &data, &run_as_ret, uid, gid);
+              &data,
+              &run_as_ret,
+              uid,
+              gid);
        errno = run_as_ret._errno;
        ret = run_as_ret.u.ret;
 error:
@@ -1709,18 +1656,20 @@ int run_as_mkdir(const char *path, mode_t mode, uid_t uid, gid_t gid)
        return run_as_mkdirat(AT_FDCWD, path, mode, uid, gid);
 }
 
-int run_as_mkdirat(int dirfd, const char *path, mode_t mode,
-               uid_t uid, gid_t gid)
+int run_as_mkdirat(int dirfd, const char *path, mode_t mode, uid_t uid, gid_t gid)
 {
        int ret;
        struct run_as_data data = {};
        struct run_as_ret run_as_ret = {};
 
        DBG3("mkdirat() recursive fd = %d%s, path = %s, mode = %d, uid = %d, gid = %d",
-                       dirfd, dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
-                       path, (int) mode, (int) uid, (int) gid);
-       ret = lttng_strncpy(data.u.mkdir.path, path,
-                       sizeof(data.u.mkdir.path));
+            dirfd,
+            dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
+            path,
+            (int) mode,
+            (int) uid,
+            (int) gid);
+       ret = lttng_strncpy(data.u.mkdir.path, path, sizeof(data.u.mkdir.path));
        if (ret) {
                ERR("Failed to copy path argument of mkdirat command");
                goto error;
@@ -1728,30 +1677,32 @@ int run_as_mkdirat(int dirfd, const char *path, mode_t mode,
        data.u.mkdir.path[sizeof(data.u.mkdir.path) - 1] = '\0';
        data.u.mkdir.mode = mode;
        data.u.mkdir.dirfd = dirfd;
-       run_as(dirfd == AT_FDCWD ? RUN_AS_MKDIR : RUN_AS_MKDIRAT,
-                       &data, &run_as_ret, uid, gid);
+       run_as(dirfd == AT_FDCWD ? RUN_AS_MKDIR : RUN_AS_MKDIRAT, &data, &run_as_ret, uid, gid);
        errno = run_as_ret._errno;
        ret = run_as_ret.u.ret;
 error:
        return ret;
 }
 
-int run_as_open(const char *path, int flags, mode_t mode, uid_t uid,
-               gid_t gid)
+int run_as_open(const char *path, int flags, mode_t mode, uid_t uid, gid_t gid)
 {
        return run_as_openat(AT_FDCWD, path, flags, mode, uid, gid);
 }
 
-int run_as_openat(int dirfd, const char *path, int flags, mode_t mode,
-               uid_t uid, gid_t gid)
+int run_as_openat(int dirfd, const char *path, int flags, mode_t mode, uid_t uid, gid_t gid)
 {
        int ret;
        struct run_as_data data = {};
        struct run_as_ret run_as_ret = {};
 
        DBG3("openat() fd = %d%s, path = %s, flags = %X, mode = %d, uid %d, gid %d",
-                       dirfd, dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
-                       path, flags, (int) mode, (int) uid, (int) gid);
+            dirfd,
+            dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
+            path,
+            flags,
+            (int) mode,
+            (int) uid,
+            (int) gid);
        ret = lttng_strncpy(data.u.open.path, path, sizeof(data.u.open.path));
        if (ret) {
                ERR("Failed to copy path argument of open command");
@@ -1760,11 +1711,9 @@ int run_as_openat(int dirfd, const char *path, int flags, mode_t mode,
        data.u.open.flags = flags;
        data.u.open.mode = mode;
        data.u.open.dirfd = dirfd;
-       run_as(dirfd == AT_FDCWD ? RUN_AS_OPEN : RUN_AS_OPENAT,
-                       &data, &run_as_ret, uid, gid);
+       run_as(dirfd == AT_FDCWD ? RUN_AS_OPEN : RUN_AS_OPENAT, &data, &run_as_ret, uid, gid);
        errno = run_as_ret._errno;
-       ret = run_as_ret.u.ret < 0 ? run_as_ret.u.ret :
-                       run_as_ret.u.open.fd;
+       ret = run_as_ret.u.ret < 0 ? run_as_ret.u.ret : run_as_ret.u.open.fd;
 error:
        return ret;
 }
@@ -1781,16 +1730,17 @@ int run_as_unlinkat(int dirfd, const char *path, uid_t uid, gid_t gid)
        struct run_as_ret run_as_ret = {};
 
        DBG3("unlinkat() fd = %d%s, path = %s, uid = %d, gid = %d",
-                       dirfd, dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
-                       path, (int) uid, (int) gid);
-       ret = lttng_strncpy(data.u.unlink.path, path,
-                       sizeof(data.u.unlink.path));
+            dirfd,
+            dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
+            path,
+            (int) uid,
+            (int) gid);
+       ret = lttng_strncpy(data.u.unlink.path, path, sizeof(data.u.unlink.path));
        if (ret) {
                goto error;
        }
        data.u.unlink.dirfd = dirfd;
-       run_as(dirfd == AT_FDCWD ? RUN_AS_UNLINK : RUN_AS_UNLINKAT, &data,
-                       &run_as_ret, uid, gid);
+       run_as(dirfd == AT_FDCWD ? RUN_AS_UNLINK : RUN_AS_UNLINKAT, &data, &run_as_ret, uid, gid);
        errno = run_as_ret._errno;
        ret = run_as_ret.u.ret;
 error:
@@ -1809,16 +1759,17 @@ int run_as_rmdirat(int dirfd, const char *path, uid_t uid, gid_t gid)
        struct run_as_ret run_as_ret = {};
 
        DBG3("rmdirat() fd = %d%s, path = %s, uid = %d, gid = %d",
-                       dirfd, dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
-                       path, (int) uid, (int) gid);
-       ret = lttng_strncpy(data.u.rmdir.path, path,
-                       sizeof(data.u.rmdir.path));
+            dirfd,
+            dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
+            path,
+            (int) uid,
+            (int) gid);
+       ret = lttng_strncpy(data.u.rmdir.path, path, sizeof(data.u.rmdir.path));
        if (ret) {
                goto error;
        }
        data.u.rmdir.dirfd = dirfd;
-       run_as(dirfd == AT_FDCWD ? RUN_AS_RMDIR : RUN_AS_RMDIRAT, &data,
-                       &run_as_ret, uid, gid);
+       run_as(dirfd == AT_FDCWD ? RUN_AS_RMDIR : RUN_AS_RMDIRAT, &data, &run_as_ret, uid, gid);
        errno = run_as_ret._errno;
        ret = run_as_ret.u.ret;
 error:
@@ -1837,17 +1788,22 @@ int run_as_rmdirat_recursive(int dirfd, const char *path, uid_t uid, gid_t gid,
        struct run_as_ret run_as_ret = {};
 
        DBG3("rmdirat() recursive fd = %d%s, path = %s, uid = %d, gid = %d",
-                       dirfd, dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
-                       path, (int) uid, (int) gid);
-       ret = lttng_strncpy(data.u.rmdir.path, path,
-                       sizeof(data.u.rmdir.path));
+            dirfd,
+            dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
+            path,
+            (int) uid,
+            (int) gid);
+       ret = lttng_strncpy(data.u.rmdir.path, path, sizeof(data.u.rmdir.path));
        if (ret) {
                goto error;
        }
        data.u.rmdir.dirfd = dirfd;
        data.u.rmdir.flags = flags;
        run_as(dirfd == AT_FDCWD ? RUN_AS_RMDIR_RECURSIVE : RUN_AS_RMDIRAT_RECURSIVE,
-                       &data, &run_as_ret, uid, gid);
+              &data,
+              &run_as_ret,
+              uid,
+              gid);
        errno = run_as_ret._errno;
        ret = run_as_ret.u.ret;
 error:
@@ -1859,58 +1815,69 @@ int run_as_rename(const char *old_name, const char *new_name, uid_t uid, gid_t g
        return run_as_renameat(AT_FDCWD, old_name, AT_FDCWD, new_name, uid, gid);
 }
 
-int run_as_renameat(int old_dirfd, const char *old_name,
-               int new_dirfd, const char *new_name, uid_t uid, gid_t gid)
+int run_as_renameat(int old_dirfd,
+                   const char *old_name,
+                   int new_dirfd,
+                   const char *new_name,
+                   uid_t uid,
+                   gid_t gid)
 {
        int ret;
        struct run_as_data data = {};
        struct run_as_ret run_as_ret = {};
 
        DBG3("renameat() old_dirfd = %d%s, old_name = %s, new_dirfd = %d%s, new_name = %s, uid = %d, gid = %d",
-                       old_dirfd, old_dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
-                       old_name,
-                       new_dirfd, new_dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
-                       new_name, (int) uid, (int) gid);
-       ret = lttng_strncpy(data.u.rename.old_path, old_name,
-                       sizeof(data.u.rename.old_path));
+            old_dirfd,
+            old_dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
+            old_name,
+            new_dirfd,
+            new_dirfd == AT_FDCWD ? " (AT_FDCWD)" : "",
+            new_name,
+            (int) uid,
+            (int) gid);
+       ret = lttng_strncpy(data.u.rename.old_path, old_name, sizeof(data.u.rename.old_path));
        if (ret) {
                goto error;
        }
-       ret = lttng_strncpy(data.u.rename.new_path, new_name,
-                       sizeof(data.u.rename.new_path));
+       ret = lttng_strncpy(data.u.rename.new_path, new_name, sizeof(data.u.rename.new_path));
        if (ret) {
                goto error;
        }
 
        data.u.rename.dirfds[0] = old_dirfd;
        data.u.rename.dirfds[1] = new_dirfd;
-       run_as(old_dirfd == AT_FDCWD && new_dirfd == AT_FDCWD ?
-                       RUN_AS_RENAME : RUN_AS_RENAMEAT,
-                       &data, &run_as_ret, uid, gid);
+       run_as(old_dirfd == AT_FDCWD && new_dirfd == AT_FDCWD ? RUN_AS_RENAME : RUN_AS_RENAMEAT,
+              &data,
+              &run_as_ret,
+              uid,
+              gid);
        errno = run_as_ret._errno;
        ret = run_as_ret.u.ret;
 error:
        return ret;
 }
 
-int run_as_extract_elf_symbol_offset(int fd, const char* function,
-               uid_t uid, gid_t gid, uint64_t *offset)
+int run_as_extract_elf_symbol_offset(
+       int fd, const char *function, uid_t uid, gid_t gid, uint64_t *offset)
 {
        int ret;
        struct run_as_data data = {};
        struct run_as_ret run_as_ret = {};
 
        DBG3("extract_elf_symbol_offset() on fd=%d and function=%s "
-                       "with for uid %d and gid %d", fd, function,
-                       (int) uid, (int) gid);
+            "with for uid %d and gid %d",
+            fd,
+            function,
+            (int) uid,
+            (int) gid);
 
        data.u.extract_elf_symbol_offset.fd = fd;
 
        strncpy(data.u.extract_elf_symbol_offset.function, function, LTTNG_SYMBOL_NAME_LEN - 1);
        data.u.extract_elf_symbol_offset.function[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
        ret = lttng_strncpy(data.u.extract_elf_symbol_offset.function,
-                       function,
-                       sizeof(data.u.extract_elf_symbol_offset.function));
+                           function,
+                           sizeof(data.u.extract_elf_symbol_offset.function));
        if (ret) {
                goto error;
        }
@@ -1927,28 +1894,37 @@ error:
        return ret;
 }
 
-int run_as_extract_sdt_probe_offsets(int fd, const char* provider_name,
-               const char* probe_name, uid_t uid, gid_t gid,
-               uint64_t **offsets, uint32_t *num_offset)
+int run_as_extract_sdt_probe_offsets(int fd,
+                                    const char *provider_name,
+                                    const char *probe_name,
+                                    uid_t uid,
+                                    gid_t gid,
+                                    uint64_t **offsets,
+                                    uint32_t *num_offset)
 {
        int ret;
        struct run_as_data data = {};
        struct run_as_ret run_as_ret = {};
 
        DBG3("extract_sdt_probe_offsets() on fd=%d, probe_name=%s and "
-                       "provider_name=%s with for uid %d and gid %d", fd,
-                       probe_name, provider_name, (int) uid, (int) gid);
+            "provider_name=%s with for uid %d and gid %d",
+            fd,
+            probe_name,
+            provider_name,
+            (int) uid,
+            (int) gid);
 
        data.u.extract_sdt_probe_offsets.fd = fd;
 
-       ret = lttng_strncpy(data.u.extract_sdt_probe_offsets.probe_name, probe_name,
-                       sizeof(data.u.extract_sdt_probe_offsets.probe_name));
+       ret = lttng_strncpy(data.u.extract_sdt_probe_offsets.probe_name,
+                           probe_name,
+                           sizeof(data.u.extract_sdt_probe_offsets.probe_name));
        if (ret) {
                goto error;
        }
        ret = lttng_strncpy(data.u.extract_sdt_probe_offsets.provider_name,
-                       provider_name,
-                       sizeof(data.u.extract_sdt_probe_offsets.provider_name));
+                           provider_name,
+                           sizeof(data.u.extract_sdt_probe_offsets.provider_name));
        if (ret) {
                goto error;
        }
@@ -1967,15 +1943,16 @@ int run_as_extract_sdt_probe_offsets(int fd, const char* provider_name,
                goto error;
        }
 
-       memcpy(*offsets, run_as_ret.u.extract_sdt_probe_offsets.offsets,
-                       *num_offset * sizeof(uint64_t));
+       memcpy(*offsets,
+              run_as_ret.u.extract_sdt_probe_offsets.offsets,
+              *num_offset * sizeof(uint64_t));
 error:
        return ret;
 }
 
 int run_as_generate_filter_bytecode(const char *filter_expression,
-               const struct lttng_credentials *creds,
-               struct lttng_bytecode **bytecode)
+                                   const struct lttng_credentials *creds,
+                                   struct lttng_bytecode **bytecode)
 {
        int ret;
        struct run_as_data data = {};
@@ -1986,10 +1963,13 @@ int run_as_generate_filter_bytecode(const char *filter_expression,
        const gid_t gid = lttng_credentials_get_gid(creds);
 
        DBG3("generate_filter_bytecode() from expression=\"%s\" for uid %d and gid %d",
-                       filter_expression, (int) uid, (int) gid);
+            filter_expression,
+            (int) uid,
+            (int) gid);
 
-       ret = lttng_strncpy(data.u.generate_filter_bytecode.filter_expression, filter_expression,
-                       sizeof(data.u.generate_filter_bytecode.filter_expression));
+       ret = lttng_strncpy(data.u.generate_filter_bytecode.filter_expression,
+                           filter_expression,
+                           sizeof(data.u.generate_filter_bytecode.filter_expression));
        if (ret) {
                goto error;
        }
@@ -2001,7 +1981,8 @@ int run_as_generate_filter_bytecode(const char *filter_expression,
                goto error;
        }
 
-       view_bytecode = (const struct lttng_bytecode *) run_as_ret.u.generate_filter_bytecode.bytecode;
+       view_bytecode =
+               (const struct lttng_bytecode *) run_as_ret.u.generate_filter_bytecode.bytecode;
 
        local_bytecode = calloc<lttng_bytecode>(view_bytecode->len);
        if (!local_bytecode) {
@@ -2009,22 +1990,22 @@ int run_as_generate_filter_bytecode(const char *filter_expression,
                goto error;
        }
 
-       memcpy(local_bytecode, run_as_ret.u.generate_filter_bytecode.bytecode,
-                       sizeof(*local_bytecode) + view_bytecode->len);
+       memcpy(local_bytecode,
+              run_as_ret.u.generate_filter_bytecode.bytecode,
+              sizeof(*local_bytecode) + view_bytecode->len);
        *bytecode = local_bytecode;
 error:
        return ret;
 }
 
 int run_as_create_worker(const char *procname,
-               post_fork_cleanup_cb clean_up_func,
-               void *clean_up_user_data)
+                        post_fork_cleanup_cb clean_up_func,
+                        void *clean_up_user_data)
 {
        int ret;
 
        pthread_mutex_lock(&worker_lock);
-       ret = run_as_create_worker_no_lock(procname, clean_up_func,
-                       clean_up_user_data);
+       ret = run_as_create_worker_no_lock(procname, clean_up_func, clean_up_user_data);
        pthread_mutex_unlock(&worker_lock);
        return ret;
 }
index 1171b2930ce605c2ee465476cd5d4541cd48a646..56655f20b63a92029509b5a6f639bc932e7cb8f2 100644 (file)
@@ -4,13 +4,15 @@
  * SPDX-License-Identifier: LGPL-2.1-only
  */
 
-#include <lttng/session-descriptor-internal.hpp>
-#include <common/macros.hpp>
-#include <common/uri.hpp>
 #include <common/defaults.hpp>
 #include <common/error.hpp>
-#include <time.h>
+#include <common/macros.hpp>
+#include <common/uri.hpp>
+
+#include <lttng/session-descriptor-internal.hpp>
+
 #include <stdio.h>
+#include <time.h>
 
 namespace {
 struct lttng_session_descriptor_network_location {
@@ -66,8 +68,7 @@ struct lttng_session_descriptor_live_comm {
 } LTTNG_PACKED;
 } /* namespace */
 
-static
-struct lttng_uri *uri_copy(const struct lttng_uri *uri)
+static struct lttng_uri *uri_copy(const struct lttng_uri *uri)
 {
        struct lttng_uri *new_uri = NULL;
 
@@ -84,13 +85,11 @@ end:
        return new_uri;
 }
 
-static
-struct lttng_uri *uri_from_path(const char *path)
+static struct lttng_uri *uri_from_path(const char *path)
 {
        struct lttng_uri *uris = NULL;
        ssize_t uri_count;
-       char local_protocol_string[LTTNG_PATH_MAX + sizeof("file://")] =
-                       "file://";
+       char local_protocol_string[LTTNG_PATH_MAX + sizeof("file://")] = "file://";
 
        if (strlen(path) >= LTTNG_PATH_MAX) {
                goto end;
@@ -117,19 +116,17 @@ error:
        return NULL;
 }
 
-static
-void network_location_fini(
-               struct lttng_session_descriptor_network_location *location)
+static void network_location_fini(struct lttng_session_descriptor_network_location *location)
 {
        free(location->control);
        free(location->data);
 }
 
 /* Assumes ownership of control and data. */
-static
-int network_location_set_from_lttng_uris(
-               struct lttng_session_descriptor_network_location *location,
-               struct lttng_uri *control, struct lttng_uri *data)
+static int
+network_location_set_from_lttng_uris(struct lttng_session_descriptor_network_location *location,
+                                    struct lttng_uri *control,
+                                    struct lttng_uri *data)
 {
        int ret = 0;
 
@@ -143,8 +140,7 @@ int network_location_set_from_lttng_uris(
                goto end;
        }
 
-       if (control->stype != LTTNG_STREAM_CONTROL ||
-                       data->stype != LTTNG_STREAM_DATA) {
+       if (control->stype != LTTNG_STREAM_CONTROL || data->stype != LTTNG_STREAM_DATA) {
                ret = -1;
                goto end;
        }
@@ -161,10 +157,10 @@ end:
        return ret;
 }
 
-static
-int network_location_set_from_uri_strings(
-               struct lttng_session_descriptor_network_location *location,
-               const char *control, const char *data)
+static int
+network_location_set_from_uri_strings(struct lttng_session_descriptor_network_location *location,
+                                     const char *control,
+                                     const char *data)
 {
        int ret = 0;
        ssize_t uri_count;
@@ -194,10 +190,7 @@ int network_location_set_from_uri_strings(
        }
 
        /* Ownership of control and data uris is transferred. */
-       ret = network_location_set_from_lttng_uris(
-                       location,
-                       control_uri,
-                       data_uri);
+       ret = network_location_set_from_lttng_uris(location, control_uri, data_uri);
        control_uri = NULL;
        data_uri = NULL;
 end:
@@ -207,8 +200,7 @@ end:
        return ret;
 }
 
-struct lttng_session_descriptor *
-lttng_session_descriptor_create(const char *name)
+struct lttng_session_descriptor *lttng_session_descriptor_create(const char *name)
 {
        struct lttng_session_descriptor *descriptor;
 
@@ -218,8 +210,7 @@ lttng_session_descriptor_create(const char *name)
        }
 
        descriptor->type = LTTNG_SESSION_DESCRIPTOR_TYPE_REGULAR;
-       descriptor->output_type =
-                       LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE;
+       descriptor->output_type = LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE;
        if (lttng_session_descriptor_set_session_name(descriptor, name)) {
                goto error;
        }
@@ -230,10 +221,8 @@ error:
 }
 
 /* Ownership of uri is transferred. */
-static
-struct lttng_session_descriptor *
-_lttng_session_descriptor_local_create(const char *name,
-               struct lttng_uri *uri)
+static struct lttng_session_descriptor *
+_lttng_session_descriptor_local_create(const char *name, struct lttng_uri *uri)
 {
        struct lttng_session_descriptor *descriptor;
 
@@ -242,8 +231,7 @@ _lttng_session_descriptor_local_create(const char *name,
                goto error;
        }
        descriptor->type = LTTNG_SESSION_DESCRIPTOR_TYPE_REGULAR;
-       descriptor->output_type =
-                       LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_LOCAL;
+       descriptor->output_type = LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_LOCAL;
        if (uri) {
                if (uri->dtype != LTTNG_DST_PATH) {
                        goto error;
@@ -258,8 +246,8 @@ error:
        return NULL;
 }
 
-struct lttng_session_descriptor *
-lttng_session_descriptor_local_create(const char *name, const char *path)
+struct lttng_session_descriptor *lttng_session_descriptor_local_create(const char *name,
+                                                                      const char *path)
 {
        struct lttng_uri *uri = NULL;
        struct lttng_session_descriptor *descriptor;
@@ -277,10 +265,8 @@ error:
 }
 
 /* Assumes the ownership of both uris. */
-static
-struct lttng_session_descriptor *
-_lttng_session_descriptor_network_create(const char *name,
-               struct lttng_uri *control, struct lttng_uri *data)
+static struct lttng_session_descriptor *_lttng_session_descriptor_network_create(
+       const char *name, struct lttng_uri *control, struct lttng_uri *data)
 {
        int ret;
        struct lttng_session_descriptor *descriptor;
@@ -293,8 +279,7 @@ _lttng_session_descriptor_network_create(const char *name,
        descriptor->type = LTTNG_SESSION_DESCRIPTOR_TYPE_REGULAR;
        descriptor->output_type = LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK;
        /* Assumes the ownership of both uris. */
-       ret = network_location_set_from_lttng_uris(&descriptor->output.network,
-                       control, data);
+       ret = network_location_set_from_lttng_uris(&descriptor->output.network, control, data);
        control = NULL;
        data = NULL;
        if (ret) {
@@ -308,21 +293,20 @@ error:
        return NULL;
 }
 
-struct lttng_session_descriptor *
-lttng_session_descriptor_network_create(const char *name,
-               const char *control_url, const char *data_url)
+struct lttng_session_descriptor *lttng_session_descriptor_network_create(const char *name,
+                                                                        const char *control_url,
+                                                                        const char *data_url)
 {
        int ret;
        struct lttng_session_descriptor *descriptor;
 
-       descriptor = _lttng_session_descriptor_network_create(name,
-                       NULL, NULL);
+       descriptor = _lttng_session_descriptor_network_create(name, NULL, NULL);
        if (!descriptor) {
                goto error;
        }
 
-       ret = network_location_set_from_uri_strings(&descriptor->output.network,
-                       control_url, data_url);
+       ret = network_location_set_from_uri_strings(
+               &descriptor->output.network, control_url, data_url);
        if (ret) {
                goto error;
        }
@@ -332,8 +316,7 @@ error:
        return NULL;
 }
 
-static
-struct lttng_session_descriptor_snapshot *
+static struct lttng_session_descriptor_snapshot *
 _lttng_session_descriptor_snapshot_create(const char *name)
 {
        struct lttng_session_descriptor_snapshot *descriptor;
@@ -344,10 +327,8 @@ _lttng_session_descriptor_snapshot_create(const char *name)
        }
 
        descriptor->base.type = LTTNG_SESSION_DESCRIPTOR_TYPE_SNAPSHOT;
-       descriptor->base.output_type =
-                       LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE;
-       if (lttng_session_descriptor_set_session_name(&descriptor->base,
-                       name)) {
+       descriptor->base.output_type = LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE;
+       if (lttng_session_descriptor_set_session_name(&descriptor->base, name)) {
                goto error;
        }
        return descriptor;
@@ -357,10 +338,8 @@ error:
 }
 
 /* Ownership of control and data is transferred. */
-static
-struct lttng_session_descriptor_snapshot *
-_lttng_session_descriptor_snapshot_network_create(const char *name,
-               struct lttng_uri *control, struct lttng_uri *data)
+static struct lttng_session_descriptor_snapshot *_lttng_session_descriptor_snapshot_network_create(
+       const char *name, struct lttng_uri *control, struct lttng_uri *data)
 {
        int ret;
        struct lttng_session_descriptor_snapshot *descriptor;
@@ -370,12 +349,9 @@ _lttng_session_descriptor_snapshot_network_create(const char *name,
                goto error;
        }
 
-       descriptor->base.output_type =
-                       LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK;
+       descriptor->base.output_type = LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK;
        /* Ownership of control and data is transferred. */
-       ret = network_location_set_from_lttng_uris(
-                       &descriptor->base.output.network,
-                       control, data);
+       ret = network_location_set_from_lttng_uris(&descriptor->base.output.network, control, data);
        control = NULL;
        data = NULL;
        if (ret) {
@@ -389,8 +365,7 @@ error:
        return NULL;
 }
 
-struct lttng_session_descriptor *
-lttng_session_descriptor_snapshot_create(const char *name)
+struct lttng_session_descriptor *lttng_session_descriptor_snapshot_create(const char *name)
 {
        struct lttng_session_descriptor_snapshot *descriptor;
 
@@ -398,22 +373,19 @@ lttng_session_descriptor_snapshot_create(const char *name)
        return descriptor ? &descriptor->base : NULL;
 }
 
-struct lttng_session_descriptor *
-lttng_session_descriptor_snapshot_network_create(const char *name,
-               const char *control_url, const char *data_url)
+struct lttng_session_descriptor *lttng_session_descriptor_snapshot_network_create(
+       const char *name, const char *control_url, const char *data_url)
 {
        int ret;
        struct lttng_session_descriptor_snapshot *descriptor;
 
-       descriptor = _lttng_session_descriptor_snapshot_network_create(name,
-                       NULL, NULL);
+       descriptor = _lttng_session_descriptor_snapshot_network_create(name, NULL, NULL);
        if (!descriptor) {
                goto error;
        }
 
        ret = network_location_set_from_uri_strings(
-                       &descriptor->base.output.network,
-                       control_url, data_url);
+               &descriptor->base.output.network, control_url, data_url);
        if (ret) {
                goto error;
        }
@@ -424,10 +396,8 @@ error:
 }
 
 /* Ownership of uri is transferred. */
-static
-struct lttng_session_descriptor_snapshot *
-_lttng_session_descriptor_snapshot_local_create(const char *name,
-               struct lttng_uri *uri)
+static struct lttng_session_descriptor_snapshot *
+_lttng_session_descriptor_snapshot_local_create(const char *name, struct lttng_uri *uri)
 {
        struct lttng_session_descriptor_snapshot *descriptor;
 
@@ -435,8 +405,7 @@ _lttng_session_descriptor_snapshot_local_create(const char *name,
        if (!descriptor) {
                goto error;
        }
-       descriptor->base.output_type =
-                       LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_LOCAL;
+       descriptor->base.output_type = LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_LOCAL;
        if (uri) {
                if (uri->dtype != LTTNG_DST_PATH) {
                        goto error;
@@ -451,9 +420,8 @@ error:
        return NULL;
 }
 
-struct lttng_session_descriptor *
-lttng_session_descriptor_snapshot_local_create(const char *name,
-               const char *path)
+struct lttng_session_descriptor *lttng_session_descriptor_snapshot_local_create(const char *name,
+                                                                               const char *path)
 {
        struct lttng_uri *path_uri = NULL;
        struct lttng_session_descriptor_snapshot *descriptor;
@@ -464,17 +432,14 @@ lttng_session_descriptor_snapshot_local_create(const char *name,
                        goto error;
                }
        }
-       descriptor = _lttng_session_descriptor_snapshot_local_create(name,
-                       path_uri);
+       descriptor = _lttng_session_descriptor_snapshot_local_create(name, path_uri);
        return descriptor ? &descriptor->base : NULL;
 error:
        return NULL;
 }
 
-static
-struct lttng_session_descriptor_live *
-_lttng_session_descriptor_live_create(const char *name,
-               unsigned long long live_timer_interval_us)
+static struct lttng_session_descriptor_live *
+_lttng_session_descriptor_live_create(const char *name, unsigned long long live_timer_interval_us)
 {
        struct lttng_session_descriptor_live *descriptor = NULL;
 
@@ -487,11 +452,9 @@ _lttng_session_descriptor_live_create(const char *name,
        }
 
        descriptor->base.type = LTTNG_SESSION_DESCRIPTOR_TYPE_LIVE;
-       descriptor->base.output_type =
-                       LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE;
+       descriptor->base.output_type = LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE;
        descriptor->live_timer_us = live_timer_interval_us;
-       if (lttng_session_descriptor_set_session_name(&descriptor->base,
-                       name)) {
+       if (lttng_session_descriptor_set_session_name(&descriptor->base, name)) {
                goto error;
        }
 
@@ -502,29 +465,24 @@ error:
 }
 
 /* Ownership of control and data is transferred. */
-static
-struct lttng_session_descriptor_live *
-_lttng_session_descriptor_live_network_create(
-               const char *name,
-               struct lttng_uri *control, struct lttng_uri *data,
-               unsigned long long live_timer_interval_us)
+static struct lttng_session_descriptor_live *
+_lttng_session_descriptor_live_network_create(const char *name,
+                                             struct lttng_uri *control,
+                                             struct lttng_uri *data,
+                                             unsigned long long live_timer_interval_us)
 {
        int ret;
        struct lttng_session_descriptor_live *descriptor;
 
-       descriptor = _lttng_session_descriptor_live_create(name,
-                       live_timer_interval_us);
+       descriptor = _lttng_session_descriptor_live_create(name, live_timer_interval_us);
        if (!descriptor) {
                goto error;
        }
 
-       descriptor->base.output_type =
-                       LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK;
+       descriptor->base.output_type = LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK;
 
        /* Ownerwhip of control and data is transferred. */
-       ret = network_location_set_from_lttng_uris(
-                       &descriptor->base.output.network,
-                       control, data);
+       ret = network_location_set_from_lttng_uris(&descriptor->base.output.network, control, data);
        control = NULL;
        data = NULL;
        if (ret) {
@@ -539,9 +497,7 @@ error:
 }
 
 struct lttng_session_descriptor *
-lttng_session_descriptor_live_create(
-               const char *name,
-               unsigned long long live_timer_us)
+lttng_session_descriptor_live_create(const char *name, unsigned long long live_timer_us)
 {
        struct lttng_session_descriptor_live *descriptor;
 
@@ -551,23 +507,21 @@ lttng_session_descriptor_live_create(
 }
 
 struct lttng_session_descriptor *
-lttng_session_descriptor_live_network_create(
-               const char *name,
-               const char *control_url, const char *data_url,
-               unsigned long long live_timer_us)
+lttng_session_descriptor_live_network_create(const char *name,
+                                            const char *control_url,
+                                            const char *data_url,
+                                            unsigned long long live_timer_us)
 {
        int ret;
        struct lttng_session_descriptor_live *descriptor;
 
-       descriptor = _lttng_session_descriptor_live_network_create(name,
-                       NULL, NULL, live_timer_us);
+       descriptor = _lttng_session_descriptor_live_network_create(name, NULL, NULL, live_timer_us);
        if (!descriptor) {
                goto error;
        }
 
        ret = network_location_set_from_uri_strings(
-                       &descriptor->base.output.network,
-                       control_url, data_url);
+               &descriptor->base.output.network, control_url, data_url);
        if (ret) {
                goto error;
        }
@@ -577,8 +531,7 @@ error:
        return NULL;
 }
 
-void lttng_session_descriptor_destroy(
-               struct lttng_session_descriptor *descriptor)
+void lttng_session_descriptor_destroy(struct lttng_session_descriptor *descriptor)
 {
        if (!descriptor) {
                return;
@@ -601,9 +554,8 @@ void lttng_session_descriptor_destroy(
        free(descriptor);
 }
 
-ssize_t lttng_session_descriptor_create_from_buffer(
-               const struct lttng_buffer_view *payload,
-               struct lttng_session_descriptor **descriptor)
+ssize_t lttng_session_descriptor_create_from_buffer(const struct lttng_buffer_view *payload,
+                                                   struct lttng_session_descriptor **descriptor)
 {
        int i;
        ssize_t offset = 0, ret;
@@ -616,8 +568,7 @@ ssize_t lttng_session_descriptor_create_from_buffer(
        enum lttng_session_descriptor_type type;
        enum lttng_session_descriptor_output_type output_type;
 
-       current_view = lttng_buffer_view_from_view(payload, offset,
-                       sizeof(*base_header));
+       current_view = lttng_buffer_view_from_view(payload, offset, sizeof(*base_header));
        if (!lttng_buffer_view_is_valid(&current_view)) {
                ret = -1;
                goto end;
@@ -632,8 +583,7 @@ ssize_t lttng_session_descriptor_create_from_buffer(
        {
                const struct lttng_session_descriptor_live_comm *live_header;
 
-               current_view = lttng_buffer_view_from_view(payload, offset,
-                               sizeof(*live_header));
+               current_view = lttng_buffer_view_from_view(payload, offset, sizeof(*live_header));
                if (!lttng_buffer_view_is_valid(&current_view)) {
                        ret = -1;
                        goto end;
@@ -674,17 +624,15 @@ ssize_t lttng_session_descriptor_create_from_buffer(
        }
 
        /* Map the name. */
-       current_view = lttng_buffer_view_from_view(payload, offset,
-                       base_header->name_len);
+       current_view = lttng_buffer_view_from_view(payload, offset, base_header->name_len);
        if (!lttng_buffer_view_is_valid(&current_view)) {
                ret = -1;
                goto end;
        }
 
        name = current_view.data;
-       if (base_header->name_len == 1 ||
-                       name[base_header->name_len - 1] ||
-                       strlen(name) != base_header->name_len - 1) {
+       if (base_header->name_len == 1 || name[base_header->name_len - 1] ||
+           strlen(name) != base_header->name_len - 1) {
                /*
                 * Check that the name is not NULL, is NULL-terminated, and
                 * does not contain a NULL before the last byte.
@@ -705,8 +653,7 @@ skip_name:
                struct lttng_uri *uri;
 
                /* Map a URI. */
-               current_view = lttng_buffer_view_from_view(payload,
-                               offset, sizeof(*uri));
+               current_view = lttng_buffer_view_from_view(payload, offset, sizeof(*uri));
                if (!lttng_buffer_view_is_valid(&current_view)) {
                        ret = -1;
                        goto end;
@@ -729,12 +676,11 @@ skip_name:
                        *descriptor = lttng_session_descriptor_create(name);
                        break;
                case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_LOCAL:
-                       *descriptor = _lttng_session_descriptor_local_create(
-                                       name, uris[0]);
+                       *descriptor = _lttng_session_descriptor_local_create(name, uris[0]);
                        break;
                case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK:
-                       *descriptor = _lttng_session_descriptor_network_create(
-                                       name, uris[0], uris[1]);
+                       *descriptor =
+                               _lttng_session_descriptor_network_create(name, uris[0], uris[1]);
                        break;
                default:
                        /* Already checked. */
@@ -746,16 +692,14 @@ skip_name:
                struct lttng_session_descriptor_snapshot *snapshot;
                switch (output_type) {
                case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE:
-                       snapshot = _lttng_session_descriptor_snapshot_create(
-                                       name);
+                       snapshot = _lttng_session_descriptor_snapshot_create(name);
                        break;
                case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_LOCAL:
-                       snapshot = _lttng_session_descriptor_snapshot_local_create(
-                                       name, uris[0]);
+                       snapshot = _lttng_session_descriptor_snapshot_local_create(name, uris[0]);
                        break;
                case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK:
                        snapshot = _lttng_session_descriptor_snapshot_network_create(
-                                       name, uris[0], uris[1]);
+                               name, uris[0], uris[1]);
                        break;
                default:
                        /* Already checked. */
@@ -770,13 +714,11 @@ skip_name:
 
                switch (output_type) {
                case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE:
-                       live = _lttng_session_descriptor_live_create(
-                                       name, live_timer_us);
+                       live = _lttng_session_descriptor_live_create(name, live_timer_us);
                        break;
                case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK:
                        live = _lttng_session_descriptor_live_network_create(
-                                       name, uris[0], uris[1],
-                                       live_timer_us);
+                               name, uris[0], uris[1], live_timer_us);
                        break;
                case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_LOCAL:
                        ret = -1;
@@ -805,9 +747,8 @@ end:
        return ret;
 }
 
-int lttng_session_descriptor_serialize(
-               const struct lttng_session_descriptor *descriptor,
-               struct lttng_dynamic_buffer *buffer)
+int lttng_session_descriptor_serialize(const struct lttng_session_descriptor *descriptor,
+                                      struct lttng_dynamic_buffer *buffer)
 {
        int ret, i;
        /* There are, at most, two URIs to serialize. */
@@ -848,7 +789,7 @@ int lttng_session_descriptor_serialize(
        header.base.uri_count = uri_count;
        if (descriptor->type == LTTNG_SESSION_DESCRIPTOR_TYPE_LIVE) {
                const struct lttng_session_descriptor_live *live = lttng::utils::container_of(
-                               descriptor, &lttng_session_descriptor_live::base);
+                       descriptor, &lttng_session_descriptor_live::base);
 
                header.live_timer_us = live->live_timer_us;
                header_ptr = &header;
@@ -863,16 +804,14 @@ int lttng_session_descriptor_serialize(
                goto end;
        }
        if (header.base.name_len) {
-               ret = lttng_dynamic_buffer_append(buffer, descriptor->name,
-                               header.base.name_len);
+               ret = lttng_dynamic_buffer_append(buffer, descriptor->name, header.base.name_len);
                if (ret) {
                        goto end;
                }
        }
 
        for (i = 0; i < uri_count; i++) {
-               ret = lttng_dynamic_buffer_append(buffer, uris[i],
-                               sizeof(struct lttng_uri));
+               ret = lttng_dynamic_buffer_append(buffer, uris[i], sizeof(struct lttng_uri));
                if (ret) {
                        goto end;
                }
@@ -882,38 +821,34 @@ end:
 }
 
 enum lttng_session_descriptor_type
-lttng_session_descriptor_get_type(
-               const struct lttng_session_descriptor *descriptor)
+lttng_session_descriptor_get_type(const struct lttng_session_descriptor *descriptor)
 {
        return descriptor->type;
 }
 
 enum lttng_session_descriptor_output_type
-lttng_session_descriptor_get_output_type(
-               const struct lttng_session_descriptor *descriptor)
+lttng_session_descriptor_get_output_type(const struct lttng_session_descriptor *descriptor)
 {
        return descriptor->output_type;
 }
 
 void lttng_session_descriptor_get_local_output_uri(
-               const struct lttng_session_descriptor *descriptor,
-               struct lttng_uri *local_uri)
+       const struct lttng_session_descriptor *descriptor, struct lttng_uri *local_uri)
 {
        memcpy(local_uri, descriptor->output.local, sizeof(*local_uri));
 }
 
 void lttng_session_descriptor_get_network_output_uris(
-               const struct lttng_session_descriptor *descriptor,
-               struct lttng_uri *control,
-               struct lttng_uri *data)
+       const struct lttng_session_descriptor *descriptor,
+       struct lttng_uri *control,
+       struct lttng_uri *data)
 {
        memcpy(control, descriptor->output.network.control, sizeof(*control));
        memcpy(data, descriptor->output.network.data, sizeof(*data));
 }
 
 unsigned long long
-lttng_session_descriptor_live_get_timer_interval(
-               const struct lttng_session_descriptor *descriptor)
+lttng_session_descriptor_live_get_timer_interval(const struct lttng_session_descriptor *descriptor)
 {
        struct lttng_session_descriptor_live *live;
 
@@ -922,9 +857,8 @@ lttng_session_descriptor_live_get_timer_interval(
 }
 
 enum lttng_session_descriptor_status
-lttng_session_descriptor_get_session_name(
-               const struct lttng_session_descriptor *descriptor,
-               const char **session_name)
+lttng_session_descriptor_get_session_name(const struct lttng_session_descriptor *descriptor,
+                                         const char **session_name)
 {
        enum lttng_session_descriptor_status status;
 
@@ -934,16 +868,14 @@ lttng_session_descriptor_get_session_name(
        }
 
        *session_name = descriptor->name;
-       status = descriptor->name ?
-                       LTTNG_SESSION_DESCRIPTOR_STATUS_OK :
-                       LTTNG_SESSION_DESCRIPTOR_STATUS_UNSET;
+       status = descriptor->name ? LTTNG_SESSION_DESCRIPTOR_STATUS_OK :
+                                   LTTNG_SESSION_DESCRIPTOR_STATUS_UNSET;
 end:
        return status;
 }
 
-int lttng_session_descriptor_set_session_name(
-               struct lttng_session_descriptor *descriptor,
-               const char *name)
+int lttng_session_descriptor_set_session_name(struct lttng_session_descriptor *descriptor,
+                                             const char *name)
 {
        int ret = 0;
        char *new_name;
@@ -967,7 +899,7 @@ end:
 }
 
 bool lttng_session_descriptor_is_output_destination_initialized(
-               const struct lttng_session_descriptor *descriptor)
+       const struct lttng_session_descriptor *descriptor)
 {
        switch (descriptor->output_type) {
        case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE:
@@ -981,8 +913,7 @@ bool lttng_session_descriptor_is_output_destination_initialized(
        }
 }
 
-bool lttng_session_descriptor_has_output_directory(
-               const struct lttng_session_descriptor *descriptor)
+bool lttng_session_descriptor_has_output_directory(const struct lttng_session_descriptor *descriptor)
 {
        switch (descriptor->output_type) {
        case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE:
@@ -1003,10 +934,10 @@ bool lttng_session_descriptor_has_output_directory(
        return false;
 }
 
-enum lttng_error_code lttng_session_descriptor_set_default_output(
-               struct lttng_session_descriptor *descriptor,
-               time_t *session_creation_time,
-               const char *absolute_home_path)
+enum lttng_error_code
+lttng_session_descriptor_set_default_output(struct lttng_session_descriptor *descriptor,
+                                           time_t *session_creation_time,
+                                           const char *absolute_home_path)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
        struct lttng_uri *uris = NULL;
@@ -1031,8 +962,9 @@ enum lttng_error_code lttng_session_descriptor_set_default_output(
                                goto end;
                        }
                        strftime_ret = strftime(creation_datetime_suffix,
-                                       sizeof(creation_datetime_suffix),
-                                       "-%Y%m%d-%H%M%S", timeinfo);
+                                               sizeof(creation_datetime_suffix),
+                                               "-%Y%m%d-%H%M%S",
+                                               timeinfo);
                        if (strftime_ret == 0) {
                                ERR("Failed to format session creation timestamp while setting default local output destination");
                                ret_code = LTTNG_ERR_FATAL;
@@ -1040,11 +972,13 @@ enum lttng_error_code lttng_session_descriptor_set_default_output(
                        }
                }
                LTTNG_ASSERT(descriptor->name);
-               ret = snprintf(local_uri, sizeof(local_uri),
-                               "file://%s/%s/%s%s",
-                               absolute_home_path,
-                               DEFAULT_TRACE_DIR_NAME, descriptor->name,
-                               creation_datetime_suffix);
+               ret = snprintf(local_uri,
+                              sizeof(local_uri),
+                              "file://%s/%s/%s%s",
+                              absolute_home_path,
+                              DEFAULT_TRACE_DIR_NAME,
+                              descriptor->name,
+                              creation_datetime_suffix);
                if (ret >= sizeof(local_uri)) {
                        ERR("Truncation occurred while setting default local output destination");
                        ret_code = LTTNG_ERR_SET_URL;
@@ -1088,8 +1022,7 @@ enum lttng_error_code lttng_session_descriptor_set_default_output(
 
                /* Ownership of uris is transferred. */
                ret = network_location_set_from_lttng_uris(
-                               &descriptor->output.network,
-                               control, data);
+                       &descriptor->output.network, control, data);
                if (ret) {
                        abort();
                        ret_code = LTTNG_ERR_SET_URL;
@@ -1109,9 +1042,8 @@ end:
  * Note that only properties that can be populated by the session daemon
  * (output destination and name) are assigned.
  */
-int lttng_session_descriptor_assign(
-               struct lttng_session_descriptor *dst,
-               const struct lttng_session_descriptor *src)
+int lttng_session_descriptor_assign(struct lttng_session_descriptor *dst,
+                                   const struct lttng_session_descriptor *src)
 {
        int ret = 0;
 
@@ -1151,8 +1083,8 @@ int lttng_session_descriptor_assign(
                        ret = -1;
                        goto end;
                }
-               ret = network_location_set_from_lttng_uris(&dst->output.network,
-                               control_copy, data_copy);
+               ret = network_location_set_from_lttng_uris(
+                       &dst->output.network, control_copy, data_copy);
                break;
        }
        case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NONE:
index 30aa8c6134a42903f2df14cd6e0e69c103d2173a..15e6ba7c8b8276a2ab9fcb29b2a7d3f9e5e21948 100644 (file)
@@ -6,25 +6,25 @@
  */
 
 #define _LGPL_SOURCE
+#include "inet.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/errno.hpp>
+#include <common/compat/time.hpp>
+#include <common/time.hpp>
+
 #include <algorithm>
+#include <fcntl.h>
 #include <limits.h>
+#include <poll.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <common/compat/time.hpp>
-#include <poll.h>
-
-#include <common/common.hpp>
-#include <common/time.hpp>
-#include <common/compat/errno.hpp>
-
-#include "inet.hpp"
 
-#define RECONNECT_DELAY        200     /* ms */
+#define RECONNECT_DELAY 200 /* ms */
 
 /*
  * INET protocol operations.
@@ -93,16 +93,14 @@ int lttcomm_bind_inet_sock(struct lttcomm_sock *sock)
        return bind(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
 }
 
-static
-int connect_no_timeout(struct lttcomm_sock *sock)
+static int connect_no_timeout(struct lttcomm_sock *sock)
 {
        struct sockaddr_in sockaddr = sock->sockaddr.addr.sin;
 
        return connect(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
 }
 
-static
-int connect_with_timeout(struct lttcomm_sock *sock)
+static int connect_with_timeout(struct lttcomm_sock *sock)
 {
        unsigned long timeout = lttcomm_get_network_timeout();
        int ret, flags, connect_ret;
@@ -132,8 +130,7 @@ int connect_with_timeout(struct lttcomm_sock *sock)
 
        sockaddr = sock->sockaddr.addr.sin;
        connect_ret = connect(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
-       if (connect_ret == -1 && errno != EAGAIN && errno != EWOULDBLOCK &&
-                       errno != EINPROGRESS) {
+       if (connect_ret == -1 && errno != EAGAIN && errno != EWOULDBLOCK && errno != EINPROGRESS) {
                goto error;
        } else if (!connect_ret) {
                /* Connect succeeded */
@@ -141,7 +138,9 @@ int connect_with_timeout(struct lttcomm_sock *sock)
        }
 
        DBG("Asynchronous connect for sock %d, performing polling with"
-                       " timeout: %lums", sock->fd, timeout);
+           " timeout: %lums",
+           sock->fd,
+           timeout);
        /*
         * Perform poll loop following EINPROGRESS recommendation from
         * connect(2) man page.
@@ -165,8 +164,7 @@ int connect_with_timeout(struct lttcomm_sock *sock)
                                goto error;
                        }
                        /* got something */
-                       ret = getsockopt(sock->fd, SOL_SOCKET,
-                               SO_ERROR, &optval, &optval_len);
+                       ret = getsockopt(sock->fd, SOL_SOCKET, SO_ERROR, &optval, &optval_len);
                        if (ret) {
                                PERROR("getsockopt");
                                goto error;
@@ -334,8 +332,7 @@ end:
  *
  * Return the size of received data.
  */
-ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf,
-               size_t len, int flags)
+ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf, size_t len, int flags)
 {
        struct msghdr msg;
        struct iovec iov[1];
@@ -390,8 +387,7 @@ end:
  *
  * Return the size of sent data.
  */
-ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock, const void *buf,
-               size_t len, int flags)
+ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock, const void *buf, size_t len, int flags)
 {
        struct msghdr msg;
        struct iovec iov[1];
@@ -525,8 +521,8 @@ void lttcomm_inet_init(void)
         * Get the maximum between the two possible timeout value and use that to
         * get the maximum with the default timeout.
         */
-       lttcomm_inet_tcp_timeout = std::max(std::max(syn_timeout, fin_timeout),
-                       lttcomm_inet_tcp_timeout);
+       lttcomm_inet_tcp_timeout =
+               std::max(std::max(syn_timeout, fin_timeout), lttcomm_inet_tcp_timeout);
 
 end:
        DBG("TCP inet operation timeout set to %lu sec", lttcomm_inet_tcp_timeout);
index caa4d7eb3906b691d1762b6e0fd41268b0ff53ed..21b8378e12e30b34f4c897d8ca2ad3df637b11c1 100644 (file)
@@ -6,24 +6,24 @@
  */
 
 #define _LGPL_SOURCE
+#include "inet6.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/errno.hpp>
+#include <common/compat/time.hpp>
+#include <common/time.hpp>
+
+#include <fcntl.h>
 #include <limits.h>
+#include <poll.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <common/compat/time.hpp>
-#include <poll.h>
-
-#include <common/common.hpp>
-#include <common/time.hpp>
-#include <common/compat/errno.hpp>
-
-#include "inet6.hpp"
 
-#define RECONNECT_DELAY        200     /* ms */
+#define RECONNECT_DELAY 200 /* ms */
 
 /*
  * INET protocol operations.
@@ -89,15 +89,13 @@ int lttcomm_bind_inet6_sock(struct lttcomm_sock *sock)
        return bind(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
 }
 
-static
-int connect_no_timeout(struct lttcomm_sock *sock)
+static int connect_no_timeout(struct lttcomm_sock *sock)
 {
        struct sockaddr_in6 sockaddr = sock->sockaddr.addr.sin6;
        return connect(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
 }
 
-static
-int connect_with_timeout(struct lttcomm_sock *sock)
+static int connect_with_timeout(struct lttcomm_sock *sock)
 {
        unsigned long timeout = lttcomm_get_network_timeout();
        int ret, flags, connect_ret;
@@ -127,8 +125,7 @@ int connect_with_timeout(struct lttcomm_sock *sock)
 
        sockaddr = sock->sockaddr.addr.sin6;
        connect_ret = connect(sock->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr));
-       if (connect_ret == -1 && errno != EAGAIN && errno != EWOULDBLOCK &&
-                       errno != EINPROGRESS) {
+       if (connect_ret == -1 && errno != EAGAIN && errno != EWOULDBLOCK && errno != EINPROGRESS) {
                goto error;
        } else if (!connect_ret) {
                /* Connect succeeded */
@@ -136,7 +133,9 @@ int connect_with_timeout(struct lttcomm_sock *sock)
        }
 
        DBG("Asynchronous connect for sock %d, performing polling with"
-                       " timeout: %lums", sock->fd, timeout);
+           " timeout: %lums",
+           sock->fd,
+           timeout);
 
        /*
         * Perform poll loop following EINPROGRESS recommendation from
@@ -161,8 +160,7 @@ int connect_with_timeout(struct lttcomm_sock *sock)
                                goto error;
                        }
                        /* got something */
-                       ret = getsockopt(sock->fd, SOL_SOCKET,
-                               SO_ERROR, &optval, &optval_len);
+                       ret = getsockopt(sock->fd, SOL_SOCKET, SO_ERROR, &optval, &optval_len);
                        if (ret) {
                                PERROR("getsockopt");
                                goto error;
@@ -310,8 +308,7 @@ end:
  *
  * Return the size of received data.
  */
-ssize_t lttcomm_recvmsg_inet6_sock(struct lttcomm_sock *sock, void *buf,
-               size_t len, int flags)
+ssize_t lttcomm_recvmsg_inet6_sock(struct lttcomm_sock *sock, void *buf, size_t len, int flags)
 {
        struct msghdr msg;
        struct iovec iov[1];
@@ -356,8 +353,8 @@ end:
  *
  * Return the size of sent data.
  */
-ssize_t lttcomm_sendmsg_inet6_sock(struct lttcomm_sock *sock, const void *buf,
-               size_t len, int flags)
+ssize_t
+lttcomm_sendmsg_inet6_sock(struct lttcomm_sock *sock, const void *buf, size_t len, int flags)
 {
        struct msghdr msg;
        struct iovec iov[1];
index ed14a9e63ec7af3f721a80d4ee7b1d53d7429eaa..7ad1be6037d02ec08e8c62d41e284588d7caa795 100644 (file)
@@ -8,6 +8,12 @@
 
 #include <sys/socket.h>
 #define _LGPL_SOURCE
+#include "sessiond-comm.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/errno.hpp>
+
+#include <inttypes.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <inttypes.h>
-
-#include <common/common.hpp>
-#include <common/compat/errno.hpp>
-
-#include "sessiond-comm.hpp"
 
 /* For Unix socket */
 #include <common/unix.hpp>
@@ -29,7 +29,7 @@
 /* For Inet6 socket */
 #include "inet6.hpp"
 
-#define NETWORK_TIMEOUT_ENV    "LTTNG_NETWORK_SOCKET_TIMEOUT"
+#define NETWORK_TIMEOUT_ENV "LTTNG_NETWORK_SOCKET_TIMEOUT"
 
 static struct lttcomm_net_family net_families[] = {
        { LTTCOMM_INET, lttcomm_create_inet_sock },
@@ -39,8 +39,8 @@ static struct lttcomm_net_family net_families[] = {
 /*
  * Human readable error message.
  */
-static
-const char *lttcomm_return_code_str(lttcomm_return_code code) {
+static const char *lttcomm_return_code_str(lttcomm_return_code code)
+{
        switch (code) {
        case LTTCOMM_CONSUMERD_SUCCESS:
                return "consumerd success";
@@ -126,7 +126,7 @@ const char *lttcomm_get_readable_code(enum lttcomm_return_code code)
        code = (lttcomm_return_code) -code;
 
        if (code != LTTCOMM_CONSUMERD_SUCCESS &&
-                       !(code >= LTTCOMM_CONSUMERD_COMMAND_SOCK_READY && code < LTTCOMM_NR)) {
+           !(code >= LTTCOMM_CONSUMERD_COMMAND_SOCK_READY && code < LTTCOMM_NR)) {
                code = LTTCOMM_CONSUMERD_UNKNOWN_ERROR;
        }
 
@@ -239,8 +239,7 @@ void lttcomm_copy_sock(struct lttcomm_sock *dst, struct lttcomm_sock *src)
 /*
  * Init IPv4 sockaddr structure.
  */
-int lttcomm_init_inet_sockaddr(struct lttcomm_sockaddr *sockaddr,
-               const char *ip, unsigned int port)
+int lttcomm_init_inet_sockaddr(struct lttcomm_sockaddr *sockaddr, const char *ip, unsigned int port)
 {
        int ret;
 
@@ -253,8 +252,7 @@ int lttcomm_init_inet_sockaddr(struct lttcomm_sockaddr *sockaddr,
        sockaddr->type = LTTCOMM_INET;
        sockaddr->addr.sin.sin_family = AF_INET;
        sockaddr->addr.sin.sin_port = htons(port);
-       ret = inet_pton(sockaddr->addr.sin.sin_family, ip,
-                       &sockaddr->addr.sin.sin_addr);
+       ret = inet_pton(sockaddr->addr.sin.sin_family, ip, &sockaddr->addr.sin.sin_addr);
        if (ret < 1) {
                ret = -1;
                ERR("%s with port %d: unrecognized IPv4 address", ip, port);
@@ -270,7 +268,8 @@ error:
  * Init IPv6 sockaddr structure.
  */
 int lttcomm_init_inet6_sockaddr(struct lttcomm_sockaddr *sockaddr,
-               const char *ip, unsigned int port)
+                               const char *ip,
+                               unsigned int port)
 {
        int ret;
 
@@ -283,8 +282,7 @@ int lttcomm_init_inet6_sockaddr(struct lttcomm_sockaddr *sockaddr,
        sockaddr->type = LTTCOMM_INET6;
        sockaddr->addr.sin6.sin6_family = AF_INET6;
        sockaddr->addr.sin6.sin6_port = htons(port);
-       ret = inet_pton(sockaddr->addr.sin6.sin6_family, ip,
-                       &sockaddr->addr.sin6.sin6_addr);
+       ret = inet_pton(sockaddr->addr.sin6.sin6_family, ip, &sockaddr->addr.sin6.sin6_addr);
        if (ret < 1) {
                ret = -1;
                goto error;
@@ -321,14 +319,12 @@ struct lttcomm_sock *lttcomm_alloc_sock_from_uri(struct lttng_uri *uri)
 
        /* Check destination type */
        if (uri->dtype == LTTNG_DST_IPV4) {
-               ret = lttcomm_init_inet_sockaddr(&sock->sockaddr, uri->dst.ipv4,
-                               uri->port);
+               ret = lttcomm_init_inet_sockaddr(&sock->sockaddr, uri->dst.ipv4, uri->port);
                if (ret < 0) {
                        goto error;
                }
        } else if (uri->dtype == LTTNG_DST_IPV6) {
-               ret = lttcomm_init_inet6_sockaddr(&sock->sockaddr, uri->dst.ipv6,
-                               uri->port);
+               ret = lttcomm_init_inet6_sockaddr(&sock->sockaddr, uri->dst.ipv6, uri->port);
                if (ret < 0) {
                        goto error;
                }
@@ -360,8 +356,8 @@ void lttcomm_destroy_sock(struct lttcomm_sock *sock)
  *
  * On error, NULL is returned.
  */
-struct lttcomm_relayd_sock *lttcomm_alloc_relayd_sock(struct lttng_uri *uri,
-               uint32_t major, uint32_t minor)
+struct lttcomm_relayd_sock *
+lttcomm_alloc_relayd_sock(struct lttng_uri *uri, uint32_t major, uint32_t minor)
 {
        int ret;
        struct lttcomm_sock *tmp_sock = NULL;
@@ -445,10 +441,8 @@ int lttcomm_sock_get_port(const struct lttcomm_sock *sock, uint16_t *port)
 {
        LTTNG_ASSERT(sock);
        LTTNG_ASSERT(port);
-       LTTNG_ASSERT(sock->sockaddr.type == LTTCOMM_INET ||
-                       sock->sockaddr.type == LTTCOMM_INET6);
-       LTTNG_ASSERT(sock->proto == LTTCOMM_SOCK_TCP ||
-                       sock->proto == LTTCOMM_SOCK_UDP);
+       LTTNG_ASSERT(sock->sockaddr.type == LTTCOMM_INET || sock->sockaddr.type == LTTCOMM_INET6);
+       LTTNG_ASSERT(sock->proto == LTTCOMM_SOCK_TCP || sock->proto == LTTCOMM_SOCK_UDP);
 
        switch (sock->sockaddr.type) {
        case LTTCOMM_INET:
@@ -467,10 +461,8 @@ int lttcomm_sock_get_port(const struct lttcomm_sock *sock, uint16_t *port)
 int lttcomm_sock_set_port(struct lttcomm_sock *sock, uint16_t port)
 {
        LTTNG_ASSERT(sock);
-       LTTNG_ASSERT(sock->sockaddr.type == LTTCOMM_INET ||
-                       sock->sockaddr.type == LTTCOMM_INET6);
-       LTTNG_ASSERT(sock->proto == LTTCOMM_SOCK_TCP ||
-                       sock->proto == LTTCOMM_SOCK_UDP);
+       LTTNG_ASSERT(sock->sockaddr.type == LTTCOMM_INET || sock->sockaddr.type == LTTCOMM_INET6);
+       LTTNG_ASSERT(sock->proto == LTTCOMM_SOCK_TCP || sock->proto == LTTCOMM_SOCK_UDP);
 
        switch (sock->sockaddr.type) {
        case LTTCOMM_INET:
@@ -515,10 +507,9 @@ unsigned long lttcomm_get_network_timeout(void)
  * Only valid for an ipv4 and ipv6 bound socket that is already connected to its
  * peer.
  */
-int lttcomm_populate_sock_from_open_socket(
-               struct lttcomm_sock *sock,
-               int fd,
-               enum lttcomm_sock_proto protocol)
+int lttcomm_populate_sock_from_open_socket(struct lttcomm_sock *sock,
+                                          int fd,
+                                          enum lttcomm_sock_proto protocol)
 {
        int ret = 0;
        socklen_t storage_len;
@@ -530,11 +521,9 @@ int lttcomm_populate_sock_from_open_socket(
        sock->proto = protocol;
 
        storage_len = sizeof(storage);
-       ret = getpeername(fd, (struct sockaddr *) &storage,
-                       &storage_len);
+       ret = getpeername(fd, (struct sockaddr *) &storage, &storage_len);
        if (ret) {
-               ERR("Failed to get peer info for socket %d (errno: %d)", fd,
-                               errno);
+               ERR("Failed to get peer info for socket %d (errno: %d)", fd, errno);
                ret = -1;
                goto end;
        }
@@ -548,13 +537,11 @@ int lttcomm_populate_sock_from_open_socket(
        switch (storage.ss_family) {
        case AF_INET:
                sock->sockaddr.type = LTTCOMM_INET;
-               memcpy(&sock->sockaddr.addr, &storage,
-                               sizeof(struct sockaddr_in));
+               memcpy(&sock->sockaddr.addr, &storage, sizeof(struct sockaddr_in));
                break;
        case AF_INET6:
                sock->sockaddr.type = LTTCOMM_INET6;
-               memcpy(&sock->sockaddr.addr, &storage,
-                               sizeof(struct sockaddr_in6));
+               memcpy(&sock->sockaddr.addr, &storage, sizeof(struct sockaddr_in6));
                break;
        default:
                abort();
index 300ffe357e98cafdfabb02146ab8736bc8474104..6284ed1fddcb1c609b868595717b05664bb58ae2 100644 (file)
@@ -7,6 +7,10 @@
  */
 
 #define _LGPL_SOURCE
+#include "shm.hpp"
+
+#include <common/error.hpp>
+
 #include <fcntl.h>
 #include <limits.h>
 #include <sys/mman.h>
 #include <unistd.h>
 #include <urcu.h>
 
-#include <common/error.hpp>
-
-#include "shm.hpp"
-
 /*
  * We deal with the shm_open vs ftruncate race (happening when the sessiond owns
  * the shm and does not let everybody modify it, to ensure safety against
@@ -84,13 +84,15 @@ static int get_wait_shm(char *shm_path, size_t mmap_size, int global)
                if (errno == EACCES) {
                        /* Work around sysctl fs.protected_regular. */
                        DBG("shm_open of %s returned EACCES, this may be caused "
-                                       "by the fs.protected_regular sysctl. "
-                                       "Attempting to open the shm without "
-                                       "creating it.", shm_path);
+                           "by the fs.protected_regular sysctl. "
+                           "Attempting to open the shm without "
+                           "creating it.",
+                           shm_path);
                        wait_shm_fd = shm_open(shm_path, O_RDWR, mode);
                }
                if (wait_shm_fd < 0) {
-                       PERROR("Failed to open \"wait\" shared memory object: path = '%s'", shm_path);
+                       PERROR("Failed to open \"wait\" shared memory object: path = '%s'",
+                              shm_path);
                        goto error;
                }
        }
@@ -98,7 +100,8 @@ static int get_wait_shm(char *shm_path, size_t mmap_size, int global)
        ret = ftruncate(wait_shm_fd, mmap_size);
        if (ret < 0) {
                PERROR("Failed to truncate \"wait\" shared memory object: fd = %d, size = %zu",
-                               wait_shm_fd, mmap_size);
+                      wait_shm_fd,
+                      mmap_size);
                goto error;
        }
 
@@ -106,7 +109,7 @@ static int get_wait_shm(char *shm_path, size_t mmap_size, int global)
                ret = fchown(wait_shm_fd, 0, 0);
                if (ret < 0) {
                        PERROR("Failed to set ownership of \"wait\" shared memory object: fd = %d, owner = 0, group = 0",
-                                       wait_shm_fd);
+                              wait_shm_fd);
                        goto error;
                }
                /*
@@ -118,21 +121,26 @@ static int get_wait_shm(char *shm_path, size_t mmap_size, int global)
                ret = fchmod(wait_shm_fd, mode);
                if (ret < 0) {
                        PERROR("Failed to set the mode of the \"wait\" shared memory object: fd = %d, mode = %d",
-                                       wait_shm_fd, mode);
+                              wait_shm_fd,
+                              mode);
                        goto error;
                }
        } else {
                ret = fchown(wait_shm_fd, getuid(), getgid());
                if (ret < 0) {
                        PERROR("Failed to set ownership of \"wait\" shared memory object: fd = %d, owner = %d, group = %d",
-                                       wait_shm_fd, getuid(), getgid());
+                              wait_shm_fd,
+                              getuid(),
+                              getgid());
                        goto error;
                }
        }
 
        DBG("Wait shared memory file descriptor created successfully: path = '%s', mmap_size = %zu, global = %s, fd = %d",
-                       shm_path, mmap_size, global ? "true" : "false",
-                       wait_shm_fd);
+           shm_path,
+           mmap_size,
+           global ? "true" : "false",
+           wait_shm_fd);
 
 end:
        (void) umask(old_mode);
@@ -179,19 +187,20 @@ char *shm_ust_get_mmap(char *shm_path, int global)
                goto error;
        }
 
-       wait_shm_mmap = (char *) mmap(NULL, mmap_size, PROT_WRITE | PROT_READ,
-                       MAP_SHARED, wait_shm_fd, 0);
+       wait_shm_mmap =
+               (char *) mmap(NULL, mmap_size, PROT_WRITE | PROT_READ, MAP_SHARED, wait_shm_fd, 0);
 
        /* close shm fd immediately after taking the mmap reference */
        ret = close(wait_shm_fd);
        if (ret) {
                PERROR("Failed to close \"wait\" shared memory object file descriptor: fd = %d",
-                               wait_shm_fd);
+                      wait_shm_fd);
        }
 
        if (wait_shm_mmap == MAP_FAILED) {
                DBG("Failed to mmap the \"wait\" shareed memory object (can be caused by race with ust): path = '%s', global = %s",
-                               shm_path, global ? "true" : "false");
+                   shm_path,
+                   global ? "true" : "false");
                goto error;
        }
 
@@ -212,7 +221,8 @@ int shm_create_anonymous(const char *owner_name)
        ret = snprintf(tmp_name, NAME_MAX, "/shm-%s-%d", owner_name, getpid());
        if (ret < 0) {
                PERROR("Failed to format shm path: owner_name = '%s', pid = %d",
-                               owner_name, getpid());
+                      owner_name,
+                      getpid());
                return -1;
        }
 
@@ -228,8 +238,7 @@ int shm_create_anonymous(const char *owner_name)
 
        ret = shm_unlink(tmp_name);
        if (ret < 0 && errno != ENOENT) {
-               PERROR("Failed to unlink shared memory object: path = '%s'",
-                               tmp_name);
+               PERROR("Failed to unlink shared memory object: path = '%s'", tmp_name);
                goto error_shm_release;
        }
 
@@ -239,7 +248,8 @@ error_shm_release:
        ret = close(shmfd);
        if (ret) {
                PERROR("Failed to close shared memory object file descriptor: fd = %d, path = '%s'",
-                               shmfd, tmp_name);
+                      shmfd,
+                      tmp_name);
        }
 error_shm_open:
        return -1;
index 191f484c255b0d5a9669737b07e6fff8b3c535cb..ba4a554513a75171c7febe6b243da5bc1fc2ea52 100644 (file)
@@ -10,6 +10,7 @@
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
 #include <common/snapshot.hpp>
+
 #include <lttng/snapshot-internal.hpp>
 #include <lttng/snapshot.h>
 
@@ -46,9 +47,8 @@ end:
        return valid;
 }
 
-bool lttng_snapshot_output_is_equal(
-               const struct lttng_snapshot_output *a,
-               const struct lttng_snapshot_output *b)
+bool lttng_snapshot_output_is_equal(const struct lttng_snapshot_output *a,
+                                   const struct lttng_snapshot_output *b)
 {
        bool equal = false;
 
@@ -90,9 +90,8 @@ struct lttng_snapshot_output_comm {
 } LTTNG_PACKED;
 } /* namespace */
 
-int lttng_snapshot_output_serialize(
-               const struct lttng_snapshot_output *output,
-               struct lttng_payload *payload)
+int lttng_snapshot_output_serialize(const struct lttng_snapshot_output *output,
+                                   struct lttng_payload *payload)
 {
        struct lttng_snapshot_output_comm comm;
        int ret;
@@ -105,20 +104,17 @@ int lttng_snapshot_output_serialize(
                goto end;
        }
 
-       ret = lttng_strncpy(
-                       comm.ctrl_url, output->ctrl_url, sizeof(comm.ctrl_url));
+       ret = lttng_strncpy(comm.ctrl_url, output->ctrl_url, sizeof(comm.ctrl_url));
        if (ret) {
                goto end;
        }
 
-       ret = lttng_strncpy(
-                       comm.data_url, output->data_url, sizeof(comm.data_url));
+       ret = lttng_strncpy(comm.data_url, output->data_url, sizeof(comm.data_url));
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, &comm, sizeof(comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &comm, sizeof(comm));
        if (ret) {
                goto end;
        }
@@ -127,9 +123,8 @@ end:
        return ret;
 }
 
-ssize_t lttng_snapshot_output_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_snapshot_output **output_p)
+ssize_t lttng_snapshot_output_create_from_payload(struct lttng_payload_view *view,
+                                                 struct lttng_snapshot_output **output_p)
 {
        const struct lttng_snapshot_output_comm *comm;
        struct lttng_snapshot_output *output = NULL;
@@ -156,14 +151,12 @@ ssize_t lttng_snapshot_output_create_from_payload(
                goto end;
        }
 
-       ret = lttng_strncpy(output->ctrl_url, comm->ctrl_url,
-                       sizeof(output->ctrl_url));
+       ret = lttng_strncpy(output->ctrl_url, comm->ctrl_url, sizeof(output->ctrl_url));
        if (ret) {
                goto end;
        }
 
-       ret = lttng_strncpy(output->data_url, comm->data_url,
-                       sizeof(output->data_url));
+       ret = lttng_strncpy(output->data_url, comm->data_url, sizeof(output->data_url));
        if (ret) {
                goto end;
        }
@@ -177,9 +170,8 @@ end:
        return ret;
 }
 
-enum lttng_error_code lttng_snapshot_output_mi_serialize(
-               const struct lttng_snapshot_output *output,
-               struct mi_writer *writer)
+enum lttng_error_code lttng_snapshot_output_mi_serialize(const struct lttng_snapshot_output *output,
+                                                        struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -188,8 +180,7 @@ enum lttng_error_code lttng_snapshot_output_mi_serialize(
        LTTNG_ASSERT(writer);
 
        /* Open output element. */
-       ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_action_snapshot_session_output);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_action_snapshot_session_output);
        if (ret) {
                goto mi_error;
        }
@@ -197,24 +188,23 @@ enum lttng_error_code lttng_snapshot_output_mi_serialize(
        /* Name. */
        if (strnlen(output->name, LTTNG_NAME_MAX) != 0) {
                ret = mi_lttng_writer_write_element_string(
-                               writer, config_element_name, output->name);
+                       writer, config_element_name, output->name);
                if (ret) {
                        goto mi_error;
                }
        }
 
        /* Control url (always present). */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_snapshot_ctrl_url, output->ctrl_url);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_snapshot_ctrl_url, output->ctrl_url);
        if (ret) {
                goto mi_error;
        }
 
        /* Data url (optional). */
        if (strnlen(output->data_url, PATH_MAX) != 0) {
-               ret = mi_lttng_writer_write_element_string(writer,
-                               mi_lttng_element_snapshot_data_url,
-                               output->data_url);
+               ret = mi_lttng_writer_write_element_string(
+                       writer, mi_lttng_element_snapshot_data_url, output->data_url);
                if (ret) {
                        goto mi_error;
                }
@@ -230,9 +220,8 @@ enum lttng_error_code lttng_snapshot_output_mi_serialize(
         */
        if (output->max_size > 0 && output->max_size != UINT64_MAX) {
                /* Total size of all stream combined. */
-               ret = mi_lttng_writer_write_element_unsigned_int(writer,
-                               mi_lttng_element_snapshot_max_size,
-                               output->max_size);
+               ret = mi_lttng_writer_write_element_unsigned_int(
+                       writer, mi_lttng_element_snapshot_max_size, output->max_size);
                if (ret) {
                        goto mi_error;
                }
index 0b605a6442a797ad0822e7d034e016d8abd84e5d..e3aeb8314858badb81ab71684489025e481d6475 100644 (file)
@@ -7,26 +7,27 @@
  *
  */
 
+#include "error.hpp"
+#include "macros.hpp"
+#include "spawn-viewer.hpp"
+
+#include <common/compat/errno.hpp>
+
+#include <lttng/constant.h>
+
 #include <stdbool.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <lttng/constant.h>
-
-#include <common/compat/errno.hpp>
-#include "error.hpp"
-#include "macros.hpp"
-#include "spawn-viewer.hpp"
-
 /*
  * Type is also use as the index in the viewers array. So please, make sure
  * your enum value is in the right order in the array below.
  */
 enum viewer_type {
-       VIEWER_BABELTRACE    = 0,
-       VIEWER_BABELTRACE2   = 1,
-       VIEWER_USER_DEFINED  = 2,
+       VIEWER_BABELTRACE = 0,
+       VIEWER_BABELTRACE2 = 1,
+       VIEWER_USER_DEFINED = 2,
 };
 
 namespace {
@@ -123,8 +124,10 @@ error:
  *
  * The returning pointer is ready to be passed to execvp().
  */
-static char **alloc_argv_from_local_opts(const char **opts, size_t opts_len,
-               const char *trace_path, bool opt_live_mode)
+static char **alloc_argv_from_local_opts(const char **opts,
+                                        size_t opts_len,
+                                        const char *trace_path,
+                                        bool opt_live_mode)
 {
        char **argv;
        size_t mem_len;
@@ -160,7 +163,6 @@ error:
        return argv;
 }
 
-
 /*
  * Spawn viewer with the trace directory path.
  */
@@ -187,9 +189,8 @@ retry_viewer:
                } else {
                        viewer_bin = viewer->exec_name;
                }
-               argv = alloc_argv_from_local_opts(babeltrace2_opts,
-                               ARRAY_SIZE(babeltrace2_opts), trace_path,
-                               opt_live_mode);
+               argv = alloc_argv_from_local_opts(
+                       babeltrace2_opts, ARRAY_SIZE(babeltrace2_opts), trace_path, opt_live_mode);
                break;
        case VIEWER_BABELTRACE:
                if (stat(babeltrace_bin, &status) == 0) {
@@ -197,9 +198,8 @@ retry_viewer:
                } else {
                        viewer_bin = viewer->exec_name;
                }
-               argv = alloc_argv_from_local_opts(babeltrace_opts,
-                               ARRAY_SIZE(babeltrace_opts), trace_path,
-                               opt_live_mode);
+               argv = alloc_argv_from_local_opts(
+                       babeltrace_opts, ARRAY_SIZE(babeltrace_opts), trace_path, opt_live_mode);
                break;
        case VIEWER_USER_DEFINED:
                argv = alloc_argv_from_user_opts(opt_viewer, trace_path);
@@ -224,16 +224,16 @@ retry_viewer:
                        if (viewer->type == VIEWER_BABELTRACE2) {
                                /* Fallback to legacy babeltrace. */
                                DBG("Default viewer \"%s\" not installed on the system, falling back to \"%s\"",
-                                               viewers[VIEWER_BABELTRACE2].exec_name,
-                                               viewers[VIEWER_BABELTRACE].exec_name);
+                                   viewers[VIEWER_BABELTRACE2].exec_name,
+                                   viewers[VIEWER_BABELTRACE].exec_name);
                                viewer = &viewers[VIEWER_BABELTRACE];
                                free(argv);
                                argv = NULL;
                                goto retry_viewer;
                        } else {
                                ERR("Default viewer \"%s\" (and fallback \"%s\") not found on the system",
-                                               viewers[VIEWER_BABELTRACE2].exec_name,
-                                               viewers[VIEWER_BABELTRACE].exec_name);
+                                   viewers[VIEWER_BABELTRACE2].exec_name,
+                                   viewers[VIEWER_BABELTRACE].exec_name);
                        }
                } else {
                        PERROR("Failed to launch \"%s\" viewer", viewer_bin);
index d172aeb4b0fd69aaf3284e00283c2cdcab9cd5ce..3fecd87a1b00e6c02c72c6e87001b8a500f9d9bf 100644 (file)
@@ -6,17 +6,17 @@
  */
 
 #define _LGPL_SOURCE
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdbool.h>
-#include <type_traits>
+#include "../macros.hpp"
+#include "string-utils.hpp"
+
 #include <assert.h>
 #include <errno.h>
 #include <stdarg.h>
-
-#include "string-utils.hpp"
-#include "../macros.hpp"
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <type_traits>
 
 enum star_glob_pattern_type_flags {
        STAR_GLOB_PATTERN_TYPE_FLAG_NONE = 0,
@@ -24,13 +24,11 @@ enum star_glob_pattern_type_flags {
        STAR_GLOB_PATTERN_TYPE_FLAG_END_ONLY = 2,
 };
 
-static
-star_glob_pattern_type_flags &operator|=(star_glob_pattern_type_flags &l,
-               star_glob_pattern_type_flags r)
+static star_glob_pattern_type_flags& operator|=(star_glob_pattern_type_flags& l,
+                                               star_glob_pattern_type_flags r)
 {
        using T = std::underlying_type<star_glob_pattern_type_flags>::type;
-       l = static_cast<star_glob_pattern_type_flags> (
-               static_cast<T> (l) | static_cast<T> (r));
+       l = static_cast<star_glob_pattern_type_flags>(static_cast<T>(l) | static_cast<T>(r));
        return l;
 }
 
@@ -81,11 +79,9 @@ end:
        *np = '\0';
 }
 
-static
-enum star_glob_pattern_type_flags strutils_test_glob_pattern(const char *pattern)
+static enum star_glob_pattern_type_flags strutils_test_glob_pattern(const char *pattern)
 {
-       enum star_glob_pattern_type_flags ret =
-               STAR_GLOB_PATTERN_TYPE_FLAG_NONE;
+       enum star_glob_pattern_type_flags ret = STAR_GLOB_PATTERN_TYPE_FLAG_NONE;
        const char *p;
 
        LTTNG_ASSERT(pattern);
@@ -122,8 +118,7 @@ end:
  */
 bool strutils_is_star_glob_pattern(const char *pattern)
 {
-       return strutils_test_glob_pattern(pattern) &
-               STAR_GLOB_PATTERN_TYPE_FLAG_PATTERN;
+       return strutils_test_glob_pattern(pattern) & STAR_GLOB_PATTERN_TYPE_FLAG_PATTERN;
 }
 
 /*
@@ -132,8 +127,7 @@ bool strutils_is_star_glob_pattern(const char *pattern)
  */
 bool strutils_is_star_at_the_end_only_glob_pattern(const char *pattern)
 {
-       return strutils_test_glob_pattern(pattern) &
-               STAR_GLOB_PATTERN_TYPE_FLAG_END_ONLY;
+       return strutils_test_glob_pattern(pattern) & STAR_GLOB_PATTERN_TYPE_FLAG_END_ONLY;
 }
 
 /*
@@ -251,9 +245,9 @@ void strutils_free_null_terminated_array_of_strings(char **array)
  * Returns -1 if there's an error.
  */
 int strutils_split(const char *input,
-               char delim,
-               bool escape_delim,
-               struct lttng_dynamic_pointer_array *out_strings)
+                  char delim,
+                  bool escape_delim,
+                  struct lttng_dynamic_pointer_array *out_strings)
 {
        int ret;
        size_t at;
@@ -305,8 +299,7 @@ int strutils_split(const char *input,
                        goto error;
                }
 
-               ret = lttng_dynamic_pointer_array_add_pointer(
-                               out_strings, substring);
+               ret = lttng_dynamic_pointer_array_add_pointer(out_strings, substring);
                if (ret) {
                        free(substring);
                        goto error;
@@ -364,9 +357,9 @@ end:
        return ret;
 }
 
-size_t strutils_array_of_strings_len(char * const *array)
+size_t strutils_array_of_strings_len(char *const *array)
 {
-       char * const *item;
+       char *const *item;
        size_t count = 0;
 
        LTTNG_ASSERT(array);
@@ -428,7 +421,7 @@ int strutils_appendf(char **s, const char *fmt, ...)
 
        /* Format new string in-place. */
        va_start(args, fmt);
-       ret = vsprintf(&new_str[oldlen], fmt, args); 
+       ret = vsprintf(&new_str[oldlen], fmt, args);
        va_end(args);
 
        if (ret == -1) {
index 4dfeadd81eb9aad643d31b5200f0d59e38e5e921..753b79594754c8e96875faec3ccfa0a7c6d5c72d 100644 (file)
@@ -8,12 +8,12 @@
 #ifndef NTESTPOINT
 
 #define _LGPL_SOURCE
-#include <dlfcn.h>  /* for dlsym   */
+#include "testpoint.hpp"
+
+#include <dlfcn.h> /* for dlsym   */
 #include <stdlib.h> /* for getenv  */
 #include <string.h> /* for strncmp */
 
-#include "testpoint.hpp"
-
 /* Environment variable used to enable the testpoints facilities. */
 static const char *lttng_testpoint_env_var = "LTTNG_TESTPOINT_ENABLE";
 
@@ -28,8 +28,7 @@ static void __attribute__((constructor)) lttng_testpoint_check(void)
        char *testpoint_env_val = NULL;
 
        testpoint_env_val = getenv(lttng_testpoint_env_var);
-       if (testpoint_env_val != NULL
-                       && (strncmp(testpoint_env_val, "1", 1) == 0)) {
+       if (testpoint_env_val != NULL && (strncmp(testpoint_env_val, "1", 1) == 0)) {
                lttng_testpoint_activated = 1;
        }
 }
index fecc0064dbca83358dd65dfb559a1d8cca2e16bf..b46a55852a5f015485856e9a41228506372036df 100644 (file)
@@ -5,11 +5,11 @@
  *
  */
 
-#include <string.h>
+#include "thread.hpp"
 
 #include <common/compat/pthread.hpp>
-#include "thread.hpp"
 
+#include <string.h>
 
 int lttng_thread_setname(const char *name)
 {
@@ -27,4 +27,3 @@ int lttng_thread_setname(const char *name)
 
        return ret;
 }
-
index a60fcf23cfabf4c53edc3085084ca88a77996c76..5155eb82cf1a74329fa7b0a94ca169e619a36ffa 100644 (file)
@@ -32,13 +32,13 @@ int timespec_to_ms(struct timespec ts, unsigned long *ms)
 
        if (ts.tv_sec > ULONG_MAX / MSEC_PER_SEC) {
                errno = EOVERFLOW;
-               return -1;      /* multiplication overflow */
+               return -1; /* multiplication overflow */
        }
        res = ts.tv_sec * MSEC_PER_SEC;
        remain_ms = ULONG_MAX - res;
        if (ts.tv_nsec / NSEC_PER_MSEC > remain_ms) {
                errno = EOVERFLOW;
-               return -1;      /* addition overflow */
+               return -1; /* addition overflow */
        }
        res += ts.tv_nsec / NSEC_PER_MSEC;
        *ms = res;
@@ -47,10 +47,8 @@ int timespec_to_ms(struct timespec ts, unsigned long *ms)
 
 struct timespec timespec_abs_diff(struct timespec t1, struct timespec t2)
 {
-       uint64_t ts1 = (uint64_t) t1.tv_sec * (uint64_t) NSEC_PER_SEC +
-                       (uint64_t) t1.tv_nsec;
-       uint64_t ts2 = (uint64_t) t2.tv_sec * (uint64_t) NSEC_PER_SEC +
-                       (uint64_t) t2.tv_nsec;
+       uint64_t ts1 = (uint64_t) t1.tv_sec * (uint64_t) NSEC_PER_SEC + (uint64_t) t1.tv_nsec;
+       uint64_t ts2 = (uint64_t) t2.tv_sec * (uint64_t) NSEC_PER_SEC + (uint64_t) t2.tv_nsec;
        uint64_t diff = std::max(ts1, ts2) - std::min(ts1, ts2);
        struct timespec res;
 
@@ -59,8 +57,7 @@ struct timespec timespec_abs_diff(struct timespec t1, struct timespec t2)
        return res;
 }
 
-static
-void __attribute__((constructor)) init_locale_utf8_support(void)
+static void __attribute__((constructor)) init_locale_utf8_support(void)
 {
        const char *program_locale = setlocale(LC_ALL, NULL);
        const char *lang = getenv("LANG");
@@ -81,7 +78,8 @@ int time_to_iso8601_str(time_t time, char *str, size_t len)
 
        if (len < ISO8601_STR_LEN) {
                ERR("Buffer too short to format ISO 8601 timestamp: %zu bytes provided when at least %zu are needed",
-                               len, ISO8601_STR_LEN);
+                   len,
+                   ISO8601_STR_LEN);
                ret = -1;
                goto end;
        }
@@ -112,7 +110,8 @@ int time_to_datetime_str(time_t time, char *str, size_t len)
 
        if (len < DATETIME_STR_LEN) {
                ERR("Buffer too short to format to datetime: %zu bytes provided when at least %zu are needed",
-                               len, DATETIME_STR_LEN);
+                   len,
+                   DATETIME_STR_LEN);
                ret = -1;
                goto end;
        }
index 488d0814620f32e4351913231d7596abff0fbdae..8267af0ec8ba473cb27b83874c4aa0cda691608d 100644 (file)
@@ -12,8 +12,8 @@
 #include <common/error.hpp>
 #include <common/fd-tracker/fd-tracker.hpp>
 #include <common/fd-tracker/utils.hpp>
-#include <common/fs-handle.hpp>
 #include <common/fs-handle-internal.hpp>
+#include <common/fs-handle.hpp>
 #include <common/hashtable/hashtable.hpp>
 #include <common/hashtable/utils.hpp>
 #include <common/optional.hpp>
@@ -22,6 +22,7 @@
 #include <common/trace-chunk-registry.hpp>
 #include <common/trace-chunk.hpp>
 #include <common/utils.hpp>
+
 #include <lttng/constant.h>
 
 #include <inttypes.h>
@@ -36,7 +37,7 @@
  * index, i.e. <start-iso-8601>-<end-iso-8601>-<id-uint64_t>.
  */
 #define GENERATED_CHUNK_NAME_LEN (2 * sizeof("YYYYmmddTHHMMSS+HHMM") + MAX_INT_DEC_LEN(uint64_t))
-#define DIR_CREATION_MODE (S_IRWXU | S_IRWXG)
+#define DIR_CREATION_MODE       (S_IRWXU | S_IRWXG)
 
 enum trace_chunk_mode {
        TRACE_CHUNK_MODE_USER,
@@ -52,17 +53,13 @@ enum trace_chunk_mode {
 typedef int (*chunk_command)(struct lttng_trace_chunk *trace_chunk);
 
 /* Move a completed trace chunk to the 'completed' trace archive folder. */
-static
-int lttng_trace_chunk_move_to_completed_post_release(struct lttng_trace_chunk *trace_chunk);
+static int lttng_trace_chunk_move_to_completed_post_release(struct lttng_trace_chunk *trace_chunk);
 /* Empty callback. */
-static
-int lttng_trace_chunk_no_operation(struct lttng_trace_chunk *trace_chunk);
+static int lttng_trace_chunk_no_operation(struct lttng_trace_chunk *trace_chunk);
 /* Unlink old chunk files. */
-static
-int lttng_trace_chunk_delete_post_release(struct lttng_trace_chunk *trace_chunk);
-static
-enum lttng_trace_chunk_status lttng_trace_chunk_rename_path_no_lock(
-               struct lttng_trace_chunk *chunk, const char *path);
+static int lttng_trace_chunk_delete_post_release(struct lttng_trace_chunk *trace_chunk);
+static enum lttng_trace_chunk_status
+lttng_trace_chunk_rename_path_no_lock(struct lttng_trace_chunk *chunk, const char *path);
 
 namespace {
 struct chunk_credentials {
@@ -150,18 +147,13 @@ struct fs_handle_untracked {
 };
 } /* namespace */
 
-static
-int fs_handle_untracked_get_fd(struct fs_handle *handle);
-static
-void fs_handle_untracked_put_fd(struct fs_handle *handle);
-static
-int fs_handle_untracked_unlink(struct fs_handle *handle);
-static
-int fs_handle_untracked_close(struct fs_handle *handle);
-
-static
-const char *lttng_trace_chunk_command_type_str(
-               lttng_trace_chunk_command_type type) {
+static int fs_handle_untracked_get_fd(struct fs_handle *handle);
+static void fs_handle_untracked_put_fd(struct fs_handle *handle);
+static int fs_handle_untracked_unlink(struct fs_handle *handle);
+static int fs_handle_untracked_close(struct fs_handle *handle);
+
+static const char *lttng_trace_chunk_command_type_str(lttng_trace_chunk_command_type type)
+{
        switch (type) {
        case LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED:
                return "move to completed chunk folder";
@@ -176,9 +168,8 @@ const char *lttng_trace_chunk_command_type_str(
        abort();
 };
 
-static
-chunk_command close_command_get_post_release_func(
-               lttng_trace_chunk_command_type type) {
+static chunk_command close_command_get_post_release_func(lttng_trace_chunk_command_type type)
+{
        switch (type) {
        case LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED:
                return lttng_trace_chunk_move_to_completed_post_release;
@@ -193,11 +184,9 @@ chunk_command close_command_get_post_release_func(
        abort();
 };
 
-static
-struct fs_handle *fs_handle_untracked_create(
-               struct lttng_directory_handle *directory_handle,
-               const char *path,
-               int fd)
+static struct fs_handle *fs_handle_untracked_create(struct lttng_directory_handle *directory_handle,
+                                                   const char *path,
+                                                   int fd)
 {
        struct fs_handle_untracked *handle = NULL;
        bool reference_acquired;
@@ -215,7 +204,7 @@ struct fs_handle *fs_handle_untracked_create(
                goto end;
        }
 
-       handle->parent = (typeof(handle->parent)) {
+       handle->parent = (typeof(handle->parent)){
                .get_fd = fs_handle_untracked_get_fd,
                .put_fd = fs_handle_untracked_put_fd,
                .unlink = fs_handle_untracked_unlink,
@@ -234,55 +223,48 @@ end:
        return handle ? &handle->parent : NULL;
 }
 
-static
-int fs_handle_untracked_get_fd(struct fs_handle *_handle)
+static int fs_handle_untracked_get_fd(struct fs_handle *_handle)
 {
-       struct fs_handle_untracked *handle = lttng::utils::container_of(
-                       _handle, &fs_handle_untracked::parent);
+       struct fs_handle_untracked *handle =
+               lttng::utils::container_of(_handle, &fs_handle_untracked::parent);
 
        return handle->fd;
 }
 
-static
-void fs_handle_untracked_put_fd(struct fs_handle *_handle __attribute__((unused)))
+static void fs_handle_untracked_put_fd(struct fs_handle *_handle __attribute__((unused)))
 {
        /* no-op. */
 }
 
-static
-int fs_handle_untracked_unlink(struct fs_handle *_handle)
+static int fs_handle_untracked_unlink(struct fs_handle *_handle)
 {
-       struct fs_handle_untracked *handle = lttng::utils::container_of(
-                       _handle, &fs_handle_untracked::parent);
+       struct fs_handle_untracked *handle =
+               lttng::utils::container_of(_handle, &fs_handle_untracked::parent);
 
-       return lttng_directory_handle_unlink_file(
-                       handle->location.directory_handle,
-                       handle->location.path);
+       return lttng_directory_handle_unlink_file(handle->location.directory_handle,
+                                                 handle->location.path);
 }
 
-static
-void fs_handle_untracked_destroy(struct fs_handle_untracked *handle)
+static void fs_handle_untracked_destroy(struct fs_handle_untracked *handle)
 {
        lttng_directory_handle_put(handle->location.directory_handle);
        free(handle->location.path);
        free(handle);
 }
 
-static
-int fs_handle_untracked_close(struct fs_handle *_handle)
+static int fs_handle_untracked_close(struct fs_handle *_handle)
 {
-       struct fs_handle_untracked *handle = lttng::utils::container_of(
-                       _handle, &fs_handle_untracked::parent);
+       struct fs_handle_untracked *handle =
+               lttng::utils::container_of(_handle, &fs_handle_untracked::parent);
        int ret = close(handle->fd);
 
        fs_handle_untracked_destroy(handle);
        return ret;
 }
 
-static
-bool lttng_trace_chunk_registry_element_equals(
-               const struct lttng_trace_chunk_registry_element *a,
-               const struct lttng_trace_chunk_registry_element *b)
+static bool
+lttng_trace_chunk_registry_element_equals(const struct lttng_trace_chunk_registry_element *a,
+                                         const struct lttng_trace_chunk_registry_element *b)
 {
        if (a->session_id != b->session_id) {
                goto not_equal;
@@ -298,24 +280,19 @@ not_equal:
        return false;
 }
 
-static
-int lttng_trace_chunk_registry_element_match(struct cds_lfht_node *node,
-               const void *key)
+static int lttng_trace_chunk_registry_element_match(struct cds_lfht_node *node, const void *key)
 {
        const struct lttng_trace_chunk_registry_element *element_a, *element_b;
 
        element_a = (const struct lttng_trace_chunk_registry_element *) key;
-       element_b = caa_container_of(node, typeof(*element_b),
-                       trace_chunk_registry_ht_node);
+       element_b = caa_container_of(node, typeof(*element_b), trace_chunk_registry_ht_node);
        return lttng_trace_chunk_registry_element_equals(element_a, element_b);
 }
 
-static
-unsigned long lttng_trace_chunk_registry_element_hash(
-               const struct lttng_trace_chunk_registry_element *element)
+static unsigned long
+lttng_trace_chunk_registry_element_hash(const struct lttng_trace_chunk_registry_element *element)
 {
-       unsigned long hash = hash_key_u64(&element->session_id,
-                       lttng_ht_seed);
+       unsigned long hash = hash_key_u64(&element->session_id, lttng_ht_seed);
 
        if (element->chunk.id.is_set) {
                hash ^= hash_key_u64(&element->chunk.id.value, lttng_ht_seed);
@@ -324,19 +301,16 @@ unsigned long lttng_trace_chunk_registry_element_hash(
        return hash;
 }
 
-static
-char *generate_chunk_name(uint64_t chunk_id, time_t creation_timestamp,
-               const time_t *close_timestamp)
+static char *
+generate_chunk_name(uint64_t chunk_id, time_t creation_timestamp, const time_t *close_timestamp)
 {
        int ret = 0;
-       char *new_name= NULL;
+       char *new_name = NULL;
        char start_datetime[ISO8601_STR_LEN] = {};
        /* Add 1 for a '-' prefix. */
        char end_datetime_suffix[ISO8601_STR_LEN + 1] = {};
 
-       ret = time_to_iso8601_str(
-                       creation_timestamp,
-                       start_datetime, sizeof(start_datetime));
+       ret = time_to_iso8601_str(creation_timestamp, start_datetime, sizeof(start_datetime));
        if (ret) {
                ERR("Failed to format trace chunk start date time");
                goto error;
@@ -344,9 +318,7 @@ char *generate_chunk_name(uint64_t chunk_id, time_t creation_timestamp,
        if (close_timestamp) {
                *end_datetime_suffix = '-';
                ret = time_to_iso8601_str(
-                               *close_timestamp,
-                               end_datetime_suffix + 1,
-                               sizeof(end_datetime_suffix) - 1);
+                       *close_timestamp, end_datetime_suffix + 1, sizeof(end_datetime_suffix) - 1);
                if (ret) {
                        ERR("Failed to format trace chunk end date time");
                        goto error;
@@ -357,8 +329,12 @@ char *generate_chunk_name(uint64_t chunk_id, time_t creation_timestamp,
                ERR("Failed to allocate buffer for automatically-generated trace chunk name");
                goto error;
        }
-       ret = snprintf(new_name, GENERATED_CHUNK_NAME_LEN, "%s%s-%" PRIu64,
-                       start_datetime, end_datetime_suffix, chunk_id);
+       ret = snprintf(new_name,
+                      GENERATED_CHUNK_NAME_LEN,
+                      "%s%s-%" PRIu64,
+                      start_datetime,
+                      end_datetime_suffix,
+                      chunk_id);
        if (ret >= GENERATED_CHUNK_NAME_LEN || ret == -1) {
                ERR("Failed to format trace chunk name");
                goto error;
@@ -370,8 +346,7 @@ error:
        return NULL;
 }
 
-static
-void lttng_trace_chunk_init(struct lttng_trace_chunk *chunk)
+static void lttng_trace_chunk_init(struct lttng_trace_chunk *chunk)
 {
        urcu_ref_init(&chunk->ref);
        pthread_mutex_init(&chunk->lock, NULL);
@@ -379,12 +354,10 @@ void lttng_trace_chunk_init(struct lttng_trace_chunk *chunk)
        lttng_dynamic_pointer_array_init(&chunk->files, free);
 }
 
-static
-void lttng_trace_chunk_fini(struct lttng_trace_chunk *chunk)
+static void lttng_trace_chunk_fini(struct lttng_trace_chunk *chunk)
 {
        if (chunk->session_output_directory) {
-               lttng_directory_handle_put(
-                               chunk->session_output_directory);
+               lttng_directory_handle_put(chunk->session_output_directory);
                chunk->session_output_directory = NULL;
        }
        if (chunk->chunk_directory) {
@@ -400,8 +373,7 @@ void lttng_trace_chunk_fini(struct lttng_trace_chunk *chunk)
        pthread_mutex_destroy(&chunk->lock);
 }
 
-static
-struct lttng_trace_chunk *lttng_trace_chunk_allocate(void)
+static struct lttng_trace_chunk *lttng_trace_chunk_allocate(void)
 {
        struct lttng_trace_chunk *chunk = NULL;
 
@@ -421,8 +393,8 @@ struct lttng_trace_chunk *lttng_trace_chunk_create_anonymous(void)
        return lttng_trace_chunk_allocate();
 }
 
-struct lttng_trace_chunk *lttng_trace_chunk_create(
-               uint64_t chunk_id, time_t chunk_creation_time, const char *path)
+struct lttng_trace_chunk *
+lttng_trace_chunk_create(uint64_t chunk_id, time_t chunk_creation_time, const char *path)
 {
        struct lttng_trace_chunk *chunk;
        char chunk_creation_datetime_buf[16] = {};
@@ -435,16 +407,17 @@ struct lttng_trace_chunk *lttng_trace_chunk_create(
 
                /* Don't fail because of this; it is only used for logging. */
                strftime_ret = strftime(chunk_creation_datetime_buf,
-                               sizeof(chunk_creation_datetime_buf),
-                               "%Y%m%d-%H%M%S", timeinfo);
+                                       sizeof(chunk_creation_datetime_buf),
+                                       "%Y%m%d-%H%M%S",
+                                       timeinfo);
                if (strftime_ret) {
-                       chunk_creation_datetime_str =
-                                       chunk_creation_datetime_buf;
+                       chunk_creation_datetime_str = chunk_creation_datetime_buf;
                }
        }
 
        DBG("Creating trace chunk: chunk_id = %" PRIu64 ", creation time = %s",
-                       chunk_id, chunk_creation_datetime_str);
+           chunk_id,
+           chunk_creation_datetime_str);
        chunk = lttng_trace_chunk_allocate();
        if (!chunk) {
                goto end;
@@ -453,8 +426,7 @@ struct lttng_trace_chunk *lttng_trace_chunk_create(
        LTTNG_OPTIONAL_SET(&chunk->id, chunk_id);
        LTTNG_OPTIONAL_SET(&chunk->timestamp_creation, chunk_creation_time);
        if (chunk_id != 0) {
-               chunk->name = generate_chunk_name(chunk_id,
-                               chunk_creation_time, NULL);
+               chunk->name = generate_chunk_name(chunk_id, chunk_creation_time, NULL);
                if (!chunk->name) {
                        ERR("Failed to allocate trace chunk name storage");
                        goto error;
@@ -474,7 +446,7 @@ struct lttng_trace_chunk *lttng_trace_chunk_create(
                }
        }
 
-       DBG("Chunk name set to \"%s\"", chunk->name ? : "(none)");
+       DBG("Chunk name set to \"%s\"", chunk->name ?: "(none)");
 end:
        return chunk;
 error:
@@ -483,7 +455,7 @@ error:
 }
 
 void lttng_trace_chunk_set_fd_tracker(struct lttng_trace_chunk *chunk,
-               struct fd_tracker *fd_tracker)
+                                     struct fd_tracker *fd_tracker)
 {
        LTTNG_ASSERT(!chunk->session_output_directory);
        LTTNG_ASSERT(!chunk->chunk_directory);
@@ -491,8 +463,7 @@ void lttng_trace_chunk_set_fd_tracker(struct lttng_trace_chunk *chunk,
        chunk->fd_tracker = fd_tracker;
 }
 
-struct lttng_trace_chunk *lttng_trace_chunk_copy(
-               struct lttng_trace_chunk *source_chunk)
+struct lttng_trace_chunk *lttng_trace_chunk_copy(struct lttng_trace_chunk *source_chunk)
 {
        struct lttng_trace_chunk *new_chunk = lttng_trace_chunk_allocate();
 
@@ -505,7 +476,7 @@ struct lttng_trace_chunk *lttng_trace_chunk_copy(
         * A new chunk is always a user; it shall create no new trace
         * subdirectories.
         */
-       new_chunk->mode = (typeof(new_chunk->mode)) {
+       new_chunk->mode = (typeof(new_chunk->mode)){
                .is_set = true,
                .value = TRACE_CHUNK_MODE_USER,
        };
@@ -519,16 +490,14 @@ struct lttng_trace_chunk *lttng_trace_chunk_copy(
        if (source_chunk->name) {
                new_chunk->name = strdup(source_chunk->name);
                if (!new_chunk->name) {
-                       ERR("Failed to copy source trace chunk name in %s()",
-                                       __FUNCTION__);
+                       ERR("Failed to copy source trace chunk name in %s()", __FUNCTION__);
                        goto error_unlock;
                }
        }
        if (source_chunk->path) {
                new_chunk->path = strdup(source_chunk->path);
                if (!new_chunk->path) {
-                       ERR("Failed to copy source trace chunk path in %s()",
-                                       __FUNCTION__);
+                       ERR("Failed to copy source trace chunk path in %s()", __FUNCTION__);
                }
        }
        new_chunk->id = source_chunk->id;
@@ -536,16 +505,15 @@ struct lttng_trace_chunk *lttng_trace_chunk_copy(
        new_chunk->timestamp_close = source_chunk->timestamp_close;
        new_chunk->credentials = source_chunk->credentials;
        if (source_chunk->session_output_directory) {
-               const bool reference_acquired = lttng_directory_handle_get(
-                               source_chunk->session_output_directory);
+               const bool reference_acquired =
+                       lttng_directory_handle_get(source_chunk->session_output_directory);
 
                LTTNG_ASSERT(reference_acquired);
-               new_chunk->session_output_directory =
-                               source_chunk->session_output_directory;
+               new_chunk->session_output_directory = source_chunk->session_output_directory;
        }
        if (source_chunk->chunk_directory) {
-               const bool reference_acquired = lttng_directory_handle_get(
-                               source_chunk->chunk_directory);
+               const bool reference_acquired =
+                       lttng_directory_handle_get(source_chunk->chunk_directory);
 
                LTTNG_ASSERT(reference_acquired);
                new_chunk->chunk_directory = source_chunk->chunk_directory;
@@ -561,8 +529,8 @@ error_unlock:
        return NULL;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_get_id(
-               struct lttng_trace_chunk *chunk, uint64_t *id)
+enum lttng_trace_chunk_status lttng_trace_chunk_get_id(struct lttng_trace_chunk *chunk,
+                                                      uint64_t *id)
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
 
@@ -576,8 +544,8 @@ enum lttng_trace_chunk_status lttng_trace_chunk_get_id(
        return status;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_get_creation_timestamp(
-               struct lttng_trace_chunk *chunk, time_t *creation_ts)
+enum lttng_trace_chunk_status
+lttng_trace_chunk_get_creation_timestamp(struct lttng_trace_chunk *chunk, time_t *creation_ts)
 
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
@@ -592,8 +560,8 @@ enum lttng_trace_chunk_status lttng_trace_chunk_get_creation_timestamp(
        return status;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_get_close_timestamp(
-               struct lttng_trace_chunk *chunk, time_t *close_ts)
+enum lttng_trace_chunk_status lttng_trace_chunk_get_close_timestamp(struct lttng_trace_chunk *chunk,
+                                                                   time_t *close_ts)
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
 
@@ -607,8 +575,8 @@ enum lttng_trace_chunk_status lttng_trace_chunk_get_close_timestamp(
        return status;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_set_close_timestamp(
-               struct lttng_trace_chunk *chunk, time_t close_ts)
+enum lttng_trace_chunk_status lttng_trace_chunk_set_close_timestamp(struct lttng_trace_chunk *chunk,
+                                                                   time_t close_ts)
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
 
@@ -629,15 +597,16 @@ enum lttng_trace_chunk_status lttng_trace_chunk_set_close_timestamp(
         */
        if (chunk->timestamp_creation.value > close_ts) {
                WARN("Set trace chunk close timestamp: close timestamp is before creation timestamp, begin : %ld, close : %ld",
-                               chunk->timestamp_creation.value, close_ts);
+                    chunk->timestamp_creation.value,
+                    close_ts);
        }
 
        LTTNG_OPTIONAL_SET(&chunk->timestamp_close, close_ts);
        if (!chunk->name_overridden) {
                free(chunk->name);
                chunk->name = generate_chunk_name(LTTNG_OPTIONAL_GET(chunk->id),
-                               LTTNG_OPTIONAL_GET(chunk->timestamp_creation),
-                               &close_ts);
+                                                 LTTNG_OPTIONAL_GET(chunk->timestamp_creation),
+                                                 &close_ts);
                if (!chunk->name) {
                        status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                }
@@ -647,9 +616,9 @@ end:
        return status;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_get_name(
-               struct lttng_trace_chunk *chunk, const char **name,
-               bool *name_overridden)
+enum lttng_trace_chunk_status lttng_trace_chunk_get_name(struct lttng_trace_chunk *chunk,
+                                                        const char **name,
+                                                        bool *name_overridden)
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
 
@@ -677,8 +646,7 @@ bool lttng_trace_chunk_get_name_overridden(struct lttng_trace_chunk *chunk)
        return name_overridden;
 }
 
-static
-bool is_valid_chunk_name(const char *name)
+static bool is_valid_chunk_name(const char *name)
 {
        size_t len;
 
@@ -698,8 +666,8 @@ bool is_valid_chunk_name(const char *name)
        return true;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_override_name(
-               struct lttng_trace_chunk *chunk, const char *name)
+enum lttng_trace_chunk_status lttng_trace_chunk_override_name(struct lttng_trace_chunk *chunk,
+                                                             const char *name)
 
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
@@ -707,8 +675,7 @@ enum lttng_trace_chunk_status lttng_trace_chunk_override_name(
 
        DBG("Override trace chunk name from %s to %s", chunk->name, name);
        if (!is_valid_chunk_name(name)) {
-               ERR("Attempted to set an invalid name on a trace chunk: name = %s",
-                               name ? : "NULL");
+               ERR("Attempted to set an invalid name on a trace chunk: name = %s", name ?: "NULL");
                status = LTTNG_TRACE_CHUNK_STATUS_INVALID_ARGUMENT;
                goto end;
        }
@@ -716,7 +683,7 @@ enum lttng_trace_chunk_status lttng_trace_chunk_override_name(
        pthread_mutex_lock(&chunk->lock);
        if (!chunk->id.is_set) {
                ERR("Attempted to set an override name on an anonymous trace chunk: name = %s",
-                               name);
+                   name);
                status = LTTNG_TRACE_CHUNK_STATUS_INVALID_OPERATION;
                goto end_unlock;
        }
@@ -746,9 +713,8 @@ end:
        return status;
 }
 
-static
-enum lttng_trace_chunk_status lttng_trace_chunk_rename_path_no_lock(
-               struct lttng_trace_chunk *chunk, const char *path)
+static enum lttng_trace_chunk_status
+lttng_trace_chunk_rename_path_no_lock(struct lttng_trace_chunk *chunk, const char *path)
 
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
@@ -764,8 +730,7 @@ enum lttng_trace_chunk_status lttng_trace_chunk_rename_path_no_lock(
        old_path = chunk->path;
        DBG("lttng_trace_chunk_rename_path from %s to %s", old_path, path);
 
-       if ((!old_path && !path) ||
-                       (old_path && path && !strcmp(old_path, path)))  {
+       if ((!old_path && !path) || (old_path && path && !strcmp(old_path, path))) {
                goto end;
        }
        /*
@@ -786,8 +751,7 @@ enum lttng_trace_chunk_status lttng_trace_chunk_rename_path_no_lock(
         * is not set (yet), or the session_output_directory is not set
         * (interacting with a relay daemon), there is no rename to perform.
         */
-       if (!chunk->chunk_directory ||
-                       !chunk->session_output_directory) {
+       if (!chunk->chunk_directory || !chunk->session_output_directory) {
                goto skip_move;
        }
 
@@ -803,18 +767,16 @@ enum lttng_trace_chunk_status lttng_trace_chunk_rename_path_no_lock(
                                &chunk->credentials.value.user);
                if (ret) {
                        PERROR("Failed to move trace chunk directory \"%s\" to \"%s\"",
-                                       old_path, path);
+                              old_path,
+                              path);
                        status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                        goto end;
                }
                rename_directory = chunk->fd_tracker ?
-                               fd_tracker_create_directory_handle_from_handle(
-                                               chunk->fd_tracker,
-                                               chunk->session_output_directory,
-                                               path) :
-                               lttng_directory_handle_create_from_handle(
-                                               path,
-                                               chunk->session_output_directory);
+                       fd_tracker_create_directory_handle_from_handle(
+                               chunk->fd_tracker, chunk->session_output_directory, path) :
+                       lttng_directory_handle_create_from_handle(path,
+                                                                 chunk->session_output_directory);
                if (!rename_directory) {
                        ERR("Failed to get handle to trace chunk rename directory");
                        status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
@@ -830,25 +792,25 @@ enum lttng_trace_chunk_status lttng_trace_chunk_rename_path_no_lock(
                chunk->chunk_directory = rename_directory;
                rename_directory = NULL;
        } else if (old_path && old_path[0] == '\0') {
-               size_t i, count = lttng_dynamic_pointer_array_get_count(
+               size_t i,
+                       count = lttng_dynamic_pointer_array_get_count(
                                &chunk->top_level_directories);
 
                ret = lttng_directory_handle_create_subdirectory_as_user(
-                               chunk->session_output_directory,
-                               path,
-                               DIR_CREATION_MODE,
-                               LTTNG_OPTIONAL_GET(chunk->credentials).use_current_user ?
-                                       NULL :
-                                       &chunk->credentials.value.user);
+                       chunk->session_output_directory,
+                       path,
+                       DIR_CREATION_MODE,
+                       LTTNG_OPTIONAL_GET(chunk->credentials).use_current_user ?
+                               NULL :
+                               &chunk->credentials.value.user);
                if (ret) {
-                       PERROR("Failed to create trace chunk rename directory \"%s\"",
-                                       path);
+                       PERROR("Failed to create trace chunk rename directory \"%s\"", path);
                        status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                        goto end;
                }
 
                rename_directory = lttng_directory_handle_create_from_handle(
-                               path, chunk->session_output_directory);
+                       path, chunk->session_output_directory);
                if (!rename_directory) {
                        ERR("Failed to get handle to trace chunk rename directory");
                        status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
@@ -862,16 +824,16 @@ enum lttng_trace_chunk_status lttng_trace_chunk_rename_path_no_lock(
                                        &chunk->top_level_directories, i);
 
                        ret = lttng_directory_handle_rename_as_user(
-                                       chunk->chunk_directory,
-                                       top_level_name,
-                                       rename_directory,
-                                       top_level_name,
-                                       LTTNG_OPTIONAL_GET(chunk->credentials).use_current_user ?
-                                               NULL :
-                                               &chunk->credentials.value.user);
+                               chunk->chunk_directory,
+                               top_level_name,
+                               rename_directory,
+                               top_level_name,
+                               LTTNG_OPTIONAL_GET(chunk->credentials).use_current_user ?
+                                       NULL :
+                                       &chunk->credentials.value.user);
                        if (ret) {
                                PERROR("Failed to move \"%s\" to trace chunk rename directory",
-                                               top_level_name);
+                                      top_level_name);
                                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                                goto end;
                        }
@@ -885,10 +847,11 @@ enum lttng_trace_chunk_status lttng_trace_chunk_rename_path_no_lock(
                chunk->chunk_directory = rename_directory;
                rename_directory = NULL;
        } else if (old_path) {
-               size_t i, count = lttng_dynamic_pointer_array_get_count(
+               size_t i,
+                       count = lttng_dynamic_pointer_array_get_count(
                                &chunk->top_level_directories);
-               const bool reference_acquired = lttng_directory_handle_get(
-                               chunk->session_output_directory);
+               const bool reference_acquired =
+                       lttng_directory_handle_get(chunk->session_output_directory);
 
                LTTNG_ASSERT(reference_acquired);
                rename_directory = chunk->session_output_directory;
@@ -900,16 +863,16 @@ enum lttng_trace_chunk_status lttng_trace_chunk_rename_path_no_lock(
                                        &chunk->top_level_directories, i);
 
                        ret = lttng_directory_handle_rename_as_user(
-                                       chunk->chunk_directory,
-                                       top_level_name,
-                                       rename_directory,
-                                       top_level_name,
-                                       LTTNG_OPTIONAL_GET(chunk->credentials).use_current_user ?
-                                               NULL :
-                                               &chunk->credentials.value.user);
+                               chunk->chunk_directory,
+                               top_level_name,
+                               rename_directory,
+                               top_level_name,
+                               LTTNG_OPTIONAL_GET(chunk->credentials).use_current_user ?
+                                       NULL :
+                                       &chunk->credentials.value.user);
                        if (ret) {
                                PERROR("Failed to move \"%s\" to trace chunk rename directory",
-                                               top_level_name);
+                                      top_level_name);
                                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                                goto end;
                        }
@@ -925,11 +888,9 @@ enum lttng_trace_chunk_status lttng_trace_chunk_rename_path_no_lock(
 
                /* Remove old directory. */
                status = (lttng_trace_chunk_status) lttng_directory_handle_remove_subdirectory(
-                               chunk->session_output_directory,
-                               old_path);
+                       chunk->session_output_directory, old_path);
                if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
-                       ERR("Error removing subdirectory '%s' file when deleting chunk",
-                               old_path);
+                       ERR("Error removing subdirectory '%s' file when deleting chunk", old_path);
                        goto end;
                }
        } else {
@@ -952,8 +913,8 @@ end:
        return status;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_rename_path(
-               struct lttng_trace_chunk *chunk, const char *path)
+enum lttng_trace_chunk_status lttng_trace_chunk_rename_path(struct lttng_trace_chunk *chunk,
+                                                           const char *path)
 
 {
        enum lttng_trace_chunk_status status;
@@ -965,9 +926,9 @@ enum lttng_trace_chunk_status lttng_trace_chunk_rename_path(
        return status;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_get_credentials(
-               struct lttng_trace_chunk *chunk,
-               struct lttng_credentials *credentials)
+enum lttng_trace_chunk_status
+lttng_trace_chunk_get_credentials(struct lttng_trace_chunk *chunk,
+                                 struct lttng_credentials *credentials)
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
 
@@ -986,9 +947,9 @@ enum lttng_trace_chunk_status lttng_trace_chunk_get_credentials(
        return status;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_set_credentials(
-               struct lttng_trace_chunk *chunk,
-               const struct lttng_credentials *user_credentials)
+enum lttng_trace_chunk_status
+lttng_trace_chunk_set_credentials(struct lttng_trace_chunk *chunk,
+                                 const struct lttng_credentials *user_credentials)
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
        const struct chunk_credentials credentials = {
@@ -1007,8 +968,8 @@ end:
        return status;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_set_credentials_current_user(
-               struct lttng_trace_chunk *chunk)
+enum lttng_trace_chunk_status
+lttng_trace_chunk_set_credentials_current_user(struct lttng_trace_chunk *chunk)
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
        const struct chunk_credentials credentials = {
@@ -1027,10 +988,9 @@ end:
        return status;
 }
 
-
-enum lttng_trace_chunk_status lttng_trace_chunk_set_as_owner(
-               struct lttng_trace_chunk *chunk,
-               struct lttng_directory_handle *session_output_directory)
+enum lttng_trace_chunk_status
+lttng_trace_chunk_set_as_owner(struct lttng_trace_chunk *chunk,
+                              struct lttng_directory_handle *session_output_directory)
 {
        int ret;
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
@@ -1053,26 +1013,22 @@ enum lttng_trace_chunk_status lttng_trace_chunk_set_as_owner(
        }
        if (chunk->path && chunk->path[0] != '\0') {
                ret = lttng_directory_handle_create_subdirectory_as_user(
-                               session_output_directory,
-                               chunk->path,
-                               DIR_CREATION_MODE,
-                               !chunk->credentials.value.use_current_user ?
-                                       &chunk->credentials.value.user : NULL);
+                       session_output_directory,
+                       chunk->path,
+                       DIR_CREATION_MODE,
+                       !chunk->credentials.value.use_current_user ?
+                               &chunk->credentials.value.user :
+                               NULL);
                if (ret) {
-                       PERROR("Failed to create chunk output directory \"%s\"",
-                               chunk->path);
+                       PERROR("Failed to create chunk output directory \"%s\"", chunk->path);
                        status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                        goto end;
                }
-               chunk_directory_handle =
-                               chunk->fd_tracker ?
-                                       fd_tracker_create_directory_handle_from_handle(
-                                                       chunk->fd_tracker,
-                                                       session_output_directory,
-                                                       chunk->path) :
-                                       lttng_directory_handle_create_from_handle(
-                                                       chunk->path,
-                                                       session_output_directory);
+               chunk_directory_handle = chunk->fd_tracker ?
+                       fd_tracker_create_directory_handle_from_handle(
+                               chunk->fd_tracker, session_output_directory, chunk->path) :
+                       lttng_directory_handle_create_from_handle(chunk->path,
+                                                                 session_output_directory);
                if (!chunk_directory_handle) {
                        /* The function already logs on all error paths. */
                        status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
@@ -1083,16 +1039,14 @@ enum lttng_trace_chunk_status lttng_trace_chunk_set_as_owner(
                 * A nameless chunk does not need its own output directory.
                 * The session's output directory will be used.
                 */
-               reference_acquired = lttng_directory_handle_get(
-                               session_output_directory);
+               reference_acquired = lttng_directory_handle_get(session_output_directory);
 
                LTTNG_ASSERT(reference_acquired);
                chunk_directory_handle = session_output_directory;
        }
        chunk->chunk_directory = chunk_directory_handle;
        chunk_directory_handle = NULL;
-       reference_acquired = lttng_directory_handle_get(
-                       session_output_directory);
+       reference_acquired = lttng_directory_handle_get(session_output_directory);
        LTTNG_ASSERT(reference_acquired);
        chunk->session_output_directory = session_output_directory;
        LTTNG_OPTIONAL_SET(&chunk->mode, TRACE_CHUNK_MODE_OWNER);
@@ -1101,9 +1055,9 @@ end:
        return status;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_set_as_user(
-               struct lttng_trace_chunk *chunk,
-               struct lttng_directory_handle *chunk_directory)
+enum lttng_trace_chunk_status
+lttng_trace_chunk_set_as_user(struct lttng_trace_chunk *chunk,
+                             struct lttng_directory_handle *chunk_directory)
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
        bool reference_acquired;
@@ -1128,9 +1082,8 @@ end:
 }
 
 enum lttng_trace_chunk_status
-lttng_trace_chunk_get_session_output_directory_handle(
-               struct lttng_trace_chunk *chunk,
-               struct lttng_directory_handle **handle)
+lttng_trace_chunk_get_session_output_directory_handle(struct lttng_trace_chunk *chunk,
+                                                     struct lttng_directory_handle **handle)
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
 
@@ -1140,8 +1093,8 @@ lttng_trace_chunk_get_session_output_directory_handle(
                *handle = NULL;
                goto end;
        } else {
-               const bool reference_acquired = lttng_directory_handle_get(
-                               chunk->session_output_directory);
+               const bool reference_acquired =
+                       lttng_directory_handle_get(chunk->session_output_directory);
 
                LTTNG_ASSERT(reference_acquired);
                *handle = chunk->session_output_directory;
@@ -1151,9 +1104,9 @@ end:
        return status;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_borrow_chunk_directory_handle(
-               struct lttng_trace_chunk *chunk,
-               const struct lttng_directory_handle **handle)
+enum lttng_trace_chunk_status
+lttng_trace_chunk_borrow_chunk_directory_handle(struct lttng_trace_chunk *chunk,
+                                               const struct lttng_directory_handle **handle)
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
 
@@ -1170,21 +1123,18 @@ end:
 }
 
 /* Add a top-level directory to the trace chunk if it was previously unknown. */
-static
-int add_top_level_directory_unique(struct lttng_trace_chunk *chunk,
-               const char *new_path)
+static int add_top_level_directory_unique(struct lttng_trace_chunk *chunk, const char *new_path)
 {
        int ret = 0;
        bool found = false;
-       size_t i, count = lttng_dynamic_pointer_array_get_count(
-                       &chunk->top_level_directories);
+       size_t i, count = lttng_dynamic_pointer_array_get_count(&chunk->top_level_directories);
        const char *new_path_separator_pos = strchr(new_path, '/');
-       const ptrdiff_t new_path_top_level_len = new_path_separator_pos ?
-                       new_path_separator_pos - new_path : strlen(new_path);
+       const ptrdiff_t new_path_top_level_len =
+               new_path_separator_pos ? new_path_separator_pos - new_path : strlen(new_path);
 
        for (i = 0; i < count; i++) {
                const char *path = (const char *) lttng_dynamic_pointer_array_get_pointer(
-                               &chunk->top_level_directories, i);
+                       &chunk->top_level_directories, i);
                const ptrdiff_t path_top_level_len = strlen(path);
 
                if (path_top_level_len != new_path_top_level_len) {
@@ -1200,14 +1150,14 @@ int add_top_level_directory_unique(struct lttng_trace_chunk *chunk,
                char *copy = lttng_strndup(new_path, new_path_top_level_len);
 
                DBG("Adding new top-level directory \"%s\" to trace chunk \"%s\"",
-                               new_path, chunk->name ? : "(unnamed)");
+                   new_path,
+                   chunk->name ?: "(unnamed)");
                if (!copy) {
                        PERROR("Failed to copy path");
                        ret = -1;
                        goto end;
                }
-               ret = lttng_dynamic_pointer_array_add_pointer(
-                               &chunk->top_level_directories, copy);
+               ret = lttng_dynamic_pointer_array_add_pointer(&chunk->top_level_directories, copy);
                if (ret) {
                        ERR("Allocation failure while adding top-level directory entry to a trace chunk");
                        free(copy);
@@ -1218,9 +1168,8 @@ end:
        return ret;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_create_subdirectory(
-               struct lttng_trace_chunk *chunk,
-               const char *path)
+enum lttng_trace_chunk_status lttng_trace_chunk_create_subdirectory(struct lttng_trace_chunk *chunk,
+                                                                   const char *path)
 {
        int ret;
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
@@ -1233,37 +1182,34 @@ enum lttng_trace_chunk_status lttng_trace_chunk_create_subdirectory(
                 * directory is created.
                 */
                ERR("Credentials of trace chunk are unset: refusing to create subdirectory \"%s\"",
-                               path);
+                   path);
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
        }
-       if (!chunk->mode.is_set ||
-                       chunk->mode.value != TRACE_CHUNK_MODE_OWNER) {
+       if (!chunk->mode.is_set || chunk->mode.value != TRACE_CHUNK_MODE_OWNER) {
                ERR("Attempted to create trace chunk subdirectory \"%s\" through a non-owner chunk",
-                               path);
+                   path);
                status = LTTNG_TRACE_CHUNK_STATUS_INVALID_OPERATION;
                goto end;
        }
        if (!chunk->chunk_directory) {
                ERR("Attempted to create trace chunk subdirectory \"%s\" before setting the chunk output directory",
-                               path);
+                   path);
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
        }
        if (*path == '/') {
-               ERR("Refusing to create absolute trace chunk directory \"%s\"",
-                               path);
+               ERR("Refusing to create absolute trace chunk directory \"%s\"", path);
                status = LTTNG_TRACE_CHUNK_STATUS_INVALID_ARGUMENT;
                goto end;
        }
        ret = lttng_directory_handle_create_subdirectory_recursive_as_user(
-                       chunk->chunk_directory, path,
-                       DIR_CREATION_MODE,
-                       chunk->credentials.value.use_current_user ?
-                                       NULL : &chunk->credentials.value.user);
+               chunk->chunk_directory,
+               path,
+               DIR_CREATION_MODE,
+               chunk->credentials.value.use_current_user ? NULL : &chunk->credentials.value.user);
        if (ret) {
-               PERROR("Failed to create trace chunk subdirectory \"%s\"",
-                               path);
+               PERROR("Failed to create trace chunk subdirectory \"%s\"", path);
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
        }
@@ -1280,17 +1226,15 @@ end:
 /*
  * TODO: Implement O(1) lookup.
  */
-static
-bool lttng_trace_chunk_find_file(struct lttng_trace_chunk *chunk,
-               const char *path, size_t *index)
+static bool
+lttng_trace_chunk_find_file(struct lttng_trace_chunk *chunk, const char *path, size_t *index)
 {
        size_t i, count;
 
        count = lttng_dynamic_pointer_array_get_count(&chunk->files);
        for (i = 0; i < count; i++) {
                const char *iter_path =
-                       (const char *) lttng_dynamic_pointer_array_get_pointer(
-                               &chunk->files, i);
+                       (const char *) lttng_dynamic_pointer_array_get_pointer(&chunk->files, i);
                if (!strcmp(iter_path, path)) {
                        if (index) {
                                *index = i;
@@ -1301,10 +1245,8 @@ bool lttng_trace_chunk_find_file(struct lttng_trace_chunk *chunk,
        return false;
 }
 
-static
-enum lttng_trace_chunk_status lttng_trace_chunk_add_file(
-               struct lttng_trace_chunk *chunk,
-               const char *path)
+static enum lttng_trace_chunk_status lttng_trace_chunk_add_file(struct lttng_trace_chunk *chunk,
+                                                               const char *path)
 {
        char *copy;
        int ret;
@@ -1313,16 +1255,14 @@ enum lttng_trace_chunk_status lttng_trace_chunk_add_file(
        if (lttng_trace_chunk_find_file(chunk, path, NULL)) {
                return LTTNG_TRACE_CHUNK_STATUS_OK;
        }
-       DBG("Adding new file \"%s\" to trace chunk \"%s\"",
-                       path, chunk->name ? : "(unnamed)");
+       DBG("Adding new file \"%s\" to trace chunk \"%s\"", path, chunk->name ?: "(unnamed)");
        copy = strdup(path);
        if (!copy) {
                PERROR("Failed to copy path");
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
        }
-       ret = lttng_dynamic_pointer_array_add_pointer(
-                       &chunk->files, copy);
+       ret = lttng_dynamic_pointer_array_add_pointer(&chunk->files, copy);
        if (ret) {
                ERR("Allocation failure while adding file to a trace chunk");
                free(copy);
@@ -1333,10 +1273,7 @@ end:
        return status;
 }
 
-static
-void lttng_trace_chunk_remove_file(
-               struct lttng_trace_chunk *chunk,
-               const char *path)
+static void lttng_trace_chunk_remove_file(struct lttng_trace_chunk *chunk, const char *path)
 {
        size_t index;
        bool found;
@@ -1346,19 +1283,17 @@ void lttng_trace_chunk_remove_file(
        if (!found) {
                return;
        }
-       ret = lttng_dynamic_pointer_array_remove_pointer(
-                       &chunk->files, index);
+       ret = lttng_dynamic_pointer_array_remove_pointer(&chunk->files, index);
        LTTNG_ASSERT(!ret);
 }
 
-static
-enum lttng_trace_chunk_status _lttng_trace_chunk_open_fs_handle_locked(
-               struct lttng_trace_chunk *chunk,
-               const char *file_path,
-               int flags,
-               mode_t mode,
-               struct fs_handle **out_handle,
-               bool expect_no_file)
+static enum lttng_trace_chunk_status
+_lttng_trace_chunk_open_fs_handle_locked(struct lttng_trace_chunk *chunk,
+                                        const char *file_path,
+                                        int flags,
+                                        mode_t mode,
+                                        struct fs_handle **out_handle,
+                                        bool expect_no_file)
 {
        int ret;
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
@@ -1370,13 +1305,13 @@ enum lttng_trace_chunk_status _lttng_trace_chunk_open_fs_handle_locked(
                 * file is created.
                 */
                ERR("Credentials of trace chunk are unset: refusing to open file \"%s\"",
-                               file_path);
+                   file_path);
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
        }
        if (!chunk->chunk_directory) {
                ERR("Attempted to open trace chunk file \"%s\" before setting the chunk output directory",
-                               file_path);
+                   file_path);
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
        }
@@ -1386,18 +1321,20 @@ enum lttng_trace_chunk_status _lttng_trace_chunk_open_fs_handle_locked(
        }
        if (chunk->fd_tracker) {
                LTTNG_ASSERT(chunk->credentials.value.use_current_user);
-               *out_handle = fd_tracker_open_fs_handle(chunk->fd_tracker,
-                               chunk->chunk_directory, file_path, flags, &mode);
+               *out_handle = fd_tracker_open_fs_handle(
+                       chunk->fd_tracker, chunk->chunk_directory, file_path, flags, &mode);
                ret = *out_handle ? 0 : -1;
        } else {
                ret = lttng_directory_handle_open_file_as_user(
-                               chunk->chunk_directory, file_path, flags, mode,
-                               chunk->credentials.value.use_current_user ?
-                                               NULL :
-                                               &chunk->credentials.value.user);
+                       chunk->chunk_directory,
+                       file_path,
+                       flags,
+                       mode,
+                       chunk->credentials.value.use_current_user ? NULL :
+                                                                   &chunk->credentials.value.user);
                if (ret >= 0) {
-                       *out_handle = fs_handle_untracked_create(
-                                       chunk->chunk_directory, file_path, ret);
+                       *out_handle =
+                               fs_handle_untracked_create(chunk->chunk_directory, file_path, ret);
                        if (!*out_handle) {
                                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                                goto end;
@@ -1409,7 +1346,9 @@ enum lttng_trace_chunk_status _lttng_trace_chunk_open_fs_handle_locked(
                        status = LTTNG_TRACE_CHUNK_STATUS_NO_FILE;
                } else {
                        PERROR("Failed to open file relative to trace chunk file_path = \"%s\", flags = %d, mode = %d",
-                               file_path, flags, (int) mode);
+                              file_path,
+                              flags,
+                              (int) mode);
                        status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                }
                lttng_trace_chunk_remove_file(chunk, file_path);
@@ -1419,30 +1358,28 @@ end:
        return status;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_open_fs_handle(
-               struct lttng_trace_chunk *chunk,
-               const char *file_path,
-               int flags,
-               mode_t mode,
-               struct fs_handle **out_handle,
-               bool expect_no_file)
+enum lttng_trace_chunk_status lttng_trace_chunk_open_fs_handle(struct lttng_trace_chunk *chunk,
+                                                              const char *file_path,
+                                                              int flags,
+                                                              mode_t mode,
+                                                              struct fs_handle **out_handle,
+                                                              bool expect_no_file)
 {
        enum lttng_trace_chunk_status status;
 
        pthread_mutex_lock(&chunk->lock);
-       status = _lttng_trace_chunk_open_fs_handle_locked(chunk, file_path,
-                       flags, mode, out_handle, expect_no_file);
+       status = _lttng_trace_chunk_open_fs_handle_locked(
+               chunk, file_path, flags, mode, out_handle, expect_no_file);
        pthread_mutex_unlock(&chunk->lock);
        return status;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_open_file(
-               struct lttng_trace_chunk *chunk,
-               const char *file_path,
-               int flags,
-               mode_t mode,
-               int *out_fd,
-               bool expect_no_file)
+enum lttng_trace_chunk_status lttng_trace_chunk_open_file(struct lttng_trace_chunk *chunk,
+                                                         const char *file_path,
+                                                         int flags,
+                                                         mode_t mode,
+                                                         int *out_fd,
+                                                         bool expect_no_file)
 {
        enum lttng_trace_chunk_status status;
        struct fs_handle *fs_handle;
@@ -1453,8 +1390,8 @@ enum lttng_trace_chunk_status lttng_trace_chunk_open_file(
         * used since the resulting file descriptor would not be tracked.
         */
        LTTNG_ASSERT(!chunk->fd_tracker);
-       status = _lttng_trace_chunk_open_fs_handle_locked(chunk, file_path,
-                       flags, mode, &fs_handle, expect_no_file);
+       status = _lttng_trace_chunk_open_fs_handle_locked(
+               chunk, file_path, flags, mode, &fs_handle, expect_no_file);
        pthread_mutex_unlock(&chunk->lock);
 
        if (status == LTTNG_TRACE_CHUNK_STATUS_OK) {
@@ -1462,15 +1399,14 @@ enum lttng_trace_chunk_status lttng_trace_chunk_open_file(
                /*
                 * Does not close the fd; we just "unbox" it from the fs_handle.
                 */
-               fs_handle_untracked_destroy(lttng::utils::container_of(
-                               fs_handle, &fs_handle_untracked::parent));
+               fs_handle_untracked_destroy(
+                       lttng::utils::container_of(fs_handle, &fs_handle_untracked::parent));
        }
 
        return status;
 }
 
-int lttng_trace_chunk_unlink_file(struct lttng_trace_chunk *chunk,
-               const char *file_path)
+int lttng_trace_chunk_unlink_file(struct lttng_trace_chunk *chunk, const char *file_path)
 {
        int ret;
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
@@ -1483,20 +1419,20 @@ int lttng_trace_chunk_unlink_file(struct lttng_trace_chunk *chunk,
                 * file is unlinked.
                 */
                ERR("Credentials of trace chunk are unset: refusing to unlink file \"%s\"",
-                               file_path);
+                   file_path);
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
        }
        if (!chunk->chunk_directory) {
                ERR("Attempted to unlink trace chunk file \"%s\" before setting the chunk output directory",
-                               file_path);
+                   file_path);
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
        }
        ret = lttng_directory_handle_unlink_file_as_user(
-                       chunk->chunk_directory, file_path,
-                       chunk->credentials.value.use_current_user ?
-                                       NULL : &chunk->credentials.value.user);
+               chunk->chunk_directory,
+               file_path,
+               chunk->credentials.value.use_current_user ? NULL : &chunk->credentials.value.user);
        if (ret < 0) {
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
@@ -1507,9 +1443,8 @@ end:
        return status;
 }
 
-static
-int lttng_trace_chunk_remove_subdirectory_recursive(struct lttng_trace_chunk *chunk,
-               const char *path)
+static int lttng_trace_chunk_remove_subdirectory_recursive(struct lttng_trace_chunk *chunk,
+                                                          const char *path)
 {
        int ret;
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
@@ -1522,21 +1457,21 @@ int lttng_trace_chunk_remove_subdirectory_recursive(struct lttng_trace_chunk *ch
                 * directory is removed.
                 */
                ERR("Credentials of trace chunk are unset: refusing to recursively remove directory \"%s\"",
-                               path);
+                   path);
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
        }
        if (!chunk->chunk_directory) {
                ERR("Attempted to recursively remove trace chunk directory \"%s\" before setting the chunk output directory",
-                               path);
+                   path);
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
        }
        ret = lttng_directory_handle_remove_subdirectory_recursive_as_user(
-                       chunk->chunk_directory, path,
-                       chunk->credentials.value.use_current_user ?
-                                       NULL : &chunk->credentials.value.user,
-                       LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
+               chunk->chunk_directory,
+               path,
+               chunk->credentials.value.use_current_user ? NULL : &chunk->credentials.value.user,
+               LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
        if (ret < 0) {
                status = LTTNG_TRACE_CHUNK_STATUS_ERROR;
                goto end;
@@ -1546,23 +1481,18 @@ end:
        return status;
 }
 
-static
-int lttng_trace_chunk_move_to_completed_post_release(
-               struct lttng_trace_chunk *trace_chunk)
+static int lttng_trace_chunk_move_to_completed_post_release(struct lttng_trace_chunk *trace_chunk)
 {
        int ret = 0;
        char *archived_chunk_name = NULL;
        const uint64_t chunk_id = LTTNG_OPTIONAL_GET(trace_chunk->id);
-       const time_t creation_timestamp =
-                       LTTNG_OPTIONAL_GET(trace_chunk->timestamp_creation);
-       const time_t close_timestamp =
-                       LTTNG_OPTIONAL_GET(trace_chunk->timestamp_close);
+       const time_t creation_timestamp = LTTNG_OPTIONAL_GET(trace_chunk->timestamp_creation);
+       const time_t close_timestamp = LTTNG_OPTIONAL_GET(trace_chunk->timestamp_close);
        struct lttng_directory_handle *archived_chunks_directory = NULL;
        enum lttng_trace_chunk_status status;
 
-       if (!trace_chunk->mode.is_set ||
-                       trace_chunk->mode.value != TRACE_CHUNK_MODE_OWNER ||
-                       !trace_chunk->session_output_directory) {
+       if (!trace_chunk->mode.is_set || trace_chunk->mode.value != TRACE_CHUNK_MODE_OWNER ||
+           !trace_chunk->session_output_directory) {
                /*
                 * This command doesn't need to run if the output is remote
                 * or if the trace chunk is not owned by this process.
@@ -1574,8 +1504,7 @@ int lttng_trace_chunk_move_to_completed_post_release(
        LTTNG_ASSERT(!trace_chunk->name_overridden);
        LTTNG_ASSERT(trace_chunk->path);
 
-       archived_chunk_name = generate_chunk_name(chunk_id, creation_timestamp,
-                       &close_timestamp);
+       archived_chunk_name = generate_chunk_name(chunk_id, creation_timestamp, &close_timestamp);
        if (!archived_chunk_name) {
                ERR("Failed to generate archived trace chunk name while renaming trace chunk");
                ret = -1;
@@ -1583,26 +1512,25 @@ int lttng_trace_chunk_move_to_completed_post_release(
        }
 
        ret = lttng_directory_handle_create_subdirectory_as_user(
-                       trace_chunk->session_output_directory,
-                       DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY,
-                       DIR_CREATION_MODE,
-                       !trace_chunk->credentials.value.use_current_user ?
-                                       &trace_chunk->credentials.value.user :
-                                       NULL);
+               trace_chunk->session_output_directory,
+               DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY,
+               DIR_CREATION_MODE,
+               !trace_chunk->credentials.value.use_current_user ?
+                       &trace_chunk->credentials.value.user :
+                       NULL);
        if (ret) {
                PERROR("Failed to create \"" DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY
-                               "\" directory for archived trace chunks");
+                      "\" directory for archived trace chunks");
                goto end;
        }
 
        archived_chunks_directory = trace_chunk->fd_tracker ?
-                       fd_tracker_create_directory_handle_from_handle(
-                                       trace_chunk->fd_tracker,
-                                       trace_chunk->session_output_directory,
-                                       DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY) :
-                       lttng_directory_handle_create_from_handle(
-                                       DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY,
-                                       trace_chunk->session_output_directory);
+               fd_tracker_create_directory_handle_from_handle(
+                       trace_chunk->fd_tracker,
+                       trace_chunk->session_output_directory,
+                       DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY) :
+               lttng_directory_handle_create_from_handle(DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY,
+                                                         trace_chunk->session_output_directory);
        if (!archived_chunks_directory) {
                PERROR("Failed to get handle to archived trace chunks directory");
                ret = -1;
@@ -1614,10 +1542,9 @@ int lttng_trace_chunk_move_to_completed_post_release(
         * the creation of the next chunk. This happens if a rotation is
         * performed while tracing is stopped.
         */
-       if (!trace_chunk->path || strcmp(trace_chunk->path,
-                       DEFAULT_CHUNK_TMP_OLD_DIRECTORY)) {
+       if (!trace_chunk->path || strcmp(trace_chunk->path, DEFAULT_CHUNK_TMP_OLD_DIRECTORY)) {
                status = lttng_trace_chunk_rename_path_no_lock(trace_chunk,
-                               DEFAULT_CHUNK_TMP_OLD_DIRECTORY);
+                                                              DEFAULT_CHUNK_TMP_OLD_DIRECTORY);
                if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ERR("Failed to rename chunk to %s", DEFAULT_CHUNK_TMP_OLD_DIRECTORY);
                        ret = -1;
@@ -1626,17 +1553,17 @@ int lttng_trace_chunk_move_to_completed_post_release(
        }
 
        ret = lttng_directory_handle_rename_as_user(
-                       trace_chunk->session_output_directory,
-                       trace_chunk->path,
-                       archived_chunks_directory,
-                       archived_chunk_name,
-                       LTTNG_OPTIONAL_GET(trace_chunk->credentials).use_current_user ?
-                               NULL :
-                               &trace_chunk->credentials.value.user);
+               trace_chunk->session_output_directory,
+               trace_chunk->path,
+               archived_chunks_directory,
+               archived_chunk_name,
+               LTTNG_OPTIONAL_GET(trace_chunk->credentials).use_current_user ?
+                       NULL :
+                       &trace_chunk->credentials.value.user);
        if (ret) {
                PERROR("Failed to rename folder \"%s\" to \"%s\"",
-                               trace_chunk->path,
-                               archived_chunk_name);
+                      trace_chunk->path,
+                      archived_chunk_name);
        }
 
 end:
@@ -1645,15 +1572,13 @@ end:
        return ret;
 }
 
-static
-int lttng_trace_chunk_no_operation(struct lttng_trace_chunk *trace_chunk __attribute__((unused)))
+static int lttng_trace_chunk_no_operation(struct lttng_trace_chunk *trace_chunk
+                                         __attribute__((unused)))
 {
        return 0;
 }
 
-static
-int lttng_trace_chunk_delete_post_release_user(
-               struct lttng_trace_chunk *trace_chunk)
+static int lttng_trace_chunk_delete_post_release_user(struct lttng_trace_chunk *trace_chunk)
 {
        int ret = 0;
 
@@ -1665,10 +1590,11 @@ int lttng_trace_chunk_delete_post_release_user(
                const char *path;
 
                /* Remove first. */
-               path = (const char *) lttng_dynamic_pointer_array_get_pointer(
-                       &trace_chunk->files, 0);
+               path = (const char *) lttng_dynamic_pointer_array_get_pointer(&trace_chunk->files,
+                                                                             0);
                DBG("Unlink file: %s", path);
-               status = (lttng_trace_chunk_status) lttng_trace_chunk_unlink_file(trace_chunk, path);
+               status =
+                       (lttng_trace_chunk_status) lttng_trace_chunk_unlink_file(trace_chunk, path);
                if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ERR("Error unlinking file '%s' when deleting chunk", path);
                        ret = -1;
@@ -1679,9 +1605,7 @@ end:
        return ret;
 }
 
-static
-int lttng_trace_chunk_delete_post_release_owner(
-               struct lttng_trace_chunk *trace_chunk)
+static int lttng_trace_chunk_delete_post_release_owner(struct lttng_trace_chunk *trace_chunk)
 {
        enum lttng_trace_chunk_status status;
        size_t i, count;
@@ -1698,18 +1622,17 @@ int lttng_trace_chunk_delete_post_release_owner(
        LTTNG_ASSERT(trace_chunk->chunk_directory);
 
        /* Remove empty directories. */
-       count = lttng_dynamic_pointer_array_get_count(
-                       &trace_chunk->top_level_directories);
+       count = lttng_dynamic_pointer_array_get_count(&trace_chunk->top_level_directories);
 
        for (i = 0; i < count; i++) {
-               const char *top_level_name =
-                       (const char *) lttng_dynamic_pointer_array_get_pointer(
-                               &trace_chunk->top_level_directories, i);
+               const char *top_level_name = (const char *) lttng_dynamic_pointer_array_get_pointer(
+                       &trace_chunk->top_level_directories, i);
 
-               status = (lttng_trace_chunk_status) lttng_trace_chunk_remove_subdirectory_recursive(trace_chunk, top_level_name);
+               status = (lttng_trace_chunk_status) lttng_trace_chunk_remove_subdirectory_recursive(
+                       trace_chunk, top_level_name);
                if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                        ERR("Error recursively removing subdirectory '%s' file when deleting chunk",
-                                       top_level_name);
+                           top_level_name);
                        ret = -1;
                        break;
                }
@@ -1719,12 +1642,12 @@ int lttng_trace_chunk_delete_post_release_owner(
                trace_chunk->chunk_directory = NULL;
 
                if (trace_chunk->path && trace_chunk->path[0] != '\0') {
-                       status = (lttng_trace_chunk_status) lttng_directory_handle_remove_subdirectory(
-                                       trace_chunk->session_output_directory,
-                                       trace_chunk->path);
+                       status = (lttng_trace_chunk_status)
+                               lttng_directory_handle_remove_subdirectory(
+                                       trace_chunk->session_output_directory, trace_chunk->path);
                        if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
                                ERR("Error removing subdirectory '%s' file when deleting chunk",
-                                       trace_chunk->path);
+                                   trace_chunk->path);
                                ret = -1;
                        }
                }
@@ -1741,9 +1664,7 @@ end:
  * session daemon is the owner of the chunk. Unlink all files owned by each
  * consumer daemon.
  */
-static
-int lttng_trace_chunk_delete_post_release(
-               struct lttng_trace_chunk *trace_chunk)
+static int lttng_trace_chunk_delete_post_release(struct lttng_trace_chunk *trace_chunk)
 {
        if (!trace_chunk->chunk_directory) {
                return 0;
@@ -1756,9 +1677,9 @@ int lttng_trace_chunk_delete_post_release(
        }
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_get_close_command(
-               struct lttng_trace_chunk *chunk,
-               enum lttng_trace_chunk_command_type *command_type)
+enum lttng_trace_chunk_status
+lttng_trace_chunk_get_close_command(struct lttng_trace_chunk *chunk,
+                                   enum lttng_trace_chunk_command_type *command_type)
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
 
@@ -1773,14 +1694,14 @@ enum lttng_trace_chunk_status lttng_trace_chunk_get_close_command(
        return status;
 }
 
-enum lttng_trace_chunk_status lttng_trace_chunk_set_close_command(
-               struct lttng_trace_chunk *chunk,
-               enum lttng_trace_chunk_command_type close_command)
+enum lttng_trace_chunk_status
+lttng_trace_chunk_set_close_command(struct lttng_trace_chunk *chunk,
+                                   enum lttng_trace_chunk_command_type close_command)
 {
        enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK;
 
        if (close_command < LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED ||
-                       close_command >= LTTNG_TRACE_CHUNK_COMMAND_TYPE_MAX) {
+           close_command >= LTTNG_TRACE_CHUNK_COMMAND_TYPE_MAX) {
                status = LTTNG_TRACE_CHUNK_STATUS_INVALID_ARGUMENT;
                goto end;
        }
@@ -1788,11 +1709,11 @@ enum lttng_trace_chunk_status lttng_trace_chunk_set_close_command(
        pthread_mutex_lock(&chunk->lock);
        if (chunk->close_command.is_set) {
                DBG("Overriding trace chunk close command from \"%s\" to \"%s\"",
-                               lttng_trace_chunk_command_type_str(chunk->close_command.value),
-                               lttng_trace_chunk_command_type_str(close_command));
+                   lttng_trace_chunk_command_type_str(chunk->close_command.value),
+                   lttng_trace_chunk_command_type_str(close_command));
        } else {
                DBG("Setting trace chunk close command to \"%s\"",
-                               lttng_trace_chunk_command_type_str(close_command));
+                   lttng_trace_chunk_command_type_str(close_command));
        }
        /*
         * Unset close command for no-op for backward compatibility with relayd
@@ -1808,8 +1729,7 @@ end:
        return status;
 }
 
-const char *lttng_trace_chunk_command_type_get_name(
-               enum lttng_trace_chunk_command_type command)
+const char *lttng_trace_chunk_command_type_get_name(enum lttng_trace_chunk_command_type command)
 {
        switch (command) {
        case LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED:
@@ -1824,7 +1744,7 @@ const char *lttng_trace_chunk_command_type_get_name(
 }
 
 bool lttng_trace_chunk_ids_equal(const struct lttng_trace_chunk *chunk_a,
-               const struct lttng_trace_chunk *chunk_b)
+                                const struct lttng_trace_chunk *chunk_b)
 {
        bool equal = false;
 
@@ -1858,26 +1778,25 @@ bool lttng_trace_chunk_get(struct lttng_trace_chunk *chunk)
        return urcu_ref_get_unless_zero(&chunk->ref);
 }
 
-static
-void free_lttng_trace_chunk_registry_element(struct rcu_head *node)
+static void free_lttng_trace_chunk_registry_element(struct rcu_head *node)
 {
-       struct lttng_trace_chunk_registry_element *element = lttng::utils::container_of(
-                       node, &lttng_trace_chunk_registry_element::rcu_node);
+       struct lttng_trace_chunk_registry_element *element =
+               lttng::utils::container_of(node, &lttng_trace_chunk_registry_element::rcu_node);
 
        free(element);
 }
 
-static
-void lttng_trace_chunk_release(struct urcu_ref *ref)
+static void lttng_trace_chunk_release(struct urcu_ref *ref)
 {
        struct lttng_trace_chunk *chunk = lttng::utils::container_of(ref, &lttng_trace_chunk::ref);
 
        if (chunk->close_command.is_set) {
-               chunk_command func = close_command_get_post_release_func(chunk->close_command.value);
+               chunk_command func =
+                       close_command_get_post_release_func(chunk->close_command.value);
 
                if (func(chunk)) {
                        ERR("Trace chunk post-release command %s has failed.",
-                                       lttng_trace_chunk_command_type_str(chunk->close_command.value));
+                           lttng_trace_chunk_command_type_str(chunk->close_command.value));
                }
        }
 
@@ -1902,19 +1821,16 @@ void lttng_trace_chunk_release(struct urcu_ref *ref)
                 */
                lttng_trace_chunk_fini(chunk);
 
-               element = lttng::utils::container_of(
-                               chunk, &lttng_trace_chunk_registry_element::chunk);
+               element = lttng::utils::container_of(chunk,
+                                                    &lttng_trace_chunk_registry_element::chunk);
                if (element->registry) {
                        rcu_read_lock();
-                       cds_lfht_del(element->registry->ht,
-                                       &element->trace_chunk_registry_ht_node);
+                       cds_lfht_del(element->registry->ht, &element->trace_chunk_registry_ht_node);
                        rcu_read_unlock();
-                       call_rcu(&element->rcu_node,
-                                       free_lttng_trace_chunk_registry_element);
+                       call_rcu(&element->rcu_node, free_lttng_trace_chunk_registry_element);
                } else {
                        /* Never published, can be free'd immediately. */
-                       free_lttng_trace_chunk_registry_element(
-                                       &element->rcu_node);
+                       free_lttng_trace_chunk_registry_element(&element->rcu_node);
                }
        } else {
                /* Not RCU-protected, free immediately. */
@@ -1941,8 +1857,8 @@ struct lttng_trace_chunk_registry *lttng_trace_chunk_registry_create(void)
                goto end;
        }
 
-       registry->ht = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0,
-                       CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       registry->ht = cds_lfht_new(
+               DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
        if (!registry->ht) {
                goto error;
        }
@@ -1953,8 +1869,7 @@ error:
        return NULL;
 }
 
-void lttng_trace_chunk_registry_destroy(
-               struct lttng_trace_chunk_registry *registry)
+void lttng_trace_chunk_registry_destroy(struct lttng_trace_chunk_registry *registry)
 {
        if (!registry) {
                return;
@@ -1966,10 +1881,9 @@ void lttng_trace_chunk_registry_destroy(
        free(registry);
 }
 
-static
-struct lttng_trace_chunk_registry_element *
-lttng_trace_chunk_registry_element_create_from_chunk(
-               struct lttng_trace_chunk *chunk, uint64_t session_id)
+static struct lttng_trace_chunk_registry_element *
+lttng_trace_chunk_registry_element_create_from_chunk(struct lttng_trace_chunk *chunk,
+                                                    uint64_t session_id)
 {
        struct lttng_trace_chunk_registry_element *element =
                zmalloc<lttng_trace_chunk_registry_element>();
@@ -1984,8 +1898,7 @@ lttng_trace_chunk_registry_element_create_from_chunk(
        lttng_trace_chunk_init(&element->chunk);
        if (chunk->session_output_directory) {
                /* Transferred ownership. */
-               element->chunk.session_output_directory =
-                               chunk->session_output_directory;
+               element->chunk.session_output_directory = chunk->session_output_directory;
                chunk->session_output_directory = NULL;
        }
        if (chunk->chunk_directory) {
@@ -2006,29 +1919,26 @@ end:
 }
 
 struct lttng_trace_chunk *
-lttng_trace_chunk_registry_publish_chunk(
-               struct lttng_trace_chunk_registry *registry,
-               uint64_t session_id,
-               struct lttng_trace_chunk *chunk)
+lttng_trace_chunk_registry_publish_chunk(struct lttng_trace_chunk_registry *registry,
+                                        uint64_t session_id,
+                                        struct lttng_trace_chunk *chunk)
 {
        bool unused;
 
-       return lttng_trace_chunk_registry_publish_chunk(
-                       registry, session_id, chunk, &unused);
+       return lttng_trace_chunk_registry_publish_chunk(registry, session_id, chunk, &unused);
 }
 
 struct lttng_trace_chunk *
-lttng_trace_chunk_registry_publish_chunk(
-               struct lttng_trace_chunk_registry *registry,
-               uint64_t session_id, struct lttng_trace_chunk *chunk,
-               bool *previously_published)
+lttng_trace_chunk_registry_publish_chunk(struct lttng_trace_chunk_registry *registry,
+                                        uint64_t session_id,
+                                        struct lttng_trace_chunk *chunk,
+                                        bool *previously_published)
 {
        struct lttng_trace_chunk_registry_element *element;
        unsigned long element_hash;
 
        pthread_mutex_lock(&chunk->lock);
-       element = lttng_trace_chunk_registry_element_create_from_chunk(chunk,
-                       session_id);
+       element = lttng_trace_chunk_registry_element_create_from_chunk(chunk, session_id);
        pthread_mutex_unlock(&chunk->lock);
        if (!element) {
                goto end;
@@ -2047,10 +1957,10 @@ lttng_trace_chunk_registry_publish_chunk(
                struct lttng_trace_chunk_registry_element *published_element;
 
                published_node = cds_lfht_add_unique(registry->ht,
-                               element_hash,
-                               lttng_trace_chunk_registry_element_match,
-                               element,
-                               &element->trace_chunk_registry_ht_node);
+                                                    element_hash,
+                                                    lttng_trace_chunk_registry_element_match,
+                                                    element,
+                                                    &element->trace_chunk_registry_ht_node);
                if (published_node == &element->trace_chunk_registry_ht_node) {
                        /* Successfully published the new element. */
                        element->registry = registry;
@@ -2076,8 +1986,9 @@ lttng_trace_chunk_registry_publish_chunk(
                 * already published and release the reference to the copy we
                 * created if successful.
                 */
-               published_element = lttng::utils::container_of(published_node,
-                               &lttng_trace_chunk_registry_element::trace_chunk_registry_ht_node);
+               published_element = lttng::utils::container_of(
+                       published_node,
+                       &lttng_trace_chunk_registry_element::trace_chunk_registry_ht_node);
                published_chunk = &published_element->chunk;
                if (lttng_trace_chunk_get(published_chunk)) {
                        lttng_trace_chunk_put(&element->chunk);
@@ -2105,20 +2016,16 @@ end:
  * IOW, holding a reference guarantees the existence of the object for the
  * caller.
  */
-static
-struct lttng_trace_chunk *_lttng_trace_chunk_registry_find_chunk(
-               const struct lttng_trace_chunk_registry *registry,
-               uint64_t session_id, uint64_t *chunk_id)
+static struct lttng_trace_chunk *_lttng_trace_chunk_registry_find_chunk(
+       const struct lttng_trace_chunk_registry *registry, uint64_t session_id, uint64_t *chunk_id)
 {
-       lttng_trace_chunk_registry_element target_element {};
+       lttng_trace_chunk_registry_element target_element{};
 
        target_element.chunk.id.is_set = !!chunk_id;
        target_element.chunk.id.value = chunk_id ? *chunk_id : 0;
        target_element.session_id = session_id;
 
-       const unsigned long element_hash =
-                       lttng_trace_chunk_registry_element_hash(
-                               &target_element);
+       const unsigned long element_hash = lttng_trace_chunk_registry_element_hash(&target_element);
        struct cds_lfht_node *published_node;
        struct lttng_trace_chunk_registry_element *published_element;
        struct lttng_trace_chunk *published_chunk = NULL;
@@ -2135,8 +2042,8 @@ struct lttng_trace_chunk *_lttng_trace_chunk_registry_find_chunk(
                goto end;
        }
 
-       published_element = lttng::utils::container_of(published_node,
-                       &lttng_trace_chunk_registry_element::trace_chunk_registry_ht_node);
+       published_element = lttng::utils::container_of(
+               published_node, &lttng_trace_chunk_registry_element::trace_chunk_registry_ht_node);
        if (lttng_trace_chunk_get(&published_element->chunk)) {
                published_chunk = &published_element->chunk;
        }
@@ -2145,18 +2052,16 @@ end:
        return published_chunk;
 }
 
-struct lttng_trace_chunk *
-lttng_trace_chunk_registry_find_chunk(
-               const struct lttng_trace_chunk_registry *registry,
-               uint64_t session_id, uint64_t chunk_id)
+struct lttng_trace_chunk *lttng_trace_chunk_registry_find_chunk(
+       const struct lttng_trace_chunk_registry *registry, uint64_t session_id, uint64_t chunk_id)
 {
-       return _lttng_trace_chunk_registry_find_chunk(registry,
-                       session_id, &chunk_id);
+       return _lttng_trace_chunk_registry_find_chunk(registry, session_id, &chunk_id);
 }
 
-int lttng_trace_chunk_registry_chunk_exists(
-               const struct lttng_trace_chunk_registry *registry,
-               uint64_t session_id, uint64_t chunk_id, bool *chunk_exists)
+int lttng_trace_chunk_registry_chunk_exists(const struct lttng_trace_chunk_registry *registry,
+                                           uint64_t session_id,
+                                           uint64_t chunk_id,
+                                           bool *chunk_exists)
 {
        int ret = 0;
        lttng_trace_chunk_registry_element target_element;
@@ -2165,9 +2070,7 @@ int lttng_trace_chunk_registry_chunk_exists(
        target_element.chunk.id.value = chunk_id;
        target_element.session_id = session_id;
 
-       const unsigned long element_hash =
-                       lttng_trace_chunk_registry_element_hash(
-                               &target_element);
+       const unsigned long element_hash = lttng_trace_chunk_registry_element_hash(&target_element);
        struct cds_lfht_node *published_node;
        struct cds_lfht_iter iter;
 
@@ -2190,16 +2093,14 @@ end:
 }
 
 struct lttng_trace_chunk *
-lttng_trace_chunk_registry_find_anonymous_chunk(
-               const struct lttng_trace_chunk_registry *registry,
-               uint64_t session_id)
+lttng_trace_chunk_registry_find_anonymous_chunk(const struct lttng_trace_chunk_registry *registry,
+                                               uint64_t session_id)
 {
-       return _lttng_trace_chunk_registry_find_chunk(registry,
-                       session_id, NULL);
+       return _lttng_trace_chunk_registry_find_chunk(registry, session_id, NULL);
 }
 
-unsigned int lttng_trace_chunk_registry_put_each_chunk(
-               const struct lttng_trace_chunk_registry *registry)
+unsigned int
+lttng_trace_chunk_registry_put_each_chunk(const struct lttng_trace_chunk_registry *registry)
 {
        struct cds_lfht_iter iter;
        struct lttng_trace_chunk_registry_element *chunk_element;
@@ -2207,8 +2108,7 @@ unsigned int lttng_trace_chunk_registry_put_each_chunk(
 
        DBG("Releasing trace chunk registry to all trace chunks");
        rcu_read_lock();
-       cds_lfht_for_each_entry(registry->ht,
-                       &iter, chunk_element, trace_chunk_registry_ht_node) {
+       cds_lfht_for_each_entry (registry->ht, &iter, chunk_element, trace_chunk_registry_ht_node) {
                const char *chunk_id_str = "none";
                char chunk_id_buf[MAX_INT_DEC_LEN(uint64_t)];
 
@@ -2216,9 +2116,10 @@ unsigned int lttng_trace_chunk_registry_put_each_chunk(
                if (chunk_element->chunk.id.is_set) {
                        int fmt_ret;
 
-                       fmt_ret = snprintf(chunk_id_buf, sizeof(chunk_id_buf),
-                                       "%" PRIu64,
-                                       chunk_element->chunk.id.value);
+                       fmt_ret = snprintf(chunk_id_buf,
+                                          sizeof(chunk_id_buf),
+                                          "%" PRIu64,
+                                          chunk_element->chunk.id.value);
                        if (fmt_ret < 0 || fmt_ret >= sizeof(chunk_id_buf)) {
                                chunk_id_str = "formatting error";
                        } else {
@@ -2227,19 +2128,17 @@ unsigned int lttng_trace_chunk_registry_put_each_chunk(
                }
 
                DBG("Releasing reference to trace chunk: session_id = %" PRIu64
-                               "chunk_id = %s, name = \"%s\", status = %s",
-                               chunk_element->session_id,
-                               chunk_id_str,
-                               chunk_element->chunk.name ? : "none",
-                               chunk_element->chunk.close_command.is_set ?
-                                               "open" : "closed");
+                   "chunk_id = %s, name = \"%s\", status = %s",
+                   chunk_element->session_id,
+                   chunk_id_str,
+                   chunk_element->chunk.name ?: "none",
+                   chunk_element->chunk.close_command.is_set ? "open" : "closed");
                pthread_mutex_unlock(&chunk_element->chunk.lock);
                lttng_trace_chunk_put(&chunk_element->chunk);
                trace_chunks_left++;
        }
        rcu_read_unlock();
-       DBG("Released reference to %u trace chunks in %s()", trace_chunks_left,
-                       __FUNCTION__);
+       DBG("Released reference to %u trace chunks in %s()", trace_chunks_left, __FUNCTION__);
 
        return trace_chunks_left;
 }
index e988599bae9a27a0c4859e6a577b191a5ff57094..d6669b6f87eabb1a2b3829f106b1b05c9d5c5a69 100644 (file)
@@ -6,18 +6,17 @@
  *
  */
 
-#include <lttng/domain.h>
-#include <lttng/lttng-error.h>
-#include <lttng/tracker.h>
-
 #include <common/dynamic-array.hpp>
 #include <common/error.hpp>
 #include <common/hashtable/hashtable.hpp>
 #include <common/hashtable/utils.hpp>
 #include <common/tracker.hpp>
 
-#include <stdbool.h>
+#include <lttng/domain.h>
+#include <lttng/lttng-error.h>
+#include <lttng/tracker.h>
 
+#include <stdbool.h>
 #include <type_traits>
 
 namespace {
@@ -36,40 +35,37 @@ struct process_attr_tracker_value_comm {
 } LTTNG_PACKED;
 } /* namespace */
 
-#define GET_INTEGRAL_COMM_VALUE(value_ptr, as_type)              \
-       ((as_type)(std::is_signed<as_type>::value ? (value_ptr)->u._signed : \
-                                       (value_ptr)->u._unsigned))
+#define GET_INTEGRAL_COMM_VALUE(value_ptr, as_type)                           \
+       ((as_type) (std::is_signed<as_type>::value ? (value_ptr)->u._signed : \
+                                                    (value_ptr)->u._unsigned))
 
-#define SET_INTEGRAL_COMM_VALUE(comm_value, val)                         \
+#define SET_INTEGRAL_COMM_VALUE(comm_value, val)                                     \
        if (std::is_signed<typeof(val)>::value) {                                    \
-               (comm_value)->u._signed =                                  \
-                               (typeof((comm_value)->u._signed)) val;   \
-       } else {                                                           \
-               (comm_value)->u._unsigned =                                \
-                               (typeof((comm_value)->u._unsigned)) val; \
+               (comm_value)->u._signed = (typeof((comm_value)->u._signed)) val;     \
+       } else {                                                                     \
+               (comm_value)->u._unsigned = (typeof((comm_value)->u._unsigned)) val; \
        }
 
 static inline bool is_virtual_process_attr(enum lttng_process_attr process_attr)
 {
        return process_attr == LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID ||
-              process_attr == LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID ||
-              process_attr == LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID;
+               process_attr == LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID ||
+               process_attr == LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID;
 }
 
-static inline bool is_value_type_name(
-               enum lttng_process_attr_value_type value_type)
+static inline bool is_value_type_name(enum lttng_process_attr_value_type value_type)
 {
        return value_type == LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME ||
-              value_type == LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME;
+               value_type == LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME;
 }
 
-enum lttng_error_code process_attr_value_from_comm(
-               enum lttng_domain_type domain,
-               enum lttng_process_attr process_attr,
-               enum lttng_process_attr_value_type value_type,
-               const struct process_attr_integral_value_comm *integral_value,
-               const struct lttng_buffer_view *value_view,
-               struct process_attr_value **_value)
+enum lttng_error_code
+process_attr_value_from_comm(enum lttng_domain_type domain,
+                            enum lttng_process_attr process_attr,
+                            enum lttng_process_attr_value_type value_type,
+                            const struct process_attr_integral_value_comm *integral_value,
+                            const struct lttng_buffer_view *value_view,
+                            struct process_attr_value **_value)
 {
        char *name = NULL;
        enum lttng_error_code ret = LTTNG_OK;
@@ -98,20 +94,17 @@ enum lttng_error_code process_attr_value_from_comm(
                goto error;
        }
 
-       if (!is_virtual_process_attr(process_attr) &&
-                       domain != LTTNG_DOMAIN_KERNEL) {
+       if (!is_virtual_process_attr(process_attr) && domain != LTTNG_DOMAIN_KERNEL) {
                ERR("Non-virtual process attributes can only be used in the kernel domain");
                ret = LTTNG_ERR_UNSUPPORTED_DOMAIN;
                goto error;
        }
 
        /* Only expect a payload for name value types. */
-       if (is_value_type_name(value_type) &&
-                       (!value_view || value_view->size == 0)) {
+       if (is_value_type_name(value_type) && (!value_view || value_view->size == 0)) {
                ret = LTTNG_ERR_INVALID_PROTOCOL;
                goto error;
-       } else if (!is_value_type_name(value_type) && value_view &&
-                       value_view->size != 0) {
+       } else if (!is_value_type_name(value_type) && value_view && value_view->size != 0) {
                ret = LTTNG_ERR_INVALID_PROTOCOL;
                goto error;
        }
@@ -125,15 +118,13 @@ enum lttng_error_code process_attr_value_from_comm(
                        ret = LTTNG_ERR_INVALID;
                        goto error;
                }
-               value->value.pid =
-                               GET_INTEGRAL_COMM_VALUE(integral_value, pid_t);
+               value->value.pid = GET_INTEGRAL_COMM_VALUE(integral_value, pid_t);
                break;
        case LTTNG_PROCESS_ATTR_USER_ID:
        case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID:
                switch (value_type) {
                case LTTNG_PROCESS_ATTR_VALUE_TYPE_UID:
-                       value->value.uid = GET_INTEGRAL_COMM_VALUE(
-                                       integral_value, uid_t);
+                       value->value.uid = GET_INTEGRAL_COMM_VALUE(integral_value, uid_t);
                        break;
                case LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME:
                        if (!name) {
@@ -154,8 +145,7 @@ enum lttng_error_code process_attr_value_from_comm(
        case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
                switch (value_type) {
                case LTTNG_PROCESS_ATTR_VALUE_TYPE_GID:
-                       value->value.gid = GET_INTEGRAL_COMM_VALUE(
-                                       integral_value, gid_t);
+                       value->value.gid = GET_INTEGRAL_COMM_VALUE(integral_value, gid_t);
                        break;
                case LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME:
                        if (!name) {
@@ -222,49 +212,43 @@ struct lttng_process_attr_values *lttng_process_attr_values_create(void)
                goto end;
        }
 
-       lttng_dynamic_pointer_array_init(
-                       &values->array, process_attr_tracker_value_destructor);
+       lttng_dynamic_pointer_array_init(&values->array, process_attr_tracker_value_destructor);
 end:
        return values;
 }
 
-unsigned int _lttng_process_attr_values_get_count(
-               const struct lttng_process_attr_values *values)
+unsigned int _lttng_process_attr_values_get_count(const struct lttng_process_attr_values *values)
 {
-       return (unsigned int) lttng_dynamic_pointer_array_get_count(
-                       &values->array);
+       return (unsigned int) lttng_dynamic_pointer_array_get_count(&values->array);
 }
 
-const struct process_attr_value *lttng_process_attr_tracker_values_get_at_index(
-               const struct lttng_process_attr_values *values,
-               unsigned int index)
+const struct process_attr_value *
+lttng_process_attr_tracker_values_get_at_index(const struct lttng_process_attr_values *values,
+                                              unsigned int index)
 {
-       return (process_attr_value *) lttng_dynamic_pointer_array_get_pointer(&values->array, index);
+       return (process_attr_value *) lttng_dynamic_pointer_array_get_pointer(&values->array,
+                                                                             index);
 }
 
-static
-int process_attr_tracker_value_serialize(const struct process_attr_value *value,
-               struct lttng_dynamic_buffer *buffer)
+static int process_attr_tracker_value_serialize(const struct process_attr_value *value,
+                                               struct lttng_dynamic_buffer *buffer)
 {
        int ret;
        struct process_attr_tracker_value_comm value_comm = {
-                       .type = (int32_t) value->type,
-                       .value = {},
+               .type = (int32_t) value->type,
+               .value = {},
        };
        const char *name = NULL;
 
        switch (value->type) {
        case LTTNG_PROCESS_ATTR_VALUE_TYPE_PID:
-               SET_INTEGRAL_COMM_VALUE(
-                               &value_comm.value.integral, value->value.pid);
+               SET_INTEGRAL_COMM_VALUE(&value_comm.value.integral, value->value.pid);
                break;
        case LTTNG_PROCESS_ATTR_VALUE_TYPE_UID:
-               SET_INTEGRAL_COMM_VALUE(
-                               &value_comm.value.integral, value->value.uid);
+               SET_INTEGRAL_COMM_VALUE(&value_comm.value.integral, value->value.uid);
                break;
        case LTTNG_PROCESS_ATTR_VALUE_TYPE_GID:
-               SET_INTEGRAL_COMM_VALUE(
-                               &value_comm.value.integral, value->value.gid);
+               SET_INTEGRAL_COMM_VALUE(&value_comm.value.integral, value->value.gid);
                break;
        case LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME:
                name = value->value.user_name;
@@ -280,23 +264,20 @@ int process_attr_tracker_value_serialize(const struct process_attr_value *value,
                value_comm.value.name_len = strlen(name) + 1;
        }
 
-       ret = lttng_dynamic_buffer_append(
-                       buffer, &value_comm, sizeof(value_comm));
+       ret = lttng_dynamic_buffer_append(buffer, &value_comm, sizeof(value_comm));
        if (ret) {
                goto end;
        }
 
        if (name) {
-               ret = lttng_dynamic_buffer_append(
-                               buffer, name, value_comm.value.name_len);
+               ret = lttng_dynamic_buffer_append(buffer, name, value_comm.value.name_len);
        }
 end:
        return ret;
 }
 
-int lttng_process_attr_values_serialize(
-               const struct lttng_process_attr_values *values,
-               struct lttng_dynamic_buffer *buffer)
+int lttng_process_attr_values_serialize(const struct lttng_process_attr_values *values,
+                                       struct lttng_dynamic_buffer *buffer)
 {
        int ret;
        unsigned int count, i;
@@ -312,8 +293,7 @@ int lttng_process_attr_values_serialize(
 
        for (i = 0; i < count; i++) {
                const struct process_attr_value *value =
-                               lttng_process_attr_tracker_values_get_at_index(
-                                               values, i);
+                       lttng_process_attr_tracker_values_get_at_index(values, i);
 
                ret = process_attr_tracker_value_serialize(value, buffer);
                if (ret) {
@@ -324,11 +304,10 @@ end:
        return ret;
 }
 
-ssize_t lttng_process_attr_values_create_from_buffer(
-               enum lttng_domain_type domain,
-               enum lttng_process_attr process_attr,
-               const struct lttng_buffer_view *buffer_view,
-               struct lttng_process_attr_values **_values)
+ssize_t lttng_process_attr_values_create_from_buffer(enum lttng_domain_type domain,
+                                                    enum lttng_process_attr process_attr,
+                                                    const struct lttng_buffer_view *buffer_view,
+                                                    struct lttng_process_attr_values **_values)
 {
        ssize_t offset;
        unsigned int i;
@@ -341,8 +320,7 @@ ssize_t lttng_process_attr_values_create_from_buffer(
                goto error;
        }
 
-       header_view = lttng_buffer_view_from_view(
-                       buffer_view, 0, sizeof(*header));
+       header_view = lttng_buffer_view_from_view(buffer_view, 0, sizeof(*header));
        if (!lttng_buffer_view_is_valid(&header_view)) {
                goto error;
        }
@@ -354,8 +332,7 @@ ssize_t lttng_process_attr_values_create_from_buffer(
         * Check that the number of values is not absurdly large with respect to
         * the received buffer's size.
         */
-       if (buffer_view->size <
-                       header->count * sizeof(struct process_attr_tracker_value_comm)) {
+       if (buffer_view->size < header->count * sizeof(struct process_attr_tracker_value_comm)) {
                goto error;
        }
        for (i = 0; i < (unsigned int) header->count; i++) {
@@ -367,8 +344,7 @@ ssize_t lttng_process_attr_values_create_from_buffer(
                struct lttng_buffer_view value_view;
                struct lttng_buffer_view value_name_view = {};
 
-               value_view = lttng_buffer_view_from_view(
-                               buffer_view, offset, sizeof(*value_comm));
+               value_view = lttng_buffer_view_from_view(buffer_view, offset, sizeof(*value_comm));
                if (!lttng_buffer_view_is_valid(&value_view)) {
                        goto error;
                }
@@ -379,8 +355,7 @@ ssize_t lttng_process_attr_values_create_from_buffer(
 
                if (is_value_type_name(type)) {
                        value_name_view = lttng_buffer_view_from_view(
-                                       buffer_view, offset,
-                                       value_comm->value.name_len);
+                               buffer_view, offset, value_comm->value.name_len);
                        if (!lttng_buffer_view_is_valid(&value_name_view)) {
                                goto error;
                        }
@@ -388,15 +363,17 @@ ssize_t lttng_process_attr_values_create_from_buffer(
                        offset += value_name_view.size;
                }
 
-               ret_code = process_attr_value_from_comm(domain, process_attr,
-                               type, &value_comm->value.integral,
-                               &value_name_view, &value);
+               ret_code = process_attr_value_from_comm(domain,
+                                                       process_attr,
+                                                       type,
+                                                       &value_comm->value.integral,
+                                                       &value_name_view,
+                                                       &value);
                if (ret_code != LTTNG_OK) {
                        goto error;
                }
 
-               ret = lttng_dynamic_pointer_array_add_pointer(
-                               &values->array, value);
+               ret = lttng_dynamic_pointer_array_add_pointer(&values->array, value);
                if (ret) {
                        process_attr_value_destroy(value);
                        goto error;
@@ -419,8 +396,7 @@ void lttng_process_attr_values_destroy(struct lttng_process_attr_values *values)
        free(values);
 }
 
-struct process_attr_value *process_attr_value_copy(
-               const struct process_attr_value *value)
+struct process_attr_value *process_attr_value_copy(const struct process_attr_value *value)
 {
        struct process_attr_value *new_value = NULL;
 
@@ -433,13 +409,12 @@ struct process_attr_value *process_attr_value_copy(
                goto end;
        }
        if (is_value_type_name(value->type)) {
-               const char *src =
-                               value->type == LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME ?
-                                               value->value.user_name :
-                                               value->value.group_name;
+               const char *src = value->type == LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME ?
+                       value->value.user_name :
+                       value->value.group_name;
                char **dst = value->type == LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME ?
-                                            &new_value->value.user_name :
-                                            &new_value->value.group_name;
+                       &new_value->value.user_name :
+                       &new_value->value.group_name;
 
                new_value->type = value->type;
                *dst = strdup(src);
@@ -462,16 +437,13 @@ unsigned long process_attr_value_hash(const struct process_attr_value *a)
 
        switch (a->type) {
        case LTTNG_PROCESS_ATTR_VALUE_TYPE_PID:
-               hash ^= hash_key_ulong((void *) (unsigned long) a->value.pid,
-                               lttng_ht_seed);
+               hash ^= hash_key_ulong((void *) (unsigned long) a->value.pid, lttng_ht_seed);
                break;
        case LTTNG_PROCESS_ATTR_VALUE_TYPE_UID:
-               hash ^= hash_key_ulong((void *) (unsigned long) a->value.uid,
-                               lttng_ht_seed);
+               hash ^= hash_key_ulong((void *) (unsigned long) a->value.uid, lttng_ht_seed);
                break;
        case LTTNG_PROCESS_ATTR_VALUE_TYPE_GID:
-               hash ^= hash_key_ulong((void *) (unsigned long) a->value.gid,
-                               lttng_ht_seed);
+               hash ^= hash_key_ulong((void *) (unsigned long) a->value.gid, lttng_ht_seed);
                break;
        case LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME:
                hash ^= hash_key_str(a->value.user_name, lttng_ht_seed);
@@ -487,7 +459,7 @@ unsigned long process_attr_value_hash(const struct process_attr_value *a)
 }
 
 bool process_attr_tracker_value_equal(const struct process_attr_value *a,
-               const struct process_attr_value *b)
+                                     const struct process_attr_value *b)
 {
        if (a->type != b->type) {
                return false;
@@ -515,8 +487,8 @@ void process_attr_value_destroy(struct process_attr_value *value)
        }
        if (is_value_type_name(value->type)) {
                free(value->type == LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME ?
-                                               value->value.user_name :
-                                               value->value.group_name);
+                            value->value.user_name :
+                            value->value.group_name);
        }
        free(value);
 }
index bceeab534ae14a8113233537060fcc59b3fd92be..927860edf343df8bcc171088a10eefda3910fbd2 100644 (file)
@@ -12,7 +12,7 @@
 #include <common/optional.hpp>
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
-#include <inttypes.h>
+
 #include <lttng/action/action-internal.hpp>
 #include <lttng/condition/buffer-usage.h>
 #include <lttng/condition/condition-internal.hpp>
@@ -23,6 +23,8 @@
 #include <lttng/event-expr-internal.hpp>
 #include <lttng/event-rule/event-rule-internal.hpp>
 #include <lttng/trigger/trigger-internal.hpp>
+
+#include <inttypes.h>
 #include <pthread.h>
 
 bool lttng_trigger_validate(const struct lttng_trigger *trigger)
@@ -40,14 +42,13 @@ bool lttng_trigger_validate(const struct lttng_trigger *trigger)
        }
 
        valid = lttng_condition_validate(trigger->condition) &&
-                       lttng_action_validate(trigger->action);
+               lttng_action_validate(trigger->action);
 end:
        return valid;
 }
 
-struct lttng_trigger *lttng_trigger_create(
-               struct lttng_condition *condition,
-               struct lttng_action *action)
+struct lttng_trigger *lttng_trigger_create(struct lttng_condition *condition,
+                                          struct lttng_action *action)
 {
        struct lttng_trigger *trigger = NULL;
 
@@ -80,14 +81,12 @@ end:
  * This API was exposed as such in 2.11. The client is not expected to call
  * lttng_condition_destroy on the returned object.
  */
-struct lttng_condition *lttng_trigger_get_condition(
-               struct lttng_trigger *trigger)
+struct lttng_condition *lttng_trigger_get_condition(struct lttng_trigger *trigger)
 {
        return trigger ? trigger->condition : NULL;
 }
 
-const struct lttng_condition *lttng_trigger_get_const_condition(
-               const struct lttng_trigger *trigger)
+const struct lttng_condition *lttng_trigger_get_const_condition(const struct lttng_trigger *trigger)
 {
        return trigger ? trigger->condition : NULL;
 }
@@ -97,25 +96,21 @@ const struct lttng_condition *lttng_trigger_get_const_condition(
  * This API was exposed as such in 2.11. The client is not expected to call
  * lttng_action_destroy on the returned object.
  */
-struct lttng_action *lttng_trigger_get_action(
-               struct lttng_trigger *trigger)
+struct lttng_action *lttng_trigger_get_action(struct lttng_trigger *trigger)
 {
        return trigger ? trigger->action : NULL;
 }
 
-const struct lttng_action *lttng_trigger_get_const_action(
-               const struct lttng_trigger *trigger)
+const struct lttng_action *lttng_trigger_get_const_action(const struct lttng_trigger *trigger)
 {
        return trigger ? trigger->action : NULL;
 }
 
 static void trigger_destroy_ref(struct urcu_ref *ref)
 {
-       struct lttng_trigger *trigger =
-                       lttng::utils::container_of(ref, &lttng_trigger::ref);
+       struct lttng_trigger *trigger = lttng::utils::container_of(ref, &lttng_trigger::ref);
        struct lttng_action *action = lttng_trigger_get_action(trigger);
-       struct lttng_condition *condition =
-                       lttng_trigger_get_condition(trigger);
+       struct lttng_condition *condition = lttng_trigger_get_condition(trigger);
 
        LTTNG_ASSERT(action);
        LTTNG_ASSERT(condition);
@@ -135,9 +130,8 @@ void lttng_trigger_destroy(struct lttng_trigger *trigger)
        lttng_trigger_put(trigger);
 }
 
-ssize_t lttng_trigger_create_from_payload(
-               struct lttng_payload_view *src_view,
-               struct lttng_trigger **_trigger)
+ssize_t lttng_trigger_create_from_payload(struct lttng_payload_view *src_view,
+                                         struct lttng_trigger **_trigger)
 {
        ssize_t ret, offset = 0, condition_size, action_size, name_size = 0;
        struct lttng_condition *condition = NULL;
@@ -150,8 +144,7 @@ ssize_t lttng_trigger_create_from_payload(
        };
        struct lttng_trigger *trigger = NULL;
        const struct lttng_payload_view trigger_comm_view =
-                       lttng_payload_view_from_view(
-                                       src_view, 0, sizeof(*trigger_comm));
+               lttng_payload_view_from_view(src_view, 0, sizeof(*trigger_comm));
 
        if (!src_view || !_trigger) {
                ret = -1;
@@ -181,9 +174,7 @@ ssize_t lttng_trigger_create_from_payload(
        if (trigger_comm->name_length != 0) {
                /* Name. */
                const struct lttng_payload_view name_view =
-                               lttng_payload_view_from_view(
-                                               src_view, offset,
-                                               trigger_comm->name_length);
+                       lttng_payload_view_from_view(src_view, offset, trigger_comm->name_length);
 
                if (!lttng_payload_view_is_valid(&name_view)) {
                        ret = -1;
@@ -191,8 +182,8 @@ ssize_t lttng_trigger_create_from_payload(
                }
 
                name = name_view.buffer.data;
-               if (!lttng_buffer_view_contains_string(&name_view.buffer, name,
-                                   trigger_comm->name_length)) {
+               if (!lttng_buffer_view_contains_string(
+                           &name_view.buffer, name, trigger_comm->name_length)) {
                        ret = -1;
                        goto end;
                }
@@ -204,11 +195,9 @@ ssize_t lttng_trigger_create_from_payload(
        {
                /* struct lttng_condition */
                struct lttng_payload_view condition_view =
-                               lttng_payload_view_from_view(
-                                               src_view, offset, -1);
+                       lttng_payload_view_from_view(src_view, offset, -1);
 
-               condition_size = lttng_condition_create_from_payload(&condition_view,
-                               &condition);
+               condition_size = lttng_condition_create_from_payload(&condition_view, &condition);
        }
 
        if (condition_size < 0) {
@@ -220,8 +209,7 @@ ssize_t lttng_trigger_create_from_payload(
        {
                /* struct lttng_action */
                struct lttng_payload_view action_view =
-                               lttng_payload_view_from_view(
-                                       src_view, offset, -1);
+                       lttng_payload_view_from_view(src_view, offset, -1);
 
                action_size = lttng_action_create_from_payload(&action_view, &action);
        }
@@ -257,8 +245,7 @@ ssize_t lttng_trigger_create_from_payload(
        action = NULL;
 
        if (name) {
-               const enum lttng_trigger_status status =
-                               lttng_trigger_set_name(trigger, name);
+               const enum lttng_trigger_status status = lttng_trigger_set_name(trigger, name);
 
                if (status != LTTNG_TRIGGER_STATUS_OK) {
                        ret = -1;
@@ -289,8 +276,7 @@ end:
  * Both elements are stored contiguously, see their "*_comm" structure
  * for the detailed format.
  */
-int lttng_trigger_serialize(const struct lttng_trigger *trigger,
-               struct lttng_payload *payload)
+int lttng_trigger_serialize(const struct lttng_trigger *trigger, struct lttng_payload *payload)
 {
        int ret;
        size_t header_offset, size_before_payload, size_name;
@@ -314,8 +300,7 @@ int lttng_trigger_serialize(const struct lttng_trigger *trigger,
        trigger_comm.is_hidden = lttng_trigger_is_hidden(trigger);
 
        header_offset = payload->buffer.size;
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &trigger_comm,
-                       sizeof(trigger_comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &trigger_comm, sizeof(trigger_comm));
        if (ret) {
                goto end;
        }
@@ -323,8 +308,7 @@ int lttng_trigger_serialize(const struct lttng_trigger *trigger,
        size_before_payload = payload->buffer.size;
 
        /* Trigger name. */
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, trigger->name, size_name);
+       ret = lttng_dynamic_buffer_append(&payload->buffer, trigger->name, size_name);
        if (ret) {
                goto end;
        }
@@ -346,8 +330,7 @@ end:
        return ret;
 }
 
-bool lttng_trigger_is_equal(
-               const struct lttng_trigger *a, const struct lttng_trigger *b)
+bool lttng_trigger_is_equal(const struct lttng_trigger *a, const struct lttng_trigger *b)
 {
        if (!!a->name != !!b->name) {
                /* Both must be either anonymous or named. */
@@ -367,7 +350,7 @@ bool lttng_trigger_is_equal(
        }
 
        if (!lttng_credentials_is_equal(lttng_trigger_get_credentials(a),
-                       lttng_trigger_get_credentials(b))) {
+                                       lttng_trigger_get_credentials(b))) {
                return false;
        }
 
@@ -390,8 +373,7 @@ void lttng_trigger_set_hidden(struct lttng_trigger *trigger)
        trigger->is_hidden = true;
 }
 
-enum lttng_trigger_status lttng_trigger_set_name(struct lttng_trigger *trigger,
-               const char* name)
+enum lttng_trigger_status lttng_trigger_set_name(struct lttng_trigger *trigger, const char *name)
 {
        char *name_copy = NULL;
        enum lttng_trigger_status status = LTTNG_TRIGGER_STATUS_OK;
@@ -417,8 +399,8 @@ end:
        return status;
 }
 
-enum lttng_trigger_status lttng_trigger_get_name(
-               const struct lttng_trigger *trigger, const char **name)
+enum lttng_trigger_status lttng_trigger_get_name(const struct lttng_trigger *trigger,
+                                                const char **name)
 {
        enum lttng_trigger_status status = LTTNG_TRIGGER_STATUS_OK;
 
@@ -436,8 +418,7 @@ end:
        return status;
 }
 
-int lttng_trigger_assign_name(struct lttng_trigger *dst,
-               const struct lttng_trigger *src)
+int lttng_trigger_assign_name(struct lttng_trigger *dst, const struct lttng_trigger *src)
 {
        int ret = 0;
        enum lttng_trigger_status status;
@@ -452,8 +433,7 @@ end:
        return ret;
 }
 
-void lttng_trigger_set_tracer_token(struct lttng_trigger *trigger,
-               uint64_t token)
+void lttng_trigger_set_tracer_token(struct lttng_trigger *trigger, uint64_t token)
 {
        LTTNG_ASSERT(trigger);
        LTTNG_OPTIONAL_SET(&trigger->tracer_token, token);
@@ -466,8 +446,7 @@ uint64_t lttng_trigger_get_tracer_token(const struct lttng_trigger *trigger)
        return LTTNG_OPTIONAL_GET(trigger->tracer_token);
 }
 
-int lttng_trigger_generate_name(struct lttng_trigger *trigger,
-               uint64_t unique_id)
+int lttng_trigger_generate_name(struct lttng_trigger *trigger, uint64_t unique_id)
 {
        int ret = 0;
        char *generated_name = NULL;
@@ -497,7 +476,7 @@ void lttng_trigger_put(struct lttng_trigger *trigger)
                return;
        }
 
-       urcu_ref_put(&trigger->ref , trigger_destroy_ref);
+       urcu_ref_put(&trigger->ref, trigger_destroy_ref);
 }
 
 static void delete_trigger_array_element(void *ptr)
@@ -522,8 +501,8 @@ end:
        return triggers;
 }
 
-struct lttng_trigger *lttng_triggers_borrow_mutable_at_index(
-               const struct lttng_triggers *triggers, unsigned int index)
+struct lttng_trigger *lttng_triggers_borrow_mutable_at_index(const struct lttng_triggers *triggers,
+                                                            unsigned int index)
 {
        struct lttng_trigger *trigger = NULL;
 
@@ -532,15 +511,13 @@ struct lttng_trigger *lttng_triggers_borrow_mutable_at_index(
                goto end;
        }
 
-       trigger = (struct lttng_trigger *)
-                       lttng_dynamic_pointer_array_get_pointer(
-                                       &triggers->array, index);
+       trigger = (struct lttng_trigger *) lttng_dynamic_pointer_array_get_pointer(&triggers->array,
+                                                                                  index);
 end:
        return trigger;
 }
 
-int lttng_triggers_add(
-               struct lttng_triggers *triggers, struct lttng_trigger *trigger)
+int lttng_triggers_add(struct lttng_triggers *triggers, struct lttng_trigger *trigger)
 {
        int ret;
 
@@ -569,12 +546,10 @@ int lttng_triggers_remove_hidden_triggers(struct lttng_triggers *triggers)
        LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
        while (i < trigger_count) {
-               const struct lttng_trigger *trigger =
-                               lttng_triggers_get_at_index(triggers, i);
+               const struct lttng_trigger *trigger = lttng_triggers_get_at_index(triggers, i);
 
                if (lttng_trigger_is_hidden(trigger)) {
-                       ret = lttng_dynamic_pointer_array_remove_pointer(
-                                       &triggers->array, i);
+                       ret = lttng_dynamic_pointer_array_remove_pointer(&triggers->array, i);
                        if (ret) {
                                goto end;
                        }
@@ -590,13 +565,14 @@ end:
        return ret;
 }
 
-const struct lttng_trigger *lttng_triggers_get_at_index(
-               const struct lttng_triggers *triggers, unsigned int index)
+const struct lttng_trigger *lttng_triggers_get_at_index(const struct lttng_triggers *triggers,
+                                                       unsigned int index)
 {
        return lttng_triggers_borrow_mutable_at_index(triggers, index);
 }
 
-enum lttng_trigger_status lttng_triggers_get_count(const struct lttng_triggers *triggers, unsigned int *count)
+enum lttng_trigger_status lttng_triggers_get_count(const struct lttng_triggers *triggers,
+                                                  unsigned int *count)
 {
        enum lttng_trigger_status status = LTTNG_TRIGGER_STATUS_OK;
 
@@ -620,8 +596,7 @@ void lttng_triggers_destroy(struct lttng_triggers *triggers)
        free(triggers);
 }
 
-int lttng_triggers_serialize(const struct lttng_triggers *triggers,
-               struct lttng_payload *payload)
+int lttng_triggers_serialize(const struct lttng_triggers *triggers, struct lttng_payload *payload)
 {
        int ret;
        unsigned int i, count;
@@ -640,8 +615,7 @@ int lttng_triggers_serialize(const struct lttng_triggers *triggers,
        triggers_comm.count = count;
 
        /* Placeholder header; updated at the end. */
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &triggers_comm,
-                       sizeof(triggers_comm));
+       ret = lttng_dynamic_buffer_append(&payload->buffer, &triggers_comm, sizeof(triggers_comm));
        if (ret) {
                goto end;
        }
@@ -649,8 +623,7 @@ int lttng_triggers_serialize(const struct lttng_triggers *triggers,
        size_before_payload = payload->buffer.size;
 
        for (i = 0; i < count; i++) {
-               const struct lttng_trigger *trigger =
-                               lttng_triggers_get_at_index(triggers, i);
+               const struct lttng_trigger *trigger = lttng_triggers_get_at_index(triggers, i);
 
                LTTNG_ASSERT(trigger);
 
@@ -667,9 +640,8 @@ end:
        return ret;
 }
 
-ssize_t lttng_triggers_create_from_payload(
-               struct lttng_payload_view *src_view,
-               struct lttng_triggers **triggers)
+ssize_t lttng_triggers_create_from_payload(struct lttng_payload_view *src_view,
+                                          struct lttng_triggers **triggers)
 {
        ssize_t ret, offset = 0, triggers_size = 0;
        unsigned int i;
@@ -694,11 +666,10 @@ ssize_t lttng_triggers_create_from_payload(
        for (i = 0; i < triggers_comm->count; i++) {
                struct lttng_trigger *trigger = NULL;
                struct lttng_payload_view trigger_view =
-                               lttng_payload_view_from_view(src_view, offset, -1);
+                       lttng_payload_view_from_view(src_view, offset, -1);
                ssize_t trigger_size;
 
-               trigger_size = lttng_trigger_create_from_payload(
-                               &trigger_view, &trigger);
+               trigger_size = lttng_trigger_create_from_payload(&trigger_view, &trigger);
                if (trigger_size < 0) {
                        ret = trigger_size;
                        goto error;
@@ -733,14 +704,13 @@ error:
        return ret;
 }
 
-const struct lttng_credentials *lttng_trigger_get_credentials(
-               const struct lttng_trigger *trigger)
+const struct lttng_credentials *lttng_trigger_get_credentials(const struct lttng_trigger *trigger)
 {
        return &trigger->creds;
 }
 
 void lttng_trigger_set_credentials(struct lttng_trigger *trigger,
-               const struct lttng_credentials *creds)
+                                  const struct lttng_credentials *creds)
 {
        /* Triggers do not use the group id to authenticate the user. */
        LTTNG_ASSERT(creds);
@@ -748,8 +718,7 @@ void lttng_trigger_set_credentials(struct lttng_trigger *trigger,
        LTTNG_OPTIONAL_UNSET(&trigger->creds.gid);
 }
 
-enum lttng_trigger_status lttng_trigger_set_owner_uid(
-               struct lttng_trigger *trigger, uid_t uid)
+enum lttng_trigger_status lttng_trigger_set_owner_uid(struct lttng_trigger *trigger, uid_t uid)
 {
        enum lttng_trigger_status ret = LTTNG_TRIGGER_STATUS_OK;
        const uid_t euid = geteuid();
@@ -775,18 +744,18 @@ end:
        return ret;
 }
 
-enum lttng_trigger_status lttng_trigger_get_owner_uid(
-               const struct lttng_trigger *trigger, uid_t *uid)
+enum lttng_trigger_status lttng_trigger_get_owner_uid(const struct lttng_trigger *trigger,
+                                                     uid_t *uid)
 {
        enum lttng_trigger_status ret = LTTNG_TRIGGER_STATUS_OK;
        const struct lttng_credentials *creds = NULL;
 
-       if (!trigger || !uid ) {
+       if (!trigger || !uid) {
                ret = LTTNG_TRIGGER_STATUS_INVALID;
                goto end;
        }
 
-       if (!trigger->creds.uid.is_set ) {
+       if (!trigger->creds.uid.is_set) {
                ret = LTTNG_TRIGGER_STATUS_UNSET;
                goto end;
        }
@@ -798,8 +767,8 @@ end:
        return ret;
 }
 
-enum lttng_domain_type lttng_trigger_get_underlying_domain_type_restriction(
-               const struct lttng_trigger *trigger)
+enum lttng_domain_type
+lttng_trigger_get_underlying_domain_type_restriction(const struct lttng_trigger *trigger)
 {
        enum lttng_domain_type type = LTTNG_DOMAIN_NONE;
        const struct lttng_event_rule *event_rule;
@@ -810,7 +779,7 @@ enum lttng_domain_type lttng_trigger_get_underlying_domain_type_restriction(
        LTTNG_ASSERT(trigger->condition);
 
        c_type = lttng_condition_get_type(trigger->condition);
-       assert (c_type != LTTNG_CONDITION_TYPE_UNKNOWN);
+       assert(c_type != LTTNG_CONDITION_TYPE_UNKNOWN);
 
        switch (c_type) {
        case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE:
@@ -821,16 +790,15 @@ enum lttng_domain_type lttng_trigger_get_underlying_domain_type_restriction(
                break;
        case LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES:
                /* Return the domain of the event rule. */
-               c_status = lttng_condition_event_rule_matches_get_rule(
-                               trigger->condition, &event_rule);
+               c_status = lttng_condition_event_rule_matches_get_rule(trigger->condition,
+                                                                      &event_rule);
                LTTNG_ASSERT(c_status == LTTNG_CONDITION_STATUS_OK);
                type = lttng_event_rule_get_domain_type(event_rule);
                break;
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH:
        case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW:
                /* Return the domain of the channel being monitored. */
-               c_status = lttng_condition_buffer_usage_get_domain_type(
-                               trigger->condition, &type);
+               c_status = lttng_condition_buffer_usage_get_domain_type(trigger->condition, &type);
                LTTNG_ASSERT(c_status == LTTNG_CONDITION_STATUS_OK);
                break;
        default:
@@ -844,9 +812,8 @@ enum lttng_domain_type lttng_trigger_get_underlying_domain_type_restriction(
  * Generate bytecode related to the trigger.
  * On success LTTNG_OK. On error, returns lttng_error code.
  */
-enum lttng_error_code lttng_trigger_generate_bytecode(
-               struct lttng_trigger *trigger,
-               const struct lttng_credentials *creds)
+enum lttng_error_code lttng_trigger_generate_bytecode(struct lttng_trigger *trigger,
+                                                     const struct lttng_credentials *creds)
 {
        enum lttng_error_code ret;
        struct lttng_condition *condition = NULL;
@@ -862,21 +829,20 @@ enum lttng_error_code lttng_trigger_generate_bytecode(
        {
                struct lttng_event_rule *event_rule;
                const enum lttng_condition_status condition_status =
-                               lttng_condition_event_rule_matches_borrow_rule_mutable(
-                                               condition, &event_rule);
+                       lttng_condition_event_rule_matches_borrow_rule_mutable(condition,
+                                                                              &event_rule);
 
                LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
                /* Generate the filter bytecode. */
-               ret = lttng_event_rule_generate_filter_bytecode(
-                               event_rule, creds);
+               ret = lttng_event_rule_generate_filter_bytecode(event_rule, creds);
                if (ret != LTTNG_OK) {
                        goto end;
                }
 
                /* Generate the capture bytecode. */
                ret = lttng_condition_event_rule_matches_generate_capture_descriptor_bytecode(
-                               condition);
+                       condition);
                if (ret != LTTNG_OK) {
                        goto end;
                }
@@ -912,11 +878,9 @@ struct lttng_trigger *lttng_trigger_copy(const struct lttng_trigger *trigger)
 
        {
                struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &copy_buffer, 0, -1);
+                       lttng_payload_view_from_payload(&copy_buffer, 0, -1);
 
-               ret = lttng_condition_create_from_payload(
-                               &view, &condition_copy);
+               ret = lttng_condition_create_from_payload(&view, &condition_copy);
                if (ret < 0) {
                        goto end;
                }
@@ -931,11 +895,9 @@ struct lttng_trigger *lttng_trigger_copy(const struct lttng_trigger *trigger)
 
        {
                struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &copy_buffer, 0, -1);
+                       lttng_payload_view_from_payload(&copy_buffer, 0, -1);
 
-               ret = lttng_action_create_from_payload(
-                               &view, &action_copy);
+               ret = lttng_action_create_from_payload(&view, &action_copy);
                if (ret < 0) {
                        goto end;
                }
@@ -963,8 +925,7 @@ struct lttng_trigger *lttng_trigger_copy(const struct lttng_trigger *trigger)
                goto error_cleanup_trigger;
        }
 
-       trigger_status = lttng_trigger_get_owner_uid(
-                       trigger, &trigger_owner_uid);
+       trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_owner_uid);
        switch (trigger_status) {
        case LTTNG_TRIGGER_STATUS_OK:
                LTTNG_OPTIONAL_SET(&copy->creds.uid, trigger_owner_uid);
@@ -994,8 +955,7 @@ end:
 bool lttng_trigger_needs_tracer_notifier(const struct lttng_trigger *trigger)
 {
        bool needs_tracer_notifier = false;
-       const struct lttng_condition *condition =
-                       lttng_trigger_get_const_condition(trigger);
+       const struct lttng_condition *condition = lttng_trigger_get_const_condition(trigger);
 
        switch (lttng_condition_get_type(condition)) {
        case LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES:
@@ -1052,10 +1012,10 @@ void lttng_trigger_unlock(struct lttng_trigger *trigger)
        pthread_mutex_unlock(&trigger->lock);
 }
 
-enum lttng_error_code lttng_trigger_mi_serialize(const struct lttng_trigger *trigger,
-               struct mi_writer *writer,
-               const struct mi_lttng_error_query_callbacks
-                               *error_query_callbacks)
+enum lttng_error_code
+lttng_trigger_mi_serialize(const struct lttng_trigger *trigger,
+                          struct mi_writer *writer,
+                          const struct mi_lttng_error_query_callbacks *error_query_callbacks)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -1080,16 +1040,14 @@ enum lttng_error_code lttng_trigger_mi_serialize(const struct lttng_trigger *tri
        LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
 
        /* Name. */
-       ret = mi_lttng_writer_write_element_string(
-                       writer, config_element_name, trigger->name);
+       ret = mi_lttng_writer_write_element_string(writer, config_element_name, trigger->name);
        if (ret) {
                goto mi_error;
        }
 
        /* Owner uid. */
-       ret = mi_lttng_writer_write_element_signed_int(writer,
-                       mi_lttng_element_trigger_owner_uid,
-                       (int64_t) owner_uid);
+       ret = mi_lttng_writer_write_element_signed_int(
+               writer, mi_lttng_element_trigger_owner_uid, (int64_t) owner_uid);
        if (ret) {
                goto mi_error;
        }
@@ -1097,8 +1055,7 @@ enum lttng_error_code lttng_trigger_mi_serialize(const struct lttng_trigger *tri
        /* Condition. */
        condition = lttng_trigger_get_const_condition(trigger);
        LTTNG_ASSERT(condition);
-       ret_code = lttng_condition_mi_serialize(
-                       trigger, condition, writer, error_query_callbacks);
+       ret_code = lttng_condition_mi_serialize(trigger, condition, writer, error_query_callbacks);
        if (ret_code != LTTNG_OK) {
                goto end;
        }
@@ -1106,8 +1063,8 @@ enum lttng_error_code lttng_trigger_mi_serialize(const struct lttng_trigger *tri
        /* Action. */
        action = lttng_trigger_get_const_action(trigger);
        LTTNG_ASSERT(action);
-       ret_code = lttng_action_mi_serialize(trigger, action, writer,
-                       error_query_callbacks, &action_path_indexes);
+       ret_code = lttng_action_mi_serialize(
+               trigger, action, writer, error_query_callbacks, &action_path_indexes);
        if (ret_code != LTTNG_OK) {
                goto end;
        }
@@ -1120,8 +1077,7 @@ enum lttng_error_code lttng_trigger_mi_serialize(const struct lttng_trigger *tri
                        goto end;
                }
 
-               ret_code = lttng_error_query_results_mi_serialize(
-                               results, writer);
+               ret_code = lttng_error_query_results_mi_serialize(results, writer);
                lttng_error_query_results_destroy(results);
                if (ret_code != LTTNG_OK) {
                        goto end;
@@ -1147,10 +1103,8 @@ end:
 /* Used by qsort, which expects the semantics of strcmp(). */
 static int compare_triggers_by_name(const void *a, const void *b)
 {
-       const struct lttng_trigger *trigger_a =
-                       *((const struct lttng_trigger **) a);
-       const struct lttng_trigger *trigger_b =
-                       *((const struct lttng_trigger **) b);
+       const struct lttng_trigger *trigger_a = *((const struct lttng_trigger **) a);
+       const struct lttng_trigger *trigger_b = *((const struct lttng_trigger **) b);
        const char *name_a, *name_b;
        enum lttng_trigger_status trigger_status;
 
@@ -1164,10 +1118,10 @@ static int compare_triggers_by_name(const void *a, const void *b)
        return strcmp(name_a, name_b);
 }
 
-enum lttng_error_code lttng_triggers_mi_serialize(const struct lttng_triggers *triggers,
-               struct mi_writer *writer,
-               const struct mi_lttng_error_query_callbacks
-                               *error_query_callbacks)
+enum lttng_error_code
+lttng_triggers_mi_serialize(const struct lttng_triggers *triggers,
+                           struct mi_writer *writer,
+                           const struct mi_lttng_error_query_callbacks *error_query_callbacks)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -1190,8 +1144,7 @@ enum lttng_error_code lttng_triggers_mi_serialize(const struct lttng_triggers *t
        for (i = 0; i < count; i++) {
                int add_ret;
                const char *unused_name;
-               const struct lttng_trigger *trigger =
-                               lttng_triggers_get_at_index(triggers, i);
+               const struct lttng_trigger *trigger = lttng_triggers_get_at_index(triggers, i);
 
                status = lttng_trigger_get_name(trigger, &unused_name);
                switch (status) {
@@ -1204,8 +1157,8 @@ enum lttng_error_code lttng_triggers_mi_serialize(const struct lttng_triggers *t
                        abort();
                }
 
-               add_ret = lttng_dynamic_pointer_array_add_pointer(
-                               &sorted_triggers, (void *) trigger);
+               add_ret =
+                       lttng_dynamic_pointer_array_add_pointer(&sorted_triggers, (void *) trigger);
 
                if (add_ret) {
                        ERR("Failed to lttng_trigger to sorting array.");
@@ -1214,9 +1167,10 @@ enum lttng_error_code lttng_triggers_mi_serialize(const struct lttng_triggers *t
                }
        }
 
-       qsort(sorted_triggers.array.buffer.data, count,
-                       sizeof(struct lttng_trigger *),
-                       compare_triggers_by_name);
+       qsort(sorted_triggers.array.buffer.data,
+             count,
+             sizeof(struct lttng_trigger *),
+             compare_triggers_by_name);
 
        /* Open triggers element. */
        ret = mi_lttng_writer_open_element(writer, mi_lttng_element_triggers);
@@ -1227,9 +1181,8 @@ enum lttng_error_code lttng_triggers_mi_serialize(const struct lttng_triggers *t
 
        for (i = 0; i < lttng_dynamic_pointer_array_get_count(&sorted_triggers); i++) {
                const struct lttng_trigger *trigger =
-                               (const struct lttng_trigger *)
-                               lttng_dynamic_pointer_array_get_pointer(
-                                               &sorted_triggers, i);
+                       (const struct lttng_trigger *) lttng_dynamic_pointer_array_get_pointer(
+                               &sorted_triggers, i);
 
                lttng_trigger_mi_serialize(trigger, writer, error_query_callbacks);
        }
index 0548aaccbab6fccce6f98093cf7c98cceca4ebf7..1aea70d9f194cbb78d16a2b6058cb1e385bf6051 100644 (file)
@@ -7,6 +7,13 @@
  */
 
 #define _LGPL_SOURCE
+#include "unix.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/errno.hpp>
+#include <common/fd-handle.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/common.hpp>
-#include <common/compat/errno.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/fd-handle.hpp>
-
-#include "unix.hpp"
-
 /*
  * Connect to unix socket using the path name.
  */
@@ -32,8 +32,9 @@ int lttcomm_connect_unix_sock(const char *pathname)
 
        if (strlen(pathname) >= sizeof(s_un.sun_path)) {
                ERR("unix socket address (\"%s\") is longer than the platform's limit (%zu > %zu).",
-                               pathname, strlen(pathname) + 1,
-                               sizeof(s_un.sun_path));
+                   pathname,
+                   strlen(pathname) + 1,
+                   sizeof(s_un.sun_path));
                ret = -ENAMETOOLONG;
                goto error;
        }
@@ -110,8 +111,9 @@ int lttcomm_create_unix_sock(const char *pathname)
 
        if (strlen(pathname) >= sizeof(s_un.sun_path)) {
                ERR("unix socket address (\"%s\") is longer than the platform's limit (%zu > %zu).",
-                               pathname, strlen(pathname) + 1,
-                               sizeof(s_un.sun_path));
+                   pathname,
+                   strlen(pathname) + 1,
+                   sizeof(s_un.sun_path));
                ret = -ENAMETOOLONG;
                goto error;
        }
@@ -241,9 +243,8 @@ retry:
                         */
                        DIAGNOSTIC_PUSH
                        DIAGNOSTIC_IGNORE_LOGICAL_OP
-                       if (errno == EAGAIN || errno == EWOULDBLOCK ||
-                                       errno == EPIPE) {
-                       DIAGNOSTIC_POP
+                       if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EPIPE) {
+                               DIAGNOSTIC_POP
                                /*
                                 * Nothing was recv.
                                 */
@@ -348,9 +349,8 @@ retry:
                         */
                        DIAGNOSTIC_PUSH
                        DIAGNOSTIC_IGNORE_LOGICAL_OP
-                       if (errno == EAGAIN || errno == EWOULDBLOCK ||
-                                       errno == EPIPE) {
-                       DIAGNOSTIC_POP
+                       if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EPIPE) {
+                               DIAGNOSTIC_POP
                                /*
                                 * This can happen in non blocking mode.
                                 * Nothing was sent.
@@ -424,7 +424,7 @@ ssize_t lttcomm_send_fds_unix_sock(int sock, const int *fds, size_t nb_fd)
        if (nb_fd > LTTCOMM_MAX_SEND_FDS)
                return -EINVAL;
 
-       msg.msg_control = (caddr_t)tmp;
+       msg.msg_control = (caddr_t) tmp;
        msg.msg_controllen = CMSG_LEN(sizeof_fds);
 
        cmptr = CMSG_FIRSTHDR(&msg);
@@ -464,10 +464,8 @@ ssize_t lttcomm_send_fds_unix_sock(int sock, const int *fds, size_t nb_fd)
  *
  * Returns the size of data sent, or negative error value.
  */
-static
-ssize_t _lttcomm_send_payload_view_fds_unix_sock(int sock,
-               struct lttng_payload_view *view,
-               bool blocking)
+static ssize_t
+_lttcomm_send_payload_view_fds_unix_sock(int sock, struct lttng_payload_view *view, bool blocking)
 {
        int i;
        ssize_t ret;
@@ -491,11 +489,9 @@ ssize_t _lttcomm_send_payload_view_fds_unix_sock(int sock,
         * owns a reference to the fd_handles.
         */
        for (i = 0; i < fd_count; i++) {
-               struct fd_handle *handle =
-                               lttng_payload_view_pop_fd_handle(view);
+               struct fd_handle *handle = lttng_payload_view_pop_fd_handle(view);
                const int raw_fd = fd_handle_get_fd(handle);
-               const int add_ret = lttng_dynamic_array_add_element(
-                               &raw_fds, &raw_fd);
+               const int add_ret = lttng_dynamic_array_add_element(&raw_fds, &raw_fd);
 
                fd_handle_put(handle);
                if (add_ret) {
@@ -505,11 +501,10 @@ ssize_t _lttcomm_send_payload_view_fds_unix_sock(int sock,
        }
 
        if (blocking) {
-               ret = lttcomm_send_fds_unix_sock(sock,
-                               (const int *) raw_fds.buffer.data, fd_count);
+               ret = lttcomm_send_fds_unix_sock(sock, (const int *) raw_fds.buffer.data, fd_count);
        } else {
-               ret = lttcomm_send_fds_unix_sock_non_block(sock,
-                               (const int *) raw_fds.buffer.data, fd_count);
+               ret = lttcomm_send_fds_unix_sock_non_block(
+                       sock, (const int *) raw_fds.buffer.data, fd_count);
        }
 
 end:
@@ -517,14 +512,12 @@ end:
        return ret;
 }
 
-ssize_t lttcomm_send_payload_view_fds_unix_sock(int sock,
-               struct lttng_payload_view *view)
+ssize_t lttcomm_send_payload_view_fds_unix_sock(int sock, struct lttng_payload_view *view)
 {
        return _lttcomm_send_payload_view_fds_unix_sock(sock, view, true);
 }
 
-ssize_t lttcomm_send_payload_view_fds_unix_sock_non_block(int sock,
-               struct lttng_payload_view *view)
+ssize_t lttcomm_send_payload_view_fds_unix_sock_non_block(int sock, struct lttng_payload_view *view)
 {
        return _lttcomm_send_payload_view_fds_unix_sock(sock, view, false);
 }
@@ -555,7 +548,7 @@ ssize_t lttcomm_send_fds_unix_sock_non_block(int sock, const int *fds, size_t nb
        if (nb_fd > LTTCOMM_MAX_SEND_FDS)
                return -EINVAL;
 
-       msg.msg_control = (caddr_t)tmp;
+       msg.msg_control = (caddr_t) tmp;
        msg.msg_controllen = CMSG_LEN(sizeof_fds);
 
        cmptr = CMSG_FIRSTHDR(&msg);
@@ -587,7 +580,7 @@ retry:
                        DIAGNOSTIC_PUSH
                        DIAGNOSTIC_IGNORE_LOGICAL_OP
                        if (errno == EAGAIN || errno == EWOULDBLOCK) {
-                       DIAGNOSTIC_POP
+                               DIAGNOSTIC_POP
                                /*
                                 * This can happen in non blocking mode.
                                 * Nothing was sent.
@@ -668,8 +661,7 @@ retry:
                        goto retry;
                } else {
                        /* We consider EPIPE and EAGAIN as expected. */
-                       if (!lttng_opt_quiet &&
-                                       (errno != EPIPE && errno != EAGAIN)) {
+                       if (!lttng_opt_quiet && (errno != EPIPE && errno != EAGAIN)) {
                                PERROR("recvmsg");
                        }
                        goto end;
@@ -677,8 +669,7 @@ retry:
        }
 
        if (ret != 1) {
-               fprintf(stderr, "Error: Received %zd bytes, expected %d\n",
-                               ret, 1);
+               fprintf(stderr, "Error: Received %zd bytes, expected %d\n", ret, 1);
                goto end;
        }
 
@@ -706,7 +697,8 @@ retry:
                         * now copy the fds to the fds ptr and return success.
                         */
                        if (cmsg->cmsg_len != CMSG_LEN(sizeof_fds)) {
-                               fprintf(stderr, "Error: Received %zu bytes of"
+                               fprintf(stderr,
+                                       "Error: Received %zu bytes of"
                                        "ancillary data for FDs, expected %zu\n",
                                        (size_t) cmsg->cmsg_len,
                                        (size_t) CMSG_LEN(sizeof_fds));
@@ -732,8 +724,7 @@ end:
        return ret;
 }
 
-static
-void close_raw_fd(void *ptr)
+static void close_raw_fd(void *ptr)
 {
        const int raw_fd = *((const int *) ptr);
 
@@ -746,9 +737,8 @@ void close_raw_fd(void *ptr)
        }
 }
 
-static
-enum lttng_error_code add_fds_to_payload(struct lttng_dynamic_array *raw_fds,
-               struct lttng_payload *payload)
+static enum lttng_error_code add_fds_to_payload(struct lttng_dynamic_array *raw_fds,
+                                               struct lttng_payload *payload)
 {
        int i;
        enum lttng_error_code ret_code = LTTNG_OK;
@@ -757,8 +747,7 @@ enum lttng_error_code add_fds_to_payload(struct lttng_dynamic_array *raw_fds,
        for (i = 0; i < fd_count; i++) {
                int ret;
                struct fd_handle *handle;
-               int *raw_fd = (int *) lttng_dynamic_array_get_element(
-                       raw_fds, i);
+               int *raw_fd = (int *) lttng_dynamic_array_get_element(raw_fds, i);
 
                LTTNG_ASSERT(*raw_fd != -1);
 
@@ -783,9 +772,10 @@ end:
        return ret_code;
 }
 
-static
-ssize_t _lttcomm_recv_payload_fds_unix_sock(int sock, size_t nb_fd,
-               struct lttng_payload *payload, bool blocking)
+static ssize_t _lttcomm_recv_payload_fds_unix_sock(int sock,
+                                                  size_t nb_fd,
+                                                  struct lttng_payload *payload,
+                                                  bool blocking)
 {
        int i = 0;
        enum lttng_error_code add_ret;
@@ -807,11 +797,10 @@ ssize_t _lttcomm_recv_payload_fds_unix_sock(int sock, size_t nb_fd,
        }
 
        if (blocking) {
-               ret = lttcomm_recv_fds_unix_sock(
-                               sock, (int *) raw_fds.buffer.data, nb_fd);
+               ret = lttcomm_recv_fds_unix_sock(sock, (int *) raw_fds.buffer.data, nb_fd);
        } else {
                ret = lttcomm_recv_fds_unix_sock_non_block(
-                               sock, (int *) raw_fds.buffer.data, nb_fd);
+                       sock, (int *) raw_fds.buffer.data, nb_fd);
        }
 
        if (ret <= 0) {
@@ -820,7 +809,7 @@ ssize_t _lttcomm_recv_payload_fds_unix_sock(int sock, size_t nb_fd,
 
        add_ret = add_fds_to_payload(&raw_fds, payload);
        if (add_ret != LTTNG_OK) {
-               ret = - (int) add_ret;
+               ret = -(int) add_ret;
                goto end;
        }
 
@@ -829,14 +818,13 @@ end:
        return ret;
 }
 
-ssize_t lttcomm_recv_payload_fds_unix_sock(int sock, size_t nb_fd,
-                          struct lttng_payload *payload)
+ssize_t lttcomm_recv_payload_fds_unix_sock(int sock, size_t nb_fd, struct lttng_payload *payload)
 {
        return _lttcomm_recv_payload_fds_unix_sock(sock, nb_fd, payload, true);
 }
 
-ssize_t lttcomm_recv_payload_fds_unix_sock_non_block(int sock, size_t nb_fd,
-                          struct lttng_payload *payload)
+ssize_t
+lttcomm_recv_payload_fds_unix_sock_non_block(int sock, size_t nb_fd, struct lttng_payload *payload)
 {
        return _lttcomm_recv_payload_fds_unix_sock(sock, nb_fd, payload, false);
 }
@@ -904,7 +892,7 @@ retry:
                        DIAGNOSTIC_PUSH
                        DIAGNOSTIC_IGNORE_LOGICAL_OP
                        if (errno == EAGAIN || errno == EWOULDBLOCK) {
-                       DIAGNOSTIC_POP
+                               DIAGNOSTIC_POP
                                /*
                                 * This can happen in non blocking mode.
                                 * Nothing was recv.
@@ -928,8 +916,7 @@ retry:
        }
 
        if (ret != 1) {
-               fprintf(stderr, "Error: Received %zd bytes, expected %d\n",
-                               ret, 1);
+               fprintf(stderr, "Error: Received %zd bytes, expected %d\n", ret, 1);
                goto end;
        }
 
@@ -957,7 +944,8 @@ retry:
                         * now copy the fds to the fds ptr and return success.
                         */
                        if (cmsg->cmsg_len != CMSG_LEN(sizeof_fds)) {
-                               fprintf(stderr, "Error: Received %zu bytes of"
+                               fprintf(stderr,
+                                       "Error: Received %zu bytes of"
                                        "ancillary data for FDs, expected %zu\n",
                                        (size_t) cmsg->cmsg_len,
                                        (size_t) CMSG_LEN(sizeof_fds));
@@ -1025,7 +1013,7 @@ ssize_t lttcomm_send_creds_unix_sock(int sock, const void *buf, size_t len)
        cmptr->cmsg_type = LTTNG_SOCK_CREDS;
        cmptr->cmsg_len = CMSG_LEN(sizeof_cred);
 
-       creds = (lttng_sock_cred*) CMSG_DATA(cmptr);
+       creds = (lttng_sock_cred *) CMSG_DATA(cmptr);
 
        LTTNG_SOCK_SET_UID_CRED(creds, geteuid());
        LTTNG_SOCK_SET_GID_CRED(creds, getegid());
@@ -1052,8 +1040,7 @@ ssize_t lttcomm_send_creds_unix_sock(int sock, const void *buf, size_t len)
  *
  * Returns the size of received data, or negative error value.
  */
-ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len,
-               lttng_sock_cred *creds)
+ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len, lttng_sock_cred *creds)
 {
        struct msghdr msg;
        struct iovec iov[1];
@@ -1063,7 +1050,7 @@ ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len,
        struct cmsghdr *cmptr;
        size_t sizeof_cred = sizeof(lttng_sock_cred);
        char anc_buf[CMSG_SPACE(sizeof_cred)];
-#endif /* __linux__, __CYGWIN__ */
+#endif /* __linux__, __CYGWIN__ */
 
        LTTNG_ASSERT(sock);
        LTTNG_ASSERT(buf);
@@ -1114,16 +1101,17 @@ ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len,
                goto end;
        }
 
-       if (cmptr->cmsg_level != SOL_SOCKET ||
-                       cmptr->cmsg_type != LTTNG_SOCK_CREDS) {
+       if (cmptr->cmsg_level != SOL_SOCKET || cmptr->cmsg_type != LTTNG_SOCK_CREDS) {
                fprintf(stderr, "Didn't received any credentials\n");
                ret = -1;
                goto end;
        }
 
        if (cmptr->cmsg_len != CMSG_LEN(sizeof_cred)) {
-               fprintf(stderr, "Error: Received %zu bytes of ancillary data, expected %zu\n",
-                               (size_t) cmptr->cmsg_len, (size_t) CMSG_LEN(sizeof_cred));
+               fprintf(stderr,
+                       "Error: Received %zu bytes of ancillary data, expected %zu\n",
+                       (size_t) cmptr->cmsg_len,
+                       (size_t) CMSG_LEN(sizeof_cred));
                ret = -1;
                goto end;
        }
@@ -1137,7 +1125,7 @@ ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len,
        }
 #else
 #error "Please implement credential support for your OS."
-#endif /* __linux__, __CYGWIN__ */
+#endif /* __linux__, __CYGWIN__ */
 
 end:
        return ret;
index 3b74928b401cc469a9b2dca2f8f205b3746a1d71..e83ac8f926b9ac609f8df2bc17018db55e4a6dc6 100644 (file)
@@ -6,23 +6,27 @@
  */
 
 #define _LGPL_SOURCE
-#include <arpa/inet.h>
-#include <common/compat/netdb.hpp>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
+#include "uri.hpp"
 
 #include <common/common.hpp>
+#include <common/compat/netdb.hpp>
 #include <common/defaults.hpp>
 #include <common/utils.hpp>
 
-#include "uri.hpp"
+#include <arpa/inet.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/socket.h>
 
 #define LOOPBACK_ADDR_IPV4 "127.0.0.1"
 #define LOOPBACK_ADDR_IPV6 "::1"
 
 enum uri_proto_code {
-       P_NET, P_NET6, P_FILE, P_TCP, P_TCP6,
+       P_NET,
+       P_NET6,
+       P_FILE,
+       P_TCP,
+       P_TCP6,
 };
 
 namespace {
@@ -35,17 +39,43 @@ struct uri_proto {
 };
 
 /* Supported protocols */
-const struct uri_proto proto_uri[] = {
-       { .name = "file", .leading_string = "file://", .code = P_FILE, .type = LTTNG_PROTO_TYPE_NONE, .dtype = LTTNG_DST_PATH },
-       { .name = "net", .leading_string = "net://", .code = P_NET, .type = LTTNG_TCP, .dtype = LTTNG_DST_IPV4 },
-       { .name = "net4", .leading_string = "net4://", .code = P_NET, .type = LTTNG_TCP, .dtype = LTTNG_DST_IPV4 },
-       { .name = "net6", .leading_string = "net6://", .code = P_NET6, .type = LTTNG_TCP, .dtype = LTTNG_DST_IPV6 },
-       { .name = "tcp", .leading_string = "tcp://", .code = P_TCP, .type = LTTNG_TCP, .dtype = LTTNG_DST_IPV4 },
-       { .name = "tcp4", .leading_string = "tcp4://", .code = P_TCP, .type = LTTNG_TCP, .dtype = LTTNG_DST_IPV4 },
-       { .name = "tcp6", .leading_string = "tcp6://", .code = P_TCP6, .type = LTTNG_TCP, .dtype = LTTNG_DST_IPV6 },
-       /* Invalid proto marking the end of the array. */
-       {}
-};
+const struct uri_proto proto_uri[] = { { .name = "file",
+                                        .leading_string = "file://",
+                                        .code = P_FILE,
+                                        .type = LTTNG_PROTO_TYPE_NONE,
+                                        .dtype = LTTNG_DST_PATH },
+                                      { .name = "net",
+                                        .leading_string = "net://",
+                                        .code = P_NET,
+                                        .type = LTTNG_TCP,
+                                        .dtype = LTTNG_DST_IPV4 },
+                                      { .name = "net4",
+                                        .leading_string = "net4://",
+                                        .code = P_NET,
+                                        .type = LTTNG_TCP,
+                                        .dtype = LTTNG_DST_IPV4 },
+                                      { .name = "net6",
+                                        .leading_string = "net6://",
+                                        .code = P_NET6,
+                                        .type = LTTNG_TCP,
+                                        .dtype = LTTNG_DST_IPV6 },
+                                      { .name = "tcp",
+                                        .leading_string = "tcp://",
+                                        .code = P_TCP,
+                                        .type = LTTNG_TCP,
+                                        .dtype = LTTNG_DST_IPV4 },
+                                      { .name = "tcp4",
+                                        .leading_string = "tcp4://",
+                                        .code = P_TCP,
+                                        .type = LTTNG_TCP,
+                                        .dtype = LTTNG_DST_IPV4 },
+                                      { .name = "tcp6",
+                                        .leading_string = "tcp6://",
+                                        .code = P_TCP6,
+                                        .type = LTTNG_TCP,
+                                        .dtype = LTTNG_DST_IPV6 },
+                                      /* Invalid proto marking the end of the array. */
+                                      {} };
 } /* namespace */
 
 /*
@@ -74,10 +104,10 @@ static const struct uri_proto *get_uri_proto(const char *uri_str)
                goto end;
        }
 
-       for (supported = &proto_uri[0];
-                       supported->leading_string != NULL; ++supported) {
-               if (strncasecmp(uri_str, supported->leading_string,
-                                       strlen(supported->leading_string)) == 0) {
+       for (supported = &proto_uri[0]; supported->leading_string != NULL; ++supported) {
+               if (strncasecmp(uri_str,
+                               supported->leading_string,
+                               strlen(supported->leading_string)) == 0) {
                        goto end;
                }
        }
@@ -115,8 +145,7 @@ static int set_ip_address(const char *addr, int af, char *dst, size_t size)
                                PERROR("inet_ntop");
                                goto error;
                        }
-               } else if (!strcmp(addr, "localhost") &&
-                               (af == AF_INET || af == AF_INET6)) {
+               } else if (!strcmp(addr, "localhost") && (af == AF_INET || af == AF_INET6)) {
                        /*
                         * Some systems may not have "localhost" defined in
                         * accordance with IETF RFC 6761. According to this RFC,
@@ -130,11 +159,11 @@ static int set_ip_address(const char *addr, int af, char *dst, size_t size)
                         * done to accommodates systems which may want to start
                         * tracing before their network configured.
                         */
-                       const char *loopback_addr = af == AF_INET ?
-                                       LOOPBACK_ADDR_IPV4 : LOOPBACK_ADDR_IPV6;
+                       const char *loopback_addr = af == AF_INET ? LOOPBACK_ADDR_IPV4 :
+                                                                   LOOPBACK_ADDR_IPV6;
                        const size_t loopback_addr_len = af == AF_INET ?
-                                       sizeof(LOOPBACK_ADDR_IPV4) :
-                                       sizeof(LOOPBACK_ADDR_IPV6);
+                               sizeof(LOOPBACK_ADDR_IPV4) :
+                               sizeof(LOOPBACK_ADDR_IPV6);
 
                        DBG2("Could not resolve localhost address, using fallback");
                        if (loopback_addr_len > size) {
@@ -165,13 +194,12 @@ error:
  * Set default URI attribute which is basically the given stream type and the
  * default port if none is set in the URI.
  */
-static void set_default_uri_attr(struct lttng_uri *uri,
-               enum lttng_stream_type stype)
+static void set_default_uri_attr(struct lttng_uri *uri, enum lttng_stream_type stype)
 {
        uri->stype = stype;
        if (uri->dtype != LTTNG_DST_PATH && uri->port == 0) {
-               uri->port = (stype == LTTNG_STREAM_CONTROL) ?
-                       DEFAULT_NETWORK_CONTROL_PORT : DEFAULT_NETWORK_DATA_PORT;
+               uri->port = (stype == LTTNG_STREAM_CONTROL) ? DEFAULT_NETWORK_CONTROL_PORT :
+                                                             DEFAULT_NETWORK_DATA_PORT;
        }
 }
 
@@ -221,14 +249,20 @@ int uri_to_str_url(struct lttng_uri *uri, char *dst, size_t size)
                (void) snprintf(port, sizeof(port), "%s", "");
        } else {
                ipver = (uri->dtype == LTTNG_DST_IPV4) ? 4 : 6;
-               addr = (ipver == 4) ?  uri->dst.ipv4 : uri->dst.ipv6;
+               addr = (ipver == 4) ? uri->dst.ipv4 : uri->dst.ipv6;
                (void) snprintf(proto, sizeof(proto), "tcp%d", ipver);
                (void) snprintf(port, sizeof(port), ":%d", uri->port);
        }
 
-       ret = snprintf(dst, size, "%s://%s%s%s%s/%s", proto,
-                       (ipver == 6) ? "[" : "", addr, (ipver == 6) ? "]" : "",
-                       port, uri->subdir);
+       ret = snprintf(dst,
+                      size,
+                      "%s://%s%s%s%s/%s",
+                      proto,
+                      (ipver == 6) ? "[" : "",
+                      addr,
+                      (ipver == 6) ? "]" : "",
+                      port,
+                      uri->subdir);
        if (ret < 0) {
                PERROR("snprintf uri to url");
        }
@@ -394,8 +428,7 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris)
                 * Maximum of two ports is possible if P_NET/NET6. Bigger than that,
                 * two much stuff.
                 */
-               if ((i == 2 && (proto->code != P_NET && proto->code != P_NET6))
-                               || i > 2) {
+               if ((i == 2 && (proto->code != P_NET && proto->code != P_NET6)) || i > 2) {
                        break;
                }
 
@@ -460,8 +493,8 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris)
 
        switch (proto->code) {
        case P_NET:
-               ret = set_ip_address(addr_f, AF_INET, tmp_uris[0].dst.ipv4,
-                               sizeof(tmp_uris[0].dst.ipv4));
+               ret = set_ip_address(
+                       addr_f, AF_INET, tmp_uris[0].dst.ipv4, sizeof(tmp_uris[0].dst.ipv4));
                if (ret < 0) {
                        goto free_error;
                }
@@ -473,8 +506,8 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris)
                tmp_uris[1].port = data_port;
                break;
        case P_NET6:
-               ret = set_ip_address(addr_f, AF_INET6, tmp_uris[0].dst.ipv6,
-                               sizeof(tmp_uris[0].dst.ipv6));
+               ret = set_ip_address(
+                       addr_f, AF_INET6, tmp_uris[0].dst.ipv6, sizeof(tmp_uris[0].dst.ipv6));
                if (ret < 0) {
                        goto free_error;
                }
@@ -486,15 +519,15 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris)
                tmp_uris[1].port = data_port;
                break;
        case P_TCP:
-               ret = set_ip_address(addr_f, AF_INET, tmp_uris[0].dst.ipv4,
-                               sizeof(tmp_uris[0].dst.ipv4));
+               ret = set_ip_address(
+                       addr_f, AF_INET, tmp_uris[0].dst.ipv4, sizeof(tmp_uris[0].dst.ipv4));
                if (ret < 0) {
                        goto free_error;
                }
                break;
        case P_TCP6:
-               ret = set_ip_address(addr_f, AF_INET6, tmp_uris[0].dst.ipv6,
-                               sizeof(tmp_uris[0].dst.ipv6));
+               ret = set_ip_address(
+                       addr_f, AF_INET6, tmp_uris[0].dst.ipv6, sizeof(tmp_uris[0].dst.ipv6));
                if (ret < 0) {
                        goto free_error;
                }
@@ -505,8 +538,12 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris)
 
 end:
        DBG3("URI dtype: %d, proto: %d, host: %s, subdir: %s, ctrl: %d, data: %d",
-                       proto->dtype, proto->type, (addr_f == NULL) ? "" : addr_f,
-                       (subdir_b == NULL) ? "" : subdir_b, ctrl_port, data_port);
+            proto->dtype,
+            proto->type,
+            (addr_f == NULL) ? "" : addr_f,
+            (subdir_b == NULL) ? "" : subdir_b,
+            ctrl_port,
+            data_port);
 
        free(addr_f);
 
@@ -525,8 +562,7 @@ error:
  * Parse a string URL and creates URI(s) returning the size of the populated
  * array.
  */
-ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
-               struct lttng_uri **uris)
+ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url, struct lttng_uri **uris)
 {
        unsigned int equal = 1, idx = 0;
        /* Add the "file://" size to the URL maximum size */
@@ -561,7 +597,6 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
                } else if (ret >= sizeof(url)) {
                        PERROR("snprintf file url is too long");
                        goto parse_error;
-
                }
                ctrl_url = url;
        }
@@ -580,8 +615,7 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
                /* At this point, we know there is at least one URI in the array */
                set_default_uri_attr(&ctrl_uris[0], LTTNG_STREAM_CONTROL);
 
-               if (ctrl_uris[0].dtype == LTTNG_DST_PATH &&
-                               (data_url && *data_url != '\0')) {
+               if (ctrl_uris[0].dtype == LTTNG_DST_PATH && (data_url && *data_url != '\0')) {
                        ERR("Cannot have a data URL when destination is file://");
                        goto error;
                }
@@ -590,7 +624,7 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
                if (ctrl_uri_count == 2) {
                        if (!equal) {
                                ERR("Control URL uses the net:// protocol and the data URL is "
-                                               "different. Not allowed.");
+                                   "different. Not allowed.");
                                goto error;
                        } else {
                                set_default_uri_attr(&ctrl_uris[1], LTTNG_STREAM_DATA);
index 9798b12c46236b56f2879f53db888c22748e0015..718136c445275534180674ff2181791fc4a45d5a 100644 (file)
@@ -6,8 +6,9 @@
  */
 
 #include "lttng/lttng-error.h"
-#include <common/compat/string.hpp>
+
 #include <common/align.hpp>
+#include <common/compat/string.hpp>
 #include <common/error.hpp>
 #include <common/hashtable/hashtable.hpp>
 #include <common/hashtable/utils.hpp>
 #include <common/mi-lttng.hpp>
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
-#include <fcntl.h>
+
 #include <lttng/constant.h>
 #include <lttng/userspace-probe-internal.hpp>
+
+#include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-static
-int lttng_userspace_probe_location_function_set_binary_fd_handle(
-               struct lttng_userspace_probe_location *location,
-               struct fd_handle *binary_fd_handle);
+static int lttng_userspace_probe_location_function_set_binary_fd_handle(
+       struct lttng_userspace_probe_location *location, struct fd_handle *binary_fd_handle);
 
-static
-int lttng_userspace_probe_location_tracepoint_set_binary_fd_handle(
-               struct lttng_userspace_probe_location *location,
-               struct fd_handle *binary_fd_handle);
+static int lttng_userspace_probe_location_tracepoint_set_binary_fd_handle(
+       struct lttng_userspace_probe_location *location, struct fd_handle *binary_fd_handle);
 
-static
-enum lttng_error_code lttng_userspace_probe_location_lookup_method_mi_serialize(
-               const struct lttng_userspace_probe_location_lookup_method
-                               *method,
-               struct mi_writer *writer);
+static enum lttng_error_code lttng_userspace_probe_location_lookup_method_mi_serialize(
+       const struct lttng_userspace_probe_location_lookup_method *method,
+       struct mi_writer *writer);
 
-static
-enum lttng_error_code lttng_userspace_probe_location_tracepoint_mi_serialize(
-               const struct lttng_userspace_probe_location *location,
-               struct mi_writer *writer);
+static enum lttng_error_code lttng_userspace_probe_location_tracepoint_mi_serialize(
+       const struct lttng_userspace_probe_location *location, struct mi_writer *writer);
 
-static
-enum lttng_error_code lttng_userspace_probe_location_function_mi_serialize(
-               const struct lttng_userspace_probe_location *location,
-               struct mi_writer *writer);
+static enum lttng_error_code lttng_userspace_probe_location_function_mi_serialize(
+       const struct lttng_userspace_probe_location *location, struct mi_writer *writer);
 
 enum lttng_userspace_probe_location_lookup_method_type
 lttng_userspace_probe_location_lookup_method_get_type(
-               const struct lttng_userspace_probe_location_lookup_method *lookup_method)
+       const struct lttng_userspace_probe_location_lookup_method *lookup_method)
 {
        return lookup_method ? lookup_method->type :
-               LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_UNKNOWN;
+                              LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_UNKNOWN;
 }
 
 void lttng_userspace_probe_location_lookup_method_destroy(
-               struct lttng_userspace_probe_location_lookup_method *lookup_method)
+       struct lttng_userspace_probe_location_lookup_method *lookup_method)
 {
-       if (!lookup_method){
+       if (!lookup_method) {
                return;
        }
 
@@ -102,23 +95,21 @@ end:
        return ret;
 }
 
-enum lttng_userspace_probe_location_type lttng_userspace_probe_location_get_type(
-               const struct lttng_userspace_probe_location *location)
+enum lttng_userspace_probe_location_type
+lttng_userspace_probe_location_get_type(const struct lttng_userspace_probe_location *location)
 {
-       return location ? location->type :
-               LTTNG_USERSPACE_PROBE_LOCATION_TYPE_UNKNOWN;
+       return location ? location->type : LTTNG_USERSPACE_PROBE_LOCATION_TYPE_UNKNOWN;
 }
 
-static
-void lttng_userspace_probe_location_function_destroy(
-               struct lttng_userspace_probe_location *location)
+static void
+lttng_userspace_probe_location_function_destroy(struct lttng_userspace_probe_location *location)
 {
        struct lttng_userspace_probe_location_function *location_function = NULL;
 
        LTTNG_ASSERT(location);
 
-       location_function = lttng::utils::container_of(location,
-                       &lttng_userspace_probe_location_function::parent);
+       location_function = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_function::parent);
 
        LTTNG_ASSERT(location_function);
 
@@ -128,16 +119,15 @@ void lttng_userspace_probe_location_function_destroy(
        free(location);
 }
 
-static
-void lttng_userspace_probe_location_tracepoint_destroy(
-               struct lttng_userspace_probe_location *location)
+static void
+lttng_userspace_probe_location_tracepoint_destroy(struct lttng_userspace_probe_location *location)
 {
        struct lttng_userspace_probe_location_tracepoint *location_tracepoint = NULL;
 
        LTTNG_ASSERT(location);
 
-       location_tracepoint = lttng::utils::container_of(location,
-                       &lttng_userspace_probe_location_tracepoint::parent);
+       location_tracepoint = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_tracepoint::parent);
 
        LTTNG_ASSERT(location_tracepoint);
 
@@ -148,15 +138,13 @@ void lttng_userspace_probe_location_tracepoint_destroy(
        free(location);
 }
 
-void lttng_userspace_probe_location_destroy(
-               struct lttng_userspace_probe_location *location)
+void lttng_userspace_probe_location_destroy(struct lttng_userspace_probe_location *location)
 {
        if (!location) {
                return;
        }
 
-       lttng_userspace_probe_location_lookup_method_destroy(
-                       location->lookup_method);
+       lttng_userspace_probe_location_lookup_method_destroy(location->lookup_method);
 
        switch (location->type) {
        case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION:
@@ -198,34 +186,30 @@ static bool fd_is_equal(int a, int b)
        /* Both are valid file descriptors. */
        ret = fstat(a, &a_stat);
        if (ret) {
-               PERROR("Failed to fstat userspace probe location binary fd %d",
-                               a);
+               PERROR("Failed to fstat userspace probe location binary fd %d", a);
                goto end;
        }
 
        ret = fstat(b, &b_stat);
        if (ret) {
-               PERROR("Failed to fstat userspace probe location binary fd %d",
-                               b);
+               PERROR("Failed to fstat userspace probe location binary fd %d", b);
                goto end;
        }
 
-       is_equal = (a_stat.st_ino == b_stat.st_ino) &&
-                       (a_stat.st_dev == b_stat.st_dev);
+       is_equal = (a_stat.st_ino == b_stat.st_ino) && (a_stat.st_dev == b_stat.st_dev);
 
 end:
        return is_equal;
 }
 
-static unsigned long lttng_userspace_probe_location_function_hash(
-               const struct lttng_userspace_probe_location *location)
+static unsigned long
+lttng_userspace_probe_location_function_hash(const struct lttng_userspace_probe_location *location)
 {
-       unsigned long hash = hash_key_ulong(
-                       (void *) LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION,
-                       lttng_ht_seed);
+       unsigned long hash = hash_key_ulong((void *) LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION,
+                                           lttng_ht_seed);
        struct lttng_userspace_probe_location_function *function_location =
-                       lttng::utils::container_of(
-                                       location, &lttng_userspace_probe_location_function::parent);
+               lttng::utils::container_of(location,
+                                          &lttng_userspace_probe_location_function::parent);
 
        hash ^= hash_key_str(function_location->function_name, lttng_ht_seed);
        hash ^= hash_key_str(function_location->binary_path, lttng_ht_seed);
@@ -236,17 +220,15 @@ static unsigned long lttng_userspace_probe_location_function_hash(
        return hash;
 }
 
-static bool lttng_userspace_probe_location_function_is_equal(
-               const struct lttng_userspace_probe_location *_a,
-               const struct lttng_userspace_probe_location *_b)
+static bool
+lttng_userspace_probe_location_function_is_equal(const struct lttng_userspace_probe_location *_a,
+                                                const struct lttng_userspace_probe_location *_b)
 {
        bool is_equal = false;
        struct lttng_userspace_probe_location_function *a, *b;
 
-       a = lttng::utils::container_of(_a,
-                       &lttng_userspace_probe_location_function::parent);
-       b = lttng::utils::container_of(_b,
-                       &lttng_userspace_probe_location_function::parent);
+       a = lttng::utils::container_of(_a, &lttng_userspace_probe_location_function::parent);
+       b = lttng::utils::container_of(_b, &lttng_userspace_probe_location_function::parent);
 
        if (a->instrumentation_type != b->instrumentation_type) {
                goto end;
@@ -265,16 +247,17 @@ static bool lttng_userspace_probe_location_function_is_equal(
        }
 
        is_equal = fd_is_equal(a->binary_fd_handle ? fd_handle_get_fd(a->binary_fd_handle) : -1,
-                       b->binary_fd_handle ? fd_handle_get_fd(b->binary_fd_handle) : -1);
+                              b->binary_fd_handle ? fd_handle_get_fd(b->binary_fd_handle) : -1);
 end:
        return is_equal;
 }
 
 static struct lttng_userspace_probe_location *
-lttng_userspace_probe_location_function_create_no_check(const char *binary_path,
-               const char *function_name,
-               struct lttng_userspace_probe_location_lookup_method *lookup_method,
-               bool open_binary)
+lttng_userspace_probe_location_function_create_no_check(
+       const char *binary_path,
+       const char *function_name,
+       struct lttng_userspace_probe_location_lookup_method *lookup_method,
+       bool open_binary)
 {
        int binary_fd = -1;
        struct fd_handle *binary_fd_handle = NULL;
@@ -321,7 +304,7 @@ lttng_userspace_probe_location_function_create_no_check(const char *binary_path,
        location->binary_fd_handle = binary_fd_handle;
        binary_fd_handle = NULL;
        location->instrumentation_type =
-                       LTTNG_USERSPACE_PROBE_LOCATION_FUNCTION_INSTRUMENTATION_TYPE_ENTRY;
+               LTTNG_USERSPACE_PROBE_LOCATION_FUNCTION_INSTRUMENTATION_TYPE_ENTRY;
 
        ret = &location->parent;
        ret->lookup_method = lookup_method;
@@ -344,13 +327,12 @@ end:
 }
 
 static unsigned long lttng_userspace_probe_location_tracepoint_hash(
-               const struct lttng_userspace_probe_location *location)
+       const struct lttng_userspace_probe_location *location)
 {
-       unsigned long hash = hash_key_ulong(
-                       (void *) LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT,
-                       lttng_ht_seed);
+       unsigned long hash = hash_key_ulong((void *) LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT,
+                                           lttng_ht_seed);
        struct lttng_userspace_probe_location_tracepoint *tp_location = lttng::utils::container_of(
-                       location, &lttng_userspace_probe_location_tracepoint::parent);
+               location, &lttng_userspace_probe_location_tracepoint::parent);
 
        hash ^= hash_key_str(tp_location->probe_name, lttng_ht_seed);
        hash ^= hash_key_str(tp_location->provider_name, lttng_ht_seed);
@@ -362,17 +344,15 @@ static unsigned long lttng_userspace_probe_location_tracepoint_hash(
        return hash;
 }
 
-static bool lttng_userspace_probe_location_tracepoint_is_equal(
-               const struct lttng_userspace_probe_location *_a,
-               const struct lttng_userspace_probe_location *_b)
+static bool
+lttng_userspace_probe_location_tracepoint_is_equal(const struct lttng_userspace_probe_location *_a,
+                                                  const struct lttng_userspace_probe_location *_b)
 {
        bool is_equal = false;
        struct lttng_userspace_probe_location_tracepoint *a, *b;
 
-       a = lttng::utils::container_of(_a,
-                       &lttng_userspace_probe_location_tracepoint::parent);
-       b = lttng::utils::container_of(_b,
-                       &lttng_userspace_probe_location_tracepoint::parent);
+       a = lttng::utils::container_of(_a, &lttng_userspace_probe_location_tracepoint::parent);
+       b = lttng::utils::container_of(_b, &lttng_userspace_probe_location_tracepoint::parent);
 
        LTTNG_ASSERT(a->probe_name);
        LTTNG_ASSERT(b->probe_name);
@@ -393,17 +373,19 @@ static bool lttng_userspace_probe_location_tracepoint_is_equal(
        }
 
        is_equal = fd_is_equal(a->binary_fd_handle ? fd_handle_get_fd(a->binary_fd_handle) : -1,
-                       b->binary_fd_handle ? fd_handle_get_fd(b->binary_fd_handle) : -1);
+                              b->binary_fd_handle ? fd_handle_get_fd(b->binary_fd_handle) : -1);
 
 end:
        return is_equal;
 }
 
 static struct lttng_userspace_probe_location *
-lttng_userspace_probe_location_tracepoint_create_no_check(const char *binary_path,
-               const char *provider_name, const char *probe_name,
-               struct lttng_userspace_probe_location_lookup_method *lookup_method,
-               bool open_binary)
+lttng_userspace_probe_location_tracepoint_create_no_check(
+       const char *binary_path,
+       const char *provider_name,
+       const char *probe_name,
+       struct lttng_userspace_probe_location_lookup_method *lookup_method,
+       bool open_binary)
 {
        int binary_fd = -1;
        struct fd_handle *binary_fd_handle = NULL;
@@ -480,10 +462,10 @@ end:
        return ret;
 }
 
-struct lttng_userspace_probe_location *
-lttng_userspace_probe_location_function_create(const char *binary_path,
-               const char *function_name,
-               struct lttng_userspace_probe_location_lookup_method *lookup_method)
+struct lttng_userspace_probe_location *lttng_userspace_probe_location_function_create(
+       const char *binary_path,
+       const char *function_name,
+       struct lttng_userspace_probe_location_lookup_method *lookup_method)
 {
        struct lttng_userspace_probe_location *ret = NULL;
 
@@ -492,8 +474,7 @@ lttng_userspace_probe_location_function_create(const char *binary_path,
                goto end;
        }
 
-       switch (lttng_userspace_probe_location_lookup_method_get_type(
-                       lookup_method)) {
+       switch (lttng_userspace_probe_location_lookup_method_get_type(lookup_method)) {
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT:
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF:
                break;
@@ -503,15 +484,16 @@ lttng_userspace_probe_location_function_create(const char *binary_path,
        }
 
        ret = lttng_userspace_probe_location_function_create_no_check(
-                       binary_path, function_name, lookup_method, true);
+               binary_path, function_name, lookup_method, true);
 end:
        return ret;
 }
 
-struct lttng_userspace_probe_location *
-lttng_userspace_probe_location_tracepoint_create(const char *binary_path,
-               const char *provider_name, const char *probe_name,
-               struct lttng_userspace_probe_location_lookup_method *lookup_method)
+struct lttng_userspace_probe_location *lttng_userspace_probe_location_tracepoint_create(
+       const char *binary_path,
+       const char *provider_name,
+       const char *probe_name,
+       struct lttng_userspace_probe_location_lookup_method *lookup_method)
 {
        struct lttng_userspace_probe_location *ret = NULL;
 
@@ -520,8 +502,7 @@ lttng_userspace_probe_location_tracepoint_create(const char *binary_path,
                goto end;
        }
 
-       switch (lttng_userspace_probe_location_lookup_method_get_type(
-                       lookup_method)) {
+       switch (lttng_userspace_probe_location_lookup_method_get_type(lookup_method)) {
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT:
                break;
        default:
@@ -530,21 +511,21 @@ lttng_userspace_probe_location_tracepoint_create(const char *binary_path,
        }
 
        ret = lttng_userspace_probe_location_tracepoint_create_no_check(
-                       binary_path, provider_name, probe_name, lookup_method, true);
+               binary_path, provider_name, probe_name, lookup_method, true);
 end:
        return ret;
 }
 
 static struct lttng_userspace_probe_location_lookup_method *
 lttng_userspace_probe_location_lookup_method_function_elf_copy(
-               const struct lttng_userspace_probe_location_lookup_method *lookup_method)
+       const struct lttng_userspace_probe_location_lookup_method *lookup_method)
 {
        struct lttng_userspace_probe_location_lookup_method *parent = NULL;
        struct lttng_userspace_probe_location_lookup_method_elf *elf_method;
 
        LTTNG_ASSERT(lookup_method);
        LTTNG_ASSERT(lookup_method->type ==
-                       LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF);
+                    LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF);
 
        elf_method = zmalloc<lttng_userspace_probe_location_lookup_method_elf>();
        if (!elf_method) {
@@ -564,14 +545,14 @@ end:
 
 static struct lttng_userspace_probe_location_lookup_method *
 lttng_userspace_probe_location_lookup_method_tracepoint_sdt_copy(
-               struct lttng_userspace_probe_location_lookup_method *lookup_method)
+       struct lttng_userspace_probe_location_lookup_method *lookup_method)
 {
        struct lttng_userspace_probe_location_lookup_method *parent = NULL;
        struct lttng_userspace_probe_location_lookup_method_sdt *sdt_method;
 
        LTTNG_ASSERT(lookup_method);
        LTTNG_ASSERT(lookup_method->type ==
-                       LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT);
+                    LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT);
 
        sdt_method = zmalloc<lttng_userspace_probe_location_lookup_method_sdt>();
        if (!sdt_method) {
@@ -591,8 +572,7 @@ end:
 }
 
 static struct lttng_userspace_probe_location *
-lttng_userspace_probe_location_function_copy(
-               const struct lttng_userspace_probe_location *location)
+lttng_userspace_probe_location_function_copy(const struct lttng_userspace_probe_location *location)
 {
        enum lttng_userspace_probe_location_lookup_method_type lookup_type;
        struct lttng_userspace_probe_location *new_location = NULL;
@@ -604,7 +584,7 @@ lttng_userspace_probe_location_function_copy(
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
        function_location = lttng::utils::container_of(
-                       location, &lttng_userspace_probe_location_function::parent);
+               location, &lttng_userspace_probe_location_function::parent);
 
        /* Get probe location fields */
        binary_path = lttng_userspace_probe_location_function_get_binary_path(location);
@@ -622,13 +602,12 @@ lttng_userspace_probe_location_function_copy(
        /*
         * Duplicate probe location method fields
         */
-       lookup_type = lttng_userspace_probe_location_lookup_method_get_type(
-                       location->lookup_method);
+       lookup_type =
+               lttng_userspace_probe_location_lookup_method_get_type(location->lookup_method);
        switch (lookup_type) {
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF:
-               lookup_method =
-                       lttng_userspace_probe_location_lookup_method_function_elf_copy(
-                                       location->lookup_method);
+               lookup_method = lttng_userspace_probe_location_lookup_method_function_elf_copy(
+                       location->lookup_method);
                if (!lookup_method) {
                        goto error;
                }
@@ -640,14 +619,14 @@ lttng_userspace_probe_location_function_copy(
 
        /* Create the probe_location */
        new_location = lttng_userspace_probe_location_function_create_no_check(
-                       binary_path, function_name, lookup_method, false);
+               binary_path, function_name, lookup_method, false);
        if (!new_location) {
                goto destroy_lookup_method;
        }
 
        /* Set the duplicated fd to the new probe_location */
-       if (lttng_userspace_probe_location_function_set_binary_fd_handle(new_location,
-                       function_location->binary_fd_handle) < 0) {
+       if (lttng_userspace_probe_location_function_set_binary_fd_handle(
+                   new_location, function_location->binary_fd_handle) < 0) {
                goto destroy_probe_location;
        }
 
@@ -663,9 +642,8 @@ end:
        return new_location;
 }
 
-static struct lttng_userspace_probe_location *
-lttng_userspace_probe_location_tracepoint_copy(
-               const struct lttng_userspace_probe_location *location)
+static struct lttng_userspace_probe_location *lttng_userspace_probe_location_tracepoint_copy(
+       const struct lttng_userspace_probe_location *location)
 {
        enum lttng_userspace_probe_location_lookup_method_type lookup_type;
        struct lttng_userspace_probe_location *new_location = NULL;
@@ -678,7 +656,7 @@ lttng_userspace_probe_location_tracepoint_copy(
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
        tracepoint_location = lttng::utils::container_of(
-                       location, &lttng_userspace_probe_location_tracepoint::parent);
+               location, &lttng_userspace_probe_location_tracepoint::parent);
 
        /* Get probe location fields */
        binary_path = lttng_userspace_probe_location_tracepoint_get_binary_path(location);
@@ -702,13 +680,12 @@ lttng_userspace_probe_location_tracepoint_copy(
        /*
         * Duplicate probe location method fields
         */
-       lookup_type = lttng_userspace_probe_location_lookup_method_get_type(
-                       location->lookup_method);
+       lookup_type =
+               lttng_userspace_probe_location_lookup_method_get_type(location->lookup_method);
        switch (lookup_type) {
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT:
-               lookup_method =
-                       lttng_userspace_probe_location_lookup_method_tracepoint_sdt_copy(
-                                       location->lookup_method);
+               lookup_method = lttng_userspace_probe_location_lookup_method_tracepoint_sdt_copy(
+                       location->lookup_method);
                if (!lookup_method) {
                        goto error;
                }
@@ -720,14 +697,14 @@ lttng_userspace_probe_location_tracepoint_copy(
 
        /* Create the probe_location */
        new_location = lttng_userspace_probe_location_tracepoint_create_no_check(
-                       binary_path, provider_name, probe_name, lookup_method, false);
+               binary_path, provider_name, probe_name, lookup_method, false);
        if (!new_location) {
                goto destroy_lookup_method;
        }
 
        /* Set the duplicated fd to the new probe_location */
-       if (lttng_userspace_probe_location_tracepoint_set_binary_fd_handle(new_location,
-                       tracepoint_location->binary_fd_handle) < 0) {
+       if (lttng_userspace_probe_location_tracepoint_set_binary_fd_handle(
+                   new_location, tracepoint_location->binary_fd_handle) < 0) {
                goto destroy_probe_location;
        }
 
@@ -744,136 +721,144 @@ end:
 }
 
 const char *lttng_userspace_probe_location_function_get_binary_path(
-               const struct lttng_userspace_probe_location *location)
+       const struct lttng_userspace_probe_location *location)
 {
        const char *ret = NULL;
        struct lttng_userspace_probe_location_function *function_location;
 
-       if (!location || lttng_userspace_probe_location_get_type(location) !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION) {
+       if (!location ||
+           lttng_userspace_probe_location_get_type(location) !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                goto end;
        }
 
-       function_location = lttng::utils::container_of(location,
-               &lttng_userspace_probe_location_function::parent);
+       function_location = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_function::parent);
        ret = function_location->binary_path;
 end:
        return ret;
 }
 
 const char *lttng_userspace_probe_location_tracepoint_get_binary_path(
-               const struct lttng_userspace_probe_location *location)
+       const struct lttng_userspace_probe_location *location)
 {
        const char *ret = NULL;
        struct lttng_userspace_probe_location_tracepoint *tracepoint_location;
 
-       if (!location || lttng_userspace_probe_location_get_type(location) !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT) {
+       if (!location ||
+           lttng_userspace_probe_location_get_type(location) !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                goto end;
        }
 
-       tracepoint_location = lttng::utils::container_of(location,
-               &lttng_userspace_probe_location_tracepoint::parent);
+       tracepoint_location = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_tracepoint::parent);
        ret = tracepoint_location->binary_path;
 end:
        return ret;
 }
 
 const char *lttng_userspace_probe_location_function_get_function_name(
-               const struct lttng_userspace_probe_location *location)
+       const struct lttng_userspace_probe_location *location)
 {
        const char *ret = NULL;
        struct lttng_userspace_probe_location_function *function_location;
 
-       if (!location || lttng_userspace_probe_location_get_type(location) !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION) {
+       if (!location ||
+           lttng_userspace_probe_location_get_type(location) !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                goto end;
        }
 
-       function_location = lttng::utils::container_of(location,
-               &lttng_userspace_probe_location_function::parent);
+       function_location = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_function::parent);
        ret = function_location->function_name;
 end:
        return ret;
 }
 
 const char *lttng_userspace_probe_location_tracepoint_get_probe_name(
-               const struct lttng_userspace_probe_location *location)
+       const struct lttng_userspace_probe_location *location)
 {
        const char *ret = NULL;
        struct lttng_userspace_probe_location_tracepoint *tracepoint_location;
 
-       if (!location || lttng_userspace_probe_location_get_type(location) !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT) {
+       if (!location ||
+           lttng_userspace_probe_location_get_type(location) !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                goto end;
        }
 
-       tracepoint_location = lttng::utils::container_of(location,
-               &lttng_userspace_probe_location_tracepoint::parent);
+       tracepoint_location = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_tracepoint::parent);
        ret = tracepoint_location->probe_name;
 end:
        return ret;
 }
 
 const char *lttng_userspace_probe_location_tracepoint_get_provider_name(
-               const struct lttng_userspace_probe_location *location)
+       const struct lttng_userspace_probe_location *location)
 {
        const char *ret = NULL;
        struct lttng_userspace_probe_location_tracepoint *tracepoint_location;
 
-       if (!location || lttng_userspace_probe_location_get_type(location) !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT) {
+       if (!location ||
+           lttng_userspace_probe_location_get_type(location) !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                goto end;
        }
 
-       tracepoint_location = lttng::utils::container_of(location,
-               &lttng_userspace_probe_location_tracepoint::parent);
+       tracepoint_location = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_tracepoint::parent);
        ret = tracepoint_location->provider_name;
 end:
        return ret;
 }
 
 int lttng_userspace_probe_location_function_get_binary_fd(
-               const struct lttng_userspace_probe_location *location)
+       const struct lttng_userspace_probe_location *location)
 {
        int ret = -1;
        struct lttng_userspace_probe_location_function *function_location;
 
-       if (!location || lttng_userspace_probe_location_get_type(location) !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION) {
+       if (!location ||
+           lttng_userspace_probe_location_get_type(location) !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                goto end;
        }
 
-       function_location = lttng::utils::container_of(location,
-               &lttng_userspace_probe_location_function::parent);
+       function_location = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_function::parent);
        ret = function_location->binary_fd_handle ?
-                       fd_handle_get_fd(function_location->binary_fd_handle) : -1;
+               fd_handle_get_fd(function_location->binary_fd_handle) :
+               -1;
 end:
        return ret;
 }
 
 enum lttng_userspace_probe_location_function_instrumentation_type
 lttng_userspace_probe_location_function_get_instrumentation_type(
-               const struct lttng_userspace_probe_location *location)
+       const struct lttng_userspace_probe_location *location)
 {
        enum lttng_userspace_probe_location_function_instrumentation_type type;
        struct lttng_userspace_probe_location_function *function_location;
 
-       if (!location || lttng_userspace_probe_location_get_type(location) !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION) {
+       if (!location ||
+           lttng_userspace_probe_location_get_type(location) !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                type = LTTNG_USERSPACE_PROBE_LOCATION_FUNCTION_INSTRUMENTATION_TYPE_UNKNOWN;
                goto end;
        }
 
-       function_location = lttng::utils::container_of(location,
-               &lttng_userspace_probe_location_function::parent);
+       function_location = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_function::parent);
        type = function_location->instrumentation_type;
 end:
        return type;
@@ -881,57 +866,61 @@ end:
 
 enum lttng_userspace_probe_location_status
 lttng_userspace_probe_location_function_set_instrumentation_type(
-               const struct lttng_userspace_probe_location *location,
-               enum lttng_userspace_probe_location_function_instrumentation_type instrumentation_type)
+       const struct lttng_userspace_probe_location *location,
+       enum lttng_userspace_probe_location_function_instrumentation_type instrumentation_type)
 {
        enum lttng_userspace_probe_location_status status =
-                       LTTNG_USERSPACE_PROBE_LOCATION_STATUS_OK;
+               LTTNG_USERSPACE_PROBE_LOCATION_STATUS_OK;
        struct lttng_userspace_probe_location_function *function_location;
 
-       if (!location || lttng_userspace_probe_location_get_type(location) !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION ||
-                       instrumentation_type !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_FUNCTION_INSTRUMENTATION_TYPE_ENTRY) {
+       if (!location ||
+           lttng_userspace_probe_location_get_type(location) !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION ||
+           instrumentation_type !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_FUNCTION_INSTRUMENTATION_TYPE_ENTRY) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                status = LTTNG_USERSPACE_PROBE_LOCATION_STATUS_INVALID;
                goto end;
        }
 
-       function_location = lttng::utils::container_of(location,
-               &lttng_userspace_probe_location_function::parent);
+       function_location = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_function::parent);
        function_location->instrumentation_type = instrumentation_type;
 end:
        return status;
 }
 
 int lttng_userspace_probe_location_tracepoint_get_binary_fd(
-               const struct lttng_userspace_probe_location *location)
+       const struct lttng_userspace_probe_location *location)
 {
        int ret = -1;
        struct lttng_userspace_probe_location_tracepoint *tracepoint_location;
 
-       if (!location || lttng_userspace_probe_location_get_type(location) !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT) {
+       if (!location ||
+           lttng_userspace_probe_location_get_type(location) !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                goto end;
        }
 
-       tracepoint_location = lttng::utils::container_of(location,
-               &lttng_userspace_probe_location_tracepoint::parent);
+       tracepoint_location = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_tracepoint::parent);
        ret = tracepoint_location->binary_fd_handle ?
-                       fd_handle_get_fd(tracepoint_location->binary_fd_handle) : -1;
+               fd_handle_get_fd(tracepoint_location->binary_fd_handle) :
+               -1;
 end:
        return ret;
 }
 
 static struct lttng_userspace_probe_location_lookup_method *
 lttng_userspace_probe_location_function_get_lookup_method(
-               const struct lttng_userspace_probe_location *location)
+       const struct lttng_userspace_probe_location *location)
 {
        struct lttng_userspace_probe_location_lookup_method *ret = NULL;
 
-       if (!location || lttng_userspace_probe_location_get_type(location) !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION) {
+       if (!location ||
+           lttng_userspace_probe_location_get_type(location) !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                goto end;
        }
@@ -943,12 +932,13 @@ end:
 
 static struct lttng_userspace_probe_location_lookup_method *
 lttng_userspace_probe_location_tracepoint_get_lookup_method(
-               const struct lttng_userspace_probe_location *location)
+       const struct lttng_userspace_probe_location *location)
 {
        struct lttng_userspace_probe_location_lookup_method *ret = NULL;
 
-       if (!location || lttng_userspace_probe_location_get_type(location) !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT) {
+       if (!location ||
+           lttng_userspace_probe_location_get_type(location) !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT) {
                ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
                goto end;
        }
@@ -960,19 +950,17 @@ end:
 
 const struct lttng_userspace_probe_location_lookup_method *
 lttng_userspace_probe_location_get_lookup_method(
-               const struct lttng_userspace_probe_location *location)
+       const struct lttng_userspace_probe_location *location)
 {
        struct lttng_userspace_probe_location_lookup_method *ret = NULL;
 
        LTTNG_ASSERT(location);
        switch (location->type) {
        case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION:
-       ret = lttng_userspace_probe_location_function_get_lookup_method(
-                       location);
+               ret = lttng_userspace_probe_location_function_get_lookup_method(location);
                break;
        case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT:
-       ret = lttng_userspace_probe_location_tracepoint_get_lookup_method(
-                       location);
+               ret = lttng_userspace_probe_location_tracepoint_get_lookup_method(location);
                break;
        default:
                ERR("Unknowned lookup method.");
@@ -981,20 +969,19 @@ lttng_userspace_probe_location_get_lookup_method(
        return ret;
 }
 
-static
-int lttng_userspace_probe_location_lookup_method_serialize(
-               struct lttng_userspace_probe_location_lookup_method *method,
-               struct lttng_payload *payload)
+static int lttng_userspace_probe_location_lookup_method_serialize(
+       struct lttng_userspace_probe_location_lookup_method *method, struct lttng_payload *payload)
 {
        int ret;
-       struct lttng_userspace_probe_location_lookup_method_comm
-                       lookup_method_comm;
+       struct lttng_userspace_probe_location_lookup_method_comm lookup_method_comm;
 
-       lookup_method_comm.type = (int8_t) (method ? method->type :
-                       LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT);
+       lookup_method_comm.type =
+               (int8_t) (method ?
+                                 method->type :
+                                 LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT);
        if (payload) {
-               ret = lttng_dynamic_buffer_append(&payload->buffer, &lookup_method_comm,
-                               sizeof(lookup_method_comm));
+               ret = lttng_dynamic_buffer_append(
+                       &payload->buffer, &lookup_method_comm, sizeof(lookup_method_comm));
                if (ret) {
                        goto end;
                }
@@ -1004,10 +991,8 @@ end:
        return ret;
 }
 
-static
-int lttng_userspace_probe_location_function_serialize(
-               const struct lttng_userspace_probe_location *location,
-               struct lttng_payload *payload)
+static int lttng_userspace_probe_location_function_serialize(
+       const struct lttng_userspace_probe_location *location, struct lttng_payload *payload)
 {
        int ret;
        size_t function_name_len, binary_path_len;
@@ -1016,10 +1001,10 @@ int lttng_userspace_probe_location_function_serialize(
 
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(lttng_userspace_probe_location_get_type(location) ==
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
+                    LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
 
-       location_function = lttng::utils::container_of(location,
-                       &lttng_userspace_probe_location_function::parent);
+       location_function = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_function::parent);
        if (!location_function->function_name || !location_function->binary_path) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -1045,45 +1030,40 @@ int lttng_userspace_probe_location_function_serialize(
        location_function_comm.binary_path_len = binary_path_len + 1;
 
        if (payload) {
-               ret = lttng_dynamic_buffer_append(&payload->buffer,
-                               &location_function_comm,
-                               sizeof(location_function_comm));
+               ret = lttng_dynamic_buffer_append(
+                       &payload->buffer, &location_function_comm, sizeof(location_function_comm));
                if (ret) {
                        ret = -LTTNG_ERR_INVALID;
                        goto end;
                }
                ret = lttng_dynamic_buffer_append(&payload->buffer,
-                               location_function->function_name,
-                               location_function_comm.function_name_len);
+                                                 location_function->function_name,
+                                                 location_function_comm.function_name_len);
                if (ret) {
                        ret = -LTTNG_ERR_INVALID;
                        goto end;
                }
                ret = lttng_dynamic_buffer_append(&payload->buffer,
-                               location_function->binary_path,
-                               location_function_comm.binary_path_len);
+                                                 location_function->binary_path,
+                                                 location_function_comm.binary_path_len);
                if (ret) {
                        ret = -LTTNG_ERR_INVALID;
                        goto end;
                }
-               ret = lttng_payload_push_fd_handle(
-                               payload, location_function->binary_fd_handle);
+               ret = lttng_payload_push_fd_handle(payload, location_function->binary_fd_handle);
                if (ret) {
                        ret = -LTTNG_ERR_INVALID;
                        goto end;
                }
        }
-       ret = sizeof(location_function_comm) +
-                       location_function_comm.function_name_len +
-                       location_function_comm.binary_path_len;
+       ret = sizeof(location_function_comm) + location_function_comm.function_name_len +
+               location_function_comm.binary_path_len;
 end:
        return ret;
 }
 
-static
-int lttng_userspace_probe_location_tracepoint_serialize(
-               const struct lttng_userspace_probe_location *location,
-               struct lttng_payload *payload)
+static int lttng_userspace_probe_location_tracepoint_serialize(
+       const struct lttng_userspace_probe_location *location, struct lttng_payload *payload)
 {
        int ret;
        size_t probe_name_len, provider_name_len, binary_path_len;
@@ -1092,13 +1072,12 @@ int lttng_userspace_probe_location_tracepoint_serialize(
 
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(lttng_userspace_probe_location_get_type(location) ==
-                       LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
+                    LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
 
-       location_tracepoint = lttng::utils::container_of(location,
-                       &lttng_userspace_probe_location_tracepoint::parent);
-       if (!location_tracepoint->probe_name ||
-                       !location_tracepoint->provider_name ||
-                       !location_tracepoint->binary_path) {
+       location_tracepoint = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_tracepoint::parent);
+       if (!location_tracepoint->probe_name || !location_tracepoint->provider_name ||
+           !location_tracepoint->binary_path) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -1132,52 +1111,49 @@ int lttng_userspace_probe_location_tracepoint_serialize(
 
        if (payload) {
                ret = lttng_dynamic_buffer_append(&payload->buffer,
-                               &location_tracepoint_comm,
-                               sizeof(location_tracepoint_comm));
+                                                 &location_tracepoint_comm,
+                                                 sizeof(location_tracepoint_comm));
                if (ret) {
                        ret = -LTTNG_ERR_INVALID;
                        goto end;
                }
                ret = lttng_dynamic_buffer_append(&payload->buffer,
-                               location_tracepoint->probe_name,
-                               location_tracepoint_comm.probe_name_len);
+                                                 location_tracepoint->probe_name,
+                                                 location_tracepoint_comm.probe_name_len);
                if (ret) {
                        ret = -LTTNG_ERR_INVALID;
                        goto end;
                }
                ret = lttng_dynamic_buffer_append(&payload->buffer,
-                               location_tracepoint->provider_name,
-                               location_tracepoint_comm.provider_name_len);
+                                                 location_tracepoint->provider_name,
+                                                 location_tracepoint_comm.provider_name_len);
                if (ret) {
                        ret = -LTTNG_ERR_INVALID;
                        goto end;
                }
                ret = lttng_dynamic_buffer_append(&payload->buffer,
-                               location_tracepoint->binary_path,
-                               location_tracepoint_comm.binary_path_len);
+                                                 location_tracepoint->binary_path,
+                                                 location_tracepoint_comm.binary_path_len);
                if (ret) {
                        ret = -LTTNG_ERR_INVALID;
                        goto end;
                }
-               ret = lttng_payload_push_fd_handle(
-                               payload, location_tracepoint->binary_fd_handle);
+               ret = lttng_payload_push_fd_handle(payload, location_tracepoint->binary_fd_handle);
                if (ret) {
                        ret = -LTTNG_ERR_INVALID;
                        goto end;
                }
        }
 
-       ret = sizeof(location_tracepoint_comm) +
-                       location_tracepoint_comm.probe_name_len +
-                       location_tracepoint_comm.provider_name_len +
-                       location_tracepoint_comm.binary_path_len;
+       ret = sizeof(location_tracepoint_comm) + location_tracepoint_comm.probe_name_len +
+               location_tracepoint_comm.provider_name_len +
+               location_tracepoint_comm.binary_path_len;
 end:
        return ret;
 }
 
-int lttng_userspace_probe_location_serialize(
-               const struct lttng_userspace_probe_location *location,
-               struct lttng_payload *payload)
+int lttng_userspace_probe_location_serialize(const struct lttng_userspace_probe_location *location,
+                                            struct lttng_payload *payload)
 {
        int ret, buffer_use = 0;
        struct lttng_userspace_probe_location_comm location_generic_comm;
@@ -1192,9 +1168,8 @@ int lttng_userspace_probe_location_serialize(
 
        location_generic_comm.type = (int8_t) location->type;
        if (payload) {
-               ret = lttng_dynamic_buffer_append(&payload->buffer,
-                               &location_generic_comm,
-                               sizeof(location_generic_comm));
+               ret = lttng_dynamic_buffer_append(
+                       &payload->buffer, &location_generic_comm, sizeof(location_generic_comm));
                if (ret) {
                        goto end;
                }
@@ -1203,12 +1178,10 @@ int lttng_userspace_probe_location_serialize(
 
        switch (lttng_userspace_probe_location_get_type(location)) {
        case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION:
-               ret = lttng_userspace_probe_location_function_serialize(
-                               location, payload);
+               ret = lttng_userspace_probe_location_function_serialize(location, payload);
                break;
        case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT:
-               ret = lttng_userspace_probe_location_tracepoint_serialize(
-                               location, payload);
+               ret = lttng_userspace_probe_location_tracepoint_serialize(location, payload);
                break;
        default:
                ERR("Unsupported probe location type");
@@ -1220,8 +1193,8 @@ int lttng_userspace_probe_location_serialize(
        }
        buffer_use += ret;
 
-       ret = lttng_userspace_probe_location_lookup_method_serialize(
-                       location->lookup_method, payload);
+       ret = lttng_userspace_probe_location_lookup_method_serialize(location->lookup_method,
+                                                                    payload);
        if (ret < 0) {
                goto end;
        }
@@ -1230,10 +1203,8 @@ end:
        return ret;
 }
 
-static
-int lttng_userspace_probe_location_function_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_userspace_probe_location **location)
+static int lttng_userspace_probe_location_function_create_from_payload(
+       struct lttng_payload_view *view, struct lttng_userspace_probe_location **location)
 {
        struct lttng_userspace_probe_location_function_comm *location_function_comm;
        const char *function_name_src, *binary_path_src;
@@ -1249,12 +1220,10 @@ int lttng_userspace_probe_location_function_create_from_payload(
                goto end;
        }
 
-       location_function_comm =
-                       (typeof(location_function_comm)) view->buffer.data;
+       location_function_comm = (typeof(location_function_comm)) view->buffer.data;
 
        expected_size = sizeof(*location_function_comm) +
-                       location_function_comm->function_name_len +
-                       location_function_comm->binary_path_len;
+               location_function_comm->function_name_len + location_function_comm->binary_path_len;
 
        if (view->buffer.size < expected_size) {
                ret = -LTTNG_ERR_INVALID;
@@ -1262,17 +1231,16 @@ int lttng_userspace_probe_location_function_create_from_payload(
        }
 
        function_name_src = view->buffer.data + sizeof(*location_function_comm);
-       binary_path_src = function_name_src +
-                       location_function_comm->function_name_len;
+       binary_path_src = function_name_src + location_function_comm->function_name_len;
 
-       if (!lttng_buffer_view_contains_string(&view->buffer, function_name_src,
-                           location_function_comm->function_name_len)) {
+       if (!lttng_buffer_view_contains_string(
+                   &view->buffer, function_name_src, location_function_comm->function_name_len)) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       if (!lttng_buffer_view_contains_string(&view->buffer, binary_path_src,
-                           location_function_comm->binary_path_len)) {
+       if (!lttng_buffer_view_contains_string(
+                   &view->buffer, binary_path_src, location_function_comm->binary_path_len)) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -1292,14 +1260,14 @@ int lttng_userspace_probe_location_function_create_from_payload(
        }
 
        *location = lttng_userspace_probe_location_function_create_no_check(
-                       binary_path, function_name, NULL, false);
+               binary_path, function_name, NULL, false);
        if (!(*location)) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       ret = lttng_userspace_probe_location_function_set_binary_fd_handle(
-                       *location, binary_fd_handle);
+       ret = lttng_userspace_probe_location_function_set_binary_fd_handle(*location,
+                                                                          binary_fd_handle);
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -1313,10 +1281,8 @@ end:
        return ret;
 }
 
-static
-int lttng_userspace_probe_location_tracepoint_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_userspace_probe_location **location)
+static int lttng_userspace_probe_location_tracepoint_create_from_payload(
+       struct lttng_payload_view *view, struct lttng_userspace_probe_location **location)
 {
        struct lttng_userspace_probe_location_tracepoint_comm *location_tracepoint_comm;
        const char *probe_name_src, *provider_name_src, *binary_path_src;
@@ -1337,13 +1303,12 @@ int lttng_userspace_probe_location_tracepoint_create_from_payload(
                goto end;
        }
 
-       location_tracepoint_comm =
-                       (typeof(location_tracepoint_comm)) view->buffer.data;
+       location_tracepoint_comm = (typeof(location_tracepoint_comm)) view->buffer.data;
 
        expected_size = sizeof(*location_tracepoint_comm) +
-                       location_tracepoint_comm->probe_name_len +
-                       location_tracepoint_comm->provider_name_len +
-                       location_tracepoint_comm->binary_path_len;
+               location_tracepoint_comm->probe_name_len +
+               location_tracepoint_comm->provider_name_len +
+               location_tracepoint_comm->binary_path_len;
 
        if (view->buffer.size < expected_size) {
                ret = -LTTNG_ERR_INVALID;
@@ -1351,25 +1316,24 @@ int lttng_userspace_probe_location_tracepoint_create_from_payload(
        }
 
        probe_name_src = view->buffer.data + sizeof(*location_tracepoint_comm);
-       provider_name_src = probe_name_src +
-                       location_tracepoint_comm->probe_name_len;
-       binary_path_src = provider_name_src +
-                       location_tracepoint_comm->provider_name_len;
+       provider_name_src = probe_name_src + location_tracepoint_comm->probe_name_len;
+       binary_path_src = provider_name_src + location_tracepoint_comm->provider_name_len;
 
-       if (!lttng_buffer_view_contains_string(&view->buffer, probe_name_src,
-                           location_tracepoint_comm->probe_name_len)) {
+       if (!lttng_buffer_view_contains_string(
+                   &view->buffer, probe_name_src, location_tracepoint_comm->probe_name_len)) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       if (!lttng_buffer_view_contains_string(&view->buffer, provider_name_src,
-                           location_tracepoint_comm->provider_name_len)) {
+       if (!lttng_buffer_view_contains_string(&view->buffer,
+                                              provider_name_src,
+                                              location_tracepoint_comm->provider_name_len)) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       if (!lttng_buffer_view_contains_string(&view->buffer, binary_path_src,
-                           location_tracepoint_comm->binary_path_len)) {
+       if (!lttng_buffer_view_contains_string(
+                   &view->buffer, binary_path_src, location_tracepoint_comm->binary_path_len)) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -1395,14 +1359,14 @@ int lttng_userspace_probe_location_tracepoint_create_from_payload(
        }
 
        *location = lttng_userspace_probe_location_tracepoint_create_no_check(
-                       binary_path, provider_name, probe_name, NULL, false);
+               binary_path, provider_name, probe_name, NULL, false);
        if (!(*location)) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       ret = lttng_userspace_probe_location_tracepoint_set_binary_fd_handle(
-                       *location, binary_fd_handle);
+       ret = lttng_userspace_probe_location_tracepoint_set_binary_fd_handle(*location,
+                                                                            binary_fd_handle);
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -1417,10 +1381,9 @@ end:
        return ret;
 }
 
-static
-int lttng_userspace_probe_location_lookup_method_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_userspace_probe_location_lookup_method **lookup_method)
+static int lttng_userspace_probe_location_lookup_method_create_from_payload(
+       struct lttng_payload_view *view,
+       struct lttng_userspace_probe_location_lookup_method **lookup_method)
 {
        int ret;
        struct lttng_userspace_probe_location_lookup_method_comm *lookup_comm;
@@ -1435,15 +1398,13 @@ int lttng_userspace_probe_location_lookup_method_create_from_payload(
        }
 
        lookup_comm = (typeof(lookup_comm)) view->buffer.data;
-       type = (enum lttng_userspace_probe_location_lookup_method_type)
-                       lookup_comm->type;
+       type = (enum lttng_userspace_probe_location_lookup_method_type) lookup_comm->type;
        switch (type) {
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT:
                *lookup_method = NULL;
                break;
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF:
-               *lookup_method =
-                       lttng_userspace_probe_location_lookup_method_function_elf_create();
+               *lookup_method = lttng_userspace_probe_location_lookup_method_function_elf_create();
                if (!(*lookup_method)) {
                        ret = -LTTNG_ERR_INVALID;
                        goto end;
@@ -1468,8 +1429,7 @@ end:
 }
 
 int lttng_userspace_probe_location_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_userspace_probe_location **location)
+       struct lttng_payload_view *view, struct lttng_userspace_probe_location **location)
 {
        struct lttng_userspace_probe_location_lookup_method *lookup_method;
        enum lttng_userspace_probe_location_type type;
@@ -1477,8 +1437,7 @@ int lttng_userspace_probe_location_create_from_payload(
        int ret;
        struct lttng_userspace_probe_location_comm *probe_location_comm;
        struct lttng_payload_view probe_location_comm_view =
-                       lttng_payload_view_from_view(
-                                       view, 0, sizeof(*probe_location_comm));
+               lttng_payload_view_from_view(view, 0, sizeof(*probe_location_comm));
 
        LTTNG_ASSERT(view);
        LTTNG_ASSERT(location);
@@ -1498,11 +1457,10 @@ int lttng_userspace_probe_location_create_from_payload(
        case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION:
        {
                struct lttng_payload_view location_view =
-                               lttng_payload_view_from_view(
-                                               view, consumed, -1);
+                       lttng_payload_view_from_view(view, consumed, -1);
 
-               ret = lttng_userspace_probe_location_function_create_from_payload(
-                               &location_view, location);
+               ret = lttng_userspace_probe_location_function_create_from_payload(&location_view,
+                                                                                 location);
                if (ret < 0) {
                        goto end;
                }
@@ -1511,10 +1469,10 @@ int lttng_userspace_probe_location_create_from_payload(
        case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT:
        {
                struct lttng_payload_view location_view =
-                               lttng_payload_view_from_view(view, consumed, -1);
+                       lttng_payload_view_from_view(view, consumed, -1);
 
-               ret = lttng_userspace_probe_location_tracepoint_create_from_payload(
-                               &location_view, location);
+               ret = lttng_userspace_probe_location_tracepoint_create_from_payload(&location_view,
+                                                                                   location);
                if (ret < 0) {
                        goto end;
                }
@@ -1533,11 +1491,10 @@ int lttng_userspace_probe_location_create_from_payload(
 
        {
                struct lttng_payload_view lookup_method_view =
-                               lttng_payload_view_from_view(
-                                               view, consumed, -1);
+                       lttng_payload_view_from_view(view, consumed, -1);
 
                ret = lttng_userspace_probe_location_lookup_method_create_from_payload(
-                               &lookup_method_view, &lookup_method);
+                       &lookup_method_view, &lookup_method);
        }
        if (ret < 0) {
                ret = -LTTNG_ERR_INVALID;
@@ -1552,10 +1509,8 @@ end:
        return ret;
 }
 
-static
-int lttng_userspace_probe_location_function_set_binary_fd_handle(
-               struct lttng_userspace_probe_location *location,
-               struct fd_handle *binary_fd)
+static int lttng_userspace_probe_location_function_set_binary_fd_handle(
+       struct lttng_userspace_probe_location *location, struct fd_handle *binary_fd)
 {
        int ret = 0;
        struct lttng_userspace_probe_location_function *function_location;
@@ -1563,18 +1518,16 @@ int lttng_userspace_probe_location_function_set_binary_fd_handle(
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
 
-       function_location = lttng::utils::container_of(location,
-                       &lttng_userspace_probe_location_function::parent);
+       function_location = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_function::parent);
        fd_handle_put(function_location->binary_fd_handle);
        fd_handle_get(binary_fd);
        function_location->binary_fd_handle = binary_fd;
        return ret;
 }
 
-static
-int lttng_userspace_probe_location_tracepoint_set_binary_fd_handle(
-               struct lttng_userspace_probe_location *location,
-               struct fd_handle *binary_fd)
+static int lttng_userspace_probe_location_tracepoint_set_binary_fd_handle(
+       struct lttng_userspace_probe_location *location, struct fd_handle *binary_fd)
 {
        int ret = 0;
        struct lttng_userspace_probe_location_tracepoint *tracepoint_location;
@@ -1582,18 +1535,16 @@ int lttng_userspace_probe_location_tracepoint_set_binary_fd_handle(
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
 
-       tracepoint_location = lttng::utils::container_of(location,
-                       &lttng_userspace_probe_location_tracepoint::parent);
+       tracepoint_location = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_tracepoint::parent);
        fd_handle_put(tracepoint_location->binary_fd_handle);
        fd_handle_get(binary_fd);
        tracepoint_location->binary_fd_handle = binary_fd;
        return ret;
 }
 
-static
-int lttng_userspace_probe_location_function_flatten(
-               const struct lttng_userspace_probe_location *location,
-               struct lttng_dynamic_buffer *buffer)
+static int lttng_userspace_probe_location_function_flatten(
+       const struct lttng_userspace_probe_location *location, struct lttng_dynamic_buffer *buffer)
 {
        struct lttng_userspace_probe_location_lookup_method_elf flat_lookup_method;
        struct lttng_userspace_probe_location_function *probe_function;
@@ -1606,19 +1557,19 @@ int lttng_userspace_probe_location_function_flatten(
 
        LTTNG_ASSERT(location);
 
-       if (location->lookup_method && location->lookup_method->type !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF) {
+       if (location->lookup_method &&
+           location->lookup_method->type !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       probe_function = lttng::utils::container_of(location,
-                       &lttng_userspace_probe_location_function::parent);
+       probe_function = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_function::parent);
        LTTNG_ASSERT(probe_function->function_name);
        LTTNG_ASSERT(probe_function->binary_path);
 
-       storage_needed +=
-                       sizeof(struct lttng_userspace_probe_location_function);
+       storage_needed += sizeof(struct lttng_userspace_probe_location_function);
        function_name_len = strlen(probe_function->function_name) + 1;
        binary_path_len = strlen(probe_function->binary_path) + 1;
        storage_needed += function_name_len + binary_path_len;
@@ -1643,8 +1594,7 @@ int lttng_userspace_probe_location_function_flatten(
        }
 
        if (lttng_dynamic_buffer_get_capacity_left(buffer) < storage_needed) {
-               ret = lttng_dynamic_buffer_set_capacity(buffer,
-                               buffer->size + storage_needed);
+               ret = lttng_dynamic_buffer_set_capacity(buffer, buffer->size + storage_needed);
                if (ret) {
                        goto end;
                }
@@ -1660,9 +1610,9 @@ int lttng_userspace_probe_location_function_flatten(
         */
        if (location->lookup_method) {
                flat_probe.parent.lookup_method =
-                               (struct lttng_userspace_probe_location_lookup_method *)
-                                       (flat_probe_start + sizeof(flat_probe) +
-                                       function_name_len + binary_path_len + padding_needed);
+                       (struct lttng_userspace_probe_location_lookup_method
+                                *) (flat_probe_start + sizeof(flat_probe) + function_name_len +
+                                    binary_path_len + padding_needed);
        } else {
                flat_probe.parent.lookup_method = NULL;
        }
@@ -1670,26 +1620,22 @@ int lttng_userspace_probe_location_function_flatten(
        flat_probe.function_name = flat_probe_start + sizeof(flat_probe);
        flat_probe.binary_path = flat_probe.function_name + function_name_len;
        flat_probe.binary_fd_handle = NULL;
-       ret = lttng_dynamic_buffer_append(buffer, &flat_probe,
-                       sizeof(flat_probe));
+       ret = lttng_dynamic_buffer_append(buffer, &flat_probe, sizeof(flat_probe));
        if (ret) {
                goto end;
        }
 
-       ret = lttng_dynamic_buffer_append(buffer,
-                       probe_function->function_name, function_name_len);
+       ret = lttng_dynamic_buffer_append(buffer, probe_function->function_name, function_name_len);
        if (ret) {
                goto end;
        }
-       ret = lttng_dynamic_buffer_append(buffer,
-                       probe_function->binary_path, binary_path_len);
+       ret = lttng_dynamic_buffer_append(buffer, probe_function->binary_path, binary_path_len);
        if (ret) {
                goto end;
        }
 
        /* Insert padding before the lookup method. */
-       ret = lttng_dynamic_buffer_set_size(buffer,
-                       buffer->size + padding_needed);
+       ret = lttng_dynamic_buffer_set_size(buffer, buffer->size + padding_needed);
        if (ret) {
                goto end;
        }
@@ -1702,9 +1648,8 @@ int lttng_userspace_probe_location_function_flatten(
 
        memset(&flat_lookup_method, 0, sizeof(flat_lookup_method));
        flat_lookup_method.parent.type =
-                       LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF;
-       ret = lttng_dynamic_buffer_append(buffer,
-                       &flat_lookup_method, sizeof(flat_lookup_method));
+               LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF;
+       ret = lttng_dynamic_buffer_append(buffer, &flat_lookup_method, sizeof(flat_lookup_method));
        if (ret) {
                goto end;
        }
@@ -1713,10 +1658,8 @@ end:
        return ret;
 }
 
-static
-int lttng_userspace_probe_location_tracepoint_flatten(
-               const struct lttng_userspace_probe_location *location,
-               struct lttng_dynamic_buffer *buffer)
+static int lttng_userspace_probe_location_tracepoint_flatten(
+       const struct lttng_userspace_probe_location *location, struct lttng_dynamic_buffer *buffer)
 {
        struct lttng_userspace_probe_location_lookup_method_sdt flat_lookup_method;
        struct lttng_userspace_probe_location_tracepoint *probe_tracepoint;
@@ -1730,13 +1673,14 @@ int lttng_userspace_probe_location_tracepoint_flatten(
        LTTNG_ASSERT(location);
 
        /* Only SDT tracepoints are supported at the moment */
-       if (location->lookup_method && location->lookup_method->type !=
-                       LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT) {
+       if (location->lookup_method &&
+           location->lookup_method->type !=
+                   LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
-       probe_tracepoint = lttng::utils::container_of(location,
-                       &lttng_userspace_probe_location_tracepoint::parent);
+       probe_tracepoint = lttng::utils::container_of(
+               location, &lttng_userspace_probe_location_tracepoint::parent);
        LTTNG_ASSERT(probe_tracepoint->probe_name);
        LTTNG_ASSERT(probe_tracepoint->provider_name);
        LTTNG_ASSERT(probe_tracepoint->binary_path);
@@ -1761,8 +1705,7 @@ int lttng_userspace_probe_location_tracepoint_flatten(
 
        if (location->lookup_method) {
                /* NOTE: elf look-up method is assumed here. */
-               storage_needed +=
-                       sizeof(struct lttng_userspace_probe_location_lookup_method_elf);
+               storage_needed += sizeof(struct lttng_userspace_probe_location_lookup_method_elf);
        }
 
        /*
@@ -1774,8 +1717,7 @@ int lttng_userspace_probe_location_tracepoint_flatten(
        }
 
        if (lttng_dynamic_buffer_get_capacity_left(buffer) < storage_needed) {
-               ret = lttng_dynamic_buffer_set_capacity(buffer,
-                               buffer->size + storage_needed);
+               ret = lttng_dynamic_buffer_set_capacity(buffer, buffer->size + storage_needed);
                if (ret) {
                        goto end;
                }
@@ -1792,10 +1734,9 @@ int lttng_userspace_probe_location_tracepoint_flatten(
         */
        if (location->lookup_method) {
                flat_probe.parent.lookup_method =
-                               (struct lttng_userspace_probe_location_lookup_method *)
-                                       (flat_probe_start + sizeof(flat_probe) +
-                                       probe_name_len + provider_name_len +
-                                       binary_path_len + padding_needed);
+                       (struct lttng_userspace_probe_location_lookup_method
+                                *) (flat_probe_start + sizeof(flat_probe) + probe_name_len +
+                                    provider_name_len + binary_path_len + padding_needed);
        } else {
                flat_probe.parent.lookup_method = NULL;
        }
@@ -1810,18 +1751,16 @@ int lttng_userspace_probe_location_tracepoint_flatten(
        }
 
        /* Append all the fields to the buffer */
-       ret = lttng_dynamic_buffer_append(buffer,
-                       probe_tracepoint->probe_name, probe_name_len);
+       ret = lttng_dynamic_buffer_append(buffer, probe_tracepoint->probe_name, probe_name_len);
        if (ret) {
                goto end;
        }
-       ret = lttng_dynamic_buffer_append(buffer,
-                       probe_tracepoint->provider_name, provider_name_len);
+       ret = lttng_dynamic_buffer_append(
+               buffer, probe_tracepoint->provider_name, provider_name_len);
        if (ret) {
                goto end;
        }
-       ret = lttng_dynamic_buffer_append(buffer,
-                       probe_tracepoint->binary_path, binary_path_len);
+       ret = lttng_dynamic_buffer_append(buffer, probe_tracepoint->binary_path, binary_path_len);
        if (ret) {
                goto end;
        }
@@ -1841,9 +1780,8 @@ int lttng_userspace_probe_location_tracepoint_flatten(
        memset(&flat_lookup_method, 0, sizeof(flat_lookup_method));
 
        flat_lookup_method.parent.type =
-                       LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT;
-       ret = lttng_dynamic_buffer_append(buffer,
-                       &flat_lookup_method, sizeof(flat_lookup_method));
+               LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT;
+       ret = lttng_dynamic_buffer_append(buffer, &flat_lookup_method, sizeof(flat_lookup_method));
        if (ret) {
                goto end;
        }
@@ -1852,9 +1790,8 @@ end:
        return ret;
 }
 
-int lttng_userspace_probe_location_flatten(
-               const struct lttng_userspace_probe_location *location,
-               struct lttng_dynamic_buffer *buffer)
+int lttng_userspace_probe_location_flatten(const struct lttng_userspace_probe_location *location,
+                                          struct lttng_dynamic_buffer *buffer)
 {
        int ret;
        if (!location) {
@@ -1879,8 +1816,8 @@ end:
        return ret;
 }
 
-struct lttng_userspace_probe_location *lttng_userspace_probe_location_copy(
-               const struct lttng_userspace_probe_location *location)
+struct lttng_userspace_probe_location *
+lttng_userspace_probe_location_copy(const struct lttng_userspace_probe_location *location)
 {
        struct lttng_userspace_probe_location *new_location = NULL;
        enum lttng_userspace_probe_location_type type;
@@ -1892,15 +1829,13 @@ struct lttng_userspace_probe_location *lttng_userspace_probe_location_copy(
        type = lttng_userspace_probe_location_get_type(location);
        switch (type) {
        case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION:
-               new_location =
-                       lttng_userspace_probe_location_function_copy(location);
+               new_location = lttng_userspace_probe_location_function_copy(location);
                if (!new_location) {
                        goto err;
                }
                break;
        case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT:
-               new_location =
-                       lttng_userspace_probe_location_tracepoint_copy(location);
+               new_location = lttng_userspace_probe_location_tracepoint_copy(location);
                if (!new_location) {
                        goto err;
                }
@@ -1914,8 +1849,8 @@ err:
 }
 
 bool lttng_userspace_probe_location_lookup_method_is_equal(
-               const struct lttng_userspace_probe_location_lookup_method *a,
-               const struct lttng_userspace_probe_location_lookup_method *b)
+       const struct lttng_userspace_probe_location_lookup_method *a,
+       const struct lttng_userspace_probe_location_lookup_method *b)
 {
        bool is_equal = false;
 
@@ -1937,9 +1872,8 @@ end:
        return is_equal;
 }
 
-bool lttng_userspace_probe_location_is_equal(
-               const struct lttng_userspace_probe_location *a,
-               const struct lttng_userspace_probe_location *b)
+bool lttng_userspace_probe_location_is_equal(const struct lttng_userspace_probe_location *a,
+                                            const struct lttng_userspace_probe_location *b)
 {
        bool is_equal = false;
 
@@ -1952,8 +1886,8 @@ bool lttng_userspace_probe_location_is_equal(
                goto end;
        }
 
-       if (!lttng_userspace_probe_location_lookup_method_is_equal(
-                           a->lookup_method, b->lookup_method)) {
+       if (!lttng_userspace_probe_location_lookup_method_is_equal(a->lookup_method,
+                                                                  b->lookup_method)) {
                goto end;
        }
 
@@ -1966,19 +1900,18 @@ end:
        return is_equal;
 }
 
-unsigned long lttng_userspace_probe_location_hash(
-               const struct lttng_userspace_probe_location *location)
+unsigned long
+lttng_userspace_probe_location_hash(const struct lttng_userspace_probe_location *location)
 {
        return location->hash(location);
 }
 
-enum lttng_error_code lttng_userspace_probe_location_mi_serialize(
-               const struct lttng_userspace_probe_location *location,
-               struct mi_writer *writer)
+enum lttng_error_code
+lttng_userspace_probe_location_mi_serialize(const struct lttng_userspace_probe_location *location,
+                                           struct mi_writer *writer)
 {
-       typedef enum lttng_error_code (*mi_fp)(
-                       const struct lttng_userspace_probe_location *,
-                       struct mi_writer *);
+       typedef enum lttng_error_code (*mi_fp)(const struct lttng_userspace_probe_location *,
+                                              struct mi_writer *);
 
        int ret;
        enum lttng_error_code ret_code;
@@ -2000,8 +1933,7 @@ enum lttng_error_code lttng_userspace_probe_location_mi_serialize(
        }
 
        /* Open userspace probe location element. */
-       ret = mi_lttng_writer_open_element(
-                       writer, mi_lttng_element_userspace_probe_location);
+       ret = mi_lttng_writer_open_element(writer, mi_lttng_element_userspace_probe_location);
        if (ret) {
                goto mi_error;
        }
@@ -2028,9 +1960,7 @@ end:
 }
 
 enum lttng_error_code lttng_userspace_probe_location_lookup_method_mi_serialize(
-               const struct lttng_userspace_probe_location_lookup_method
-                               *method,
-               struct mi_writer *writer)
+       const struct lttng_userspace_probe_location_lookup_method *method, struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -2042,15 +1972,15 @@ enum lttng_error_code lttng_userspace_probe_location_lookup_method_mi_serialize(
        switch (lttng_userspace_probe_location_lookup_method_get_type(method)) {
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT:
                type_element_str =
-                               mi_lttng_element_userspace_probe_location_lookup_method_function_default;
+                       mi_lttng_element_userspace_probe_location_lookup_method_function_default;
                break;
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF:
                type_element_str =
-                               mi_lttng_element_userspace_probe_location_lookup_method_function_elf;
+                       mi_lttng_element_userspace_probe_location_lookup_method_function_elf;
                break;
        case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT:
                type_element_str =
-                               mi_lttng_element_userspace_probe_location_lookup_method_tracepoint_sdt;
+                       mi_lttng_element_userspace_probe_location_lookup_method_tracepoint_sdt;
                break;
        default:
                abort();
@@ -2059,7 +1989,7 @@ enum lttng_error_code lttng_userspace_probe_location_lookup_method_mi_serialize(
 
        /* Open userspace probe location lookup method element. */
        ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_userspace_probe_location_lookup_method);
+                                          mi_lttng_element_userspace_probe_location_lookup_method);
        if (ret) {
                goto mi_error;
        }
@@ -2086,63 +2016,57 @@ end:
 }
 
 static enum lttng_error_code lttng_userspace_probe_location_tracepoint_mi_serialize(
-               const struct lttng_userspace_probe_location *location,
-               struct mi_writer *writer)
+       const struct lttng_userspace_probe_location *location, struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
        const char *probe_name = NULL;
        const char *provider_name = NULL;
        const char *binary_path = NULL;
-       const struct lttng_userspace_probe_location_lookup_method
-                       *lookup_method = NULL;
+       const struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
 
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(writer);
 
-       probe_name = lttng_userspace_probe_location_tracepoint_get_probe_name(
-                       location);
-       provider_name = lttng_userspace_probe_location_tracepoint_get_provider_name(
-                       location);
-       binary_path = lttng_userspace_probe_location_tracepoint_get_binary_path(
-                       location);
-       lookup_method = lttng_userspace_probe_location_tracepoint_get_lookup_method(
-                       location);
+       probe_name = lttng_userspace_probe_location_tracepoint_get_probe_name(location);
+       provider_name = lttng_userspace_probe_location_tracepoint_get_provider_name(location);
+       binary_path = lttng_userspace_probe_location_tracepoint_get_binary_path(location);
+       lookup_method = lttng_userspace_probe_location_tracepoint_get_lookup_method(location);
 
        /* Open userspace probe location tracepoint element. */
        ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_userspace_probe_location_tracepoint);
+                                          mi_lttng_element_userspace_probe_location_tracepoint);
        if (ret) {
                goto mi_error;
        }
 
        /* Probe name. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_userspace_probe_location_tracepoint_probe_name,
-                       probe_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer,
+               mi_lttng_element_userspace_probe_location_tracepoint_probe_name,
+               probe_name);
        if (ret) {
                goto mi_error;
        }
 
        /* Provider name. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_userspace_probe_location_tracepoint_provider_name,
-                       provider_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer,
+               mi_lttng_element_userspace_probe_location_tracepoint_provider_name,
+               provider_name);
        if (ret) {
                goto mi_error;
        }
 
        /* Binary path. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_userspace_probe_location_binary_path,
-                       binary_path);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_userspace_probe_location_binary_path, binary_path);
        if (ret) {
                goto mi_error;
        }
 
        /* The lookup method. */
-       ret_code = lttng_userspace_probe_location_lookup_method_mi_serialize(
-                       lookup_method, writer);
+       ret_code = lttng_userspace_probe_location_lookup_method_mi_serialize(lookup_method, writer);
        if (ret_code != LTTNG_OK) {
                goto end;
        }
@@ -2163,36 +2087,29 @@ end:
 }
 
 static enum lttng_error_code lttng_userspace_probe_location_function_mi_serialize(
-               const struct lttng_userspace_probe_location *location,
-               struct mi_writer *writer)
+       const struct lttng_userspace_probe_location *location, struct mi_writer *writer)
 {
        int ret;
        enum lttng_error_code ret_code;
        const char *function_name = NULL;
        const char *binary_path = NULL;
        const char *instrumentation_type_str = NULL;
-       enum lttng_userspace_probe_location_function_instrumentation_type
-                       instrumentation_type;
-       const struct lttng_userspace_probe_location_lookup_method
-                       *lookup_method = NULL;
+       enum lttng_userspace_probe_location_function_instrumentation_type instrumentation_type;
+       const struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
 
        LTTNG_ASSERT(location);
        LTTNG_ASSERT(writer);
 
-       function_name = lttng_userspace_probe_location_function_get_function_name(
-                       location);
-       binary_path = lttng_userspace_probe_location_function_get_binary_path(
-                       location);
+       function_name = lttng_userspace_probe_location_function_get_function_name(location);
+       binary_path = lttng_userspace_probe_location_function_get_binary_path(location);
        instrumentation_type =
-                       lttng_userspace_probe_location_function_get_instrumentation_type(
-                                       location);
-       lookup_method = lttng_userspace_probe_location_function_get_lookup_method(
-                       location);
+               lttng_userspace_probe_location_function_get_instrumentation_type(location);
+       lookup_method = lttng_userspace_probe_location_function_get_lookup_method(location);
 
        switch (instrumentation_type) {
        case LTTNG_USERSPACE_PROBE_LOCATION_FUNCTION_INSTRUMENTATION_TYPE_ENTRY:
                instrumentation_type_str =
-                               mi_lttng_userspace_probe_location_function_instrumentation_type_entry;
+                       mi_lttng_userspace_probe_location_function_instrumentation_type_entry;
                break;
        default:
                abort();
@@ -2201,38 +2118,36 @@ static enum lttng_error_code lttng_userspace_probe_location_function_mi_serializ
 
        /* Open userspace probe location function element. */
        ret = mi_lttng_writer_open_element(writer,
-                       mi_lttng_element_userspace_probe_location_function);
+                                          mi_lttng_element_userspace_probe_location_function);
        if (ret) {
                goto mi_error;
        }
 
        /* Function name. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_userspace_probe_location_function_name,
-                       function_name);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_userspace_probe_location_function_name, function_name);
        if (ret) {
                goto mi_error;
        }
 
        /* Binary path. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_userspace_probe_location_binary_path,
-                       binary_path);
+       ret = mi_lttng_writer_write_element_string(
+               writer, mi_lttng_element_userspace_probe_location_binary_path, binary_path);
        if (ret) {
                goto mi_error;
        }
 
        /* Instrumentation type. */
-       ret = mi_lttng_writer_write_element_string(writer,
-                       mi_lttng_element_userspace_probe_location_function_instrumentation_type,
-                       instrumentation_type_str);
+       ret = mi_lttng_writer_write_element_string(
+               writer,
+               mi_lttng_element_userspace_probe_location_function_instrumentation_type,
+               instrumentation_type_str);
        if (ret) {
                goto mi_error;
        }
 
        /* The lookup method. */
-       ret_code = lttng_userspace_probe_location_lookup_method_mi_serialize(
-                       lookup_method, writer);
+       ret_code = lttng_userspace_probe_location_lookup_method_mi_serialize(lookup_method, writer);
        if (ret_code != LTTNG_OK) {
                goto end;
        }
index 872bc1abf8f89c322e217b365138e88c5341d7f8..ea3e3619106654d556bdbf543afca0ce75308bd2 100644 (file)
@@ -8,41 +8,42 @@
  */
 
 #define _LGPL_SOURCE
+#include "ust-consumer.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/endian.hpp>
+#include <common/compat/fcntl.hpp>
+#include <common/consumer/consumer-metadata-cache.hpp>
+#include <common/consumer/consumer-stream.hpp>
+#include <common/consumer/consumer-timer.hpp>
+#include <common/consumer/consumer.hpp>
+#include <common/index/index.hpp>
+#include <common/optional.hpp>
+#include <common/relayd/relayd.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/shm.hpp>
+#include <common/utils.hpp>
+
 #include <lttng/ust-ctl.h>
 #include <lttng/ust-sigbus.h>
+
+#include <bin/lttng-consumerd/health-consumerd.hpp>
+#include <inttypes.h>
 #include <poll.h>
 #include <pthread.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/mman.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <inttypes.h>
 #include <unistd.h>
 #include <urcu/list.h>
-#include <signal.h>
-#include <stdbool.h>
-#include <stdint.h>
 
-#include <bin/lttng-consumerd/health-consumerd.hpp>
-#include <common/common.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/relayd/relayd.hpp>
-#include <common/compat/fcntl.hpp>
-#include <common/compat/endian.hpp>
-#include <common/consumer/consumer-metadata-cache.hpp>
-#include <common/consumer/consumer-stream.hpp>
-#include <common/consumer/consumer-timer.hpp>
-#include <common/utils.hpp>
-#include <common/index/index.hpp>
-#include <common/consumer/consumer.hpp>
-#include <common/shm.hpp>
-#include <common/optional.hpp>
-
-#include "ust-consumer.hpp"
-
-#define INT_MAX_STR_LEN 12     /* includes \0 */
+#define INT_MAX_STR_LEN 12 /* includes \0 */
 
 extern struct lttng_consumer_global_data the_consumer_data;
 extern int consumer_poll_timeout;
@@ -55,7 +56,7 @@ LTTNG_EXPORT DEFINE_LTTNG_UST_SIGBUS_STATE();
  * Returns 0 on success or else a negative value.
  */
 static int add_channel(struct lttng_consumer_channel *channel,
-               struct lttng_consumer_local_data *ctx)
+                      struct lttng_consumer_local_data *ctx)
 {
        int ret = 0;
 
@@ -87,9 +88,11 @@ error:
  *
  * Return NULL on error else the newly allocated stream object.
  */
-static struct lttng_consumer_stream *allocate_stream(int cpu, int key,
-               struct lttng_consumer_channel *channel,
-               struct lttng_consumer_local_data *ctx, int *_alloc_ret)
+static struct lttng_consumer_stream *allocate_stream(int cpu,
+                                                    int key,
+                                                    struct lttng_consumer_channel *channel,
+                                                    struct lttng_consumer_local_data *ctx,
+                                                    int *_alloc_ret)
 {
        int alloc_ret;
        struct lttng_consumer_stream *stream = NULL;
@@ -97,18 +100,17 @@ static struct lttng_consumer_stream *allocate_stream(int cpu, int key,
        LTTNG_ASSERT(channel);
        LTTNG_ASSERT(ctx);
 
-       stream = consumer_stream_create(
-                       channel,
-                       channel->key,
-                       key,
-                       channel->name,
-                       channel->relayd_id,
-                       channel->session_id,
-                       channel->trace_chunk,
-                       cpu,
-                       &alloc_ret,
-                       channel->type,
-                       channel->monitor);
+       stream = consumer_stream_create(channel,
+                                       channel->key,
+                                       key,
+                                       channel->name,
+                                       channel->relayd_id,
+                                       channel->session_id,
+                                       channel->trace_chunk,
+                                       cpu,
+                                       &alloc_ret,
+                                       channel->type,
+                                       channel->monitor);
        if (stream == NULL) {
                switch (alloc_ret) {
                case -ENOENT:
@@ -142,7 +144,7 @@ error:
  * Returns 0 on success else a negative value.
  */
 static int send_stream_to_thread(struct lttng_consumer_stream *stream,
-               struct lttng_consumer_local_data *ctx)
+                                struct lttng_consumer_local_data *ctx)
 {
        int ret;
        struct lttng_pipe *stream_pipe;
@@ -168,8 +170,8 @@ static int send_stream_to_thread(struct lttng_consumer_stream *stream,
        ret = lttng_pipe_write(stream_pipe, &stream, sizeof(stream));
        if (ret < 0) {
                ERR("Consumer write %s stream to pipe %d",
-                               stream->metadata_flag ? "metadata" : "data",
-                               lttng_pipe_get_writefd(stream_pipe));
+                   stream->metadata_flag ? "metadata" : "data",
+                   lttng_pipe_get_writefd(stream_pipe));
                if (stream->metadata_flag) {
                        consumer_del_stream_for_metadata(stream);
                } else {
@@ -182,10 +184,9 @@ error:
        return ret;
 }
 
-static
-int get_stream_shm_path(char *stream_shm_path, const char *shm_path, int cpu)
+static int get_stream_shm_path(char *stream_shm_path, const char *shm_path, int cpu)
 {
-       char cpu_nr[INT_MAX_STR_LEN];  /* int max len */
+       char cpu_nr[INT_MAX_STR_LEN]; /* int max len */
        int ret;
 
        strncpy(stream_shm_path, shm_path, PATH_MAX);
@@ -195,8 +196,7 @@ int get_stream_shm_path(char *stream_shm_path, const char *shm_path, int cpu)
                PERROR("snprintf");
                goto end;
        }
-       strncat(stream_shm_path, cpu_nr,
-               PATH_MAX - strlen(stream_shm_path) - 1);
+       strncat(stream_shm_path, cpu_nr, PATH_MAX - strlen(stream_shm_path) - 1);
        ret = 0;
 end:
        return ret;
@@ -209,7 +209,7 @@ end:
  * Return 0 on success else a negative value.
  */
 static int create_ust_streams(struct lttng_consumer_channel *channel,
-               struct lttng_consumer_local_data *ctx)
+                             struct lttng_consumer_local_data *ctx)
 {
        int ret, cpu = 0;
        struct lttng_ust_ctl_consumer_stream *ustream;
@@ -269,11 +269,9 @@ static int create_ust_streams(struct lttng_consumer_channel *channel,
                 */
                cds_list_add_tail(&stream->send_node, &channel->streams.head);
 
-               ret = lttng_ust_ctl_get_max_subbuf_size(stream->ustream,
-                               &stream->max_sb_size);
+               ret = lttng_ust_ctl_get_max_subbuf_size(stream->ustream, &stream->max_sb_size);
                if (ret < 0) {
-                       ERR("lttng_ust_ctl_get_max_subbuf_size failed for stream %s",
-                                       stream->name);
+                       ERR("lttng_ust_ctl_get_max_subbuf_size failed for stream %s", stream->name);
                        goto error;
                }
 
@@ -286,7 +284,9 @@ static int create_ust_streams(struct lttng_consumer_channel *channel,
                }
 
                DBG("UST consumer add stream %s (key: %" PRIu64 ") with relayd id %" PRIu64,
-                               stream->name, stream->key, stream->relayd_stream_id);
+                   stream->name,
+                   stream->key,
+                   stream->relayd_stream_id);
 
                /* Set next CPU stream. */
                channel->streams.count = ++cpu;
@@ -297,8 +297,8 @@ static int create_ust_streams(struct lttng_consumer_channel *channel,
                        if (channel->monitor) {
                                /* Set metadata poll pipe if we created one */
                                memcpy(stream->ust_metadata_poll_pipe,
-                                               ust_metadata_pipe,
-                                               sizeof(ust_metadata_pipe));
+                                      ust_metadata_pipe,
+                                      sizeof(ust_metadata_pipe));
                        }
                }
                pthread_mutex_unlock(&stream->lock);
@@ -315,8 +315,9 @@ error_alloc:
        return ret;
 }
 
-static int open_ust_stream_fd(struct lttng_consumer_channel *channel, int cpu,
-               const struct lttng_credentials *session_credentials)
+static int open_ust_stream_fd(struct lttng_consumer_channel *channel,
+                             int cpu,
+                             const struct lttng_credentials *session_credentials)
 {
        char shm_path[PATH_MAX];
        int ret;
@@ -329,9 +330,10 @@ static int open_ust_stream_fd(struct lttng_consumer_channel *channel, int cpu,
                goto error_shm_path;
        }
        return run_as_open(shm_path,
-               O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR,
-               lttng_credentials_get_uid(session_credentials),
-               lttng_credentials_get_gid(session_credentials));
+                          O_RDWR | O_CREAT | O_EXCL,
+                          S_IRUSR | S_IWUSR,
+                          lttng_credentials_get_uid(session_credentials),
+                          lttng_credentials_get_gid(session_credentials));
 
 error_shm_path:
        return -1;
@@ -344,8 +346,8 @@ error_shm_path:
  * Return 0 on success or else a negative value.
  */
 static int create_ust_channel(struct lttng_consumer_channel *channel,
-               struct lttng_ust_ctl_consumer_channel_attr *attr,
-               struct lttng_ust_ctl_consumer_channel **ust_chanp)
+                             struct lttng_ust_ctl_consumer_channel_attr *attr,
+                             struct lttng_ust_ctl_consumer_channel **ust_chanp)
 {
        int ret, nr_stream_fds, i, j;
        int *stream_fds;
@@ -357,11 +359,16 @@ static int create_ust_channel(struct lttng_consumer_channel *channel,
        LTTNG_ASSERT(channel->buffer_credentials.is_set);
 
        DBG3("Creating channel to ustctl with attr: [overwrite: %d, "
-                       "subbuf_size: %" PRIu64 ", num_subbuf: %" PRIu64 ", "
-                       "switch_timer_interval: %u, read_timer_interval: %u, "
-                       "output: %d, type: %d", attr->overwrite, attr->subbuf_size,
-                       attr->num_subbuf, attr->switch_timer_interval,
-                       attr->read_timer_interval, attr->output, attr->type);
+            "subbuf_size: %" PRIu64 ", num_subbuf: %" PRIu64 ", "
+            "switch_timer_interval: %u, read_timer_interval: %u, "
+            "output: %d, type: %d",
+            attr->overwrite,
+            attr->subbuf_size,
+            attr->num_subbuf,
+            attr->switch_timer_interval,
+            attr->read_timer_interval,
+            attr->output,
+            attr->type);
 
        if (channel->type == CONSUMER_CHANNEL_TYPE_METADATA)
                nr_stream_fds = 1;
@@ -373,8 +380,7 @@ static int create_ust_channel(struct lttng_consumer_channel *channel,
                goto error_alloc;
        }
        for (i = 0; i < nr_stream_fds; i++) {
-               stream_fds[i] = open_ust_stream_fd(channel, i,
-                               &channel->buffer_credentials.value);
+               stream_fds[i] = open_ust_stream_fd(channel, i, &channel->buffer_credentials.value);
                if (stream_fds[i] < 0) {
                        ret = -1;
                        goto error_open;
@@ -403,16 +409,15 @@ error_open:
                if (channel->shm_path[0]) {
                        char shm_path[PATH_MAX];
 
-                       closeret = get_stream_shm_path(shm_path,
-                                       channel->shm_path, j);
+                       closeret = get_stream_shm_path(shm_path, channel->shm_path, j);
                        if (closeret) {
                                ERR("Cannot get stream shm path");
                        }
                        closeret = run_as_unlink(shm_path,
-                                       lttng_credentials_get_uid(LTTNG_OPTIONAL_GET_PTR(
-                                                       channel->buffer_credentials)),
-                                       lttng_credentials_get_gid(LTTNG_OPTIONAL_GET_PTR(
-                                                       channel->buffer_credentials)));
+                                                lttng_credentials_get_uid(LTTNG_OPTIONAL_GET_PTR(
+                                                        channel->buffer_credentials)),
+                                                lttng_credentials_get_gid(LTTNG_OPTIONAL_GET_PTR(
+                                                        channel->buffer_credentials)));
                        if (closeret) {
                                PERROR("unlink %s", shm_path);
                        }
@@ -421,11 +426,11 @@ error_open:
        /* Try to rmdir all directories under shm_path root. */
        if (channel->root_shm_path[0]) {
                (void) run_as_rmdir_recursive(channel->root_shm_path,
-                               lttng_credentials_get_uid(LTTNG_OPTIONAL_GET_PTR(
-                                               channel->buffer_credentials)),
-                               lttng_credentials_get_gid(LTTNG_OPTIONAL_GET_PTR(
-                                               channel->buffer_credentials)),
-                               LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
+                                             lttng_credentials_get_uid(LTTNG_OPTIONAL_GET_PTR(
+                                                     channel->buffer_credentials)),
+                                             lttng_credentials_get_gid(LTTNG_OPTIONAL_GET_PTR(
+                                                     channel->buffer_credentials)),
+                                             LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
        }
        free(stream_fds);
 error_alloc:
@@ -462,8 +467,9 @@ error:
  * Return 0 on success or else a negative value.
  */
 static int send_channel_to_sessiond_and_relayd(int sock,
-               struct lttng_consumer_channel *channel,
-               struct lttng_consumer_local_data *ctx, int *relayd_error)
+                                              struct lttng_consumer_channel *channel,
+                                              struct lttng_consumer_local_data *ctx,
+                                              int *relayd_error)
 {
        int ret, ret_code = LTTCOMM_CONSUMERD_SUCCESS;
        struct lttng_consumer_stream *stream;
@@ -476,13 +482,13 @@ static int send_channel_to_sessiond_and_relayd(int sock,
        DBG("UST consumer sending channel %s to sessiond", channel->name);
 
        if (channel->relayd_id != (uint64_t) -1ULL) {
-               cds_list_for_each_entry(stream, &channel->streams.head, send_node) {
-
+               cds_list_for_each_entry (stream, &channel->streams.head, send_node) {
                        health_code_update();
 
                        /* Try to send the stream to the relayd if one is available. */
                        DBG("Sending stream %" PRIu64 " of channel \"%s\" to relayd",
-                                       stream->key, channel->name);
+                           stream->key,
+                           channel->name);
                        ret = consumer_send_relayd_stream(stream, stream->chan->pathname);
                        if (ret < 0) {
                                /*
@@ -522,8 +528,7 @@ static int send_channel_to_sessiond_and_relayd(int sock,
        }
 
        /* The channel was sent successfully to the sessiond at this point. */
-       cds_list_for_each_entry(stream, &channel->streams.head, send_node) {
-
+       cds_list_for_each_entry (stream, &channel->streams.head, send_node) {
                health_code_update();
 
                /* Send stream to session daemon. */
@@ -559,8 +564,8 @@ error:
  * MUST be destroyed by consumer_del_channel().
  */
 static int ask_channel(struct lttng_consumer_local_data *ctx,
-               struct lttng_consumer_channel *channel,
-               struct lttng_ust_ctl_consumer_channel_attr *attr)
+                      struct lttng_consumer_channel *channel,
+                      struct lttng_ust_ctl_consumer_channel_attr *attr)
 {
        int ret;
 
@@ -618,7 +623,7 @@ end:
  * On error, return a negative value else 0 on success.
  */
 static int send_streams_to_thread(struct lttng_consumer_channel *channel,
-               struct lttng_consumer_local_data *ctx)
+                                 struct lttng_consumer_local_data *ctx)
 {
        int ret = 0;
        struct lttng_consumer_stream *stream, *stmp;
@@ -627,9 +632,7 @@ static int send_streams_to_thread(struct lttng_consumer_channel *channel,
        LTTNG_ASSERT(ctx);
 
        /* Send streams to the corresponding thread. */
-       cds_list_for_each_entry_safe(stream, stmp, &channel->streams.head,
-                       send_node) {
-
+       cds_list_for_each_entry_safe (stream, stmp, &channel->streams.head, send_node) {
                health_code_update();
 
                /* Sending the stream to the thread. */
@@ -674,9 +677,13 @@ static int flush_channel(uint64_t chan_key)
 
        /* For each stream of the channel id, flush it. */
        cds_lfht_for_each_entry_duplicate(ht->ht,
-                       ht->hash_fct(&channel->key, lttng_ht_seed), ht->match_fct,
-                       &channel->key, &iter.iter, stream, node_channel_id.node) {
-
+                                         ht->hash_fct(&channel->key, lttng_ht_seed),
+                                         ht->match_fct,
+                                         &channel->key,
+                                         &iter.iter,
+                                         stream,
+                                         node_channel_id.node)
+       {
                health_code_update();
 
                pthread_mutex_lock(&stream->lock);
@@ -691,15 +698,17 @@ static int flush_channel(uint64_t chan_key)
                if (!stream->quiescent) {
                        ret = lttng_ust_ctl_flush_buffer(stream->ustream, 0);
                        if (ret) {
-                               ERR("Failed to flush buffer while flushing channel: channel key = %" PRIu64 ", channel name = '%s'",
-                                               chan_key, channel->name);
+                               ERR("Failed to flush buffer while flushing channel: channel key = %" PRIu64
+                                   ", channel name = '%s'",
+                                   chan_key,
+                                   channel->name);
                                ret = LTTNG_ERR_BUFFER_FLUSH_FAILED;
                                pthread_mutex_unlock(&stream->lock);
                                goto error;
                        }
                        stream->quiescent = true;
                }
-next:
+       next:
                pthread_mutex_unlock(&stream->lock);
        }
 
@@ -743,9 +752,13 @@ static int clear_quiescent_channel(uint64_t chan_key)
 
        /* For each stream of the channel id, clear quiescent state. */
        cds_lfht_for_each_entry_duplicate(ht->ht,
-                       ht->hash_fct(&channel->key, lttng_ht_seed), ht->match_fct,
-                       &channel->key, &iter.iter, stream, node_channel_id.node) {
-
+                                         ht->hash_fct(&channel->key, lttng_ht_seed),
+                                         ht->match_fct,
+                                         &channel->key,
+                                         &iter.iter,
+                                         stream,
+                                         node_channel_id.node)
+       {
                health_code_update();
 
                pthread_mutex_lock(&stream->lock);
@@ -877,14 +890,12 @@ static int setup_metadata(struct lttng_consumer_local_data *ctx, uint64_t key)
 
        /* Send metadata stream to relayd if needed. */
        if (metadata->metadata_stream->net_seq_idx != (uint64_t) -1ULL) {
-               ret = consumer_send_relayd_stream(metadata->metadata_stream,
-                               metadata->pathname);
+               ret = consumer_send_relayd_stream(metadata->metadata_stream, metadata->pathname);
                if (ret < 0) {
                        ret = LTTCOMM_CONSUMERD_ERROR_METADATA;
                        goto error;
                }
-               ret = consumer_send_relayd_streams_sent(
-                               metadata->metadata_stream->net_seq_idx);
+               ret = consumer_send_relayd_streams_sent(metadata->metadata_stream->net_seq_idx);
                if (ret < 0) {
                        ret = LTTCOMM_CONSUMERD_RELAYD_FAIL;
                        goto error;
@@ -932,8 +943,10 @@ end:
  * Returns 0 on success, < 0 on error
  */
 static int snapshot_metadata(struct lttng_consumer_channel *metadata_channel,
-               uint64_t key, char *path, uint64_t relayd_id,
-               struct lttng_consumer_local_data *ctx)
+                            uint64_t key,
+                            char *path,
+                            uint64_t relayd_id,
+                            struct lttng_consumer_local_data *ctx)
 {
        int ret = 0;
        struct lttng_consumer_stream *metadata_stream;
@@ -942,8 +955,7 @@ static int snapshot_metadata(struct lttng_consumer_channel *metadata_channel,
        LTTNG_ASSERT(ctx);
        ASSERT_RCU_READ_LOCKED();
 
-       DBG("UST consumer snapshot metadata with key %" PRIu64 " at path %s",
-                       key, path);
+       DBG("UST consumer snapshot metadata with key %" PRIu64 " at path %s", key, path);
 
        rcu_read_lock();
 
@@ -979,8 +991,7 @@ static int snapshot_metadata(struct lttng_consumer_channel *metadata_channel,
                metadata_stream->net_seq_idx = relayd_id;
                ret = consumer_send_relayd_stream(metadata_stream, path);
        } else {
-               ret = consumer_stream_create_output_files(metadata_stream,
-                               false);
+               ret = consumer_stream_create_output_files(metadata_stream, false);
        }
        if (ret < 0) {
                goto error_stream;
@@ -1008,9 +1019,7 @@ error:
        return ret;
 }
 
-static
-int get_current_subbuf_addr(struct lttng_consumer_stream *stream,
-               const char **addr)
+static int get_current_subbuf_addr(struct lttng_consumer_stream *stream, const char **addr)
 {
        int ret;
        unsigned long mmap_offset;
@@ -1018,8 +1027,7 @@ int get_current_subbuf_addr(struct lttng_consumer_stream *stream,
 
        mmap_base = (const char *) lttng_ust_ctl_get_mmap_base(stream->ustream);
        if (!mmap_base) {
-               ERR("Failed to get mmap base for stream `%s`",
-                               stream->name);
+               ERR("Failed to get mmap base for stream `%s`", stream->name);
                ret = -EPERM;
                goto error;
        }
@@ -1034,7 +1042,6 @@ int get_current_subbuf_addr(struct lttng_consumer_stream *stream,
        *addr = mmap_base + mmap_offset;
 error:
        return ret;
-
 }
 
 /*
@@ -1044,9 +1051,11 @@ error:
  * Returns 0 on success, < 0 on error
  */
 static int snapshot_channel(struct lttng_consumer_channel *channel,
-               uint64_t key, char *path, uint64_t relayd_id,
-               uint64_t nb_packets_per_stream,
-               struct lttng_consumer_local_data *ctx)
+                           uint64_t key,
+                           char *path,
+                           uint64_t relayd_id,
+                           uint64_t nb_packets_per_stream,
+                           struct lttng_consumer_local_data *ctx)
 {
        int ret;
        unsigned use_relayd = 0;
@@ -1066,7 +1075,7 @@ static int snapshot_channel(struct lttng_consumer_channel *channel,
        LTTNG_ASSERT(!channel->monitor);
        DBG("UST consumer snapshot channel %" PRIu64, key);
 
-       cds_list_for_each_entry(stream, &channel->streams.head, send_node) {
+       cds_list_for_each_entry (stream, &channel->streams.head, send_node) {
                health_code_update();
 
                /* Lock stream because we are about to change its state. */
@@ -1092,13 +1101,11 @@ static int snapshot_channel(struct lttng_consumer_channel *channel,
                                goto error_close_stream;
                        }
                } else {
-                       ret = consumer_stream_create_output_files(stream,
-                                       false);
+                       ret = consumer_stream_create_output_files(stream, false);
                        if (ret < 0) {
                                goto error_close_stream;
                        }
-                       DBG("UST consumer snapshot stream (%" PRIu64 ")",
-                                       stream->key);
+                       DBG("UST consumer snapshot stream (%" PRIu64 ")", stream->key);
                }
 
                /*
@@ -1108,8 +1115,10 @@ static int snapshot_channel(struct lttng_consumer_channel *channel,
                if (!stream->quiescent) {
                        ret = lttng_ust_ctl_flush_buffer(stream->ustream, 0);
                        if (ret < 0) {
-                               ERR("Failed to flush buffer during snapshot of channel: channel key = %" PRIu64 ", channel name = '%s'",
-                                               channel->key, channel->name);
+                               ERR("Failed to flush buffer during snapshot of channel: channel key = %" PRIu64
+                                   ", channel name = '%s'",
+                                   channel->key,
+                                   channel->name);
                                goto error_unlock;
                        }
                }
@@ -1138,9 +1147,8 @@ static int snapshot_channel(struct lttng_consumer_channel *channel,
                 * daemon should never send a maximum stream size that is lower than
                 * subbuffer size.
                 */
-               consumed_pos = consumer_get_consume_start_pos(consumed_pos,
-                               produced_pos, nb_packets_per_stream,
-                               stream->max_sb_size);
+               consumed_pos = consumer_get_consume_start_pos(
+                       consumed_pos, produced_pos, nb_packets_per_stream, stream->max_sb_size);
 
                while ((long) (consumed_pos - produced_pos) < 0) {
                        ssize_t read_len;
@@ -1181,10 +1189,9 @@ static int snapshot_channel(struct lttng_consumer_channel *channel,
                                goto error_put_subbuf;
                        }
 
-                       subbuf_view = lttng_buffer_view_init(
-                                       subbuf_addr, 0, padded_len);
+                       subbuf_view = lttng_buffer_view_init(subbuf_addr, 0, padded_len);
                        read_len = lttng_consumer_on_read_subbuffer_mmap(
-                                       stream, &subbuf_view, padded_len - len);
+                               stream, &subbuf_view, padded_len - len);
                        if (use_relayd) {
                                if (read_len != len) {
                                        ret = -EPERM;
@@ -1225,14 +1232,11 @@ error_unlock:
        return ret;
 }
 
-static
-void metadata_stream_reset_cache_consumed_position(
-               struct lttng_consumer_stream *stream)
+static void metadata_stream_reset_cache_consumed_position(struct lttng_consumer_stream *stream)
 {
        ASSERT_LOCKED(stream->lock);
 
-       DBG("Reset metadata cache of session %" PRIu64,
-                       stream->chan->session_id);
+       DBG("Reset metadata cache of session %" PRIu64, stream->chan->session_id);
        stream->ust_metadata_pushed = 0;
 }
 
@@ -1244,9 +1248,14 @@ void metadata_stream_reset_cache_consumed_position(
  * the metadata cache flush to concurrently progress in order to
  * complete.
  */
-int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset,
-               uint64_t len, uint64_t version,
-               struct lttng_consumer_channel *channel, int timer, int wait)
+int lttng_ustconsumer_recv_metadata(int sock,
+                                   uint64_t key,
+                                   uint64_t offset,
+                                   uint64_t len,
+                                   uint64_t version,
+                                   struct lttng_consumer_channel *channel,
+                                   int timer,
+                                   int wait)
 {
        int ret, ret_code = LTTCOMM_CONSUMERD_SUCCESS;
        char *metadata_str;
@@ -1275,8 +1284,7 @@ int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset,
 
        pthread_mutex_lock(&channel->metadata_cache->lock);
        cache_write_status = consumer_metadata_cache_write(
-                       channel->metadata_cache, offset, len, version,
-                       metadata_str);
+               channel->metadata_cache, offset, len, version, metadata_str);
        pthread_mutex_unlock(&channel->metadata_cache->lock);
        switch (cache_write_status) {
        case CONSUMER_METADATA_CACHE_WRITE_STATUS_NO_CHANGE:
@@ -1300,8 +1308,7 @@ int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset,
                 */
                if (channel->metadata_stream != NULL) {
                        pthread_mutex_lock(&channel->metadata_stream->lock);
-                       metadata_stream_reset_cache_consumed_position(
-                                       channel->metadata_stream);
+                       metadata_stream_reset_cache_consumed_position(channel->metadata_stream);
                        pthread_mutex_unlock(&channel->metadata_stream->lock);
                } else {
                        /* Validate we are in snapshot mode. */
@@ -1355,7 +1362,8 @@ end:
  * Return 1 on success else a negative value or 0.
  */
 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
-               int sock, struct pollfd *consumer_sockpoll)
+                              int sock,
+                              struct pollfd *consumer_sockpoll)
 {
        int ret_func;
        enum lttcomm_return_code ret_code = LTTCOMM_CONSUMERD_SUCCESS;
@@ -1370,14 +1378,14 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                ret_recv = lttcomm_recv_unix_sock(sock, &msg, sizeof(msg));
                if (ret_recv != sizeof(msg)) {
                        DBG("Consumer received unexpected message size %zd (expects %zu)",
-                                       ret_recv, sizeof(msg));
+                           ret_recv,
+                           sizeof(msg));
                        /*
                         * The ret value might 0 meaning an orderly shutdown but this is ok
                         * since the caller handles this.
                         */
                        if (ret_recv > 0) {
-                               lttng_consumer_send_error(ctx,
-                                               LTTCOMM_CONSUMERD_ERROR_RECV_CMD);
+                               lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_ERROR_RECV_CMD);
                                ret_recv = -1;
                        }
                        return ret_recv;
@@ -1400,15 +1408,19 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                uint32_t major = msg.u.relayd_sock.major;
                uint32_t minor = msg.u.relayd_sock.minor;
                enum lttcomm_sock_proto protocol =
-                               (enum lttcomm_sock_proto) msg.u.relayd_sock
-                                               .relayd_socket_protocol;
+                       (enum lttcomm_sock_proto) msg.u.relayd_sock.relayd_socket_protocol;
 
                /* Session daemon status message are handled in the following call. */
                consumer_add_relayd_socket(msg.u.relayd_sock.net_index,
-                               msg.u.relayd_sock.type, ctx, sock,
-                               consumer_sockpoll, msg.u.relayd_sock.session_id,
-                               msg.u.relayd_sock.relayd_session_id, major,
-                               minor, protocol);
+                                          msg.u.relayd_sock.type,
+                                          ctx,
+                                          sock,
+                                          consumer_sockpoll,
+                                          msg.u.relayd_sock.session_id,
+                                          msg.u.relayd_sock.relayd_session_id,
+                                          major,
+                                          minor,
+                                          protocol);
                goto end_nosignal;
        }
        case LTTNG_CONSUMER_DESTROY_RELAYD:
@@ -1457,11 +1469,9 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                is_data_pending = consumer_data_pending(id);
 
                /* Send back returned value to session daemon */
-               ret_send = lttcomm_send_unix_sock(sock, &is_data_pending,
-                               sizeof(is_data_pending));
+               ret_send = lttcomm_send_unix_sock(sock, &is_data_pending, sizeof(is_data_pending));
                if (ret_send < 0) {
-                       DBG("Error when sending the data pending ret code: %zd",
-                                       ret_send);
+                       DBG("Error when sending the data pending ret code: %zd", ret_send);
                        goto error_fatal;
                }
 
@@ -1483,28 +1493,26 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                /* Create a plain object and reserve a channel key. */
                channel = consumer_allocate_channel(
-                               msg.u.ask_channel.key,
-                               msg.u.ask_channel.session_id,
-                               msg.u.ask_channel.chunk_id.is_set ?
-                                               &chunk_id : NULL,
-                               msg.u.ask_channel.pathname,
-                               msg.u.ask_channel.name,
-                               msg.u.ask_channel.relayd_id,
-                               (enum lttng_event_output) msg.u.ask_channel.output,
-                               msg.u.ask_channel.tracefile_size,
-                               msg.u.ask_channel.tracefile_count,
-                               msg.u.ask_channel.session_id_per_pid,
-                               msg.u.ask_channel.monitor,
-                               msg.u.ask_channel.live_timer_interval,
-                               msg.u.ask_channel.is_live,
-                               msg.u.ask_channel.root_shm_path,
-                               msg.u.ask_channel.shm_path);
+                       msg.u.ask_channel.key,
+                       msg.u.ask_channel.session_id,
+                       msg.u.ask_channel.chunk_id.is_set ? &chunk_id : NULL,
+                       msg.u.ask_channel.pathname,
+                       msg.u.ask_channel.name,
+                       msg.u.ask_channel.relayd_id,
+                       (enum lttng_event_output) msg.u.ask_channel.output,
+                       msg.u.ask_channel.tracefile_size,
+                       msg.u.ask_channel.tracefile_count,
+                       msg.u.ask_channel.session_id_per_pid,
+                       msg.u.ask_channel.monitor,
+                       msg.u.ask_channel.live_timer_interval,
+                       msg.u.ask_channel.is_live,
+                       msg.u.ask_channel.root_shm_path,
+                       msg.u.ask_channel.shm_path);
                if (!channel) {
                        goto end_channel_error;
                }
 
-               LTTNG_OPTIONAL_SET(&channel->buffer_credentials,
-                               buffer_credentials);
+               LTTNG_OPTIONAL_SET(&channel->buffer_credentials, buffer_credentials);
 
                /*
                 * Assign UST application UID to the channel. This value is ignored for
@@ -1521,7 +1529,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                attr.read_timer_interval = msg.u.ask_channel.read_timer_interval;
                attr.chan_id = msg.u.ask_channel.chan_id;
                memcpy(attr.uuid, msg.u.ask_channel.uuid, sizeof(attr.uuid));
-               attr.blocking_timeout= msg.u.ask_channel.blocking_timeout;
+               attr.blocking_timeout = msg.u.ask_channel.blocking_timeout;
 
                /* Match channel buffer type to the UST abi. */
                switch (msg.u.ask_channel.output) {
@@ -1562,8 +1570,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                if (msg.u.ask_channel.type == LTTNG_UST_ABI_CHAN_METADATA) {
                        int ret_allocate;
 
-                       ret_allocate = consumer_metadata_cache_allocate(
-                                       channel);
+                       ret_allocate = consumer_metadata_cache_allocate(channel);
                        if (ret_allocate < 0) {
                                ERR("Allocating metadata cache");
                                goto end_channel_error;
@@ -1573,11 +1580,9 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                } else {
                        int monitor_start_ret;
 
-                       consumer_timer_live_start(channel,
-                                       msg.u.ask_channel.live_timer_interval);
+                       consumer_timer_live_start(channel, msg.u.ask_channel.live_timer_interval);
                        monitor_start_ret = consumer_timer_monitor_start(
-                                       channel,
-                                       msg.u.ask_channel.monitor_timer_interval);
+                               channel, msg.u.ask_channel.monitor_timer_interval);
                        if (monitor_start_ret < 0) {
                                ERR("Starting channel monitoring timer failed");
                                goto end_channel_error;
@@ -1643,8 +1648,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                health_code_update();
 
                /* Send the channel to sessiond (and relayd, if applicable). */
-               ret = send_channel_to_sessiond_and_relayd(
-                               sock, found_channel, ctx, &relayd_err);
+               ret = send_channel_to_sessiond_and_relayd(sock, found_channel, ctx, &relayd_err);
                if (ret < 0) {
                        if (relayd_err) {
                                /*
@@ -1682,11 +1686,11 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                }
                /* List MUST be empty after or else it could be reused. */
                LTTNG_ASSERT(cds_list_empty(&found_channel->streams.head));
-end_get_channel:
+       end_get_channel:
                goto end_msg_sessiond;
-error_get_channel_fatal:
+       error_get_channel_fatal:
                goto error_fatal;
-end_get_channel_nosignal:
+       end_get_channel_nosignal:
                goto end_nosignal;
        }
        case LTTNG_CONSUMER_DESTROY_CHANNEL:
@@ -1727,8 +1731,7 @@ end_get_channel_nosignal:
        {
                int ret;
 
-               ret = clear_quiescent_channel(
-                               msg.u.clear_quiescent_channel.key);
+               ret = clear_quiescent_channel(msg.u.clear_quiescent_channel.key);
                if (ret != 0) {
                        ret_code = (lttcomm_return_code) ret;
                }
@@ -1744,8 +1747,7 @@ end_get_channel_nosignal:
                uint64_t version = msg.u.push_metadata.version;
                struct lttng_consumer_channel *found_channel;
 
-               DBG("UST consumer push metadata key %" PRIu64 " of len %" PRIu64, key,
-                               len);
+               DBG("UST consumer push metadata key %" PRIu64 " of len %" PRIu64, key, len);
 
                found_channel = consumer_find_channel(key);
                if (!found_channel) {
@@ -1791,8 +1793,8 @@ end_get_channel_nosignal:
 
                health_code_update();
 
-               ret = lttng_ustconsumer_recv_metadata(sock, key, offset, len,
-                               version, found_channel, 0, 1);
+               ret = lttng_ustconsumer_recv_metadata(
+                       sock, key, offset, len, version, found_channel, 0, 1);
                if (ret < 0) {
                        /* error receiving from sessiond */
                        goto error_push_metadata_fatal;
@@ -1800,9 +1802,9 @@ end_get_channel_nosignal:
                        ret_code = (lttcomm_return_code) ret;
                        goto end_push_metadata_msg_sessiond;
                }
-end_push_metadata_msg_sessiond:
+       end_push_metadata_msg_sessiond:
                goto end_msg_sessiond;
-error_push_metadata_fatal:
+       error_push_metadata_fatal:
                goto error_fatal;
        }
        case LTTNG_CONSUMER_SETUP_METADATA:
@@ -1830,10 +1832,10 @@ error_push_metadata_fatal:
                                int ret_snapshot;
 
                                ret_snapshot = snapshot_metadata(found_channel,
-                                               key,
-                                               msg.u.snapshot_channel.pathname,
-                                               msg.u.snapshot_channel.relayd_id,
-                                               ctx);
+                                                                key,
+                                                                msg.u.snapshot_channel.pathname,
+                                                                msg.u.snapshot_channel.relayd_id,
+                                                                ctx);
                                if (ret_snapshot < 0) {
                                        ERR("Snapshot metadata failed");
                                        ret_code = LTTCOMM_CONSUMERD_SNAPSHOT_FAILED;
@@ -1841,13 +1843,13 @@ error_push_metadata_fatal:
                        } else {
                                int ret_snapshot;
 
-                               ret_snapshot = snapshot_channel(found_channel,
-                                               key,
-                                               msg.u.snapshot_channel.pathname,
-                                               msg.u.snapshot_channel.relayd_id,
-                                               msg.u.snapshot_channel
-                                                               .nb_packets_per_stream,
-                                               ctx);
+                               ret_snapshot = snapshot_channel(
+                                       found_channel,
+                                       key,
+                                       msg.u.snapshot_channel.pathname,
+                                       msg.u.snapshot_channel.relayd_id,
+                                       msg.u.snapshot_channel.nb_packets_per_stream,
+                                       ctx);
                                if (ret_snapshot < 0) {
                                        ERR("Snapshot channel failed");
                                        ret_code = LTTCOMM_CONSUMERD_SNAPSHOT_FAILED;
@@ -1873,8 +1875,7 @@ error_push_metadata_fatal:
                uint64_t id = msg.u.discarded_events.session_id;
                uint64_t key = msg.u.discarded_events.channel_key;
 
-               DBG("UST consumer discarded events command for session id %"
-                               PRIu64, id);
+               DBG("UST consumer discarded events command for session id %" PRIu64, id);
                rcu_read_lock();
                pthread_mutex_lock(&the_consumer_data.lock);
 
@@ -1889,9 +1890,13 @@ error_push_metadata_fatal:
                 */
                discarded_events = 0;
                cds_lfht_for_each_entry_duplicate(ht->ht,
-                               ht->hash_fct(&id, lttng_ht_seed),
-                               ht->match_fct, &id,
-                               &iter.iter, stream, node_session_id.node) {
+                                                 ht->hash_fct(&id, lttng_ht_seed),
+                                                 ht->match_fct,
+                                                 &id,
+                                                 &iter.iter,
+                                                 stream,
+                                                 node_session_id.node)
+               {
                        if (stream->chan->key == key) {
                                discarded_events = stream->chan->discarded_events;
                                break;
@@ -1900,8 +1905,10 @@ error_push_metadata_fatal:
                pthread_mutex_unlock(&the_consumer_data.lock);
                rcu_read_unlock();
 
-               DBG("UST consumer discarded events command for session id %"
-                               PRIu64 ", channel key %" PRIu64, id, key);
+               DBG("UST consumer discarded events command for session id %" PRIu64
+                   ", channel key %" PRIu64,
+                   id,
+                   key);
 
                health_code_update();
 
@@ -1916,7 +1923,7 @@ error_push_metadata_fatal:
        }
        case LTTNG_CONSUMER_LOST_PACKETS:
        {
-               int ret;
+               int ret;
                uint64_t lost_packets;
                struct lttng_ht_iter iter;
                struct lttng_ht *ht;
@@ -1924,8 +1931,7 @@ error_push_metadata_fatal:
                uint64_t id = msg.u.lost_packets.session_id;
                uint64_t key = msg.u.lost_packets.channel_key;
 
-               DBG("UST consumer lost packets command for session id %"
-                               PRIu64, id);
+               DBG("UST consumer lost packets command for session id %" PRIu64, id);
                rcu_read_lock();
                pthread_mutex_lock(&the_consumer_data.lock);
 
@@ -1937,27 +1943,32 @@ error_push_metadata_fatal:
                 * to extract the information we need, we default to 0 if not
                 * found (no packets lost if the channel is not yet in use).
                 */
-               lost_packets = 0;
+               lost_packets = 0;
                cds_lfht_for_each_entry_duplicate(ht->ht,
-                               ht->hash_fct(&id, lttng_ht_seed),
-                               ht->match_fct, &id,
-                               &iter.iter, stream, node_session_id.node) {
+                                                 ht->hash_fct(&id, lttng_ht_seed),
+                                                 ht->match_fct,
+                                                 &id,
+                                                 &iter.iter,
+                                                 stream,
+                                                 node_session_id.node)
+               {
                        if (stream->chan->key == key) {
-                               lost_packets = stream->chan->lost_packets;
+                               lost_packets = stream->chan->lost_packets;
                                break;
                        }
                }
                pthread_mutex_unlock(&the_consumer_data.lock);
                rcu_read_unlock();
 
-               DBG("UST consumer lost packets command for session id %"
-                               PRIu64 ", channel key %" PRIu64, id, key);
+               DBG("UST consumer lost packets command for session id %" PRIu64
+                   ", channel key %" PRIu64,
+                   id,
+                   key);
 
                health_code_update();
 
                /* Send back returned value to session daemon */
-               ret = lttcomm_send_unix_sock(sock, &lost_packets,
-                               sizeof(lost_packets));
+               ret = lttcomm_send_unix_sock(sock, &lost_packets, sizeof(lost_packets));
                if (ret < 0) {
                        PERROR("send lost packets");
                        goto error_fatal;
@@ -1967,8 +1978,7 @@ error_push_metadata_fatal:
        }
        case LTTNG_CONSUMER_SET_CHANNEL_MONITOR_PIPE:
        {
-               int channel_monitor_pipe, ret_send,
-                               ret_set_channel_monitor_pipe;
+               int channel_monitor_pipe, ret_send, ret_set_channel_monitor_pipe;
                ssize_t ret_recv;
 
                ret_code = LTTCOMM_CONSUMERD_SUCCESS;
@@ -1978,8 +1988,7 @@ error_push_metadata_fatal:
                        goto error_fatal;
                }
 
-               ret_recv = lttcomm_recv_fds_unix_sock(
-                               sock, &channel_monitor_pipe, 1);
+               ret_recv = lttcomm_recv_fds_unix_sock(sock, &channel_monitor_pipe, 1);
                if (ret_recv != sizeof(channel_monitor_pipe)) {
                        ERR("Failed to receive channel monitor pipe");
                        goto error_fatal;
@@ -1987,8 +1996,7 @@ error_push_metadata_fatal:
 
                DBG("Received channel monitor pipe (%d)", channel_monitor_pipe);
                ret_set_channel_monitor_pipe =
-                               consumer_timer_thread_set_channel_monitor_pipe(
-                                               channel_monitor_pipe);
+                       consumer_timer_thread_set_channel_monitor_pipe(channel_monitor_pipe);
                if (!ret_set_channel_monitor_pipe) {
                        int flags;
                        int ret_fcntl;
@@ -2002,8 +2010,7 @@ error_push_metadata_fatal:
                        }
                        flags = ret_fcntl;
 
-                       ret_fcntl = fcntl(channel_monitor_pipe, F_SETFL,
-                                       flags | O_NONBLOCK);
+                       ret_fcntl = fcntl(channel_monitor_pipe, F_SETFL, flags | O_NONBLOCK);
                        if (ret_fcntl == -1) {
                                PERROR("fcntl set O_NONBLOCK flag of the channel monitoring pipe");
                                goto error_fatal;
@@ -2032,8 +2039,7 @@ error_push_metadata_fatal:
                         * this channel.
                         */
                        rotate_channel = lttng_consumer_rotate_channel(
-                                       found_channel, key,
-                                       msg.u.rotate_channel.relayd_id);
+                               found_channel, key, msg.u.rotate_channel.relayd_id);
                        if (rotate_channel < 0) {
                                ERR("Rotate channel failed");
                                ret_code = LTTCOMM_CONSUMERD_ROTATION_FAIL;
@@ -2059,14 +2065,13 @@ error_push_metadata_fatal:
                        int ret_rotate_read_streams;
 
                        ret_rotate_read_streams =
-                                       lttng_consumer_rotate_ready_streams(
-                                                       found_channel, key);
+                               lttng_consumer_rotate_ready_streams(found_channel, key);
                        if (ret_rotate_read_streams < 0) {
                                ERR("Rotate channel failed");
                        }
                }
                break;
-end_rotate_channel_nosignal:
+       end_rotate_channel_nosignal:
                goto end_nosignal;
        }
        case LTTNG_CONSUMER_CLEAR_CHANNEL:
@@ -2082,8 +2087,7 @@ end_rotate_channel_nosignal:
                } else {
                        int ret_clear_channel;
 
-                       ret_clear_channel = lttng_consumer_clear_channel(
-                                       found_channel);
+                       ret_clear_channel = lttng_consumer_clear_channel(found_channel);
                        if (ret_clear_channel) {
                                ERR("Clear channel failed key %" PRIu64, key);
                                ret_code = (lttcomm_return_code) ret_clear_channel;
@@ -2103,8 +2107,9 @@ end_rotate_channel_nosignal:
                int ret_send_status;
                lttng_uuid sessiond_uuid;
 
-               std::copy(std::begin(msg.u.init.sessiond_uuid), std::end(msg.u.init.sessiond_uuid),
-                               sessiond_uuid.begin());
+               std::copy(std::begin(msg.u.init.sessiond_uuid),
+                         std::end(msg.u.init.sessiond_uuid),
+                         sessiond_uuid.begin());
                ret_code = lttng_consumer_init_command(ctx, sessiond_uuid);
                health_code_update();
                ret_send_status = consumer_send_status_msg(sock, ret_code);
@@ -2117,17 +2122,16 @@ end_rotate_channel_nosignal:
        case LTTNG_CONSUMER_CREATE_TRACE_CHUNK:
        {
                const struct lttng_credentials credentials = {
-                       .uid = LTTNG_OPTIONAL_INIT_VALUE(msg.u.create_trace_chunk.credentials.value.uid),
-                       .gid = LTTNG_OPTIONAL_INIT_VALUE(msg.u.create_trace_chunk.credentials.value.gid),
+                       .uid = LTTNG_OPTIONAL_INIT_VALUE(
+                               msg.u.create_trace_chunk.credentials.value.uid),
+                       .gid = LTTNG_OPTIONAL_INIT_VALUE(
+                               msg.u.create_trace_chunk.credentials.value.gid),
                };
-               const bool is_local_trace =
-                               !msg.u.create_trace_chunk.relayd_id.is_set;
-               const uint64_t relayd_id =
-                               msg.u.create_trace_chunk.relayd_id.value;
-               const char *chunk_override_name =
-                               *msg.u.create_trace_chunk.override_name ?
-                                       msg.u.create_trace_chunk.override_name :
-                                       NULL;
+               const bool is_local_trace = !msg.u.create_trace_chunk.relayd_id.is_set;
+               const uint64_t relayd_id = msg.u.create_trace_chunk.relayd_id.value;
+               const char *chunk_override_name = *msg.u.create_trace_chunk.override_name ?
+                       msg.u.create_trace_chunk.override_name :
+                       NULL;
                struct lttng_directory_handle *chunk_directory_handle = NULL;
 
                /*
@@ -2140,8 +2144,7 @@ end_rotate_channel_nosignal:
                        ssize_t ret_recv;
 
                        /* Acnowledge the reception of the command. */
-                       ret_send_status = consumer_send_status_msg(
-                                       sock, LTTCOMM_CONSUMERD_SUCCESS);
+                       ret_send_status = consumer_send_status_msg(sock, LTTCOMM_CONSUMERD_SUCCESS);
                        if (ret_send_status < 0) {
                                /* Somehow, the session daemon is not responding anymore. */
                                goto end_nosignal;
@@ -2150,17 +2153,15 @@ end_rotate_channel_nosignal:
                        /*
                         * Receive trace chunk domain dirfd.
                         */
-                       ret_recv = lttcomm_recv_fds_unix_sock(
-                                       sock, &chunk_dirfd, 1);
+                       ret_recv = lttcomm_recv_fds_unix_sock(sock, &chunk_dirfd, 1);
                        if (ret_recv != sizeof(chunk_dirfd)) {
                                ERR("Failed to receive trace chunk domain directory file descriptor");
                                goto error_fatal;
                        }
 
-                       DBG("Received trace chunk domain directory fd (%d)",
-                                       chunk_dirfd);
-                       chunk_directory_handle = lttng_directory_handle_create_from_dirfd(
-                                       chunk_dirfd);
+                       DBG("Received trace chunk domain directory fd (%d)", chunk_dirfd);
+                       chunk_directory_handle =
+                               lttng_directory_handle_create_from_dirfd(chunk_dirfd);
                        if (!chunk_directory_handle) {
                                ERR("Failed to initialize chunk domain directory handle from directory file descriptor");
                                if (close(chunk_dirfd)) {
@@ -2171,48 +2172,39 @@ end_rotate_channel_nosignal:
                }
 
                ret_code = lttng_consumer_create_trace_chunk(
-                               !is_local_trace ? &relayd_id : NULL,
-                               msg.u.create_trace_chunk.session_id,
-                               msg.u.create_trace_chunk.chunk_id,
-                               (time_t) msg.u.create_trace_chunk
-                                               .creation_timestamp,
-                               chunk_override_name,
-                               msg.u.create_trace_chunk.credentials.is_set ?
-                                               &credentials :
-                                               NULL,
-                               chunk_directory_handle);
+                       !is_local_trace ? &relayd_id : NULL,
+                       msg.u.create_trace_chunk.session_id,
+                       msg.u.create_trace_chunk.chunk_id,
+                       (time_t) msg.u.create_trace_chunk.creation_timestamp,
+                       chunk_override_name,
+                       msg.u.create_trace_chunk.credentials.is_set ? &credentials : NULL,
+                       chunk_directory_handle);
                lttng_directory_handle_put(chunk_directory_handle);
                goto end_msg_sessiond;
        }
        case LTTNG_CONSUMER_CLOSE_TRACE_CHUNK:
        {
                enum lttng_trace_chunk_command_type close_command =
-                       (lttng_trace_chunk_command_type)
-                               msg.u.close_trace_chunk.close_command.value;
-               const uint64_t relayd_id =
-                               msg.u.close_trace_chunk.relayd_id.value;
+                       (lttng_trace_chunk_command_type) msg.u.close_trace_chunk.close_command.value;
+               const uint64_t relayd_id = msg.u.close_trace_chunk.relayd_id.value;
                struct lttcomm_consumer_close_trace_chunk_reply reply;
                char closed_trace_chunk_path[LTTNG_PATH_MAX] = {};
                int ret;
 
                ret_code = lttng_consumer_close_trace_chunk(
-                               msg.u.close_trace_chunk.relayd_id.is_set ?
-                                               &relayd_id :
-                                               NULL,
-                               msg.u.close_trace_chunk.session_id,
-                               msg.u.close_trace_chunk.chunk_id,
-                               (time_t) msg.u.close_trace_chunk.close_timestamp,
-                               msg.u.close_trace_chunk.close_command.is_set ?
-                                               &close_command :
-                                               NULL, closed_trace_chunk_path);
+                       msg.u.close_trace_chunk.relayd_id.is_set ? &relayd_id : NULL,
+                       msg.u.close_trace_chunk.session_id,
+                       msg.u.close_trace_chunk.chunk_id,
+                       (time_t) msg.u.close_trace_chunk.close_timestamp,
+                       msg.u.close_trace_chunk.close_command.is_set ? &close_command : NULL,
+                       closed_trace_chunk_path);
                reply.ret_code = ret_code;
                reply.path_length = strlen(closed_trace_chunk_path) + 1;
                ret = lttcomm_send_unix_sock(sock, &reply, sizeof(reply));
                if (ret != sizeof(reply)) {
                        goto error_fatal;
                }
-               ret = lttcomm_send_unix_sock(sock, closed_trace_chunk_path,
-                               reply.path_length);
+               ret = lttcomm_send_unix_sock(sock, closed_trace_chunk_path, reply.path_length);
                if (ret != reply.path_length) {
                        goto error_fatal;
                }
@@ -2220,26 +2212,22 @@ end_rotate_channel_nosignal:
        }
        case LTTNG_CONSUMER_TRACE_CHUNK_EXISTS:
        {
-               const uint64_t relayd_id =
-                               msg.u.trace_chunk_exists.relayd_id.value;
+               const uint64_t relayd_id = msg.u.trace_chunk_exists.relayd_id.value;
 
                ret_code = lttng_consumer_trace_chunk_exists(
-                               msg.u.trace_chunk_exists.relayd_id.is_set ?
-                                               &relayd_id : NULL,
-                               msg.u.trace_chunk_exists.session_id,
-                               msg.u.trace_chunk_exists.chunk_id);
+                       msg.u.trace_chunk_exists.relayd_id.is_set ? &relayd_id : NULL,
+                       msg.u.trace_chunk_exists.session_id,
+                       msg.u.trace_chunk_exists.chunk_id);
                goto end_msg_sessiond;
        }
        case LTTNG_CONSUMER_OPEN_CHANNEL_PACKETS:
        {
                const uint64_t key = msg.u.open_channel_packets.key;
-               struct lttng_consumer_channel *found_channel =
-                               consumer_find_channel(key);
+               struct lttng_consumer_channel *found_channel = consumer_find_channel(key);
 
                if (found_channel) {
                        pthread_mutex_lock(&found_channel->lock);
-                       ret_code = lttng_consumer_open_channel_packets(
-                                       found_channel);
+                       ret_code = lttng_consumer_open_channel_packets(found_channel);
                        pthread_mutex_unlock(&found_channel->lock);
                } else {
                        /*
@@ -2312,8 +2300,7 @@ end:
        return ret_func;
 }
 
-int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream,
-               int producer_active)
+int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream, int producer_active)
 {
        LTTNG_ASSERT(stream);
        LTTNG_ASSERT(stream->ustream);
@@ -2339,8 +2326,7 @@ int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream)
  *
  * Returns 0 on success, < 0 on error.
  */
-int lttng_ustconsumer_sample_snapshot_positions(
-               struct lttng_consumer_stream *stream)
+int lttng_ustconsumer_sample_snapshot_positions(struct lttng_consumer_stream *stream)
 {
        LTTNG_ASSERT(stream);
        LTTNG_ASSERT(stream->ustream);
@@ -2353,8 +2339,8 @@ int lttng_ustconsumer_sample_snapshot_positions(
  *
  * Returns 0 on success, < 0 on error
  */
-int lttng_ustconsumer_get_produced_snapshot(
-               struct lttng_consumer_stream *stream, unsigned long *pos)
+int lttng_ustconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream,
+                                           unsigned long *pos)
 {
        LTTNG_ASSERT(stream);
        LTTNG_ASSERT(stream->ustream);
@@ -2368,8 +2354,8 @@ int lttng_ustconsumer_get_produced_snapshot(
  *
  * Returns 0 on success, < 0 on error
  */
-int lttng_ustconsumer_get_consumed_snapshot(
-               struct lttng_consumer_stream *stream, unsigned long *pos)
+int lttng_ustconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream,
+                                           unsigned long *pos)
 {
        LTTNG_ASSERT(stream);
        LTTNG_ASSERT(stream->ustream);
@@ -2378,8 +2364,7 @@ int lttng_ustconsumer_get_consumed_snapshot(
        return lttng_ust_ctl_snapshot_get_consumed(stream->ustream, pos);
 }
 
-int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream,
-               int producer)
+int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, int producer)
 {
        LTTNG_ASSERT(stream);
        LTTNG_ASSERT(stream->ustream);
@@ -2395,8 +2380,7 @@ int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream)
        return lttng_ust_ctl_clear_buffer(stream->ustream);
 }
 
-int lttng_ustconsumer_get_current_timestamp(
-               struct lttng_consumer_stream *stream, uint64_t *ts)
+int lttng_ustconsumer_get_current_timestamp(struct lttng_consumer_stream *stream, uint64_t *ts)
 {
        LTTNG_ASSERT(stream);
        LTTNG_ASSERT(stream->ustream);
@@ -2405,8 +2389,7 @@ int lttng_ustconsumer_get_current_timestamp(
        return lttng_ust_ctl_get_current_timestamp(stream->ustream, ts);
 }
 
-int lttng_ustconsumer_get_sequence_number(
-               struct lttng_consumer_stream *stream, uint64_t *seq)
+int lttng_ustconsumer_get_sequence_number(struct lttng_consumer_stream *stream, uint64_t *seq)
 {
        LTTNG_ASSERT(stream);
        LTTNG_ASSERT(stream->ustream);
@@ -2462,10 +2445,10 @@ void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
                                ERR("Cannot get stream shm path");
                        }
                        ret = run_as_unlink(shm_path,
-                                       lttng_credentials_get_uid(LTTNG_OPTIONAL_GET_PTR(
-                                                       chan->buffer_credentials)),
-                                       lttng_credentials_get_gid(LTTNG_OPTIONAL_GET_PTR(
-                                                       chan->buffer_credentials)));
+                                           lttng_credentials_get_uid(LTTNG_OPTIONAL_GET_PTR(
+                                                   chan->buffer_credentials)),
+                                           lttng_credentials_get_gid(LTTNG_OPTIONAL_GET_PTR(
+                                                   chan->buffer_credentials)));
                        if (ret) {
                                PERROR("unlink %s", shm_path);
                        }
@@ -2483,12 +2466,11 @@ void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
        lttng_ust_ctl_destroy_channel(chan->uchan);
        /* Try to rmdir all directories under shm_path root. */
        if (chan->root_shm_path[0]) {
-               (void) run_as_rmdir_recursive(chan->root_shm_path,
-                               lttng_credentials_get_uid(LTTNG_OPTIONAL_GET_PTR(
-                                               chan->buffer_credentials)),
-                               lttng_credentials_get_gid(LTTNG_OPTIONAL_GET_PTR(
-                                               chan->buffer_credentials)),
-                               LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
+               (void) run_as_rmdir_recursive(
+                       chan->root_shm_path,
+                       lttng_credentials_get_uid(LTTNG_OPTIONAL_GET_PTR(chan->buffer_credentials)),
+                       lttng_credentials_get_gid(LTTNG_OPTIONAL_GET_PTR(chan->buffer_credentials)),
+                       LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
        }
        free(chan->stream_fds);
 }
@@ -2526,15 +2508,13 @@ int lttng_ustconsumer_close_wakeup_fd(struct lttng_consumer_stream *stream)
  * Returns the number of bytes pushed from the cache into the ring buffer, or a
  * negative value on error.
  */
-static
-int commit_one_metadata_packet(struct lttng_consumer_stream *stream)
+static int commit_one_metadata_packet(struct lttng_consumer_stream *stream)
 {
        ssize_t write_len;
        int ret;
 
        pthread_mutex_lock(&stream->chan->metadata_cache->lock);
-       if (stream->chan->metadata_cache->contents.size ==
-                       stream->ust_metadata_pushed) {
+       if (stream->chan->metadata_cache->contents.size == stream->ust_metadata_pushed) {
                /*
                 * In the context of a user space metadata channel, a
                 * change in version can be detected in two ways:
@@ -2559,21 +2539,20 @@ int commit_one_metadata_packet(struct lttng_consumer_stream *stream)
                 * occur as part of the pre-consume) until the metadata size
                 * exceeded the cache size.
                 */
-               if (stream->metadata_version !=
-                               stream->chan->metadata_cache->version) {
+               if (stream->metadata_version != stream->chan->metadata_cache->version) {
                        metadata_stream_reset_cache_consumed_position(stream);
                        consumer_stream_metadata_set_version(stream,
-                                       stream->chan->metadata_cache->version);
+                                                            stream->chan->metadata_cache->version);
                } else {
                        ret = 0;
                        goto end;
                }
        }
 
-       write_len = lttng_ust_ctl_write_one_packet_to_channel(stream->chan->uchan,
-                       &stream->chan->metadata_cache->contents.data[stream->ust_metadata_pushed],
-                       stream->chan->metadata_cache->contents.size -
-                                       stream->ust_metadata_pushed);
+       write_len = lttng_ust_ctl_write_one_packet_to_channel(
+               stream->chan->uchan,
+               &stream->chan->metadata_cache->contents.data[stream->ust_metadata_pushed],
+               stream->chan->metadata_cache->contents.size - stream->ust_metadata_pushed);
        LTTNG_ASSERT(write_len != 0);
        if (write_len < 0) {
                ERR("Writing one metadata packet");
@@ -2582,8 +2561,7 @@ int commit_one_metadata_packet(struct lttng_consumer_stream *stream)
        }
        stream->ust_metadata_pushed += write_len;
 
-       LTTNG_ASSERT(stream->chan->metadata_cache->contents.size >=
-                       stream->ust_metadata_pushed);
+       LTTNG_ASSERT(stream->chan->metadata_cache->contents.size >= stream->ust_metadata_pushed);
        ret = write_len;
 
        /*
@@ -2602,7 +2580,6 @@ end:
        return ret;
 }
 
-
 /*
  * Sync metadata meaning request them to the session daemon and snapshot to the
  * metadata thread can consumer them.
@@ -2613,9 +2590,9 @@ end:
  *
  * The RCU read side lock must be held by the caller.
  */
-enum sync_metadata_status lttng_ustconsumer_sync_metadata(
-               struct lttng_consumer_local_data *ctx,
-               struct lttng_consumer_stream *metadata_stream)
+enum sync_metadata_status
+lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx,
+                               struct lttng_consumer_stream *metadata_stream)
 {
        int ret;
        enum sync_metadata_status status;
@@ -2651,7 +2628,7 @@ enum sync_metadata_status lttng_ustconsumer_sync_metadata(
         */
        if (consumer_stream_is_deleted(metadata_stream)) {
                DBG("Metadata stream %" PRIu64 " was deleted during the metadata synchronization",
-                               metadata_stream->key);
+                   metadata_stream->key);
                status = SYNC_METADATA_STATUS_NO_DATA;
                goto end;
        }
@@ -2669,7 +2646,8 @@ enum sync_metadata_status lttng_ustconsumer_sync_metadata(
 
        ret = lttng_ust_ctl_snapshot(metadata_stream->ustream);
        if (ret < 0) {
-               ERR("Failed to take a snapshot of the metadata ring-buffer positions, ret = %d", ret);
+               ERR("Failed to take a snapshot of the metadata ring-buffer positions, ret = %d",
+                   ret);
                status = SYNC_METADATA_STATUS_ERROR;
                goto end;
        }
@@ -2682,7 +2660,7 @@ end:
  * Return 0 on success else a negative value.
  */
 static int notify_if_more_data(struct lttng_consumer_stream *stream,
-               struct lttng_consumer_local_data *ctx)
+                              struct lttng_consumer_local_data *ctx)
 {
        int ret;
        struct lttng_ust_ctl_consumer_stream *ustream;
@@ -2758,18 +2736,17 @@ static int consumer_stream_ust_on_wake_up(struct lttng_consumer_stream *stream)
 }
 
 static int extract_common_subbuffer_info(struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuf)
+                                        struct stream_subbuffer *subbuf)
 {
        int ret;
 
-       ret = lttng_ust_ctl_get_subbuf_size(
-                       stream->ustream, &subbuf->info.data.subbuf_size);
+       ret = lttng_ust_ctl_get_subbuf_size(stream->ustream, &subbuf->info.data.subbuf_size);
        if (ret) {
                goto end;
        }
 
-       ret = lttng_ust_ctl_get_padded_subbuf_size(
-                       stream->ustream, &subbuf->info.data.padded_subbuf_size);
+       ret = lttng_ust_ctl_get_padded_subbuf_size(stream->ustream,
+                                                  &subbuf->info.data.padded_subbuf_size);
        if (ret) {
                goto end;
        }
@@ -2779,7 +2756,7 @@ end:
 }
 
 static int extract_metadata_subbuffer_info(struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuf)
+                                          struct stream_subbuffer *subbuf)
 {
        int ret;
 
@@ -2795,7 +2772,7 @@ end:
 }
 
 static int extract_data_subbuffer_info(struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuf)
+                                      struct stream_subbuffer *subbuf)
 {
        int ret;
 
@@ -2804,43 +2781,40 @@ static int extract_data_subbuffer_info(struct lttng_consumer_stream *stream,
                goto end;
        }
 
-       ret = lttng_ust_ctl_get_packet_size(
-                       stream->ustream, &subbuf->info.data.packet_size);
+       ret = lttng_ust_ctl_get_packet_size(stream->ustream, &subbuf->info.data.packet_size);
        if (ret < 0) {
                PERROR("Failed to get sub-buffer packet size");
                goto end;
        }
 
-       ret = lttng_ust_ctl_get_content_size(
-                       stream->ustream, &subbuf->info.data.content_size);
+       ret = lttng_ust_ctl_get_content_size(stream->ustream, &subbuf->info.data.content_size);
        if (ret < 0) {
                PERROR("Failed to get sub-buffer content size");
                goto end;
        }
 
-       ret = lttng_ust_ctl_get_timestamp_begin(
-                       stream->ustream, &subbuf->info.data.timestamp_begin);
+       ret = lttng_ust_ctl_get_timestamp_begin(stream->ustream,
+                                               &subbuf->info.data.timestamp_begin);
        if (ret < 0) {
                PERROR("Failed to get sub-buffer begin timestamp");
                goto end;
        }
 
-       ret = lttng_ust_ctl_get_timestamp_end(
-                       stream->ustream, &subbuf->info.data.timestamp_end);
+       ret = lttng_ust_ctl_get_timestamp_end(stream->ustream, &subbuf->info.data.timestamp_end);
        if (ret < 0) {
                PERROR("Failed to get sub-buffer end timestamp");
                goto end;
        }
 
-       ret = lttng_ust_ctl_get_events_discarded(
-                       stream->ustream, &subbuf->info.data.events_discarded);
+       ret = lttng_ust_ctl_get_events_discarded(stream->ustream,
+                                                &subbuf->info.data.events_discarded);
        if (ret) {
                PERROR("Failed to get sub-buffer events discarded count");
                goto end;
        }
 
        ret = lttng_ust_ctl_get_sequence_number(stream->ustream,
-                       &subbuf->info.data.sequence_number.value);
+                                               &subbuf->info.data.sequence_number.value);
        if (ret) {
                /* May not be supported by older LTTng-modules. */
                if (ret != -ENOTTY) {
@@ -2851,15 +2825,14 @@ static int extract_data_subbuffer_info(struct lttng_consumer_stream *stream,
                subbuf->info.data.sequence_number.is_set = true;
        }
 
-       ret = lttng_ust_ctl_get_stream_id(
-                       stream->ustream, &subbuf->info.data.stream_id);
+       ret = lttng_ust_ctl_get_stream_id(stream->ustream, &subbuf->info.data.stream_id);
        if (ret < 0) {
                PERROR("Failed to get stream id");
                goto end;
        }
 
        ret = lttng_ust_ctl_get_instance_id(stream->ustream,
-                       &subbuf->info.data.stream_instance_id.value);
+                                           &subbuf->info.data.stream_instance_id.value);
        if (ret) {
                /* May not be supported by older LTTng-modules. */
                if (ret != -ENOTTY) {
@@ -2874,13 +2847,12 @@ end:
 }
 
 static int get_next_subbuffer_common(struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuffer)
+                                    struct stream_subbuffer *subbuffer)
 {
        int ret;
        const char *addr;
 
-       ret = stream->read_subbuffer_ops.extract_subbuffer_info(
-                       stream, subbuffer);
+       ret = stream->read_subbuffer_ops.extract_subbuffer_info(stream, subbuffer);
        if (ret) {
                goto end;
        }
@@ -2890,16 +2862,15 @@ static int get_next_subbuffer_common(struct lttng_consumer_stream *stream,
                goto end;
        }
 
-       subbuffer->buffer.buffer = lttng_buffer_view_init(
-                       addr, 0, subbuffer->info.data.padded_subbuf_size);
+       subbuffer->buffer.buffer =
+               lttng_buffer_view_init(addr, 0, subbuffer->info.data.padded_subbuf_size);
        LTTNG_ASSERT(subbuffer->buffer.buffer.data != NULL);
 end:
        return ret;
 }
 
-static enum get_next_subbuffer_status get_next_subbuffer(
-               struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuffer)
+static enum get_next_subbuffer_status get_next_subbuffer(struct lttng_consumer_stream *stream,
+                                                        struct stream_subbuffer *subbuffer)
 {
        int ret;
        enum get_next_subbuffer_status status;
@@ -2910,7 +2881,7 @@ static enum get_next_subbuffer_status get_next_subbuffer(
                status = GET_NEXT_SUBBUFFER_STATUS_OK;
                break;
        case -ENODATA:
-               case -EAGAIN:
+       case -EAGAIN:
                /*
                 * The caller only expects -ENODATA when there is no data to
                 * read, but the kernel tracer returns -EAGAIN when there is
@@ -2934,9 +2905,9 @@ end:
        return status;
 }
 
-static enum get_next_subbuffer_status get_next_subbuffer_metadata(
-               struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuffer)
+static enum get_next_subbuffer_status
+get_next_subbuffer_metadata(struct lttng_consumer_stream *stream,
+                           struct stream_subbuffer *subbuffer)
 {
        int ret;
        bool cache_empty;
@@ -2979,7 +2950,7 @@ static enum get_next_subbuffer_status get_next_subbuffer_metadata(
                } else {
                        pthread_mutex_lock(&stream->chan->metadata_cache->lock);
                        cache_empty = stream->chan->metadata_cache->contents.size ==
-                                       stream->ust_metadata_pushed;
+                               stream->ust_metadata_pushed;
                        pthread_mutex_unlock(&stream->chan->metadata_cache->lock);
                }
        } while (!got_subbuffer);
@@ -3034,7 +3005,7 @@ end:
 }
 
 static int put_next_subbuffer(struct lttng_consumer_stream *stream,
-               struct stream_subbuffer *subbuffer __attribute__((unused)))
+                             struct stream_subbuffer *subbuffer __attribute__((unused)))
 {
        const int ret = lttng_ust_ctl_put_next_subbuf(stream->ustream);
 
@@ -3043,42 +3014,35 @@ static int put_next_subbuffer(struct lttng_consumer_stream *stream,
 }
 
 static int signal_metadata(struct lttng_consumer_stream *stream,
-               struct lttng_consumer_local_data *ctx __attribute__((unused)))
+                          struct lttng_consumer_local_data *ctx __attribute__((unused)))
 {
        ASSERT_LOCKED(stream->metadata_rdv_lock);
        return pthread_cond_broadcast(&stream->metadata_rdv) ? -errno : 0;
 }
 
-static int lttng_ustconsumer_set_stream_ops(
-               struct lttng_consumer_stream *stream)
+static int lttng_ustconsumer_set_stream_ops(struct lttng_consumer_stream *stream)
 {
        int ret = 0;
 
        stream->read_subbuffer_ops.on_wake_up = consumer_stream_ust_on_wake_up;
        if (stream->metadata_flag) {
-               stream->read_subbuffer_ops.get_next_subbuffer =
-                               get_next_subbuffer_metadata;
-               stream->read_subbuffer_ops.extract_subbuffer_info =
-                               extract_metadata_subbuffer_info;
+               stream->read_subbuffer_ops.get_next_subbuffer = get_next_subbuffer_metadata;
+               stream->read_subbuffer_ops.extract_subbuffer_info = extract_metadata_subbuffer_info;
                stream->read_subbuffer_ops.reset_metadata =
-                               metadata_stream_reset_cache_consumed_position;
+                       metadata_stream_reset_cache_consumed_position;
                if (stream->chan->is_live) {
                        stream->read_subbuffer_ops.on_sleep = signal_metadata;
-                       ret = consumer_stream_enable_metadata_bucketization(
-                                       stream);
+                       ret = consumer_stream_enable_metadata_bucketization(stream);
                        if (ret) {
                                goto end;
                        }
                }
        } else {
-               stream->read_subbuffer_ops.get_next_subbuffer =
-                               get_next_subbuffer;
-               stream->read_subbuffer_ops.extract_subbuffer_info =
-                               extract_data_subbuffer_info;
+               stream->read_subbuffer_ops.get_next_subbuffer = get_next_subbuffer;
+               stream->read_subbuffer_ops.extract_subbuffer_info = extract_data_subbuffer_info;
                stream->read_subbuffer_ops.on_sleep = notify_if_more_data;
                if (stream->chan->is_live) {
-                       stream->read_subbuffer_ops.send_live_beacon =
-                                       consumer_flush_ust_index;
+                       stream->read_subbuffer_ops.send_live_beacon = consumer_flush_ust_index;
                }
        }
 
@@ -3103,7 +3067,7 @@ int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
         * no current trace chunk on the parent channel.
         */
        if (stream->net_seq_idx == (uint64_t) -1ULL && stream->chan->monitor &&
-                       stream->chan->trace_chunk) {
+           stream->chan->trace_chunk) {
                ret = consumer_stream_create_output_files(stream, true);
                if (ret) {
                        goto error;
@@ -3159,12 +3123,14 @@ int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream)
                 * whetnever ust_metadata_pushed is incremented, the associated
                 * metadata has been consumed from the metadata stream.
                 */
-               DBG("UST consumer metadata pending check: contiguous %" PRIu64 " vs pushed %" PRIu64,
-                               contiguous, pushed);
+               DBG("UST consumer metadata pending check: contiguous %" PRIu64
+                   " vs pushed %" PRIu64,
+                   contiguous,
+                   pushed);
                LTTNG_ASSERT(((int64_t) (contiguous - pushed)) >= 0);
                if ((contiguous != pushed) ||
-                               (((int64_t) contiguous - pushed) > 0 || contiguous == 0)) {
-                       ret = 1;        /* Data is pending */
+                   (((int64_t) contiguous - pushed) > 0 || contiguous == 0)) {
+                       ret = 1; /* Data is pending */
                        goto end;
                }
        } else {
@@ -3176,7 +3142,7 @@ int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream)
                         */
                        ret = lttng_ust_ctl_put_subbuf(stream->ustream);
                        LTTNG_ASSERT(ret == 0);
-                       ret = 1;        /* Data is pending */
+                       ret = 1; /* Data is pending */
                        goto end;
                }
        }
@@ -3247,15 +3213,12 @@ void lttng_ustconsumer_close_all_metadata(struct lttng_ht *metadata_ht)
        DBG("UST consumer closing all metadata streams");
 
        rcu_read_lock();
-       cds_lfht_for_each_entry(metadata_ht->ht, &iter.iter, stream,
-                       node.node) {
-
+       cds_lfht_for_each_entry (metadata_ht->ht, &iter.iter, stream, node.node) {
                health_code_update();
 
                pthread_mutex_lock(&stream->chan->lock);
                lttng_ustconsumer_close_metadata(stream->chan);
                pthread_mutex_unlock(&stream->chan->lock);
-
        }
        rcu_read_unlock();
 }
@@ -3281,7 +3244,9 @@ void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream)
  * pushed out due to concurrent interaction with the session daemon.
  */
 int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
-               struct lttng_consumer_channel *channel, int timer, int wait)
+                                      struct lttng_consumer_channel *channel,
+                                      int timer,
+                                      int wait)
 {
        struct lttcomm_metadata_request_msg request;
        struct lttcomm_consumer_msg msg;
@@ -3317,17 +3282,18 @@ int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
        request.uid = channel->ust_app_uid;
        request.key = channel->key;
 
-       DBG("Sending metadata request to sessiond, session id %" PRIu64
-                       ", per-pid %" PRIu64 ", app UID %u and channel key %" PRIu64,
-                       request.session_id, request.session_id_per_pid, request.uid,
-                       request.key);
+       DBG("Sending metadata request to sessiond, session id %" PRIu64 ", per-pid %" PRIu64
+           ", app UID %u and channel key %" PRIu64,
+           request.session_id,
+           request.session_id_per_pid,
+           request.uid,
+           request.key);
 
        pthread_mutex_lock(&ctx->metadata_socket_lock);
 
        health_code_update();
 
-       ret = lttcomm_send_unix_sock(ctx->consumer_metadata_socket, &request,
-                       sizeof(request));
+       ret = lttcomm_send_unix_sock(ctx->consumer_metadata_socket, &request, sizeof(request));
        if (ret < 0) {
                ERR("Asking metadata to sessiond");
                goto end;
@@ -3336,11 +3302,9 @@ int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
        health_code_update();
 
        /* Receive the metadata from sessiond */
-       ret = lttcomm_recv_unix_sock(ctx->consumer_metadata_socket, &msg,
-                       sizeof(msg));
+       ret = lttcomm_recv_unix_sock(ctx->consumer_metadata_socket, &msg, sizeof(msg));
        if (ret != sizeof(msg)) {
-               DBG("Consumer received unexpected message size %d (expects %zu)",
-                       ret, sizeof(msg));
+               DBG("Consumer received unexpected message size %d (expects %zu)", ret, sizeof(msg));
                lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_ERROR_RECV_CMD);
                /*
                 * The ret value might 0 meaning an orderly shutdown but this is ok
@@ -3353,8 +3317,7 @@ int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
 
        if (msg.cmd_type == LTTNG_ERR_UND) {
                /* No registry found */
-               (void) consumer_send_status_msg(ctx->consumer_metadata_socket,
-                               ret_code);
+               (void) consumer_send_status_msg(ctx->consumer_metadata_socket, ret_code);
                ret = 0;
                goto end;
        } else if (msg.cmd_type != LTTNG_CONSUMER_PUSH_METADATA) {
@@ -3376,8 +3339,7 @@ int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
        health_code_update();
 
        /* Tell session daemon we are ready to receive the metadata. */
-       ret = consumer_send_status_msg(ctx->consumer_metadata_socket,
-                       LTTCOMM_CONSUMERD_SUCCESS);
+       ret = consumer_send_status_msg(ctx->consumer_metadata_socket, LTTCOMM_CONSUMERD_SUCCESS);
        if (ret < 0 || len == 0) {
                /*
                 * Somehow, the session daemon is not responding anymore or there is
@@ -3388,8 +3350,8 @@ int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
 
        health_code_update();
 
-       ret = lttng_ustconsumer_recv_metadata(ctx->consumer_metadata_socket,
-                       key, offset, len, version, channel, timer, wait);
+       ret = lttng_ustconsumer_recv_metadata(
+               ctx->consumer_metadata_socket, key, offset, len, version, channel, timer, wait);
        if (ret >= 0) {
                /*
                 * Only send the status msg if the sessiond is alive meaning a positive
@@ -3409,8 +3371,7 @@ end:
 /*
  * Return the ustctl call for the get stream id.
  */
-int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
-               uint64_t *stream_id)
+int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream, uint64_t *stream_id)
 {
        LTTNG_ASSERT(stream);
        LTTNG_ASSERT(stream_id);
index 89ef0e54fd01714ea866c05dd2424cd1f21c26e5..71104c8e87868363f3fb8353860c6e5967c257af 100644 (file)
@@ -7,17 +7,9 @@
  */
 
 #define _LGPL_SOURCE
-#include <ctype.h>
-#include <fcntl.h>
-#include <grp.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <pwd.h>
-#include <stdlib.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
+#include "defaults.hpp"
+#include "time.hpp"
+#include "utils.hpp"
 
 #include <common/common.hpp>
 #include <common/compat/directory-handle.hpp>
 #include <common/readwrite.hpp>
 #include <common/runas.hpp>
 #include <common/string-utils/format.hpp>
+
 #include <lttng/constant.h>
 
-#include "defaults.hpp"
-#include "time.hpp"
-#include "utils.hpp"
+#include <ctype.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <pwd.h>
+#include <stdlib.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
 
-#define PROC_MEMINFO_PATH               "/proc/meminfo"
-#define PROC_MEMINFO_MEMAVAILABLE_LINE  "MemAvailable:"
-#define PROC_MEMINFO_MEMTOTAL_LINE      "MemTotal:"
+#define PROC_MEMINFO_PATH             "/proc/meminfo"
+#define PROC_MEMINFO_MEMAVAILABLE_LINE "MemAvailable:"
+#define PROC_MEMINFO_MEMTOTAL_LINE     "MemTotal:"
 
 /* The length of the longest field of `/proc/meminfo`. */
-#define PROC_MEMINFO_FIELD_MAX_NAME_LEN        20
+#define PROC_MEMINFO_FIELD_MAX_NAME_LEN 20
 
 #if (PROC_MEMINFO_FIELD_MAX_NAME_LEN == 20)
 #define MAX_NAME_LEN_SCANF_IS_A_BROKEN_API "19"
@@ -47,7 +48,7 @@
 #error MAX_NAME_LEN_SCANF_IS_A_BROKEN_API must be updated to match (PROC_MEMINFO_FIELD_MAX_NAME_LEN - 1)
 #endif
 
-#define FALLBACK_USER_BUFLEN 16384
+#define FALLBACK_USER_BUFLEN  16384
 #define FALLBACK_GROUP_BUFLEN 16384
 
 /*
@@ -217,7 +218,7 @@ int utils_create_pid_file(pid_t pid, const char *filepath)
 
        LTTNG_ASSERT(filepath);
 
-       fd = open(filepath, O_CREAT | O_WRONLY, S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH);
+       fd = open(filepath, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
        if (fd < 0) {
                PERROR("open file %s", filepath);
                ret = -1;
@@ -229,7 +230,8 @@ int utils_create_pid_file(pid_t pid, const char *filepath)
                PERROR("fdopen file %s", filepath);
                ret = -1;
                if (close(fd)) {
-                       PERROR("Failed to close `%s` file descriptor while handling fdopen error", filepath);
+                       PERROR("Failed to close `%s` file descriptor while handling fdopen error",
+                              filepath);
                }
 
                goto error;
@@ -265,8 +267,7 @@ int utils_create_lock_file(const char *filepath)
        LTTNG_ASSERT(filepath);
 
        memset(&lock, 0, sizeof(lock));
-       fd = open(filepath, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR |
-               S_IRGRP | S_IWGRP);
+       fd = open(filepath, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
        if (fd < 0) {
                PERROR("open lock file %s", filepath);
                fd = -1;
@@ -284,8 +285,7 @@ int utils_create_lock_file(const char *filepath)
        ret = fcntl(fd, F_SETLK, &lock);
        if (ret == -1) {
                PERROR("fcntl lock file");
-               ERR("Could not get lock file %s, another instance is running.",
-                       filepath);
+               ERR("Could not get lock file %s, another instance is running.", filepath);
                if (close(fd)) {
                        PERROR("close lock file");
                }
@@ -317,8 +317,7 @@ int utils_mkdir(const char *path, mode_t mode, int uid, int gid)
                goto end;
        }
        ret = lttng_directory_handle_create_subdirectory_as_user(
-                       handle, path, mode,
-                       (uid >= 0 || gid >= 0) ? &creds : NULL);
+               handle, path, mode, (uid >= 0 || gid >= 0) ? &creds : NULL);
 end:
        lttng_directory_handle_put(handle);
        return ret;
@@ -345,8 +344,7 @@ int utils_mkdir_recursive(const char *path, mode_t mode, int uid, int gid)
                goto end;
        }
        ret = lttng_directory_handle_create_subdirectory_recursive_as_user(
-                       handle, path, mode,
-                       (uid >= 0 || gid >= 0) ? &creds : NULL);
+               handle, path, mode, (uid >= 0 || gid >= 0) ? &creds : NULL);
 end:
        lttng_directory_handle_put(handle);
        return ret;
@@ -357,32 +355,39 @@ end:
  *
  * Return 0 on success or else a negative value.
  */
-int utils_stream_file_path(const char *path_name, const char *file_name,
-               uint64_t size, uint64_t count, const char *suffix,
-               char *out_stream_path, size_t stream_path_len)
+int utils_stream_file_path(const char *path_name,
+                          const char *file_name,
+                          uint64_t size,
+                          uint64_t count,
+                          const char *suffix,
+                          char *out_stream_path,
+                          size_t stream_path_len)
 {
        int ret;
        char count_str[MAX_INT_DEC_LEN(count) + 1] = {};
        const char *path_separator;
 
-       if (path_name && (path_name[0] == '\0' ||
-                       path_name[strlen(path_name) - 1] == '/')) {
+       if (path_name && (path_name[0] == '\0' || path_name[strlen(path_name) - 1] == '/')) {
                path_separator = "";
        } else {
                path_separator = "/";
        }
 
-       path_name = path_name ? : "";
-       suffix = suffix ? : "";
+       path_name = path_name ?: "";
+       suffix = suffix ?: "";
        if (size > 0) {
-               ret = snprintf(count_str, sizeof(count_str), "_%" PRIu64,
-                               count);
+               ret = snprintf(count_str, sizeof(count_str), "_%" PRIu64, count);
                LTTNG_ASSERT(ret > 0 && ret < sizeof(count_str));
        }
 
-       ret = snprintf(out_stream_path, stream_path_len, "%s%s%s%s%s",
-                       path_name, path_separator, file_name, count_str,
-                       suffix);
+       ret = snprintf(out_stream_path,
+                      stream_path_len,
+                      "%s%s%s%s%s",
+                      path_name,
+                      path_separator,
+                      file_name,
+                      count_str,
+                      suffix);
        if (ret < 0 || ret >= stream_path_len) {
                ERR("Truncation occurred while formatting stream path");
                ret = -1;
@@ -407,7 +412,7 @@ int utils_stream_file_path(const char *path_name, const char *file_name,
  *
  * @return 0 on success, -1 on failure.
  */
-int utils_parse_size_suffix(const char * const str, uint64_t * const size)
+int utils_parse_size_suffix(const char *const str, uint64_t *const size)
 {
        int ret;
        uint64_t base_size;
@@ -513,7 +518,7 @@ end:
  *
  * @return 0 on success, -1 on failure.
  */
-int utils_parse_time_suffix(char const * const str, uint64_t * const time_us)
+int utils_parse_time_suffix(char const *const str, uint64_t *const time_us)
 {
        int ret;
        uint64_t base_time;
@@ -627,18 +632,18 @@ static inline unsigned int fls_u32(uint32_t x)
        int r;
 
        asm("bsrl %1,%0\n\t"
-               "jnz 1f\n\t"
-               "movl $-1,%0\n\t"
-               "1:\n\t"
-               : "=r" (r) : "rm" (x));
+           "jnz 1f\n\t"
+           "movl $-1,%0\n\t"
+           "1:\n\t"
+           : "=r"(r)
+           : "rm"(x));
        return r + 1;
 }
 #define HAS_FLS_U32
 #endif
 
 #if defined(__x86_64) && defined(__LP64__)
-static inline
-unsigned int fls_u64(uint64_t x)
+static inline unsigned int fls_u64(uint64_t x)
 {
        long r;
 
@@ -646,15 +651,15 @@ unsigned int fls_u64(uint64_t x)
            "jnz 1f\n\t"
            "movq $-1,%0\n\t"
            "1:\n\t"
-           : "=r" (r) : "rm" (x));
+           : "=r"(r)
+           : "rm"(x));
        return r + 1;
 }
 #define HAS_FLS_U64
 #endif
 
 #ifndef HAS_FLS_U64
-static __attribute__((unused))
-unsigned int fls_u64(uint64_t x)
+static __attribute__((unused)) unsigned int fls_u64(uint64_t x)
 {
        unsigned int r = 64;
 
@@ -839,8 +844,7 @@ size_t utils_get_current_time_str(const char *format, char *dst, size_t len)
        ret = strftime(dst, len, format, timeinfo);
        DIAGNOSTIC_POP
        if (ret == 0) {
-               ERR("Unable to strftime with format %s at dst %p of len %zu", format,
-                               dst, len);
+               ERR("Unable to strftime with format %s at dst %p of len %zu", format, dst, len);
        }
 
        return ret;
@@ -888,19 +892,16 @@ int utils_get_group_id(const char *name, bool warn, gid_t *gid)
 
                ret = lttng_dynamic_buffer_set_size(&buffer, new_len);
                if (ret) {
-                       ERR("Failed to grow group info buffer to %zu bytes",
-                                       new_len);
+                       ERR("Failed to grow group info buffer to %zu bytes", new_len);
                        ret = -1;
                        goto error;
                }
        }
        if (ret) {
                if (ret == ESRCH) {
-                       DBG("Could not find group file entry for group name '%s'",
-                                       name);
+                       DBG("Could not find group file entry for group name '%s'", name);
                } else {
-                       PERROR("Failed to get group file entry for group name '%s'",
-                                       name);
+                       PERROR("Failed to get group file entry for group name '%s'", name);
                }
 
                ret = -1;
@@ -931,8 +932,7 @@ error:
  * of elements in the long_options array. Returns NULL if the string's
  * allocation fails.
  */
-char *utils_generate_optstring(const struct option *long_options,
-               size_t opt_count)
+char *utils_generate_optstring(const struct option *long_options, size_t opt_count)
 {
        int i;
        size_t string_len = opt_count, str_pos = 0;
@@ -1020,8 +1020,7 @@ static const char *get_man_bin_path(void)
        return DEFAULT_MAN_BIN_PATH;
 }
 
-int utils_show_help(int section, const char *page_name,
-               const char *help_msg)
+int utils_show_help(int section, const char *page_name, const char *help_msg)
 {
        char section_string[8];
        const char *man_bin_path = get_man_bin_path();
@@ -1043,15 +1042,13 @@ int utils_show_help(int section, const char *page_name,
         * be installed outside /usr, in which case its man pages are
         * not located in the default /usr/share/man directory.
         */
-       ret = execlp(man_bin_path, "man", "-M", MANPATH,
-               section_string, page_name, NULL);
+       ret = execlp(man_bin_path, "man", "-M", MANPATH, section_string, page_name, NULL);
 
 end:
        return ret;
 }
 
-static
-int read_proc_meminfo_field(const char *field, uint64_t *value)
+static int read_proc_meminfo_field(const char *field, uint64_t *value)
 {
        int ret;
        FILE *proc_meminfo;
@@ -1062,7 +1059,7 @@ int read_proc_meminfo_field(const char *field, uint64_t *value)
                PERROR("Failed to fopen() " PROC_MEMINFO_PATH);
                ret = -1;
                goto fopen_error;
-        }
+       }
 
        /*
         * Read the contents of /proc/meminfo line by line to find the right
@@ -1072,8 +1069,9 @@ int read_proc_meminfo_field(const char *field, uint64_t *value)
                uint64_t value_kb;
 
                ret = fscanf(proc_meminfo,
-                               "%" MAX_NAME_LEN_SCANF_IS_A_BROKEN_API "s %" SCNu64 " kB\n",
-                               name, &value_kb);
+                            "%" MAX_NAME_LEN_SCANF_IS_A_BROKEN_API "s %" SCNu64 " kB\n",
+                            name,
+                            &value_kb);
                if (ret == EOF) {
                        /*
                         * fscanf() returning EOF can indicate EOF or an error.
@@ -1149,8 +1147,7 @@ int utils_change_working_directory(const char *path)
                         */
                        DBG("Working directory \"%s\" is not writable", path);
                } else {
-                       PERROR("Failed to check if working directory \"%s\" is writable",
-                                       path);
+                       PERROR("Failed to check if working directory \"%s\" is writable", path);
                }
        }
 
@@ -1204,7 +1201,8 @@ end_loop:
                } else {
                        *uid = p.pw_uid;
                        DBG("Lookup of tracker UID/VUID: name '%s' maps to uid %" PRId64,
-                                       user_name, (int64_t) *uid);
+                           user_name,
+                           (int64_t) *uid);
                        ret_val = LTTNG_OK;
                }
                break;
@@ -1222,8 +1220,7 @@ end:
        return ret_val;
 }
 
-enum lttng_error_code utils_group_id_from_name(
-               const char *group_name, gid_t *gid)
+enum lttng_error_code utils_group_id_from_name(const char *group_name, gid_t *gid)
 {
        struct group g, *gres;
        int ret;
@@ -1269,7 +1266,8 @@ end_loop:
                } else {
                        *gid = g.gr_gid;
                        DBG("Lookup of tracker GID/GUID: name '%s' maps to gid %" PRId64,
-                                       group_name, (int64_t) *gid);
+                           group_name,
+                           (int64_t) *gid);
                        ret_val = LTTNG_OK;
                }
                break;
@@ -1287,8 +1285,7 @@ end:
        return ret_val;
 }
 
-int utils_parse_unsigned_long_long(const char *str,
-               unsigned long long *value)
+int utils_parse_unsigned_long_long(const char *str, unsigned long long *value)
 {
        int ret;
        char *endptr;
@@ -1303,15 +1300,15 @@ int utils_parse_unsigned_long_long(const char *str,
        if (errno != 0) {
                /* Don't print an error; allow the caller to log a better error. */
                DBG("Failed to parse string as unsigned long long number: string = '%s', errno = %d",
-                               str, errno);
+                   str,
+                   errno);
                ret = -1;
                goto end;
        }
 
        /* Not the end of the string or empty string. */
        if (*endptr || endptr == str) {
-               DBG("Failed to parse string as unsigned long long number: string = '%s'",
-                               str);
+               DBG("Failed to parse string as unsigned long long number: string = '%s'", str);
                ret = -1;
                goto end;
        }
index 4a1038b330caf66e4be141bc251e5dcd14b965b6..770d95529c685b95fb54ca2cd9e3c469c19c7a9f 100644 (file)
@@ -6,6 +6,8 @@
  *
  */
 
+#include "uuid.hpp"
+
 #include <common/compat/string.hpp>
 #include <common/error.hpp>
 #include <common/format.hpp>
@@ -18,8 +20,6 @@
 #include <string.h>
 #include <time.h>
 
-#include "uuid.hpp"
-
 namespace {
 const lttng_uuid nil_uuid = {};
 bool lttng_uuid_is_init;
@@ -58,8 +58,7 @@ int lttng_uuid_from_str(const char *str_in, lttng_uuid& uuid_out)
        }
 
        /* Scan to a temporary location in case of a partial match. */
-       if (sscanf(str_in, LTTNG_UUID_FMT, LTTNG_UUID_SCAN_VALUES(uuid_scan)) !=
-                       LTTNG_UUID_LEN) {
+       if (sscanf(str_in, LTTNG_UUID_FMT, LTTNG_UUID_SCAN_VALUES(uuid_scan)) != LTTNG_UUID_LEN) {
                ret = -1;
                goto end;
        }
@@ -86,7 +85,7 @@ int lttng_uuid_generate(lttng_uuid& uuid_out)
                        srand(lttng::random::produce_best_effort_random_seed());
                } catch (std::exception& e) {
                        ERR("Failed to initialize random seed during generation of UUID: %s",
-                                       e.what());
+                           e.what());
                        ret = -1;
                        goto end;
                }
index 2a1dded89805a6188a5b77b9f75e8ce5a99a976c..b1e0adeccba00638a206c9e8171b6af44af6f201 100644 (file)
@@ -6,11 +6,12 @@
  *
  */
 
-#include "waiter.hpp"
-#include <urcu/uatomic.h>
-#include <urcu/futex.h>
 #include "error.hpp"
+#include "waiter.hpp"
+
 #include <poll.h>
+#include <urcu/futex.h>
+#include <urcu/uatomic.h>
 
 /*
  * Number of busy-loop attempts before waiting on futex.
 
 enum waiter_state {
        /* WAITER_WAITING is compared directly (futex compares it). */
-       WAITER_WAITING =        0,
+       WAITER_WAITING = 0,
        /* non-zero are used as masks. */
-       WAITER_WOKEN_UP =       (1 << 0),
-       WAITER_RUNNING =        (1 << 1),
-       WAITER_TEARDOWN =       (1 << 2),
+       WAITER_WOKEN_UP = (1 << 0),
+       WAITER_RUNNING = (1 << 1),
+       WAITER_TEARDOWN = (1 << 2),
 };
 
 void lttng_waiter_init(struct lttng_waiter *waiter)
@@ -67,7 +68,7 @@ void lttng_waiter_wait(struct lttng_waiter *waiter)
                        goto skip_futex_wait;
                case EINTR:
                        /* Retry if interrupted by signal. */
-                       break;  /* Get out of switch. Check again. */
+                       break; /* Get out of switch. Check again. */
                default:
                        /* Unexpected error. */
                        PERROR("futex_noasync");
@@ -107,8 +108,7 @@ void lttng_waiter_wake_up(struct lttng_waiter *waiter)
        LTTNG_ASSERT(uatomic_read(&waiter->state) == WAITER_WAITING);
        uatomic_set(&waiter->state, WAITER_WOKEN_UP);
        if (!(uatomic_read(&waiter->state) & WAITER_RUNNING)) {
-               if (futex_noasync(&waiter->state, FUTEX_WAKE, 1,
-                               NULL, NULL, 0) < 0) {
+               if (futex_noasync(&waiter->state, FUTEX_WAKE, 1, NULL, NULL, 0) < 0) {
                        PERROR("futex_noasync");
                        abort();
                }
index aee38f58bfa41bafebd5fce22c5d26d12c590a6f..d8827c67046d88feca8b0eb933871e504f9c955e 100644 (file)
@@ -5,30 +5,29 @@
  *
  */
 
-#include <lttng/notification/notification-internal.hpp>
-#include <lttng/notification/channel-internal.hpp>
-#include <lttng/condition/condition-internal.hpp>
-#include <lttng/endpoint.h>
+#include "lttng-ctl-helper.hpp"
+
+#include <common/compat/poll.hpp>
 #include <common/defaults.hpp>
-#include <common/error.hpp>
 #include <common/dynamic-buffer.hpp>
-#include <common/utils.hpp>
-#include <common/defaults.hpp>
-#include <common/payload.hpp>
+#include <common/error.hpp>
 #include <common/payload-view.hpp>
+#include <common/payload.hpp>
 #include <common/unix.hpp>
-#include "lttng-ctl-helper.hpp"
-#include <common/compat/poll.hpp>
+#include <common/utils.hpp>
 
-static
-int handshake(struct lttng_notification_channel *channel);
+#include <lttng/condition/condition-internal.hpp>
+#include <lttng/endpoint.h>
+#include <lttng/notification/channel-internal.hpp>
+#include <lttng/notification/notification-internal.hpp>
+
+static int handshake(struct lttng_notification_channel *channel);
 
 /*
  * Populates the reception buffer with the next complete message.
  * The caller must acquire the channel's lock.
  */
-static
-int receive_message(struct lttng_notification_channel *channel)
+static int receive_message(struct lttng_notification_channel *channel)
 {
        ssize_t ret;
        struct lttng_notification_channel_message msg;
@@ -47,8 +46,7 @@ int receive_message(struct lttng_notification_channel *channel)
        }
 
        /* Add message header at buffer's start. */
-       ret = lttng_dynamic_buffer_append(&channel->reception_payload.buffer, &msg,
-                       sizeof(msg));
+       ret = lttng_dynamic_buffer_append(&channel->reception_payload.buffer, &msg, sizeof(msg));
        if (ret) {
                goto error;
        }
@@ -59,14 +57,14 @@ int receive_message(struct lttng_notification_channel *channel)
 
        /* Reserve space for the payload. */
        ret = lttng_dynamic_buffer_set_size(&channel->reception_payload.buffer,
-                       channel->reception_payload.buffer.size + msg.size);
+                                           channel->reception_payload.buffer.size + msg.size);
        if (ret) {
                goto error;
        }
 
        /* Receive message payload. */
-       ret = lttcomm_recv_unix_sock(channel->socket,
-                       channel->reception_payload.buffer.data + sizeof(msg), msg.size);
+       ret = lttcomm_recv_unix_sock(
+               channel->socket, channel->reception_payload.buffer.data + sizeof(msg), msg.size);
        if (ret < (ssize_t) msg.size) {
                ret = -1;
                goto error;
@@ -75,8 +73,8 @@ int receive_message(struct lttng_notification_channel *channel)
 skip_payload:
        /* Receive message fds. */
        if (msg.fds != 0) {
-               ret = lttcomm_recv_payload_fds_unix_sock(channel->socket,
-                               msg.fds, &channel->reception_payload);
+               ret = lttcomm_recv_payload_fds_unix_sock(
+                       channel->socket, msg.fds, &channel->reception_payload);
                if (ret < sizeof(int) * msg.fds) {
                        ret = -1;
                        goto error;
@@ -90,43 +88,40 @@ error:
        goto end;
 }
 
-static
-enum lttng_notification_channel_message_type get_current_message_type(
-               struct lttng_notification_channel *channel)
+static enum lttng_notification_channel_message_type
+get_current_message_type(struct lttng_notification_channel *channel)
 {
        struct lttng_notification_channel_message *msg;
 
        LTTNG_ASSERT(channel->reception_payload.buffer.size >= sizeof(*msg));
 
-       msg = (struct lttng_notification_channel_message *)
-                       channel->reception_payload.buffer.data;
+       msg = (struct lttng_notification_channel_message *) channel->reception_payload.buffer.data;
        return (enum lttng_notification_channel_message_type) msg->type;
 }
 
-static
-struct lttng_notification *create_notification_from_current_message(
-               struct lttng_notification_channel *channel)
+static struct lttng_notification *
+create_notification_from_current_message(struct lttng_notification_channel *channel)
 {
        ssize_t ret;
        struct lttng_notification *notification = NULL;
 
        if (channel->reception_payload.buffer.size <=
-                       sizeof(struct lttng_notification_channel_message)) {
+           sizeof(struct lttng_notification_channel_message)) {
                goto end;
        }
 
        {
                struct lttng_payload_view view = lttng_payload_view_from_payload(
-                               &channel->reception_payload,
-                               sizeof(struct lttng_notification_channel_message),
-                               -1);
+                       &channel->reception_payload,
+                       sizeof(struct lttng_notification_channel_message),
+                       -1);
 
-               ret = lttng_notification_create_from_payload(
-                               &view, &notification);
+               ret = lttng_notification_create_from_payload(&view, &notification);
        }
 
-       if (ret != channel->reception_payload.buffer.size -
-                       sizeof(struct lttng_notification_channel_message)) {
+       if (ret !=
+           channel->reception_payload.buffer.size -
+                   sizeof(struct lttng_notification_channel_message)) {
                lttng_notification_destroy(notification);
                notification = NULL;
                goto end;
@@ -135,16 +130,15 @@ end:
        return notification;
 }
 
-struct lttng_notification_channel *lttng_notification_channel_create(
-               struct lttng_endpoint *endpoint)
+struct lttng_notification_channel *
+lttng_notification_channel_create(struct lttng_endpoint *endpoint)
 {
        int fd, ret;
        bool is_in_tracing_group = false, is_root = false;
        char *sock_path = NULL;
        struct lttng_notification_channel *channel = NULL;
 
-       if (!endpoint ||
-                       endpoint != lttng_session_daemon_notification_endpoint) {
+       if (!endpoint || endpoint != lttng_session_daemon_notification_endpoint) {
                goto end;
        }
 
@@ -168,9 +162,8 @@ struct lttng_notification_channel *lttng_notification_channel_create(
        }
 
        if (is_root || is_in_tracing_group) {
-               ret = lttng_strncpy(sock_path,
-                               DEFAULT_GLOBAL_NOTIFICATION_CHANNEL_UNIX_SOCK,
-                               LTTNG_PATH_MAX);
+               ret = lttng_strncpy(
+                       sock_path, DEFAULT_GLOBAL_NOTIFICATION_CHANNEL_UNIX_SOCK, LTTNG_PATH_MAX);
                if (ret) {
                        ret = -LTTNG_ERR_INVALID;
                        goto error;
@@ -184,9 +177,10 @@ struct lttng_notification_channel *lttng_notification_channel_create(
        }
 
        /* Fallback to local session daemon. */
-       ret = snprintf(sock_path, LTTNG_PATH_MAX,
-                       DEFAULT_HOME_NOTIFICATION_CHANNEL_UNIX_SOCK,
-                       utils_get_home_dir());
+       ret = snprintf(sock_path,
+                      LTTNG_PATH_MAX,
+                      DEFAULT_HOME_NOTIFICATION_CHANNEL_UNIX_SOCK,
+                      utils_get_home_dir());
        if (ret < 0 || ret >= LTTNG_PATH_MAX) {
                goto error;
        }
@@ -214,14 +208,12 @@ error:
 }
 
 enum lttng_notification_channel_status
-lttng_notification_channel_get_next_notification(
-               struct lttng_notification_channel *channel,
-               struct lttng_notification **_notification)
+lttng_notification_channel_get_next_notification(struct lttng_notification_channel *channel,
+                                                struct lttng_notification **_notification)
 {
        int ret;
        struct lttng_notification *notification = NULL;
-       enum lttng_notification_channel_status status =
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
+       enum lttng_notification_channel_status status = LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
        struct lttng_poll_event events;
 
        if (!channel || !_notification) {
@@ -238,9 +230,7 @@ lttng_notification_channel_get_next_notification(
 
                /* Deliver one of the pending notifications. */
                pending_notification = cds_list_first_entry(
-                               &channel->pending_notifications.list,
-                               struct pending_notification,
-                               node);
+                       &channel->pending_notifications.list, struct pending_notification, node);
                notification = pending_notification->notification;
                if (!notification) {
                        status = LTTNG_NOTIFICATION_CHANNEL_STATUS_NOTIFICATIONS_DROPPED;
@@ -289,8 +279,7 @@ lttng_notification_channel_get_next_notification(
 
        switch (get_current_message_type(channel)) {
        case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION:
-               notification = create_notification_from_current_message(
-                               channel);
+               notification = create_notification_from_current_message(channel);
                if (!notification) {
                        status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
                        goto end_clean_poll;
@@ -315,17 +304,13 @@ end:
        return status;
 }
 
-static
-int enqueue_dropped_notification(
-               struct lttng_notification_channel *channel)
+static int enqueue_dropped_notification(struct lttng_notification_channel *channel)
 {
        int ret = 0;
        struct pending_notification *pending_notification;
-       struct cds_list_head *last_element =
-                       channel->pending_notifications.list.prev;
+       struct cds_list_head *last_element = channel->pending_notifications.list.prev;
 
-       pending_notification = caa_container_of(last_element,
-                       struct pending_notification, node);
+       pending_notification = caa_container_of(last_element, struct pending_notification, node);
        if (!pending_notification->notification) {
                /*
                 * The last enqueued notification indicates dropped
@@ -335,15 +320,13 @@ int enqueue_dropped_notification(
                goto end;
        }
 
-       if (channel->pending_notifications.count >=
-                       DEFAULT_CLIENT_MAX_QUEUED_NOTIFICATIONS_COUNT &&
-                       pending_notification->notification) {
+       if (channel->pending_notifications.count >= DEFAULT_CLIENT_MAX_QUEUED_NOTIFICATIONS_COUNT &&
+           pending_notification->notification) {
                /*
                 * Discard the last enqueued notification to indicate
                 * that notifications were dropped at this point.
                 */
-               lttng_notification_destroy(
-                               pending_notification->notification);
+               lttng_notification_destroy(pending_notification->notification);
                pending_notification->notification = NULL;
                goto end;
        }
@@ -354,23 +337,19 @@ int enqueue_dropped_notification(
                goto end;
        }
        CDS_INIT_LIST_HEAD(&pending_notification->node);
-       cds_list_add(&pending_notification->node,
-                       &channel->pending_notifications.list);
+       cds_list_add(&pending_notification->node, &channel->pending_notifications.list);
        channel->pending_notifications.count++;
 end:
        return ret;
 }
 
-static
-int enqueue_notification_from_current_message(
-               struct lttng_notification_channel *channel)
+static int enqueue_notification_from_current_message(struct lttng_notification_channel *channel)
 {
        int ret = 0;
        struct lttng_notification *notification;
        struct pending_notification *pending_notification;
 
-       if (channel->pending_notifications.count >=
-                       DEFAULT_CLIENT_MAX_QUEUED_NOTIFICATIONS_COUNT) {
+       if (channel->pending_notifications.count >= DEFAULT_CLIENT_MAX_QUEUED_NOTIFICATIONS_COUNT) {
                /* Drop the notification. */
                ret = enqueue_dropped_notification(channel);
                goto end;
@@ -390,8 +369,7 @@ int enqueue_notification_from_current_message(
        }
 
        pending_notification->notification = notification;
-       cds_list_add(&pending_notification->node,
-                       &channel->pending_notifications.list);
+       cds_list_add(&pending_notification->node, &channel->pending_notifications.list);
        channel->pending_notifications.count++;
 end:
        return ret;
@@ -401,13 +379,11 @@ error:
 }
 
 enum lttng_notification_channel_status
-lttng_notification_channel_has_pending_notification(
-               struct lttng_notification_channel *channel,
-               bool *_notification_pending)
+lttng_notification_channel_has_pending_notification(struct lttng_notification_channel *channel,
+                                                   bool *_notification_pending)
 {
        int ret;
-       enum lttng_notification_channel_status status =
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
+       enum lttng_notification_channel_status status = LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
        struct lttng_poll_event events;
 
        if (!channel || !_notification_pending) {
@@ -500,9 +476,8 @@ end:
        return status;
 }
 
-static
-int receive_command_reply(struct lttng_notification_channel *channel,
-               enum lttng_notification_channel_status *status)
+static int receive_command_reply(struct lttng_notification_channel *channel,
+                                enum lttng_notification_channel_status *status)
 {
        int ret;
        struct lttng_notification_channel_command_reply *reply;
@@ -520,8 +495,7 @@ int receive_command_reply(struct lttng_notification_channel *channel,
                case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_COMMAND_REPLY:
                        goto exit_loop;
                case LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION:
-                       ret = enqueue_notification_from_current_message(
-                                       channel);
+                       ret = enqueue_notification_from_current_message(channel);
                        if (ret) {
                                goto end;
                        }
@@ -536,9 +510,9 @@ int receive_command_reply(struct lttng_notification_channel *channel,
                {
                        struct lttng_notification_channel_command_handshake *handshake;
 
-                       handshake = (struct lttng_notification_channel_command_handshake *)
-                                       (channel->reception_payload.buffer.data +
-                                       sizeof(struct lttng_notification_channel_message));
+                       handshake = (struct lttng_notification_channel_command_handshake
+                                            *) (channel->reception_payload.buffer.data +
+                                                sizeof(struct lttng_notification_channel_message));
                        channel->version.major = handshake->major;
                        channel->version.minor = handshake->minor;
                        channel->version.set = true;
@@ -552,27 +526,24 @@ int receive_command_reply(struct lttng_notification_channel *channel,
 
 exit_loop:
        if (channel->reception_payload.buffer.size <
-                       (sizeof(struct lttng_notification_channel_message) +
-                       sizeof(*reply))) {
+           (sizeof(struct lttng_notification_channel_message) + sizeof(*reply))) {
                /* Invalid message received. */
                ret = -1;
                goto end;
        }
 
-       reply = (struct lttng_notification_channel_command_reply *)
-                       (channel->reception_payload.buffer.data +
-                       sizeof(struct lttng_notification_channel_message));
+       reply = (struct lttng_notification_channel_command_reply
+                        *) (channel->reception_payload.buffer.data +
+                            sizeof(struct lttng_notification_channel_message));
        *status = (enum lttng_notification_channel_status) reply->status;
 end:
        return ret;
 }
 
-static
-int handshake(struct lttng_notification_channel *channel)
+static int handshake(struct lttng_notification_channel *channel)
 {
        ssize_t ret;
-       enum lttng_notification_channel_status status =
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
+       enum lttng_notification_channel_status status = LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
        struct lttng_notification_channel_command_handshake handshake = {
                .major = LTTNG_NOTIFICATION_CHANNEL_VERSION_MAJOR,
                .minor = LTTNG_NOTIFICATION_CHANNEL_VERSION_MINOR,
@@ -589,8 +560,7 @@ int handshake(struct lttng_notification_channel *channel)
 
        pthread_mutex_lock(&channel->lock);
 
-       ret = lttcomm_send_creds_unix_sock(channel->socket, send_buffer,
-                       sizeof(send_buffer));
+       ret = lttcomm_send_creds_unix_sock(channel->socket, send_buffer, sizeof(send_buffer));
        if (ret < 0) {
                goto end_unlock;
        }
@@ -616,16 +586,14 @@ end_unlock:
        return ret;
 }
 
-static
-enum lttng_notification_channel_status send_condition_command(
-               struct lttng_notification_channel *channel,
-               enum lttng_notification_channel_message_type type,
-               const struct lttng_condition *condition)
+static enum lttng_notification_channel_status
+send_condition_command(struct lttng_notification_channel *channel,
+                      enum lttng_notification_channel_message_type type,
+                      const struct lttng_condition *condition)
 {
        int socket;
        ssize_t ret;
-       enum lttng_notification_channel_status status =
-                       LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
+       enum lttng_notification_channel_status status = LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
        struct lttng_payload payload;
        struct lttng_notification_channel_message cmd_header;
 
@@ -641,7 +609,7 @@ enum lttng_notification_channel_status send_condition_command(
        }
 
        LTTNG_ASSERT(type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE ||
-               type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNSUBSCRIBE);
+                    type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNSUBSCRIBE);
 
        pthread_mutex_lock(&channel->lock);
        socket = channel->socket;
@@ -651,8 +619,7 @@ enum lttng_notification_channel_status send_condition_command(
                goto end_unlock;
        }
 
-       ret = lttng_dynamic_buffer_append(&payload.buffer, &cmd_header,
-                       sizeof(cmd_header));
+       ret = lttng_dynamic_buffer_append(&payload.buffer, &cmd_header, sizeof(cmd_header));
        if (ret) {
                status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
                goto end_unlock;
@@ -666,21 +633,17 @@ enum lttng_notification_channel_status send_condition_command(
 
        /* Update payload length. */
        ((struct lttng_notification_channel_message *) payload.buffer.data)->size =
-                       (uint32_t) (payload.buffer.size - sizeof(cmd_header));
+               (uint32_t) (payload.buffer.size - sizeof(cmd_header));
 
        {
-               struct lttng_payload_view pv =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
-               const int fd_count =
-                               lttng_payload_view_get_fd_handle_count(&pv);
+               struct lttng_payload_view pv = lttng_payload_view_from_payload(&payload, 0, -1);
+               const int fd_count = lttng_payload_view_get_fd_handle_count(&pv);
 
                /* Update fd count. */
                ((struct lttng_notification_channel_message *) payload.buffer.data)->fds =
                        (uint32_t) fd_count;
 
-               ret = lttcomm_send_unix_sock(
-                       socket, pv.buffer.data, pv.buffer.size);
+               ret = lttcomm_send_unix_sock(socket, pv.buffer.data, pv.buffer.size);
                if (ret < 0) {
                        status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
                        goto end_unlock;
@@ -688,8 +651,7 @@ enum lttng_notification_channel_status send_condition_command(
 
                /* Pass fds if present. */
                if (fd_count > 0) {
-                       ret = lttcomm_send_payload_view_fds_unix_sock(socket,
-                                       &pv);
+                       ret = lttcomm_send_payload_view_fds_unix_sock(socket, &pv);
                        if (ret < 0) {
                                status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
                                goto end_unlock;
@@ -709,26 +671,23 @@ end:
        return status;
 }
 
-enum lttng_notification_channel_status lttng_notification_channel_subscribe(
-               struct lttng_notification_channel *channel,
-               const struct lttng_condition *condition)
+enum lttng_notification_channel_status
+lttng_notification_channel_subscribe(struct lttng_notification_channel *channel,
+                                    const struct lttng_condition *condition)
 {
-       return send_condition_command(channel,
-                       LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE,
-                       condition);
+       return send_condition_command(
+               channel, LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE, condition);
 }
 
-enum lttng_notification_channel_status lttng_notification_channel_unsubscribe(
-               struct lttng_notification_channel *channel,
-               const struct lttng_condition *condition)
+enum lttng_notification_channel_status
+lttng_notification_channel_unsubscribe(struct lttng_notification_channel *channel,
+                                      const struct lttng_condition *condition)
 {
-       return send_condition_command(channel,
-                       LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNSUBSCRIBE,
-                       condition);
+       return send_condition_command(
+               channel, LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNSUBSCRIBE, condition);
 }
 
-void lttng_notification_channel_destroy(
-               struct lttng_notification_channel *channel)
+void lttng_notification_channel_destroy(struct lttng_notification_channel *channel)
 {
        if (!channel) {
                return;
index 870935bd3280d527ace8d40444d43ea5d3864eb3..4b5974612d14b9b5e284c535f3fcd486bf7cdd40 100644 (file)
@@ -7,20 +7,21 @@
  */
 
 #define _LGPL_SOURCE
-#include <algorithm>
-#include <string.h>
+#include "lttng-ctl-helper.hpp"
 
-#include <lttng/lttng-error.h>
-#include <lttng/clear.h>
-#include <lttng/clear-handle.h>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/macros.hpp>
+#include <common/buffer-view.hpp>
 #include <common/compat/poll.hpp>
 #include <common/dynamic-buffer.hpp>
-#include <common/buffer-view.hpp>
+#include <common/macros.hpp>
 #include <common/optional.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
 
-#include "lttng-ctl-helper.hpp"
+#include <lttng/clear-handle.h>
+#include <lttng/clear.h>
+#include <lttng/lttng-error.h>
+
+#include <algorithm>
+#include <string.h>
 
 enum communication_state {
        COMMUNICATION_STATE_RECEIVE_LTTNG_MSG,
@@ -60,8 +61,7 @@ void lttng_clear_handle_destroy(struct lttng_clear_handle *handle)
        free(handle);
 }
 
-static
-struct lttng_clear_handle *lttng_clear_handle_create(int sessiond_socket)
+static struct lttng_clear_handle *lttng_clear_handle_create(int sessiond_socket)
 {
        int ret;
        struct lttng_clear_handle *handle = zmalloc<lttng_clear_handle>();
@@ -76,14 +76,12 @@ struct lttng_clear_handle *lttng_clear_handle_create(int sessiond_socket)
                goto error;
        }
 
-       ret = lttng_poll_add(&handle->communication.events, sessiond_socket,
-                       LPOLLIN | LPOLLRDHUP);
+       ret = lttng_poll_add(&handle->communication.events, sessiond_socket, LPOLLIN | LPOLLRDHUP);
        if (ret) {
                goto error;
        }
 
-       handle->communication.bytes_left_to_receive =
-                       sizeof(struct lttcomm_lttng_msg);
+       handle->communication.bytes_left_to_receive = sizeof(struct lttcomm_lttng_msg);
        handle->communication.state = COMMUNICATION_STATE_RECEIVE_LTTNG_MSG;
 end:
        return handle;
@@ -92,8 +90,7 @@ error:
        return NULL;
 }
 
-static
-int handle_state_transition(struct lttng_clear_handle *handle)
+static int handle_state_transition(struct lttng_clear_handle *handle)
 {
        int ret = 0;
 
@@ -103,10 +100,10 @@ int handle_state_transition(struct lttng_clear_handle *handle)
        case COMMUNICATION_STATE_RECEIVE_LTTNG_MSG:
        {
                const struct lttcomm_lttng_msg *msg =
-                               (typeof(msg)) handle->communication.buffer.data;
+                       (typeof(msg)) handle->communication.buffer.data;
 
                LTTNG_OPTIONAL_SET(&handle->clear_return_code,
-                               (enum lttng_error_code) msg->ret_code);
+                                  (enum lttng_error_code) msg->ret_code);
                if (handle->clear_return_code.value != LTTNG_OK) {
                        handle->communication.state = COMMUNICATION_STATE_END;
                        break;
@@ -119,8 +116,7 @@ int handle_state_transition(struct lttng_clear_handle *handle)
                handle->communication.state = COMMUNICATION_STATE_END;
                handle->communication.bytes_left_to_receive = 0;
                LTTNG_OPTIONAL_SET(&handle->communication.data_size, 0);
-               ret = lttng_dynamic_buffer_set_size(
-                               &handle->communication.buffer, 0);
+               ret = lttng_dynamic_buffer_set_size(&handle->communication.buffer, 0);
                LTTNG_ASSERT(!ret);
                break;
        }
@@ -135,8 +131,7 @@ int handle_state_transition(struct lttng_clear_handle *handle)
        return ret;
 }
 
-static
-int handle_incoming_data(struct lttng_clear_handle *handle)
+static int handle_incoming_data(struct lttng_clear_handle *handle)
 {
        int ret;
        ssize_t comm_ret;
@@ -144,14 +139,15 @@ int handle_incoming_data(struct lttng_clear_handle *handle)
 
        /* Reserve space for reception. */
        ret = lttng_dynamic_buffer_set_size(&handle->communication.buffer,
-                       original_buffer_size + handle->communication.bytes_left_to_receive);
+                                           original_buffer_size +
+                                                   handle->communication.bytes_left_to_receive);
        if (ret) {
                goto end;
        }
 
        comm_ret = lttcomm_recv_unix_sock(handle->communication.socket,
-                       handle->communication.buffer.data + original_buffer_size,
-                       handle->communication.bytes_left_to_receive);
+                                         handle->communication.buffer.data + original_buffer_size,
+                                         handle->communication.bytes_left_to_receive);
        if (comm_ret <= 0) {
                ret = -1;
                goto end;
@@ -161,17 +157,15 @@ int handle_incoming_data(struct lttng_clear_handle *handle)
        if (handle->communication.bytes_left_to_receive == 0) {
                ret = handle_state_transition(handle);
        } else {
-               ret = lttng_dynamic_buffer_set_size(
-                               &handle->communication.buffer,
-                               original_buffer_size + comm_ret);
+               ret = lttng_dynamic_buffer_set_size(&handle->communication.buffer,
+                                                   original_buffer_size + comm_ret);
        }
 end:
        return ret;
 }
 
 extern enum lttng_clear_handle_status
-       lttng_clear_handle_wait_for_completion(
-               struct lttng_clear_handle *handle, int timeout_ms)
+lttng_clear_handle_wait_for_completion(struct lttng_clear_handle *handle, int timeout_ms)
 {
        enum lttng_clear_handle_status status;
        unsigned long time_left_ms = 0;
@@ -195,14 +189,14 @@ extern enum lttng_clear_handle_status
        }
 
        while (handle->communication.state != COMMUNICATION_STATE_END &&
-                       (time_left_ms || !has_timeout)) {
+              (time_left_ms || !has_timeout)) {
                int ret;
                uint32_t revents;
                struct timespec current_time, diff;
                unsigned long diff_ms;
 
                ret = lttng_poll_wait(&handle->communication.events,
-                               has_timeout ? time_left_ms : -1);
+                                     has_timeout ? time_left_ms : -1);
                if (ret == 0) {
                        /* timeout */
                        break;
@@ -216,8 +210,7 @@ extern enum lttng_clear_handle_status
                if (revents & LPOLLIN) {
                        ret = handle_incoming_data(handle);
                        if (ret) {
-                               handle->communication.state =
-                                               COMMUNICATION_STATE_ERROR;
+                               handle->communication.state = COMMUNICATION_STATE_ERROR;
                                status = LTTNG_CLEAR_HANDLE_STATUS_ERROR;
                                goto end;
                        }
@@ -242,27 +235,24 @@ extern enum lttng_clear_handle_status
                        status = LTTNG_CLEAR_HANDLE_STATUS_ERROR;
                        goto end;
                }
-               DBG("%lums elapsed while waiting for session clear completion",
-                               diff_ms);
+               DBG("%lums elapsed while waiting for session clear completion", diff_ms);
                diff_ms = std::max(diff_ms, 1UL);
                diff_ms = std::min(diff_ms, time_left_ms);
                time_left_ms -= diff_ms;
        }
 
        status = handle->communication.state == COMMUNICATION_STATE_END ?
-                       LTTNG_CLEAR_HANDLE_STATUS_COMPLETED :
-                       LTTNG_CLEAR_HANDLE_STATUS_TIMEOUT;
+               LTTNG_CLEAR_HANDLE_STATUS_COMPLETED :
+               LTTNG_CLEAR_HANDLE_STATUS_TIMEOUT;
 end:
        return status;
 }
 
 extern enum lttng_clear_handle_status
-       lttng_clear_handle_get_result(
-               const struct lttng_clear_handle *handle,
-               enum lttng_error_code *result)
+lttng_clear_handle_get_result(const struct lttng_clear_handle *handle,
+                             enum lttng_error_code *result)
 {
-       enum lttng_clear_handle_status status =
-                       LTTNG_CLEAR_HANDLE_STATUS_OK;
+       enum lttng_clear_handle_status status = LTTNG_CLEAR_HANDLE_STATUS_OK;
 
        if (!handle->clear_return_code.is_set) {
                status = LTTNG_CLEAR_HANDLE_STATUS_INVALID;
@@ -277,7 +267,7 @@ end:
  * Clear the session
  */
 enum lttng_error_code lttng_clear_session(const char *session_name,
-               struct lttng_clear_handle **_handle)
+                                         struct lttng_clear_handle **_handle)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
        struct lttng_clear_handle *handle = NULL;
@@ -296,8 +286,7 @@ enum lttng_error_code lttng_clear_session(const char *session_name,
                ret_code = LTTNG_ERR_INVALID;
                goto error;
        }
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret_code = LTTNG_ERR_INVALID;
                goto error;
index 0eaf507c29da390968111391c87827472716f483..00d76a4b8b72cbccdfc89115e6fc0aa0f629e8c7 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <lttng/lttng-export.h>
+
 #include <stddef.h>
 
 /*
index 688e4faba652dd023d47f9ff131fab9ee8b8e3f6..d77554a588fb58da04a2db7e066b3c95dedffff0 100644 (file)
@@ -5,19 +5,19 @@
  *
  */
 
-#include <lttng/destruction-handle.h>
-#include <lttng/rotation.h>
+#include "lttng-ctl-helper.hpp"
 
-#include <common/optional.hpp>
+#include <common/buffer-view.hpp>
 #include <common/compat/poll.hpp>
 #include <common/compat/time.hpp>
-#include <common/macros.hpp>
-#include <common/compat/poll.hpp>
 #include <common/dynamic-buffer.hpp>
-#include <common/buffer-view.hpp>
+#include <common/macros.hpp>
+#include <common/optional.hpp>
 #include <common/sessiond-comm/sessiond-comm.hpp>
+
+#include <lttng/destruction-handle.h>
 #include <lttng/location-internal.hpp>
-#include "lttng-ctl-helper.hpp"
+#include <lttng/rotation.h>
 
 #include <algorithm>
 #include <stdbool.h>
@@ -64,9 +64,7 @@ void lttng_destruction_handle_destroy(struct lttng_destruction_handle *handle)
        free(handle);
 }
 
-static
-struct lttng_destruction_handle *lttng_destruction_handle_create(
-               int sessiond_socket)
+static struct lttng_destruction_handle *lttng_destruction_handle_create(int sessiond_socket)
 {
        int ret;
        struct lttng_destruction_handle *handle = zmalloc<lttng_destruction_handle>();
@@ -81,14 +79,12 @@ struct lttng_destruction_handle *lttng_destruction_handle_create(
                goto error;
        }
 
-       ret = lttng_poll_add(&handle->communication.events, sessiond_socket,
-                       LPOLLIN | LPOLLRDHUP);
+       ret = lttng_poll_add(&handle->communication.events, sessiond_socket, LPOLLIN | LPOLLRDHUP);
        if (ret) {
                goto error;
        }
 
-       handle->communication.bytes_left_to_receive =
-                       sizeof(struct lttcomm_lttng_msg);
+       handle->communication.bytes_left_to_receive = sizeof(struct lttcomm_lttng_msg);
        handle->communication.state = COMMUNICATION_STATE_RECEIVE_LTTNG_MSG;
 end:
        return handle;
@@ -97,8 +93,7 @@ error:
        return NULL;
 }
 
-static
-int handle_state_transition(struct lttng_destruction_handle *handle)
+static int handle_state_transition(struct lttng_destruction_handle *handle)
 {
        int ret = 0;
 
@@ -108,44 +103,40 @@ int handle_state_transition(struct lttng_destruction_handle *handle)
        case COMMUNICATION_STATE_RECEIVE_LTTNG_MSG:
        {
                const struct lttcomm_lttng_msg *msg =
-                               (typeof(msg)) handle->communication.buffer.data;
+                       (typeof(msg)) handle->communication.buffer.data;
 
                LTTNG_OPTIONAL_SET(&handle->destruction_return_code,
-                               (enum lttng_error_code) msg->ret_code);
+                                  (enum lttng_error_code) msg->ret_code);
                if (handle->destruction_return_code.value != LTTNG_OK) {
                        handle->communication.state = COMMUNICATION_STATE_END;
                        break;
-               } else if (msg->cmd_header_size != sizeof(struct lttcomm_session_destroy_command_header) ||
-                               msg->data_size > DEFAULT_MAX_TRACE_ARCHIVE_LOCATION_PAYLOAD_SIZE) {
+               } else if (msg->cmd_header_size !=
+                                  sizeof(struct lttcomm_session_destroy_command_header) ||
+                          msg->data_size > DEFAULT_MAX_TRACE_ARCHIVE_LOCATION_PAYLOAD_SIZE) {
                        handle->communication.state = COMMUNICATION_STATE_ERROR;
                        ret = -1;
                        break;
                }
 
-               handle->communication.state =
-                               COMMUNICATION_STATE_RECEIVE_COMMAND_HEADER;
-               handle->communication.bytes_left_to_receive =
-                               msg->cmd_header_size;
-               LTTNG_OPTIONAL_SET(&handle->communication.data_size,
-                               msg->data_size);
-               ret = lttng_dynamic_buffer_set_size(
-                               &handle->communication.buffer, 0);
+               handle->communication.state = COMMUNICATION_STATE_RECEIVE_COMMAND_HEADER;
+               handle->communication.bytes_left_to_receive = msg->cmd_header_size;
+               LTTNG_OPTIONAL_SET(&handle->communication.data_size, msg->data_size);
+               ret = lttng_dynamic_buffer_set_size(&handle->communication.buffer, 0);
                LTTNG_ASSERT(!ret);
                break;
        }
        case COMMUNICATION_STATE_RECEIVE_COMMAND_HEADER:
        {
                const struct lttcomm_session_destroy_command_header *hdr =
-                               (typeof(hdr)) handle->communication.buffer.data;
+                       (typeof(hdr)) handle->communication.buffer.data;
 
                LTTNG_OPTIONAL_SET(&handle->rotation_state,
-                               (enum lttng_rotation_state) hdr->rotation_state);
+                                  (enum lttng_rotation_state) hdr->rotation_state);
                switch (handle->rotation_state.value) {
                case LTTNG_ROTATION_STATE_COMPLETED:
-                       handle->communication.state =
-                                       COMMUNICATION_STATE_RECEIVE_PAYLOAD;
+                       handle->communication.state = COMMUNICATION_STATE_RECEIVE_PAYLOAD;
                        handle->communication.bytes_left_to_receive =
-                                       LTTNG_OPTIONAL_GET(handle->communication.data_size);
+                               LTTNG_OPTIONAL_GET(handle->communication.data_size);
                        break;
                case LTTNG_ROTATION_STATE_ERROR:
                case LTTNG_ROTATION_STATE_NO_ROTATION:
@@ -163,11 +154,9 @@ int handle_state_transition(struct lttng_destruction_handle *handle)
                ssize_t location_ret;
                struct lttng_trace_archive_location *location;
                const struct lttng_buffer_view view =
-                               lttng_buffer_view_from_dynamic_buffer(
-                                       &handle->communication.buffer, 0, -1);
+                       lttng_buffer_view_from_dynamic_buffer(&handle->communication.buffer, 0, -1);
 
-               location_ret = lttng_trace_archive_location_create_from_buffer(
-                               &view, &location);
+               location_ret = lttng_trace_archive_location_create_from_buffer(&view, &location);
                if (location_ret < 0) {
                        ERR("Failed to deserialize trace archive location");
                        handle->communication.state = COMMUNICATION_STATE_ERROR;
@@ -191,8 +180,7 @@ int handle_state_transition(struct lttng_destruction_handle *handle)
        return ret;
 }
 
-static
-int handle_incoming_data(struct lttng_destruction_handle *handle)
+static int handle_incoming_data(struct lttng_destruction_handle *handle)
 {
        int ret;
        ssize_t comm_ret;
@@ -200,14 +188,15 @@ int handle_incoming_data(struct lttng_destruction_handle *handle)
 
        /* Reserve space for reception. */
        ret = lttng_dynamic_buffer_set_size(&handle->communication.buffer,
-                       original_buffer_size + handle->communication.bytes_left_to_receive);
+                                           original_buffer_size +
+                                                   handle->communication.bytes_left_to_receive);
        if (ret) {
                goto end;
        }
 
        comm_ret = lttcomm_recv_unix_sock(handle->communication.socket,
-                       handle->communication.buffer.data + original_buffer_size,
-                       handle->communication.bytes_left_to_receive);
+                                         handle->communication.buffer.data + original_buffer_size,
+                                         handle->communication.bytes_left_to_receive);
        if (comm_ret <= 0) {
                ret = -1;
                goto end;
@@ -217,17 +206,16 @@ int handle_incoming_data(struct lttng_destruction_handle *handle)
        if (handle->communication.bytes_left_to_receive == 0) {
                ret = handle_state_transition(handle);
        } else {
-               ret = lttng_dynamic_buffer_set_size(
-                               &handle->communication.buffer,
-                               original_buffer_size + comm_ret);
+               ret = lttng_dynamic_buffer_set_size(&handle->communication.buffer,
+                                                   original_buffer_size + comm_ret);
        }
 end:
        return ret;
 }
 
 enum lttng_destruction_handle_status
-lttng_destruction_handle_wait_for_completion(
-               struct lttng_destruction_handle *handle, int timeout_ms)
+lttng_destruction_handle_wait_for_completion(struct lttng_destruction_handle *handle,
+                                            int timeout_ms)
 {
        enum lttng_destruction_handle_status status;
        unsigned long time_left_ms = 0;
@@ -256,14 +244,14 @@ lttng_destruction_handle_wait_for_completion(
        }
 
        while (handle->communication.state != COMMUNICATION_STATE_END &&
-                       (time_left_ms || !has_timeout)) {
+              (time_left_ms || !has_timeout)) {
                int ret;
                uint32_t revents;
                struct timespec current_time, diff;
                unsigned long diff_ms;
 
                ret = lttng_poll_wait(&handle->communication.events,
-                               has_timeout ? time_left_ms : -1);
+                                     has_timeout ? time_left_ms : -1);
                if (ret == 0) {
                        /* timeout */
                        break;
@@ -277,8 +265,7 @@ lttng_destruction_handle_wait_for_completion(
                if (revents & LPOLLIN) {
                        ret = handle_incoming_data(handle);
                        if (ret) {
-                               handle->communication.state =
-                                               COMMUNICATION_STATE_ERROR;
+                               handle->communication.state = COMMUNICATION_STATE_ERROR;
                                status = LTTNG_DESTRUCTION_HANDLE_STATUS_ERROR;
                                goto end;
                        }
@@ -303,27 +290,24 @@ lttng_destruction_handle_wait_for_completion(
                        status = LTTNG_DESTRUCTION_HANDLE_STATUS_ERROR;
                        goto end;
                }
-               DBG("%lums elapsed while waiting for session destruction completion",
-                               diff_ms);
+               DBG("%lums elapsed while waiting for session destruction completion", diff_ms);
                diff_ms = std::max(diff_ms, 1UL);
                diff_ms = std::min(diff_ms, time_left_ms);
                time_left_ms -= diff_ms;
        }
 
        status = handle->communication.state == COMMUNICATION_STATE_END ?
-                       LTTNG_DESTRUCTION_HANDLE_STATUS_COMPLETED :
-                       LTTNG_DESTRUCTION_HANDLE_STATUS_TIMEOUT;
+               LTTNG_DESTRUCTION_HANDLE_STATUS_COMPLETED :
+               LTTNG_DESTRUCTION_HANDLE_STATUS_TIMEOUT;
 end:
        return status;
 }
 
 enum lttng_destruction_handle_status
-lttng_destruction_handle_get_rotation_state(
-               const struct lttng_destruction_handle *handle,
-               enum lttng_rotation_state *rotation_state)
+lttng_destruction_handle_get_rotation_state(const struct lttng_destruction_handle *handle,
+                                           enum lttng_rotation_state *rotation_state)
 {
-       enum lttng_destruction_handle_status status =
-                       LTTNG_DESTRUCTION_HANDLE_STATUS_OK;
+       enum lttng_destruction_handle_status status = LTTNG_DESTRUCTION_HANDLE_STATUS_OK;
 
        if (!handle || !rotation_state) {
                status = LTTNG_DESTRUCTION_HANDLE_STATUS_INVALID;
@@ -340,12 +324,10 @@ end:
 }
 
 enum lttng_destruction_handle_status
-lttng_destruction_handle_get_archive_location(
-               const struct lttng_destruction_handle *handle,
-               const struct lttng_trace_archive_location **location)
+lttng_destruction_handle_get_archive_location(const struct lttng_destruction_handle *handle,
+                                             const struct lttng_trace_archive_location **location)
 {
-       enum lttng_destruction_handle_status status =
-                       LTTNG_DESTRUCTION_HANDLE_STATUS_OK;
+       enum lttng_destruction_handle_status status = LTTNG_DESTRUCTION_HANDLE_STATUS_OK;
 
        if (!handle || !location) {
                status = LTTNG_DESTRUCTION_HANDLE_STATUS_INVALID;
@@ -362,12 +344,10 @@ end:
 }
 
 enum lttng_destruction_handle_status
-lttng_destruction_handle_get_result(
-               const struct lttng_destruction_handle *handle,
-               enum lttng_error_code *result)
+lttng_destruction_handle_get_result(const struct lttng_destruction_handle *handle,
+                                   enum lttng_error_code *result)
 {
-       enum lttng_destruction_handle_status status =
-                       LTTNG_DESTRUCTION_HANDLE_STATUS_OK;
+       enum lttng_destruction_handle_status status = LTTNG_DESTRUCTION_HANDLE_STATUS_OK;
 
        if (!handle || !result) {
                status = LTTNG_DESTRUCTION_HANDLE_STATUS_INVALID;
@@ -384,7 +364,7 @@ end:
 }
 
 enum lttng_error_code lttng_destroy_session_ext(const char *session_name,
-               struct lttng_destruction_handle **_handle)
+                                               struct lttng_destruction_handle **_handle)
 {
        int ret;
        ssize_t comm_ret;
@@ -404,8 +384,7 @@ enum lttng_error_code lttng_destroy_session_ext(const char *session_name,
                goto error;
        }
 
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret_code = LTTNG_ERR_INVALID;
                goto error;
index c33adf1197e15485469921417f5654c3958028b5..141fb56842ca5723d71444bf61bfd6d8aac3f99e 100644 (file)
  */
 
 #define _LGPL_SOURCE
-#include <stddef.h>
-
 #include <common/error.hpp>
 #include <common/sessiond-comm/sessiond-comm.hpp>
+
 #include <lttng/event-internal.hpp>
 #include <lttng/event.h>
 #include <lttng/lttng-error.h>
 #include <lttng/userspace-probe-internal.hpp>
 
+#include <stddef.h>
+
 struct lttng_event *lttng_event_create(void)
 {
        struct lttng_event *event;
@@ -56,16 +57,14 @@ void lttng_event_destroy(struct lttng_event *event)
 
        if (event_extended) {
                if (event_extended->probe_location) {
-                       lttng_userspace_probe_location_destroy(
-                               event_extended->probe_location);
+                       lttng_userspace_probe_location_destroy(event_extended->probe_location);
                }
                free(event_extended);
        }
        free(event);
 }
 
-int lttng_event_get_filter_expression(struct lttng_event *event,
-       const char **filter_expression)
+int lttng_event_get_filter_expression(struct lttng_event *event, const char **filter_expression)
 {
        int ret = 0;
        struct lttng_event_extended *event_extended;
@@ -119,7 +118,8 @@ end:
 }
 
 int lttng_event_get_exclusion_name(struct lttng_event *event,
-               size_t index, const char **exclusion_name)
+                                  size_t index,
+                                  const char **exclusion_name)
 {
        int ret = 0;
        struct lttng_event_extended *event_extended;
@@ -149,8 +149,7 @@ int lttng_event_get_exclusion_name(struct lttng_event *event,
                goto end;
        }
 
-       *exclusion_name = event_extended->exclusions.strings +
-               (index * LTTNG_SYMBOL_NAME_LEN);
+       *exclusion_name = event_extended->exclusions.strings + (index * LTTNG_SYMBOL_NAME_LEN);
 end:
        return ret;
 }
@@ -175,7 +174,7 @@ end:
 }
 
 int lttng_event_set_userspace_probe_location(struct lttng_event *event,
-               struct lttng_userspace_probe_location *probe_location)
+                                            struct lttng_userspace_probe_location *probe_location)
 {
        int ret = 0;
        struct lttng_event_extended *event_extended;
@@ -188,8 +187,7 @@ int lttng_event_set_userspace_probe_location(struct lttng_event *event,
        event_extended = (struct lttng_event_extended *) event->extended.ptr;
        LTTNG_ASSERT(event_extended);
        if (event_extended->probe_location) {
-               lttng_userspace_probe_location_destroy(
-                       event_extended->probe_location);
+               lttng_userspace_probe_location_destroy(event_extended->probe_location);
        }
        event_extended->probe_location = probe_location;
 end:
index eaab9905e78f5e1c5a6cc60bca19847d61db06c5..2477e24e3a86cd1eede61254cf5925f8c41941ed 100644 (file)
@@ -6,27 +6,27 @@
  */
 
 #define _LGPL_SOURCE
-#include <string.h>
-#include <limits.h>
+#include "lttng-ctl-helper.hpp"
 
-#include <lttng/lttng-error.h>
-#include <lttng/load.h>
-#include <lttng/load-internal.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/compat/string.hpp>
 #include <common/config/session-config.hpp>
-#include <common/uri.hpp>
 #include <common/macros.hpp>
-#include <common/compat/string.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/uri.hpp>
 
-#include "lttng-ctl-helper.hpp"
+#include <lttng/load-internal.hpp>
+#include <lttng/load.h>
+#include <lttng/lttng-error.h>
+
+#include <limits.h>
+#include <string.h>
 
 struct lttng_load_session_attr *lttng_load_session_attr_create(void)
 {
        return zmalloc<lttng_load_session_attr>();
 }
 
-static
-void reset_load_session_attr_urls(struct lttng_load_session_attr *attr)
+static void reset_load_session_attr_urls(struct lttng_load_session_attr *attr)
 {
        free(attr->raw_override_url);
        free(attr->raw_override_path_url);
@@ -66,8 +66,7 @@ static int validate_attr(const struct lttng_load_session_attr *attr)
         * Refuse override name if the objective is to load multiple session
         * since this operation is ambiguous while loading multiple session.
         */
-       if (attr->override_attr->session_name
-                       && attr->session_name[0] == '\0') {
+       if (attr->override_attr->session_name && attr->session_name[0] == '\0') {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -75,8 +74,7 @@ end:
        return ret;
 }
 
-const char *lttng_load_session_attr_get_session_name(
-       struct lttng_load_session_attr *attr)
+const char *lttng_load_session_attr_get_session_name(struct lttng_load_session_attr *attr)
 {
        const char *ret = NULL;
 
@@ -87,8 +85,7 @@ const char *lttng_load_session_attr_get_session_name(
        return ret;
 }
 
-const char *lttng_load_session_attr_get_input_url(
-       struct lttng_load_session_attr *attr)
+const char *lttng_load_session_attr_get_input_url(struct lttng_load_session_attr *attr)
 {
        const char *ret = NULL;
 
@@ -99,14 +96,12 @@ const char *lttng_load_session_attr_get_input_url(
        return ret;
 }
 
-int lttng_load_session_attr_get_overwrite(
-       struct lttng_load_session_attr *attr)
+int lttng_load_session_attr_get_overwrite(struct lttng_load_session_attr *attr)
 {
        return attr ? attr->overwrite : -LTTNG_ERR_INVALID;
 }
 
-const char *lttng_load_session_attr_get_override_ctrl_url(
-       struct lttng_load_session_attr *attr)
+const char *lttng_load_session_attr_get_override_ctrl_url(struct lttng_load_session_attr *attr)
 {
        const char *ret = NULL;
 
@@ -119,8 +114,7 @@ end:
        return ret;
 }
 
-const char *lttng_load_session_attr_get_override_data_url(
-       struct lttng_load_session_attr *attr)
+const char *lttng_load_session_attr_get_override_data_url(struct lttng_load_session_attr *attr)
 {
        const char *ret = NULL;
 
@@ -133,8 +127,7 @@ end:
        return ret;
 }
 
-const char *lttng_load_session_attr_get_override_url(
-               struct lttng_load_session_attr *attr)
+const char *lttng_load_session_attr_get_override_url(struct lttng_load_session_attr *attr)
 {
        const char *ret = NULL;
 
@@ -143,16 +136,14 @@ const char *lttng_load_session_attr_get_override_url(
        }
 
        if ((attr->override_attr->path_url ||
-               (attr->override_attr->ctrl_url &&
-                attr->override_attr->data_url))) {
+            (attr->override_attr->ctrl_url && attr->override_attr->data_url))) {
                ret = attr->raw_override_url;
        }
 end:
        return ret;
 }
 
-const char *lttng_load_session_attr_get_override_session_name(
-               struct lttng_load_session_attr *attr)
+const char *lttng_load_session_attr_get_override_session_name(struct lttng_load_session_attr *attr)
 {
        const char *ret = NULL;
 
@@ -165,8 +156,8 @@ end:
        return ret;
 }
 
-int lttng_load_session_attr_set_session_name(
-       struct lttng_load_session_attr *attr, const char *session_name)
+int lttng_load_session_attr_set_session_name(struct lttng_load_session_attr *attr,
+                                            const char *session_name)
 {
        int ret = 0;
 
@@ -184,8 +175,7 @@ int lttng_load_session_attr_set_session_name(
                        goto error;
                }
 
-               ret = lttng_strncpy(attr->session_name, session_name,
-                               sizeof(attr->session_name));
+               ret = lttng_strncpy(attr->session_name, session_name, sizeof(attr->session_name));
                if (ret) {
                        ret = -LTTNG_ERR_INVALID;
                        goto error;
@@ -197,8 +187,7 @@ error:
        return ret;
 }
 
-int lttng_load_session_attr_set_input_url(
-       struct lttng_load_session_attr *attr, const char *url)
+int lttng_load_session_attr_set_input_url(struct lttng_load_session_attr *attr, const char *url)
 {
        int ret = 0;
        size_t len;
@@ -229,8 +218,7 @@ int lttng_load_session_attr_set_input_url(
        }
 
        /* Copy string plus the NULL terminated byte. */
-       ret = lttng_strncpy(attr->input_url, uris[0].dst.path,
-                       sizeof(attr->input_url));
+       ret = lttng_strncpy(attr->input_url, uris[0].dst.path, sizeof(attr->input_url));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
@@ -242,8 +230,7 @@ error:
        return ret;
 }
 
-int lttng_load_session_attr_set_overwrite(
-       struct lttng_load_session_attr *attr, int overwrite)
+int lttng_load_session_attr_set_overwrite(struct lttng_load_session_attr *attr, int overwrite)
 {
        int ret = 0;
 
@@ -257,8 +244,8 @@ end:
        return ret;
 }
 
-int lttng_load_session_attr_set_override_ctrl_url(
-       struct lttng_load_session_attr *attr, const char *url)
+int lttng_load_session_attr_set_override_ctrl_url(struct lttng_load_session_attr *attr,
+                                                 const char *url)
 {
        int ret = 0;
        ssize_t ret_size;
@@ -341,8 +328,8 @@ end:
        return ret;
 }
 
-int lttng_load_session_attr_set_override_data_url(
-       struct lttng_load_session_attr *attr, const char *url)
+int lttng_load_session_attr_set_override_data_url(struct lttng_load_session_attr *attr,
+                                                 const char *url)
 {
        int ret = 0;
        ssize_t ret_size;
@@ -423,8 +410,7 @@ end:
        return ret;
 }
 
-int lttng_load_session_attr_set_override_url(
-               struct lttng_load_session_attr *attr, const char *url)
+int lttng_load_session_attr_set_override_url(struct lttng_load_session_attr *attr, const char *url)
 {
        int ret = 0;
        ssize_t ret_size;
@@ -568,13 +554,13 @@ end:
        return ret;
 }
 
-int lttng_load_session_attr_set_override_session_name(
-       struct lttng_load_session_attr *attr, const char *session_name)
+int lttng_load_session_attr_set_override_session_name(struct lttng_load_session_attr *attr,
+                                                     const char *session_name)
 {
        int ret = 0;
        size_t len;
 
-       if (!attr ||!session_name) {
+       if (!attr || !session_name) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -593,8 +579,7 @@ int lttng_load_session_attr_set_override_session_name(
                goto end;
        }
 
-       attr->override_attr->session_name = lttng_strndup(session_name,
-               len);
+       attr->override_attr->session_name = lttng_strndup(session_name, len);
        if (!attr->override_attr->session_name) {
                ret = -LTTNG_ERR_NOMEM;
                goto end;
@@ -619,11 +604,9 @@ int lttng_load_session(struct lttng_load_session_attr *attr)
        }
 
        url = attr->input_url[0] != '\0' ? attr->input_url : NULL;
-       session_name = attr->session_name[0] != '\0' ?
-                       attr->session_name : NULL;
+       session_name = attr->session_name[0] != '\0' ? attr->session_name : NULL;
 
-       ret = config_load_session(url, session_name, attr->overwrite, 0,
-                       attr->override_attr);
+       ret = config_load_session(url, session_name, attr->overwrite, 0, attr->override_attr);
 
 end:
        return ret;
index e3234d5d4e3ef75a70761ea20420cf500f356b8a..016e2a8a4b01c068dea859b3435457d8f90051f2 100644 (file)
  */
 
 #define _LGPL_SOURCE
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdint.h>
-#include <limits.h>
-#include <string.h>
-#include <lttng/health-internal.hpp>
+#include "lttng-ctl-helper.hpp"
 
-#include <bin/lttng-sessiond/health-sessiond.hpp>
-#include <bin/lttng-consumerd/health-consumerd.hpp>
-#include <bin/lttng-relayd/health-relayd.hpp>
+#include <common/compat/errno.hpp>
 #include <common/defaults.hpp>
 #include <common/utils.hpp>
-#include <common/compat/errno.hpp>
 
-#include "lttng-ctl-helper.hpp"
+#include <lttng/health-internal.hpp>
+
+#include <bin/lttng-consumerd/health-consumerd.hpp>
+#include <bin/lttng-relayd/health-relayd.hpp>
+#include <bin/lttng-sessiond/health-sessiond.hpp>
+#include <limits.h>
+#include <stdint.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 enum health_component {
        HEALTH_COMPONENT_SESSIOND,
@@ -50,10 +51,9 @@ struct lttng_health {
        struct lttng_health_thread thread[];
 };
 
-static
-const char *get_sessiond_thread_name(health_type_sessiond type) {
-       switch (type)
-       {
+static const char *get_sessiond_thread_name(health_type_sessiond type)
+{
+       switch (type) {
        case HEALTH_SESSIOND_TYPE_CMD:
                return "Session daemon command";
        case HEALTH_SESSIOND_TYPE_APP_MANAGE:
@@ -83,8 +83,8 @@ const char *get_sessiond_thread_name(health_type_sessiond type) {
        abort();
 };
 
-static
-const char *get_consumerd_thread_name(health_type_consumerd type) {
+static const char *get_consumerd_thread_name(health_type_consumerd type)
+{
        switch (type) {
        case HEALTH_CONSUMERD_TYPE_CHANNEL:
                return "Consumer daemon channel";
@@ -103,8 +103,7 @@ const char *get_consumerd_thread_name(health_type_consumerd type) {
        abort();
 };
 
-static
-const char *get_relayd_thread_name(health_type_relayd type)
+static const char *get_relayd_thread_name(health_type_relayd type)
 {
        switch (type) {
        case HEALTH_RELAYD_TYPE_DISPATCHER:
@@ -126,8 +125,7 @@ const char *get_relayd_thread_name(health_type_relayd type)
        abort();
 }
 
-static
-const char *get_thread_name(int comp, int nr)
+static const char *get_thread_name(int comp, int nr)
 {
        switch (comp) {
        case HEALTH_COMPONENT_SESSIOND:
@@ -148,9 +146,7 @@ const char *get_thread_name(int comp, int nr)
  *
  * Returns 0 on success or a negative errno.
  */
-static
-int set_health_socket_path(struct lttng_health *lh,
-               int tracing_group)
+static int set_health_socket_path(struct lttng_health *lh, int tracing_group)
 {
        uid_t uid;
        const char *home;
@@ -187,7 +183,7 @@ int set_health_socket_path(struct lttng_health *lh,
                } else {
                        return 0;
                }
-               break;  /* Unreached */
+               break; /* Unreached */
        default:
                return -EINVAL;
        }
@@ -195,9 +191,7 @@ int set_health_socket_path(struct lttng_health *lh,
        uid = getuid();
 
        if (uid == 0 || tracing_group) {
-               ret = lttng_strncpy(lh->health_sock_path,
-                               global_str,
-                               sizeof(lh->health_sock_path));
+               ret = lttng_strncpy(lh->health_sock_path, global_str, sizeof(lh->health_sock_path));
                return ret == 0 ? 0 : -EINVAL;
        }
 
@@ -214,8 +208,7 @@ int set_health_socket_path(struct lttng_health *lh,
 
        DIAGNOSTIC_PUSH
        DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
-       ret = snprintf(lh->health_sock_path, sizeof(lh->health_sock_path),
-                       home_str, home);
+       ret = snprintf(lh->health_sock_path, sizeof(lh->health_sock_path), home_str, home);
        DIAGNOSTIC_POP
        if ((ret < 0) || (ret >= sizeof(lh->health_sock_path))) {
                return -ENOMEM;
@@ -224,9 +217,7 @@ int set_health_socket_path(struct lttng_health *lh,
        return 0;
 }
 
-static
-struct lttng_health *lttng_health_create(enum health_component hc,
-               unsigned int nr_threads)
+static struct lttng_health *lttng_health_create(enum health_component hc, unsigned int nr_threads)
 {
        struct lttng_health *lh;
        int i;
@@ -237,7 +228,7 @@ struct lttng_health *lttng_health_create(enum health_component hc,
        }
 
        lh->component = hc;
-       lh->state = UINT64_MAX;         /* All bits in error initially */
+       lh->state = UINT64_MAX; /* All bits in error initially */
        lh->nr_threads = nr_threads;
        for (i = 0; i < nr_threads; i++) {
                lh->thread[i].p = lh;
@@ -249,21 +240,18 @@ struct lttng_health *lttng_health_create_sessiond(void)
 {
        struct lttng_health *lh;
 
-       lh = lttng_health_create(HEALTH_COMPONENT_SESSIOND,
-                       NR_HEALTH_SESSIOND_TYPES);
+       lh = lttng_health_create(HEALTH_COMPONENT_SESSIOND, NR_HEALTH_SESSIOND_TYPES);
        if (!lh) {
                return NULL;
        }
        return lh;
 }
 
-struct lttng_health *
-       lttng_health_create_consumerd(enum lttng_health_consumerd consumerd)
+struct lttng_health *lttng_health_create_consumerd(enum lttng_health_consumerd consumerd)
 {
        struct lttng_health *lh;
 
-       lh = lttng_health_create(HEALTH_COMPONENT_CONSUMERD,
-                       NR_HEALTH_CONSUMERD_TYPES);
+       lh = lttng_health_create(HEALTH_COMPONENT_CONSUMERD, NR_HEALTH_CONSUMERD_TYPES);
        if (!lh) {
                return NULL;
        }
@@ -280,14 +268,12 @@ struct lttng_health *lttng_health_create_relayd(const char *path)
                goto error;
        }
 
-       lh = lttng_health_create(HEALTH_COMPONENT_RELAYD,
-                       NR_HEALTH_RELAYD_TYPES);
+       lh = lttng_health_create(HEALTH_COMPONENT_RELAYD, NR_HEALTH_RELAYD_TYPES);
        if (!lh) {
                goto error;
        }
 
-       ret = lttng_strncpy(lh->health_sock_path, path,
-                       sizeof(lh->health_sock_path));
+       ret = lttng_strncpy(lh->health_sock_path, path, sizeof(lh->health_sock_path));
        if (ret) {
                goto error;
        }
@@ -335,13 +321,13 @@ retry:
        memset(&msg, 0, sizeof(msg));
        msg.cmd = HEALTH_CMD_CHECK;
 
-       ret = lttcomm_send_unix_sock(sock, (void *)&msg, sizeof(msg));
+       ret = lttcomm_send_unix_sock(sock, (void *) &msg, sizeof(msg));
        if (ret < 0) {
                ret = -1;
                goto close_error;
        }
 
-       ret = lttcomm_recv_unix_sock(sock, (void *)&reply, sizeof(reply));
+       ret = lttcomm_recv_unix_sock(sock, (void *) &reply, sizeof(reply));
        if (ret < 0) {
                ret = -1;
                goto close_error;
@@ -357,12 +343,12 @@ retry:
        }
 
 close_error:
-       {
-               int closeret;
+{
+       int closeret;
 
-               closeret = close(sock);
-               LTTNG_ASSERT(!closeret);
-       }
+       closeret = close(sock);
+       LTTNG_ASSERT(!closeret);
+}
 
 error:
        if (ret >= 0)
@@ -391,9 +377,8 @@ int lttng_health_get_nr_threads(const struct lttng_health *health)
        return health->nr_threads;
 }
 
-const struct lttng_health_thread *
-       lttng_health_get_thread(const struct lttng_health *health,
-               unsigned int nth_thread)
+const struct lttng_health_thread *lttng_health_get_thread(const struct lttng_health *health,
+                                                         unsigned int nth_thread)
 {
        if (!health || nth_thread >= health->nr_threads) {
                return NULL;
@@ -417,5 +402,5 @@ const char *lttng_health_thread_name(const struct lttng_health_thread *thread)
                return NULL;
        }
        nr = thread - &thread->p->thread[0];
-       return get_thread_name (thread->p->component, nr);
+       return get_thread_name(thread->p->component, nr);
 }
index c389243d98dd1213e4e2d692011dce9f0cfa063c..82f10bec03228f16a5267e899e8c9efe23f11872 100644 (file)
  */
 
 #define _LGPL_SOURCE
-#include <grp.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
+#include "lttng-ctl-helper.hpp"
 
-#include <common/bytecode/bytecode.hpp>
 #include <common/align.hpp>
+#include <common/bytecode/bytecode.hpp>
 #include <common/common.hpp>
 #include <common/compat/errno.hpp>
 #include <common/compat/string.hpp>
 #include <common/defaults.hpp>
 #include <common/dynamic-array.hpp>
 #include <common/dynamic-buffer.hpp>
+#include <common/filter/filter-ast.hpp>
+#include <common/filter/filter-parser.hpp>
+#include <common/filter/memstream.hpp>
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
 #include <common/sessiond-comm/sessiond-comm.hpp>
@@ -33,6 +31,7 @@
 #include <common/unix.hpp>
 #include <common/uri.hpp>
 #include <common/utils.hpp>
+
 #include <lttng/channel-internal.hpp>
 #include <lttng/destruction-handle.h>
 #include <lttng/endpoint.h>
 #include <lttng/trigger/trigger-internal.hpp>
 #include <lttng/userspace-probe-internal.hpp>
 
-#include "lttng-ctl-helper.hpp"
-#include <common/filter/filter-ast.hpp>
-#include <common/filter/filter-parser.hpp>
-#include <common/filter/memstream.hpp>
+#include <grp.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
-#define COPY_DOMAIN_PACKED(dst, src)                           \
-do {                                                           \
-       struct lttng_domain _tmp_domain;                        \
-                                                               \
-       lttng_ctl_copy_lttng_domain(&_tmp_domain, &src);        \
-       dst = _tmp_domain;                                      \
-} while (0)
+#define COPY_DOMAIN_PACKED(dst, src)                             \
+       do {                                                     \
+               struct lttng_domain _tmp_domain;                 \
+                                                                 \
+               lttng_ctl_copy_lttng_domain(&_tmp_domain, &src); \
+               dst = _tmp_domain;                               \
+       } while (0)
 
 /* Socket to session daemon for communication */
 static int sessiond_socket = -1;
@@ -83,8 +84,7 @@ LTTNG_EXPORT int lttng_opt_mi;
  *
  * If domain is unknown, default domain will be the kernel.
  */
-void lttng_ctl_copy_lttng_domain(struct lttng_domain *dst,
-               struct lttng_domain *src)
+void lttng_ctl_copy_lttng_domain(struct lttng_domain *dst, struct lttng_domain *src)
 {
        if (src && dst) {
                switch (src->type) {
@@ -117,11 +117,12 @@ static int send_session_msg(struct lttcomm_session_msg *lsm)
                goto end;
        }
 
-       DBG("LSM cmd type: '%s' (%d)", lttcomm_sessiond_command_str((lttcomm_sessiond_command) lsm->cmd_type),
-                       lsm->cmd_type);
+       DBG("LSM cmd type: '%s' (%d)",
+           lttcomm_sessiond_command_str((lttcomm_sessiond_command) lsm->cmd_type),
+           lsm->cmd_type);
 
-       ret = lttcomm_send_creds_unix_sock(sessiond_socket, lsm,
-                       sizeof(struct lttcomm_session_msg));
+       ret = lttcomm_send_creds_unix_sock(
+               sessiond_socket, lsm, sizeof(struct lttcomm_session_msg));
        if (ret < 0) {
                ret = -LTTNG_ERR_FATAL;
        }
@@ -227,15 +228,13 @@ static int recv_payload_sessiond(struct lttng_payload *payload, size_t len)
        int ret;
        const size_t original_payload_size = payload->buffer.size;
 
-       ret = lttng_dynamic_buffer_set_size(
-                       &payload->buffer, payload->buffer.size + len);
+       ret = lttng_dynamic_buffer_set_size(&payload->buffer, payload->buffer.size + len);
        if (ret) {
                ret = -LTTNG_ERR_NOMEM;
                goto end;
        }
 
-       ret = recv_data_sessiond(
-                       payload->buffer.data + original_payload_size, len);
+       ret = recv_data_sessiond(payload->buffer.data + original_payload_size, len);
 end:
        return ret;
 }
@@ -291,8 +290,7 @@ end:
        return ret;
 }
 
-static enum lttng_error_code check_enough_available_memory(
-               uint64_t num_bytes_requested_per_cpu)
+static enum lttng_error_code check_enough_available_memory(uint64_t num_bytes_requested_per_cpu)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -316,8 +314,7 @@ static enum lttng_error_code check_enough_available_memory(
                goto end;
        }
 
-       num_bytes_requested_total =
-                       num_bytes_requested_per_cpu * (uint64_t) num_cpu;
+       num_bytes_requested_total = num_bytes_requested_per_cpu * (uint64_t) num_cpu;
 
        /*
         * Try to get the `MemAvail` field of `/proc/meminfo`. This is the most
@@ -395,7 +392,7 @@ error:
  */
 static int set_session_daemon_path(void)
 {
-       int in_tgroup = 0;      /* In tracing group. */
+       int in_tgroup = 0; /* In tracing group. */
        uid_t uid;
 
        uid = getuid();
@@ -407,8 +404,8 @@ static int set_session_daemon_path(void)
 
        if ((uid == 0) || in_tgroup == 1) {
                const int ret = lttng_strncpy(sessiond_sock_path,
-                               DEFAULT_GLOBAL_CLIENT_UNIX_SOCK,
-                               sizeof(sessiond_sock_path));
+                                             DEFAULT_GLOBAL_CLIENT_UNIX_SOCK,
+                                             sizeof(sessiond_sock_path));
 
                if (ret) {
                        goto error;
@@ -434,8 +431,10 @@ static int set_session_daemon_path(void)
                 * With GNU C >= 2.1, snprintf returns the required size
                 * (excluding closing null)
                 */
-               ret = snprintf(sessiond_sock_path, sizeof(sessiond_sock_path),
-                               DEFAULT_HOME_CLIENT_UNIX_SOCK, utils_get_home_dir());
+               ret = snprintf(sessiond_sock_path,
+                              sizeof(sessiond_sock_path),
+                              DEFAULT_HOME_CLIENT_UNIX_SOCK,
+                              utils_get_home_dir());
                if ((ret < 0) || (ret >= sizeof(sessiond_sock_path))) {
                        goto error;
                }
@@ -496,8 +495,7 @@ static int disconnect_sessiond(void)
        return ret;
 }
 
-static int recv_sessiond_optional_data(size_t len, void **user_buf,
-       size_t *user_len)
+static int recv_sessiond_optional_data(size_t len, void **user_buf, size_t *user_len)
 {
        int ret = 0;
        char *buf = NULL;
@@ -552,9 +550,13 @@ end:
  * Return size of data (only payload, not header) or a negative error code.
  */
 int lttng_ctl_ask_sessiond_fds_varlen(struct lttcomm_session_msg *lsm,
-               const int *fds, size_t nb_fd, const void *vardata,
-               size_t vardata_len, void **user_payload_buf,
-               void **user_cmd_header_buf, size_t *user_cmd_header_len)
+                                     const int *fds,
+                                     size_t nb_fd,
+                                     const void *vardata,
+                                     size_t vardata_len,
+                                     void **user_payload_buf,
+                                     void **user_cmd_header_buf,
+                                     size_t *user_cmd_header_len)
 {
        int ret;
        size_t payload_len;
@@ -602,15 +604,14 @@ int lttng_ctl_ask_sessiond_fds_varlen(struct lttcomm_session_msg *lsm,
        }
 
        /* Get command header from data transmission */
-       ret = recv_sessiond_optional_data(llm.cmd_header_size,
-               user_cmd_header_buf, user_cmd_header_len);
+       ret = recv_sessiond_optional_data(
+               llm.cmd_header_size, user_cmd_header_buf, user_cmd_header_len);
        if (ret < 0) {
                goto end;
        }
 
        /* Get payload from data transmission */
-       ret = recv_sessiond_optional_data(llm.data_size, user_payload_buf,
-               &payload_len);
+       ret = recv_sessiond_optional_data(llm.data_size, user_payload_buf, &payload_len);
        if (ret < 0) {
                goto end;
        }
@@ -622,8 +623,7 @@ end:
        return ret;
 }
 
-int lttng_ctl_ask_sessiond_payload(struct lttng_payload_view *message,
-       struct lttng_payload *reply)
+int lttng_ctl_ask_sessiond_payload(struct lttng_payload_view *message, struct lttng_payload *reply)
 {
        int ret;
        struct lttcomm_lttng_msg llm;
@@ -642,16 +642,15 @@ int lttng_ctl_ask_sessiond_payload(struct lttng_payload_view *message,
        }
 
        /* Send command to session daemon */
-       ret = lttcomm_send_creds_unix_sock(sessiond_socket, message->buffer.data,
-                       message->buffer.size);
+       ret = lttcomm_send_creds_unix_sock(
+               sessiond_socket, message->buffer.data, message->buffer.size);
        if (ret < 0) {
                ret = -LTTNG_ERR_FATAL;
                goto end;
        }
 
        if (fd_count > 0) {
-               ret = lttcomm_send_payload_view_fds_unix_sock(sessiond_socket,
-                               message);
+               ret = lttcomm_send_payload_view_fds_unix_sock(sessiond_socket, message);
                if (ret < 0) {
                        ret = -LTTNG_ERR_FATAL;
                        goto end;
@@ -694,18 +693,17 @@ int lttng_ctl_ask_sessiond_payload(struct lttng_payload_view *message,
        }
 
        if (llm.fd_count > 0) {
-               ret = lttcomm_recv_payload_fds_unix_sock(
-                               sessiond_socket, llm.fd_count, reply);
+               ret = lttcomm_recv_payload_fds_unix_sock(sessiond_socket, llm.fd_count, reply);
                if (ret < 0) {
                        goto end;
                }
        }
 
        /* Don't return the llm header to the caller. */
-       memmove(reply->buffer.data, reply->buffer.data + sizeof(llm),
-                       reply->buffer.size - sizeof(llm));
-       ret = lttng_dynamic_buffer_set_size(
-                       &reply->buffer, reply->buffer.size - sizeof(llm));
+       memmove(reply->buffer.data,
+               reply->buffer.data + sizeof(llm),
+               reply->buffer.size - sizeof(llm));
+       ret = lttng_dynamic_buffer_set_size(&reply->buffer, reply->buffer.size - sizeof(llm));
        if (ret) {
                /* Can't happen as size is reduced. */
                abort();
@@ -723,8 +721,7 @@ end:
  *
  * The returned pointer will be NULL in case of malloc() error.
  */
-struct lttng_handle *lttng_create_handle(const char *session_name,
-               struct lttng_domain *domain)
+struct lttng_handle *lttng_create_handle(const char *session_name, struct lttng_domain *domain)
 {
        int ret;
        struct lttng_handle *handle = NULL;
@@ -736,8 +733,7 @@ struct lttng_handle *lttng_create_handle(const char *session_name,
        }
 
        /* Copy session name */
-       ret = lttng_strncpy(handle->session_name, session_name ? : "",
-                           sizeof(handle->session_name));
+       ret = lttng_strncpy(handle->session_name, session_name ?: "", sizeof(handle->session_name));
        if (ret) {
                goto error;
        }
@@ -767,8 +763,7 @@ void lttng_destroy_handle(struct lttng_handle *handle)
  *
  * Returns size of returned session payload data or a negative error code.
  */
-int lttng_register_consumer(struct lttng_handle *handle,
-               const char *socket_path)
+int lttng_register_consumer(struct lttng_handle *handle, const char *socket_path)
 {
        int ret;
        struct lttcomm_session_msg lsm;
@@ -780,8 +775,7 @@ int lttng_register_consumer(struct lttng_handle *handle,
 
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_REGISTER_CONSUMER;
-       ret = lttng_strncpy(lsm.session.name, handle->session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, handle->session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -789,8 +783,7 @@ int lttng_register_consumer(struct lttng_handle *handle,
 
        COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
 
-       ret = lttng_strncpy(lsm.u.reg.path, socket_path,
-                           sizeof(lsm.u.reg.path));
+       ret = lttng_strncpy(lsm.u.reg.path, socket_path, sizeof(lsm.u.reg.path));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -819,8 +812,7 @@ int lttng_start_tracing(const char *session_name)
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_START_TRACE;
 
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                           sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -847,8 +839,7 @@ static int _lttng_stop_tracing(const char *session_name, int wait)
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_STOP_TRACE;
 
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                           sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
@@ -911,9 +902,9 @@ int lttng_stop_tracing_no_wait(const char *session_name)
  * Returns the size of the returned payload data or a negative error code.
  */
 int lttng_add_context(struct lttng_handle *handle,
-               struct lttng_event_context *ctx,
-               const char *event_name __attribute__((unused)),
-               const char *channel_name)
+                     struct lttng_event_context *ctx,
+                     const char *event_name __attribute__((unused)),
+                     const char *channel_name)
 {
        int ret;
        struct lttcomm_session_msg lsm = {
@@ -940,16 +931,15 @@ int lttng_add_context(struct lttng_handle *handle,
        }
 
        /* If no channel name, send empty string. */
-       ret = lttng_strncpy(lsm.u.context.channel_name, channel_name ?: "",
-                       sizeof(lsm.u.context.channel_name));
+       ret = lttng_strncpy(
+               lsm.u.context.channel_name, channel_name ?: "", sizeof(lsm.u.context.channel_name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
        COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
-       ret = lttng_strncpy(lsm.session.name, handle->session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, handle->session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -969,8 +959,7 @@ int lttng_add_context(struct lttng_handle *handle,
        {
                struct lttng_payload reply;
                struct lttng_payload_view payload_view =
-                               lttng_payload_view_from_payload(&payload, 0,
-                               -1);
+                       lttng_payload_view_from_payload(&payload, 0, -1);
 
                lttng_payload_init(&reply);
                ret = lttng_ctl_ask_sessiond_payload(&payload_view, &reply);
@@ -994,10 +983,10 @@ end:
  * Returns size of returned session payload data or a negative error code.
  */
 int lttng_enable_event(struct lttng_handle *handle,
-               struct lttng_event *ev, const char *channel_name)
+                      struct lttng_event *ev,
+                      const char *channel_name)
 {
-       return lttng_enable_event_with_exclusions(handle, ev, channel_name,
-                       NULL, 0, NULL);
+       return lttng_enable_event_with_exclusions(handle, ev, channel_name, NULL, 0, NULL);
 }
 
 /*
@@ -1007,11 +996,12 @@ int lttng_enable_event(struct lttng_handle *handle,
  * Return size of returned session payload data if OK.
  */
 int lttng_enable_event_with_filter(struct lttng_handle *handle,
-               struct lttng_event *event, const char *channel_name,
-               const char *filter_expression)
+                                  struct lttng_event *event,
+                                  const char *channel_name,
+                                  const char *filter_expression)
 {
-       return lttng_enable_event_with_exclusions(handle, event, channel_name,
-                       filter_expression, 0, NULL);
+       return lttng_enable_event_with_exclusions(
+               handle, event, channel_name, filter_expression, 0, NULL);
 }
 
 /*
@@ -1030,8 +1020,8 @@ static char *set_agent_filter(const char *filter, struct lttng_event *ev)
        /* Don't add filter for the '*' event. */
        if (strcmp(ev->name, "*") != 0) {
                if (filter) {
-                       err = asprintf(&agent_filter, "(%s) && (logger_name == \"%s\")", filter,
-                                       ev->name);
+                       err = asprintf(
+                               &agent_filter, "(%s) && (logger_name == \"%s\")", filter, ev->name);
                } else {
                        err = asprintf(&agent_filter, "logger_name == \"%s\"", ev->name);
                }
@@ -1054,16 +1044,17 @@ static char *set_agent_filter(const char *filter, struct lttng_event *ev)
                if (filter || agent_filter) {
                        char *new_filter;
 
-                       err = asprintf(&new_filter, "(%s) && (int_loglevel %s %d)",
-                                       agent_filter ? agent_filter : filter, op,
-                                       ev->loglevel);
+                       err = asprintf(&new_filter,
+                                      "(%s) && (int_loglevel %s %d)",
+                                      agent_filter ? agent_filter : filter,
+                                      op,
+                                      ev->loglevel);
                        if (agent_filter) {
                                free(agent_filter);
                        }
                        agent_filter = new_filter;
                } else {
-                       err = asprintf(&agent_filter, "int_loglevel %s %d", op,
-                                       ev->loglevel);
+                       err = asprintf(&agent_filter, "int_loglevel %s %d", op, ev->loglevel);
                }
                if (err < 0) {
                        PERROR("asprintf");
@@ -1086,9 +1077,11 @@ error:
  * Returns size of returned session payload data or a negative error code.
  */
 int lttng_enable_event_with_exclusions(struct lttng_handle *handle,
-               struct lttng_event *ev, const char *channel_name,
-               const char *original_filter_expression,
-               int exclusion_count, char **exclusion_list)
+                                      struct lttng_event *ev,
+                                      const char *channel_name,
+                                      const char *original_filter_expression,
+                                      int exclusion_count,
+                                      char **exclusion_list)
 {
        struct lttcomm_session_msg lsm = {
                .cmd_type = LTTCOMM_SESSIOND_COMMAND_ENABLE_EVENT,
@@ -1138,12 +1131,12 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle,
        }
 
        /* Parse filter expression. */
-       if (filter_expression != NULL || handle->domain.type == LTTNG_DOMAIN_JUL
-                       || handle->domain.type == LTTNG_DOMAIN_LOG4J
-                       || handle->domain.type == LTTNG_DOMAIN_PYTHON) {
+       if (filter_expression != NULL || handle->domain.type == LTTNG_DOMAIN_JUL ||
+           handle->domain.type == LTTNG_DOMAIN_LOG4J ||
+           handle->domain.type == LTTNG_DOMAIN_PYTHON) {
                if (handle->domain.type == LTTNG_DOMAIN_JUL ||
-                               handle->domain.type == LTTNG_DOMAIN_LOG4J ||
-                               handle->domain.type == LTTNG_DOMAIN_PYTHON) {
+                   handle->domain.type == LTTNG_DOMAIN_LOG4J ||
+                   handle->domain.type == LTTNG_DOMAIN_PYTHON) {
                        char *agent_filter;
 
                        /* Setup agent filter if needed. */
@@ -1167,8 +1160,7 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle,
                        }
                }
 
-               if (strnlen(filter_expression, LTTNG_FILTER_MAX_LEN) ==
-                               LTTNG_FILTER_MAX_LEN) {
+               if (strnlen(filter_expression, LTTNG_FILTER_MAX_LEN) == LTTNG_FILTER_MAX_LEN) {
                        ret = -LTTNG_ERR_FILTER_INVAL;
                        goto error;
                }
@@ -1178,8 +1170,7 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle,
                        goto error;
                }
 
-               bytecode_len = bytecode_get_len(&ctx->bytecode->b) +
-                               sizeof(ctx->bytecode->b);
+               bytecode_len = bytecode_get_len(&ctx->bytecode->b) + sizeof(ctx->bytecode->b);
                if (bytecode_len > LTTNG_FILTER_MAX_LEN) {
                        ret = -LTTNG_ERR_FILTER_INVAL;
                        goto error;
@@ -1187,18 +1178,21 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle,
        }
 
 serialize:
-       ret = lttng_event_serialize(ev, exclusion_count, exclusion_list,
-                       filter_expression, bytecode_len,
-                       (ctx && bytecode_len) ? &ctx->bytecode->b : NULL,
-                       &payload);
+       ret = lttng_event_serialize(ev,
+                                   exclusion_count,
+                                   exclusion_list,
+                                   filter_expression,
+                                   bytecode_len,
+                                   (ctx && bytecode_len) ? &ctx->bytecode->b : NULL,
+                                   &payload);
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
        }
 
        /* If no channel name, send empty string. */
-       ret = lttng_strncpy(lsm.u.enable.channel_name, channel_name ?: "",
-                       sizeof(lsm.u.enable.channel_name));
+       ret = lttng_strncpy(
+               lsm.u.enable.channel_name, channel_name ?: "", sizeof(lsm.u.enable.channel_name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
@@ -1208,8 +1202,7 @@ serialize:
        COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
 
        /* Session name */
-       ret = lttng_strncpy(lsm.session.name, handle->session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, handle->session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
@@ -1219,8 +1212,7 @@ serialize:
        lsm.u.enable.length = (uint32_t) payload.buffer.size;
 
        {
-               struct lttng_payload_view view = lttng_payload_view_from_payload(
-                       &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
                int fd_count = lttng_payload_view_get_fd_handle_count(&view);
                int fd_to_send;
 
@@ -1230,8 +1222,7 @@ serialize:
 
                LTTNG_ASSERT(fd_count == 0 || fd_count == 1);
                if (fd_count == 1) {
-                       struct fd_handle *h =
-                                       lttng_payload_view_pop_fd_handle(&view);
+                       struct fd_handle *h = lttng_payload_view_pop_fd_handle(&view);
 
                        if (!h) {
                                goto error;
@@ -1244,9 +1235,13 @@ serialize:
                lsm.fd_count = fd_count;
 
                ret = lttng_ctl_ask_sessiond_fds_varlen(&lsm,
-                               fd_count ? &fd_to_send : NULL, fd_count,
-                               view.buffer.size ? view.buffer.data : NULL,
-                               view.buffer.size, NULL, NULL, 0);
+                                                       fd_count ? &fd_to_send : NULL,
+                                                       fd_count,
+                                                       view.buffer.size ? view.buffer.data : NULL,
+                                                       view.buffer.size,
+                                                       NULL,
+                                                       NULL,
+                                                       0);
        }
 
 error:
@@ -1272,8 +1267,9 @@ error:
 }
 
 int lttng_disable_event_ext(struct lttng_handle *handle,
-               struct lttng_event *ev, const char *channel_name,
-               const char *original_filter_expression)
+                           struct lttng_event *ev,
+                           const char *channel_name,
+                           const char *original_filter_expression)
 {
        struct lttcomm_session_msg lsm = {
                .cmd_type = LTTCOMM_SESSIOND_COMMAND_DISABLE_EVENT,
@@ -1317,12 +1313,12 @@ int lttng_disable_event_ext(struct lttng_handle *handle,
        }
 
        /* Parse filter expression. */
-       if (filter_expression != NULL || handle->domain.type == LTTNG_DOMAIN_JUL
-                       || handle->domain.type == LTTNG_DOMAIN_LOG4J
-                       || handle->domain.type == LTTNG_DOMAIN_PYTHON) {
+       if (filter_expression != NULL || handle->domain.type == LTTNG_DOMAIN_JUL ||
+           handle->domain.type == LTTNG_DOMAIN_LOG4J ||
+           handle->domain.type == LTTNG_DOMAIN_PYTHON) {
                if (handle->domain.type == LTTNG_DOMAIN_JUL ||
-                               handle->domain.type == LTTNG_DOMAIN_LOG4J ||
-                               handle->domain.type == LTTNG_DOMAIN_PYTHON) {
+                   handle->domain.type == LTTNG_DOMAIN_LOG4J ||
+                   handle->domain.type == LTTNG_DOMAIN_PYTHON) {
                        char *agent_filter;
 
                        /* Setup agent filter if needed. */
@@ -1346,8 +1342,7 @@ int lttng_disable_event_ext(struct lttng_handle *handle,
                        }
                }
 
-               if (strnlen(filter_expression, LTTNG_FILTER_MAX_LEN) ==
-                               LTTNG_FILTER_MAX_LEN) {
+               if (strnlen(filter_expression, LTTNG_FILTER_MAX_LEN) == LTTNG_FILTER_MAX_LEN) {
                        ret = -LTTNG_ERR_FILTER_INVAL;
                        goto error;
                }
@@ -1357,8 +1352,7 @@ int lttng_disable_event_ext(struct lttng_handle *handle,
                        goto error;
                }
 
-               bytecode_len = bytecode_get_len(&ctx->bytecode->b) +
-                               sizeof(ctx->bytecode->b);
+               bytecode_len = bytecode_get_len(&ctx->bytecode->b) + sizeof(ctx->bytecode->b);
                if (bytecode_len > LTTNG_FILTER_MAX_LEN) {
                        ret = -LTTNG_ERR_FILTER_INVAL;
                        goto error;
@@ -1366,18 +1360,21 @@ int lttng_disable_event_ext(struct lttng_handle *handle,
        }
 
 serialize:
-       ret = lttng_event_serialize(ev, 0, NULL,
-                       filter_expression, bytecode_len,
-                       (ctx && bytecode_len) ? &ctx->bytecode->b : NULL,
-                       &payload);
+       ret = lttng_event_serialize(ev,
+                                   0,
+                                   NULL,
+                                   filter_expression,
+                                   bytecode_len,
+                                   (ctx && bytecode_len) ? &ctx->bytecode->b : NULL,
+                                   &payload);
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
        }
 
        /* If no channel name, send empty string. */
-       ret = lttng_strncpy(lsm.u.disable.channel_name, channel_name ?: "",
-                       sizeof(lsm.u.disable.channel_name));
+       ret = lttng_strncpy(
+               lsm.u.disable.channel_name, channel_name ?: "", sizeof(lsm.u.disable.channel_name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
@@ -1387,8 +1384,7 @@ serialize:
        COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
 
        /* Session name */
-       ret = lttng_strncpy(lsm.session.name, handle->session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, handle->session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
@@ -1398,8 +1394,7 @@ serialize:
        lsm.u.disable.length = (uint32_t) payload.buffer.size;
 
        {
-               struct lttng_payload_view view = lttng_payload_view_from_payload(
-                       &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
                int fd_count = lttng_payload_view_get_fd_handle_count(&view);
                int fd_to_send;
 
@@ -1409,8 +1404,7 @@ serialize:
 
                LTTNG_ASSERT(fd_count == 0 || fd_count == 1);
                if (fd_count == 1) {
-                       struct fd_handle *h =
-                                       lttng_payload_view_pop_fd_handle(&view);
+                       struct fd_handle *h = lttng_payload_view_pop_fd_handle(&view);
 
                        if (!h) {
                                goto error;
@@ -1421,9 +1415,13 @@ serialize:
                }
 
                ret = lttng_ctl_ask_sessiond_fds_varlen(&lsm,
-                               fd_count ? &fd_to_send : NULL, fd_count,
-                               view.buffer.size ? view.buffer.data : NULL,
-                               view.buffer.size, NULL, NULL, 0);
+                                                       fd_count ? &fd_to_send : NULL,
+                                                       fd_count,
+                                                       view.buffer.size ? view.buffer.data : NULL,
+                                                       view.buffer.size,
+                                                       NULL,
+                                                       NULL,
+                                                       0);
        }
 
 error:
@@ -1454,8 +1452,7 @@ error:
  * If no channel name is specified, the default 'channel0' is used.
  * Returns size of returned session payload data or a negative error code.
  */
-int lttng_disable_event(struct lttng_handle *handle, const char *name,
-               const char *channel_name)
+int lttng_disable_event(struct lttng_handle *handle, const char *name, const char *channel_name)
 {
        int ret;
        struct lttng_event ev;
@@ -1528,8 +1525,7 @@ void lttng_channel_destroy(struct lttng_channel *channel)
  * Enable channel per domain
  * Returns size of returned session payload data or a negative error code.
  */
-int lttng_enable_channel(struct lttng_handle *handle,
-               struct lttng_channel *in_chan)
+int lttng_enable_channel(struct lttng_handle *handle, struct lttng_channel *in_chan)
 {
        enum lttng_error_code ret_code;
        int ret;
@@ -1550,17 +1546,14 @@ int lttng_enable_channel(struct lttng_handle *handle,
         * Verify that the amount of memory required to create the requested
         * buffer is available on the system at the moment.
         */
-       if (in_chan->attr.num_subbuf >
-                       UINT64_MAX / in_chan->attr.subbuf_size) {
+       if (in_chan->attr.num_subbuf > UINT64_MAX / in_chan->attr.subbuf_size) {
                /* Overflow */
                ret = -LTTNG_ERR_OVERFLOW;
                goto end;
        }
 
-       total_buffer_size_needed_per_cpu =
-                       in_chan->attr.num_subbuf * in_chan->attr.subbuf_size;
-       ret_code = check_enough_available_memory(
-                       total_buffer_size_needed_per_cpu);
+       total_buffer_size_needed_per_cpu = in_chan->attr.num_subbuf * in_chan->attr.subbuf_size;
+       ret_code = check_enough_available_memory(total_buffer_size_needed_per_cpu);
        if (ret_code != LTTNG_OK) {
                ret = -ret_code;
                goto end;
@@ -1575,16 +1568,14 @@ int lttng_enable_channel(struct lttng_handle *handle,
 
        /* Populate the channel extended attribute if necessary. */
        if (!channel->attr.extended.ptr) {
-               struct lttng_channel_extended *extended =
-                               zmalloc<lttng_channel_extended>();
+               struct lttng_channel_extended *extended = zmalloc<lttng_channel_extended>();
 
                if (!extended) {
                        ret = -LTTNG_ERR_NOMEM;
                        goto end;
                }
 
-               lttng_channel_set_default_extended_attr(
-                               &handle->domain, extended);
+               lttng_channel_set_default_extended_attr(&handle->domain, extended);
                channel->attr.extended.ptr = extended;
        }
 
@@ -1594,8 +1585,7 @@ int lttng_enable_channel(struct lttng_handle *handle,
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_ENABLE_CHANNEL;
        COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
 
-       ret = lttng_strncpy(lsm.session.name, handle->session_name,
-                                   sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, handle->session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -1609,8 +1599,7 @@ int lttng_enable_channel(struct lttng_handle *handle,
 
        lsm.u.channel.length = buffer.size;
 
-       ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(
-                       &lsm, buffer.data, buffer.size, NULL);
+       ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, buffer.data, buffer.size, NULL);
 end:
        lttng_channel_destroy(channel);
        lttng_dynamic_buffer_reset(&buffer);
@@ -1635,8 +1624,7 @@ int lttng_disable_channel(struct lttng_handle *handle, const char *name)
 
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_DISABLE_CHANNEL;
 
-       ret = lttng_strncpy(lsm.u.disable.channel_name, name,
-                       sizeof(lsm.u.disable.channel_name));
+       ret = lttng_strncpy(lsm.u.disable.channel_name, name, sizeof(lsm.u.disable.channel_name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -1644,8 +1632,7 @@ int lttng_disable_channel(struct lttng_handle *handle, const char *name)
 
        COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
 
-       ret = lttng_strncpy(lsm.session.name, handle->session_name,
-                           sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, handle->session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -1662,61 +1649,63 @@ end:
  * Returns the number of lttng_event entries in events;
  * on error, returns a negative value.
  */
-int lttng_list_tracepoints(struct lttng_handle *handle,
-               struct lttng_event **events)
+int lttng_list_tracepoints(struct lttng_handle *handle, struct lttng_event **events)
 {
-        enum lttng_error_code ret_code;
-        int ret, total_payload_received;
-        char *reception_buffer = NULL;
-        struct lttcomm_session_msg lsm = {
+       enum lttng_error_code ret_code;
+       int ret, total_payload_received;
+       char *reception_buffer = NULL;
+       struct lttcomm_session_msg lsm = {
                .cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_TRACEPOINTS,
                .session = {},
                .domain = {},
                .u = {},
                .fd_count = 0,
        };
-        struct lttcomm_list_command_header *cmd_header = NULL;
-        size_t cmd_header_len;
-        unsigned int nb_events = 0;
+       struct lttcomm_list_command_header *cmd_header = NULL;
+       size_t cmd_header_len;
+       unsigned int nb_events = 0;
 
-        if (handle == NULL) {
-                ret = -LTTNG_ERR_INVALID;
-                goto end;
-        }
+       if (handle == NULL) {
+               ret = -LTTNG_ERR_INVALID;
+               goto end;
+       }
 
-        COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
+       COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
 
-        ret = lttng_ctl_ask_sessiond_fds_varlen(&lsm, NULL, 0, NULL, 0,
-                        (void **) &reception_buffer, (void **) &cmd_header,
-                        &cmd_header_len);
-        if (ret < 0) {
-                goto end;
-        }
+       ret = lttng_ctl_ask_sessiond_fds_varlen(&lsm,
+                                               NULL,
+                                               0,
+                                               NULL,
+                                               0,
+                                               (void **) &reception_buffer,
+                                               (void **) &cmd_header,
+                                               &cmd_header_len);
+       if (ret < 0) {
+               goto end;
+       }
 
-        total_payload_received = ret;
+       total_payload_received = ret;
 
-        if (!cmd_header) {
-                ret = -LTTNG_ERR_UNK;
-                goto end;
-        }
+       if (!cmd_header) {
+               ret = -LTTNG_ERR_UNK;
+               goto end;
+       }
 
-        if (cmd_header->count > INT_MAX) {
-                ret = -LTTNG_ERR_OVERFLOW;
-                goto end;
-        }
+       if (cmd_header->count > INT_MAX) {
+               ret = -LTTNG_ERR_OVERFLOW;
+               goto end;
+       }
 
-        nb_events = (unsigned int) cmd_header->count;
+       nb_events = (unsigned int) cmd_header->count;
 
        {
                struct lttng_buffer_view events_view =
-                               lttng_buffer_view_init(reception_buffer, 0,
-                                               total_payload_received);
+                       lttng_buffer_view_init(reception_buffer, 0, total_payload_received);
                struct lttng_payload_view events_payload_view =
-                               lttng_payload_view_from_buffer_view(
-                                               &events_view, 0, -1);
+                       lttng_payload_view_from_buffer_view(&events_view, 0, -1);
 
                ret_code = lttng_events_create_and_flatten_from_payload(
-                               &events_payload_view, nb_events, events);
+                       &events_payload_view, nb_events, events);
                if (ret_code != LTTNG_OK) {
                        ret = -ret_code;
                        goto end;
@@ -1726,9 +1715,9 @@ int lttng_list_tracepoints(struct lttng_handle *handle,
        ret = (int) nb_events;
 
 end:
-        free(cmd_header);
-        free(reception_buffer);
-        return ret;
+       free(cmd_header);
+       free(reception_buffer);
+       return ret;
 }
 
 /*
@@ -1737,8 +1726,7 @@ end:
  * Returns the number of lttng_event_field entries in events;
  * on error, returns a negative value.
  */
-int lttng_list_tracepoint_fields(struct lttng_handle *handle,
-               struct lttng_event_field **fields)
+int lttng_list_tracepoint_fields(struct lttng_handle *handle, struct lttng_event_field **fields)
 {
        enum lttng_error_code ret_code;
        int ret;
@@ -1760,9 +1748,7 @@ int lttng_list_tracepoint_fields(struct lttng_handle *handle,
 
        {
                lttng_payload_view message_view =
-                               lttng_payload_view_init_from_buffer(
-                                       (const char *) &lsm, 0,
-                                       sizeof(lsm));
+                       lttng_payload_view_init_from_buffer((const char *) &lsm, 0, sizeof(lsm));
 
                ret = lttng_ctl_ask_sessiond_payload(&message_view, &reply);
                if (ret < 0) {
@@ -1771,17 +1757,15 @@ int lttng_list_tracepoint_fields(struct lttng_handle *handle,
        }
 
        {
-               const lttng_buffer_view cmd_header_view =
-                               lttng_buffer_view_from_dynamic_buffer(
-                                       &reply.buffer, 0, sizeof(*cmd_header));
+               const lttng_buffer_view cmd_header_view = lttng_buffer_view_from_dynamic_buffer(
+                       &reply.buffer, 0, sizeof(*cmd_header));
 
                if (!lttng_buffer_view_is_valid(&cmd_header_view)) {
                        ret = -LTTNG_ERR_INVALID_PROTOCOL;
                        goto end;
                }
 
-               cmd_header = (struct lttcomm_list_command_header *)
-                               cmd_header_view.data;
+               cmd_header = (struct lttcomm_list_command_header *) cmd_header_view.data;
        }
 
        if (cmd_header->count > INT_MAX) {
@@ -1793,11 +1777,10 @@ int lttng_list_tracepoint_fields(struct lttng_handle *handle,
 
        {
                lttng_payload_view reply_view =
-                               lttng_payload_view_from_payload(&reply,
-                               sizeof(*cmd_header), -1);
+                       lttng_payload_view_from_payload(&reply, sizeof(*cmd_header), -1);
 
                ret_code = lttng_event_fields_create_and_flatten_from_payload(
-                               &reply_view, nb_event_fields, fields);
+                       &reply_view, nb_event_fields, fields);
                if (ret_code != LTTNG_OK) {
                        ret = -ret_code;
                        goto end;
@@ -1820,65 +1803,68 @@ end:
  */
 int lttng_list_syscalls(struct lttng_event **events)
 {
-        enum lttng_error_code ret_code;
-        int ret, total_payload_received;
-        char *reception_buffer = NULL;
-        struct lttcomm_session_msg lsm = {};
-        struct lttcomm_list_command_header *cmd_header = NULL;
-        size_t cmd_header_len;
-        uint32_t nb_events = 0;
-
-        if (!events) {
-                ret = -LTTNG_ERR_INVALID;
-                goto end;
-        }
-
-        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_SYSCALLS;
-        /* Force kernel domain for system calls. */
-        lsm.domain.type = LTTNG_DOMAIN_KERNEL;
-
-        ret = lttng_ctl_ask_sessiond_fds_varlen(&lsm, NULL, 0, NULL, 0,
-                        (void **) &reception_buffer, (void **) &cmd_header,
-                        &cmd_header_len);
-        if (ret < 0) {
-                goto end;
-        }
-        total_payload_received = ret;
-
-        if (!cmd_header) {
-                ret = -LTTNG_ERR_UNK;
-                goto end;
-        }
-
-        if (cmd_header->count > INT_MAX) {
-                ret = -LTTNG_ERR_OVERFLOW;
-                goto end;
-        }
-
-        nb_events = (unsigned int) cmd_header->count;
-
-        {
-                const struct lttng_buffer_view events_view =
-                                lttng_buffer_view_init(reception_buffer, 0,
-                                                total_payload_received);
+       enum lttng_error_code ret_code;
+       int ret, total_payload_received;
+       char *reception_buffer = NULL;
+       struct lttcomm_session_msg lsm = {};
+       struct lttcomm_list_command_header *cmd_header = NULL;
+       size_t cmd_header_len;
+       uint32_t nb_events = 0;
+
+       if (!events) {
+               ret = -LTTNG_ERR_INVALID;
+               goto end;
+       }
+
+       lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_SYSCALLS;
+       /* Force kernel domain for system calls. */
+       lsm.domain.type = LTTNG_DOMAIN_KERNEL;
+
+       ret = lttng_ctl_ask_sessiond_fds_varlen(&lsm,
+                                               NULL,
+                                               0,
+                                               NULL,
+                                               0,
+                                               (void **) &reception_buffer,
+                                               (void **) &cmd_header,
+                                               &cmd_header_len);
+       if (ret < 0) {
+               goto end;
+       }
+       total_payload_received = ret;
+
+       if (!cmd_header) {
+               ret = -LTTNG_ERR_UNK;
+               goto end;
+       }
+
+       if (cmd_header->count > INT_MAX) {
+               ret = -LTTNG_ERR_OVERFLOW;
+               goto end;
+       }
+
+       nb_events = (unsigned int) cmd_header->count;
+
+       {
+               const struct lttng_buffer_view events_view =
+                       lttng_buffer_view_init(reception_buffer, 0, total_payload_received);
                struct lttng_payload_view events_payload_view =
-                               lttng_payload_view_from_buffer_view(
-                                               &events_view, 0, -1);
+                       lttng_payload_view_from_buffer_view(&events_view, 0, -1);
 
-                ret_code = lttng_events_create_and_flatten_from_payload(
-                                &events_payload_view, nb_events, events);
-                if (ret_code != LTTNG_OK) {
-                        ret = -ret_code;
-                        goto end;
-                }
-        }
+               ret_code = lttng_events_create_and_flatten_from_payload(
+                       &events_payload_view, nb_events, events);
+               if (ret_code != LTTNG_OK) {
+                       ret = -ret_code;
+                       goto end;
+               }
+       }
 
-        ret = (int) nb_events;
+       ret = (int) nb_events;
 
 end:
-        free(reception_buffer);
-        free(cmd_header);
-        return ret;
+       free(reception_buffer);
+       free(cmd_header);
+       return ret;
 }
 
 /*
@@ -1894,8 +1880,7 @@ const char *lttng_strerror(int code)
        return error_get_str(code);
 }
 
-enum lttng_error_code lttng_create_session_ext(
-               struct lttng_session_descriptor *session_descriptor)
+enum lttng_error_code lttng_create_session_ext(struct lttng_session_descriptor *session_descriptor)
 {
        enum lttng_error_code ret_code;
        struct lttcomm_session_msg lsm = {
@@ -1921,8 +1906,7 @@ enum lttng_error_code lttng_create_session_ext(
        }
 
        sessiond_must_generate_ouput =
-                       !lttng_session_descriptor_is_output_destination_initialized(
-                               session_descriptor);
+               !lttng_session_descriptor_is_output_destination_initialized(session_descriptor);
        if (sessiond_must_generate_ouput) {
                const char *home_dir = utils_get_home_dir();
                size_t home_dir_len = home_dir ? strlen(home_dir) + 1 : 0;
@@ -1933,8 +1917,7 @@ enum lttng_error_code lttng_create_session_ext(
                }
 
                lsm.u.create_session.home_dir_size = (uint16_t) home_dir_len;
-               ret = lttng_dynamic_buffer_append(&payload, home_dir,
-                               home_dir_len);
+               ret = lttng_dynamic_buffer_append(&payload, home_dir, home_dir_len);
                if (ret) {
                        ret_code = LTTNG_ERR_NOMEM;
                        goto end;
@@ -1942,8 +1925,7 @@ enum lttng_error_code lttng_create_session_ext(
        }
 
        descriptor_size = payload.size;
-       ret = lttng_session_descriptor_serialize(session_descriptor,
-                       &payload);
+       ret = lttng_session_descriptor_serialize(session_descriptor, &payload);
        if (ret) {
                ret_code = LTTNG_ERR_INVALID;
                goto end;
@@ -1952,8 +1934,8 @@ enum lttng_error_code lttng_create_session_ext(
        lsm.u.create_session.session_descriptor_size = descriptor_size;
 
        /* Command returns a session descriptor on success. */
-       reply_ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, payload.data,
-                       payload.size, &reply);
+       reply_ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(
+               &lsm, payload.data, payload.size, &reply);
        if (reply_ret < 0) {
                ret_code = (lttng_error_code) -reply_ret;
                goto end;
@@ -1964,8 +1946,7 @@ enum lttng_error_code lttng_create_session_ext(
        }
 
        reply_view = lttng_buffer_view_init((const char *) reply, 0, reply_ret);
-       ret = lttng_session_descriptor_create_from_buffer(&reply_view,
-                       &descriptor_reply);
+       ret = lttng_session_descriptor_create_from_buffer(&reply_view, &descriptor_reply);
        if (ret < 0) {
                ret_code = LTTNG_ERR_FATAL;
                goto end;
@@ -2011,12 +1992,10 @@ int lttng_create_session(const char *name, const char *url)
                        ret = -LTTNG_ERR_INVALID;
                        goto end;
                }
-               descriptor = lttng_session_descriptor_local_create(name,
-                               uris[0].dst.path);
+               descriptor = lttng_session_descriptor_local_create(name, uris[0].dst.path);
                break;
        case 2:
-               descriptor = lttng_session_descriptor_network_create(name, url,
-                               NULL);
+               descriptor = lttng_session_descriptor_network_create(name, url, NULL);
                break;
        default:
                ret = -LTTNG_ERR_INVALID;
@@ -2060,10 +2039,8 @@ int lttng_create_session_snapshot(const char *name, const char *snapshot_url)
        /*
         * If the user does not specify a custom subdir, use the session name.
         */
-       if (size > 0 && uris[0].dtype != LTTNG_DST_PATH &&
-                       strlen(uris[0].subdir) == 0) {
-               ret = snprintf(uris[0].subdir, sizeof(uris[0].subdir), "%s",
-                               name);
+       if (size > 0 && uris[0].dtype != LTTNG_DST_PATH && strlen(uris[0].subdir) == 0) {
+               ret = snprintf(uris[0].subdir, sizeof(uris[0].subdir), "%s", name);
                if (ret < 0) {
                        PERROR("Failed to set session name as network destination sub-directory");
                        ret = -LTTNG_ERR_FATAL;
@@ -2084,15 +2061,11 @@ int lttng_create_session_snapshot(const char *name, const char *snapshot_url)
                        ret = -LTTNG_ERR_INVALID;
                        goto end;
                }
-               descriptor = lttng_session_descriptor_snapshot_local_create(
-                               name,
-                               uris[0].dst.path);
+               descriptor = lttng_session_descriptor_snapshot_local_create(name, uris[0].dst.path);
                break;
        case 2:
-               descriptor = lttng_session_descriptor_snapshot_network_create(
-                               name,
-                               snapshot_url,
-                               NULL);
+               descriptor =
+                       lttng_session_descriptor_snapshot_network_create(name, snapshot_url, NULL);
                break;
        default:
                ret = -LTTNG_ERR_INVALID;
@@ -2115,8 +2088,7 @@ end:
  *
  * Return 0 on success else a negative LTTng error code.
  */
-int lttng_create_session_live(const char *name, const char *url,
-               unsigned int timer_interval)
+int lttng_create_session_live(const char *name, const char *url, unsigned int timer_interval)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -2129,10 +2101,9 @@ int lttng_create_session_live(const char *name, const char *url,
 
        if (url) {
                descriptor = lttng_session_descriptor_live_network_create(
-                               name, url, NULL, timer_interval);
+                       name, url, NULL, timer_interval);
        } else {
-               descriptor = lttng_session_descriptor_live_create(
-                               name, timer_interval);
+               descriptor = lttng_session_descriptor_live_create(name, timer_interval);
        }
        if (!descriptor) {
                ret = -LTTNG_ERR_INVALID;
@@ -2212,8 +2183,8 @@ int lttng_list_sessions(struct lttng_session **out_sessions)
 {
        int ret;
        struct lttcomm_session_msg lsm;
-       const size_t session_size = sizeof(struct lttng_session) +
-                       sizeof(struct lttng_session_extended);
+       const size_t session_size =
+               sizeof(struct lttng_session) + sizeof(struct lttng_session_extended);
        size_t session_count, i;
        struct lttng_session_extended *sessions_extended_begin;
        struct lttng_session *sessions = NULL;
@@ -2226,7 +2197,7 @@ int lttng_list_sessions(struct lttng_session **out_sessions)
         * be subsequently freed.
         */
        *out_sessions = NULL;
-       ret = lttng_ctl_ask_sessiond(&lsm, (void**) &sessions);
+       ret = lttng_ctl_ask_sessiond(&lsm, (void **) &sessions);
        if (ret <= 0) {
                goto end;
        }
@@ -2241,14 +2212,12 @@ int lttng_list_sessions(struct lttng_session **out_sessions)
                goto end;
        }
        session_count = (size_t) ret / session_size;
-       sessions_extended_begin = (struct lttng_session_extended *)
-                       (&sessions[session_count]);
+       sessions_extended_begin = (struct lttng_session_extended *) (&sessions[session_count]);
 
        /* Set extended session info pointers. */
        for (i = 0; i < session_count; i++) {
                struct lttng_session *session = &sessions[i];
-               struct lttng_session_extended *extended =
-                               &(sessions_extended_begin[i]);
+               struct lttng_session_extended *extended = &(sessions_extended_begin[i]);
 
                session->extended.ptr = extended;
        }
@@ -2259,8 +2228,8 @@ end:
        return ret;
 }
 
-enum lttng_error_code lttng_session_get_creation_time(
-               const struct lttng_session *session, uint64_t *creation_time)
+enum lttng_error_code lttng_session_get_creation_time(const struct lttng_session *session,
+                                                     uint64_t *creation_time)
 {
        enum lttng_error_code ret = LTTNG_OK;
        struct lttng_session_extended *extended;
@@ -2281,8 +2250,7 @@ end:
        return ret;
 }
 
-int lttng_set_session_shm_path(const char *session_name,
-               const char *shm_path)
+int lttng_set_session_shm_path(const char *session_name, const char *shm_path)
 {
        int ret;
        struct lttcomm_session_msg lsm;
@@ -2294,15 +2262,14 @@ int lttng_set_session_shm_path(const char *session_name,
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SET_SESSION_SHM_PATH;
 
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       ret = lttng_strncpy(lsm.u.set_shm_path.shm_path, shm_path ?: "",
-                       sizeof(lsm.u.set_shm_path.shm_path));
+       ret = lttng_strncpy(
+               lsm.u.set_shm_path.shm_path, shm_path ?: "", sizeof(lsm.u.set_shm_path.shm_path));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -2319,8 +2286,7 @@ end:
  * Returns the number of lttng_domain entries in domains;
  * on error, returns a negative value.
  */
-int lttng_list_domains(const char *session_name,
-               struct lttng_domain **domains)
+int lttng_list_domains(const char *session_name, struct lttng_domain **domains)
 {
        int ret;
        struct lttcomm_session_msg lsm;
@@ -2333,14 +2299,13 @@ int lttng_list_domains(const char *session_name,
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_DOMAINS;
 
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
        }
 
-       ret = lttng_ctl_ask_sessiond(&lsm, (void**) domains);
+       ret = lttng_ctl_ask_sessiond(&lsm, (void **) domains);
        if (ret < 0) {
                goto error;
        }
@@ -2356,8 +2321,7 @@ error:
  * Returns the number of lttng_channel entries in channels;
  * on error, returns a negative value.
  */
-int lttng_list_channels(struct lttng_handle *handle,
-               struct lttng_channel **channels)
+int lttng_list_channels(struct lttng_handle *handle, struct lttng_channel **channels)
 {
        int ret, total_payload_received;
        struct lttcomm_session_msg lsm;
@@ -2375,8 +2339,7 @@ int lttng_list_channels(struct lttng_handle *handle,
 
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_CHANNELS;
-       ret = lttng_strncpy(lsm.session.name, handle->session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, handle->session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -2384,9 +2347,14 @@ int lttng_list_channels(struct lttng_handle *handle,
 
        COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
 
-       ret = lttng_ctl_ask_sessiond_fds_varlen(&lsm, NULL, 0, NULL, 0,
-                       (void **) &reception_buffer, (void **) &cmd_header,
-                       &cmd_header_len);
+       ret = lttng_ctl_ask_sessiond_fds_varlen(&lsm,
+                                               NULL,
+                                               0,
+                                               NULL,
+                                               0,
+                                               (void **) &reception_buffer,
+                                               (void **) &cmd_header,
+                                               &cmd_header_len);
        if (ret < 0) {
                goto end;
        }
@@ -2411,11 +2379,10 @@ int lttng_list_channels(struct lttng_handle *handle,
        {
                enum lttng_error_code ret_code;
                const struct lttng_buffer_view events_view =
-                               lttng_buffer_view_init(reception_buffer, 0,
-                                               total_payload_received);
+                       lttng_buffer_view_init(reception_buffer, 0, total_payload_received);
 
                ret_code = lttng_channels_create_and_flatten_from_buffer(
-                               &events_view, cmd_header->count, channels);
+                       &events_view, cmd_header->count, channels);
                if (ret_code != LTTNG_OK) {
                        ret = -ret_code;
                        goto end;
@@ -2436,14 +2403,14 @@ end:
  * on error, returns a negative value.
  */
 int lttng_list_events(struct lttng_handle *handle,
-               const char *channel_name, struct lttng_event **events)
+                     const char *channel_name,
+                     struct lttng_event **events)
 {
        int ret;
        struct lttcomm_session_msg lsm = {};
        struct lttng_payload reply;
        struct lttng_payload_view lsm_view =
-                       lttng_payload_view_init_from_buffer(
-                               (const char *) &lsm, 0, sizeof(lsm));
+               lttng_payload_view_init_from_buffer((const char *) &lsm, 0, sizeof(lsm));
        unsigned int nb_events = 0;
 
        lttng_payload_init(&reply);
@@ -2456,15 +2423,13 @@ int lttng_list_events(struct lttng_handle *handle,
 
        /* Initialize command parameters. */
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_LIST_EVENTS;
-       ret = lttng_strncpy(lsm.session.name, handle->session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, handle->session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       ret = lttng_strncpy(lsm.u.list.channel_name, channel_name,
-                       sizeof(lsm.u.list.channel_name));
+       ret = lttng_strncpy(lsm.u.list.channel_name, channel_name, sizeof(lsm.u.list.channel_name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -2479,11 +2444,9 @@ int lttng_list_events(struct lttng_handle *handle,
        }
 
        {
-               const struct lttcomm_list_command_header *cmd_reply_header =
-                               NULL;
+               const struct lttcomm_list_command_header *cmd_reply_header = NULL;
                const lttng_payload_view cmd_reply_header_view =
-                               lttng_payload_view_from_payload(&reply, 0,
-                                               sizeof(*cmd_reply_header));
+                       lttng_payload_view_from_payload(&reply, 0, sizeof(*cmd_reply_header));
 
                if (!lttng_payload_view_is_valid(&cmd_reply_header_view)) {
                        ret = -LTTNG_ERR_INVALID_PROTOCOL;
@@ -2491,8 +2454,7 @@ int lttng_list_events(struct lttng_handle *handle,
                }
 
                cmd_reply_header = (const struct lttcomm_list_command_header *)
-                                                  cmd_reply_header_view.buffer
-                                                                  .data;
+                                          cmd_reply_header_view.buffer.data;
                if (cmd_reply_header->count > INT_MAX) {
                        ret = -LTTNG_ERR_OVERFLOW;
                        goto end;
@@ -2504,11 +2466,10 @@ int lttng_list_events(struct lttng_handle *handle,
        {
                enum lttng_error_code ret_code;
                lttng_payload_view cmd_reply_payload = lttng_payload_view_from_payload(
-                               &reply,
-                               sizeof(struct lttcomm_list_command_header), -1);
+                       &reply, sizeof(struct lttcomm_list_command_header), -1);
 
                ret_code = lttng_events_create_and_flatten_from_payload(
-                               &cmd_reply_payload, nb_events, events);
+                       &cmd_reply_payload, nb_events, events);
                if (ret_code != LTTNG_OK) {
                        ret = -((int) ret_code);
                        goto end;
@@ -2551,7 +2512,7 @@ end:
 }
 
 int lttng_calibrate(struct lttng_handle *handle __attribute__((unused)),
-               struct lttng_calibrate *calibrate __attribute__((unused)))
+                   struct lttng_calibrate *calibrate __attribute__((unused)))
 {
        /*
         * This command was removed in LTTng 2.9.
@@ -2563,8 +2524,7 @@ int lttng_calibrate(struct lttng_handle *handle __attribute__((unused)),
  * Set default channel attributes.
  * If either or both of the arguments are null, attr content is zeroe'd.
  */
-void lttng_channel_set_default_attr(struct lttng_domain *domain,
-               struct lttng_channel_attr *attr)
+void lttng_channel_set_default_attr(struct lttng_domain *domain, struct lttng_channel_attr *attr)
 {
        struct lttng_channel_extended *extended;
 
@@ -2584,8 +2544,7 @@ void lttng_channel_set_default_attr(struct lttng_domain *domain,
 
        switch (domain->type) {
        case LTTNG_DOMAIN_KERNEL:
-               attr->switch_timer_interval =
-                               DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER;
+               attr->switch_timer_interval = DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER;
                attr->read_timer_interval = DEFAULT_KERNEL_CHANNEL_READ_TIMER;
                attr->subbuf_size = default_get_kernel_channel_subbuf_size();
                attr->num_subbuf = DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM;
@@ -2597,20 +2556,16 @@ void lttng_channel_set_default_attr(struct lttng_domain *domain,
                        attr->subbuf_size = default_get_ust_uid_channel_subbuf_size();
                        attr->num_subbuf = DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM;
                        attr->output = DEFAULT_UST_UID_CHANNEL_OUTPUT;
-                       attr->switch_timer_interval =
-                                       DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER;
-                       attr->read_timer_interval =
-                                       DEFAULT_UST_UID_CHANNEL_READ_TIMER;
+                       attr->switch_timer_interval = DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER;
+                       attr->read_timer_interval = DEFAULT_UST_UID_CHANNEL_READ_TIMER;
                        break;
                case LTTNG_BUFFER_PER_PID:
                default:
                        attr->subbuf_size = default_get_ust_pid_channel_subbuf_size();
                        attr->num_subbuf = DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM;
                        attr->output = DEFAULT_UST_PID_CHANNEL_OUTPUT;
-                       attr->switch_timer_interval =
-                                       DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER;
-                       attr->read_timer_interval =
-                                       DEFAULT_UST_PID_CHANNEL_READ_TIMER;
+                       attr->switch_timer_interval = DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER;
+                       attr->read_timer_interval = DEFAULT_UST_PID_CHANNEL_READ_TIMER;
                        break;
                }
        default:
@@ -2627,7 +2582,7 @@ void lttng_channel_set_default_attr(struct lttng_domain *domain,
 }
 
 int lttng_channel_get_discarded_event_count(struct lttng_channel *channel,
-               uint64_t *discarded_events)
+                                           uint64_t *discarded_events)
 {
        int ret = 0;
        struct lttng_channel_extended *chan_ext;
@@ -2652,8 +2607,7 @@ end:
        return ret;
 }
 
-int lttng_channel_get_lost_packet_count(struct lttng_channel *channel,
-               uint64_t *lost_packets)
+int lttng_channel_get_lost_packet_count(struct lttng_channel *channel, uint64_t *lost_packets)
 {
        int ret = 0;
        struct lttng_channel_extended *chan_ext;
@@ -2679,7 +2633,7 @@ end:
 }
 
 int lttng_channel_get_monitor_timer_interval(struct lttng_channel *chan,
-               uint64_t *monitor_timer_interval)
+                                            uint64_t *monitor_timer_interval)
 {
        int ret = 0;
 
@@ -2693,14 +2647,14 @@ int lttng_channel_get_monitor_timer_interval(struct lttng_channel *chan,
                goto end;
        }
 
-       *monitor_timer_interval = ((struct lttng_channel_extended *)
-                       chan->attr.extended.ptr)->monitor_timer_interval;
+       *monitor_timer_interval =
+               ((struct lttng_channel_extended *) chan->attr.extended.ptr)->monitor_timer_interval;
 end:
        return ret;
 }
 
 int lttng_channel_set_monitor_timer_interval(struct lttng_channel *chan,
-               uint64_t monitor_timer_interval)
+                                            uint64_t monitor_timer_interval)
 {
        int ret = 0;
 
@@ -2709,15 +2663,13 @@ int lttng_channel_set_monitor_timer_interval(struct lttng_channel *chan,
                goto end;
        }
 
-       ((struct lttng_channel_extended *)
-                       chan->attr.extended.ptr)->monitor_timer_interval =
-                       monitor_timer_interval;
+       ((struct lttng_channel_extended *) chan->attr.extended.ptr)->monitor_timer_interval =
+               monitor_timer_interval;
 end:
        return ret;
 }
 
-int lttng_channel_get_blocking_timeout(struct lttng_channel *chan,
-               int64_t *blocking_timeout)
+int lttng_channel_get_blocking_timeout(struct lttng_channel *chan, int64_t *blocking_timeout)
 {
        int ret = 0;
 
@@ -2731,14 +2683,13 @@ int lttng_channel_get_blocking_timeout(struct lttng_channel *chan,
                goto end;
        }
 
-       *blocking_timeout = ((struct lttng_channel_extended *)
-                       chan->attr.extended.ptr)->blocking_timeout;
+       *blocking_timeout =
+               ((struct lttng_channel_extended *) chan->attr.extended.ptr)->blocking_timeout;
 end:
        return ret;
 }
 
-int lttng_channel_set_blocking_timeout(struct lttng_channel *chan,
-               int64_t blocking_timeout)
+int lttng_channel_set_blocking_timeout(struct lttng_channel *chan, int64_t blocking_timeout)
 {
        int ret = 0;
        int64_t msec_timeout;
@@ -2764,9 +2715,8 @@ int lttng_channel_set_blocking_timeout(struct lttng_channel *chan,
                goto end;
        }
 
-       ((struct lttng_channel_extended *)
-                       chan->attr.extended.ptr)->blocking_timeout =
-                       blocking_timeout;
+       ((struct lttng_channel_extended *) chan->attr.extended.ptr)->blocking_timeout =
+               blocking_timeout;
 end:
        return ret;
 }
@@ -2811,7 +2761,8 @@ int lttng_session_daemon_alive(void)
  * Return 0 on success, else a negative value.
  */
 int lttng_set_consumer_url(struct lttng_handle *handle,
-               const char *control_url, const char *data_url)
+                          const char *control_url,
+                          const char *data_url)
 {
        int ret;
        ssize_t size;
@@ -2827,8 +2778,7 @@ int lttng_set_consumer_url(struct lttng_handle *handle,
 
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SET_CONSUMER_URI;
 
-       ret = lttng_strncpy(lsm.session.name, handle->session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, handle->session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
@@ -2844,8 +2794,8 @@ int lttng_set_consumer_url(struct lttng_handle *handle,
 
        lsm.u.uri.size = size;
 
-       ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, uris,
-                       sizeof(struct lttng_uri) * size, NULL);
+       ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(
+               &lsm, uris, sizeof(struct lttng_uri) * size, NULL);
 
        free(uris);
 error:
@@ -2855,8 +2805,7 @@ error:
 /*
  * [OBSOLETE]
  */
-extern "C"
-LTTNG_EXPORT int lttng_enable_consumer(struct lttng_handle *handle);
+extern "C" LTTNG_EXPORT int lttng_enable_consumer(struct lttng_handle *handle);
 int lttng_enable_consumer(struct lttng_handle *handle __attribute__((unused)))
 {
        return -ENOSYS;
@@ -2865,8 +2814,7 @@ int lttng_enable_consumer(struct lttng_handle *handle __attribute__((unused)))
 /*
  * [OBSOLETE]
  */
-extern "C"
-LTTNG_EXPORT int lttng_disable_consumer(struct lttng_handle *handle);
+extern "C" LTTNG_EXPORT int lttng_disable_consumer(struct lttng_handle *handle);
 int lttng_disable_consumer(struct lttng_handle *handle __attribute__((unused)))
 {
        return -ENOSYS;
@@ -2875,12 +2823,11 @@ int lttng_disable_consumer(struct lttng_handle *handle __attribute__((unused)))
 /*
  * [OBSOLETE]
  */
-extern "C"
-LTTNG_EXPORT int _lttng_create_session_ext(const char *name, const char *url,
-               const char *datetime);
+extern "C" LTTNG_EXPORT int
+_lttng_create_session_ext(const char *name, const char *url, const char *datetime);
 int _lttng_create_session_ext(const char *name __attribute__((unused)),
-               const char *url __attribute__((unused)),
-               const char *datetime __attribute__((unused)))
+                             const char *url __attribute__((unused)),
+                             const char *datetime __attribute__((unused)))
 {
        return -ENOSYS;
 }
@@ -2903,8 +2850,7 @@ int lttng_data_pending(const char *session_name)
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_DATA_PENDING;
 
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -2946,8 +2892,7 @@ int lttng_regenerate_metadata(const char *session_name)
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_REGENERATE_METADATA;
 
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -2988,8 +2933,7 @@ int lttng_regenerate_statedump(const char *session_name)
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_REGENERATE_STATEDUMP;
 
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -3005,9 +2949,8 @@ end:
        return ret;
 }
 
-static
-int _lttng_register_trigger(struct lttng_trigger *trigger, const char *name,
-               bool generate_name)
+static int
+_lttng_register_trigger(struct lttng_trigger *trigger, const char *name, bool generate_name)
 {
        int ret;
        struct lttcomm_session_msg lsm = {
@@ -3068,7 +3011,7 @@ int _lttng_register_trigger(struct lttng_trigger *trigger, const char *name,
                 * "safety" checks.
                 */
                const struct lttng_credentials *trigger_creds =
-                               lttng_trigger_get_credentials(trigger);
+                       lttng_trigger_get_credentials(trigger);
 
                if (!lttng_credentials_is_equal_uid(trigger_creds, &user_creds)) {
                        if (lttng_credentials_get_uid(&user_creds) != 0) {
@@ -3083,8 +3026,7 @@ int _lttng_register_trigger(struct lttng_trigger *trigger, const char *name,
                goto end_unset_name;
        }
 
-       domain_type = lttng_trigger_get_underlying_domain_type_restriction(
-                       trigger);
+       domain_type = lttng_trigger_get_underlying_domain_type_restriction(trigger);
 
        lsm.domain.type = domain_type;
 
@@ -3110,11 +3052,9 @@ int _lttng_register_trigger(struct lttng_trigger *trigger, const char *name,
 
        {
                struct lttng_payload_view message_view =
-                               lttng_payload_view_from_payload(
-                                               &message, 0, -1);
+                       lttng_payload_view_from_payload(&message, 0, -1);
 
-               message_lsm->fd_count = lttng_payload_view_get_fd_handle_count(
-                               &message_view);
+               message_lsm->fd_count = lttng_payload_view_get_fd_handle_count(&message_view);
                ret = lttng_ctl_ask_sessiond_payload(&message_view, &reply);
                if (ret < 0) {
                        goto end_unset_name;
@@ -3123,11 +3063,9 @@ int _lttng_register_trigger(struct lttng_trigger *trigger, const char *name,
 
        {
                struct lttng_payload_view reply_view =
-                               lttng_payload_view_from_payload(
-                                               &reply, 0, reply.buffer.size);
+                       lttng_payload_view_from_payload(&reply, 0, reply.buffer.size);
 
-               ret = lttng_trigger_create_from_payload(
-                               &reply_view, &reply_trigger);
+               ret = lttng_trigger_create_from_payload(&reply_view, &reply_trigger);
                if (ret < 0) {
                        ret = -LTTNG_ERR_INVALID_PROTOCOL;
                        goto end_unset_name;
@@ -3163,26 +3101,24 @@ int lttng_register_trigger(struct lttng_trigger *trigger)
        return _lttng_register_trigger(trigger, NULL, false);
 }
 
-enum lttng_error_code lttng_register_trigger_with_name(
-               struct lttng_trigger *trigger, const char *name)
+enum lttng_error_code lttng_register_trigger_with_name(struct lttng_trigger *trigger,
+                                                      const char *name)
 {
        const int ret = _lttng_register_trigger(trigger, name, false);
 
-       return ret == 0 ? LTTNG_OK : (enum lttng_error_code) -ret;
+       return ret == 0 ? LTTNG_OK : (enum lttng_error_code) - ret;
 }
 
-enum lttng_error_code lttng_register_trigger_with_automatic_name(
-               struct lttng_trigger *trigger)
+enum lttng_error_code lttng_register_trigger_with_automatic_name(struct lttng_trigger *trigger)
 {
-       const int ret =  _lttng_register_trigger(trigger, nullptr, true);
+       const int ret = _lttng_register_trigger(trigger, nullptr, true);
 
-       return ret == 0 ? LTTNG_OK : (enum lttng_error_code) -ret;
+       return ret == 0 ? LTTNG_OK : (enum lttng_error_code) - ret;
 }
 
-enum lttng_error_code lttng_error_query_execute(
-               const struct lttng_error_query *query,
-               const struct lttng_endpoint *endpoint,
-               struct lttng_error_query_results **results)
+enum lttng_error_code lttng_error_query_execute(const struct lttng_error_query *query,
+                                               const struct lttng_endpoint *endpoint,
+                                               struct lttng_error_query_results **results)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -3223,19 +3159,16 @@ enum lttng_error_code lttng_error_query_execute(
        }
 
        message_lsm = (struct lttcomm_session_msg *) message.buffer.data;
-       message_lsm->u.error_query.length =
-                       (uint32_t) message.buffer.size - sizeof(lsm);
+       message_lsm->u.error_query.length = (uint32_t) message.buffer.size - sizeof(lsm);
 
        {
                struct lttng_payload_view message_view =
-                               lttng_payload_view_from_payload(
-                                               &message, 0, -1);
+                       lttng_payload_view_from_payload(&message, 0, -1);
 
-               message_lsm->fd_count = lttng_payload_view_get_fd_handle_count(
-                               &message_view);
+               message_lsm->fd_count = lttng_payload_view_get_fd_handle_count(&message_view);
                ret = lttng_ctl_ask_sessiond_payload(&message_view, &reply);
                if (ret < 0) {
-                       ret_code =(lttng_error_code) -ret;
+                       ret_code = (lttng_error_code) -ret;
                        goto end;
                }
        }
@@ -3243,11 +3176,10 @@ enum lttng_error_code lttng_error_query_execute(
        {
                ssize_t reply_create_ret;
                struct lttng_payload_view reply_view =
-                               lttng_payload_view_from_payload(
-                                               &reply, 0, reply.buffer.size);
+                       lttng_payload_view_from_payload(&reply, 0, reply.buffer.size);
 
-               reply_create_ret = lttng_error_query_results_create_from_payload(
-                               &reply_view, results);
+               reply_create_ret =
+                       lttng_error_query_results_create_from_payload(&reply_view, results);
                if (reply_create_ret < 0) {
                        ret_code = LTTNG_ERR_INVALID_PROTOCOL;
                        goto end;
@@ -3302,8 +3234,7 @@ int lttng_unregister_trigger(const struct lttng_trigger *trigger)
                 * credentials passed on the socket. These check are all
                 * "safety" checks.
                 */
-               const struct lttng_credentials *trigger_creds =
-                               lttng_trigger_get_credentials(copy);
+               const struct lttng_credentials *trigger_creds = lttng_trigger_get_credentials(copy);
                if (!lttng_credentials_is_equal_uid(trigger_creds, &user_creds)) {
                        if (lttng_credentials_get_uid(&user_creds) != 0) {
                                ret = -LTTNG_ERR_EPERM;
@@ -3335,22 +3266,20 @@ int lttng_unregister_trigger(const struct lttng_trigger *trigger)
        /*
         * This is needed to populate the trigger object size for the command
         * header and number of fds sent.
-       */
+        */
        message_lsm = (struct lttcomm_session_msg *) message.buffer.data;
 
        message_lsm->u.trigger.length = (uint32_t) message.buffer.size - sizeof(lsm);
 
        {
                struct lttng_payload_view message_view =
-                               lttng_payload_view_from_payload(
-                                               &message, 0, -1);
+                       lttng_payload_view_from_payload(&message, 0, -1);
 
                /*
                 * Update the message header with the number of fd that will be
                 * sent.
                 */
-               message_lsm->fd_count = lttng_payload_view_get_fd_handle_count(
-                               &message_view);
+               message_lsm->fd_count = lttng_payload_view_get_fd_handle_count(&message_view);
 
                ret = lttng_ctl_ask_sessiond_payload(&message_view, &reply);
                if (ret < 0) {
@@ -3386,24 +3315,21 @@ enum lttng_error_code lttng_list_triggers(struct lttng_triggers **triggers)
        struct lttng_triggers *local_triggers = NULL;
        struct lttng_payload reply;
        struct lttng_payload_view lsm_view =
-                       lttng_payload_view_init_from_buffer(
-                               (const char *) &lsm, 0, sizeof(lsm));
+               lttng_payload_view_init_from_buffer((const char *) &lsm, 0, sizeof(lsm));
 
        lttng_payload_init(&reply);
 
        ret = lttng_ctl_ask_sessiond_payload(&lsm_view, &reply);
        if (ret < 0) {
-               ret_code = (enum lttng_error_code) -ret;
+               ret_code = (enum lttng_error_code) - ret;
                goto end;
        }
 
        {
                struct lttng_payload_view reply_view =
-                               lttng_payload_view_from_payload(
-                                               &reply, 0, reply.buffer.size);
+                       lttng_payload_view_from_payload(&reply, 0, reply.buffer.size);
 
-               ret = lttng_triggers_create_from_payload(
-                               &reply_view, &local_triggers);
+               ret = lttng_triggers_create_from_payload(&reply_view, &local_triggers);
                if (ret < 0) {
                        ret_code = LTTNG_ERR_FATAL;
                        goto end;
index 240b8c9ad3ffc5769e12382812c90dd9e8f3cf81..68b882686304a076f2d9b3533b7e31e3159a0b54 100644 (file)
@@ -6,21 +6,20 @@
  */
 
 #define _LGPL_SOURCE
-#include <string.h>
+#include "lttng-ctl-helper.hpp"
+
+#include <common/macros.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
 
-#include <lttng/lttng-error.h>
-#include <lttng/rotation.h>
 #include <lttng/location-internal.hpp>
+#include <lttng/lttng-error.h>
 #include <lttng/rotate-internal.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/macros.hpp>
+#include <lttng/rotation.h>
 
-#include "lttng-ctl-helper.hpp"
+#include <string.h>
 
-static
-enum lttng_rotation_status ask_rotation_info(
-               struct lttng_rotation_handle *rotation_handle,
-               struct lttng_rotation_get_info_return **info)
+static enum lttng_rotation_status ask_rotation_info(struct lttng_rotation_handle *rotation_handle,
+                                                   struct lttng_rotation_get_info_return **info)
 {
        /* lsm.get_rotation_state.rotation_id */
        struct lttcomm_session_msg lsm;
@@ -36,8 +35,8 @@ enum lttng_rotation_status ask_rotation_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,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(
+               lsm.session.name, rotation_handle->session_name, sizeof(lsm.session.name));
        if (ret) {
                status = LTTNG_ROTATION_STATUS_INVALID;
                goto end;
@@ -50,28 +49,26 @@ enum lttng_rotation_status ask_rotation_info(
        }
 end:
        return status;
-
 }
 
-static
-struct lttng_trace_archive_location *
-create_trace_archive_location_from_get_info(
-               const struct lttng_rotation_get_info_return *info)
+static struct lttng_trace_archive_location *
+create_trace_archive_location_from_get_info(const struct lttng_rotation_get_info_return *info)
 {
        struct lttng_trace_archive_location *location;
 
        switch (info->location_type) {
        case LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL:
                location = lttng_trace_archive_location_local_create(
-                               info->location.local.absolute_path);
+                       info->location.local.absolute_path);
                break;
        case LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY:
                location = lttng_trace_archive_location_relay_create(
-                               info->location.relay.host,
-                               (lttng_trace_archive_location_relay_protocol_type) info->location.relay.protocol,
-                               info->location.relay.ports.control,
-                               info->location.relay.ports.data,
-                               info->location.relay.relative_path);
+                       info->location.relay.host,
+                       (lttng_trace_archive_location_relay_protocol_type)
+                               info->location.relay.protocol,
+                       info->location.relay.ports.control,
+                       info->location.relay.ports.data,
+                       info->location.relay.relative_path);
                break;
        default:
                location = NULL;
@@ -80,9 +77,9 @@ create_trace_archive_location_from_get_info(
        return location;
 }
 
-enum lttng_rotation_status lttng_rotation_handle_get_state(
-               struct lttng_rotation_handle *rotation_handle,
-               enum lttng_rotation_state *state)
+enum lttng_rotation_status
+lttng_rotation_handle_get_state(struct lttng_rotation_handle *rotation_handle,
+                               enum lttng_rotation_state *state)
 {
        enum lttng_rotation_status status = LTTNG_ROTATION_STATUS_OK;
        struct lttng_rotation_get_info_return *info = NULL;
@@ -98,8 +95,7 @@ enum lttng_rotation_status lttng_rotation_handle_get_state(
        }
 
        *state = (enum lttng_rotation_state) info->status;
-       if (rotation_handle->archive_location ||
-                       *state != LTTNG_ROTATION_STATE_COMPLETED) {
+       if (rotation_handle->archive_location || *state != LTTNG_ROTATION_STATE_COMPLETED) {
                /*
                 * The path is only provided by the sessiond once
                 * the session rotation is completed, but not expired.
@@ -111,8 +107,7 @@ enum lttng_rotation_status lttng_rotation_handle_get_state(
         * Cache the location since the rotation may expire before the user
         * has a chance to query it.
         */
-       rotation_handle->archive_location =
-                       create_trace_archive_location_from_get_info(info);
+       rotation_handle->archive_location = create_trace_archive_location_from_get_info(info);
        if (!rotation_handle->archive_location) {
                status = LTTNG_ROTATION_STATUS_ERROR;
                goto end;
@@ -122,9 +117,9 @@ end:
        return status;
 }
 
-enum lttng_rotation_status lttng_rotation_handle_get_archive_location(
-               struct lttng_rotation_handle *rotation_handle,
-               const struct lttng_trace_archive_location **location)
+enum lttng_rotation_status
+lttng_rotation_handle_get_archive_location(struct lttng_rotation_handle *rotation_handle,
+                                          const struct lttng_trace_archive_location **location)
 {
        enum lttng_rotation_status status = LTTNG_ROTATION_STATUS_OK;
        struct lttng_rotation_get_info_return *info = NULL;
@@ -145,14 +140,12 @@ enum lttng_rotation_status lttng_rotation_handle_get_archive_location(
                goto end;
        }
 
-       if ((enum lttng_rotation_state) info->status !=
-                       LTTNG_ROTATION_STATE_COMPLETED) {
+       if ((enum lttng_rotation_state) info->status != LTTNG_ROTATION_STATE_COMPLETED) {
                status = LTTNG_ROTATION_STATUS_UNAVAILABLE;
                goto end;
        }
 
-       rotation_handle->archive_location =
-                       create_trace_archive_location_from_get_info(info);
+       rotation_handle->archive_location = create_trace_archive_location_from_get_info(info);
        if (!rotation_handle->archive_location) {
                status = LTTNG_ROTATION_STATUS_ERROR;
                goto end;
@@ -162,8 +155,7 @@ end:
        return status;
 }
 
-void lttng_rotation_handle_destroy(
-               struct lttng_rotation_handle *rotation_handle)
+void lttng_rotation_handle_destroy(struct lttng_rotation_handle *rotation_handle)
 {
        if (!rotation_handle) {
                return;
@@ -172,15 +164,14 @@ void lttng_rotation_handle_destroy(
        free(rotation_handle);
 }
 
-static
-int init_rotation_handle(struct lttng_rotation_handle *rotation_handle,
-               const char *session_name,
-               struct lttng_rotate_session_return *rotate_return)
+static int init_rotation_handle(struct lttng_rotation_handle *rotation_handle,
+                               const char *session_name,
+                               struct lttng_rotate_session_return *rotate_return)
 {
        int ret;
 
-       ret = lttng_strncpy(rotation_handle->session_name, session_name,
-                       sizeof(rotation_handle->session_name));
+       ret = lttng_strncpy(
+               rotation_handle->session_name, session_name, sizeof(rotation_handle->session_name));
        if (ret) {
                goto end;
        }
@@ -196,8 +187,9 @@ end:
  * Return 0 on success else a negative LTTng error code.
  */
 int lttng_rotate_session(const char *session_name,
-               struct lttng_rotation_immediate_descriptor *descriptor __attribute__((unused)),
-               struct lttng_rotation_handle **rotation_handle)
+                        struct lttng_rotation_immediate_descriptor *descriptor
+                        __attribute__((unused)),
+                        struct lttng_rotation_handle **rotation_handle)
 {
        struct lttcomm_session_msg lsm;
        struct lttng_rotate_session_return *rotate_return = NULL;
@@ -219,8 +211,7 @@ int lttng_rotate_session(const char *session_name,
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_ROTATE_SESSION;
 
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                           sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        /* Source length already validated. */
        LTTNG_ASSERT(ret == 0);
 
@@ -262,11 +253,8 @@ end:
  * just its type) must be passed so that the session daemon can
  * validate that is exists before clearing it.
  */
-static
-enum lttng_rotation_status lttng_rotation_update_schedule(
-               const char *session_name,
-               const struct lttng_rotation_schedule *schedule,
-               bool add)
+static enum lttng_rotation_status lttng_rotation_update_schedule(
+       const char *session_name, const struct lttng_rotation_schedule *schedule, bool add)
 {
        struct lttcomm_session_msg lsm;
        enum lttng_rotation_status status = LTTNG_ROTATION_STATUS_OK;
@@ -284,8 +272,7 @@ enum lttng_rotation_status lttng_rotation_update_schedule(
 
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_ROTATION_SET_SCHEDULE;
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        /* Source length already validated. */
        LTTNG_ASSERT(ret == 0);
 
@@ -295,8 +282,7 @@ enum lttng_rotation_status lttng_rotation_update_schedule(
        {
                uint64_t threshold;
 
-               status = lttng_rotation_schedule_size_threshold_get_threshold(
-                               schedule, &threshold);
+               status = lttng_rotation_schedule_size_threshold_get_threshold(schedule, &threshold);
                if (status != LTTNG_ROTATION_STATUS_OK) {
                        if (status == LTTNG_ROTATION_STATUS_UNAVAILABLE) {
                                status = LTTNG_ROTATION_STATUS_INVALID;
@@ -311,8 +297,7 @@ enum lttng_rotation_status lttng_rotation_update_schedule(
        {
                uint64_t period;
 
-               status = lttng_rotation_schedule_periodic_get_period(
-                               schedule, &period);
+               status = lttng_rotation_schedule_periodic_get_period(schedule, &period);
                if (status != LTTNG_ROTATION_STATUS_OK) {
                        if (status == LTTNG_ROTATION_STATUS_UNAVAILABLE) {
                                status = LTTNG_ROTATION_STATUS_INVALID;
@@ -347,22 +332,18 @@ end:
        return status;
 }
 
-static
-struct lttng_rotation_schedules *lttng_rotation_schedules_create(void)
+static struct lttng_rotation_schedules *lttng_rotation_schedules_create(void)
 {
        return zmalloc<lttng_rotation_schedules>();
 }
 
-static
-void lttng_schedules_add(struct lttng_rotation_schedules *schedules,
-               struct lttng_rotation_schedule *schedule)
+static void lttng_schedules_add(struct lttng_rotation_schedules *schedules,
+                               struct lttng_rotation_schedule *schedule)
 {
        schedules->schedules[schedules->count++] = schedule;
 }
 
-static
-int get_schedules(const char *session_name,
-               struct lttng_rotation_schedules **_schedules)
+static int get_schedules(const char *session_name, struct lttng_rotation_schedules **_schedules)
 {
        int ret;
        struct lttcomm_session_msg lsm;
@@ -377,8 +358,7 @@ int get_schedules(const char *session_name,
 
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SESSION_LIST_ROTATION_SCHEDULES;
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -405,7 +385,7 @@ int get_schedules(const char *session_name,
                }
 
                status = lttng_rotation_schedule_periodic_set_period(
-                               periodic, schedules_comm->periodic.value);
+                       periodic, schedules_comm->periodic.value);
                if (status != LTTNG_ROTATION_STATUS_OK) {
                        /*
                         * This would imply that the session daemon returned
@@ -429,7 +409,7 @@ int get_schedules(const char *session_name,
                }
 
                status = lttng_rotation_schedule_size_threshold_set_threshold(
-                               size, schedules_comm->size.value);
+                       size, schedules_comm->size.value);
                if (status != LTTNG_ROTATION_STATUS_OK) {
                        /*
                         * This would imply that the session daemon returned
@@ -452,14 +432,13 @@ end:
        return ret;
 }
 
-enum lttng_rotation_schedule_type lttng_rotation_schedule_get_type(
-               const struct lttng_rotation_schedule *schedule)
+enum lttng_rotation_schedule_type
+lttng_rotation_schedule_get_type(const struct lttng_rotation_schedule *schedule)
 {
        return schedule ? schedule->type : LTTNG_ROTATION_SCHEDULE_TYPE_UNKNOWN;
 }
 
-struct lttng_rotation_schedule *
-lttng_rotation_schedule_size_threshold_create(void)
+struct lttng_rotation_schedule *lttng_rotation_schedule_size_threshold_create(void)
 {
        struct lttng_rotation_schedule_size_threshold *schedule;
 
@@ -474,21 +453,20 @@ end:
 }
 
 enum lttng_rotation_status
-lttng_rotation_schedule_size_threshold_get_threshold(
-               const struct lttng_rotation_schedule *schedule,
-               uint64_t *size_threshold_bytes)
+lttng_rotation_schedule_size_threshold_get_threshold(const struct lttng_rotation_schedule *schedule,
+                                                    uint64_t *size_threshold_bytes)
 {
        enum lttng_rotation_status status = LTTNG_ROTATION_STATUS_OK;
        struct lttng_rotation_schedule_size_threshold *size_schedule;
 
        if (!schedule || !size_threshold_bytes ||
-                       schedule->type != LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD) {
+           schedule->type != LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD) {
                status = LTTNG_ROTATION_STATUS_INVALID;
                goto end;
        }
 
        size_schedule = lttng::utils::container_of(schedule,
-                       &lttng_rotation_schedule_size_threshold::parent);
+                                                  &lttng_rotation_schedule_size_threshold::parent);
        if (size_schedule->size.set) {
                *size_threshold_bytes = size_schedule->size.bytes;
        } else {
@@ -500,30 +478,27 @@ end:
 }
 
 enum lttng_rotation_status
-lttng_rotation_schedule_size_threshold_set_threshold(
-               struct lttng_rotation_schedule *schedule,
-               uint64_t size_threshold_bytes)
+lttng_rotation_schedule_size_threshold_set_threshold(struct lttng_rotation_schedule *schedule,
+                                                    uint64_t size_threshold_bytes)
 {
        enum lttng_rotation_status status = LTTNG_ROTATION_STATUS_OK;
        struct lttng_rotation_schedule_size_threshold *size_schedule;
 
-       if (!schedule || size_threshold_bytes == 0 ||
-                       size_threshold_bytes == -1ULL ||
-                       schedule->type != LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD) {
+       if (!schedule || size_threshold_bytes == 0 || size_threshold_bytes == -1ULL ||
+           schedule->type != LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD) {
                status = LTTNG_ROTATION_STATUS_INVALID;
                goto end;
        }
 
        size_schedule = lttng::utils::container_of(schedule,
-                       &lttng_rotation_schedule_size_threshold::parent);
+                                                  &lttng_rotation_schedule_size_threshold::parent);
        size_schedule->size.bytes = size_threshold_bytes;
        size_schedule->size.set = true;
 end:
        return status;
 }
 
-struct lttng_rotation_schedule *
-lttng_rotation_schedule_periodic_create(void)
+struct lttng_rotation_schedule *lttng_rotation_schedule_periodic_create(void)
 {
        struct lttng_rotation_schedule_periodic *schedule;
 
@@ -538,21 +513,19 @@ end:
 }
 
 enum lttng_rotation_status
-lttng_rotation_schedule_periodic_get_period(
-               const struct lttng_rotation_schedule *schedule,
-               uint64_t *period_us)
+lttng_rotation_schedule_periodic_get_period(const struct lttng_rotation_schedule *schedule,
+                                           uint64_t *period_us)
 {
        enum lttng_rotation_status status = LTTNG_ROTATION_STATUS_OK;
        struct lttng_rotation_schedule_periodic *periodic_schedule;
 
-       if (!schedule || !period_us ||
-                       schedule->type != LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC) {
+       if (!schedule || !period_us || schedule->type != LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC) {
                status = LTTNG_ROTATION_STATUS_INVALID;
                goto end;
        }
 
-       periodic_schedule = lttng::utils::container_of(schedule,
-                       &lttng_rotation_schedule_periodic::parent);
+       periodic_schedule =
+               lttng::utils::container_of(schedule, &lttng_rotation_schedule_periodic::parent);
        if (periodic_schedule->period.set) {
                *period_us = periodic_schedule->period.us;
        } else {
@@ -564,21 +537,20 @@ end:
 }
 
 enum lttng_rotation_status
-lttng_rotation_schedule_periodic_set_period(
-               struct lttng_rotation_schedule *schedule,
-               uint64_t period_us)
+lttng_rotation_schedule_periodic_set_period(struct lttng_rotation_schedule *schedule,
+                                           uint64_t period_us)
 {
        enum lttng_rotation_status status = LTTNG_ROTATION_STATUS_OK;
        struct lttng_rotation_schedule_periodic *periodic_schedule;
 
        if (!schedule || period_us == 0 || period_us == -1ULL ||
-                       schedule->type != LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC) {
+           schedule->type != LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC) {
                status = LTTNG_ROTATION_STATUS_INVALID;
                goto end;
        }
 
-       periodic_schedule = lttng::utils::container_of(schedule,
-                       &lttng_rotation_schedule_periodic::parent);
+       periodic_schedule =
+               lttng::utils::container_of(schedule, &lttng_rotation_schedule_periodic::parent);
        periodic_schedule->period.us = period_us;
        periodic_schedule->period.set = true;
 end:
@@ -593,8 +565,7 @@ void lttng_rotation_schedule_destroy(struct lttng_rotation_schedule *schedule)
        free(schedule);
 }
 
-void lttng_rotation_schedules_destroy(
-               struct lttng_rotation_schedules *schedules)
+void lttng_rotation_schedules_destroy(struct lttng_rotation_schedules *schedules)
 {
        unsigned int i;
 
@@ -608,10 +579,9 @@ void lttng_rotation_schedules_destroy(
        free(schedules);
 }
 
-
-enum lttng_rotation_status lttng_rotation_schedules_get_count(
-               const struct lttng_rotation_schedules *schedules,
-               unsigned int *count)
+enum lttng_rotation_status
+lttng_rotation_schedules_get_count(const struct lttng_rotation_schedules *schedules,
+                                  unsigned int *count)
 {
        enum lttng_rotation_status status = LTTNG_ROTATION_STATUS_OK;
 
@@ -625,9 +595,9 @@ end:
        return status;
 }
 
-const struct lttng_rotation_schedule *lttng_rotation_schedules_get_at_index(
-               const struct lttng_rotation_schedules *schedules,
-               unsigned int index)
+const struct lttng_rotation_schedule *
+lttng_rotation_schedules_get_at_index(const struct lttng_rotation_schedules *schedules,
+                                     unsigned int index)
 {
        const struct lttng_rotation_schedule *schedule = NULL;
 
@@ -640,23 +610,22 @@ end:
        return schedule;
 }
 
-enum lttng_rotation_status lttng_session_add_rotation_schedule(
-               const char *session_name,
-               const struct lttng_rotation_schedule *schedule)
+enum lttng_rotation_status
+lttng_session_add_rotation_schedule(const char *session_name,
+                                   const struct lttng_rotation_schedule *schedule)
 {
        return lttng_rotation_update_schedule(session_name, schedule, true);
 }
 
-enum lttng_rotation_status lttng_session_remove_rotation_schedule(
-               const char *session_name,
-               const struct lttng_rotation_schedule *schedule)
+enum lttng_rotation_status
+lttng_session_remove_rotation_schedule(const char *session_name,
+                                      const struct lttng_rotation_schedule *schedule)
 {
        return lttng_rotation_update_schedule(session_name, schedule, false);
 }
 
-int lttng_session_list_rotation_schedules(
-               const char *session_name,
-               struct lttng_rotation_schedules **schedules)
+int lttng_session_list_rotation_schedules(const char *session_name,
+                                         struct lttng_rotation_schedules **schedules)
 {
        return get_schedules(session_name, schedules);
 }
index dcbad45b3ebb5b27801fd2520dc07972414d5f41..e53f5f68c51898085ad78e6941e4d2cfb2e11231 100644 (file)
@@ -6,14 +6,15 @@
  */
 
 #define _LGPL_SOURCE
-#include <string.h>
+#include "lttng-ctl-helper.hpp"
+
+#include <common/sessiond-comm/sessiond-comm.hpp>
 
 #include <lttng/lttng-error.h>
-#include <lttng/save.h>
 #include <lttng/save-internal.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <lttng/save.h>
 
-#include "lttng-ctl-helper.hpp"
+#include <string.h>
 
 struct lttng_save_session_attr *lttng_save_session_attr_create(void)
 {
@@ -27,8 +28,7 @@ void lttng_save_session_attr_destroy(struct lttng_save_session_attr *output)
        }
 }
 
-const char *lttng_save_session_attr_get_session_name(
-       struct lttng_save_session_attr *attr)
+const char *lttng_save_session_attr_get_session_name(struct lttng_save_session_attr *attr)
 {
        const char *ret = NULL;
 
@@ -39,8 +39,7 @@ const char *lttng_save_session_attr_get_session_name(
        return ret;
 }
 
-const char *lttng_save_session_attr_get_output_url(
-       struct lttng_save_session_attr *attr)
+const char *lttng_save_session_attr_get_output_url(struct lttng_save_session_attr *attr)
 {
        const char *ret = NULL;
 
@@ -51,26 +50,23 @@ const char *lttng_save_session_attr_get_output_url(
        return ret;
 }
 
-int lttng_save_session_attr_get_overwrite(
-       struct lttng_save_session_attr *attr)
+int lttng_save_session_attr_get_overwrite(struct lttng_save_session_attr *attr)
 {
        return attr ? attr->overwrite : -LTTNG_ERR_INVALID;
 }
 
-int lttng_save_session_attr_get_omit_name(
-       struct lttng_save_session_attr *attr)
+int lttng_save_session_attr_get_omit_name(struct lttng_save_session_attr *attr)
 {
        return attr ? attr->omit_name : -LTTNG_ERR_INVALID;
 }
 
-int lttng_save_session_attr_get_omit_output(
-       struct lttng_save_session_attr *attr)
+int lttng_save_session_attr_get_omit_output(struct lttng_save_session_attr *attr)
 {
        return attr ? attr->omit_output : -LTTNG_ERR_INVALID;
 }
 
-int lttng_save_session_attr_set_session_name(
-       struct lttng_save_session_attr *attr, const char *session_name)
+int lttng_save_session_attr_set_session_name(struct lttng_save_session_attr *attr,
+                                            const char *session_name)
 {
        int ret = 0;
 
@@ -88,8 +84,7 @@ int lttng_save_session_attr_set_session_name(
                        goto error;
                }
 
-               ret = lttng_strncpy(attr->session_name, session_name,
-                               sizeof(attr->session_name));
+               ret = lttng_strncpy(attr->session_name, session_name, sizeof(attr->session_name));
                if (ret) {
                        ret = -LTTNG_ERR_INVALID;
                        goto error;
@@ -101,8 +96,7 @@ error:
        return ret;
 }
 
-int lttng_save_session_attr_set_output_url(
-       struct lttng_save_session_attr *attr, const char *url)
+int lttng_save_session_attr_set_output_url(struct lttng_save_session_attr *attr, const char *url)
 {
        int ret = 0;
        size_t len;
@@ -133,8 +127,8 @@ int lttng_save_session_attr_set_output_url(
        }
 
        /* Copy string plus the NULL terminated byte. */
-       ret = lttng_strncpy(attr->configuration_url, uris[0].dst.path,
-                           sizeof(attr->configuration_url));
+       ret = lttng_strncpy(
+               attr->configuration_url, uris[0].dst.path, sizeof(attr->configuration_url));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
@@ -146,8 +140,7 @@ error:
        return ret;
 }
 
-int lttng_save_session_attr_set_overwrite(
-       struct lttng_save_session_attr *attr, int overwrite)
+int lttng_save_session_attr_set_overwrite(struct lttng_save_session_attr *attr, int overwrite)
 {
        int ret = 0;
 
@@ -161,8 +154,7 @@ end:
        return ret;
 }
 
-int lttng_save_session_attr_set_omit_name(
-       struct lttng_save_session_attr *attr, int omit_name)
+int lttng_save_session_attr_set_omit_name(struct lttng_save_session_attr *attr, int omit_name)
 {
        int ret = 0;
 
@@ -176,8 +168,7 @@ end:
        return ret;
 }
 
-int lttng_save_session_attr_set_omit_output(
-       struct lttng_save_session_attr *attr, int omit_output)
+int lttng_save_session_attr_set_omit_output(struct lttng_save_session_attr *attr, int omit_output)
 {
        int ret = 0;
 
@@ -209,8 +200,7 @@ int lttng_save_session(struct lttng_save_session_attr *attr)
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SAVE_SESSION;
 
-       memcpy(&lsm.u.save_session.attr, attr,
-               sizeof(struct lttng_save_session_attr));
+       memcpy(&lsm.u.save_session.attr, attr, sizeof(struct lttng_save_session_attr));
        ret = lttng_ctl_ask_sessiond(&lsm, NULL);
 end:
        return ret;
index 2814cc5ee2bca788e2e2412257f98693f127c963..dcdbbd130a630f0da9f96ed832473d5d8a6d8d90 100644 (file)
@@ -6,22 +6,22 @@
  */
 
 #define _LGPL_SOURCE
-#include <string.h>
+#include "lttng-ctl-helper.hpp"
 
 #include <common/sessiond-comm/sessiond-comm.hpp>
+
 #include <lttng/lttng-error.h>
-#include <lttng/snapshot.h>
 #include <lttng/snapshot-internal.hpp>
+#include <lttng/snapshot.h>
 
-#include "lttng-ctl-helper.hpp"
+#include <string.h>
 
 /*
  * Add an output object to a session identified by name.
  *
  * Return 0 on success or else a negative LTTNG_ERR code.
  */
-int lttng_snapshot_add_output(const char *session_name,
-               struct lttng_snapshot_output *output)
+int lttng_snapshot_add_output(const char *session_name, struct lttng_snapshot_output *output)
 {
        int ret;
        struct lttcomm_session_msg lsm;
@@ -35,15 +35,13 @@ int lttng_snapshot_add_output(const char *session_name,
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_ADD_OUTPUT;
 
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       memcpy(&lsm.u.snapshot_output.output, output,
-                       sizeof(lsm.u.snapshot_output.output));
+       memcpy(&lsm.u.snapshot_output.output, output, sizeof(lsm.u.snapshot_output.output));
 
        ret = lttng_ctl_ask_sessiond(&lsm, (void **) &reply);
        if (ret < 0) {
@@ -62,8 +60,7 @@ end:
  *
  * Return 0 on success or else a negative LTTNG_ERR code.
  */
-int lttng_snapshot_del_output(const char *session_name,
-               struct lttng_snapshot_output *output)
+int lttng_snapshot_del_output(const char *session_name, struct lttng_snapshot_output *output)
 {
        int ret;
        struct lttcomm_session_msg lsm;
@@ -76,15 +73,13 @@ int lttng_snapshot_del_output(const char *session_name,
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_DEL_OUTPUT;
 
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                           sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       memcpy(&lsm.u.snapshot_output.output, output,
-                       sizeof(lsm.u.snapshot_output.output));
+       memcpy(&lsm.u.snapshot_output.output, output, sizeof(lsm.u.snapshot_output.output));
 
        ret = lttng_ctl_ask_sessiond(&lsm, NULL);
 end:
@@ -98,8 +93,7 @@ end:
  * Return 0 on success or else a negative LTTNG_ERR code and the list pointer
  * is untouched.
  */
-int lttng_snapshot_list_output(const char *session_name,
-               struct lttng_snapshot_output_list **list)
+int lttng_snapshot_list_output(const char *session_name, struct lttng_snapshot_output_list **list)
 {
        int ret;
        struct lttcomm_session_msg lsm;
@@ -113,8 +107,7 @@ int lttng_snapshot_list_output(const char *session_name,
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_LIST_OUTPUT;
 
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                           sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto error;
@@ -148,8 +141,8 @@ error:
  * Return the next object on success or else NULL indicating the end of the
  * list.
  */
-struct lttng_snapshot_output *lttng_snapshot_output_list_get_next(
-               struct lttng_snapshot_output_list *list)
+struct lttng_snapshot_output *
+lttng_snapshot_output_list_get_next(struct lttng_snapshot_output_list *list)
 {
        struct lttng_snapshot_output *output = NULL;
 
@@ -196,8 +189,8 @@ void lttng_snapshot_output_list_destroy(struct lttng_snapshot_output_list *list)
  * Return 0 on success or else a negative LTTNG_ERR value.
  */
 int lttng_snapshot_record(const char *session_name,
-               struct lttng_snapshot_output *output,
-               int wait __attribute__((unused)))
+                         struct lttng_snapshot_output *output,
+                         int wait __attribute__((unused)))
 {
        int ret;
        struct lttcomm_session_msg lsm;
@@ -210,8 +203,7 @@ int lttng_snapshot_record(const char *session_name,
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_RECORD;
 
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                       sizeof(lsm.session.name));
+       ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name));
        if (ret) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
@@ -223,8 +215,7 @@ int lttng_snapshot_record(const char *session_name,
         * record.
         */
        if (output) {
-               memcpy(&lsm.u.snapshot_record.output, output,
-                               sizeof(lsm.u.snapshot_record.output));
+               memcpy(&lsm.u.snapshot_record.output, output, sizeof(lsm.u.snapshot_record.output));
        }
 
        /* The wait param is ignored. */
@@ -270,8 +261,7 @@ uint32_t lttng_snapshot_output_get_id(const struct lttng_snapshot_output *output
        return output->id;
 }
 
-const char *lttng_snapshot_output_get_name(
-               const struct lttng_snapshot_output *output)
+const char *lttng_snapshot_output_get_name(const struct lttng_snapshot_output *output)
 {
        return output->name;
 }
@@ -286,8 +276,7 @@ const char *lttng_snapshot_output_get_ctrl_url(const struct lttng_snapshot_outpu
        return output->ctrl_url;
 }
 
-uint64_t lttng_snapshot_output_get_maxsize(
-               const struct lttng_snapshot_output *output)
+uint64_t lttng_snapshot_output_get_maxsize(const struct lttng_snapshot_output *output)
 {
        return output->max_size;
 }
@@ -296,8 +285,7 @@ uint64_t lttng_snapshot_output_get_maxsize(
  * Setter family functions for snapshot output.
  */
 
-int lttng_snapshot_output_set_id(uint32_t id,
-               struct lttng_snapshot_output *output)
+int lttng_snapshot_output_set_id(uint32_t id, struct lttng_snapshot_output *output)
 {
        if (!output || id == 0) {
                return -LTTNG_ERR_INVALID;
@@ -307,8 +295,7 @@ int lttng_snapshot_output_set_id(uint32_t id,
        return 0;
 }
 
-int lttng_snapshot_output_set_size(uint64_t size,
-               struct lttng_snapshot_output *output)
+int lttng_snapshot_output_set_size(uint64_t size, struct lttng_snapshot_output *output)
 {
        if (!output) {
                return -LTTNG_ERR_INVALID;
@@ -318,8 +305,7 @@ int lttng_snapshot_output_set_size(uint64_t size,
        return 0;
 }
 
-int lttng_snapshot_output_set_name(const char *name,
-               struct lttng_snapshot_output *output)
+int lttng_snapshot_output_set_name(const char *name, struct lttng_snapshot_output *output)
 {
        int ret;
 
@@ -338,8 +324,7 @@ end:
        return ret;
 }
 
-int lttng_snapshot_output_set_ctrl_url(const char *url,
-               struct lttng_snapshot_output *output)
+int lttng_snapshot_output_set_ctrl_url(const char *url, struct lttng_snapshot_output *output)
 {
        int ret;
 
@@ -358,8 +343,7 @@ end:
        return ret;
 }
 
-int lttng_snapshot_output_set_data_url(const char *url,
-               struct lttng_snapshot_output *output)
+int lttng_snapshot_output_set_data_url(const char *url, struct lttng_snapshot_output *output)
 {
        int ret;
 
@@ -378,8 +362,7 @@ end:
        return ret;
 }
 
-int lttng_snapshot_output_set_local_path(const char *path,
-               struct lttng_snapshot_output *output)
+int lttng_snapshot_output_set_local_path(const char *path, struct lttng_snapshot_output *output)
 {
        int ret;
        struct lttng_uri *uris = NULL;
@@ -412,8 +395,7 @@ end:
        return ret;
 }
 
-int lttng_snapshot_output_set_network_url(const char *url,
-               struct lttng_snapshot_output *output)
+int lttng_snapshot_output_set_network_url(const char *url, struct lttng_snapshot_output *output)
 {
        int ret;
        struct lttng_uri *uris = NULL;
@@ -430,14 +412,12 @@ int lttng_snapshot_output_set_network_url(const char *url,
                goto end;
        }
 
-       if (uris[0].dtype != LTTNG_DST_IPV4 &&
-                       uris[0].dtype != LTTNG_DST_IPV6) {
+       if (uris[0].dtype != LTTNG_DST_IPV4 && uris[0].dtype != LTTNG_DST_IPV6) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       if (uris[1].dtype != LTTNG_DST_IPV4 &&
-                       uris[1].dtype != LTTNG_DST_IPV6) {
+       if (uris[1].dtype != LTTNG_DST_IPV4 && uris[1].dtype != LTTNG_DST_IPV6) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
@@ -453,9 +433,9 @@ end:
        return ret;
 }
 
-int lttng_snapshot_output_set_network_urls(
-               const char *ctrl_url, const char *data_url,
-               struct lttng_snapshot_output *output)
+int lttng_snapshot_output_set_network_urls(const char *ctrl_url,
+                                          const char *data_url,
+                                          struct lttng_snapshot_output *output)
 {
        int ret;
        struct lttng_uri *uris = NULL;
@@ -472,14 +452,12 @@ int lttng_snapshot_output_set_network_urls(
                goto end;
        }
 
-       if (uris[0].dtype != LTTNG_DST_IPV4 &&
-                       uris[0].dtype != LTTNG_DST_IPV6) {
+       if (uris[0].dtype != LTTNG_DST_IPV4 && uris[0].dtype != LTTNG_DST_IPV6) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       if (uris[1].dtype != LTTNG_DST_IPV4 &&
-                       uris[1].dtype != LTTNG_DST_IPV6) {
+       if (uris[1].dtype != LTTNG_DST_IPV4 && uris[1].dtype != LTTNG_DST_IPV6) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
index 47d8ecb5cf1e1e123173222c49b8f893efaf08a1..cf32a4c33d8f80f7e48f2c7a020dbbfd41b42e62 100644 (file)
@@ -5,13 +5,15 @@
  *
  */
 
-#include <lttng/domain.h>
-#include <lttng/lttng-error.h>
-
 #include "lttng-ctl-helper.hpp"
+
 #include <common/sessiond-comm/sessiond-comm.hpp>
 #include <common/tracker.hpp>
+
+#include <lttng/domain.h>
+#include <lttng/lttng-error.h>
 #include <lttng/tracker.h>
+
 #include <type_traits>
 
 struct lttng_process_attr_tracker_handle {
@@ -21,8 +23,7 @@ struct lttng_process_attr_tracker_handle {
        struct lttng_process_attr_values *inclusion_set;
 };
 
-void lttng_process_attr_tracker_handle_destroy(
-               struct lttng_process_attr_tracker_handle *tracker)
+void lttng_process_attr_tracker_handle_destroy(struct lttng_process_attr_tracker_handle *tracker)
 {
        if (!tracker) {
                return;
@@ -33,10 +34,11 @@ void lttng_process_attr_tracker_handle_destroy(
        free(tracker);
 }
 
-enum lttng_error_code lttng_session_get_tracker_handle(const char *session_name,
-               enum lttng_domain_type domain,
-               enum lttng_process_attr process_attr,
-               struct lttng_process_attr_tracker_handle **out_tracker_handle)
+enum lttng_error_code
+lttng_session_get_tracker_handle(const char *session_name,
+                                enum lttng_domain_type domain,
+                                enum lttng_process_attr process_attr,
+                                struct lttng_process_attr_tracker_handle **out_tracker_handle)
 {
        enum lttng_error_code ret_code = LTTNG_OK;
        struct lttng_process_attr_tracker_handle *handle = NULL;
@@ -72,8 +74,7 @@ enum lttng_error_code lttng_session_get_tracker_handle(const char *session_name,
         * Use the `get_tracking_policy` command to validate the tracker's
         * existence.
         */
-       status = lttng_process_attr_tracker_handle_get_tracking_policy(
-                       handle, &policy);
+       status = lttng_process_attr_tracker_handle_get_tracking_policy(handle, &policy);
        switch (status) {
        case LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK:
                break;
@@ -92,15 +93,13 @@ error:
        return ret_code;
 }
 
-enum lttng_process_attr_tracker_handle_status
-lttng_process_attr_tracker_handle_get_tracking_policy(
-               const struct lttng_process_attr_tracker_handle *tracker,
-               enum lttng_tracking_policy *policy)
+enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_get_tracking_policy(
+       const struct lttng_process_attr_tracker_handle *tracker, enum lttng_tracking_policy *policy)
 {
        void *reply = NULL;
        int reply_ret, copy_ret;
        enum lttng_process_attr_tracker_handle_status status =
-                       LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK;
+               LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK;
        struct lttcomm_session_msg lsm = {
                .cmd_type = LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_GET_POLICY,
                .session = {},
@@ -114,8 +113,7 @@ lttng_process_attr_tracker_handle_get_tracking_policy(
                goto end;
        }
 
-       copy_ret = lttng_strncpy(lsm.session.name, tracker->session_name,
-                       sizeof(lsm.session.name));
+       copy_ret = lttng_strncpy(lsm.session.name, tracker->session_name, sizeof(lsm.session.name));
        if (copy_ret) {
                status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID;
                goto end;
@@ -123,14 +121,13 @@ lttng_process_attr_tracker_handle_get_tracking_policy(
 
        lsm.domain.type = tracker->domain;
        lsm.u.process_attr_tracker_get_tracking_policy.process_attr =
-                       (int32_t) tracker->process_attr;
+               (int32_t) tracker->process_attr;
 
        /* Command returns a session descriptor on success. */
-       reply_ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(
-                       &lsm, NULL, 0, &reply);
+       reply_ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, NULL, 0, &reply);
        if (reply_ret != sizeof(uint32_t)) {
                if (reply_ret == -LTTNG_ERR_SESSION_NOT_EXIST ||
-                               reply_ret == -LTTNG_ERR_SESS_NOT_FOUND) {
+                   reply_ret == -LTTNG_ERR_SESS_NOT_FOUND) {
                        status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_SESSION_DOES_NOT_EXIST;
                } else {
                        status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_ERROR;
@@ -144,14 +141,12 @@ end:
        return status;
 }
 
-enum lttng_process_attr_tracker_handle_status
-lttng_process_attr_tracker_handle_set_tracking_policy(
-               const struct lttng_process_attr_tracker_handle *tracker,
-               enum lttng_tracking_policy policy)
+enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_set_tracking_policy(
+       const struct lttng_process_attr_tracker_handle *tracker, enum lttng_tracking_policy policy)
 {
        int reply_ret, copy_ret;
        enum lttng_process_attr_tracker_handle_status status =
-                       LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK;
+               LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK;
        struct lttcomm_session_msg lsm = {
                .cmd_type = LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_SET_POLICY,
                .session = {},
@@ -165,8 +160,7 @@ lttng_process_attr_tracker_handle_set_tracking_policy(
                goto end;
        }
 
-       copy_ret = lttng_strncpy(lsm.session.name, tracker->session_name,
-                                sizeof(lsm.session.name));
+       copy_ret = lttng_strncpy(lsm.session.name, tracker->session_name, sizeof(lsm.session.name));
        if (copy_ret) {
                status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID;
                goto end;
@@ -174,9 +168,8 @@ lttng_process_attr_tracker_handle_set_tracking_policy(
 
        lsm.domain.type = tracker->domain;
        lsm.u.process_attr_tracker_set_tracking_policy.process_attr =
-                       (int32_t) tracker->process_attr;
-       lsm.u.process_attr_tracker_set_tracking_policy.tracking_policy =
-                       (int32_t) policy;
+               (int32_t) tracker->process_attr;
+       lsm.u.process_attr_tracker_set_tracking_policy.tracking_policy = (int32_t) policy;
 
        /* Command returns a session descriptor on success. */
        reply_ret = lttng_ctl_ask_sessiond(&lsm, NULL);
@@ -192,205 +185,183 @@ end:
        return status;
 }
 
-#define DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(command_upper,                                                 \
-               command_lower, process_attr_name, value_type_name,                                                   \
-               value_type_c, value_type_enum)                                                                       \
-       enum lttng_process_attr_tracker_handle_status                                                                \
-                       lttng_process_attr_##process_attr_name##_tracker_handle_##command_lower##_##value_type_name( \
-                                       const struct lttng_process_attr_tracker_handle                               \
-                                                       *tracker,                                                    \
-                                       value_type_c value)                                                          \
-       {                                                                                                            \
-               int ret;                                                                                             \
-               enum lttng_process_attr_tracker_handle_status status =                                               \
-                               LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK;                                         \
-               struct lttcomm_session_msg lsm = {                                                                   \
-                       .cmd_type = LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_##command_upper##_INCLUDE_VALUE,                      \
-                       .session = {},                                                                               \
-                       .domain = {},                                                                                \
-                       .u = {},                                                                                     \
-                       .fd_count = 0,                                                                               \
-               };                                                                                                   \
-                                                                                                                     \
-               if (!tracker) {                                                                                      \
-                       status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID;                                   \
-                       goto end;                                                                                    \
-               }                                                                                                    \
-                                                                                                                     \
-               ret = lttng_strncpy(lsm.session.name, tracker->session_name,                                         \
-                               sizeof(lsm.session.name));                                                           \
-               if (ret) {                                                                                           \
-                       status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID;                                   \
-                       goto end;                                                                                    \
-               }                                                                                                    \
-                                                                                                                     \
-               lsm.domain.type = tracker->domain;                                                                   \
-               lsm.u.process_attr_tracker_add_remove_include_value                                                  \
-                               .process_attr =                                                                      \
-                               (int32_t) tracker->process_attr;                                                     \
-               lsm.u.process_attr_tracker_add_remove_include_value                                                  \
-                               .value_type = (uint32_t)                                                             \
-                               LTTNG_PROCESS_ATTR_VALUE_TYPE_##value_type_enum;                                     \
-                                                                                                                     \
-               if (std::is_signed<value_type_c>::value) {                                                                       \
-                       lsm.u.process_attr_tracker_add_remove_include_value                                          \
-                                       .integral_value.u._signed = value;                                           \
-               } else {                                                                                             \
-                       lsm.u.process_attr_tracker_add_remove_include_value                                          \
-                                       .integral_value.u._unsigned = value;                                         \
-               }                                                                                                    \
-                                                                                                                     \
-               ret = lttng_ctl_ask_sessiond(&lsm, NULL);                                                            \
-               if (ret < 0) {                                                                                       \
-                       switch (-ret) {                                                                              \
-                       case LTTNG_ERR_PROCESS_ATTR_EXISTS:                                                          \
-                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_EXISTS;                            \
-                               break;                                                                               \
-                       case LTTNG_ERR_PROCESS_ATTR_MISSING:                                                         \
-                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_MISSING;                           \
-                               break;                                                                               \
-                       case LTTNG_ERR_PROCESS_ATTR_TRACKER_INVALID_TRACKING_POLICY:                                 \
-                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID_TRACKING_POLICY;           \
-                               break;                                                                               \
-                       default:                                                                                     \
-                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_ERROR;                             \
-                       }                                                                                            \
-               }                                                                                                    \
-       end:                                                                                                         \
-               return status;                                                                                       \
-       }
-
-#define DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(command_upper,                                                   \
-               command_lower, process_attr_name, value_type_name,                                                   \
-               value_type_enum)                                                                                     \
-       enum lttng_process_attr_tracker_handle_status                                                                \
-                       lttng_process_attr_##process_attr_name##_tracker_handle_##command_lower##_##value_type_name( \
-                                       const struct lttng_process_attr_tracker_handle                               \
-                                                       *tracker,                                                    \
-                                       const char *value)                                                           \
-       {                                                                                                            \
-               int ret;                                                                                             \
-               enum lttng_process_attr_tracker_handle_status status =                                               \
-                               LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK;                                         \
-               struct lttcomm_session_msg lsm = {                                                                   \
-                       .cmd_type = LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_##command_upper##_INCLUDE_VALUE,                      \
-                       .session = {},                                                                               \
-                       .domain = {},                                                                                \
-                       .u = {},                                                                                     \
-                       .fd_count = 0,                                                                               \
-               };                                                                                                   \
-               const size_t len = value ? strlen(value) + 1 : 0;                                                    \
-                                                                                                                     \
-               if (!tracker || !value) {                                                                            \
-                       status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID;                                   \
-                       goto end;                                                                                    \
-               }                                                                                                    \
-                                                                                                                     \
-               ret = lttng_strncpy(lsm.session.name, tracker->session_name,                                         \
-                               sizeof(lsm.session.name));                                                           \
-               if (ret) {                                                                                           \
-                       status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID;                                   \
-                       goto end;                                                                                    \
-               }                                                                                                    \
-                                                                                                                     \
-               lsm.domain.type = tracker->domain;                                                                   \
-               lsm.u.process_attr_tracker_add_remove_include_value                                                  \
-                               .process_attr =                                                                      \
-                               (int32_t) tracker->process_attr;                                                     \
-               lsm.u.process_attr_tracker_add_remove_include_value.name_len =                                       \
-                               (uint32_t) len;                                                                      \
-               lsm.u.process_attr_tracker_add_remove_include_value                                                  \
-                               .value_type = (uint32_t)                                                             \
-                               LTTNG_PROCESS_ATTR_VALUE_TYPE_##value_type_enum;                                     \
-                                                                                                                     \
-               ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(                                                   \
-                               &lsm, value, len, NULL);                                                             \
-               if (ret < 0) {                                                                                       \
-                       switch (-ret) {                                                                              \
-                       case LTTNG_ERR_PROCESS_ATTR_EXISTS:                                                          \
-                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_EXISTS;                            \
-                               break;                                                                               \
-                       case LTTNG_ERR_PROCESS_ATTR_MISSING:                                                         \
-                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_MISSING;                           \
-                               break;                                                                               \
-                       case LTTNG_ERR_PROCESS_ATTR_TRACKER_INVALID_TRACKING_POLICY:                                 \
-                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID_TRACKING_POLICY;           \
-                               break;                                                                               \
-                       case LTTNG_ERR_USER_NOT_FOUND:                                                               \
-                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_USER_NOT_FOUND;                    \
-                               break;                                                                               \
-                       case LTTNG_ERR_GROUP_NOT_FOUND:                                                              \
-                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_GROUP_NOT_FOUND;                   \
-                               break;                                                                               \
-                       default:                                                                                     \
-                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_ERROR;                             \
-                       }                                                                                            \
-               }                                                                                                    \
-       end:                                                                                                         \
-               return status;                                                                                       \
+#define DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(command_upper,                                           \
+                                                     command_lower,                                           \
+                                                     process_attr_name,                                       \
+                                                     value_type_name,                                         \
+                                                     value_type_c,                                            \
+                                                     value_type_enum)                                         \
+       enum lttng_process_attr_tracker_handle_status                                                          \
+               lttng_process_attr_##process_attr_name##_tracker_handle_##command_lower##_##value_type_name(   \
+                       const struct lttng_process_attr_tracker_handle *tracker,                               \
+                       value_type_c value)                                                                    \
+       {                                                                                                      \
+               int ret;                                                                                       \
+               enum lttng_process_attr_tracker_handle_status status =                                         \
+                       LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK;                                           \
+               struct lttcomm_session_msg lsm = {                                                             \
+                       .cmd_type =                                                                            \
+                               LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_##command_upper##_INCLUDE_VALUE, \
+                       .session = {},                                                                         \
+                       .domain = {},                                                                          \
+                       .u = {},                                                                               \
+                       .fd_count = 0,                                                                         \
+               };                                                                                             \
+                                                                                                               \
+               if (!tracker) {                                                                                \
+                       status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID;                             \
+                       goto end;                                                                              \
+               }                                                                                              \
+                                                                                                               \
+               ret = lttng_strncpy(                                                                           \
+                       lsm.session.name, tracker->session_name, sizeof(lsm.session.name));                    \
+               if (ret) {                                                                                     \
+                       status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID;                             \
+                       goto end;                                                                              \
+               }                                                                                              \
+                                                                                                               \
+               lsm.domain.type = tracker->domain;                                                             \
+               lsm.u.process_attr_tracker_add_remove_include_value.process_attr =                             \
+                       (int32_t) tracker->process_attr;                                                       \
+               lsm.u.process_attr_tracker_add_remove_include_value.value_type =                               \
+                       (uint32_t) LTTNG_PROCESS_ATTR_VALUE_TYPE_##value_type_enum;                            \
+                                                                                                               \
+               if (std::is_signed<value_type_c>::value) {                                                     \
+                       lsm.u.process_attr_tracker_add_remove_include_value.integral_value.u                   \
+                               ._signed = value;                                                              \
+               } else {                                                                                       \
+                       lsm.u.process_attr_tracker_add_remove_include_value.integral_value.u                   \
+                               ._unsigned = value;                                                            \
+               }                                                                                              \
+                                                                                                               \
+               ret = lttng_ctl_ask_sessiond(&lsm, NULL);                                                      \
+               if (ret < 0) {                                                                                 \
+                       switch (-ret) {                                                                        \
+                       case LTTNG_ERR_PROCESS_ATTR_EXISTS:                                                    \
+                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_EXISTS;                      \
+                               break;                                                                         \
+                       case LTTNG_ERR_PROCESS_ATTR_MISSING:                                                   \
+                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_MISSING;                     \
+                               break;                                                                         \
+                       case LTTNG_ERR_PROCESS_ATTR_TRACKER_INVALID_TRACKING_POLICY:                           \
+                               status =                                                                       \
+                                       LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID_TRACKING_POLICY;      \
+                               break;                                                                         \
+                       default:                                                                               \
+                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_ERROR;                       \
+                       }                                                                                      \
+               }                                                                                              \
+       end:                                                                                                   \
+               return status;                                                                                 \
+       }
+
+#define DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(                                                           \
+       command_upper, command_lower, process_attr_name, value_type_name, value_type_enum)                     \
+       enum lttng_process_attr_tracker_handle_status                                                          \
+               lttng_process_attr_##process_attr_name##_tracker_handle_##command_lower##_##value_type_name(   \
+                       const struct lttng_process_attr_tracker_handle *tracker,                               \
+                       const char *value)                                                                     \
+       {                                                                                                      \
+               int ret;                                                                                       \
+               enum lttng_process_attr_tracker_handle_status status =                                         \
+                       LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK;                                           \
+               struct lttcomm_session_msg lsm = {                                                             \
+                       .cmd_type =                                                                            \
+                               LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_##command_upper##_INCLUDE_VALUE, \
+                       .session = {},                                                                         \
+                       .domain = {},                                                                          \
+                       .u = {},                                                                               \
+                       .fd_count = 0,                                                                         \
+               };                                                                                             \
+               const size_t len = value ? strlen(value) + 1 : 0;                                              \
+                                                                                                               \
+               if (!tracker || !value) {                                                                      \
+                       status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID;                             \
+                       goto end;                                                                              \
+               }                                                                                              \
+                                                                                                               \
+               ret = lttng_strncpy(                                                                           \
+                       lsm.session.name, tracker->session_name, sizeof(lsm.session.name));                    \
+               if (ret) {                                                                                     \
+                       status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID;                             \
+                       goto end;                                                                              \
+               }                                                                                              \
+                                                                                                               \
+               lsm.domain.type = tracker->domain;                                                             \
+               lsm.u.process_attr_tracker_add_remove_include_value.process_attr =                             \
+                       (int32_t) tracker->process_attr;                                                       \
+               lsm.u.process_attr_tracker_add_remove_include_value.name_len = (uint32_t) len;                 \
+               lsm.u.process_attr_tracker_add_remove_include_value.value_type =                               \
+                       (uint32_t) LTTNG_PROCESS_ATTR_VALUE_TYPE_##value_type_enum;                            \
+                                                                                                               \
+               ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, value, len, NULL);                     \
+               if (ret < 0) {                                                                                 \
+                       switch (-ret) {                                                                        \
+                       case LTTNG_ERR_PROCESS_ATTR_EXISTS:                                                    \
+                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_EXISTS;                      \
+                               break;                                                                         \
+                       case LTTNG_ERR_PROCESS_ATTR_MISSING:                                                   \
+                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_MISSING;                     \
+                               break;                                                                         \
+                       case LTTNG_ERR_PROCESS_ATTR_TRACKER_INVALID_TRACKING_POLICY:                           \
+                               status =                                                                       \
+                                       LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID_TRACKING_POLICY;      \
+                               break;                                                                         \
+                       case LTTNG_ERR_USER_NOT_FOUND:                                                         \
+                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_USER_NOT_FOUND;              \
+                               break;                                                                         \
+                       case LTTNG_ERR_GROUP_NOT_FOUND:                                                        \
+                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_GROUP_NOT_FOUND;             \
+                               break;                                                                         \
+                       default:                                                                               \
+                               status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_ERROR;                       \
+                       }                                                                                      \
+               }                                                                                              \
+       end:                                                                                                   \
+               return status;                                                                                 \
        }
 
 /* PID */
-DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(
-               ADD, add, process_id, pid, pid_t, PID);
-DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(
-               REMOVE, remove, process_id, pid, pid_t, PID);
+DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(ADD, add, process_id, pid, pid_t, PID);
+DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(REMOVE, remove, process_id, pid, pid_t, PID);
 
 /* VPID */
-DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(
-               ADD, add, virtual_process_id, pid, pid_t, PID);
-DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(
-               REMOVE, remove, virtual_process_id, pid, pid_t, PID);
+DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(ADD, add, virtual_process_id, pid, pid_t, PID);
+DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(REMOVE, remove, virtual_process_id, pid, pid_t, PID);
 
 /* UID */
-DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(
-               ADD, add, user_id, uid, uid_t, UID);
-DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(
-               REMOVE, remove, user_id, uid, uid_t, UID);
-DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(
-               ADD, add, user_id, user_name, USER_NAME);
-DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(
-               REMOVE, remove, user_id, user_name, USER_NAME);
+DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(ADD, add, user_id, uid, uid_t, UID);
+DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(REMOVE, remove, user_id, uid, uid_t, UID);
+DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(ADD, add, user_id, user_name, USER_NAME);
+DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(REMOVE, remove, user_id, user_name, USER_NAME);
 
 /* VUID */
-DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(
-               ADD, add, virtual_user_id, uid, uid_t, UID);
-DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(
-               REMOVE, remove, virtual_user_id, uid, uid_t, UID);
-DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(
-               ADD, add, virtual_user_id, user_name, USER_NAME);
-DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(
-               REMOVE, remove, virtual_user_id, user_name, USER_NAME);
+DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(ADD, add, virtual_user_id, uid, uid_t, UID);
+DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(REMOVE, remove, virtual_user_id, uid, uid_t, UID);
+DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(ADD, add, virtual_user_id, user_name, USER_NAME);
+DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(REMOVE, remove, virtual_user_id, user_name, USER_NAME);
 
 /* GID */
-DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(
-               ADD, add, group_id, gid, gid_t, GID);
-DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(
-               REMOVE, remove, group_id, gid, gid_t, GID);
-DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(
-               ADD, add, group_id, group_name, GROUP_NAME);
-DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(
-               REMOVE, remove, group_id, group_name, GROUP_NAME);
+DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(ADD, add, group_id, gid, gid_t, GID);
+DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(REMOVE, remove, group_id, gid, gid_t, GID);
+DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(ADD, add, group_id, group_name, GROUP_NAME);
+DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(REMOVE, remove, group_id, group_name, GROUP_NAME);
 
 /* VGID */
-DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(
-               ADD, add, virtual_group_id, gid, gid_t, GID);
-DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(
-               REMOVE, remove, virtual_group_id, gid, gid_t, GID);
+DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(ADD, add, virtual_group_id, gid, gid_t, GID);
+DEFINE_TRACKER_ADD_REMOVE_INTEGRAL_VALUE_FUNC(REMOVE, remove, virtual_group_id, gid, gid_t, GID);
+DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(ADD, add, virtual_group_id, group_name, GROUP_NAME);
 DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(
-               ADD, add, virtual_group_id, group_name, GROUP_NAME);
-DEFINE_TRACKER_ADD_REMOVE_STRING_VALUE_FUNC(
-               REMOVE, remove, virtual_group_id, group_name, GROUP_NAME);
+       REMOVE, remove, virtual_group_id, group_name, GROUP_NAME);
 
-enum lttng_process_attr_tracker_handle_status
-lttng_process_attr_tracker_handle_get_inclusion_set(
-               struct lttng_process_attr_tracker_handle *tracker,
-               const struct lttng_process_attr_values **values)
+enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_get_inclusion_set(
+       struct lttng_process_attr_tracker_handle *tracker,
+       const struct lttng_process_attr_values **values)
 {
        char *reply = NULL;
        int reply_ret, copy_ret;
        enum lttng_process_attr_tracker_handle_status status =
-                       LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK;
+               LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK;
        struct lttcomm_session_msg lsm = {
                .cmd_type = LTTCOMM_SESSIOND_COMMAND_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET,
                .session = {},
@@ -409,8 +380,7 @@ lttng_process_attr_tracker_handle_get_inclusion_set(
        lttng_process_attr_values_destroy(tracker->inclusion_set);
        tracker->inclusion_set = NULL;
 
-       copy_ret = lttng_strncpy(lsm.session.name, tracker->session_name,
-                       sizeof(lsm.session.name));
+       copy_ret = lttng_strncpy(lsm.session.name, tracker->session_name, sizeof(lsm.session.name));
        if (copy_ret) {
                status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID;
                goto end;
@@ -418,16 +388,14 @@ lttng_process_attr_tracker_handle_get_inclusion_set(
 
        lsm.domain.type = tracker->domain;
        lsm.u.process_attr_tracker_get_tracking_policy.process_attr =
-                       (int32_t) tracker->process_attr;
+               (int32_t) tracker->process_attr;
 
        /* Command returns a session descriptor on success. */
-       reply_ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(
-                       &lsm, NULL, 0, (void **) &reply);
+       reply_ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, NULL, 0, (void **) &reply);
        if (reply_ret < 0) {
                if (reply_ret == -LTTNG_ERR_SESSION_NOT_EXIST) {
                        status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_SESSION_DOES_NOT_EXIST;
-               } else if (reply_ret ==
-                               -LTTNG_ERR_PROCESS_ATTR_TRACKER_INVALID_TRACKING_POLICY) {
+               } else if (reply_ret == -LTTNG_ERR_PROCESS_ATTR_TRACKER_INVALID_TRACKING_POLICY) {
                        status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID_TRACKING_POLICY;
                } else {
                        status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_ERROR;
@@ -444,9 +412,10 @@ lttng_process_attr_tracker_handle_get_inclusion_set(
                goto end;
        }
 
-       inclusion_set_ret = lttng_process_attr_values_create_from_buffer(
-                       tracker->domain, tracker->process_attr,
-                       &inclusion_set_view, &tracker->inclusion_set);
+       inclusion_set_ret = lttng_process_attr_values_create_from_buffer(tracker->domain,
+                                                                        tracker->process_attr,
+                                                                        &inclusion_set_view,
+                                                                        &tracker->inclusion_set);
        if (inclusion_set_ret < 0) {
                status = LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_COMMUNICATION_ERROR;
                goto end;
@@ -457,12 +426,11 @@ end:
        return status;
 }
 
-enum lttng_process_attr_values_status lttng_process_attr_values_get_count(
-               const struct lttng_process_attr_values *values,
-               unsigned int *count)
+enum lttng_process_attr_values_status
+lttng_process_attr_values_get_count(const struct lttng_process_attr_values *values,
+                                   unsigned int *count)
 {
-       enum lttng_process_attr_values_status status =
-                       LTTNG_PROCESS_ATTR_VALUES_STATUS_OK;
+       enum lttng_process_attr_values_status status = LTTNG_PROCESS_ATTR_VALUES_STATUS_OK;
 
        if (!values || !count) {
                status = LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID;
@@ -474,9 +442,9 @@ end:
        return status;
 }
 
-enum lttng_process_attr_value_type lttng_process_attr_values_get_type_at_index(
-               const struct lttng_process_attr_values *values,
-               unsigned int index)
+enum lttng_process_attr_value_type
+lttng_process_attr_values_get_type_at_index(const struct lttng_process_attr_values *values,
+                                           unsigned int index)
 {
        enum lttng_process_attr_value_type type;
        const struct process_attr_value *value;
@@ -497,39 +465,35 @@ end:
        return type;
 }
 
-#define DEFINE_LTTNG_PROCESS_ATTR_VALUES_GETTER(                                       \
-               value_type_name, value_type, expected_value_type)                      \
-       enum lttng_process_attr_values_status                                          \
-                       lttng_process_attr_values_get_##value_type_name##_at_index(    \
-                                       const struct lttng_process_attr_values         \
-                                                       *values,                       \
-                                       unsigned int index,                            \
-                                       value_type *out_value)                         \
-       {                                                                              \
-               enum lttng_process_attr_values_status status =                         \
-                               LTTNG_PROCESS_ATTR_VALUES_STATUS_OK;                   \
-               const struct process_attr_value *value;                                \
-                                                                                       \
-               if (!values) {                                                         \
-                       status = LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID;             \
-                       goto end;                                                      \
-               }                                                                      \
-                                                                                       \
-               if (_lttng_process_attr_values_get_count(values) <= index) {           \
-                       status = LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID;             \
-                       goto end;                                                      \
-               }                                                                      \
-                                                                                       \
-               value = lttng_process_attr_tracker_values_get_at_index(                \
-                               values, index);                                        \
-               if (value->type !=                                                     \
-                               LTTNG_PROCESS_ATTR_VALUE_TYPE_##expected_value_type) { \
-                       status = LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE;        \
-                       goto end;                                                      \
-               }                                                                      \
-               *out_value = value->value.value_type_name;                             \
-       end:                                                                           \
-               return status;                                                         \
+#define DEFINE_LTTNG_PROCESS_ATTR_VALUES_GETTER(value_type_name, value_type, expected_value_type) \
+       enum lttng_process_attr_values_status                                                     \
+               lttng_process_attr_values_get_##value_type_name##_at_index(                       \
+                       const struct lttng_process_attr_values *values,                           \
+                       unsigned int index,                                                       \
+                       value_type *out_value)                                                    \
+       {                                                                                         \
+               enum lttng_process_attr_values_status status =                                    \
+                       LTTNG_PROCESS_ATTR_VALUES_STATUS_OK;                                      \
+               const struct process_attr_value *value;                                           \
+                                                                                                  \
+               if (!values) {                                                                    \
+                       status = LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID;                        \
+                       goto end;                                                                 \
+               }                                                                                 \
+                                                                                                  \
+               if (_lttng_process_attr_values_get_count(values) <= index) {                      \
+                       status = LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID;                        \
+                       goto end;                                                                 \
+               }                                                                                 \
+                                                                                                  \
+               value = lttng_process_attr_tracker_values_get_at_index(values, index);            \
+               if (value->type != LTTNG_PROCESS_ATTR_VALUE_TYPE_##expected_value_type) {         \
+                       status = LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE;                   \
+                       goto end;                                                                 \
+               }                                                                                 \
+               *out_value = value->value.value_type_name;                                        \
+       end:                                                                                      \
+               return status;                                                                    \
        }
 
 DEFINE_LTTNG_PROCESS_ATTR_VALUES_GETTER(pid, pid_t, PID);
@@ -538,8 +502,8 @@ DEFINE_LTTNG_PROCESS_ATTR_VALUES_GETTER(gid, gid_t, GID);
 DEFINE_LTTNG_PROCESS_ATTR_VALUES_GETTER(user_name, const char *, USER_NAME);
 DEFINE_LTTNG_PROCESS_ATTR_VALUES_GETTER(group_name, const char *, GROUP_NAME);
 
-static enum lttng_error_code handle_status_to_error_code(
-               enum lttng_process_attr_tracker_handle_status handle_status)
+static enum lttng_error_code
+handle_status_to_error_code(enum lttng_process_attr_tracker_handle_status handle_status)
 {
        switch (handle_status) {
        case LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID_TRACKING_POLICY:
@@ -579,26 +543,24 @@ int lttng_track_pid(struct lttng_handle *handle, int pid)
        }
 
        process_attr = handle->domain.type == LTTNG_DOMAIN_KERNEL ?
-                                      LTTNG_PROCESS_ATTR_PROCESS_ID :
-                                      LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID;
+               LTTNG_PROCESS_ATTR_PROCESS_ID :
+               LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID;
 
-       ret_code = lttng_session_get_tracker_handle(handle->session_name,
-                       handle->domain.type,
-                       process_attr, &tracker_handle);
+       ret_code = lttng_session_get_tracker_handle(
+               handle->session_name, handle->domain.type, process_attr, &tracker_handle);
        if (ret_code != LTTNG_OK) {
                goto end;
        }
 
        if (pid == -1) {
                handle_status = lttng_process_attr_tracker_handle_set_tracking_policy(
-                               tracker_handle,
-                               LTTNG_TRACKING_POLICY_INCLUDE_ALL);
+                       tracker_handle, LTTNG_TRACKING_POLICY_INCLUDE_ALL);
                ret_code = handle_status_to_error_code(handle_status);
                goto end;
        }
 
-       handle_status = lttng_process_attr_tracker_handle_get_tracking_policy(
-               tracker_handle, &policy);
+       handle_status =
+               lttng_process_attr_tracker_handle_get_tracking_policy(tracker_handle, &policy);
        if (handle_status != LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK) {
                ret_code = handle_status_to_error_code(handle_status);
                goto end;
@@ -606,8 +568,7 @@ int lttng_track_pid(struct lttng_handle *handle, int pid)
 
        if (policy != LTTNG_TRACKING_POLICY_INCLUDE_SET) {
                handle_status = lttng_process_attr_tracker_handle_set_tracking_policy(
-                       tracker_handle,
-                       LTTNG_TRACKING_POLICY_INCLUDE_SET);
+                       tracker_handle, LTTNG_TRACKING_POLICY_INCLUDE_SET);
                if (handle_status != LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK) {
                        ret_code = handle_status_to_error_code(handle_status);
                        goto end;
@@ -615,12 +576,9 @@ int lttng_track_pid(struct lttng_handle *handle, int pid)
        }
 
        handle_status = process_attr == LTTNG_PROCESS_ATTR_PROCESS_ID ?
-                                       lttng_process_attr_process_id_tracker_handle_add_pid(
-                                                       tracker_handle,
-                                                       (pid_t) pid) :
-                                       lttng_process_attr_virtual_process_id_tracker_handle_add_pid(
-                                                       tracker_handle,
-                                                       (pid_t) pid);
+               lttng_process_attr_process_id_tracker_handle_add_pid(tracker_handle, (pid_t) pid) :
+               lttng_process_attr_virtual_process_id_tracker_handle_add_pid(tracker_handle,
+                                                                            (pid_t) pid);
        ret_code = handle_status_to_error_code(handle_status);
 end:
        lttng_process_attr_tracker_handle_destroy(tracker_handle);
@@ -645,24 +603,23 @@ int lttng_untrack_pid(struct lttng_handle *handle, int pid)
        }
 
        process_attr = handle->domain.type == LTTNG_DOMAIN_KERNEL ?
-                                      LTTNG_PROCESS_ATTR_PROCESS_ID :
-                                      LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID;
-       ret_code = lttng_session_get_tracker_handle(handle->session_name,
-                       handle->domain.type, process_attr, &tracker_handle);
+               LTTNG_PROCESS_ATTR_PROCESS_ID :
+               LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID;
+       ret_code = lttng_session_get_tracker_handle(
+               handle->session_name, handle->domain.type, process_attr, &tracker_handle);
        if (ret_code != LTTNG_OK) {
                goto end;
        }
 
        if (pid == -1) {
                handle_status = lttng_process_attr_tracker_handle_set_tracking_policy(
-                               tracker_handle,
-                               LTTNG_TRACKING_POLICY_EXCLUDE_ALL);
+                       tracker_handle, LTTNG_TRACKING_POLICY_EXCLUDE_ALL);
                ret_code = handle_status_to_error_code(handle_status);
                goto end;
        }
 
-       handle_status = lttng_process_attr_tracker_handle_get_tracking_policy(
-               tracker_handle, &policy);
+       handle_status =
+               lttng_process_attr_tracker_handle_get_tracking_policy(tracker_handle, &policy);
        if (handle_status != LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK) {
                ret_code = handle_status_to_error_code(handle_status);
                goto end;
@@ -677,12 +634,10 @@ int lttng_untrack_pid(struct lttng_handle *handle, int pid)
        }
 
        handle_status = process_attr == LTTNG_PROCESS_ATTR_PROCESS_ID ?
-                                       lttng_process_attr_process_id_tracker_handle_remove_pid(
-                                                       tracker_handle,
-                                                       (pid_t) pid) :
-                                       lttng_process_attr_virtual_process_id_tracker_handle_remove_pid(
-                                                       tracker_handle,
-                                                       (pid_t) pid);
+               lttng_process_attr_process_id_tracker_handle_remove_pid(tracker_handle,
+                                                                       (pid_t) pid) :
+               lttng_process_attr_virtual_process_id_tracker_handle_remove_pid(tracker_handle,
+                                                                               (pid_t) pid);
        if (handle_status == LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID_TRACKING_POLICY) {
                ret_code = LTTNG_ERR_PID_NOT_TRACKED;
        }
@@ -702,9 +657,9 @@ end:
  * Returns 0 on success, else a negative LTTng error code.
  */
 int lttng_list_tracker_pids(struct lttng_handle *handle,
-               int *_enabled,
-               int32_t **_pids,
-               size_t *_nr_pids)
+                           int *_enabled,
+                           int32_t **_pids,
+                           size_t *_nr_pids)
 {
        enum lttng_error_code ret_code;
        struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
@@ -720,29 +675,28 @@ int lttng_list_tracker_pids(struct lttng_handle *handle,
        }
 
        ret_code = lttng_session_get_tracker_handle(handle->session_name,
-                       handle->domain.type,
-                       LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID, &tracker_handle);
+                                                   handle->domain.type,
+                                                   LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID,
+                                                   &tracker_handle);
        if (ret_code != LTTNG_OK) {
                goto end;
        }
 
        while (true) {
-               handle_status = lttng_process_attr_tracker_handle_get_inclusion_set(
-                               tracker_handle, &values);
-               if (handle_status ==
-                               LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK) {
+               handle_status = lttng_process_attr_tracker_handle_get_inclusion_set(tracker_handle,
+                                                                                   &values);
+               if (handle_status == LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK) {
                        policy = LTTNG_TRACKING_POLICY_INCLUDE_SET;
                        break;
                } else if (handle_status !=
-                               LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID_TRACKING_POLICY) {
+                          LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID_TRACKING_POLICY) {
                        ret_code = handle_status_to_error_code(handle_status);
                        goto end;
                }
 
                handle_status = lttng_process_attr_tracker_handle_get_tracking_policy(
-                               tracker_handle, &policy);
-               if (handle_status !=
-                               LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK) {
+                       tracker_handle, &policy);
+               if (handle_status != LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK) {
                        ret_code = handle_status_to_error_code(handle_status);
                        goto end;
                }
@@ -765,8 +719,7 @@ int lttng_list_tracker_pids(struct lttng_handle *handle,
        case LTTNG_TRACKING_POLICY_INCLUDE_SET:
        {
                const enum lttng_process_attr_values_status values_status =
-                               lttng_process_attr_values_get_count(
-                                               values, &pid_count);
+                       lttng_process_attr_values_get_count(values, &pid_count);
 
                if (values_status != LTTNG_PROCESS_ATTR_VALUES_STATUS_OK) {
                        ret_code = LTTNG_ERR_UNK;
@@ -789,8 +742,7 @@ int lttng_list_tracker_pids(struct lttng_handle *handle,
        for (i = 0; i < pid_count; i++) {
                pid_t pid;
                const enum lttng_process_attr_values_status values_status =
-                               lttng_process_attr_values_get_pid_at_index(
-                                               values, i, &pid);
+                       lttng_process_attr_values_get_pid_at_index(values, i, &pid);
 
                if (values_status != LTTNG_PROCESS_ATTR_VALUES_STATUS_OK) {
                        ret_code = LTTNG_ERR_UNK;
index 32cecddbb13409c2e1551385c47eb7043142538b..b8e2db90d0218d1f709ad9ef0bd5c57a623102e1 100644 (file)
@@ -13,6 +13,9 @@
 #undef _FORTIFY_SOURCE
 #endif
 
+#include <common/compat/time.hpp>
+#include <common/error.hpp>
+
 #include <fcntl.h>
 #include <limits.h>
 #include <poll.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/compat/time.hpp>
-#include <common/error.hpp>
-
 #define BUF_SIZE 256
-#define NB_FD 1
-#define MAX_FDS 2047
-#define NR_ITER 1000 /* for stress-tests */
+#define NB_FD   1
+#define MAX_FDS         2047
+#define NR_ITER         1000 /* for stress-tests */
 
-#define MIN_NR_FDS 5 /* the minimum number of open FDs required for the test to run */
+#define MIN_NR_FDS    5 /* the minimum number of open FDs required for the test to run */
 #define BIG_SELECT_FD 1022
 
 #define MSEC_PER_USEC 1000
@@ -72,8 +72,7 @@ const struct test_case {
        test_case_cb run;
        bool produces_validation_info;
        int timeout;
-} test_cases [] =
-{
+} test_cases[] = {
        { .run = run_working_cases, .produces_validation_info = true, .timeout = -1 },
        { .run = run_working_cases, .produces_validation_info = true, .timeout = 1 },
        { .run = pselect_invalid_fd, .produces_validation_info = false, .timeout = 0 },
@@ -93,8 +92,7 @@ struct ppoll_thread_data {
 };
 } /* namespace */
 
-static
-void test_select_big(void)
+static void test_select_big(void)
 {
        fd_set rfds, wfds, exfds;
        struct timeval tv;
@@ -140,8 +138,7 @@ end:
        return;
 }
 
-static
-void test_pselect(void)
+static void test_pselect(void)
 {
        fd_set rfds;
        struct timespec tv;
@@ -170,8 +167,7 @@ void test_pselect(void)
        }
 }
 
-static
-void test_select(void)
+static void test_select(void)
 {
        fd_set rfds;
        struct timeval tv;
@@ -200,15 +196,14 @@ void test_select(void)
        }
 }
 
-static
-void test_poll(void)
+static void test_poll(void)
 {
        struct pollfd ufds[NB_FD];
        char buf[BUF_SIZE];
        int ret;
 
        ufds[0].fd = wait_fd;
-       ufds[0].events = POLLIN|POLLPRI;
+       ufds[0].events = POLLIN | POLLPRI;
 
        ret = poll(ufds, 1, timeout);
 
@@ -222,8 +217,7 @@ void test_poll(void)
        }
 }
 
-static
-void test_ppoll(void)
+static void test_ppoll(void)
 {
        struct pollfd ufds[NB_FD];
        char buf[BUF_SIZE];
@@ -231,7 +225,7 @@ void test_ppoll(void)
        struct timespec ts;
 
        ufds[0].fd = wait_fd;
-       ufds[0].events = POLLIN|POLLPRI;
+       ufds[0].events = POLLIN | POLLPRI;
 
        if (timeout > 0) {
                ts.tv_sec = 0;
@@ -241,7 +235,6 @@ void test_ppoll(void)
                ret = ppoll(ufds, 1, NULL, NULL);
        }
 
-
        if (ret < 0) {
                PERROR("ppoll");
        } else if (ret > 0) {
@@ -252,8 +245,7 @@ void test_ppoll(void)
        }
 }
 
-static
-void test_ppoll_big(FILE *validation_output_file __attribute__((unused)))
+static void test_ppoll_big(FILE *validation_output_file __attribute__((unused)))
 {
        struct pollfd ufds[MAX_FDS];
        char buf[BUF_SIZE];
@@ -265,7 +257,7 @@ void test_ppoll_big(FILE *validation_output_file __attribute__((unused)))
                        PERROR("dup");
                }
                ufds[i].fd = fds[i];
-               ufds[i].events = POLLIN|POLLPRI;
+               ufds[i].events = POLLIN | POLLPRI;
        }
 
        ret = ppoll(ufds, MAX_FDS, NULL, NULL);
@@ -289,8 +281,7 @@ void test_ppoll_big(FILE *validation_output_file __attribute__((unused)))
        return;
 }
 
-static
-void test_epoll(FILE *validation_output_file)
+static void test_epoll(FILE *validation_output_file)
 {
        int ret, epollfd;
        char buf[BUF_SIZE];
@@ -302,8 +293,7 @@ void test_epoll(FILE *validation_output_file)
                goto end;
        }
 
-       ret = fprintf(validation_output_file,
-                       ", \"epoll_wait_fd\": %i", epollfd);
+       ret = fprintf(validation_output_file, ", \"epoll_wait_fd\": %i", epollfd);
        if (ret < 0) {
                PERROR("[epoll] Failed to write test validation output");
                goto error;
@@ -341,8 +331,7 @@ end:
        return;
 }
 
-static
-void test_epoll_pwait(FILE *validation_output_file)
+static void test_epoll_pwait(FILE *validation_output_file)
 {
        int ret, epollfd;
        char buf[BUF_SIZE];
@@ -354,8 +343,7 @@ void test_epoll_pwait(FILE *validation_output_file)
                goto end;
        }
 
-       ret = fprintf(validation_output_file,
-                       ", \"epoll_pwait_fd\": %i", epollfd);
+       ret = fprintf(validation_output_file, ", \"epoll_pwait_fd\": %i", epollfd);
        if (ret < 0) {
                PERROR("[epoll_pwait] Failed to write test validation output");
                goto error;
@@ -393,8 +381,7 @@ end:
        return;
 }
 
-static
-void run_working_cases(FILE *validation_output_file)
+static void run_working_cases(FILE *validation_output_file)
 {
        int ret;
        int pipe_fds[2];
@@ -453,16 +440,14 @@ end:
  * segfault (eventually with a "*** stack smashing detected ***" message).
  * The event should contain an array of 100 FDs filled with garbage.
  */
-static
-void ppoll_fds_buffer_overflow(
-               FILE *validation_output_file __attribute__((unused)))
+static void ppoll_fds_buffer_overflow(FILE *validation_output_file __attribute__((unused)))
 {
        struct pollfd ufds[NB_FD];
        char buf[BUF_SIZE];
        int ret;
 
        ufds[0].fd = wait_fd;
-       ufds[0].events = POLLIN|POLLPRI;
+       ufds[0].events = POLLIN | POLLPRI;
 
        ret = syscall(SYS_ppoll, ufds, 100, NULL, NULL);
 
@@ -481,15 +466,14 @@ void ppoll_fds_buffer_overflow(
  * cleanly fail with a "Invalid argument".
  * The event should contain an empty array of FDs and overflow = 1.
  */
-static
-void ppoll_fds_ulong_max(FILE *validation_output_file __attribute__((unused)))
+static void ppoll_fds_ulong_max(FILE *validation_output_file __attribute__((unused)))
 {
        struct pollfd ufds[NB_FD];
        char buf[BUF_SIZE];
        int ret;
 
        ufds[0].fd = wait_fd;
-       ufds[0].events = POLLIN|POLLPRI;
+       ufds[0].events = POLLIN | POLLPRI;
 
        ret = syscall(SYS_ppoll, ufds, ULONG_MAX, NULL, NULL);
        if (ret < 0) {
@@ -506,8 +490,7 @@ void ppoll_fds_ulong_max(FILE *validation_output_file __attribute__((unused)))
  * Pass an invalid file descriptor to pselect6(). The syscall should return
  * -EBADF. The recorded event should contain a "ret = -EBADF (-9)".
  */
-static
-void pselect_invalid_fd(FILE *validation_output_file __attribute__((unused)))
+static void pselect_invalid_fd(FILE *validation_output_file __attribute__((unused)))
 {
        fd_set rfds;
        int ret;
@@ -549,9 +532,7 @@ error:
  * Invalid pointer as writefds, should output a ppoll event
  * with 0 FDs.
  */
-static
-void pselect_invalid_pointer(
-               FILE *validation_output_file __attribute__((unused)))
+static void pselect_invalid_pointer(FILE *validation_output_file __attribute__((unused)))
 {
        fd_set rfds;
        int ret;
@@ -561,8 +542,7 @@ void pselect_invalid_pointer(
        FD_ZERO(&rfds);
        FD_SET(wait_fd, &rfds);
 
-       ret = syscall(SYS_pselect6, 1, &rfds, (fd_set *) invalid, NULL, NULL,
-                       NULL);
+       ret = syscall(SYS_pselect6, 1, &rfds, (fd_set *) invalid, NULL, NULL, NULL);
        if (ret == -1) {
                /* Expected error. */
        } else if (ret) {
@@ -577,8 +557,7 @@ void pselect_invalid_pointer(
  * Pass an invalid pointer to epoll_pwait, should fail with
  * "Bad address", the event returns 0 FDs.
  */
-static
-void epoll_pwait_invalid_pointer(FILE *validation_output_file)
+static void epoll_pwait_invalid_pointer(FILE *validation_output_file)
 {
        int ret, epollfd;
        char buf[BUF_SIZE];
@@ -591,9 +570,8 @@ void epoll_pwait_invalid_pointer(FILE *validation_output_file)
                goto end;
        }
 
-       ret = fprintf(validation_output_file,
-                       "{ \"epollfd\": %i, \"pid\": %i }", epollfd,
-                       getpid());
+       ret = fprintf(
+               validation_output_file, "{ \"epollfd\": %i, \"pid\": %i }", epollfd, getpid());
        if (ret < 0) {
                PERROR("[epoll_pwait] Failed to write test validation output");
                goto error;
@@ -607,8 +585,7 @@ void epoll_pwait_invalid_pointer(FILE *validation_output_file)
                goto error;
        }
 
-       ret = syscall(SYS_epoll_pwait, epollfd,
-                       (struct epoll_event *) invalid, 1, -1, NULL);
+       ret = syscall(SYS_epoll_pwait, epollfd, (struct epoll_event *) invalid, 1, -1, NULL);
 
        if (ret == 1) {
                ret = read(wait_fd, buf, BUF_SIZE);
@@ -632,8 +609,7 @@ end:
  * Set maxevents to INT_MAX, should output "Invalid argument"
  * The event should return an empty array.
  */
-static
-void epoll_pwait_int_max(FILE *validation_output_file)
+static void epoll_pwait_int_max(FILE *validation_output_file)
 {
        int ret, epollfd;
        char buf[BUF_SIZE];
@@ -645,9 +621,8 @@ void epoll_pwait_int_max(FILE *validation_output_file)
                goto end;
        }
 
-       ret = fprintf(validation_output_file,
-                       "{ \"epollfd\": %i, \"pid\": %i }", epollfd,
-                       getpid());
+       ret = fprintf(
+               validation_output_file, "{ \"epollfd\": %i, \"pid\": %i }", epollfd, getpid());
        if (ret < 0) {
                PERROR("[epoll_pwait] Failed to write test validation output");
                goto error;
@@ -661,8 +636,7 @@ void epoll_pwait_int_max(FILE *validation_output_file)
                goto error;
        }
 
-       ret = syscall(SYS_epoll_pwait, epollfd, &epoll_event, INT_MAX, -1,
-                       NULL);
+       ret = syscall(SYS_epoll_pwait, epollfd, &epoll_event, INT_MAX, -1, NULL);
 
        if (ret == 1) {
                ret = read(wait_fd, buf, BUF_SIZE);
@@ -682,22 +656,19 @@ end:
        return;
 }
 
-static
-void *ppoll_writer(void *arg)
+static void *ppoll_writer(void *arg)
 {
        struct ppoll_thread_data *data = (struct ppoll_thread_data *) arg;
 
        while (!stop_thread) {
-               memset(data->ufds, data->value,
-                               MAX_FDS * sizeof(struct pollfd));
+               memset(data->ufds, data->value, MAX_FDS * sizeof(struct pollfd));
                usleep(100);
        }
 
        return NULL;
 }
 
-static
-void do_ppoll(int *fds, struct pollfd *ufds)
+static void do_ppoll(int *fds, struct pollfd *ufds)
 {
        int i, ret;
        struct timespec ts;
@@ -708,7 +679,7 @@ void do_ppoll(int *fds, struct pollfd *ufds)
 
        for (i = 0; i < MAX_FDS; i++) {
                ufds[i].fd = fds[i];
-               ufds[i].events = POLLIN|POLLPRI;
+               ufds[i].events = POLLIN | POLLPRI;
        }
 
        ret = ppoll(ufds, MAX_FDS, &ts, NULL);
@@ -723,8 +694,7 @@ void do_ppoll(int *fds, struct pollfd *ufds)
        }
 }
 
-static
-void stress_ppoll(int *fds, int value)
+static void stress_ppoll(int *fds, int value)
 {
        pthread_t writer;
        int iter, ret;
@@ -765,9 +735,7 @@ end:
  *
  * ppoll should work as expected and the trace should be readable at the end.
  */
-static
-void ppoll_concurrent_write(
-               FILE *validation_output_file __attribute__((unused)))
+static void ppoll_concurrent_write(FILE *validation_output_file __attribute__((unused)))
 {
        int i, ret, fds[MAX_FDS];
 
@@ -792,8 +760,7 @@ void ppoll_concurrent_write(
        return;
 }
 
-static
-void *epoll_pwait_writer(void *addr)
+static void *epoll_pwait_writer(void *addr)
 {
        srand(time(NULL));
 
@@ -810,8 +777,7 @@ void *epoll_pwait_writer(void *addr)
  * buffer allocated for the returned data. This should randomly segfault.
  * The trace should be readable and no kernel OOPS should occur.
  */
-static
-void epoll_pwait_concurrent_munmap(FILE *validation_output_file)
+static void epoll_pwait_concurrent_munmap(FILE *validation_output_file)
 {
        int ret, epollfd, i, fds[MAX_FDS];
        char buf[BUF_SIZE];
@@ -827,18 +793,19 @@ void epoll_pwait_concurrent_munmap(FILE *validation_output_file)
                goto end;
        }
 
-       ret = fprintf(validation_output_file,
-                       "{ \"epollfd\": %i, \"pid\": %i }", epollfd,
-                       getpid());
+       ret = fprintf(
+               validation_output_file, "{ \"epollfd\": %i, \"pid\": %i }", epollfd, getpid());
        if (ret < 0) {
                PERROR("[epoll_pwait] Failed to write test validation output");
                goto error;
        }
 
        epoll_event = (struct epoll_event *) mmap(NULL,
-                       MAX_FDS * sizeof(struct epoll_event),
-                       PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1,
-                       0);
+                                                 MAX_FDS * sizeof(struct epoll_event),
+                                                 PROT_READ | PROT_WRITE,
+                                                 MAP_PRIVATE | MAP_ANONYMOUS,
+                                                 -1,
+                                                 0);
        if (epoll_event == MAP_FAILED) {
                PERROR("mmap");
                goto error;
@@ -858,8 +825,7 @@ void epoll_pwait_concurrent_munmap(FILE *validation_output_file)
                }
        }
        stop_thread = 0;
-       ret = pthread_create(&writer, NULL, &epoll_pwait_writer,
-                       (void *) epoll_event);
+       ret = pthread_create(&writer, NULL, &epoll_pwait_writer, (void *) epoll_event);
        if (ret != 0) {
                fprintf(stderr, "[error] pthread_create\n");
                goto error_unmap;
@@ -904,31 +870,38 @@ end:
        return;
 }
 
-static
-void print_list(void)
+static void print_list(void)
 {
        fprintf(stderr, "Test list (-t X):\n");
-       fprintf(stderr, "\t1: Working cases for select, pselect6, poll, ppoll "
-                       "and epoll, waiting for input\n");
-       fprintf(stderr, "\t2: Timeout cases (1ms) for select, pselect6, poll, "
-                       "ppoll and epoll\n");
+       fprintf(stderr,
+               "\t1: Working cases for select, pselect6, poll, ppoll "
+               "and epoll, waiting for input\n");
+       fprintf(stderr,
+               "\t2: Timeout cases (1ms) for select, pselect6, poll, "
+               "ppoll and epoll\n");
        fprintf(stderr, "\t3: pselect with an invalid fd\n");
        fprintf(stderr, "\t4: ppoll with %d FDs\n", MAX_FDS);
-       fprintf(stderr, "\t5: ppoll buffer overflow, should segfault, waits "
-                       "for input\n");
-       fprintf(stderr, "\t6: pselect with an invalid pointer, waits for "
-                       "input\n");
+       fprintf(stderr,
+               "\t5: ppoll buffer overflow, should segfault, waits "
+               "for input\n");
+       fprintf(stderr,
+               "\t6: pselect with an invalid pointer, waits for "
+               "input\n");
        fprintf(stderr, "\t7: ppoll with ulong_max fds, waits for input\n");
-       fprintf(stderr, "\t8: epoll_pwait with an invalid pointer, waits for "
-                       "input\n");
-       fprintf(stderr, "\t9: epoll_pwait with maxevents set to INT_MAX, "
-                       "waits for input\n");
-       fprintf(stderr, "\t10: ppoll with concurrent updates of the structure "
-                       "from user-space, stress test (3000 iterations), "
-                       "waits for input + timeout 1ms\n");
-       fprintf(stderr, "\t11: epoll_pwait with concurrent munmap of the buffer "
-                       "from user-space, should randomly segfault, run "
-                       "multiple times, waits for input + timeout 1ms\n");
+       fprintf(stderr,
+               "\t8: epoll_pwait with an invalid pointer, waits for "
+               "input\n");
+       fprintf(stderr,
+               "\t9: epoll_pwait with maxevents set to INT_MAX, "
+               "waits for input\n");
+       fprintf(stderr,
+               "\t10: ppoll with concurrent updates of the structure "
+               "from user-space, stress test (3000 iterations), "
+               "waits for input + timeout 1ms\n");
+       fprintf(stderr,
+               "\t11: epoll_pwait with concurrent munmap of the buffer "
+               "from user-space, should randomly segfault, run "
+               "multiple times, waits for input + timeout 1ms\n");
 }
 
 int main(int argc, const char **argv)
@@ -939,14 +912,16 @@ int main(int argc, const char **argv)
        FILE *test_validation_output_file = NULL;
        const char *test_validation_output_file_path = NULL;
        struct poptOption optionsTable[] = {
-               { "test", 't', POPT_ARG_INT, &test, 0,
-                       "Test to run", NULL },
-               { "list", 'l', 0, 0, 'l',
-                       "List of tests (-t X)", NULL },
-               { "validation-file", 'o', POPT_ARG_STRING, &test_validation_output_file_path, 0,
-                       "Test case output", NULL },
-               POPT_AUTOHELP
-               { NULL, 0, 0, NULL, 0, NULL, NULL }
+               { "test", 't', POPT_ARG_INT, &test, 0, "Test to run", NULL },
+               { "list", 'l', 0, 0, 'l', "List of tests (-t X)", NULL },
+               { "validation-file",
+                 'o',
+                 POPT_ARG_STRING,
+                 &test_validation_output_file_path,
+                 0,
+                 "Test case output",
+                 NULL },
+               POPT_AUTOHELP{ NULL, 0, 0, NULL, 0, NULL, NULL }
        };
        const struct test_case *test_case;
 
@@ -977,7 +952,7 @@ int main(int argc, const char **argv)
        test_validation_output_file = fopen(test_validation_output_file_path, "w+");
        if (!test_validation_output_file) {
                PERROR("Failed to create test validation output file at '%s'",
-                               test_validation_output_file_path);
+                      test_validation_output_file_path);
                ret = -1;
                goto end;
        }
index 08eb8197cddc29f1676f2ef9183f5f5630e1c5da..ab95135e4753d19cea1f5e1e8d9c4d97b54bc56b 100644 (file)
@@ -5,35 +5,31 @@
  *
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
+#include <common/common.hpp>
+#include <common/compat/endian.hpp>
+#include <common/compat/errno.hpp>
 #include <common/compat/time.hpp>
-#include <sys/types.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
+#include <common/index/ctf-index.hpp>
 
 #include <lttng/lttng.h>
 
-#include <urcu/list.h>
-#include <common/common.hpp>
-
 #include <bin/lttng-relayd/lttng-viewer-abi.hpp>
-#include <common/index/ctf-index.hpp>
-
-#include <common/compat/errno.hpp>
-#include <common/compat/endian.hpp>
-
+#include <fcntl.h>
+#include <inttypes.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 #include <tap/tap.h>
+#include <unistd.h>
+#include <urcu/list.h>
 
-#define SESSION1 "test1"
+#define SESSION1   "test1"
 #define RELAYD_URL "net://localhost"
 #define LIVE_TIMER 2000000
 
@@ -72,8 +68,7 @@ struct live_session {
 };
 } /* namespace */
 
-static
-ssize_t lttng_live_recv(int fd, void *buf, size_t len)
+static ssize_t lttng_live_recv(int fd, void *buf, size_t len)
 {
        ssize_t ret;
        size_t copied = 0, to_copy = len;
@@ -85,16 +80,14 @@ ssize_t lttng_live_recv(int fd, void *buf, size_t len)
                        copied += ret;
                        to_copy -= ret;
                }
-       } while ((ret > 0 && to_copy > 0)
-               || (ret < 0 && errno == EINTR));
+       } while ((ret > 0 && to_copy > 0) || (ret < 0 && errno == EINTR));
        if (ret > 0)
                ret = copied;
        /* ret = 0 means orderly shutdown, ret < 0 is error. */
        return ret;
 }
 
-static
-ssize_t lttng_live_send(int fd, const void *buf, size_t len)
+static ssize_t lttng_live_send(int fd, const void *buf, size_t len)
 {
        ssize_t ret;
 
@@ -104,8 +97,7 @@ ssize_t lttng_live_send(int fd, const void *buf, size_t len)
        return ret;
 }
 
-static
-int connect_viewer(const char *hostname)
+static int connect_viewer(const char *hostname)
 {
        struct hostent *host;
        struct sockaddr_in server_addr;
@@ -128,8 +120,8 @@ int connect_viewer(const char *hostname)
        server_addr.sin_addr = *((struct in_addr *) host->h_addr);
        bzero(&(server_addr.sin_zero), 8);
 
-       if (connect(control_sock, (struct sockaddr *) &server_addr,
-                               sizeof(struct sockaddr)) == -1) {
+       if (connect(control_sock, (struct sockaddr *) &server_addr, sizeof(struct sockaddr)) ==
+           -1) {
                PERROR("Connect");
                ret = -1;
                goto end;
@@ -146,8 +138,7 @@ end:
        return ret;
 }
 
-static
-int establish_connection(void)
+static int establish_connection(void)
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_connect connect;
@@ -191,8 +182,7 @@ error:
 /*
  * Returns the number of sessions, should be 1 during the unit test.
  */
-static
-int list_sessions(uint64_t *session_id)
+static int list_sessions(uint64_t *session_id)
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_list_sessions list;
@@ -239,8 +229,7 @@ error:
        return -1;
 }
 
-static
-int create_viewer_session(void)
+static int create_viewer_session(void)
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_create_session_response resp;
@@ -278,8 +267,7 @@ error:
        return -1;
 }
 
-static
-int attach_session(uint64_t id)
+static int attach_session(uint64_t id)
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_attach_session_request rq;
@@ -349,9 +337,8 @@ int attach_session(uint64_t id)
 
                session->streams[i].ctf_trace_id = be64toh(stream.ctf_trace_id);
                session->streams[i].first_read = 1;
-               session->streams[i].mmap_base = mmap(NULL, mmap_size,
-                               PROT_READ | PROT_WRITE,
-                               MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+               session->streams[i].mmap_base = mmap(
+                       NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
                if (session->streams[i].mmap_base == MAP_FAILED) {
                        diag("mmap error");
                        goto error;
@@ -367,8 +354,7 @@ error:
        return -1;
 }
 
-static
-int get_metadata(void)
+static int get_metadata(void)
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_get_metadata rq;
@@ -463,8 +449,7 @@ error:
        return -1;
 }
 
-static
-int get_next_index(void)
+static int get_next_index(void)
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_get_next_index rq;
@@ -483,7 +468,7 @@ int get_next_index(void)
                memset(&rq, 0, sizeof(rq));
                rq.stream_id = htobe64(session->streams[id].id);
 
-retry:
+       retry:
                ret_len = lttng_live_send(control_sock, &cmd, sizeof(cmd));
                if (ret_len < 0) {
                        diag("Error sending cmd");
@@ -525,7 +510,8 @@ retry:
                        diag("Got LTTNG_VIEWER_INDEX_ERR");
                        goto error;
                default:
-                       diag("Unknown reply status during LTTNG_VIEWER_GET_NEXT_INDEX (%d)", be32toh(rp.status));
+                       diag("Unknown reply status during LTTNG_VIEWER_GET_NEXT_INDEX (%d)",
+                            be32toh(rp.status));
                        goto error;
                }
                if (first_packet_stream_id < 0) {
@@ -537,7 +523,8 @@ retry:
                        first_packet_len = be64toh(rp.packet_size) / CHAR_BIT;
                        first_packet_stream_id = id;
                        diag("Got first packet index with offset %d and len %d",
-                                       first_packet_offset, first_packet_len);
+                            first_packet_offset,
+                            first_packet_len);
                }
        }
        return 0;
@@ -546,9 +533,7 @@ error:
        return -1;
 }
 
-static
-int get_data_packet(int id, uint64_t offset,
-               uint64_t len)
+static int get_data_packet(int id, uint64_t offset, uint64_t len)
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_get_packet rq;
@@ -629,8 +614,7 @@ error:
        return -1;
 }
 
-static
-int detach_viewer_session(uint64_t id)
+static int detach_viewer_session(uint64_t id)
 {
        struct lttng_viewer_cmd cmd;
        struct lttng_viewer_detach_session_response resp;
@@ -690,8 +674,10 @@ int main(void)
        ok(ret == 0, "Connect viewer to relayd");
 
        ret = establish_connection();
-       ok(ret == 0, "Established connection and version check with %d.%d",
-                       VERSION_MAJOR, VERSION_MINOR);
+       ok(ret == 0,
+          "Established connection and version check with %d.%d",
+          VERSION_MAJOR,
+          VERSION_MINOR);
 
        ret = list_sessions(&session_id);
        ok(ret > 0, "List sessions : %d session(s)", ret);
@@ -711,12 +697,12 @@ int main(void)
        ret = get_next_index();
        ok(ret == 0, "Get one index per stream");
 
-       ret = get_data_packet(first_packet_stream_id, first_packet_offset,
-                       first_packet_len);
+       ret = get_data_packet(first_packet_stream_id, first_packet_offset, first_packet_len);
        ok(ret == 0,
-                       "Get one data packet for stream %d, offset %d, len %d",
-                       first_packet_stream_id, first_packet_offset,
-                       first_packet_len);
+          "Get one data packet for stream %d, offset %d, len %d",
+          first_packet_stream_id,
+          first_packet_offset,
+          first_packet_len);
 
        ret = detach_viewer_session(session_id);
        ok(ret == 0, "Detach viewer session");
index 9f2314acb8d3f82807ecbd95db581827a601261a..e390fd9721dd2645e0d2e3972a249fe184904e78 100644 (file)
@@ -7,15 +7,17 @@
 
 #include <common/compat/getenv.hpp>
 #include <common/consumer/consumer.hpp>
-#include <common/pipe.hpp>
 #include <common/error.hpp>
-#include <unistd.h>
-#include <stdbool.h>
+#include <common/pipe.hpp>
+
 #include <lttng/constant.h>
 #include <lttng/lttng-export.h>
-#include <fcntl.h>
+
 #include <dlfcn.h>
+#include <fcntl.h>
+#include <stdbool.h>
 #include <stdio.h>
+#include <unistd.h>
 
 static char *pause_pipe_path;
 static struct lttng_pipe *pause_pipe;
@@ -27,8 +29,7 @@ int lttng_opt_verbose;
 int lttng_opt_mi;
 int lttng_opt_quiet;
 
-static
-void __attribute__((destructor)) pause_pipe_fini(void)
+static void __attribute__((destructor)) pause_pipe_fini(void)
 {
        int ret;
 
@@ -54,8 +55,7 @@ int __testpoint_consumerd_thread_data(void)
        int ret = 0;
        const char *pause_pipe_path_prefix, *domain;
 
-       pause_pipe_path_prefix = lttng_secure_getenv(
-                       "CONSUMER_PAUSE_PIPE_PATH");
+       pause_pipe_path_prefix = lttng_secure_getenv("CONSUMER_PAUSE_PIPE_PATH");
        if (!pause_pipe_path_prefix) {
                ret = -1;
                goto end;
@@ -69,7 +69,7 @@ int __testpoint_consumerd_thread_data(void)
         */
        data_consumption_state = (int *) dlsym(NULL, "data_consumption_paused");
        LTTNG_ASSERT(data_consumption_state);
-       lttng_consumer_get_type = (lttng_consumer_type (*)()) dlsym(NULL, "lttng_consumer_get_type");
+       lttng_consumer_get_type = (lttng_consumer_type(*)()) dlsym(NULL, "lttng_consumer_get_type");
        LTTNG_ASSERT(lttng_consumer_get_type);
 
        switch (lttng_consumer_get_type()) {
@@ -86,16 +86,15 @@ int __testpoint_consumerd_thread_data(void)
                abort();
        }
 
-       ret = asprintf(&pause_pipe_path, "%s-%s", pause_pipe_path_prefix,
-                       domain);
+       ret = asprintf(&pause_pipe_path, "%s-%s", pause_pipe_path_prefix, domain);
        if (ret < 1) {
                ERR("Failed to allocate pause pipe path");
                goto end;
        }
 
        DBG("Creating pause pipe at %s", pause_pipe_path);
-       pause_pipe = lttng_pipe_named_open(pause_pipe_path,
-                       S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, O_NONBLOCK);
+       pause_pipe = lttng_pipe_named_open(
+               pause_pipe_path, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, O_NONBLOCK);
        if (!pause_pipe) {
                ERR("Failed to create pause pipe at %s", pause_pipe_path);
                ret = -1;
@@ -133,7 +132,7 @@ int __testpoint_consumerd_thread_data_poll(void)
        if (value_read) {
                *data_consumption_state = !!value;
                DBG("Message received on pause pipe: %s data consumption",
-                               *data_consumption_state ? "paused" : "resumed");
+                   *data_consumption_state ? "paused" : "resumed");
        }
 end:
        return ret;
index 8615f769f842292be3597a75d4719d78394bb5ed..8902774b3100c6125ccbf6cce3ca28c02c2be4bf 100644 (file)
 #define _GNU_SOURCE
 #endif
 
-#include <unistd.h>
+#include <common/error.hpp>
+#include <common/pipe.hpp>
+
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
-
-#include <common/pipe.hpp>
-#include <common/error.hpp>
+#include <unistd.h>
 
 int lttng_opt_verbose;
 int lttng_opt_mi;
index aa351d96a0c78245566f479e1ca639c6ec957434..f730384f601f816ad3ca3ed65d99613a8e66b664 100644 (file)
@@ -9,24 +9,24 @@
  *
  */
 
+#include <common/compat/errno.hpp>
+#include <common/macros.hpp>
+
+#include <lttng/lttng.h>
+
+#include <fcntl.h>
+#include <inttypes.h>
 #include <math.h>
+#include <poll.h>
+#include <signal.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
-#include <inttypes.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <poll.h>
-
-#include <common/compat/errno.hpp>
-#include <common/macros.hpp>
-#include <lttng/lttng.h>
-
+#include <sys/types.h>
 #include <tap/tap.h>
+#include <unistd.h>
 
 #define FIELD_NAME_MAX_LEN 256
 
@@ -61,8 +61,7 @@ struct capture_base_field_tuple {
 };
 } /* namespace */
 
-static
-const char *field_value_type_to_str(enum lttng_event_field_value_type type)
+static const char *field_value_type_to_str(enum lttng_event_field_value_type type)
 {
        switch (type) {
        case LTTNG_EVENT_FIELD_VALUE_TYPE_UNKNOWN:
@@ -89,7 +88,7 @@ const char *field_value_type_to_str(enum lttng_event_field_value_type type)
 }
 
 static int validate_type(const struct lttng_event_field_value *event_field,
-               enum lttng_event_field_value_type expect)
+                        enum lttng_event_field_value_type expect)
 {
        int ret;
        enum lttng_event_field_value_type value;
@@ -100,9 +99,10 @@ static int validate_type(const struct lttng_event_field_value *event_field,
                goto end;
        }
 
-       ok(expect == value, "Expected field type %s, got %s",
-                       field_value_type_to_str(expect),
-                       field_value_type_to_str(value));
+       ok(expect == value,
+          "Expected field type %s, got %s",
+          field_value_type_to_str(expect),
+          field_value_type_to_str(value));
 
        ret = expect != value;
 
@@ -113,32 +113,30 @@ end:
 /*
  * Validate unsigned captured field against the iteration number.
  */
-static int validate_unsigned_int_field(
-               const struct lttng_event_field_value *event_field,
-               unsigned int expected_value)
+static int validate_unsigned_int_field(const struct lttng_event_field_value *event_field,
+                                      unsigned int expected_value)
 {
        int ret;
        uint64_t value;
        enum lttng_event_field_value_status status;
 
-       ret = validate_type(
-                       event_field, LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT);
+       ret = validate_type(event_field, LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT);
        if (ret) {
                goto end;
        }
 
-       status = lttng_event_field_value_unsigned_int_get_value(
-                       event_field, &value);
+       status = lttng_event_field_value_unsigned_int_get_value(event_field, &value);
        if (status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                fail("lttng_event_field_value_unsigned_int_get_value returned an error: status = %d",
-                               (int) status);
+                    (int) status);
                ret = 1;
                goto end;
        }
 
        ok(value == (uint64_t) expected_value,
-                       "Expected unsigned integer value %u, got %" PRIu64,
-                       expected_value, value);
+          "Expected unsigned integer value %u, got %" PRIu64,
+          expected_value,
+          value);
 
        ret = value != (uint64_t) expected_value;
 
@@ -149,9 +147,8 @@ end:
 /*
  * Validate signed captured field.
  */
-static int validate_signed_int_field(
-               const struct lttng_event_field_value *event_field,
-               unsigned int iteration)
+static int validate_signed_int_field(const struct lttng_event_field_value *event_field,
+                                    unsigned int iteration)
 {
        int ret;
        const int64_t expected = -1;
@@ -161,25 +158,23 @@ static int validate_signed_int_field(
        /* Unused. */
        (void) iteration;
 
-       ret = validate_type(
-                       event_field, LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT);
+       ret = validate_type(event_field, LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT);
        if (ret) {
                goto end;
        }
 
-       status = lttng_event_field_value_signed_int_get_value(
-                       event_field, &value);
+       status = lttng_event_field_value_signed_int_get_value(event_field, &value);
        if (status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                fail("lttng_event_field_value_signed_int_get_value returned an error: status = %d",
-                               (int) status);
+                    (int) status);
                ret = 1;
                goto end;
        }
 
        ok(value == expected,
-                       "Expected signed integer value %" PRId64
-                       ", got %" PRId64,
-                       expected, value);
+          "Expected signed integer value %" PRId64 ", got %" PRId64,
+          expected,
+          value);
 
        ret = value != expected;
 
@@ -191,9 +186,8 @@ end:
 /*
  * Validate array of unsigned int.
  */
-static int validate_array_unsigned_int_field(
-               const struct lttng_event_field_value *event_field,
-               unsigned int iteration)
+static int validate_array_unsigned_int_field(const struct lttng_event_field_value *event_field,
+                                            unsigned int iteration)
 {
        int ret;
        enum lttng_event_field_value_status status;
@@ -215,8 +209,7 @@ static int validate_array_unsigned_int_field(
                goto end;
        }
 
-       ok(count == expected, "Expected %d subelements, got %d", expected,
-                       count);
+       ok(count == expected, "Expected %d subelements, got %d", expected, count);
        if (count != expected) {
                ret = 1;
                goto end;
@@ -226,10 +219,10 @@ static int validate_array_unsigned_int_field(
                const struct lttng_event_field_value *value;
 
                status = lttng_event_field_value_array_get_element_at_index(
-                               event_field, i - 1, &value);
+                       event_field, i - 1, &value);
                if (status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                        fail("lttng_event_field_value_array_get_element_at_index returned an error: status = %d",
-                                       (int) status);
+                            (int) status);
                        ret = 1;
                        goto end;
                }
@@ -246,9 +239,9 @@ end:
        return ret;
 }
 
-static int validate_array_unsigned_int_field_at_index(
-               const struct lttng_event_field_value *event_field,
-               unsigned int iteration)
+static int
+validate_array_unsigned_int_field_at_index(const struct lttng_event_field_value *event_field,
+                                          unsigned int iteration)
 {
        int ret;
        const uint64_t expected_value = 2;
@@ -258,24 +251,23 @@ static int validate_array_unsigned_int_field_at_index(
        /* Unused. */
        (void) iteration;
 
-       ret = validate_type(
-                       event_field, LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT);
+       ret = validate_type(event_field, LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT);
        if (ret) {
                goto end;
        }
 
-       status = lttng_event_field_value_unsigned_int_get_value(
-                       event_field, &value);
+       status = lttng_event_field_value_unsigned_int_get_value(event_field, &value);
        if (status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                fail("lttng_event_field_value_unsigned_int_get_value returned an error: status = %d",
-                               (int) status);
+                    (int) status);
                ret = 1;
                goto end;
        }
 
        ok(value == expected_value,
-                       "Expected unsigned integer value %" PRIu64 ", got %" PRIu64,
-                       expected_value, value);
+          "Expected unsigned integer value %" PRIu64 ", got %" PRIu64,
+          expected_value,
+          value);
 
        ret = 0;
 end:
@@ -288,12 +280,12 @@ end:
  * Value: "test" encoded in UTF-8: [116, 101, 115, 116]
  */
 static int validate_seqfield1(const struct lttng_event_field_value *event_field,
-               unsigned int iteration)
+                             unsigned int iteration)
 {
        int ret;
        enum lttng_event_field_value_status status;
        unsigned int i, count;
-       const unsigned int expect[] = {116, 101, 115, 116};
+       const unsigned int expect[] = { 116, 101, 115, 116 };
        const size_t array_count = sizeof(expect) / sizeof(*expect);
 
        /* Unused. */
@@ -307,13 +299,12 @@ static int validate_seqfield1(const struct lttng_event_field_value *event_field,
        status = lttng_event_field_value_array_get_length(event_field, &count);
        if (status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                fail("lttng_event_field_value_array_get_length returned an error: status = %d",
-                               (int) status);
+                    (int) status);
                ret = 1;
                goto end;
        }
 
-       ok(count == array_count, "Expected %zu array sub-elements, got %d",
-                       array_count, count);
+       ok(count == array_count, "Expected %zu array sub-elements, got %d", array_count, count);
        if (count != array_count) {
                ret = 1;
                goto end;
@@ -322,11 +313,10 @@ static int validate_seqfield1(const struct lttng_event_field_value *event_field,
        for (i = 0; i < count; i++) {
                const struct lttng_event_field_value *value;
 
-               status = lttng_event_field_value_array_get_element_at_index(
-                               event_field, i, &value);
+               status = lttng_event_field_value_array_get_element_at_index(event_field, i, &value);
                if (status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                        fail("lttng_event_field_value_array_get_element_at_index returned an error: status = %d",
-                                       (int) status);
+                            (int) status);
                        ret = 1;
                        goto end;
                }
@@ -342,9 +332,7 @@ end:
        return ret;
 }
 
-static int validate_string(
-               const struct lttng_event_field_value *event_field,
-               const char *expect)
+static int validate_string(const struct lttng_event_field_value *event_field, const char *expect)
 {
        int ret;
        const char *value = NULL;
@@ -358,13 +346,12 @@ static int validate_string(
        status = lttng_event_field_value_string_get_value(event_field, &value);
        if (!value) {
                fail("lttng_event_field_value_array_get_length returned an error: status = %d",
-                               (int) status);
+                    (int) status);
                ret = 1;
                goto end;
        }
 
-       ok(!strcmp(value, expect), "Expected string value \"%s\", got \"%s\"",
-                       expect, value);
+       ok(!strcmp(value, expect), "Expected string value \"%s\", got \"%s\"", expect, value);
 
        ret = 0;
 end:
@@ -375,11 +362,10 @@ end:
 /*
  * Validate string. Expected value is "test".
  */
-static int validate_string_test(
-               const struct lttng_event_field_value *event_field,
-               unsigned int iteration)
+static int validate_string_test(const struct lttng_event_field_value *event_field,
+                               unsigned int iteration)
 {
-       const char * const expect = "test";
+       const char *const expect = "test";
 
        /* Unused. */
        (void) iteration;
@@ -390,11 +376,10 @@ static int validate_string_test(
 /*
  * Validate escaped string. Expected value is "\*".
  */
-static int validate_string_escaped(
-               const struct lttng_event_field_value *event_field,
-               unsigned int iteration)
+static int validate_string_escaped(const struct lttng_event_field_value *event_field,
+                                  unsigned int iteration)
 {
-       const char * const expect = "\\*";
+       const char *const expect = "\\*";
 
        /* Unused. */
        (void) iteration;
@@ -405,9 +390,7 @@ static int validate_string_escaped(
 /*
  * Validate real field.
  */
-static int validate_real(
-               const struct lttng_event_field_value *event_field,
-               double expect)
+static int validate_real(const struct lttng_event_field_value *event_field, double expect)
 {
        int ret;
        double value;
@@ -421,7 +404,7 @@ static int validate_real(
        status = lttng_event_field_value_real_get_value(event_field, &value);
        if (status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                fail("lttng_event_field_value_real_get_value returned an error: status = %d",
-                               (int) status);
+                    (int) status);
                ret = 1;
                goto end;
        }
@@ -435,9 +418,8 @@ end:
 /*
  * Validate floatfield.
  */
-static int validate_floatfield(
-               const struct lttng_event_field_value *event_field,
-               unsigned int iteration)
+static int validate_floatfield(const struct lttng_event_field_value *event_field,
+                              unsigned int iteration)
 {
        const double expect = 2222.0;
 
@@ -450,9 +432,8 @@ static int validate_floatfield(
 /*
  * Validate doublefield.
  */
-static int validate_doublefield(
-               const struct lttng_event_field_value *event_field,
-               unsigned int iteration)
+static int validate_doublefield(const struct lttng_event_field_value *event_field,
+                               unsigned int iteration)
 {
        const double expect = 2.0;
 
@@ -465,8 +446,7 @@ static int validate_doublefield(
 /*
  * Validate enum0: enum0 = ( "AUTO: EXPECT 0" : container = 0 )
  */
-static int validate_enum0(const struct lttng_event_field_value *event_field,
-               unsigned int iteration)
+static int validate_enum0(const struct lttng_event_field_value *event_field, unsigned int iteration)
 {
        int ret;
        enum lttng_event_field_value_status status;
@@ -476,24 +456,23 @@ static int validate_enum0(const struct lttng_event_field_value *event_field,
        /* Unused. */
        (void) iteration;
 
-       ret = validate_type(event_field,
-                       LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM);
+       ret = validate_type(event_field, LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM);
        if (ret) {
                goto end;
        }
 
-       status = lttng_event_field_value_unsigned_int_get_value(
-                       event_field, &value);
+       status = lttng_event_field_value_unsigned_int_get_value(event_field, &value);
        if (status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                fail("lttng_event_field_value_unsigned_int_get_value returned an error: status = %d",
-                               (int) status);
+                    (int) status);
                ret = 1;
                goto end;
        }
 
        ok(value == expected_value,
-                       "Expected enum value %" PRIu64 ", got %" PRIu64,
-                       expected_value, value);
+          "Expected enum value %" PRIu64 ", got %" PRIu64,
+          expected_value,
+          value);
 
 end:
        return ret;
@@ -504,9 +483,8 @@ end:
  *
  * We expect 2 labels here.
  */
-static int validate_enumnegative(
-               const struct lttng_event_field_value *event_field,
-               unsigned int iteration)
+static int validate_enumnegative(const struct lttng_event_field_value *event_field,
+                                unsigned int iteration)
 {
        int ret;
        enum lttng_event_field_value_status status;
@@ -516,14 +494,12 @@ static int validate_enumnegative(
        /* Unused. */
        (void) iteration;
 
-       ret = validate_type(event_field,
-                       LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM);
+       ret = validate_type(event_field, LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM);
        if (ret) {
                goto end;
        }
 
-       status = lttng_event_field_value_signed_int_get_value(
-                       event_field, &value);
+       status = lttng_event_field_value_signed_int_get_value(event_field, &value);
        if (status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                fail("lttng_event_field_value_unsigned_int_get_value");
                ret = 1;
@@ -531,25 +507,24 @@ static int validate_enumnegative(
        }
 
        ok(value == expected_value,
-                       "Expected enum value %" PRId64 ", got %" PRId64,
-                       expected_value, value);
+          "Expected enum value %" PRId64 ", got %" PRId64,
+          expected_value,
+          value);
 
 end:
        return ret;
 }
 
-static int validate_context_procname_ust(
-               const struct lttng_event_field_value *event_field,
-               unsigned int iteration)
+static int validate_context_procname_ust(const struct lttng_event_field_value *event_field,
+                                        unsigned int iteration)
 {
        /* Unused. */
        (void) iteration;
        return validate_string(event_field, "gen-ust-events");
 }
 
-static int validate_context_procname_kernel(
-               const struct lttng_event_field_value *event_field,
-               unsigned int iteration)
+static int validate_context_procname_kernel(const struct lttng_event_field_value *event_field,
+                                           unsigned int iteration)
 {
        /* Unused. */
        (void) iteration;
@@ -558,28 +533,87 @@ static int validate_context_procname_kernel(
 
 struct capture_base_field_tuple test_capture_base_fields[] = {
        { "DOESNOTEXIST", FIELD_TYPE_PAYLOAD, false, false, NULL, NULL },
-       { "intfield", FIELD_TYPE_PAYLOAD, true, true, validate_unsigned_int_field, validate_unsigned_int_field },
-       { "longfield", FIELD_TYPE_PAYLOAD, true, true, validate_unsigned_int_field, validate_unsigned_int_field },
-       { "signedfield", FIELD_TYPE_PAYLOAD, true, true, validate_signed_int_field, validate_signed_int_field },
-       { "arrfield1", FIELD_TYPE_PAYLOAD, true, true, validate_array_unsigned_int_field, validate_array_unsigned_int_field },
+       { "intfield",
+         FIELD_TYPE_PAYLOAD,
+         true,
+         true,
+         validate_unsigned_int_field,
+         validate_unsigned_int_field },
+       { "longfield",
+         FIELD_TYPE_PAYLOAD,
+         true,
+         true,
+         validate_unsigned_int_field,
+         validate_unsigned_int_field },
+       { "signedfield",
+         FIELD_TYPE_PAYLOAD,
+         true,
+         true,
+         validate_signed_int_field,
+         validate_signed_int_field },
+       { "arrfield1",
+         FIELD_TYPE_PAYLOAD,
+         true,
+         true,
+         validate_array_unsigned_int_field,
+         validate_array_unsigned_int_field },
        { "arrfield2", FIELD_TYPE_PAYLOAD, true, true, validate_string_test, validate_string_test },
-       { "arrfield3", FIELD_TYPE_PAYLOAD, true, true, validate_array_unsigned_int_field, validate_array_unsigned_int_field },
+       { "arrfield3",
+         FIELD_TYPE_PAYLOAD,
+         true,
+         true,
+         validate_array_unsigned_int_field,
+         validate_array_unsigned_int_field },
        { "seqfield1", FIELD_TYPE_PAYLOAD, true, true, validate_seqfield1, validate_seqfield1 },
        { "seqfield2", FIELD_TYPE_PAYLOAD, true, true, validate_string_test, validate_string_test },
-       { "seqfield3", FIELD_TYPE_PAYLOAD, true, true, validate_array_unsigned_int_field, validate_array_unsigned_int_field },
-       { "seqfield4", FIELD_TYPE_PAYLOAD, true, true, validate_array_unsigned_int_field, validate_array_unsigned_int_field },
-       { "arrfield1[1]", FIELD_TYPE_ARRAY_FIELD, true, true, validate_array_unsigned_int_field_at_index, validate_array_unsigned_int_field_at_index },
+       { "seqfield3",
+         FIELD_TYPE_PAYLOAD,
+         true,
+         true,
+         validate_array_unsigned_int_field,
+         validate_array_unsigned_int_field },
+       { "seqfield4",
+         FIELD_TYPE_PAYLOAD,
+         true,
+         true,
+         validate_array_unsigned_int_field,
+         validate_array_unsigned_int_field },
+       { "arrfield1[1]",
+         FIELD_TYPE_ARRAY_FIELD,
+         true,
+         true,
+         validate_array_unsigned_int_field_at_index,
+         validate_array_unsigned_int_field_at_index },
        { "stringfield", FIELD_TYPE_PAYLOAD, true, true, validate_string_test, validate_string_test },
-       { "stringfield2", FIELD_TYPE_PAYLOAD, true, true, validate_string_escaped, validate_string_escaped },
+       { "stringfield2",
+         FIELD_TYPE_PAYLOAD,
+         true,
+         true,
+         validate_string_escaped,
+         validate_string_escaped },
        { "floatfield", FIELD_TYPE_PAYLOAD, true, false, validate_floatfield, validate_floatfield },
-       { "doublefield", FIELD_TYPE_PAYLOAD, true, false, validate_doublefield, validate_doublefield },
+       { "doublefield",
+         FIELD_TYPE_PAYLOAD,
+         true,
+         false,
+         validate_doublefield,
+         validate_doublefield },
        { "enum0", FIELD_TYPE_PAYLOAD, true, true, validate_enum0, validate_enum0 },
-       { "enumnegative", FIELD_TYPE_PAYLOAD, true, true, validate_enumnegative, validate_enumnegative },
-       { "$ctx.procname", FIELD_TYPE_CONTEXT, true, true, validate_context_procname_ust, validate_context_procname_kernel },
+       { "enumnegative",
+         FIELD_TYPE_PAYLOAD,
+         true,
+         true,
+         validate_enumnegative,
+         validate_enumnegative },
+       { "$ctx.procname",
+         FIELD_TYPE_CONTEXT,
+         true,
+         true,
+         validate_context_procname_ust,
+         validate_context_procname_kernel },
 };
 
-static const char *get_notification_trigger_name(
-               struct lttng_notification *notification)
+static const char *get_notification_trigger_name(struct lttng_notification *notification)
 {
        const char *trigger_name = NULL;
        enum lttng_trigger_status trigger_status;
@@ -607,9 +641,8 @@ end:
        return trigger_name;
 }
 
-static int validator_notification_trigger_name(
-               struct lttng_notification *notification,
-               const char *trigger_name)
+static int validator_notification_trigger_name(struct lttng_notification *notification,
+                                              const char *trigger_name)
 {
        int ret;
        bool name_is_equal;
@@ -625,8 +658,7 @@ static int validator_notification_trigger_name(
        }
 
        name_is_equal = (strcmp(trigger_name, name) == 0);
-       ok(name_is_equal, "Expected trigger name: %s got %s", trigger_name,
-                       name);
+       ok(name_is_equal, "Expected trigger name: %s got %s", trigger_name, name);
 
        ret = !name_is_equal;
 
@@ -634,8 +666,7 @@ end:
        return ret;
 }
 
-static
-void wait_on_file(const char *path, bool file_exist)
+static void wait_on_file(const char *path, bool file_exist)
 {
        if (!path) {
                return;
@@ -675,8 +706,7 @@ void wait_on_file(const char *path, bool file_exist)
        }
 }
 
-static
-int write_pipe(const char *path, uint8_t data)
+static int write_pipe(const char *path, uint8_t data)
 {
        int ret = 0;
        int fd = 0;
@@ -687,7 +717,7 @@ int write_pipe(const char *path, uint8_t data)
                goto end;
        }
 
-       ret = write(fd, &data , sizeof(data));
+       ret = write(fd, &data, sizeof(data));
        if (ret < 1) {
                perror("Named pipe write failed");
                if (close(fd)) {
@@ -707,8 +737,7 @@ end:
        return ret;
 }
 
-static
-int stop_consumer(const char **argv)
+static int stop_consumer(const char **argv)
 {
        int ret = 0, i;
 
@@ -718,8 +747,7 @@ int stop_consumer(const char **argv)
        return ret;
 }
 
-static
-int resume_consumer(const char **argv)
+static int resume_consumer(const char **argv)
 {
        int ret = 0, i;
 
@@ -729,8 +757,7 @@ int resume_consumer(const char **argv)
        return ret;
 }
 
-static
-int suspend_application(void)
+static int suspend_application(void)
 {
        int ret;
        struct stat buf;
@@ -757,11 +784,9 @@ int suspend_application(void)
 
 error:
        return ret;
-
 }
 
-static
-int resume_application(void)
+static int resume_application(void)
 {
        int ret;
        struct stat buf;
@@ -789,14 +814,11 @@ int resume_application(void)
 
 error:
        return ret;
-
 }
 
-
-static
-void test_triggers_buffer_usage_condition(const char *session_name,
-               const char *channel_name,
-               enum lttng_condition_type condition_type)
+static void test_triggers_buffer_usage_condition(const char *session_name,
+                                                const char *channel_name,
+                                                enum lttng_condition_type condition_type)
 {
        unsigned int test_vector_size = 5, i;
        enum lttng_condition_status condition_status;
@@ -810,11 +832,12 @@ void test_triggers_buffer_usage_condition(const char *session_name,
        }
 
        /* Test lttng_register_trigger with null value */
-       ok(lttng_register_trigger(NULL) == -LTTNG_ERR_INVALID, "Registering a NULL trigger fails as expected");
+       ok(lttng_register_trigger(NULL) == -LTTNG_ERR_INVALID,
+          "Registering a NULL trigger fails as expected");
 
        /* Test: register a trigger */
 
-       for (i = 0; i < pow(2,test_vector_size); i++) {
+       for (i = 0; i < pow(2, test_vector_size); i++) {
                int loop_ret = 0;
                char *test_tuple_string = NULL;
                unsigned int mask_position = 0;
@@ -843,7 +866,6 @@ void test_triggers_buffer_usage_condition(const char *session_name,
                if (!condition) {
                        loop_ret = 1;
                        goto loop_end;
-
                }
 
                /* Prepare the condition for trigger registration test */
@@ -851,7 +873,7 @@ void test_triggers_buffer_usage_condition(const char *session_name,
                /* Set session name */
                if ((1 << mask_position) & i) {
                        condition_status = lttng_condition_buffer_usage_set_session_name(
-                                       condition, session_name);
+                               condition, session_name);
                        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
                                loop_ret = 1;
                                goto loop_end;
@@ -863,7 +885,7 @@ void test_triggers_buffer_usage_condition(const char *session_name,
                /* Set channel name */
                if ((1 << mask_position) & i) {
                        condition_status = lttng_condition_buffer_usage_set_channel_name(
-                                       condition, channel_name);
+                               condition, channel_name);
                        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
                                loop_ret = 1;
                                goto loop_end;
@@ -874,8 +896,8 @@ void test_triggers_buffer_usage_condition(const char *session_name,
 
                /* Set threshold ratio */
                if ((1 << mask_position) & i) {
-                       condition_status = lttng_condition_buffer_usage_set_threshold_ratio(
-                                       condition, 0.0);
+                       condition_status =
+                               lttng_condition_buffer_usage_set_threshold_ratio(condition, 0.0);
                        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
                                loop_ret = 1;
                                goto loop_end;
@@ -886,8 +908,7 @@ void test_triggers_buffer_usage_condition(const char *session_name,
 
                /* Set threshold byte */
                if ((1 << mask_position) & i) {
-                       condition_status = lttng_condition_buffer_usage_set_threshold(
-                                       condition, 0);
+                       condition_status = lttng_condition_buffer_usage_set_threshold(condition, 0);
                        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
                                loop_ret = 1;
                                goto loop_end;
@@ -899,7 +920,7 @@ void test_triggers_buffer_usage_condition(const char *session_name,
                /* Set domain type */
                if ((1 << mask_position) & i) {
                        condition_status = lttng_condition_buffer_usage_set_domain_type(
-                                       condition, LTTNG_DOMAIN_UST);
+                               condition, LTTNG_DOMAIN_UST);
                        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
                                loop_ret = 1;
                                goto loop_end;
@@ -908,16 +929,18 @@ void test_triggers_buffer_usage_condition(const char *session_name,
                }
 
                /* Safety check */
-               if (mask_position != test_vector_size -1) {
+               if (mask_position != test_vector_size - 1) {
                        LTTNG_ASSERT("Logic error for test vector generation");
                }
 
-               loop_ret = asprintf(&test_tuple_string, "session name %s, channel name %s, threshold ratio %s, threshold byte %s, domain type %s",
-                               session_name_set ? "set" : "unset",
-                               channel_name_set ? "set" : "unset",
-                               threshold_ratio_set ? "set" : "unset",
-                               threshold_byte_set ? "set" : "unset",
-                               domain_type_set? "set" : "unset");
+               loop_ret = asprintf(
+                       &test_tuple_string,
+                       "session name %s, channel name %s, threshold ratio %s, threshold byte %s, domain type %s",
+                       session_name_set ? "set" : "unset",
+                       channel_name_set ? "set" : "unset",
+                       threshold_ratio_set ? "set" : "unset",
+                       threshold_byte_set ? "set" : "unset",
+                       domain_type_set ? "set" : "unset");
                if (!test_tuple_string || loop_ret < 0) {
                        loop_ret = 1;
                        goto loop_end;
@@ -932,16 +955,15 @@ void test_triggers_buffer_usage_condition(const char *session_name,
 
                loop_ret = lttng_register_trigger(trigger);
 
-loop_end:
+       loop_end:
                if (loop_ret == 1) {
                        fail("Setup error occurred for tuple: %s", test_tuple_string);
                        goto loop_cleanup;
                }
 
                /* This combination happens three times */
-               if (session_name_set && channel_name_set
-                               && (threshold_ratio_set || threshold_byte_set)
-                               && domain_type_set) {
+               if (session_name_set && channel_name_set &&
+                   (threshold_ratio_set || threshold_byte_set) && domain_type_set) {
                        ok(loop_ret == 0, "Trigger is registered: %s", test_tuple_string);
 
                        /*
@@ -949,7 +971,9 @@ loop_end:
                         * multiple time.
                         */
                        loop_ret = lttng_register_trigger(trigger);
-                       ok(loop_ret == -LTTNG_ERR_TRIGGER_EXISTS, "Re-register trigger fails as expected: %s", test_tuple_string);
+                       ok(loop_ret == -LTTNG_ERR_TRIGGER_EXISTS,
+                          "Re-register trigger fails as expected: %s",
+                          test_tuple_string);
 
                        /* Test that a trigger can be unregistered */
                        loop_ret = lttng_unregister_trigger(trigger);
@@ -960,12 +984,16 @@ loop_end:
                         * registered trigger fail.
                         */
                        loop_ret = lttng_unregister_trigger(trigger);
-                       ok(loop_ret == -LTTNG_ERR_TRIGGER_NOT_FOUND, "Unregister of a non-registered trigger fails as expected: %s", test_tuple_string);
+                       ok(loop_ret == -LTTNG_ERR_TRIGGER_NOT_FOUND,
+                          "Unregister of a non-registered trigger fails as expected: %s",
+                          test_tuple_string);
                } else {
-                       ok(loop_ret == -LTTNG_ERR_INVALID_TRIGGER, "Trigger is invalid as expected and cannot be registered: %s", test_tuple_string);
+                       ok(loop_ret == -LTTNG_ERR_INVALID_TRIGGER,
+                          "Trigger is invalid as expected and cannot be registered: %s",
+                          test_tuple_string);
                }
 
-loop_cleanup:
+       loop_cleanup:
                free(test_tuple_string);
                lttng_trigger_destroy(trigger);
                lttng_condition_destroy(condition);
@@ -975,8 +1003,7 @@ end:
        lttng_action_destroy(action);
 }
 
-static
-void wait_data_pending(const char *session_name)
+static void wait_data_pending(const char *session_name)
 {
        int ret;
 
@@ -986,39 +1013,32 @@ void wait_data_pending(const char *session_name)
        } while (ret != 0);
 }
 
-static
-int setup_buffer_usage_condition(struct lttng_condition *condition,
-               const char *condition_name,
-               const char *session_name,
-               const char *channel_name,
-               const enum lttng_domain_type domain_type)
+static int setup_buffer_usage_condition(struct lttng_condition *condition,
+                                       const char *condition_name,
+                                       const char *session_name,
+                                       const char *channel_name,
+                                       const enum lttng_domain_type domain_type)
 {
        enum lttng_condition_status condition_status;
        int ret = 0;
 
-       condition_status = lttng_condition_buffer_usage_set_session_name(
-                       condition, session_name);
+       condition_status = lttng_condition_buffer_usage_set_session_name(condition, session_name);
        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
-               fail("Failed to set session name on creation of condition `%s`",
-                               condition_name);
+               fail("Failed to set session name on creation of condition `%s`", condition_name);
                ret = -1;
                goto end;
        }
 
-       condition_status = lttng_condition_buffer_usage_set_channel_name(
-                       condition, channel_name);
+       condition_status = lttng_condition_buffer_usage_set_channel_name(condition, channel_name);
        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
-               fail("Failed to set channel name on creation of condition `%s`",
-                               condition_name);
+               fail("Failed to set channel name on creation of condition `%s`", condition_name);
                ret = -1;
                goto end;
        }
 
-       condition_status = lttng_condition_buffer_usage_set_domain_type(
-                       condition, domain_type);
+       condition_status = lttng_condition_buffer_usage_set_domain_type(condition, domain_type);
        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
-               fail("Failed to set domain type on creation of condition `%s`",
-                               condition_name);
+               fail("Failed to set domain type on creation of condition `%s`", condition_name);
                ret = -1;
                goto end;
        }
@@ -1027,9 +1047,7 @@ end:
        return ret;
 }
 
-static
-void test_invalid_channel_subscription(
-               const enum lttng_domain_type domain_type)
+static void test_invalid_channel_subscription(const enum lttng_domain_type domain_type)
 {
        enum lttng_condition_status condition_status;
        enum lttng_notification_channel_status nc_status;
@@ -1038,8 +1056,8 @@ void test_invalid_channel_subscription(
        struct lttng_notification_channel *notification_channel = NULL;
        int ret = 0;
 
-       notification_channel = lttng_notification_channel_create(
-                       lttng_session_daemon_notification_endpoint);
+       notification_channel =
+               lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
        ok(notification_channel, "Notification channel object creation");
        if (!notification_channel) {
                goto end;
@@ -1058,15 +1076,15 @@ void test_invalid_channel_subscription(
         * Test subscription and unsubscription of an invalid condition to/from
         * a channel.
         */
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, dummy_invalid_condition);
+       nc_status =
+               lttng_notification_channel_subscribe(notification_channel, dummy_invalid_condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID,
-                       "Subscribing to an invalid condition");
+          "Subscribing to an invalid condition");
 
-       nc_status = lttng_notification_channel_unsubscribe(
-                       notification_channel, dummy_invalid_condition);
+       nc_status = lttng_notification_channel_unsubscribe(notification_channel,
+                                                          dummy_invalid_condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID,
-                       "Unsubscribing from an invalid condition");
+          "Unsubscribing from an invalid condition");
 
        /* Create a valid dummy condition with a ratio of 0.5 */
        dummy_condition = lttng_condition_buffer_usage_low_create();
@@ -1075,15 +1093,14 @@ void test_invalid_channel_subscription(
                goto end;
        }
 
-       condition_status = lttng_condition_buffer_usage_set_threshold_ratio(
-                       dummy_condition, 0.5);
+       condition_status = lttng_condition_buffer_usage_set_threshold_ratio(dummy_condition, 0.5);
        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
                fail("Setup error on condition creation");
                goto end;
        }
 
-       ret = setup_buffer_usage_condition(dummy_condition, "dummy_condition",
-                       "dummy_session", "dummy_channel", domain_type);
+       ret = setup_buffer_usage_condition(
+               dummy_condition, "dummy_condition", "dummy_session", "dummy_channel", domain_type);
        if (ret) {
                fail("Setup error on dummy condition creation");
                goto end;
@@ -1095,21 +1112,19 @@ void test_invalid_channel_subscription(
         */
        nc_status = lttng_notification_channel_subscribe(NULL, NULL);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID,
-                       "Notification channel subscription is invalid: NULL, NULL");
+          "Notification channel subscription is invalid: NULL, NULL");
 
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, NULL);
+       nc_status = lttng_notification_channel_subscribe(notification_channel, NULL);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID,
-                       "Notification channel subscription is invalid: NON-NULL, NULL");
+          "Notification channel subscription is invalid: NON-NULL, NULL");
 
        nc_status = lttng_notification_channel_subscribe(NULL, dummy_condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID,
-                       "Notification channel subscription is invalid: NULL, NON-NULL");
+          "Notification channel subscription is invalid: NULL, NON-NULL");
 
-       nc_status = lttng_notification_channel_unsubscribe(
-                       notification_channel, dummy_condition);
+       nc_status = lttng_notification_channel_unsubscribe(notification_channel, dummy_condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_UNKNOWN_CONDITION,
-                       "Unsubscribing from a valid unknown condition");
+          "Unsubscribing from a valid unknown condition");
 
 end:
        lttng_notification_channel_destroy(notification_channel);
@@ -1124,13 +1139,13 @@ enum buffer_usage_type {
 };
 
 static int register_buffer_usage_notify_trigger(const char *session_name,
-               const char *channel_name,
-               const enum lttng_domain_type domain_type,
-               enum buffer_usage_type buffer_usage_type,
-               double ratio,
-               struct lttng_condition **condition,
-               struct lttng_action **action,
-               struct lttng_trigger **trigger)
+                                               const char *channel_name,
+                                               const enum lttng_domain_type domain_type,
+                                               enum buffer_usage_type buffer_usage_type,
+                                               double ratio,
+                                               struct lttng_condition **condition,
+                                               struct lttng_action **action,
+                                               struct lttng_trigger **trigger)
 {
        enum lttng_condition_status condition_status;
        struct lttng_action *tmp_action = NULL;
@@ -1159,16 +1174,15 @@ static int register_buffer_usage_notify_trigger(const char *session_name,
        }
 
        /* Set the buffer usage threashold */
-       condition_status = lttng_condition_buffer_usage_set_threshold_ratio(
-                       tmp_condition, ratio);
+       condition_status = lttng_condition_buffer_usage_set_threshold_ratio(tmp_condition, ratio);
        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
                fail("Setup error on condition creation");
                ret = -1;
                goto error;
        }
 
-       ret = setup_buffer_usage_condition(tmp_condition, "condition_name",
-                       session_name, channel_name, domain_type);
+       ret = setup_buffer_usage_condition(
+               tmp_condition, "condition_name", session_name, channel_name, domain_type);
        if (ret) {
                fail("Setup error on condition creation");
                ret = -1;
@@ -1205,8 +1219,8 @@ end:
 }
 
 static void test_subscription_twice(const char *session_name,
-               const char *channel_name,
-               const enum lttng_domain_type domain_type)
+                                   const char *channel_name,
+                                   const enum lttng_domain_type domain_type)
 {
        int ret = 0;
        enum lttng_notification_channel_status nc_status;
@@ -1217,34 +1231,35 @@ static void test_subscription_twice(const char *session_name,
 
        struct lttng_condition *condition = NULL;
 
-       ret = register_buffer_usage_notify_trigger(session_name, channel_name,
-                       domain_type, BUFFER_USAGE_TYPE_LOW, 0.99, &condition,
-                       &action, &trigger);
+       ret = register_buffer_usage_notify_trigger(session_name,
+                                                  channel_name,
+                                                  domain_type,
+                                                  BUFFER_USAGE_TYPE_LOW,
+                                                  0.99,
+                                                  &condition,
+                                                  &action,
+                                                  &trigger);
        if (ret) {
-               fail("Setup error on trigger registration in %s()",
-                               __FUNCTION__);
+               fail("Setup error on trigger registration in %s()", __FUNCTION__);
                goto end;
        }
 
        /* Begin testing. */
-       notification_channel = lttng_notification_channel_create(
-                       lttng_session_daemon_notification_endpoint);
+       notification_channel =
+               lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
        ok(notification_channel, "Notification channel object creation");
        if (!notification_channel) {
                goto end;
        }
 
        /* Subscribe a valid condition. */
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, condition);
-       ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe to condition");
+       nc_status = lttng_notification_channel_subscribe(notification_channel, condition);
+       ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK, "Subscribe to condition");
 
        /* Subscribing again should fail. */
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, condition);
+       nc_status = lttng_notification_channel_subscribe(notification_channel, condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_ALREADY_SUBSCRIBED,
-                       "Subscribe to a condition for which subscription was already done");
+          "Subscribe to a condition for which subscription was already done");
 
 end:
        ret = lttng_unregister_trigger(trigger);
@@ -1259,9 +1274,9 @@ end:
 }
 
 static void test_buffer_usage_notification_channel(const char *session_name,
-               const char *channel_name,
-               const enum lttng_domain_type domain_type,
-               const char **argv)
+                                                  const char *channel_name,
+                                                  const enum lttng_domain_type domain_type,
+                                                  const char **argv)
 {
        int ret = 0;
        enum lttng_notification_channel_status nc_status;
@@ -1279,41 +1294,47 @@ static void test_buffer_usage_notification_channel(const char *session_name,
        const double low_ratio = 0.0;
        const double high_ratio = 0.90;
 
-       ret = register_buffer_usage_notify_trigger(session_name, channel_name,
-                       domain_type, BUFFER_USAGE_TYPE_LOW, low_ratio,
-                       &low_condition, &low_action, &low_trigger);
+       ret = register_buffer_usage_notify_trigger(session_name,
+                                                  channel_name,
+                                                  domain_type,
+                                                  BUFFER_USAGE_TYPE_LOW,
+                                                  low_ratio,
+                                                  &low_condition,
+                                                  &low_action,
+                                                  &low_trigger);
        if (ret) {
                fail("Setup error on low trigger registration");
                goto end;
        }
 
-       ret = register_buffer_usage_notify_trigger(session_name, channel_name,
-                       domain_type, BUFFER_USAGE_TYPE_HIGH, high_ratio,
-                       &high_condition, &high_action, &high_trigger);
+       ret = register_buffer_usage_notify_trigger(session_name,
+                                                  channel_name,
+                                                  domain_type,
+                                                  BUFFER_USAGE_TYPE_HIGH,
+                                                  high_ratio,
+                                                  &high_condition,
+                                                  &high_action,
+                                                  &high_trigger);
        if (ret) {
                fail("Setup error on high trigger registration");
                goto end;
        }
 
        /* Begin testing */
-       notification_channel = lttng_notification_channel_create(
-                       lttng_session_daemon_notification_endpoint);
+       notification_channel =
+               lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
        ok(notification_channel, "Notification channel object creation");
        if (!notification_channel) {
                goto end;
        }
 
        /* Subscribe a valid low condition */
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, low_condition);
-       ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe to low condition");
+       nc_status = lttng_notification_channel_subscribe(notification_channel, low_condition);
+       ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK, "Subscribe to low condition");
 
        /* Subscribe a valid high condition */
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, high_condition);
-       ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe to high condition");
+       nc_status = lttng_notification_channel_subscribe(notification_channel, high_condition);
+       ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK, "Subscribe to high condition");
 
        resume_application();
 
@@ -1323,14 +1344,13 @@ static void test_buffer_usage_notification_channel(const char *session_name,
 
        /* Wait for high notification */
        do {
-               nc_status = lttng_notification_channel_get_next_notification(
-                               notification_channel, &notification);
+               nc_status = lttng_notification_channel_get_next_notification(notification_channel,
+                                                                            &notification);
        } while (nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK && notification &&
-                                       lttng_condition_get_type(lttng_notification_get_condition(
-                                                       notification)) ==
-                                                       LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH,
-                       "High notification received after intermediary communication");
+                  lttng_condition_get_type(lttng_notification_get_condition(notification)) ==
+                          LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH,
+          "High notification received after intermediary communication");
        lttng_notification_destroy(notification);
        notification = NULL;
 
@@ -1344,25 +1364,22 @@ static void test_buffer_usage_notification_channel(const char *session_name,
         * waiting for consumption.
         */
 
-       nc_status = lttng_notification_channel_unsubscribe(
-                       notification_channel, low_condition);
+       nc_status = lttng_notification_channel_unsubscribe(notification_channel, low_condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Unsubscribe with pending notification");
+          "Unsubscribe with pending notification");
 
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, low_condition);
+       nc_status = lttng_notification_channel_subscribe(notification_channel, low_condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe with pending notification");
+          "Subscribe with pending notification");
 
        do {
-               nc_status = lttng_notification_channel_get_next_notification(
-                               notification_channel, &notification);
+               nc_status = lttng_notification_channel_get_next_notification(notification_channel,
+                                                                            &notification);
        } while (nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK && notification &&
-                                       lttng_condition_get_type(lttng_notification_get_condition(
-                                                       notification)) ==
-                                                       LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW,
-                       "Low notification received after intermediary communication");
+                  lttng_condition_get_type(lttng_notification_get_condition(notification)) ==
+                          LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW,
+          "Low notification received after intermediary communication");
        lttng_notification_destroy(notification);
        notification = NULL;
 
@@ -1372,14 +1389,13 @@ static void test_buffer_usage_notification_channel(const char *session_name,
        lttng_start_tracing(session_name);
 
        do {
-               nc_status = lttng_notification_channel_get_next_notification(
-                               notification_channel, &notification);
+               nc_status = lttng_notification_channel_get_next_notification(notification_channel,
+                                                                            &notification);
        } while (nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK && notification &&
-                                       lttng_condition_get_type(lttng_notification_get_condition(
-                                                       notification)) ==
-                                                       LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH,
-                       "High notification received after intermediary communication");
+                  lttng_condition_get_type(lttng_notification_get_condition(notification)) ==
+                          LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH,
+          "High notification received after intermediary communication");
        lttng_notification_destroy(notification);
        notification = NULL;
 
@@ -1389,14 +1405,13 @@ static void test_buffer_usage_notification_channel(const char *session_name,
        wait_data_pending(session_name);
 
        do {
-               nc_status = lttng_notification_channel_get_next_notification(
-                               notification_channel, &notification);
+               nc_status = lttng_notification_channel_get_next_notification(notification_channel,
+                                                                            &notification);
        } while (nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK && notification &&
-                                       lttng_condition_get_type(lttng_notification_get_condition(
-                                                       notification)) ==
-                                                       LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW,
-                       "Low notification received after re-subscription");
+                  lttng_condition_get_type(lttng_notification_get_condition(notification)) ==
+                          LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW,
+          "Low notification received after re-subscription");
        lttng_notification_destroy(notification);
        notification = NULL;
 
@@ -1406,14 +1421,13 @@ static void test_buffer_usage_notification_channel(const char *session_name,
        lttng_start_tracing(session_name);
 
        do {
-               nc_status = lttng_notification_channel_get_next_notification(
-                               notification_channel, &notification);
+               nc_status = lttng_notification_channel_get_next_notification(notification_channel,
+                                                                            &notification);
        } while (nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK && notification &&
-                                       lttng_condition_get_type(lttng_notification_get_condition(
-                                                       notification)) ==
-                                                       LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH,
-                       "High notification");
+                  lttng_condition_get_type(lttng_notification_get_condition(notification)) ==
+                          LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH,
+          "High notification");
        lttng_notification_destroy(notification);
        notification = NULL;
 
@@ -1424,15 +1438,13 @@ static void test_buffer_usage_notification_channel(const char *session_name,
        resume_consumer(argv);
        wait_data_pending(session_name);
 
-       nc_status = lttng_notification_channel_unsubscribe(
-                       notification_channel, low_condition);
+       nc_status = lttng_notification_channel_unsubscribe(notification_channel, low_condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Unsubscribe low condition with pending notification");
+          "Unsubscribe low condition with pending notification");
 
-       nc_status = lttng_notification_channel_unsubscribe(
-                       notification_channel, high_condition);
+       nc_status = lttng_notification_channel_unsubscribe(notification_channel, high_condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Unsubscribe high condition with pending notification");
+          "Unsubscribe high condition with pending notification");
 
 end:
        lttng_notification_channel_destroy(notification_channel);
@@ -1445,26 +1457,22 @@ end:
 }
 
 static void create_tracepoint_event_rule_trigger(const char *event_pattern,
-               const char *trigger_name,
-               const char *filter,
-               unsigned int exclusion_count,
-               const char * const *exclusions,
-               enum lttng_domain_type domain_type,
-               condition_capture_desc_cb capture_desc_cb,
-               struct lttng_condition **condition,
-               struct lttng_trigger **trigger)
+                                                const char *trigger_name,
+                                                const char *filter,
+                                                unsigned int exclusion_count,
+                                                const char *const *exclusions,
+                                                enum lttng_domain_type domain_type,
+                                                condition_capture_desc_cb capture_desc_cb,
+                                                struct lttng_condition **condition,
+                                                struct lttng_trigger **trigger)
 {
        typedef struct lttng_event_rule *(*event_rule_create)(void);
        typedef enum lttng_event_rule_status (
-                       *event_rule_set_name_pattern)(
-                       struct lttng_event_rule *rule,
-                       const char *pattern);
-       typedef enum lttng_event_rule_status (*event_rule_set_filter)(
-                       struct lttng_event_rule *rule,
-                       const char *expression);
+               *event_rule_set_name_pattern)(struct lttng_event_rule * rule, const char *pattern);
        typedef enum lttng_event_rule_status (
-                       *event_rule_add_name_pattern_exclusion)(
-                       struct lttng_event_rule * rule, const char *exclusion);
+               *event_rule_set_filter)(struct lttng_event_rule * rule, const char *expression);
+       typedef enum lttng_event_rule_status (*event_rule_add_name_pattern_exclusion)(
+               struct lttng_event_rule * rule, const char *exclusion);
 
        enum lttng_event_rule_status event_rule_status;
        struct lttng_action *tmp_action = NULL;
@@ -1489,7 +1497,8 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern,
                create = lttng_event_rule_user_tracepoint_create;
                set_name_pattern = lttng_event_rule_user_tracepoint_set_name_pattern;
                set_filter = lttng_event_rule_user_tracepoint_set_filter;
-               add_name_pattern_exclusion = lttng_event_rule_user_tracepoint_add_name_pattern_exclusion;
+               add_name_pattern_exclusion =
+                       lttng_event_rule_user_tracepoint_add_name_pattern_exclusion;
                break;
        case LTTNG_DOMAIN_KERNEL:
                create = lttng_event_rule_kernel_tracepoint_create;
@@ -1507,14 +1516,14 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern,
 
        event_rule_status = set_name_pattern(event_rule, event_pattern);
        ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK,
-                       "Setting tracepoint event rule pattern: '%s'",
-                       event_pattern);
+          "Setting tracepoint event rule pattern: '%s'",
+          event_pattern);
 
        if (filter) {
                event_rule_status = set_filter(event_rule, filter);
                ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK,
-                               "Setting tracepoint event rule filter: '%s'",
-                               filter);
+                  "Setting tracepoint event rule filter: '%s'",
+                  filter);
        }
 
        if (exclusions) {
@@ -1526,11 +1535,10 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern,
                LTTNG_ASSERT(exclusion_count > 0);
 
                for (i = 0; i < exclusion_count; i++) {
-                       event_rule_status = add_name_pattern_exclusion(
-                                       event_rule, exclusions[i]);
+                       event_rule_status = add_name_pattern_exclusion(event_rule, exclusions[i]);
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                                fail("Setting tracepoint event rule exclusion '%s'.",
-                                               exclusions[i]);
+                                    exclusions[i]);
                                success = false;
                        }
                }
@@ -1566,15 +1574,15 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern,
        return;
 }
 
-static struct lttng_notification *get_next_notification(
-               struct lttng_notification_channel *notification_channel)
+static struct lttng_notification *
+get_next_notification(struct lttng_notification_channel *notification_channel)
 {
        struct lttng_notification *local_notification = NULL;
        enum lttng_notification_channel_status status;
 
        /* Receive the next notification. */
-       status = lttng_notification_channel_get_next_notification(
-                       notification_channel, &local_notification);
+       status = lttng_notification_channel_get_next_notification(notification_channel,
+                                                                 &local_notification);
 
        switch (status) {
        case LTTNG_NOTIFICATION_CHANNEL_STATUS_OK:
@@ -1586,7 +1594,7 @@ static struct lttng_notification *get_next_notification(
        default:
                /* Unhandled conditions / errors. */
                fail("Failed to get next notification (unknown notification channel status): status = %d",
-                               (int) status);
+                    (int) status);
                local_notification = NULL;
                break;
        }
@@ -1594,8 +1602,7 @@ static struct lttng_notification *get_next_notification(
        return local_notification;
 }
 
-static void test_tracepoint_event_rule_notification(
-               enum lttng_domain_type domain_type)
+static void test_tracepoint_event_rule_notification(enum lttng_domain_type domain_type)
 {
        int i;
        int ret;
@@ -1605,7 +1612,7 @@ static void test_tracepoint_event_rule_notification(
        struct lttng_condition *condition = NULL;
        struct lttng_notification_channel *notification_channel = NULL;
        struct lttng_trigger *trigger = NULL;
-       const char * const trigger_name = "my_precious";
+       const char *const trigger_name = "my_precious";
        const char *pattern;
 
        if (domain_type == LTTNG_DOMAIN_UST) {
@@ -1614,27 +1621,25 @@ static void test_tracepoint_event_rule_notification(
                pattern = "lttng_test_filter_event";
        }
 
-       create_tracepoint_event_rule_trigger(pattern, trigger_name, NULL, 0,
-                       NULL, domain_type, NULL, &condition, &trigger);
+       create_tracepoint_event_rule_trigger(
+               pattern, trigger_name, NULL, 0, NULL, domain_type, NULL, &condition, &trigger);
 
-       notification_channel = lttng_notification_channel_create(
-                       lttng_session_daemon_notification_endpoint);
+       notification_channel =
+               lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
        ok(notification_channel, "Notification channel object creation");
 
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, condition);
+       nc_status = lttng_notification_channel_subscribe(notification_channel, condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe to tracepoint event rule condition");
+          "Subscribe to tracepoint event rule condition");
 
        resume_application();
 
        /* Get notifications. */
        for (i = 0; i < notification_count; i++) {
-               struct lttng_notification *notification = get_next_notification(
-                               notification_channel);
+               struct lttng_notification *notification =
+                       get_next_notification(notification_channel);
 
-               ok(notification, "Received notification (%d/%d)", i + 1,
-                               notification_count);
+               ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
                if (notification == NULL) {
@@ -1658,8 +1663,7 @@ end:
        return;
 }
 
-static void test_tracepoint_event_rule_notification_filter(
-               enum lttng_domain_type domain_type)
+static void test_tracepoint_event_rule_notification_filter(enum lttng_domain_type domain_type)
 {
        int i;
        const int notification_count = 3;
@@ -1667,8 +1671,8 @@ static void test_tracepoint_event_rule_notification_filter(
        struct lttng_condition *ctrl_condition = NULL, *condition = NULL;
        struct lttng_notification_channel *notification_channel = NULL;
        struct lttng_trigger *ctrl_trigger = NULL, *trigger = NULL;
-       const char * const ctrl_trigger_name = "control_trigger";
-       const char * const trigger_name = "trigger";
+       const char *const ctrl_trigger_name = "control_trigger";
+       const char *const trigger_name = "trigger";
        const char *pattern;
        int ctrl_count = 0, count = 0;
 
@@ -1678,30 +1682,41 @@ static void test_tracepoint_event_rule_notification_filter(
                pattern = "lttng_test_filter_event";
        }
 
-       notification_channel = lttng_notification_channel_create(
-                       lttng_session_daemon_notification_endpoint);
+       notification_channel =
+               lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
        ok(notification_channel, "Notification channel object creation");
 
-       create_tracepoint_event_rule_trigger(pattern, ctrl_trigger_name, NULL,
-                       0, NULL, domain_type, NULL, &ctrl_condition, &ctrl_trigger);
-
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, ctrl_condition);
+       create_tracepoint_event_rule_trigger(pattern,
+                                            ctrl_trigger_name,
+                                            NULL,
+                                            0,
+                                            NULL,
+                                            domain_type,
+                                            NULL,
+                                            &ctrl_condition,
+                                            &ctrl_trigger);
+
+       nc_status = lttng_notification_channel_subscribe(notification_channel, ctrl_condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe to tracepoint event rule condition");
+          "Subscribe to tracepoint event rule condition");
 
        /*
         * Attach a filter expression to get notification only if the
         * `intfield` is even.
         */
-       create_tracepoint_event_rule_trigger(pattern, trigger_name,
-                       "(intfield & 1) == 0", 0, NULL, domain_type, NULL, &condition,
-                       &trigger);
-
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, condition);
+       create_tracepoint_event_rule_trigger(pattern,
+                                            trigger_name,
+                                            "(intfield & 1) == 0",
+                                            0,
+                                            NULL,
+                                            domain_type,
+                                            NULL,
+                                            &condition,
+                                            &trigger);
+
+       nc_status = lttng_notification_channel_subscribe(notification_channel, condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe to tracepoint event rule condition");
+          "Subscribe to tracepoint event rule condition");
 
        /*
         * We registered 2 notifications triggers, one with a filter and one
@@ -1718,11 +1733,10 @@ static void test_tracepoint_event_rule_notification_filter(
         */
        for (i = 0; i < notification_count; i++) {
                const char *name;
-               struct lttng_notification *notification = get_next_notification(
-                               notification_channel);
+               struct lttng_notification *notification =
+                       get_next_notification(notification_channel);
 
-               ok(notification, "Received notification (%d/%d)", i + 1,
-                               notification_count);
+               ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
                if (notification == NULL) {
@@ -1744,8 +1758,7 @@ static void test_tracepoint_event_rule_notification_filter(
                lttng_notification_destroy(notification);
        }
 
-       ok(ctrl_count / 2 == count,
-                       "Get twice as many control notif as of regular notif");
+       ok(ctrl_count / 2 == count, "Get twice as many control notif as of regular notif");
 
 end:
        suspend_application();
@@ -1759,8 +1772,7 @@ end:
        lttng_condition_destroy(ctrl_condition);
 }
 
-static void test_tracepoint_event_rule_notification_exclusion(
-               enum lttng_domain_type domain_type)
+static void test_tracepoint_event_rule_notification_exclusion(enum lttng_domain_type domain_type)
 {
        enum lttng_notification_channel_status nc_status;
        struct lttng_condition *ctrl_condition = NULL, *condition = NULL;
@@ -1768,37 +1780,35 @@ static void test_tracepoint_event_rule_notification_exclusion(
        struct lttng_trigger *ctrl_trigger = NULL, *trigger = NULL;
        int ctrl_count = 0, count = 0, i;
        const int notification_count = 6;
-       const char * const ctrl_trigger_name = "control_exclusion_trigger";
-       const char * const trigger_name = "exclusion_trigger";
-       const char * const pattern = "tp:tptest*";
-       const char * const exclusions[] = {
-               "tp:tptest2",
-               "tp:tptest3",
-               "tp:tptest4",
-               "tp:tptest5"
-       };
-
-       notification_channel = lttng_notification_channel_create(
-                       lttng_session_daemon_notification_endpoint);
-       ok(notification_channel, "Notification channel object creation");
+       const char *const ctrl_trigger_name = "control_exclusion_trigger";
+       const char *const trigger_name = "exclusion_trigger";
+       const char *const pattern = "tp:tptest*";
+       const char *const exclusions[] = { "tp:tptest2", "tp:tptest3", "tp:tptest4", "tp:tptest5" };
 
-       create_tracepoint_event_rule_trigger(pattern, ctrl_trigger_name, NULL,
-                       0, NULL, domain_type, NULL, &ctrl_condition,
-                       &ctrl_trigger);
+       notification_channel =
+               lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
+       ok(notification_channel, "Notification channel object creation");
 
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, ctrl_condition);
+       create_tracepoint_event_rule_trigger(pattern,
+                                            ctrl_trigger_name,
+                                            NULL,
+                                            0,
+                                            NULL,
+                                            domain_type,
+                                            NULL,
+                                            &ctrl_condition,
+                                            &ctrl_trigger);
+
+       nc_status = lttng_notification_channel_subscribe(notification_channel, ctrl_condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe to tracepoint event rule condition");
+          "Subscribe to tracepoint event rule condition");
 
-       create_tracepoint_event_rule_trigger(pattern, trigger_name, NULL, 4,
-                       exclusions, domain_type, NULL, &condition,
-                       &trigger);
+       create_tracepoint_event_rule_trigger(
+               pattern, trigger_name, NULL, 4, exclusions, domain_type, NULL, &condition, &trigger);
 
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, condition);
+       nc_status = lttng_notification_channel_subscribe(notification_channel, condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe to tracepoint event rule condition");
+          "Subscribe to tracepoint event rule condition");
 
        /*
         * We registered 2 notifications triggers, one with an exclusion and
@@ -1819,11 +1829,10 @@ static void test_tracepoint_event_rule_notification_exclusion(
         */
        for (i = 0; i < notification_count; i++) {
                const char *name;
-               struct lttng_notification *notification = get_next_notification(
-                               notification_channel);
+               struct lttng_notification *notification =
+                       get_next_notification(notification_channel);
 
-               ok(notification, "Received notification (%d/%d)", i + 1,
-                               notification_count);
+               ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
                if (notification == NULL) {
@@ -1845,8 +1854,7 @@ static void test_tracepoint_event_rule_notification_exclusion(
                lttng_notification_destroy(notification);
        }
 
-       ok(ctrl_count / 5 == count,
-                       "Got 5 times as many control notif as of regular notif");
+       ok(ctrl_count / 5 == count, "Got 5 times as many control notif as of regular notif");
 
 end:
        suspend_application();
@@ -1874,8 +1882,8 @@ static void test_kprobe_event_rule_notification(void)
        struct lttng_event_rule *event_rule = NULL;
        struct lttng_action *action = NULL;
        struct lttng_trigger *trigger = NULL;
-       const char * const trigger_name = "kprobe_trigger";
-       const char * const symbol_name = "lttng_test_filter_event_write";
+       const char *const trigger_name = "kprobe_trigger";
+       const char *const symbol_name = "lttng_test_filter_event_write";
 
        action = lttng_action_notify_create();
        if (!action) {
@@ -1889,17 +1897,17 @@ static void test_kprobe_event_rule_notification(void)
                goto end;
        }
 
-       notification_channel = lttng_notification_channel_create(
-                       lttng_session_daemon_notification_endpoint);
+       notification_channel =
+               lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
        ok(notification_channel, "Notification channel object creation");
 
        event_rule = lttng_event_rule_kernel_kprobe_create(location);
        ok(event_rule, "kprobe event rule object creation");
 
-       event_rule_status = lttng_event_rule_kernel_kprobe_set_event_name(
-                       event_rule, trigger_name);
+       event_rule_status = lttng_event_rule_kernel_kprobe_set_event_name(event_rule, trigger_name);
        ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK,
-                       "Setting kprobe event rule name: '%s'", trigger_name);
+          "Setting kprobe event rule name: '%s'",
+          trigger_name);
 
        condition = lttng_condition_event_rule_matches_create(event_rule);
        ok(condition, "Condition event rule object creation");
@@ -1917,19 +1925,17 @@ static void test_kprobe_event_rule_notification(void)
                goto end;
        }
 
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, condition);
+       nc_status = lttng_notification_channel_subscribe(notification_channel, condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe to tracepoint event rule condition");
+          "Subscribe to tracepoint event rule condition");
 
        resume_application();
 
        for (i = 0; i < notification_count; i++) {
-               struct lttng_notification *notification = get_next_notification(
-                               notification_channel);
+               struct lttng_notification *notification =
+                       get_next_notification(notification_channel);
 
-               ok(notification, "Received notification (%d/%d)", i + 1,
-                               notification_count);
+               ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
                if (notification == NULL) {
@@ -1955,9 +1961,8 @@ end:
        return;
 }
 
-static void test_uprobe_event_rule_notification(
-               const char *testapp_path,
-               const char *test_symbol_name)
+static void test_uprobe_event_rule_notification(const char *testapp_path,
+                                               const char *test_symbol_name)
 {
        int i, ret;
        enum lttng_error_code ret_code;
@@ -1966,13 +1971,12 @@ static void test_uprobe_event_rule_notification(
        enum lttng_event_rule_status event_rule_status;
        struct lttng_notification_channel *notification_channel = NULL;
        struct lttng_userspace_probe_location *probe_location = NULL;
-       struct lttng_userspace_probe_location_lookup_method *lookup_method =
-                       NULL;
+       struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
        struct lttng_condition *condition = NULL;
        struct lttng_event_rule *event_rule = NULL;
        struct lttng_action *action = NULL;
        struct lttng_trigger *trigger = NULL;
-       const char * const trigger_name = "uprobe_trigger";
+       const char *const trigger_name = "uprobe_trigger";
 
        action = lttng_action_notify_create();
        if (!action) {
@@ -1987,23 +1991,23 @@ static void test_uprobe_event_rule_notification(
        }
 
        probe_location = lttng_userspace_probe_location_function_create(
-                       testapp_path, test_symbol_name, lookup_method);
+               testapp_path, test_symbol_name, lookup_method);
        if (!probe_location) {
                fail("Failed to create userspace probe location");
                goto end;
        }
 
-       notification_channel = lttng_notification_channel_create(
-                       lttng_session_daemon_notification_endpoint);
+       notification_channel =
+               lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
        ok(notification_channel, "Notification channel object creation");
 
        event_rule = lttng_event_rule_kernel_uprobe_create(probe_location);
        ok(event_rule, "uprobe event rule object creation");
 
-       event_rule_status = lttng_event_rule_kernel_uprobe_set_event_name(
-                       event_rule, trigger_name);
+       event_rule_status = lttng_event_rule_kernel_uprobe_set_event_name(event_rule, trigger_name);
        ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK,
-                       "Setting uprobe event rule name: '%s'", trigger_name);
+          "Setting uprobe event rule name: '%s'",
+          trigger_name);
 
        condition = lttng_condition_event_rule_matches_create(event_rule);
        ok(condition, "Condition event rule object creation");
@@ -2021,19 +2025,17 @@ static void test_uprobe_event_rule_notification(
                goto end;
        }
 
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, condition);
+       nc_status = lttng_notification_channel_subscribe(notification_channel, condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe to tracepoint event rule condition");
+          "Subscribe to tracepoint event rule condition");
 
        resume_application();
 
        for (i = 0; i < 3; i++) {
-               struct lttng_notification *notification = get_next_notification(
-                               notification_channel);
+               struct lttng_notification *notification =
+                       get_next_notification(notification_channel);
 
-               ok(notification, "Received notification (%d/%d)", i + 1,
-                               notification_count);
+               ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
                if (notification == NULL) {
@@ -2071,8 +2073,8 @@ static void test_syscall_event_rule_notification(void)
        struct lttng_event_rule *event_rule = NULL;
        struct lttng_action *action = NULL;
        struct lttng_trigger *trigger = NULL;
-       const char * const trigger_name = "syscall_trigger";
-       const char * const syscall_name = "openat";
+       const char *const trigger_name = "syscall_trigger";
+       const char *const syscall_name = "openat";
 
        action = lttng_action_notify_create();
        if (!action) {
@@ -2080,17 +2082,19 @@ static void test_syscall_event_rule_notification(void)
                goto end;
        }
 
-       notification_channel = lttng_notification_channel_create(
-                       lttng_session_daemon_notification_endpoint);
+       notification_channel =
+               lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
        ok(notification_channel, "Notification channel object creation");
 
-       event_rule = lttng_event_rule_kernel_syscall_create(LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY);
+       event_rule = lttng_event_rule_kernel_syscall_create(
+               LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY);
        ok(event_rule, "syscall event rule object creation");
 
-       event_rule_status = lttng_event_rule_kernel_syscall_set_name_pattern(
-                       event_rule, syscall_name);
+       event_rule_status =
+               lttng_event_rule_kernel_syscall_set_name_pattern(event_rule, syscall_name);
        ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK,
-                       "Setting syscall event rule pattern: '%s'", syscall_name);
+          "Setting syscall event rule pattern: '%s'",
+          syscall_name);
 
        condition = lttng_condition_event_rule_matches_create(event_rule);
        ok(condition, "Condition syscall event rule object creation");
@@ -2108,19 +2112,17 @@ static void test_syscall_event_rule_notification(void)
                goto end;
        }
 
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, condition);
+       nc_status = lttng_notification_channel_subscribe(notification_channel, condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe to tracepoint event rule condition");
+          "Subscribe to tracepoint event rule condition");
 
        resume_application();
 
        for (i = 0; i < notification_count; i++) {
-               struct lttng_notification *notification = get_next_notification(
-                               notification_channel);
+               struct lttng_notification *notification =
+                       get_next_notification(notification_channel);
 
-               ok(notification, "Received notification (%d/%d)", i + 1,
-                               notification_count);
+               ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
                if (notification == NULL) {
@@ -2155,9 +2157,9 @@ static void test_syscall_event_rule_notification_filter(void)
        struct lttng_event_rule *event_rule = NULL;
        struct lttng_action *action = NULL;
        struct lttng_trigger *trigger = NULL;
-       const char * const trigger_name = "syscall_trigger";
-       const char * const syscall_name = "openat";
-       const char * const filter_pattern = "filename == \"/proc/cpuinfo\"";
+       const char *const trigger_name = "syscall_trigger";
+       const char *const syscall_name = "openat";
+       const char *const filter_pattern = "filename == \"/proc/cpuinfo\"";
 
        action = lttng_action_notify_create();
        if (!action) {
@@ -2165,22 +2167,22 @@ static void test_syscall_event_rule_notification_filter(void)
                goto end;
        }
 
-       notification_channel = lttng_notification_channel_create(
-                       lttng_session_daemon_notification_endpoint);
+       notification_channel =
+               lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
        ok(notification_channel, "Notification channel object creation");
 
-       event_rule = lttng_event_rule_kernel_syscall_create(LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY);
+       event_rule = lttng_event_rule_kernel_syscall_create(
+               LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY);
        ok(event_rule, "syscall event rule object creation");
 
-       event_rule_status = lttng_event_rule_kernel_syscall_set_name_pattern(
-                       event_rule, syscall_name);
+       event_rule_status =
+               lttng_event_rule_kernel_syscall_set_name_pattern(event_rule, syscall_name);
        ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK,
-                       "Setting syscall event rule pattern: '%s'", syscall_name);
+          "Setting syscall event rule pattern: '%s'",
+          syscall_name);
 
-       event_rule_status = lttng_event_rule_kernel_syscall_set_filter(
-                       event_rule, filter_pattern);
-       ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK,
-                       "Setting filter: '%s'", filter_pattern);
+       event_rule_status = lttng_event_rule_kernel_syscall_set_filter(event_rule, filter_pattern);
+       ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK, "Setting filter: '%s'", filter_pattern);
 
        condition = lttng_condition_event_rule_matches_create(event_rule);
        ok(condition, "Condition event rule object creation");
@@ -2198,19 +2200,17 @@ static void test_syscall_event_rule_notification_filter(void)
                goto end;
        }
 
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, condition);
+       nc_status = lttng_notification_channel_subscribe(notification_channel, condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe to tracepoint event rule condition");
+          "Subscribe to tracepoint event rule condition");
 
        resume_application();
 
        for (i = 0; i < notification_count; i++) {
-               struct lttng_notification *notification = get_next_notification(
-                               notification_channel);
+               struct lttng_notification *notification =
+                       get_next_notification(notification_channel);
 
-               ok(notification, "Received notification (%d/%d)", i + 1,
-                               notification_count);
+               ok(notification, "Received notification (%d/%d)", i + 1, notification_count);
 
                /* Error. */
                if (notification == NULL) {
@@ -2239,22 +2239,21 @@ static int generate_capture_descr(struct lttng_condition *condition)
 {
        int ret, i;
        struct lttng_event_expr *expr = NULL;
-       const unsigned int basic_field_count = sizeof(test_capture_base_fields) /
-                       sizeof(*test_capture_base_fields);
+       const unsigned int basic_field_count =
+               sizeof(test_capture_base_fields) / sizeof(*test_capture_base_fields);
        enum lttng_condition_status cond_status;
 
        for (i = 0; i < basic_field_count; i++) {
-               diag("Adding capture descriptor '%s'",
-                               test_capture_base_fields[i].field_name);
+               diag("Adding capture descriptor '%s'", test_capture_base_fields[i].field_name);
 
                switch (test_capture_base_fields[i].field_type) {
                case FIELD_TYPE_PAYLOAD:
                        expr = lttng_event_expr_event_payload_field_create(
-                                       test_capture_base_fields[i].field_name);
+                               test_capture_base_fields[i].field_name);
                        break;
                case FIELD_TYPE_CONTEXT:
                        expr = lttng_event_expr_channel_context_field_create(
-                                       test_capture_base_fields[i].field_name);
+                               test_capture_base_fields[i].field_name);
                        break;
                case FIELD_TYPE_ARRAY_FIELD:
                {
@@ -2264,19 +2263,19 @@ static int generate_capture_descr(struct lttng_condition *condition)
                        struct lttng_event_expr *array_expr = NULL;
 
                        nb_matches = sscanf(test_capture_base_fields[i].field_name,
-                                       "%[^[][%u]", field_name, &index);
+                                           "%[^[][%u]",
+                                           field_name,
+                                           &index);
                        if (nb_matches != 2) {
                                fail("Unexpected array field name format: field name = '%s'",
-                                               test_capture_base_fields[i].field_name);
+                                    test_capture_base_fields[i].field_name);
                                ret = 1;
                                goto end;
                        }
 
-                       array_expr = lttng_event_expr_event_payload_field_create(
-                               field_name);
+                       array_expr = lttng_event_expr_event_payload_field_create(field_name);
 
-                       expr = lttng_event_expr_array_field_element_create(
-                               array_expr, index);
+                       expr = lttng_event_expr_array_field_element_create(array_expr, index);
                        break;
                }
                case FIELD_TYPE_APP_CONTEXT:
@@ -2294,7 +2293,7 @@ static int generate_capture_descr(struct lttng_condition *condition)
                }
 
                cond_status = lttng_condition_event_rule_matches_append_capture_descriptor(
-                               condition, expr);
+                       condition, expr);
                if (cond_status != LTTNG_CONDITION_STATUS_OK) {
                        fail("Failed to append capture descriptor");
                        ret = -1;
@@ -2309,15 +2308,13 @@ end:
        return ret;
 }
 
-static int validator_notification_trigger_capture(
-               enum lttng_domain_type domain,
-               struct lttng_notification *notification,
-               const int iteration)
+static int validator_notification_trigger_capture(enum lttng_domain_type domain,
+                                                 struct lttng_notification *notification,
+                                                 const int iteration)
 {
        int ret;
        unsigned int capture_count, i;
-       enum lttng_evaluation_event_rule_matches_status
-                       event_rule_matches_evaluation_status;
+       enum lttng_evaluation_event_rule_matches_status event_rule_matches_evaluation_status;
        enum lttng_event_field_value_status event_field_value_status;
        const struct lttng_evaluation *evaluation;
        const struct lttng_event_field_value *captured_fields;
@@ -2331,19 +2328,17 @@ static int validator_notification_trigger_capture(
        }
 
        event_rule_matches_evaluation_status =
-                       lttng_evaluation_event_rule_matches_get_captured_values(
-                                       evaluation, &captured_fields);
-       if (event_rule_matches_evaluation_status !=
-                       LTTNG_EVALUATION_EVENT_RULE_MATCHES_STATUS_OK) {
+               lttng_evaluation_event_rule_matches_get_captured_values(evaluation,
+                                                                       &captured_fields);
+       if (event_rule_matches_evaluation_status != LTTNG_EVALUATION_EVENT_RULE_MATCHES_STATUS_OK) {
                diag("Failed to get event rule evaluation captured values: status = %d",
-                               (int) event_rule_matches_evaluation_status);
+                    (int) event_rule_matches_evaluation_status);
                ret = 1;
                goto end;
        }
 
        event_field_value_status =
-               lttng_event_field_value_array_get_length(captured_fields,
-                               &capture_count);
+               lttng_event_field_value_array_get_length(captured_fields, &capture_count);
        if (event_field_value_status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                fail("Failed to get count of captured value field array");
                ret = 1;
@@ -2355,14 +2350,11 @@ static int validator_notification_trigger_capture(
                validate_cb validate;
                bool expected;
 
-               diag("Validating capture of field '%s'",
-                               test_capture_base_fields[i].field_name);
-               event_field_value_status =
-                               lttng_event_field_value_array_get_element_at_index(
-                                               captured_fields, i,
-                                               &captured_field);
+               diag("Validating capture of field '%s'", test_capture_base_fields[i].field_name);
+               event_field_value_status = lttng_event_field_value_array_get_element_at_index(
+                       captured_fields, i, &captured_field);
 
-               switch(domain) {
+               switch (domain) {
                case LTTNG_DOMAIN_UST:
                        expected = test_capture_base_fields[i].expected_ust;
                        break;
@@ -2370,8 +2362,7 @@ static int validator_notification_trigger_capture(
                        expected = test_capture_base_fields[i].expected_kernel;
                        break;
                default:
-                       fail("Unexpected domain encountered: domain = %d",
-                                       (int) domain);
+                       fail("Unexpected domain encountered: domain = %d", (int) domain);
                        ret = 1;
                        goto end;
                }
@@ -2384,17 +2375,17 @@ static int validator_notification_trigger_capture(
 
                if (!expected) {
                        ok(event_field_value_status == LTTNG_EVENT_FIELD_VALUE_STATUS_UNAVAILABLE,
-                                       "No payload captured");
+                          "No payload captured");
                        continue;
                }
 
                if (event_field_value_status != LTTNG_EVENT_FIELD_VALUE_STATUS_OK) {
                        if (event_field_value_status ==
-                                       LTTNG_EVENT_FIELD_VALUE_STATUS_UNAVAILABLE) {
+                           LTTNG_EVENT_FIELD_VALUE_STATUS_UNAVAILABLE) {
                                fail("Expected a capture but it is unavailable");
                        } else {
                                fail("lttng_event_field_value_array_get_element_at_index returned an error: status = %d",
-                                               (int) event_field_value_status);
+                                    (int) event_field_value_status);
                        }
 
                        ret = 1;
@@ -2402,8 +2393,7 @@ static int validator_notification_trigger_capture(
                }
 
                diag("Captured field of type %s",
-                               field_value_type_to_str(
-                                       lttng_event_field_value_get_type(captured_field)));
+                    field_value_type_to_str(lttng_event_field_value_get_type(captured_field)));
 
                LTTNG_ASSERT(validate);
                ret = validate(captured_field, iteration);
@@ -2418,8 +2408,7 @@ end:
        return ret;
 }
 
-static void test_tracepoint_event_rule_notification_capture(
-               enum lttng_domain_type domain_type)
+static void test_tracepoint_event_rule_notification_capture(enum lttng_domain_type domain_type)
 {
        enum lttng_notification_channel_status nc_status;
 
@@ -2436,25 +2425,30 @@ static void test_tracepoint_event_rule_notification_capture(
                pattern = "lttng_test_filter_event";
        }
 
-       create_tracepoint_event_rule_trigger(pattern, trigger_name, NULL, 0,
-                       NULL, domain_type, generate_capture_descr, &condition,
-                       &trigger);
+       create_tracepoint_event_rule_trigger(pattern,
+                                            trigger_name,
+                                            NULL,
+                                            0,
+                                            NULL,
+                                            domain_type,
+                                            generate_capture_descr,
+                                            &condition,
+                                            &trigger);
 
-       notification_channel = lttng_notification_channel_create(
-                       lttng_session_daemon_notification_endpoint);
+       notification_channel =
+               lttng_notification_channel_create(lttng_session_daemon_notification_endpoint);
        ok(notification_channel, "Notification channel object creation");
 
-       nc_status = lttng_notification_channel_subscribe(
-                       notification_channel, condition);
+       nc_status = lttng_notification_channel_subscribe(notification_channel, condition);
        ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK,
-                       "Subscribe to tracepoint event rule condition");
+          "Subscribe to tracepoint event rule condition");
 
        resume_application();
 
        /* Get 3 notifications */
        for (i = 0; i < 3; i++) {
-               struct lttng_notification *notification = get_next_notification(
-                               notification_channel);
+               struct lttng_notification *notification =
+                       get_next_notification(notification_channel);
                ok(notification, "Received notification");
 
                /* Error */
@@ -2525,16 +2519,14 @@ int main(int argc, const char *argv[])
                plan_tests(41);
 
                /* Test cases that need gen-ust-event testapp. */
-               diag("Test basic notification error paths for %s domain",
-                               domain_type_string);
+               diag("Test basic notification error paths for %s domain", domain_type_string);
                test_invalid_channel_subscription(domain_type);
 
-               diag("Test tracepoint event rule notifications for domain %s",
-                               domain_type_string);
+               diag("Test tracepoint event rule notifications for domain %s", domain_type_string);
                test_tracepoint_event_rule_notification(domain_type);
 
                diag("Test tracepoint event rule notifications with filter for domain %s",
-                               domain_type_string);
+                    domain_type_string);
                test_tracepoint_event_rule_notification_filter(domain_type);
                break;
        }
@@ -2561,23 +2553,22 @@ int main(int argc, const char *argv[])
                session_name = argv[5];
                channel_name = argv[6];
 
-               test_subscription_twice(session_name, channel_name,
-                               domain_type);
+               test_subscription_twice(session_name, channel_name, domain_type);
 
                diag("Test trigger for domain %s with buffer_usage_low condition",
-                               domain_type_string);
-               test_triggers_buffer_usage_condition(session_name, channel_name,
-                               LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW);
+                    domain_type_string);
+               test_triggers_buffer_usage_condition(
+                       session_name, channel_name, LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW);
 
                diag("Test trigger for domain %s with buffer_usage_high condition",
-                               domain_type_string);
-               test_triggers_buffer_usage_condition(session_name, channel_name,
-                               LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH);
+                    domain_type_string);
+               test_triggers_buffer_usage_condition(
+                       session_name, channel_name, LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH);
 
                diag("Test buffer usage notification channel api for domain %s",
-                               domain_type_string);
-               test_buffer_usage_notification_channel(session_name, channel_name,
-                               domain_type, argv);
+                    domain_type_string);
+               test_buffer_usage_notification_channel(
+                       session_name, channel_name, domain_type, argv);
                break;
        }
        case 3:
@@ -2594,7 +2585,7 @@ int main(int argc, const char *argv[])
                 */
                LTTNG_ASSERT(domain_type == LTTNG_DOMAIN_UST);
                diag("Test tracepoint event rule notifications with exclusion for domain %s",
-                               domain_type_string);
+                    domain_type_string);
                test_tracepoint_event_rule_notification_exclusion(domain_type);
 
                break;
@@ -2605,8 +2596,7 @@ int main(int argc, const char *argv[])
                /* Test cases that need the kernel tracer. */
                LTTNG_ASSERT(domain_type == LTTNG_DOMAIN_KERNEL);
 
-               diag("Test kprobe event rule notifications for domain %s",
-                               domain_type_string);
+               diag("Test kprobe event rule notifications for domain %s", domain_type_string);
 
                test_kprobe_event_rule_notification();
 
@@ -2618,13 +2608,12 @@ int main(int argc, const char *argv[])
                /* Test cases that need the kernel tracer. */
                LTTNG_ASSERT(domain_type == LTTNG_DOMAIN_KERNEL);
 
-               diag("Test syscall event rule notifications for domain %s",
-                               domain_type_string);
+               diag("Test syscall event rule notifications for domain %s", domain_type_string);
 
                test_syscall_event_rule_notification();
 
                diag("Test syscall filtering event rule notifications for domain %s",
-                               domain_type_string);
+                    domain_type_string);
 
                test_syscall_event_rule_notification_filter();
 
@@ -2647,16 +2636,15 @@ int main(int argc, const char *argv[])
                LTTNG_ASSERT(domain_type == LTTNG_DOMAIN_KERNEL);
 
                diag("Test userspace-probe event rule notifications for domain %s",
-                               domain_type_string);
+                    domain_type_string);
 
-               test_uprobe_event_rule_notification(
-                               testapp_path, test_symbol_name);
+               test_uprobe_event_rule_notification(testapp_path, test_symbol_name);
 
                break;
        }
        case 7:
        {
-               switch(domain_type) {
+               switch (domain_type) {
                case LTTNG_DOMAIN_UST:
                        plan_tests(221);
                        break;
@@ -2668,7 +2656,7 @@ int main(int argc, const char *argv[])
                }
 
                diag("Test tracepoint event rule notification captures for domain %s",
-                               domain_type_string);
+                    domain_type_string);
                test_tracepoint_event_rule_notification_capture(domain_type);
 
                break;
@@ -2681,4 +2669,3 @@ int main(int argc, const char *argv[])
 error:
        return exit_status();
 }
-
index f0517ed14b911f9e62fc2bbf2ccd2d2e0036f76e..3baea63230dcfc27cf3d85bea7d113155295ed15 100644 (file)
@@ -8,34 +8,35 @@
 
 #include <common/compat/getenv.hpp>
 #include <common/consumer/consumer.hpp>
-#include <common/pipe.hpp>
 #include <common/error.hpp>
-#include <unistd.h>
-#include <stdbool.h>
+#include <common/pipe.hpp>
+
 #include <lttng/constant.h>
 #include <lttng/lttng-export.h>
-#include <fcntl.h>
+
 #include <dlfcn.h>
+#include <fcntl.h>
+#include <stdbool.h>
 #include <stdio.h>
+#include <unistd.h>
 
 static char *pause_pipe_path;
 static struct lttng_pipe *pause_pipe;
-static int *notifier_notif_consumption_state;;
+static int *notifier_notif_consumption_state;
+;
 
 int lttng_opt_verbose;
 int lttng_opt_mi;
 int lttng_opt_quiet;
 
-static
-void __attribute__((destructor)) pause_pipe_fini(void)
+static void __attribute__((destructor)) pause_pipe_fini(void)
 {
        int ret;
 
        if (pause_pipe_path) {
                ret = unlink(pause_pipe_path);
                if (ret) {
-                       PERROR("Failed to unlink pause pipe: path = %s",
-                                       pause_pipe_path);
+                       PERROR("Failed to unlink pause pipe: path = %s", pause_pipe_path);
                }
        }
 
@@ -49,8 +50,7 @@ int __testpoint_sessiond_thread_notification(void)
        int ret = 0;
        const char *pause_pipe_path_prefix;
 
-       pause_pipe_path_prefix = lttng_secure_getenv(
-                       "NOTIFIER_PAUSE_PIPE_PATH");
+       pause_pipe_path_prefix = lttng_secure_getenv("NOTIFIER_PAUSE_PIPE_PATH");
        if (!pause_pipe_path_prefix) {
                ret = -1;
                goto end;
@@ -66,8 +66,8 @@ int __testpoint_sessiond_thread_notification(void)
        }
 
        DBG("Creating pause pipe at %s", pause_pipe_path);
-       pause_pipe = lttng_pipe_named_open(pause_pipe_path,
-                       S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, O_NONBLOCK);
+       pause_pipe = lttng_pipe_named_open(
+               pause_pipe_path, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, O_NONBLOCK);
        if (!pause_pipe) {
                ERR("Failed to create pause pipe at %s", pause_pipe_path);
                ret = -1;
@@ -105,7 +105,7 @@ int __testpoint_sessiond_handle_notifier_event_pipe(void)
        if (value_read) {
                *notifier_notif_consumption_state = !!value;
                DBG("Message received on pause pipe: %s data consumption",
-                               *notifier_notif_consumption_state ? "paused" : "resumed");
+                   *notifier_notif_consumption_state ? "paused" : "resumed");
        }
 end:
        return ret;
index 969cab11eabb05050d1d96f80929f88516367d19..13148524814b43362922eb28da23e025b5e07977 100644 (file)
@@ -9,24 +9,23 @@
  *
  */
 
+#include <common/macros.hpp>
+
+#include <lttng/lttng.h>
+
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
-
 #include <tap/tap.h>
-
-#include <common/macros.hpp>
-#include <lttng/lttng.h>
+#include <unistd.h>
 
 #define TEST_COUNT 1
 
 #define TEST_SESSION_NAME "test_session"
 #define TEST_CHANNEL_NAME "test_channel"
 
-static
-int get_registered_triggers_count(void)
+static int get_registered_triggers_count(void)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -55,24 +54,21 @@ end:
        return ret;
 }
 
-static
-int setup_session_with_size_rotation_schedule(const char *session_output_path)
+static int setup_session_with_size_rotation_schedule(const char *session_output_path)
 {
        int ret;
        struct lttng_session_descriptor *session_desriptor = NULL;
        enum lttng_error_code ret_code;
-       struct lttng_handle ust_channel_handle = {
-               TEST_SESSION_NAME,
-               {
-                       .type = LTTNG_DOMAIN_UST,
-                       .buf_type = LTTNG_BUFFER_PER_UID,
-                       .padding = {},
-                       .attr = {},
-               },
-               {}
-       };
-
-       lttng_channel channel_cfg {};
+       struct lttng_handle ust_channel_handle = { TEST_SESSION_NAME,
+                                                  {
+                                                          .type = LTTNG_DOMAIN_UST,
+                                                          .buf_type = LTTNG_BUFFER_PER_UID,
+                                                          .padding = {},
+                                                          .attr = {},
+                                                  },
+                                                  {} };
+
+       lttng_channel channel_cfg{};
        strcpy(channel_cfg.name, TEST_CHANNEL_NAME);
        channel_cfg.enabled = 1;
        channel_cfg.attr.overwrite = -1;
@@ -83,35 +79,33 @@ int setup_session_with_size_rotation_schedule(const char *session_output_path)
        enum lttng_rotation_status rotation_status;
        struct lttng_rotation_schedule *rotation_schedule = NULL;
 
-       session_desriptor = lttng_session_descriptor_local_create(
-                       TEST_SESSION_NAME, session_output_path);
+       session_desriptor =
+               lttng_session_descriptor_local_create(TEST_SESSION_NAME, session_output_path);
        if (!session_desriptor) {
-               fail("Failed to create session descriptor for session `%s`",
-                               TEST_SESSION_NAME);
+               fail("Failed to create session descriptor for session `%s`", TEST_SESSION_NAME);
                ret = -1;
                goto end;
        }
 
        ret_code = lttng_create_session_ext(session_desriptor);
        if (ret_code != LTTNG_OK) {
-               fail("Failed to create session `%s`: %s", TEST_SESSION_NAME,
-                               lttng_strerror(-ret_code));
+               fail("Failed to create session `%s`: %s",
+                    TEST_SESSION_NAME,
+                    lttng_strerror(-ret_code));
                ret = -1;
                goto end;
        }
 
        ret = lttng_enable_channel(&ust_channel_handle, &channel_cfg);
        if (ret) {
-               fail("Failed to enable channel `%s`: %s", TEST_CHANNEL_NAME,
-                               lttng_strerror(ret));
+               fail("Failed to enable channel `%s`: %s", TEST_CHANNEL_NAME, lttng_strerror(ret));
                ret = -1;
                goto end;
        }
 
        ret = lttng_start_tracing(TEST_SESSION_NAME);
        if (ret) {
-               fail("Failed to start session `%s`: %s", TEST_SESSION_NAME,
-                               lttng_strerror(ret));
+               fail("Failed to start session `%s`: %s", TEST_SESSION_NAME, lttng_strerror(ret));
                ret = -1;
                goto end;
        }
@@ -129,18 +123,17 @@ int setup_session_with_size_rotation_schedule(const char *session_output_path)
         * time.
         */
        rotation_status = lttng_rotation_schedule_size_threshold_set_threshold(
-                       rotation_schedule, sysconf(_SC_PAGE_SIZE) * 4096);
+               rotation_schedule, sysconf(_SC_PAGE_SIZE) * 4096);
        if (rotation_status != LTTNG_ROTATION_STATUS_OK) {
                fail("Failed to set size threshold of session rotation schedule");
                ret = -1;
                goto end;
        }
 
-       rotation_status = lttng_session_add_rotation_schedule(
-                       TEST_SESSION_NAME, rotation_schedule);
+       rotation_status = lttng_session_add_rotation_schedule(TEST_SESSION_NAME, rotation_schedule);
        if (rotation_status != LTTNG_ROTATION_STATUS_OK) {
                fail("Failed to set size-based rotation schedule on session `%s`",
-                               TEST_SESSION_NAME);
+                    TEST_SESSION_NAME);
                ret = -1;
                goto end;
        }
@@ -174,7 +167,7 @@ int main(int argc, const char **argv)
        }
 
        ok(get_registered_triggers_count() == 0,
-                       "No triggers visible while session has an enabled size-based rotation schedule");
+          "No triggers visible while session has an enabled size-based rotation schedule");
 
        ret = lttng_destroy_session(TEST_SESSION_NAME);
        if (ret) {
index 1e2a676dc4000003eec31a6eccb2736ff5d2c42f..80bd96c27b9f893d2c340d166ba94a0079c22745 100644 (file)
@@ -9,13 +9,15 @@
  *
  */
 
-#include <stdio.h>
-#include <unistd.h>
-#include <tap/tap.h>
+#include <common/macros.hpp>
+
+#include <lttng/lttng.h>
+
 #include <stdint.h>
+#include <stdio.h>
 #include <string.h>
-#include <lttng/lttng.h>
-#include <common/macros.hpp>
+#include <tap/tap.h>
+#include <unistd.h>
 
 #define TEST_COUNT 70
 
@@ -26,8 +28,7 @@ enum unregistration_trigger_instance {
 
 typedef void (*test_function)(enum unregistration_trigger_instance);
 
-static
-const char *get_trigger_name(const struct lttng_trigger *trigger)
+static const char *get_trigger_name(const struct lttng_trigger *trigger)
 {
        const char *trigger_name;
        enum lttng_trigger_status trigger_status;
@@ -47,9 +48,8 @@ const char *get_trigger_name(const struct lttng_trigger *trigger)
        return trigger_name;
 }
 
-static
-const char *unregistration_trigger_instance_name(
-               enum unregistration_trigger_instance unregistration_trigger)
+static const char *
+unregistration_trigger_instance_name(enum unregistration_trigger_instance unregistration_trigger)
 {
        const char *name;
 
@@ -71,8 +71,7 @@ const char *unregistration_trigger_instance_name(
  * Returns a negative error code on error, else the number of unregistered
  * triggers.
  */
-static
-int unregister_all_triggers(void)
+static int unregister_all_triggers(void)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -123,8 +122,7 @@ end:
        return ret;
 }
 
-static
-int get_registered_triggers_count(void)
+static int get_registered_triggers_count(void)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -157,14 +155,13 @@ end:
  * Create a generic trigger. The specifics of the condition and action are not
  * important for the purposes of this test.
  */
-static
-struct lttng_trigger *create_trigger(uint64_t threshold)
+static struct lttng_trigger *create_trigger(uint64_t threshold)
 {
        struct lttng_condition *condition = NULL;
        struct lttng_action *action = NULL;
        struct lttng_trigger *trigger = NULL;
        enum lttng_condition_status condition_status;
-       const char * const session_name = "test session";
+       const char *const session_name = "test session";
 
        condition = lttng_condition_session_consumed_size_create();
        if (!condition) {
@@ -172,14 +169,15 @@ struct lttng_trigger *create_trigger(uint64_t threshold)
                goto end;
        }
 
-       condition_status = lttng_condition_session_consumed_size_set_session_name(condition, session_name);
+       condition_status =
+               lttng_condition_session_consumed_size_set_session_name(condition, session_name);
        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
                fail("Failed to set session name on 'session consumed size' condition");
                goto end;
        }
 
-       condition_status = lttng_condition_session_consumed_size_set_threshold(
-                       condition, threshold);
+       condition_status =
+               lttng_condition_session_consumed_size_set_threshold(condition, threshold);
        if (condition_status != LTTNG_CONDITION_STATUS_OK) {
                fail("Failed to set threshold on 'session consumed size' condition");
                goto end;
@@ -203,9 +201,7 @@ end:
        return trigger;
 }
 
-static
-void register_anonymous_trigger(
-               enum unregistration_trigger_instance unregistration_trigger)
+static void register_anonymous_trigger(enum unregistration_trigger_instance unregistration_trigger)
 {
        int ret;
        struct lttng_trigger *trigger = create_trigger(0xbadc0ffee);
@@ -216,8 +212,7 @@ void register_anonymous_trigger(
        enum lttng_error_code ret_code;
 
        diag("Register an anonymous trigger (Unregistration performed with the trigger instance %s)",
-                       unregistration_trigger_instance_name(
-                                       unregistration_trigger));
+            unregistration_trigger_instance_name(unregistration_trigger));
 
        if (!trigger) {
                fail("Failed to create trigger");
@@ -229,8 +224,8 @@ void register_anonymous_trigger(
 
        trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
        ok(trigger_status == LTTNG_TRIGGER_STATUS_UNSET,
-                       "Anonymous trigger name remains unset after registration: trigger name = '%s'",
-                       get_trigger_name(trigger));
+          "Anonymous trigger name remains unset after registration: trigger name = '%s'",
+          get_trigger_name(trigger));
 
        ret_code = lttng_list_triggers(&triggers);
        if (ret_code != LTTNG_OK) {
@@ -256,18 +251,20 @@ void register_anonymous_trigger(
 
                trigger_status = lttng_trigger_get_name(trigger_from_listing, &trigger_name);
                ok(trigger_status == LTTNG_TRIGGER_STATUS_UNSET,
-                               "Anonymous trigger returned by listing has an unset name: trigger name = '%s'",
-                               get_trigger_name(trigger_from_listing));
+                  "Anonymous trigger returned by listing has an unset name: trigger name = '%s'",
+                  get_trigger_name(trigger_from_listing));
 
                if (unregistration_trigger == UNREGISTRATION_TRIGGER_INSTANCE_FROM_LISTING) {
                        ret = lttng_unregister_trigger(trigger_from_listing);
-                       ok(ret == 0, "Successfully unregistered anonymous trigger using the trigger instance returned by the listing");
+                       ok(ret == 0,
+                          "Successfully unregistered anonymous trigger using the trigger instance returned by the listing");
                }
        }
 
        if (unregistration_trigger == UNREGISTRATION_TRIGGER_INSTANCE_USED_FOR_REGISTRATION) {
                ret = lttng_unregister_trigger(trigger);
-               ok(ret == 0, "Successfully unregistered anonymous trigger using the trigger instance used on registration");
+               ok(ret == 0,
+                  "Successfully unregistered anonymous trigger using the trigger instance used on registration");
        }
 
 end:
@@ -275,9 +272,7 @@ end:
        lttng_trigger_destroy(trigger);
 }
 
-static
-void register_named_trigger(
-               enum unregistration_trigger_instance unregistration_trigger)
+static void register_named_trigger(enum unregistration_trigger_instance unregistration_trigger)
 {
        int ret;
        struct lttng_trigger *trigger = create_trigger(0xbadc0ffee);
@@ -286,11 +281,10 @@ void register_named_trigger(
        struct lttng_triggers *triggers = NULL;
        unsigned int trigger_count, i;
        enum lttng_error_code ret_code;
-       const char * const trigger_name = "some name that is hopefully unique";
+       const char *const trigger_name = "some name that is hopefully unique";
 
        diag("Register a named trigger (Unregistration performed with the trigger instance %s)",
-                       unregistration_trigger_instance_name(
-                                       unregistration_trigger));
+            unregistration_trigger_instance_name(unregistration_trigger));
 
        if (!trigger) {
                fail("Failed to create trigger");
@@ -298,16 +292,17 @@ void register_named_trigger(
        }
 
        ret_code = lttng_register_trigger_with_name(trigger, trigger_name);
-       ok(ret_code == LTTNG_OK, "Registered trigger with name: trigger name = '%s'",
-                       get_trigger_name(trigger));
+       ok(ret_code == LTTNG_OK,
+          "Registered trigger with name: trigger name = '%s'",
+          get_trigger_name(trigger));
 
        trigger_status = lttng_trigger_get_name(trigger, &returned_trigger_name);
        ok(trigger_status == LTTNG_TRIGGER_STATUS_OK,
-                       "Trigger name is set after registration: trigger name = '%s'",
-                       get_trigger_name(trigger));
+          "Trigger name is set after registration: trigger name = '%s'",
+          get_trigger_name(trigger));
 
        ok(!strcmp(get_trigger_name(trigger), trigger_name),
-                       "Name set on trigger after registration is correct");
+          "Name set on trigger after registration is correct");
 
        ret_code = lttng_list_triggers(&triggers);
        if (ret_code != LTTNG_OK) {
@@ -331,26 +326,28 @@ void register_named_trigger(
                trigger_from_listing = lttng_triggers_get_at_index(triggers, i);
                LTTNG_ASSERT(trigger_from_listing);
 
-               trigger_status = lttng_trigger_get_name(trigger_from_listing, &returned_trigger_name);
+               trigger_status =
+                       lttng_trigger_get_name(trigger_from_listing, &returned_trigger_name);
                ok(trigger_status == LTTNG_TRIGGER_STATUS_OK,
-                               "Trigger returned by listing has a name: trigger name = '%s'",
-                               get_trigger_name(trigger_from_listing));
+                  "Trigger returned by listing has a name: trigger name = '%s'",
+                  get_trigger_name(trigger_from_listing));
 
-               ok(!strcmp(get_trigger_name(trigger_from_listing),
-                               trigger_name),
-                               "Name set on trigger returned from listing is correct: name returned from listing = '%s', expected name = '%s'",
-                               get_trigger_name(trigger_from_listing),
-                               trigger_name);
+               ok(!strcmp(get_trigger_name(trigger_from_listing), trigger_name),
+                  "Name set on trigger returned from listing is correct: name returned from listing = '%s', expected name = '%s'",
+                  get_trigger_name(trigger_from_listing),
+                  trigger_name);
 
                if (unregistration_trigger == UNREGISTRATION_TRIGGER_INSTANCE_FROM_LISTING) {
                        ret = lttng_unregister_trigger(trigger_from_listing);
-                       ok(ret == 0, "Successfully unregistered named trigger using the trigger instance returned by the listing");
+                       ok(ret == 0,
+                          "Successfully unregistered named trigger using the trigger instance returned by the listing");
                }
        }
 
        if (unregistration_trigger == UNREGISTRATION_TRIGGER_INSTANCE_USED_FOR_REGISTRATION) {
                ret = lttng_unregister_trigger(trigger);
-               ok(ret == 0, "Successfully unregistered named trigger using the trigger instance used on registration");
+               ok(ret == 0,
+                  "Successfully unregistered named trigger using the trigger instance used on registration");
        }
 
 end:
@@ -358,9 +355,8 @@ end:
        lttng_trigger_destroy(trigger);
 }
 
-static
-void register_automatic_name_trigger(
-               enum unregistration_trigger_instance unregistration_trigger)
+static void
+register_automatic_name_trigger(enum unregistration_trigger_instance unregistration_trigger)
 {
        int ret;
        struct lttng_trigger *trigger = create_trigger(0xbadc0ffee);
@@ -371,8 +367,7 @@ void register_automatic_name_trigger(
        enum lttng_error_code ret_code;
 
        diag("Register an automatic name trigger (Unregistration performed with the trigger instance %s)",
-                       unregistration_trigger_instance_name(
-                                       unregistration_trigger));
+            unregistration_trigger_instance_name(unregistration_trigger));
 
        if (!trigger) {
                fail("Failed to create trigger");
@@ -384,11 +379,11 @@ void register_automatic_name_trigger(
 
        trigger_status = lttng_trigger_get_name(trigger, &returned_trigger_name);
        ok(trigger_status == LTTNG_TRIGGER_STATUS_OK,
-                       "Trigger name is set after registration: trigger name = '%s'",
-                       get_trigger_name(trigger));
+          "Trigger name is set after registration: trigger name = '%s'",
+          get_trigger_name(trigger));
 
        ok(returned_trigger_name && strlen(returned_trigger_name) > 0,
-                       "Automatic name set on trigger after registration longer is not an empty string");
+          "Automatic name set on trigger after registration longer is not an empty string");
 
        ret_code = lttng_list_triggers(&triggers);
        if (ret_code != LTTNG_OK) {
@@ -412,20 +407,23 @@ void register_automatic_name_trigger(
                trigger_from_listing = lttng_triggers_get_at_index(triggers, i);
                LTTNG_ASSERT(trigger_from_listing);
 
-               trigger_status = lttng_trigger_get_name(trigger_from_listing, &returned_trigger_name);
+               trigger_status =
+                       lttng_trigger_get_name(trigger_from_listing, &returned_trigger_name);
                ok(trigger_status == LTTNG_TRIGGER_STATUS_OK,
-                               "Trigger returned by listing has a name: trigger name = '%s'",
-                               get_trigger_name(trigger_from_listing));
+                  "Trigger returned by listing has a name: trigger name = '%s'",
+                  get_trigger_name(trigger_from_listing));
 
                if (unregistration_trigger == UNREGISTRATION_TRIGGER_INSTANCE_FROM_LISTING) {
                        ret = lttng_unregister_trigger(trigger_from_listing);
-                       ok(ret == 0, "Successfully unregistered automatic name trigger using the trigger instance returned by the listing");
+                       ok(ret == 0,
+                          "Successfully unregistered automatic name trigger using the trigger instance returned by the listing");
                }
        }
 
        if (unregistration_trigger == UNREGISTRATION_TRIGGER_INSTANCE_USED_FOR_REGISTRATION) {
                ret = lttng_unregister_trigger(trigger);
-               ok(ret == 0, "Successfully unregistered automatic trigger using the trigger instance used on registration");
+               ok(ret == 0,
+                  "Successfully unregistered automatic trigger using the trigger instance used on registration");
        }
 
 end:
@@ -433,17 +431,15 @@ end:
        lttng_trigger_destroy(trigger);
 }
 
-static
-void double_register_anonymous_trigger(
-               enum unregistration_trigger_instance unregistration_trigger)
+static void
+double_register_anonymous_trigger(enum unregistration_trigger_instance unregistration_trigger)
 {
        int ret;
        struct lttng_trigger *trigger = create_trigger(0xbadc0ffee);
        struct lttng_triggers *triggers = NULL;
 
        diag("Register duplicate anonymous trigger (Unregistration performed with the trigger instance %s)",
-                       unregistration_trigger_instance_name(
-                                       unregistration_trigger));
+            unregistration_trigger_instance_name(unregistration_trigger));
 
        if (!trigger) {
                fail("Failed to create trigger");
@@ -455,17 +451,16 @@ void double_register_anonymous_trigger(
 
        ret = lttng_register_trigger(trigger);
        ok(ret == -LTTNG_ERR_TRIGGER_EXISTS,
-                       "Registering identical anonymous trigger fails with `LTTNG_ERR_TRIGGER_EXISTS`");
-
+          "Registering identical anonymous trigger fails with `LTTNG_ERR_TRIGGER_EXISTS`");
 
        if (unregistration_trigger == UNREGISTRATION_TRIGGER_INSTANCE_USED_FOR_REGISTRATION) {
                ret = lttng_unregister_trigger(trigger);
-               ok(ret == 0, "Successfully unregistered anonymous trigger using the trigger instance used on registration");
+               ok(ret == 0,
+                  "Successfully unregistered anonymous trigger using the trigger instance used on registration");
        } else {
-               ok(get_registered_triggers_count() == 1,
-                               "Trigger listing returns 1 trigger");
+               ok(get_registered_triggers_count() == 1, "Trigger listing returns 1 trigger");
                ok(unregister_all_triggers() == 1,
-                               "Successfully unregistered anonymous trigger using the trigger instance returned by the listing");
+                  "Successfully unregistered anonymous trigger using the trigger instance returned by the listing");
        }
 
 end:
@@ -473,20 +468,18 @@ end:
        lttng_trigger_destroy(trigger);
 }
 
-static
-void double_register_named_trigger(
-               enum unregistration_trigger_instance unregistration_trigger)
+static void
+double_register_named_trigger(enum unregistration_trigger_instance unregistration_trigger)
 {
        int ret;
        struct lttng_trigger *trigger_a = create_trigger(0xbadc0ffee);
        struct lttng_trigger *trigger_b = create_trigger(0xbadc0ffee);
        struct lttng_triggers *triggers = NULL;
-       const char * const trigger_name = "a unique trigger name";
+       const char *const trigger_name = "a unique trigger name";
        enum lttng_error_code ret_code;
 
        diag("Register duplicate named trigger (Unregistration performed with the trigger instance %s)",
-                       unregistration_trigger_instance_name(
-                                       unregistration_trigger));
+            unregistration_trigger_instance_name(unregistration_trigger));
 
        if (!trigger_a || !trigger_b) {
                fail("Failed to create triggers");
@@ -498,27 +491,28 @@ void double_register_named_trigger(
 
        ret = lttng_register_trigger(trigger_a);
        ok(ret == -LTTNG_ERR_INVALID,
-                       "Registering a trigger instance already used for registration fails with `LTTNG_ERR_INVALID` (anonymous registration)");
+          "Registering a trigger instance already used for registration fails with `LTTNG_ERR_INVALID` (anonymous registration)");
 
        ret_code = lttng_register_trigger_with_name(trigger_a, trigger_name);
        ok(ret_code == LTTNG_ERR_INVALID,
-                       "Registering a trigger instance already used for registration fails with `LTTNG_ERR_INVALID` (register with name)");
+          "Registering a trigger instance already used for registration fails with `LTTNG_ERR_INVALID` (register with name)");
 
        ret_code = lttng_register_trigger_with_automatic_name(trigger_a);
        ok(ret_code == LTTNG_ERR_INVALID,
-                       "Registering a trigger instance already used for registration fails with `LTTNG_ERR_INVALID` (register with automatic name)");
+          "Registering a trigger instance already used for registration fails with `LTTNG_ERR_INVALID` (register with automatic name)");
 
        ret_code = lttng_register_trigger_with_name(trigger_b, trigger_name);
-       ok(ret_code == LTTNG_ERR_TRIGGER_EXISTS, "Registering trigger with an already used name fails with `LTTNG_ERR_TRIGGER_EXISTS`");
+       ok(ret_code == LTTNG_ERR_TRIGGER_EXISTS,
+          "Registering trigger with an already used name fails with `LTTNG_ERR_TRIGGER_EXISTS`");
 
        if (unregistration_trigger == UNREGISTRATION_TRIGGER_INSTANCE_USED_FOR_REGISTRATION) {
                ret = lttng_unregister_trigger(trigger_a);
-               ok(ret == 0, "Successfully unregistered named trigger using the trigger instance used on registration");
+               ok(ret == 0,
+                  "Successfully unregistered named trigger using the trigger instance used on registration");
        } else {
-               ok(get_registered_triggers_count() == 1,
-                               "Trigger listing returns 1 trigger");
+               ok(get_registered_triggers_count() == 1, "Trigger listing returns 1 trigger");
                ok(unregister_all_triggers() == 1,
-                               "Successfully unregistered named trigger using the trigger instance returned by the listing");
+                  "Successfully unregistered named trigger using the trigger instance returned by the listing");
        }
 
 end:
@@ -527,9 +521,8 @@ end:
        lttng_trigger_destroy(trigger_b);
 }
 
-static
-void double_register_automatic_name_trigger(
-               enum unregistration_trigger_instance unregistration_trigger)
+static void
+double_register_automatic_name_trigger(enum unregistration_trigger_instance unregistration_trigger)
 {
        int ret;
        struct lttng_trigger *trigger_a = create_trigger(0xbadc0ffee);
@@ -538,8 +531,7 @@ void double_register_automatic_name_trigger(
        enum lttng_error_code ret_code;
 
        diag("Register duplicate automatic name trigger (Unregistration performed with the trigger instance %s)",
-                       unregistration_trigger_instance_name(
-                                       unregistration_trigger));
+            unregistration_trigger_instance_name(unregistration_trigger));
 
        if (!trigger_a || !trigger_b) {
                fail("Failed to create triggers");
@@ -547,25 +539,30 @@ void double_register_automatic_name_trigger(
        }
 
        ret_code = lttng_register_trigger_with_automatic_name(trigger_a);
-       ok(ret_code == LTTNG_OK, "Registered automatic name trigger: trigger name = '%s'", get_trigger_name(trigger_a));
+       ok(ret_code == LTTNG_OK,
+          "Registered automatic name trigger: trigger name = '%s'",
+          get_trigger_name(trigger_a));
 
        ret = lttng_register_trigger_with_automatic_name(trigger_b);
-       ok(ret_code == LTTNG_OK, "Registering an identical trigger instance with an automatic name succeeds: trigger name = '%s'", get_trigger_name(trigger_b));
+       ok(ret_code == LTTNG_OK,
+          "Registering an identical trigger instance with an automatic name succeeds: trigger name = '%s'",
+          get_trigger_name(trigger_b));
 
        ok(strcmp(get_trigger_name(trigger_a), get_trigger_name(trigger_b)),
-                       "Two identical triggers registered with an automatic name have different names");
+          "Two identical triggers registered with an automatic name have different names");
 
        if (unregistration_trigger == UNREGISTRATION_TRIGGER_INSTANCE_USED_FOR_REGISTRATION) {
                ret = lttng_unregister_trigger(trigger_a);
-               ok(ret == 0, "Successfully unregistered automatic trigger A using the trigger instance used on registration");
+               ok(ret == 0,
+                  "Successfully unregistered automatic trigger A using the trigger instance used on registration");
 
                ret = lttng_unregister_trigger(trigger_b);
-               ok(ret == 0, "Successfully unregistered automatic trigger B using the trigger instance used on registration");
+               ok(ret == 0,
+                  "Successfully unregistered automatic trigger B using the trigger instance used on registration");
        } else {
-               ok(get_registered_triggers_count() == 2,
-                               "Trigger listing returns 2 trigger");
+               ok(get_registered_triggers_count() == 2, "Trigger listing returns 2 trigger");
                ok(unregister_all_triggers() == 2,
-                               "Successfully unregistered automatic name triggers using the trigger instance returned by the listing");
+                  "Successfully unregistered automatic name triggers using the trigger instance returned by the listing");
        }
 
 end:
@@ -574,8 +571,7 @@ end:
        lttng_trigger_destroy(trigger_b);
 }
 
-static
-void register_multiple_anonymous_triggers(void)
+static void register_multiple_anonymous_triggers(void)
 {
        int ret;
        struct lttng_trigger *trigger_a = create_trigger(0xbadc0ffee);
@@ -594,10 +590,8 @@ void register_multiple_anonymous_triggers(void)
        ret = lttng_register_trigger(trigger_b);
        ok(ret == 0, "Registered second anonymous trigger");
 
-       ok(get_registered_triggers_count() == 2,
-                       "Trigger listing returns 2 trigger");
-       ok(unregister_all_triggers() == 2,
-                       "Successfully unregistered two anonymous triggers");
+       ok(get_registered_triggers_count() == 2, "Trigger listing returns 2 trigger");
+       ok(unregister_all_triggers() == 2, "Successfully unregistered two anonymous triggers");
 
 end:
        lttng_trigger_destroy(trigger_a);
@@ -605,12 +599,9 @@ end:
 }
 
 const test_function test_functions[] = {
-       register_anonymous_trigger,
-       register_named_trigger,
-       register_automatic_name_trigger,
-       double_register_anonymous_trigger,
-       double_register_named_trigger,
-       double_register_automatic_name_trigger,
+       register_anonymous_trigger,      register_named_trigger,
+       register_automatic_name_trigger, double_register_anonymous_trigger,
+       double_register_named_trigger,   double_register_automatic_name_trigger,
 };
 
 int main(void)
index 6a173b7c18293430e9a5bd5fabd885ce9fdc7727..1e21c79978c02917106a86d63cc4802e57e6cb56 100644 (file)
@@ -9,14 +9,15 @@
 
 #include <common/filter/filter-ast.hpp>
 #include <common/macros.hpp>
+
 #include <lttng/lttng.h>
 
 #include <stdlib.h>
 #include <string.h>
 
 static void register_trigger(const char *trigger_name,
-               struct lttng_condition *condition,
-               struct lttng_action *action)
+                            struct lttng_condition *condition,
+                            struct lttng_action *action)
 {
        struct lttng_trigger *trigger;
        enum lttng_error_code ret;
@@ -33,8 +34,8 @@ static void register_trigger(const char *trigger_name,
  * Register a trigger with the given condition and an action list containing a
  * single notify action.
  */
-static void register_trigger_action_list_notify(
-               const char *trigger_name, struct lttng_condition *condition)
+static void register_trigger_action_list_notify(const char *trigger_name,
+                                               struct lttng_condition *condition)
 {
        struct lttng_action *action_notify;
        struct lttng_action *action_list;
@@ -42,27 +43,25 @@ static void register_trigger_action_list_notify(
 
        action_list = lttng_action_list_create();
        action_notify = lttng_action_notify_create();
-       action_status = lttng_action_list_add_action(
-                       action_list, action_notify);
+       action_status = lttng_action_list_add_action(action_list, action_notify);
        LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
        lttng_action_destroy(action_notify);
 
        register_trigger(trigger_name, condition, action_list);
 }
 
-static struct lttng_condition *create_session_consumed_size_condition(
-               const char *session_name, uint64_t threshold)
+static struct lttng_condition *create_session_consumed_size_condition(const char *session_name,
+                                                                     uint64_t threshold)
 {
        struct lttng_condition *condition;
        enum lttng_condition_status condition_status;
 
        condition = lttng_condition_session_consumed_size_create();
        condition_status =
-                       lttng_condition_session_consumed_size_set_session_name(
-                                       condition, session_name);
+               lttng_condition_session_consumed_size_set_session_name(condition, session_name);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
-       condition_status = lttng_condition_session_consumed_size_set_threshold(
-                       condition, threshold);
+       condition_status =
+               lttng_condition_session_consumed_size_set_threshold(condition, threshold);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 
        return condition;
@@ -71,115 +70,107 @@ static struct lttng_condition *create_session_consumed_size_condition(
 static void test_session_consumed_size_condition(void)
 {
        register_trigger_action_list_notify(
-                       "trigger-with-session-consumed-size-condition",
-                       create_session_consumed_size_condition(
-                                       "the-session-name", 1234));
+               "trigger-with-session-consumed-size-condition",
+               create_session_consumed_size_condition("the-session-name", 1234));
 }
 
 static void fill_buffer_usage_condition(struct lttng_condition *condition,
-               const char *session_name,
-               const char *channel_name,
-               enum lttng_domain_type domain_type)
+                                       const char *session_name,
+                                       const char *channel_name,
+                                       enum lttng_domain_type domain_type)
 {
        enum lttng_condition_status condition_status;
 
-       condition_status = lttng_condition_buffer_usage_set_session_name(
-                       condition, session_name);
+       condition_status = lttng_condition_buffer_usage_set_session_name(condition, session_name);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
-       condition_status = lttng_condition_buffer_usage_set_channel_name(
-                       condition, channel_name);
+       condition_status = lttng_condition_buffer_usage_set_channel_name(condition, channel_name);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
-       condition_status = lttng_condition_buffer_usage_set_domain_type(
-                       condition, domain_type);
+       condition_status = lttng_condition_buffer_usage_set_domain_type(condition, domain_type);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 }
 
 static void fill_buffer_usage_bytes_condition(struct lttng_condition *condition,
-               const char *session_name,
-               const char *channel_name,
-               enum lttng_domain_type domain_type,
-               uint64_t threshold)
+                                             const char *session_name,
+                                             const char *channel_name,
+                                             enum lttng_domain_type domain_type,
+                                             uint64_t threshold)
 {
        enum lttng_condition_status condition_status;
 
-       fill_buffer_usage_condition(
-                       condition, session_name, channel_name, domain_type);
-       condition_status = lttng_condition_buffer_usage_set_threshold(
-                       condition, threshold);
+       fill_buffer_usage_condition(condition, session_name, channel_name, domain_type);
+       condition_status = lttng_condition_buffer_usage_set_threshold(condition, threshold);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 }
 
 static void fill_buffer_usage_ratio_condition(struct lttng_condition *condition,
-               const char *session_name,
-               const char *channel_name,
-               enum lttng_domain_type domain_type,
-               double ratio)
+                                             const char *session_name,
+                                             const char *channel_name,
+                                             enum lttng_domain_type domain_type,
+                                             double ratio)
 {
        enum lttng_condition_status condition_status;
 
-       fill_buffer_usage_condition(
-                       condition, session_name, channel_name, domain_type);
-       condition_status = lttng_condition_buffer_usage_set_threshold_ratio(
-                       condition, ratio);
+       fill_buffer_usage_condition(condition, session_name, channel_name, domain_type);
+       condition_status = lttng_condition_buffer_usage_set_threshold_ratio(condition, ratio);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 }
 
-static struct lttng_condition *create_buffer_usage_high_bytes_condition(
-               const char *session_name,
-               const char *channel_name,
-               enum lttng_domain_type domain_type,
-               uint64_t threshold)
+static struct lttng_condition *
+create_buffer_usage_high_bytes_condition(const char *session_name,
+                                        const char *channel_name,
+                                        enum lttng_domain_type domain_type,
+                                        uint64_t threshold)
 {
        struct lttng_condition *condition;
 
        condition = lttng_condition_buffer_usage_high_create();
-       fill_buffer_usage_bytes_condition(condition, session_name, channel_name,
-                       domain_type, threshold);
+       fill_buffer_usage_bytes_condition(
+               condition, session_name, channel_name, domain_type, threshold);
 
        return condition;
 }
 
-static struct lttng_condition *create_buffer_usage_low_bytes_condition(
-               const char *session_name,
-               const char *channel_name,
-               enum lttng_domain_type domain_type,
-               uint64_t threshold)
+static struct lttng_condition *
+create_buffer_usage_low_bytes_condition(const char *session_name,
+                                       const char *channel_name,
+                                       enum lttng_domain_type domain_type,
+                                       uint64_t threshold)
 {
        struct lttng_condition *condition;
 
        condition = lttng_condition_buffer_usage_low_create();
-       fill_buffer_usage_bytes_condition(condition, session_name, channel_name,
-                       domain_type, threshold);
+       fill_buffer_usage_bytes_condition(
+               condition, session_name, channel_name, domain_type, threshold);
 
        return condition;
 }
 
-static struct lttng_condition *create_buffer_usage_high_ratio_condition(
-               const char *session_name,
-               const char *channel_name,
-               enum lttng_domain_type domain_type,
-               double ratio)
+static struct lttng_condition *
+create_buffer_usage_high_ratio_condition(const char *session_name,
+                                        const char *channel_name,
+                                        enum lttng_domain_type domain_type,
+                                        double ratio)
 {
        struct lttng_condition *condition;
 
        condition = lttng_condition_buffer_usage_high_create();
-       fill_buffer_usage_ratio_condition(condition, session_name, channel_name,
-                       domain_type, ratio);
+       fill_buffer_usage_ratio_condition(
+               condition, session_name, channel_name, domain_type, ratio);
 
        return condition;
 }
 
-static struct lttng_condition *create_buffer_usage_low_ratio_condition(
-               const char *session_name,
-               const char *channel_name,
-               enum lttng_domain_type domain_type,
-               double ratio)
+static struct lttng_condition *
+create_buffer_usage_low_ratio_condition(const char *session_name,
+                                       const char *channel_name,
+                                       enum lttng_domain_type domain_type,
+                                       double ratio)
 {
        struct lttng_condition *condition;
 
        condition = lttng_condition_buffer_usage_low_create();
-       fill_buffer_usage_ratio_condition(condition, session_name, channel_name,
-                       domain_type, ratio);
+       fill_buffer_usage_ratio_condition(
+               condition, session_name, channel_name, domain_type, ratio);
 
        return condition;
 }
@@ -187,42 +178,37 @@ static struct lttng_condition *create_buffer_usage_low_ratio_condition(
 static void test_buffer_usage_conditions(void)
 {
        register_trigger_action_list_notify(
-                       "trigger-with-buffer-usage-high-bytes-condition",
-                       create_buffer_usage_high_bytes_condition(
-                                       "the-session-name", "the-channel-name",
-                                       LTTNG_DOMAIN_UST, 1234));
+               "trigger-with-buffer-usage-high-bytes-condition",
+               create_buffer_usage_high_bytes_condition(
+                       "the-session-name", "the-channel-name", LTTNG_DOMAIN_UST, 1234));
 
        register_trigger_action_list_notify(
-                       "trigger-with-buffer-usage-low-bytes-condition",
-                       create_buffer_usage_low_bytes_condition(
-                                       "the-session-name", "the-channel-name",
-                                       LTTNG_DOMAIN_UST, 2345));
+               "trigger-with-buffer-usage-low-bytes-condition",
+               create_buffer_usage_low_bytes_condition(
+                       "the-session-name", "the-channel-name", LTTNG_DOMAIN_UST, 2345));
 
        register_trigger_action_list_notify(
-                       "trigger-with-buffer-usage-high-ratio-condition",
-                       create_buffer_usage_high_ratio_condition(
-                                       "the-session-name", "the-channel-name",
-                                       LTTNG_DOMAIN_UST, 0.25));
+               "trigger-with-buffer-usage-high-ratio-condition",
+               create_buffer_usage_high_ratio_condition(
+                       "the-session-name", "the-channel-name", LTTNG_DOMAIN_UST, 0.25));
 
        register_trigger_action_list_notify(
-                       "trigger-with-buffer-usage-low-ratio-condition",
-                       create_buffer_usage_low_ratio_condition(
-                                       "the-session-name", "the-channel-name",
-                                       LTTNG_DOMAIN_UST, 0.4));
+               "trigger-with-buffer-usage-low-ratio-condition",
+               create_buffer_usage_low_ratio_condition(
+                       "the-session-name", "the-channel-name", LTTNG_DOMAIN_UST, 0.4));
 }
 
-static void fill_session_rotation_condition(
-               struct lttng_condition *condition, const char *session_name)
+static void fill_session_rotation_condition(struct lttng_condition *condition,
+                                           const char *session_name)
 {
        enum lttng_condition_status condition_status;
 
-       condition_status = lttng_condition_session_rotation_set_session_name(
-                       condition, session_name);
+       condition_status =
+               lttng_condition_session_rotation_set_session_name(condition, session_name);
        LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
 }
 
-static struct lttng_condition *create_session_rotation_ongoing_condition(
-               const char *session_name)
+static struct lttng_condition *create_session_rotation_ongoing_condition(const char *session_name)
 {
        struct lttng_condition *condition;
 
@@ -233,8 +219,7 @@ static struct lttng_condition *create_session_rotation_ongoing_condition(
        return condition;
 }
 
-static struct lttng_condition *create_session_rotation_completed_condition(
-               const char *session_name)
+static struct lttng_condition *create_session_rotation_completed_condition(const char *session_name)
 {
        struct lttng_condition *condition;
 
@@ -248,27 +233,24 @@ static struct lttng_condition *create_session_rotation_completed_condition(
 static void test_session_rotation_conditions(void)
 {
        register_trigger_action_list_notify(
-                       "trigger-with-session-rotation-ongoing-condition",
-                       create_session_rotation_ongoing_condition(
-                                       "the-session-name"));
+               "trigger-with-session-rotation-ongoing-condition",
+               create_session_rotation_ongoing_condition("the-session-name"));
 
        register_trigger_action_list_notify(
-                       "trigger-with-session-rotation-completed-condition",
-                       create_session_rotation_completed_condition(
-                                       "the-session-name"));
+               "trigger-with-session-rotation-completed-condition",
+               create_session_rotation_completed_condition("the-session-name"));
 }
 
 static struct {
        const char *name;
        void (*callback)(void);
 } tests[] = {
-               {
-                               "test_session_consumed_size_condition",
-                               test_session_consumed_size_condition,
-               },
-               {"test_buffer_usage_conditions", test_buffer_usage_conditions},
-               {"test_session_rotation_conditions",
-                               test_session_rotation_conditions},
+       {
+               "test_session_consumed_size_condition",
+               test_session_consumed_size_condition,
+       },
+       { "test_buffer_usage_conditions", test_buffer_usage_conditions },
+       { "test_session_rotation_conditions", test_session_rotation_conditions },
 };
 
 static void show_known_tests(void)
index bc9aedf1063e73a032c85900fcd55642ea9f82d4..976a32db6056cfae23a0b52fb432363e74a54846 100644 (file)
@@ -5,13 +5,15 @@
  *
  */
 
-#include <tap/tap.h>
 #include <common/ini-config/ini-config.hpp>
-#include <common/utils.hpp>
 #include <common/path.hpp>
-#include <string.h>
+#include <common/utils.hpp>
+
 #include <lttng/constant.h>
 
+#include <string.h>
+#include <tap/tap.h>
+
 namespace {
 struct state {
        int section_1;
@@ -38,8 +40,7 @@ static int entry_handler(const struct config_entry *entry, struct state *state)
 
        if (!strcmp(entry->section, "section1")) {
                state->section_1 = 1;
-               if (!strcmp(entry->name, "section1_entry") &&
-                       !strcmp(entry->value, "42")) {
+               if (!strcmp(entry->name, "section1_entry") && !strcmp(entry->value, "42")) {
                        state->int_entry = 1;
                }
        }
@@ -51,7 +52,7 @@ static int entry_handler(const struct config_entry *entry, struct state *state)
        if (!strcmp(entry->section, "section 3")) {
                state->section_3 = 1;
                if (!strcmp(entry->name, "name with a space") &&
-                       !strcmp(entry->value, "another value")) {
+                   !strcmp(entry->value, "another value")) {
                        state->text_entry = 1;
                }
        }
@@ -76,7 +77,7 @@ int main(int argc, char **argv)
 
        if (strlen(argv[1]) >= LTTNG_PATH_MAX) {
                diag("The provided path exceeds the maximal permitted length of %i bytes",
-                               LTTNG_PATH_MAX);
+                    LTTNG_PATH_MAX);
                goto end;
        }
        path = utils_expand_path(argv[1]);
@@ -85,27 +86,26 @@ int main(int argc, char **argv)
        }
 
        plan_no_plan();
-       ret = config_get_section_entries(path, NULL,
-               (config_entry_handler_cb)entry_handler, &state);
+       ret = config_get_section_entries(
+               path, NULL, (config_entry_handler_cb) entry_handler, &state);
        ok(ret == 0, "Successfully opened a config file, registered to all sections");
-       ok(state.section_1 && state.section_2 && state.section_3 &&
-               state.section_global, "Processed entries from each sections");
+       ok(state.section_1 && state.section_2 && state.section_3 && state.section_global,
+          "Processed entries from each sections");
        ok(state.text_entry, "Text value parsed correctly");
 
        memset(&state, 0, sizeof(struct state));
-       ret = config_get_section_entries(path, "section1",
-               (config_entry_handler_cb)entry_handler, &state);
+       ret = config_get_section_entries(
+               path, "section1", (config_entry_handler_cb) entry_handler, &state);
        ok(ret == 0, "Successfully opened a config file, registered to one section");
-       ok(state.section_1 && !state.section_2 && !state.section_3 &&
-               !state.section_global, "Processed an entry from section1 only");
+       ok(state.section_1 && !state.section_2 && !state.section_3 && !state.section_global,
+          "Processed an entry from section1 only");
        ok(state.int_entry, "Int value parsed correctly");
 
        memset(&state, 0, sizeof(struct state));
-       ret = config_get_section_entries(path, "",
-               (config_entry_handler_cb)entry_handler, &state);
+       ret = config_get_section_entries(path, "", (config_entry_handler_cb) entry_handler, &state);
        ok(ret == 0, "Successfully opened a config file, registered to the global section");
-       ok(!state.section_1 && !state.section_2 && !state.section_3 &&
-               state.section_global, "Processed an entry from the global section only");
+       ok(!state.section_1 && !state.section_2 && !state.section_3 && state.section_global,
+          "Processed an entry from the global section only");
 end:
        free(path);
        return exit_status();
index de2197ed0d964d690c846a2b95c1cff256af832f..5256a4fca2b54c4f365c15a9ed1ebde360cc4344 100644 (file)
@@ -9,15 +9,9 @@
  *
  */
 
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <tap/tap.h>
-
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
+
 #include <lttng/action/action-internal.hpp>
 #include <lttng/action/action.h>
 #include <lttng/action/notify.h>
 #include <lttng/action/start-session.h>
 #include <lttng/action/stop-session.h>
 
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <tap/tap.h>
+#include <unistd.h>
+
 /* For error.h */
 int lttng_opt_quiet = 1;
 int lttng_opt_verbose;
@@ -39,8 +39,7 @@ static void test_action_notify(void)
 {
        int ret;
        enum lttng_action_status status;
-       struct lttng_action *notify_action = NULL,
-                           *notify_action_from_buffer = NULL;
+       struct lttng_action *notify_action = NULL, *notify_action_from_buffer = NULL;
        struct lttng_rate_policy *policy = NULL, *default_policy;
        struct lttng_payload payload;
 
@@ -56,18 +55,15 @@ static void test_action_notify(void)
        notify_action = lttng_action_notify_create();
        ok(notify_action, "Create notify action");
        ok(lttng_action_get_type(notify_action) == LTTNG_ACTION_TYPE_NOTIFY,
-                       "Action has type LTTNG_ACTION_TYPE_NOTIFY");
+          "Action has type LTTNG_ACTION_TYPE_NOTIFY");
 
        /* Validate the default policy for a notify action. */
        {
                const struct lttng_rate_policy *cur_policy = NULL;
-               status = lttng_action_notify_get_rate_policy(
-                               notify_action, &cur_policy);
+               status = lttng_action_notify_get_rate_policy(notify_action, &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
-                                               lttng_rate_policy_is_equal(
-                                                               default_policy,
-                                                               cur_policy),
-                               "Default policy is every n=1");
+                          lttng_rate_policy_is_equal(default_policy, cur_policy),
+                  "Default policy is every n=1");
        }
 
        /* Set a custom policy. */
@@ -77,30 +73,23 @@ static void test_action_notify(void)
        /* Validate the custom policy for a notify action. */
        {
                const struct lttng_rate_policy *cur_policy = NULL;
-               status = lttng_action_notify_get_rate_policy(
-                               notify_action, &cur_policy);
+               status = lttng_action_notify_get_rate_policy(notify_action, &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
-                                               lttng_rate_policy_is_equal(
-                                                               policy,
-                                                               cur_policy),
-                               "Notify action policy get");
+                          lttng_rate_policy_is_equal(policy, cur_policy),
+                  "Notify action policy get");
        }
 
        ret = lttng_action_serialize(notify_action, &payload);
        ok(ret == 0, "Action notify serialized");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
-               (void) lttng_action_create_from_payload(
-                               &view, &notify_action_from_buffer);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
+               (void) lttng_action_create_from_payload(&view, &notify_action_from_buffer);
        }
-       ok(notify_action_from_buffer,
-                       "Notify action created from payload is non-null");
+       ok(notify_action_from_buffer, "Notify action created from payload is non-null");
 
        ok(lttng_action_is_equal(notify_action, notify_action_from_buffer),
-                       "Serialized and de-serialized notify action are equal");
+          "Serialized and de-serialized notify action are equal");
 
        lttng_rate_policy_destroy(default_policy);
        lttng_rate_policy_destroy(policy);
@@ -131,62 +120,50 @@ static void test_action_rotate_session(void)
 
        rotate_session_action = lttng_action_rotate_session_create();
        ok(rotate_session_action, "Create rotate_session action");
-       ok(lttng_action_get_type(rotate_session_action) ==
-                                       LTTNG_ACTION_TYPE_ROTATE_SESSION,
-                       "Action has type LTTNG_ACTION_TYPE_ROTATE_SESSION");
+       ok(lttng_action_get_type(rotate_session_action) == LTTNG_ACTION_TYPE_ROTATE_SESSION,
+          "Action has type LTTNG_ACTION_TYPE_ROTATE_SESSION");
 
        /* Session name setter. */
        status = lttng_action_rotate_session_set_session_name(NULL, NULL);
-       ok(status == LTTNG_ACTION_STATUS_INVALID,
-                       "Set session name (NULL,NULL) expect invalid");
-       status = lttng_action_rotate_session_set_session_name(
-                       rotate_session_action, NULL);
-       ok(status == LTTNG_ACTION_STATUS_INVALID,
-                       "Set session name (object,NULL) expect invalid");
-       status = lttng_action_rotate_session_set_session_name(
-                       NULL, session_name);
-       ok(status == LTTNG_ACTION_STATUS_INVALID,
-                       "Set session name (NULL,object) expect invalid");
+       ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,NULL) expect invalid");
+       status = lttng_action_rotate_session_set_session_name(rotate_session_action, NULL);
+       ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (object,NULL) expect invalid");
+       status = lttng_action_rotate_session_set_session_name(NULL, session_name);
+       ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,object) expect invalid");
 
        /* Set the session name */
-       status = lttng_action_rotate_session_set_session_name(
-                       rotate_session_action, session_name);
+       status = lttng_action_rotate_session_set_session_name(rotate_session_action, session_name);
        ok(status == LTTNG_ACTION_STATUS_OK, "Set session name");
 
-       status = lttng_action_rotate_session_get_session_name(
-                       rotate_session_action, &get_session_name);
-       ok(status == LTTNG_ACTION_STATUS_OK &&
-                                       !strcmp(session_name, get_session_name),
-                       "Get session name, expected `%s` got `%s`",
-                       session_name, get_session_name);
+       status = lttng_action_rotate_session_get_session_name(rotate_session_action,
+                                                             &get_session_name);
+       ok(status == LTTNG_ACTION_STATUS_OK && !strcmp(session_name, get_session_name),
+          "Get session name, expected `%s` got `%s`",
+          session_name,
+          get_session_name);
 
        /* Validate the default policy for a rotate_session action. */
        {
                const struct lttng_rate_policy *cur_policy = NULL;
-               status = lttng_action_rotate_session_get_rate_policy(
-                               rotate_session_action, &cur_policy);
+               status = lttng_action_rotate_session_get_rate_policy(rotate_session_action,
+                                                                    &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
-                                               lttng_rate_policy_is_equal(
-                                                               default_policy,
-                                                               cur_policy),
-                               "Default policy is every n=1");
+                          lttng_rate_policy_is_equal(default_policy, cur_policy),
+                  "Default policy is every n=1");
        }
 
        /* Set a custom policy. */
-       status = lttng_action_rotate_session_set_rate_policy(
-                       rotate_session_action, policy);
+       status = lttng_action_rotate_session_set_rate_policy(rotate_session_action, policy);
        ok(status == LTTNG_ACTION_STATUS_OK, "Set rate policy");
 
        /* Validate the custom policy for a rotate_session action. */
        {
                const struct lttng_rate_policy *cur_policy = NULL;
-               status = lttng_action_rotate_session_get_rate_policy(
-                               rotate_session_action, &cur_policy);
+               status = lttng_action_rotate_session_get_rate_policy(rotate_session_action,
+                                                                    &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
-                                               lttng_rate_policy_is_equal(
-                                                               policy,
-                                                               cur_policy),
-                               "rotate_session action policy get");
+                          lttng_rate_policy_is_equal(policy, cur_policy),
+                  "rotate_session action policy get");
        }
 
        /* Ser/des tests. */
@@ -194,18 +171,14 @@ static void test_action_rotate_session(void)
        ok(ret == 0, "Action rotate_session serialized");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
-               (void) lttng_action_create_from_payload(
-                               &view, &rotate_session_action_from_buffer);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
+               (void) lttng_action_create_from_payload(&view, &rotate_session_action_from_buffer);
        }
        ok(rotate_session_action_from_buffer,
-                       "rotate_session action created from payload is non-null");
+          "rotate_session action created from payload is non-null");
 
-       ok(lttng_action_is_equal(rotate_session_action,
-                          rotate_session_action_from_buffer),
-                       "Serialized and de-serialized rotate_session action are equal");
+       ok(lttng_action_is_equal(rotate_session_action, rotate_session_action_from_buffer),
+          "Serialized and de-serialized rotate_session action are equal");
 
        lttng_rate_policy_destroy(default_policy);
        lttng_rate_policy_destroy(policy);
@@ -218,8 +191,7 @@ static void test_action_start_session(void)
 {
        int ret;
        enum lttng_action_status status;
-       struct lttng_action *start_session_action = NULL,
-                           *start_session_action_from_buffer = NULL;
+       struct lttng_action *start_session_action = NULL, *start_session_action_from_buffer = NULL;
        struct lttng_rate_policy *policy = NULL, *default_policy;
        struct lttng_payload payload;
        const char *session_name = "my_session_name";
@@ -236,62 +208,50 @@ static void test_action_start_session(void)
 
        start_session_action = lttng_action_start_session_create();
        ok(start_session_action, "Create start_session action");
-       ok(lttng_action_get_type(start_session_action) ==
-                                       LTTNG_ACTION_TYPE_START_SESSION,
-                       "Action has type LTTNG_ACTION_TYPE_START_SESSION");
+       ok(lttng_action_get_type(start_session_action) == LTTNG_ACTION_TYPE_START_SESSION,
+          "Action has type LTTNG_ACTION_TYPE_START_SESSION");
 
        /* Session name setter. */
        status = lttng_action_start_session_set_session_name(NULL, NULL);
-       ok(status == LTTNG_ACTION_STATUS_INVALID,
-                       "Set session name (NULL,NULL) expect invalid");
-       status = lttng_action_start_session_set_session_name(
-                       start_session_action, NULL);
-       ok(status == LTTNG_ACTION_STATUS_INVALID,
-                       "Set session name (object,NULL) expect invalid");
-       status = lttng_action_start_session_set_session_name(
-                       NULL, session_name);
-       ok(status == LTTNG_ACTION_STATUS_INVALID,
-                       "Set session name (NULL,object) expect invalid");
+       ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,NULL) expect invalid");
+       status = lttng_action_start_session_set_session_name(start_session_action, NULL);
+       ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (object,NULL) expect invalid");
+       status = lttng_action_start_session_set_session_name(NULL, session_name);
+       ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,object) expect invalid");
 
        /* Set the session name */
-       status = lttng_action_start_session_set_session_name(
-                       start_session_action, session_name);
+       status = lttng_action_start_session_set_session_name(start_session_action, session_name);
        ok(status == LTTNG_ACTION_STATUS_OK, "Set session name");
 
-       status = lttng_action_start_session_get_session_name(
-                       start_session_action, &get_session_name);
-       ok(status == LTTNG_ACTION_STATUS_OK &&
-                                       !strcmp(session_name, get_session_name),
-                       "Get session name, expected `%s` got `%s`",
-                       session_name, get_session_name);
+       status = lttng_action_start_session_get_session_name(start_session_action,
+                                                            &get_session_name);
+       ok(status == LTTNG_ACTION_STATUS_OK && !strcmp(session_name, get_session_name),
+          "Get session name, expected `%s` got `%s`",
+          session_name,
+          get_session_name);
 
        /* Validate the default policy for a start_session action. */
        {
                const struct lttng_rate_policy *cur_policy = NULL;
-               status = lttng_action_start_session_get_rate_policy(
-                               start_session_action, &cur_policy);
+               status = lttng_action_start_session_get_rate_policy(start_session_action,
+                                                                   &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
-                                               lttng_rate_policy_is_equal(
-                                                               default_policy,
-                                                               cur_policy),
-                               "Default policy is every n=1");
+                          lttng_rate_policy_is_equal(default_policy, cur_policy),
+                  "Default policy is every n=1");
        }
 
        /* Set a custom policy. */
-       status = lttng_action_start_session_set_rate_policy(
-                       start_session_action, policy);
+       status = lttng_action_start_session_set_rate_policy(start_session_action, policy);
        ok(status == LTTNG_ACTION_STATUS_OK, "Set rate policy");
 
        /* Validate the custom policy for a start_session action. */
        {
                const struct lttng_rate_policy *cur_policy = NULL;
-               status = lttng_action_start_session_get_rate_policy(
-                               start_session_action, &cur_policy);
+               status = lttng_action_start_session_get_rate_policy(start_session_action,
+                                                                   &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
-                                               lttng_rate_policy_is_equal(
-                                                               policy,
-                                                               cur_policy),
-                               "start_session action policy get");
+                          lttng_rate_policy_is_equal(policy, cur_policy),
+                  "start_session action policy get");
        }
 
        /* Ser/des tests. */
@@ -299,18 +259,14 @@ static void test_action_start_session(void)
        ok(ret == 0, "Action start_session serialized");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
-               (void) lttng_action_create_from_payload(
-                               &view, &start_session_action_from_buffer);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
+               (void) lttng_action_create_from_payload(&view, &start_session_action_from_buffer);
        }
        ok(start_session_action_from_buffer,
-                       "start_session action created from payload is non-null");
+          "start_session action created from payload is non-null");
 
-       ok(lttng_action_is_equal(start_session_action,
-                          start_session_action_from_buffer),
-                       "Serialized and de-serialized start_session action are equal");
+       ok(lttng_action_is_equal(start_session_action, start_session_action_from_buffer),
+          "Serialized and de-serialized start_session action are equal");
 
        lttng_rate_policy_destroy(default_policy);
        lttng_rate_policy_destroy(policy);
@@ -323,8 +279,7 @@ static void test_action_stop_session(void)
 {
        int ret;
        enum lttng_action_status status;
-       struct lttng_action *stop_session_action = NULL,
-                           *stop_session_action_from_buffer = NULL;
+       struct lttng_action *stop_session_action = NULL, *stop_session_action_from_buffer = NULL;
        struct lttng_rate_policy *policy = NULL, *default_policy;
        struct lttng_payload payload;
        const char *session_name = "my_session_name";
@@ -341,61 +296,49 @@ static void test_action_stop_session(void)
 
        stop_session_action = lttng_action_stop_session_create();
        ok(stop_session_action, "Create stop_session action");
-       ok(lttng_action_get_type(stop_session_action) ==
-                                       LTTNG_ACTION_TYPE_STOP_SESSION,
-                       "Action has type LTTNG_ACTION_TYPE_STOP_SESSION");
+       ok(lttng_action_get_type(stop_session_action) == LTTNG_ACTION_TYPE_STOP_SESSION,
+          "Action has type LTTNG_ACTION_TYPE_STOP_SESSION");
 
        /* Session name setter. */
        status = lttng_action_stop_session_set_session_name(NULL, NULL);
-       ok(status == LTTNG_ACTION_STATUS_INVALID,
-                       "Set session name (NULL,NULL) expect invalid");
-       status = lttng_action_stop_session_set_session_name(
-                       stop_session_action, NULL);
-       ok(status == LTTNG_ACTION_STATUS_INVALID,
-                       "Set session name (object,NULL) expect invalid");
+       ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,NULL) expect invalid");
+       status = lttng_action_stop_session_set_session_name(stop_session_action, NULL);
+       ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (object,NULL) expect invalid");
        status = lttng_action_stop_session_set_session_name(NULL, session_name);
-       ok(status == LTTNG_ACTION_STATUS_INVALID,
-                       "Set session name (NULL,object) expect invalid");
+       ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,object) expect invalid");
 
        /* Set the session name */
-       status = lttng_action_stop_session_set_session_name(
-                       stop_session_action, session_name);
+       status = lttng_action_stop_session_set_session_name(stop_session_action, session_name);
        ok(status == LTTNG_ACTION_STATUS_OK, "Set session name");
 
-       status = lttng_action_stop_session_get_session_name(
-                       stop_session_action, &get_session_name);
-       ok(status == LTTNG_ACTION_STATUS_OK &&
-                                       !strcmp(session_name, get_session_name),
-                       "Get session name, expected `%s` got `%s`",
-                       session_name, get_session_name);
+       status = lttng_action_stop_session_get_session_name(stop_session_action, &get_session_name);
+       ok(status == LTTNG_ACTION_STATUS_OK && !strcmp(session_name, get_session_name),
+          "Get session name, expected `%s` got `%s`",
+          session_name,
+          get_session_name);
 
        /* Validate the default policy for a stop_session action. */
        {
                const struct lttng_rate_policy *cur_policy = NULL;
-               status = lttng_action_stop_session_get_rate_policy(
-                               stop_session_action, &cur_policy);
+               status =
+                       lttng_action_stop_session_get_rate_policy(stop_session_action, &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
-                                               lttng_rate_policy_is_equal(
-                                                               default_policy,
-                                                               cur_policy),
-                               "Default policy is every n=1");
+                          lttng_rate_policy_is_equal(default_policy, cur_policy),
+                  "Default policy is every n=1");
        }
 
        /* Set a custom policy. */
-       status = lttng_action_stop_session_set_rate_policy(
-                       stop_session_action, policy);
+       status = lttng_action_stop_session_set_rate_policy(stop_session_action, policy);
        ok(status == LTTNG_ACTION_STATUS_OK, "Set rate policy");
 
        /* Validate the custom policy for a stop_session action. */
        {
                const struct lttng_rate_policy *cur_policy = NULL;
-               status = lttng_action_stop_session_get_rate_policy(
-                               stop_session_action, &cur_policy);
+               status =
+                       lttng_action_stop_session_get_rate_policy(stop_session_action, &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
-                                               lttng_rate_policy_is_equal(
-                                                               policy,
-                                                               cur_policy),
-                               "stop_session action policy get");
+                          lttng_rate_policy_is_equal(policy, cur_policy),
+                  "stop_session action policy get");
        }
 
        /* Ser/des tests. */
@@ -403,18 +346,13 @@ static void test_action_stop_session(void)
        ok(ret == 0, "Action stop_session serialized");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
-               (void) lttng_action_create_from_payload(
-                               &view, &stop_session_action_from_buffer);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
+               (void) lttng_action_create_from_payload(&view, &stop_session_action_from_buffer);
        }
-       ok(stop_session_action_from_buffer,
-                       "stop_session action created from payload is non-null");
+       ok(stop_session_action_from_buffer, "stop_session action created from payload is non-null");
 
-       ok(lttng_action_is_equal(stop_session_action,
-                          stop_session_action_from_buffer),
-                       "Serialized and de-serialized stop_session action are equal");
+       ok(lttng_action_is_equal(stop_session_action, stop_session_action_from_buffer),
+          "Serialized and de-serialized stop_session action are equal");
 
        lttng_rate_policy_destroy(default_policy);
        lttng_rate_policy_destroy(policy);
@@ -445,62 +383,51 @@ static void test_action_snapshot_session(void)
 
        snapshot_session_action = lttng_action_snapshot_session_create();
        ok(snapshot_session_action, "Create snapshot_session action");
-       ok(lttng_action_get_type(snapshot_session_action) ==
-                                       LTTNG_ACTION_TYPE_SNAPSHOT_SESSION,
-                       "Action has type LTTNG_ACTION_TYPE_SNAPSHOT_SESSION");
+       ok(lttng_action_get_type(snapshot_session_action) == LTTNG_ACTION_TYPE_SNAPSHOT_SESSION,
+          "Action has type LTTNG_ACTION_TYPE_SNAPSHOT_SESSION");
 
        /* Session name setter. */
        status = lttng_action_snapshot_session_set_session_name(NULL, NULL);
-       ok(status == LTTNG_ACTION_STATUS_INVALID,
-                       "Set session name (NULL,NULL) expect invalid");
-       status = lttng_action_snapshot_session_set_session_name(
-                       snapshot_session_action, NULL);
-       ok(status == LTTNG_ACTION_STATUS_INVALID,
-                       "Set session name (object,NULL) expect invalid");
-       status = lttng_action_snapshot_session_set_session_name(
-                       NULL, session_name);
-       ok(status == LTTNG_ACTION_STATUS_INVALID,
-                       "Set session name (NULL,object) expect invalid");
+       ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,NULL) expect invalid");
+       status = lttng_action_snapshot_session_set_session_name(snapshot_session_action, NULL);
+       ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (object,NULL) expect invalid");
+       status = lttng_action_snapshot_session_set_session_name(NULL, session_name);
+       ok(status == LTTNG_ACTION_STATUS_INVALID, "Set session name (NULL,object) expect invalid");
 
        /* Set the session name */
-       status = lttng_action_snapshot_session_set_session_name(
-                       snapshot_session_action, session_name);
+       status = lttng_action_snapshot_session_set_session_name(snapshot_session_action,
+                                                               session_name);
        ok(status == LTTNG_ACTION_STATUS_OK, "Set session name");
 
-       status = lttng_action_snapshot_session_get_session_name(
-                       snapshot_session_action, &get_session_name);
-       ok(status == LTTNG_ACTION_STATUS_OK &&
-                                       !strcmp(session_name, get_session_name),
-                       "Get session name, expected `%s` got `%s`",
-                       session_name, get_session_name);
+       status = lttng_action_snapshot_session_get_session_name(snapshot_session_action,
+                                                               &get_session_name);
+       ok(status == LTTNG_ACTION_STATUS_OK && !strcmp(session_name, get_session_name),
+          "Get session name, expected `%s` got `%s`",
+          session_name,
+          get_session_name);
 
        /* Validate the default policy for a snapshot_session action. */
        {
                const struct lttng_rate_policy *cur_policy = NULL;
-               status = lttng_action_snapshot_session_get_rate_policy(
-                               snapshot_session_action, &cur_policy);
+               status = lttng_action_snapshot_session_get_rate_policy(snapshot_session_action,
+                                                                      &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
-                                               lttng_rate_policy_is_equal(
-                                                               default_policy,
-                                                               cur_policy),
-                               "Default policy is every n=1");
+                          lttng_rate_policy_is_equal(default_policy, cur_policy),
+                  "Default policy is every n=1");
        }
 
        /* Set a custom policy. */
-       status = lttng_action_snapshot_session_set_rate_policy(
-                       snapshot_session_action, policy);
+       status = lttng_action_snapshot_session_set_rate_policy(snapshot_session_action, policy);
        ok(status == LTTNG_ACTION_STATUS_OK, "Set rate policy");
 
        /* Validate the custom policy for a snapshot_session action. */
        {
                const struct lttng_rate_policy *cur_policy = NULL;
-               status = lttng_action_snapshot_session_get_rate_policy(
-                               snapshot_session_action, &cur_policy);
+               status = lttng_action_snapshot_session_get_rate_policy(snapshot_session_action,
+                                                                      &cur_policy);
                ok(status == LTTNG_ACTION_STATUS_OK &&
-                                               lttng_rate_policy_is_equal(
-                                                               policy,
-                                                               cur_policy),
-                               "snapshot_session action policy get");
+                          lttng_rate_policy_is_equal(policy, cur_policy),
+                  "snapshot_session action policy get");
        }
 
        /* Ser/des tests. */
@@ -508,18 +435,15 @@ static void test_action_snapshot_session(void)
        ok(ret == 0, "Action snapshot_session serialized");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
-               (void) lttng_action_create_from_payload(
-                               &view, &snapshot_session_action_from_buffer);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
+               (void) lttng_action_create_from_payload(&view,
+                                                       &snapshot_session_action_from_buffer);
        }
        ok(snapshot_session_action_from_buffer,
-                       "snapshot_session action created from payload is non-null");
+          "snapshot_session action created from payload is non-null");
 
-       ok(lttng_action_is_equal(snapshot_session_action,
-                          snapshot_session_action_from_buffer),
-                       "Serialized and de-serialized snapshot_session action are equal");
+       ok(lttng_action_is_equal(snapshot_session_action, snapshot_session_action_from_buffer),
+          "Serialized and de-serialized snapshot_session action are equal");
 
        lttng_rate_policy_destroy(default_policy);
        lttng_rate_policy_destroy(policy);
index 764549b83da41c7e289090286d4d22326c819dd1..d62f15e4d5192e100852843019e8a0bd051db3fa 100644 (file)
@@ -5,8 +5,8 @@
  *
  */
 
-
 #include <common/buffer-view.hpp>
+
 #include <tap/tap.h>
 
 static const int TEST_COUNT = 5;
@@ -18,10 +18,9 @@ int lttng_opt_mi;
 
 static void test_contains_string(void)
 {
-       const char buf[] = {'A', 'l', 'l', 'o', '\0'};
+       const char buf[] = { 'A', 'l', 'l', 'o', '\0' };
        struct lttng_buffer_view view = lttng_buffer_view_init(buf, 0, 5);
-       struct lttng_buffer_view view_minus_one =
-                       lttng_buffer_view_init(buf, 0, 4);
+       struct lttng_buffer_view view_minus_one = lttng_buffer_view_init(buf, 0, 4);
 
        ok1(!lttng_buffer_view_contains_string(&view, buf, 4));
        ok1(lttng_buffer_view_contains_string(&view, buf, 5));
index 9ed6b89418e9225ce2481fe390a2186c76f21938..ce54abc9a448b7caf1c06d4e84c928b48e68c8fc 100644 (file)
@@ -9,22 +9,22 @@
  *
  */
 
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <tap/tap.h>
+#include <common/buffer-view.hpp>
+#include <common/dynamic-buffer.hpp>
 
-#include <lttng/event.h>
-#include <lttng/event-rule/user-tracepoint.h>
 #include <lttng/condition/condition-internal.hpp>
-#include <lttng/condition/event-rule-matches.h>
 #include <lttng/condition/event-rule-matches-internal.hpp>
+#include <lttng/condition/event-rule-matches.h>
 #include <lttng/domain.h>
+#include <lttng/event-rule/user-tracepoint.h>
+#include <lttng/event.h>
 #include <lttng/log-level-rule.h>
-#include <common/dynamic-buffer.hpp>
-#include <common/buffer-view.hpp>
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <tap/tap.h>
+#include <unistd.h>
 
 /* For error.h */
 int lttng_opt_quiet = 1;
@@ -33,8 +33,7 @@ int lttng_opt_mi;
 
 #define NUM_TESTS 13
 
-static
-void test_condition_event_rule(void)
+static void test_condition_event_rule(void)
 {
        int ret, i;
        struct lttng_event_rule *tracepoint = NULL;
@@ -43,8 +42,8 @@ void test_condition_event_rule(void)
        struct lttng_condition *condition = NULL;
        struct lttng_condition *condition_from_buffer = NULL;
        enum lttng_condition_status condition_status;
-       const char *pattern="my_event_*";
-       const char *filter="msg_id == 23 && size >= 2048";
+       const char *pattern = "my_event_*";
+       const char *filter = "msg_id == 23 && size >= 2048";
        const char *exclusions[] = { "my_event_test1", "my_event_test2", "my_event_test3" };
        struct lttng_log_level_rule *log_level_rule_at_least_as_severe = NULL;
        struct lttng_payload buffer;
@@ -53,8 +52,7 @@ void test_condition_event_rule(void)
 
        /* Create log level rule. */
        log_level_rule_at_least_as_severe =
-                       lttng_log_level_rule_at_least_as_severe_as_create(
-                                       LTTNG_LOGLEVEL_WARNING);
+               lttng_log_level_rule_at_least_as_severe_as_create(LTTNG_LOGLEVEL_WARNING);
        LTTNG_ASSERT(log_level_rule_at_least_as_severe);
 
        tracepoint = lttng_event_rule_user_tracepoint_create();
@@ -67,40 +65,37 @@ void test_condition_event_rule(void)
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Setting filter");
 
        status = lttng_event_rule_user_tracepoint_set_log_level_rule(
-                       tracepoint, log_level_rule_at_least_as_severe);
+               tracepoint, log_level_rule_at_least_as_severe);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Setting log level range");
 
        for (i = 0; i < 3; i++) {
-               status = lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(
-                               tracepoint, exclusions[i]);
-               ok(status == LTTNG_EVENT_RULE_STATUS_OK,
-                               "Setting exclusion pattern");
+               status = lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(tracepoint,
+                                                                                    exclusions[i]);
+               ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Setting exclusion pattern");
        }
 
        condition = lttng_condition_event_rule_matches_create(tracepoint);
        ok(condition, "Created condition");
 
-       condition_status = lttng_condition_event_rule_matches_get_rule(
-                       condition, &tracepoint_tmp);
+       condition_status = lttng_condition_event_rule_matches_get_rule(condition, &tracepoint_tmp);
        ok(condition_status == LTTNG_CONDITION_STATUS_OK,
-                       "Getting event rule from event rule condition");
-       ok(tracepoint == tracepoint_tmp, "lttng_condition_event_rule_get_rule provides a reference to the original rule");
+          "Getting event rule from event rule condition");
+       ok(tracepoint == tracepoint_tmp,
+          "lttng_condition_event_rule_get_rule provides a reference to the original rule");
 
        ret = lttng_condition_serialize(condition, &buffer);
        ok(ret == 0, "Condition serialized");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(&buffer, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&buffer, 0, -1);
 
-               (void) lttng_condition_create_from_payload(
-                               &view, &condition_from_buffer);
+               (void) lttng_condition_create_from_payload(&view, &condition_from_buffer);
        }
 
        ok(condition_from_buffer, "Condition created from payload is non-null");
 
        ok(lttng_condition_is_equal(condition, condition_from_buffer),
-                       "Serialized and de-serialized conditions are equal");
+          "Serialized and de-serialized conditions are equal");
 
        lttng_payload_reset(&buffer);
        lttng_event_rule_destroy(tracepoint);
index 8a4e614993379ff42e01779b9cde562507d91b93..60d3b4027b0b1cfd6d348dd38d1b13455b52057d 100644 (file)
@@ -5,6 +5,10 @@
  *
  */
 
+#include <common/compat/directory-handle.hpp>
+#include <common/compat/errno.hpp>
+#include <common/error.hpp>
+
 #include <fcntl.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <unistd.h>
-
-#include <common/compat/directory-handle.hpp>
-#include <common/compat/errno.hpp>
-#include <common/error.hpp>
 #include <tap/tap.h>
+#include <unistd.h>
 
 #define TEST_COUNT 9
 
@@ -63,9 +63,8 @@ static bool dir_exists(const char *path)
  *             ├── f
  *             └── file1
  */
-static int create_non_empty_hierarchy_with_root(
-               struct lttng_directory_handle *test_dir_handle,
-               const char *test_root_name)
+static int create_non_empty_hierarchy_with_root(struct lttng_directory_handle *test_dir_handle,
+                                               const char *test_root_name)
 {
        int ret;
        const int file_flags = O_WRONLY | O_CREAT | O_TRUNC;
@@ -78,9 +77,7 @@ static int create_non_empty_hierarchy_with_root(
                goto end;
        }
        ret = lttng_directory_handle_create_subdirectory_recursive(
-                       test_dir_handle,
-                       branch_name,
-                       DIR_CREATION_MODE);
+               test_dir_handle, branch_name, DIR_CREATION_MODE);
        if (ret) {
                diag("Failed to create test folder hierarchy %s", branch_name);
                goto end;
@@ -93,9 +90,7 @@ static int create_non_empty_hierarchy_with_root(
                goto end;
        }
        ret = lttng_directory_handle_create_subdirectory_recursive(
-                       test_dir_handle,
-                       branch_name,
-                       DIR_CREATION_MODE);
+               test_dir_handle, branch_name, DIR_CREATION_MODE);
        if (ret) {
                diag("Failed to create test folder hierarchy %s", branch_name);
                goto end;
@@ -107,16 +102,14 @@ static int create_non_empty_hierarchy_with_root(
                diag("Failed to format file path");
                goto end;
        }
-       ret = lttng_directory_handle_open_file(
-                       test_dir_handle, branch_name, file_flags, file_mode);
+       ret = lttng_directory_handle_open_file(test_dir_handle, branch_name, file_flags, file_mode);
        if (ret < 0) {
                diag("Failed to create file %s", branch_name);
                goto end;
        }
        ret = close(ret);
        if (ret) {
-               PERROR("Failed to close fd to newly created file %s",
-                               branch_name);
+               PERROR("Failed to close fd to newly created file %s", branch_name);
                goto end;
        }
 end:
@@ -125,9 +118,8 @@ end:
 }
 
 /* Remove "file1" from the test folder hierarchy. */
-static
-int remove_file_from_hierarchy(struct lttng_directory_handle *test_dir_handle,
-               const char *test_root_name)
+static int remove_file_from_hierarchy(struct lttng_directory_handle *test_dir_handle,
+                                     const char *test_root_name)
 {
        int ret;
        char *file_name = NULL;
@@ -138,8 +130,7 @@ int remove_file_from_hierarchy(struct lttng_directory_handle *test_dir_handle,
                goto end;
        }
 
-       ret = lttng_directory_handle_unlink_file(test_dir_handle,
-                       file_name);
+       ret = lttng_directory_handle_unlink_file(test_dir_handle, file_name);
        if (ret) {
                PERROR("Failed to unlink file %s", file_name);
                goto end;
@@ -174,9 +165,9 @@ static int test_rmdir_fail_non_empty(const char *test_dir)
        }
 
        ret = lttng_directory_handle_remove_subdirectory_recursive(
-                       test_dir_handle, test_root_name,
-                       LTTNG_DIRECTORY_HANDLE_FAIL_NON_EMPTY_FLAG);
-       ok(ret == -1, "Error returned when attempting to recursively remove non-empty hierarchy with LTTNG_DIRECTORY_HANDLE_FAIL_NON_EMPTY_FLAG");
+               test_dir_handle, test_root_name, LTTNG_DIRECTORY_HANDLE_FAIL_NON_EMPTY_FLAG);
+       ok(ret == -1,
+          "Error returned when attempting to recursively remove non-empty hierarchy with LTTNG_DIRECTORY_HANDLE_FAIL_NON_EMPTY_FLAG");
        tests_ran++;
 
        ret = remove_file_from_hierarchy(test_dir_handle, test_root_name);
@@ -186,9 +177,9 @@ static int test_rmdir_fail_non_empty(const char *test_dir)
        }
 
        ret = lttng_directory_handle_remove_subdirectory_recursive(
-                       test_dir_handle, test_root_name,
-                       LTTNG_DIRECTORY_HANDLE_FAIL_NON_EMPTY_FLAG);
-       ok(ret == 0, "No error returned when recursively removing empty hierarchy with LTTNG_DIRECTORY_HANDLE_FAIL_NON_EMPTY_FLAG");
+               test_dir_handle, test_root_name, LTTNG_DIRECTORY_HANDLE_FAIL_NON_EMPTY_FLAG);
+       ok(ret == 0,
+          "No error returned when recursively removing empty hierarchy with LTTNG_DIRECTORY_HANDLE_FAIL_NON_EMPTY_FLAG");
        tests_ran++;
 
        ret = asprintf(&test_dir_path, "%s/%s", test_dir, test_root_name);
@@ -197,8 +188,8 @@ static int test_rmdir_fail_non_empty(const char *test_dir)
                goto end;
        }
        ok(!dir_exists(test_dir_path) && errno == ENOENT,
-                       "Folder hierarchy %s successfully removed",
-                       test_dir_path);
+          "Folder hierarchy %s successfully removed",
+          test_dir_path);
        tests_ran++;
        ret = 0;
 end:
@@ -233,9 +224,9 @@ static int test_rmdir_skip_non_empty(const char *test_dir)
        }
 
        ret = lttng_directory_handle_remove_subdirectory_recursive(
-                       test_dir_handle, test_root_name,
-                       LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
-       ok(ret == 0, "No error returned when attempting to recursively remove non-empty hierarchy with LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG");
+               test_dir_handle, test_root_name, LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
+       ok(ret == 0,
+          "No error returned when attempting to recursively remove non-empty hierarchy with LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG");
        tests_ran++;
 
        ret = asprintf(&test_dir_path, "%s/%s", test_dir, test_root_name);
@@ -253,14 +244,14 @@ static int test_rmdir_skip_non_empty(const char *test_dir)
        }
 
        ret = lttng_directory_handle_remove_subdirectory_recursive(
-                       test_dir_handle, test_root_name,
-                       LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
-       ok(ret == 0, "No error returned when recursively removing empty hierarchy with LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG");
+               test_dir_handle, test_root_name, LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
+       ok(ret == 0,
+          "No error returned when recursively removing empty hierarchy with LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG");
        tests_ran++;
 
        ok(!dir_exists(test_dir_path) && errno == ENOENT,
-                       "Folder hierarchy %s successfully removed",
-                       test_dir_path);
+          "Folder hierarchy %s successfully removed",
+          test_dir_path);
        tests_ran++;
        ret = 0;
 end:
@@ -286,13 +277,12 @@ int main(void)
                goto end;
        }
 
-       for (func_idx = 0; func_idx < sizeof(test_funcs) / sizeof(*test_funcs);
-                       func_idx++) {
+       for (func_idx = 0; func_idx < sizeof(test_funcs) / sizeof(*test_funcs); func_idx++) {
                tests_left -= test_funcs[func_idx](test_dir);
        }
        if (tests_left) {
                diag("Skipping %d tests that could not be executed due to a prior error",
-                               tests_left);
+                    tests_left);
                skip(tests_left, "test due to an error");
        }
 end:
index 577dea93229ce1ffc12c785508383b20e217b83e..48f13e71ee0d9c189bad28aa3580ca10ef2978f3 100644 (file)
@@ -6,14 +6,15 @@
  */
 
 #include <common/bytecode/bytecode.hpp>
+
 #include <lttng/event-expr-internal.hpp>
 #include <lttng/event-expr.h>
+
 #include <tap/tap.h>
 
 #define NR_TESTS 4
 
-static
-void test_event_payload_field(void)
+static void test_event_payload_field(void)
 {
        struct lttng_event_expr *event_expr;
        struct lttng_bytecode *bytecode = NULL;
@@ -28,8 +29,7 @@ void test_event_payload_field(void)
        free(bytecode);
 }
 
-static
-void test_channel_context_field(void)
+static void test_channel_context_field(void)
 {
        struct lttng_event_expr *event_expr;
        struct lttng_bytecode *bytecode = NULL;
@@ -44,8 +44,7 @@ void test_channel_context_field(void)
        free(bytecode);
 }
 
-static
-void test_app_specific_context_field(void)
+static void test_app_specific_context_field(void)
 {
        struct lttng_event_expr *event_expr;
        struct lttng_bytecode *bytecode = NULL;
@@ -60,8 +59,7 @@ void test_app_specific_context_field(void)
        free(bytecode);
 }
 
-static
-void test_array_field_element(void)
+static void test_array_field_element(void)
 {
        struct lttng_event_expr *event_expr;
        struct lttng_bytecode *bytecode = NULL;
index c3fd01a81837011293444addf13b61f62b3581e3..be4766c8a7f9e669add35214d62f7faaf280b1f2 100644 (file)
@@ -7,13 +7,11 @@
  *
  */
 
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
+#include "bin/lttng/loglevel.hpp"
 
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
+
 #include <lttng/domain.h>
 #include <lttng/event-rule/jul-logging-internal.hpp>
 #include <lttng/event-rule/jul-logging.h>
 #include <lttng/event-rule/kernel-kprobe.h>
 #include <lttng/event-rule/kernel-syscall-internal.hpp>
 #include <lttng/event-rule/kernel-syscall.h>
-#include <lttng/event-rule/python-logging-internal.hpp>
-#include <lttng/event-rule/python-logging.h>
 #include <lttng/event-rule/kernel-tracepoint-internal.hpp>
 #include <lttng/event-rule/kernel-tracepoint.h>
 #include <lttng/event-rule/kernel-uprobe-internal.hpp>
 #include <lttng/event-rule/kernel-uprobe.h>
+#include <lttng/event-rule/python-logging-internal.hpp>
+#include <lttng/event-rule/python-logging.h>
 #include <lttng/event-rule/user-tracepoint-internal.hpp>
 #include <lttng/event-rule/user-tracepoint.h>
 #include <lttng/event.h>
 #include <lttng/kernel-probe.h>
 #include <lttng/userspace-probe-internal.hpp>
 #include <lttng/userspace-probe.h>
-#include "bin/lttng/loglevel.hpp"
 
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
 #include <tap/tap.h>
+#include <unistd.h>
 
 /* For error.h. */
 int lttng_opt_quiet = 1;
@@ -62,17 +63,15 @@ typedef const char *(*log_level_name_getter)(int log_level);
 
 typedef struct lttng_event_rule *(*event_rule_create)(void);
 typedef enum lttng_event_rule_status (*event_rule_set_log_level)(
-               struct lttng_event_rule *rule,
-               const struct lttng_log_level_rule *log_level_rule);
+       struct lttng_event_rule *rule, const struct lttng_log_level_rule *log_level_rule);
 
-static
-void test_event_rule_kernel_tracepoint(void)
+static void test_event_rule_kernel_tracepoint(void)
 {
        struct lttng_event_rule *tracepoint = NULL;
        struct lttng_event_rule *tracepoint_from_buffer = NULL;
        enum lttng_event_rule_status status;
-       const char *pattern="my_event_*";
-       const char *filter="msg_id == 23 && size >= 2048";
+       const char *pattern = "my_event_*";
+       const char *filter = "msg_id == 23 && size >= 2048";
        const char *tmp;
        struct lttng_payload payload;
 
@@ -98,34 +97,33 @@ void test_event_rule_kernel_tracepoint(void)
        ok(lttng_event_rule_serialize(tracepoint, &payload) == 0, "Serializing.");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
-               ok(lttng_event_rule_create_from_payload(
-                               &view, &tracepoint_from_buffer) > 0,
-                               "Deserializing.");
+               ok(lttng_event_rule_create_from_payload(&view, &tracepoint_from_buffer) > 0,
+                  "Deserializing.");
        }
 
-       ok(lttng_event_rule_is_equal(tracepoint, tracepoint_from_buffer), "serialized and from buffer are equal.");
+       ok(lttng_event_rule_is_equal(tracepoint, tracepoint_from_buffer),
+          "serialized and from buffer are equal.");
 
        lttng_payload_reset(&payload);
        lttng_event_rule_destroy(tracepoint);
        lttng_event_rule_destroy(tracepoint_from_buffer);
 }
 
-static
-void test_event_rule_user_tracepoint(void)
+static void test_event_rule_user_tracepoint(void)
 {
        int i;
        unsigned int count;
        struct lttng_event_rule *tracepoint = NULL;
        struct lttng_event_rule *tracepoint_from_buffer = NULL;
        enum lttng_event_rule_status status;
-       const char *pattern="my_event_*";
-       const char *filter="msg_id == 23 && size >= 2048";
+       const char *pattern = "my_event_*";
+       const char *filter = "msg_id == 23 && size >= 2048";
        const char *tmp;
-       const char *name_pattern_exclusions[] = {"my_event_test1", "my_event_test2" ,"my_event_test3"};
+       const char *name_pattern_exclusions[] = { "my_event_test1",
+                                                 "my_event_test2",
+                                                 "my_event_test3" };
        struct lttng_log_level_rule *log_level_rule = NULL;
        const struct lttng_log_level_rule *log_level_rule_return = NULL;
        struct lttng_payload payload;
@@ -152,55 +150,53 @@ void test_event_rule_user_tracepoint(void)
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "getting filter.");
        ok(!strncmp(filter, tmp, strlen(filter)), "filter is equal.");
 
-       status = lttng_event_rule_user_tracepoint_get_log_level_rule(tracepoint, &log_level_rule_return);
+       status = lttng_event_rule_user_tracepoint_get_log_level_rule(tracepoint,
+                                                                    &log_level_rule_return);
        ok(status == LTTNG_EVENT_RULE_STATUS_UNSET, "get unset log level rule.");
 
-       status = lttng_event_rule_user_tracepoint_set_log_level_rule(
-                       tracepoint, log_level_rule);
+       status = lttng_event_rule_user_tracepoint_set_log_level_rule(tracepoint, log_level_rule);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "setting log level rule.");
-       status = lttng_event_rule_user_tracepoint_get_log_level_rule(
-                       tracepoint, &log_level_rule_return);
+       status = lttng_event_rule_user_tracepoint_get_log_level_rule(tracepoint,
+                                                                    &log_level_rule_return);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "get log level rule.");
 
        /* Name pattern exclusions */
        for (i = 0; i < 3; i++) {
                status = lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(
-                               tracepoint, name_pattern_exclusions[i]);
+                       tracepoint, name_pattern_exclusions[i]);
                ok(status == LTTNG_EVENT_RULE_STATUS_OK,
-                               "setting name pattern exclusions \"%s\"",
-                               name_pattern_exclusions[i]);
+                  "setting name pattern exclusions \"%s\"",
+                  name_pattern_exclusions[i]);
        }
 
-       status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(
-                       tracepoint, &count);
-       ok(status == LTTNG_EVENT_RULE_STATUS_OK,
-                       "getting name pattern exclusion count.");
+       status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(tracepoint,
+                                                                                  &count);
+       ok(status == LTTNG_EVENT_RULE_STATUS_OK, "getting name pattern exclusion count.");
        ok(count == 3, "count is %d/3", count);
 
        for (i = 0; i < count; i++) {
                status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
-                               tracepoint, i, &tmp);
+                       tracepoint, i, &tmp);
                ok(status == LTTNG_EVENT_RULE_STATUS_OK,
-                               "getting name pattern exclusion at index %d.",
-                               i);
-               ok(!strncmp(name_pattern_exclusions[i], tmp,
-                                  strlen(name_pattern_exclusions[i])),
-                               "%s == %s.", tmp, name_pattern_exclusions[i]);
+                  "getting name pattern exclusion at index %d.",
+                  i);
+               ok(!strncmp(name_pattern_exclusions[i], tmp, strlen(name_pattern_exclusions[i])),
+                  "%s == %s.",
+                  tmp,
+                  name_pattern_exclusions[i]);
        }
 
        ok(lttng_event_rule_serialize(tracepoint, &payload) == 0, "Serializing.");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
-               ok(lttng_event_rule_create_from_payload(
-                               &view, &tracepoint_from_buffer) > 0,
-                               "Deserializing.");
+               ok(lttng_event_rule_create_from_payload(&view, &tracepoint_from_buffer) > 0,
+                  "Deserializing.");
        }
 
-       ok(lttng_event_rule_is_equal(tracepoint, tracepoint_from_buffer), "serialized and from buffer are equal.");
+       ok(lttng_event_rule_is_equal(tracepoint, tracepoint_from_buffer),
+          "serialized and from buffer are equal.");
 
        lttng_payload_reset(&payload);
        lttng_event_rule_destroy(tracepoint);
@@ -222,7 +218,8 @@ static void test_event_rule_syscall(void)
 
        lttng_payload_init(&payload);
 
-       syscall = lttng_event_rule_kernel_syscall_create(LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY);
+       syscall = lttng_event_rule_kernel_syscall_create(
+               LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY);
        ok(syscall, "syscall object.");
 
        status = lttng_event_rule_kernel_syscall_set_name_pattern(syscall, pattern);
@@ -240,31 +237,27 @@ static void test_event_rule_syscall(void)
        ok(lttng_event_rule_serialize(syscall, &payload) == 0, "Serializing.");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
-               ok(lttng_event_rule_create_from_payload(
-                                  &view, &syscall_from_buffer) > 0,
-                               "Deserializing.");
+               ok(lttng_event_rule_create_from_payload(&view, &syscall_from_buffer) > 0,
+                  "Deserializing.");
        }
 
        ok(lttng_event_rule_is_equal(syscall, syscall_from_buffer),
-                       "serialized and from buffer are equal.");
+          "serialized and from buffer are equal.");
 
        lttng_payload_reset(&payload);
        lttng_event_rule_destroy(syscall);
        lttng_event_rule_destroy(syscall_from_buffer);
 }
 
-static
-void test_event_rule_jul_logging(void)
+static void test_event_rule_jul_logging(void)
 {
        struct lttng_event_rule *jul_logging = NULL;
        struct lttng_event_rule *jul_logging_from_buffer = NULL;
        enum lttng_event_rule_status status;
-       const char *pattern="my_event_*";
-       const char *filter="msg_id == 23 && size >= 2048";
+       const char *pattern = "my_event_*";
+       const char *filter = "msg_id == 23 && size >= 2048";
        const char *tmp;
        struct lttng_log_level_rule *log_level_rule = NULL;
        const struct lttng_log_level_rule *log_level_rule_return = NULL;
@@ -292,29 +285,27 @@ void test_event_rule_jul_logging(void)
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "getting filter.");
        ok(!strncmp(filter, tmp, strlen(filter)), "filter is equal.");
 
-       status = lttng_event_rule_jul_logging_get_log_level_rule(jul_logging, &log_level_rule_return);
+       status = lttng_event_rule_jul_logging_get_log_level_rule(jul_logging,
+                                                                &log_level_rule_return);
        ok(status == LTTNG_EVENT_RULE_STATUS_UNSET, "get unset log level rule.");
 
-       status = lttng_event_rule_jul_logging_set_log_level_rule(
-                       jul_logging, log_level_rule);
+       status = lttng_event_rule_jul_logging_set_log_level_rule(jul_logging, log_level_rule);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "setting log level rule.");
-       status = lttng_event_rule_jul_logging_get_log_level_rule(
-                       jul_logging, &log_level_rule_return);
+       status = lttng_event_rule_jul_logging_get_log_level_rule(jul_logging,
+                                                                &log_level_rule_return);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "get log level rule.");
 
        ok(lttng_event_rule_serialize(jul_logging, &payload) == 0, "Serializing.");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
-               ok(lttng_event_rule_create_from_payload(
-                               &view, &jul_logging_from_buffer) > 0,
-                               "Deserializing.");
+               ok(lttng_event_rule_create_from_payload(&view, &jul_logging_from_buffer) > 0,
+                  "Deserializing.");
        }
 
-       ok(lttng_event_rule_is_equal(jul_logging, jul_logging_from_buffer), "serialized and from buffer are equal.");
+       ok(lttng_event_rule_is_equal(jul_logging, jul_logging_from_buffer),
+          "serialized and from buffer are equal.");
 
        lttng_payload_reset(&payload);
        lttng_event_rule_destroy(jul_logging);
@@ -322,14 +313,13 @@ void test_event_rule_jul_logging(void)
        lttng_log_level_rule_destroy(log_level_rule);
 }
 
-static
-void test_event_rule_log4j_logging(void)
+static void test_event_rule_log4j_logging(void)
 {
        struct lttng_event_rule *log4j_logging = NULL;
        struct lttng_event_rule *log4j_logging_from_buffer = NULL;
        enum lttng_event_rule_status status;
-       const char *pattern="my_event_*";
-       const char *filter="msg_id == 23 && size >= 2048";
+       const char *pattern = "my_event_*";
+       const char *filter = "msg_id == 23 && size >= 2048";
        const char *tmp;
        struct lttng_log_level_rule *log_level_rule = NULL;
        const struct lttng_log_level_rule *log_level_rule_return = NULL;
@@ -357,29 +347,27 @@ void test_event_rule_log4j_logging(void)
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "getting filter.");
        ok(!strncmp(filter, tmp, strlen(filter)), "filter is equal.");
 
-       status = lttng_event_rule_log4j_logging_get_log_level_rule(log4j_logging, &log_level_rule_return);
+       status = lttng_event_rule_log4j_logging_get_log_level_rule(log4j_logging,
+                                                                  &log_level_rule_return);
        ok(status == LTTNG_EVENT_RULE_STATUS_UNSET, "get unset log level rule.");
 
-       status = lttng_event_rule_log4j_logging_set_log_level_rule(
-                       log4j_logging, log_level_rule);
+       status = lttng_event_rule_log4j_logging_set_log_level_rule(log4j_logging, log_level_rule);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "setting log level rule.");
-       status = lttng_event_rule_log4j_logging_get_log_level_rule(
-                       log4j_logging, &log_level_rule_return);
+       status = lttng_event_rule_log4j_logging_get_log_level_rule(log4j_logging,
+                                                                  &log_level_rule_return);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "get log level rule.");
 
        ok(lttng_event_rule_serialize(log4j_logging, &payload) == 0, "Serializing.");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
-               ok(lttng_event_rule_create_from_payload(
-                               &view, &log4j_logging_from_buffer) > 0,
-                               "Deserializing.");
+               ok(lttng_event_rule_create_from_payload(&view, &log4j_logging_from_buffer) > 0,
+                  "Deserializing.");
        }
 
-       ok(lttng_event_rule_is_equal(log4j_logging, log4j_logging_from_buffer), "serialized and from buffer are equal.");
+       ok(lttng_event_rule_is_equal(log4j_logging, log4j_logging_from_buffer),
+          "serialized and from buffer are equal.");
 
        lttng_payload_reset(&payload);
        lttng_event_rule_destroy(log4j_logging);
@@ -387,14 +375,13 @@ void test_event_rule_log4j_logging(void)
        lttng_log_level_rule_destroy(log_level_rule);
 }
 
-static
-void test_event_rule_python_logging(void)
+static void test_event_rule_python_logging(void)
 {
        struct lttng_event_rule *python_logging = NULL;
        struct lttng_event_rule *python_logging_from_buffer = NULL;
        enum lttng_event_rule_status status;
-       const char *pattern="my_event_*";
-       const char *filter="msg_id == 23 && size >= 2048";
+       const char *pattern = "my_event_*";
+       const char *filter = "msg_id == 23 && size >= 2048";
        const char *tmp;
        struct lttng_log_level_rule *log_level_rule = NULL;
        const struct lttng_log_level_rule *log_level_rule_return = NULL;
@@ -422,29 +409,27 @@ void test_event_rule_python_logging(void)
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "getting filter.");
        ok(!strncmp(filter, tmp, strlen(filter)), "filter is equal.");
 
-       status = lttng_event_rule_python_logging_get_log_level_rule(python_logging, &log_level_rule_return);
+       status = lttng_event_rule_python_logging_get_log_level_rule(python_logging,
+                                                                   &log_level_rule_return);
        ok(status == LTTNG_EVENT_RULE_STATUS_UNSET, "get unset log level rule.");
 
-       status = lttng_event_rule_python_logging_set_log_level_rule(
-                       python_logging, log_level_rule);
+       status = lttng_event_rule_python_logging_set_log_level_rule(python_logging, log_level_rule);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "setting log level rule.");
-       status = lttng_event_rule_python_logging_get_log_level_rule(
-                       python_logging, &log_level_rule_return);
+       status = lttng_event_rule_python_logging_get_log_level_rule(python_logging,
+                                                                   &log_level_rule_return);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "get log level rule.");
 
        ok(lttng_event_rule_serialize(python_logging, &payload) == 0, "Serializing.");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
-               ok(lttng_event_rule_create_from_payload(
-                               &view, &python_logging_from_buffer) > 0,
-                               "Deserializing.");
+               ok(lttng_event_rule_create_from_payload(&view, &python_logging_from_buffer) > 0,
+                  "Deserializing.");
        }
 
-       ok(lttng_event_rule_is_equal(python_logging, python_logging_from_buffer), "serialized and from buffer are equal.");
+       ok(lttng_event_rule_is_equal(python_logging, python_logging_from_buffer),
+          "serialized and from buffer are equal.");
 
        lttng_payload_reset(&payload);
        lttng_event_rule_destroy(python_logging);
@@ -457,8 +442,7 @@ static void test_event_rule_userspace_probe(void)
 {
        struct lttng_event_rule *uprobe = NULL;
        struct lttng_event_rule *uprobe_from_buffer = NULL;
-       struct lttng_userspace_probe_location_lookup_method *lookup_method =
-                       NULL;
+       struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
        struct lttng_userspace_probe_location *probe_location = NULL;
        const struct lttng_userspace_probe_location *probe_location_tmp = NULL;
        enum lttng_event_rule_status status;
@@ -477,9 +461,9 @@ static void test_event_rule_userspace_probe(void)
        }
 
        probe_location = lttng_userspace_probe_location_function_create(
-                       "/proc/self/exe",
-                       "lttng_userspace_probe_location_tracepoint_create",
-                       lookup_method);
+               "/proc/self/exe",
+               "lttng_userspace_probe_location_tracepoint_create",
+               lookup_method);
        if (!probe_location) {
                fail("Setup error on userspace probe location creation.");
                goto end;
@@ -493,17 +477,13 @@ static void test_event_rule_userspace_probe(void)
        uprobe = lttng_event_rule_kernel_uprobe_create(probe_location);
        ok(uprobe, "uprobe event rule object creation.");
 
-       status = lttng_event_rule_kernel_uprobe_get_location(
-                       uprobe, &probe_location_tmp);
-       ok(status == LTTNG_EVENT_RULE_STATUS_OK,
-                       "Getting uprobe event rule location.");
-       ok(lttng_userspace_probe_location_is_equal(
-                          probe_location, probe_location_tmp),
-                       "Location is equal.");
+       status = lttng_event_rule_kernel_uprobe_get_location(uprobe, &probe_location_tmp);
+       ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Getting uprobe event rule location.");
+       ok(lttng_userspace_probe_location_is_equal(probe_location, probe_location_tmp),
+          "Location is equal.");
 
        status = lttng_event_rule_kernel_uprobe_set_event_name(uprobe, probe_name);
-       ok(status == LTTNG_EVENT_RULE_STATUS_OK,
-                       "Setting uprobe event rule name: %s.", probe_name);
+       ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Setting uprobe event rule name: %s.", probe_name);
        status = lttng_event_rule_kernel_uprobe_get_event_name(uprobe, &tmp);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Getting uprobe name.");
        ok(!strcmp(probe_name, tmp), "Uprobe name are equal.");
@@ -511,17 +491,14 @@ static void test_event_rule_userspace_probe(void)
        ok(lttng_event_rule_serialize(uprobe, &payload) == 0, "Serializing.");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
-               ok(lttng_event_rule_create_from_payload(
-                                  &view, &uprobe_from_buffer) > 0,
-                               "Deserializing.");
+               ok(lttng_event_rule_create_from_payload(&view, &uprobe_from_buffer) > 0,
+                  "Deserializing.");
        }
 
        ok(lttng_event_rule_is_equal(uprobe, uprobe_from_buffer),
-                       "serialized and from buffer are equal.");
+          "serialized and from buffer are equal.");
 
 end:
        lttng_payload_reset(&payload);
@@ -531,11 +508,13 @@ end:
        lttng_userspace_probe_location_lookup_method_destroy(lookup_method);
 }
 #else
-static void test_event_rule_userspace_probe(void) {}
+static void test_event_rule_userspace_probe(void)
+{
+}
 #endif
 
-static void test_event_rule_kernel_probe_by_location(
-               const struct lttng_kernel_probe_location *location)
+static void
+test_event_rule_kernel_probe_by_location(const struct lttng_kernel_probe_location *location)
 {
        struct lttng_event_rule *kprobe = NULL;
        struct lttng_event_rule *kprobe_from_buffer = NULL;
@@ -547,7 +526,7 @@ static void test_event_rule_kernel_probe_by_location(
        struct lttng_payload payload;
 
        diag("Event rule kprobe for location type %d.",
-                       lttng_kernel_probe_location_get_type(location));
+            lttng_kernel_probe_location_get_type(location));
 
        lttng_payload_init(&payload);
 
@@ -555,13 +534,11 @@ static void test_event_rule_kernel_probe_by_location(
        ok(kprobe, "kprobe event rule object creation.");
 
        status = lttng_event_rule_kernel_kprobe_get_location(kprobe, &_location);
-       ok(status == LTTNG_EVENT_RULE_STATUS_OK,
-                       "Getting kprobe event rule location.");
+       ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Getting kprobe event rule location.");
        ok(lttng_kernel_probe_location_is_equal(location, _location), "Locations are equal.");
 
        status = lttng_event_rule_kernel_kprobe_set_event_name(kprobe, probe_name);
-       ok(status == LTTNG_EVENT_RULE_STATUS_OK,
-                       "Setting kprobe event rule name: %s.", probe_name);
+       ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Setting kprobe event rule name: %s.", probe_name);
        status = lttng_event_rule_kernel_kprobe_get_event_name(kprobe, &tmp);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Getting kprobe name.");
        ok(!strcmp(probe_name, tmp), "kprobe name are equal.");
@@ -569,17 +546,14 @@ static void test_event_rule_kernel_probe_by_location(
        ok(lttng_event_rule_serialize(kprobe, &payload) == 0, "Serializing.");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
-               ok(lttng_event_rule_create_from_payload(
-                                  &view, &kprobe_from_buffer) > 0,
-                               "Deserializing.");
+               ok(lttng_event_rule_create_from_payload(&view, &kprobe_from_buffer) > 0,
+                  "Deserializing.");
        }
 
        ok(lttng_event_rule_is_equal(kprobe, kprobe_from_buffer),
-                       "serialized and from buffer are equal.");
+          "serialized and from buffer are equal.");
 
        lttng_payload_reset(&payload);
        lttng_event_rule_destroy(kprobe);
@@ -603,48 +577,43 @@ static void test_event_rule_kernel_probe(void)
        lttng_kernel_probe_location_destroy(symbol_location);
 }
 
-static void test_set_event_rule_log_level_rules(
-               struct lttng_event_rule *event_rule,
-               event_rule_set_log_level set_log_level,
-               int log_level,
-               enum lttng_event_rule_status *exactly_status,
-               enum lttng_event_rule_status *as_severe_status)
+static void test_set_event_rule_log_level_rules(struct lttng_event_rule *event_rule,
+                                               event_rule_set_log_level set_log_level,
+                                               int log_level,
+                                               enum lttng_event_rule_status *exactly_status,
+                                               enum lttng_event_rule_status *as_severe_status)
 {
        struct lttng_log_level_rule *log_level_rule;
 
-       log_level_rule = lttng_log_level_rule_at_least_as_severe_as_create(
-                       log_level);
+       log_level_rule = lttng_log_level_rule_at_least_as_severe_as_create(log_level);
        LTTNG_ASSERT(log_level_rule);
 
-       *as_severe_status = set_log_level(
-                       event_rule, log_level_rule);
+       *as_severe_status = set_log_level(event_rule, log_level_rule);
        lttng_log_level_rule_destroy(log_level_rule);
 
        log_level_rule = lttng_log_level_rule_exactly_create(log_level);
        LTTNG_ASSERT(log_level_rule);
 
-       *exactly_status = set_log_level(
-                       event_rule, log_level_rule);
+       *exactly_status = set_log_level(event_rule, log_level_rule);
        lttng_log_level_rule_destroy(log_level_rule);
 }
 
 static void test_event_rule_log_level_generic(enum lttng_event_rule_type event_rule_type,
-               log_level_name_getter get_log_level_name,
-               event_rule_create create_event_rule,
-               event_rule_set_log_level set_log_level,
-               const int tagged_log_level_values[],
-               size_t tagged_log_level_values_count,
-               const int valid_log_level_values[],
-               size_t valid_log_level_values_count,
-               const int invalid_log_level_values[],
-               size_t invalid_log_level_values_count)
+                                             log_level_name_getter get_log_level_name,
+                                             event_rule_create create_event_rule,
+                                             event_rule_set_log_level set_log_level,
+                                             const int tagged_log_level_values[],
+                                             size_t tagged_log_level_values_count,
+                                             const int valid_log_level_values[],
+                                             size_t valid_log_level_values_count,
+                                             const int invalid_log_level_values[],
+                                             size_t invalid_log_level_values_count)
 {
        size_t i;
        struct lttng_event_rule *rule;
        enum lttng_event_rule_status er_exactly_status, er_as_severe_status;
        const char *event_rule_type_str = lttng_event_rule_type_str(event_rule_type);
 
-
        diag("Test %s event rule + log level rule", event_rule_type_str);
 
        rule = create_event_rule();
@@ -653,51 +622,55 @@ static void test_event_rule_log_level_generic(enum lttng_event_rule_type event_r
        for (i = 0; i < tagged_log_level_values_count; i++) {
                const int tagged_log_level_value = tagged_log_level_values[i];
 
-               test_set_event_rule_log_level_rules(rule, set_log_level,
-                               tagged_log_level_value,
-                               &er_exactly_status, &er_as_severe_status);
+               test_set_event_rule_log_level_rules(rule,
+                                                   set_log_level,
+                                                   tagged_log_level_value,
+                                                   &er_exactly_status,
+                                                   &er_as_severe_status);
                ok(er_exactly_status == LTTNG_EVENT_RULE_STATUS_OK,
-                               "Log level rule \"exactly\" accepted by %s event rule: level = %s",
-                               event_rule_type_str,
-                               get_log_level_name(
-                                               tagged_log_level_value));
+                  "Log level rule \"exactly\" accepted by %s event rule: level = %s",
+                  event_rule_type_str,
+                  get_log_level_name(tagged_log_level_value));
                ok(er_as_severe_status == LTTNG_EVENT_RULE_STATUS_OK,
-                               "Log level rule \"as least as severe as\" accepted by %s event rule: level = %s",
-                               event_rule_type_str,
-                               get_log_level_name(
-                                               tagged_log_level_value));
+                  "Log level rule \"as least as severe as\" accepted by %s event rule: level = %s",
+                  event_rule_type_str,
+                  get_log_level_name(tagged_log_level_value));
        }
 
        for (i = 0; i < valid_log_level_values_count; i++) {
                const int valid_log_level_value = valid_log_level_values[i];
 
-               test_set_event_rule_log_level_rules(rule, set_log_level,
-                               valid_log_level_value,
-                               &er_exactly_status, &er_as_severe_status);
+               test_set_event_rule_log_level_rules(rule,
+                                                   set_log_level,
+                                                   valid_log_level_value,
+                                                   &er_exactly_status,
+                                                   &er_as_severe_status);
                ok(er_exactly_status == LTTNG_EVENT_RULE_STATUS_OK,
-                               "Log level rule \"exactly\" accepted by %s event rule: level = %d",
-                               event_rule_type_str,
-                               valid_log_level_value);
+                  "Log level rule \"exactly\" accepted by %s event rule: level = %d",
+                  event_rule_type_str,
+                  valid_log_level_value);
                ok(er_as_severe_status == LTTNG_EVENT_RULE_STATUS_OK,
-                               "Log level rule \"as least as severe as\" accepted by %s event rule: level = %d",
-                               event_rule_type_str,
-                               valid_log_level_value);
+                  "Log level rule \"as least as severe as\" accepted by %s event rule: level = %d",
+                  event_rule_type_str,
+                  valid_log_level_value);
        }
 
        for (i = 0; i < invalid_log_level_values_count; i++) {
                const int invalid_log_level_value = invalid_log_level_values[i];
 
-               test_set_event_rule_log_level_rules(rule, set_log_level,
-                               invalid_log_level_value,
-                               &er_exactly_status, &er_as_severe_status);
+               test_set_event_rule_log_level_rules(rule,
+                                                   set_log_level,
+                                                   invalid_log_level_value,
+                                                   &er_exactly_status,
+                                                   &er_as_severe_status);
                ok(er_exactly_status == LTTNG_EVENT_RULE_STATUS_INVALID,
-                               "Log level rule \"exactly\" rejected by %s event rule: level = %d",
-                               event_rule_type_str,
-                               invalid_log_level_value);
+                  "Log level rule \"exactly\" rejected by %s event rule: level = %d",
+                  event_rule_type_str,
+                  invalid_log_level_value);
                ok(er_as_severe_status == LTTNG_EVENT_RULE_STATUS_INVALID,
-                               "Log level rule \"as least as severe as\" rejected by %s event rule: level = %d",
-                               event_rule_type_str,
-                               invalid_log_level_value);
+                  "Log level rule \"as least as severe as\" rejected by %s event rule: level = %d",
+                  event_rule_type_str,
+                  invalid_log_level_value);
        }
 
        lttng_event_rule_destroy(rule);
@@ -706,20 +679,13 @@ static void test_event_rule_log_level_generic(enum lttng_event_rule_type event_r
 static void test_event_rule_log_level_ust(void)
 {
        const int tagged_log_level_values[] = {
-               LTTNG_LOGLEVEL_EMERG,
-               LTTNG_LOGLEVEL_ALERT,
-               LTTNG_LOGLEVEL_CRIT,
-               LTTNG_LOGLEVEL_ERR,
-               LTTNG_LOGLEVEL_WARNING,
-               LTTNG_LOGLEVEL_NOTICE,
-               LTTNG_LOGLEVEL_INFO,
-               LTTNG_LOGLEVEL_DEBUG_SYSTEM,
-               LTTNG_LOGLEVEL_DEBUG_PROGRAM,
-               LTTNG_LOGLEVEL_DEBUG_PROCESS,
-               LTTNG_LOGLEVEL_DEBUG_MODULE,
-               LTTNG_LOGLEVEL_DEBUG_UNIT,
-               LTTNG_LOGLEVEL_DEBUG_FUNCTION,
-               LTTNG_LOGLEVEL_DEBUG_LINE,
+               LTTNG_LOGLEVEL_EMERG,          LTTNG_LOGLEVEL_ALERT,
+               LTTNG_LOGLEVEL_CRIT,           LTTNG_LOGLEVEL_ERR,
+               LTTNG_LOGLEVEL_WARNING,        LTTNG_LOGLEVEL_NOTICE,
+               LTTNG_LOGLEVEL_INFO,           LTTNG_LOGLEVEL_DEBUG_SYSTEM,
+               LTTNG_LOGLEVEL_DEBUG_PROGRAM,  LTTNG_LOGLEVEL_DEBUG_PROCESS,
+               LTTNG_LOGLEVEL_DEBUG_MODULE,   LTTNG_LOGLEVEL_DEBUG_UNIT,
+               LTTNG_LOGLEVEL_DEBUG_FUNCTION, LTTNG_LOGLEVEL_DEBUG_LINE,
                LTTNG_LOGLEVEL_DEBUG,
        };
        const int invalid_log_level_values[] = {
@@ -730,81 +696,65 @@ static void test_event_rule_log_level_ust(void)
        };
 
        test_event_rule_log_level_generic(LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT,
-                       loglevel_value_to_name,
-                       lttng_event_rule_user_tracepoint_create,
-                       lttng_event_rule_user_tracepoint_set_log_level_rule,
-                       tagged_log_level_values,
-                       ARRAY_SIZE(tagged_log_level_values), NULL, 0,
-                       invalid_log_level_values,
-                       ARRAY_SIZE(invalid_log_level_values));
+                                         loglevel_value_to_name,
+                                         lttng_event_rule_user_tracepoint_create,
+                                         lttng_event_rule_user_tracepoint_set_log_level_rule,
+                                         tagged_log_level_values,
+                                         ARRAY_SIZE(tagged_log_level_values),
+                                         NULL,
+                                         0,
+                                         invalid_log_level_values,
+                                         ARRAY_SIZE(invalid_log_level_values));
 }
 
 static void test_event_rule_log_level_jul(void)
 {
        const int tagged_log_level_values[] = {
-               LTTNG_LOGLEVEL_JUL_OFF,
-               LTTNG_LOGLEVEL_JUL_SEVERE,
-               LTTNG_LOGLEVEL_JUL_WARNING,
-               LTTNG_LOGLEVEL_JUL_INFO,
-               LTTNG_LOGLEVEL_JUL_CONFIG,
-               LTTNG_LOGLEVEL_JUL_FINE,
-               LTTNG_LOGLEVEL_JUL_FINER,
-               LTTNG_LOGLEVEL_JUL_FINEST,
-               LTTNG_LOGLEVEL_JUL_ALL,
-       };
-       const int valid_log_level_values[] = {
-               0,
-               -1980,
-               1995
+               LTTNG_LOGLEVEL_JUL_OFF,   LTTNG_LOGLEVEL_JUL_SEVERE, LTTNG_LOGLEVEL_JUL_WARNING,
+               LTTNG_LOGLEVEL_JUL_INFO,  LTTNG_LOGLEVEL_JUL_CONFIG, LTTNG_LOGLEVEL_JUL_FINE,
+               LTTNG_LOGLEVEL_JUL_FINER, LTTNG_LOGLEVEL_JUL_FINEST, LTTNG_LOGLEVEL_JUL_ALL,
        };
+       const int valid_log_level_values[] = { 0, -1980, 1995 };
 
        test_event_rule_log_level_generic(LTTNG_EVENT_RULE_TYPE_JUL_LOGGING,
-                       loglevel_jul_value_to_name,
-                       lttng_event_rule_jul_logging_create,
-                       lttng_event_rule_jul_logging_set_log_level_rule,
-                       tagged_log_level_values,
-                       ARRAY_SIZE(tagged_log_level_values),
-                       valid_log_level_values,
-                       ARRAY_SIZE(valid_log_level_values), NULL, 0);
+                                         loglevel_jul_value_to_name,
+                                         lttng_event_rule_jul_logging_create,
+                                         lttng_event_rule_jul_logging_set_log_level_rule,
+                                         tagged_log_level_values,
+                                         ARRAY_SIZE(tagged_log_level_values),
+                                         valid_log_level_values,
+                                         ARRAY_SIZE(valid_log_level_values),
+                                         NULL,
+                                         0);
 }
 
 static void test_event_rule_log_level_log4j(void)
 {
        const int tagged_log_level_values[] = {
-               LTTNG_LOGLEVEL_LOG4J_OFF,
-               LTTNG_LOGLEVEL_LOG4J_FATAL,
-               LTTNG_LOGLEVEL_LOG4J_ERROR,
-               LTTNG_LOGLEVEL_LOG4J_WARN,
-               LTTNG_LOGLEVEL_LOG4J_INFO,
-               LTTNG_LOGLEVEL_LOG4J_DEBUG,
-               LTTNG_LOGLEVEL_LOG4J_TRACE,
-               LTTNG_LOGLEVEL_LOG4J_ALL,
-       };
-       const int valid_log_level_values[] = {
-               0
-               -1980,
-               1995
+               LTTNG_LOGLEVEL_LOG4J_OFF,   LTTNG_LOGLEVEL_LOG4J_FATAL, LTTNG_LOGLEVEL_LOG4J_ERROR,
+               LTTNG_LOGLEVEL_LOG4J_WARN,  LTTNG_LOGLEVEL_LOG4J_INFO,  LTTNG_LOGLEVEL_LOG4J_DEBUG,
+               LTTNG_LOGLEVEL_LOG4J_TRACE, LTTNG_LOGLEVEL_LOG4J_ALL,
        };
+       const int valid_log_level_values[] = { 0 - 1980, 1995 };
 
        test_event_rule_log_level_generic(LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING,
-                       loglevel_log4j_value_to_name,
-                       lttng_event_rule_log4j_logging_create,
-                       lttng_event_rule_log4j_logging_set_log_level_rule,
-                       tagged_log_level_values,
-                       ARRAY_SIZE(tagged_log_level_values),
-                       valid_log_level_values,
-                       ARRAY_SIZE(valid_log_level_values), NULL, 0);
+                                         loglevel_log4j_value_to_name,
+                                         lttng_event_rule_log4j_logging_create,
+                                         lttng_event_rule_log4j_logging_set_log_level_rule,
+                                         tagged_log_level_values,
+                                         ARRAY_SIZE(tagged_log_level_values),
+                                         valid_log_level_values,
+                                         ARRAY_SIZE(valid_log_level_values),
+                                         NULL,
+                                         0);
 }
 
 static void test_event_rule_log_level_python(void)
 {
        const int tagged_log_level_values[] = {
-               LTTNG_LOGLEVEL_PYTHON_CRITICAL,
-               LTTNG_LOGLEVEL_PYTHON_ERROR,
-               LTTNG_LOGLEVEL_PYTHON_WARNING,
-               LTTNG_LOGLEVEL_PYTHON_INFO,
-               LTTNG_LOGLEVEL_PYTHON_DEBUG,
-               LTTNG_LOGLEVEL_PYTHON_NOTSET,
+               LTTNG_LOGLEVEL_PYTHON_CRITICAL, LTTNG_LOGLEVEL_PYTHON_ERROR,
+               LTTNG_LOGLEVEL_PYTHON_WARNING,  LTTNG_LOGLEVEL_PYTHON_INFO,
+               LTTNG_LOGLEVEL_PYTHON_DEBUG,    LTTNG_LOGLEVEL_PYTHON_NOTSET,
        };
        const int valid_log_level_values[] = {
                45,
@@ -814,14 +764,15 @@ static void test_event_rule_log_level_python(void)
        };
 
        test_event_rule_log_level_generic(LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING,
-                       loglevel_python_value_to_name,
-                       lttng_event_rule_python_logging_create,
-                       lttng_event_rule_python_logging_set_log_level_rule,
-                       tagged_log_level_values,
-                       ARRAY_SIZE(tagged_log_level_values),
-                       valid_log_level_values,
-                       ARRAY_SIZE(valid_log_level_values),
-                       NULL, 0);
+                                         loglevel_python_value_to_name,
+                                         lttng_event_rule_python_logging_create,
+                                         lttng_event_rule_python_logging_set_log_level_rule,
+                                         tagged_log_level_values,
+                                         ARRAY_SIZE(tagged_log_level_values),
+                                         valid_log_level_values,
+                                         ARRAY_SIZE(valid_log_level_values),
+                                         NULL,
+                                         0);
 }
 
 int main(void)
index 63f3d0afa31921ab78a2b3086d3c1292e6bb97a5..d86cb4126b0584c53f0a2a41d002a391521a0905 100644 (file)
@@ -5,28 +5,26 @@
  *
  */
 
-#include <stdlib.h>
+#include <common/compat/directory-handle.hpp>
+#include <common/compat/errno.hpp>
+#include <common/error.hpp>
+#include <common/fd-tracker/fd-tracker.hpp>
+#include <common/fs-handle.hpp>
+
+#include <dirent.h>
+#include <fcntl.h>
 #include <inttypes.h>
-#include <stdbool.h>
-#include <string.h>
 #include <stdarg.h>
-#include <tap/tap.h>
-#include <sys/types.h>
-#include <dirent.h>
+#include <stdbool.h>
 #include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-
+#include <tap/tap.h>
+#include <unistd.h>
 #include <urcu.h>
 
-#include <common/compat/directory-handle.hpp>
-#include <common/compat/errno.hpp>
-#include <common/error.hpp>
-#include <common/fs-handle.hpp>
-#include <common/fd-tracker/fd-tracker.hpp>
-
 /* For error.h */
 int lttng_opt_quiet = 1;
 int lttng_opt_verbose;
@@ -35,9 +33,9 @@ int lttng_opt_mi;
 /* Number of TAP tests in this file */
 #define NUM_TESTS 61
 /* 3 for stdin, stdout, and stderr */
-#define STDIO_FD_COUNT 3
-#define TRACKER_FD_LIMIT 50
-#define TMP_DIR_PATTERN "/tmp/fd-tracker-XXXXXX"
+#define STDIO_FD_COUNT            3
+#define TRACKER_FD_LIMIT          50
+#define TMP_DIR_PATTERN                   "/tmp/fd-tracker-XXXXXX"
 #define TEST_UNLINK_DIRECTORY_NAME "unlinked_files"
 
 #ifdef __linux__
@@ -56,13 +54,12 @@ int lttng_opt_mi;
 int unknown_fds_count;
 
 const char file_contents[] = "Bacon ipsum dolor amet jerky drumstick sirloin "
-       "strip steak venison boudin filet mignon picanha doner shoulder. "
-       "Strip steak brisket alcatra, venison beef chuck cupim pastrami. "
-       "Landjaeger tri-tip salami leberkas ball tip, ham hock chuck sausage "
-       "flank jerky cupim. Pig bacon chuck pancetta andouille.";
+                            "strip steak venison boudin filet mignon picanha doner shoulder. "
+                            "Strip steak brisket alcatra, venison beef chuck cupim pastrami. "
+                            "Landjaeger tri-tip salami leberkas ball tip, ham hock chuck sausage "
+                            "flank jerky cupim. Pig bacon chuck pancetta andouille.";
 
-static
-void get_temporary_directories(char **_test_directory, char **_unlink_directory)
+static void get_temporary_directories(char **_test_directory, char **_unlink_directory)
 {
        int ret;
        char tmp_path_pattern[] = TMP_DIR_PATTERN;
@@ -70,22 +67,19 @@ void get_temporary_directories(char **_test_directory, char **_unlink_directory)
 
        output_dir = mkdtemp(tmp_path_pattern);
        if (!output_dir) {
-               diag("Failed to create temporary path of the form %s",
-                               TMP_DIR_PATTERN);
+               diag("Failed to create temporary path of the form %s", TMP_DIR_PATTERN);
                abort();
        }
 
        *_test_directory = strdup(output_dir);
        LTTNG_ASSERT(*_test_directory);
-       ret = asprintf(_unlink_directory, "%s/%s", output_dir,
-                       TEST_UNLINK_DIRECTORY_NAME);
+       ret = asprintf(_unlink_directory, "%s/%s", output_dir, TEST_UNLINK_DIRECTORY_NAME);
        if (ret < 0) {
                abort();
        }
 }
 
-static
-int fd_count(void)
+static int fd_count(void)
 {
        DIR *dir;
        struct dirent *entry;
@@ -93,7 +87,8 @@ int fd_count(void)
 
        dir = opendir(SELF_FD_DIR);
        if (!dir) {
-               perror("# Failed to enumerate " SELF_FD_DIR " to count the number of used file descriptors");
+               perror("# Failed to enumerate " SELF_FD_DIR
+                      " to count the number of used file descriptors");
                count = -1;
                goto end;
        }
@@ -107,41 +102,42 @@ int fd_count(void)
        /* Don't account for the file descriptor opened by opendir(). */
        count--;
        if (closedir(dir)) {
-               perror("# Failed to close test program's " SELF_FD_DIR " directory file descriptor");
+               perror("# Failed to close test program's " SELF_FD_DIR
+                      " directory file descriptor");
        }
 end:
        return count;
 }
 
-static
-void check_fd_count(int expected_count)
+static void check_fd_count(int expected_count)
 {
        int count = 0;
 
        count = fd_count();
-       ok(count == expected_count, "Expected %d open file descriptors (%d are open)",
-                       expected_count, count);
+       ok(count == expected_count,
+          "Expected %d open file descriptors (%d are open)",
+          expected_count,
+          count);
 }
 
-static
-int noop_open(void *data, int *fds)
+static int noop_open(void *data, int *fds)
 {
        *fds = *((int *) data);
        return 0;
 }
 
-static
-int noop_close(void *data __attribute__((unused)),
-               int *fds __attribute__((unused)))
+static int noop_close(void *data __attribute__((unused)), int *fds __attribute__((unused)))
 {
        return 0;
 }
 
-static
-void track_std_fds(struct fd_tracker *tracker)
+static void track_std_fds(struct fd_tracker *tracker)
 {
        int i;
-       struct { int fd; const char *name; } files[] = {
+       struct {
+               int fd;
+               const char *name;
+       } files[] = {
                { .fd = fileno(stdin), .name = "stdin" },
                { .fd = fileno(stdout), .name = "stdout" },
                { .fd = fileno(stderr), .name = "stderr" },
@@ -150,20 +146,21 @@ void track_std_fds(struct fd_tracker *tracker)
        for (i = 0; i < sizeof(files) / sizeof(*files); i++) {
                int out_fd, ret;
 
-               ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
-                               &files[i].name, 1, noop_open, &files[i].fd);
+               ret = fd_tracker_open_unsuspendable_fd(
+                       tracker, &out_fd, &files[i].name, 1, noop_open, &files[i].fd);
                LTTNG_ASSERT(out_fd == files[i].fd);
 
-               ok(ret == 0, "Track unsuspendable fd %d (%s)", files[i].fd,
-                               files[i].name);
+               ok(ret == 0, "Track unsuspendable fd %d (%s)", files[i].fd, files[i].name);
        }
 }
 
-static
-void untrack_std_fds(struct fd_tracker *tracker)
+static void untrack_std_fds(struct fd_tracker *tracker)
 {
        int i;
-       struct { int fd; const char *name; } files[] = {
+       struct {
+               int fd;
+               const char *name;
+       } files[] = {
                { .fd = fileno(stdin), .name = "stdin" },
                { .fd = fileno(stdout), .name = "stdout" },
                { .fd = fileno(stderr), .name = "stderr" },
@@ -171,19 +168,17 @@ void untrack_std_fds(struct fd_tracker *tracker)
 
        for (i = 0; i < sizeof(files) / sizeof(*files); i++) {
                int fd = files[i].fd;
-               int ret = fd_tracker_close_unsuspendable_fd(tracker,
-                               &files[i].fd, 1, noop_close, NULL);
+               int ret = fd_tracker_close_unsuspendable_fd(
+                       tracker, &files[i].fd, 1, noop_close, NULL);
 
-               ok(ret == 0, "Untrack unsuspendable fd %d (%s)", fd,
-                               files[i].name);
+               ok(ret == 0, "Untrack unsuspendable fd %d (%s)", fd, files[i].name);
        }
 }
 
 /*
- * Basic test opening and closing three unsuspendable fds. 
+ * Basic test opening and closing three unsuspendable fds.
  */
-static
-void test_unsuspendable_basic(void)
+static void test_unsuspendable_basic(void)
 {
        int ret;
        struct fd_tracker *tracker;
@@ -192,8 +187,9 @@ void test_unsuspendable_basic(void)
        get_temporary_directories(&test_directory, &unlinked_files_directory);
 
        tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
-       ok(tracker, "Created an fd tracker with a limit of %d simulateously opened file descriptors",
-                       TRACKER_FD_LIMIT);
+       ok(tracker,
+          "Created an fd tracker with a limit of %d simulateously opened file descriptors",
+          TRACKER_FD_LIMIT);
        if (!tracker) {
                goto end;
        }
@@ -209,14 +205,12 @@ end:
        free(unlinked_files_directory);
 }
 
-static
-int error_open(void *data, int *fds __attribute__((unused)))
+static int error_open(void *data, int *fds __attribute__((unused)))
 {
        return *((int *) data);
 }
 
-static
-int error_close(void *data, int *fds __attribute__((unused)))
+static int error_close(void *data, int *fds __attribute__((unused)))
 {
        return *((int *) data);
 }
@@ -225,8 +219,7 @@ int error_close(void *data, int *fds __attribute__((unused)))
  * Validate that user callback return values are returned to the
  * caller of the fd tracker.
  */
-static
-void test_unsuspendable_cb_return(void)
+static void test_unsuspendable_cb_return(void)
 {
        int ret, stdout_fd = fileno(stdout), out_fd = 42;
        struct fd_tracker *tracker;
@@ -239,25 +232,28 @@ void test_unsuspendable_cb_return(void)
        LTTNG_ASSERT(tracker);
 
        /* The error_open callback should fail and return 'expected_error'. */
-       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
-                       NULL, 1, error_open, &expected_error);
-       ok(ret == expected_error, "fd_tracker_open_unsuspendable_fd() forwards the user callback's error code");
-       ok(out_fd == 42, "Output fd parameter is unaffected on error of fd_tracker_open_unsuspendable_fd()");
+       ret = fd_tracker_open_unsuspendable_fd(
+               tracker, &out_fd, NULL, 1, error_open, &expected_error);
+       ok(ret == expected_error,
+          "fd_tracker_open_unsuspendable_fd() forwards the user callback's error code");
+       ok(out_fd == 42,
+          "Output fd parameter is unaffected on error of fd_tracker_open_unsuspendable_fd()");
 
        /*
         * Track a valid fd since we don't want the tracker to fail with an
         * invalid fd error for this test.
         */
-       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
-                       NULL, 1, noop_open, &stdout_fd);
-       ok(out_fd == stdout_fd, "fd_tracker_open_unsuspendable_fd() sets the output fd parameter to the newly-tracked fd's value");
+       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, NULL, 1, noop_open, &stdout_fd);
+       ok(out_fd == stdout_fd,
+          "fd_tracker_open_unsuspendable_fd() sets the output fd parameter to the newly-tracked fd's value");
        LTTNG_ASSERT(!ret);
 
-       ret = fd_tracker_close_unsuspendable_fd(tracker,
-                       &stdout_fd, 1, error_close, &expected_error);
-       ok(ret == expected_error, "fd_tracker_close_unsuspendable_fd() forwards the user callback's error code");
-       ret = fd_tracker_close_unsuspendable_fd(tracker,
-                       &stdout_fd, 1, noop_close, &expected_error);
+       ret = fd_tracker_close_unsuspendable_fd(
+               tracker, &stdout_fd, 1, error_close, &expected_error);
+       ok(ret == expected_error,
+          "fd_tracker_close_unsuspendable_fd() forwards the user callback's error code");
+       ret = fd_tracker_close_unsuspendable_fd(
+               tracker, &stdout_fd, 1, noop_close, &expected_error);
        LTTNG_ASSERT(!ret);
 
        fd_tracker_destroy(tracker);
@@ -271,8 +267,7 @@ void test_unsuspendable_cb_return(void)
  * Validate that the tracker refuses to track two identical unsuspendable
  * file descriptors.
  */
-static
-void test_unsuspendable_duplicate(void)
+static void test_unsuspendable_duplicate(void)
 {
        int ret, stdout_fd = fileno(stdout), out_fd;
        struct fd_tracker *tracker;
@@ -283,15 +278,12 @@ void test_unsuspendable_duplicate(void)
        tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
        LTTNG_ASSERT(tracker);
 
-       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
-                       NULL, 1, noop_open, &stdout_fd);
+       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, NULL, 1, noop_open, &stdout_fd);
        LTTNG_ASSERT(!ret);
-       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
-                       NULL, 1, noop_open, &stdout_fd);
+       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, NULL, 1, noop_open, &stdout_fd);
        ok(ret == -EEXIST, "EEXIST reported on open of an already tracked file descriptor");
 
-       ret = fd_tracker_close_unsuspendable_fd(tracker,
-                       &stdout_fd, 1, noop_close, NULL);
+       ret = fd_tracker_close_unsuspendable_fd(tracker, &stdout_fd, 1, noop_close, NULL);
        LTTNG_ASSERT(!ret);
 
        fd_tracker_destroy(tracker);
@@ -301,8 +293,7 @@ void test_unsuspendable_duplicate(void)
        free(unlinked_files_directory);
 }
 
-static
-int open_pipes(void *data __attribute__((unused)), int *out_fds)
+static int open_pipes(void *data __attribute__((unused)), int *out_fds)
 {
        unsigned int i;
        const unsigned int pipe_count = TRACKER_FD_LIMIT / 2;
@@ -317,8 +308,7 @@ int open_pipes(void *data __attribute__((unused)), int *out_fds)
        return 0;
 }
 
-static
-int close_pipes(void *data __attribute__((unused)), int *fds)
+static int close_pipes(void *data __attribute__((unused)), int *fds)
 {
        int i;
        int *pipes = fds;
@@ -337,8 +327,7 @@ int close_pipes(void *data __attribute__((unused)), int *fds)
  * Validate that the tracker enforces the open file descriptor limit
  * when unsuspendable file descriptors are being opened.
  */
-static
-void test_unsuspendable_limit(void)
+static void test_unsuspendable_limit(void)
 {
        struct fd_tracker *tracker;
        int ret, stdout_fd = fileno(stdout), out_fd;
@@ -353,17 +342,17 @@ void test_unsuspendable_limit(void)
        tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
        LTTNG_ASSERT(tracker);
 
-       ret = fd_tracker_open_unsuspendable_fd(tracker, fds,
-                       NULL, TRACKER_FD_LIMIT, open_pipes, NULL);
-       ok(ret == 0, "File descriptor tracker allowed the user to meet its limit with unsuspendable file descriptors (%d)",
-                       TRACKER_FD_LIMIT);
+       ret = fd_tracker_open_unsuspendable_fd(
+               tracker, fds, NULL, TRACKER_FD_LIMIT, open_pipes, NULL);
+       ok(ret == 0,
+          "File descriptor tracker allowed the user to meet its limit with unsuspendable file descriptors (%d)",
+          TRACKER_FD_LIMIT);
 
-       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
-                       NULL, 1, noop_open, &stdout_fd);
-       ok(ret == -EMFILE, "EMFILE reported when exceeding the file descriptor limit while opening an unsuspendable fd");
+       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, NULL, 1, noop_open, &stdout_fd);
+       ok(ret == -EMFILE,
+          "EMFILE reported when exceeding the file descriptor limit while opening an unsuspendable fd");
 
-       ret = fd_tracker_close_unsuspendable_fd(tracker,
-                       fds, TRACKER_FD_LIMIT, close_pipes, NULL);
+       ret = fd_tracker_close_unsuspendable_fd(tracker, fds, TRACKER_FD_LIMIT, close_pipes, NULL);
        LTTNG_ASSERT(!ret);
 
        fd_tracker_destroy(tracker);
@@ -377,8 +366,7 @@ void test_unsuspendable_limit(void)
  * Validate that the tracker refuses to track two identical unsuspendable
  * file descriptors.
  */
-static
-void test_unsuspendable_close_untracked(void)
+static void test_unsuspendable_close_untracked(void)
 {
        int ret, stdout_fd = fileno(stdout), unknown_fds[2], out_fd;
        struct fd_tracker *tracker;
@@ -388,7 +376,8 @@ void test_unsuspendable_close_untracked(void)
 
        tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
        if (!tracker) {
-               goto end;;
+               goto end;
+               ;
        }
 
        ret = pipe(unknown_fds);
@@ -398,16 +387,13 @@ void test_unsuspendable_close_untracked(void)
        ret = close(unknown_fds[1]);
        LTTNG_ASSERT(ret == 0);
 
-       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
-                       NULL, 1, noop_open, &stdout_fd);
+       ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd, NULL, 1, noop_open, &stdout_fd);
        LTTNG_ASSERT(!ret);
 
-       ret = fd_tracker_close_unsuspendable_fd(tracker,
-                       unknown_fds, 1, noop_close, NULL);
+       ret = fd_tracker_close_unsuspendable_fd(tracker, unknown_fds, 1, noop_close, NULL);
        ok(ret == -EINVAL, "EINVAL reported on close of an untracked file descriptor");
 
-       ret = fd_tracker_close_unsuspendable_fd(tracker,
-                       &stdout_fd, 1, noop_close, NULL);
+       ret = fd_tracker_close_unsuspendable_fd(tracker, &stdout_fd, 1, noop_close, NULL);
        LTTNG_ASSERT(!ret);
 
        fd_tracker_destroy(tracker);
@@ -419,10 +405,10 @@ end:
 }
 
 static int open_files(struct fd_tracker *tracker,
-               struct lttng_directory_handle *directory,
-               unsigned int count,
-               struct fs_handle **handles,
-               char **file_paths)
+                     struct lttng_directory_handle *directory,
+                     unsigned int count,
+                     struct fs_handle **handles,
+                     char **file_paths)
 {
        int ret = 0;
        unsigned int i;
@@ -437,8 +423,8 @@ static int open_files(struct fd_tracker *tracker,
                LTTNG_ASSERT(p_ret >= 0);
                file_paths[i] = file_path;
 
-               handle = fd_tracker_open_fs_handle(tracker, directory, file_path,
-                               O_RDWR | O_CREAT, &mode);
+               handle = fd_tracker_open_fs_handle(
+                       tracker, directory, file_path, O_RDWR | O_CREAT, &mode);
                if (!handle) {
                        ret = -1;
                        break;
@@ -449,10 +435,10 @@ static int open_files(struct fd_tracker *tracker,
 }
 
 static int open_same_file(struct fd_tracker *tracker,
-               struct lttng_directory_handle *directory,
-               const char *file,
-               unsigned int count,
-               struct fs_handle **handles)
+                         struct lttng_directory_handle *directory,
+                         const char *file,
+                         unsigned int count,
+                         struct fs_handle **handles)
 {
        int ret = 0;
        unsigned int i;
@@ -461,8 +447,8 @@ static int open_same_file(struct fd_tracker *tracker,
                struct fs_handle *handle;
                mode_t mode = S_IWUSR | S_IRUSR;
 
-               handle = fd_tracker_open_fs_handle(tracker, directory, file,
-                               O_RDWR | O_CREAT, &mode);
+               handle = fd_tracker_open_fs_handle(
+                       tracker, directory, file, O_RDWR | O_CREAT, &mode);
                if (!handle) {
                        ret = -1;
                        break;
@@ -472,11 +458,11 @@ static int open_same_file(struct fd_tracker *tracker,
        return ret;
 }
 
-static
-int cleanup_files(struct fd_tracker *tracker __attribute__((unused)),
-               const char *dir __attribute__((unused)),
-               unsigned int count, struct fs_handle **handles,
-               char **file_paths)
+static int cleanup_files(struct fd_tracker *tracker __attribute__((unused)),
+                        const char *dir __attribute__((unused)),
+                        unsigned int count,
+                        struct fs_handle **handles,
+                        char **file_paths)
 {
        int ret = 0;
        unsigned int i;
@@ -500,8 +486,7 @@ int cleanup_files(struct fd_tracker *tracker __attribute__((unused)),
        return ret;
 }
 
-static
-void test_suspendable_limit(void)
+static void test_suspendable_limit(void)
 {
        int ret;
        const int files_to_create = TRACKER_FD_LIMIT * 10;
@@ -526,15 +511,14 @@ void test_suspendable_limit(void)
        LTTNG_ASSERT(dir_handle);
        dir_handle_fd_count = !!lttng_directory_handle_uses_fd(dir_handle);
 
-       ret = open_files(tracker, dir_handle, files_to_create, handles,
-                       output_files);
-       ok(!ret, "Created %d files with a limit of %d simultaneously-opened file descriptor",
-                       files_to_create, TRACKER_FD_LIMIT);
-       check_fd_count(TRACKER_FD_LIMIT + STDIO_FD_COUNT + unknown_fds_count +
-                       dir_handle_fd_count);
+       ret = open_files(tracker, dir_handle, files_to_create, handles, output_files);
+       ok(!ret,
+          "Created %d files with a limit of %d simultaneously-opened file descriptor",
+          files_to_create,
+          TRACKER_FD_LIMIT);
+       check_fd_count(TRACKER_FD_LIMIT + STDIO_FD_COUNT + unknown_fds_count + dir_handle_fd_count);
 
-       ret = cleanup_files(tracker, test_directory, files_to_create, handles,
-                       output_files);
+       ret = cleanup_files(tracker, test_directory, files_to_create, handles, output_files);
        ok(!ret, "Close all opened filesystem handles");
        ret = rmdir(test_directory);
        ok(ret == 0, "Test directory is empty");
@@ -545,8 +529,7 @@ end:
        free(unlinked_files_directory);
 }
 
-static
-void test_mixed_limit(void)
+static void test_mixed_limit(void)
 {
        int ret;
        const int files_to_create = TRACKER_FD_LIMIT;
@@ -571,30 +554,26 @@ void test_mixed_limit(void)
        LTTNG_ASSERT(dir_handle);
        dir_handle_fd_count = !!lttng_directory_handle_uses_fd(dir_handle);
 
-       ret = open_files(tracker, dir_handle, files_to_create, handles,
-                       output_files);
-       ok(!ret, "Created %d files with a limit of %d simultaneously-opened file descriptor",
-                       files_to_create, TRACKER_FD_LIMIT);
+       ret = open_files(tracker, dir_handle, files_to_create, handles, output_files);
+       ok(!ret,
+          "Created %d files with a limit of %d simultaneously-opened file descriptor",
+          files_to_create,
+          TRACKER_FD_LIMIT);
        diag("Check file descriptor count after opening %u files", files_to_create);
-       check_fd_count(TRACKER_FD_LIMIT + STDIO_FD_COUNT + unknown_fds_count +
-                       dir_handle_fd_count);
+       check_fd_count(TRACKER_FD_LIMIT + STDIO_FD_COUNT + unknown_fds_count + dir_handle_fd_count);
 
        /*
         * Open unsuspendable fds (stdin, stdout, stderr) and verify that the fd
         * cap is still respected.
         */
-       diag("Check file descriptor count after adding %d unsuspendable fds",
-                       STDIO_FD_COUNT);
+       diag("Check file descriptor count after adding %d unsuspendable fds", STDIO_FD_COUNT);
        track_std_fds(tracker);
-       check_fd_count(TRACKER_FD_LIMIT + unknown_fds_count +
-                       dir_handle_fd_count);
+       check_fd_count(TRACKER_FD_LIMIT + unknown_fds_count + dir_handle_fd_count);
        diag("Untrack unsuspendable file descriptors");
        untrack_std_fds(tracker);
-       check_fd_count(TRACKER_FD_LIMIT + unknown_fds_count +
-                       dir_handle_fd_count);
+       check_fd_count(TRACKER_FD_LIMIT + unknown_fds_count + dir_handle_fd_count);
 
-       ret = cleanup_files(tracker, test_directory, files_to_create, handles,
-                       output_files);
+       ret = cleanup_files(tracker, test_directory, files_to_create, handles, output_files);
        ok(!ret, "Close all opened filesystem handles");
        ret = rmdir(test_directory);
        ok(ret == 0, "Test directory is empty");
@@ -613,8 +592,7 @@ end:
  *
  * The content of the files is also verified at the end.
  */
-static
-void test_suspendable_restore(void)
+static void test_suspendable_restore(void)
 {
        int ret;
        const int files_to_create = TRACKER_FD_LIMIT * 10;
@@ -644,13 +622,13 @@ void test_suspendable_restore(void)
        LTTNG_ASSERT(dir_handle);
        dir_handle_fd_count = !!lttng_directory_handle_uses_fd(dir_handle);
 
-       ret = open_files(tracker, dir_handle, files_to_create, handles,
-                       output_files);
-       ok(!ret, "Created %d files with a limit of %d simultaneously-opened file descriptor",
-                       files_to_create, TRACKER_FD_LIMIT);
+       ret = open_files(tracker, dir_handle, files_to_create, handles, output_files);
+       ok(!ret,
+          "Created %d files with a limit of %d simultaneously-opened file descriptor",
+          files_to_create,
+          TRACKER_FD_LIMIT);
        diag("Check file descriptor count after opening %u files", files_to_create);
-       check_fd_count(TRACKER_FD_LIMIT + STDIO_FD_COUNT + unknown_fds_count +
-                       dir_handle_fd_count);
+       check_fd_count(TRACKER_FD_LIMIT + STDIO_FD_COUNT + unknown_fds_count + dir_handle_fd_count);
 
        for (content_index = 0; content_index < sizeof(file_contents); content_index++) {
                for (handle_index = 0; handle_index < files_to_create; handle_index++) {
@@ -661,8 +639,7 @@ void test_suspendable_restore(void)
                        fd = fs_handle_get_fd(handle);
                        if (fd < 0) {
                                write_success = false;
-                               diag("Failed to restore fs_handle to %s",
-                                               path);
+                               diag("Failed to restore fs_handle to %s", path);
                                goto skip_write;
                        }
 
@@ -676,9 +653,8 @@ void test_suspendable_restore(void)
                                goto skip_write;
                        }
 
-                       if (fd_count() > (TRACKER_FD_LIMIT + STDIO_FD_COUNT +
-                                                       unknown_fds_count +
-                                                       dir_handle_fd_count)) {
+                       if (fd_count() > (TRACKER_FD_LIMIT + STDIO_FD_COUNT + unknown_fds_count +
+                                         dir_handle_fd_count)) {
                                fd_cap_respected = false;
                        }
 
@@ -686,8 +662,7 @@ void test_suspendable_restore(void)
                }
        }
 skip_write:
-       ok(write_success, "Wrote reference string to %d files",
-                       files_to_create);
+       ok(write_success, "Wrote reference string to %d files", files_to_create);
        ok(fd_cap_respected, "FD tracker enforced the file descriptor cap");
 
        /* Validate the contents of the files. */
@@ -699,15 +674,15 @@ skip_write:
                size_t to_read = sizeof(read_buf);
                int fd;
 
-               fd = lttng_directory_handle_open_file(
-                               dir_handle, path, O_RDONLY, 0);
+               fd = lttng_directory_handle_open_file(dir_handle, path, O_RDONLY, 0);
                LTTNG_ASSERT(fd >= 0);
                ret = fstat(fd, &fd_stat);
                LTTNG_ASSERT(!ret);
                if (fd_stat.st_size != sizeof(file_contents)) {
                        diag("Content size of file %s doesn't match, got %" PRId64 ", expected %zu",
-                                       path, (int64_t) fd_stat.st_size,
-                                       sizeof(file_contents));
+                            path,
+                            (int64_t) fd_stat.st_size,
+                            sizeof(file_contents));
                        content_ok = false;
                        (void) close(fd);
                        break;
@@ -737,8 +712,7 @@ skip_write:
                (void) close(fd);
        }
        ok(content_ok, "Files contain the expected content");
-       ret = cleanup_files(tracker, test_directory, files_to_create, handles,
-                       output_files);
+       ret = cleanup_files(tracker, test_directory, files_to_create, handles, output_files);
        ok(!ret, "Close all opened filesystem handles");
        ret = rmdir(test_directory);
        ok(ret == 0, "Test directory is empty");
@@ -749,8 +723,7 @@ end:
        free(unlinked_files_directory);
 }
 
-static
-void test_unlink(void)
+static void test_unlink(void)
 {
        int ret;
        struct fd_tracker *tracker;
@@ -765,11 +738,9 @@ void test_unlink(void)
        int fd;
 
        get_temporary_directories(&test_directory, &unlinked_files_directory);
-       ret = asprintf(&unlinked_file_zero, "%s/%u", unlinked_files_directory,
-                       0);
+       ret = asprintf(&unlinked_file_zero, "%s/%u", unlinked_files_directory, 0);
        LTTNG_ASSERT(ret > 0);
-       ret = asprintf(&unlinked_file_one, "%s/%u", unlinked_files_directory,
-                       1);
+       ret = asprintf(&unlinked_file_one, "%s/%u", unlinked_files_directory, 1);
        LTTNG_ASSERT(ret > 0);
 
        tracker = fd_tracker_create(unlinked_files_directory, 1);
@@ -781,10 +752,12 @@ void test_unlink(void)
        LTTNG_ASSERT(dir_handle);
 
        /* Open two handles to the same file. */
-       ret = open_same_file(tracker, dir_handle, file_name, handles_to_open,
-                       handles);
-       ok(!ret, "Successfully opened %i handles to %s/%s", handles_to_open,
-                       test_directory, file_name);
+       ret = open_same_file(tracker, dir_handle, file_name, handles_to_open, handles);
+       ok(!ret,
+          "Successfully opened %i handles to %s/%s",
+          handles_to_open,
+          test_directory,
+          file_name);
        if (ret) {
                goto end;
        }
@@ -794,21 +767,18 @@ void test_unlink(void)
         * to '0'.
         */
        ret = fs_handle_unlink(handles[0]);
-       ok(!ret, "Successfully unlinked the first handle to %s/%s",
-                       test_directory, file_name);
+       ok(!ret, "Successfully unlinked the first handle to %s/%s", test_directory, file_name);
 
        /*
         * The original file should no longer exist on the file system, and a
         * new file named '0' should exist.
         */
-       ok(lttng_directory_handle_stat(dir_handle, file_name, &statbuf) == -1 &&
-                                       errno == ENOENT,
-                       "%s no longer present on file system after unlink",
-                       file_name);
-       ok(lttng_directory_handle_stat(
-                       dir_handle, unlinked_file_zero, &statbuf) == 0,
-                       "%s exists on file system after unlink",
-                       unlinked_file_zero);
+       ok(lttng_directory_handle_stat(dir_handle, file_name, &statbuf) == -1 && errno == ENOENT,
+          "%s no longer present on file system after unlink",
+          file_name);
+       ok(lttng_directory_handle_stat(dir_handle, unlinked_file_zero, &statbuf) == 0,
+          "%s exists on file system after unlink",
+          unlinked_file_zero);
 
        /*
         * It should be possible to use the file descriptors of both handles.
@@ -819,7 +789,7 @@ void test_unlink(void)
        ok(fd >= 0, "Got fd from first handle");
 
        fd = fs_handle_get_fd(handles[1]);
-       ok (fd < 0, "fd tracker does not allow two fds to be used at once");
+       ok(fd < 0, "fd tracker does not allow two fds to be used at once");
 
        fs_handle_put_fd(handles[0]);
        fd = fs_handle_get_fd(handles[1]);
@@ -829,15 +799,18 @@ void test_unlink(void)
        /* The second unlink should fail with -ENOENT. */
        ret = fs_handle_unlink(handles[1]);
        ok(ret == -ENOENT,
-                       "ENOENT is reported when attempting to unlink the second handle to %s/%s",
-                       test_directory, file_name);
+          "ENOENT is reported when attempting to unlink the second handle to %s/%s",
+          test_directory,
+          file_name);
 
        /*
         * Opening a new handle to 'my_file' should succeed.
         */
        ret = open_same_file(tracker, dir_handle, file_name, 1, &new_handle);
-       ok(!ret, "Successfully opened a new handle to previously unlinked file %s/%s",
-                       test_directory, file_name);
+       ok(!ret,
+          "Successfully opened a new handle to previously unlinked file %s/%s",
+          test_directory,
+          file_name);
        LTTNG_ASSERT(new_handle);
 
        /*
@@ -845,11 +818,10 @@ void test_unlink(void)
         * to '1' since '0' already exists.
         */
        ret = fs_handle_unlink(new_handle);
-       ok(!ret, "Successfully unlinked the new handle handle to %s/%s",
-                       test_directory, file_name);
+       ok(!ret, "Successfully unlinked the new handle handle to %s/%s", test_directory, file_name);
        ok(stat(unlinked_file_one, &statbuf) == 0,
-                       "%s exists on file system after unlink",
-                       unlinked_file_one);
+          "%s exists on file system after unlink",
+          unlinked_file_one);
 
        ret = fs_handle_close(handles[0]);
        ok(!ret, "Successfully closed the first handle");
@@ -858,20 +830,17 @@ void test_unlink(void)
        ret = fs_handle_close(new_handle);
        ok(!ret, "Successfully closed the third handle");
 
-       ok(lttng_directory_handle_stat(dir_handle, file_name, &statbuf) == -1 &&
-                                       errno == ENOENT,
-                       "%s no longer present on file system after handle close",
-                       file_name);
-       ok(lttng_directory_handle_stat(
-                       dir_handle, unlinked_file_zero, &statbuf) == -1 &&
-                                       errno == ENOENT,
-                       "%s no longer present on file system after handle close",
-                       unlinked_file_zero);
-       ok(lttng_directory_handle_stat(dir_handle, unlinked_file_one,
-                       &statbuf) == -1 &&
-                                       errno == ENOENT,
-                       "%s no longer present on file system after handle close",
-                       unlinked_file_one);
+       ok(lttng_directory_handle_stat(dir_handle, file_name, &statbuf) == -1 && errno == ENOENT,
+          "%s no longer present on file system after handle close",
+          file_name);
+       ok(lttng_directory_handle_stat(dir_handle, unlinked_file_zero, &statbuf) == -1 &&
+                  errno == ENOENT,
+          "%s no longer present on file system after handle close",
+          unlinked_file_zero);
+       ok(lttng_directory_handle_stat(dir_handle, unlinked_file_one, &statbuf) == -1 &&
+                  errno == ENOENT,
+          "%s no longer present on file system after handle close",
+          unlinked_file_one);
 
        ret = rmdir(test_directory);
        ok(ret == 0, "Test directory is empty");
index eae335be205026b0abd549cf166cf342d32b40aa..b7a882cfcacb5602c59102d94b5dfad62374357e 100644 (file)
@@ -5,19 +5,18 @@
  *
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-
 #include <common/compat/errno.hpp>
-#include <bin/lttng-sessiond/trace-kernel.hpp>
 #include <common/defaults.hpp>
 
+#include <bin/lttng-sessiond/trace-kernel.hpp>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <tap/tap.h>
+#include <time.h>
+#include <unistd.h>
 
-#define RANDOM_STRING_LEN      11
+#define RANDOM_STRING_LEN 11
 
 /* Number of TAP tests in this file */
 #define NUM_TESTS 11
 LTTNG_EXPORT DEFINE_LTTNG_UST_SIGBUS_STATE();
 #endif
 
-static const char alphanum[] =
-       "0123456789"
-       "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-       "abcdefghijklmnopqrstuvwxyz";
+static const char alphanum[] = "0123456789"
+                              "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                              "abcdefghijklmnopqrstuvwxyz";
 
 static struct ltt_kernel_session *kern;
 static char random_string[RANDOM_STRING_LEN];
@@ -62,12 +60,9 @@ static void test_create_one_kernel_session(void)
                skip(1, "Kernel session is null");
                return;
        }
-       ok(kern->fd == -1 &&
-          kern->metadata_stream_fd == -1 &&
-          kern->consumer_fds_sent == 0 &&
-          kern->channel_count == 0 &&
-          kern->stream_count_global == 0 &&
-          kern->metadata == NULL,
+       ok(kern->fd == -1 && kern->metadata_stream_fd == -1 && kern->consumer_fds_sent == 0 &&
+                  kern->channel_count == 0 && kern->stream_count_global == 0 &&
+                  kern->metadata == NULL,
           "Validate kernel session");
 }
 
@@ -78,20 +73,14 @@ static void test_create_kernel_metadata(void)
        kern->metadata = trace_kernel_create_metadata();
        ok(kern->metadata != NULL, "Create kernel metadata");
 
-       ok(kern->metadata->fd == -1 &&
-          kern->metadata->conf != NULL &&
-          kern->metadata->conf->attr.overwrite
-                       == DEFAULT_METADATA_OVERWRITE &&
-          kern->metadata->conf->attr.subbuf_size
-                       == default_get_metadata_subbuf_size() &&
-          kern->metadata->conf->attr.num_subbuf
-                       == DEFAULT_METADATA_SUBBUF_NUM &&
-          kern->metadata->conf->attr.switch_timer_interval
-                       == DEFAULT_METADATA_SWITCH_TIMER &&
-          kern->metadata->conf->attr.read_timer_interval
-                       == DEFAULT_METADATA_READ_TIMER &&
-          kern->metadata->conf->attr.output
-                       == LTTNG_EVENT_MMAP,
+       ok(kern->metadata->fd == -1 && kern->metadata->conf != NULL &&
+                  kern->metadata->conf->attr.overwrite == DEFAULT_METADATA_OVERWRITE &&
+                  kern->metadata->conf->attr.subbuf_size == default_get_metadata_subbuf_size() &&
+                  kern->metadata->conf->attr.num_subbuf == DEFAULT_METADATA_SUBBUF_NUM &&
+                  kern->metadata->conf->attr.switch_timer_interval ==
+                          DEFAULT_METADATA_SWITCH_TIMER &&
+                  kern->metadata->conf->attr.read_timer_interval == DEFAULT_METADATA_READ_TIMER &&
+                  kern->metadata->conf->attr.output == LTTNG_EVENT_MMAP,
           "Validate kernel session metadata");
 
        trace_kernel_destroy_metadata(kern->metadata);
@@ -115,10 +104,8 @@ static void test_create_kernel_channel(void)
                return;
        }
 
-       ok(chan->fd == -1 &&
-          chan->enabled == 1 &&
-          chan->stream_count == 0 &&
-          chan->channel->attr.overwrite  == attr.attr.overwrite,
+       ok(chan->fd == -1 && chan->enabled == 1 && chan->stream_count == 0 &&
+                  chan->channel->attr.overwrite == attr.attr.overwrite,
           "Validate kernel channel");
 
        /* Init list in order to avoid sefaults from cds_list_del */
@@ -133,9 +120,8 @@ static void test_create_kernel_event(void)
        struct lttng_event ev;
 
        memset(&ev, 0, sizeof(ev));
-       ok(!lttng_strncpy(ev.name, get_random_string(),
-                       RANDOM_STRING_LEN),
-               "Validate string length");
+       ok(!lttng_strncpy(ev.name, get_random_string(), RANDOM_STRING_LEN),
+          "Validate string length");
        ev.type = LTTNG_EVENT_TRACEPOINT;
        ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
 
@@ -147,10 +133,9 @@ static void test_create_kernel_event(void)
                return;
        }
 
-       ok(event->fd == -1 &&
-          event->enabled == 1 &&
-          event->event->instrumentation == LTTNG_KERNEL_ABI_TRACEPOINT &&
-          strlen(event->event->name),
+       ok(event->fd == -1 && event->enabled == 1 &&
+                  event->event->instrumentation == LTTNG_KERNEL_ABI_TRACEPOINT &&
+                  strlen(event->event->name),
           "Validate kernel event");
 
        /* Init list in order to avoid sefaults from cds_list_del */
@@ -170,9 +155,7 @@ static void test_create_kernel_stream(void)
                return;
        }
 
-       ok(stream->fd == -1 &&
-          stream->state == 0,
-          "Validate kernel stream");
+       ok(stream->fd == -1 && stream->state == 0, "Validate kernel stream");
 
        /* Init list in order to avoid sefaults from cds_list_del */
        CDS_INIT_LIST_HEAD(&stream->list);
index 1ec6945d4aae72de31fb67a4f4cf9d609991d0e0..12e6e3555f0a47181fd2a4bb30977c4362fbe3d9 100644 (file)
@@ -7,18 +7,18 @@
  *
  */
 
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <tap/tap.h>
-
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
+
 #include <lttng/kernel-probe-internal.hpp>
 #include <lttng/kernel-probe.h>
 
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <tap/tap.h>
+#include <unistd.h>
+
 /* For error.h */
 int lttng_opt_quiet = 1;
 int lttng_opt_verbose;
@@ -44,42 +44,40 @@ static void test_kernel_probe_location_address(void)
 
        type = lttng_kernel_probe_location_get_type(location);
        ok(LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS == type,
-                       "Location type got %d expected %d", type,
-                       LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
+          "Location type got %d expected %d",
+          type,
+          LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
 
-       status = lttng_kernel_probe_location_address_get_address(
-                       location, &_address);
+       status = lttng_kernel_probe_location_address_get_address(location, &_address);
        ok(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK, "Getting address");
        ok(address == _address,
-                       "Address is equal. Got %" PRIu64 " expected %" PRIu64,
-                       _address, address);
+          "Address is equal. Got %" PRIu64 " expected %" PRIu64,
+          _address,
+          address);
 
-       ok(lttng_kernel_probe_location_serialize(location, &payload) > 0,
-                       "Serializing");
+       ok(lttng_kernel_probe_location_serialize(location, &payload) > 0, "Serializing");
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
-               ok(lttng_kernel_probe_location_create_from_payload(
-                                  &view, &location_from_buffer) > 0,
-                               "Deserializing");
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
+               ok(lttng_kernel_probe_location_create_from_payload(&view, &location_from_buffer) >
+                          0,
+                  "Deserializing");
        }
 
        type = lttng_kernel_probe_location_get_type(location_from_buffer);
        ok(LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS == type,
-                       "Location from buffer type got %d expected %d", type,
-                       LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
+          "Location from buffer type got %d expected %d",
+          type,
+          LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
 
-       status = lttng_kernel_probe_location_address_get_address(
-                       location_from_buffer, &_address);
+       status = lttng_kernel_probe_location_address_get_address(location_from_buffer, &_address);
        ok(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK, "Getting address");
        ok(address == _address,
-                       "Address from buffer is equal. Got %" PRIu64
-                       " expected %" PRIu64,
-                       _address, address);
+          "Address from buffer is equal. Got %" PRIu64 " expected %" PRIu64,
+          _address,
+          address);
 
        ok(lttng_kernel_probe_location_is_equal(location, location_from_buffer),
-                       "serialized and from buffer are equal");
+          "serialized and from buffer are equal");
 
        lttng_payload_reset(&payload);
        lttng_kernel_probe_location_destroy(location);
@@ -105,54 +103,48 @@ static void test_kernel_probe_location_symbol(void)
 
        type = lttng_kernel_probe_location_get_type(location);
        ok(LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET == type,
-                       "Location type got %d expected %d", type,
-                       LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
+          "Location type got %d expected %d",
+          type,
+          LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
 
        _symbol = lttng_kernel_probe_location_symbol_get_name(location);
        ok(_symbol, "Getting symbol name");
        ok(!strncmp(symbol, _symbol, strlen(symbol)),
-                       "Symbol name is equal. Got %s, expected %s", _symbol,
-                       symbol);
+          "Symbol name is equal. Got %s, expected %s",
+          _symbol,
+          symbol);
 
-       status = lttng_kernel_probe_location_symbol_get_offset(
-                       location, &_offset);
+       status = lttng_kernel_probe_location_symbol_get_offset(location, &_offset);
        ok(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK, "Getting offset");
-       ok(offset == _offset,
-                       "Offset is equal. Got %" PRIu64 " expected %" PRIu64,
-                       _offset, offset);
+       ok(offset == _offset, "Offset is equal. Got %" PRIu64 " expected %" PRIu64, _offset, offset);
 
-       ok(lttng_kernel_probe_location_serialize(location, &payload) > 0,
-                       "Serializing");
+       ok(lttng_kernel_probe_location_serialize(location, &payload) > 0, "Serializing");
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
-               ok(lttng_kernel_probe_location_create_from_payload(
-                                  &view, &location_from_buffer) > 0,
-                               "Deserializing");
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
+               ok(lttng_kernel_probe_location_create_from_payload(&view, &location_from_buffer) >
+                          0,
+                  "Deserializing");
        }
 
        type = lttng_kernel_probe_location_get_type(location_from_buffer);
        ok(LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET == type,
-                       "Location from buffer type got %d expected %d", type,
-                       LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
+          "Location from buffer type got %d expected %d",
+          type,
+          LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
 
-       _symbol = lttng_kernel_probe_location_symbol_get_name(
-                       location_from_buffer);
+       _symbol = lttng_kernel_probe_location_symbol_get_name(location_from_buffer);
        ok(_symbol, "Getting symbol name");
        ok(!strncmp(symbol, _symbol, strlen(symbol)),
-                       "Symbol name is equal. Got %s, expected %s", _symbol,
-                       symbol);
+          "Symbol name is equal. Got %s, expected %s",
+          _symbol,
+          symbol);
 
-       status = lttng_kernel_probe_location_symbol_get_offset(
-                       location_from_buffer, &_offset);
+       status = lttng_kernel_probe_location_symbol_get_offset(location_from_buffer, &_offset);
        ok(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK, "Getting offset");
-       ok(offset == _offset,
-                       "Offset is equal. Got %" PRIu64 " expected %" PRIu64,
-                       _offset, offset);
+       ok(offset == _offset, "Offset is equal. Got %" PRIu64 " expected %" PRIu64, _offset, offset);
 
        ok(lttng_kernel_probe_location_is_equal(location, location_from_buffer),
-                       "serialized and from buffer are equal");
+          "serialized and from buffer are equal");
 
        lttng_payload_reset(&payload);
        lttng_kernel_probe_location_destroy(location);
index be60e82c78ed0f989ebeef87e114ffe0f741e3fb..1d5114b756ac92609b9b02b814653e410cbe9c9c 100644 (file)
@@ -7,18 +7,18 @@
  *
  */
 
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <tap/tap.h>
-
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
+
 #include <lttng/log-level-rule-internal.hpp>
 #include <lttng/log-level-rule.h>
 
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <tap/tap.h>
+#include <unistd.h>
+
 /* For error.h. */
 int lttng_opt_quiet = 1;
 int lttng_opt_verbose;
@@ -29,28 +29,38 @@ int lttng_opt_mi;
 static void test_log_level_rule_error(void)
 {
        int level = 9000;
-       struct lttng_log_level_rule *exactly =
-                       lttng_log_level_rule_exactly_create(level);
+       struct lttng_log_level_rule *exactly = lttng_log_level_rule_exactly_create(level);
        struct lttng_log_level_rule *at_least_as_severe =
-                       lttng_log_level_rule_at_least_as_severe_as_create(
-                                       level);
-
-       ok(lttng_log_level_rule_get_type(NULL) == LTTNG_LOG_LEVEL_RULE_TYPE_UNKNOWN, "Get type on invalid pointer");
-
-       ok(lttng_log_level_rule_exactly_get_level(NULL, NULL) == LTTNG_LOG_LEVEL_RULE_STATUS_INVALID, "lttng_log_level_rule_exactly_get_level (NULL, NULL) returns invalid");
-       ok(lttng_log_level_rule_exactly_get_level(exactly, NULL) == LTTNG_LOG_LEVEL_RULE_STATUS_INVALID, "lttng_log_level_rule_exactly_get_level (valid, NULL) returns invalid");
-       ok(lttng_log_level_rule_exactly_get_level(NULL, &level) == LTTNG_LOG_LEVEL_RULE_STATUS_INVALID, "lttng_log_level_rule_exactly_get_level (NULL, valid) returns invalid");
-
-       ok(lttng_log_level_rule_at_least_as_severe_as_get_level(NULL, NULL) == LTTNG_LOG_LEVEL_RULE_STATUS_INVALID, "lttng_log_level_rule_at_least_as_severe_as_get_level (NULL, NULL) returns invalid");
-       ok(lttng_log_level_rule_at_least_as_severe_as_get_level(exactly, NULL) == LTTNG_LOG_LEVEL_RULE_STATUS_INVALID, "lttng_log_level_rule_at_least_as_severe_as_get_level (valid, NULL) returns invalid");
-       ok(lttng_log_level_rule_at_least_as_severe_as_get_level(NULL, &level) == LTTNG_LOG_LEVEL_RULE_STATUS_INVALID, "lttng_log_level_rule_at_least_as_severe_as_get_level (NULL, valid) returns invalid");
+               lttng_log_level_rule_at_least_as_severe_as_create(level);
+
+       ok(lttng_log_level_rule_get_type(NULL) == LTTNG_LOG_LEVEL_RULE_TYPE_UNKNOWN,
+          "Get type on invalid pointer");
+
+       ok(lttng_log_level_rule_exactly_get_level(NULL, NULL) ==
+                  LTTNG_LOG_LEVEL_RULE_STATUS_INVALID,
+          "lttng_log_level_rule_exactly_get_level (NULL, NULL) returns invalid");
+       ok(lttng_log_level_rule_exactly_get_level(exactly, NULL) ==
+                  LTTNG_LOG_LEVEL_RULE_STATUS_INVALID,
+          "lttng_log_level_rule_exactly_get_level (valid, NULL) returns invalid");
+       ok(lttng_log_level_rule_exactly_get_level(NULL, &level) ==
+                  LTTNG_LOG_LEVEL_RULE_STATUS_INVALID,
+          "lttng_log_level_rule_exactly_get_level (NULL, valid) returns invalid");
+
+       ok(lttng_log_level_rule_at_least_as_severe_as_get_level(NULL, NULL) ==
+                  LTTNG_LOG_LEVEL_RULE_STATUS_INVALID,
+          "lttng_log_level_rule_at_least_as_severe_as_get_level (NULL, NULL) returns invalid");
+       ok(lttng_log_level_rule_at_least_as_severe_as_get_level(exactly, NULL) ==
+                  LTTNG_LOG_LEVEL_RULE_STATUS_INVALID,
+          "lttng_log_level_rule_at_least_as_severe_as_get_level (valid, NULL) returns invalid");
+       ok(lttng_log_level_rule_at_least_as_severe_as_get_level(NULL, &level) ==
+                  LTTNG_LOG_LEVEL_RULE_STATUS_INVALID,
+          "lttng_log_level_rule_at_least_as_severe_as_get_level (NULL, valid) returns invalid");
 
        lttng_log_level_rule_destroy(exactly);
        lttng_log_level_rule_destroy(at_least_as_severe);
 }
 
-static
-void test_log_level_rule_serialize_deserialize(const struct lttng_log_level_rule *rule)
+static void test_log_level_rule_serialize_deserialize(const struct lttng_log_level_rule *rule)
 {
        struct lttng_log_level_rule *log_level_rule_from_buffer = NULL;
        struct lttng_payload payload;
@@ -60,23 +70,20 @@ void test_log_level_rule_serialize_deserialize(const struct lttng_log_level_rule
        ok(lttng_log_level_rule_serialize(rule, &payload) == 0, "Serializing.");
 
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
-               ok(lttng_log_level_rule_create_from_payload(
-                               &view, &log_level_rule_from_buffer) > 0,
-                               "Deserializing.");
+               ok(lttng_log_level_rule_create_from_payload(&view, &log_level_rule_from_buffer) > 0,
+                  "Deserializing.");
        }
 
-       ok(lttng_log_level_rule_is_equal(rule, log_level_rule_from_buffer), "Serialized and from buffer are equal");
+       ok(lttng_log_level_rule_is_equal(rule, log_level_rule_from_buffer),
+          "Serialized and from buffer are equal");
 
        lttng_log_level_rule_destroy(log_level_rule_from_buffer);
        lttng_payload_reset(&payload);
 }
 
-static
-void test_log_level_rule_is_equal_exactly(void)
+static void test_log_level_rule_is_equal_exactly(void)
 {
        int level = 9000, no_eq_level = 420;
        struct lttng_log_level_rule *a, *b, *different_level, *different_type;
@@ -95,8 +102,10 @@ void test_log_level_rule_is_equal_exactly(void)
 
        ok(lttng_log_level_rule_is_equal(a, a), "Same object is equal");
        ok(lttng_log_level_rule_is_equal(a, b), "Object a and b are equal");
-       ok(!lttng_log_level_rule_is_equal(a, different_level), " Object of different levels are not equal");
-       ok(!lttng_log_level_rule_is_equal(a, different_type), " Object of different types are not equal");
+       ok(!lttng_log_level_rule_is_equal(a, different_level),
+          " Object of different levels are not equal");
+       ok(!lttng_log_level_rule_is_equal(a, different_type),
+          " Object of different types are not equal");
 
        lttng_log_level_rule_destroy(a);
        lttng_log_level_rule_destroy(b);
@@ -104,8 +113,7 @@ void test_log_level_rule_is_equal_exactly(void)
        lttng_log_level_rule_destroy(different_type);
 }
 
-static
-void test_log_level_rule_is_equal_at_least_as_severe_as(void)
+static void test_log_level_rule_is_equal_at_least_as_severe_as(void)
 {
        int level = 9000, no_eq_level = 420;
        struct lttng_log_level_rule *a, *b, *different_level, *different_type;
@@ -124,8 +132,10 @@ void test_log_level_rule_is_equal_at_least_as_severe_as(void)
 
        ok(lttng_log_level_rule_is_equal(a, a), "Same object is equal");
        ok(lttng_log_level_rule_is_equal(a, b), "Object a and b are equal");
-       ok(!lttng_log_level_rule_is_equal(a, different_level), " Object of different levels are not equal");
-       ok(!lttng_log_level_rule_is_equal(a, different_type), " Object of different types are not equal");
+       ok(!lttng_log_level_rule_is_equal(a, different_level),
+          " Object of different levels are not equal");
+       ok(!lttng_log_level_rule_is_equal(a, different_type),
+          " Object of different types are not equal");
 
        lttng_log_level_rule_destroy(a);
        lttng_log_level_rule_destroy(b);
@@ -143,9 +153,8 @@ static void test_log_level_rule_exactly(void)
        exactly = lttng_log_level_rule_exactly_create(level);
 
        ok(exactly, "Log level exactly allocated");
-       ok(lttng_log_level_rule_get_type(exactly) ==
-                                       LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY,
-                       "Log level rule exactly type");
+       ok(lttng_log_level_rule_get_type(exactly) == LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY,
+          "Log level rule exactly type");
 
        status = lttng_log_level_rule_exactly_get_level(exactly, &_level);
        ok(status == LTTNG_LOG_LEVEL_RULE_STATUS_OK, "Get the level");
@@ -167,10 +176,11 @@ static void test_log_level_rule_at_least_as_severe_as(void)
 
        ok(at_least_as_severe_as, "Log level at_least_as_severe_as allocated");
        ok(lttng_log_level_rule_get_type(at_least_as_severe_as) ==
-                                       LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS,
-                       "Log level rule at_least_as_severe_as type");
+                  LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS,
+          "Log level rule at_least_as_severe_as type");
 
-       status = lttng_log_level_rule_at_least_as_severe_as_get_level(at_least_as_severe_as, &_level);
+       status = lttng_log_level_rule_at_least_as_severe_as_get_level(at_least_as_severe_as,
+                                                                     &_level);
        ok(status == LTTNG_LOG_LEVEL_RULE_STATUS_OK, "Get the level");
        ok(_level == level, "Level property is valid");
 
index e870cbef6dab355eab2e8f6151c642589b1bd8e3..e2e885e6e192affa63725327c72514d3562028d5 100644 (file)
@@ -9,12 +9,7 @@
  *
  */
 
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <tap/tap.h>
+#include <common/macros.hpp>
 
 #include <lttng/action/action.h>
 #include <lttng/action/notify.h>
 #include <lttng/notification/notification.h>
 #include <lttng/trigger/trigger.h>
 
-#include <common/macros.hpp>
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <tap/tap.h>
+#include <unistd.h>
 
 /* For error.h */
 int lttng_opt_quiet = 1;
@@ -33,8 +32,7 @@ int lttng_opt_mi;
 
 #define NUM_TESTS 180
 
-static void test_condition_buffer_usage(
-               struct lttng_condition *buffer_usage_condition)
+static void test_condition_buffer_usage(struct lttng_condition *buffer_usage_condition)
 {
        enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
        const char *session_name = NULL;
@@ -47,17 +45,21 @@ static void test_condition_buffer_usage(
        LTTNG_ASSERT(buffer_usage_condition);
 
        diag("Validating initialization");
-       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition, &threshold_ratio);
+       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition,
+                                                                 &threshold_ratio);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Threshold ratio is unset");
 
-       status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition, &threshold_bytes);
+       status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition,
+                                                           &threshold_bytes);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Threshold byte is unset");
 
-       status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition, &session_name);
+       status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition,
+                                                              &session_name);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Session name is unset");
        ok(!session_name, "Session name is null");
 
-       status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition, &channel_name);
+       status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition,
+                                                              &channel_name);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Channel name is unset");
        ok(!session_name, "Channel name is null");
 
@@ -70,25 +72,30 @@ static void test_condition_buffer_usage(
        status = lttng_condition_buffer_usage_get_session_name(NULL, &session_name);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get session name with null condition");
        ok(!session_name, "Session name is null");
-       status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition, &session_name);
+       status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition,
+                                                              &session_name);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Session name is unset");
        ok(!session_name, "Session name is null");
 
        status = lttng_condition_buffer_usage_set_session_name(buffer_usage_condition, NULL);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set null session name");
-       status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition, &session_name);
+       status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition,
+                                                              &session_name);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Session name is unset");
        ok(!session_name, "Session name is null");
 
        status = lttng_condition_buffer_usage_set_session_name(buffer_usage_condition, "");
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set empty session name");
-       status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition, &session_name);
+       status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition,
+                                                              &session_name);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Session name is unset");
        ok(!session_name, "Session name is null");
 
-       status = lttng_condition_buffer_usage_set_session_name(buffer_usage_condition, "session420");
+       status =
+               lttng_condition_buffer_usage_set_session_name(buffer_usage_condition, "session420");
        ok(status == LTTNG_CONDITION_STATUS_OK, "Set session name session420");
-       status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition, &session_name);
+       status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition,
+                                                              &session_name);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Session name is set");
        ok(session_name, "Session name has a value");
        ok(strcmp("session420", session_name) == 0, "Session name is %s", "session420");
@@ -100,7 +107,8 @@ static void test_condition_buffer_usage(
 
        status = lttng_condition_buffer_usage_set_session_name(buffer_usage_condition, "");
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set session name to empty");
-       status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition, &session_name);
+       status = lttng_condition_buffer_usage_get_session_name(buffer_usage_condition,
+                                                              &session_name);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Session name is still set");
        ok(session_name, "Session name has a value");
        ok(strcmp("session420", session_name) == 0, "Session is still name is %s", "session420");
@@ -110,25 +118,30 @@ static void test_condition_buffer_usage(
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set null condition on set channel name");
        status = lttng_condition_buffer_usage_get_channel_name(NULL, &channel_name);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get channel name with null condition");
-       status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition, &channel_name);
+       status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition,
+                                                              &channel_name);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Channel name is unset");
        ok(!channel_name, "Channel name is null");
 
        status = lttng_condition_buffer_usage_set_channel_name(buffer_usage_condition, NULL);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set null channel name");
-       status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition, &channel_name);
+       status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition,
+                                                              &channel_name);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Channel name is unset");
        ok(!channel_name, "Channel name is null");
 
        status = lttng_condition_buffer_usage_set_channel_name(buffer_usage_condition, "");
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set empty channel name");
-       status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition, &channel_name);
+       status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition,
+                                                              &channel_name);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Channel name is unset");
        ok(!channel_name, "Channel name is null");
 
-       status = lttng_condition_buffer_usage_set_channel_name(buffer_usage_condition, "channel420");
+       status =
+               lttng_condition_buffer_usage_set_channel_name(buffer_usage_condition, "channel420");
        ok(status == LTTNG_CONDITION_STATUS_OK, "Set channel name channel420");
-       status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition, &channel_name);
+       status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition,
+                                                              &channel_name);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Channel name is set");
        ok(channel_name, "Channel name has a value");
        ok(strcmp("channel420", channel_name) == 0, "Channel name is %s", "channel420");
@@ -140,7 +153,8 @@ static void test_condition_buffer_usage(
 
        status = lttng_condition_buffer_usage_set_channel_name(buffer_usage_condition, "");
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set channel name to empty");
-       status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition, &channel_name);
+       status = lttng_condition_buffer_usage_get_channel_name(buffer_usage_condition,
+                                                              &channel_name);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Channel name is still set");
        ok(channel_name, "Channel name has a value");
        ok(strcmp("channel420", channel_name) == 0, "Channel is still name is %s", "channel420");
@@ -150,34 +164,40 @@ static void test_condition_buffer_usage(
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set threshold ratio with null condition");
        status = lttng_condition_buffer_usage_get_threshold_ratio(NULL, &threshold_ratio);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get threshold ratio with null condition");
-       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition, &threshold_ratio);
+       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition,
+                                                                 &threshold_ratio);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Threshold ratio is unset");
 
        status = lttng_condition_buffer_usage_set_threshold_ratio(buffer_usage_condition, -100.0);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set threshold ratio < 0");
-       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition, &threshold_ratio);
+       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition,
+                                                                 &threshold_ratio);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Threshold ratio is unset");
 
        status = lttng_condition_buffer_usage_set_threshold_ratio(buffer_usage_condition, 200.0);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set Threshold ratio > 1");
-       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition, &threshold_ratio);
+       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition,
+                                                                 &threshold_ratio);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Threshold ratio is unset");
 
        status = lttng_condition_buffer_usage_set_threshold_ratio(buffer_usage_condition, 1.0);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Set threshold ratio == 1.0");
-       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition, &threshold_ratio);
+       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition,
+                                                                 &threshold_ratio);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Threshold ratio is set");
        ok(threshold_ratio == 1.0, "Threshold ratio is 1.0");
 
        status = lttng_condition_buffer_usage_set_threshold_ratio(buffer_usage_condition, 0.0);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Set threshold ratio == 0.0");
-       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition, &threshold_ratio);
+       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition,
+                                                                 &threshold_ratio);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Threshold ratio is set");
        ok(threshold_ratio == 0.0, "Threshold ratio is 0.0");
 
        status = lttng_condition_buffer_usage_set_threshold_ratio(buffer_usage_condition, 0.420);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Set threshold ratio == 0.420");
-       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition, &threshold_ratio);
+       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition,
+                                                                 &threshold_ratio);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Threshold ratio is set");
        ok(threshold_ratio == 0.420, "Threshold ratio is 0.420");
 
@@ -186,24 +206,28 @@ static void test_condition_buffer_usage(
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set threshold with null condition");
        status = lttng_condition_buffer_usage_get_threshold(NULL, &threshold_bytes);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get threshold value with null condition ");
-       status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition, &threshold_bytes);
+       status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition,
+                                                           &threshold_bytes);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Threshold is unset");
 
        status = lttng_condition_buffer_usage_set_threshold(buffer_usage_condition, 100000);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Set threshold > 0");
-       status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition, &threshold_bytes);
+       status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition,
+                                                           &threshold_bytes);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Threshold is set");
        ok(threshold_bytes == 100000, "Threshold is 100000");
 
        status = lttng_condition_buffer_usage_set_threshold(buffer_usage_condition, UINT64_MAX);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Set threshold UINT64_MAX");
-       status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition, &threshold_bytes);
+       status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition,
+                                                           &threshold_bytes);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Threshold is set");
        ok(threshold_bytes == UINT64_MAX, "Threshold is UINT64_MAX");
 
        status = lttng_condition_buffer_usage_set_threshold(buffer_usage_condition, 0);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Set threshold  == 0");
-       status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition, &threshold_bytes);
+       status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition,
+                                                           &threshold_bytes);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Threshold is set");
        ok(threshold_bytes == 0, "Threshold is %d", 0);
 
@@ -214,19 +238,22 @@ static void test_condition_buffer_usage(
        diag("Testing interaction between byte and ratio thresholds");
 
        threshold_ratio = -1.0;
-       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition, &threshold_ratio);
+       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition,
+                                                                 &threshold_ratio);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Threshold ratio is unset");
        ok(threshold_ratio == -1.0, "Threshold ratio is untouched");
 
        /* Set a ratio to validate that the byte threshold is now unset */
        status = lttng_condition_buffer_usage_set_threshold_ratio(buffer_usage_condition, 0.420);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Set threshold ratio == 0.420");
-       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition, &threshold_ratio);
+       status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition,
+                                                                 &threshold_ratio);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Threshold ratio is set");
        ok(threshold_ratio == 0.420, "Threshold ratio is 0.420");
 
        threshold_bytes = 420;
-       status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition, &threshold_bytes);
+       status = lttng_condition_buffer_usage_get_threshold(buffer_usage_condition,
+                                                           &threshold_bytes);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Threshold is unset");
        ok(threshold_bytes == 420, "Threshold is untouched");
 
@@ -236,12 +263,14 @@ static void test_condition_buffer_usage(
        status = lttng_condition_buffer_usage_get_domain_type(NULL, &domain_type);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Get domain type with null condition");
 
-       status = lttng_condition_buffer_usage_set_domain_type(buffer_usage_condition, LTTNG_DOMAIN_NONE);
+       status = lttng_condition_buffer_usage_set_domain_type(buffer_usage_condition,
+                                                             LTTNG_DOMAIN_NONE);
        ok(status == LTTNG_CONDITION_STATUS_INVALID, "Set domain type as LTTNG_DOMAIN_NONE");
        status = lttng_condition_buffer_usage_get_domain_type(buffer_usage_condition, &domain_type);
        ok(status == LTTNG_CONDITION_STATUS_UNSET, "Domain type is unset");
 
-       status = lttng_condition_buffer_usage_set_domain_type(buffer_usage_condition, LTTNG_DOMAIN_UST);
+       status = lttng_condition_buffer_usage_set_domain_type(buffer_usage_condition,
+                                                             LTTNG_DOMAIN_UST);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Set domain type as LTTNG_DOMAIN_UST");
        status = lttng_condition_buffer_usage_get_domain_type(buffer_usage_condition, &domain_type);
        ok(status == LTTNG_CONDITION_STATUS_OK, "Domain type is set");
@@ -256,7 +285,8 @@ static void test_condition_buffer_usage_low(void)
        buffer_usage_low = lttng_condition_buffer_usage_low_create();
        ok(buffer_usage_low, "Condition allocated");
 
-       ok(lttng_condition_get_type(buffer_usage_low) == LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW, "Condition is of type \"low buffer usage\"");
+       ok(lttng_condition_get_type(buffer_usage_low) == LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW,
+          "Condition is of type \"low buffer usage\"");
 
        test_condition_buffer_usage(buffer_usage_low);
 
@@ -271,7 +301,8 @@ static void test_condition_buffer_usage_high(void)
        buffer_usage_high = lttng_condition_buffer_usage_high_create();
        ok(buffer_usage_high, "High buffer usage condition allocated");
 
-       ok(lttng_condition_get_type(buffer_usage_high) == LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH, "Condition is of type \"high buffer usage\"");
+       ok(lttng_condition_get_type(buffer_usage_high) == LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH,
+          "Condition is of type \"high buffer usage\"");
 
        test_condition_buffer_usage(buffer_usage_high);
 
@@ -302,7 +333,6 @@ static void test_trigger(void)
        lttng_trigger_destroy(trigger);
 }
 
-
 int main(void)
 {
        plan_tests(NUM_TESTS);
index de50ed383b5a6ec8cfc4e1160124a30385f703c2..a719770aa9958779eeca0659c024e9084cbcd38f 100644 (file)
@@ -5,12 +5,12 @@
  *
  */
 
-#include <unistd.h>
-
 #include <common/compat/fcntl.hpp>
-#include <common/payload.hpp>
 #include <common/payload-view.hpp>
+#include <common/payload.hpp>
+
 #include <tap/tap.h>
+#include <unistd.h>
 
 static const int TEST_COUNT = 5;
 
@@ -49,19 +49,17 @@ static void test_fd_push_pop_order(void)
 
        {
                bool fail_pop = false;
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                       &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
                for (i = 0; i < 3; i++) {
-                       struct fd_handle *handle =
-                                       lttng_payload_view_pop_fd_handle(&view);
+                       struct fd_handle *handle = lttng_payload_view_pop_fd_handle(&view);
 
                        fail_pop |= fd_handle_get_fd(handle) != fds[i];
                        fd_handle_put(handle);
                }
 
-               ok(!fail_pop, "File descriptors are popped from a payload view in the order of insertion");
+               ok(!fail_pop,
+                  "File descriptors are popped from a payload view in the order of insertion");
        }
 
        lttng_payload_reset(&payload);
@@ -71,7 +69,8 @@ static void test_fd_push_pop_imbalance(void)
 {
        int ret, i;
        struct lttng_payload payload;
-       const char * const test_description = "Error reported when popping more file descriptors than were pushed";
+       const char *const test_description =
+               "Error reported when popping more file descriptors than were pushed";
 
        lttng_payload_init(&payload);
 
@@ -94,9 +93,7 @@ static void test_fd_push_pop_imbalance(void)
 
        {
                struct fd_handle *handle;
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                       &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
                for (i = 0; i < 10; i++) {
                        handle = lttng_payload_view_pop_fd_handle(&view);
@@ -124,7 +121,8 @@ static void test_fd_pop_fd_root_views(void)
        int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
        struct fd_handle *handle;
        struct lttng_payload payload;
-       const char * const test_description = "Same file descriptor returned when popping from different top-level views";
+       const char *const test_description =
+               "Same file descriptor returned when popping from different top-level views";
 
        LTTNG_ASSERT(fd >= 0);
        handle = fd_handle_create(fd);
@@ -141,9 +139,7 @@ static void test_fd_pop_fd_root_views(void)
        for (i = 0; i < 5; i++) {
                int view_fd;
                struct fd_handle *view_handle;
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                       &payload, 0, -1);
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
 
                view_handle = lttng_payload_view_pop_fd_handle(&view);
                if (!view_handle) {
@@ -175,7 +171,8 @@ static void test_fd_pop_fd_descendant_views(void)
        struct fd_handle *handle2 = fd_handle_create(fd2);
        struct fd_handle *view_handle1 = NULL, *view_handle2 = NULL;
        struct lttng_payload payload;
-       const char * const test_description = "Different file descriptors returned when popping from descendant views";
+       const char *const test_description =
+               "Different file descriptors returned when popping from descendant views";
 
        lttng_payload_init(&payload);
        LTTNG_ASSERT(handle1);
@@ -193,12 +190,8 @@ static void test_fd_pop_fd_descendant_views(void)
        }
 
        {
-               struct lttng_payload_view view1 =
-                               lttng_payload_view_from_payload(
-                                       &payload, 0, -1);
-               struct lttng_payload_view view2 =
-                       lttng_payload_view_from_view(
-                               &view1, 0, -1);
+               struct lttng_payload_view view1 = lttng_payload_view_from_payload(&payload, 0, -1);
+               struct lttng_payload_view view2 = lttng_payload_view_from_view(&view1, 0, -1);
 
                view_handle1 = lttng_payload_view_pop_fd_handle(&view1);
                if (!view_handle1 || fd_handle_get_fd(view_handle1) != fd1) {
index 755bfca029e4e95f3b90ddb13e06e08740c86df5..1c2c46961d5fe595d5552a8470f9c5fd87525a02 100644 (file)
@@ -7,18 +7,18 @@
  *
  */
 
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <tap/tap.h>
-
 #include <common/payload-view.hpp>
 #include <common/payload.hpp>
+
 #include <lttng/action/rate-policy-internal.hpp>
 #include <lttng/action/rate-policy.h>
 
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <tap/tap.h>
+#include <unistd.h>
+
 /* For error.h. */
 int lttng_opt_quiet = 1;
 int lttng_opt_verbose;
@@ -43,90 +43,65 @@ static void test_rate_policy_every_n(void)
        policy_a = lttng_rate_policy_every_n_create(interval_a_b);
        policy_b = lttng_rate_policy_every_n_create(interval_a_b);
        policy_c = lttng_rate_policy_every_n_create(interval_c);
-       ok(policy_a != NULL,
-                       "Rate policy every n A created: interval: %" PRIu64,
-                       interval_a_b);
-       ok(policy_b != NULL,
-                       "Rate policy every n B created: interval: %" PRIu64,
-                       interval_a_b);
-       ok(policy_c != NULL,
-                       "Rate policy every n C created: interval: %" PRIu64,
-                       interval_c);
-
-       ok(LTTNG_RATE_POLICY_TYPE_EVERY_N ==
-                                       lttng_rate_policy_get_type(policy_a),
-                       "Type is LTTNG_RATE_POLICY_TYPE_EVERY_N");
+       ok(policy_a != NULL, "Rate policy every n A created: interval: %" PRIu64, interval_a_b);
+       ok(policy_b != NULL, "Rate policy every n B created: interval: %" PRIu64, interval_a_b);
+       ok(policy_c != NULL, "Rate policy every n C created: interval: %" PRIu64, interval_c);
+
+       ok(LTTNG_RATE_POLICY_TYPE_EVERY_N == lttng_rate_policy_get_type(policy_a),
+          "Type is LTTNG_RATE_POLICY_TYPE_EVERY_N");
 
        /* Getter tests */
        status = lttng_rate_policy_every_n_get_interval(NULL, NULL);
-       ok(status == LTTNG_RATE_POLICY_STATUS_INVALID,
-                       "Get interval returns INVALID");
+       ok(status == LTTNG_RATE_POLICY_STATUS_INVALID, "Get interval returns INVALID");
 
        status = lttng_rate_policy_every_n_get_interval(NULL, &interval_query);
-       ok(status == LTTNG_RATE_POLICY_STATUS_INVALID,
-                       "Get interval returns INVALID");
+       ok(status == LTTNG_RATE_POLICY_STATUS_INVALID, "Get interval returns INVALID");
 
        status = lttng_rate_policy_every_n_get_interval(policy_a, NULL);
-       ok(status == LTTNG_RATE_POLICY_STATUS_INVALID,
-                       "Get interval returns INVALID");
-
-       status = lttng_rate_policy_every_n_get_interval(
-                       policy_a, &interval_query);
-       ok(status == LTTNG_RATE_POLICY_STATUS_OK &&
-                                       interval_query == interval_a_b,
-                       " Getting interval A");
-
-       status = lttng_rate_policy_every_n_get_interval(
-                       policy_b, &interval_query);
-       ok(status == LTTNG_RATE_POLICY_STATUS_OK &&
-                                       interval_query == interval_a_b,
-                       " Getting interval B");
-
-       status = lttng_rate_policy_every_n_get_interval(
-                       policy_c, &interval_query);
-       ok(status == LTTNG_RATE_POLICY_STATUS_OK &&
-                                       interval_query == interval_c,
-                       " Getting interval C");
+       ok(status == LTTNG_RATE_POLICY_STATUS_INVALID, "Get interval returns INVALID");
+
+       status = lttng_rate_policy_every_n_get_interval(policy_a, &interval_query);
+       ok(status == LTTNG_RATE_POLICY_STATUS_OK && interval_query == interval_a_b,
+          " Getting interval A");
+
+       status = lttng_rate_policy_every_n_get_interval(policy_b, &interval_query);
+       ok(status == LTTNG_RATE_POLICY_STATUS_OK && interval_query == interval_a_b,
+          " Getting interval B");
+
+       status = lttng_rate_policy_every_n_get_interval(policy_c, &interval_query);
+       ok(status == LTTNG_RATE_POLICY_STATUS_OK && interval_query == interval_c,
+          " Getting interval C");
 
        /* is_equal tests */
        /* TODO: this is the behaviour introduced by the
         * lttng_condition_is_equal back in 2017 do we want to fix this and
         * return true if both are NULL?
         */
-       ok(false == lttng_rate_policy_is_equal(NULL, NULL),
-                       "is equal (NULL,NULL)");
-       ok(false == lttng_rate_policy_is_equal(policy_a, NULL),
-                       "is equal (object, NULL)");
-       ok(false == lttng_rate_policy_is_equal(NULL, policy_a),
-                       " is equal (NULL, object)");
-       ok(true == lttng_rate_policy_is_equal(policy_a, policy_a),
-                       "is equal (object A, object A)");
-
-       ok(true == lttng_rate_policy_is_equal(policy_a, policy_b),
-                       "is equal (object A, object B");
-       ok(true == lttng_rate_policy_is_equal(policy_b, policy_a),
-                       "is equal (object B, object A");
+       ok(false == lttng_rate_policy_is_equal(NULL, NULL), "is equal (NULL,NULL)");
+       ok(false == lttng_rate_policy_is_equal(policy_a, NULL), "is equal (object, NULL)");
+       ok(false == lttng_rate_policy_is_equal(NULL, policy_a), " is equal (NULL, object)");
+       ok(true == lttng_rate_policy_is_equal(policy_a, policy_a), "is equal (object A, object A)");
+
+       ok(true == lttng_rate_policy_is_equal(policy_a, policy_b), "is equal (object A, object B");
+       ok(true == lttng_rate_policy_is_equal(policy_b, policy_a), "is equal (object B, object A");
 
        ok(false == lttng_rate_policy_is_equal(policy_a, policy_c),
-                       "is equal (object A, object C)");
+          "is equal (object A, object C)");
        ok(false == lttng_rate_policy_is_equal(policy_c, policy_a),
-                       "is equal (object C, object A)");
+          "is equal (object C, object A)");
 
        /* Serialization and create_from buffer. */
        ok(lttng_rate_policy_serialize(policy_a, &payload) == 0, "Serializing");
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
-
-               ok(lttng_rate_policy_create_from_payload(
-                                  &view, &policy_from_buffer) > 0 &&
-                                               policy_from_buffer != NULL,
-                               "Deserializing");
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
+
+               ok(lttng_rate_policy_create_from_payload(&view, &policy_from_buffer) > 0 &&
+                          policy_from_buffer != NULL,
+                  "Deserializing");
        }
 
        ok(lttng_rate_policy_is_equal(policy_a, policy_from_buffer),
-                       "serialized and from buffer are equal");
+          "serialized and from buffer are equal");
 
        lttng_rate_policy_destroy(policy_a);
        lttng_rate_policy_destroy(policy_b);
@@ -152,87 +127,61 @@ static void test_rate_policy_once_after_n(void)
        policy_a = lttng_rate_policy_once_after_n_create(threshold_a_b);
        policy_b = lttng_rate_policy_once_after_n_create(threshold_a_b);
        policy_c = lttng_rate_policy_once_after_n_create(threshold_c);
-       ok(policy_a != NULL,
-                       "Rate policy every n A created: threshold: %" PRIu64,
-                       threshold_a_b);
-       ok(policy_b != NULL,
-                       "Rate policy every n B created: threshold: %" PRIu64,
-                       threshold_a_b);
-       ok(policy_c != NULL,
-                       "Rate policy every n C created: threshold: %" PRIu64,
-                       threshold_c);
-
-       ok(LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N ==
-                                       lttng_rate_policy_get_type(policy_a),
-                       "Type is LTTNG_RATE_POLICY_TYPE_once_after_n");
+       ok(policy_a != NULL, "Rate policy every n A created: threshold: %" PRIu64, threshold_a_b);
+       ok(policy_b != NULL, "Rate policy every n B created: threshold: %" PRIu64, threshold_a_b);
+       ok(policy_c != NULL, "Rate policy every n C created: threshold: %" PRIu64, threshold_c);
+
+       ok(LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N == lttng_rate_policy_get_type(policy_a),
+          "Type is LTTNG_RATE_POLICY_TYPE_once_after_n");
 
        /* Getter tests */
        status = lttng_rate_policy_once_after_n_get_threshold(NULL, NULL);
-       ok(status == LTTNG_RATE_POLICY_STATUS_INVALID,
-                       "Get threshold returns INVALID");
+       ok(status == LTTNG_RATE_POLICY_STATUS_INVALID, "Get threshold returns INVALID");
 
-       status = lttng_rate_policy_once_after_n_get_threshold(
-                       NULL, &threshold_query);
-       ok(status == LTTNG_RATE_POLICY_STATUS_INVALID,
-                       "Get threshold returns INVALID");
+       status = lttng_rate_policy_once_after_n_get_threshold(NULL, &threshold_query);
+       ok(status == LTTNG_RATE_POLICY_STATUS_INVALID, "Get threshold returns INVALID");
 
        status = lttng_rate_policy_once_after_n_get_threshold(policy_a, NULL);
-       ok(status == LTTNG_RATE_POLICY_STATUS_INVALID,
-                       "Get threshold returns INVALID");
-
-       status = lttng_rate_policy_once_after_n_get_threshold(
-                       policy_a, &threshold_query);
-       ok(status == LTTNG_RATE_POLICY_STATUS_OK &&
-                                       threshold_query == threshold_a_b,
-                       " Getting threshold A");
-
-       status = lttng_rate_policy_once_after_n_get_threshold(
-                       policy_b, &threshold_query);
-       ok(status == LTTNG_RATE_POLICY_STATUS_OK &&
-                                       threshold_query == threshold_a_b,
-                       " Getting threshold B");
-
-       status = lttng_rate_policy_once_after_n_get_threshold(
-                       policy_c, &threshold_query);
-       ok(status == LTTNG_RATE_POLICY_STATUS_OK &&
-                                       threshold_query == threshold_c,
-                       " Getting threshold C");
+       ok(status == LTTNG_RATE_POLICY_STATUS_INVALID, "Get threshold returns INVALID");
+
+       status = lttng_rate_policy_once_after_n_get_threshold(policy_a, &threshold_query);
+       ok(status == LTTNG_RATE_POLICY_STATUS_OK && threshold_query == threshold_a_b,
+          " Getting threshold A");
+
+       status = lttng_rate_policy_once_after_n_get_threshold(policy_b, &threshold_query);
+       ok(status == LTTNG_RATE_POLICY_STATUS_OK && threshold_query == threshold_a_b,
+          " Getting threshold B");
+
+       status = lttng_rate_policy_once_after_n_get_threshold(policy_c, &threshold_query);
+       ok(status == LTTNG_RATE_POLICY_STATUS_OK && threshold_query == threshold_c,
+          " Getting threshold C");
 
        /* is_equal tests */
-       ok(false == lttng_rate_policy_is_equal(NULL, NULL),
-                       "is equal (NULL,NULL)");
-       ok(false == lttng_rate_policy_is_equal(policy_a, NULL),
-                       "is equal (object, NULL)");
-       ok(false == lttng_rate_policy_is_equal(NULL, policy_a),
-                       " is equal (NULL, object)");
-       ok(true == lttng_rate_policy_is_equal(policy_a, policy_a),
-                       "is equal (object A, object A)");
-
-       ok(true == lttng_rate_policy_is_equal(policy_a, policy_b),
-                       "is equal (object A, object B");
-       ok(true == lttng_rate_policy_is_equal(policy_b, policy_a),
-                       "is equal (object B, object A");
+       ok(false == lttng_rate_policy_is_equal(NULL, NULL), "is equal (NULL,NULL)");
+       ok(false == lttng_rate_policy_is_equal(policy_a, NULL), "is equal (object, NULL)");
+       ok(false == lttng_rate_policy_is_equal(NULL, policy_a), " is equal (NULL, object)");
+       ok(true == lttng_rate_policy_is_equal(policy_a, policy_a), "is equal (object A, object A)");
+
+       ok(true == lttng_rate_policy_is_equal(policy_a, policy_b), "is equal (object A, object B");
+       ok(true == lttng_rate_policy_is_equal(policy_b, policy_a), "is equal (object B, object A");
 
        ok(false == lttng_rate_policy_is_equal(policy_a, policy_c),
-                       "is equal (object A, object C)");
+          "is equal (object A, object C)");
        ok(false == lttng_rate_policy_is_equal(policy_c, policy_a),
-                       "is equal (object C, object A)");
+          "is equal (object C, object A)");
 
        /* Serialization and create_from buffer. */
        ok(lttng_rate_policy_serialize(policy_a, &payload) == 0, "Serializing");
        {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
-
-               ok(lttng_rate_policy_create_from_payload(
-                                  &view, &policy_from_buffer) > 0 &&
-                                               policy_from_buffer != NULL,
-                               "Deserializing");
+               struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
+
+               ok(lttng_rate_policy_create_from_payload(&view, &policy_from_buffer) > 0 &&
+                          policy_from_buffer != NULL,
+                  "Deserializing");
        }
 
        ok(lttng_rate_policy_is_equal(policy_a, policy_from_buffer),
-                       "serialized and from buffer are equal");
+          "serialized and from buffer are equal");
 
        lttng_rate_policy_destroy(policy_a);
        lttng_rate_policy_destroy(policy_b);
index 602376c4376588f9be54888488a047d3e79c9b4c..cfd5b1a975d87fe3b5be688c49a37ef9dc491091 100644 (file)
@@ -5,15 +5,14 @@
  *
  */
 
+#include "backward-compatibility-group-by.hpp"
+
+#include <common/time.hpp>
+
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-
-#include <common/time.hpp>
-
-#include "backward-compatibility-group-by.hpp"
-
 #include <tap/tap.h>
 
 /* Number of TAP tests in this file */
@@ -36,69 +35,110 @@ int lttng_opt_mi;
 int lttng_opt_verbose;
 
 struct test tests[] = {
-               /* Default name session streaming. */
-               {"hostname/auto-20190918-164429/ust/uid/1000/64-bit",
-                               "auto-20190918-164429", "hostname",
-                               "20190918-164429", "", "ust/uid/1000/64-bit",
-                               true},
-               /* Custom default name session */
-               {"hostname/custom_auto-20190319-120000/ust/uid/1000/64-bit",
-                               "custom_auto-20190319-120000", "hostname",
-                               "20190319-120000", "", "ust/uid/1000/64-bit",
-                               true},
-               /* Named session streaming */
-               {"hostname/test-20190918-164709/ust/uid/1000/64-bit", "test",
-                               "hostname", "20190918-164709", "",
-                               "ust/uid/1000/64-bit", true},
-               /* Default session snapshot streaming */
-               {"hostname//snapshot-1-20190918-164829-0/ust//uid/1000/64-bit",
-                               "my_session", "hostname", "", "",
-                               "snapshot-1-20190918-164829-0/ust//uid/1000/64-bit",
-                               true},
-               /* Named session snapshot streaming */
-               {"hostname//snapshot-1-20190918-175919-0/ust//uid/1000/64-bit",
-                               "my_session", "hostname", "", "",
-                               "snapshot-1-20190918-175919-0/ust//uid/1000/64-bit",
-                               true},
-               /* Default name session, live */
-               {"hostname//auto-20190918-171641/ust/uid/1000/64-bit",
-                               "auto-20190918-171641", "hostname",
-                               "20190918-171641", "", "ust/uid/1000/64-bit",
-                               true},
-               /* Named session, live */
-               {"hostname//test-20190918-180333//ust/uid/1000/64-bit",
-                               "test-20190918-180333", "hostname",
-                               "20190918-180333", "", "/ust/uid/1000/64-bit",
-                               true},
-               /* Default name session, streaming & live , extra path */
-               {"hostname/extra/path/ust/uid/1000/64-bit",
-                               "auto-20190919-122110", "hostname",
-                               "20190919-122110", "extra",
-                               "path/ust/uid/1000/64-bit", true},
-               /* Named session, live, extra path */
-               {"hostname/extra/path/ust/uid/1000/64-bit", "test", "hostname",
-                               "", "extra", "path/ust/uid/1000/64-bit", true},
-               /* Named session, snapshot, extra path */
-               {"hostname/extra/path/snapshot-1-20190919-140702-0/ust//uid/1000/64-bit",
-                               "test", "hostname", "", "extra",
-                               "path/snapshot-1-20190919-140702-0/ust//uid/1000/64-bit",
-                               true},
-               /* Corner cases*/
-               /* Named session with valid datetime in it */
-               /* Default name session, extra path with session name in it*/
-               {"hostname/test-20190319-120000-20190918-180921/ust/uid/1000/64-bit",
-                               "test-20190319-120000", "hostname",
-                               "20190918-180921", "", "ust/uid/1000/64-bit",
-                               true},
-               /* Empty path */
-               {"", "test", "", "", "", "", false},
-               /* Path without second token */
-               {"hostname", "test", "hostname", "", "", "", false},
-               /* No leftover */
-               {"hostname/test", "test", "hostname", "", "", "", true},
-               /* Path with ession name but no datetime */
-               {"hostname/test/ust/uid/1000/64-bit", "test", "hostname", "",
-                               "", "ust/uid/1000/64-bit", true},
+       /* Default name session streaming. */
+       { "hostname/auto-20190918-164429/ust/uid/1000/64-bit",
+         "auto-20190918-164429",
+         "hostname",
+         "20190918-164429",
+         "",
+         "ust/uid/1000/64-bit",
+         true },
+       /* Custom default name session */
+       { "hostname/custom_auto-20190319-120000/ust/uid/1000/64-bit",
+         "custom_auto-20190319-120000",
+         "hostname",
+         "20190319-120000",
+         "",
+         "ust/uid/1000/64-bit",
+         true },
+       /* Named session streaming */
+       { "hostname/test-20190918-164709/ust/uid/1000/64-bit",
+         "test",
+         "hostname",
+         "20190918-164709",
+         "",
+         "ust/uid/1000/64-bit",
+         true },
+       /* Default session snapshot streaming */
+       { "hostname//snapshot-1-20190918-164829-0/ust//uid/1000/64-bit",
+         "my_session",
+         "hostname",
+         "",
+         "",
+         "snapshot-1-20190918-164829-0/ust//uid/1000/64-bit",
+         true },
+       /* Named session snapshot streaming */
+       { "hostname//snapshot-1-20190918-175919-0/ust//uid/1000/64-bit",
+         "my_session",
+         "hostname",
+         "",
+         "",
+         "snapshot-1-20190918-175919-0/ust//uid/1000/64-bit",
+         true },
+       /* Default name session, live */
+       { "hostname//auto-20190918-171641/ust/uid/1000/64-bit",
+         "auto-20190918-171641",
+         "hostname",
+         "20190918-171641",
+         "",
+         "ust/uid/1000/64-bit",
+         true },
+       /* Named session, live */
+       { "hostname//test-20190918-180333//ust/uid/1000/64-bit",
+         "test-20190918-180333",
+         "hostname",
+         "20190918-180333",
+         "",
+         "/ust/uid/1000/64-bit",
+         true },
+       /* Default name session, streaming & live , extra path */
+       { "hostname/extra/path/ust/uid/1000/64-bit",
+         "auto-20190919-122110",
+         "hostname",
+         "20190919-122110",
+         "extra",
+         "path/ust/uid/1000/64-bit",
+         true },
+       /* Named session, live, extra path */
+       { "hostname/extra/path/ust/uid/1000/64-bit",
+         "test",
+         "hostname",
+         "",
+         "extra",
+         "path/ust/uid/1000/64-bit",
+         true },
+       /* Named session, snapshot, extra path */
+       { "hostname/extra/path/snapshot-1-20190919-140702-0/ust//uid/1000/64-bit",
+         "test",
+         "hostname",
+         "",
+         "extra",
+         "path/snapshot-1-20190919-140702-0/ust//uid/1000/64-bit",
+         true },
+       /* Corner cases*/
+       /* Named session with valid datetime in it */
+       /* Default name session, extra path with session name in it*/
+       { "hostname/test-20190319-120000-20190918-180921/ust/uid/1000/64-bit",
+         "test-20190319-120000",
+         "hostname",
+         "20190918-180921",
+         "",
+         "ust/uid/1000/64-bit",
+         true },
+       /* Empty path */
+       { "", "test", "", "", "", "", false },
+       /* Path without second token */
+       { "hostname", "test", "hostname", "", "", "", false },
+       /* No leftover */
+       { "hostname/test", "test", "hostname", "", "", "", true },
+       /* Path with ession name but no datetime */
+       { "hostname/test/ust/uid/1000/64-bit",
+         "test",
+         "hostname",
+         "",
+         "",
+         "ust/uid/1000/64-bit",
+         true },
 };
 
 static char *craft_expected(struct test *test, time_t relay_session_creation_time)
@@ -108,20 +148,22 @@ static char *craft_expected(struct test *test, time_t relay_session_creation_tim
        char relay_session_creation_datetime[DATETIME_STR_LEN];
 
        ret = time_to_datetime_str(relay_session_creation_time,
-                       relay_session_creation_datetime,
-                       sizeof(relay_session_creation_datetime));
+                                  relay_session_creation_datetime,
+                                  sizeof(relay_session_creation_datetime));
        if (ret < 0) {
                result = NULL;
                goto end;
        }
 
-       ret = asprintf(&result, "%s/%s-%s/%s%s%s", test->session_name,
-                       test->hostname,
-                       test->creation_time[0] == '\0' ?
-                                       relay_session_creation_datetime :
-                                       test->creation_time,
-                       test->extra_path,
-                       test->extra_path[0] != '\0' ? "/" : "", test->leftover);
+       ret = asprintf(&result,
+                      "%s/%s-%s/%s%s%s",
+                      test->session_name,
+                      test->hostname,
+                      test->creation_time[0] == '\0' ? relay_session_creation_datetime :
+                                                       test->creation_time,
+                      test->extra_path,
+                      test->extra_path[0] != '\0' ? "/" : "",
+                      test->leftover);
        if (ret < 0) {
                result = NULL;
                goto end;
@@ -154,8 +196,8 @@ int main(void)
                        goto loop;
                }
 
-               result = backward_compat_group_by_session(tests[i].stream_path,
-                               tests[i].session_name, test_time);
+               result = backward_compat_group_by_session(
+                       tests[i].stream_path, tests[i].session_name, test_time);
                if (!result && tests[i].is_valid) {
                        fprintf(stderr, "Failed to get result\n");
                        goto loop;
@@ -165,8 +207,10 @@ int main(void)
                }
 
                ok(strncmp(expected, result, strlen(expected)) == 0,
-                               "In: %s, out: %s, expected: %s",
-                               tests[i].stream_path, result, expected);
+                  "In: %s, out: %s, expected: %s",
+                  tests[i].stream_path,
+                  result,
+                  expected);
        loop:
                free(expected);
                free(result);
index c19a1afddfc0a17a445b71d367b74dfaaf7444b6..1589cf78e0e02f4c2dba6dc45e4ca54608138d49 100644 (file)
@@ -5,38 +5,36 @@
  *
  */
 
+#include <common/common.hpp>
+#include <common/compat/errno.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+
+#include <bin/lttng-sessiond/health-sessiond.hpp>
+#include <bin/lttng-sessiond/session.hpp>
+#include <bin/lttng-sessiond/thread.hpp>
+#include <bin/lttng-sessiond/ust-app.hpp>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#include <tap/tap.h>
 #include <time.h>
 #include <unistd.h>
 #include <urcu.h>
 
-#include <bin/lttng-sessiond/health-sessiond.hpp>
-#include <bin/lttng-sessiond/session.hpp>
-#include <bin/lttng-sessiond/thread.hpp>
-#include <bin/lttng-sessiond/ust-app.hpp>
-#include <common/common.hpp>
-#include <common/compat/errno.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-
-#include <tap/tap.h>
-
 #define SESSION1 "test1"
 
-#define MAX_SESSIONS 10000
-#define RANDOM_STRING_LEN      11
+#define MAX_SESSIONS     10000
+#define RANDOM_STRING_LEN 11
 
 /* Number of TAP tests in this file */
 #define NUM_TESTS 11
 
 static struct ltt_session_list *session_list;
 
-static const char alphanum[] =
-       "0123456789"
-       "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-       "abcdefghijklmnopqrstuvwxyz";
+static const char alphanum[] = "0123456789"
+                              "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                              "abcdefghijklmnopqrstuvwxyz";
 static char random_string[RANDOM_STRING_LEN];
 
 /*
@@ -63,7 +61,7 @@ static int find_session_name(const char *name)
 {
        struct ltt_session *iter;
 
-       cds_list_for_each_entry(iter, &session_list->head, list) {
+       cds_list_for_each_entry (iter, &session_list->head, list) {
                if (strcmp(iter->name, name) == 0) {
                        return 0;
                }
@@ -77,7 +75,7 @@ static int session_list_count(void)
        int count = 0;
        struct ltt_session *iter;
 
-       cds_list_for_each_entry(iter, &session_list->head, list) {
+       cds_list_for_each_entry (iter, &session_list->head, list) {
                count++;
        }
        return count;
@@ -91,7 +89,7 @@ static void empty_session_list(void)
        struct ltt_session *iter, *tmp;
 
        session_lock_list();
-       cds_list_for_each_entry_safe(iter, tmp, &session_list->head, list) {
+       cds_list_for_each_entry_safe (iter, tmp, &session_list->head, list) {
                session_destroy(iter);
        }
        session_unlock_list();
@@ -202,9 +200,7 @@ static void test_session_list(void)
 
 static void test_create_one_session(void)
 {
-       ok(create_one_session(SESSION1) == 0,
-          "Create session: %s",
-          SESSION1);
+       ok(create_one_session(SESSION1) == 0, "Create session: %s", SESSION1);
 }
 
 static void test_validate_session(void)
@@ -214,12 +210,10 @@ static void test_validate_session(void)
        session_lock_list();
        tmp = session_find_by_name(SESSION1);
 
-       ok(tmp != NULL,
-          "Validating session: session found");
+       ok(tmp != NULL, "Validating session: session found");
 
        if (tmp) {
-               ok(tmp->kernel_session == NULL &&
-                  strlen(tmp->name),
+               ok(tmp->kernel_session == NULL && strlen(tmp->name),
                   "Validating session: basic sanity check");
        } else {
                skip(1, "Skipping session validation check as session was not found");
@@ -240,13 +234,10 @@ static void test_destroy_session(void)
        session_lock_list();
        tmp = session_find_by_name(SESSION1);
 
-       ok(tmp != NULL,
-          "Destroying session: session found");
+       ok(tmp != NULL, "Destroying session: session found");
 
        if (tmp) {
-               ok(destroy_one_session(tmp) == 0,
-                  "Destroying session: %s destroyed",
-                  SESSION1);
+               ok(destroy_one_session(tmp) == 0, "Destroying session: %s destroyed", SESSION1);
        } else {
                skip(1, "Skipping session destruction as it was not found");
        }
@@ -255,8 +246,7 @@ static void test_destroy_session(void)
 
 static void test_duplicate_session(void)
 {
-       ok(two_session_same_name() == 0,
-          "Duplicate session creation");
+       ok(two_session_same_name() == 0, "Duplicate session creation");
 }
 
 static void test_session_name_generation(void)
@@ -267,18 +257,18 @@ static void test_session_name_generation(void)
 
        session_lock_list();
        ret_code = session_create(NULL, geteuid(), getegid(), &session);
-       ok(ret_code == LTTNG_OK,
-               "Create session with a NULL name (auto-generate a name)");
+       ok(ret_code == LTTNG_OK, "Create session with a NULL name (auto-generate a name)");
        if (!session) {
                skip(1, "Skipping session name generation tests as session_create() failed.");
                goto end;
        }
-       diag("Automatically-generated session name: %s", *session->name ?
-               session->name : "ERROR");
-       ok(*session->name && !strncmp(expected_session_name_prefix, session->name,
-                       sizeof(DEFAULT_SESSION_NAME) - 1),
-                       "Auto-generated session name starts with %s",
-                       DEFAULT_SESSION_NAME);
+       diag("Automatically-generated session name: %s", *session->name ? session->name : "ERROR");
+       ok(*session->name &&
+                  !strncmp(expected_session_name_prefix,
+                           session->name,
+                           sizeof(DEFAULT_SESSION_NAME) - 1),
+          "Auto-generated session name starts with %s",
+          DEFAULT_SESSION_NAME);
 end:
        session_put(session);
        session_unlock_list();
@@ -298,15 +288,13 @@ static void test_large_session_number(void)
                }
        }
 
-       ok(failed == 0,
-          "Large sessions number: created %u sessions",
-          MAX_SESSIONS);
+       ok(failed == 0, "Large sessions number: created %u sessions", MAX_SESSIONS);
 
        failed = 0;
 
        session_lock_list();
        for (i = 0; i < MAX_SESSIONS; i++) {
-               cds_list_for_each_entry_safe(iter, tmp, &session_list->head, list) {
+               cds_list_for_each_entry_safe (iter, tmp, &session_list->head, list) {
                        LTTNG_ASSERT(session_get(iter));
                        ret = destroy_one_session(iter);
                        if (ret < 0) {
@@ -324,7 +312,6 @@ static void test_large_session_number(void)
 
 int main(void)
 {
-
        plan_tests(NUM_TESTS);
 
        the_health_sessiond = health_app_create(NR_HEALTH_SESSIOND_TYPES);
index ff06bf9b6774ade76bb419822fca0c3afe4532a8..239e998dce65431dba0cf15fd778153d2f69391d 100644 (file)
@@ -5,11 +5,12 @@
  *
  */
 
-#include <stdlib.h>
+#include <common/string-utils/string-utils.hpp>
+
+#include <stdarg.h>
 #include <stdbool.h>
+#include <stdlib.h>
 #include <string.h>
-#include <stdarg.h>
-#include <common/string-utils/string-utils.hpp>
 #include <tap/tap.h>
 
 /* Number of TAP tests in this file */
@@ -20,8 +21,7 @@ int lttng_opt_quiet = 1;
 int lttng_opt_verbose;
 int lttng_opt_mi;
 
-static void test_one_split(const char *input, char delim, int escape_delim,
-               ...)
+static void test_one_split(const char *input, char delim, int escape_delim, ...)
 {
        va_list vl;
        bool all_ok = true;
@@ -38,8 +38,7 @@ static void test_one_split(const char *input, char delim, int escape_delim,
        for (i = 0; i < string_count; i++) {
                const char *expected_substring = va_arg(vl, const char *);
                const char *substring =
-                       (const char *) lttng_dynamic_pointer_array_get_pointer(
-                               &strings, i);
+                       (const char *) lttng_dynamic_pointer_array_get_pointer(&strings, i);
 
                diag("  got `%s`, expecting `%s`", substring, expected_substring);
 
@@ -56,8 +55,11 @@ static void test_one_split(const char *input, char delim, int escape_delim,
 
        lttng_dynamic_pointer_array_reset(&strings);
        va_end(vl);
-       ok(all_ok, "strutils_split() produces the expected substrings: `%s` (delim. `%c`, escape `%d`)",
-                       input, delim, escape_delim);
+       ok(all_ok,
+          "strutils_split() produces the expected substrings: `%s` (delim. `%c`, escape `%d`)",
+          input,
+          delim,
+          escape_delim);
 }
 
 static void test_split(void)
@@ -84,8 +86,9 @@ static void test_split(void)
 static void test_one_is_star_at_the_end_only_glob_pattern(const char *pattern, bool expected)
 {
        ok(strutils_is_star_at_the_end_only_glob_pattern(pattern) == expected,
-               "strutils_is_star_at_the_end_only_glob_pattern() returns the expected result: `%s` -> %d",
-               pattern, expected);
+          "strutils_is_star_at_the_end_only_glob_pattern() returns the expected result: `%s` -> %d",
+          pattern,
+          expected);
 }
 
 static void test_is_star_at_the_end_only_glob_pattern(void)
@@ -105,8 +108,9 @@ static void test_is_star_at_the_end_only_glob_pattern(void)
 static void test_one_is_star_glob_pattern(const char *pattern, bool expected)
 {
        ok(strutils_is_star_glob_pattern(pattern) == expected,
-               "strutils_is_star_glob_pattern() returns the expected result: `%s` -> %d",
-               pattern, expected);
+          "strutils_is_star_glob_pattern() returns the expected result: `%s` -> %d",
+          pattern,
+          expected);
 }
 
 static void test_is_star_glob_pattern(void)
@@ -128,16 +132,16 @@ static void test_is_star_glob_pattern(void)
        test_one_is_star_glob_pattern("allo\\", false);
 }
 
-static void test_one_normalize_star_glob_pattern(const char *pattern,
-               const char *expected)
+static void test_one_normalize_star_glob_pattern(const char *pattern, const char *expected)
 {
        char *rw_pattern = strdup(pattern);
 
        LTTNG_ASSERT(rw_pattern);
        strutils_normalize_star_glob_pattern(rw_pattern);
        ok(strcmp(rw_pattern, expected) == 0,
-               "strutils_normalize_star_glob_pattern() produces the expected result: `%s` -> `%s`",
-               pattern, expected);
+          "strutils_normalize_star_glob_pattern() produces the expected result: `%s` -> `%s`",
+          pattern,
+          expected);
        free(rw_pattern);
 }
 
index 2ff65a679749838586fb47846306a740cc0b3f0f..2c23b669c2d800bf35e7b528b0e346f3bc0ef1a5 100644 (file)
@@ -5,28 +5,30 @@
  *
  */
 
-#include <algorithm>
 #include <common/compat/fcntl.hpp>
-#include <common/sessiond-comm/sessiond-comm.hpp>
-#include <common/payload.hpp>
+#include <common/defaults.hpp>
+#include <common/error.hpp>
 #include <common/payload-view.hpp>
+#include <common/payload.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
 #include <common/unix.hpp>
 #include <common/utils.hpp>
-#include <common/defaults.hpp>
-#include <tap/tap.h>
-#include <stdbool.h>
-#include <common/error.hpp>
+
 #include <lttng/constant.h>
-#include <stdio.h>
+
+#include <algorithm>
 #include <pthread.h>
-#include <unistd.h>
-#include <sys/wait.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <sys/wait.h>
+#include <tap/tap.h>
+#include <unistd.h>
 
-#define HIGH_FD_COUNT LTTCOMM_MAX_SEND_FDS
-#define MESSAGE_COUNT 4
-#define LARGE_PAYLOAD_SIZE 4 * 1024
-#define LARGE_PAYLOAD_RECV_SIZE        100
+#define HIGH_FD_COUNT          LTTCOMM_MAX_SEND_FDS
+#define MESSAGE_COUNT          4
+#define LARGE_PAYLOAD_SIZE     4 * 1024
+#define LARGE_PAYLOAD_RECV_SIZE 100
 
 static const int TEST_COUNT = 37;
 
@@ -40,7 +42,7 @@ int lttng_opt_mi;
  */
 static void test_high_fd_count(unsigned int fd_count)
 {
-       int sockets[2] = {-1, -1};
+       int sockets[2] = { -1, -1 };
        int ret;
        unsigned int i;
        const unsigned int payload_content = 42;
@@ -59,8 +61,8 @@ static void test_high_fd_count(unsigned int fd_count)
        }
 
        /* Add dummy content to payload. */
-       ret = lttng_dynamic_buffer_append(&sent_payload.buffer,
-                       &payload_content, sizeof(payload_content));
+       ret = lttng_dynamic_buffer_append(
+               &sent_payload.buffer, &payload_content, sizeof(payload_content));
        if (ret) {
                PERROR("Failed to initialize test payload");
                goto error;
@@ -94,29 +96,30 @@ static void test_high_fd_count(unsigned int fd_count)
        /* Send payload. */
        {
                ssize_t sock_ret;
-               struct lttng_payload_view pv = lttng_payload_view_from_payload(
-                               &sent_payload, 0, -1);
+               struct lttng_payload_view pv =
+                       lttng_payload_view_from_payload(&sent_payload, 0, -1);
 
                /* Not expected to block considering the size of the payload. */
-               sock_ret = lttcomm_send_unix_sock(
-                               sockets[0], pv.buffer.data, pv.buffer.size);
+               sock_ret = lttcomm_send_unix_sock(sockets[0], pv.buffer.data, pv.buffer.size);
                ok(sock_ret == pv.buffer.size, "Sent complete test payload");
                if (sock_ret != pv.buffer.size) {
                        ERR("Failed to send test payload bytes: ret = %zd, expected = %zu",
-                                       sock_ret, pv.buffer.size);
+                           sock_ret,
+                           pv.buffer.size);
                        goto error;
                }
 
-               sock_ret = lttcomm_send_payload_view_fds_unix_sock(
-                               sockets[0], &pv);
+               sock_ret = lttcomm_send_payload_view_fds_unix_sock(sockets[0], &pv);
                ok(sock_ret == 1, "Sent test payload file descriptors");
                if (sock_ret != 1) {
                        if (sock_ret < 0) {
                                PERROR("Failed to send test payload file descriptors: ret = %zd, expected = %d",
-                                               sock_ret, 1);
+                                      sock_ret,
+                                      1);
                        } else {
                                diag("Failed to send test payload file descriptors: ret = %zd, expected = %d",
-                                               sock_ret, 1);
+                                    sock_ret,
+                                    1);
                        }
 
                        goto error;
@@ -128,45 +131,40 @@ static void test_high_fd_count(unsigned int fd_count)
                ssize_t sock_ret;
 
                ret = lttng_dynamic_buffer_set_size(&received_payload.buffer,
-                               sent_payload.buffer.size);
+                                                   sent_payload.buffer.size);
                if (ret) {
                        PERROR("Failed to pre-allocate reception buffer");
                        goto error;
                }
 
-               sock_ret = lttcomm_recv_unix_sock(sockets[1],
-                               received_payload.buffer.data,
-                               received_payload.buffer.size);
-               ok(sock_ret == received_payload.buffer.size,
-                               "Received payload bytes");
+               sock_ret = lttcomm_recv_unix_sock(
+                       sockets[1], received_payload.buffer.data, received_payload.buffer.size);
+               ok(sock_ret == received_payload.buffer.size, "Received payload bytes");
                if (sock_ret != received_payload.buffer.size) {
                        ERR("Failed to receive payload bytes: ret = %zd, expected = %zu",
-                                       sock_ret, received_payload.buffer.size);
+                           sock_ret,
+                           received_payload.buffer.size);
                        goto error;
                }
 
-               sock_ret = lttcomm_recv_payload_fds_unix_sock(
-                               sockets[1], fd_count, &received_payload);
+               sock_ret =
+                       lttcomm_recv_payload_fds_unix_sock(sockets[1], fd_count, &received_payload);
                ok(sock_ret == (int) (sizeof(int) * fd_count),
-                               "FD reception return value is number of fd * sizeof(int)");
+                  "FD reception return value is number of fd * sizeof(int)");
                if (sock_ret != (int) (sizeof(int) * fd_count)) {
                        ERR("Failed to receive test payload file descriptors: ret = %zd, expected = %d",
-                                       sock_ret,
-                                       (int) (fd_count * sizeof(int)));
+                           sock_ret,
+                           (int) (fd_count * sizeof(int)));
                        goto error;
                }
 
                {
                        const struct lttng_payload_view pv =
-                                       lttng_payload_view_from_payload(
-                                                       &received_payload, 0,
-                                                       -1);
-                       const int fd_handle_count =
-                                       lttng_payload_view_get_fd_handle_count(
-                                                       &pv);
+                               lttng_payload_view_from_payload(&received_payload, 0, -1);
+                       const int fd_handle_count = lttng_payload_view_get_fd_handle_count(&pv);
 
                        ok(fd_handle_count == fd_count,
-                                       "Received all test payload file descriptors in one invocation");
+                          "Received all test payload file descriptors in one invocation");
                }
        }
 
@@ -193,14 +191,13 @@ error:
 static void test_one_fd_per_message(unsigned int message_count)
 {
        const unsigned int payload_content = 42;
-       int sockets[2] = {-1, -1};
+       int sockets[2] = { -1, -1 };
        int ret;
        unsigned int i;
        struct lttng_payload sent_payload;
        struct lttng_payload received_payload;
 
-       diag("Send and receive small messages with one FD each (%u messages)",
-                       message_count);
+       diag("Send and receive small messages with one FD each (%u messages)", message_count);
        lttng_payload_init(&sent_payload);
        lttng_payload_init(&received_payload);
 
@@ -217,8 +214,8 @@ static void test_one_fd_per_message(unsigned int message_count)
                int fd;
 
                /* Add dummy content to payload. */
-               ret = lttng_dynamic_buffer_append(&sent_payload.buffer,
-                               &payload_content, sizeof(payload_content));
+               ret = lttng_dynamic_buffer_append(
+                       &sent_payload.buffer, &payload_content, sizeof(payload_content));
                if (ret) {
                        PERROR("Failed to initialize test payload");
                        goto error;
@@ -249,34 +246,31 @@ static void test_one_fd_per_message(unsigned int message_count)
                {
                        ssize_t sock_ret;
                        struct lttng_payload_view pv =
-                                       lttng_payload_view_from_payload(
-                                                       &sent_payload, 0, -1);
+                               lttng_payload_view_from_payload(&sent_payload, 0, -1);
 
                        /* Not expected to block considering the size of the
                         * payload. */
-                       sock_ret = lttcomm_send_unix_sock(sockets[0],
-                                       pv.buffer.data, pv.buffer.size);
-                       ok(sock_ret == pv.buffer.size,
-                                       "Sent binary payload for message %u",
-                                       i);
+                       sock_ret =
+                               lttcomm_send_unix_sock(sockets[0], pv.buffer.data, pv.buffer.size);
+                       ok(sock_ret == pv.buffer.size, "Sent binary payload for message %u", i);
                        if (sock_ret != pv.buffer.size) {
                                ERR("Failed to send test payload bytes: ret = %zd, expected = %zu",
-                                               sock_ret, pv.buffer.size);
+                                   sock_ret,
+                                   pv.buffer.size);
                                goto error;
                        }
 
-                       sock_ret = lttcomm_send_payload_view_fds_unix_sock(
-                                       sockets[0], &pv);
-                       ok(sock_ret == 1,
-                                       "Sent file descriptors payload for message %u",
-                                       i);
+                       sock_ret = lttcomm_send_payload_view_fds_unix_sock(sockets[0], &pv);
+                       ok(sock_ret == 1, "Sent file descriptors payload for message %u", i);
                        if (sock_ret != 1) {
                                if (sock_ret < 0) {
                                        PERROR("Failed to send test payload file descriptors: ret = %zd, expected = %d",
-                                                       sock_ret, 1);
+                                              sock_ret,
+                                              1);
                                } else {
                                        diag("Failed to send test payload file descriptors: ret = %zd, expected = %d",
-                                                       sock_ret, 1);
+                                            sock_ret,
+                                            1);
                                }
 
                                goto error;
@@ -291,45 +285,39 @@ static void test_one_fd_per_message(unsigned int message_count)
                ssize_t sock_ret;
 
                ret = lttng_dynamic_buffer_set_size(&received_payload.buffer,
-                               sizeof(payload_content));
+                                                   sizeof(payload_content));
                if (ret) {
                        PERROR("Failed to pre-allocate reception buffer");
                        goto error;
                }
 
-               sock_ret = lttcomm_recv_unix_sock(sockets[1],
-                               received_payload.buffer.data,
-                               received_payload.buffer.size);
+               sock_ret = lttcomm_recv_unix_sock(
+                       sockets[1], received_payload.buffer.data, received_payload.buffer.size);
                ok(sock_ret == received_payload.buffer.size,
-                               "Received payload bytes for message %u", i);
+                  "Received payload bytes for message %u",
+                  i);
                if (sock_ret != received_payload.buffer.size) {
                        ERR("Failed to receive payload bytes: ret = %zd, expected = %zu",
-                                       sock_ret, received_payload.buffer.size);
+                           sock_ret,
+                           received_payload.buffer.size);
                        goto error;
                }
 
-               sock_ret = lttcomm_recv_payload_fds_unix_sock(
-                               sockets[1], 1, &received_payload);
-               ok(sock_ret == (int) sizeof(int), "Received fd for message %u",
-                               i);
+               sock_ret = lttcomm_recv_payload_fds_unix_sock(sockets[1], 1, &received_payload);
+               ok(sock_ret == (int) sizeof(int), "Received fd for message %u", i);
                if (sock_ret != (int) sizeof(int)) {
                        ERR("Failed to receive test payload file descriptors: ret = %zd, expected = %u",
-                                       sock_ret, (int) sizeof(int));
+                           sock_ret,
+                           (int) sizeof(int));
                        goto error;
                }
 
                {
                        const struct lttng_payload_view pv =
-                                       lttng_payload_view_from_payload(
-                                                       &received_payload, 0,
-                                                       -1);
-                       const int fd_handle_count =
-                                       lttng_payload_view_get_fd_handle_count(
-                                                       &pv);
+                               lttng_payload_view_from_payload(&received_payload, 0, -1);
+                       const int fd_handle_count = lttng_payload_view_get_fd_handle_count(&pv);
 
-                       ok(fd_handle_count == 1,
-                                       "Payload contains 1 fd for message %u",
-                                       i);
+                       ok(fd_handle_count == 1, "Payload contains 1 fd for message %u", i);
                }
 
                lttng_payload_clear(&received_payload);
@@ -353,10 +341,9 @@ error:
 /*
  * Validate that a large message can be received in multiple chunks.
  */
-static void test_receive_in_chunks(
-               unsigned int payload_size, unsigned int max_recv_size)
+static void test_receive_in_chunks(unsigned int payload_size, unsigned int max_recv_size)
 {
-       int sockets[2] = {-1, -1};
+       int sockets[2] = { -1, -1 };
        int ret;
        unsigned int i;
        struct lttng_payload sent_payload;
@@ -406,29 +393,30 @@ static void test_receive_in_chunks(
 
        /* Send payload. */
        {
-               struct lttng_payload_view pv = lttng_payload_view_from_payload(
-                               &sent_payload, 0, -1);
+               struct lttng_payload_view pv =
+                       lttng_payload_view_from_payload(&sent_payload, 0, -1);
 
                /* Not expected to block considering the size of the payload. */
-               sock_ret = lttcomm_send_unix_sock(
-                               sockets[0], pv.buffer.data, pv.buffer.size);
+               sock_ret = lttcomm_send_unix_sock(sockets[0], pv.buffer.data, pv.buffer.size);
                ok(sock_ret == pv.buffer.size, "Sent complete test payload");
                if (sock_ret != pv.buffer.size) {
                        ERR("Failed to send test payload bytes: ret = %zd, expected = %zu",
-                                       sock_ret, pv.buffer.size);
+                           sock_ret,
+                           pv.buffer.size);
                        goto error;
                }
 
-               sock_ret = lttcomm_send_payload_view_fds_unix_sock(
-                               sockets[0], &pv);
+               sock_ret = lttcomm_send_payload_view_fds_unix_sock(sockets[0], &pv);
                ok(sock_ret == 1, "Sent test payload file descriptors");
                if (sock_ret != 1) {
                        if (sock_ret < 0) {
                                PERROR("Failed to send test payload file descriptors: ret = %zd, expected = %d",
-                                               sock_ret, 1);
+                                      sock_ret,
+                                      1);
                        } else {
                                diag("Failed to send test payload file descriptors: ret = %zd, expected = %d",
-                                               sock_ret, 1);
+                                    sock_ret,
+                                    1);
                        }
 
                        goto error;
@@ -436,8 +424,7 @@ static void test_receive_in_chunks(
        }
 
        /* Receive payload */
-       ret = lttng_dynamic_buffer_set_size(
-                       &received_payload.buffer, sent_payload.buffer.size);
+       ret = lttng_dynamic_buffer_set_size(&received_payload.buffer, sent_payload.buffer.size);
        if (ret) {
                PERROR("Failed to pre-allocate reception buffer");
                goto error;
@@ -445,15 +432,14 @@ static void test_receive_in_chunks(
 
        do {
                const ssize_t to_receive_this_pass =
-                       std::min<ssize_t>(max_recv_size,
-                               sent_payload.buffer.size - received);
+                       std::min<ssize_t>(max_recv_size, sent_payload.buffer.size - received);
 
-               sock_ret = lttcomm_recv_unix_sock(sockets[1],
-                               received_payload.buffer.data + received,
-                               to_receive_this_pass);
+               sock_ret = lttcomm_recv_unix_sock(
+                       sockets[1], received_payload.buffer.data + received, to_receive_this_pass);
                if (sock_ret != to_receive_this_pass) {
                        ERR("Failed to receive payload bytes: ret = %zd, expected = %zu",
-                                       sock_ret, to_receive_this_pass);
+                           sock_ret,
+                           to_receive_this_pass);
                        break;
                }
 
@@ -461,31 +447,28 @@ static void test_receive_in_chunks(
        } while (received < sent_payload.buffer.size);
 
        ok(received == sent_payload.buffer.size,
-                       "Received complete payload in chunks of %u bytes",
-                       max_recv_size);
+          "Received complete payload in chunks of %u bytes",
+          max_recv_size);
        if (received != sent_payload.buffer.size) {
                goto error;
        }
 
-       sock_ret = lttcomm_recv_payload_fds_unix_sock(
-                       sockets[1], 1, &received_payload);
+       sock_ret = lttcomm_recv_payload_fds_unix_sock(sockets[1], 1, &received_payload);
        ok(sock_ret == (int) sizeof(int),
-                       "Received file descriptor after receiving payload in chunks");
+          "Received file descriptor after receiving payload in chunks");
        if (sock_ret != (int) sizeof(int)) {
                ERR("Failed to receive test payload file descriptors: ret = %zd, expected = %d",
-                               sock_ret, (int) sizeof(int));
+                   sock_ret,
+                   (int) sizeof(int));
                goto error;
        }
 
        {
                const struct lttng_payload_view pv =
-                               lttng_payload_view_from_payload(
-                                               &received_payload, 0, -1);
-               const int fd_handle_count =
-                               lttng_payload_view_get_fd_handle_count(&pv);
+                       lttng_payload_view_from_payload(&received_payload, 0, -1);
+               const int fd_handle_count = lttng_payload_view_get_fd_handle_count(&pv);
 
-               ok(fd_handle_count == 1,
-                               "Payload contains 1 fd after receiving payload in chunks");
+               ok(fd_handle_count == 1, "Payload contains 1 fd after receiving payload in chunks");
        }
 
 error:
@@ -503,8 +486,7 @@ error:
        lttng_payload_reset(&received_payload);
 }
 
-static
-void test_creds_passing(void)
+static void test_creds_passing(void)
 {
        pid_t fork_ret = -1;
        int ret, parent_socket = -1, child_connection_socket = -1;
@@ -524,10 +506,8 @@ void test_creds_passing(void)
                goto error;
        }
 
-       strncat(socket_path, socket_dir_path,
-                       sizeof(socket_path) - strlen(socket_path) - 1);
-       strncat(socket_path, "/test_unix_socket",
-                       sizeof(socket_path) - strlen(socket_path) - 1);
+       strncat(socket_path, socket_dir_path, sizeof(socket_path) - strlen(socket_path) - 1);
+       strncat(socket_path, "/test_unix_socket", sizeof(socket_path) - strlen(socket_path) - 1);
 
        parent_socket = lttcomm_create_unix_sock(socket_path);
        ok(parent_socket >= 0, "Created unix socket at path `%s`", socket_path);
@@ -575,8 +555,8 @@ void test_creds_passing(void)
                        PERROR("Failed to set SO_PASSCRED on child socket");
                }
 
-               sock_ret = lttcomm_send_creds_unix_sock(child_socket, &expected_creds,
-                               sizeof(expected_creds));
+               sock_ret = lttcomm_send_creds_unix_sock(
+                       child_socket, &expected_creds, sizeof(expected_creds));
                if (sock_ret < 0) {
                        PERROR("Failed to send expected credentials");
                }
@@ -591,23 +571,22 @@ void test_creds_passing(void)
                pid_t wait_pid_ret;
                lttng_sock_cred received_creds = {};
 
-               child_connection_socket =
-                               lttcomm_accept_unix_sock(parent_socket);
+               child_connection_socket = lttcomm_accept_unix_sock(parent_socket);
                if (child_connection_socket < 0) {
                        PERROR();
                        goto error;
                }
 
-               ret = lttcomm_setsockopt_creds_unix_sock(
-                               child_connection_socket);
+               ret = lttcomm_setsockopt_creds_unix_sock(child_connection_socket);
                if (ret) {
                        PERROR("Failed to set SO_PASSCRED on child connection socket");
                        goto error;
                }
 
                sock_ret = lttcomm_recv_creds_unix_sock(child_connection_socket,
-                               &expected_creds, sizeof(expected_creds),
-                               &received_creds);
+                                                       &expected_creds,
+                                                       sizeof(expected_creds),
+                                                       &received_creds);
                if (sock_ret < 0) {
                        PERROR("Failed to receive credentials");
                        goto error;
@@ -624,14 +603,17 @@ void test_creds_passing(void)
                }
 
                ok(expected_creds.euid == received_creds.uid,
-                               "Received the expected effective uid (%d == %d)",
-                               expected_creds.euid, received_creds.uid);
+                  "Received the expected effective uid (%d == %d)",
+                  expected_creds.euid,
+                  received_creds.uid);
                ok(expected_creds.egid == received_creds.gid,
-                               "Received the expected effective gid (%d == %d)",
-                               expected_creds.egid, received_creds.gid);
+                  "Received the expected effective gid (%d == %d)",
+                  expected_creds.egid,
+                  received_creds.gid);
                ok(expected_creds.pid == received_creds.pid,
-                               "Received the expected pid (%d == %d)",
-                               expected_creds.pid, received_creds.pid);
+                  "Received the expected pid (%d == %d)",
+                  expected_creds.pid,
+                  received_creds.pid);
        }
 
 error:
@@ -659,14 +641,12 @@ error:
 
                ret = unlink(socket_path);
                if (ret) {
-                       PERROR("Failed to unlink socket at path `%s`",
-                                       socket_path);
+                       PERROR("Failed to unlink socket at path `%s`", socket_path);
                }
 
                ret = rmdir(socket_dir_path);
                if (ret) {
-                       PERROR("Failed to remove test directory at `%s`",
-                                       socket_dir_path);
+                       PERROR("Failed to remove test directory at `%s`", socket_dir_path);
                }
        }
 }
index e89396e34ed28ebd7fa047221177d5492e953cb4..558948040e486516586521d330870307e9a39d84 100644 (file)
@@ -5,12 +5,11 @@
  *
  */
 
-#include <string.h>
+#include <common/uri.hpp>
 
+#include <string.h>
 #include <tap/tap.h>
 
-#include <common/uri.hpp>
-
 /* For error.h */
 int lttng_opt_quiet = 1;
 int lttng_opt_verbose = 3;
@@ -29,19 +28,11 @@ static void test_uri_parsing(void)
 
        size = uri_parse(s_uri1, &uri);
 
-       ok(size == 2 &&
-          uri[0].dtype == LTTNG_DST_IPV4 &&
-          uri[0].utype == LTTNG_URI_DST &&
-          uri[0].stype == 0 &&
-          uri[0].port == 0 &&
-          strlen(uri[0].subdir) == 0 &&
-          strcmp(uri[0].dst.ipv4, "127.0.0.1") == 0 &&
-          uri[1].dtype == LTTNG_DST_IPV4 &&
-          uri[1].utype == LTTNG_URI_DST &&
-          uri[1].stype == 0 &&
-          uri[1].port == 0 &&
-          strlen(uri[1].subdir) == 0 &&
-          strcmp(uri[1].dst.ipv4, "127.0.0.1") == 0,
+       ok(size == 2 && uri[0].dtype == LTTNG_DST_IPV4 && uri[0].utype == LTTNG_URI_DST &&
+                  uri[0].stype == 0 && uri[0].port == 0 && strlen(uri[0].subdir) == 0 &&
+                  strcmp(uri[0].dst.ipv4, "127.0.0.1") == 0 && uri[1].dtype == LTTNG_DST_IPV4 &&
+                  uri[1].utype == LTTNG_URI_DST && uri[1].stype == 0 && uri[1].port == 0 &&
+                  strlen(uri[1].subdir) == 0 && strcmp(uri[1].dst.ipv4, "127.0.0.1") == 0,
           "URI set to net://localhost");
 
        if (uri) {
@@ -53,19 +44,12 @@ static void test_uri_parsing(void)
 
        size = uri_parse(s_uri1, &uri);
 
-       ok(size == 2 &&
-          uri[0].dtype == LTTNG_DST_IPV4 &&
-          uri[0].utype == LTTNG_URI_DST &&
-          uri[0].stype == 0 &&
-          uri[0].port == 8989 &&
-          strcmp(uri[0].subdir, "my/test/path") == 0 &&
-          strcmp(uri[0].dst.ipv4, "127.0.0.1") == 0 &&
-          uri[1].dtype == LTTNG_DST_IPV4 &&
-          uri[1].utype == LTTNG_URI_DST &&
-          uri[1].stype == 0 &&
-          uri[1].port == 4242 &&
-          strlen(uri[1].subdir) == 0 &&
-          strcmp(uri[1].dst.ipv4, "127.0.0.1") == 0,
+       ok(size == 2 && uri[0].dtype == LTTNG_DST_IPV4 && uri[0].utype == LTTNG_URI_DST &&
+                  uri[0].stype == 0 && uri[0].port == 8989 &&
+                  strcmp(uri[0].subdir, "my/test/path") == 0 &&
+                  strcmp(uri[0].dst.ipv4, "127.0.0.1") == 0 && uri[1].dtype == LTTNG_DST_IPV4 &&
+                  uri[1].utype == LTTNG_URI_DST && uri[1].stype == 0 && uri[1].port == 4242 &&
+                  strlen(uri[1].subdir) == 0 && strcmp(uri[1].dst.ipv4, "127.0.0.1") == 0,
           "URI set to net://localhost:8989:4242/my/test/path");
 
        if (uri) {
@@ -77,19 +61,11 @@ static void test_uri_parsing(void)
 
        size = uri_parse(s_uri1, &uri);
 
-       ok(size == 2 &&
-          uri[0].dtype == LTTNG_DST_IPV4 &&
-          uri[0].utype == LTTNG_URI_DST &&
-          uri[0].stype == 0 &&
-          uri[0].port == 8989 &&
-          strlen(uri[0].subdir) == 0 &&
-          strcmp(uri[0].dst.ipv4, "127.0.0.1") == 0 &&
-          uri[1].dtype == LTTNG_DST_IPV4 &&
-          uri[1].utype == LTTNG_URI_DST &&
-          uri[1].stype == 0 &&
-          uri[1].port == 4242 &&
-          strlen(uri[1].subdir) == 0 &&
-          strcmp(uri[1].dst.ipv4, "127.0.0.1") == 0,
+       ok(size == 2 && uri[0].dtype == LTTNG_DST_IPV4 && uri[0].utype == LTTNG_URI_DST &&
+                  uri[0].stype == 0 && uri[0].port == 8989 && strlen(uri[0].subdir) == 0 &&
+                  strcmp(uri[0].dst.ipv4, "127.0.0.1") == 0 && uri[1].dtype == LTTNG_DST_IPV4 &&
+                  uri[1].utype == LTTNG_URI_DST && uri[1].stype == 0 && uri[1].port == 4242 &&
+                  strlen(uri[1].subdir) == 0 && strcmp(uri[1].dst.ipv4, "127.0.0.1") == 0,
           "URI set to net://localhost:8989:4242");
 
        if (uri) {
@@ -101,19 +77,11 @@ static void test_uri_parsing(void)
 
        size = uri_parse(s_uri1, &uri);
 
-       ok(size == 2 &&
-          uri[0].dtype == LTTNG_DST_IPV6 &&
-          uri[0].utype == LTTNG_URI_DST &&
-          uri[0].stype == 0 &&
-          uri[0].port == 8989 &&
-          strlen(uri[0].subdir) == 0 &&
-          strcmp(uri[0].dst.ipv6, "::1") == 0 &&
-          uri[1].dtype == LTTNG_DST_IPV6 &&
-          uri[1].utype == LTTNG_URI_DST &&
-          uri[1].stype == 0 &&
-          uri[1].port == 0 &&
-          strlen(uri[1].subdir) == 0 &&
-          strcmp(uri[1].dst.ipv6, "::1") == 0,
+       ok(size == 2 && uri[0].dtype == LTTNG_DST_IPV6 && uri[0].utype == LTTNG_URI_DST &&
+                  uri[0].stype == 0 && uri[0].port == 8989 && strlen(uri[0].subdir) == 0 &&
+                  strcmp(uri[0].dst.ipv6, "::1") == 0 && uri[1].dtype == LTTNG_DST_IPV6 &&
+                  uri[1].utype == LTTNG_URI_DST && uri[1].stype == 0 && uri[1].port == 0 &&
+                  strlen(uri[1].subdir) == 0 && strcmp(uri[1].dst.ipv6, "::1") == 0,
           "URI set to net6://[::1]:8989");
 
        if (uri) {
@@ -125,13 +93,10 @@ static void test_uri_parsing(void)
 
        size = uri_parse(s_uri1, &uri);
 
-       ok(size == 1 &&
-          uri[0].dtype == LTTNG_DST_IPV4 &&
-          uri[0].utype == LTTNG_URI_DST &&
-          uri[0].stype == 0 &&
-          uri[0].port == 0 &&
-          strcmp(uri[0].subdir, "my/test/path") == 0 &&
-          strcmp(uri[0].dst.ipv4, "42.42.42.42") == 0,
+       ok(size == 1 && uri[0].dtype == LTTNG_DST_IPV4 && uri[0].utype == LTTNG_URI_DST &&
+                  uri[0].stype == 0 && uri[0].port == 0 &&
+                  strcmp(uri[0].subdir, "my/test/path") == 0 &&
+                  strcmp(uri[0].dst.ipv4, "42.42.42.42") == 0,
           "URI set to tcp://42.42.42.42/my/test/path");
 
        if (uri) {
@@ -143,13 +108,10 @@ static void test_uri_parsing(void)
 
        size = uri_parse(s_uri1, &uri);
 
-       ok(size == 1 &&
-          uri[0].dtype == LTTNG_DST_IPV6 &&
-          uri[0].utype == LTTNG_URI_DST &&
-          uri[0].stype == 0 &&
-          uri[0].port == 0 &&
-          strcmp(uri[0].subdir, "my/test/path") == 0 &&
-          strcmp(uri[0].dst.ipv6, "fe80::f66d:4ff:fe53:d220") == 0,
+       ok(size == 1 && uri[0].dtype == LTTNG_DST_IPV6 && uri[0].utype == LTTNG_URI_DST &&
+                  uri[0].stype == 0 && uri[0].port == 0 &&
+                  strcmp(uri[0].subdir, "my/test/path") == 0 &&
+                  strcmp(uri[0].dst.ipv6, "fe80::f66d:4ff:fe53:d220") == 0,
           "URI set to tcp6://[fe80::f66d:4ff:fe53:d220]/my/test/path");
 
        if (uri) {
@@ -161,13 +123,9 @@ static void test_uri_parsing(void)
 
        size = uri_parse(s_uri1, &uri);
 
-       ok(size == 1 &&
-          uri[0].dtype == LTTNG_DST_PATH &&
-          uri[0].utype == LTTNG_URI_DST &&
-          uri[0].stype == 0 &&
-          uri[0].port == 0 &&
-          strlen(uri[0].subdir) == 0 &&
-          strcmp(uri[0].dst.path, "/my/test/path") == 0,
+       ok(size == 1 && uri[0].dtype == LTTNG_DST_PATH && uri[0].utype == LTTNG_URI_DST &&
+                  uri[0].stype == 0 && uri[0].port == 0 && strlen(uri[0].subdir) == 0 &&
+                  strcmp(uri[0].dst.path, "/my/test/path") == 0,
           "URI set to file:///my/test/path");
 
        if (uri) {
@@ -230,13 +188,11 @@ static void test_uri_cmp(void)
 
        res = uri_compare(uri1, uri1);
 
-       ok(res == 0,
-          "URI compare net://localhost == net://localhost");
+       ok(res == 0, "URI compare net://localhost == net://localhost");
 
        res = uri_compare(uri1, uri2);
 
-       ok(res != 0,
-          "URI compare net://localhost != net://localhost:8989:4242");
+       ok(res != 0, "URI compare net://localhost != net://localhost:8989:4242");
 
        uri_free(uri1);
        uri_free(uri2);
index cdd9cbd66dd033a3e6b60486562a6107a6722c4f..ac03a4f3f800043b4bf36f9d63ddb0fb2b708676 100644 (file)
@@ -5,39 +5,37 @@
  *
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <urcu.h>
+#include <common/compat/errno.hpp>
+#include <common/defaults.hpp>
 
 #include <lttng/lttng.h>
+#include <lttng/ust-sigbus.h>
+
 #include <bin/lttng-sessiond/lttng-ust-abi.hpp>
-#include <common/defaults.hpp>
-#include <common/compat/errno.hpp>
+#include <bin/lttng-sessiond/notification-thread.hpp>
 #include <bin/lttng-sessiond/trace-ust.hpp>
 #include <bin/lttng-sessiond/ust-app.hpp>
-#include <bin/lttng-sessiond/notification-thread.hpp>
-
-#include <lttng/ust-sigbus.h>
-
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <tap/tap.h>
+#include <time.h>
+#include <unistd.h>
+#include <urcu.h>
 
 /* This path will NEVER be created in this test */
 #define PATH1 "/tmp/.test-junk-lttng"
 
-#define RANDOM_STRING_LEN      11
+#define RANDOM_STRING_LEN 11
 
 /* Number of TAP tests in this file */
 #define NUM_TESTS 16
 
 LTTNG_EXPORT DEFINE_LTTNG_UST_SIGBUS_STATE();
 
-static const char alphanum[] =
-       "0123456789"
-       "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-       "abcdefghijklmnopqrstuvwxyz";
+static const char alphanum[] = "0123456789"
+                              "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                              "abcdefghijklmnopqrstuvwxyz";
 static char random_string[RANDOM_STRING_LEN];
 
 /*
@@ -59,8 +57,7 @@ static char *get_random_string(void)
 
 static void test_create_one_ust_session(void)
 {
-       struct ltt_ust_session *usess =
-               trace_ust_create_session(42);
+       struct ltt_ust_session *usess = trace_ust_create_session(42);
 
        ok(usess != NULL, "Create UST session");
 
@@ -69,11 +66,8 @@ static void test_create_one_ust_session(void)
                return;
        }
 
-       ok(usess->id == 42 &&
-          usess->active == 0 &&
-          usess->domain_global.channels != NULL &&
-          usess->uid == 0 &&
-          usess->gid == 0,
+       ok(usess->id == 42 && usess->active == 0 && usess->domain_global.channels != NULL &&
+                  usess->uid == 0 && usess->gid == 0,
           "Validate UST session");
 
        trace_ust_destroy_session(usess);
@@ -91,7 +85,7 @@ static void test_create_ust_channel(void)
        attr.attr.extended.ptr = &extended;
 
        ok(lttng_strncpy(attr.name, "channel0", sizeof(attr.name)) == 0,
-               "Validate channel name length");
+          "Validate channel name length");
        uchan = trace_ust_create_channel(&attr, LTTNG_DOMAIN_UST);
        ok(uchan != NULL, "Create UST channel");
 
@@ -100,12 +94,9 @@ static void test_create_ust_channel(void)
                return;
        }
 
-       ok(uchan->enabled == 0 &&
-          strncmp(uchan->name, "channel0", 8) == 0 &&
-          uchan->name[LTTNG_UST_ABI_SYM_NAME_LEN - 1] == '\0' &&
-          uchan->ctx != NULL &&
-          uchan->events != NULL &&
-          uchan->attr.overwrite  == attr.attr.overwrite,
+       ok(uchan->enabled == 0 && strncmp(uchan->name, "channel0", 8) == 0 &&
+                  uchan->name[LTTNG_UST_ABI_SYM_NAME_LEN - 1] == '\0' && uchan->ctx != NULL &&
+                  uchan->events != NULL && uchan->attr.overwrite == attr.attr.overwrite,
           "Validate UST channel");
 
        trace_ust_destroy_channel(uchan);
@@ -118,9 +109,8 @@ static void test_create_ust_event(void)
        enum lttng_error_code ret;
 
        memset(&ev, 0, sizeof(ev));
-       ok(lttng_strncpy(ev.name, get_random_string(),
-                       LTTNG_SYMBOL_NAME_LEN) == 0,
-               "Validate string length");
+       ok(lttng_strncpy(ev.name, get_random_string(), LTTNG_SYMBOL_NAME_LEN) == 0,
+          "Validate string length");
        ev.type = LTTNG_EVENT_TRACEPOINT;
        ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
 
@@ -133,10 +123,9 @@ static void test_create_ust_event(void)
                return;
        }
 
-       ok(event->enabled == 0 &&
-          event->attr.instrumentation == LTTNG_UST_ABI_TRACEPOINT &&
-          strcmp(event->attr.name, ev.name) == 0 &&
-          event->attr.name[LTTNG_UST_ABI_SYM_NAME_LEN - 1] == '\0',
+       ok(event->enabled == 0 && event->attr.instrumentation == LTTNG_UST_ABI_TRACEPOINT &&
+                  strcmp(event->attr.name, ev.name) == 0 &&
+                  event->attr.name[LTTNG_UST_ABI_SYM_NAME_LEN - 1] == '\0',
           "Validate UST event");
 
        trace_ust_destroy_event(event);
@@ -159,15 +148,14 @@ static void test_create_ust_event_exclusion(void)
        /* make a wildcarded event name */
        name = get_random_string();
        name[strlen(name) - 1] = '*';
-       ok(lttng_strncpy(ev.name, name, LTTNG_SYMBOL_NAME_LEN) == 0,
-               "Validate string length");
+       ok(lttng_strncpy(ev.name, name, LTTNG_SYMBOL_NAME_LEN) == 0, "Validate string length");
 
        ev.type = LTTNG_EVENT_TRACEPOINT;
        ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
 
        /* set up an exclusion set */
        exclusion = zmalloc<lttng_event_exclusion>(sizeof(*exclusion) +
-               LTTNG_SYMBOL_NAME_LEN * exclusion_count);
+                                                  LTTNG_SYMBOL_NAME_LEN * exclusion_count);
        ok(exclusion != NULL, "Create UST exclusion");
        if (!exclusion) {
                skip(4, "zmalloc failed");
@@ -176,9 +164,11 @@ static void test_create_ust_event_exclusion(void)
 
        exclusion->count = exclusion_count;
        random_name = get_random_string();
-       strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 0), random_name,
+       strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 0),
+               random_name,
                LTTNG_SYMBOL_NAME_LEN - 1);
-       strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1), random_name,
+       strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1),
+               random_name,
                LTTNG_SYMBOL_NAME_LEN - 1);
 
        ret = trace_ust_create_event(&ev, NULL, NULL, exclusion, false, &event);
@@ -187,7 +177,7 @@ static void test_create_ust_event_exclusion(void)
        ok(ret != LTTNG_OK, "Create UST event with identical exclusion names fails");
 
        exclusion = zmalloc<lttng_event_exclusion>(sizeof(*exclusion) +
-               LTTNG_SYMBOL_NAME_LEN * exclusion_count);
+                                                  LTTNG_SYMBOL_NAME_LEN * exclusion_count);
        ok(exclusion != NULL, "Create UST exclusion");
        if (!exclusion) {
                skip(2, "zmalloc failed");
@@ -195,7 +185,7 @@ static void test_create_ust_event_exclusion(void)
        }
 
        exclusion_copy = zmalloc<lttng_event_exclusion>(sizeof(*exclusion) +
-               LTTNG_SYMBOL_NAME_LEN * exclusion_count);
+                                                       LTTNG_SYMBOL_NAME_LEN * exclusion_count);
        if (!exclusion_copy) {
                skip(2, "zmalloc failed");
                goto end;
@@ -209,22 +199,22 @@ static void test_create_ust_event_exclusion(void)
 
        exclusion->count = exclusion_count;
        copy_ret = lttng_strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 0),
-                       get_random_string(),
-                       sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 0)));
+                                get_random_string(),
+                                sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 0)));
        LTTNG_ASSERT(copy_ret == 0);
        copy_ret = lttng_strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1),
-                       get_random_string(),
-                       sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1)));
+                                get_random_string(),
+                                sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1)));
        LTTNG_ASSERT(copy_ret == 0);
 
        exclusion_copy->count = exclusion_count;
        copy_ret = lttng_strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion_copy, 0),
-                       LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 0),
-                       sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion_copy, 0)));
+                                LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 0),
+                                sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion_copy, 0)));
        LTTNG_ASSERT(copy_ret == 0);
        copy_ret = lttng_strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion_copy, 1),
-                       LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1),
-                       sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion_copy, 1)));
+                                LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1),
+                                sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion_copy, 1)));
        LTTNG_ASSERT(copy_ret == 0);
 
        ret = trace_ust_create_event(&ev, NULL, NULL, exclusion, false, &event);
@@ -236,15 +226,14 @@ static void test_create_ust_event_exclusion(void)
                goto end;
        }
 
-       ok(event->enabled == 0 &&
-               event->attr.instrumentation == LTTNG_UST_ABI_TRACEPOINT &&
-               strcmp(event->attr.name, ev.name) == 0 &&
-               event->exclusion != NULL &&
-               event->exclusion->count == exclusion_count &&
-               !memcmp(event->exclusion->names, exclusion_copy->names,
-                       LTTNG_SYMBOL_NAME_LEN * exclusion_count) &&
-               event->attr.name[LTTNG_UST_ABI_SYM_NAME_LEN - 1] == '\0',
-               "Validate UST event and exclusion");
+       ok(event->enabled == 0 && event->attr.instrumentation == LTTNG_UST_ABI_TRACEPOINT &&
+                  strcmp(event->attr.name, ev.name) == 0 && event->exclusion != NULL &&
+                  event->exclusion->count == exclusion_count &&
+                  !memcmp(event->exclusion->names,
+                          exclusion_copy->names,
+                          LTTNG_SYMBOL_NAME_LEN * exclusion_count) &&
+                  event->attr.name[LTTNG_UST_ABI_SYM_NAME_LEN - 1] == '\0',
+          "Validate UST event and exclusion");
 
        trace_ust_destroy_event(event);
 end:
@@ -253,7 +242,6 @@ end:
        return;
 }
 
-
 static void test_create_ust_context(void)
 {
        struct lttng_event_context ectx;
@@ -265,8 +253,7 @@ static void test_create_ust_context(void)
        ok(uctx != NULL, "Create UST context");
 
        if (uctx) {
-               ok((int) uctx->ctx.ctx == LTTNG_UST_ABI_CONTEXT_VTID,
-                  "Validate UST context");
+               ok((int) uctx->ctx.ctx == LTTNG_UST_ABI_CONTEXT_VTID, "Validate UST context");
        } else {
                skip(1, "Skipping UST context validation as creation failed");
        }
index 49cd4a1eb52af272b9cf679f4a11c3728ce56f95..dcfbe2aa07a27b7e934e63dbd4521a57a176e007 100644 (file)
@@ -9,27 +9,27 @@
  *
  */
 
+#include <common/compat/poll.hpp>
+#include <common/dynamic-array.hpp>
+#include <common/pipe.hpp>
+#include <common/readwrite.hpp>
+
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/types.h>
 #include <sys/wait.h>
-
-#include <common/compat/poll.hpp>
-#include <common/readwrite.hpp>
-#include <common/pipe.hpp>
-#include <common/dynamic-array.hpp>
-
 #include <tap/tap.h>
+#include <unistd.h>
 
 /* Verification without trashing test order in the child process */
-#define childok(e, test, ...) do { \
-       if (!(e)) { \
-               diag(test, ## __VA_ARGS__); \
-               _exit(EXIT_FAILURE); \
-       } \
-} while(0)
+#define childok(e, test, ...)                      \
+       do {                                       \
+               if (!(e)) {                        \
+                       diag(test, ##__VA_ARGS__); \
+                       _exit(EXIT_FAILURE);       \
+               }                                  \
+       } while (0)
 
 /* For error.h */
 int lttng_opt_quiet = 1;
@@ -56,8 +56,7 @@ int lttng_opt_mi;
 #define CLOE_VALUE FD_CLOEXEC
 #endif
 
-static
-void test_epoll_compat(void)
+static void test_epoll_compat(void)
 {
        /*
         * Type conversion present to disable warning of anonymous enum from
@@ -94,7 +93,8 @@ static void test_add_del(void)
 
        lttng_poll_init(&poll_events);
        ok(lttng_poll_add(NULL, 1, LPOLLIN) != 0, "Adding to NULL set fails");
-       ok(lttng_poll_add(&poll_events, 1, LPOLLIN) != 0, "Adding to uninitialized structure fails");
+       ok(lttng_poll_add(&poll_events, 1, LPOLLIN) != 0,
+          "Adding to uninitialized structure fails");
        ok(lttng_poll_add(&poll_events, -1, LPOLLIN) != 0, "Adding invalid FD fails");
 
        ok(lttng_poll_create(&poll_events, 1, 0) == 0, "Create a poll set succeeds");
@@ -144,13 +144,20 @@ static void test_mod_wait(void)
 
        cpid = fork();
        if (cpid == 0) {
-               childok(lttng_poll_create(&cpoll_events, 1, 0) == 0, "Create valid poll set succeeds");
-               childok(lttng_poll_mod(NULL, infd[0], LPOLLIN) == -1, "lttng_poll_mod with invalid input returns an error");
-               childok(lttng_poll_mod(&cpoll_events, infd[0], LPOLLIN) == -1, "lttng_poll_mod with invalid input returns an error");
-               childok(lttng_poll_add(&cpoll_events, infd[0], LPOLLIN) == 0, "Add valid FD succeeds");
-               childok(lttng_poll_mod(&cpoll_events, -1, LPOLLIN) == -1, "lttng_poll_mod with invalid input returns an error");
-               childok(lttng_poll_mod(&cpoll_events, hupfd[0], LPOLLIN) == 0, "lttng_poll_mod on unincluded FD goes on");
-               childok(lttng_poll_mod(&cpoll_events, infd[0], LPOLLIN) == 0, "Modify event type succeeds");
+               childok(lttng_poll_create(&cpoll_events, 1, 0) == 0,
+                       "Create valid poll set succeeds");
+               childok(lttng_poll_mod(NULL, infd[0], LPOLLIN) == -1,
+                       "lttng_poll_mod with invalid input returns an error");
+               childok(lttng_poll_mod(&cpoll_events, infd[0], LPOLLIN) == -1,
+                       "lttng_poll_mod with invalid input returns an error");
+               childok(lttng_poll_add(&cpoll_events, infd[0], LPOLLIN) == 0,
+                       "Add valid FD succeeds");
+               childok(lttng_poll_mod(&cpoll_events, -1, LPOLLIN) == -1,
+                       "lttng_poll_mod with invalid input returns an error");
+               childok(lttng_poll_mod(&cpoll_events, hupfd[0], LPOLLIN) == 0,
+                       "lttng_poll_mod on unincluded FD goes on");
+               childok(lttng_poll_mod(&cpoll_events, infd[0], LPOLLIN) == 0,
+                       "Modify event type succeeds");
                childok(close(infd[1]) == 0, "Close valid FD succeeds");
                childok(lttng_poll_wait(&cpoll_events, -1) == 1, "Wait on close times out");
                childok(lttng_read(infd[0], &rbuf, 1) == 1, "Data is present in the pipe");
@@ -165,10 +172,12 @@ static void test_mod_wait(void)
                ok(close(hupfd[1]) == 0, "Close valid FD succeeds");
                ok(close(infd[0]) == 0, "Close valid FD succeeds");
 
-               ok(lttng_poll_wait(NULL, -1) == -1, "lttng_poll_wait call with invalid input returns error");
+               ok(lttng_poll_wait(NULL, -1) == -1,
+                  "lttng_poll_wait call with invalid input returns error");
 
                ok(lttng_poll_create(&poll_events, 1, 0) == 0, "Create valid poll set succeeds");
-               ok(lttng_poll_wait(&poll_events, -1) == -1, "lttng_poll_wait call with invalid input returns error");
+               ok(lttng_poll_wait(&poll_events, -1) == -1,
+                  "lttng_poll_wait call with invalid input returns error");
                ok(lttng_poll_add(&poll_events, hupfd[0], LPOLLIN) == 0, "Add valid FD succeeds");
                ok(lttng_write(infd[1], &tbuf, 1) == 1, "Write to pipe succeeds");
                ok(lttng_poll_wait(&poll_events, -1) == 1, "Wakes up on one event");
@@ -187,8 +196,7 @@ static void destroy_pipe(void *pipe)
        lttng_pipe_destroy((lttng_pipe *) pipe);
 }
 
-static int run_active_set_combination(unsigned int fd_count,
-               unsigned int active_fds_mask)
+static int run_active_set_combination(unsigned int fd_count, unsigned int active_fds_mask)
 {
        int ret = 0;
        unsigned int i;
@@ -202,8 +210,7 @@ static int run_active_set_combination(unsigned int fd_count,
 
        ret = lttng_poll_create(&poll_events, fd_count, 0);
        if (ret) {
-               diag("Failed to create poll set for %u file descriptors",
-                               fd_count);
+               diag("Failed to create poll set for %u file descriptors", fd_count);
                goto end;
        }
 
@@ -216,8 +223,7 @@ static int run_active_set_combination(unsigned int fd_count,
                        goto end;
                }
 
-               ret = lttng_poll_add(&poll_events, lttng_pipe_get_readfd(pipe),
-                               LPOLLIN);
+               ret = lttng_poll_add(&poll_events, lttng_pipe_get_readfd(pipe), LPOLLIN);
                if (ret) {
                        diag("Failed to add file descriptor to poll set");
                        ret = -1;
@@ -244,13 +250,10 @@ static int run_active_set_combination(unsigned int fd_count,
                        continue;
                }
 
-               borrowed_pipe =
-                       (lttng_pipe *) lttng_dynamic_pointer_array_get_pointer(
-                               &pipes, i);
+               borrowed_pipe = (lttng_pipe *) lttng_dynamic_pointer_array_get_pointer(&pipes, i);
 
                char c = 'a';
-               ret = lttng_pipe_write(
-                       borrowed_pipe, &c, sizeof(char));
+               ret = lttng_pipe_write(borrowed_pipe, &c, sizeof(char));
                if (ret != sizeof(char)) {
                        diag("Failed to write to pipe");
                        ret = -1;
@@ -261,7 +264,8 @@ static int run_active_set_combination(unsigned int fd_count,
        ret = lttng_poll_wait(&poll_events, 0);
        if (ret != active_fds_count) {
                diag("lttng_poll_wait returned %d, expected %u active file descriptors",
-                               ret, active_fds_count);
+                    ret,
+                    active_fds_count);
                ret = -1;
                goto end;
        } else {
@@ -328,7 +332,7 @@ static void test_func_def(void)
 #endif
 
        ok(lttng_poll_reset == lttng_poll_reset, "lttng_poll_reset is defined");
-       ok(lttng_poll_init == lttng_poll_init , "lttng_poll_init is defined");
+       ok(lttng_poll_init == lttng_poll_init, "lttng_poll_init is defined");
        ok(PASS_GETFD, "GETFD is defined");
        ok(PASS_GETEV, "GETEV is defined");
        ok(PASS_GETSZ, "GETSZ is defined");
index 55e584b8bc9b34745a074e3f73732c1f2e3c5259..3adfd7ea7137815d921d2e99b88a756578c1b3da 100644 (file)
@@ -5,10 +5,10 @@
  *
  */
 
-#include <stdio.h>
-#include <string.h>
 #include "common/compat/pthread.hpp"
 
+#include <stdio.h>
+#include <string.h>
 #include <tap/tap.h>
 
 #define TEST_NAME_PROPER_LEN 16
@@ -44,8 +44,10 @@ int main(void)
        /* Get the thread name again, should be the one we set */
        ret = lttng_pthread_getname_np(name1, TEST_NAME_PROPER_LEN);
        ok(ret == 0, "Get a short thread name: '%s'", name1);
-       ok(strcmp(short_name, name1) == 0, "Compare the short thread name: '%s' == '%s'", short_name, name1);
-
+       ok(strcmp(short_name, name1) == 0,
+          "Compare the short thread name: '%s' == '%s'",
+          short_name,
+          name1);
 
        /* Set a thread name of 16 bytes */
        ret = lttng_pthread_setname_np(long_name);
@@ -54,7 +56,10 @@ int main(void)
        /* Get the thread name again, should be the one we set */
        ret = lttng_pthread_getname_np(name1, TEST_NAME_PROPER_LEN);
        ok(ret == 0, "Get a long thread name: '%s'", name1);
-       ok(strncmp(long_name, name1, TEST_NAME_PROPER_LEN - 1) == 0, "Compare the long thread name: '%s' == '%s'", long_name, name1);
+       ok(strncmp(long_name, name1, TEST_NAME_PROPER_LEN - 1) == 0,
+          "Compare the long thread name: '%s' == '%s'",
+          long_name,
+          name1);
 
        return exit_status();
 }
index 9fe1619ee9bf031a71989487e4edc6cac62edf5f..908347659d6d3b28c0187337cedc47c7d7adc053 100644 (file)
@@ -5,18 +5,16 @@
  *
  */
 
-#include <string.h>
+#include <common/common.hpp>
+#include <common/path.hpp>
+#include <common/utils.hpp>
+
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <limits.h>
-
+#include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-
-#include <common/utils.hpp>
-#include <common/path.hpp>
-#include <common/common.hpp>
-
 #include <tap/tap.h>
 
 /* For error.h */
@@ -43,83 +41,69 @@ struct symlink_test_input {
 
 /* Valid test cases */
 struct valid_test_input valid_tests_inputs[] = {
-       { "/a/b/c/d/e",                 "",             "/a/b/c/d/e"    },
-       { "/a//b//c/d/e",               "",             "/a/b/c/d/e"    },
-       { "./a/b/c/d/e",                ".",            "/a/b/c/d/e"    },
-       { "../a/b/c/d/../e",            "..",           "/a/b/c/e"      },
-       { ".././a/b/c/d/./e",           "..",           "/a/b/c/d/e"    },
-       { "../../a/b/c/d/e",            "../..",        "/a/b/c/d/e"    },
-       { "./a/b/../c/d/../e",          ".",            "/a/c/e"        },
-       { "../a/b/../../c/./d/./e",     "..",           "/c/d/e"        },
-       { "../../a/b/../c/d/../../e",   "../..",        "/a/e"          },
-       { "./a/b/c/d/../../../../e",    ".",            "/e"            },
-       { ".././a/b/c/d/./e",           "..",           "/a/b/c/d/e"    },
-       { "a/",                         ".",            "/a/"           },
-       { "a",                          ".",            "/a"            },
-       { "../../",                     "../..",        "/"             },
-       { "../..",                      "../..",        ""              },
-       { "../",                        "..",           "/"             },
-       { "..",                         "..",           ""              },
-       { "./",                         ".",            "/"             },
-       { ".",                          ".",            ""              },
-       { "/../a/b/c/d/e",              "",             "/a/b/c/d/e"    },
-       { "/a/b/c/d/../../../../../e",  "",             "/e"            },
-       { "/..",                        "",             "/"             },
-       { "/a/..",                      "",             "/"             },
+       { "/a/b/c/d/e", "", "/a/b/c/d/e" },
+       { "/a//b//c/d/e", "", "/a/b/c/d/e" },
+       { "./a/b/c/d/e", ".", "/a/b/c/d/e" },
+       { "../a/b/c/d/../e", "..", "/a/b/c/e" },
+       { ".././a/b/c/d/./e", "..", "/a/b/c/d/e" },
+       { "../../a/b/c/d/e", "../..", "/a/b/c/d/e" },
+       { "./a/b/../c/d/../e", ".", "/a/c/e" },
+       { "../a/b/../../c/./d/./e", "..", "/c/d/e" },
+       { "../../a/b/../c/d/../../e", "../..", "/a/e" },
+       { "./a/b/c/d/../../../../e", ".", "/e" },
+       { ".././a/b/c/d/./e", "..", "/a/b/c/d/e" },
+       { "a/", ".", "/a/" },
+       { "a", ".", "/a" },
+       { "../../", "../..", "/" },
+       { "../..", "../..", "" },
+       { "../", "..", "/" },
+       { "..", "..", "" },
+       { "./", ".", "/" },
+       { ".", ".", "" },
+       { "/../a/b/c/d/e", "", "/a/b/c/d/e" },
+       { "/a/b/c/d/../../../../../e", "", "/e" },
+       { "/..", "", "/" },
+       { "/a/..", "", "/" },
 };
 char **valid_tests_expected_results;
-const int num_valid_tests =
-               sizeof(valid_tests_inputs) / sizeof(valid_tests_inputs[0]);
+const int num_valid_tests = sizeof(valid_tests_inputs) / sizeof(valid_tests_inputs[0]);
 
 /* Symlinks test cases */
 char tree_origin[] = "/tmp/test_utils_expand_path.XXXXXX";
 
-const char * const tree_dirs[] = {
+const char *const tree_dirs[] = {
        "a",
        "a/b",
        "a/b/c",
        "a/e",
 };
-const int num_tree_dirs =
-               sizeof(tree_dirs) / sizeof(tree_dirs[0]);
+const int num_tree_dirs = sizeof(tree_dirs) / sizeof(tree_dirs[0]);
 
 struct tree_symlink tree_symlinks[] = {
-       { "a/d",                        "b/c/"          },
-       { "a/g",                        "d/"            },
-       { "a/b/f",                      "../e/"         },
-       { "a/b/h",                      "../g/"         },
-       { "a/b/k",                      "c/g/"          },
-       { "a/b/c/g",                    "../../../"     },
+       { "a/d", "b/c/" },    { "a/g", "d/" },     { "a/b/f", "../e/" },
+       { "a/b/h", "../g/" }, { "a/b/k", "c/g/" }, { "a/b/c/g", "../../../" },
 };
-const int num_tree_symlinks =
-               sizeof(tree_symlinks) / sizeof(tree_symlinks[0]);
+const int num_tree_symlinks = sizeof(tree_symlinks) / sizeof(tree_symlinks[0]);
 
 static struct symlink_test_input symlink_tests_inputs[] = {
-       { "a/g/../l/.",                 "a/b/l"         },
-       { "a/g/../l/./",                "a/b/l/"        },
-       { "a/g/../l/..",                "a/b"           },
-       { "a/g/../l/../",               "a/b/"          },
-       { "a/b/h/g/",                   ""              },
+       { "a/g/../l/.", "a/b/l" },  { "a/g/../l/./", "a/b/l/" }, { "a/g/../l/..", "a/b" },
+       { "a/g/../l/../", "a/b/" }, { "a/b/h/g/", "" },
 };
-const int num_symlink_tests =
-               sizeof(symlink_tests_inputs) / sizeof(symlink_tests_inputs[0]);
+const int num_symlink_tests = sizeof(symlink_tests_inputs) / sizeof(symlink_tests_inputs[0]);
 
 /* Invalid test cases */
 char *invalid_tests_inputs[] = {
        NULL,
 };
-const int num_invalid_tests =
-               sizeof(invalid_tests_inputs) / sizeof(invalid_tests_inputs[0]);
+const int num_invalid_tests = sizeof(invalid_tests_inputs) / sizeof(invalid_tests_inputs[0]);
 } /* namespace */
 
-#define PRINT_ERR(fmt, args...)                                                \
-       fprintf(stderr, "test_utils_expand_path: error: " fmt "\n", ## args)
+#define PRINT_ERR(fmt, args...) fprintf(stderr, "test_utils_expand_path: error: " fmt "\n", ##args)
 
 static int prepare_valid_results(void)
 {
        int i;
-       char *relative, *cur_path = NULL, *prev_path = NULL,
-                       *pprev_path = NULL, *empty = NULL;
+       char *relative, *cur_path = NULL, *prev_path = NULL, *pprev_path = NULL, *empty = NULL;
        int ret = 0;
 
        /* Prepare the relative paths */
@@ -158,8 +142,11 @@ static int prepare_valid_results(void)
                        relative = empty;
                }
 
-               snprintf(valid_tests_expected_results[i], PATH_MAX,
-                               "%s%s", relative, valid_tests_inputs[i].absolute_part);
+               snprintf(valid_tests_expected_results[i],
+                        PATH_MAX,
+                        "%s%s",
+                        relative,
+                        valid_tests_inputs[i].absolute_part);
        }
 
 end:
@@ -197,8 +184,7 @@ static int prepare_symlink_tree(void)
 
        /* Create the directories of the test tree */
        for (i = 0; i < num_tree_dirs; i++) {
-               snprintf(tmppath, sizeof(tmppath), "%s/%s", tree_origin,
-                               tree_dirs[i]);
+               snprintf(tmppath, sizeof(tmppath), "%s/%s", tree_origin, tree_dirs[i]);
 
                if (mkdir(tmppath, 0755) != 0) {
                        PRINT_ERR("mkdir failed with path \"%s\"", tmppath);
@@ -208,12 +194,12 @@ static int prepare_symlink_tree(void)
 
        /* Create the symlinks of the test tree */
        for (i = 0; i < num_tree_symlinks; i++) {
-               snprintf(tmppath, sizeof(tmppath), "%s/%s",
-                               tree_origin, tree_symlinks[i].orig);
+               snprintf(tmppath, sizeof(tmppath), "%s/%s", tree_origin, tree_symlinks[i].orig);
 
                if (symlink(tree_symlinks[i].dest, tmppath) != 0) {
-                       PRINT_ERR("failed to symlink \"%s\" to \"%s\"", tmppath,
-                                       tree_symlinks[i].dest);
+                       PRINT_ERR("failed to symlink \"%s\" to \"%s\"",
+                                 tmppath,
+                                 tree_symlinks[i].dest);
                        goto error;
                }
        }
@@ -230,9 +216,8 @@ static int free_symlink_tree(void)
        char tmppath[PATH_MAX];
 
        /* Remove the symlinks from the test tree */
-       for (i =  num_tree_symlinks - 1; i > -1; i--) {
-               snprintf(tmppath, PATH_MAX, "%s/%s",
-                               tree_origin, tree_symlinks[i].orig);
+       for (i = num_tree_symlinks - 1; i > -1; i--) {
+               snprintf(tmppath, PATH_MAX, "%s/%s", tree_origin, tree_symlinks[i].orig);
 
                if (unlink(tmppath) != 0) {
                        PRINT_ERR("failed to unlink \"%s\"", tmppath);
@@ -273,8 +258,9 @@ static void test_utils_expand_path(void)
                sprintf(name, "valid test case: %s", valid_tests_inputs[i].input);
 
                result = utils_expand_path(valid_tests_inputs[i].input);
-               ok(result != NULL &&
-                       strcmp(result, valid_tests_expected_results[i]) == 0, "%s", name);
+               ok(result != NULL && strcmp(result, valid_tests_expected_results[i]) == 0,
+                  "%s",
+                  name);
 
                free(result);
        }
@@ -294,22 +280,27 @@ static void test_utils_expand_path(void)
        for (i = 0; i < num_symlink_tests; i++) {
                int ret;
 
-               sprintf(name, "symlink tree test case: [tmppath/]%s",
-                               symlink_tests_inputs[i].input);
+               sprintf(name,
+                       "symlink tree test case: [tmppath/]%s",
+                       symlink_tests_inputs[i].input);
 
-               ret = snprintf(tmppath, PATH_MAX, "%s/%s",
-                               real_tree_origin,
-                               symlink_tests_inputs[i].input);
+               ret = snprintf(tmppath,
+                              PATH_MAX,
+                              "%s/%s",
+                              real_tree_origin,
+                              symlink_tests_inputs[i].input);
                if (ret == -1 || ret >= PATH_MAX) {
                        PRINT_ERR("truncation occurred while concatenating paths \"%s\" and \"%s\"",
-                                       real_tree_origin,
-                                       symlink_tests_inputs[i].input);
+                                 real_tree_origin,
+                                 symlink_tests_inputs[i].input);
                        fail("%s", name);
                        continue;
                }
                result = utils_expand_path(tmppath);
-               ok(result != NULL && strcmp(result + treelen,
-                       symlink_tests_inputs[i].expected_result) == 0, "%s", name);
+               ok(result != NULL &&
+                          strcmp(result + treelen, symlink_tests_inputs[i].expected_result) == 0,
+                  "%s",
+                  name);
 
                free(result);
        }
@@ -318,8 +309,7 @@ static void test_utils_expand_path(void)
        for (i = 0; i < num_invalid_tests; i++) {
                const char *test_input = invalid_tests_inputs[i];
 
-               sprintf(name, "invalid test case: %s", test_input ?
-                               test_input : "NULL");
+               sprintf(name, "invalid test case: %s", test_input ? test_input : "NULL");
 
                result = utils_expand_path(test_input);
                if (result != NULL) {
index 840d4fc5bd93b88347d4709ae534f9b695a70c75..3073e86860c5633498d865156bca9097bf8e2a70 100644 (file)
@@ -5,13 +5,12 @@
  *
  */
 
-#include <string.h>
-#include <stdio.h>
+#include <common/utils.hpp>
 
+#include <stdio.h>
+#include <string.h>
 #include <tap/tap.h>
 
-#include <common/utils.hpp>
-
 /* For error.h */
 int lttng_opt_quiet = 1;
 int lttng_opt_verbose = 3;
@@ -25,70 +24,55 @@ struct valid_test_input {
 
 /* Valid test cases */
 struct valid_test_input valid_tests_inputs[] = {
-               { "0", 0 },
-               { "1234", 1234 },
-               { "0x400", 1024 },
-               { "0300", 192 },
-               { "16k", 16384 },
-               { "128K", 131072 },
-               { "0x1234k", 4771840 },
-               { "32M", 33554432 },
-               { "1024G", 1099511627776ULL },
-               { "0X400", 1024 },
-               { "0x40a", 1034 },
-               { "0X40b", 1035 },
-               { "0x40C", 1036 },
-               { "0X40D", 1037 },
-               { "0x40e", 1038 },
-               { "0X40f", 1039 },
-               { "00", 0 },
-               { "0k", 0 },
-               { "0K", 0 },
-               { "0M", 0 },
-               { "0G", 0 },
-               { "00k", 0 },
-               { "00K", 0 },
-               { "00M", 0 },
-               { "00G", 0 },
-               { "0x0", 0 },
-               { "0X0", 0 },
-               { "0x0k", 0 },
-               { "0X0K", 0 },
-               { "0x0M", 0 },
-               { "0X0G", 0 },
-               { "0X40G", 68719476736ULL },
-               { "0300k", 196608 },
-               { "0300K", 196608 },
-               { "030M", 25165824 },
-               { "020G", 17179869184ULL },
-               { "0xa0k", 163840 },
-               { "0xa0K", 163840 },
-               { "0XA0M", 167772160 },
-               { "0xA0G", 171798691840ULL },
+       { "0", 0 },
+       { "1234", 1234 },
+       { "0x400", 1024 },
+       { "0300", 192 },
+       { "16k", 16384 },
+       { "128K", 131072 },
+       { "0x1234k", 4771840 },
+       { "32M", 33554432 },
+       { "1024G", 1099511627776ULL },
+       { "0X400", 1024 },
+       { "0x40a", 1034 },
+       { "0X40b", 1035 },
+       { "0x40C", 1036 },
+       { "0X40D", 1037 },
+       { "0x40e", 1038 },
+       { "0X40f", 1039 },
+       { "00", 0 },
+       { "0k", 0 },
+       { "0K", 0 },
+       { "0M", 0 },
+       { "0G", 0 },
+       { "00k", 0 },
+       { "00K", 0 },
+       { "00M", 0 },
+       { "00G", 0 },
+       { "0x0", 0 },
+       { "0X0", 0 },
+       { "0x0k", 0 },
+       { "0X0K", 0 },
+       { "0x0M", 0 },
+       { "0X0G", 0 },
+       { "0X40G", 68719476736ULL },
+       { "0300k", 196608 },
+       { "0300K", 196608 },
+       { "030M", 25165824 },
+       { "020G", 17179869184ULL },
+       { "0xa0k", 163840 },
+       { "0xa0K", 163840 },
+       { "0XA0M", 167772160 },
+       { "0xA0G", 171798691840ULL },
 };
 const int num_valid_tests = sizeof(valid_tests_inputs) / sizeof(valid_tests_inputs[0]);
 
 /* Invalid test cases */
 const char *invalid_tests_inputs[] = {
-               "",
-               " ",
-               "-1",
-               "k",
-               "4611686018427387904G",
-               "0x40g",
-               "08",
-               "09",
-               "0x",
-               "x0",
-               "0xx0",
-               "07kK",
-               "0xk",
-               "0XM",
-               "0xG",
-               "0x0MM",
-               "0X0GG",
-               "0a",
-               "0B",
+       "",      " ",     "-1",  "k",   "4611686018427387904G",
+       "0x40g", "08",    "09",  "0x",  "x0",
+       "0xx0",  "07kK",  "0xk", "0XM", "0xG",
+       "0x0MM", "0X0GG", "0a",  "0B",
 };
 
 const int num_invalid_tests = sizeof(invalid_tests_inputs) / sizeof(invalid_tests_inputs[0]);
index 765c96fb5d01bb96c7509d1c0f167a3803c4cb8f..98630d6abce44772860ba5c0a7a81f7e653087a3 100644 (file)
@@ -5,14 +5,13 @@
  *
  */
 
-#include <string.h>
-#include <stdio.h>
-#include <inttypes.h>
+#include <common/utils.hpp>
 
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
 #include <tap/tap.h>
 
-#include <common/utils.hpp>
-
 /* For error.h */
 int lttng_opt_quiet = 1;
 int lttng_opt_verbose = 3;
@@ -26,67 +25,48 @@ struct valid_test_input {
 
 /* Valid test cases */
 struct valid_test_input valid_tests_inputs[] = {
-               { "0", 0 },
-               { "1234", 1234 },
-               { "1234us", 1234 },
-               { "16ms", 16000 },
-               { "128ms", 128000 },
-               { "32s", 32000000 },
-               { "1m", 60000000 },
-               { "20m", 1200000000 },
-               { "1h", 3600000000 },
-               { "5h", 18000000000 },
-               { "00", 0 },
-               { "0us", 0 },
-               { "0ms", 0 },
-               { "0s", 0 },
-               { "0m", 0 },
-               { "0h", 0 },
-               { "00us", 0 },
-               { "00ms", 0 },
-               { "00s", 0 },
-               { "00m", 0 },
-               { "00h", 0 },
-               { "12ms", 12000 },
-               { "3597us", 3597 },
-               { "+5", 5 },
-               { "08", 8 },
-               { "0145us", 145 },
+       { "0", 0 },           { "1234", 1234 },      { "1234us", 1234 }, { "16ms", 16000 },
+       { "128ms", 128000 },  { "32s", 32000000 },   { "1m", 60000000 }, { "20m", 1200000000 },
+       { "1h", 3600000000 }, { "5h", 18000000000 }, { "00", 0 },        { "0us", 0 },
+       { "0ms", 0 },         { "0s", 0 },           { "0m", 0 },        { "0h", 0 },
+       { "00us", 0 },        { "00ms", 0 },         { "00s", 0 },       { "00m", 0 },
+       { "00h", 0 },         { "12ms", 12000 },     { "3597us", 3597 }, { "+5", 5 },
+       { "08", 8 },          { "0145us", 145 },
 };
 const int num_valid_tests = sizeof(valid_tests_inputs) / sizeof(valid_tests_inputs[0]);
 
 /* Invalid test cases */
 const char *invalid_tests_inputs[] = {
-               "",
-               " ",
-               "-1",
-               "m",
-               "4611686018427387904s",
-               "0x40M",
-               "0x",
-               "x0",
-               "0xx0",
-               "07mm",
-               "0xm",
-               "0Xs",
-               "0x0ss",
-               "0a",
-               "0B",
-               "0x3 s",
-               "0xbs ",
-               "14ns",
-               "0xbs",
-               "14ns",
-               "14ms garbage after value",
-               "0x14s",
-               "0u",
-               "5mS",
-               "5Ms",
-               "12ussr",
-               "67msrp",
-               "14si",
-               "12mo",
-               "53hi",
+       "",
+       " ",
+       "-1",
+       "m",
+       "4611686018427387904s",
+       "0x40M",
+       "0x",
+       "x0",
+       "0xx0",
+       "07mm",
+       "0xm",
+       "0Xs",
+       "0x0ss",
+       "0a",
+       "0B",
+       "0x3 s",
+       "0xbs ",
+       "14ns",
+       "0xbs",
+       "14ns",
+       "14ms garbage after value",
+       "0x14s",
+       "0u",
+       "5mS",
+       "5Ms",
+       "12ussr",
+       "67msrp",
+       "14si",
+       "12mo",
+       "53hi",
 };
 const int num_invalid_tests = sizeof(invalid_tests_inputs) / sizeof(invalid_tests_inputs[0]);
 } /* namespace */
@@ -102,7 +82,10 @@ static void test_utils_parse_time_suffix(void)
                char name[256];
 
                ret = utils_parse_time_suffix(valid_tests_inputs[i].input, &result);
-               sprintf(name, "valid test case: %s expected %" PRIu64, valid_tests_inputs[i].input, result);
+               sprintf(name,
+                       "valid test case: %s expected %" PRIu64,
+                       valid_tests_inputs[i].input,
+                       result);
                ok(ret == 0 && result == valid_tests_inputs[i].expected_result, "%s", name);
        }
 
index 6357c3adf24e88a51b5f8ea64c1b6dfa692dc6a3..b714754a23a295ba476ab3a05c3a085e3763f954 100644 (file)
@@ -5,12 +5,11 @@
  *
  */
 
-#include <stdio.h>
-#include <stdbool.h>
-#include <string.h>
-
 #include "common/uuid.hpp"
 
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
 #include <tap/tap.h>
 
 #define NR_TESTS 21
@@ -21,18 +20,12 @@ static const char valid_str_3[] = "1b4855cc-96de-4ae8-abe3-86449c2a43c4";
 static const char valid_str_4[] = "8ADED5B9-ACD2-439F-A60C-897403AA2AB4";
 static const char valid_str_5[] = "f109e0a2-C619-4d18-b760-20EA20E0F69A";
 
-static lttng_uuid valid_uuid_1 = {
-       0x3d, 0x26, 0x0c, 0x88, 0x75, 0xea, 0x47, 0xb8,
-       0xa7, 0xe2, 0xd6, 0x07, 0x7c, 0x03, 0x78, 0xd9
-};
-static lttng_uuid valid_uuid_2 = {
-       0x61, 0x1c, 0xf3, 0xa6, 0xa6, 0x8b, 0x45, 0x15,
-       0x83, 0x4f, 0x20, 0x8b, 0xc2, 0x76, 0x25, 0x92
-};
-static lttng_uuid valid_uuid_3 = {
-       0x1b, 0x48, 0x55, 0xcc, 0x96, 0xde, 0x4a, 0xe8,
-       0xab, 0xe3, 0x86, 0x44, 0x9c, 0x2a, 0x43, 0xc4
-};
+static lttng_uuid valid_uuid_1 = { 0x3d, 0x26, 0x0c, 0x88, 0x75, 0xea, 0x47, 0xb8,
+                                  0xa7, 0xe2, 0xd6, 0x07, 0x7c, 0x03, 0x78, 0xd9 };
+static lttng_uuid valid_uuid_2 = { 0x61, 0x1c, 0xf3, 0xa6, 0xa6, 0x8b, 0x45, 0x15,
+                                  0x83, 0x4f, 0x20, 0x8b, 0xc2, 0x76, 0x25, 0x92 };
+static lttng_uuid valid_uuid_3 = { 0x1b, 0x48, 0x55, 0xcc, 0x96, 0xde, 0x4a, 0xe8,
+                                  0xab, 0xe3, 0x86, 0x44, 0x9c, 0x2a, 0x43, 0xc4 };
 
 static const char invalid_str_1[] = "1b485!cc-96de-4XX8-abe3-86449c2a43?4";
 static const char invalid_str_2[] = "c2e6eddb&3955&4006&be3a&70bb63bd5f25";
@@ -46,8 +39,7 @@ int lttng_opt_quiet = 1;
 int lttng_opt_verbose = 0;
 int lttng_opt_mi;
 
-static
-void run_test_lttng_uuid_from_str(void)
+static void run_test_lttng_uuid_from_str(void)
 {
        int ret;
        lttng_uuid uuid1;
@@ -74,41 +66,57 @@ void run_test_lttng_uuid_from_str(void)
         * Parse invalid UUID strings, expect failure.
         */
        ret = lttng_uuid_from_str(invalid_str_1, uuid1);
-       ok(ret != 0, "lttng_uuid_from_str - Parse invalid string '%s', expect failure", invalid_str_1);
+       ok(ret != 0,
+          "lttng_uuid_from_str - Parse invalid string '%s', expect failure",
+          invalid_str_1);
 
        ret = lttng_uuid_from_str(invalid_str_2, uuid1);
-       ok(ret != 0, "lttng_uuid_from_str - Parse invalid string '%s', expect failure", invalid_str_2);
+       ok(ret != 0,
+          "lttng_uuid_from_str - Parse invalid string '%s', expect failure",
+          invalid_str_2);
 
        ret = lttng_uuid_from_str(invalid_str_3, uuid1);
-       ok(ret != 0, "lttng_uuid_from_str - Parse invalid string '%s', expect failure", invalid_str_3);
+       ok(ret != 0,
+          "lttng_uuid_from_str - Parse invalid string '%s', expect failure",
+          invalid_str_3);
 
        ret = lttng_uuid_from_str(invalid_str_4, uuid1);
-       ok(ret != 0, "lttng_uuid_from_str - Parse invalid string '%s', expect failure", invalid_str_4);
+       ok(ret != 0,
+          "lttng_uuid_from_str - Parse invalid string '%s', expect failure",
+          invalid_str_4);
 
        ret = lttng_uuid_from_str(invalid_str_5, uuid1);
-       ok(ret != 0, "lttng_uuid_from_str - Parse invalid string '%s', expect failure", invalid_str_5);
+       ok(ret != 0,
+          "lttng_uuid_from_str - Parse invalid string '%s', expect failure",
+          invalid_str_5);
 
        ret = lttng_uuid_from_str(invalid_str_6, uuid1);
-       ok(ret != 0, "lttng_uuid_from_str - Parse invalid string '%s', expect failure", invalid_str_6);
+       ok(ret != 0,
+          "lttng_uuid_from_str - Parse invalid string '%s', expect failure",
+          invalid_str_6);
 }
 
-static
-void run_test_lttng_uuid_to_str(void)
+static void run_test_lttng_uuid_to_str(void)
 {
        char uuid_str[LTTNG_UUID_STR_LEN];
 
        lttng_uuid_to_str(valid_uuid_1, uuid_str);
-       ok(strcmp(uuid_str, valid_str_1) == 0, "lttng_uuid_to_str - Convert UUID '%s' to string, expect success", valid_str_1);
+       ok(strcmp(uuid_str, valid_str_1) == 0,
+          "lttng_uuid_to_str - Convert UUID '%s' to string, expect success",
+          valid_str_1);
 
        lttng_uuid_to_str(valid_uuid_2, uuid_str);
-       ok(strcmp(uuid_str, valid_str_2) == 0, "lttng_uuid_to_str - Convert UUID '%s' to string, expect success", valid_str_2);
+       ok(strcmp(uuid_str, valid_str_2) == 0,
+          "lttng_uuid_to_str - Convert UUID '%s' to string, expect success",
+          valid_str_2);
 
        lttng_uuid_to_str(valid_uuid_3, uuid_str);
-       ok(strcmp(uuid_str, valid_str_3) == 0, "lttng_uuid_to_str - Convert UUID '%s' to string, expect success", valid_str_3);
+       ok(strcmp(uuid_str, valid_str_3) == 0,
+          "lttng_uuid_to_str - Convert UUID '%s' to string, expect success",
+          valid_str_3);
 }
 
-static
-void run_test_lttng_uuid_is_equal(void)
+static void run_test_lttng_uuid_is_equal(void)
 {
        int ret;
        lttng_uuid uuid1, uuid2;
@@ -126,8 +134,7 @@ void run_test_lttng_uuid_is_equal(void)
        ok(ret == false, "lttng_uuid_is_equal - Compare different UUID, expect failure");
 }
 
-static
-void run_test_lttng_uuid_copy(void)
+static void run_test_lttng_uuid_copy(void)
 {
        bool ret;
        lttng_uuid uuid1;
@@ -138,8 +145,7 @@ void run_test_lttng_uuid_copy(void)
        ok(ret == true, "lttng_uuid_copy - Compare copied UUID with source, expect success");
 }
 
-static
-void run_test_lttng_uuid_generate(void)
+static void run_test_lttng_uuid_generate(void)
 {
        int ret;
        lttng_uuid uuid1, uuid2;
@@ -168,8 +174,7 @@ void run_test_lttng_uuid_generate(void)
        ok(ret == LTTNG_UUID_VER, "lttng_uuid_generate - Generated UUID version check");
 }
 
-static
-void run_test(void)
+static void run_test(void)
 {
        plan_tests(NR_TESTS);
 
index 80afdb6d63ed27c99510c7068436a7539d23bcf2..dc18e4e9f91f36b630c65db25d36cda4f90a3435 100644 (file)
@@ -9,6 +9,13 @@
 #define _GNU_SOURCE
 #endif
 
+#include "signal-helper.hpp"
+#include "utils.h"
+
+#include <common/compat/tid.hpp>
+#include <common/macros.hpp>
+
+#include <inttypes.h>
 #include <popt.h>
 #include <sched.h>
 #include <stdarg.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <inttypes.h>
-
-#include <common/compat/tid.hpp>
-#include <common/macros.hpp>
-
-#include "signal-helper.hpp"
-#include "utils.h"
 
 #define LTTNG_PROC_NS_PATH_MAX 40
 
  * but that use a libc that doesn't define its associated clone flag.
  */
 #ifndef CLONE_NEWNS
-#define CLONE_NEWNS     0x00020000
+#define CLONE_NEWNS 0x00020000
 #endif
 #ifndef CLONE_NEWCGROUP
 #define CLONE_NEWCGROUP 0x02000000
 #endif
 #ifndef CLONE_NEWUTS
-#define CLONE_NEWUTS    0x04000000
+#define CLONE_NEWUTS 0x04000000
 #endif
 #ifndef CLONE_NEWIPC
-#define CLONE_NEWIPC    0x08000000
+#define CLONE_NEWIPC 0x08000000
 #endif
 #ifndef CLONE_NEWUSER
-#define CLONE_NEWUSER   0x10000000
+#define CLONE_NEWUSER 0x10000000
 #endif
 #ifndef CLONE_NEWPID
-#define CLONE_NEWPID    0x20000000
+#define CLONE_NEWPID 0x20000000
 #endif
 #ifndef CLONE_NEWNET
-#define CLONE_NEWNET    0x40000000
+#define CLONE_NEWNET 0x40000000
 #endif
 #ifndef CLONE_NEWTIME
-#define CLONE_NEWTIME   0x00000080
+#define CLONE_NEWTIME 0x00000080
 #endif
 
 static int debug = 0;
@@ -69,15 +69,31 @@ static struct poptOption opts[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
        { "debug", 'd', POPT_ARG_NONE, &debug, 0, "Enable debug output", NULL },
        { "ns", 'n', POPT_ARG_STRING, &ns_opt, 0, "Namespace short identifier", NULL },
-       { "before", 'b', POPT_ARG_STRING, &before_unshare_wait_file_path, 0, "Wait for file before unshare", NULL },
-       { "after", 'a', POPT_ARG_STRING, &after_unshare_wait_file_path, 0, "Wait for file after unshare", NULL },
-       { "signal", 's', POPT_ARG_STRING, &after_unshare_signal_file_path, 0, "Create signal file after unshare", NULL },
-       POPT_AUTOHELP
-       { NULL, 0, 0, NULL, 0, NULL, NULL }
+       { "before",
+         'b',
+         POPT_ARG_STRING,
+         &before_unshare_wait_file_path,
+         0,
+         "Wait for file before unshare",
+         NULL },
+       { "after",
+         'a',
+         POPT_ARG_STRING,
+         &after_unshare_wait_file_path,
+         0,
+         "Wait for file after unshare",
+         NULL },
+       { "signal",
+         's',
+         POPT_ARG_STRING,
+         &after_unshare_signal_file_path,
+         0,
+         "Create signal file after unshare",
+         NULL },
+       POPT_AUTOHELP{ NULL, 0, 0, NULL, 0, NULL, NULL }
 };
 
-static ATTR_FORMAT_PRINTF(1, 2)
-void debug_printf(const char *format, ...)
+static ATTR_FORMAT_PRINTF(1, 2) void debug_printf(const char *format, ...)
 {
        va_list args;
        va_start(args, format);
@@ -98,8 +114,7 @@ static int get_ns_inum(const char *ns, ino_t *ns_inum)
        /*
         * /proc/thread-self was introduced in kernel v3.17
         */
-       if (snprintf(proc_ns_path, LTTNG_PROC_NS_PATH_MAX,
-                       "/proc/thread-self/ns/%s", ns) >= 0) {
+       if (snprintf(proc_ns_path, LTTNG_PROC_NS_PATH_MAX, "/proc/thread-self/ns/%s", ns) >= 0) {
                if (stat(proc_ns_path, &sb) == 0) {
                        *ns_inum = sb.st_ino;
                } else {
@@ -108,8 +123,11 @@ static int get_ns_inum(const char *ns, ino_t *ns_inum)
                goto end;
        }
 
-       if (snprintf(proc_ns_path, LTTNG_PROC_NS_PATH_MAX,
-                       "/proc/self/task/%d/%s/net", lttng_gettid(), ns) >= 0) {
+       if (snprintf(proc_ns_path,
+                    LTTNG_PROC_NS_PATH_MAX,
+                    "/proc/self/task/%d/%s/net",
+                    lttng_gettid(),
+                    ns) >= 0) {
                if (stat(proc_ns_path, &sb) == 0) {
                        *ns_inum = sb.st_ino;
                } else {
@@ -128,8 +146,7 @@ static int do_the_needful(int ns_flag, const char *ns_str)
 
        ret = get_ns_inum(ns_str, &ns1);
        if (ret) {
-               debug_printf("Failed to get ns inode number for namespace %s",
-                               ns_str);
+               debug_printf("Failed to get ns inode number for namespace %s", ns_str);
                ret = -1;
                goto end;
        }
@@ -151,8 +168,7 @@ static int do_the_needful(int ns_flag, const char *ns_str)
 
        ret = get_ns_inum(ns_str, &ns2);
        if (ret) {
-               debug_printf("Failed to get ns inode number for namespace %s",
-                               ns_str);
+               debug_printf("Failed to get ns inode number for namespace %s", ns_str);
                ret = -1;
                goto end;
        }
@@ -205,7 +221,8 @@ int main(int argc, const char **argv)
        if (opt < -1) {
                /* an error occurred during option processing */
                poptPrintUsage(pc, stderr, 0);
-               fprintf(stderr, "%s: %s\n",
+               fprintf(stderr,
+                       "%s: %s\n",
                        poptBadOption(pc, POPT_BADOPTION_NOALIAS),
                        poptStrerror(opt));
                ret = EXIT_FAILURE;
index 9b19d2d2d6d5424866a388ede519700ea0de2793..726fbc8ed0805e280115ab9e5b31dd6ae4513db4 100644 (file)
@@ -5,14 +5,15 @@
  *
  */
 
+#include "utils.h"
+
+#include <common/align.hpp>
+#include <common/error.hpp>
+
 #include <fcntl.h>
 #include <stdio.h>
 #include <sys/syscall.h>
 #include <unistd.h>
-#include <common/error.hpp>
-#include <common/align.hpp>
-
-#include "utils.h"
 
 #define MAX_LEN 16
 
  * This isn't a proper fix; it is simply the best we can do for now.
  * See bug #1261 for more context.
  */
-static
-void prefault_string(const char *p)
+static void prefault_string(const char *p)
 {
-       const char * const end = p + strlen(p) + 1;
+       const char *const end = p + strlen(p) + 1;
 
        while (p < end) {
                /*
@@ -41,8 +41,7 @@ void prefault_string(const char *p)
        }
 }
 
-static
-int open_read_close(const char *path)
+static int open_read_close(const char *path)
 {
        int fd, ret;
        char buf[MAX_LEN];
@@ -63,7 +62,9 @@ int open_read_close(const char *path)
        ret = syscall(SYS_read, fd, buf, MAX_LEN);
        if (ret < 0) {
                PERROR_NO_LOGGER("Failed to read file: path = '%s', fd = %d, length = %d",
-                               path, fd, MAX_LEN);
+                                path,
+                                fd,
+                                MAX_LEN);
                ret = -1;
                goto error;
        }
index ba506b1131b57eeb1e2f8313e16dc90546ba5d60..8a3014ea655e85204565eb0733ec986d55f78c7d 100644 (file)
@@ -9,6 +9,13 @@
 #define _GNU_SOURCE
 #endif
 
+#include "signal-helper.hpp"
+#include "utils.h"
+
+#include <common/compat/tid.hpp>
+#include <common/macros.hpp>
+
+#include <inttypes.h>
 #include <popt.h>
 #include <sched.h>
 #include <stdarg.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <inttypes.h>
-
-#include <common/compat/tid.hpp>
-#include <common/macros.hpp>
-
-#include "signal-helper.hpp"
-#include "utils.h"
 
 #define TRACEPOINT_DEFINE
 #include "tp.h"
  * but that use a libc that doesn't define its associated clone flag.
  */
 #ifndef CLONE_NEWNS
-#define CLONE_NEWNS     0x00020000
+#define CLONE_NEWNS 0x00020000
 #endif
 #ifndef CLONE_NEWCGROUP
 #define CLONE_NEWCGROUP 0x02000000
 #endif
 #ifndef CLONE_NEWUTS
-#define CLONE_NEWUTS    0x04000000
+#define CLONE_NEWUTS 0x04000000
 #endif
 #ifndef CLONE_NEWIPC
-#define CLONE_NEWIPC    0x08000000
+#define CLONE_NEWIPC 0x08000000
 #endif
 #ifndef CLONE_NEWUSER
-#define CLONE_NEWUSER   0x10000000
+#define CLONE_NEWUSER 0x10000000
 #endif
 #ifndef CLONE_NEWPID
-#define CLONE_NEWPID    0x20000000
+#define CLONE_NEWPID 0x20000000
 #endif
 #ifndef CLONE_NEWNET
-#define CLONE_NEWNET    0x40000000
+#define CLONE_NEWNET 0x40000000
 #endif
 #ifndef CLONE_NEWTIME
-#define CLONE_NEWTIME   0x00000080
+#define CLONE_NEWTIME 0x00000080
 #endif
 
 static int nr_iter = 100;
@@ -67,20 +67,29 @@ static char *ns_opt = NULL;
 static char *after_unshare_file_path = NULL;
 static char *before_second_event_file_path = NULL;
 
-static
-struct poptOption opts[] = {
+static struct poptOption opts[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
        { "debug", 'd', POPT_ARG_NONE, &debug, 0, "Enable debug output", NULL },
        { "ns", 'n', POPT_ARG_STRING, &ns_opt, 0, "Namespace short identifier", NULL },
        { "iter", 'i', POPT_ARG_INT, &nr_iter, 0, "Number of tracepoint iterations", NULL },
-       { "after", 'a', POPT_ARG_STRING, &after_unshare_file_path, 0, "after_unshare_file_path,", NULL },
-       { "before", 'b', POPT_ARG_STRING, &before_second_event_file_path, 0, "before_second_event_file_path,", NULL },
-       POPT_AUTOHELP
-       { NULL, 0, 0, NULL, 0 }
+       { "after",
+         'a',
+         POPT_ARG_STRING,
+         &after_unshare_file_path,
+         0,
+         "after_unshare_file_path,",
+         NULL },
+       { "before",
+         'b',
+         POPT_ARG_STRING,
+         &before_second_event_file_path,
+         0,
+         "before_second_event_file_path,",
+         NULL },
+       POPT_AUTOHELP{ NULL, 0, 0, NULL, 0 }
 };
 
-static ATTR_FORMAT_PRINTF(1, 2)
-void debug_printf(const char *format, ...)
+static ATTR_FORMAT_PRINTF(1, 2) void debug_printf(const char *format, ...)
 {
        va_list args;
        va_start(args, format);
@@ -101,8 +110,7 @@ static int get_ns_inum(const char *ns, ino_t *ns_inum)
        /*
         * /proc/thread-self was introduced in kernel v3.17
         */
-       if (snprintf(proc_ns_path, LTTNG_PROC_NS_PATH_MAX,
-                       "/proc/thread-self/ns/%s", ns) >= 0) {
+       if (snprintf(proc_ns_path, LTTNG_PROC_NS_PATH_MAX, "/proc/thread-self/ns/%s", ns) >= 0) {
                if (stat(proc_ns_path, &sb) == 0) {
                        *ns_inum = sb.st_ino;
                        ret = 0;
@@ -110,8 +118,11 @@ static int get_ns_inum(const char *ns, ino_t *ns_inum)
                goto end;
        }
 
-       if (snprintf(proc_ns_path, LTTNG_PROC_NS_PATH_MAX,
-                       "/proc/self/task/%d/%s/net", lttng_gettid(), ns) >= 0) {
+       if (snprintf(proc_ns_path,
+                    LTTNG_PROC_NS_PATH_MAX,
+                    "/proc/self/task/%d/%s/net",
+                    lttng_gettid(),
+                    ns) >= 0) {
                if (stat(proc_ns_path, &sb) == 0) {
                        *ns_inum = sb.st_ino;
                        ret = 0;
@@ -129,8 +140,7 @@ static int do_the_needful(int ns_flag, const char *ns_str)
 
        ret = get_ns_inum(ns_str, &ns1);
        if (ret) {
-               debug_printf("Failed to get ns inode number for namespace %s",
-                               ns_str);
+               debug_printf("Failed to get ns inode number for namespace %s", ns_str);
                ret = -1;
                goto end;
        }
@@ -151,8 +161,7 @@ static int do_the_needful(int ns_flag, const char *ns_str)
 
        ret = get_ns_inum(ns_str, &ns2);
        if (ret) {
-               debug_printf("Failed to get ns inode number for namespace %s",
-                               ns_str);
+               debug_printf("Failed to get ns inode number for namespace %s", ns_str);
                ret = -1;
                goto end;
        }
@@ -219,9 +228,10 @@ int main(int argc, const char **argv)
        if (opt < -1) {
                /* An error occurred during option processing. */
                poptPrintUsage(pc, stderr, 0);
-               fprintf(stderr, "%s: %s\n",
-                               poptBadOption(pc, POPT_BADOPTION_NOALIAS),
-                               poptStrerror(opt));
+               fprintf(stderr,
+                       "%s: %s\n",
+                       poptBadOption(pc, POPT_BADOPTION_NOALIAS),
+                       poptStrerror(opt));
                ret = EXIT_FAILURE;
                goto end;
        }
index b66f1ce8c6efc099c1aa5eb0aa71ed602e97426f..5c5ba3114b4ad2a04d3e2eed88d9919eff0101d0 100644 (file)
@@ -6,10 +6,17 @@
  */
 
 #define _LGPL_SOURCE
-#include <getopt.h>
+#include "signal-helper.hpp"
+#include "utils.h"
+
 #include <arpa/inet.h>
+#include <errno.h>
 #include <fcntl.h>
+#include <getopt.h>
+#include <poll.h>
+#include <signal.h>
 #include <stdarg.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <stdbool.h>
-#include <signal.h>
-#include <poll.h>
-#include <errno.h>
-#include "utils.h"
-#include "signal-helper.hpp"
 
 #define TRACEPOINT_DEFINE
 #include "tp.h"
 
-static struct option long_options[] =
-{
+static struct option long_options[] = {
        /* These options set a flag. */
-       {"iter", required_argument, 0, 'i'},
-       {"wait", required_argument, 0, 'w'},
-       {"sync-after-first-event", required_argument, 0, 'a'},
-       {"sync-before-last-event", required_argument, 0, 'b'},
-       {"sync-before-last-event-touch", required_argument, 0, 'c'},
-       {"sync-before-exit", required_argument, 0, 'd'},
-       {"sync-before-exit-touch", required_argument, 0, 'e'},
-       {"emit-end-event", no_argument, 0, 'f'},
-       {0, 0, 0, 0}
+       { "iter", required_argument, 0, 'i' },
+       { "wait", required_argument, 0, 'w' },
+       { "sync-after-first-event", required_argument, 0, 'a' },
+       { "sync-before-last-event", required_argument, 0, 'b' },
+       { "sync-before-last-event-touch", required_argument, 0, 'c' },
+       { "sync-before-exit", required_argument, 0, 'd' },
+       { "sync-before-exit-touch", required_argument, 0, 'e' },
+       { "emit-end-event", no_argument, 0, 'f' },
+       { 0, 0, 0, 0 }
 };
 
 int main(int argc, char **argv)
@@ -72,8 +72,8 @@ int main(int argc, char **argv)
                net_values[i] = htonl(net_values[i]);
        }
 
-       while ((option = getopt_long(argc, argv, "i:w:a:b:c:d:e:f",
-                               long_options, &option_index)) != -1) {
+       while ((option = getopt_long(argc, argv, "i:w:a:b:c:d:e:f", long_options, &option_index)) !=
+              -1) {
                switch (option) {
                case 'a':
                        after_first_event_file_path = strdup(optarg);
@@ -124,7 +124,6 @@ int main(int argc, char **argv)
                goto end;
        }
 
-
        if (set_signal_handler()) {
                ret = -1;
                goto end;
@@ -151,8 +150,17 @@ int main(int argc, char **argv)
                        }
                }
                netint = htonl(i);
-               tracepoint(tp, tptest, i, netint, values, text,
-                       strlen(text), escape, net_values, dbl, flt);
+               tracepoint(tp,
+                          tptest,
+                          i,
+                          netint,
+                          values,
+                          text,
+                          strlen(text),
+                          escape,
+                          net_values,
+                          dbl,
+                          flt);
 
                /*
                 * First loop we create the file if asked to indicate
@@ -169,7 +177,7 @@ int main(int argc, char **argv)
                }
 
                if (nr_usec) {
-                       if (usleep_safe(nr_usec)) {
+                       if (usleep_safe(nr_usec)) {
                                ret = -1;
                                goto end;
                        }
index d59dfa3d81c919cf1993bb7487ac5a302e8f1bb6..b6270c60eb0f68c8be99595c432965641ea535e9 100644 (file)
@@ -6,9 +6,10 @@
  */
 
 #define _LGPL_SOURCE
-#include <stdio.h>
 #include "signal-helper.hpp"
 
+#include <stdio.h>
+
 #define TRACEPOINT_DEFINE
 #include "tp.h"
 
@@ -21,8 +22,7 @@ int main(int argc, char **argv)
        }
 
        if (argc <= 3) {
-               fprintf(stderr, "Usage: %s COUNT STRING [STRING]...\n",
-                       argv[0]);
+               fprintf(stderr, "Usage: %s COUNT STRING [STRING]...\n", argv[0]);
                return 1;
        }
 
index a2aae040f9b01cefb419332afdc0175f10c1546d..e7a44151bb03d8b7d6903be43d2d477fdb4240df 100644 (file)
@@ -6,6 +6,9 @@
  */
 
 #define _LGPL_SOURCE
+#include "signal-helper.hpp"
+#include "utils.h"
+
 #include <arpa/inet.h>
 #include <getopt.h>
 #include <stdarg.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include "utils.h"
-#include "signal-helper.hpp"
 
 #define TRACEPOINT_DEFINE
 #include "tp.h"
 
-static struct option long_options[] =
-{
+static struct option long_options[] = {
        /* These options set a flag. */
-       {"iter", required_argument, 0, 'i'},
-       {"wait", required_argument, 0, 'w'},
-       {"create-in-main", required_argument, 0, 'm'},
-       {"wait-before-first-event", required_argument, 0, 'b'},
-       {0, 0, 0, 0}
+       { "iter", required_argument, 0, 'i' },
+       { "wait", required_argument, 0, 'w' },
+       { "create-in-main", required_argument, 0, 'm' },
+       { "wait-before-first-event", required_argument, 0, 'b' },
+       { 0, 0, 0, 0 }
 };
 
 int main(int argc, char **argv)
@@ -44,8 +44,7 @@ int main(int argc, char **argv)
        char *wait_before_first_event_file_path = NULL;
        char *create_in_main_file_path = NULL;
 
-       while ((option = getopt_long(argc, argv, "i:w:b:m:",
-                       long_options, &option_index)) != -1) {
+       while ((option = getopt_long(argc, argv, "i:w:b:m:", long_options, &option_index)) != -1) {
                switch (option) {
                case 'b':
                        wait_before_first_event_file_path = strdup(optarg);
@@ -92,18 +91,13 @@ int main(int argc, char **argv)
 
        for (i = 0; i < nr_iter; i++) {
                netint = htonl(i);
-               tracepoint(tp, tptest1, i, netint, values, text, strlen(text),
-                          dbl, flt);
-               tracepoint(tp, tptest2, i, netint, values, text, strlen(text),
-                               dbl, flt);
-               tracepoint(tp, tptest3, i, netint, values, text, strlen(text),
-                               dbl, flt);
-               tracepoint(tp, tptest4, i, netint, values, text, strlen(text),
-                               dbl, flt);
-               tracepoint(tp, tptest5, i, netint, values, text, strlen(text),
-                               dbl, flt);
+               tracepoint(tp, tptest1, i, netint, values, text, strlen(text), dbl, flt);
+               tracepoint(tp, tptest2, i, netint, values, text, strlen(text), dbl, flt);
+               tracepoint(tp, tptest3, i, netint, values, text, strlen(text), dbl, flt);
+               tracepoint(tp, tptest4, i, netint, values, text, strlen(text), dbl, flt);
+               tracepoint(tp, tptest5, i, netint, values, text, strlen(text), dbl, flt);
                if (nr_usec) {
-                       if (usleep_safe(nr_usec)) {
+                       if (usleep_safe(nr_usec)) {
                                ret = -1;
                                goto end;
                        }
index 31aa3798f99432c198696d55100d9d347c5210c2..011c399522451a407dbfd824fe380365e43043d6 100644 (file)
@@ -7,6 +7,12 @@
  */
 
 #define _LGPL_SOURCE
+#include "signal-helper.hpp"
+
+#include <common/macros.hpp>
+
+#include <lttng/tracef.h>
+
 #include <fcntl.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/macros.hpp>
-#include <lttng/tracef.h>
-#include "signal-helper.hpp"
-
 const char *str = "test string";
 
-static
-void create_file(const char *path)
+static void create_file(const char *path)
 {
        int ret;
 
index 05a20c7a188466471b8a39370178b295eaa122da..7dd53df39c1b3dd10b9e2fb6fb33cbb7a1064942 100644 (file)
@@ -6,10 +6,12 @@
  */
 
 #include "test_class.hpp"
-test_class::test_class() {
+test_class::test_class()
+{
        test_member = 1;
 }
 
-void test_class::test_method() {
+void test_class::test_method()
+{
        test_member += 1;
 }
index 544628ff9deee18bdf9e45d4c65f1745277e593c..18091e22d0244692899afb99d9e4405fe2db42c1 100644 (file)
@@ -9,7 +9,7 @@
 
 volatile int not_a_function = 0;
 
-void test_cxx_function() __attribute__ ((noinline));
+void test_cxx_function() __attribute__((noinline));
 void test_cxx_function()
 {
        not_a_function += 1;
index 0f1bd28c7e7a3da58d09abc63c5c3270347b7071..4ec36f1145b79b0e02fbc4e217f2e562747dabf7 100644 (file)
@@ -5,8 +5,13 @@
  *
  */
 
+#include "utils.h"
+
+#include <common/compat/errno.hpp>
 #include <common/compat/time.hpp>
+#include <common/macros.hpp>
 #include <common/time.hpp>
+
 #include <fcntl.h>
 #include <poll.h>
 #include <stdbool.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/compat/errno.hpp>
-#include <common/macros.hpp>
-
-#include "utils.h"
-
-static inline
-int64_t elapsed_time_ns(struct timespec *t1, struct timespec *t2)
+static inline int64_t elapsed_time_ns(struct timespec *t1, struct timespec *t2)
 {
        struct timespec delta;
 
        LTTNG_ASSERT(t1 && t2);
        delta.tv_sec = t2->tv_sec - t1->tv_sec;
        delta.tv_nsec = t2->tv_nsec - t1->tv_nsec;
-       return ((int64_t) NSEC_PER_SEC * (int64_t) delta.tv_sec) +
-                       (int64_t) delta.tv_nsec;
+       return ((int64_t) NSEC_PER_SEC * (int64_t) delta.tv_sec) + (int64_t) delta.tv_nsec;
 }
 
 int usleep_safe(useconds_t usec)
@@ -101,24 +99,23 @@ int wait_on_file(const char *path)
        for (;;) {
                ret = stat(path, &buf);
                if (ret == -1 && errno == ENOENT) {
-                       ret = poll(NULL, 0, 10);        /* 10 ms delay */
+                       ret = poll(NULL, 0, 10); /* 10 ms delay */
                        /* Should return 0 everytime */
                        if (ret) {
                                if (ret < 0) {
                                        perror("perror");
                                } else {
-                                       fprintf(stderr,
-                                               "poll return value is larger than zero\n");
+                                       fprintf(stderr, "poll return value is larger than zero\n");
                                }
                                return -1;
                        }
-                       continue;                       /* retry */
+                       continue; /* retry */
                }
                if (ret) {
                        perror("stat");
                        return -1;
                }
-               break;  /* found */
+               break; /* found */
        }
 
        return 0;
index 9bfd50bda83d8e8ed829e2a7277eef2ae419cc28..80b895411ab45b864208d33f2b673a19e0fe0c7e 100644 (file)
  *     node;b;
  *     node;c;
  */
+#include <common/defaults.hpp>
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/xpath.h>
-#include <libxml/xpathInternals.h>
-#include <common/defaults.hpp>
-
 #if defined(LIBXML_XPATH_ENABLED)
 
 static int opt_verbose;
@@ -65,8 +65,9 @@ static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
                LTTNG_ASSERT(nodes->nodeTab[i]);
 
                if (nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) {
-                       fprintf(stderr, "ERR:%s\n",
-                                       "This executable does not support xml namespacing\n");
+                       fprintf(stderr,
+                               "ERR:%s\n",
+                               "This executable does not support xml namespacing\n");
                        ret = -1;
                        goto end;
                } else if (nodes->nodeTab[i]->type == XML_ELEMENT_NODE) {
@@ -74,16 +75,17 @@ static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
 
                        if (xmlChildElementCount(cur) == 0) {
                                if (xmlNodeIsText(cur->children)) {
-                                       node_child_value_string = xmlNodeListGetString(doc,
-                                                       cur->children, 1);
+                                       node_child_value_string =
+                                               xmlNodeListGetString(doc, cur->children, 1);
                                        if (node_exist) {
                                                result = true;
                                        } else if (opt_verbose) {
-                                               fprintf(output, "%s;%s;\n", cur->name,
-                                                               node_child_value_string);
+                                               fprintf(output,
+                                                       "%s;%s;\n",
+                                                       cur->name,
+                                                       node_child_value_string);
                                        } else {
-                                               fprintf(output, "%s\n",
-                                                               node_child_value_string);
+                                               fprintf(output, "%s\n", node_child_value_string);
                                        }
                                        xmlFree(node_child_value_string);
                                } else {
@@ -91,8 +93,9 @@ static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
                                        if (node_exist) {
                                                result = true;
                                        } else {
-                                               fprintf(stderr, "ERR:%s\n",
-                                                               "Xpath expression return non-final xml element");
+                                               fprintf(stderr,
+                                                       "ERR:%s\n",
+                                                       "Xpath expression return non-final xml element");
                                                ret = -1;
                                                goto end;
                                        }
@@ -102,8 +105,9 @@ static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
                                        result = true;
                                } else {
                                        /* We don't want to print non-final element */
-                                       fprintf(stderr, "ERR:%s\n",
-                                                       "Xpath expression return non-final xml element");
+                                       fprintf(stderr,
+                                               "ERR:%s\n",
+                                               "Xpath expression return non-final xml element");
                                        ret = -1;
                                        goto end;
                                }
@@ -255,7 +259,7 @@ int main(int argc, char **argv)
                return -1;
        }
        /* Do the main job */
-       if (extract_xpath(argv[optind], (xmlChar *)argv[optind+1])) {
+       if (extract_xpath(argv[optind], (xmlChar *) argv[optind + 1])) {
                return -1;
        }
 
index 887f7af524c146a2f1f6d8b5ecd2ee018cc981c3..aa2d526bd9096fccd590bb4234eb802a99bfeca9 100644 (file)
@@ -5,27 +5,27 @@
  *
  */
 
- /*
-  * This script validate and xml from an xsd.
-  * argv[1] Path of the xsd
-  * argv[2] Path to the XML to be validated
-  */
+/*
+ * This script validate and xml from an xsd.
+ * argv[1] Path of the xsd
+ * argv[2] Path to the XML to be validated
+ */
+
+#include <common/macros.hpp>
+
+#include <lttng/lttng-error.h>
 
 #include <ctype.h>
+#include <dirent.h>
+#include <inttypes.h>
+#include <libxml/parser.h>
+#include <libxml/xmlschemas.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-
-#include <libxml/xmlschemas.h>
-#include <libxml/parser.h>
-
-#include <lttng/lttng-error.h>
-#include <common/macros.hpp>
+#include <sys/types.h>
+#include <unistd.h>
 
 namespace {
 struct validation_ctx {
@@ -35,14 +35,11 @@ struct validation_ctx {
 };
 } /* namespace */
 
-enum command_err_code {
-       CMD_SUCCESS = 0,
-       CMD_ERROR
-};
+enum command_err_code { CMD_SUCCESS = 0, CMD_ERROR };
 
-static ATTR_FORMAT_PRINTF(2, 3)
-void xml_error_handler(void *ctx __attribute__((unused)),
-               const char *format, ...)
+static ATTR_FORMAT_PRINTF(2, 3) void xml_error_handler(void *ctx __attribute__((unused)),
+                                                      const char *format,
+                                                      ...)
 {
        char *err_msg;
        va_list args;
@@ -52,8 +49,7 @@ void xml_error_handler(void *ctx __attribute__((unused)),
        ret = vasprintf(&err_msg, format, args);
        va_end(args);
        if (ret == -1) {
-               fprintf(stderr, "ERR: %s\n",
-                               "String allocation failed in xml error handle");
+               fprintf(stderr, "ERR: %s\n", "String allocation failed in xml error handle");
                return;
        }
 
@@ -61,9 +57,7 @@ void xml_error_handler(void *ctx __attribute__((unused)),
        free(err_msg);
 }
 
-static
-void fini_validation_ctx(
-       struct validation_ctx *ctx)
+static void fini_validation_ctx(struct validation_ctx *ctx)
 {
        if (ctx->parser_ctx) {
                xmlSchemaFreeParserCtxt(ctx->parser_ctx);
@@ -80,9 +74,7 @@ void fini_validation_ctx(
        memset(ctx, 0, sizeof(struct validation_ctx));
 }
 
-static
-int init_validation_ctx(
-       struct validation_ctx *ctx, char *xsd_path)
+static int init_validation_ctx(struct validation_ctx *ctx, char *xsd_path)
 {
        int ret;
 
@@ -96,8 +88,7 @@ int init_validation_ctx(
                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                goto end;
        }
-       xmlSchemaSetParserErrors(ctx->parser_ctx, xml_error_handler,
-               xml_error_handler, NULL);
+       xmlSchemaSetParserErrors(ctx->parser_ctx, xml_error_handler, xml_error_handler, NULL);
 
        ctx->schema = xmlSchemaParse(ctx->parser_ctx);
        if (!ctx->schema) {
@@ -111,8 +102,8 @@ int init_validation_ctx(
                goto end;
        }
 
-       xmlSchemaSetValidErrors(ctx->schema_validation_ctx, xml_error_handler,
-                       xml_error_handler, NULL);
+       xmlSchemaSetValidErrors(
+               ctx->schema_validation_ctx, xml_error_handler, xml_error_handler, NULL);
        ret = 0;
 
 end:
This page took 1.860264 seconds and 4 git commands to generate.