From 28f23191dcbf047429d51950a337a57d7a3f866a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 12 Apr 2023 11:57:50 -0400 Subject: [PATCH] Clean-up: run format-cpp on the tree MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The original re-format commit missed a number of files that were caught by format-cpp. Hopefully this is the last large reformat commit for a while. Change-Id: I493ee6d9fe6187e0bd087c68ed346af69c929c1e Signed-off-by: Jérémie Galarneau --- doc/examples/rotation/rotate-client-example.c | 54 +- .../instrumented-app.c | 7 +- .../tracepoint-trigger-example.h | 10 +- extras/core-handler/crash.c | 1 - include/lttng/action/action-internal.hpp | 52 +- include/lttng/action/action.h | 3 +- include/lttng/action/list-internal.hpp | 29 +- include/lttng/action/list.h | 13 +- include/lttng/action/notify-internal.hpp | 7 +- include/lttng/action/notify.h | 12 +- include/lttng/action/path-internal.hpp | 16 +- include/lttng/action/path.h | 15 +- include/lttng/action/rate-policy-internal.hpp | 24 +- include/lttng/action/rate-policy.h | 22 +- .../lttng/action/rotate-session-internal.hpp | 5 +- include/lttng/action/rotate-session.h | 21 +- .../action/snapshot-session-internal.hpp | 9 +- include/lttng/action/snapshot-session.h | 34 +- .../lttng/action/start-session-internal.hpp | 5 +- include/lttng/action/start-session.h | 21 +- .../lttng/action/stop-session-internal.hpp | 5 +- include/lttng/action/stop-session.h | 21 +- include/lttng/channel-internal.hpp | 11 +- include/lttng/channel.h | 42 +- include/lttng/clear-handle.h | 8 +- include/lttng/clear.h | 4 +- .../lttng/condition/buffer-usage-internal.hpp | 33 +- include/lttng/condition/buffer-usage.h | 72 +-- .../lttng/condition/condition-internal.hpp | 26 +- include/lttng/condition/condition.h | 4 +- .../lttng/condition/evaluation-internal.hpp | 18 +- include/lttng/condition/evaluation.h | 4 +- .../condition/event-rule-matches-internal.hpp | 48 +- include/lttng/condition/event-rule-matches.h | 25 +- .../session-consumed-size-internal.hpp | 22 +- .../lttng/condition/session-consumed-size.h | 31 +- .../condition/session-rotation-internal.hpp | 38 +- include/lttng/condition/session-rotation.h | 28 +- include/lttng/constant.h | 16 +- include/lttng/destruction-handle.h | 24 +- include/lttng/domain-internal.hpp | 2 +- include/lttng/domain.h | 25 +- include/lttng/endpoint-internal.hpp | 3 +- include/lttng/error-query-internal.hpp | 65 +- include/lttng/error-query.h | 59 +- include/lttng/event-expr-internal.hpp | 17 +- include/lttng/event-expr.h | 42 +- include/lttng/event-field-value-internal.hpp | 53 +- include/lttng/event-field-value.h | 33 +- include/lttng/event-internal.hpp | 48 +- .../lttng/event-rule/event-rule-internal.hpp | 41 +- include/lttng/event-rule/event-rule.h | 4 +- .../lttng/event-rule/jul-logging-internal.hpp | 8 +- include/lttng/event-rule/jul-logging.h | 27 +- .../event-rule/kernel-kprobe-internal.hpp | 8 +- include/lttng/event-rule/kernel-kprobe.h | 19 +- .../event-rule/kernel-syscall-internal.hpp | 10 +- include/lttng/event-rule/kernel-syscall.h | 26 +- .../event-rule/kernel-tracepoint-internal.hpp | 8 +- include/lttng/event-rule/kernel-tracepoint.h | 20 +- .../event-rule/kernel-uprobe-internal.hpp | 11 +- include/lttng/event-rule/kernel-uprobe.h | 19 +- .../event-rule/log4j-logging-internal.hpp | 8 +- include/lttng/event-rule/log4j-logging.h | 31 +- .../event-rule/python-logging-internal.hpp | 8 +- include/lttng/event-rule/python-logging.h | 32 +- .../event-rule/user-tracepoint-internal.hpp | 8 +- include/lttng/event-rule/user-tracepoint.h | 40 +- include/lttng/event.h | 268 ++++---- include/lttng/handle.h | 5 +- include/lttng/health-internal.hpp | 34 +- include/lttng/health.h | 5 +- include/lttng/kernel-probe-internal.hpp | 29 +- include/lttng/kernel-probe.h | 35 +- include/lttng/load-internal.hpp | 9 +- include/lttng/load.h | 60 +- include/lttng/location-internal.hpp | 36 +- include/lttng/location.h | 25 +- include/lttng/log-level-rule-internal.hpp | 32 +- include/lttng/log-level-rule.h | 18 +- include/lttng/lttng-error.h | 326 +++++----- include/lttng/lttng-export.h | 4 +- include/lttng/lttng.h | 18 +- .../lttng/notification/channel-internal.hpp | 3 +- include/lttng/notification/channel.h | 29 +- .../notification/notification-internal.hpp | 24 +- include/lttng/notification/notification.h | 12 +- include/lttng/ref-internal.hpp | 9 +- include/lttng/rotate-internal.hpp | 9 +- include/lttng/rotation.h | 88 ++- include/lttng/save-internal.hpp | 7 +- include/lttng/save.h | 40 +- include/lttng/session-descriptor-internal.hpp | 60 +- include/lttng/session-descriptor.h | 31 +- include/lttng/session-internal.hpp | 3 +- include/lttng/session.h | 28 +- include/lttng/snapshot-internal.hpp | 6 +- include/lttng/snapshot.h | 52 +- include/lttng/tracker.h | 145 ++--- include/lttng/trigger/trigger-internal.hpp | 82 ++- include/lttng/trigger/trigger.h | 56 +- include/lttng/userspace-probe-internal.hpp | 36 +- include/lttng/userspace-probe.h | 68 +- src/bin/lttng-consumerd/health-consumerd.hpp | 10 +- src/bin/lttng-consumerd/lttng-consumerd.hpp | 5 +- .../backward-compatibility-group-by.hpp | 4 +- src/bin/lttng-relayd/cmd-2-1.hpp | 4 +- src/bin/lttng-relayd/cmd-2-11.hpp | 26 +- src/bin/lttng-relayd/cmd-2-2.hpp | 7 +- src/bin/lttng-relayd/cmd-2-4.hpp | 7 +- src/bin/lttng-relayd/cmd.hpp | 2 +- src/bin/lttng-relayd/connection.hpp | 44 +- src/bin/lttng-relayd/ctf-trace.hpp | 20 +- src/bin/lttng-relayd/health-relayd.hpp | 17 +- src/bin/lttng-relayd/index.hpp | 25 +- src/bin/lttng-relayd/live.hpp | 4 +- src/bin/lttng-relayd/lttng-relayd.hpp | 13 +- src/bin/lttng-relayd/lttng-viewer-abi.hpp | 123 ++-- src/bin/lttng-relayd/main.cpp | 13 +- src/bin/lttng-relayd/session.hpp | 40 +- .../lttng-relayd/sessiond-trace-chunks.hpp | 49 +- src/bin/lttng-relayd/stream.hpp | 60 +- src/bin/lttng-relayd/tracefile-array.hpp | 12 +- src/bin/lttng-relayd/viewer-session.hpp | 29 +- src/bin/lttng-relayd/viewer-stream.hpp | 19 +- src/bin/lttng-sessiond/action-executor.hpp | 15 +- src/bin/lttng-sessiond/agent-thread.hpp | 6 +- src/bin/lttng-sessiond/agent.hpp | 56 +- src/bin/lttng-sessiond/buffer-registry.hpp | 67 +- src/bin/lttng-sessiond/channel.hpp | 27 +- src/bin/lttng-sessiond/client.cpp | 6 +- src/bin/lttng-sessiond/clock-class.hpp | 1 + src/bin/lttng-sessiond/cmd.cpp | 3 +- src/bin/lttng-sessiond/cmd.hpp | 187 +++--- src/bin/lttng-sessiond/condition-internal.hpp | 3 +- src/bin/lttng-sessiond/consumer.hpp | 252 ++++---- src/bin/lttng-sessiond/context.hpp | 16 +- .../ctf2-trace-class-visitor.hpp | 6 +- src/bin/lttng-sessiond/dispatch.hpp | 7 +- src/bin/lttng-sessiond/event-class.hpp | 11 +- .../event-notifier-error-accounting.hpp | 34 +- src/bin/lttng-sessiond/event.cpp | 1 - src/bin/lttng-sessiond/event.hpp | 56 +- src/bin/lttng-sessiond/field.hpp | 150 ++--- src/bin/lttng-sessiond/health-sessiond.hpp | 23 +- src/bin/lttng-sessiond/kern-modules.hpp | 10 +- src/bin/lttng-sessiond/kernel-consumer.hpp | 22 +- src/bin/lttng-sessiond/kernel.cpp | 2 +- src/bin/lttng-sessiond/kernel.hpp | 70 +-- src/bin/lttng-sessiond/lttng-sessiond.hpp | 2 +- src/bin/lttng-sessiond/lttng-syscall.hpp | 9 +- src/bin/lttng-sessiond/main.cpp | 5 +- src/bin/lttng-sessiond/manage-apps.hpp | 3 +- src/bin/lttng-sessiond/manage-consumer.hpp | 3 +- src/bin/lttng-sessiond/manage-kernel.hpp | 3 +- .../notification-thread-commands.hpp | 123 ++-- .../notification-thread-events.hpp | 47 +- .../notification-thread-internal.hpp | 33 +- .../lttng-sessiond/notification-thread.hpp | 23 +- src/bin/lttng-sessiond/notify-apps.hpp | 5 +- src/bin/lttng-sessiond/register.hpp | 6 +- src/bin/lttng-sessiond/rotation-thread.cpp | 30 +- src/bin/lttng-sessiond/rotation-thread.hpp | 7 +- src/bin/lttng-sessiond/save.hpp | 6 +- src/bin/lttng-sessiond/session.cpp | 4 +- src/bin/lttng-sessiond/session.hpp | 74 +-- src/bin/lttng-sessiond/sessiond-config.hpp | 1 + src/bin/lttng-sessiond/snapshot.hpp | 40 +- src/bin/lttng-sessiond/stream-class.hpp | 10 +- src/bin/lttng-sessiond/thread.hpp | 8 +- src/bin/lttng-sessiond/timer.cpp | 2 +- src/bin/lttng-sessiond/timer.hpp | 9 +- src/bin/lttng-sessiond/trace-class.hpp | 2 +- src/bin/lttng-sessiond/trace-kernel.hpp | 60 +- src/bin/lttng-sessiond/trace-ust.hpp | 236 ++++--- src/bin/lttng-sessiond/tracker.hpp | 27 +- .../tsdl-trace-class-visitor.cpp | 4 +- .../tsdl-trace-class-visitor.hpp | 18 +- src/bin/lttng-sessiond/ust-abi-internal.hpp | 260 ++++---- src/bin/lttng-sessiond/ust-app.hpp | 391 +++++------- src/bin/lttng-sessiond/ust-consumer.hpp | 31 +- src/bin/lttng-sessiond/ust-ctl-internal.hpp | 382 ++++++------ src/bin/lttng-sessiond/ust-error-internal.hpp | 32 +- src/bin/lttng-sessiond/ust-field-convert.hpp | 16 +- .../lttng-sessiond/ust-registry-channel.hpp | 33 +- src/bin/lttng-sessiond/ust-registry-event.hpp | 33 +- .../ust-registry-session-pid.hpp | 21 +- .../ust-registry-session-uid.hpp | 22 +- .../lttng-sessiond/ust-registry-session.hpp | 47 +- src/bin/lttng-sessiond/ust-registry.hpp | 197 +++--- src/bin/lttng-sessiond/ust-sigbus.hpp | 3 +- src/bin/lttng-sessiond/utils.hpp | 7 +- src/bin/lttng/command.hpp | 37 +- src/bin/lttng/commands/disable_events.cpp | 3 +- src/bin/lttng/loglevel.hpp | 28 +- src/bin/lttng/uprobe.hpp | 3 +- src/bin/lttng/utils.hpp | 15 +- src/common/align.hpp | 28 +- src/common/argpar-utils/argpar-utils.hpp | 20 +- src/common/argpar/argpar.c | 214 +++---- src/common/argpar/argpar.h | 36 +- src/common/buffer-view.hpp | 16 +- src/common/bug.hpp | 31 +- src/common/bytecode/bytecode.hpp | 254 ++++---- src/common/common.hpp | 2 +- src/common/compat/directory-handle.hpp | 133 ++-- src/common/compat/dirent.hpp | 18 +- src/common/compat/endian.hpp | 250 ++++---- src/common/compat/fcntl.hpp | 46 +- src/common/compat/getenv.hpp | 13 +- src/common/compat/netdb.hpp | 10 +- src/common/compat/paths.hpp | 2 +- src/common/compat/poll.hpp | 128 ++-- src/common/compat/pthread.hpp | 34 +- src/common/compat/socket.hpp | 70 +-- src/common/compat/string.hpp | 26 +- src/common/compat/time.hpp | 13 +- src/common/config/config-session-abi.hpp | 320 +++++----- src/common/config/session-config.hpp | 31 +- .../consumer/consumer-metadata-cache.hpp | 9 +- src/common/consumer/consumer-stream.hpp | 53 +- src/common/consumer/consumer-timer.hpp | 22 +- src/common/consumer/consumer.hpp | 246 ++++---- src/common/consumer/metadata-bucket.hpp | 5 +- src/common/context.hpp | 3 +- src/common/credentials.hpp | 12 +- src/common/daemonize.hpp | 6 +- src/common/defaults.hpp | 323 +++++----- src/common/dynamic-array.hpp | 58 +- src/common/dynamic-buffer.hpp | 19 +- src/common/error.hpp | 200 +++--- src/common/event-rule/user-tracepoint.cpp | 3 +- src/common/exception.hpp | 44 +- src/common/fd-tracker/fd-tracker.hpp | 29 +- src/common/fd-tracker/inode.hpp | 35 +- src/common/fd-tracker/utils.hpp | 22 +- src/common/file-descriptor.hpp | 1 + src/common/filter.hpp | 6 +- src/common/filter/filter-ast.hpp | 26 +- src/common/filter/filter-ir.hpp | 13 +- src/common/filter/filter-symbols.hpp | 54 +- src/common/filter/memstream.hpp | 11 +- src/common/format.hpp | 2 +- src/common/fs-handle.hpp | 1 + src/common/hashtable/hashtable-symbols.hpp | 32 +- src/common/hashtable/hashtable.hpp | 70 +-- src/common/index-allocator.hpp | 27 +- src/common/index/ctf-index.hpp | 38 +- src/common/index/index.hpp | 45 +- src/common/ini-config/ini-config.hpp | 6 +- .../kernel-consumer/kernel-consumer.hpp | 18 +- src/common/kernel-ctl/kernel-ctl.hpp | 23 +- src/common/kernel-ctl/kernel-ioctl.hpp | 209 +++---- src/common/locked-reference.hpp | 2 +- src/common/lttng-elf.hpp | 13 +- src/common/lttng-kernel-old.hpp | 21 +- src/common/lttng-kernel.hpp | 172 +++--- src/common/macros.hpp | 100 ++- src/common/make-unique-wrapper.hpp | 6 +- src/common/mi-lttng.hpp | 582 ++++++++---------- src/common/optional.hpp | 40 +- src/common/payload-view.hpp | 29 +- src/common/payload.hpp | 8 +- src/common/pipe.hpp | 6 +- src/common/pthread-lock.hpp | 2 +- src/common/random.cpp | 5 +- src/common/random.hpp | 6 +- src/common/readwrite.hpp | 3 +- src/common/relayd/relayd.hpp | 88 +-- src/common/runas.hpp | 44 +- src/common/sessiond-comm/agent.hpp | 31 +- src/common/sessiond-comm/inet.hpp | 22 +- src/common/sessiond-comm/inet6.hpp | 21 +- src/common/sessiond-comm/relayd.hpp | 51 +- src/common/sessiond-comm/sessiond-comm.hpp | 282 +++++---- src/common/snapshot.hpp | 20 +- src/common/spawn-viewer.hpp | 5 +- src/common/string-utils/format.hpp | 2 +- src/common/string-utils/string-utils.hpp | 16 +- src/common/testpoint/testpoint.hpp | 52 +- src/common/time.hpp | 38 +- src/common/trace-chunk-registry.hpp | 52 +- src/common/trace-chunk.hpp | 148 +++-- src/common/tracker.hpp | 51 +- src/common/unix.hpp | 28 +- src/common/urcu.hpp | 2 +- src/common/uri.hpp | 21 +- src/common/ust-consumer/ust-consumer.hpp | 245 ++++---- src/common/utils.hpp | 33 +- src/common/uuid.hpp | 36 +- src/common/waiter.hpp | 5 +- src/lib/lttng-ctl/lttng-ctl-health.cpp | 2 +- src/lib/lttng-ctl/lttng-ctl-helper.hpp | 48 +- tests/perf/find_event.c | 37 +- .../tools/filtering/gen-ust-events.c | 13 +- tests/regression/tools/filtering/tp.h | 73 ++- tests/regression/tools/health/health_check.c | 33 +- tests/regression/tools/health/health_fail.c | 6 +- tests/regression/tools/health/health_stall.c | 9 +- .../tools/notification/base_client.c | 81 +-- .../regression/tools/notification/rotation.c | 208 +++---- .../regression/tools/rotation/schedule_api.c | 154 ++--- .../tools/trigger/utils/notification-client.c | 106 ++-- tests/regression/ust/baddr-statedump/tp.h | 17 +- .../lttng-ust-clock-override-test.c | 43 +- tests/regression/ust/daemon/daemon.c | 4 +- .../regression/ust/daemon/ust_tests_daemon.h | 30 +- .../ust/exit-fast/ust_tests_exitfast.h | 8 +- tests/regression/ust/fork/fork.c | 4 +- tests/regression/ust/fork/ust_tests_fork.h | 47 +- .../lttng-ust-getcpu-override-test.c | 54 +- tests/regression/ust/high-throughput/main.c | 25 +- tests/regression/ust/high-throughput/tp.h | 47 +- tests/regression/ust/libc-wrapper/prog.c | 4 +- tests/regression/ust/linking/demo.c | 19 +- tests/regression/ust/linking/ust_tests_demo.h | 20 +- .../regression/ust/linking/ust_tests_demo2.h | 50 +- .../regression/ust/linking/ust_tests_demo3.h | 10 +- tests/regression/ust/low-throughput/tp.h | 11 +- tests/regression/ust/multi-lib/callsites.c | 6 +- .../regression/ust/multi-lib/multi-lib-test.c | 54 +- tests/regression/ust/multi-lib/probes.h | 234 +++---- .../ust/multi-session/ust_gen_nevents.h | 50 +- tests/regression/ust/overlap/demo/demo.c | 19 +- .../ust/overlap/demo/ust_tests_demo.h | 32 +- .../ust/overlap/demo/ust_tests_demo2.h | 50 +- .../ust/overlap/demo/ust_tests_demo3.h | 10 +- .../ust/type-declarations/type-declarations.c | 4 +- .../ust/type-declarations/ust_tests_td.h | 77 +-- tests/regression/ust/ust-dl/libbar-tp.h | 7 +- tests/regression/ust/ust-dl/libbar.h | 2 +- tests/regression/ust/ust-dl/libfoo-tp.h | 7 +- tests/regression/ust/ust-dl/libfoo.c | 2 +- tests/regression/ust/ust-dl/libfoo.h | 2 +- tests/regression/ust/ust-dl/libzzz-tp.h | 7 +- tests/regression/ust/ust-dl/libzzz.h | 2 +- tests/regression/ust/ust-dl/prog.c | 6 +- tests/utils/tap/tap.c | 162 +++-- tests/utils/tap/tap.h | 95 ++- .../gen-kernel-test-events.c | 7 +- .../gen-syscall-events-callstack.c | 36 +- tests/utils/testapp/gen-ust-events-ns/tp.h | 10 +- tests/utils/testapp/gen-ust-events/tp.h | 144 +++-- tests/utils/testapp/gen-ust-nevents-str/tp.h | 17 +- tests/utils/testapp/gen-ust-nevents/tp.h | 240 +++++--- tests/utils/testapp/signal-helper.hpp | 6 +- .../userspace-probe-elf-binary.c | 4 +- .../test_class.hpp | 5 +- .../userspace-probe-sdt-binary/libbar.c | 6 +- .../userspace-probe-sdt-binary/libfoo.c | 9 +- .../userspace-probe-sdt-binary/libzzz.c | 6 +- .../testapp/userspace-probe-sdt-binary/sema.c | 4 +- .../userspace-probe-sdt-binary.c | 14 +- tests/utils/utils.h | 16 +- 354 files changed, 7370 insertions(+), 7931 deletions(-) diff --git a/doc/examples/rotation/rotate-client-example.c b/doc/examples/rotation/rotate-client-example.c index 86e5b04f2..1f9070a04 100644 --- a/doc/examples/rotation/rotate-client-example.c +++ b/doc/examples/rotation/rotate-client-example.c @@ -32,12 +32,13 @@ */ #include + +#include #include #include #include #include #include -#include #define DEFAULT_DATA_AVAILABILITY_WAIT_TIME 200000 /* usec */ @@ -46,7 +47,7 @@ static volatile int quit = 0; static void sighandler(int signal __attribute__((unused))) { const char msg[] = "Signal caught, exiting\n"; - const int ret = write(STDOUT_FILENO, msg, sizeof(msg)); + const int ret = write(STDOUT_FILENO, msg, sizeof(msg)); assert(ret == 0); /* NOLINT assert is not async signal safe */ quit = 1; @@ -80,8 +81,7 @@ static int setup_session(const char *session_name, const char *path) strcpy(ev.name, "*"); ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL; - ret = lttng_enable_event_with_exclusions( - chan_handle, &ev, "mychan", NULL, 0, NULL); + ret = lttng_enable_event_with_exclusions(chan_handle, &ev, "mychan", NULL, 0, NULL); if (ret < 0) { fprintf(stderr, "Failed to enable events (ret = %i)\n", ret); goto end; @@ -157,16 +157,14 @@ static int rotate_session(const char *session_name, const char *ext_program) ret = lttng_rotate_session(session_name, NULL, &handle); if (ret < 0) { - fprintf(stderr, "Failed to rotate session, %s\n", - lttng_strerror(ret)); + fprintf(stderr, "Failed to rotate session, %s\n", lttng_strerror(ret)); goto end; } fflush(stdout); 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) { ret = -1; fprintf(stderr, "Failed to get the current rotation's state\n"); @@ -193,27 +191,24 @@ static int rotate_session(const char *session_name, const char *ext_program) const char *absolute_path; enum lttng_trace_archive_location_status location_status; - 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) { - fprintf(stderr, "Failed to retrieve the rotation's completed chunk archive location\n"); + fprintf(stderr, + "Failed to retrieve the rotation's completed chunk archive location\n"); ret = -1; goto end; } - location_status = - lttng_trace_archive_location_local_get_absolute_path( - location, &absolute_path); + location_status = lttng_trace_archive_location_local_get_absolute_path( + location, &absolute_path); if (location_status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) { fprintf(stderr, "Failed to get absolute path of completed chunk archive"); ret = -1; goto end; } - printf("Output files of session %s rotated to %s\n", - session_name, absolute_path); - ret = snprintf(cmd, PATH_MAX, "%s %s", ext_program, - absolute_path); + printf("Output files of session %s rotated to %s\n", session_name, absolute_path); + ret = snprintf(cmd, PATH_MAX, "%s %s", ext_program, absolute_path); if (ret < 0) { fprintf(stderr, "Failed to prepare command string\n"); goto end; @@ -223,20 +218,22 @@ static int rotate_session(const char *session_name, const char *ext_program) } case LTTNG_ROTATION_STATE_EXPIRED: printf("Output files of session %s rotated, but the handle expired\n", - session_name); + session_name); ret = 0; goto end; case LTTNG_ROTATION_STATE_ERROR: - fprintf(stderr, "An error occurred with the rotation of session %s\n", - session_name); + fprintf(stderr, + "An error occurred with the rotation of session %s\n", + session_name); ret = -1; goto end; case LTTNG_ROTATION_STATE_ONGOING: abort(); goto end; case LTTNG_ROTATION_STATE_NO_ROTATION: - fprintf(stderr, "No rotation was performed on rotation request for session %s\n", - session_name); + fprintf(stderr, + "No rotation was performed on rotation request for session %s\n", + session_name); ret = -1; goto end; } @@ -264,16 +261,15 @@ end: static void usage(const char *prog_name) { - fprintf(stderr, "Usage: %s \n", - prog_name); + fprintf(stderr, "Usage: %s \n", prog_name); fprintf(stderr, " : the name of the session you want to create\n"); fprintf(stderr, " : the delay in seconds between each rotation\n"); fprintf(stderr, - " : the number of rotation you want to perform, " - "-1 for infinite until ctrl-c\n"); + " : the number of rotation you want to perform, " + "-1 for infinite until ctrl-c\n"); fprintf(stderr, - " : program to run on each chunk, it must be " - "executable, and expect a trace folder as only argument\n"); + " : program to run on each chunk, it must be " + "executable, and expect a trace folder as only argument\n"); fprintf(stderr, "\nThe trace folder is deleted when this program completes.\n"); } diff --git a/doc/examples/trigger-condition-event-matches/instrumented-app.c b/doc/examples/trigger-condition-event-matches/instrumented-app.c index 465b4a123..6148d1c09 100644 --- a/doc/examples/trigger-condition-event-matches/instrumented-app.c +++ b/doc/examples/trigger-condition-event-matches/instrumented-app.c @@ -8,6 +8,7 @@ #include "tracepoint-trigger-example.h" #include + #include #include #include @@ -25,10 +26,10 @@ int main(void) 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 - Tracing event \"trigger_example:my_event\"\n", - time_str, tv.tv_usec); + time_str, + tv.tv_usec); tracepoint(trigger_example, my_event, i); sleep(2); diff --git a/doc/examples/trigger-condition-event-matches/tracepoint-trigger-example.h b/doc/examples/trigger-condition-event-matches/tracepoint-trigger-example.h index e82e3c704..9aad47e7c 100644 --- a/doc/examples/trigger-condition-event-matches/tracepoint-trigger-example.h +++ b/doc/examples/trigger-condition-event-matches/tracepoint-trigger-example.h @@ -16,12 +16,10 @@ #include -TRACEPOINT_EVENT(trigger_example, my_event, - TP_ARGS(int, iteration), - TP_FIELDS( - ctf_integer(uint64_t, iteration, iteration) - ) -) +TRACEPOINT_EVENT(trigger_example, + my_event, + TP_ARGS(int, iteration), + TP_FIELDS(ctf_integer(uint64_t, iteration, iteration))) #endif /* _TRACEPOINT_TRIGGER_EXAMPLE_H */ diff --git a/extras/core-handler/crash.c b/extras/core-handler/crash.c index bc7296814..c1e2a91bc 100644 --- a/extras/core-handler/crash.c +++ b/extras/core-handler/crash.c @@ -5,7 +5,6 @@ * */ - #include int main(void) diff --git a/include/lttng/action/action-internal.hpp b/include/lttng/action/action-internal.hpp index e52d91f59..bf55fa803 100644 --- a/include/lttng/action/action-internal.hpp +++ b/include/lttng/action/action-internal.hpp @@ -13,7 +13,9 @@ #include #include #include + #include + #include #include #include @@ -70,31 +72,29 @@ struct lttng_action_comm { } LTTNG_PACKED; 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); bool lttng_action_validate(struct lttng_action *action); -int lttng_action_serialize(struct lttng_action *action, - struct lttng_payload *buf); +int lttng_action_serialize(struct lttng_action *action, struct lttng_payload *buf); ssize_t lttng_action_create_from_payload(struct lttng_payload_view *view, - struct lttng_action **action); + struct lttng_action **action); -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); void lttng_action_get(struct lttng_action *action); void lttng_action_put(struct lttng_action *action); -const char* lttng_action_type_string(enum lttng_action_type action_type); +const char *lttng_action_type_string(enum lttng_action_type action_type); void lttng_action_increase_execution_request_count(struct lttng_action *action); @@ -104,23 +104,23 @@ void lttng_action_increase_execution_failure_count(struct lttng_action *action); bool lttng_action_should_execute(const struct lttng_action *action); -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); /* * For use by the various lttng_action implementation. Implements the default * behavior to the generic error "execution failure counter" that all actions * (except list, which passes-through) provide. */ -enum lttng_action_status lttng_action_generic_add_error_query_results( - const struct lttng_action *action, - struct lttng_error_query_results *results); -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_action_status +lttng_action_generic_add_error_query_results(const struct lttng_action *action, + struct lttng_error_query_results *results); +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); #endif /* LTTNG_ACTION_INTERNAL_H */ diff --git a/include/lttng/action/action.h b/include/lttng/action/action.h index 70237e43c..6e303f441 100644 --- a/include/lttng/action/action.h +++ b/include/lttng/action/action.h @@ -39,8 +39,7 @@ enum lttng_action_status { * * Returns the type of an action on success, LTTNG_ACTION_TYPE_UNKNOWN on error. */ -LTTNG_EXPORT extern enum lttng_action_type lttng_action_get_type( - const struct lttng_action *action); +LTTNG_EXPORT extern enum lttng_action_type lttng_action_get_type(const struct lttng_action *action); /* * Destroy (frees) an action object. diff --git a/include/lttng/action/list-internal.hpp b/include/lttng/action/list-internal.hpp index 294a53ca2..7282ab7e4 100644 --- a/include/lttng/action/list-internal.hpp +++ b/include/lttng/action/list-internal.hpp @@ -8,10 +8,10 @@ #ifndef LTTNG_ACTION_LIST_INTERNAL_H #define LTTNG_ACTION_LIST_INTERNAL_H -#include - #include +#include + struct lttng_action; struct lttng_payload_view; struct mi_writer; @@ -25,18 +25,17 @@ struct lttng_trigger; * On success, return the number of bytes consumed from `view`, and the created * list in `*list`. On failure, return -1. */ -extern ssize_t lttng_action_list_create_from_payload( - struct lttng_payload_view *view, - struct lttng_action **list); - -extern struct lttng_action *lttng_action_list_borrow_mutable_at_index( - const struct lttng_action *list, unsigned int index); - -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); +extern ssize_t lttng_action_list_create_from_payload(struct lttng_payload_view *view, + struct lttng_action **list); + +extern struct lttng_action * +lttng_action_list_borrow_mutable_at_index(const struct lttng_action *list, unsigned int index); + +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); #endif /* LTTNG_ACTION_LIST_INTERNAL_H */ diff --git a/include/lttng/action/list.h b/include/lttng/action/list.h index 0dfffa296..5fe3a503b 100644 --- a/include/lttng/action/list.h +++ b/include/lttng/action/list.h @@ -33,14 +33,14 @@ LTTNG_EXPORT extern struct lttng_action *lttng_action_list_create(void); * * Adding an action list to an action list is not supported. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_list_add_action( - struct lttng_action *list, struct lttng_action *action); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_list_add_action(struct lttng_action *list, struct lttng_action *action); /* * Get the number of actions in an action list. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_list_get_count( - const struct lttng_action *list, unsigned int *count); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_list_get_count(const struct lttng_action *list, unsigned int *count); /* * Get an action from the action list at a given index. @@ -51,9 +51,8 @@ LTTNG_EXPORT extern enum lttng_action_status lttng_action_list_get_count( * * Returns an action, or NULL on error. */ -LTTNG_EXPORT extern const struct lttng_action *lttng_action_list_get_at_index( - const struct lttng_action *list, - unsigned int index); +LTTNG_EXPORT extern const struct lttng_action * +lttng_action_list_get_at_index(const struct lttng_action *list, unsigned int index); #ifdef __cplusplus } diff --git a/include/lttng/action/notify-internal.hpp b/include/lttng/action/notify-internal.hpp index c923019c3..2d4d1bd4a 100644 --- a/include/lttng/action/notify-internal.hpp +++ b/include/lttng/action/notify-internal.hpp @@ -8,16 +8,15 @@ #ifndef LTTNG_ACTION_NOTIFY_INTERNAL_H #define LTTNG_ACTION_NOTIFY_INTERNAL_H -#include #include +#include struct lttng_action_notify { struct lttng_action parent; struct lttng_rate_policy *policy; }; -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); #endif /* LTTNG_ACTION_NOTIFY_INTERNAL_H */ diff --git a/include/lttng/action/notify.h b/include/lttng/action/notify.h index 3aa55e09c..300e28507 100644 --- a/include/lttng/action/notify.h +++ b/include/lttng/action/notify.h @@ -39,9 +39,9 @@ LTTNG_EXPORT extern struct lttng_action *lttng_action_notify_create(void); * LTTNG_ACTION_STATUS_ERROR on internal error, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_notify_set_rate_policy( - struct lttng_action *action, - const struct lttng_rate_policy *policy); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_notify_set_rate_policy(struct lttng_action *action, + const struct lttng_rate_policy *policy); /* * Get the rate policy of a notify action. @@ -49,9 +49,9 @@ LTTNG_EXPORT extern enum lttng_action_status lttng_action_notify_set_rate_policy * Returns LTTNG_ACTION_STATUS_OK on success, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_notify_get_rate_policy( - const struct lttng_action *action, - const struct lttng_rate_policy **policy); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_notify_get_rate_policy(const struct lttng_action *action, + const struct lttng_rate_policy **policy); #ifdef __cplusplus } diff --git a/include/lttng/action/path-internal.hpp b/include/lttng/action/path-internal.hpp index f07776b9b..4ad638449 100644 --- a/include/lttng/action/path-internal.hpp +++ b/include/lttng/action/path-internal.hpp @@ -8,25 +8,25 @@ #ifndef LTTNG_ACTION_PATH_INTERNAL_H #define LTTNG_ACTION_PATH_INTERNAL_H -#include -#include #include +#include #include #include + +#include + #include struct lttng_action_path { struct lttng_dynamic_array indexes; }; -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); -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); int lttng_action_path_serialize(const struct lttng_action_path *action_path, - struct lttng_payload *payload); + struct lttng_payload *payload); #endif /* LTTNG_ACTION_PATH_INTERNAL_H */ diff --git a/include/lttng/action/path.h b/include/lttng/action/path.h index 6ec91676b..88d8b640d 100644 --- a/include/lttng/action/path.h +++ b/include/lttng/action/path.h @@ -9,8 +9,9 @@ #define LTTNG_ACTION_PATH_H #include -#include + #include +#include struct lttng_action_path; @@ -45,22 +46,20 @@ enum lttng_action_path_status { * * The `indexes` are copied internally and can be disposed-of by the caller. */ -LTTNG_EXPORT extern struct lttng_action_path *lttng_action_path_create( - const uint64_t *indexes, size_t index_count); +LTTNG_EXPORT extern struct lttng_action_path *lttng_action_path_create(const uint64_t *indexes, + size_t index_count); /* * Get the count of indexes in an action path. */ -LTTNG_EXPORT extern enum lttng_action_path_status lttng_action_path_get_index_count( - const struct lttng_action_path *path, size_t *index_count); +LTTNG_EXPORT extern enum lttng_action_path_status +lttng_action_path_get_index_count(const struct lttng_action_path *path, size_t *index_count); /* * Get an index from an action path. */ LTTNG_EXPORT extern 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); /* * Destroy an action path object. diff --git a/include/lttng/action/rate-policy-internal.hpp b/include/lttng/action/rate-policy-internal.hpp index 5f6eb1f45..643a01cda 100644 --- a/include/lttng/action/rate-policy-internal.hpp +++ b/include/lttng/action/rate-policy-internal.hpp @@ -10,33 +10,29 @@ #include #include + #include #include -#include +#include struct mi_writer; -int lttng_rate_policy_serialize(struct lttng_rate_policy *rate_policy, - struct lttng_payload *buf); +int lttng_rate_policy_serialize(struct lttng_rate_policy *rate_policy, struct lttng_payload *buf); 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); bool lttng_rate_policy_is_equal(const struct lttng_rate_policy *a, - const struct lttng_rate_policy *b); + const struct lttng_rate_policy *b); -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); -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); -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); -enum lttng_error_code lttng_rate_policy_mi_serialize( - const struct lttng_rate_policy *policy, - struct mi_writer *writer); +enum lttng_error_code lttng_rate_policy_mi_serialize(const struct lttng_rate_policy *policy, + struct mi_writer *writer); #endif /* LTTNG_RATE_POLICY */ diff --git a/include/lttng/action/rate-policy.h b/include/lttng/action/rate-policy.h index 1cd0126e3..229e14c0d 100644 --- a/include/lttng/action/rate-policy.h +++ b/include/lttng/action/rate-policy.h @@ -8,8 +8,9 @@ #ifndef LTTNG_RATE_POLICY_H #define LTTNG_RATE_POLICY_H -#include #include + +#include #include struct lttng_rate_policy; @@ -37,8 +38,8 @@ enum lttng_rate_policy_type { /* * Get the type of a rate policy. */ -LTTNG_EXPORT extern enum lttng_rate_policy_type lttng_rate_policy_get_type( - const struct lttng_rate_policy *policy); +LTTNG_EXPORT extern enum lttng_rate_policy_type +lttng_rate_policy_get_type(const struct lttng_rate_policy *policy); /* * Create a rate_policy of type `every n`. @@ -50,8 +51,7 @@ LTTNG_EXPORT extern enum lttng_rate_policy_type lttng_rate_policy_get_type( * rate_policy objects must be destroyed using the lttng_rate_policy_destroy() * function. */ -LTTNG_EXPORT extern struct lttng_rate_policy *lttng_rate_policy_every_n_create( - uint64_t interval); +LTTNG_EXPORT extern struct lttng_rate_policy *lttng_rate_policy_every_n_create(uint64_t interval); /* * Get the interval of a every N rate policy. @@ -60,8 +60,8 @@ LTTNG_EXPORT extern struct lttng_rate_policy *lttng_rate_policy_every_n_create( * on success, LTTNG_RATE_FIRING_POLICY_STATUS_INVALID if an invalid * parameter is passed. */ -LTTNG_EXPORT extern enum lttng_rate_policy_status lttng_rate_policy_every_n_get_interval( - const struct lttng_rate_policy *policy, uint64_t *interval); +LTTNG_EXPORT extern enum lttng_rate_policy_status +lttng_rate_policy_every_n_get_interval(const struct lttng_rate_policy *policy, uint64_t *interval); /* * Create a rate_policy of type `once after N`. @@ -74,8 +74,8 @@ LTTNG_EXPORT extern enum lttng_rate_policy_status lttng_rate_policy_every_n_get_ * rate_policy objects must be destroyed using the lttng_rate_policy_destroy() * function. */ -LTTNG_EXPORT extern struct lttng_rate_policy *lttng_rate_policy_once_after_n_create( - uint64_t threshold); +LTTNG_EXPORT extern struct lttng_rate_policy * +lttng_rate_policy_once_after_n_create(uint64_t threshold); /* * Get the threshold of a once after N rate policy. @@ -85,8 +85,8 @@ LTTNG_EXPORT extern struct lttng_rate_policy *lttng_rate_policy_once_after_n_cre * parameter is passed. */ LTTNG_EXPORT extern enum lttng_rate_policy_status -lttng_rate_policy_once_after_n_get_threshold( - const struct lttng_rate_policy *policy, uint64_t *threshold); +lttng_rate_policy_once_after_n_get_threshold(const struct lttng_rate_policy *policy, + uint64_t *threshold); /* * Destroy (frees) a rate policy object. diff --git a/include/lttng/action/rotate-session-internal.hpp b/include/lttng/action/rotate-session-internal.hpp index 5030aeac3..cbab68e39 100644 --- a/include/lttng/action/rotate-session-internal.hpp +++ b/include/lttng/action/rotate-session-internal.hpp @@ -19,8 +19,7 @@ struct lttng_payload_view; * On success, return the number of bytes consumed from `view`, and the created * action in `*action`. On failure, return -1. */ -extern ssize_t lttng_action_rotate_session_create_from_payload( - struct lttng_payload_view *view, - struct lttng_action **action); +extern ssize_t lttng_action_rotate_session_create_from_payload(struct lttng_payload_view *view, + struct lttng_action **action); #endif /* LTTNG_ACTION_ROTATE_SESSION_INTERNAL_H */ diff --git a/include/lttng/action/rotate-session.h b/include/lttng/action/rotate-session.h index 199b6f169..e628c5f52 100644 --- a/include/lttng/action/rotate-session.h +++ b/include/lttng/action/rotate-session.h @@ -33,15 +33,16 @@ LTTNG_EXPORT extern struct lttng_action *lttng_action_rotate_session_create(void * Set the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_ROTATE_SESSION. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_rotate_session_set_session_name( - struct lttng_action *action, const char *session_name); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_rotate_session_set_session_name(struct lttng_action *action, const char *session_name); /* * Get the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_ROTATE_SESSION. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_rotate_session_get_session_name( - const struct lttng_action *action, const char **session_name); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_rotate_session_get_session_name(const struct lttng_action *action, + const char **session_name); /* * Set the rate policy of a rotate session action. @@ -50,9 +51,9 @@ LTTNG_EXPORT extern enum lttng_action_status lttng_action_rotate_session_get_ses * LTTNG_ACTION_STATUS_ERROR on internal error, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_rotate_session_set_rate_policy( - struct lttng_action *action, - const struct lttng_rate_policy *policy); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_rotate_session_set_rate_policy(struct lttng_action *action, + const struct lttng_rate_policy *policy); /* * Get the rate policy of a rotate session action. @@ -60,9 +61,9 @@ LTTNG_EXPORT extern enum lttng_action_status lttng_action_rotate_session_set_rat * Returns LTTNG_ACTION_STATUS_OK on success, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_rotate_session_get_rate_policy( - const struct lttng_action *action, - const struct lttng_rate_policy **policy); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_rotate_session_get_rate_policy(const struct lttng_action *action, + const struct lttng_rate_policy **policy); #ifdef __cplusplus } diff --git a/include/lttng/action/snapshot-session-internal.hpp b/include/lttng/action/snapshot-session-internal.hpp index 27a8795ad..3943fe8f3 100644 --- a/include/lttng/action/snapshot-session-internal.hpp +++ b/include/lttng/action/snapshot-session-internal.hpp @@ -8,10 +8,10 @@ #ifndef LTTNG_ACTION_SNAPSHOT_SESSION_INTERNAL_H #define LTTNG_ACTION_SNAPSHOT_SESSION_INTERNAL_H -#include - #include +#include + struct lttng_action; struct lttng_payload_view; @@ -21,8 +21,7 @@ struct lttng_payload_view; * On success, return the number of bytes consumed from `view`, and the created * action in `*action`. On failure, return -1. */ -extern ssize_t lttng_action_snapshot_session_create_from_payload( - struct lttng_payload_view *view, - struct lttng_action **action); +extern ssize_t lttng_action_snapshot_session_create_from_payload(struct lttng_payload_view *view, + struct lttng_action **action); #endif /* LTTNG_ACTION_SNAPSHOT_SESSION_INTERNAL_H */ diff --git a/include/lttng/action/snapshot-session.h b/include/lttng/action/snapshot-session.h index 859086200..aadb784b2 100644 --- a/include/lttng/action/snapshot-session.h +++ b/include/lttng/action/snapshot-session.h @@ -34,15 +34,17 @@ LTTNG_EXPORT extern struct lttng_action *lttng_action_snapshot_session_create(vo * Set the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_SNAPSHOT_SESSION. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_set_session_name( - struct lttng_action *action, const char *session_name); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_snapshot_session_set_session_name(struct lttng_action *action, + const char *session_name); /* * Get the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_SNAPSHOT_SESSION. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_get_session_name( - const struct lttng_action *action, const char **session_name); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_snapshot_session_get_session_name(const struct lttng_action *action, + const char **session_name); /* * Set an explicit snapshot output for this snapshot session action. @@ -52,16 +54,16 @@ LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_get_s * * This function takes ownership of the given snapshot output. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_set_output( - struct lttng_action *action, - struct lttng_snapshot_output *output); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_snapshot_session_set_output(struct lttng_action *action, + struct lttng_snapshot_output *output); /* * Get the explicit snapshot output for this snapshot session action. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_get_output( - const struct lttng_action *action, - const struct lttng_snapshot_output **output); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_snapshot_session_get_output(const struct lttng_action *action, + const struct lttng_snapshot_output **output); /* * Set the rate policy of a snapshot session action. @@ -70,9 +72,9 @@ LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_get_o * LTTNG_ACTION_STATUS_ERROR on internal error, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_set_rate_policy( - struct lttng_action *action, - const struct lttng_rate_policy *policy); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_snapshot_session_set_rate_policy(struct lttng_action *action, + const struct lttng_rate_policy *policy); /* * Get the rate policy of a snapshot session action. @@ -80,9 +82,9 @@ LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_set_r * Returns LTTNG_ACTION_STATUS_OK on success, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_snapshot_session_get_rate_policy( - const struct lttng_action *action, - const struct lttng_rate_policy **policy); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_snapshot_session_get_rate_policy(const struct lttng_action *action, + const struct lttng_rate_policy **policy); #ifdef __cplusplus } diff --git a/include/lttng/action/start-session-internal.hpp b/include/lttng/action/start-session-internal.hpp index 44dab1bf1..d33e073af 100644 --- a/include/lttng/action/start-session-internal.hpp +++ b/include/lttng/action/start-session-internal.hpp @@ -19,8 +19,7 @@ struct lttng_payload_view; * On success, return the number of bytes consumed from `view`, and the created * action in `*action`. On failure, return -1. */ -extern ssize_t lttng_action_start_session_create_from_payload( - struct lttng_payload_view *view, - struct lttng_action **action); +extern ssize_t lttng_action_start_session_create_from_payload(struct lttng_payload_view *view, + struct lttng_action **action); #endif /* LTTNG_ACTION_START_SESSION_INTERNAL_H */ diff --git a/include/lttng/action/start-session.h b/include/lttng/action/start-session.h index db5200032..da8c1c1b9 100644 --- a/include/lttng/action/start-session.h +++ b/include/lttng/action/start-session.h @@ -33,15 +33,16 @@ LTTNG_EXPORT extern struct lttng_action *lttng_action_start_session_create(void) * Set the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_START_SESSION. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_start_session_set_session_name( - struct lttng_action *action, const char *session_name); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_start_session_set_session_name(struct lttng_action *action, const char *session_name); /* * Get the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_START_SESSION. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_start_session_get_session_name( - const struct lttng_action *action, const char **session_name); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_start_session_get_session_name(const struct lttng_action *action, + const char **session_name); /* * Set the rate policy of a start session action. @@ -50,9 +51,9 @@ LTTNG_EXPORT extern enum lttng_action_status lttng_action_start_session_get_sess * LTTNG_ACTION_STATUS_ERROR on internal error, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_start_session_set_rate_policy( - struct lttng_action *action, - const struct lttng_rate_policy *policy); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_start_session_set_rate_policy(struct lttng_action *action, + const struct lttng_rate_policy *policy); /* * Get the rate policy of a start session action. @@ -60,9 +61,9 @@ LTTNG_EXPORT extern enum lttng_action_status lttng_action_start_session_set_rate * Returns LTTNG_ACTION_STATUS_OK on success, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_start_session_get_rate_policy( - const struct lttng_action *action, - const struct lttng_rate_policy **policy); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_start_session_get_rate_policy(const struct lttng_action *action, + const struct lttng_rate_policy **policy); #ifdef __cplusplus } diff --git a/include/lttng/action/stop-session-internal.hpp b/include/lttng/action/stop-session-internal.hpp index 22055352f..46f1d6eba 100644 --- a/include/lttng/action/stop-session-internal.hpp +++ b/include/lttng/action/stop-session-internal.hpp @@ -19,8 +19,7 @@ struct lttng_payload_view; * On success, return the number of bytes consumed from `view`, and the created * action in `*action`. On failure, return -1. */ -extern ssize_t lttng_action_stop_session_create_from_payload( - struct lttng_payload_view *view, - struct lttng_action **action); +extern ssize_t lttng_action_stop_session_create_from_payload(struct lttng_payload_view *view, + struct lttng_action **action); #endif /* LTTNG_ACTION_STOP_SESSION_INTERNAL_H */ diff --git a/include/lttng/action/stop-session.h b/include/lttng/action/stop-session.h index 5b223ef23..b4a82a229 100644 --- a/include/lttng/action/stop-session.h +++ b/include/lttng/action/stop-session.h @@ -33,15 +33,16 @@ LTTNG_EXPORT extern struct lttng_action *lttng_action_stop_session_create(void); * Set the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_STOP_SESSION. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_stop_session_set_session_name( - struct lttng_action *action, const char *session_name); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_stop_session_set_session_name(struct lttng_action *action, const char *session_name); /* * Get the session name of an lttng_action object of type * LTTNG_ACTION_TYPE_STOP_SESSION. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_stop_session_get_session_name( - const struct lttng_action *action, const char **session_name); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_stop_session_get_session_name(const struct lttng_action *action, + const char **session_name); /* * Set the rate policy of a stop session action. @@ -50,9 +51,9 @@ LTTNG_EXPORT extern enum lttng_action_status lttng_action_stop_session_get_sessi * LTTNG_ACTION_STATUS_ERROR on internal error, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_stop_session_set_rate_policy( - struct lttng_action *action, - const struct lttng_rate_policy *policy); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_stop_session_set_rate_policy(struct lttng_action *action, + const struct lttng_rate_policy *policy); /* * Get the rate policy of a stop session action. @@ -60,9 +61,9 @@ LTTNG_EXPORT extern enum lttng_action_status lttng_action_stop_session_set_rate_ * Returns LTTNG_ACTION_STATUS_OK on success, * LTTNG_ACTION_STATUS_INVALID if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_action_status lttng_action_stop_session_get_rate_policy( - const struct lttng_action *action, - const struct lttng_rate_policy **policy); +LTTNG_EXPORT extern enum lttng_action_status +lttng_action_stop_session_get_rate_policy(const struct lttng_action *action, + const struct lttng_rate_policy **policy); #ifdef __cplusplus } diff --git a/include/lttng/channel-internal.hpp b/include/lttng/channel-internal.hpp index 4a7a53bb4..ec17e8a19 100644 --- a/include/lttng/channel-internal.hpp +++ b/include/lttng/channel-internal.hpp @@ -45,17 +45,14 @@ struct lttng_channel *lttng_channel_create_internal(); struct lttng_channel *lttng_channel_copy(const struct lttng_channel *src); ssize_t lttng_channel_create_from_buffer(const struct lttng_buffer_view *view, - struct lttng_channel **event); + struct lttng_channel **event); -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); void lttng_channel_set_default_extended_attr(struct lttng_domain *domain, - struct lttng_channel_extended *extended_attr); + struct lttng_channel_extended *extended_attr); enum lttng_error_code lttng_channels_create_and_flatten_from_buffer( - const struct lttng_buffer_view *view, - unsigned int count, - struct lttng_channel **channels); + const struct lttng_buffer_view *view, unsigned int count, struct lttng_channel **channels); #endif /* LTTNG_CHANNEL_INTERNAL_H */ diff --git a/include/lttng/channel.h b/include/lttng/channel.h index 62e202d26..3d175b8a4 100644 --- a/include/lttng/channel.h +++ b/include/lttng/channel.h @@ -11,6 +11,7 @@ #include #include #include + #include #ifdef __cplusplus @@ -22,19 +23,19 @@ extern "C" { * * The structures should be initialized to zero before use. */ -#define LTTNG_CHANNEL_ATTR_PADDING1 LTTNG_SYMBOL_NAME_LEN + 12 +#define LTTNG_CHANNEL_ATTR_PADDING1 LTTNG_SYMBOL_NAME_LEN + 12 struct lttng_channel_attr { - int overwrite; /* -1: session default, 1: overwrite, 0: discard */ - uint64_t subbuf_size; /* bytes, power of 2 */ - uint64_t num_subbuf; /* power of 2 */ + int overwrite; /* -1: session default, 1: overwrite, 0: discard */ + uint64_t subbuf_size; /* bytes, power of 2 */ + uint64_t num_subbuf; /* power of 2 */ unsigned int switch_timer_interval; /* usec */ - unsigned int read_timer_interval; /* usec */ - enum lttng_event_output output; /* splice, mmap */ + unsigned int read_timer_interval; /* usec */ + enum lttng_event_output output; /* splice, mmap */ /* LTTng 2.1 padding limit */ - uint64_t tracefile_size; /* bytes */ - uint64_t tracefile_count; /* number of tracefiles */ + uint64_t tracefile_size; /* bytes */ + uint64_t tracefile_count; /* number of tracefiles */ /* LTTng 2.3 padding limit */ - unsigned int live_timer_interval; /* usec */ + unsigned int live_timer_interval; /* usec */ /* LTTng 2.7 padding limit */ uint32_t align_to_64; union { @@ -50,7 +51,7 @@ struct lttng_channel_attr { * * The structures should be initialized to zero before use. */ -#define LTTNG_CHANNEL_PADDING1 16 +#define LTTNG_CHANNEL_PADDING1 16 struct lttng_channel { char name[LTTNG_SYMBOL_NAME_LEN]; uint32_t enabled; @@ -76,7 +77,7 @@ LTTNG_EXPORT extern void lttng_channel_destroy(struct lttng_channel *channel); * must free channels. On error, a negative LTTng error code is returned. */ LTTNG_EXPORT extern int lttng_list_channels(struct lttng_handle *handle, - struct lttng_channel **channels); + struct lttng_channel **channels); /* * Create or enable a channel. @@ -86,7 +87,7 @@ LTTNG_EXPORT extern int lttng_list_channels(struct lttng_handle *handle, * Return 0 on success else a negative LTTng error code. */ LTTNG_EXPORT extern int lttng_enable_channel(struct lttng_handle *handle, - struct lttng_channel *chan); + struct lttng_channel *chan); /* * Disable channel. @@ -95,8 +96,7 @@ LTTNG_EXPORT extern int lttng_enable_channel(struct lttng_handle *handle, * * Return 0 on success else a negative LTTng error code. */ -LTTNG_EXPORT extern int lttng_disable_channel(struct lttng_handle *handle, - const char *name); +LTTNG_EXPORT extern int lttng_disable_channel(struct lttng_handle *handle, const char *name); /* * Set the default channel attributes for a specific domain and an allocated @@ -105,7 +105,7 @@ LTTNG_EXPORT extern int lttng_disable_channel(struct lttng_handle *handle, * If one or both arguments are NULL, nothing happens. */ LTTNG_EXPORT extern void lttng_channel_set_default_attr(struct lttng_domain *domain, - struct lttng_channel_attr *attr); + struct lttng_channel_attr *attr); /* * Get the discarded event count of a specific LTTng channel. @@ -113,7 +113,7 @@ LTTNG_EXPORT extern void lttng_channel_set_default_attr(struct lttng_domain *dom * Returns 0 on success, or a negative LTTng error code on error. */ LTTNG_EXPORT extern int lttng_channel_get_discarded_event_count(struct lttng_channel *chan, - uint64_t *discarded_events); + uint64_t *discarded_events); /* * Get the lost packet count of a specific LTTng channel. @@ -121,19 +121,19 @@ LTTNG_EXPORT extern int lttng_channel_get_discarded_event_count(struct lttng_cha * Returns 0 on success, or a negative LTTng error code on error. */ LTTNG_EXPORT extern int lttng_channel_get_lost_packet_count(struct lttng_channel *chan, - uint64_t *lost_packets); + uint64_t *lost_packets); LTTNG_EXPORT extern int lttng_channel_get_monitor_timer_interval(struct lttng_channel *chan, - uint64_t *monitor_timer_interval); + uint64_t *monitor_timer_interval); LTTNG_EXPORT extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel *chan, - uint64_t monitor_timer_interval); + uint64_t monitor_timer_interval); LTTNG_EXPORT extern int lttng_channel_get_blocking_timeout(struct lttng_channel *chan, - int64_t *blocking_timeout); + int64_t *blocking_timeout); LTTNG_EXPORT extern int lttng_channel_set_blocking_timeout(struct lttng_channel *chan, - int64_t blocking_timeout); + int64_t blocking_timeout); #ifdef __cplusplus } diff --git a/include/lttng/clear-handle.h b/include/lttng/clear-handle.h index e07e6c47f..4fc5695ed 100644 --- a/include/lttng/clear-handle.h +++ b/include/lttng/clear-handle.h @@ -54,8 +54,7 @@ LTTNG_EXPORT extern void lttng_clear_handle_destroy(struct lttng_clear_handle *h * operation completed successfully. */ LTTNG_EXPORT 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); /* * Get the result of a session clear operation. @@ -73,9 +72,8 @@ LTTNG_EXPORT extern enum lttng_clear_handle_status * invalid (e.g. NULL). */ LTTNG_EXPORT 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); #ifdef __cplusplus } #endif diff --git a/include/lttng/clear.h b/include/lttng/clear.h index 5dfd5db58..8961e166f 100644 --- a/include/lttng/clear.h +++ b/include/lttng/clear.h @@ -54,9 +54,9 @@ struct lttng_clear_handle; * LTTNG_ERR_CLEAR_RELAY_DISALLOWED * LTTNG_ERR_CLEAR_NOT_AVAILABLE_RELAY * LTTNG_ERR_CLEAR_FAIL_CONSUMER -*/ + */ LTTNG_EXPORT extern enum lttng_error_code lttng_clear_session(const char *session_name, - struct lttng_clear_handle **handle); + struct lttng_clear_handle **handle); #ifdef __cplusplus } #endif diff --git a/include/lttng/condition/buffer-usage-internal.hpp b/include/lttng/condition/buffer-usage-internal.hpp index b2e6f85c1..25c91d176 100644 --- a/include/lttng/condition/buffer-usage-internal.hpp +++ b/include/lttng/condition/buffer-usage-internal.hpp @@ -8,12 +8,14 @@ #ifndef LTTNG_CONDITION_BUFFER_USAGE_INTERNAL_H #define LTTNG_CONDITION_BUFFER_USAGE_INTERNAL_H +#include "common/buffer-view.hpp" + +#include + #include #include #include #include -#include "common/buffer-view.hpp" -#include struct lttng_condition_buffer_usage { struct lttng_condition parent; @@ -57,24 +59,21 @@ struct lttng_evaluation_buffer_usage_comm { uint64_t buffer_capacity; } LTTNG_PACKED; -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); -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 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 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 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); #endif /* LTTNG_CONDITION_BUFFER_USAGE_INTERNAL_H */ diff --git a/include/lttng/condition/buffer-usage.h b/include/lttng/condition/buffer-usage.h index dcdb7ca1f..198f3e657 100644 --- a/include/lttng/condition/buffer-usage.h +++ b/include/lttng/condition/buffer-usage.h @@ -8,12 +8,13 @@ #ifndef LTTNG_CONDITION_BUFFER_USAGE_H #define LTTNG_CONDITION_BUFFER_USAGE_H -#include #include -#include +#include #include #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -57,8 +58,7 @@ extern "C" { * Returns a new condition on success, NULL on failure. This condition must be * destroyed using lttng_condition_destroy(). */ -LTTNG_EXPORT extern struct lttng_condition * -lttng_condition_buffer_usage_low_create(void); +LTTNG_EXPORT extern struct lttng_condition *lttng_condition_buffer_usage_low_create(void); /* * Create a newly allocated upper-bound buffer usage condition. @@ -73,8 +73,7 @@ lttng_condition_buffer_usage_low_create(void); * Returns a new condition on success, NULL on failure. This condition must be * destroyed using lttng_condition_destroy(). */ -LTTNG_EXPORT extern struct lttng_condition * -lttng_condition_buffer_usage_high_create(void); +LTTNG_EXPORT extern struct lttng_condition *lttng_condition_buffer_usage_high_create(void); /* * Get the buffer usage threshold ratio of a buffer usage condition. @@ -89,9 +88,8 @@ lttng_condition_buffer_usage_high_create(void); * call. */ LTTNG_EXPORT extern 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); /* * Set the buffer usage threshold ratio of a buffer usage condition. @@ -105,9 +103,8 @@ lttng_condition_buffer_usage_get_threshold_ratio( * if invalid paramenters are passed. */ LTTNG_EXPORT extern 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); /* * Get the buffer usage threshold of a buffer usage condition. @@ -121,9 +118,8 @@ lttng_condition_buffer_usage_set_threshold_ratio( * bytes, was not set prior to this call. */ LTTNG_EXPORT extern 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); /* * Set the buffer usage threshold in bytes of a buffer usage condition. @@ -135,9 +131,8 @@ lttng_condition_buffer_usage_get_threshold( * if invalid paramenters are passed. */ LTTNG_EXPORT extern 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); /* * Get the session name property of a buffer usage condition. @@ -152,9 +147,8 @@ lttng_condition_buffer_usage_set_threshold( * was not set prior to this call. */ LTTNG_EXPORT extern 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); /* * Set the session name property of a buffer usage condition. @@ -165,9 +159,8 @@ lttng_condition_buffer_usage_get_session_name( * if invalid paramenters are passed. */ LTTNG_EXPORT extern 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); /* * Get the channel name property of a buffer usage condition. @@ -182,9 +175,8 @@ lttng_condition_buffer_usage_set_session_name( * was not set prior to this call. */ LTTNG_EXPORT extern 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); /* * Set the channel name property of a buffer usage condition. @@ -195,9 +187,8 @@ lttng_condition_buffer_usage_get_channel_name( * if invalid paramenters are passed. */ LTTNG_EXPORT extern 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); /* * Get the domain type property of a buffer usage condition. @@ -208,9 +199,8 @@ lttng_condition_buffer_usage_set_channel_name( * call. */ LTTNG_EXPORT extern 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); /* * Set the domain type property of a buffer usage condition. @@ -219,10 +209,8 @@ lttng_condition_buffer_usage_get_domain_type( * if invalid paramenters are passed. */ LTTNG_EXPORT extern 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); /** * lttng_evaluation_buffer_usage are specialised lttng_evaluations which @@ -242,9 +230,8 @@ lttng_condition_buffer_usage_set_domain_type( * an invalid parameter is passed. */ LTTNG_EXPORT extern 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); /* * Get the buffer usage property of a buffer usage evaluation. @@ -253,9 +240,8 @@ lttng_evaluation_buffer_usage_get_usage_ratio( * bytes, or LTTNG_EVALUATION_STATUS_INVALID if an invalid parameter is passed. */ LTTNG_EXPORT extern 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); #ifdef __cplusplus } diff --git a/include/lttng/condition/condition-internal.hpp b/include/lttng/condition/condition-internal.hpp index 2fac62913..c69ae2a21 100644 --- a/include/lttng/condition/condition-internal.hpp +++ b/include/lttng/condition/condition-internal.hpp @@ -11,8 +11,10 @@ #include #include #include + #include #include + #include #include #include @@ -53,27 +55,23 @@ void lttng_condition_get(struct lttng_condition *condition); void lttng_condition_put(struct lttng_condition *condition); -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); bool lttng_condition_validate(const struct lttng_condition *condition); -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); int lttng_condition_serialize(const struct lttng_condition *condition, - struct lttng_payload *payload); + struct lttng_payload *payload); -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); -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); const char *lttng_condition_type_str(enum lttng_condition_type type); diff --git a/include/lttng/condition/condition.h b/include/lttng/condition/condition.h index f0f5ffdd8..13a09c19a 100644 --- a/include/lttng/condition/condition.h +++ b/include/lttng/condition/condition.h @@ -41,8 +41,8 @@ enum lttng_condition_status { * Returns the type of a condition on success, LTTNG_CONDITION_TYPE_UNKNOWN on * error. */ -LTTNG_EXPORT extern enum lttng_condition_type lttng_condition_get_type( - const struct lttng_condition *condition); +LTTNG_EXPORT extern enum lttng_condition_type +lttng_condition_get_type(const struct lttng_condition *condition); /* * Destroy (release) a condition object. diff --git a/include/lttng/condition/evaluation-internal.hpp b/include/lttng/condition/evaluation-internal.hpp index ed2c5735f..36dc3a544 100644 --- a/include/lttng/condition/evaluation-internal.hpp +++ b/include/lttng/condition/evaluation-internal.hpp @@ -8,9 +8,11 @@ #ifndef LTTNG_EVALUATION_INTERNAL_H #define LTTNG_EVALUATION_INTERNAL_H -#include -#include #include + +#include +#include + #include #include @@ -32,15 +34,13 @@ struct lttng_evaluation { evaluation_destroy_cb destroy; }; -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); -ssize_t lttng_evaluation_create_from_payload( - const struct lttng_condition *condition, - struct lttng_payload_view *view, - struct lttng_evaluation **evaluation); +ssize_t lttng_evaluation_create_from_payload(const struct lttng_condition *condition, + struct lttng_payload_view *view, + struct lttng_evaluation **evaluation); int lttng_evaluation_serialize(const struct lttng_evaluation *evaluation, - struct lttng_payload *payload); + struct lttng_payload *payload); #endif /* LTTNG_EVALUATION_INTERNAL_H */ diff --git a/include/lttng/condition/evaluation.h b/include/lttng/condition/evaluation.h index 494cb9739..599bc35b3 100644 --- a/include/lttng/condition/evaluation.h +++ b/include/lttng/condition/evaluation.h @@ -31,8 +31,8 @@ enum lttng_evaluation_status { * Returns the type of a condition on success, LTTNG_CONDITION_TYPE_UNKNOWN on * error. */ -LTTNG_EXPORT extern enum lttng_condition_type lttng_evaluation_get_type( - const struct lttng_evaluation *evaluation); +LTTNG_EXPORT extern enum lttng_condition_type +lttng_evaluation_get_type(const struct lttng_evaluation *evaluation); /* * Destroy (frees) an evaluation object. diff --git a/include/lttng/condition/event-rule-matches-internal.hpp b/include/lttng/condition/event-rule-matches-internal.hpp index bb7e03e21..22bfb9557 100644 --- a/include/lttng/condition/event-rule-matches-internal.hpp +++ b/include/lttng/condition/event-rule-matches-internal.hpp @@ -8,12 +8,13 @@ #ifndef LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H #define LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H -#include #include +#include #include #include + +#include #include -#include #include struct lttng_capture_descriptor { @@ -51,39 +52,34 @@ struct lttng_evaluation_event_rule_matches { struct lttng_event_field_value *captured_values; }; -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); 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); -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); -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); 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); 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); -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); -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); #endif /* LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H */ diff --git a/include/lttng/condition/event-rule-matches.h b/include/lttng/condition/event-rule-matches.h index b1bbe08f3..c579a1864 100644 --- a/include/lttng/condition/event-rule-matches.h +++ b/include/lttng/condition/event-rule-matches.h @@ -8,9 +8,9 @@ #ifndef LTTNG_CONDITION_EVENT_RULE_MATCHES_H #define LTTNG_CONDITION_EVENT_RULE_MATCHES_H -#include #include #include +#include #include #ifdef __cplusplus @@ -43,8 +43,8 @@ enum lttng_evaluation_event_rule_matches_status { * Returns a new condition on success, NULL on failure. This condition must be * destroyed using lttng_condition_destroy(). */ -LTTNG_EXPORT extern struct lttng_condition *lttng_condition_event_rule_matches_create( - struct lttng_event_rule *rule); +LTTNG_EXPORT extern struct lttng_condition * +lttng_condition_event_rule_matches_create(struct lttng_event_rule *rule); /* * Get the rule property of an Event Rule Matches condition. @@ -56,9 +56,9 @@ LTTNG_EXPORT extern struct lttng_condition *lttng_condition_event_rule_matches_c * Returns LTTNG_CONDITION_STATUS_OK and a pointer to the condition's rule * on success, LTTNG_CONDITION_STATUS_INVALID if an invalid * parameter is passed. */ -LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_event_rule_matches_get_rule( - const struct lttng_condition *condition, - const struct lttng_event_rule **rule); +LTTNG_EXPORT extern enum lttng_condition_status +lttng_condition_event_rule_matches_get_rule(const struct lttng_condition *condition, + const struct lttng_event_rule **rule); /** * lttng_evaluation_event_rule_matches_hit are specialised lttng_evaluations @@ -92,8 +92,8 @@ LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_event_rule_match */ LTTNG_EXPORT extern 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); /* * Appends (transfering the ownership) the capture descriptor `expr` to @@ -124,9 +124,8 @@ lttng_evaluation_event_rule_matches_get_captured_values( * * The associated event-rule does not support runtime capture. */ LTTNG_EXPORT extern 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); /* * Sets `*count` to the number of capture descriptors in the Event Rule Matches @@ -145,7 +144,7 @@ lttng_condition_event_rule_matches_append_capture_descriptor( */ LTTNG_EXPORT extern enum lttng_condition_status lttng_condition_event_rule_matches_get_capture_descriptor_count( - const struct lttng_condition *condition, unsigned int *count); + const struct lttng_condition *condition, unsigned int *count); /* * Returns the capture descriptor (borrowed) of the Event Rule Matches condition @@ -160,7 +159,7 @@ lttng_condition_event_rule_matches_get_capture_descriptor_count( */ LTTNG_EXPORT extern 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_condition *condition, unsigned int index); #ifdef __cplusplus } diff --git a/include/lttng/condition/session-consumed-size-internal.hpp b/include/lttng/condition/session-consumed-size-internal.hpp index cdfa10034..e49a60814 100644 --- a/include/lttng/condition/session-consumed-size-internal.hpp +++ b/include/lttng/condition/session-consumed-size-internal.hpp @@ -8,12 +8,13 @@ #ifndef LTTNG_CONDITION_SESSION_CONSUMED_SIZE_INTERNAL_H #define LTTNG_CONDITION_SESSION_CONSUMED_SIZE_INTERNAL_H -#include -#include -#include #include #include +#include +#include +#include + struct lttng_payload; struct lttng_payload_view; @@ -42,15 +43,14 @@ struct lttng_evaluation_session_consumed_size_comm { uint64_t session_consumed; } LTTNG_PACKED; -struct lttng_evaluation *lttng_evaluation_session_consumed_size_create( - uint64_t consumed); +struct lttng_evaluation *lttng_evaluation_session_consumed_size_create(uint64_t consumed); -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 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); #endif /* LTTNG_CONDITION_SESSION_CONSUMED_SIZE_INTERNAL_H */ diff --git a/include/lttng/condition/session-consumed-size.h b/include/lttng/condition/session-consumed-size.h index 4d52cb689..98284c748 100644 --- a/include/lttng/condition/session-consumed-size.h +++ b/include/lttng/condition/session-consumed-size.h @@ -8,9 +8,10 @@ #ifndef LTTNG_CONDITION_SESSION_CONSUMED_SIZE_H #define LTTNG_CONDITION_SESSION_CONSUMED_SIZE_H -#include #include +#include #include + #include #ifdef __cplusplus @@ -43,8 +44,7 @@ extern "C" { * Returns a new condition on success, NULL on failure. This condition must be * destroyed using lttng_condition_destroy(). */ -LTTNG_EXPORT extern struct lttng_condition * -lttng_condition_session_consumed_size_create(void); +LTTNG_EXPORT extern struct lttng_condition *lttng_condition_session_consumed_size_create(void); /* * Get the threshold of a session consumed size condition. @@ -58,9 +58,8 @@ lttng_condition_session_consumed_size_create(void); * bytes, was not set prior to this call. */ LTTNG_EXPORT extern 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); /* * Set the threshold of a session consumed size usage condition. @@ -71,9 +70,8 @@ lttng_condition_session_consumed_size_get_threshold( * if invalid parameters are passed. */ LTTNG_EXPORT extern 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); /* * Get the session name property of a session consumed size condition. @@ -88,9 +86,8 @@ lttng_condition_session_consumed_size_set_threshold( * was not set prior to this call. */ LTTNG_EXPORT extern 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); /* * Set the session name property of a session consumed size condition. @@ -101,9 +98,8 @@ lttng_condition_session_consumed_size_get_session_name( * if invalid parameters are passed. */ LTTNG_EXPORT extern 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); /** * lttng_evaluation_session_consumed_size is specialised lttng_evaluations @@ -118,9 +114,8 @@ lttng_condition_session_consumed_size_set_session_name( * bytes, or LTTNG_EVALUATION_STATUS_INVALID if an invalid parameter is passed. */ LTTNG_EXPORT extern 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); #ifdef __cplusplus } diff --git a/include/lttng/condition/session-rotation-internal.hpp b/include/lttng/condition/session-rotation-internal.hpp index e9a298445..a3d14b493 100644 --- a/include/lttng/condition/session-rotation-internal.hpp +++ b/include/lttng/condition/session-rotation-internal.hpp @@ -8,12 +8,14 @@ #ifndef LTTNG_CONDITION_SESSION_ROTATION_INTERNAL_H #define LTTNG_CONDITION_SESSION_ROTATION_INTERNAL_H -#include +#include "common/buffer-view.hpp" + +#include + #include #include -#include "common/buffer-view.hpp" +#include #include -#include struct lttng_condition_session_rotation { struct lttng_condition parent; @@ -37,28 +39,26 @@ struct lttng_evaluation_session_rotation_comm { uint8_t has_location; } LTTNG_PACKED; -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); -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); -struct lttng_evaluation *lttng_evaluation_session_rotation_ongoing_create( - uint64_t id); +struct lttng_evaluation *lttng_evaluation_session_rotation_ongoing_create(uint64_t id); /* Ownership of location is transferred to the evaluation. */ -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); -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); 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); #endif /* LTTNG_CONDITION_SESSION_ROTATION_INTERNAL_H */ diff --git a/include/lttng/condition/session-rotation.h b/include/lttng/condition/session-rotation.h index 086fff915..6e6207fb2 100644 --- a/include/lttng/condition/session-rotation.h +++ b/include/lttng/condition/session-rotation.h @@ -8,13 +8,14 @@ #ifndef LTTNG_CONDITION_SESSION_ROTATION_H #define LTTNG_CONDITION_SESSION_ROTATION_H -#include #include -#include +#include #include #include #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -39,8 +40,7 @@ extern "C" { * Returns a new condition on success, NULL on failure. This condition must be * destroyed using lttng_condition_destroy(). */ -LTTNG_EXPORT extern struct lttng_condition * -lttng_condition_session_rotation_ongoing_create(void); +LTTNG_EXPORT extern struct lttng_condition *lttng_condition_session_rotation_ongoing_create(void); /* * Create a newly allocated session rotation completion condition. @@ -54,8 +54,7 @@ lttng_condition_session_rotation_ongoing_create(void); * Returns a new condition on success, NULL on failure. This condition must be * destroyed using lttng_condition_destroy(). */ -LTTNG_EXPORT extern struct lttng_condition * -lttng_condition_session_rotation_completed_create(void); +LTTNG_EXPORT extern struct lttng_condition *lttng_condition_session_rotation_completed_create(void); /* * Get the session name property of a session rotation condition. @@ -70,9 +69,8 @@ lttng_condition_session_rotation_completed_create(void); * was not set prior to this call. */ LTTNG_EXPORT extern 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); /* * Set the session name property of a session rotation condition. @@ -83,9 +81,8 @@ lttng_condition_session_rotation_get_session_name( * if invalid paramenters are passed. */ LTTNG_EXPORT extern 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); /** * lttng_evaluation_session_rotation are specialised lttng_evaluations @@ -101,8 +98,7 @@ lttng_condition_session_rotation_set_session_name( * passed. */ LTTNG_EXPORT extern 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); /* * Get the session rotation location property of a session rotation completed @@ -121,8 +117,8 @@ lttng_evaluation_session_rotation_get_id( */ LTTNG_EXPORT extern 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 *evaluation, + const struct lttng_trace_archive_location **location); #ifdef __cplusplus } diff --git a/include/lttng/constant.h b/include/lttng/constant.h index 1b6f44d8b..2cbb46095 100644 --- a/include/lttng/constant.h +++ b/include/lttng/constant.h @@ -9,9 +9,7 @@ #define LTTNG_CONSTANT_H #ifndef LTTNG_DEPRECATED -#if defined (__GNUC__) \ - && ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) \ - || __GNUC__ >= 5) +#if defined(__GNUC__) && ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) || __GNUC__ >= 5) #define LTTNG_DEPRECATED(msg) __attribute__((deprecated(msg))) #else #define LTTNG_DEPRECATED(msg) __attribute__((deprecated)) @@ -35,16 +33,16 @@ /* * Event symbol length. Copied from LTTng kernel ABI. */ -#define LTTNG_SYMBOL_NAME_LEN 256 +#define LTTNG_SYMBOL_NAME_LEN 256 /* * PROC(5) mentions that PID_MAX_LIMIT may not exceed 2^22 on 64-bit HW. * We prefer to use 32-bits for simplicity's sake. */ -#define LTTNG_MAX_PID INT32_MAX -#define LTTNG_MAX_PID_STR "2147483647" +#define LTTNG_MAX_PID INT32_MAX +#define LTTNG_MAX_PID_STR "2147483647" -#define LTTNG_NAME_MAX 255 +#define LTTNG_NAME_MAX 255 /* * POSIX guarantees that a host name will not exceed 255 characters. @@ -53,8 +51,8 @@ * * 256 is used to include a trailing NULL character. */ -#define LTTNG_HOST_NAME_MAX 256 +#define LTTNG_HOST_NAME_MAX 256 -#define LTTNG_PATH_MAX 4096 +#define LTTNG_PATH_MAX 4096 #endif /* LTTNG_CONSTANT_H */ diff --git a/include/lttng/destruction-handle.h b/include/lttng/destruction-handle.h index 6fa4339ac..d14bc16a8 100644 --- a/include/lttng/destruction-handle.h +++ b/include/lttng/destruction-handle.h @@ -8,9 +8,9 @@ #ifndef LTTNG_DESTRUCTION_HANDLE_H #define LTTNG_DESTRUCTION_HANDLE_H -#include #include #include +#include #ifdef __cplusplus extern "C" { @@ -44,8 +44,7 @@ enum lttng_destruction_handle_status { * Destroy an lttng_destruction_session handle. * The handle should be discarded after this call. */ -LTTNG_EXPORT extern void lttng_destruction_handle_destroy( - struct lttng_destruction_handle *handle); +LTTNG_EXPORT extern void lttng_destruction_handle_destroy(struct lttng_destruction_handle *handle); /* * Wait for the destruction of a session to complete. @@ -62,8 +61,8 @@ LTTNG_EXPORT extern void lttng_destruction_handle_destroy( * operation completed successfully. */ LTTNG_EXPORT extern 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); /* * Get the result of a session destruction operation. @@ -81,9 +80,8 @@ lttng_destruction_handle_wait_for_completion( * invalid (e.g. NULL). */ LTTNG_EXPORT extern 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); /* * Get the status of the session rotation performed as part of the session's @@ -109,9 +107,8 @@ lttng_destruction_handle_get_result( * LTTNG_ROTATION_STATE_NO_ROTATION. */ LTTNG_EXPORT extern 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); /* * Get the location of the archive resulting from the rotation performed during @@ -133,9 +130,8 @@ lttng_destruction_handle_get_rotation_state( * invalid (e.g. NULL). */ LTTNG_EXPORT extern 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); #ifdef __cplusplus } diff --git a/include/lttng/domain-internal.hpp b/include/lttng/domain-internal.hpp index 4439c7825..f41d61e84 100644 --- a/include/lttng/domain-internal.hpp +++ b/include/lttng/domain-internal.hpp @@ -8,8 +8,8 @@ #ifndef LTTNG_DOMAIN_INTERNAL_H #define LTTNG_DOMAIN_INTERNAL_H -#include "lttng/domain.h" #include "common/macros.hpp" +#include "lttng/domain.h" const char *lttng_domain_type_str(enum lttng_domain_type domain_type); diff --git a/include/lttng/domain.h b/include/lttng/domain.h index 192c04bf2..90c949721 100644 --- a/include/lttng/domain.h +++ b/include/lttng/domain.h @@ -19,26 +19,26 @@ extern "C" { * Domain types: the different possible tracers. */ enum lttng_domain_type { - LTTNG_DOMAIN_NONE = 0, /* No associated domain. */ - LTTNG_DOMAIN_KERNEL = 1, /* Linux Kernel tracer. */ - LTTNG_DOMAIN_UST = 2, /* Global Userspace tracer. */ - LTTNG_DOMAIN_JUL = 3, /* Java Util Logging. */ - LTTNG_DOMAIN_LOG4J = 4, /* Java Log4j Framework. */ - LTTNG_DOMAIN_PYTHON = 5, /* Python logging Framework. */ + LTTNG_DOMAIN_NONE = 0, /* No associated domain. */ + LTTNG_DOMAIN_KERNEL = 1, /* Linux Kernel tracer. */ + LTTNG_DOMAIN_UST = 2, /* Global Userspace tracer. */ + LTTNG_DOMAIN_JUL = 3, /* Java Util Logging. */ + LTTNG_DOMAIN_LOG4J = 4, /* Java Log4j Framework. */ + LTTNG_DOMAIN_PYTHON = 5, /* Python logging Framework. */ }; /* Buffer type for a specific domain. */ enum lttng_buffer_type { - LTTNG_BUFFER_PER_PID, /* Only supported by UST being the default. */ - LTTNG_BUFFER_PER_UID, /* Only supported by UST. */ - LTTNG_BUFFER_GLOBAL, /* Only supported by the Kernel. */ + LTTNG_BUFFER_PER_PID, /* Only supported by UST being the default. */ + LTTNG_BUFFER_PER_UID, /* Only supported by UST. */ + LTTNG_BUFFER_GLOBAL, /* Only supported by the Kernel. */ }; /* * The structures should be initialized to zero before use. */ -#define LTTNG_DOMAIN_PADDING1 12 -#define LTTNG_DOMAIN_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32 +#define LTTNG_DOMAIN_PADDING1 12 +#define LTTNG_DOMAIN_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32 struct lttng_domain { enum lttng_domain_type type; enum lttng_buffer_type buf_type; @@ -59,8 +59,7 @@ struct lttng_domain { * Return the size (number of entries) of the "lttng_domain" array. Caller * must free domains. On error, a negative LTTng error code is returned. */ -LTTNG_EXPORT extern int lttng_list_domains(const char *session_name, - struct lttng_domain **domains); +LTTNG_EXPORT extern int lttng_list_domains(const char *session_name, struct lttng_domain **domains); #ifdef __cplusplus } diff --git a/include/lttng/endpoint-internal.hpp b/include/lttng/endpoint-internal.hpp index 5317f7ff5..306a96a47 100644 --- a/include/lttng/endpoint-internal.hpp +++ b/include/lttng/endpoint-internal.hpp @@ -8,9 +8,10 @@ #ifndef LTTNG_ENDPOINT_INTERNAL_H #define LTTNG_ENDPOINT_INTERNAL_H -#include #include +#include + enum lttng_endpoint_type { LTTNG_ENDPOINT_TYPE_DEFAULT_SESSIOND_NOTIFICATION = 0, LTTNG_ENDPOINT_TYPE_DEFAULT_SESSIOND_COMMAND = 1, diff --git a/include/lttng/error-query-internal.hpp b/include/lttng/error-query-internal.hpp index ece2b0ce9..4564b1070 100644 --- a/include/lttng/error-query-internal.hpp +++ b/include/lttng/error-query-internal.hpp @@ -10,10 +10,11 @@ #ifndef LTTNG_ERROR_QUERY_INTERNAL_H #define LTTNG_ERROR_QUERY_INTERNAL_H -#include #include -#include #include +#include + +#include struct mi_writer; @@ -23,59 +24,53 @@ enum lttng_error_query_target_type { LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION, }; -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); -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_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_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); -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); int lttng_error_query_serialize(const struct lttng_error_query *query, - struct lttng_payload *payload); + struct lttng_payload *payload); ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view, - struct lttng_error_query **query); + struct lttng_error_query **query); -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); -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); -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); -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); 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); void lttng_error_query_result_destroy(struct lttng_error_query_result *result); struct lttng_error_query_results *lttng_error_query_results_create(); /* Ownership of `result` is transferred on success. */ -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); -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); #endif /* LTTNG_ERROR_QUERY_INTERNAL_H */ diff --git a/include/lttng/error-query.h b/include/lttng/error-query.h index a7cbae421..0eb0addc8 100644 --- a/include/lttng/error-query.h +++ b/include/lttng/error-query.h @@ -10,9 +10,10 @@ #ifndef LTTNG_ERROR_QUERY_H #define LTTNG_ERROR_QUERY_H -#include #include +#include #include + #include #ifdef __cplusplus @@ -59,12 +60,12 @@ enum lttng_error_query_results_status { }; /* Create an error query targetting a trigger object. */ -LTTNG_EXPORT extern struct lttng_error_query *lttng_error_query_trigger_create( - const struct lttng_trigger *trigger); +LTTNG_EXPORT extern struct lttng_error_query * +lttng_error_query_trigger_create(const struct lttng_trigger *trigger); /* Create an error query targetting a trigger's condition object. */ -LTTNG_EXPORT extern struct lttng_error_query *lttng_error_query_condition_create( - const struct lttng_trigger *trigger); +LTTNG_EXPORT extern struct lttng_error_query * +lttng_error_query_condition_create(const struct lttng_trigger *trigger); /* * Create an error query targetting an action object. @@ -72,9 +73,9 @@ LTTNG_EXPORT extern struct lttng_error_query *lttng_error_query_condition_create * `action_path` is copied internally. The root of the `action_path` is the * action of `trigger`. */ -LTTNG_EXPORT extern struct lttng_error_query *lttng_error_query_action_create( - const struct lttng_trigger *trigger, - const struct lttng_action_path *action_path); +LTTNG_EXPORT extern struct lttng_error_query * +lttng_error_query_action_create(const struct lttng_trigger *trigger, + const struct lttng_action_path *action_path); /* Destroy an error query. */ LTTNG_EXPORT extern void lttng_error_query_destroy(struct lttng_error_query *query); @@ -85,47 +86,43 @@ LTTNG_EXPORT extern void lttng_error_query_destroy(struct lttng_error_query *que * Currently, only the `lttng_session_daemon_command_endpoint` is supported, * see `lttng/endpoint.h`. */ -LTTNG_EXPORT extern 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); +LTTNG_EXPORT extern 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); /* Get the number of results in a result set. */ LTTNG_EXPORT LTTNG_EXPORT extern enum lttng_error_query_results_status -lttng_error_query_results_get_count( - const struct lttng_error_query_results *results, - unsigned int *count); +lttng_error_query_results_get_count(const struct lttng_error_query_results *results, + unsigned int *count); /* Get a result from a result set by index. */ LTTNG_EXPORT extern 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); /* Destroy an error query result set. */ -LTTNG_EXPORT extern void lttng_error_query_results_destroy( - struct lttng_error_query_results *results); +LTTNG_EXPORT extern void +lttng_error_query_results_destroy(struct lttng_error_query_results *results); /* Get the type of an error query result. */ -LTTNG_EXPORT extern enum lttng_error_query_result_type lttng_error_query_result_get_type( - const struct lttng_error_query_result *result); +LTTNG_EXPORT extern enum lttng_error_query_result_type +lttng_error_query_result_get_type(const struct lttng_error_query_result *result); /* Get the name of result. */ -LTTNG_EXPORT extern enum lttng_error_query_result_status lttng_error_query_result_get_name( - const struct lttng_error_query_result *result, - const char **name); +LTTNG_EXPORT extern enum lttng_error_query_result_status +lttng_error_query_result_get_name(const struct lttng_error_query_result *result, const char **name); /* Get the description of a result. */ LTTNG_EXPORT extern enum lttng_error_query_result_status -lttng_error_query_result_get_description( - const struct lttng_error_query_result *result, - const char **description); +lttng_error_query_result_get_description(const struct lttng_error_query_result *result, + const char **description); /* Get the value of an error counter. */ LTTNG_EXPORT extern enum lttng_error_query_result_status -lttng_error_query_result_counter_get_value( - const struct lttng_error_query_result *result, uint64_t *value); +lttng_error_query_result_counter_get_value(const struct lttng_error_query_result *result, + uint64_t *value); #ifdef __cplusplus } diff --git a/include/lttng/event-expr-internal.hpp b/include/lttng/event-expr-internal.hpp index 07547e587..c44e63e4a 100644 --- a/include/lttng/event-expr-internal.hpp +++ b/include/lttng/event-expr-internal.hpp @@ -9,6 +9,7 @@ #define LTTNG_EVENT_EXPR_INTERNAL_H #include + #include struct lttng_bytecode; @@ -47,21 +48,19 @@ struct lttng_event_expr_array_field_element { /* * Returns whether or not `expr` is an l-value (locator value). */ -static inline -bool lttng_event_expr_is_lvalue(const struct lttng_event_expr *expr) +static inline bool lttng_event_expr_is_lvalue(const struct lttng_event_expr *expr) { LTTNG_ASSERT(expr); return expr->type == LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD || - expr->type == LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD || - expr->type == LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD || - expr->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT; + expr->type == LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD || + expr->type == LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD || + expr->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT; } int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr, - struct lttng_bytecode **bytecode_out); + struct lttng_bytecode **bytecode_out); -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); #endif /* LTTNG_EVENT_EXPR_INTERNAL_H */ diff --git a/include/lttng/event-expr.h b/include/lttng/event-expr.h index cab22c97e..7b42785ca 100644 --- a/include/lttng/event-expr.h +++ b/include/lttng/event-expr.h @@ -9,6 +9,7 @@ #define LTTNG_EVENT_EXPR_H #include + #include struct lttng_event_expr; @@ -84,8 +85,8 @@ enum lttng_event_expr_status { * Returns the type of the event expression `expr`, or * `LTTNG_EVENT_EXPR_TYPE_INVALID` if `expr` is `NULL`. */ -LTTNG_EXPORT extern enum lttng_event_expr_type lttng_event_expr_get_type( - const struct lttng_event_expr *expr); +LTTNG_EXPORT extern enum lttng_event_expr_type +lttng_event_expr_get_type(const struct lttng_event_expr *expr); /* * Creates an event payload field expression for the payload field named @@ -96,8 +97,8 @@ LTTNG_EXPORT extern enum lttng_event_expr_type lttng_event_expr_get_type( * * There's a memory error. * * `field_name` is `NULL`. */ -LTTNG_EXPORT extern struct lttng_event_expr *lttng_event_expr_event_payload_field_create( - const char *field_name); +LTTNG_EXPORT extern struct lttng_event_expr * +lttng_event_expr_event_payload_field_create(const char *field_name); /* * Returns the field name of the event payload field expression `expr`, @@ -107,8 +108,8 @@ LTTNG_EXPORT extern struct lttng_event_expr *lttng_event_expr_event_payload_fiel * * The type of `expr` is not * `LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD`. */ -LTTNG_EXPORT extern const char *lttng_event_expr_event_payload_field_get_name( - const struct lttng_event_expr *expr); +LTTNG_EXPORT extern const char * +lttng_event_expr_event_payload_field_get_name(const struct lttng_event_expr *expr); /* * Creates a per-channel context field expression for the per-channel @@ -130,8 +131,8 @@ lttng_event_expr_channel_context_field_create(const char *field_name); * * The type of `expr` is not * `LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD`. */ -LTTNG_EXPORT extern const char *lttng_event_expr_channel_context_field_get_name( - const struct lttng_event_expr *expr); +LTTNG_EXPORT extern const char * +lttng_event_expr_channel_context_field_get_name(const struct lttng_event_expr *expr); /* * Creates an application-specific context field expression for the @@ -145,8 +146,8 @@ LTTNG_EXPORT extern const char *lttng_event_expr_channel_context_field_get_name( * * `type_name` is `NULL`. */ LTTNG_EXPORT extern struct lttng_event_expr * -lttng_event_expr_app_specific_context_field_create( - const char *provider_name, const char *type_name); +lttng_event_expr_app_specific_context_field_create(const char *provider_name, + const char *type_name); /* * Returns the provider name of the application-specific context field @@ -157,8 +158,7 @@ lttng_event_expr_app_specific_context_field_create( * `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD`. */ LTTNG_EXPORT extern const char * -lttng_event_expr_app_specific_context_field_get_provider_name( - const struct lttng_event_expr *expr); +lttng_event_expr_app_specific_context_field_get_provider_name(const struct lttng_event_expr *expr); /* * Returns the type name of the application-specific context field @@ -169,8 +169,7 @@ lttng_event_expr_app_specific_context_field_get_provider_name( * `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD`. */ LTTNG_EXPORT extern const char * -lttng_event_expr_app_specific_context_field_get_type_name( - const struct lttng_event_expr *expr); +lttng_event_expr_app_specific_context_field_get_type_name(const struct lttng_event_expr *expr); /* * Creates an array field element expression for the parent array field @@ -188,9 +187,9 @@ lttng_event_expr_app_specific_context_field_get_type_name( * * `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD` * * `LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT` */ -LTTNG_EXPORT extern struct lttng_event_expr *lttng_event_expr_array_field_element_create( - struct lttng_event_expr *array_field_expr, - unsigned int index); +LTTNG_EXPORT extern struct lttng_event_expr * +lttng_event_expr_array_field_element_create(struct lttng_event_expr *array_field_expr, + unsigned int index); /* * Returns the parent array field expression of the array field element @@ -201,8 +200,7 @@ LTTNG_EXPORT extern struct lttng_event_expr *lttng_event_expr_array_field_elemen * `LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT`. */ LTTNG_EXPORT extern 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); /* * Sets `*index` to the index of the array field element expression @@ -220,8 +218,8 @@ lttng_event_expr_array_field_element_get_parent_expr( * * `index` is `NULL`. */ LTTNG_EXPORT extern enum lttng_event_expr_status -lttng_event_expr_array_field_element_get_index( - const struct lttng_event_expr *expr, unsigned int *index); +lttng_event_expr_array_field_element_get_index(const struct lttng_event_expr *expr, + unsigned int *index); /* * Returns whether or not the event expressions `expr_a` and `expr_b` @@ -230,7 +228,7 @@ lttng_event_expr_array_field_element_get_index( * `expr_a` and `expr_b` can be `NULL`. */ LTTNG_EXPORT extern 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); /* * Destroys the event expression `expr` if not `NULL`. diff --git a/include/lttng/event-field-value-internal.hpp b/include/lttng/event-field-value-internal.hpp index 96196db87..57a6a3e1c 100644 --- a/include/lttng/event-field-value-internal.hpp +++ b/include/lttng/event-field-value-internal.hpp @@ -8,10 +8,12 @@ #ifndef LTTNG_EVENT_FIELD_VALUE_INTERNAL_H #define LTTNG_EVENT_FIELD_VALUE_INTERNAL_H -#include -#include #include +#include + +#include + struct lttng_event_field_value { enum lttng_event_field_value_type type; }; @@ -114,9 +116,8 @@ struct lttng_event_field_value_array { * * `count` is `NULL`. */ 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); /* * Returns the label at index `index` of the enumeration event field @@ -129,45 +130,39 @@ lttng_event_field_value_enum_get_label_count( * * `index` is greater than or equal to the label count of `field_val`, * as returned by lttng_event_field_value_enum_get_label_count(). */ -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); -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 *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 *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 *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 *lttng_event_field_value_real_create(double val); -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); -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 *lttng_event_field_value_array_create(); -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); -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 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); int lttng_event_field_value_array_append_unavailable( - struct lttng_event_field_value *array_field_val); + struct lttng_event_field_value *array_field_val); void lttng_event_field_value_destroy(struct lttng_event_field_value *field_val); diff --git a/include/lttng/event-field-value.h b/include/lttng/event-field-value.h index 02d93c661..7f10deec3 100644 --- a/include/lttng/event-field-value.h +++ b/include/lttng/event-field-value.h @@ -9,6 +9,7 @@ #define LTTNG_EVENT_FIELD_VALUE_H #include + #include struct lttng_event_field_value; @@ -104,8 +105,8 @@ enum lttng_event_field_value_status { * `LTTNG_EVENT_FIELD_VALUE_TYPE_INVALID`: * `field_val` is `NULL`. */ -LTTNG_EXPORT extern enum lttng_event_field_value_type lttng_event_field_value_get_type( - const struct lttng_event_field_value *field_val); +LTTNG_EXPORT extern enum lttng_event_field_value_type +lttng_event_field_value_get_type(const struct lttng_event_field_value *field_val); /* * Sets `*val` to the raw value of the unsigned integer/enumeration @@ -124,8 +125,8 @@ LTTNG_EXPORT extern enum lttng_event_field_value_type lttng_event_field_value_ge * * `val` is `NULL`. */ LTTNG_EXPORT extern 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); /* * Sets `*val` to the raw value of the signed integer/enumeration event @@ -144,8 +145,8 @@ lttng_event_field_value_unsigned_int_get_value( * * `val` is `NULL`. */ LTTNG_EXPORT extern 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); /* * Sets `*val` to the raw value of the real event field value @@ -163,8 +164,8 @@ lttng_event_field_value_signed_int_get_value( * * `val` is `NULL`. */ LTTNG_EXPORT extern 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); /* * Returns the raw value (an UTF-8 C string) of the string event field @@ -179,9 +180,8 @@ lttng_event_field_value_real_get_value( * `LTTNG_EVENT_FIELD_VALUE_TYPE_STRING`. */ LTTNG_EXPORT extern enum lttng_event_field_value_status -lttng_event_field_value_string_get_value( - const struct lttng_event_field_value *field_val, - const char **value); +lttng_event_field_value_string_get_value(const struct lttng_event_field_value *field_val, + const char **value); /* * Sets `*length` to the length (the number of contained elements) of @@ -199,9 +199,8 @@ lttng_event_field_value_string_get_value( * * `length` is `NULL`. */ LTTNG_EXPORT extern enum lttng_event_field_value_status -lttng_event_field_value_array_get_length( - const struct lttng_event_field_value *field_val, - unsigned int *length); +lttng_event_field_value_array_get_length(const struct lttng_event_field_value *field_val, + unsigned int *length); /* * Sets `*elem_field_val` to the event field value at index `index` in @@ -225,9 +224,9 @@ lttng_event_field_value_array_get_length( */ LTTNG_EXPORT extern 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); + const struct lttng_event_field_value *field_val, + unsigned int index, + const struct lttng_event_field_value **elem_field_val); #ifdef __cplusplus } diff --git a/include/lttng/event-internal.hpp b/include/lttng/event-internal.hpp index daa8fa68e..df5a9fd45 100644 --- a/include/lttng/event-internal.hpp +++ b/include/lttng/event-internal.hpp @@ -13,6 +13,7 @@ #define LTTNG_EVENT_INTERNAL_H #include + #include #include @@ -58,7 +59,7 @@ struct lttng_event_comm { struct lttng_event_exclusion_comm { /* Includes terminator `\0`. */ uint32_t len; - char payload []; + char payload[]; } LTTNG_PACKED; struct lttng_event_probe_attr_comm { @@ -154,43 +155,38 @@ struct lttng_event_extended { struct lttng_event *lttng_event_copy(const struct lttng_event *event); 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); 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); -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); int lttng_event_context_serialize(struct lttng_event_context *context, - struct lttng_payload *payload); + struct lttng_payload *payload); void lttng_event_context_destroy(struct lttng_event_context *context); -enum lttng_error_code lttng_events_create_and_flatten_from_payload( - struct lttng_payload_view *view, - unsigned int count, - struct lttng_event **events); +enum lttng_error_code lttng_events_create_and_flatten_from_payload(struct lttng_payload_view *view, + unsigned int count, + struct lttng_event **events); -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); int lttng_event_field_serialize(const struct lttng_event_field *field, - struct lttng_payload *payload); + struct lttng_payload *payload); 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); #endif /* LTTNG_EVENT_INTERNAL_H */ diff --git a/include/lttng/event-rule/event-rule-internal.hpp b/include/lttng/event-rule/event-rule-internal.hpp index b1415cac7..1b73b0609 100644 --- a/include/lttng/event-rule/event-rule-internal.hpp +++ b/include/lttng/event-rule/event-rule-internal.hpp @@ -8,13 +8,15 @@ #ifndef LTTNG_EVENT_RULE_INTERNAL_H #define LTTNG_EVENT_RULE_INTERNAL_H -#include #include +#include #include + #include -#include #include +#include #include + #include #include #include @@ -72,31 +74,27 @@ struct lttng_event_rule_comm { char payload[]; }; -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); bool lttng_event_rule_validate(const struct lttng_event_rule *event_rule); -ssize_t lttng_event_rule_create_from_payload( - struct lttng_payload_view *payload, - struct lttng_event_rule **event_rule); +ssize_t lttng_event_rule_create_from_payload(struct lttng_payload_view *payload, + struct lttng_event_rule **event_rule); int lttng_event_rule_serialize(const struct lttng_event_rule *event_rule, - struct lttng_payload *payload); + struct lttng_payload *payload); -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 lttng_event_rule_get(struct lttng_event_rule *rule); void lttng_event_rule_put(struct lttng_event_rule *rule); -enum lttng_domain_type lttng_event_rule_get_domain_type( - const struct lttng_event_rule *rule); +enum lttng_domain_type lttng_event_rule_get_domain_type(const struct lttng_event_rule *rule); -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); /* * If not present/implemented returns NULL. @@ -108,8 +106,8 @@ const char *lttng_event_rule_get_filter(const struct lttng_event_rule *rule); * If not present/implemented returns NULL. * Caller DOES NOT own the returned object. */ -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); /* * If not present/implemented return NULL. @@ -117,7 +115,7 @@ 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); const char *lttng_event_rule_type_str(enum lttng_event_rule_type type); @@ -132,13 +130,12 @@ unsigned long lttng_event_rule_hash(const struct lttng_event_rule *rule); * * The caller owns the returned object. */ -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); /* Test if an event rule targets an agent domain. */ bool lttng_event_rule_targets_agent_domain(const struct lttng_event_rule *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); #endif /* LTTNG_EVENT_RULE_INTERNAL_H */ diff --git a/include/lttng/event-rule/event-rule.h b/include/lttng/event-rule/event-rule.h index 0c2453ccf..a75db771e 100644 --- a/include/lttng/event-rule/event-rule.h +++ b/include/lttng/event-rule/event-rule.h @@ -48,8 +48,8 @@ enum lttng_event_rule_status { * Returns the type of an event rule on success, LTTNG_EVENT_RULE_UNKNOWN on * error. */ -LTTNG_EXPORT extern enum lttng_event_rule_type lttng_event_rule_get_type( - const struct lttng_event_rule *event_rule); +LTTNG_EXPORT extern enum lttng_event_rule_type +lttng_event_rule_get_type(const struct lttng_event_rule *event_rule); /* * Destroy an event rule object. diff --git a/include/lttng/event-rule/jul-logging-internal.hpp b/include/lttng/event-rule/jul-logging-internal.hpp index b769f0f80..c84ab7a7f 100644 --- a/include/lttng/event-rule/jul-logging-internal.hpp +++ b/include/lttng/event-rule/jul-logging-internal.hpp @@ -8,9 +8,10 @@ #ifndef LTTNG_EVENT_RULE_JUL_LOGGING_INTERNAL_H #define LTTNG_EVENT_RULE_JUL_LOGGING_INTERNAL_H -#include #include #include +#include + #include #include #include @@ -51,8 +52,7 @@ struct lttng_event_rule_jul_logging_comm { char payload[]; } LTTNG_PACKED; -ssize_t lttng_event_rule_jul_logging_create_from_payload( - struct lttng_payload_view *view, - struct lttng_event_rule **rule); +ssize_t lttng_event_rule_jul_logging_create_from_payload(struct lttng_payload_view *view, + struct lttng_event_rule **rule); #endif /* LTTNG_EVENT_RULE_JUL_LOGGING_INTERNAL_H */ diff --git a/include/lttng/event-rule/jul-logging.h b/include/lttng/event-rule/jul-logging.h index 833e6adff..7960c1c7e 100644 --- a/include/lttng/event-rule/jul-logging.h +++ b/include/lttng/event-rule/jul-logging.h @@ -9,9 +9,9 @@ #define LTTNG_EVENT_RULE_JUL_LOGGING_H #include +#include #include #include -#include #ifdef __cplusplus extern "C" { @@ -35,8 +35,8 @@ LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_jul_logging_create * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_set_name_pattern( - struct lttng_event_rule *rule, const char *pattern); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_jul_logging_set_name_pattern(struct lttng_event_rule *rule, const char *pattern); /* * Get the name pattern of a jul logging event rule. @@ -50,8 +50,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_se * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern * was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_get_name_pattern( - const struct lttng_event_rule *rule, const char **pattern); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_jul_logging_get_name_pattern(const struct lttng_event_rule *rule, + const char **pattern); /* * Set the filter expression of a jul logging event rule. @@ -61,8 +62,8 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_ge * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_set_filter( - struct lttng_event_rule *rule, const char *expression); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_jul_logging_set_filter(struct lttng_event_rule *rule, const char *expression); /* * Get the filter expression of a jul logging event rule. @@ -76,8 +77,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_se * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression * was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_get_filter( - const struct lttng_event_rule *rule, const char **expression); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_jul_logging_get_filter(const struct lttng_event_rule *rule, + const char **expression); /* * Set the log level rule of a jul logging event rule. @@ -89,7 +91,7 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_jul_logging_ge */ LTTNG_EXPORT extern 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); + const struct lttng_log_level_rule *log_level_rule); /* * Get the log level rule of a jul logging event rule. @@ -104,9 +106,8 @@ lttng_event_rule_jul_logging_set_log_level_rule(struct lttng_event_rule *rule, * to this call. */ LTTNG_EXPORT extern 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); +lttng_event_rule_jul_logging_get_log_level_rule(const struct lttng_event_rule *rule, + const struct lttng_log_level_rule **log_level_rule); #ifdef __cplusplus } diff --git a/include/lttng/event-rule/kernel-kprobe-internal.hpp b/include/lttng/event-rule/kernel-kprobe-internal.hpp index 5b4997987..f92fc10c4 100644 --- a/include/lttng/event-rule/kernel-kprobe-internal.hpp +++ b/include/lttng/event-rule/kernel-kprobe-internal.hpp @@ -8,8 +8,9 @@ #ifndef LTTNG_EVENT_RULE_KERNEL_KPROBE_INTERNAL_H #define LTTNG_EVENT_RULE_KERNEL_KPROBE_INTERNAL_H -#include #include +#include + #include #include @@ -31,8 +32,7 @@ struct lttng_event_rule_kernel_kprobe_comm { char payload[]; } LTTNG_PACKED; -ssize_t lttng_event_rule_kernel_kprobe_create_from_payload( - struct lttng_payload_view *payload, - struct lttng_event_rule **rule); +ssize_t lttng_event_rule_kernel_kprobe_create_from_payload(struct lttng_payload_view *payload, + struct lttng_event_rule **rule); #endif /* LTTNG_EVENT_RULE_KERNEL_KPROBE_INTERNAL_H */ diff --git a/include/lttng/event-rule/kernel-kprobe.h b/include/lttng/event-rule/kernel-kprobe.h index c970116af..6e292f0d1 100644 --- a/include/lttng/event-rule/kernel-kprobe.h +++ b/include/lttng/event-rule/kernel-kprobe.h @@ -25,8 +25,8 @@ struct lttng_kernel_probe_location; * Returns a new event rule on success, NULL on failure. The returned event rule * must be destroyed using lttng_event_rule_destroy(). */ -LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_kprobe_create( - const struct lttng_kernel_probe_location *location); +LTTNG_EXPORT extern struct lttng_event_rule * +lttng_event_rule_kernel_kprobe_create(const struct lttng_kernel_probe_location *location); /* * Get the kernel probe location of a kernel kprobe event rule. @@ -40,9 +40,9 @@ LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_kprobe_crea * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a location was not set prior to * this call. */ -LTTNG_EXPORT extern 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); +LTTNG_EXPORT extern 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); /* * Set the name of a kernel kprobe event rule. @@ -52,8 +52,8 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_ * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_set_event_name( - struct lttng_event_rule *rule, const char *name); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_kernel_kprobe_set_event_name(struct lttng_event_rule *rule, const char *name); /* * Get the name of a kernel kprobe event rule. @@ -66,8 +66,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_ * success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is passed, * or LTTNG_EVENT_RULE_STATUS_UNSET if a name was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_kprobe_get_event_name( - const struct lttng_event_rule *rule, const char **name); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_kernel_kprobe_get_event_name(const struct lttng_event_rule *rule, + const char **name); #ifdef __cplusplus } diff --git a/include/lttng/event-rule/kernel-syscall-internal.hpp b/include/lttng/event-rule/kernel-syscall-internal.hpp index 2ca1823ec..9cef606bb 100644 --- a/include/lttng/event-rule/kernel-syscall-internal.hpp +++ b/include/lttng/event-rule/kernel-syscall-internal.hpp @@ -8,8 +8,9 @@ #ifndef LTTNG_EVENT_RULE_KERNEL_SYSCALL_INTERNAL_H #define LTTNG_EVENT_RULE_KERNEL_SYSCALL_INTERNAL_H -#include #include +#include + #include #include @@ -40,11 +41,10 @@ struct lttng_event_rule_kernel_syscall_comm { char payload[]; } LTTNG_PACKED; -ssize_t lttng_event_rule_kernel_syscall_create_from_payload( - struct lttng_payload_view *view, - struct lttng_event_rule **rule); +ssize_t lttng_event_rule_kernel_syscall_create_from_payload(struct lttng_payload_view *view, + struct lttng_event_rule **rule); 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); #endif /* LTTNG_EVENT_RULE_KERNEL_SYSCALL_INTERNAL_H */ diff --git a/include/lttng/event-rule/kernel-syscall.h b/include/lttng/event-rule/kernel-syscall.h index ce8be6a5d..4ae104ff6 100644 --- a/include/lttng/event-rule/kernel-syscall.h +++ b/include/lttng/event-rule/kernel-syscall.h @@ -31,8 +31,8 @@ enum lttng_event_rule_kernel_syscall_emission_site { * Returns a new event rule on success, NULL on failure. This event rule must be * destroyed using lttng_event_rule_destroy(). */ -LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_syscall_create(enum - lttng_event_rule_kernel_syscall_emission_site emission_site); +LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_syscall_create( + enum lttng_event_rule_kernel_syscall_emission_site emission_site); /* * Set the name pattern of a kernel syscall event rule. @@ -44,8 +44,9 @@ LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_syscall_cre * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_name_pattern( - struct lttng_event_rule *rule, const char *pattern); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_kernel_syscall_set_name_pattern(struct lttng_event_rule *rule, + const char *pattern); /* * Get the name pattern of a kernel syscall event rule. @@ -59,8 +60,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern * was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_get_name_pattern( - const struct lttng_event_rule *rule, const char **pattern); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_kernel_syscall_get_name_pattern(const struct lttng_event_rule *rule, + const char **pattern); /* * Set the filter expression of a kernel syscall event rule. @@ -70,8 +72,8 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_filter( - struct lttng_event_rule *rule, const char *expression); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_kernel_syscall_set_filter(struct lttng_event_rule *rule, const char *expression); /* * Get the filter expression of a kernel syscall event rule. @@ -85,8 +87,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression * was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_get_filter( - const struct lttng_event_rule *rule, const char **expression); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_kernel_syscall_get_filter(const struct lttng_event_rule *rule, + const char **expression); /* * Get the emission site of a kernel syscall event rule. @@ -94,8 +97,7 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall * Returns a enum lttng_event_rule_kernel_syscall_emission_site. */ LTTNG_EXPORT 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); #ifdef __cplusplus } diff --git a/include/lttng/event-rule/kernel-tracepoint-internal.hpp b/include/lttng/event-rule/kernel-tracepoint-internal.hpp index d800eef91..1a0e50abd 100644 --- a/include/lttng/event-rule/kernel-tracepoint-internal.hpp +++ b/include/lttng/event-rule/kernel-tracepoint-internal.hpp @@ -8,9 +8,10 @@ #ifndef LTTNG_EVENT_RULE_KERNEL_TRACEPOINT_INTERNAL_H #define LTTNG_EVENT_RULE_KERNEL_TRACEPOINT_INTERNAL_H -#include #include #include +#include + #include #include #include @@ -44,8 +45,7 @@ struct lttng_event_rule_kernel_tracepoint_comm { char payload[]; } LTTNG_PACKED; -ssize_t lttng_event_rule_kernel_tracepoint_create_from_payload( - struct lttng_payload_view *view, - struct lttng_event_rule **rule); +ssize_t lttng_event_rule_kernel_tracepoint_create_from_payload(struct lttng_payload_view *view, + struct lttng_event_rule **rule); #endif /* LTTNG_EVENT_RULE_KERNEL_TRACEPOINT_INTERNAL_H */ diff --git a/include/lttng/event-rule/kernel-tracepoint.h b/include/lttng/event-rule/kernel-tracepoint.h index 550a04ac4..6c566e159 100644 --- a/include/lttng/event-rule/kernel-tracepoint.h +++ b/include/lttng/event-rule/kernel-tracepoint.h @@ -34,8 +34,9 @@ LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_tracepoint_ * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_name_pattern( - struct lttng_event_rule *rule, const char *pattern); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_kernel_tracepoint_set_name_pattern(struct lttng_event_rule *rule, + const char *pattern); /* * Get the name pattern of a kernel tracepoint event rule. @@ -49,8 +50,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepo * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern * was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_name_pattern( - const struct lttng_event_rule *rule, const char **pattern); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_kernel_tracepoint_get_name_pattern(const struct lttng_event_rule *rule, + const char **pattern); /* * Set the filter expression of a kernel tracepoint event rule. @@ -60,8 +62,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepo * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_filter( - struct lttng_event_rule *rule, const char *expression); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_kernel_tracepoint_set_filter(struct lttng_event_rule *rule, + const char *expression); /* * Get the filter expression of a kernel tracepoint event rule. @@ -75,8 +78,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepo * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression * was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_filter( - const struct lttng_event_rule *rule, const char **expression); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_kernel_tracepoint_get_filter(const struct lttng_event_rule *rule, + const char **expression); #ifdef __cplusplus } diff --git a/include/lttng/event-rule/kernel-uprobe-internal.hpp b/include/lttng/event-rule/kernel-uprobe-internal.hpp index f9a193100..61dfd4f3f 100644 --- a/include/lttng/event-rule/kernel-uprobe-internal.hpp +++ b/include/lttng/event-rule/kernel-uprobe-internal.hpp @@ -8,8 +8,9 @@ #ifndef LTTNG_EVENT_RULE_KERNEL_UPROBE_INTERNAL_H #define LTTNG_EVENT_RULE_KERNEL_UPROBE_INTERNAL_H -#include #include +#include + #include #include @@ -32,12 +33,10 @@ struct lttng_event_rule_kernel_uprobe_comm { char payload[]; } LTTNG_PACKED; -ssize_t lttng_event_rule_kernel_uprobe_create_from_payload( - struct lttng_payload_view *view, - struct lttng_event_rule **rule); +ssize_t lttng_event_rule_kernel_uprobe_create_from_payload(struct lttng_payload_view *view, + struct lttng_event_rule **rule); 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); #endif /* LTTNG_EVENT_RULE_KERNEL_UPROBE_INTERNAL_H */ diff --git a/include/lttng/event-rule/kernel-uprobe.h b/include/lttng/event-rule/kernel-uprobe.h index 6b29b695d..cfb0ccaa7 100644 --- a/include/lttng/event-rule/kernel-uprobe.h +++ b/include/lttng/event-rule/kernel-uprobe.h @@ -24,8 +24,8 @@ extern "C" { * Returns a new event rule on success, NULL on failure. This event rule must be * destroyed using lttng_event_rule_destroy(). */ -LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_uprobe_create( - const struct lttng_userspace_probe_location *location); +LTTNG_EXPORT extern struct lttng_event_rule * +lttng_event_rule_kernel_uprobe_create(const struct lttng_userspace_probe_location *location); /* * Get the location of a kernel uprobe event rule. @@ -39,9 +39,9 @@ LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_uprobe_crea * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a location was not set prior to * this call. */ -LTTNG_EXPORT extern 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); +LTTNG_EXPORT extern 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); /* * Set the name of a kernel uprobe event rule. @@ -51,8 +51,8 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_ * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_set_event_name( - struct lttng_event_rule *rule, const char *name); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_kernel_uprobe_set_event_name(struct lttng_event_rule *rule, const char *name); /* * Get the name of a kernel uprobe event rule. @@ -65,8 +65,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_ * success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is passed, * or LTTNG_EVENT_RULE_STATUS_UNSET if a name was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_kernel_uprobe_get_event_name( - const struct lttng_event_rule *rule, const char **name); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_kernel_uprobe_get_event_name(const struct lttng_event_rule *rule, + const char **name); #ifdef __cplusplus } diff --git a/include/lttng/event-rule/log4j-logging-internal.hpp b/include/lttng/event-rule/log4j-logging-internal.hpp index a65e74b6d..239bf98ee 100644 --- a/include/lttng/event-rule/log4j-logging-internal.hpp +++ b/include/lttng/event-rule/log4j-logging-internal.hpp @@ -8,9 +8,10 @@ #ifndef LTTNG_EVENT_RULE_LOG4J_LOGGING_INTERNAL_H #define LTTNG_EVENT_RULE_LOG4J_LOGGING_INTERNAL_H -#include #include #include +#include + #include #include #include @@ -51,8 +52,7 @@ struct lttng_event_rule_log4j_logging_comm { char payload[]; } LTTNG_PACKED; -ssize_t lttng_event_rule_log4j_logging_create_from_payload( - struct lttng_payload_view *view, - struct lttng_event_rule **rule); +ssize_t lttng_event_rule_log4j_logging_create_from_payload(struct lttng_payload_view *view, + struct lttng_event_rule **rule); #endif /* LTTNG_EVENT_RULE_LOG4J_LOGGING_INTERNAL_H */ diff --git a/include/lttng/event-rule/log4j-logging.h b/include/lttng/event-rule/log4j-logging.h index 277e7d950..9128b4d69 100644 --- a/include/lttng/event-rule/log4j-logging.h +++ b/include/lttng/event-rule/log4j-logging.h @@ -9,9 +9,9 @@ #define LTTNG_EVENT_RULE_LOG4J_LOGGING_H #include +#include #include #include -#include #ifdef __cplusplus extern "C" { @@ -35,8 +35,8 @@ LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_log4j_logging_crea * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_name_pattern( - struct lttng_event_rule *rule, const char *pattern); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_log4j_logging_set_name_pattern(struct lttng_event_rule *rule, const char *pattern); /* * Get the name pattern of a log4j logging event rule. @@ -50,8 +50,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_ * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern * was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_name_pattern( - const struct lttng_event_rule *rule, const char **pattern); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_log4j_logging_get_name_pattern(const struct lttng_event_rule *rule, + const char **pattern); /* * Set the filter expression of a log4j logging event rule. @@ -61,8 +62,8 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_ * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_set_filter( - struct lttng_event_rule *rule, const char *expression); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_log4j_logging_set_filter(struct lttng_event_rule *rule, const char *expression); /* * Get the filter expression of a log4j logging event rule. @@ -76,8 +77,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_ * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression * was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_get_filter( - const struct lttng_event_rule *rule, const char **expression); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_log4j_logging_get_filter(const struct lttng_event_rule *rule, + const char **expression); /* * Set the log level rule of a log4j logging event rule. @@ -87,9 +89,8 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_log4j_logging_ * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern 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); +LTTNG_EXPORT extern 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); /* * Get the log level rule of a log4j logging event rule. @@ -103,10 +104,8 @@ lttng_event_rule_log4j_logging_set_log_level_rule(struct lttng_event_rule *rule, * is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level rule was not set prior * to this call. */ -LTTNG_EXPORT extern 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); +LTTNG_EXPORT extern 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); #ifdef __cplusplus } diff --git a/include/lttng/event-rule/python-logging-internal.hpp b/include/lttng/event-rule/python-logging-internal.hpp index d23f4e2a5..f7513f420 100644 --- a/include/lttng/event-rule/python-logging-internal.hpp +++ b/include/lttng/event-rule/python-logging-internal.hpp @@ -8,9 +8,10 @@ #ifndef LTTNG_EVENT_RULE_PYTHON_LOGGING_INTERNAL_H #define LTTNG_EVENT_RULE_PYTHON_LOGGING_INTERNAL_H -#include #include #include +#include + #include #include #include @@ -51,8 +52,7 @@ struct lttng_event_rule_python_logging_comm { char payload[]; } LTTNG_PACKED; -ssize_t lttng_event_rule_python_logging_create_from_payload( - struct lttng_payload_view *view, - struct lttng_event_rule **rule); +ssize_t lttng_event_rule_python_logging_create_from_payload(struct lttng_payload_view *view, + struct lttng_event_rule **rule); #endif /* LTTNG_EVENT_RULE_PYTHON_LOGGING_INTERNAL_H */ diff --git a/include/lttng/event-rule/python-logging.h b/include/lttng/event-rule/python-logging.h index d4a6ada47..d77be2e50 100644 --- a/include/lttng/event-rule/python-logging.h +++ b/include/lttng/event-rule/python-logging.h @@ -9,9 +9,9 @@ #define LTTNG_EVENT_RULE_PYTHON_LOGGING_H #include +#include #include #include -#include #ifdef __cplusplus extern "C" { @@ -35,8 +35,9 @@ LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_python_logging_cre * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging_set_name_pattern( - struct lttng_event_rule *rule, const char *pattern); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_python_logging_set_name_pattern(struct lttng_event_rule *rule, + const char *pattern); /* * Get the name pattern of a python logging event rule. @@ -50,8 +51,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern * was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging_get_name_pattern( - const struct lttng_event_rule *rule, const char **pattern); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_python_logging_get_name_pattern(const struct lttng_event_rule *rule, + const char **pattern); /* * Set the filter expression of a python logging event rule. @@ -61,8 +63,8 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging_set_filter( - struct lttng_event_rule *rule, const char *expression); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_python_logging_set_filter(struct lttng_event_rule *rule, const char *expression); /* * Get the filter expression of a python logging event rule. @@ -76,8 +78,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression * was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging_get_filter( - const struct lttng_event_rule *rule, const char **expression); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_python_logging_get_filter(const struct lttng_event_rule *rule, + const char **expression); /* * Set the log level rule of a python logging event rule. @@ -87,9 +90,8 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_python_logging * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern 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); +LTTNG_EXPORT extern 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); /* * Get the log level rule of a python logging event rule. @@ -103,10 +105,8 @@ lttng_event_rule_python_logging_set_log_level_rule(struct lttng_event_rule *rule * is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level rule was not set prior * to this call. */ -LTTNG_EXPORT extern 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); +LTTNG_EXPORT extern 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); #ifdef __cplusplus } diff --git a/include/lttng/event-rule/user-tracepoint-internal.hpp b/include/lttng/event-rule/user-tracepoint-internal.hpp index 1960a8a4d..65199bbbc 100644 --- a/include/lttng/event-rule/user-tracepoint-internal.hpp +++ b/include/lttng/event-rule/user-tracepoint-internal.hpp @@ -8,9 +8,10 @@ #ifndef LTTNG_EVENT_RULE_USER_TRACEPOINT_INTERNAL_H #define LTTNG_EVENT_RULE_USER_TRACEPOINT_INTERNAL_H -#include #include #include +#include + #include #include #include @@ -58,8 +59,7 @@ struct lttng_event_rule_user_tracepoint_comm { char payload[]; } LTTNG_PACKED; -ssize_t lttng_event_rule_user_tracepoint_create_from_payload( - struct lttng_payload_view *view, - struct lttng_event_rule **rule); +ssize_t lttng_event_rule_user_tracepoint_create_from_payload(struct lttng_payload_view *view, + struct lttng_event_rule **rule); #endif /* LTTNG_EVENT_RULE_USER_TRACEPOINT_INTERNAL_H */ diff --git a/include/lttng/event-rule/user-tracepoint.h b/include/lttng/event-rule/user-tracepoint.h index 7ee91ce79..8f227b778 100644 --- a/include/lttng/event-rule/user-tracepoint.h +++ b/include/lttng/event-rule/user-tracepoint.h @@ -10,9 +10,9 @@ #include #include +#include #include #include -#include #ifdef __cplusplus extern "C" { @@ -36,8 +36,9 @@ LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_user_tracepoint_cr * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_name_pattern( - struct lttng_event_rule *rule, const char *pattern); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_user_tracepoint_set_name_pattern(struct lttng_event_rule *rule, + const char *pattern); /* * Get the name pattern of a user tracepoint event rule. @@ -51,8 +52,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoin * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern * was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pattern( - const struct lttng_event_rule *rule, const char **pattern); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_user_tracepoint_get_name_pattern(const struct lttng_event_rule *rule, + const char **pattern); /* * Set the filter expression of a user tracepoint event rule. @@ -62,8 +64,8 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoin * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_filter( - struct lttng_event_rule *rule, const char *expression); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_user_tracepoint_set_filter(struct lttng_event_rule *rule, const char *expression); /* * Get the filter expression of a user tracepoint event rule. @@ -77,8 +79,9 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoin * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression * was not set prior to this call. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_filter( - const struct lttng_event_rule *rule, const char **expression); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_user_tracepoint_get_filter(const struct lttng_event_rule *rule, + const char **expression); /* * Set the log level rule of a user tracepoint event rule. @@ -89,8 +92,8 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoin * if invalid parameters are passed. */ LTTNG_EXPORT extern 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); +lttng_event_rule_user_tracepoint_set_log_level_rule( + struct lttng_event_rule *rule, const struct lttng_log_level_rule *log_level_rule); /* * Get the log level rule of a user tracepoint event rule. @@ -106,8 +109,7 @@ lttng_event_rule_user_tracepoint_set_log_level_rule(struct lttng_event_rule *rul */ LTTNG_EXPORT extern 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); /* * Add a name pattern exclusion to the set of name pattern exclusion of an event rule. @@ -117,9 +119,9 @@ lttng_event_rule_user_tracepoint_get_log_level_rule( * Returns LTTNG_EVENT_RULE_STATUS_OK on success, * LTTNG_EVENT_RULE_STATUS_INVALID if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_add_name_pattern_exclusion( - struct lttng_event_rule *rule, - const char *exclusion); +LTTNG_EXPORT extern enum lttng_event_rule_status +lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(struct lttng_event_rule *rule, + const char *exclusion); /* * Get the name pattern exclusions property count of an event rule. @@ -130,7 +132,7 @@ LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoin */ LTTNG_EXPORT extern 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); /* * Get the pattern name exclusion at the given index. @@ -141,9 +143,7 @@ lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count( */ LTTNG_EXPORT extern 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); #ifdef __cplusplus } diff --git a/include/lttng/event.h b/include/lttng/event.h index 5915db6d6..202fd8992 100644 --- a/include/lttng/event.h +++ b/include/lttng/event.h @@ -21,44 +21,44 @@ extern "C" { * Instrumentation type of tracing event. */ enum lttng_event_type { - LTTNG_EVENT_ALL = -1, - LTTNG_EVENT_TRACEPOINT = 0, - LTTNG_EVENT_PROBE = 1, - LTTNG_EVENT_FUNCTION = 2, - LTTNG_EVENT_FUNCTION_ENTRY = 3, - LTTNG_EVENT_NOOP = 4, - LTTNG_EVENT_SYSCALL = 5, - LTTNG_EVENT_USERSPACE_PROBE = 6, + LTTNG_EVENT_ALL = -1, + LTTNG_EVENT_TRACEPOINT = 0, + LTTNG_EVENT_PROBE = 1, + LTTNG_EVENT_FUNCTION = 2, + LTTNG_EVENT_FUNCTION_ENTRY = 3, + LTTNG_EVENT_NOOP = 4, + LTTNG_EVENT_SYSCALL = 5, + LTTNG_EVENT_USERSPACE_PROBE = 6, }; /* * Loglevel information. */ enum lttng_loglevel_type { - LTTNG_EVENT_LOGLEVEL_ALL = 0, - LTTNG_EVENT_LOGLEVEL_RANGE = 1, - LTTNG_EVENT_LOGLEVEL_SINGLE = 2, + LTTNG_EVENT_LOGLEVEL_ALL = 0, + LTTNG_EVENT_LOGLEVEL_RANGE = 1, + LTTNG_EVENT_LOGLEVEL_SINGLE = 2, }; /* * Available loglevels. */ enum lttng_loglevel { - LTTNG_LOGLEVEL_EMERG = 0, - LTTNG_LOGLEVEL_ALERT = 1, - LTTNG_LOGLEVEL_CRIT = 2, - LTTNG_LOGLEVEL_ERR = 3, - LTTNG_LOGLEVEL_WARNING = 4, - LTTNG_LOGLEVEL_NOTICE = 5, - LTTNG_LOGLEVEL_INFO = 6, - LTTNG_LOGLEVEL_DEBUG_SYSTEM = 7, - LTTNG_LOGLEVEL_DEBUG_PROGRAM = 8, - LTTNG_LOGLEVEL_DEBUG_PROCESS = 9, - LTTNG_LOGLEVEL_DEBUG_MODULE = 10, - LTTNG_LOGLEVEL_DEBUG_UNIT = 11, - LTTNG_LOGLEVEL_DEBUG_FUNCTION = 12, - LTTNG_LOGLEVEL_DEBUG_LINE = 13, - LTTNG_LOGLEVEL_DEBUG = 14, + LTTNG_LOGLEVEL_EMERG = 0, + LTTNG_LOGLEVEL_ALERT = 1, + LTTNG_LOGLEVEL_CRIT = 2, + LTTNG_LOGLEVEL_ERR = 3, + LTTNG_LOGLEVEL_WARNING = 4, + LTTNG_LOGLEVEL_NOTICE = 5, + LTTNG_LOGLEVEL_INFO = 6, + LTTNG_LOGLEVEL_DEBUG_SYSTEM = 7, + LTTNG_LOGLEVEL_DEBUG_PROGRAM = 8, + LTTNG_LOGLEVEL_DEBUG_PROCESS = 9, + LTTNG_LOGLEVEL_DEBUG_MODULE = 10, + LTTNG_LOGLEVEL_DEBUG_UNIT = 11, + LTTNG_LOGLEVEL_DEBUG_FUNCTION = 12, + LTTNG_LOGLEVEL_DEBUG_LINE = 13, + LTTNG_LOGLEVEL_DEBUG = 14, }; /* @@ -66,15 +66,15 @@ enum lttng_loglevel { * class java.util.logging.Level. */ enum lttng_loglevel_jul { - LTTNG_LOGLEVEL_JUL_OFF = INT32_MAX, - LTTNG_LOGLEVEL_JUL_SEVERE = 1000, - LTTNG_LOGLEVEL_JUL_WARNING = 900, - LTTNG_LOGLEVEL_JUL_INFO = 800, - LTTNG_LOGLEVEL_JUL_CONFIG = 700, - LTTNG_LOGLEVEL_JUL_FINE = 500, - LTTNG_LOGLEVEL_JUL_FINER = 400, - LTTNG_LOGLEVEL_JUL_FINEST = 300, - LTTNG_LOGLEVEL_JUL_ALL = INT32_MIN, + LTTNG_LOGLEVEL_JUL_OFF = INT32_MAX, + LTTNG_LOGLEVEL_JUL_SEVERE = 1000, + LTTNG_LOGLEVEL_JUL_WARNING = 900, + LTTNG_LOGLEVEL_JUL_INFO = 800, + LTTNG_LOGLEVEL_JUL_CONFIG = 700, + LTTNG_LOGLEVEL_JUL_FINE = 500, + LTTNG_LOGLEVEL_JUL_FINER = 400, + LTTNG_LOGLEVEL_JUL_FINEST = 300, + LTTNG_LOGLEVEL_JUL_ALL = INT32_MIN, }; /* @@ -82,14 +82,14 @@ enum lttng_loglevel_jul { * class org.apache.log4j.Level. */ enum lttng_loglevel_log4j { - LTTNG_LOGLEVEL_LOG4J_OFF = INT32_MAX, - LTTNG_LOGLEVEL_LOG4J_FATAL = 50000, - LTTNG_LOGLEVEL_LOG4J_ERROR = 40000, - LTTNG_LOGLEVEL_LOG4J_WARN = 30000, - LTTNG_LOGLEVEL_LOG4J_INFO = 20000, - LTTNG_LOGLEVEL_LOG4J_DEBUG = 10000, - LTTNG_LOGLEVEL_LOG4J_TRACE = 5000, - LTTNG_LOGLEVEL_LOG4J_ALL = INT32_MIN, + LTTNG_LOGLEVEL_LOG4J_OFF = INT32_MAX, + LTTNG_LOGLEVEL_LOG4J_FATAL = 50000, + LTTNG_LOGLEVEL_LOG4J_ERROR = 40000, + LTTNG_LOGLEVEL_LOG4J_WARN = 30000, + LTTNG_LOGLEVEL_LOG4J_INFO = 20000, + LTTNG_LOGLEVEL_LOG4J_DEBUG = 10000, + LTTNG_LOGLEVEL_LOG4J_TRACE = 5000, + LTTNG_LOGLEVEL_LOG4J_ALL = INT32_MIN, }; /* @@ -97,79 +97,79 @@ enum lttng_loglevel_log4j { * Level class. */ enum lttng_loglevel_python { - LTTNG_LOGLEVEL_PYTHON_CRITICAL = 50, - LTTNG_LOGLEVEL_PYTHON_ERROR = 40, - LTTNG_LOGLEVEL_PYTHON_WARNING = 30, - LTTNG_LOGLEVEL_PYTHON_INFO = 20, - LTTNG_LOGLEVEL_PYTHON_DEBUG = 10, - LTTNG_LOGLEVEL_PYTHON_NOTSET = 0, + LTTNG_LOGLEVEL_PYTHON_CRITICAL = 50, + LTTNG_LOGLEVEL_PYTHON_ERROR = 40, + LTTNG_LOGLEVEL_PYTHON_WARNING = 30, + LTTNG_LOGLEVEL_PYTHON_INFO = 20, + LTTNG_LOGLEVEL_PYTHON_DEBUG = 10, + LTTNG_LOGLEVEL_PYTHON_NOTSET = 0, }; /* * LTTng consumer mode */ enum lttng_event_output { - LTTNG_EVENT_SPLICE = 0, - LTTNG_EVENT_MMAP = 1, + LTTNG_EVENT_SPLICE = 0, + LTTNG_EVENT_MMAP = 1, }; /* Event context possible type */ enum lttng_event_context_type { - LTTNG_EVENT_CONTEXT_PID = 0, - LTTNG_EVENT_CONTEXT_PERF_COUNTER = 1, /* Backward compat. */ - LTTNG_EVENT_CONTEXT_PROCNAME = 2, - LTTNG_EVENT_CONTEXT_PRIO = 3, - LTTNG_EVENT_CONTEXT_NICE = 4, - LTTNG_EVENT_CONTEXT_VPID = 5, - LTTNG_EVENT_CONTEXT_TID = 6, - LTTNG_EVENT_CONTEXT_VTID = 7, - LTTNG_EVENT_CONTEXT_PPID = 8, - LTTNG_EVENT_CONTEXT_VPPID = 9, - LTTNG_EVENT_CONTEXT_PTHREAD_ID = 10, - LTTNG_EVENT_CONTEXT_HOSTNAME = 11, - LTTNG_EVENT_CONTEXT_IP = 12, - LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER = 13, + LTTNG_EVENT_CONTEXT_PID = 0, + LTTNG_EVENT_CONTEXT_PERF_COUNTER = 1, /* Backward compat. */ + LTTNG_EVENT_CONTEXT_PROCNAME = 2, + LTTNG_EVENT_CONTEXT_PRIO = 3, + LTTNG_EVENT_CONTEXT_NICE = 4, + LTTNG_EVENT_CONTEXT_VPID = 5, + LTTNG_EVENT_CONTEXT_TID = 6, + LTTNG_EVENT_CONTEXT_VTID = 7, + LTTNG_EVENT_CONTEXT_PPID = 8, + LTTNG_EVENT_CONTEXT_VPPID = 9, + LTTNG_EVENT_CONTEXT_PTHREAD_ID = 10, + LTTNG_EVENT_CONTEXT_HOSTNAME = 11, + LTTNG_EVENT_CONTEXT_IP = 12, + LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER = 13, LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER = 14, - LTTNG_EVENT_CONTEXT_APP_CONTEXT = 15, - LTTNG_EVENT_CONTEXT_INTERRUPTIBLE = 16, - LTTNG_EVENT_CONTEXT_PREEMPTIBLE = 17, - LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE = 18, - LTTNG_EVENT_CONTEXT_MIGRATABLE = 19, - LTTNG_EVENT_CONTEXT_CALLSTACK_KERNEL = 20, - LTTNG_EVENT_CONTEXT_CALLSTACK_USER = 21, /* Supported on x86_32 and x86_64 only. */ - LTTNG_EVENT_CONTEXT_CGROUP_NS = 22, - LTTNG_EVENT_CONTEXT_IPC_NS = 23, - LTTNG_EVENT_CONTEXT_MNT_NS = 24, - LTTNG_EVENT_CONTEXT_NET_NS = 25, - LTTNG_EVENT_CONTEXT_PID_NS = 26, - LTTNG_EVENT_CONTEXT_USER_NS = 27, - LTTNG_EVENT_CONTEXT_UTS_NS = 28, - LTTNG_EVENT_CONTEXT_UID = 29, - LTTNG_EVENT_CONTEXT_EUID = 30, - LTTNG_EVENT_CONTEXT_SUID = 31, - LTTNG_EVENT_CONTEXT_GID = 32, - LTTNG_EVENT_CONTEXT_EGID = 33, - LTTNG_EVENT_CONTEXT_SGID = 34, - LTTNG_EVENT_CONTEXT_VUID = 35, - LTTNG_EVENT_CONTEXT_VEUID = 36, - LTTNG_EVENT_CONTEXT_VSUID = 37, - LTTNG_EVENT_CONTEXT_VGID = 38, - LTTNG_EVENT_CONTEXT_VEGID = 39, - LTTNG_EVENT_CONTEXT_VSGID = 40, - LTTNG_EVENT_CONTEXT_TIME_NS = 41, + LTTNG_EVENT_CONTEXT_APP_CONTEXT = 15, + LTTNG_EVENT_CONTEXT_INTERRUPTIBLE = 16, + LTTNG_EVENT_CONTEXT_PREEMPTIBLE = 17, + LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE = 18, + LTTNG_EVENT_CONTEXT_MIGRATABLE = 19, + LTTNG_EVENT_CONTEXT_CALLSTACK_KERNEL = 20, + LTTNG_EVENT_CONTEXT_CALLSTACK_USER = 21, /* Supported on x86_32 and x86_64 only. */ + LTTNG_EVENT_CONTEXT_CGROUP_NS = 22, + LTTNG_EVENT_CONTEXT_IPC_NS = 23, + LTTNG_EVENT_CONTEXT_MNT_NS = 24, + LTTNG_EVENT_CONTEXT_NET_NS = 25, + LTTNG_EVENT_CONTEXT_PID_NS = 26, + LTTNG_EVENT_CONTEXT_USER_NS = 27, + LTTNG_EVENT_CONTEXT_UTS_NS = 28, + LTTNG_EVENT_CONTEXT_UID = 29, + LTTNG_EVENT_CONTEXT_EUID = 30, + LTTNG_EVENT_CONTEXT_SUID = 31, + LTTNG_EVENT_CONTEXT_GID = 32, + LTTNG_EVENT_CONTEXT_EGID = 33, + LTTNG_EVENT_CONTEXT_SGID = 34, + LTTNG_EVENT_CONTEXT_VUID = 35, + LTTNG_EVENT_CONTEXT_VEUID = 36, + LTTNG_EVENT_CONTEXT_VSUID = 37, + LTTNG_EVENT_CONTEXT_VGID = 38, + LTTNG_EVENT_CONTEXT_VEGID = 39, + LTTNG_EVENT_CONTEXT_VSGID = 40, + LTTNG_EVENT_CONTEXT_TIME_NS = 41, }; enum lttng_event_field_type { - LTTNG_EVENT_FIELD_OTHER = 0, - LTTNG_EVENT_FIELD_INTEGER = 1, - LTTNG_EVENT_FIELD_ENUM = 2, - LTTNG_EVENT_FIELD_FLOAT = 3, - LTTNG_EVENT_FIELD_STRING = 4, + LTTNG_EVENT_FIELD_OTHER = 0, + LTTNG_EVENT_FIELD_INTEGER = 1, + LTTNG_EVENT_FIELD_ENUM = 2, + LTTNG_EVENT_FIELD_FLOAT = 3, + LTTNG_EVENT_FIELD_STRING = 4, }; enum lttng_event_flag { - LTTNG_EVENT_FLAG_SYSCALL_32 = (1U << 0), - LTTNG_EVENT_FLAG_SYSCALL_64 = (1U << 1), + LTTNG_EVENT_FLAG_SYSCALL_32 = (1U << 0), + LTTNG_EVENT_FLAG_SYSCALL_64 = (1U << 1), }; /* @@ -177,7 +177,7 @@ enum lttng_event_flag { * * The structures should be initialized to zero before use. */ -#define LTTNG_PERF_EVENT_PADDING1 16 +#define LTTNG_PERF_EVENT_PADDING1 16 struct lttng_event_perf_counter_ctx { uint32_t type; uint64_t config; @@ -191,8 +191,8 @@ struct lttng_event_perf_counter_ctx { * * The structures should be initialized to zero before use. */ -#define LTTNG_EVENT_CONTEXT_PADDING1 16 -#define LTTNG_EVENT_CONTEXT_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32 +#define LTTNG_EVENT_CONTEXT_PADDING1 16 +#define LTTNG_EVENT_CONTEXT_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32 struct lttng_event_context { enum lttng_event_context_type ctx; char padding[LTTNG_EVENT_CONTEXT_PADDING1]; @@ -214,7 +214,7 @@ struct lttng_event_context { * * The structures should be initialized to zero before use. */ -#define LTTNG_EVENT_PROBE_PADDING1 16 +#define LTTNG_EVENT_PROBE_PADDING1 16 struct lttng_event_probe_attr { uint64_t addr; @@ -229,7 +229,7 @@ struct lttng_event_probe_attr { * * The structures should be initialized to zero before use. */ -#define LTTNG_EVENT_FUNCTION_PADDING1 16 +#define LTTNG_EVENT_FUNCTION_PADDING1 16 struct lttng_event_function_attr { char symbol_name[LTTNG_SYMBOL_NAME_LEN]; @@ -241,8 +241,8 @@ struct lttng_event_function_attr { * * The structures should be initialized to zero before use. */ -#define LTTNG_EVENT_PADDING1 12 -#define LTTNG_EVENT_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32 +#define LTTNG_EVENT_PADDING1 12 +#define LTTNG_EVENT_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32 struct lttng_event { /* Offset 0 */ enum lttng_event_type type; @@ -257,13 +257,13 @@ struct lttng_event { int loglevel; /* Offset 268 */ - int32_t enabled; /* Does not apply: -1 */ + int32_t enabled; /* Does not apply: -1 */ /* Offset 272 */ pid_t pid; /* Offset 276 */ - unsigned char filter; /* filter enabled ? */ + unsigned char filter; /* filter enabled ? */ /* Offset 277 */ unsigned char exclusion; /* exclusions added ? */ @@ -294,7 +294,7 @@ struct lttng_event { } attr; }; -#define LTTNG_EVENT_FIELD_PADDING LTTNG_SYMBOL_NAME_LEN + 32 +#define LTTNG_EVENT_FIELD_PADDING LTTNG_SYMBOL_NAME_LEN + 32 struct lttng_event_field { char field_name[LTTNG_SYMBOL_NAME_LEN]; enum lttng_event_field_type type; @@ -312,7 +312,8 @@ struct lttng_event_field { * free events. On error a negative LTTng error code is returned. */ LTTNG_EXPORT extern int lttng_list_events(struct lttng_handle *handle, - const char *channel_name, struct lttng_event **events); + const char *channel_name, + struct lttng_event **events); /* * Create an lttng_event. @@ -337,7 +338,7 @@ LTTNG_EXPORT extern struct lttng_event *lttng_event_create(void); * * This destruction function, introduced in LTTng 2.11, should only * be used with events created by lttng_event_create(). - */ + */ LTTNG_EXPORT extern void lttng_event_destroy(struct lttng_event *event); /* @@ -351,7 +352,7 @@ LTTNG_EXPORT extern void lttng_event_destroy(struct lttng_event *event); * Returns 0 on success, or a negative LTTng error code on error. */ LTTNG_EXPORT extern int lttng_event_get_filter_expression(struct lttng_event *event, - const char **filter_string); + const char **filter_string); /* * Get the number of exclusion names of a specific LTTng event. @@ -370,7 +371,8 @@ LTTNG_EXPORT extern int lttng_event_get_exclusion_name_count(struct lttng_event * Returns 0 on success, or a negative LTTng error code on error. */ LTTNG_EXPORT extern int lttng_event_get_exclusion_name(struct lttng_event *event, - size_t index, const char **exclusion_name); + size_t index, + const char **exclusion_name); /* * Get the userspace probe location of a specific LTTng event. @@ -392,8 +394,9 @@ lttng_event_get_userspace_probe_location(const struct lttng_event *event); * * Returns 0 on success, or a negative LTTng error code on error. */ -LTTNG_EXPORT extern int lttng_event_set_userspace_probe_location(struct lttng_event *event, - struct lttng_userspace_probe_location *probe_location); +LTTNG_EXPORT extern int +lttng_event_set_userspace_probe_location(struct lttng_event *event, + struct lttng_userspace_probe_location *probe_location); /* * List the available tracepoints of a specific lttng domain. @@ -404,7 +407,7 @@ LTTNG_EXPORT extern int lttng_event_set_userspace_probe_location(struct lttng_ev * free events. On error a negative LTTng error code is returned. */ LTTNG_EXPORT extern int lttng_list_tracepoints(struct lttng_handle *handle, - struct lttng_event **events); + struct lttng_event **events); /* * List the available tracepoints fields of a specific lttng domain. @@ -416,7 +419,7 @@ LTTNG_EXPORT extern int lttng_list_tracepoints(struct lttng_handle *handle, * returned. */ LTTNG_EXPORT extern int lttng_list_tracepoint_fields(struct lttng_handle *handle, - struct lttng_event_field **fields); + struct lttng_event_field **fields); /* * List the available kernel syscall. @@ -440,8 +443,9 @@ LTTNG_EXPORT extern int lttng_list_syscalls(struct lttng_event **events); * Return 0 on success else a negative LTTng error code. */ LTTNG_EXPORT extern int lttng_add_context(struct lttng_handle *handle, - struct lttng_event_context *ctx, const char *event_name, - const char *channel_name); + struct lttng_event_context *ctx, + const char *event_name, + const char *channel_name); /* * Create or enable an event (or events) for a channel. @@ -454,8 +458,8 @@ LTTNG_EXPORT extern int lttng_add_context(struct lttng_handle *handle, * * Return 0 on success else a negative LTTng error code. */ -LTTNG_EXPORT extern int lttng_enable_event(struct lttng_handle *handle, - struct lttng_event *ev, const char *channel_name); +LTTNG_EXPORT extern int +lttng_enable_event(struct lttng_handle *handle, struct lttng_event *ev, const char *channel_name); /* * Create or enable an event with a specific filter. @@ -471,8 +475,9 @@ LTTNG_EXPORT extern int lttng_enable_event(struct lttng_handle *handle, * Return 0 on success else a negative LTTng error code. */ LTTNG_EXPORT extern 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); /* * Create or enable an event with a filter and/or exclusions. @@ -489,9 +494,11 @@ LTTNG_EXPORT extern int lttng_enable_event_with_filter(struct lttng_handle *hand * Return 0 on success else a negative LTTng error code. */ LTTNG_EXPORT extern int lttng_enable_event_with_exclusions(struct lttng_handle *handle, - struct lttng_event *event, const char *channel_name, - const char *filter_expression, - int exclusion_count, char **exclusion_names); + struct lttng_event *event, + const char *channel_name, + const char *filter_expression, + int exclusion_count, + char **exclusion_names); /* * Disable event(s) of a channel and domain. @@ -501,8 +508,8 @@ LTTNG_EXPORT extern int lttng_enable_event_with_exclusions(struct lttng_handle * * * Return 0 on success else a negative LTTng error code. */ -LTTNG_EXPORT extern int lttng_disable_event(struct lttng_handle *handle, - const char *name, const char *channel_name); +LTTNG_EXPORT extern int +lttng_disable_event(struct lttng_handle *handle, const char *name, const char *channel_name); /* * Disable event(s) of a channel and domain. @@ -518,8 +525,9 @@ LTTNG_EXPORT extern int lttng_disable_event(struct lttng_handle *handle, * Return 0 on success else a negative LTTng error code. */ LTTNG_EXPORT extern int lttng_disable_event_ext(struct lttng_handle *handle, - struct lttng_event *ev, const char *channel_name, - const char *filter_expression); + struct lttng_event *ev, + const char *channel_name, + const char *filter_expression); #ifdef __cplusplus } diff --git a/include/lttng/handle.h b/include/lttng/handle.h index efc889f1d..14a0e5407 100644 --- a/include/lttng/handle.h +++ b/include/lttng/handle.h @@ -20,7 +20,7 @@ extern "C" { * * The structures should be initialized to zero before use. */ -#define LTTNG_HANDLE_PADDING1 16 +#define LTTNG_HANDLE_PADDING1 16 struct lttng_handle { char session_name[LTTNG_NAME_MAX]; struct lttng_domain domain; @@ -42,7 +42,7 @@ struct lttng_handle { * lttng_destroy_handle. On error, NULL is returned. */ LTTNG_EXPORT extern struct lttng_handle *lttng_create_handle(const char *session_name, - struct lttng_domain *domain); + struct lttng_domain *domain); /* * Destroy an handle that has been previously created with lttng_create_handle. @@ -51,7 +51,6 @@ LTTNG_EXPORT extern struct lttng_handle *lttng_create_handle(const char *session */ LTTNG_EXPORT extern void lttng_destroy_handle(struct lttng_handle *handle); - #ifdef __cplusplus } #endif diff --git a/include/lttng/health-internal.hpp b/include/lttng/health-internal.hpp index b1dc33047..a3bf001ce 100644 --- a/include/lttng/health-internal.hpp +++ b/include/lttng/health-internal.hpp @@ -10,26 +10,28 @@ */ #include +#include + +#include + #include +#include #include #include -#include -#include -#include /* * These are the value added to the current state depending of the position in * the thread where is either waiting on a poll() or running in the code. */ -#define HEALTH_POLL_VALUE (1UL << 0) -#define HEALTH_CODE_VALUE (1UL << 1) +#define HEALTH_POLL_VALUE (1UL << 0) +#define HEALTH_CODE_VALUE (1UL << 1) -#define HEALTH_IS_IN_POLL(x) ((x) & HEALTH_POLL_VALUE) +#define HEALTH_IS_IN_POLL(x) ((x) &HEALTH_POLL_VALUE) struct health_app; enum health_flags { - HEALTH_ERROR = (1U << 0), + HEALTH_ERROR = (1U << 0), }; struct health_state { @@ -43,23 +45,23 @@ struct health_state { /* * current and flags are updated by multiple threads concurrently. */ - unsigned long current; /* progress counter, updated atomically */ - enum health_flags flags; /* other flags, updated atomically */ - int type; /* Indicates the nature of the thread. */ + unsigned long current; /* progress counter, updated atomically */ + enum health_flags flags; /* other flags, updated atomically */ + int type; /* Indicates the nature of the thread. */ /* Node of the global TLS state list. */ struct cds_list_head node; }; enum health_cmd { - HEALTH_CMD_CHECK = 0, + HEALTH_CMD_CHECK = 0, }; struct health_comm_msg { - uint32_t cmd; /* enum health_cmd */ + uint32_t cmd; /* enum health_cmd */ } LTTNG_PACKED; struct health_comm_reply { - uint64_t ret_code; /* bitmask of threads in bad health */ + uint64_t ret_code; /* bitmask of threads in bad health */ } LTTNG_PACKED; /* Declare TLS health state. */ @@ -73,8 +75,7 @@ extern DECLARE_URCU_TLS(struct health_state, health_state); static inline void health_poll_entry() { /* Code MUST be in code execution state which is an even number. */ - LTTNG_ASSERT(!(uatomic_read(&URCU_TLS(health_state).current) - & HEALTH_POLL_VALUE)); + LTTNG_ASSERT(!(uatomic_read(&URCU_TLS(health_state).current) & HEALTH_POLL_VALUE)); uatomic_add(&URCU_TLS(health_state).current, HEALTH_POLL_VALUE); } @@ -87,8 +88,7 @@ static inline void health_poll_entry() static inline void health_poll_exit() { /* Code MUST be in poll execution state which is an odd number. */ - LTTNG_ASSERT(uatomic_read(&URCU_TLS(health_state).current) - & HEALTH_POLL_VALUE); + LTTNG_ASSERT(uatomic_read(&URCU_TLS(health_state).current) & HEALTH_POLL_VALUE); uatomic_add(&URCU_TLS(health_state).current, HEALTH_POLL_VALUE); } diff --git a/include/lttng/health.h b/include/lttng/health.h index 26e885705..4e82c7be1 100644 --- a/include/lttng/health.h +++ b/include/lttng/health.h @@ -40,7 +40,7 @@ LTTNG_EXPORT extern struct lttng_health *lttng_health_create_sessiond(void); * Return a newly allocated health object, or NULL on error. */ LTTNG_EXPORT extern struct lttng_health * - lttng_health_create_consumerd(enum lttng_health_consumerd consumerd); +lttng_health_create_consumerd(enum lttng_health_consumerd consumerd); /** * lttng_health_create_relayd - Create relayd health object @@ -101,8 +101,7 @@ LTTNG_EXPORT extern int lttng_health_get_nr_threads(const struct lttng_health *h * lttng_health_destroy() is called on @health. */ LTTNG_EXPORT extern const struct lttng_health_thread * - lttng_health_get_thread(const struct lttng_health *health, - unsigned int nth_thread); +lttng_health_get_thread(const struct lttng_health *health, unsigned int nth_thread); /** * lttng_health_thread_state - Get thread health state diff --git a/include/lttng/kernel-probe-internal.hpp b/include/lttng/kernel-probe-internal.hpp index ec8740a62..bdafb4d0a 100644 --- a/include/lttng/kernel-probe-internal.hpp +++ b/include/lttng/kernel-probe-internal.hpp @@ -10,9 +10,10 @@ #include #include -#include + #include #include + #include #include #include @@ -80,26 +81,22 @@ struct lttng_kernel_probe_location_address { uint64_t address; }; -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); ssize_t lttng_kernel_probe_location_create_from_payload( - struct lttng_payload_view *view, - struct lttng_kernel_probe_location **probe_location); + struct lttng_payload_view *view, struct lttng_kernel_probe_location **probe_location); -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); -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); -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); -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); #endif /* LTTNG_KERNEL_PROBE_INTERNAL_H */ diff --git a/include/lttng/kernel-probe.h b/include/lttng/kernel-probe.h index cdd617dea..8e894fae8 100644 --- a/include/lttng/kernel-probe.h +++ b/include/lttng/kernel-probe.h @@ -9,6 +9,7 @@ #define LTTNG_KERNEL_PROBE_H #include + #include #ifdef __cplusplus @@ -18,53 +19,50 @@ extern "C" { struct lttng_kernel_probe_location; enum lttng_kernel_probe_location_status { - LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK = 0, + LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK = 0, /* Invalid parameters provided. */ - LTTNG_KERNEL_PROBE_LOCATION_STATUS_INVALID = -1, + LTTNG_KERNEL_PROBE_LOCATION_STATUS_INVALID = -1, }; enum lttng_kernel_probe_location_type { - LTTNG_KERNEL_PROBE_LOCATION_TYPE_UNKNOWN = -1, + LTTNG_KERNEL_PROBE_LOCATION_TYPE_UNKNOWN = -1, /* Location derived from a symbol and an offset. */ - LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET = 0, + LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET = 0, /* Location derived from an address. */ - LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS = 1, + LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS = 1, }; /* * Get the type of the kernel probe location. */ LTTNG_EXPORT extern enum lttng_kernel_probe_location_type -lttng_kernel_probe_location_get_type( - const struct lttng_kernel_probe_location *location); +lttng_kernel_probe_location_get_type(const struct lttng_kernel_probe_location *location); /* * Destroy the kernel probe location. */ -LTTNG_EXPORT extern void lttng_kernel_probe_location_destroy( - struct lttng_kernel_probe_location *location); +LTTNG_EXPORT extern void +lttng_kernel_probe_location_destroy(struct lttng_kernel_probe_location *location); /* * Create a symbol derived probe location. * On failure, NULL is returned. */ LTTNG_EXPORT extern 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); /* * Get the symbol name of a symbol derived probe location. */ -LTTNG_EXPORT extern const char *lttng_kernel_probe_location_symbol_get_name( - const struct lttng_kernel_probe_location *location); +LTTNG_EXPORT extern const char * +lttng_kernel_probe_location_symbol_get_name(const struct lttng_kernel_probe_location *location); /* * Get the offset of a symbol derived location. */ LTTNG_EXPORT extern 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); /* * Create an address derived probe location. @@ -77,9 +75,8 @@ lttng_kernel_probe_location_address_create(uint64_t address); * Get the address of an address derived probe location. */ LTTNG_EXPORT extern 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); #ifdef __cplusplus } diff --git a/include/lttng/load-internal.hpp b/include/lttng/load-internal.hpp index ef09ffd9c..78f38e47e 100644 --- a/include/lttng/load-internal.hpp +++ b/include/lttng/load-internal.hpp @@ -9,12 +9,13 @@ #ifndef LTTNG_LOAD_INTERNAL_ABI_H #define LTTNG_LOAD_INTERNAL_ABI_H -#include -#include +#include +#include #include -#include -#include + +#include +#include /* * Object used by the load_session API. This is opaque to the public library. diff --git a/include/lttng/load.h b/include/lttng/load.h index 0395bb414..5f7b4ec44 100644 --- a/include/lttng/load.h +++ b/include/lttng/load.h @@ -31,21 +31,20 @@ LTTNG_EXPORT extern struct lttng_load_session_attr *lttng_load_session_attr_crea */ LTTNG_EXPORT extern void lttng_load_session_attr_destroy(struct lttng_load_session_attr *attr); - /* * Load session attribute getter family of functions. */ /* Return session name. NULL indicates all sessions must be loaded. */ -LTTNG_EXPORT extern const char *lttng_load_session_attr_get_session_name( - struct lttng_load_session_attr *attr); +LTTNG_EXPORT extern const char * +lttng_load_session_attr_get_session_name(struct lttng_load_session_attr *attr); /* * Return input URL. A NULL value indicates the default session * configuration location. The URL format used is documented in lttng-create(1). * NULL indicates that the default session configuration path is used. */ -LTTNG_EXPORT extern const char *lttng_load_session_attr_get_input_url( - struct lttng_load_session_attr *attr); +LTTNG_EXPORT extern const char * +lttng_load_session_attr_get_input_url(struct lttng_load_session_attr *attr); /* * Return the configuration overwrite attribute. This attribute indicates @@ -53,8 +52,7 @@ LTTNG_EXPORT extern const char *lttng_load_session_attr_get_input_url( * same name already exists. If such a session exists, it is destroyed before * the replacement is loaded. */ -LTTNG_EXPORT extern int lttng_load_session_attr_get_overwrite( - struct lttng_load_session_attr *attr); +LTTNG_EXPORT extern int lttng_load_session_attr_get_overwrite(struct lttng_load_session_attr *attr); /* * Return the destination URL configuration override attribute. This attribute @@ -63,8 +61,8 @@ LTTNG_EXPORT extern int lttng_load_session_attr_get_overwrite( * * NULL indicates no override will be applied on configuration load. */ -LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_url( - struct lttng_load_session_attr *attr); +LTTNG_EXPORT extern const char * +lttng_load_session_attr_get_override_url(struct lttng_load_session_attr *attr); /* * Return the configuration override control URL attribute. This attribute @@ -73,8 +71,8 @@ LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_url( * * NULL indicates no control URL override will be applied on configuration load. */ -LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_ctrl_url( - struct lttng_load_session_attr *attr); +LTTNG_EXPORT extern const char * +lttng_load_session_attr_get_override_ctrl_url(struct lttng_load_session_attr *attr); /* * Return the configuration override data URL attribute. This attribute @@ -83,8 +81,8 @@ LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_ctrl_url( * * NULL indicates no data URL override will be applied on configuration load. */ -LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_data_url( - struct lttng_load_session_attr *attr); +LTTNG_EXPORT extern const char * +lttng_load_session_attr_get_override_data_url(struct lttng_load_session_attr *attr); /* * Return the configuration override session name attribute. @@ -94,8 +92,8 @@ LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_data_url( * NULL indicates no session name override will be applied on configuration * load. */ -LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_session_name( - struct lttng_load_session_attr *attr); +LTTNG_EXPORT extern const char * +lttng_load_session_attr_get_override_session_name(struct lttng_load_session_attr *attr); /* * Load session attribute setter family of functions. @@ -108,8 +106,9 @@ LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_session_nam * Set the name of the session to load. A NULL name means all sessions * found at the input URL will be loaded. */ -LTTNG_EXPORT extern int lttng_load_session_attr_set_session_name( - struct lttng_load_session_attr *attr, const char *session_name); +LTTNG_EXPORT extern int +lttng_load_session_attr_set_session_name(struct lttng_load_session_attr *attr, + const char *session_name); /* * Set the URL of the session configuration to load. A NULL value indicates the @@ -117,16 +116,16 @@ LTTNG_EXPORT extern int lttng_load_session_attr_set_session_name( * * Note that file:// is the only supported URL format. */ -LTTNG_EXPORT extern int lttng_load_session_attr_set_input_url( - struct lttng_load_session_attr *attr, const char *url); +LTTNG_EXPORT extern int lttng_load_session_attr_set_input_url(struct lttng_load_session_attr *attr, + const char *url); /* * Set the overwrite attribute. If set to true, current sessions matching the * loaded sessions will be destroyed and be replaced by the session(s) being * loaded. */ -LTTNG_EXPORT extern int lttng_load_session_attr_set_overwrite( - struct lttng_load_session_attr *attr, int overwrite); +LTTNG_EXPORT extern int lttng_load_session_attr_set_overwrite(struct lttng_load_session_attr *attr, + int overwrite); /* * The following setter are for overriding sessions attributes during the @@ -145,8 +144,8 @@ LTTNG_EXPORT extern int lttng_load_session_attr_set_overwrite( * * See lttng-create(1) for more detail. */ -LTTNG_EXPORT extern int lttng_load_session_attr_set_override_url( - struct lttng_load_session_attr *attr, const char *url); +LTTNG_EXPORT extern int +lttng_load_session_attr_set_override_url(struct lttng_load_session_attr *attr, const char *url); /* * Set the control url override attribute. @@ -158,8 +157,9 @@ LTTNG_EXPORT extern int lttng_load_session_attr_set_override_url( * * See lttng-create(1) for more detail. */ -LTTNG_EXPORT extern int lttng_load_session_attr_set_override_ctrl_url( - struct lttng_load_session_attr *attr, const char *url); +LTTNG_EXPORT extern int +lttng_load_session_attr_set_override_ctrl_url(struct lttng_load_session_attr *attr, + const char *url); /* * Set the data url override attribute. @@ -171,8 +171,9 @@ LTTNG_EXPORT extern int lttng_load_session_attr_set_override_ctrl_url( * * See lttng-create(1) for more detail. */ -LTTNG_EXPORT extern int lttng_load_session_attr_set_override_data_url( - struct lttng_load_session_attr *attr, const char *url); +LTTNG_EXPORT extern int +lttng_load_session_attr_set_override_data_url(struct lttng_load_session_attr *attr, + const char *url); /* * Set the session name override attribute. @@ -180,8 +181,9 @@ LTTNG_EXPORT extern int lttng_load_session_attr_set_override_data_url( * Loading a configuration file defining multiple sessions will fail if a * session name is provided. */ -LTTNG_EXPORT extern int lttng_load_session_attr_set_override_session_name( - struct lttng_load_session_attr *attr, const char *session_name); +LTTNG_EXPORT extern int +lttng_load_session_attr_set_override_session_name(struct lttng_load_session_attr *attr, + const char *session_name); /* * Load session configuration(s). diff --git a/include/lttng/location-internal.hpp b/include/lttng/location-internal.hpp index 4daeed061..669347e2e 100644 --- a/include/lttng/location-internal.hpp +++ b/include/lttng/location-internal.hpp @@ -8,10 +8,12 @@ #ifndef LTTNG_LOCATION_INTERNAL_H #define LTTNG_LOCATION_INTERNAL_H -#include -#include #include +#include #include + +#include + #include #include @@ -73,28 +75,24 @@ struct lttng_trace_archive_location_comm { char payload[]; } LTTNG_PACKED; - -struct lttng_trace_archive_location *lttng_trace_archive_location_local_create( - const char *path); +struct lttng_trace_archive_location *lttng_trace_archive_location_local_create(const char *path); 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); -ssize_t lttng_trace_archive_location_create_from_buffer( - const struct lttng_buffer_view *buffer, - struct lttng_trace_archive_location **location); +ssize_t +lttng_trace_archive_location_create_from_buffer(const struct lttng_buffer_view *buffer, + struct lttng_trace_archive_location **location); -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); -void lttng_trace_archive_location_get( - struct lttng_trace_archive_location *location); +void lttng_trace_archive_location_get(struct lttng_trace_archive_location *location); -void lttng_trace_archive_location_put( - struct lttng_trace_archive_location *location); +void lttng_trace_archive_location_put(struct lttng_trace_archive_location *location); #endif /* LTTNG_LOCATION_INTERNAL_H */ diff --git a/include/lttng/location.h b/include/lttng/location.h index ce686315e..a1ea16f23 100644 --- a/include/lttng/location.h +++ b/include/lttng/location.h @@ -9,6 +9,7 @@ #define LTTNG_LOCATION_H #include + #include #ifdef __cplusplus @@ -40,8 +41,7 @@ struct lttng_trace_archive_location; * Get a trace archive location's type. */ LTTNG_EXPORT extern enum lttng_trace_archive_location_type -lttng_trace_archive_location_get_type( - const struct lttng_trace_archive_location *location); +lttng_trace_archive_location_get_type(const struct lttng_trace_archive_location *location); /* * Get the absolute path of a local trace archive location. @@ -50,8 +50,7 @@ lttng_trace_archive_location_get_type( */ LTTNG_EXPORT extern 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); + const struct lttng_trace_archive_location *location, const char **absolute_path); /* * Get the host address of the relay daemon associated to this trace archive @@ -60,9 +59,8 @@ lttng_trace_archive_location_local_get_absolute_path( * The trace archive location maintains ownership of relay_host. */ LTTNG_EXPORT extern 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); /* * Get the control port of the relay daemon associated to this trace archive @@ -70,8 +68,7 @@ lttng_trace_archive_location_relay_get_host( */ LTTNG_EXPORT extern 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); + const struct lttng_trace_archive_location *location, uint16_t *control_port); /* * Get the data port of the relay daemon associated to this trace archive @@ -79,8 +76,7 @@ lttng_trace_archive_location_relay_get_control_port( */ LTTNG_EXPORT extern 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); + const struct lttng_trace_archive_location *location, uint16_t *data_port); /* * Get the protocol used to communicate with the relay daemon associated to this @@ -88,8 +84,8 @@ lttng_trace_archive_location_relay_get_data_port( */ LTTNG_EXPORT extern 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); + const struct lttng_trace_archive_location *location, + enum lttng_trace_archive_location_relay_protocol_type *protocol); /* * Get path relative to the relay daemon's current output path. @@ -98,8 +94,7 @@ lttng_trace_archive_location_relay_get_protocol_type( */ LTTNG_EXPORT extern 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); + const struct lttng_trace_archive_location *location, const char **relative_path); #ifdef __cplusplus } diff --git a/include/lttng/log-level-rule-internal.hpp b/include/lttng/log-level-rule-internal.hpp index 71447cfe3..6b08e8a5f 100644 --- a/include/lttng/log-level-rule-internal.hpp +++ b/include/lttng/log-level-rule-internal.hpp @@ -8,17 +8,18 @@ #ifndef LTTNG_LOG_LEVEL_RULE_INTERNAL_H #define LTTNG_LOG_LEVEL_RULE_INTERNAL_H -#include - #include #include #include #include #include + #include #include #include +#include + struct mi_writer; /* @@ -36,29 +37,24 @@ struct lttng_log_level_rule_comm { int32_t level; }; -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); int lttng_log_level_rule_serialize(const struct lttng_log_level_rule *rule, - struct lttng_payload *payload); + struct lttng_payload *payload); 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); -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); -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); -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); -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); #endif /* LTTNG_LOG_LEVEL_RULE_INTERNAL_H */ diff --git a/include/lttng/log-level-rule.h b/include/lttng/log-level-rule.h index ddb3501a1..a73b26ae3 100644 --- a/include/lttng/log-level-rule.h +++ b/include/lttng/log-level-rule.h @@ -34,8 +34,8 @@ enum lttng_log_level_rule_status { * `LTTNG_LOG_LEVEL_RULE_TYPE_UNKNOWN`: * `rule` is `NULL`. */ -LTTNG_EXPORT extern enum lttng_log_level_rule_type lttng_log_level_rule_get_type( - const struct lttng_log_level_rule *rule); +LTTNG_EXPORT extern enum lttng_log_level_rule_type +lttng_log_level_rule_get_type(const struct lttng_log_level_rule *rule); /* * Creates a log level rule for which a log level must match exactly `level` to @@ -48,8 +48,7 @@ LTTNG_EXPORT extern enum lttng_log_level_rule_type lttng_log_level_rule_get_type * The returned log level rule must be destroyed using * lttng_log_level_rule_destroy(). */ -LTTNG_EXPORT extern struct lttng_log_level_rule *lttng_log_level_rule_exactly_create( - int level); +LTTNG_EXPORT extern struct lttng_log_level_rule *lttng_log_level_rule_exactly_create(int level); /* * Sets `level` to the level of the "exactly" log level rule `rule`. @@ -64,8 +63,8 @@ LTTNG_EXPORT extern struct lttng_log_level_rule *lttng_log_level_rule_exactly_cr * * `level` is NULL. * * The type of `rule` is not `LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY`. */ -LTTNG_EXPORT extern enum lttng_log_level_rule_status lttng_log_level_rule_exactly_get_level( - const struct lttng_log_level_rule *rule, int *level); +LTTNG_EXPORT extern enum lttng_log_level_rule_status +lttng_log_level_rule_exactly_get_level(const struct lttng_log_level_rule *rule, int *level); /* * Creates a log level rule for which a log level must be at least as severe as @@ -97,14 +96,13 @@ lttng_log_level_rule_at_least_as_severe_as_create(int level); * `LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS`. */ LTTNG_EXPORT extern 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); /* * Destroy the log level rule `log_level_rule` if not `NULL`. */ -LTTNG_EXPORT extern void lttng_log_level_rule_destroy( - struct lttng_log_level_rule *log_level_rule); +LTTNG_EXPORT extern void lttng_log_level_rule_destroy(struct lttng_log_level_rule *log_level_rule); #ifdef __cplusplus } diff --git a/include/lttng/lttng-error.h b/include/lttng/lttng-error.h index 790a78a0b..df23a67bb 100644 --- a/include/lttng/lttng-error.h +++ b/include/lttng/lttng-error.h @@ -22,174 +22,198 @@ extern "C" { #endif enum lttng_error_code { - LTTNG_OK = 10, /* Ok */ - LTTNG_ERR_UNK = 11, /* Unknown Error */ - LTTNG_ERR_UND = 12, /* Undefined command */ - LTTNG_ERR_SESSION_STARTED = 13, /* Session is running */ - LTTNG_ERR_UNKNOWN_DOMAIN = 14, /* Tracing domain not known */ - LTTNG_ERR_NOT_SUPPORTED = 15, /* Operation not supported */ - LTTNG_ERR_NO_SESSION = 16, /* No session found */ - LTTNG_ERR_CREATE_DIR_FAIL = 17, /* Create directory fail */ - LTTNG_ERR_SESSION_FAIL = 18, /* Create session fail */ - LTTNG_ERR_NO_SESSIOND = 19, /* No session daemon available */ - LTTNG_ERR_SET_URL = 20, /* Error setting URL */ - LTTNG_ERR_URL_EXIST = 21, /* URL already exists. */ - LTTNG_ERR_BUFFER_NOT_SUPPORTED = 22, /* Buffer type not supported. */ - LTTNG_ERR_SESS_NOT_FOUND = 23, /* Session by name not found */ - LTTNG_ERR_BUFFER_TYPE_MISMATCH = 24, /* Buffer type mismatched. */ - LTTNG_ERR_FATAL = 25, /* Fatal error */ - LTTNG_ERR_NOMEM = 26, /* Not enough memory. */ - LTTNG_ERR_SELECT_SESS = 27, /* Must select a session */ - LTTNG_ERR_EXIST_SESS = 28, /* Session name already exist */ - LTTNG_ERR_NO_EVENT = 29, /* No event found */ - LTTNG_ERR_CONNECT_FAIL = 30, /* Unable to connect to unix socket */ - LTTNG_ERR_SNAPSHOT_OUTPUT_EXIST = 31, /* Snapshot output already exists */ - LTTNG_ERR_EPERM = 32, /* Permission denied */ - LTTNG_ERR_KERN_NA = 33, /* Kernel tracer unavailable */ - LTTNG_ERR_KERN_VERSION = 34, /* Kernel tracer not compatible */ - LTTNG_ERR_KERN_EVENT_EXIST = 35, /* Kernel event already exists */ - LTTNG_ERR_KERN_SESS_FAIL = 36, /* Kernel create session failed */ - LTTNG_ERR_KERN_CHAN_EXIST = 37, /* Kernel channel already exists */ - LTTNG_ERR_KERN_CHAN_FAIL = 38, /* Kernel create channel failed */ - LTTNG_ERR_KERN_CHAN_NOT_FOUND = 39, /* Kernel channel not found */ - LTTNG_ERR_KERN_CHAN_DISABLE_FAIL = 40, /* Kernel disable channel failed */ - LTTNG_ERR_KERN_CHAN_ENABLE_FAIL = 41, /* Kernel enable channel failed */ - LTTNG_ERR_KERN_CONTEXT_FAIL = 42, /* Kernel add context failed */ - LTTNG_ERR_KERN_ENABLE_FAIL = 43, /* Kernel enable event failed */ - LTTNG_ERR_KERN_DISABLE_FAIL = 44, /* Kernel disable event failed */ - LTTNG_ERR_KERN_META_FAIL = 45, /* Kernel open metadata failed */ - LTTNG_ERR_KERN_START_FAIL = 46, /* Kernel start trace failed */ - LTTNG_ERR_KERN_STOP_FAIL = 47, /* Kernel stop trace failed */ - LTTNG_ERR_KERN_CONSUMER_FAIL = 48, /* Kernel consumer start failed */ - LTTNG_ERR_KERN_STREAM_FAIL = 49, /* Kernel create stream failed */ - LTTNG_ERR_START_SESSION_ONCE = 50, /* Session needs to be started once. */ - LTTNG_ERR_SNAPSHOT_FAIL = 51, /* Snapshot record failed. */ - LTTNG_ERR_NO_STREAM = 52, /* Index without stream on relay. */ - LTTNG_ERR_KERN_LIST_FAIL = 53, /* Kernel listing events failed */ - LTTNG_ERR_UST_CALIBRATE_FAIL = 54, /* UST calibration failed */ - LTTNG_ERR_UST_EVENT_ENABLED = 55, /* UST event already enabled. */ - LTTNG_ERR_UST_SESS_FAIL = 56, /* UST create session failed */ - LTTNG_ERR_UST_CHAN_EXIST = 57, /* UST channel already exist */ - LTTNG_ERR_UST_CHAN_FAIL = 58, /* UST create channel failed */ - LTTNG_ERR_UST_CHAN_NOT_FOUND = 59, /* UST channel not found */ - LTTNG_ERR_UST_CHAN_DISABLE_FAIL = 60, /* UST disable channel failed */ - LTTNG_ERR_UST_CHAN_ENABLE_FAIL = 61, /* UST enable channel failed */ - LTTNG_ERR_CHAN_EXIST = 62, /* Channel already exists. */ - LTTNG_ERR_UST_ENABLE_FAIL = 63, /* UST enable event failed */ - LTTNG_ERR_UST_DISABLE_FAIL = 64, /* UST disable event failed */ - LTTNG_ERR_UST_META_FAIL = 65, /* UST open metadata failed */ - LTTNG_ERR_UST_START_FAIL = 66, /* UST start trace failed */ - LTTNG_ERR_UST_STOP_FAIL = 67, /* UST stop trace failed */ - LTTNG_ERR_UST_CONSUMER64_FAIL = 68, /* 64-bit UST consumer start failed */ - LTTNG_ERR_UST_CONSUMER32_FAIL = 69, /* 32-bit UST consumer start failed */ - LTTNG_ERR_UST_STREAM_FAIL = 70, /* UST create stream failed */ - LTTNG_ERR_SNAPSHOT_NODATA = 71, /* No data in snapshot. */ - LTTNG_ERR_NO_CHANNEL = 72, /* No channel found in the session. */ - LTTNG_ERR_SESSION_INVALID_CHAR = 73, /* Invalid characters found in session name. */ - LTTNG_ERR_UST_LIST_FAIL = 74, /* UST listing events failed */ - LTTNG_ERR_UST_EVENT_EXIST = 75, /* UST event exist */ - LTTNG_ERR_UST_EVENT_NOT_FOUND = 76, /* UST event not found */ - LTTNG_ERR_UST_CONTEXT_EXIST = 77, /* UST context exist */ - LTTNG_ERR_UST_CONTEXT_INVAL = 78, /* UST context invalid */ - LTTNG_ERR_NEED_ROOT_SESSIOND = 79, /* root sessiond is needed */ - LTTNG_ERR_TRACE_ALREADY_STARTED = 80, /* Tracing already started */ - LTTNG_ERR_TRACE_ALREADY_STOPPED = 81, /* Tracing already stopped */ - LTTNG_ERR_KERN_EVENT_ENOSYS = 82, /* Kernel event type not supported */ - LTTNG_ERR_NEED_CHANNEL_NAME = 83, /* Non-default channel exists within session: channel name needs to be specified with '-c name' */ - LTTNG_ERR_NO_UST = 84, /* LTTng-UST tracer is not supported. Please rebuild lttng-tools with lttng-ust support enabled. */ - LTTNG_ERR_SAVE_FILE_EXIST = 85, /* Session file already exists. */ - LTTNG_ERR_SAVE_IO_FAIL = 86, /* IO error while writing session configuration */ - LTTNG_ERR_LOAD_INVALID_CONFIG = 87, /* Invalid session configuration */ - LTTNG_ERR_LOAD_IO_FAIL = 88, /* IO error while reading a session configuration */ - LTTNG_ERR_LOAD_SESSION_NOENT = 89, /* Session file not found */ - LTTNG_ERR_MAX_SIZE_INVALID = 90, /* Snapshot max size is invalid. */ - LTTNG_ERR_MI_OUTPUT_TYPE = 91, /* Invalid MI output format */ - LTTNG_ERR_MI_IO_FAIL = 92, /* IO error while writing machine interface output */ - LTTNG_ERR_MI_NOT_IMPLEMENTED = 93, /* Mi feature not implemented */ + LTTNG_OK = 10, /* Ok */ + LTTNG_ERR_UNK = 11, /* Unknown Error */ + LTTNG_ERR_UND = 12, /* Undefined command */ + LTTNG_ERR_SESSION_STARTED = 13, /* Session is running */ + LTTNG_ERR_UNKNOWN_DOMAIN = 14, /* Tracing domain not known */ + LTTNG_ERR_NOT_SUPPORTED = 15, /* Operation not supported */ + LTTNG_ERR_NO_SESSION = 16, /* No session found */ + LTTNG_ERR_CREATE_DIR_FAIL = 17, /* Create directory fail */ + LTTNG_ERR_SESSION_FAIL = 18, /* Create session fail */ + LTTNG_ERR_NO_SESSIOND = 19, /* No session daemon available */ + LTTNG_ERR_SET_URL = 20, /* Error setting URL */ + LTTNG_ERR_URL_EXIST = 21, /* URL already exists. */ + LTTNG_ERR_BUFFER_NOT_SUPPORTED = 22, /* Buffer type not supported. */ + LTTNG_ERR_SESS_NOT_FOUND = 23, /* Session by name not found */ + LTTNG_ERR_BUFFER_TYPE_MISMATCH = 24, /* Buffer type mismatched. */ + LTTNG_ERR_FATAL = 25, /* Fatal error */ + LTTNG_ERR_NOMEM = 26, /* Not enough memory. */ + LTTNG_ERR_SELECT_SESS = 27, /* Must select a session */ + LTTNG_ERR_EXIST_SESS = 28, /* Session name already exist */ + LTTNG_ERR_NO_EVENT = 29, /* No event found */ + LTTNG_ERR_CONNECT_FAIL = 30, /* Unable to connect to unix socket */ + LTTNG_ERR_SNAPSHOT_OUTPUT_EXIST = 31, /* Snapshot output already exists */ + LTTNG_ERR_EPERM = 32, /* Permission denied */ + LTTNG_ERR_KERN_NA = 33, /* Kernel tracer unavailable */ + LTTNG_ERR_KERN_VERSION = 34, /* Kernel tracer not compatible */ + LTTNG_ERR_KERN_EVENT_EXIST = 35, /* Kernel event already exists */ + LTTNG_ERR_KERN_SESS_FAIL = 36, /* Kernel create session failed */ + LTTNG_ERR_KERN_CHAN_EXIST = 37, /* Kernel channel already exists */ + LTTNG_ERR_KERN_CHAN_FAIL = 38, /* Kernel create channel failed */ + LTTNG_ERR_KERN_CHAN_NOT_FOUND = 39, /* Kernel channel not found */ + LTTNG_ERR_KERN_CHAN_DISABLE_FAIL = 40, /* Kernel disable channel failed */ + LTTNG_ERR_KERN_CHAN_ENABLE_FAIL = 41, /* Kernel enable channel failed */ + LTTNG_ERR_KERN_CONTEXT_FAIL = 42, /* Kernel add context failed */ + LTTNG_ERR_KERN_ENABLE_FAIL = 43, /* Kernel enable event failed */ + LTTNG_ERR_KERN_DISABLE_FAIL = 44, /* Kernel disable event failed */ + LTTNG_ERR_KERN_META_FAIL = 45, /* Kernel open metadata failed */ + LTTNG_ERR_KERN_START_FAIL = 46, /* Kernel start trace failed */ + LTTNG_ERR_KERN_STOP_FAIL = 47, /* Kernel stop trace failed */ + LTTNG_ERR_KERN_CONSUMER_FAIL = 48, /* Kernel consumer start failed */ + LTTNG_ERR_KERN_STREAM_FAIL = 49, /* Kernel create stream failed */ + LTTNG_ERR_START_SESSION_ONCE = 50, /* Session needs to be started once. */ + LTTNG_ERR_SNAPSHOT_FAIL = 51, /* Snapshot record failed. */ + LTTNG_ERR_NO_STREAM = 52, /* Index without stream on relay. */ + LTTNG_ERR_KERN_LIST_FAIL = 53, /* Kernel listing events failed */ + LTTNG_ERR_UST_CALIBRATE_FAIL = 54, /* UST calibration failed */ + LTTNG_ERR_UST_EVENT_ENABLED = 55, /* UST event already enabled. */ + LTTNG_ERR_UST_SESS_FAIL = 56, /* UST create session failed */ + LTTNG_ERR_UST_CHAN_EXIST = 57, /* UST channel already exist */ + LTTNG_ERR_UST_CHAN_FAIL = 58, /* UST create channel failed */ + LTTNG_ERR_UST_CHAN_NOT_FOUND = 59, /* UST channel not found */ + LTTNG_ERR_UST_CHAN_DISABLE_FAIL = 60, /* UST disable channel failed */ + LTTNG_ERR_UST_CHAN_ENABLE_FAIL = 61, /* UST enable channel failed */ + LTTNG_ERR_CHAN_EXIST = 62, /* Channel already exists. */ + LTTNG_ERR_UST_ENABLE_FAIL = 63, /* UST enable event failed */ + LTTNG_ERR_UST_DISABLE_FAIL = 64, /* UST disable event failed */ + LTTNG_ERR_UST_META_FAIL = 65, /* UST open metadata failed */ + LTTNG_ERR_UST_START_FAIL = 66, /* UST start trace failed */ + LTTNG_ERR_UST_STOP_FAIL = 67, /* UST stop trace failed */ + LTTNG_ERR_UST_CONSUMER64_FAIL = 68, /* 64-bit UST consumer start failed */ + LTTNG_ERR_UST_CONSUMER32_FAIL = 69, /* 32-bit UST consumer start failed */ + LTTNG_ERR_UST_STREAM_FAIL = 70, /* UST create stream failed */ + LTTNG_ERR_SNAPSHOT_NODATA = 71, /* No data in snapshot. */ + LTTNG_ERR_NO_CHANNEL = 72, /* No channel found in the session. */ + LTTNG_ERR_SESSION_INVALID_CHAR = 73, /* Invalid characters found in session name. */ + LTTNG_ERR_UST_LIST_FAIL = 74, /* UST listing events failed */ + LTTNG_ERR_UST_EVENT_EXIST = 75, /* UST event exist */ + LTTNG_ERR_UST_EVENT_NOT_FOUND = 76, /* UST event not found */ + LTTNG_ERR_UST_CONTEXT_EXIST = 77, /* UST context exist */ + LTTNG_ERR_UST_CONTEXT_INVAL = 78, /* UST context invalid */ + LTTNG_ERR_NEED_ROOT_SESSIOND = 79, /* root sessiond is needed */ + LTTNG_ERR_TRACE_ALREADY_STARTED = 80, /* Tracing already started */ + LTTNG_ERR_TRACE_ALREADY_STOPPED = 81, /* Tracing already stopped */ + LTTNG_ERR_KERN_EVENT_ENOSYS = 82, /* Kernel event type not supported */ + LTTNG_ERR_NEED_CHANNEL_NAME = 83, /* Non-default channel exists within session: channel name + needs to be specified with '-c name' */ + LTTNG_ERR_NO_UST = 84, /* LTTng-UST tracer is not supported. Please rebuild lttng-tools with + lttng-ust support enabled. */ + LTTNG_ERR_SAVE_FILE_EXIST = 85, /* Session file already exists. */ + LTTNG_ERR_SAVE_IO_FAIL = 86, /* IO error while writing session configuration */ + LTTNG_ERR_LOAD_INVALID_CONFIG = 87, /* Invalid session configuration */ + LTTNG_ERR_LOAD_IO_FAIL = 88, /* IO error while reading a session configuration */ + LTTNG_ERR_LOAD_SESSION_NOENT = 89, /* Session file not found */ + LTTNG_ERR_MAX_SIZE_INVALID = 90, /* Snapshot max size is invalid. */ + LTTNG_ERR_MI_OUTPUT_TYPE = 91, /* Invalid MI output format */ + LTTNG_ERR_MI_IO_FAIL = 92, /* IO error while writing machine interface output */ + LTTNG_ERR_MI_NOT_IMPLEMENTED = 93, /* Mi feature not implemented */ /* 94 */ /* 95 */ /* 96 */ - LTTNG_ERR_INVALID = 97, /* Invalid parameter */ - LTTNG_ERR_NO_USTCONSUMERD = 98, /* No UST consumer detected */ - LTTNG_ERR_NO_KERNCONSUMERD = 99, /* No Kernel consumer detected */ - LTTNG_ERR_EVENT_EXIST_LOGLEVEL = 100, /* Event enabled with different loglevel */ - LTTNG_ERR_URL_DATA_MISS = 101, /* Missing network data URL */ - LTTNG_ERR_URL_CTRL_MISS = 102, /* Missing network control URL */ - LTTNG_ERR_ENABLE_CONSUMER_FAIL = 103, /* Enabling consumer failed */ - LTTNG_ERR_RELAYD_CONNECT_FAIL = 104, /* lttng-relayd create session failed */ - LTTNG_ERR_RELAYD_VERSION_FAIL = 105, /* lttng-relayd not compatible */ - LTTNG_ERR_FILTER_INVAL = 106, /* Invalid filter bytecode */ - LTTNG_ERR_FILTER_NOMEM = 107, /* Lack of memory for filter bytecode */ - LTTNG_ERR_FILTER_EXIST = 108, /* Filter already exist */ - LTTNG_ERR_NO_CONSUMER = 109, /* No consumer exist for the session */ - LTTNG_ERR_EXCLUSION_INVAL = 110, /* Invalid event exclusion data */ - LTTNG_ERR_EXCLUSION_NOMEM = 111, /* Lack of memory while processing event exclusions */ - LTTNG_ERR_INVALID_EVENT_NAME = 112, /* Invalid event name */ - LTTNG_ERR_INVALID_CHANNEL_NAME = 113, /* Invalid channel name */ - LTTNG_ERR_PROCESS_ATTR_EXISTS = 114, /* Process attribute is already tracked */ + LTTNG_ERR_INVALID = 97, /* Invalid parameter */ + LTTNG_ERR_NO_USTCONSUMERD = 98, /* No UST consumer detected */ + LTTNG_ERR_NO_KERNCONSUMERD = 99, /* No Kernel consumer detected */ + LTTNG_ERR_EVENT_EXIST_LOGLEVEL = 100, /* Event enabled with different loglevel */ + LTTNG_ERR_URL_DATA_MISS = 101, /* Missing network data URL */ + LTTNG_ERR_URL_CTRL_MISS = 102, /* Missing network control URL */ + LTTNG_ERR_ENABLE_CONSUMER_FAIL = 103, /* Enabling consumer failed */ + LTTNG_ERR_RELAYD_CONNECT_FAIL = 104, /* lttng-relayd create session failed */ + LTTNG_ERR_RELAYD_VERSION_FAIL = 105, /* lttng-relayd not compatible */ + LTTNG_ERR_FILTER_INVAL = 106, /* Invalid filter bytecode */ + LTTNG_ERR_FILTER_NOMEM = 107, /* Lack of memory for filter bytecode */ + LTTNG_ERR_FILTER_EXIST = 108, /* Filter already exist */ + LTTNG_ERR_NO_CONSUMER = 109, /* No consumer exist for the session */ + LTTNG_ERR_EXCLUSION_INVAL = 110, /* Invalid event exclusion data */ + LTTNG_ERR_EXCLUSION_NOMEM = 111, /* Lack of memory while processing event exclusions */ + LTTNG_ERR_INVALID_EVENT_NAME = 112, /* Invalid event name */ + LTTNG_ERR_INVALID_CHANNEL_NAME = 113, /* Invalid channel name */ + LTTNG_ERR_PROCESS_ATTR_EXISTS = 114, /* Process attribute is already tracked */ LTTNG_ERR_PROCESS_ATTR_MISSING = 115, /* Process attribute was not tracked */ LTTNG_ERR_INVALID_CHANNEL_DOMAIN = 116, /* Invalid channel domain */ - LTTNG_ERR_OVERFLOW = 117, /* Overflow occurred. */ - LTTNG_ERR_SESSION_NOT_STARTED = 118, /* Session not started */ - LTTNG_ERR_LIVE_SESSION = 119, /* Live session unsupported */ - LTTNG_ERR_PER_PID_SESSION = 120, /* Per-PID sessions unsupported */ + LTTNG_ERR_OVERFLOW = 117, /* Overflow occurred. */ + LTTNG_ERR_SESSION_NOT_STARTED = 118, /* Session not started */ + LTTNG_ERR_LIVE_SESSION = 119, /* Live session unsupported */ + LTTNG_ERR_PER_PID_SESSION = 120, /* Per-PID sessions unsupported */ LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE = 121, /* Context unavailable on this kernel */ - LTTNG_ERR_REGEN_STATEDUMP_FAIL = 122, /* Failed to regenerate the state dump */ - LTTNG_ERR_REGEN_STATEDUMP_NOMEM = 123, /* Failed to regenerate the state dump, not enough memory */ - LTTNG_ERR_NOT_SNAPSHOT_SESSION = 124, /* Session is not in snapshot mode. */ - LTTNG_ERR_INVALID_TRIGGER = 125, /* Invalid trigger provided. */ - LTTNG_ERR_TRIGGER_EXISTS = 126, /* Trigger already registered. */ - LTTNG_ERR_TRIGGER_NOT_FOUND = 127, /* Trigger not found. */ - LTTNG_ERR_COMMAND_CANCELLED = 128, /* Command cancelled. */ - LTTNG_ERR_ROTATION_PENDING = 129, /* Rotation already pending for this session. */ - LTTNG_ERR_ROTATION_NOT_AVAILABLE = 130, /* Rotate feature not available for this type of session (e.g: live) */ - LTTNG_ERR_ROTATION_SCHEDULE_SET = 131, /* Schedule type already set for this session. */ - LTTNG_ERR_ROTATION_SCHEDULE_NOT_SET = 132, /* No schedule of this type set for this session. */ + LTTNG_ERR_REGEN_STATEDUMP_FAIL = 122, /* Failed to regenerate the state dump */ + LTTNG_ERR_REGEN_STATEDUMP_NOMEM = 123, /* Failed to regenerate the state dump, not enough + memory */ + LTTNG_ERR_NOT_SNAPSHOT_SESSION = 124, /* Session is not in snapshot mode. */ + LTTNG_ERR_INVALID_TRIGGER = 125, /* Invalid trigger provided. */ + LTTNG_ERR_TRIGGER_EXISTS = 126, /* Trigger already registered. */ + LTTNG_ERR_TRIGGER_NOT_FOUND = 127, /* Trigger not found. */ + LTTNG_ERR_COMMAND_CANCELLED = 128, /* Command cancelled. */ + LTTNG_ERR_ROTATION_PENDING = 129, /* Rotation already pending for this session. */ + LTTNG_ERR_ROTATION_NOT_AVAILABLE = 130, /* Rotate feature not available for this type of + session (e.g: live) */ + LTTNG_ERR_ROTATION_SCHEDULE_SET = 131, /* Schedule type already set for this session. */ + LTTNG_ERR_ROTATION_SCHEDULE_NOT_SET = 132, /* No schedule of this type set for this session. + */ LTTNG_ERR_ROTATION_MULTIPLE_AFTER_STOP = 133, /* Already rotated once after a stop. */ - LTTNG_ERR_ROTATION_WRONG_VERSION = 134, /* Session rotation not supported by this kernel tracer version */ - LTTNG_ERR_NO_SESSION_OUTPUT = 135, /* Session has no output configured. */ - LTTNG_ERR_ROTATION_NOT_AVAILABLE_RELAY = 136, /* Rotate feature not available on the relay. */ + LTTNG_ERR_ROTATION_WRONG_VERSION = 134, /* Session rotation not supported by this kernel + tracer version */ + LTTNG_ERR_NO_SESSION_OUTPUT = 135, /* Session has no output configured. */ + LTTNG_ERR_ROTATION_NOT_AVAILABLE_RELAY = 136, /* Rotate feature not available on the relay. + */ LTTNG_ERR_AGENT_TRACING_DISABLED = 137, /* Agent tracing disabled. */ - LTTNG_ERR_PROBE_LOCATION_INVAL = 138, /* Invalid userspace probe location. */ - LTTNG_ERR_ELF_PARSING = 139, /* ELF parsing error. */ - LTTNG_ERR_SDT_PROBE_SEMAPHORE = 140, /* SDT probe guarded by a semaphore. */ + LTTNG_ERR_PROBE_LOCATION_INVAL = 138, /* Invalid userspace probe location. */ + LTTNG_ERR_ELF_PARSING = 139, /* ELF parsing error. */ + LTTNG_ERR_SDT_PROBE_SEMAPHORE = 140, /* SDT probe guarded by a semaphore. */ LTTNG_ERR_ROTATION_FAIL_CONSUMER = 141, /* Rotation failure on consumer */ LTTNG_ERR_ROTATE_RENAME_FAIL_CONSUMER = 142, /* Rotation rename failure on consumer */ - LTTNG_ERR_ROTATION_PENDING_LOCAL_FAIL_CONSUMER = 143, /* Rotation pending check (local) failure on consumer */ - LTTNG_ERR_ROTATION_PENDING_RELAY_FAIL_CONSUMER = 144, /* Rotation pending check (relay) failure on consumer */ - LTTNG_ERR_MKDIR_FAIL_CONSUMER = 145, /* mkdir failure on consumer */ - LTTNG_ERR_CHAN_NOT_FOUND = 146, /* Channel not found */ - LTTNG_ERR_SNAPSHOT_UNSUPPORTED = 147, /* Session configuration does not allow the use of snapshots */ - LTTNG_ERR_SESSION_NOT_EXIST = 148, /* The session does not exist on the session daemon */ - LTTNG_ERR_CREATE_TRACE_CHUNK_FAIL_CONSUMER = 149, /* trace chunk creation failure on consumer */ - LTTNG_ERR_CLOSE_TRACE_CHUNK_FAIL_CONSUMER = 150, /* trace chunk close failure on consumer */ - LTTNG_ERR_TRACE_CHUNK_EXISTS_FAIL_CONSUMER = 151, /* failed to query consumer for trace chunk existence */ - LTTNG_ERR_INVALID_PROTOCOL = 152, /* a protocol error occurred */ - LTTNG_ERR_FILE_CREATION_ERROR = 153, /* failed to create a file */ - LTTNG_ERR_TIMER_STOP_ERROR = 154, /* failed to stop timer. */ - LTTNG_ERR_ROTATION_NOT_AVAILABLE_KERNEL = 155, /* Rotation feature not supported by the kernel tracer. */ - LTTNG_ERR_CLEAR_RELAY_DISALLOWED = 156, /* LTTng-relayd peer does not allow lttng clear command. */ - LTTNG_ERR_CLEAR_NOT_AVAILABLE_RELAY = 157, /* Clearing a session is not supported by the relay daemon. */ - LTTNG_ERR_CLEAR_FAIL_CONSUMER = 158, /* Clear failure on consumer */ - LTTNG_ERR_ROTATION_AFTER_STOP_CLEAR = 159, /* Session was already cleared since it became inactive. */ - LTTNG_ERR_USER_NOT_FOUND = 160, /* User not found. */ - LTTNG_ERR_GROUP_NOT_FOUND = 161, /* Group not found. */ - LTTNG_ERR_UNSUPPORTED_DOMAIN = 162, /* Unsupported domain used. */ - LTTNG_ERR_PROCESS_ATTR_TRACKER_INVALID_TRACKING_POLICY = 163, /* Operation does not apply to the process attribute tracker's tracking policy */ - LTTNG_ERR_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD = 164, /* Error initializing event notifier group notification file descriptor */ + LTTNG_ERR_ROTATION_PENDING_LOCAL_FAIL_CONSUMER = 143, /* Rotation pending check (local) + failure on consumer */ + LTTNG_ERR_ROTATION_PENDING_RELAY_FAIL_CONSUMER = 144, /* Rotation pending check (relay) + failure on consumer */ + LTTNG_ERR_MKDIR_FAIL_CONSUMER = 145, /* mkdir failure on consumer */ + LTTNG_ERR_CHAN_NOT_FOUND = 146, /* Channel not found */ + LTTNG_ERR_SNAPSHOT_UNSUPPORTED = 147, /* Session configuration does not allow the use of + snapshots */ + LTTNG_ERR_SESSION_NOT_EXIST = 148, /* The session does not exist on the session daemon */ + LTTNG_ERR_CREATE_TRACE_CHUNK_FAIL_CONSUMER = 149, /* trace chunk creation failure on + consumer */ + LTTNG_ERR_CLOSE_TRACE_CHUNK_FAIL_CONSUMER = 150, /* trace chunk close failure on consumer */ + LTTNG_ERR_TRACE_CHUNK_EXISTS_FAIL_CONSUMER = 151, /* failed to query consumer for trace + chunk existence */ + LTTNG_ERR_INVALID_PROTOCOL = 152, /* a protocol error occurred */ + LTTNG_ERR_FILE_CREATION_ERROR = 153, /* failed to create a file */ + LTTNG_ERR_TIMER_STOP_ERROR = 154, /* failed to stop timer. */ + LTTNG_ERR_ROTATION_NOT_AVAILABLE_KERNEL = 155, /* Rotation feature not supported by the + kernel tracer. */ + LTTNG_ERR_CLEAR_RELAY_DISALLOWED = 156, /* LTTng-relayd peer does not allow lttng clear + command. */ + LTTNG_ERR_CLEAR_NOT_AVAILABLE_RELAY = 157, /* Clearing a session is not supported by the + relay daemon. */ + LTTNG_ERR_CLEAR_FAIL_CONSUMER = 158, /* Clear failure on consumer */ + LTTNG_ERR_ROTATION_AFTER_STOP_CLEAR = 159, /* Session was already cleared since it became + inactive. */ + LTTNG_ERR_USER_NOT_FOUND = 160, /* User not found. */ + LTTNG_ERR_GROUP_NOT_FOUND = 161, /* Group not found. */ + LTTNG_ERR_UNSUPPORTED_DOMAIN = 162, /* Unsupported domain used. */ + LTTNG_ERR_PROCESS_ATTR_TRACKER_INVALID_TRACKING_POLICY = 163, /* Operation does not apply to + the process attribute + tracker's tracking policy + */ + LTTNG_ERR_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD = 164, /* Error initializing event notifier + group notification file descriptor + */ LTTNG_ERR_INVALID_CAPTURE_EXPRESSION = 165, /* Invalid capture expression. */ - LTTNG_ERR_EVENT_NOTIFIER_REGISTRATION = 166, /* Error registering event notifier to the tracer. */ - LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING = 167, /* Error initializing event notifier error accounting. */ - LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING_FULL = 168, /* Error event notifier error accounting full. */ + LTTNG_ERR_EVENT_NOTIFIER_REGISTRATION = 166, /* Error registering event notifier to the + tracer. */ + LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING = 167, /* Error initializing event notifier error + accounting. */ + LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING_FULL = 168, /* Error event notifier error + accounting full. */ LTTNG_ERR_INVALID_ERROR_QUERY_TARGET = 169, /* Invalid error query target. */ - LTTNG_ERR_BUFFER_FLUSH_FAILED = 170, /* Buffer flush failed */ + LTTNG_ERR_BUFFER_FLUSH_FAILED = 170, /* Buffer flush failed */ /* MUST be last element of the manually-assigned section of the enum */ LTTNG_ERR_NR, /* Backward-compatibility assignments */ - LTTNG_ERR_PID_TRACKED = LTTNG_ERR_PROCESS_ATTR_EXISTS, /* Backward compat alias */ - LTTNG_ERR_PID_NOT_TRACKED = LTTNG_ERR_PROCESS_ATTR_MISSING, /* Backward compat alias */ + LTTNG_ERR_PID_TRACKED = LTTNG_ERR_PROCESS_ATTR_EXISTS, /* Backward compat alias */ + LTTNG_ERR_PID_NOT_TRACKED = LTTNG_ERR_PROCESS_ATTR_MISSING, /* Backward compat alias */ }; /* diff --git a/include/lttng/lttng-export.h b/include/lttng/lttng-export.h index ae3990a29..51eca4ee7 100644 --- a/include/lttng/lttng-export.h +++ b/include/lttng/lttng-export.h @@ -7,8 +7,8 @@ #ifndef LTTNG_EXPORT_H #define LTTNG_EXPORT_H #if defined(_WIN32) || defined(__CYGWIN__) -# define LTTNG_EXPORT +#define LTTNG_EXPORT #else -# define LTTNG_EXPORT __attribute__((visibility("default"))) +#define LTTNG_EXPORT __attribute__((visibility("default"))) #endif #endif diff --git a/include/lttng/lttng.h b/include/lttng/lttng.h index dbfe9a7db..929ce014e 100644 --- a/include/lttng/lttng.h +++ b/include/lttng/lttng.h @@ -42,13 +42,13 @@ #include #include #include -#include #include #include #include -#include #include #include +#include +#include #include #include #include @@ -75,15 +75,15 @@ extern "C" { #endif enum lttng_calibrate_type { - LTTNG_CALIBRATE_FUNCTION = 0, + LTTNG_CALIBRATE_FUNCTION = 0, }; /* Machine interface output type */ enum lttng_mi_output_type { - LTTNG_MI_XML = 1 /* XML output */ + LTTNG_MI_XML = 1 /* XML output */ }; -#define LTTNG_CALIBRATE_PADDING1 16 +#define LTTNG_CALIBRATE_PADDING1 16 struct lttng_calibrate { enum lttng_calibrate_type type; @@ -116,7 +116,7 @@ LTTNG_EXPORT extern int lttng_set_tracing_group(const char *name); * Return 0 on success else a negative LTTng error code. */ LTTNG_EXPORT extern int lttng_register_consumer(struct lttng_handle *handle, - const char *socket_path); + const char *socket_path); /* * Start tracing for *all* domain(s) in the session. @@ -152,7 +152,7 @@ LTTNG_EXPORT extern int lttng_stop_tracing_no_wait(const char *session_name); #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" LTTNG_EXPORT extern int lttng_calibrate(struct lttng_handle *handle, - struct lttng_calibrate *calibrate); + struct lttng_calibrate *calibrate); #pragma GCC diagnostic pop /* @@ -179,8 +179,8 @@ LTTNG_EXPORT extern int lttng_calibrate(struct lttng_handle *handle, * * Return 0 on success else a negative LTTng error code. */ -LTTNG_EXPORT extern int lttng_set_consumer_url(struct lttng_handle *handle, - const char *control_url, const char *data_url); +LTTNG_EXPORT extern int +lttng_set_consumer_url(struct lttng_handle *handle, const char *control_url, const char *data_url); /* * For a given session name, this call checks if the data is ready to be read diff --git a/include/lttng/notification/channel-internal.hpp b/include/lttng/notification/channel-internal.hpp index 44fd9cf16..34014f16f 100644 --- a/include/lttng/notification/channel-internal.hpp +++ b/include/lttng/notification/channel-internal.hpp @@ -87,7 +87,8 @@ struct pending_notification { struct lttng_notification_channel { using uptr = std::unique_ptr< lttng_notification_channel, - lttng::details::create_unique_class::deleter>; + lttng::details::create_unique_class::deleter>; pthread_mutex_t lock; int socket; diff --git a/include/lttng/notification/channel.h b/include/lttng/notification/channel.h index 030c88cbd..dad62b0b3 100644 --- a/include/lttng/notification/channel.h +++ b/include/lttng/notification/channel.h @@ -9,6 +9,7 @@ #define LTTNG_NOTIFICATION_CHANNEL_H #include + #include #ifdef __cplusplus @@ -58,8 +59,8 @@ enum lttng_notification_channel_status { * The returned lttng_notification_channel must be destroyed using * the lttng_notification_channel_destroy() function. */ -LTTNG_EXPORT extern struct lttng_notification_channel *lttng_notification_channel_create( - struct lttng_endpoint *endpoint); +LTTNG_EXPORT extern struct lttng_notification_channel * +lttng_notification_channel_create(struct lttng_endpoint *endpoint); /* * Get the next notification received on a notification channel. @@ -83,9 +84,8 @@ LTTNG_EXPORT extern struct lttng_notification_channel *lttng_notification_channe * that caused the reception to fail. */ LTTNG_EXPORT extern 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); /* * Check whether a notification is pending on a notification channel. @@ -104,9 +104,8 @@ lttng_notification_channel_get_next_notification( * provided. */ LTTNG_EXPORT extern 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); /* * Subscribe to notifications of a condition through a notification channel. @@ -124,9 +123,8 @@ lttng_notification_channel_has_pending_notification( * client was already subscribed to the condition through this channel. */ LTTNG_EXPORT extern enum lttng_notification_channel_status -lttng_notification_channel_subscribe( - struct lttng_notification_channel *channel, - const struct lttng_condition *condition); +lttng_notification_channel_subscribe(struct lttng_notification_channel *channel, + const struct lttng_condition *condition); /* * Unsubscribe to notifications of a condition through a notification channel. @@ -144,15 +142,14 @@ lttng_notification_channel_subscribe( * client was not already subscribed to the condition through this channel. */ LTTNG_EXPORT extern enum lttng_notification_channel_status -lttng_notification_channel_unsubscribe( - struct lttng_notification_channel *channel, - const struct lttng_condition *condition); +lttng_notification_channel_unsubscribe(struct lttng_notification_channel *channel, + const struct lttng_condition *condition); /* * Closes and destroys (frees) a notification channel. */ -LTTNG_EXPORT extern void lttng_notification_channel_destroy( - struct lttng_notification_channel *channel); +LTTNG_EXPORT extern void +lttng_notification_channel_destroy(struct lttng_notification_channel *channel); #ifdef __cplusplus } diff --git a/include/lttng/notification/notification-internal.hpp b/include/lttng/notification/notification-internal.hpp index 9837c359b..9fe471c26 100644 --- a/include/lttng/notification/notification-internal.hpp +++ b/include/lttng/notification/notification-internal.hpp @@ -38,23 +38,21 @@ struct lttng_notification_comm { char payload[]; } LTTNG_PACKED; -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); int lttng_notification_serialize(const struct lttng_notification *notification, - struct lttng_payload *payload); + struct lttng_payload *payload); -ssize_t lttng_notification_create_from_payload( - struct lttng_payload_view *view, - struct lttng_notification **notification); +ssize_t lttng_notification_create_from_payload(struct lttng_payload_view *view, + struct lttng_notification **notification); -const struct lttng_condition *lttng_notification_get_const_condition( - const struct lttng_notification *notification); -const struct lttng_evaluation *lttng_notification_get_const_evaluation( - const struct lttng_notification *notification); +const struct lttng_condition * +lttng_notification_get_const_condition(const struct lttng_notification *notification); +const struct lttng_evaluation * +lttng_notification_get_const_evaluation(const struct lttng_notification *notification); -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); #endif /* LTTNG_NOTIFICATION_INTERNAL_H */ diff --git a/include/lttng/notification/notification.h b/include/lttng/notification/notification.h index d1c088fec..c434f1132 100644 --- a/include/lttng/notification/notification.h +++ b/include/lttng/notification/notification.h @@ -30,8 +30,8 @@ struct lttng_notification; * * Returns an lttng_condition object on success, NULL on error. */ -LTTNG_EXPORT extern const struct lttng_condition *lttng_notification_get_condition( - struct lttng_notification *notification); +LTTNG_EXPORT extern const struct lttng_condition * +lttng_notification_get_condition(struct lttng_notification *notification); /* * Get a notification's condition's evaluation. @@ -45,8 +45,8 @@ LTTNG_EXPORT extern const struct lttng_condition *lttng_notification_get_conditi * * Returns an lttng_evaluation object on success, NULL on error. */ -LTTNG_EXPORT extern const struct lttng_evaluation *lttng_notification_get_evaluation( - struct lttng_notification *notification); +LTTNG_EXPORT extern const struct lttng_evaluation * +lttng_notification_get_evaluation(struct lttng_notification *notification); /* * Get a notification's origin trigger. @@ -57,8 +57,8 @@ LTTNG_EXPORT extern const struct lttng_evaluation *lttng_notification_get_evalua * * Returns an lttng_trigger object on success, NULL on error. */ -LTTNG_EXPORT extern const struct lttng_trigger *lttng_notification_get_trigger( - struct lttng_notification *notification); +LTTNG_EXPORT extern const struct lttng_trigger * +lttng_notification_get_trigger(struct lttng_notification *notification); /* * Destroys (frees) a notification. The notification's condition and evaluation diff --git a/include/lttng/ref-internal.hpp b/include/lttng/ref-internal.hpp index 68b6efd1b..13c1a69ee 100644 --- a/include/lttng/ref-internal.hpp +++ b/include/lttng/ref-internal.hpp @@ -17,16 +17,14 @@ struct lttng_ref { lttng_release_func release; }; -static inline -void lttng_ref_init(struct lttng_ref *ref, lttng_release_func release) +static inline void lttng_ref_init(struct lttng_ref *ref, lttng_release_func release) { LTTNG_ASSERT(ref); ref->count = 1; ref->release = release; } -static inline -void lttng_ref_get(struct lttng_ref *ref) +static inline void lttng_ref_get(struct lttng_ref *ref) { LTTNG_ASSERT(ref); ref->count++; @@ -34,8 +32,7 @@ void lttng_ref_get(struct lttng_ref *ref) LTTNG_ASSERT(ref->count); } -static inline -void lttng_ref_put(struct lttng_ref *ref) +static inline void lttng_ref_put(struct lttng_ref *ref) { LTTNG_ASSERT(ref); /* Underflow check. */ diff --git a/include/lttng/rotate-internal.hpp b/include/lttng/rotate-internal.hpp index 69b82b5f6..dbc66f345 100644 --- a/include/lttng/rotate-internal.hpp +++ b/include/lttng/rotate-internal.hpp @@ -8,13 +8,14 @@ #ifndef LTTNG_ROTATE_INTERNAL_ABI_H #define LTTNG_ROTATE_INTERNAL_ABI_H -#include -#include -#include +#include #include #include -#include + +#include +#include +#include /* * Object returned by the rotate session API. diff --git a/include/lttng/rotation.h b/include/lttng/rotation.h index 08f2a985b..e5b14e8b7 100644 --- a/include/lttng/rotation.h +++ b/include/lttng/rotation.h @@ -9,10 +9,11 @@ #ifndef LTTNG_ROTATION_H #define LTTNG_ROTATION_H -#include #include #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -102,9 +103,9 @@ struct lttng_rotation_handle; * This will issue a request to the session daemon on every call. Hence, * the result of this call may change over time. */ -LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_handle_get_state( - struct lttng_rotation_handle *rotation_handle, - enum lttng_rotation_state *rotation_state); +LTTNG_EXPORT extern enum lttng_rotation_status +lttng_rotation_handle_get_state(struct lttng_rotation_handle *rotation_handle, + enum lttng_rotation_state *rotation_state); /* * Get the location of the rotation's resulting archive. @@ -115,15 +116,15 @@ LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_handle_get_state( * Note that location will not be set in case of error, or if the session * rotation handle has expired. */ -LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_handle_get_archive_location( - struct lttng_rotation_handle *rotation_handle, - const struct lttng_trace_archive_location **location); +LTTNG_EXPORT extern enum lttng_rotation_status +lttng_rotation_handle_get_archive_location(struct lttng_rotation_handle *rotation_handle, + const struct lttng_trace_archive_location **location); /* * Destroy an lttng_rotate_session handle. */ -LTTNG_EXPORT extern void lttng_rotation_handle_destroy( - struct lttng_rotation_handle *rotation_handle); +LTTNG_EXPORT extern void +lttng_rotation_handle_destroy(struct lttng_rotation_handle *rotation_handle); /* * Rotate the output folder of the session. @@ -139,14 +140,14 @@ LTTNG_EXPORT extern void lttng_rotation_handle_destroy( * LTTng error code on error. */ LTTNG_EXPORT extern int lttng_rotate_session(const char *session_name, - struct lttng_rotation_immediate_descriptor *descriptor, - struct lttng_rotation_handle **rotation_handle); + struct lttng_rotation_immediate_descriptor *descriptor, + struct lttng_rotation_handle **rotation_handle); /* * Get the type of a rotation schedule object. */ -LTTNG_EXPORT extern enum lttng_rotation_schedule_type lttng_rotation_schedule_get_type( - const struct lttng_rotation_schedule *schedule); +LTTNG_EXPORT extern enum lttng_rotation_schedule_type +lttng_rotation_schedule_get_type(const struct lttng_rotation_schedule *schedule); /* * Return a newly allocated size-based session rotation schedule or NULL on @@ -162,24 +163,21 @@ lttng_rotation_schedule_size_threshold_create(void); * LTTNG_ROTATION_STATUS_UNAVAILABLE is returned if the value is unset. */ LTTNG_EXPORT extern 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); /* * Set a session rotation schedule's size threshold. */ LTTNG_EXPORT extern 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); /* * Return a newly allocated periodic session rotation schedule or NULL on * error. */ -LTTNG_EXPORT extern struct lttng_rotation_schedule * -lttng_rotation_schedule_periodic_create(void); +LTTNG_EXPORT extern struct lttng_rotation_schedule *lttng_rotation_schedule_periodic_create(void); /* * Get a time-based session rotation schedule's period. @@ -187,36 +185,35 @@ lttng_rotation_schedule_periodic_create(void); * Returns LTTNG_ROTATION_STATUS_OK on success. * LTTNG_ROTATION_STATUS_UNAVAILABLE is returned if the value is unset. */ -LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_schedule_periodic_get_period( - const struct lttng_rotation_schedule *schedule, - uint64_t *period_us); +LTTNG_EXPORT extern enum lttng_rotation_status +lttng_rotation_schedule_periodic_get_period(const struct lttng_rotation_schedule *schedule, + uint64_t *period_us); /* * Set a time-based session rotation schedule's period. */ -LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_schedule_periodic_set_period( - struct lttng_rotation_schedule *schedule, - uint64_t period_us); +LTTNG_EXPORT extern enum lttng_rotation_status +lttng_rotation_schedule_periodic_set_period(struct lttng_rotation_schedule *schedule, + uint64_t period_us); /* * Destroy a rotation schedule. */ -LTTNG_EXPORT extern void lttng_rotation_schedule_destroy( - struct lttng_rotation_schedule *schedule); +LTTNG_EXPORT extern void lttng_rotation_schedule_destroy(struct lttng_rotation_schedule *schedule); /* * Destroy a set of rotation schedules. Pointers to any schedule contained * in this set become invalid after this call. */ -LTTNG_EXPORT extern void lttng_rotation_schedules_destroy( - struct lttng_rotation_schedules *schedules); +LTTNG_EXPORT extern void +lttng_rotation_schedules_destroy(struct lttng_rotation_schedules *schedules); /* * Get the number of schedules in a schedule set. */ -LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_schedules_get_count( - const struct lttng_rotation_schedules *schedules, - unsigned int *count); +LTTNG_EXPORT extern enum lttng_rotation_status +lttng_rotation_schedules_get_count(const struct lttng_rotation_schedules *schedules, + unsigned int *count); /* * Get a schedule from the set at a given index. @@ -228,9 +225,8 @@ LTTNG_EXPORT extern enum lttng_rotation_status lttng_rotation_schedules_get_coun * Returns a rotation schedule, or NULL on error. */ LTTNG_EXPORT extern const struct lttng_rotation_schedule * -lttng_rotation_schedules_get_at_index( - const struct lttng_rotation_schedules *schedules, - unsigned int index); +lttng_rotation_schedules_get_at_index(const struct lttng_rotation_schedules *schedules, + unsigned int index); /* * Add a session rotation schedule to a session. @@ -242,9 +238,9 @@ lttng_rotation_schedules_get_at_index( * LTTNG_ROTATION_STATUS_SCHEDULE_ALREADY_SET if a rotation of the same type * is already set. */ -LTTNG_EXPORT extern enum lttng_rotation_status lttng_session_add_rotation_schedule( - const char *session_name, - const struct lttng_rotation_schedule *schedule); +LTTNG_EXPORT extern enum lttng_rotation_status +lttng_session_add_rotation_schedule(const char *session_name, + const struct lttng_rotation_schedule *schedule); /* * Remove a session rotation schedule from a session. @@ -253,18 +249,18 @@ LTTNG_EXPORT extern enum lttng_rotation_status lttng_session_add_rotation_schedu * LTTNG_ROTATION_STATUS_SCHEDULE_INVALID if the provided schedule is * not set. */ -LTTNG_EXPORT extern enum lttng_rotation_status lttng_session_remove_rotation_schedule( - const char *session_name, - const struct lttng_rotation_schedule *schedule); +LTTNG_EXPORT extern enum lttng_rotation_status +lttng_session_remove_rotation_schedule(const char *session_name, + const struct lttng_rotation_schedule *schedule); /* * Get the rotation schedules associated with a given session. * * Returns LTTNG_OK on success, or a negative lttng error code on error. */ -LTTNG_EXPORT extern int lttng_session_list_rotation_schedules( - const char *session_name, - struct lttng_rotation_schedules **schedules); +LTTNG_EXPORT extern int +lttng_session_list_rotation_schedules(const char *session_name, + struct lttng_rotation_schedules **schedules); #ifdef __cplusplus } diff --git a/include/lttng/save-internal.hpp b/include/lttng/save-internal.hpp index 6b2bb9433..4b8343bdb 100644 --- a/include/lttng/save-internal.hpp +++ b/include/lttng/save-internal.hpp @@ -8,11 +8,12 @@ #ifndef LTTNG_SAVE_INTERNAL_ABI_H #define LTTNG_SAVE_INTERNAL_ABI_H -#include -#include +#include #include -#include + +#include +#include /* * Object used by the save_session API. This is opaque to the public library. diff --git a/include/lttng/save.h b/include/lttng/save.h index d28fdffcd..6120467a7 100644 --- a/include/lttng/save.h +++ b/include/lttng/save.h @@ -30,39 +30,36 @@ LTTNG_EXPORT extern struct lttng_save_session_attr *lttng_save_session_attr_crea */ LTTNG_EXPORT extern void lttng_save_session_attr_destroy(struct lttng_save_session_attr *output); - /* * Save session attribute getter family functions. */ /* Return session name. NULL indicated all sessions must be saved. */ -LTTNG_EXPORT extern const char *lttng_save_session_attr_get_session_name( - struct lttng_save_session_attr *attr); +LTTNG_EXPORT extern const char * +lttng_save_session_attr_get_session_name(struct lttng_save_session_attr *attr); /* * Return destination URL. A NULL value indicates the default session * configuration location. The URL format used is documented in lttng(1). * NULL indicates that the default session configuration path is used. */ -LTTNG_EXPORT extern const char *lttng_save_session_attr_get_output_url( - struct lttng_save_session_attr *attr); +LTTNG_EXPORT extern const char * +lttng_save_session_attr_get_output_url(struct lttng_save_session_attr *attr); /* * Return the configuration overwrite attribute. This attribute indicates * whether or not existing configuration files must be overwritten. */ -LTTNG_EXPORT extern int lttng_save_session_attr_get_overwrite( - struct lttng_save_session_attr *attr); +LTTNG_EXPORT extern int lttng_save_session_attr_get_overwrite(struct lttng_save_session_attr *attr); /* * Return the omit name configuration attribute. This attribute indicates * whether or not the saved sessions' names should be omitted. */ -LTTNG_EXPORT extern int lttng_save_session_attr_get_omit_name( - struct lttng_save_session_attr *attr); +LTTNG_EXPORT extern int lttng_save_session_attr_get_omit_name(struct lttng_save_session_attr *attr); /* * Return the omit output configuration attribute. This attribute indicates * whether or not the saved sessions' output configuration should be omitted. */ -LTTNG_EXPORT extern int lttng_save_session_attr_get_omit_output( - struct lttng_save_session_attr *attr); +LTTNG_EXPORT extern int +lttng_save_session_attr_get_omit_output(struct lttng_save_session_attr *attr); /* * Save session attribute setter family functions. @@ -75,33 +72,34 @@ LTTNG_EXPORT extern int lttng_save_session_attr_get_omit_output( * Set the name of the session to save. A NULL name means all sessions * known to the session daemon will be saved. */ -LTTNG_EXPORT extern int lttng_save_session_attr_set_session_name( - struct lttng_save_session_attr *attr, const char *session_name); +LTTNG_EXPORT extern int +lttng_save_session_attr_set_session_name(struct lttng_save_session_attr *attr, + const char *session_name); /* * Set the URL of the session configuration to save. A NULL value indicates the * use of the default location being the session one. The URL's format is is * documented in lttng(1). */ -LTTNG_EXPORT extern int lttng_save_session_attr_set_output_url( - struct lttng_save_session_attr *attr, const char *url); +LTTNG_EXPORT extern int lttng_save_session_attr_set_output_url(struct lttng_save_session_attr *attr, + const char *url); /* * Set the overwrite attribute. If set to true, files of the same name as the * current session configuration URL will be overwritten. */ -LTTNG_EXPORT extern int lttng_save_session_attr_set_overwrite( - struct lttng_save_session_attr *attr, int overwrite); +LTTNG_EXPORT extern int lttng_save_session_attr_set_overwrite(struct lttng_save_session_attr *attr, + int overwrite); /* * Set the omit name attribute. If set to true, the sessions' names are omitted * from the resulting session configuration file. */ -LTTNG_EXPORT extern int lttng_save_session_attr_set_omit_name( - struct lttng_save_session_attr *attr, int omit_name); +LTTNG_EXPORT extern int lttng_save_session_attr_set_omit_name(struct lttng_save_session_attr *attr, + int omit_name); /* * Set the omit output attribute. If set to true, the sessions' output * configurations are omitted from the resulting session configuration file. */ -LTTNG_EXPORT extern int lttng_save_session_attr_set_omit_output( - struct lttng_save_session_attr *attr, int omit_output); +LTTNG_EXPORT extern int +lttng_save_session_attr_set_omit_output(struct lttng_save_session_attr *attr, int omit_output); /* * Save session configuration(s). diff --git a/include/lttng/session-descriptor-internal.hpp b/include/lttng/session-descriptor-internal.hpp index c132f5600..a2dd70d57 100644 --- a/include/lttng/session-descriptor-internal.hpp +++ b/include/lttng/session-descriptor-internal.hpp @@ -8,11 +8,13 @@ #ifndef LTTNG_SESSION_DESCRIPTOR_INTERNAL_H #define LTTNG_SESSION_DESCRIPTOR_INTERNAL_H -#include -#include -#include -#include #include +#include +#include + +#include +#include + #include /* Note that these enums are used as part of the lttnctl protocol. */ @@ -33,52 +35,44 @@ enum lttng_session_descriptor_output_type { LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK = 2, }; -ssize_t lttng_session_descriptor_create_from_buffer( - const struct lttng_buffer_view *view, - struct lttng_session_descriptor **descriptor); +ssize_t lttng_session_descriptor_create_from_buffer(const struct lttng_buffer_view *view, + struct lttng_session_descriptor **descriptor); -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); 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); 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); 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); 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); 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); -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); bool lttng_session_descriptor_is_output_destination_initialized( - const struct lttng_session_descriptor *descriptor); + const struct lttng_session_descriptor *descriptor); bool lttng_session_descriptor_has_output_directory( - const struct lttng_session_descriptor *descriptor); + const struct lttng_session_descriptor *descriptor); -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); -int lttng_session_descriptor_assign( - struct lttng_session_descriptor *dst_descriptor, - const struct lttng_session_descriptor *src_descriptor); +int lttng_session_descriptor_assign(struct lttng_session_descriptor *dst_descriptor, + const struct lttng_session_descriptor *src_descriptor); #endif /* LTTNG_SESSION_DESCRIPTOR_INTERNAL_H */ diff --git a/include/lttng/session-descriptor.h b/include/lttng/session-descriptor.h index 5db04be7e..a67a4bf1c 100644 --- a/include/lttng/session-descriptor.h +++ b/include/lttng/session-descriptor.h @@ -131,9 +131,8 @@ lttng_session_descriptor_local_create(const char *name, const char *path); * * Returns an lttng_session_descriptor instance on success, NULL on error. */ -LTTNG_EXPORT extern struct lttng_session_descriptor * -lttng_session_descriptor_network_create(const char *name, - const char *control_url, const char *data_url); +LTTNG_EXPORT extern struct lttng_session_descriptor *lttng_session_descriptor_network_create( + const char *name, const char *control_url, const char *data_url); /* * Create a snapshot session descriptor without a default output. @@ -156,8 +155,7 @@ lttng_session_descriptor_snapshot_create(const char *name); * Returns an lttng_session_descriptor instance on success, NULL on error. */ LTTNG_EXPORT extern struct lttng_session_descriptor * -lttng_session_descriptor_snapshot_local_create(const char *name, - const char *path); +lttng_session_descriptor_snapshot_local_create(const char *name, const char *path); /* * Create a snapshot session descriptor with a remote output destination. @@ -172,7 +170,8 @@ lttng_session_descriptor_snapshot_local_create(const char *name, */ LTTNG_EXPORT extern struct lttng_session_descriptor * lttng_session_descriptor_snapshot_network_create(const char *name, - const char *control_url, const char *data_url); + const char *control_url, + const char *data_url); /* * Create a live session descriptor without an output. @@ -188,8 +187,7 @@ lttng_session_descriptor_snapshot_network_create(const char *name, * Returns an lttng_session_descriptor instance on success, NULL on error. */ LTTNG_EXPORT extern struct lttng_session_descriptor * -lttng_session_descriptor_live_create( - const char *name, unsigned long long live_timer_interval_us); +lttng_session_descriptor_live_create(const char *name, unsigned long long live_timer_interval_us); /* * Create a live session descriptor with a remote output destination. @@ -208,10 +206,10 @@ lttng_session_descriptor_live_create( * Returns an lttng_session_descriptor instance on success, NULL on error. */ LTTNG_EXPORT extern 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_interval_us); +lttng_session_descriptor_live_network_create(const char *name, + const char *control_url, + const char *data_url, + unsigned long long live_timer_interval_us); /* * Get a session descriptor's session name. @@ -229,9 +227,8 @@ lttng_session_descriptor_live_network_create( * name parameter is unset. */ LTTNG_EXPORT extern enum lttng_session_descriptor_status -lttng_session_descriptor_get_session_name( - const struct lttng_session_descriptor *descriptor, - const char **name); +lttng_session_descriptor_get_session_name(const struct lttng_session_descriptor *descriptor, + const char **name); /* * Destroy a local lttng_session object. @@ -239,8 +236,8 @@ lttng_session_descriptor_get_session_name( * This does not destroy the session on the session daemon; it releases * the resources allocated by the descriptor object. */ -LTTNG_EXPORT extern void lttng_session_descriptor_destroy( - struct lttng_session_descriptor *descriptor); +LTTNG_EXPORT extern void +lttng_session_descriptor_destroy(struct lttng_session_descriptor *descriptor); #ifdef __cplusplus } diff --git a/include/lttng/session-internal.hpp b/include/lttng/session-internal.hpp index 7f73b9610..e7530d3ae 100644 --- a/include/lttng/session-internal.hpp +++ b/include/lttng/session-internal.hpp @@ -8,9 +8,10 @@ #ifndef LTTNG_SESSION_INTERNAL_H #define LTTNG_SESSION_INTERNAL_H -#include #include +#include + struct lttng_session_extended { struct { uint64_t value; diff --git a/include/lttng/session.h b/include/lttng/session.h index 153a37b03..9be506fc1 100644 --- a/include/lttng/session.h +++ b/include/lttng/session.h @@ -28,7 +28,7 @@ struct lttng_destruction_handle; * * The structures should be initialized to zero before use. */ -#define LTTNG_SESSION_PADDING1 8 +#define LTTNG_SESSION_PADDING1 8 struct lttng_session { char name[LTTNG_NAME_MAX]; /* @@ -41,9 +41,9 @@ struct lttng_session { * net://hostname/path:ctrl_port [data: data_port] */ char path[PATH_MAX]; - uint32_t enabled; /* enabled/started: 1, disabled/stopped: 0 */ + uint32_t enabled; /* enabled/started: 1, disabled/stopped: 0 */ uint32_t snapshot_mode; - unsigned int live_timer_interval; /* usec */ + unsigned int live_timer_interval; /* usec */ /* * End of public attributes. @@ -87,8 +87,8 @@ struct lttng_session { * Returns LTTNG_OK on success. See lttng-error.h for the meaning of the other * return codes. */ -LTTNG_EXPORT extern enum lttng_error_code lttng_create_session_ext( - struct lttng_session_descriptor *session_descriptor); +LTTNG_EXPORT extern enum lttng_error_code +lttng_create_session_ext(struct lttng_session_descriptor *session_descriptor); /* * Create a tracing session using a name and an optional URL. @@ -112,8 +112,7 @@ LTTNG_EXPORT extern int lttng_create_session(const char *name, const char *url); * * Return 0 on success else a negative LTTng error code. */ -LTTNG_EXPORT extern int lttng_create_session_snapshot(const char *name, - const char *snapshot_url); +LTTNG_EXPORT extern int lttng_create_session_snapshot(const char *name, const char *snapshot_url); /* * Create a session exclusively used for live reading. @@ -128,8 +127,8 @@ LTTNG_EXPORT extern int lttng_create_session_snapshot(const char *name, * * Return 0 on success else a negative LTTng error code. */ -LTTNG_EXPORT extern int lttng_create_session_live(const char *name, const char *url, - unsigned int timer_interval); +LTTNG_EXPORT extern int +lttng_create_session_live(const char *name, const char *url, unsigned int timer_interval); /* * Destroy a tracing session. @@ -162,8 +161,8 @@ LTTNG_EXPORT extern int lttng_destroy_session(const char *name); * Returns LTTNG_OK on success. The returned handle is owned by the caller * and must be free'd using lttng_destruction_handle_destroy(). */ -LTTNG_EXPORT extern enum lttng_error_code lttng_destroy_session_ext(const char *session_name, - struct lttng_destruction_handle **handle); +LTTNG_EXPORT extern enum lttng_error_code +lttng_destroy_session_ext(const char *session_name, struct lttng_destruction_handle **handle); /* * Behaves exactly like lttng_destroy_session but does not wait for data @@ -193,8 +192,8 @@ LTTNG_EXPORT extern int lttng_list_sessions(struct lttng_session **sessions); * Returns LTTNG_OK on success. See lttng-error.h for the meaning of the other * return codes. */ -LTTNG_EXPORT extern enum lttng_error_code lttng_session_get_creation_time( - const struct lttng_session *session, uint64_t *creation_time); +LTTNG_EXPORT extern enum lttng_error_code +lttng_session_get_creation_time(const struct lttng_session *session, uint64_t *creation_time); /* * Set the shared memory path for a session. @@ -205,8 +204,7 @@ LTTNG_EXPORT extern enum lttng_error_code lttng_session_get_creation_time( * * Return 0 on success else a negative LTTng error code. */ -LTTNG_EXPORT extern int lttng_set_session_shm_path(const char *session_name, - const char *shm_path); +LTTNG_EXPORT extern int lttng_set_session_shm_path(const char *session_name, const char *shm_path); #ifdef __cplusplus } diff --git a/include/lttng/snapshot-internal.hpp b/include/lttng/snapshot-internal.hpp index c60a1963b..706bf6ebf 100644 --- a/include/lttng/snapshot-internal.hpp +++ b/include/lttng/snapshot-internal.hpp @@ -8,10 +8,12 @@ #ifndef LTTNG_SNAPSHOT_INTERNAL_ABI_H #define LTTNG_SNAPSHOT_INTERNAL_ABI_H +#include + +#include + #include #include -#include -#include /* * Object used for the snapshot API. This is opaque to the public library. diff --git a/include/lttng/snapshot.h b/include/lttng/snapshot.h index b777e006b..4c1049b4d 100644 --- a/include/lttng/snapshot.h +++ b/include/lttng/snapshot.h @@ -8,8 +8,9 @@ #ifndef LTTNG_SNAPSHOT_H #define LTTNG_SNAPSHOT_H -#include #include + +#include #include #include @@ -40,15 +41,20 @@ LTTNG_EXPORT extern void lttng_snapshot_output_destroy(struct lttng_snapshot_out */ /* Return snapshot ID. */ -LTTNG_EXPORT extern uint32_t lttng_snapshot_output_get_id(const struct lttng_snapshot_output *output); +LTTNG_EXPORT extern uint32_t +lttng_snapshot_output_get_id(const struct lttng_snapshot_output *output); /* Return maximum size of a snapshot. */ -LTTNG_EXPORT extern uint64_t lttng_snapshot_output_get_maxsize(const struct lttng_snapshot_output *output); +LTTNG_EXPORT extern uint64_t +lttng_snapshot_output_get_maxsize(const struct lttng_snapshot_output *output); /* Return snapshot name. */ -LTTNG_EXPORT extern const char *lttng_snapshot_output_get_name(const struct lttng_snapshot_output *output); +LTTNG_EXPORT extern const char * +lttng_snapshot_output_get_name(const struct lttng_snapshot_output *output); /* Return snapshot control URL in a text format. */ -LTTNG_EXPORT extern const char *lttng_snapshot_output_get_ctrl_url(const struct lttng_snapshot_output *output); +LTTNG_EXPORT extern const char * +lttng_snapshot_output_get_ctrl_url(const struct lttng_snapshot_output *output); /* Return snapshot data URL in a text format. */ -LTTNG_EXPORT extern const char *lttng_snapshot_output_get_data_url(const struct lttng_snapshot_output *output); +LTTNG_EXPORT extern const char * +lttng_snapshot_output_get_data_url(const struct lttng_snapshot_output *output); /* * Snapshot output setter family functions. @@ -59,13 +65,13 @@ LTTNG_EXPORT extern const char *lttng_snapshot_output_get_data_url(const struct /* Set a custom ID. */ LTTNG_EXPORT extern int lttng_snapshot_output_set_id(uint32_t id, - struct lttng_snapshot_output *output); + struct lttng_snapshot_output *output); /* Set the maximum size. */ LTTNG_EXPORT extern int lttng_snapshot_output_set_size(uint64_t size, - struct lttng_snapshot_output *output); + struct lttng_snapshot_output *output); /* Set the snapshot name. */ LTTNG_EXPORT extern int lttng_snapshot_output_set_name(const char *name, - struct lttng_snapshot_output *output); + struct lttng_snapshot_output *output); /* * Set the output destination to be a path on the local filesystem. @@ -75,7 +81,7 @@ LTTNG_EXPORT extern int lttng_snapshot_output_set_name(const char *name, * Return 0 on success or else a negative LTTNG_ERR code. */ LTTNG_EXPORT extern int lttng_snapshot_output_set_local_path(const char *path, - struct lttng_snapshot_output *output); + struct lttng_snapshot_output *output); /* * Set the output destination to be the network from a combined control/data @@ -86,7 +92,7 @@ LTTNG_EXPORT extern int lttng_snapshot_output_set_local_path(const char *path, * Return 0 on success or else a negative LTTNG_ERR code. */ LTTNG_EXPORT extern int lttng_snapshot_output_set_network_url(const char *url, - struct lttng_snapshot_output *output); + struct lttng_snapshot_output *output); /* * Set the output destination to be the network using separate URLs for control @@ -99,15 +105,14 @@ LTTNG_EXPORT extern int lttng_snapshot_output_set_network_url(const char *url, * Return 0 on success or else a negative LTTNG_ERR code. */ LTTNG_EXPORT extern int lttng_snapshot_output_set_network_urls( - const char *ctrl_url, const char *data_url, - struct lttng_snapshot_output *output); + const char *ctrl_url, const char *data_url, struct lttng_snapshot_output *output); /* Set the control URL. Local and remote URL are supported. */ LTTNG_EXPORT extern int lttng_snapshot_output_set_ctrl_url(const char *url, - struct lttng_snapshot_output *output); + struct lttng_snapshot_output *output); /* Set the data URL. Local and remote URL are supported. */ LTTNG_EXPORT extern int lttng_snapshot_output_set_data_url(const char *url, - struct lttng_snapshot_output *output); + struct lttng_snapshot_output *output); /* * Add an output object to a session identified by name. @@ -115,7 +120,7 @@ LTTNG_EXPORT extern int lttng_snapshot_output_set_data_url(const char *url, * Return 0 on success or else a negative LTTNG_ERR code. */ LTTNG_EXPORT extern int lttng_snapshot_add_output(const char *session_name, - struct lttng_snapshot_output *output); + struct lttng_snapshot_output *output); /* * Delete an output object to a session identified by name. @@ -123,7 +128,7 @@ LTTNG_EXPORT extern int lttng_snapshot_add_output(const char *session_name, * Return 0 on success or else a negative LTTNG_ERR code. */ LTTNG_EXPORT extern int lttng_snapshot_del_output(const char *session_name, - struct lttng_snapshot_output *output); + struct lttng_snapshot_output *output); /* * List all snapshot output(s) of a session identified by name. The output list @@ -133,7 +138,7 @@ LTTNG_EXPORT extern int lttng_snapshot_del_output(const char *session_name, * is untouched. */ LTTNG_EXPORT extern int lttng_snapshot_list_output(const char *session_name, - struct lttng_snapshot_output_list **list); + struct lttng_snapshot_output_list **list); /* * Return the next available snapshot output object in the given list. A list @@ -142,13 +147,14 @@ LTTNG_EXPORT extern int lttng_snapshot_list_output(const char *session_name, * Return the next object on success or else NULL indicating the end of the * list. */ -LTTNG_EXPORT extern struct lttng_snapshot_output *lttng_snapshot_output_list_get_next( - struct lttng_snapshot_output_list *list); +LTTNG_EXPORT extern struct lttng_snapshot_output * +lttng_snapshot_output_list_get_next(struct lttng_snapshot_output_list *list); /* * Free an output list object. */ -LTTNG_EXPORT extern void lttng_snapshot_output_list_destroy(struct lttng_snapshot_output_list *list); +LTTNG_EXPORT extern void +lttng_snapshot_output_list_destroy(struct lttng_snapshot_output_list *list); /* * Snapshot a trace for the given session. @@ -162,8 +168,8 @@ LTTNG_EXPORT extern void lttng_snapshot_output_list_destroy(struct lttng_snapsho * * Return 0 on success or else a negative LTTNG_ERR value. */ -LTTNG_EXPORT extern int lttng_snapshot_record(const char *session_name, - struct lttng_snapshot_output *output, int wait); +LTTNG_EXPORT extern int +lttng_snapshot_record(const char *session_name, struct lttng_snapshot_output *output, int wait); #ifdef __cplusplus } diff --git a/include/lttng/tracker.h b/include/lttng/tracker.h index 869f8a8f8..f8f493e66 100644 --- a/include/lttng/tracker.h +++ b/include/lttng/tracker.h @@ -116,17 +116,17 @@ struct lttng_process_attr_values; * The tracker's ownership is transfered to the caller. Use * lttng_process_attr_tracker_handle_destroy() to dispose of it. */ -LTTNG_EXPORT extern 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); +LTTNG_EXPORT extern 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); /* * Destroy a process attribute tracker handle. */ -LTTNG_EXPORT extern void lttng_process_attr_tracker_handle_destroy( - struct lttng_process_attr_tracker_handle *tracker_handle); +LTTNG_EXPORT extern void +lttng_process_attr_tracker_handle_destroy(struct lttng_process_attr_tracker_handle *tracker_handle); /* * Get the tracking policy of a process attribute tracker. @@ -137,8 +137,8 @@ LTTNG_EXPORT extern void lttng_process_attr_tracker_handle_destroy( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_get_tracking_policy( - const struct lttng_process_attr_tracker_handle *tracker_handle, - enum lttng_tracking_policy *policy); + const struct lttng_process_attr_tracker_handle *tracker_handle, + enum lttng_tracking_policy *policy); /* * Set the tracking policy of a process attribute tracker. @@ -150,8 +150,8 @@ lttng_process_attr_tracker_handle_get_tracking_policy( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_set_tracking_policy( - const struct lttng_process_attr_tracker_handle *tracker_handle, - enum lttng_tracking_policy policy); + const struct lttng_process_attr_tracker_handle *tracker_handle, + enum lttng_tracking_policy policy); /* * Add a numerical PID to the process ID process attribute tracker inclusion @@ -165,9 +165,7 @@ lttng_process_attr_tracker_handle_set_tracking_policy( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_process_id_tracker_handle_add_pid( - const struct lttng_process_attr_tracker_handle - *process_id_tracker, - pid_t pid); + const struct lttng_process_attr_tracker_handle *process_id_tracker, pid_t pid); /* * Remove a numerical PID from the process ID process attribute tracker include @@ -180,9 +178,7 @@ lttng_process_attr_process_id_tracker_handle_add_pid( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_process_id_tracker_handle_remove_pid( - const struct lttng_process_attr_tracker_handle - *process_id_tracker, - pid_t pid); + const struct lttng_process_attr_tracker_handle *process_id_tracker, pid_t pid); /* * Add a numerical PID to the virtual process ID process attribute tracker @@ -196,9 +192,7 @@ lttng_process_attr_process_id_tracker_handle_remove_pid( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_process_id_tracker_handle_add_pid( - const struct lttng_process_attr_tracker_handle - *process_id_tracker, - pid_t vpid); + const struct lttng_process_attr_tracker_handle *process_id_tracker, pid_t vpid); /* * Remove a numerical PID from the virtual process ID process attribute tracker @@ -211,9 +205,7 @@ lttng_process_attr_virtual_process_id_tracker_handle_add_pid( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_process_id_tracker_handle_remove_pid( - const struct lttng_process_attr_tracker_handle - *process_id_tracker, - pid_t vpid); + const struct lttng_process_attr_tracker_handle *process_id_tracker, pid_t vpid); /* * Add a numerical UID to the user ID process attribute tracker inclusion set. @@ -226,8 +218,7 @@ lttng_process_attr_virtual_process_id_tracker_handle_remove_pid( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_user_id_tracker_handle_add_uid( - const struct lttng_process_attr_tracker_handle *user_id_tracker, - uid_t uid); + const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t uid); /* * Remove a numerical UID from the user ID process attribute tracker include @@ -240,8 +231,7 @@ lttng_process_attr_user_id_tracker_handle_add_uid( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_user_id_tracker_handle_remove_uid( - const struct lttng_process_attr_tracker_handle *user_id_tracker, - uid_t uid); + const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t uid); /* * Add a user name to the user ID process attribute tracker inclusion set. @@ -257,8 +247,7 @@ lttng_process_attr_user_id_tracker_handle_remove_uid( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_user_id_tracker_handle_add_user_name( - const struct lttng_process_attr_tracker_handle *user_id_tracker, - const char *user_name); + const struct lttng_process_attr_tracker_handle *user_id_tracker, const char *user_name); /* * Remove a user name from the user ID process attribute tracker include @@ -274,8 +263,7 @@ lttng_process_attr_user_id_tracker_handle_add_user_name( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_user_id_tracker_handle_remove_user_name( - const struct lttng_process_attr_tracker_handle *user_id_tracker, - const char *user_name); + const struct lttng_process_attr_tracker_handle *user_id_tracker, const char *user_name); /* * Add a numerical UID to the virtual user ID process attribute tracker @@ -289,8 +277,7 @@ lttng_process_attr_user_id_tracker_handle_remove_user_name( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_user_id_tracker_handle_add_uid( - const struct lttng_process_attr_tracker_handle *user_id_tracker, - uid_t vuid); + const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t vuid); /* * Remove a numerical UID from the virtual user ID process attribute tracker @@ -303,8 +290,7 @@ lttng_process_attr_virtual_user_id_tracker_handle_add_uid( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_user_id_tracker_handle_remove_uid( - const struct lttng_process_attr_tracker_handle *user_id_tracker, - uid_t vuid); + const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t vuid); /* * Add a user name to the virtual user ID process attribute tracker include @@ -321,8 +307,8 @@ lttng_process_attr_virtual_user_id_tracker_handle_remove_uid( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_user_id_tracker_handle_add_user_name( - const struct lttng_process_attr_tracker_handle *user_id_tracker, - const char *virtual_user_name); + const struct lttng_process_attr_tracker_handle *user_id_tracker, + const char *virtual_user_name); /* * Remove a user name from the virtual user ID process attribute tracker @@ -338,8 +324,8 @@ lttng_process_attr_virtual_user_id_tracker_handle_add_user_name( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_user_id_tracker_handle_remove_user_name( - const struct lttng_process_attr_tracker_handle *user_id_tracker, - const char *virtual_user_name); + const struct lttng_process_attr_tracker_handle *user_id_tracker, + const char *virtual_user_name); /* * Add a numerical GID to the group ID process attribute tracker inclusion set. @@ -352,8 +338,7 @@ lttng_process_attr_virtual_user_id_tracker_handle_remove_user_name( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_group_id_tracker_handle_add_gid( - const struct lttng_process_attr_tracker_handle *group_id_tracker, - gid_t gid); + const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t gid); /* * Remove a numerical GID from the group ID process attribute tracker include @@ -366,8 +351,7 @@ lttng_process_attr_group_id_tracker_handle_add_gid( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_group_id_tracker_handle_remove_gid( - const struct lttng_process_attr_tracker_handle *group_id_tracker, - gid_t gid); + const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t gid); /* * Add a group name to the group ID process attribute tracker inclusion set. @@ -383,8 +367,7 @@ lttng_process_attr_group_id_tracker_handle_remove_gid( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_group_id_tracker_handle_add_group_name( - const struct lttng_process_attr_tracker_handle *group_id_tracker, - const char *group_name); + const struct lttng_process_attr_tracker_handle *group_id_tracker, const char *group_name); /* * Remove a group name from the group ID process attribute tracker include @@ -400,8 +383,7 @@ lttng_process_attr_group_id_tracker_handle_add_group_name( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_group_id_tracker_handle_remove_group_name( - const struct lttng_process_attr_tracker_handle *group_id_tracker, - const char *group_name); + const struct lttng_process_attr_tracker_handle *group_id_tracker, const char *group_name); /* * Add a numerical GID to the virtual group ID process attribute tracker @@ -415,8 +397,7 @@ lttng_process_attr_group_id_tracker_handle_remove_group_name( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_group_id_tracker_handle_add_gid( - const struct lttng_process_attr_tracker_handle *group_id_tracker, - gid_t vgid); + const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t vgid); /* * Remove a numerical GID from the virtual group ID process attribute tracker @@ -429,8 +410,7 @@ lttng_process_attr_virtual_group_id_tracker_handle_add_gid( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_group_id_tracker_handle_remove_gid( - const struct lttng_process_attr_tracker_handle *group_id_tracker, - gid_t vgid); + const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t vgid); /* * Add a group name to the virtual group ID process attribute tracker include @@ -447,8 +427,8 @@ lttng_process_attr_virtual_group_id_tracker_handle_remove_gid( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_group_id_tracker_handle_add_group_name( - const struct lttng_process_attr_tracker_handle *group_id_tracker, - const char *virtual_group_name); + const struct lttng_process_attr_tracker_handle *group_id_tracker, + const char *virtual_group_name); /* * Remove a group name from the virtual group ID process attribute tracker @@ -464,8 +444,8 @@ lttng_process_attr_virtual_group_id_tracker_handle_add_group_name( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_virtual_group_id_tracker_handle_remove_group_name( - const struct lttng_process_attr_tracker_handle *group_id_tracker, - const char *virtual_group_name); + const struct lttng_process_attr_tracker_handle *group_id_tracker, + const char *virtual_group_name); /* * Get the process attribute values that are part of a tracker's inclusion set. @@ -482,8 +462,8 @@ lttng_process_attr_virtual_group_id_tracker_handle_remove_group_name( */ LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status lttng_process_attr_tracker_handle_get_inclusion_set( - struct lttng_process_attr_tracker_handle *tracker_handle, - const struct lttng_process_attr_values **values); + struct lttng_process_attr_tracker_handle *tracker_handle, + const struct lttng_process_attr_values **values); /* * Get the count of values within a set of process attribute values. @@ -492,9 +472,8 @@ lttng_process_attr_tracker_handle_get_inclusion_set( * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID if an invalid argument is provided. */ LTTNG_EXPORT extern enum lttng_process_attr_values_status -lttng_process_attr_values_get_count( - const struct lttng_process_attr_values *values, - unsigned int *count); +lttng_process_attr_values_get_count(const struct lttng_process_attr_values *values, + unsigned int *count); /* * Get the type of a process attribute value at a given index. @@ -503,9 +482,8 @@ lttng_process_attr_values_get_count( * LTTNG_PROCESS_ATTR_VALUE_TYPE_INVALID if an invalid argument is provided. */ LTTNG_EXPORT extern enum lttng_process_attr_value_type -lttng_process_attr_values_get_type_at_index( - const struct lttng_process_attr_values *values, - unsigned int index); +lttng_process_attr_values_get_type_at_index(const struct lttng_process_attr_values *values, + unsigned int index); /* * Get a process ID process attribute value. @@ -515,10 +493,9 @@ lttng_process_attr_values_get_type_at_index( * is not a process ID. */ LTTNG_EXPORT extern enum lttng_process_attr_values_status -lttng_process_attr_values_get_pid_at_index( - const struct lttng_process_attr_values *values, - unsigned int index, - pid_t *pid); +lttng_process_attr_values_get_pid_at_index(const struct lttng_process_attr_values *values, + unsigned int index, + pid_t *pid); /* * Get a user ID process attribute value. @@ -528,10 +505,9 @@ lttng_process_attr_values_get_pid_at_index( * is not a user ID. */ LTTNG_EXPORT extern enum lttng_process_attr_values_status -lttng_process_attr_values_get_uid_at_index( - const struct lttng_process_attr_values *values, - unsigned int index, - uid_t *uid); +lttng_process_attr_values_get_uid_at_index(const struct lttng_process_attr_values *values, + unsigned int index, + uid_t *uid); /* * Get a user name process attribute value. @@ -541,10 +517,9 @@ lttng_process_attr_values_get_uid_at_index( * is not a user name. */ LTTNG_EXPORT extern enum lttng_process_attr_values_status -lttng_process_attr_values_get_user_name_at_index( - const struct lttng_process_attr_values *values, - unsigned int index, - const char **user_name); +lttng_process_attr_values_get_user_name_at_index(const struct lttng_process_attr_values *values, + unsigned int index, + const char **user_name); /* * Get a group ID process attribute value. @@ -554,10 +529,9 @@ lttng_process_attr_values_get_user_name_at_index( * is not a group ID. */ LTTNG_EXPORT extern enum lttng_process_attr_values_status -lttng_process_attr_values_get_gid_at_index( - const struct lttng_process_attr_values *values, - unsigned int index, - gid_t *gid); +lttng_process_attr_values_get_gid_at_index(const struct lttng_process_attr_values *values, + unsigned int index, + gid_t *gid); /* * Get a group name process attribute value. @@ -567,10 +541,9 @@ lttng_process_attr_values_get_gid_at_index( * is not a group name. */ LTTNG_EXPORT extern enum lttng_process_attr_values_status -lttng_process_attr_values_get_group_name_at_index( - const struct lttng_process_attr_values *values, - unsigned int index, - const char **group_name); +lttng_process_attr_values_get_group_name_at_index(const struct lttng_process_attr_values *values, + unsigned int index, + const char **group_name); /* The following entry points are deprecated. */ @@ -589,10 +562,8 @@ lttng_process_attr_values_get_group_name_at_index( * * Returns 0 on success, else a negative LTTng error code. */ -LTTNG_EXPORT extern int lttng_list_tracker_pids(struct lttng_handle *handle, - int *enabled, - int32_t **pids, - size_t *nr_pids); +LTTNG_EXPORT extern int +lttng_list_tracker_pids(struct lttng_handle *handle, int *enabled, int32_t **pids, size_t *nr_pids); /* * Deprecated: see `lttng_process_attr_process_id_tracker_handle_add_pid`. diff --git a/include/lttng/trigger/trigger-internal.hpp b/include/lttng/trigger/trigger-internal.hpp index 30675523e..c0aa3506a 100644 --- a/include/lttng/trigger/trigger-internal.hpp +++ b/include/lttng/trigger/trigger-internal.hpp @@ -12,7 +12,9 @@ #include #include #include + #include + #include #include #include @@ -107,26 +109,21 @@ struct lttng_triggers_comm { }; ssize_t lttng_trigger_create_from_payload(struct lttng_payload_view *view, - struct lttng_trigger **trigger); + struct lttng_trigger **trigger); -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); bool lttng_trigger_validate(const struct lttng_trigger *trigger); -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); -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); uint64_t lttng_trigger_get_tracer_token(const struct lttng_trigger *trigger); -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); -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); bool lttng_trigger_is_hidden(const struct lttng_trigger *trigger); @@ -140,10 +137,10 @@ void lttng_trigger_put(struct lttng_trigger *trigger); * Serialize a trigger to a mi_writer. * Return LTTNG_OK in success, other enum lttng_error_code on error. */ -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); /* * Allocate a new set of triggers. @@ -161,8 +158,8 @@ struct lttng_triggers *lttng_triggers_create(); * The ownership of the trigger set element is NOT transfered. * The returned object can NOT be freed via lttng_trigger_destroy. */ -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); /* * Add a trigger to the triggers set. @@ -170,8 +167,7 @@ struct lttng_trigger *lttng_triggers_borrow_mutable_at_index( * A reference to the added trigger is acquired on behalf of the trigger set * on success. */ -int lttng_triggers_add( - struct lttng_triggers *triggers, struct lttng_trigger *trigger); +int lttng_triggers_add(struct lttng_triggers *triggers, struct lttng_trigger *trigger); /* * Remove all triggers marked as hidden from the provided trigger set. @@ -182,41 +178,38 @@ int lttng_triggers_remove_hidden_triggers(struct lttng_triggers *triggers); * Serialize a trigger set to an lttng_payload object. * Return LTTNG_OK on success, negative lttng error code on error. */ -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); ssize_t lttng_triggers_create_from_payload(struct lttng_payload_view *view, - struct lttng_triggers **triggers); + struct lttng_triggers **triggers); /* * Serialize a trigger set to a mi_writer. * Return LTTNG_OK in success, other enum lttng_error_code on error. */ -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); -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); void lttng_trigger_set_credentials(struct lttng_trigger *trigger, - const struct lttng_credentials *creds); + const struct lttng_credentials *creds); /* * Return the type of any underlying domain restriction. If no particular * requirement is present, returns LTTNG_DOMAIN_NONE. */ -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); /* * Generate any 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); /* * Note that the trigger object is not locked by "copy" as it is const and @@ -253,17 +246,17 @@ void lttng_trigger_lock(struct lttng_trigger *trigger); void lttng_trigger_unlock(struct lttng_trigger *trigger); -enum lttng_trigger_status lttng_trigger_add_error_results( - const struct lttng_trigger *trigger, - struct lttng_error_query_results *results); +enum lttng_trigger_status +lttng_trigger_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 +lttng_trigger_condition_add_error_results(const 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 +lttng_trigger_add_action_error_query_results(struct lttng_trigger *trigger, + struct lttng_error_query_results *results); /* * Set the trigger name. @@ -276,7 +269,6 @@ enum lttng_trigger_status lttng_trigger_add_action_error_query_results( * Return LTTNG_TRIGGER_STATUS_OK on success, LTTNG_TRIGGER_STATUS_INVALID * if invalid parameters are passed. */ -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); #endif /* LTTNG_TRIGGER_INTERNAL_H */ diff --git a/include/lttng/trigger/trigger.h b/include/lttng/trigger/trigger.h index 0a944a15a..18ab06e50 100644 --- a/include/lttng/trigger/trigger.h +++ b/include/lttng/trigger/trigger.h @@ -8,12 +8,13 @@ #ifndef LTTNG_TRIGGER_H #define LTTNG_TRIGGER_H -#include #include -#include #include #include +#include +#include + struct lttng_action; struct lttng_condition; struct lttng_trigger; @@ -63,8 +64,8 @@ enum lttng_trigger_status { * Trigger objects must be destroyed using the lttng_trigger_destroy() * function. */ -LTTNG_EXPORT extern struct lttng_trigger *lttng_trigger_create( - struct lttng_condition *condition, struct lttng_action *action); +LTTNG_EXPORT extern struct lttng_trigger *lttng_trigger_create(struct lttng_condition *condition, + struct lttng_action *action); /* * Set the user identity (uid) of a trigger. @@ -75,8 +76,8 @@ LTTNG_EXPORT extern struct lttng_trigger *lttng_trigger_create( * LTTNG_TRIGGER_STATUS_EPERM if not authorized, * LTTNG_TRIGGER_STATUS_INVALID if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_trigger_status lttng_trigger_set_owner_uid( - struct lttng_trigger *trigger, uid_t uid); +LTTNG_EXPORT extern enum lttng_trigger_status +lttng_trigger_set_owner_uid(struct lttng_trigger *trigger, uid_t uid); /* * Get the user identity (uid) of a trigger. @@ -85,8 +86,8 @@ LTTNG_EXPORT extern enum lttng_trigger_status lttng_trigger_set_owner_uid( * LTTNG_TRIGGER_STATUS_UNSET if unset, * LTTNG_TRIGGER_STATUS_INVALID if invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_trigger_status lttng_trigger_get_owner_uid( - const struct lttng_trigger *trigger, uid_t *uid); +LTTNG_EXPORT extern enum lttng_trigger_status +lttng_trigger_get_owner_uid(const struct lttng_trigger *trigger, uid_t *uid); /* * Get the condition of a trigger. @@ -95,11 +96,11 @@ LTTNG_EXPORT extern enum lttng_trigger_status lttng_trigger_get_owner_uid( * * Returns a condition on success, NULL on error. */ -LTTNG_EXPORT extern struct lttng_condition *lttng_trigger_get_condition( - struct lttng_trigger *trigger); +LTTNG_EXPORT extern struct lttng_condition * +lttng_trigger_get_condition(struct lttng_trigger *trigger); -LTTNG_EXPORT extern const struct lttng_condition *lttng_trigger_get_const_condition( - const struct lttng_trigger *trigger); +LTTNG_EXPORT extern const struct lttng_condition * +lttng_trigger_get_const_condition(const struct lttng_trigger *trigger); /* * Get the action of a trigger. @@ -108,11 +109,10 @@ LTTNG_EXPORT extern const struct lttng_condition *lttng_trigger_get_const_condit * * Returns an action on success, NULL on error. */ -LTTNG_EXPORT extern struct lttng_action *lttng_trigger_get_action( - struct lttng_trigger *trigger); +LTTNG_EXPORT extern struct lttng_action *lttng_trigger_get_action(struct lttng_trigger *trigger); -LTTNG_EXPORT extern const struct lttng_action *lttng_trigger_get_const_action( - const struct lttng_trigger *trigger); +LTTNG_EXPORT extern const struct lttng_action * +lttng_trigger_get_const_action(const struct lttng_trigger *trigger); /* * Get the name of a trigger. @@ -125,8 +125,8 @@ LTTNG_EXPORT extern const struct lttng_action *lttng_trigger_get_const_action( * success, LTTNG_TRIGGER_STATUS_INVALID if an invalid parameter is passed, * or LTTNG_TRIGGER_STATUS_UNSET if the trigger is unnamed. */ -LTTNG_EXPORT extern enum lttng_trigger_status lttng_trigger_get_name( - const struct lttng_trigger *trigger, const char **name); +LTTNG_EXPORT extern enum lttng_trigger_status +lttng_trigger_get_name(const struct lttng_trigger *trigger, const char **name); /* * Destroy (frees) a trigger object. @@ -141,9 +141,8 @@ LTTNG_EXPORT extern void lttng_trigger_destroy(struct lttng_trigger *trigger); * * Returns an LTTng status code. */ -LTTNG_EXPORT extern enum lttng_error_code lttng_register_trigger_with_name( - struct lttng_trigger *trigger, - const char *name); +LTTNG_EXPORT extern enum lttng_error_code +lttng_register_trigger_with_name(struct lttng_trigger *trigger, const char *name); /* * Register a trigger to the session daemon, generating a unique name for its @@ -155,8 +154,8 @@ LTTNG_EXPORT extern enum lttng_error_code lttng_register_trigger_with_name( * * Returns an LTTng status code. */ -LTTNG_EXPORT extern enum lttng_error_code lttng_register_trigger_with_automatic_name( - struct lttng_trigger *trigger); +LTTNG_EXPORT extern enum lttng_error_code +lttng_register_trigger_with_automatic_name(struct lttng_trigger *trigger); /* * Unregister a trigger from the session daemon. @@ -177,8 +176,7 @@ LTTNG_EXPORT extern int lttng_unregister_trigger(const struct lttng_trigger *tri * * Returns LTTNG_OK on success, else a suitable LTTng error code. */ -LTTNG_EXPORT extern enum lttng_error_code lttng_list_triggers( - struct lttng_triggers **triggers); +LTTNG_EXPORT extern enum lttng_error_code lttng_list_triggers(struct lttng_triggers **triggers); /* * Get a trigger from the set at a given index. @@ -189,8 +187,8 @@ LTTNG_EXPORT extern enum lttng_error_code lttng_list_triggers( * * Returns a trigger, or NULL on error. */ -LTTNG_EXPORT extern const struct lttng_trigger *lttng_triggers_get_at_index( - const struct lttng_triggers *triggers, unsigned int index); +LTTNG_EXPORT extern const struct lttng_trigger * +lttng_triggers_get_at_index(const struct lttng_triggers *triggers, unsigned int index); /* * Get the number of triggers in a trigger set. @@ -198,8 +196,8 @@ LTTNG_EXPORT extern const struct lttng_trigger *lttng_triggers_get_at_index( * Return LTTNG_TRIGGER_STATUS_OK on success, * LTTNG_TRIGGER_STATUS_INVALID when invalid parameters are passed. */ -LTTNG_EXPORT extern enum lttng_trigger_status lttng_triggers_get_count( - const struct lttng_triggers *triggers, unsigned int *count); +LTTNG_EXPORT extern enum lttng_trigger_status +lttng_triggers_get_count(const struct lttng_triggers *triggers, unsigned int *count); /* * Destroy a trigger set. diff --git a/include/lttng/userspace-probe-internal.hpp b/include/lttng/userspace-probe-internal.hpp index f4e6ee74e..016aeb1c6 100644 --- a/include/lttng/userspace-probe-internal.hpp +++ b/include/lttng/userspace-probe-internal.hpp @@ -125,39 +125,35 @@ struct lttng_userspace_probe_location_tracepoint { struct fd_handle *binary_fd_handle; }; -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 lttng_userspace_probe_location_create_from_payload( - struct lttng_payload_view *view, - struct lttng_userspace_probe_location **probe_location); + struct lttng_payload_view *view, struct lttng_userspace_probe_location **probe_location); /* * Returns a version of the location that is serialized to a contiguous region * of memory. Pass NULL to buffer to only get the storage requirement of the * flattened userspace probe location. */ -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); -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); 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 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); -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); -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); #endif /* LTTNG_USERSPACE_PROBE_INTERNAL_H */ diff --git a/include/lttng/userspace-probe.h b/include/lttng/userspace-probe.h index b6fc13508..7de667efc 100644 --- a/include/lttng/userspace-probe.h +++ b/include/lttng/userspace-probe.h @@ -21,10 +21,10 @@ extern "C" { struct lttng_userspace_probe_location_lookup_method; enum lttng_userspace_probe_location_lookup_method_type { - LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_UNKNOWN = -1, - LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT = 0, - LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF = 1, - LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT = 2, + LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_UNKNOWN = -1, + LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT = 0, + LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF = 1, + LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT = 2, }; /* @@ -32,13 +32,13 @@ enum lttng_userspace_probe_location_lookup_method_type { */ LTTNG_EXPORT extern 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); /* * Destroy a lookup method. */ LTTNG_EXPORT extern 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); /* * Create a tracepoint ELF function lookup method struct. @@ -54,7 +54,6 @@ lttng_userspace_probe_location_lookup_method_function_elf_create(void); LTTNG_EXPORT extern struct lttng_userspace_probe_location_lookup_method * lttng_userspace_probe_location_lookup_method_tracepoint_sdt_create(void); - /* * Contains all the information needed to compute the instrumentation point in * the binary. It is used in conjonction with a lookup method. @@ -62,32 +61,30 @@ lttng_userspace_probe_location_lookup_method_tracepoint_sdt_create(void); struct lttng_userspace_probe_location; enum lttng_userspace_probe_location_status { - LTTNG_USERSPACE_PROBE_LOCATION_STATUS_OK = 0, + LTTNG_USERSPACE_PROBE_LOCATION_STATUS_OK = 0, /* Invalid parameters provided. */ - LTTNG_USERSPACE_PROBE_LOCATION_STATUS_INVALID = -1, + LTTNG_USERSPACE_PROBE_LOCATION_STATUS_INVALID = -1, }; enum lttng_userspace_probe_location_type { - LTTNG_USERSPACE_PROBE_LOCATION_TYPE_UNKNOWN = -1, + LTTNG_USERSPACE_PROBE_LOCATION_TYPE_UNKNOWN = -1, /* Function. */ - LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION = 0, + LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION = 0, /* SDT probe's callsites. */ - LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT = 1, + LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT = 1, }; /* * Get the type of the userspace probe location. */ LTTNG_EXPORT extern enum lttng_userspace_probe_location_type -lttng_userspace_probe_location_get_type( - const struct lttng_userspace_probe_location *location); +lttng_userspace_probe_location_get_type(const struct lttng_userspace_probe_location *location); /* * Destroy the userspace probe location. */ -LTTNG_EXPORT extern void lttng_userspace_probe_location_destroy( - struct lttng_userspace_probe_location *location); - +LTTNG_EXPORT extern void +lttng_userspace_probe_location_destroy(struct lttng_userspace_probe_location *location); enum lttng_userspace_probe_location_function_instrumentation_type { LTTNG_USERSPACE_PROBE_LOCATION_FUNCTION_INSTRUMENTATION_TYPE_UNKNOWN = -1, @@ -104,35 +101,36 @@ enum lttng_userspace_probe_location_function_instrumentation_type { * location. */ LTTNG_EXPORT extern 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); +lttng_userspace_probe_location_function_create( + const char *binary_path, + const char *function_name, + struct lttng_userspace_probe_location_lookup_method *lookup_method); /* * Get the target binary path of the probe location of the function type. */ LTTNG_EXPORT extern const char *lttng_userspace_probe_location_function_get_binary_path( - const struct lttng_userspace_probe_location *location); + const struct lttng_userspace_probe_location *location); /* * Get the target function type of the probe location of the function type. */ LTTNG_EXPORT extern const char *lttng_userspace_probe_location_function_get_function_name( - const struct lttng_userspace_probe_location *location); + const struct lttng_userspace_probe_location *location); /* * Get the FD to the target binary file to the probe location of the function * type. The FD is only valid for the duration of the lifetime of `location`. */ LTTNG_EXPORT extern int lttng_userspace_probe_location_function_get_binary_fd( - const struct lttng_userspace_probe_location *location); + const struct lttng_userspace_probe_location *location); /* * Get the instrumentation type of the function probe location. */ LTTNG_EXPORT extern 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); /* * Get the instrumentation type of the function probe location. @@ -145,8 +143,8 @@ lttng_userspace_probe_location_function_get_instrumentation_type( */ LTTNG_EXPORT extern 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); /* * Get the lookup method of the given userspace probe location. @@ -156,7 +154,7 @@ lttng_userspace_probe_location_function_set_instrumentation_type( */ LTTNG_EXPORT extern 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); /* * Create a probe location of the tracepoint type. @@ -168,35 +166,37 @@ lttng_userspace_probe_location_get_lookup_method( * location. */ LTTNG_EXPORT extern struct lttng_userspace_probe_location * -lttng_userspace_probe_location_tracepoint_create(const char *binary_path, - const char *probe_name, const char *provider_name, - struct lttng_userspace_probe_location_lookup_method *lookup_method); +lttng_userspace_probe_location_tracepoint_create( + const char *binary_path, + const char *probe_name, + const char *provider_name, + struct lttng_userspace_probe_location_lookup_method *lookup_method); /* * Get the target binary path of the probe location of the tracepoint type. */ LTTNG_EXPORT extern const char *lttng_userspace_probe_location_tracepoint_get_binary_path( - const struct lttng_userspace_probe_location *location); + const struct lttng_userspace_probe_location *location); /* * Get the target probe name of the probe location of the tracepoint type. */ LTTNG_EXPORT extern const char *lttng_userspace_probe_location_tracepoint_get_probe_name( - const struct lttng_userspace_probe_location *location); + const struct lttng_userspace_probe_location *location); /* * Get the target probe provider name of the probe location of the tracepoint * type. */ LTTNG_EXPORT extern const char *lttng_userspace_probe_location_tracepoint_get_provider_name( - const struct lttng_userspace_probe_location *location); + const struct lttng_userspace_probe_location *location); /* * Get the FD to the target binary file to the probe location of the tracepoint * type. The FD is only valid for the duration of the lifetime of `location`. */ LTTNG_EXPORT extern int lttng_userspace_probe_location_tracepoint_get_binary_fd( - const struct lttng_userspace_probe_location *location); + const struct lttng_userspace_probe_location *location); #ifdef __cplusplus } diff --git a/src/bin/lttng-consumerd/health-consumerd.hpp b/src/bin/lttng-consumerd/health-consumerd.hpp index 4e3bf8686..109ccb4c4 100644 --- a/src/bin/lttng-consumerd/health-consumerd.hpp +++ b/src/bin/lttng-consumerd/health-consumerd.hpp @@ -11,11 +11,11 @@ #include enum health_type_consumerd { - HEALTH_CONSUMERD_TYPE_CHANNEL = 0, - HEALTH_CONSUMERD_TYPE_METADATA = 1, - HEALTH_CONSUMERD_TYPE_DATA = 2, - HEALTH_CONSUMERD_TYPE_SESSIOND = 3, - HEALTH_CONSUMERD_TYPE_METADATA_TIMER = 4, + HEALTH_CONSUMERD_TYPE_CHANNEL = 0, + HEALTH_CONSUMERD_TYPE_METADATA = 1, + HEALTH_CONSUMERD_TYPE_DATA = 2, + HEALTH_CONSUMERD_TYPE_SESSIOND = 3, + HEALTH_CONSUMERD_TYPE_METADATA_TIMER = 4, NR_HEALTH_CONSUMERD_TYPES, }; diff --git a/src/bin/lttng-consumerd/lttng-consumerd.hpp b/src/bin/lttng-consumerd/lttng-consumerd.hpp index ab736d55b..f21d5abba 100644 --- a/src/bin/lttng-consumerd/lttng-consumerd.hpp +++ b/src/bin/lttng-consumerd/lttng-consumerd.hpp @@ -11,7 +11,7 @@ #include -#define NR_LTTNG_CONSUMER_READY 1 +#define NR_LTTNG_CONSUMER_READY 1 extern int lttng_consumer_ready; extern const char *tracing_group_name; @@ -21,7 +21,6 @@ extern const char *tracing_group_name; * have a C linkage name makes it easier, as it avoids having to look up a * mangled name. */ -extern "C" LTTNG_EXPORT -enum lttng_consumer_type lttng_consumer_get_type(); +extern "C" LTTNG_EXPORT enum lttng_consumer_type lttng_consumer_get_type(); #endif /* _LTTNG_CONSUMERD_H */ diff --git a/src/bin/lttng-relayd/backward-compatibility-group-by.hpp b/src/bin/lttng-relayd/backward-compatibility-group-by.hpp index 4cf7462de..fef6bd0ab 100644 --- a/src/bin/lttng-relayd/backward-compatibility-group-by.hpp +++ b/src/bin/lttng-relayd/backward-compatibility-group-by.hpp @@ -11,7 +11,7 @@ #include char *backward_compat_group_by_session(const char *path, - const char *local_session_name, - time_t session_creation_time); + const char *local_session_name, + time_t session_creation_time); #endif /* BACKWARD_COMPATIBILITY_GROUP_BY_H */ diff --git a/src/bin/lttng-relayd/cmd-2-1.hpp b/src/bin/lttng-relayd/cmd-2-1.hpp index 147069b6b..5dc0bd370 100644 --- a/src/bin/lttng-relayd/cmd-2-1.hpp +++ b/src/bin/lttng-relayd/cmd-2-1.hpp @@ -11,9 +11,11 @@ */ #include "lttng-relayd.hpp" + #include int cmd_recv_stream_2_1(const struct lttng_buffer_view *payload, - char **path_name, char **channel_name); + char **path_name, + char **channel_name); #endif /* RELAYD_CMD_2_1_H */ diff --git a/src/bin/lttng-relayd/cmd-2-11.hpp b/src/bin/lttng-relayd/cmd-2-11.hpp index 79f241aaa..97565df5b 100644 --- a/src/bin/lttng-relayd/cmd-2-11.hpp +++ b/src/bin/lttng-relayd/cmd-2-11.hpp @@ -9,20 +9,28 @@ #define RELAYD_CMD_2_11_H #include "lttng-relayd.hpp" + #include #include 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 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); #endif /* RELAYD_CMD_2_11_H */ diff --git a/src/bin/lttng-relayd/cmd-2-2.hpp b/src/bin/lttng-relayd/cmd-2-2.hpp index 010bbb127..4686949be 100644 --- a/src/bin/lttng-relayd/cmd-2-2.hpp +++ b/src/bin/lttng-relayd/cmd-2-2.hpp @@ -11,10 +11,13 @@ */ #include "lttng-relayd.hpp" + #include int cmd_recv_stream_2_2(const struct lttng_buffer_view *payload, - char **path_name, char **channel_name, - uint64_t *tracefile_size, uint64_t *tracefile_count); + char **path_name, + char **channel_name, + uint64_t *tracefile_size, + uint64_t *tracefile_count); #endif /* RELAYD_CMD_2_2_H */ diff --git a/src/bin/lttng-relayd/cmd-2-4.hpp b/src/bin/lttng-relayd/cmd-2-4.hpp index b3d105c84..98a6dabcc 100644 --- a/src/bin/lttng-relayd/cmd-2-4.hpp +++ b/src/bin/lttng-relayd/cmd-2-4.hpp @@ -11,10 +11,13 @@ */ #include "lttng-relayd.hpp" + #include 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); #endif /* RELAYD_CMD_2_4_H */ diff --git a/src/bin/lttng-relayd/cmd.hpp b/src/bin/lttng-relayd/cmd.hpp index 24e361a4b..351527c09 100644 --- a/src/bin/lttng-relayd/cmd.hpp +++ b/src/bin/lttng-relayd/cmd.hpp @@ -11,8 +11,8 @@ */ #include "cmd-2-1.hpp" +#include "cmd-2-11.hpp" #include "cmd-2-2.hpp" #include "cmd-2-4.hpp" -#include "cmd-2-11.hpp" #endif /* RELAYD_CMD_H */ diff --git a/src/bin/lttng-relayd/connection.hpp b/src/bin/lttng-relayd/connection.hpp index de25255a7..917c2ef60 100644 --- a/src/bin/lttng-relayd/connection.hpp +++ b/src/bin/lttng-relayd/connection.hpp @@ -10,26 +10,26 @@ * */ -#include -#include -#include -#include -#include -#include +#include "session.hpp" +#include #include -#include #include -#include +#include -#include "session.hpp" +#include +#include +#include +#include +#include +#include enum connection_type { - RELAY_CONNECTION_UNKNOWN = 0, - RELAY_DATA = 1, - RELAY_CONTROL = 2, - RELAY_VIEWER_COMMAND = 3, - RELAY_VIEWER_NOTIFICATION = 4, + RELAY_CONNECTION_UNKNOWN = 0, + RELAY_DATA = 1, + RELAY_CONTROL = 2, + RELAY_VIEWER_COMMAND = 3, + RELAY_VIEWER_NOTIFICATION = 4, }; enum data_connection_state { @@ -107,8 +107,8 @@ struct relay_connection { */ struct lttng_ht_node_ulong sock_n; bool in_socket_ht; - struct lttng_ht *socket_ht; /* HACK: Contained within this hash table. */ - struct rcu_head rcu_node; /* For call_rcu teardown. */ + struct lttng_ht *socket_ht; /* HACK: Contained within this hash table. */ + struct rcu_head rcu_node; /* For call_rcu teardown. */ union { struct { @@ -129,16 +129,12 @@ struct relay_connection { } protocol; }; -struct relay_connection *connection_create(struct lttcomm_sock *sock, - enum connection_type type); -struct relay_connection *connection_get_by_sock(struct lttng_ht *relay_connections_ht, - int sock); +struct relay_connection *connection_create(struct lttcomm_sock *sock, enum connection_type type); +struct relay_connection *connection_get_by_sock(struct lttng_ht *relay_connections_ht, int sock); int connection_reset_protocol_state(struct relay_connection *connection); bool connection_get(struct relay_connection *connection); void connection_put(struct relay_connection *connection); -void connection_ht_add(struct lttng_ht *relay_connections_ht, - struct relay_connection *conn); -int connection_set_session(struct relay_connection *conn, - struct relay_session *session); +void connection_ht_add(struct lttng_ht *relay_connections_ht, struct relay_connection *conn); +int connection_set_session(struct relay_connection *conn, struct relay_session *session); #endif /* _CONNECTION_H */ diff --git a/src/bin/lttng-relayd/ctf-trace.hpp b/src/bin/lttng-relayd/ctf-trace.hpp index dbf7d3fa2..3d9026da8 100644 --- a/src/bin/lttng-relayd/ctf-trace.hpp +++ b/src/bin/lttng-relayd/ctf-trace.hpp @@ -10,18 +10,18 @@ * */ -#include -#include - -#include - #include "session.hpp" #include "stream.hpp" #include "viewer-stream.hpp" +#include + +#include +#include + struct ctf_trace { - struct urcu_ref ref; /* Every stream has a ref on the trace. */ - struct relay_session *session; /* Back ref to trace session */ + struct urcu_ref ref; /* Every stream has a ref on the trace. */ + struct relay_session *session; /* Back ref to trace session */ /* Trace sub-folder relative to the session output path. */ char *path; @@ -31,7 +31,7 @@ struct ctf_trace { */ pthread_mutex_t lock; uint64_t id; - struct relay_viewer_stream *viewer_metadata_stream; /* RCU protected */ + struct relay_viewer_stream *viewer_metadata_stream; /* RCU protected */ /* * Relay streams associated with this ctf trace. @@ -46,7 +46,7 @@ struct ctf_trace { * stream path name. */ struct lttng_ht_node_str node; - struct rcu_head rcu_node; /* For call_rcu teardown. */ + struct rcu_head rcu_node; /* For call_rcu teardown. */ /* * True if the metadata stream of this trace was sent the viewer in the @@ -56,7 +56,7 @@ struct ctf_trace { }; struct ctf_trace *ctf_trace_get_by_path_or_create(struct relay_session *session, - const char *subpath); + const char *subpath); bool ctf_trace_get(struct ctf_trace *trace); void ctf_trace_put(struct ctf_trace *trace); diff --git a/src/bin/lttng-relayd/health-relayd.hpp b/src/bin/lttng-relayd/health-relayd.hpp index 7d885c672..2e4170848 100644 --- a/src/bin/lttng-relayd/health-relayd.hpp +++ b/src/bin/lttng-relayd/health-relayd.hpp @@ -9,18 +9,19 @@ * */ -#include #include -#define LTTNG_RELAYD_HEALTH_ENV "LTTNG_RELAYD_HEALTH" +#include + +#define LTTNG_RELAYD_HEALTH_ENV "LTTNG_RELAYD_HEALTH" enum health_type_relayd { - HEALTH_RELAYD_TYPE_DISPATCHER = 0, - HEALTH_RELAYD_TYPE_WORKER = 1, - HEALTH_RELAYD_TYPE_LISTENER = 2, - HEALTH_RELAYD_TYPE_LIVE_DISPATCHER = 3, - HEALTH_RELAYD_TYPE_LIVE_WORKER = 4, - HEALTH_RELAYD_TYPE_LIVE_LISTENER = 5, + HEALTH_RELAYD_TYPE_DISPATCHER = 0, + HEALTH_RELAYD_TYPE_WORKER = 1, + HEALTH_RELAYD_TYPE_LISTENER = 2, + HEALTH_RELAYD_TYPE_LIVE_DISPATCHER = 3, + HEALTH_RELAYD_TYPE_LIVE_WORKER = 4, + HEALTH_RELAYD_TYPE_LIVE_LISTENER = 5, NR_HEALTH_RELAYD_TYPES, }; diff --git a/src/bin/lttng-relayd/index.hpp b/src/bin/lttng-relayd/index.hpp index cb29485eb..8ba88c992 100644 --- a/src/bin/lttng-relayd/index.hpp +++ b/src/bin/lttng-relayd/index.hpp @@ -10,12 +10,12 @@ * */ -#include -#include - #include #include +#include +#include + struct relay_stream; struct relay_connection; struct lttcomm_relayd_index; @@ -24,8 +24,8 @@ struct relay_index { /* * index lock nests inside stream lock. */ - struct urcu_ref ref; /* Reference from getters. */ - struct relay_stream *stream; /* Back ref to stream */ + struct urcu_ref ref; /* Reference from getters. */ + struct relay_stream *stream; /* Back ref to stream */ pthread_mutex_t lock; /* @@ -49,17 +49,16 @@ struct relay_index { * index across the stream. */ struct lttng_ht_node_u64 index_n; - struct rcu_head rcu_node; /* For call_rcu teardown. */ + struct rcu_head rcu_node; /* For call_rcu teardown. */ }; struct relay_index *relay_index_get_by_id_or_create(struct relay_stream *stream, - uint64_t net_seq_num); + uint64_t net_seq_num); void relay_index_put(struct relay_index *index); int relay_index_set_file(struct relay_index *index, - struct lttng_index_file *index_file, - uint64_t data_offset); -int relay_index_set_data(struct relay_index *index, - const struct ctf_packet_index *data); + struct lttng_index_file *index_file, + uint64_t data_offset); +int relay_index_set_data(struct relay_index *index, const struct ctf_packet_index *data); int relay_index_try_flush(struct relay_index *index); void relay_index_close_all(struct relay_stream *stream); @@ -67,7 +66,7 @@ void relay_index_close_partial_fd(struct relay_stream *stream); uint64_t relay_index_find_last(struct relay_stream *stream); int relay_index_switch_all_files(struct relay_stream *stream); 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); #endif /* _RELAY_INDEX_H */ diff --git a/src/bin/lttng-relayd/live.hpp b/src/bin/lttng-relayd/live.hpp index d1866d3f5..67fb58a14 100644 --- a/src/bin/lttng-relayd/live.hpp +++ b/src/bin/lttng-relayd/live.hpp @@ -10,10 +10,10 @@ * */ -#include - #include "lttng-relayd.hpp" +#include + int relayd_live_create(struct lttng_uri *live_uri); int relayd_live_stop(void); int relayd_live_join(void); diff --git a/src/bin/lttng-relayd/lttng-relayd.hpp b/src/bin/lttng-relayd/lttng-relayd.hpp index 32911f09c..ac7d0c691 100644 --- a/src/bin/lttng-relayd/lttng-relayd.hpp +++ b/src/bin/lttng-relayd/lttng-relayd.hpp @@ -10,14 +10,14 @@ * */ +#include +#include +#include + #include #include #include -#include -#include -#include - struct sessiond_trace_chunk_registry; /* @@ -47,7 +47,7 @@ extern struct sessiond_trace_chunk_registry *sessiond_trace_chunk_registry; extern char *opt_output_path; extern const char *tracing_group_name; -extern const char * const config_section_name; +extern const char *const config_section_name; extern enum relay_group_output_by opt_group_output_by; extern struct fd_tracker *the_fd_tracker; @@ -60,7 +60,6 @@ int relayd_notify_thread_quit_pipe(void); void relayd_close_thread_quit_pipe(void); bool relayd_is_thread_quit_pipe(const int fd); -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); #endif /* LTTNG_RELAYD_H */ diff --git a/src/bin/lttng-relayd/lttng-viewer-abi.hpp b/src/bin/lttng-relayd/lttng-viewer-abi.hpp index 6fdb7fa60..393fb6f28 100644 --- a/src/bin/lttng-relayd/lttng-viewer-abi.hpp +++ b/src/bin/lttng-relayd/lttng-viewer-abi.hpp @@ -10,92 +10,93 @@ * */ -#include #include -#define LTTNG_VIEWER_PATH_MAX 4096 -#define LTTNG_VIEWER_NAME_MAX 255 -#define LTTNG_VIEWER_HOST_NAME_MAX 64 +#include + +#define LTTNG_VIEWER_PATH_MAX 4096 +#define LTTNG_VIEWER_NAME_MAX 255 +#define LTTNG_VIEWER_HOST_NAME_MAX 64 /* Flags in reply to get_next_index and get_packet. */ enum { /* New metadata is required to read this packet. */ - LTTNG_VIEWER_FLAG_NEW_METADATA = (1 << 0), + LTTNG_VIEWER_FLAG_NEW_METADATA = (1 << 0), /* New stream got added to the trace. */ - LTTNG_VIEWER_FLAG_NEW_STREAM = (1 << 1), + LTTNG_VIEWER_FLAG_NEW_STREAM = (1 << 1), }; enum lttng_viewer_command { - LTTNG_VIEWER_CONNECT = 1, - LTTNG_VIEWER_LIST_SESSIONS = 2, - LTTNG_VIEWER_ATTACH_SESSION = 3, - LTTNG_VIEWER_GET_NEXT_INDEX = 4, - LTTNG_VIEWER_GET_PACKET = 5, - LTTNG_VIEWER_GET_METADATA = 6, - LTTNG_VIEWER_GET_NEW_STREAMS = 7, - LTTNG_VIEWER_CREATE_SESSION = 8, - LTTNG_VIEWER_DETACH_SESSION = 9, + LTTNG_VIEWER_CONNECT = 1, + LTTNG_VIEWER_LIST_SESSIONS = 2, + LTTNG_VIEWER_ATTACH_SESSION = 3, + LTTNG_VIEWER_GET_NEXT_INDEX = 4, + LTTNG_VIEWER_GET_PACKET = 5, + LTTNG_VIEWER_GET_METADATA = 6, + LTTNG_VIEWER_GET_NEW_STREAMS = 7, + LTTNG_VIEWER_CREATE_SESSION = 8, + LTTNG_VIEWER_DETACH_SESSION = 9, }; enum lttng_viewer_attach_return_code { - LTTNG_VIEWER_ATTACH_OK = 1, /* The attach command succeeded. */ - LTTNG_VIEWER_ATTACH_ALREADY = 2, /* A viewer is already attached. */ - LTTNG_VIEWER_ATTACH_UNK = 3, /* The session ID is unknown. */ - LTTNG_VIEWER_ATTACH_NOT_LIVE = 4, /* The session is not live. */ - LTTNG_VIEWER_ATTACH_SEEK_ERR = 5, /* Seek error. */ - LTTNG_VIEWER_ATTACH_NO_SESSION = 6, /* No viewer session created. */ + LTTNG_VIEWER_ATTACH_OK = 1, /* The attach command succeeded. */ + LTTNG_VIEWER_ATTACH_ALREADY = 2, /* A viewer is already attached. */ + LTTNG_VIEWER_ATTACH_UNK = 3, /* The session ID is unknown. */ + LTTNG_VIEWER_ATTACH_NOT_LIVE = 4, /* The session is not live. */ + LTTNG_VIEWER_ATTACH_SEEK_ERR = 5, /* Seek error. */ + LTTNG_VIEWER_ATTACH_NO_SESSION = 6, /* No viewer session created. */ }; enum lttng_viewer_next_index_return_code { - LTTNG_VIEWER_INDEX_OK = 1, /* Index is available. */ - LTTNG_VIEWER_INDEX_RETRY = 2, /* Index not yet available. */ - LTTNG_VIEWER_INDEX_HUP = 3, /* Index closed (trace destroyed). */ - LTTNG_VIEWER_INDEX_ERR = 4, /* Unknow error. */ - LTTNG_VIEWER_INDEX_INACTIVE = 5, /* Inactive stream beacon. */ - LTTNG_VIEWER_INDEX_EOF = 6, /* End of index file. */ + LTTNG_VIEWER_INDEX_OK = 1, /* Index is available. */ + LTTNG_VIEWER_INDEX_RETRY = 2, /* Index not yet available. */ + LTTNG_VIEWER_INDEX_HUP = 3, /* Index closed (trace destroyed). */ + LTTNG_VIEWER_INDEX_ERR = 4, /* Unknow error. */ + LTTNG_VIEWER_INDEX_INACTIVE = 5, /* Inactive stream beacon. */ + LTTNG_VIEWER_INDEX_EOF = 6, /* End of index file. */ }; enum lttng_viewer_get_packet_return_code { - LTTNG_VIEWER_GET_PACKET_OK = 1, - LTTNG_VIEWER_GET_PACKET_RETRY = 2, - LTTNG_VIEWER_GET_PACKET_ERR = 3, - LTTNG_VIEWER_GET_PACKET_EOF = 4, + LTTNG_VIEWER_GET_PACKET_OK = 1, + LTTNG_VIEWER_GET_PACKET_RETRY = 2, + LTTNG_VIEWER_GET_PACKET_ERR = 3, + LTTNG_VIEWER_GET_PACKET_EOF = 4, }; enum lttng_viewer_get_metadata_return_code { - LTTNG_VIEWER_METADATA_OK = 1, - LTTNG_VIEWER_NO_NEW_METADATA = 2, - LTTNG_VIEWER_METADATA_ERR = 3, + LTTNG_VIEWER_METADATA_OK = 1, + LTTNG_VIEWER_NO_NEW_METADATA = 2, + LTTNG_VIEWER_METADATA_ERR = 3, }; enum lttng_viewer_connection_type { - LTTNG_VIEWER_CLIENT_COMMAND = 1, - LTTNG_VIEWER_CLIENT_NOTIFICATION = 2, + LTTNG_VIEWER_CLIENT_COMMAND = 1, + LTTNG_VIEWER_CLIENT_NOTIFICATION = 2, }; enum lttng_viewer_seek { /* Receive the trace packets from the beginning. */ - LTTNG_VIEWER_SEEK_BEGINNING = 1, + LTTNG_VIEWER_SEEK_BEGINNING = 1, /* Receive the trace packets from now. */ - LTTNG_VIEWER_SEEK_LAST = 2, + LTTNG_VIEWER_SEEK_LAST = 2, }; enum lttng_viewer_new_streams_return_code { - LTTNG_VIEWER_NEW_STREAMS_OK = 1, /* If new streams are being sent. */ - LTTNG_VIEWER_NEW_STREAMS_NO_NEW = 2, /* If no new streams are available. */ - LTTNG_VIEWER_NEW_STREAMS_ERR = 3, /* Error. */ - LTTNG_VIEWER_NEW_STREAMS_HUP = 4, /* Session closed. */ + LTTNG_VIEWER_NEW_STREAMS_OK = 1, /* If new streams are being sent. */ + LTTNG_VIEWER_NEW_STREAMS_NO_NEW = 2, /* If no new streams are available. */ + LTTNG_VIEWER_NEW_STREAMS_ERR = 3, /* Error. */ + LTTNG_VIEWER_NEW_STREAMS_HUP = 4, /* Session closed. */ }; enum lttng_viewer_create_session_return_code { - LTTNG_VIEWER_CREATE_SESSION_OK = 1, - LTTNG_VIEWER_CREATE_SESSION_ERR = 2, + LTTNG_VIEWER_CREATE_SESSION_OK = 1, + LTTNG_VIEWER_CREATE_SESSION_ERR = 2, }; enum lttng_viewer_detach_session_return_code { - LTTNG_VIEWER_DETACH_SESSION_OK = 1, - LTTNG_VIEWER_DETACH_SESSION_UNK = 2, - LTTNG_VIEWER_DETACH_SESSION_ERR = 3, + LTTNG_VIEWER_DETACH_SESSION_OK = 1, + LTTNG_VIEWER_DETACH_SESSION_UNK = 2, + LTTNG_VIEWER_DETACH_SESSION_ERR = 3, }; struct lttng_viewer_session { @@ -116,9 +117,9 @@ struct lttng_viewer_stream { } LTTNG_PACKED; struct lttng_viewer_cmd { - uint64_t data_size; /* data size following this header */ - uint32_t cmd; /* enum lttcomm_relayd_command */ - uint32_t cmd_version; /* command version */ + uint64_t data_size; /* data size following this header */ + uint32_t cmd; /* enum lttcomm_relayd_command */ + uint32_t cmd_version; /* command version */ } LTTNG_PACKED; /* @@ -129,7 +130,7 @@ struct lttng_viewer_connect { uint64_t viewer_session_id; uint32_t major; uint32_t minor; - uint32_t type; /* enum lttng_viewer_connection_type */ + uint32_t type; /* enum lttng_viewer_connection_type */ } LTTNG_PACKED; /* @@ -137,7 +138,7 @@ struct lttng_viewer_connect { */ struct lttng_viewer_list_sessions { uint32_t sessions_count; - char session_list[]; /* struct lttng_viewer_session */ + char session_list[]; /* struct lttng_viewer_session */ } LTTNG_PACKED; /* @@ -145,8 +146,8 @@ struct lttng_viewer_list_sessions { */ struct lttng_viewer_attach_session_request { uint64_t session_id; - uint64_t offset; /* unused for now */ - uint32_t seek; /* enum lttng_viewer_seek */ + uint64_t offset; /* unused for now */ + uint32_t seek; /* enum lttng_viewer_seek */ } LTTNG_PACKED; struct lttng_viewer_attach_session_response { @@ -162,7 +163,7 @@ struct lttng_viewer_attach_session_response { */ struct lttng_viewer_get_next_index { uint64_t stream_id; -} __attribute__ ((__packed__)); +} __attribute__((__packed__)); struct lttng_viewer_index { uint64_t offset; @@ -172,9 +173,9 @@ struct lttng_viewer_index { uint64_t timestamp_end; uint64_t events_discarded; uint64_t stream_id; - uint32_t status; /* enum lttng_viewer_next_index_return_code */ - uint32_t flags; /* LTTNG_VIEWER_FLAG_* */ -} __attribute__ ((__packed__)); + uint32_t status; /* enum lttng_viewer_next_index_return_code */ + uint32_t flags; /* LTTNG_VIEWER_FLAG_* */ +} __attribute__((__packed__)); /* * LTTNG_VIEWER_GET_PACKET payload. @@ -186,9 +187,9 @@ struct lttng_viewer_get_packet { } LTTNG_PACKED; struct lttng_viewer_trace_packet { - uint32_t status; /* enum lttng_viewer_get_packet_return_code */ + uint32_t status; /* enum lttng_viewer_get_packet_return_code */ uint32_t len; - uint32_t flags; /* LTTNG_VIEWER_FLAG_* */ + uint32_t flags; /* LTTNG_VIEWER_FLAG_* */ char data[]; } LTTNG_PACKED; @@ -201,7 +202,7 @@ struct lttng_viewer_get_metadata { struct lttng_viewer_metadata_packet { uint64_t len; - uint32_t status; /* enum lttng_viewer_get_metadata_return_code */ + uint32_t status; /* enum lttng_viewer_get_metadata_return_code */ char data[]; } LTTNG_PACKED; diff --git a/src/bin/lttng-relayd/main.cpp b/src/bin/lttng-relayd/main.cpp index e3eb9d72e..1de1f1853 100644 --- a/src/bin/lttng-relayd/main.cpp +++ b/src/bin/lttng-relayd/main.cpp @@ -1321,12 +1321,13 @@ static void *relay_thread_dispatcher(void *data __attribute__((unused))) * the data will be read at some point in time * or wait to the end of the world :) */ - ret = lttng_write(relay_conn_pipe[1], &new_conn, sizeof(new_conn)); /* NOLINT - sizeof - used - on a - pointer. - */ + ret = lttng_write( + relay_conn_pipe[1], &new_conn, sizeof(new_conn)); /* NOLINT + sizeof + used + on a + pointer. + */ if (ret < 0) { PERROR("write connection pipe"); connection_put(new_conn); diff --git a/src/bin/lttng-relayd/session.hpp b/src/bin/lttng-relayd/session.hpp index 986eca68f..b50c68526 100644 --- a/src/bin/lttng-relayd/session.hpp +++ b/src/bin/lttng-relayd/session.hpp @@ -10,18 +10,19 @@ * */ -#include +#include +#include +#include +#include + +#include + #include +#include #include #include #include -#include -#include -#include -#include -#include - /* * Represents a session for the relay point of view */ @@ -107,7 +108,7 @@ struct relay_session { * Traversals are protected by RCU. * recv_list_lock also protects stream_count. */ - struct cds_list_head recv_list; /* RCU list. */ + struct cds_list_head recv_list; /* RCU list. */ uint32_t stream_count; pthread_mutex_t recv_list_lock; @@ -135,20 +136,21 @@ struct relay_session { */ bool ongoing_rotation; struct lttng_directory_handle *output_directory; - struct rcu_head rcu_node; /* For call_rcu teardown. */ + struct rcu_head rcu_node; /* For call_rcu teardown. */ }; 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_timestamp); + 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_timestamp); struct relay_session *session_get_by_id(uint64_t id); bool session_get(struct relay_session *session); void session_put(struct relay_session *session); diff --git a/src/bin/lttng-relayd/sessiond-trace-chunks.hpp b/src/bin/lttng-relayd/sessiond-trace-chunks.hpp index 4d5759d87..c290f9d0f 100644 --- a/src/bin/lttng-relayd/sessiond-trace-chunks.hpp +++ b/src/bin/lttng-relayd/sessiond-trace-chunks.hpp @@ -8,8 +8,9 @@ #ifndef SESSIOND_TRACE_CHUNK_REGISTRY_H #define SESSIOND_TRACE_CHUNK_REGISTRY_H -#include #include +#include + #include /* @@ -25,40 +26,38 @@ */ struct sessiond_trace_chunk_registry; -struct sessiond_trace_chunk_registry * -sessiond_trace_chunk_registry_create(void); +struct sessiond_trace_chunk_registry *sessiond_trace_chunk_registry_create(void); -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 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 sessiond_trace_chunk_registry_session_destroyed( - struct sessiond_trace_chunk_registry *sessiond_registry, - const lttng_uuid& sessiond_uuid); - -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 *chunk); + struct sessiond_trace_chunk_registry *sessiond_registry, const lttng_uuid& sessiond_uuid); 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); +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 *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_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); 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); #endif /* SESSIOND_TRACE_CHUNK_REGISTRY_H */ diff --git a/src/bin/lttng-relayd/stream.hpp b/src/bin/lttng-relayd/stream.hpp index 6e09c5571..eee56d38d 100644 --- a/src/bin/lttng-relayd/stream.hpp +++ b/src/bin/lttng-relayd/stream.hpp @@ -10,18 +10,18 @@ * */ -#include -#include -#include -#include +#include "session.hpp" +#include "tracefile-array.hpp" +#include #include -#include #include -#include +#include -#include "session.hpp" -#include "tracefile-array.hpp" +#include +#include +#include +#include struct lttcomm_relayd_index; @@ -118,8 +118,8 @@ struct relay_stream { */ struct tracefile_array *tfa; - bool closed; /* Stream is closed. */ - bool close_requested; /* Close command has been received. */ + bool closed; /* Stream is closed. */ + bool close_requested; /* Close command has been received. */ /* * Counts number of indexes in indexes_ht. Redundant info. @@ -169,8 +169,8 @@ struct relay_stream { * Node of stream within global stream hash table. */ struct lttng_ht_node_u64 node; - bool in_stream_ht; /* is stream in stream hash table. */ - struct rcu_head rcu_node; /* For call_rcu teardown. */ + bool in_stream_ht; /* is stream in stream hash table. */ + struct rcu_head rcu_node; /* For call_rcu teardown. */ /* * The trace chunk to which the file currently being produced (if any) * belongs. @@ -186,33 +186,37 @@ struct relay_stream { }; 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); struct relay_stream *stream_get_by_id(uint64_t stream_id); bool stream_get(struct relay_stream *stream); void stream_put(struct relay_stream *stream); -int stream_rotate_output_files(struct relay_session *session, - struct relay_stream *stream); +int stream_rotate_output_files(struct relay_session *session, 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); void try_stream_close(struct relay_stream *stream); void stream_publish(struct relay_stream *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 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); /* Called after the reception of a complete data packet. */ -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 stream_complete_packet(struct relay_stream *stream, - size_t packet_total_size, uint64_t sequence_number, - bool index_flushed); + size_t packet_total_size, + uint64_t sequence_number, + bool index_flushed); /* Index info is in host endianness. */ -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 stream_reset_file(struct relay_stream *stream); void print_relay_streams(void); diff --git a/src/bin/lttng-relayd/tracefile-array.hpp b/src/bin/lttng-relayd/tracefile-array.hpp index 09c425fad..25b228016 100644 --- a/src/bin/lttng-relayd/tracefile-array.hpp +++ b/src/bin/lttng-relayd/tracefile-array.hpp @@ -8,15 +8,15 @@ * */ -#include #include +#include #include #include struct tracefile { /* Per-tracefile head/tail seq. */ - uint64_t seq_head; /* Newest seqcount. Inclusive. */ - uint64_t seq_tail; /* Oldest seqcount. Inclusive. */ + uint64_t seq_head; /* Newest seqcount. Inclusive. */ + uint64_t seq_tail; /* Oldest seqcount. Inclusive. */ }; enum tracefile_rotate_type { @@ -54,8 +54,7 @@ struct tracefile_array *tracefile_array_create(size_t count); void tracefile_array_destroy(struct tracefile_array *tfa); void tracefile_array_file_rotate(struct tracefile_array *tfa, enum tracefile_rotate_type type); -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); void tracefile_array_reset(struct tracefile_array *tfa); uint64_t tracefile_array_get_read_file_index_head(struct tracefile_array *tfa); @@ -66,7 +65,6 @@ uint64_t tracefile_array_get_file_index_tail(struct tracefile_array *tfa); /* May return -1ULL in the case where we have not received any indexes yet. */ uint64_t tracefile_array_get_seq_tail(struct tracefile_array *tfa); -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); #endif /* _STREAM_H */ diff --git a/src/bin/lttng-relayd/viewer-session.hpp b/src/bin/lttng-relayd/viewer-session.hpp index 65ad3e11a..301b8ffc7 100644 --- a/src/bin/lttng-relayd/viewer-session.hpp +++ b/src/bin/lttng-relayd/viewer-session.hpp @@ -10,17 +10,17 @@ * */ -#include -#include -#include -#include -#include +#include "lttng-viewer-abi.hpp" +#include "session.hpp" #include #include -#include "session.hpp" -#include "lttng-viewer-abi.hpp" +#include +#include +#include +#include +#include struct relay_viewer_session { /* @@ -29,8 +29,8 @@ struct relay_viewer_session { * This list limits the design to having the sessions in at most * one viewer session. */ - struct cds_list_head session_list; /* RCU list. */ - pthread_mutex_t session_list_lock; /* Protects list updates. */ + struct cds_list_head session_list; /* RCU list. */ + pthread_mutex_t session_list_lock; /* Protects list updates. */ /* * The viewer session's current trace chunk is initially set, when * a viewer attaches to the viewer session, to a copy the corresponding @@ -65,14 +65,13 @@ struct relay_viewer_session *viewer_session_create(void); void viewer_session_destroy(struct relay_viewer_session *vsession); void viewer_session_close(struct relay_viewer_session *vsession); -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); int viewer_session_is_attached(struct relay_viewer_session *vsession, - struct relay_session *session); + struct relay_session *session); void viewer_session_close_one_session(struct relay_viewer_session *vsession, - struct relay_session *session); + struct relay_session *session); 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); #endif /* _VIEWER_SESSION_H */ diff --git a/src/bin/lttng-relayd/viewer-stream.hpp b/src/bin/lttng-relayd/viewer-stream.hpp index 42bdc1e20..2886420f4 100644 --- a/src/bin/lttng-relayd/viewer-stream.hpp +++ b/src/bin/lttng-relayd/viewer-stream.hpp @@ -10,16 +10,16 @@ * */ -#include -#include -#include - -#include - #include "ctf-trace.hpp" #include "lttng-viewer-abi.hpp" #include "stream.hpp" +#include + +#include +#include +#include + struct relay_stream; /* @@ -78,15 +78,14 @@ struct relay_viewer_stream { }; struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream, - struct lttng_trace_chunk *viewer_trace_chunk, - enum lttng_viewer_seek seek_t); + struct lttng_trace_chunk *viewer_trace_chunk, + enum lttng_viewer_seek seek_t); struct relay_viewer_stream *viewer_stream_get_by_id(uint64_t id); bool viewer_stream_get(struct relay_viewer_stream *vstream); void viewer_stream_put(struct relay_viewer_stream *vstream); int viewer_stream_rotate(struct relay_viewer_stream *vstream); -bool viewer_stream_is_tracefile_seq_readable(struct relay_viewer_stream *vstream, - uint64_t seq); +bool viewer_stream_is_tracefile_seq_readable(struct relay_viewer_stream *vstream, uint64_t seq); void print_viewer_streams(void); void viewer_stream_close_files(struct relay_viewer_stream *vstream); void viewer_stream_sync_tracefile_array_tail(struct relay_viewer_stream *vstream); diff --git a/src/bin/lttng-sessiond/action-executor.hpp b/src/bin/lttng-sessiond/action-executor.hpp index 85d5931fe..4fc874f15 100644 --- a/src/bin/lttng-sessiond/action-executor.hpp +++ b/src/bin/lttng-sessiond/action-executor.hpp @@ -22,8 +22,7 @@ enum action_executor_status { ACTION_EXECUTOR_STATUS_INVALID, }; -struct action_executor *action_executor_create( - struct notification_thread_handle *handle); +struct action_executor *action_executor_create(struct notification_thread_handle *handle); void action_executor_destroy(struct action_executor *executor); @@ -37,11 +36,11 @@ void action_executor_destroy(struct action_executor *executor); * This function assumes the ownership of the `evaluation` both on success and * failure: the caller should no longer access it once the function returns. */ -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 *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 *list); #endif /* ACTION_EXECUTOR_H */ diff --git a/src/bin/lttng-sessiond/agent-thread.hpp b/src/bin/lttng-sessiond/agent-thread.hpp index d84ea6172..86d0a9b88 100644 --- a/src/bin/lttng-sessiond/agent-thread.hpp +++ b/src/bin/lttng-sessiond/agent-thread.hpp @@ -17,14 +17,12 @@ bool agent_tracing_is_enabled(void); #else /* HAVE_LIBLTTNG_UST_CTL */ -static inline -bool launch_agent_management_thread(void) +static inline bool launch_agent_management_thread(void) { return true; } -static inline -bool agent_tracing_is_enabled(void) +static inline bool agent_tracing_is_enabled(void) { return false; } diff --git a/src/bin/lttng-sessiond/agent.hpp b/src/bin/lttng-sessiond/agent.hpp index 2ad42c3f4..388543f66 100644 --- a/src/bin/lttng-sessiond/agent.hpp +++ b/src/bin/lttng-sessiond/agent.hpp @@ -9,14 +9,15 @@ #ifndef LTTNG_SESSIOND_AGENT_H #define LTTNG_SESSIOND_AGENT_H -#include - #include + #include +#include + /* Agent protocol version that is verified during the agent registration. */ -#define AGENT_MAJOR_VERSION 2 -#define AGENT_MINOR_VERSION 0 +#define AGENT_MAJOR_VERSION 2 +#define AGENT_MINOR_VERSION 0 /* * Hash table that contains the agent app created upon registration indexed by @@ -145,32 +146,29 @@ void agent_add(struct agent *agt, struct lttng_ht *ht); /* Agent event API. */ 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); void agent_add_event(struct agent_event *event, struct agent *agt); 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); -void agent_find_events_by_name(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); + enum lttng_loglevel_type loglevel_type, + int loglevel_value, + const char *filter_expression, + struct agent *agt); +void agent_find_events_by_name(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); void agent_delete_event(struct agent_event *event, struct agent *agt); void agent_destroy_event(struct agent_event *event); /* Agent context API.*/ -int agent_enable_context(const struct lttng_event_context *ctx, - enum lttng_domain_type domain); -int agent_add_context(const struct lttng_event_context *ctx, - struct agent *agt); +int agent_enable_context(const struct lttng_event_context *ctx, enum lttng_domain_type domain); +int agent_add_context(const struct lttng_event_context *ctx, struct agent *agt); /* Agent app API. */ -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); void agent_add_app(struct agent_app *app); void agent_delete_app(struct agent_app *app); struct agent_app *agent_find_app_by_sock(int sock); @@ -179,20 +177,16 @@ void agent_destroy_app_by_sock(int sock); int agent_send_registration_done(struct agent_app *app); /* Agent action API */ -int agent_enable_event(struct agent_event *event, - enum lttng_domain_type domain); -int agent_disable_event(struct agent_event *event, - enum lttng_domain_type domain); +int agent_enable_event(struct agent_event *event, enum lttng_domain_type domain); +int agent_disable_event(struct agent_event *event, enum lttng_domain_type domain); void agent_update(const struct agent *agt, const struct agent_app *app); -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); -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); /* Global event notifier per-domain agents. */ -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); void agent_by_event_notifier_domain_ht_destroy(void); int agent_by_event_notifier_domain_ht_create(void); diff --git a/src/bin/lttng-sessiond/buffer-registry.hpp b/src/bin/lttng-sessiond/buffer-registry.hpp index 4641361f0..35f7960e9 100644 --- a/src/bin/lttng-sessiond/buffer-registry.hpp +++ b/src/bin/lttng-sessiond/buffer-registry.hpp @@ -8,16 +8,17 @@ #ifndef LTTNG_BUFFER_REGISTRY_H #define LTTNG_BUFFER_REGISTRY_H -#include -#include - -#include -#include - #include "consumer.hpp" #include "lttng-ust-ctl.hpp" -#include "ust-registry.hpp" #include "ust-registry-session.hpp" +#include "ust-registry.hpp" + +#include + +#include + +#include +#include struct buffer_reg_stream { struct cds_list_head lnode; @@ -68,9 +69,9 @@ struct buffer_reg_uid { * Keys to match this object in a hash table. The following three variables * identify a unique per UID buffer registry. */ - uint64_t session_id; /* Unique tracing session id. */ - int bits_per_long; /* ABI */ - uid_t uid; /* Owner. */ + uint64_t session_id; /* Unique tracing session id. */ + int bits_per_long; /* ABI */ + uid_t uid; /* Owner. */ enum lttng_domain_type domain; struct buffer_reg_session *registry; @@ -101,20 +102,24 @@ struct buffer_reg_pid { /* Buffer registry per UID. */ void buffer_reg_init_uid_registry(void); -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); void buffer_reg_uid_add(struct buffer_reg_uid *reg); -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); void buffer_reg_uid_remove(struct buffer_reg_uid *regp); -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); /* Buffer registry per PID. */ void buffer_reg_init_pid_registry(void); -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); void buffer_reg_pid_add(struct buffer_reg_pid *reg); struct buffer_reg_pid *buffer_reg_pid_find(uint64_t session_id); void buffer_reg_pid_remove(struct buffer_reg_pid *regp); @@ -122,27 +127,21 @@ void buffer_reg_pid_destroy(struct buffer_reg_pid *regp); /* Channel */ int buffer_reg_channel_create(uint64_t key, struct buffer_reg_channel **regp); -void buffer_reg_channel_add(struct buffer_reg_session *session, - struct buffer_reg_channel *channel); -struct buffer_reg_channel *buffer_reg_channel_find(uint64_t key, - struct buffer_reg_uid *reg); -void buffer_reg_channel_remove(struct buffer_reg_session *session, - struct buffer_reg_channel *regp); -void buffer_reg_channel_destroy(struct buffer_reg_channel *regp, - enum lttng_domain_type domain); +void buffer_reg_channel_add(struct buffer_reg_session *session, struct buffer_reg_channel *channel); +struct buffer_reg_channel *buffer_reg_channel_find(uint64_t key, struct buffer_reg_uid *reg); +void buffer_reg_channel_remove(struct buffer_reg_session *session, struct buffer_reg_channel *regp); +void buffer_reg_channel_destroy(struct buffer_reg_channel *regp, enum lttng_domain_type domain); /* Stream */ int buffer_reg_stream_create(struct buffer_reg_stream **regp); -void buffer_reg_stream_add(struct buffer_reg_stream *stream, - struct buffer_reg_channel *channel); -void buffer_reg_stream_destroy(struct buffer_reg_stream *regp, - enum lttng_domain_type domain); +void buffer_reg_stream_add(struct buffer_reg_stream *stream, struct buffer_reg_channel *channel); +void buffer_reg_stream_destroy(struct buffer_reg_stream *regp, enum lttng_domain_type domain); /* Global registry. */ void buffer_reg_destroy_registries(void); -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); #endif /* LTTNG_BUFFER_REGISTRY_H */ diff --git a/src/bin/lttng-sessiond/channel.hpp b/src/bin/lttng-sessiond/channel.hpp index 342e30f78..f7156c632 100644 --- a/src/bin/lttng-sessiond/channel.hpp +++ b/src/bin/lttng-sessiond/channel.hpp @@ -8,31 +8,28 @@ #ifndef _LTT_CHANNEL_H #define _LTT_CHANNEL_H -#include - #include "trace-kernel.hpp" #include "trace-ust.hpp" -int channel_kernel_disable(struct ltt_kernel_session *ksession, - char *channel_name); +#include + +int channel_kernel_disable(struct ltt_kernel_session *ksession, char *channel_name); 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 channel_kernel_create(struct ltt_kernel_session *ksession, - struct lttng_channel *chan, - int kernel_pipe); + struct lttng_channel *chan, + int kernel_pipe); -struct lttng_channel *channel_new_default_attr(int domain, - enum lttng_buffer_type type); +struct lttng_channel *channel_new_default_attr(int domain, enum lttng_buffer_type type); void channel_attr_destroy(struct lttng_channel *channel); 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 channel_ust_enable(struct ltt_ust_session *usess, - struct ltt_ust_channel *uchan); -int channel_ust_disable(struct ltt_ust_session *usess, - struct ltt_ust_channel *uchan); + struct ltt_ust_channel *uchan); +int channel_ust_disable(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan); -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); #endif /* _LTT_CHANNEL_H */ diff --git a/src/bin/lttng-sessiond/client.cpp b/src/bin/lttng-sessiond/client.cpp index 0680e14fd..6c3f696f0 100644 --- a/src/bin/lttng-sessiond/client.cpp +++ b/src/bin/lttng-sessiond/client.cpp @@ -2214,10 +2214,8 @@ skip_domain: 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); + ret = cmd_rotation_set_schedule( + cmd_ctx->session, set_schedule, schedule_type, value); if (ret != LTTNG_OK) { goto error; } diff --git a/src/bin/lttng-sessiond/clock-class.hpp b/src/bin/lttng-sessiond/clock-class.hpp index fd130fc18..8fc1cb4cd 100644 --- a/src/bin/lttng-sessiond/clock-class.hpp +++ b/src/bin/lttng-sessiond/clock-class.hpp @@ -10,6 +10,7 @@ #include #include + #include #include diff --git a/src/bin/lttng-sessiond/cmd.cpp b/src/bin/lttng-sessiond/cmd.cpp index 413bb6500..203ffb146 100644 --- a/src/bin/lttng-sessiond/cmd.cpp +++ b/src/bin/lttng-sessiond/cmd.cpp @@ -3390,8 +3390,7 @@ error: * * Called with session lock held. */ -int cmd_destroy_session(struct ltt_session *session, - int *sock_fd) +int cmd_destroy_session(struct ltt_session *session, int *sock_fd) { int ret; enum lttng_error_code destruction_last_error = LTTNG_OK; diff --git a/src/bin/lttng-sessiond/cmd.hpp b/src/bin/lttng-sessiond/cmd.hpp index 6defe0049..8b77b18a4 100644 --- a/src/bin/lttng-sessiond/cmd.hpp +++ b/src/bin/lttng-sessiond/cmd.hpp @@ -12,6 +12,7 @@ #include "lttng-sessiond.hpp" #include "lttng/tracker.h" #include "session.hpp" + #include struct notification_thread_handle; @@ -38,60 +39,64 @@ struct cmd_completion_handler { void cmd_init(void); /* Session commands */ -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 cmd_destroy_session(struct ltt_session *session, int *sock_fd); /* Channel commands */ 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 cmd_enable_channel(struct command_ctx *cmd_ctx, int sock, int wpipe); /* Process attribute tracker commands */ -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_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_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_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_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_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 +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_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_get_inclusion_set(struct ltt_session *session, + enum lttng_domain_type domain, + enum lttng_process_attr process_attr, + struct lttng_process_attr_values **values); /* Event commands */ int cmd_disable_event(struct command_ctx *cmd_ctx, - struct lttng_event *event, - char *filter_expression, - struct lttng_bytecode *filter, - struct lttng_event_exclusion *exclusion); + struct lttng_event *event, + char *filter_expression, + struct lttng_bytecode *filter, + struct lttng_event_exclusion *exclusion); int cmd_add_context(struct command_ctx *cmd_ctx, - const struct lttng_event_context *event_context, - int kwpipe); -int cmd_set_filter(struct ltt_session *session, enum lttng_domain_type domain, - char *channel_name, struct lttng_event *event, - struct lttng_bytecode *bytecode); + const struct lttng_event_context *event_context, + int kwpipe); +int cmd_set_filter(struct ltt_session *session, + enum lttng_domain_type domain, + char *channel_name, + struct lttng_event *event, + struct lttng_bytecode *bytecode); 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); /* Trace session action commands */ int cmd_start_trace(struct ltt_session *session); @@ -99,77 +104,81 @@ int cmd_stop_trace(struct ltt_session *session); /* Consumer commands */ int cmd_register_consumer(struct ltt_session *session, - enum lttng_domain_type domain, - const char *sock_path, struct consumer_data *cdata); -int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri, - struct lttng_uri *uris); + enum lttng_domain_type domain, + const char *sock_path, + struct consumer_data *cdata); +int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri, struct lttng_uri *uris); int cmd_setup_relayd(struct ltt_session *session); /* Listing commands */ -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); enum lttng_error_code cmd_list_events(enum lttng_domain_type domain, - struct ltt_session *session, - char *channel_name, - struct lttng_payload *payload); + struct ltt_session *session, + char *channel_name, + struct lttng_payload *payload); 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); 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); 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 cmd_list_tracepoints(enum lttng_domain_type domain, - struct lttng_payload *reply_payload); + struct lttng_payload *reply_payload); ssize_t cmd_snapshot_list_outputs(struct ltt_session *session, - struct lttng_snapshot_output **outputs); -enum lttng_error_code cmd_list_syscalls( - struct lttng_payload *reply_payload); + struct lttng_snapshot_output **outputs); +enum lttng_error_code cmd_list_syscalls(struct lttng_payload *reply_payload); int cmd_data_pending(struct ltt_session *session); /* Snapshot */ 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 cmd_snapshot_del_output(struct ltt_session *session, - const struct lttng_snapshot_output *output); + const struct lttng_snapshot_output *output); int cmd_snapshot_record(struct ltt_session *session, - const struct lttng_snapshot_output *output, int wait); + const struct lttng_snapshot_output *output, + int wait); -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); int cmd_regenerate_metadata(struct ltt_session *session); int cmd_regenerate_statedump(struct ltt_session *session); -enum lttng_error_code cmd_register_trigger( - const struct lttng_credentials *cmd_creds, - struct lttng_trigger *trigger, - bool is_anonymous_trigger, - struct notification_thread_handle *notification_thread_handle, - struct lttng_trigger **return_trigger); -enum lttng_error_code cmd_unregister_trigger( - const struct lttng_credentials *cmd_creds, - const struct lttng_trigger *trigger, - struct notification_thread_handle *notification_thread_handle); - -enum lttng_error_code cmd_list_triggers(struct command_ctx *cmd_ctx, - struct notification_thread_handle *notification_thread_handle, - struct lttng_triggers **return_triggers); -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_register_trigger(const struct lttng_credentials *cmd_creds, + struct lttng_trigger *trigger, + bool is_anonymous_trigger, + struct notification_thread_handle *notification_thread_handle, + struct lttng_trigger **return_trigger); +enum lttng_error_code +cmd_unregister_trigger(const struct lttng_credentials *cmd_creds, + const struct lttng_trigger *trigger, + struct notification_thread_handle *notification_thread_handle); + +enum lttng_error_code +cmd_list_triggers(struct command_ctx *cmd_ctx, + struct notification_thread_handle *notification_thread_handle, + struct lttng_triggers **return_triggers); +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); 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 cmd_rotate_get_info(struct ltt_session *session, - struct lttng_rotation_get_info_return *info_return, - uint64_t rotate_id); + struct lttng_rotation_get_info_return *info_return, + uint64_t rotate_id); int cmd_rotation_set_schedule(struct ltt_session *session, - bool activate, enum lttng_rotation_schedule_type schedule_type, - uint64_t value); + bool activate, + enum lttng_rotation_schedule_type schedule_type, + uint64_t value); const struct cmd_completion_handler *cmd_pop_completion_handler(void); int start_kernel_session(struct ltt_kernel_session *ksess); diff --git a/src/bin/lttng-sessiond/condition-internal.hpp b/src/bin/lttng-sessiond/condition-internal.hpp index 49a074952..23d2c229e 100644 --- a/src/bin/lttng-sessiond/condition-internal.hpp +++ b/src/bin/lttng-sessiond/condition-internal.hpp @@ -17,7 +17,6 @@ */ unsigned long lttng_condition_hash(const struct lttng_condition *condition); -struct lttng_condition *lttng_condition_copy( - const struct lttng_condition *condition); +struct lttng_condition *lttng_condition_copy(const struct lttng_condition *condition); #endif /* LTTNG_SESSIOND_CONDITION_INTERNAL_H */ diff --git a/src/bin/lttng-sessiond/consumer.hpp b/src/bin/lttng-sessiond/consumer.hpp index 6875360e6..6c334875b 100644 --- a/src/bin/lttng-sessiond/consumer.hpp +++ b/src/bin/lttng-sessiond/consumer.hpp @@ -8,13 +8,15 @@ #ifndef _CONSUMER_H #define _CONSUMER_H +#include "snapshot.hpp" + #include #include + #include -#include -#include -#include "snapshot.hpp" +#include +#include struct snapshot; struct snapshot_output; @@ -75,9 +77,9 @@ struct consumer_socket { }; struct consumer_data { - explicit consumer_data (lttng_consumer_type type_) - : type(type_) - {} + explicit consumer_data(lttng_consumer_type type_) : type(type_) + { + } enum lttng_consumer_type type; @@ -144,7 +146,7 @@ struct consumer_net { * Consumer output object describing where and how to send data. */ struct consumer_output { - struct urcu_ref ref; /* Refcount */ + struct urcu_ref ref; /* Refcount */ /* If the consumer is enabled meaning that should be used */ bool enabled; @@ -167,9 +169,8 @@ struct consumer_output { * Subdirectory path name used for both local and network * consumer ("kernel", "ust", or empty). */ - char domain_subdir[ - max_constexpr(sizeof(DEFAULT_KERNEL_TRACE_DIR), - sizeof(DEFAULT_UST_TRACE_DIR))]; + char domain_subdir[max_constexpr(sizeof(DEFAULT_KERNEL_TRACE_DIR), + sizeof(DEFAULT_UST_TRACE_DIR))]; /* * Hashtable of consumer_socket index by the file descriptor value. For @@ -193,152 +194,161 @@ struct consumer_output { char chunk_path[LTTNG_PATH_MAX]; }; -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 consumer_socket *consumer_find_socket_by_bitness(int bits, - const struct consumer_output *consumer); + const struct consumer_output *consumer); struct consumer_socket *consumer_allocate_socket(int *fd); -void consumer_add_socket(struct consumer_socket *sock, - struct consumer_output *consumer); -void consumer_del_socket(struct consumer_socket *sock, - struct consumer_output *consumer); +void consumer_add_socket(struct consumer_socket *sock, struct consumer_output *consumer); +void consumer_del_socket(struct consumer_socket *sock, struct consumer_output *consumer); void consumer_destroy_socket(struct consumer_socket *sock); -int consumer_copy_sockets(struct consumer_output *dst, - struct consumer_output *src); +int consumer_copy_sockets(struct consumer_output *dst, struct consumer_output *src); void consumer_destroy_output_sockets(struct consumer_output *obj); -int consumer_socket_send(struct consumer_socket *socket, const void *msg, - size_t len); -int consumer_socket_recv(struct consumer_socket *socket, void *msg, - size_t len); +int consumer_socket_send(struct consumer_socket *socket, const void *msg, size_t len); +int consumer_socket_recv(struct consumer_socket *socket, void *msg, size_t len); struct consumer_output *consumer_create_output(enum consumer_dst_type type); struct consumer_output *consumer_copy_output(struct consumer_output *obj); void consumer_output_get(struct consumer_output *obj); void consumer_output_put(struct consumer_output *obj); int consumer_set_network_uri(const struct ltt_session *session, - struct consumer_output *obj, - struct lttng_uri *uri); -int consumer_send_fds(struct consumer_socket *sock, const int *fds, - size_t nb_fd); -int consumer_send_msg(struct consumer_socket *sock, - const struct lttcomm_consumer_msg *msg); + struct consumer_output *obj, + struct lttng_uri *uri); +int consumer_send_fds(struct consumer_socket *sock, const int *fds, size_t nb_fd); +int consumer_send_msg(struct consumer_socket *sock, const struct lttcomm_consumer_msg *msg); int consumer_send_stream(struct consumer_socket *sock, - struct consumer_output *dst, struct lttcomm_consumer_msg *msg, - const int *fds, size_t nb_fd); -int consumer_send_channel(struct consumer_socket *sock, - struct lttcomm_consumer_msg *msg); + struct consumer_output *dst, + struct lttcomm_consumer_msg *msg, + const int *fds, + size_t nb_fd); +int consumer_send_channel(struct consumer_socket *sock, struct lttcomm_consumer_msg *msg); 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); -int consumer_send_channel_monitor_pipe(struct consumer_socket *consumer_sock, - int pipe); -int consumer_send_destroy_relayd(struct consumer_socket *sock, - struct consumer_output *consumer); + 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 consumer_send_channel_monitor_pipe(struct consumer_socket *consumer_sock, int pipe); +int consumer_send_destroy_relayd(struct consumer_socket *sock, struct consumer_output *consumer); int consumer_recv_status_reply(struct consumer_socket *sock); int consumer_recv_status_channel(struct consumer_socket *sock, - uint64_t *key, unsigned int *stream_count); + uint64_t *key, + unsigned int *stream_count); void consumer_output_send_destroy_relayd(struct consumer_output *consumer); -int consumer_create_socket(struct consumer_data *data, - struct consumer_output *output); +int consumer_create_socket(struct consumer_data *data, struct consumer_output *output); 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); 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); 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); 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); -int consumer_is_data_pending(uint64_t session_id, - struct consumer_output *consumer); -int consumer_close_metadata(struct consumer_socket *socket, - uint64_t metadata_key); -int consumer_setup_metadata(struct consumer_socket *socket, - uint64_t metadata_key); + 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); +int consumer_is_data_pending(uint64_t session_id, struct consumer_output *consumer); +int consumer_close_metadata(struct consumer_socket *socket, uint64_t metadata_key); +int consumer_setup_metadata(struct consumer_socket *socket, uint64_t metadata_key); 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 consumer_flush_channel(struct consumer_socket *socket, uint64_t key); int consumer_clear_quiescent_channel(struct consumer_socket *socket, uint64_t key); -int consumer_get_discarded_events(uint64_t session_id, uint64_t channel_key, - struct consumer_output *consumer, uint64_t *discarded); -int consumer_get_lost_packets(uint64_t session_id, uint64_t channel_key, - struct consumer_output *consumer, uint64_t *lost); +int consumer_get_discarded_events(uint64_t session_id, + uint64_t channel_key, + struct consumer_output *consumer, + uint64_t *discarded); +int consumer_get_lost_packets(uint64_t session_id, + uint64_t channel_key, + struct consumer_output *consumer, + uint64_t *lost); /* Snapshot command. */ 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); /* Rotation commands. */ -int consumer_rotate_channel(struct consumer_socket *socket, uint64_t key, - struct consumer_output *output, bool is_metadata_channel); -int consumer_init(struct consumer_socket *socket, - const lttng_uuid& sessiond_uuid); +int consumer_rotate_channel(struct consumer_socket *socket, + uint64_t key, + struct consumer_output *output, + bool is_metadata_channel); +int consumer_init(struct consumer_socket *socket, const lttng_uuid& sessiond_uuid); 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 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 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 consumer_open_channel_packets(struct consumer_socket *socket, uint64_t key); 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); /* Clear command */ int consumer_clear_channel(struct consumer_socket *socket, uint64_t key); diff --git a/src/bin/lttng-sessiond/context.hpp b/src/bin/lttng-sessiond/context.hpp index a55f57116..4a9653333 100644 --- a/src/bin/lttng-sessiond/context.hpp +++ b/src/bin/lttng-sessiond/context.hpp @@ -8,18 +8,18 @@ #ifndef _LTT_CONTEXT_H #define _LTT_CONTEXT_H -#include - +#include "lttng-ust-ctl.hpp" #include "trace-kernel.hpp" #include "trace-ust.hpp" -#include "lttng-ust-ctl.hpp" + +#include 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 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); #endif /* _LTT_CONTEXT_H */ diff --git a/src/bin/lttng-sessiond/ctf2-trace-class-visitor.hpp b/src/bin/lttng-sessiond/ctf2-trace-class-visitor.hpp index b709a0294..a46cc8bcb 100644 --- a/src/bin/lttng-sessiond/ctf2-trace-class-visitor.hpp +++ b/src/bin/lttng-sessiond/ctf2-trace-class-visitor.hpp @@ -8,12 +8,12 @@ #ifndef LTTNG_CTF2_TRACE_CLASS_VISITOR_H #define LTTNG_CTF2_TRACE_CLASS_VISITOR_H -#include "trace-class.hpp" -#include "stream-class.hpp" #include "event-class.hpp" +#include "stream-class.hpp" +#include "trace-class.hpp" -#include #include +#include #include diff --git a/src/bin/lttng-sessiond/dispatch.hpp b/src/bin/lttng-sessiond/dispatch.hpp index d5ec8c9c3..d3e57368a 100644 --- a/src/bin/lttng-sessiond/dispatch.hpp +++ b/src/bin/lttng-sessiond/dispatch.hpp @@ -10,11 +10,12 @@ #ifndef SESSIOND_UST_DISPATCH_THREAD_H #define SESSIOND_UST_DISPATCH_THREAD_H -#include #include "lttng-sessiond.hpp" +#include + bool launch_ust_dispatch_thread(struct ust_cmd_queue *cmd_queue, - int apps_cmd_pipe_write_fd, - int apps_cmd_notify_write_fd); + int apps_cmd_pipe_write_fd, + int apps_cmd_notify_write_fd); #endif /* SESSIOND_UST_DISPATCH_THREAD_H */ diff --git a/src/bin/lttng-sessiond/event-class.hpp b/src/bin/lttng-sessiond/event-class.hpp index 2a5e63e62..81b27f8d0 100644 --- a/src/bin/lttng-sessiond/event-class.hpp +++ b/src/bin/lttng-sessiond/event-class.hpp @@ -11,6 +11,7 @@ #include "field.hpp" #include + #include #include @@ -40,11 +41,11 @@ public: protected: event_class(unsigned int id, - unsigned int stream_class_id, - int log_level, - std::string name, - nonstd::optional model_emf_uri, - lttng::sessiond::trace::type::cuptr payload); + unsigned int stream_class_id, + int log_level, + std::string name, + nonstd::optional model_emf_uri, + lttng::sessiond::trace::type::cuptr payload); }; } /* namespace trace */ diff --git a/src/bin/lttng-sessiond/event-notifier-error-accounting.hpp b/src/bin/lttng-sessiond/event-notifier-error-accounting.hpp index 89466bd44..e1d445333 100644 --- a/src/bin/lttng-sessiond/event-notifier-error-accounting.hpp +++ b/src/bin/lttng-sessiond/event-notifier-error-accounting.hpp @@ -8,11 +8,11 @@ #ifndef _EVENT_NOTIFIER_ERROR_ACCOUNTING_H #define _EVENT_NOTIFIER_ERROR_ACCOUNTING_H -#include +#include "ust-app.hpp" #include -#include "ust-app.hpp" +#include enum event_notifier_error_accounting_status { EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK, @@ -30,16 +30,14 @@ enum event_notifier_error_accounting_status { * to be allocated for each domain. */ 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); /* * Register the kernel event notifier group. * This allocates the counter object on the kernel side. */ 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); #ifdef HAVE_LIBLTTNG_UST_CTL @@ -59,18 +57,14 @@ event_notifier_error_accounting_unregister_app(struct ust_app *app); #else /* HAVE_LIBLTTNG_UST_CTL */ -static inline -enum event_notifier_error_accounting_status -event_notifier_error_accounting_register_app( - struct ust_app *app __attribute__((unused))) +static inline enum event_notifier_error_accounting_status +event_notifier_error_accounting_register_app(struct ust_app *app __attribute__((unused))) { return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK; } -static inline -enum event_notifier_error_accounting_status -event_notifier_error_accounting_unregister_app( - struct ust_app *app __attribute__((unused))) +static inline enum event_notifier_error_accounting_status +event_notifier_error_accounting_unregister_app(struct ust_app *app __attribute__((unused))) { return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK; } @@ -80,17 +74,13 @@ event_notifier_error_accounting_unregister_app( * Allocates, reserves and returns the error counter index for that trigger. */ 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 -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); -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); void event_notifier_error_accounting_fini(void); diff --git a/src/bin/lttng-sessiond/event.cpp b/src/bin/lttng-sessiond/event.cpp index 367c49445..462ed2f0d 100644 --- a/src/bin/lttng-sessiond/event.cpp +++ b/src/bin/lttng-sessiond/event.cpp @@ -326,7 +326,6 @@ int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess, struct ltt_ LTTNG_ASSERT(usess); LTTNG_ASSERT(uchan); - /* Disabling existing events */ { lttng::urcu::read_lock_guard read_lock; diff --git a/src/bin/lttng-sessiond/event.hpp b/src/bin/lttng-sessiond/event.hpp index efc4ad5d0..efd72f4cc 100644 --- a/src/bin/lttng-sessiond/event.hpp +++ b/src/bin/lttng-sessiond/event.hpp @@ -13,39 +13,43 @@ struct agent; int event_kernel_disable_event(struct ltt_kernel_channel *kchan, - const char *event_name, enum lttng_event_type event_type); + const char *event_name, + enum lttng_event_type event_type); 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 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 event_ust_disable_tracepoint(struct ltt_ust_session *usess, - struct ltt_ust_channel *uchan, const char *event_name); - -int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess, - struct ltt_ust_channel *uchan); - -int event_agent_enable(struct ltt_ust_session *usess, struct agent *agt, - struct lttng_event *event, struct lttng_bytecode *filter, - char *filter_expression); -int event_agent_enable_all(struct ltt_ust_session *usess, struct agent *agt, - struct lttng_event *event, struct lttng_bytecode *filter, - char *filter_expression); - -int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt, - const char *event_name); + struct ltt_ust_channel *uchan, + const char *event_name); + +int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan); + +int event_agent_enable(struct ltt_ust_session *usess, + struct agent *agt, + struct lttng_event *event, + struct lttng_bytecode *filter, + char *filter_expression); +int event_agent_enable_all(struct ltt_ust_session *usess, + struct agent *agt, + struct lttng_event *event, + struct lttng_bytecode *filter, + char *filter_expression); + +int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt, const char *event_name); int event_agent_disable_all(struct ltt_ust_session *usess, struct agent *agt); -int trigger_agent_enable( - const struct lttng_trigger *trigger, struct agent *agt); -int trigger_agent_disable( - const struct lttng_trigger *trigger, struct agent *agt); +int trigger_agent_enable(const struct lttng_trigger *trigger, struct agent *agt); +int trigger_agent_disable(const struct lttng_trigger *trigger, struct agent *agt); const char *event_get_default_agent_ust_name(enum lttng_domain_type domain); diff --git a/src/bin/lttng-sessiond/field.hpp b/src/bin/lttng-sessiond/field.hpp index dc418b661..8ba85d81a 100644 --- a/src/bin/lttng-sessiond/field.hpp +++ b/src/bin/lttng-sessiond/field.hpp @@ -137,11 +137,11 @@ public: using roles = std::vector; integer_type(unsigned int alignment, - byte_order byte_order, - unsigned int size, - signedness signedness, - base base, - roles roles = {}); + byte_order byte_order, + unsigned int size, + signedness signedness, + base base, + roles roles = {}); type::cuptr copy() const override; @@ -165,9 +165,9 @@ protected: class floating_point_type : public type { public: floating_point_type(unsigned int alignment, - byte_order byte_order, - unsigned int exponent_digits, - unsigned int mantissa_digits); + byte_order byte_order, + unsigned int exponent_digits, + unsigned int mantissa_digits); type::cuptr copy() const final; @@ -207,7 +207,7 @@ public: using range_integer_t = MappingIntegerType; enumeration_mapping_range(MappingIntegerType in_begin, MappingIntegerType in_end) : - begin{in_begin}, end{in_end} + begin{ in_begin }, end{ in_end } { } @@ -270,31 +270,31 @@ public: using mappings = std::vector; static_assert(std::is_integral::value && - sizeof(MappingIntegerType) == 8, - "MappingIntegerType must be either int64_t or uint64_t"); + sizeof(MappingIntegerType) == 8, + "MappingIntegerType must be either int64_t or uint64_t"); typed_enumeration_type(unsigned int in_alignment, - enum byte_order in_byte_order, - unsigned int in_size, - enum base in_base, - const std::shared_ptr& in_mappings, - integer_type::roles in_roles = {}) : + enum byte_order in_byte_order, + unsigned int in_size, + enum base in_base, + const std::shared_ptr& in_mappings, + integer_type::roles in_roles = {}) : enumeration_type(in_alignment, - in_byte_order, - in_size, - std::is_signed::value ? - integer_type::signedness::SIGNED : - integer_type::signedness::UNSIGNED, - in_base, - std::move(in_roles)), - mappings_{std::move(in_mappings)} + in_byte_order, + in_size, + std::is_signed::value ? + integer_type::signedness::SIGNED : + integer_type::signedness::UNSIGNED, + in_base, + std::move(in_roles)), + mappings_{ std::move(in_mappings) } { } type::cuptr copy() const override { return lttng::make_unique>( - alignment, byte_order, size, base_, mappings_, roles_); + alignment, byte_order, size, base_, mappings_, roles_); } void accept(type_visitor& visitor) const final; @@ -304,8 +304,8 @@ public: private: bool _is_equal(const type& base_other) const noexcept final { - const auto& other = static_cast&>( - base_other); + const auto& other = + static_cast&>(base_other); return integer_type::_is_equal(base_other) && *this->mappings_ == *other.mappings_; } @@ -328,8 +328,8 @@ protected: class static_length_array_type : public array_type { public: static_length_array_type(unsigned int alignment, - type::cuptr element_type, - uint64_t in_length); + type::cuptr element_type, + uint64_t in_length); type::cuptr copy() const final; @@ -344,8 +344,8 @@ private: class dynamic_length_array_type : public array_type { public: dynamic_length_array_type(unsigned int alignment, - type::cuptr element_type, - field_location length_field_location); + type::cuptr element_type, + field_location length_field_location); type::cuptr copy() const final; @@ -415,8 +415,9 @@ protected: class static_length_string_type : public string_type { public: - static_length_string_type( - unsigned int alignment, enum encoding in_encoding, uint64_t length); + static_length_string_type(unsigned int alignment, + enum encoding in_encoding, + uint64_t length); type::cuptr copy() const final; @@ -431,8 +432,8 @@ private: class dynamic_length_string_type : public string_type { public: dynamic_length_string_type(unsigned int alignment, - enum encoding in_encoding, - field_location length_field_location); + enum encoding in_encoding, + field_location length_field_location); type::cuptr copy() const final; @@ -471,24 +472,25 @@ private: template class variant_type : public type { - static_assert(std::is_same::value || - std::is_same::value, - "Variant mapping integer type must be one of those allowed by typed_enumeration_type"); + static_assert( + std::is_same::value || + std::is_same< + MappingIntegerType, + signed_enumeration_type::mapping::range_t::range_integer_t>::value, + "Variant mapping integer type must be one of those allowed by typed_enumeration_type"); public: - using choice = std::pair, type::cuptr>; + using choice = + std::pair, type::cuptr>; using choices = std::vector; variant_type(unsigned int in_alignment, - field_location in_selector_field_location, - choices in_choices) : + field_location in_selector_field_location, + choices in_choices) : type(in_alignment), - selector_field_location{std::move(in_selector_field_location)}, - choices_{std::move(in_choices)} + selector_field_location{ std::move(in_selector_field_location) }, + choices_{ std::move(in_choices) } { } @@ -498,8 +500,8 @@ public: copy_of_choices.reserve(choices_.size()); for (const auto& current_choice : choices_) { - copy_of_choices.emplace_back( - current_choice.first, current_choice.second->copy()); + copy_of_choices.emplace_back(current_choice.first, + current_choice.second->copy()); } return lttng::make_unique>( @@ -518,11 +520,13 @@ private: return false; } - return std::equal(a.cbegin(), a.cend(), b.cbegin(), - [](const choice& choice_a, const choice& choice_b) { - return choice_a.first == choice_b.first && - *choice_a.second == *choice_b.second; - }); + return std::equal(a.cbegin(), + a.cend(), + b.cbegin(), + [](const choice& choice_a, const choice& choice_b) { + return choice_a.first == choice_b.first && + *choice_a.second == *choice_b.second; + }); } bool _is_equal(const type& base_other) const noexcept final @@ -530,7 +534,7 @@ private: const auto& other = static_cast(base_other); return selector_field_location == other.selector_field_location && - _choices_are_equal(choices_, other.choices_); + _choices_are_equal(choices_, other.choices_); } }; @@ -568,8 +572,12 @@ public: virtual void visit(const static_length_string_type& type) = 0; virtual void visit(const dynamic_length_string_type& type) = 0; virtual void visit(const structure_type& type) = 0; - virtual void visit(const variant_type& type) = 0; - virtual void visit(const variant_type& type) = 0; + virtual void + visit(const variant_type& + type) = 0; + virtual void + visit(const variant_type& + type) = 0; protected: type_visitor() = default; @@ -589,10 +597,10 @@ namespace fmt { template <> struct formatter : formatter { template - typename FormatContextType::iterator format( - const lttng::sessiond::trace::field_location& location, FormatContextType& ctx) + typename FormatContextType::iterator + format(const lttng::sessiond::trace::field_location& location, FormatContextType& ctx) { - std::string location_str{"["}; + std::string location_str{ "[" }; switch (location.root_) { case lttng::sessiond::trace::field_location::root::PACKET_HEADER: @@ -615,7 +623,7 @@ struct formatter : formatter : formatter ::std::string format_mapping_range(typename lttng::sessiond::trace::typed_enumeration_type< - MappingIntegerType>::mapping::range_t range) + MappingIntegerType>::mapping::range_t range) { if (range.begin == range.end) { return ::fmt::format("[{}]", range.begin); @@ -643,13 +651,12 @@ struct formatter typename FormatContextType::iterator format(typename lttng::sessiond::trace::signed_enumeration_type::mapping::range_t range, - FormatContextType& ctx) + FormatContextType& ctx) { return format_to(ctx.out(), - details::format_mapping_range< - lttng::sessiond::trace::signed_enumeration_type:: - mapping::range_t::range_integer_t>( - range)); + details::format_mapping_range< + lttng::sessiond::trace::signed_enumeration_type::mapping:: + range_t::range_integer_t>(range)); } }; @@ -659,13 +666,12 @@ struct formatter typename FormatContextType::iterator format(typename lttng::sessiond::trace::unsigned_enumeration_type::mapping::range_t range, - FormatContextType& ctx) + FormatContextType& ctx) { return format_to(ctx.out(), - details::format_mapping_range< - lttng::sessiond::trace::unsigned_enumeration_type:: - mapping::range_t::range_integer_t>( - range)); + details::format_mapping_range< + lttng::sessiond::trace::unsigned_enumeration_type:: + mapping::range_t::range_integer_t>(range)); } }; diff --git a/src/bin/lttng-sessiond/health-sessiond.hpp b/src/bin/lttng-sessiond/health-sessiond.hpp index 455cc05d5..453b87e5b 100644 --- a/src/bin/lttng-sessiond/health-sessiond.hpp +++ b/src/bin/lttng-sessiond/health-sessiond.hpp @@ -9,20 +9,21 @@ */ #include + #include enum health_type_sessiond { - HEALTH_SESSIOND_TYPE_CMD = 0, - HEALTH_SESSIOND_TYPE_APP_MANAGE = 1, - HEALTH_SESSIOND_TYPE_APP_REG = 2, - HEALTH_SESSIOND_TYPE_KERNEL = 3, - HEALTH_SESSIOND_TYPE_CONSUMER = 4, - HEALTH_SESSIOND_TYPE_APP_MANAGE_NOTIFY = 6, - HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH = 7, - HEALTH_SESSIOND_TYPE_NOTIFICATION = 8, - HEALTH_SESSIOND_TYPE_ROTATION = 9, - HEALTH_SESSIOND_TYPE_TIMER = 10, - HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR = 11, + HEALTH_SESSIOND_TYPE_CMD = 0, + HEALTH_SESSIOND_TYPE_APP_MANAGE = 1, + HEALTH_SESSIOND_TYPE_APP_REG = 2, + HEALTH_SESSIOND_TYPE_KERNEL = 3, + HEALTH_SESSIOND_TYPE_CONSUMER = 4, + HEALTH_SESSIOND_TYPE_APP_MANAGE_NOTIFY = 6, + HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH = 7, + HEALTH_SESSIOND_TYPE_NOTIFICATION = 8, + HEALTH_SESSIOND_TYPE_ROTATION = 9, + HEALTH_SESSIOND_TYPE_TIMER = 10, + HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR = 11, NR_HEALTH_SESSIOND_TYPES, }; diff --git a/src/bin/lttng-sessiond/kern-modules.hpp b/src/bin/lttng-sessiond/kern-modules.hpp index d91436256..54a642b74 100644 --- a/src/bin/lttng-sessiond/kern-modules.hpp +++ b/src/bin/lttng-sessiond/kern-modules.hpp @@ -11,11 +11,11 @@ /* * Compatible lttng-modules version. */ -#define KERN_MODULES_PRE_MAJOR 1 -#define KERN_MODULES_PRE_MINOR 9 +#define KERN_MODULES_PRE_MAJOR 1 +#define KERN_MODULES_PRE_MINOR 9 -#define KERN_MODULES_MAJOR 2 -#define KERN_MODULES_MINOR 0 +#define KERN_MODULES_MAJOR 2 +#define KERN_MODULES_MINOR 0 enum kernel_module_property_load_policy { KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED = 0, @@ -24,7 +24,7 @@ enum kernel_module_property_load_policy { struct kern_modules_param { char *name; - enum kernel_module_property_load_policy load_policy; + enum kernel_module_property_load_policy load_policy; bool loaded; }; diff --git a/src/bin/lttng-sessiond/kernel-consumer.hpp b/src/bin/lttng-sessiond/kernel-consumer.hpp index 276312e6c..916408567 100644 --- a/src/bin/lttng-sessiond/kernel-consumer.hpp +++ b/src/bin/lttng-sessiond/kernel-consumer.hpp @@ -5,27 +5,29 @@ * */ -#include +#include "trace-kernel.hpp" #include -#include "trace-kernel.hpp" +#include int kernel_consumer_send_channel_streams(struct consumer_socket *sock, - struct ltt_kernel_channel *channel, struct ltt_kernel_session *session, - unsigned int monitor); + struct ltt_kernel_channel *channel, + struct ltt_kernel_session *session, + unsigned int monitor); -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 kernel_consumer_add_metadata(struct consumer_socket *sock, - struct ltt_kernel_session *session, unsigned int monitor); + struct ltt_kernel_session *session, + unsigned int monitor); int kernel_consumer_destroy_channel(struct consumer_socket *socket, - struct ltt_kernel_channel *channel); + struct ltt_kernel_channel *channel); int kernel_consumer_destroy_metadata(struct consumer_socket *socket, - struct ltt_kernel_metadata *metadata); + struct ltt_kernel_metadata *metadata); 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); diff --git a/src/bin/lttng-sessiond/kernel.cpp b/src/bin/lttng-sessiond/kernel.cpp index 2914475d5..24c3180d5 100644 --- a/src/bin/lttng-sessiond/kernel.cpp +++ b/src/bin/lttng-sessiond/kernel.cpp @@ -86,7 +86,7 @@ static inline uint64_t sanitize_uprobe_offset(uint64_t raw_offset) return raw_offset; } #endif -} +} /* namespace */ /* * Add context on a kernel channel. diff --git a/src/bin/lttng-sessiond/kernel.hpp b/src/bin/lttng-sessiond/kernel.hpp index bb0165121..6024f611c 100644 --- a/src/bin/lttng-sessiond/kernel.hpp +++ b/src/bin/lttng-sessiond/kernel.hpp @@ -23,32 +23,32 @@ */ #define KERNEL_EVENT_INIT_LIST_SIZE 64 -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 kernel_create_session(struct ltt_session *session); -int kernel_create_channel(struct ltt_kernel_session *session, - struct lttng_channel *chan); -int kernel_create_event(struct lttng_event *ev, struct ltt_kernel_channel *channel, - char *filter_expression, struct lttng_bytecode *filter); +int kernel_create_channel(struct ltt_kernel_session *session, struct lttng_channel *chan); +int kernel_create_event(struct lttng_event *ev, + struct ltt_kernel_channel *channel, + char *filter_expression, + struct lttng_bytecode *filter); int kernel_disable_channel(struct ltt_kernel_channel *chan); int kernel_disable_event(struct ltt_kernel_event *event); int kernel_enable_event(struct ltt_kernel_event *event); int kernel_enable_channel(struct ltt_kernel_channel *chan); -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_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_remove_value( - struct ltt_kernel_session *session, - enum lttng_process_attr process_attr, - const struct process_attr_value *value); -const struct process_attr_tracker *kernel_get_process_attr_tracker( - struct ltt_kernel_session *session, - enum lttng_process_attr 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_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_remove_value(struct ltt_kernel_session *session, + enum lttng_process_attr process_attr, + const struct process_attr_value *value); +const struct process_attr_tracker * +kernel_get_process_attr_tracker(struct ltt_kernel_session *session, + enum lttng_process_attr process_attr); int kernel_open_metadata(struct ltt_kernel_session *session); int kernel_open_metadata_stream(struct ltt_kernel_session *session); int kernel_open_channel_stream(struct ltt_kernel_channel *channel); @@ -59,14 +59,13 @@ int kernel_stop_session(struct ltt_kernel_session *session); ssize_t kernel_list_events(struct lttng_event **event_list); void kernel_wait_quiescent(void); int kernel_validate_version(struct lttng_kernel_abi_tracer_version *kernel_tracer_version, - struct lttng_kernel_abi_tracer_abi_version *kernel_tracer_abi_version); + struct lttng_kernel_abi_tracer_abi_version *kernel_tracer_abi_version); void kernel_destroy_session(struct ltt_kernel_session *ksess); void kernel_free_session(struct ltt_kernel_session *ksess); void kernel_destroy_channel(struct ltt_kernel_channel *kchan); -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 kernel_syscall_mask(int chan_fd, char **syscall_mask, uint32_t *nr_bits); enum lttng_error_code kernel_rotate_session(struct ltt_session *session); enum lttng_error_code kernel_clear_session(struct ltt_session *session); @@ -79,19 +78,16 @@ int init_kernel_tracer(void); void cleanup_kernel_tracer(void); bool kernel_tracer_is_initialized(void); -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 kernel_create_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 +kernel_create_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 kernel_register_event_notifier( - struct lttng_trigger *trigger, - const struct lttng_credentials *cmd_creds); -enum lttng_error_code kernel_unregister_event_notifier( - const struct lttng_trigger *trigger); +enum lttng_error_code kernel_register_event_notifier(struct lttng_trigger *trigger, + const struct lttng_credentials *cmd_creds); +enum lttng_error_code kernel_unregister_event_notifier(const struct lttng_trigger *trigger); int kernel_get_notification_fd(void); diff --git a/src/bin/lttng-sessiond/lttng-sessiond.hpp b/src/bin/lttng-sessiond/lttng-sessiond.hpp index a6b17c2a8..c8e03e7e9 100644 --- a/src/bin/lttng-sessiond/lttng-sessiond.hpp +++ b/src/bin/lttng-sessiond/lttng-sessiond.hpp @@ -31,7 +31,7 @@ enum consumerd_state { CONSUMER_STARTED = 1, CONSUMER_STOPPED = 2, - CONSUMER_ERROR = 3, + CONSUMER_ERROR = 3, }; /* Unique identifier of a session daemon instance. */ diff --git a/src/bin/lttng-sessiond/lttng-syscall.hpp b/src/bin/lttng-sessiond/lttng-syscall.hpp index 78691f95d..8ba8c7ea0 100644 --- a/src/bin/lttng-sessiond/lttng-syscall.hpp +++ b/src/bin/lttng-sessiond/lttng-syscall.hpp @@ -8,19 +8,20 @@ #ifndef LTTNG_SYSCALL_H #define LTTNG_SYSCALL_H +#include "trace-kernel.hpp" + #include -#include -#include "trace-kernel.hpp" +#include /* * Default size of the kernel system call array. With this size, we usually * reallocate twice considering a 32 bit compat layer also. */ -#define SYSCALL_TABLE_INIT_SIZE 256 +#define SYSCALL_TABLE_INIT_SIZE 256 /* Maximum length of a syscall name. */ -#define SYSCALL_NAME_LEN 255 +#define SYSCALL_NAME_LEN 255 /* * Represent a kernel syscall and used when we are populating the internal diff --git a/src/bin/lttng-sessiond/main.cpp b/src/bin/lttng-sessiond/main.cpp index 312c243cf..8d59952d6 100644 --- a/src/bin/lttng-sessiond/main.cpp +++ b/src/bin/lttng-sessiond/main.cpp @@ -1770,9 +1770,8 @@ int main(int argc, char **argv) } try { - the_rotation_thread_handle = - lttng::make_unique( - *rotation_timer_queue, *the_notification_thread_handle); + the_rotation_thread_handle = lttng::make_unique( + *rotation_timer_queue, *the_notification_thread_handle); } catch (const std::exception& e) { retval = -1; ERR("Failed to create rotation thread: %s", e.what()); diff --git a/src/bin/lttng-sessiond/manage-apps.hpp b/src/bin/lttng-sessiond/manage-apps.hpp index a865d9a8f..6d4c7a625 100644 --- a/src/bin/lttng-sessiond/manage-apps.hpp +++ b/src/bin/lttng-sessiond/manage-apps.hpp @@ -10,9 +10,10 @@ #ifndef SESSIOND_APPLICATION_MANAGEMENT_THREAD_H #define SESSIOND_APPLICATION_MANAGEMENT_THREAD_H -#include #include "lttng-sessiond.hpp" +#include + bool launch_application_management_thread(int apps_cmd_pipe_read_fd); #endif /* SESSIOND_APPLICATION_MANAGEMENT_THREAD_H */ diff --git a/src/bin/lttng-sessiond/manage-consumer.hpp b/src/bin/lttng-sessiond/manage-consumer.hpp index 9e35a9051..e2b29cc5b 100644 --- a/src/bin/lttng-sessiond/manage-consumer.hpp +++ b/src/bin/lttng-sessiond/manage-consumer.hpp @@ -10,9 +10,10 @@ #ifndef SESSIOND_CONSUMER_MANAGEMENT_THREAD_H #define SESSIOND_CONSUMER_MANAGEMENT_THREAD_H -#include #include "lttng-sessiond.hpp" +#include + bool launch_consumer_management_thread(struct consumer_data *consumer_data); #endif /* SESSIOND_CONSUMER_MANAGEMENT_THREAD_H */ diff --git a/src/bin/lttng-sessiond/manage-kernel.hpp b/src/bin/lttng-sessiond/manage-kernel.hpp index fe0d8b013..c514d6042 100644 --- a/src/bin/lttng-sessiond/manage-kernel.hpp +++ b/src/bin/lttng-sessiond/manage-kernel.hpp @@ -10,9 +10,10 @@ #ifndef SESSIOND_KERNEL_MANAGEMENT_THREAD_H #define SESSIOND_KERNEL_MANAGEMENT_THREAD_H -#include #include "lttng-sessiond.hpp" +#include + bool launch_kernel_management_thread(int kernel_poll_pipe_read_fd); #endif /* SESSIOND_KERNEL_MANAGEMENT_THREAD_H */ diff --git a/src/bin/lttng-sessiond/notification-thread-commands.hpp b/src/bin/lttng-sessiond/notification-thread-commands.hpp index 293a0b4b7..4058de5a4 100644 --- a/src/bin/lttng-sessiond/notification-thread-commands.hpp +++ b/src/bin/lttng-sessiond/notification-thread-commands.hpp @@ -8,14 +8,17 @@ #ifndef NOTIFICATION_THREAD_COMMANDS_H #define NOTIFICATION_THREAD_COMMANDS_H -#include -#include -#include -#include "notification-thread.hpp" -#include "notification-thread-internal.hpp" #include "notification-thread-events.hpp" +#include "notification-thread-internal.hpp" +#include "notification-thread.hpp" + #include + +#include +#include + #include +#include struct notification_thread_data; struct lttng_trigger; @@ -121,47 +124,48 @@ struct notification_thread_command { bool is_async; }; -enum lttng_error_code notification_thread_command_register_trigger( - struct notification_thread_handle *handle, - struct lttng_trigger *trigger, - bool is_anonymous_trigger); - -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_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_remove_session( - struct notification_thread_handle *handle, - uint64_t session_id); - -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_register_trigger(struct notification_thread_handle *handle, + struct lttng_trigger *trigger, + bool is_anonymous_trigger); + +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_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_remove_session(struct notification_thread_handle *handle, + uint64_t session_id); + +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_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); -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); /* Ownership of location is transferred. */ 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); /* * Return the set of triggers visible to a given client. @@ -176,30 +180,29 @@ enum lttng_error_code notification_thread_command_session_rotation_completed( * * The caller has the exclusive ownership of the returned trigger set. */ -enum lttng_error_code notification_thread_command_list_triggers( - struct notification_thread_handle *handle, - uid_t client_uid, - struct lttng_triggers **triggers); +enum lttng_error_code +notification_thread_command_list_triggers(struct notification_thread_handle *handle, + uid_t client_uid, + struct lttng_triggers **triggers); /* * The ownership of trigger_event_application_pipe is _not_ transferred to * the notification thread. */ -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_remove_tracer_event_source( - struct notification_thread_handle *handle, - int tracer_event_source_fd); - -void notification_thread_command_quit( - struct notification_thread_handle *handle); - -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_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_remove_tracer_event_source(struct notification_thread_handle *handle, + int tracer_event_source_fd); + +void notification_thread_command_quit(struct notification_thread_handle *handle); + +enum lttng_error_code +notification_thread_command_get_trigger(struct notification_thread_handle *handle, + const struct lttng_trigger *trigger, + struct lttng_trigger **real_trigger); #endif /* NOTIFICATION_THREAD_COMMANDS_H */ diff --git a/src/bin/lttng-sessiond/notification-thread-events.hpp b/src/bin/lttng-sessiond/notification-thread-events.hpp index 50abad916..955b16cdd 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.hpp +++ b/src/bin/lttng-sessiond/notification-thread-events.hpp @@ -8,48 +8,39 @@ #ifndef NOTIFICATION_THREAD_EVENTS_H #define NOTIFICATION_THREAD_EVENTS_H -#include #include "notification-thread.hpp" +#include + /** * Event handling function shall only return an error if * the thread should be stopped. */ -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 handle_notification_thread_client_connect( - struct notification_thread_state *state); +int handle_notification_thread_client_connect(struct notification_thread_state *state); -int handle_notification_thread_client_disconnect( - int client_fd, - struct notification_thread_state *state); +int handle_notification_thread_client_disconnect(int client_fd, + struct notification_thread_state *state); -int handle_notification_thread_client_disconnect_all( - struct notification_thread_state *state); +int handle_notification_thread_client_disconnect_all(struct notification_thread_state *state); -int handle_notification_thread_trigger_unregister_all( - struct notification_thread_state *state); +int handle_notification_thread_trigger_unregister_all(struct notification_thread_state *state); -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 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 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 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 handle_notification_thread_event_notification( - struct notification_thread_state *state, int pipe, - enum lttng_domain_type domain); +int handle_notification_thread_event_notification(struct notification_thread_state *state, + int pipe, + enum lttng_domain_type domain); #endif /* NOTIFICATION_THREAD_EVENTS_H */ diff --git a/src/bin/lttng-sessiond/notification-thread-internal.hpp b/src/bin/lttng-sessiond/notification-thread-internal.hpp index f711727c3..864593cef 100644 --- a/src/bin/lttng-sessiond/notification-thread-internal.hpp +++ b/src/bin/lttng-sessiond/notification-thread-internal.hpp @@ -8,17 +8,20 @@ #ifndef NOTIFICATION_THREAD_INTERNAL_H #define NOTIFICATION_THREAD_INTERNAL_H +#include "notification-thread.hpp" + #include #include #include + #include #include + #include #include +#include #include #include -#include -#include "notification-thread.hpp" struct lttng_evaluation; struct notification_thread_handle; @@ -243,29 +246,25 @@ using report_client_transmission_result_cb = int (*)(struct notification_client enum client_transmission_status, void *); -int notification_client_list_send_evaluation( - struct notification_client_list *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 *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_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); /* * 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); void lttng_event_notifier_notification_destroy( - struct lttng_event_notifier_notification *event_notifier_notification); + struct lttng_event_notifier_notification *event_notifier_notification); #endif /* NOTIFICATION_THREAD_INTERNAL_H */ diff --git a/src/bin/lttng-sessiond/notification-thread.hpp b/src/bin/lttng-sessiond/notification-thread.hpp index 0c0740926..c995fc951 100644 --- a/src/bin/lttng-sessiond/notification-thread.hpp +++ b/src/bin/lttng-sessiond/notification-thread.hpp @@ -10,11 +10,14 @@ #include "action-executor.hpp" #include "thread.hpp" + #include #include #include -#include + #include +#include + #include #include #include @@ -151,8 +154,8 @@ struct notification_thread_handle { * for lookup on registration. * - tracer_event_sources_list: * A list of tracer event source (read side fd) of type -* struct notification_event_tracer_event_source_element. -* + * struct notification_event_tracer_event_source_element. + * * * The thread reacts to the following internal events: * 1) creation of a tracing channel, @@ -315,13 +318,11 @@ struct notification_thread_state { }; /* notification_thread_data takes ownership of the channel monitor pipes. */ -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); -void notification_thread_handle_destroy( - struct notification_thread_handle *handle); -struct lttng_thread *launch_notification_thread( - struct notification_thread_handle *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); +void notification_thread_handle_destroy(struct notification_thread_handle *handle); +struct lttng_thread *launch_notification_thread(struct notification_thread_handle *handle); #endif /* NOTIFICATION_THREAD_H */ diff --git a/src/bin/lttng-sessiond/notify-apps.hpp b/src/bin/lttng-sessiond/notify-apps.hpp index 152a52a20..75301e202 100644 --- a/src/bin/lttng-sessiond/notify-apps.hpp +++ b/src/bin/lttng-sessiond/notify-apps.hpp @@ -14,9 +14,8 @@ bool launch_application_notification_thread(int apps_cmd_notify_pipe_read_fd); #else /* HAVE_LIBLTTNG_UST_CTL */ -static -bool launch_application_notification_thread( - int apps_cmd_notify_pipe_read_fd __attribute__((unused))) +static bool launch_application_notification_thread(int apps_cmd_notify_pipe_read_fd + __attribute__((unused))) { return true; } diff --git a/src/bin/lttng-sessiond/register.hpp b/src/bin/lttng-sessiond/register.hpp index ef82a2ca2..2071475de 100644 --- a/src/bin/lttng-sessiond/register.hpp +++ b/src/bin/lttng-sessiond/register.hpp @@ -10,10 +10,10 @@ #ifndef SESSIOND_APPLICATION_REGISTRATION_THREAD_H #define SESSIOND_APPLICATION_REGISTRATION_THREAD_H -#include #include "lttng-sessiond.hpp" -struct lttng_thread *launch_application_registration_thread( - struct ust_cmd_queue *cmd_queue); +#include + +struct lttng_thread *launch_application_registration_thread(struct ust_cmd_queue *cmd_queue); #endif /* SESSIOND_APPLICATION_REGISTRATION_THREAD_H */ diff --git a/src/bin/lttng-sessiond/rotation-thread.cpp b/src/bin/lttng-sessiond/rotation-thread.cpp index 6f58a178d..bc7893475 100644 --- a/src/bin/lttng-sessiond/rotation-thread.cpp +++ b/src/bin/lttng-sessiond/rotation-thread.cpp @@ -393,9 +393,8 @@ void ls::rotation_thread_timer_queue_destroy(struct rotation_thread_timer_queue free(queue); } -ls::rotation_thread::rotation_thread( - rotation_thread_timer_queue& rotation_timer_queue, - notification_thread_handle& notification_thread_handle) : +ls::rotation_thread::rotation_thread(rotation_thread_timer_queue& rotation_timer_queue, + notification_thread_handle& notification_thread_handle) : _rotation_timer_queue{ rotation_timer_queue }, _notification_thread_handle{ notification_thread_handle } { @@ -460,8 +459,8 @@ ls::rotation_thread::~rotation_thread() } void ls::rotation_thread_enqueue_job(ls::rotation_thread_timer_queue *queue, - ls::rotation_thread_job_type job_type, - ltt_session *session) + ls::rotation_thread_job_type job_type, + ltt_session *session) { const char dummy = '!'; struct rotation_thread_job *job = nullptr; @@ -539,7 +538,8 @@ void ls::rotation_thread::_handle_job_queue() } session_lock_list(); - const auto unlock_list = lttng::make_scope_exit([]() noexcept { session_unlock_list(); }); + const auto unlock_list = + lttng::make_scope_exit([]() noexcept { session_unlock_list(); }); /* locked_ptr will unlock the session and release the ref held by the job. */ session_lock(job->session); @@ -551,7 +551,7 @@ void ls::rotation_thread::_handle_job_queue() } } -void ls::rotation_thread::_handle_notification(const lttng_notification ¬ification) +void ls::rotation_thread::_handle_notification(const lttng_notification& notification) { int ret = 0; const char *condition_session_name = nullptr; @@ -770,7 +770,8 @@ void ls::rotation_thread::_run() } if (fd == _notification_channel_subscribtion_change_eventfd.fd()) { - _notification_channel_subscribtion_change_eventfd.decrement(); + _notification_channel_subscribtion_change_eventfd + .decrement(); } } else { /* Job queue or quit pipe activity. */ @@ -829,7 +830,7 @@ void ls::rotation_thread::launch_thread() } void ls::rotation_thread::subscribe_session_consumed_size_rotation(ltt_session& session, - std::uint64_t size) + std::uint64_t size) { const struct lttng_credentials session_creds = { .uid = LTTNG_OPTIONAL_INIT_VALUE(session.uid), @@ -851,8 +852,8 @@ void ls::rotation_thread::subscribe_session_consumed_size_rotation(ltt_session& "Could not set session consumed size condition threshold: size={}", size)); } - condition_status = lttng_condition_session_consumed_size_set_session_name(rotate_condition.get(), - session.name); + condition_status = lttng_condition_session_consumed_size_set_session_name( + rotate_condition.get(), session.name); if (condition_status != LTTNG_CONDITION_STATUS_OK) { LTTNG_THROW_ERROR(fmt::format( "Could not set session consumed size condition session name: name=`{}`", @@ -869,8 +870,7 @@ void ls::rotation_thread::subscribe_session_consumed_size_rotation(ltt_session& /* trigger acquires its own reference to condition and action on success. */ auto trigger = lttng::make_unique_wrapper( lttng_trigger_create(rotate_condition.get(), notify_action.get())); - if (!trigger) - { + if (!trigger) { LTTNG_THROW_POSIX("Could not create size-based rotation trigger", errno); } @@ -878,8 +878,8 @@ void ls::rotation_thread::subscribe_session_consumed_size_rotation(ltt_session& lttng_trigger_set_hidden(trigger.get()); lttng_trigger_set_credentials(trigger.get(), &session_creds); - auto nc_status = - lttng_notification_channel_subscribe(_notification_channel.get(), rotate_condition.get()); + auto nc_status = lttng_notification_channel_subscribe(_notification_channel.get(), + rotate_condition.get()); if (nc_status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) { LTTNG_THROW_ERROR("Could not subscribe to session consumed size notification"); } diff --git a/src/bin/lttng-sessiond/rotation-thread.hpp b/src/bin/lttng-sessiond/rotation-thread.hpp index 02ff2b2fe..daf5b5f3e 100644 --- a/src/bin/lttng-sessiond/rotation-thread.hpp +++ b/src/bin/lttng-sessiond/rotation-thread.hpp @@ -31,10 +31,7 @@ namespace lttng { namespace sessiond { -enum class rotation_thread_job_type { - SCHEDULED_ROTATION, - CHECK_PENDING_ROTATION -}; +enum class rotation_thread_job_type { SCHEDULED_ROTATION, CHECK_PENDING_ROTATION }; struct rotation_thread_timer_queue; @@ -43,7 +40,7 @@ public: using uptr = std::unique_ptr; rotation_thread(rotation_thread_timer_queue& rotation_timer_queue, - notification_thread_handle& notification_thread_handle); + notification_thread_handle& notification_thread_handle); ~rotation_thread(); /* Only use through the lttng_thread facilities. */ diff --git a/src/bin/lttng-sessiond/save.hpp b/src/bin/lttng-sessiond/save.hpp index 367b41c17..ec2af8d50 100644 --- a/src/bin/lttng-sessiond/save.hpp +++ b/src/bin/lttng-sessiond/save.hpp @@ -8,10 +8,10 @@ #ifndef SAVE_H #define SAVE_H -#include #include -int cmd_save_sessions(struct lttng_save_session_attr *attr, - lttng_sock_cred *creds); +#include + +int cmd_save_sessions(struct lttng_save_session_attr *attr, lttng_sock_cred *creds); #endif /* SAVE_H */ diff --git a/src/bin/lttng-sessiond/session.cpp b/src/bin/lttng-sessiond/session.cpp index 0532a7686..0ad891e32 100644 --- a/src/bin/lttng-sessiond/session.cpp +++ b/src/bin/lttng-sessiond/session.cpp @@ -928,7 +928,7 @@ static void session_notify_destruction(const struct ltt_session *session) /* * Fire each clear notifier once, and remove them from the array. */ -void session_notify_clear(ltt_session &session) +void session_notify_clear(ltt_session& session) { size_t i; const size_t count = lttng_dynamic_array_get_count(&session.clear_notifiers); @@ -1359,7 +1359,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(ltt_session &session, enum lttng_rotation_state result) +int session_reset_rotation_state(ltt_session& session, enum lttng_rotation_state result) { int ret = 0; diff --git a/src/bin/lttng-sessiond/session.hpp b/src/bin/lttng-sessiond/session.hpp index 49064037d..74be7e959 100644 --- a/src/bin/lttng-sessiond/session.hpp +++ b/src/bin/lttng-sessiond/session.hpp @@ -8,21 +8,22 @@ #ifndef _LTT_SESSION_H #define _LTT_SESSION_H -#include -#include -#include +#include "consumer.hpp" +#include "snapshot.hpp" +#include "trace-kernel.hpp" -#include #include +#include #include #include -#include + #include #include +#include -#include "snapshot.hpp" -#include "trace-kernel.hpp" -#include "consumer.hpp" +#include +#include +#include #define ASSERT_SESSION_LIST_LOCKED() LTTNG_ASSERT(session_trylock_list()) @@ -76,8 +77,10 @@ struct ltt_session_list { */ struct ltt_session { using id_t = uint64_t; - using locked_ptr = std::unique_ptr::deleter>; using sptr = std::shared_ptr; @@ -212,8 +215,8 @@ struct ltt_session { char *base_path; }; -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); void session_lock(struct ltt_session *session); void session_unlock(struct ltt_session *session); @@ -232,24 +235,24 @@ void session_unlock_list() noexcept; 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); int session_add_clear_notifier(struct ltt_session *session, - ltt_session_clear_notifier notifier, void *user_data); -void session_notify_clear(ltt_session &session); + ltt_session_clear_notifier notifier, + void *user_data); +void session_notify_clear(ltt_session& session); bool session_get(struct ltt_session *session); void session_put(struct ltt_session *session); -enum consumer_dst_type session_get_consumer_destination_type( - const struct ltt_session *session); -const char *session_get_net_consumer_hostname( - const struct ltt_session *session); -void session_get_net_consumer_ports( - const struct ltt_session *session, - uint16_t *control_port, uint16_t *data_port); -struct lttng_trace_archive_location *session_get_trace_archive_location( - const struct ltt_session *session); +enum consumer_dst_type session_get_consumer_destination_type(const struct ltt_session *session); +const char *session_get_net_consumer_hostname(const struct ltt_session *session); +void session_get_net_consumer_ports(const struct ltt_session *session, + uint16_t *control_port, + uint16_t *data_port); +struct lttng_trace_archive_location * +session_get_trace_archive_location(const struct ltt_session *session); struct ltt_session *session_find_by_name(const char *name); struct ltt_session *session_find_by_id(ltt_session::id_t id); @@ -259,15 +262,14 @@ void session_list_wait_empty(); bool session_access_ok(struct ltt_session *session, uid_t uid); -int session_reset_rotation_state(ltt_session &session, - enum lttng_rotation_state result); +int session_reset_rotation_state(ltt_session& session, enum lttng_rotation_state result); /* Create a new trace chunk object from the session's configuration. */ -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); /* * Set `new_trace_chunk` as the session's current trace chunk. A reference @@ -278,17 +280,17 @@ struct lttng_trace_chunk *session_create_new_trace_chunk( * `current_session_trace_chunk` on success. */ int session_set_trace_chunk(struct ltt_session *session, - struct lttng_trace_chunk *new_trace_chunk, - struct lttng_trace_chunk **current_session_trace_chunk); + struct lttng_trace_chunk *new_trace_chunk, + struct lttng_trace_chunk **current_session_trace_chunk); /* * Close a chunk on the remote peers of a session. Has no effect on the * ltt_session itself. */ int session_close_trace_chunk(struct ltt_session *session, - struct lttng_trace_chunk *trace_chunk, - enum lttng_trace_chunk_command_type close_command, - char *path); + struct lttng_trace_chunk *trace_chunk, + enum lttng_trace_chunk_command_type close_command, + char *path); /* Open a packet in all channels of a given session. */ enum lttng_error_code session_open_packets(struct ltt_session *session); diff --git a/src/bin/lttng-sessiond/sessiond-config.hpp b/src/bin/lttng-sessiond/sessiond-config.hpp index fa0bfeb82..6b98a59a7 100644 --- a/src/bin/lttng-sessiond/sessiond-config.hpp +++ b/src/bin/lttng-sessiond/sessiond-config.hpp @@ -9,6 +9,7 @@ #define LTTNG_SESSIOND_CONFIG_H #include + #include struct config_string { diff --git a/src/bin/lttng-sessiond/snapshot.hpp b/src/bin/lttng-sessiond/snapshot.hpp index 9053d3b4a..726b89f80 100644 --- a/src/bin/lttng-sessiond/snapshot.hpp +++ b/src/bin/lttng-sessiond/snapshot.hpp @@ -8,14 +8,14 @@ #ifndef SNAPSHOT_H #define SNAPSHOT_H -#include -#include +#include "consumer.hpp" #include #include #include -#include "consumer.hpp" +#include +#include struct consumer_output; struct ltt_session; @@ -55,27 +55,29 @@ struct snapshot { struct snapshot *snapshot_alloc(); void snapshot_destroy(struct snapshot *obj); int snapshot_init(struct snapshot *obj); -void snapshot_delete_output(struct snapshot *snapshot, - struct snapshot_output *output); -void snapshot_add_output(struct snapshot *snapshot, - struct snapshot_output *output); +void snapshot_delete_output(struct snapshot *snapshot, struct snapshot_output *output); +void snapshot_add_output(struct snapshot *snapshot, struct snapshot_output *output); /* Snapshot output object. */ struct snapshot_output *snapshot_output_alloc(); void snapshot_output_destroy(struct snapshot_output *obj); 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 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); -struct snapshot_output *snapshot_find_output_by_id(uint32_t id, - struct snapshot *snapshot); -struct snapshot_output *snapshot_find_output_by_name(const char *name, - 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); +struct snapshot_output *snapshot_find_output_by_id(uint32_t id, struct snapshot *snapshot); +struct snapshot_output *snapshot_find_output_by_name(const char *name, struct snapshot *snapshot); #endif /* SNAPSHOT_H */ diff --git a/src/bin/lttng-sessiond/stream-class.hpp b/src/bin/lttng-sessiond/stream-class.hpp index d80ad2e0b..5faecd5e1 100644 --- a/src/bin/lttng-sessiond/stream-class.hpp +++ b/src/bin/lttng-sessiond/stream-class.hpp @@ -35,9 +35,9 @@ public: stream_class& operator=(stream_class&&) = delete; stream_class& operator=(const stream_class&) = delete; - virtual const type* packet_context() const; - virtual const type* event_header() const; - virtual const type* event_context() const; + virtual const type *packet_context() const; + virtual const type *event_header() const; + virtual const type *event_context() const; const unsigned int id; /* @@ -50,8 +50,8 @@ public: protected: stream_class(unsigned int id, - enum header_type header_type, - nonstd::optional default_clock_class_name = nonstd::nullopt); + enum header_type header_type, + nonstd::optional default_clock_class_name = nonstd::nullopt); virtual void _accept_on_event_classes(trace_class_visitor& trace_class_visitor) const = 0; lttng::sessiond::trace::type::cuptr _packet_context; diff --git a/src/bin/lttng-sessiond/thread.hpp b/src/bin/lttng-sessiond/thread.hpp index f35bb5803..a1e390a09 100644 --- a/src/bin/lttng-sessiond/thread.hpp +++ b/src/bin/lttng-sessiond/thread.hpp @@ -31,10 +31,10 @@ using lttng_thread_cleanup_cb = void (*)(void *); * The shutdown and cleanup callbacks are optional. */ 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); bool lttng_thread_get(struct lttng_thread *thread); void lttng_thread_put(struct lttng_thread *thread); diff --git a/src/bin/lttng-sessiond/timer.cpp b/src/bin/lttng-sessiond/timer.cpp index d87824704..838983e3b 100644 --- a/src/bin/lttng-sessiond/timer.cpp +++ b/src/bin/lttng-sessiond/timer.cpp @@ -233,7 +233,7 @@ end: /* * Call with session and session_list locks held. */ -int timer_session_rotation_pending_check_stop(ltt_session &session) +int timer_session_rotation_pending_check_stop(ltt_session& session) { int ret; diff --git a/src/bin/lttng-sessiond/timer.hpp b/src/bin/lttng-sessiond/timer.hpp index 3cdebbc13..142982f8b 100644 --- a/src/bin/lttng-sessiond/timer.hpp +++ b/src/bin/lttng-sessiond/timer.hpp @@ -23,17 +23,16 @@ int timer_signal_init(void); /* Start a session's rotation pending check timer (one-shot mode). */ int timer_session_rotation_pending_check_start(struct ltt_session *session, - unsigned int interval_us); + unsigned int interval_us); /* Stop a session's rotation pending check timer. */ -int timer_session_rotation_pending_check_stop(ltt_session &session); +int timer_session_rotation_pending_check_stop(ltt_session& session); /* Start a session's rotation schedule timer. */ int timer_session_rotation_schedule_timer_start(struct ltt_session *session, - unsigned int interval_us); + unsigned int interval_us); /* Stop a session's rotation schedule timer. */ int timer_session_rotation_schedule_timer_stop(struct ltt_session *session); -bool launch_timer_thread( - struct timer_thread_parameters *timer_thread_parameters); +bool launch_timer_thread(struct timer_thread_parameters *timer_thread_parameters); #endif /* SESSIOND_TIMER_H */ diff --git a/src/bin/lttng-sessiond/trace-class.hpp b/src/bin/lttng-sessiond/trace-class.hpp index cbd411486..afd99ffb7 100644 --- a/src/bin/lttng-sessiond/trace-class.hpp +++ b/src/bin/lttng-sessiond/trace-class.hpp @@ -40,7 +40,7 @@ public: { } - const char* const name; + const char *const name; const ValueType& value; }; diff --git a/src/bin/lttng-sessiond/trace-kernel.hpp b/src/bin/lttng-sessiond/trace-kernel.hpp index a563faa28..265613ba8 100644 --- a/src/bin/lttng-sessiond/trace-kernel.hpp +++ b/src/bin/lttng-sessiond/trace-kernel.hpp @@ -8,15 +8,16 @@ #ifndef _LTT_TRACE_KERNEL_H #define _LTT_TRACE_KERNEL_H -#include +#include "consumer.hpp" +#include "tracker.hpp" -#include -#include -#include #include +#include +#include -#include "consumer.hpp" -#include "tracker.hpp" +#include + +#include /* Kernel event list */ struct ltt_kernel_event_list { @@ -141,41 +142,38 @@ struct ltt_kernel_session { /* * Lookup functions. NULL is returned if not found. */ -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_find_event( - char *name, struct ltt_kernel_channel *channel, - enum lttng_event_type type, - struct lttng_bytecode *filter); -struct ltt_kernel_channel *trace_kernel_get_channel_by_name( - const char *name, struct ltt_kernel_session *session); +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_find_event(char *name, + struct ltt_kernel_channel *channel, + enum lttng_event_type type, + struct lttng_bytecode *filter); +struct ltt_kernel_channel *trace_kernel_get_channel_by_name(const char *name, + struct ltt_kernel_session *session); /* * Create functions malloc() the data structure. */ struct ltt_kernel_session *trace_kernel_create_session(); -struct ltt_kernel_channel *trace_kernel_create_channel( - struct lttng_channel *chan); +struct ltt_kernel_channel *trace_kernel_create_channel(struct lttng_channel *chan); 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); + char *filter_expression, + struct lttng_bytecode *filter, + struct ltt_kernel_event **kernel_event); struct ltt_kernel_metadata *trace_kernel_create_metadata(); -struct ltt_kernel_stream *trace_kernel_create_stream(const char *name, - unsigned int count); -struct ltt_kernel_context *trace_kernel_create_context( - struct lttng_kernel_abi_context *ctx); +struct ltt_kernel_stream *trace_kernel_create_stream(const char *name, unsigned int count); +struct ltt_kernel_context *trace_kernel_create_context(struct lttng_kernel_abi_context *ctx); /* Trigger is only non-const to acquire a reference. */ 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); -struct ltt_kernel_context *trace_kernel_copy_context( - struct ltt_kernel_context *ctx); + struct lttng_trigger *trigger, + uint64_t token, + uint64_t error_counter_index, + struct ltt_kernel_event_notifier_rule **event_notifier_rule); +struct ltt_kernel_context *trace_kernel_copy_context(struct ltt_kernel_context *ctx); 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); /* * Destroy functions free() the data structure and remove from linked list if diff --git a/src/bin/lttng-sessiond/trace-ust.hpp b/src/bin/lttng-sessiond/trace-ust.hpp index 46a69fe9d..74b1df60f 100644 --- a/src/bin/lttng-sessiond/trace-ust.hpp +++ b/src/bin/lttng-sessiond/trace-ust.hpp @@ -9,16 +9,17 @@ #ifndef _LTT_TRACE_UST_H #define _LTT_TRACE_UST_H -#include -#include +#include "consumer.hpp" +#include "lttng-ust-ctl.hpp" #include #include #include + #include -#include "consumer.hpp" -#include "lttng-ust-ctl.hpp" +#include +#include struct agent; @@ -56,7 +57,7 @@ struct ltt_ust_event { /* UST channel */ struct ltt_ust_channel { - uint64_t id; /* unique id per session. */ + uint64_t id; /* unique id per session. */ bool enabled; /* * A UST channel can be part of a userspace sub-domain such as JUL, @@ -92,7 +93,7 @@ struct ust_id_tracker { /* UST session */ struct ltt_ust_session { - uint64_t id; /* Unique identifier of session */ + uint64_t id; /* Unique identifier of session */ struct ltt_ust_domain_global domain_global; /* Hash table of agent indexed by agent domain. */ struct lttng_ht *agents; @@ -118,7 +119,7 @@ struct ltt_ust_session { unsigned int output_traces; unsigned int snapshot_mode; unsigned int has_non_default_channel; - unsigned int live_timer_interval; /* usec */ + unsigned int live_timer_interval; /* usec */ /* Metadata channel attributes. */ struct lttng_ust_abi_channel_attr metadata_attr; @@ -175,39 +176,38 @@ static inline uint64_t trace_ust_get_next_chan_id(struct ltt_ust_session *s) #ifdef HAVE_LIBLTTNG_UST_CTL int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_key); -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); /* * Lookup functions. NULL is returned if not found. */ 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); -struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht, - const char *name); + char *name, + struct lttng_bytecode *filter, + enum lttng_ust_abi_loglevel_type loglevel_type, + int loglevel_value, + struct lttng_event_exclusion *exclusion); +struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht, const char *name); struct agent *trace_ust_find_agent(struct ltt_ust_session *session, - enum lttng_domain_type domain_type); + enum lttng_domain_type domain_type); /* * Create functions malloc() the data structure. */ struct ltt_ust_session *trace_ust_create_session(uint64_t session_id); struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *attr, - enum lttng_domain_type domain); + enum lttng_domain_type domain); 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); -struct ltt_ust_context *trace_ust_create_context( - const struct lttng_event_context *ctx); + char *filter_expression, + struct lttng_bytecode *filter, + struct lttng_event_exclusion *exclusion, + bool internal_event, + struct ltt_ust_event **ust_event); +struct ltt_ust_context *trace_ust_create_context(const struct lttng_event_context *ctx); int trace_ust_match_context(const struct ltt_ust_context *uctx, - const struct lttng_event_context *ctx); -void trace_ust_delete_channel(struct lttng_ht *ht, - struct ltt_ust_channel *channel); + const struct lttng_event_context *ctx); +void trace_ust_delete_channel(struct lttng_ht *ht, struct ltt_ust_channel *channel); int trace_ust_regenerate_metadata(struct ltt_ust_session *usess); @@ -222,187 +222,171 @@ void trace_ust_destroy_context(struct ltt_ust_context *ctx); void trace_ust_free_session(struct ltt_ust_session *session); int trace_ust_id_tracker_lookup(enum lttng_process_attr process_attr, - struct ltt_ust_session *session, - int id); -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_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_remove_value( - struct ltt_ust_session *session, - enum lttng_process_attr process_attr, - const struct process_attr_value *value); -const struct process_attr_tracker *trace_ust_get_process_attr_tracker( - struct ltt_ust_session *session, - enum lttng_process_attr process_attr); + struct ltt_ust_session *session, + int id); +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_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_remove_value(struct ltt_ust_session *session, + enum lttng_process_attr process_attr, + const struct process_attr_value *value); +const struct process_attr_tracker * +trace_ust_get_process_attr_tracker(struct ltt_ust_session *session, + enum lttng_process_attr process_attr); #else /* HAVE_LIBLTTNG_UST_CTL */ -static inline int trace_ust_ht_match_event( - struct cds_lfht_node *node __attribute__((unused)), - const void *_key __attribute__((unused))) +static inline int trace_ust_ht_match_event(struct cds_lfht_node *node __attribute__((unused)), + const void *_key __attribute__((unused))) { return 0; } -static inline int trace_ust_ht_match_event_by_name( - struct cds_lfht_node *node __attribute__((unused)), - const void *_key __attribute__((unused))) +static inline int trace_ust_ht_match_event_by_name(struct cds_lfht_node *node + __attribute__((unused)), + const void *_key __attribute__((unused))) { return 0; } -static inline -struct ltt_ust_channel *trace_ust_find_channel_by_name( - struct lttng_ht *ht __attribute__((unused)), - const char *name __attribute__((unused))) +static inline struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht + __attribute__((unused)), + const char *name + __attribute__((unused))) { return NULL; } -static inline -struct ltt_ust_session *trace_ust_create_session( - unsigned int session_id __attribute__((unused))) +static inline struct ltt_ust_session *trace_ust_create_session(unsigned int session_id + __attribute__((unused))) { return NULL; } -static inline -struct ltt_ust_channel *trace_ust_create_channel( - struct lttng_channel *attr __attribute__((unused)), - enum lttng_domain_type domain __attribute__((unused))) +static inline struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *attr + __attribute__((unused)), + enum lttng_domain_type domain + __attribute__((unused))) { return NULL; } -static inline -enum lttng_error_code trace_ust_create_event( - struct lttng_event *ev __attribute__((unused)), - const char *filter_expression __attribute__((unused)), - struct lttng_bytecode *filter __attribute__((unused)), - struct lttng_event_exclusion *exclusion __attribute__((unused)), - bool internal_event __attribute__((unused)), - struct ltt_ust_event **ust_event __attribute__((unused))) +static inline enum lttng_error_code +trace_ust_create_event(struct lttng_event *ev __attribute__((unused)), + const char *filter_expression __attribute__((unused)), + struct lttng_bytecode *filter __attribute__((unused)), + struct lttng_event_exclusion *exclusion __attribute__((unused)), + bool internal_event __attribute__((unused)), + struct ltt_ust_event **ust_event __attribute__((unused))) { return LTTNG_ERR_NO_UST; } -static inline -void trace_ust_destroy_session( - struct ltt_ust_session *session __attribute__((unused))) +static inline void trace_ust_destroy_session(struct ltt_ust_session *session + __attribute__((unused))) { } -static inline -void trace_ust_destroy_channel( - struct ltt_ust_channel *channel __attribute__((unused))) +static inline void trace_ust_destroy_channel(struct ltt_ust_channel *channel + __attribute__((unused))) { } -static inline -void trace_ust_destroy_event( - struct ltt_ust_event *event __attribute__((unused))) +static inline void trace_ust_destroy_event(struct ltt_ust_event *event __attribute__((unused))) { } -static inline -void trace_ust_free_session( - struct ltt_ust_session *session __attribute__((unused))) +static inline void trace_ust_free_session(struct ltt_ust_session *session __attribute__((unused))) { } -static inline -struct ltt_ust_context *trace_ust_create_context( - const struct lttng_event_context *ctx __attribute__((unused))) +static inline struct ltt_ust_context *trace_ust_create_context(const struct lttng_event_context *ctx + __attribute__((unused))) { return NULL; } -static inline -int trace_ust_match_context( - const struct ltt_ust_context *uctx __attribute__((unused)), - const struct lttng_event_context *ctx __attribute__((unused))) +static inline int trace_ust_match_context(const struct ltt_ust_context *uctx + __attribute__((unused)), + const struct lttng_event_context *ctx + __attribute__((unused))) { return 0; } -static inline -struct ltt_ust_event *trace_ust_find_event( - struct lttng_ht *ht __attribute__((unused)), - char *name __attribute__((unused)), - struct lttng_bytecode *filter __attribute__((unused)), - enum lttng_ust_abi_loglevel_type loglevel_type __attribute__((unused)), - int loglevel_value __attribute__((unused)), - struct lttng_event_exclusion *exclusion __attribute__((unused))) +static inline struct ltt_ust_event * +trace_ust_find_event(struct lttng_ht *ht __attribute__((unused)), + char *name __attribute__((unused)), + struct lttng_bytecode *filter __attribute__((unused)), + enum lttng_ust_abi_loglevel_type loglevel_type __attribute__((unused)), + int loglevel_value __attribute__((unused)), + struct lttng_event_exclusion *exclusion __attribute__((unused))) { return NULL; } -static inline -void trace_ust_delete_channel( - struct lttng_ht *ht __attribute__((unused)), - struct ltt_ust_channel *channel __attribute__((unused))) +static inline void trace_ust_delete_channel(struct lttng_ht *ht __attribute__((unused)), + struct ltt_ust_channel *channel __attribute__((unused))) { return; } -static inline int trace_ust_regenerate_metadata( - struct ltt_ust_session *usess __attribute__((unused))) +static inline int trace_ust_regenerate_metadata(struct ltt_ust_session *usess + __attribute__((unused))) { return 0; } -static inline -struct agent *trace_ust_find_agent( - struct ltt_ust_session *session __attribute__((unused)), - enum lttng_domain_type domain_type __attribute__((unused))) +static inline struct agent *trace_ust_find_agent(struct ltt_ust_session *session + __attribute__((unused)), + enum lttng_domain_type domain_type + __attribute__((unused))) { return NULL; } -static inline int trace_ust_id_tracker_lookup( - enum lttng_process_attr process_attr __attribute__((unused)), - struct ltt_ust_session *session __attribute__((unused)), - int id __attribute__((unused))) +static inline int trace_ust_id_tracker_lookup(enum lttng_process_attr process_attr + __attribute__((unused)), + struct ltt_ust_session *session + __attribute__((unused)), + int id __attribute__((unused))) { return 0; } -static inline enum lttng_error_code -trace_ust_process_attr_tracker_set_tracking_policy( - struct ltt_ust_session *session __attribute__((unused)), - enum lttng_process_attr process_attr __attribute__((unused)), - enum lttng_tracking_policy policy __attribute__((unused))) +static inline enum lttng_error_code trace_ust_process_attr_tracker_set_tracking_policy( + struct ltt_ust_session *session __attribute__((unused)), + enum lttng_process_attr process_attr __attribute__((unused)), + enum lttng_tracking_policy policy __attribute__((unused))) { return LTTNG_OK; } -static inline enum lttng_error_code -trace_ust_process_attr_tracker_inclusion_set_add_value( - struct ltt_ust_session *session __attribute__((unused)), - enum lttng_process_attr process_attr __attribute__((unused)), - const struct process_attr_value *value __attribute__((unused))) +static inline enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_add_value( + struct ltt_ust_session *session __attribute__((unused)), + enum lttng_process_attr process_attr __attribute__((unused)), + const struct process_attr_value *value __attribute__((unused))) { return LTTNG_OK; } -static inline enum lttng_error_code -trace_ust_process_attr_tracker_inclusion_set_remove_value( - struct ltt_ust_session *session __attribute__((unused)), - enum lttng_process_attr process_attr __attribute__((unused)), - const struct process_attr_value *value __attribute__((unused))) +static inline enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_remove_value( + struct ltt_ust_session *session __attribute__((unused)), + enum lttng_process_attr process_attr __attribute__((unused)), + const struct process_attr_value *value __attribute__((unused))) { return LTTNG_OK; } static inline const struct process_attr_tracker * -trace_ust_get_process_attr_tracker( - struct ltt_ust_session *session __attribute__((unused)), - enum lttng_process_attr process_attr __attribute__((unused))) +trace_ust_get_process_attr_tracker(struct ltt_ust_session *session __attribute__((unused)), + enum lttng_process_attr process_attr __attribute__((unused))) { return NULL; } diff --git a/src/bin/lttng-sessiond/tracker.hpp b/src/bin/lttng-sessiond/tracker.hpp index a4edced0e..2996113c5 100644 --- a/src/bin/lttng-sessiond/tracker.hpp +++ b/src/bin/lttng-sessiond/tracker.hpp @@ -10,6 +10,7 @@ #define _LTT_TRACKER_H #include + #include struct process_attr_tracker; @@ -25,22 +26,20 @@ enum process_attr_tracker_status { struct process_attr_tracker *process_attr_tracker_create(); void process_attr_tracker_destroy(struct process_attr_tracker *tracker); -enum lttng_tracking_policy process_attr_tracker_get_tracking_policy( - const struct process_attr_tracker *tracker); -int process_attr_tracker_set_tracking_policy( - struct process_attr_tracker *tracker, - enum lttng_tracking_policy tracking_policy); +enum lttng_tracking_policy +process_attr_tracker_get_tracking_policy(const struct process_attr_tracker *tracker); +int process_attr_tracker_set_tracking_policy(struct process_attr_tracker *tracker, + enum lttng_tracking_policy tracking_policy); -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_remove_value( - struct process_attr_tracker *tracker, - const struct process_attr_value *value); +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_remove_value(struct process_attr_tracker *tracker, + const struct process_attr_value *value); -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); #endif /* _LTT_TRACKER_H */ diff --git a/src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp b/src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp index 61a0c26e9..d8a01864b 100644 --- a/src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp +++ b/src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp @@ -372,8 +372,8 @@ public: _trace_abi(abi), _default_clock_class_name(in_default_clock_class_name ? - in_default_clock_class_name->c_str() : - nullptr), + in_default_clock_class_name->c_str() : + nullptr), _type_overrides(type_overrides) { } diff --git a/src/bin/lttng-sessiond/tsdl-trace-class-visitor.hpp b/src/bin/lttng-sessiond/tsdl-trace-class-visitor.hpp index 1b8bd642d..0c3ceb1fd 100644 --- a/src/bin/lttng-sessiond/tsdl-trace-class-visitor.hpp +++ b/src/bin/lttng-sessiond/tsdl-trace-class-visitor.hpp @@ -8,9 +8,9 @@ #ifndef LTTNG_TSDL_TRACE_CLASS_VISITOR_H #define LTTNG_TSDL_TRACE_CLASS_VISITOR_H -#include "trace-class.hpp" -#include "stream-class.hpp" #include "event-class.hpp" +#include "stream-class.hpp" +#include "trace-class.hpp" #include @@ -36,13 +36,13 @@ public: type_overrider() = default; void publish(const lttng::sessiond::trace::type& original, - lttng::sessiond::trace::type::cuptr new_type_override); - const lttng::sessiond::trace::type& type( - const lttng::sessiond::trace::type& original) const noexcept; + lttng::sessiond::trace::type::cuptr new_type_override); + const lttng::sessiond::trace::type& + type(const lttng::sessiond::trace::type& original) const noexcept; private: std::unordered_map - _overriden_types; + _overriden_types; }; } /* namespace details. */ @@ -56,7 +56,7 @@ private: class trace_class_visitor : public lttng::sessiond::trace::trace_class_visitor { public: trace_class_visitor(const lttng::sessiond::trace::abi& trace_abi, - append_metadata_fragment_function append_metadata); + append_metadata_fragment_function append_metadata); virtual void visit(const lttng::sessiond::trace::trace_class& trace_class) override final; virtual void visit(const lttng::sessiond::trace::clock_class& clock_class) override final; @@ -66,8 +66,8 @@ public: private: /* Coherent (parseable) fragments must be appended. */ void append_metadata_fragment(const std::string& fragment) const; - const lttng::sessiond::trace::type& _lookup_field_type( - const lttng::sessiond::trace::field_location& field_location) const; + const lttng::sessiond::trace::type& + _lookup_field_type(const lttng::sessiond::trace::field_location& field_location) const; const lttng::sessiond::trace::abi& _trace_abi; const append_metadata_fragment_function _append_metadata_fragment; diff --git a/src/bin/lttng-sessiond/ust-abi-internal.hpp b/src/bin/lttng-sessiond/ust-abi-internal.hpp index 343be56b9..a2a0dcabb 100644 --- a/src/bin/lttng-sessiond/ust-abi-internal.hpp +++ b/src/bin/lttng-sessiond/ust-abi-internal.hpp @@ -12,43 +12,44 @@ #ifndef LTTNG_UST_ABI_INTERNAL_H #define LTTNG_UST_ABI_INTERNAL_H -#include #include +#include + #ifndef LTTNG_PACKED #error "LTTNG_PACKED should be defined" #endif #ifndef __ust_stringify -#define __ust_stringify1(x) #x -#define __ust_stringify(x) __ust_stringify1(x) +#define __ust_stringify1(x) #x +#define __ust_stringify(x) __ust_stringify1(x) #endif /* __ust_stringify */ -#define LTTNG_UST_ABI_SYM_NAME_LEN 256 -#define LTTNG_UST_ABI_PROCNAME_LEN 16 +#define LTTNG_UST_ABI_SYM_NAME_LEN 256 +#define LTTNG_UST_ABI_PROCNAME_LEN 16 /* UST comm magic number, used to validate protocol and endianness. */ -#define LTTNG_UST_ABI_COMM_MAGIC 0xC57C57C5 +#define LTTNG_UST_ABI_COMM_MAGIC 0xC57C57C5 /* Version for ABI between liblttng-ust, sessiond, consumerd */ -#define LTTNG_UST_ABI_MAJOR_VERSION 9 -#define LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE 8 -#define LTTNG_UST_ABI_MINOR_VERSION 0 +#define LTTNG_UST_ABI_MAJOR_VERSION 9 +#define LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE 8 +#define LTTNG_UST_ABI_MINOR_VERSION 0 enum lttng_ust_abi_instrumentation { - LTTNG_UST_ABI_TRACEPOINT = 0, - LTTNG_UST_ABI_PROBE = 1, - LTTNG_UST_ABI_FUNCTION = 2, + LTTNG_UST_ABI_TRACEPOINT = 0, + LTTNG_UST_ABI_PROBE = 1, + LTTNG_UST_ABI_FUNCTION = 2, }; enum lttng_ust_abi_loglevel_type { - LTTNG_UST_ABI_LOGLEVEL_ALL = 0, - LTTNG_UST_ABI_LOGLEVEL_RANGE = 1, - LTTNG_UST_ABI_LOGLEVEL_SINGLE = 2, + LTTNG_UST_ABI_LOGLEVEL_ALL = 0, + LTTNG_UST_ABI_LOGLEVEL_RANGE = 1, + LTTNG_UST_ABI_LOGLEVEL_SINGLE = 2, }; enum lttng_ust_abi_output { - LTTNG_UST_ABI_MMAP = 0, + LTTNG_UST_ABI_MMAP = 0, }; enum lttng_ust_abi_chan_type { @@ -62,25 +63,25 @@ struct lttng_ust_abi_tracer_version { uint32_t patchlevel; } LTTNG_PACKED; -#define LTTNG_UST_ABI_CHANNEL_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 32) +#define LTTNG_UST_ABI_CHANNEL_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 32) /* * Given that the consumerd is limited to 64k file descriptors, we * cannot expect much more than 1MB channel structure size. This size is * depends on the number of streams within a channel, which depends on * the number of possible CPUs on the system. */ -#define LTTNG_UST_ABI_CHANNEL_DATA_MAX_LEN 1048576U +#define LTTNG_UST_ABI_CHANNEL_DATA_MAX_LEN 1048576U struct lttng_ust_abi_channel { uint64_t len; - int32_t type; /* enum lttng_ust_abi_chan_type */ + int32_t type; /* enum lttng_ust_abi_chan_type */ char padding[LTTNG_UST_ABI_CHANNEL_PADDING]; - char data[]; /* variable sized data */ + char data[]; /* variable sized data */ } LTTNG_PACKED; -#define LTTNG_UST_ABI_STREAM_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) +#define LTTNG_UST_ABI_STREAM_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) struct lttng_ust_abi_stream { - uint64_t len; /* shm len */ - uint32_t stream_nr; /* stream number */ + uint64_t len; /* shm len */ + uint32_t stream_nr; /* stream number */ char padding[LTTNG_UST_ABI_STREAM_PADDING1]; /* * shm_fd and wakeup_fd are send over unix socket as file @@ -110,8 +111,8 @@ struct lttng_ust_abi_counter_dimension { #define LTTNG_UST_ABI_COUNTER_CONF_PADDING1 67 struct lttng_ust_abi_counter_conf { - uint32_t arithmetic; /* enum lttng_ust_abi_counter_arithmetic */ - uint32_t bitness; /* enum lttng_ust_abi_counter_bitness */ + uint32_t arithmetic; /* enum lttng_ust_abi_counter_arithmetic */ + uint32_t bitness; /* enum lttng_ust_abi_counter_bitness */ uint32_t number_dimensions; int64_t global_sum_step; struct lttng_ust_abi_counter_dimension dimensions[LTTNG_UST_ABI_COUNTER_DIMENSION_MAX]; @@ -125,15 +126,15 @@ struct lttng_ust_abi_counter_value { int64_t value; } LTTNG_PACKED; -#define LTTNG_UST_ABI_EVENT_PADDING1 8 -#define LTTNG_UST_ABI_EVENT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) +#define LTTNG_UST_ABI_EVENT_PADDING1 8 +#define LTTNG_UST_ABI_EVENT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) struct lttng_ust_abi_event { - int32_t instrumentation; /* enum lttng_ust_abi_instrumentation */ - char name[LTTNG_UST_ABI_SYM_NAME_LEN]; /* event name */ + int32_t instrumentation; /* enum lttng_ust_abi_instrumentation */ + char name[LTTNG_UST_ABI_SYM_NAME_LEN]; /* event name */ - int32_t loglevel_type; /* enum lttng_ust_abi_loglevel_type */ - int32_t loglevel; /* value, -1: all */ - uint64_t token; /* User-provided token */ + int32_t loglevel_type; /* enum lttng_ust_abi_loglevel_type */ + int32_t loglevel; /* value, -1: all */ + uint64_t token; /* User-provided token */ char padding[LTTNG_UST_ABI_EVENT_PADDING1]; /* Per instrumentation type configuration */ @@ -142,7 +143,7 @@ struct lttng_ust_abi_event { } u; } LTTNG_PACKED; -#define LTTNG_UST_ABI_EVENT_NOTIFIER_PADDING 32 +#define LTTNG_UST_ABI_EVENT_NOTIFIER_PADDING 32 struct lttng_ust_abi_event_notifier { struct lttng_ust_abi_event event; uint64_t error_counter_index; @@ -156,68 +157,68 @@ struct lttng_ust_abi_event_notifier_notification { char padding[LTTNG_UST_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING]; } LTTNG_PACKED; -#define LTTNG_UST_ABI_COUNTER_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) -#define LTTNG_UST_ABI_COUNTER_DATA_MAX_LEN 4096U +#define LTTNG_UST_ABI_COUNTER_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) +#define LTTNG_UST_ABI_COUNTER_DATA_MAX_LEN 4096U struct lttng_ust_abi_counter { uint64_t len; char padding[LTTNG_UST_ABI_COUNTER_PADDING1]; - char data[]; /* variable sized data */ + char data[]; /* variable sized data */ } LTTNG_PACKED; -#define LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) +#define LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) struct lttng_ust_abi_counter_global { - uint64_t len; /* shm len */ + uint64_t len; /* shm len */ char padding[LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1]; } LTTNG_PACKED; -#define LTTNG_UST_ABI_COUNTER_CPU_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) +#define LTTNG_UST_ABI_COUNTER_CPU_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) struct lttng_ust_abi_counter_cpu { - uint64_t len; /* shm len */ + uint64_t len; /* shm len */ uint32_t cpu_nr; char padding[LTTNG_UST_ABI_COUNTER_CPU_PADDING1]; } LTTNG_PACKED; enum lttng_ust_abi_field_type { - LTTNG_UST_ABI_FIELD_OTHER = 0, - LTTNG_UST_ABI_FIELD_INTEGER = 1, - LTTNG_UST_ABI_FIELD_ENUM = 2, - LTTNG_UST_ABI_FIELD_FLOAT = 3, - LTTNG_UST_ABI_FIELD_STRING = 4, + LTTNG_UST_ABI_FIELD_OTHER = 0, + LTTNG_UST_ABI_FIELD_INTEGER = 1, + LTTNG_UST_ABI_FIELD_ENUM = 2, + LTTNG_UST_ABI_FIELD_FLOAT = 3, + LTTNG_UST_ABI_FIELD_STRING = 4, }; -#define LTTNG_UST_ABI_FIELD_ITER_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 28) +#define LTTNG_UST_ABI_FIELD_ITER_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 28) struct lttng_ust_abi_field_iter { char event_name[LTTNG_UST_ABI_SYM_NAME_LEN]; char field_name[LTTNG_UST_ABI_SYM_NAME_LEN]; - int32_t type; /* enum lttng_ust_abi_field_type */ - int loglevel; /* event loglevel */ + int32_t type; /* enum lttng_ust_abi_field_type */ + int loglevel; /* event loglevel */ int nowrite; char padding[LTTNG_UST_ABI_FIELD_ITER_PADDING]; } LTTNG_PACKED; enum lttng_ust_abi_context_type { - LTTNG_UST_ABI_CONTEXT_VTID = 0, - LTTNG_UST_ABI_CONTEXT_VPID = 1, - LTTNG_UST_ABI_CONTEXT_PTHREAD_ID = 2, - LTTNG_UST_ABI_CONTEXT_PROCNAME = 3, - LTTNG_UST_ABI_CONTEXT_IP = 4, - LTTNG_UST_ABI_CONTEXT_PERF_THREAD_COUNTER = 5, - LTTNG_UST_ABI_CONTEXT_CPU_ID = 6, - LTTNG_UST_ABI_CONTEXT_APP_CONTEXT = 7, - LTTNG_UST_ABI_CONTEXT_CGROUP_NS = 8, - LTTNG_UST_ABI_CONTEXT_IPC_NS = 9, - LTTNG_UST_ABI_CONTEXT_MNT_NS = 10, - LTTNG_UST_ABI_CONTEXT_NET_NS = 11, - LTTNG_UST_ABI_CONTEXT_PID_NS = 12, - LTTNG_UST_ABI_CONTEXT_USER_NS = 13, - LTTNG_UST_ABI_CONTEXT_UTS_NS = 14, - LTTNG_UST_ABI_CONTEXT_VUID = 15, - LTTNG_UST_ABI_CONTEXT_VEUID = 16, - LTTNG_UST_ABI_CONTEXT_VSUID = 17, - LTTNG_UST_ABI_CONTEXT_VGID = 18, - LTTNG_UST_ABI_CONTEXT_VEGID = 19, - LTTNG_UST_ABI_CONTEXT_VSGID = 20, - LTTNG_UST_ABI_CONTEXT_TIME_NS = 21, + LTTNG_UST_ABI_CONTEXT_VTID = 0, + LTTNG_UST_ABI_CONTEXT_VPID = 1, + LTTNG_UST_ABI_CONTEXT_PTHREAD_ID = 2, + LTTNG_UST_ABI_CONTEXT_PROCNAME = 3, + LTTNG_UST_ABI_CONTEXT_IP = 4, + LTTNG_UST_ABI_CONTEXT_PERF_THREAD_COUNTER = 5, + LTTNG_UST_ABI_CONTEXT_CPU_ID = 6, + LTTNG_UST_ABI_CONTEXT_APP_CONTEXT = 7, + LTTNG_UST_ABI_CONTEXT_CGROUP_NS = 8, + LTTNG_UST_ABI_CONTEXT_IPC_NS = 9, + LTTNG_UST_ABI_CONTEXT_MNT_NS = 10, + LTTNG_UST_ABI_CONTEXT_NET_NS = 11, + LTTNG_UST_ABI_CONTEXT_PID_NS = 12, + LTTNG_UST_ABI_CONTEXT_USER_NS = 13, + LTTNG_UST_ABI_CONTEXT_UTS_NS = 14, + LTTNG_UST_ABI_CONTEXT_VUID = 15, + LTTNG_UST_ABI_CONTEXT_VEUID = 16, + LTTNG_UST_ABI_CONTEXT_VSUID = 17, + LTTNG_UST_ABI_CONTEXT_VGID = 18, + LTTNG_UST_ABI_CONTEXT_VEGID = 19, + LTTNG_UST_ABI_CONTEXT_VSGID = 20, + LTTNG_UST_ABI_CONTEXT_TIME_NS = 21, }; struct lttng_ust_abi_perf_counter_ctx { @@ -226,10 +227,10 @@ struct lttng_ust_abi_perf_counter_ctx { char name[LTTNG_UST_ABI_SYM_NAME_LEN]; } LTTNG_PACKED; -#define LTTNG_UST_ABI_CONTEXT_PADDING1 16 -#define LTTNG_UST_ABI_CONTEXT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) +#define LTTNG_UST_ABI_CONTEXT_PADDING1 16 +#define LTTNG_UST_ABI_CONTEXT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) struct lttng_ust_abi_context { - int32_t ctx; /* enum lttng_ust_abi_context_type */ + int32_t ctx; /* enum lttng_ust_abi_context_type */ char padding[LTTNG_UST_ABI_CONTEXT_PADDING1]; union { @@ -246,25 +247,25 @@ struct lttng_ust_abi_context { /* * Tracer channel attributes. */ -#define LTTNG_UST_ABI_CHANNEL_ATTR_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 32) +#define LTTNG_UST_ABI_CHANNEL_ATTR_PADDING (LTTNG_UST_ABI_SYM_NAME_LEN + 32) struct lttng_ust_abi_channel_attr { - uint64_t subbuf_size; /* bytes */ - uint64_t num_subbuf; /* power of 2 */ - int overwrite; /* 1: overwrite, 0: discard */ - unsigned int switch_timer_interval; /* usec */ - unsigned int read_timer_interval; /* usec */ - int32_t output; /* enum lttng_ust_abi_output */ + uint64_t subbuf_size; /* bytes */ + uint64_t num_subbuf; /* power of 2 */ + int overwrite; /* 1: overwrite, 0: discard */ + unsigned int switch_timer_interval; /* usec */ + unsigned int read_timer_interval; /* usec */ + int32_t output; /* enum lttng_ust_abi_output */ union { struct { - int64_t blocking_timeout; /* Blocking timeout (usec) */ + int64_t blocking_timeout; /* Blocking timeout (usec) */ } s; char padding[LTTNG_UST_ABI_CHANNEL_ATTR_PADDING]; } u; } LTTNG_PACKED; -#define LTTNG_UST_ABI_TRACEPOINT_ITER_PADDING 16 +#define LTTNG_UST_ABI_TRACEPOINT_ITER_PADDING 16 struct lttng_ust_abi_tracepoint_iter { - char name[LTTNG_UST_ABI_SYM_NAME_LEN]; /* provider:name */ + char name[LTTNG_UST_ABI_SYM_NAME_LEN]; /* provider:name */ int loglevel; char padding[LTTNG_UST_ABI_TRACEPOINT_ITER_PADDING]; } LTTNG_PACKED; @@ -282,18 +283,18 @@ enum lttng_ust_abi_object_type { LTTNG_UST_ABI_OBJECT_TYPE_COUNTER_CPU = 8, }; -#define LTTNG_UST_ABI_OBJECT_DATA_PADDING1 32 -#define LTTNG_UST_ABI_OBJECT_DATA_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) +#define LTTNG_UST_ABI_OBJECT_DATA_PADDING1 32 +#define LTTNG_UST_ABI_OBJECT_DATA_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) struct lttng_ust_abi_object_data { - int32_t type; /* enum lttng_ust_abi_object_type */ + int32_t type; /* enum lttng_ust_abi_object_type */ int handle; uint64_t size; char padding1[LTTNG_UST_ABI_OBJECT_DATA_PADDING1]; union { struct { void *data; - int32_t type; /* enum lttng_ust_abi_chan_type */ + int32_t type; /* enum lttng_ust_abi_chan_type */ int wakeup_fd; } channel; struct { @@ -319,10 +320,10 @@ enum lttng_ust_abi_calibrate_type { LTTNG_UST_ABI_CALIBRATE_TRACEPOINT, }; -#define LTTNG_UST_ABI_CALIBRATE_PADDING1 16 -#define LTTNG_UST_ABI_CALIBRATE_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) +#define LTTNG_UST_ABI_CALIBRATE_PADDING1 16 +#define LTTNG_UST_ABI_CALIBRATE_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32) struct lttng_ust_abi_calibrate { - enum lttng_ust_abi_calibrate_type type; /* type (input) */ + enum lttng_ust_abi_calibrate_type type; /* type (input) */ char padding[LTTNG_UST_ABI_CALIBRATE_PADDING1]; union { @@ -330,8 +331,8 @@ struct lttng_ust_abi_calibrate { } u; } LTTNG_PACKED; -#define LTTNG_UST_ABI_FILTER_BYTECODE_MAX_LEN 65536 -#define LTTNG_UST_ABI_FILTER_PADDING 32 +#define LTTNG_UST_ABI_FILTER_BYTECODE_MAX_LEN 65536 +#define LTTNG_UST_ABI_FILTER_PADDING 32 struct lttng_ust_abi_filter_bytecode { uint32_t len; uint32_t reloc_offset; @@ -340,8 +341,8 @@ struct lttng_ust_abi_filter_bytecode { char data[0]; } LTTNG_PACKED; -#define LTTNG_UST_ABI_CAPTURE_BYTECODE_MAX_LEN 65536 -#define LTTNG_UST_ABI_CAPTURE_PADDING 32 +#define LTTNG_UST_ABI_CAPTURE_BYTECODE_MAX_LEN 65536 +#define LTTNG_UST_ABI_CAPTURE_PADDING 32 struct lttng_ust_abi_capture_bytecode { uint32_t len; uint32_t reloc_offset; @@ -350,80 +351,71 @@ struct lttng_ust_abi_capture_bytecode { char data[0]; } LTTNG_PACKED; -#define LTTNG_UST_ABI_EXCLUSION_PADDING 32 +#define LTTNG_UST_ABI_EXCLUSION_PADDING 32 struct lttng_ust_abi_event_exclusion { uint32_t count; char padding[LTTNG_UST_ABI_EXCLUSION_PADDING]; char names[LTTNG_UST_ABI_SYM_NAME_LEN][0]; } LTTNG_PACKED; -#define LTTNG_UST_ABI_CMD(minor) (minor) -#define LTTNG_UST_ABI_CMDR(minor, type) (minor) -#define LTTNG_UST_ABI_CMDW(minor, type) (minor) +#define LTTNG_UST_ABI_CMD(minor) (minor) +#define LTTNG_UST_ABI_CMDR(minor, type) (minor) +#define LTTNG_UST_ABI_CMDW(minor, type) (minor) /* Handled by object descriptor */ -#define LTTNG_UST_ABI_RELEASE LTTNG_UST_ABI_CMD(0x1) +#define LTTNG_UST_ABI_RELEASE LTTNG_UST_ABI_CMD(0x1) /* Handled by object cmd */ /* LTTng-UST commands */ -#define LTTNG_UST_ABI_SESSION LTTNG_UST_ABI_CMD(0x40) -#define LTTNG_UST_ABI_TRACER_VERSION \ - LTTNG_UST_ABI_CMDR(0x41, struct lttng_ust_abi_tracer_version) -#define LTTNG_UST_ABI_TRACEPOINT_LIST LTTNG_UST_ABI_CMD(0x42) -#define LTTNG_UST_ABI_WAIT_QUIESCENT LTTNG_UST_ABI_CMD(0x43) -#define LTTNG_UST_ABI_REGISTER_DONE LTTNG_UST_ABI_CMD(0x44) -#define LTTNG_UST_ABI_TRACEPOINT_FIELD_LIST LTTNG_UST_ABI_CMD(0x45) -#define LTTNG_UST_ABI_EVENT_NOTIFIER_GROUP_CREATE \ - LTTNG_UST_ABI_CMD(0x46) +#define LTTNG_UST_ABI_SESSION LTTNG_UST_ABI_CMD(0x40) +#define LTTNG_UST_ABI_TRACER_VERSION LTTNG_UST_ABI_CMDR(0x41, struct lttng_ust_abi_tracer_version) +#define LTTNG_UST_ABI_TRACEPOINT_LIST LTTNG_UST_ABI_CMD(0x42) +#define LTTNG_UST_ABI_WAIT_QUIESCENT LTTNG_UST_ABI_CMD(0x43) +#define LTTNG_UST_ABI_REGISTER_DONE LTTNG_UST_ABI_CMD(0x44) +#define LTTNG_UST_ABI_TRACEPOINT_FIELD_LIST LTTNG_UST_ABI_CMD(0x45) +#define LTTNG_UST_ABI_EVENT_NOTIFIER_GROUP_CREATE LTTNG_UST_ABI_CMD(0x46) /* Session commands */ -#define LTTNG_UST_ABI_CHANNEL \ - LTTNG_UST_ABI_CMDW(0x51, struct lttng_ust_abi_channel) -#define LTTNG_UST_ABI_SESSION_START LTTNG_UST_ABI_CMD(0x52) -#define LTTNG_UST_ABI_SESSION_STOP LTTNG_UST_ABI_CMD(0x53) -#define LTTNG_UST_ABI_SESSION_STATEDUMP LTTNG_UST_ABI_CMD(0x54) +#define LTTNG_UST_ABI_CHANNEL LTTNG_UST_ABI_CMDW(0x51, struct lttng_ust_abi_channel) +#define LTTNG_UST_ABI_SESSION_START LTTNG_UST_ABI_CMD(0x52) +#define LTTNG_UST_ABI_SESSION_STOP LTTNG_UST_ABI_CMD(0x53) +#define LTTNG_UST_ABI_SESSION_STATEDUMP LTTNG_UST_ABI_CMD(0x54) /* Channel commands */ -#define LTTNG_UST_ABI_STREAM LTTNG_UST_ABI_CMD(0x60) -#define LTTNG_UST_ABI_EVENT \ - LTTNG_UST_ABI_CMDW(0x61, struct lttng_ust_abi_event) +#define LTTNG_UST_ABI_STREAM LTTNG_UST_ABI_CMD(0x60) +#define LTTNG_UST_ABI_EVENT LTTNG_UST_ABI_CMDW(0x61, struct lttng_ust_abi_event) /* Event and channel commands */ -#define LTTNG_UST_ABI_CONTEXT \ - LTTNG_UST_ABI_CMDW(0x70, struct lttng_ust_abi_context) -#define LTTNG_UST_ABI_FLUSH_BUFFER \ - LTTNG_UST_ABI_CMD(0x71) +#define LTTNG_UST_ABI_CONTEXT LTTNG_UST_ABI_CMDW(0x70, struct lttng_ust_abi_context) +#define LTTNG_UST_ABI_FLUSH_BUFFER LTTNG_UST_ABI_CMD(0x71) /* Event, event notifier, channel and session commands */ -#define LTTNG_UST_ABI_ENABLE LTTNG_UST_ABI_CMD(0x80) -#define LTTNG_UST_ABI_DISABLE LTTNG_UST_ABI_CMD(0x81) +#define LTTNG_UST_ABI_ENABLE LTTNG_UST_ABI_CMD(0x80) +#define LTTNG_UST_ABI_DISABLE LTTNG_UST_ABI_CMD(0x81) /* Tracepoint list commands */ #define LTTNG_UST_ABI_TRACEPOINT_LIST_GET LTTNG_UST_ABI_CMD(0x90) -#define LTTNG_UST_ABI_TRACEPOINT_FIELD_LIST_GET LTTNG_UST_ABI_CMD(0x91) +#define LTTNG_UST_ABI_TRACEPOINT_FIELD_LIST_GET LTTNG_UST_ABI_CMD(0x91) /* Event and event notifier commands */ -#define LTTNG_UST_ABI_FILTER LTTNG_UST_ABI_CMD(0xA0) -#define LTTNG_UST_ABI_EXCLUSION LTTNG_UST_ABI_CMD(0xA1) +#define LTTNG_UST_ABI_FILTER LTTNG_UST_ABI_CMD(0xA0) +#define LTTNG_UST_ABI_EXCLUSION LTTNG_UST_ABI_CMD(0xA1) /* Event notifier group commands */ -#define LTTNG_UST_ABI_EVENT_NOTIFIER_CREATE \ +#define LTTNG_UST_ABI_EVENT_NOTIFIER_CREATE \ LTTNG_UST_ABI_CMDW(0xB0, struct lttng_ust_abi_event_notifier) /* Event notifier commands */ -#define LTTNG_UST_ABI_CAPTURE LTTNG_UST_ABI_CMD(0xB6) +#define LTTNG_UST_ABI_CAPTURE LTTNG_UST_ABI_CMD(0xB6) /* Session and event notifier group commands */ -#define LTTNG_UST_ABI_COUNTER \ - LTTNG_UST_ABI_CMDW(0xC0, struct lttng_ust_abi_counter) +#define LTTNG_UST_ABI_COUNTER LTTNG_UST_ABI_CMDW(0xC0, struct lttng_ust_abi_counter) /* Counter commands */ -#define LTTNG_UST_ABI_COUNTER_GLOBAL \ - LTTNG_UST_ABI_CMDW(0xD0, struct lttng_ust_abi_counter_global) -#define LTTNG_UST_ABI_COUNTER_CPU \ - LTTNG_UST_ABI_CMDW(0xD1, struct lttng_ust_abi_counter_cpu) +#define LTTNG_UST_ABI_COUNTER_GLOBAL LTTNG_UST_ABI_CMDW(0xD0, struct lttng_ust_abi_counter_global) +#define LTTNG_UST_ABI_COUNTER_CPU LTTNG_UST_ABI_CMDW(0xD1, struct lttng_ust_abi_counter_cpu) -#define LTTNG_UST_ABI_ROOT_HANDLE 0 +#define LTTNG_UST_ABI_ROOT_HANDLE 0 #endif /* LTTNG_UST_ABI_INTERNAL_H */ diff --git a/src/bin/lttng-sessiond/ust-app.hpp b/src/bin/lttng-sessiond/ust-app.hpp index 3200b6549..fdc007853 100644 --- a/src/bin/lttng-sessiond/ust-app.hpp +++ b/src/bin/lttng-sessiond/ust-app.hpp @@ -9,22 +9,22 @@ #ifndef _LTT_UST_APP_H #define _LTT_UST_APP_H -#include +#include "session.hpp" +#include "trace-ust.hpp" +#include "ust-field-convert.hpp" +#include "ust-registry-session.hpp" +#include "ust-registry.hpp" -#include #include +#include #include -#include "trace-ust.hpp" -#include "ust-registry.hpp" -#include "ust-registry-session.hpp" -#include "session.hpp" -#include "ust-field-convert.hpp" +#include #define UST_APP_EVENT_LIST_SIZE 32 /* Process name (short). */ -#define UST_APP_PROCNAME_LEN 16 +#define UST_APP_PROCNAME_LEN 16 struct lttng_bytecode; struct lttng_ust_filter_bytecode; @@ -67,7 +67,7 @@ struct ust_register_msg { uint32_t uint32_t_alignment; uint32_t uint64_t_alignment; uint32_t long_alignment; - int byte_order; /* BIG_ENDIAN or LITTLE_ENDIAN */ + int byte_order; /* BIG_ENDIAN or LITTLE_ENDIAN */ char name[LTTNG_UST_ABI_PROCNAME_LEN]; }; @@ -198,17 +198,17 @@ struct ust_app_session { bool enabled; /* started: has the session been in started state at any time ? */ - bool started; /* allows detection of start vs restart. */ - int handle; /* used has unique identifier for app session */ + bool started; /* allows detection of start vs restart. */ + int handle; /* used has unique identifier for app session */ - bool deleted; /* Session deleted flag. Check with lock held. */ + bool deleted; /* Session deleted flag. Check with lock held. */ /* * Tracing session ID. Multiple ust app session can have the same tracing * session id making this value NOT unique to the object. */ uint64_t tracing_id; - uint64_t id; /* Unique session identifier */ + uint64_t id; /* Unique session identifier */ struct lttng_ht *channels; /* Registered channels */ struct lttng_ht_node_u64 node; /* @@ -235,7 +235,7 @@ struct ust_app_session { struct rcu_head rcu_head; /* If the channel's streams have to be outputed or not. */ unsigned int output_traces; - unsigned int live_timer_interval; /* usec */ + unsigned int live_timer_interval; /* usec */ /* Metadata channel attributes. */ struct lttng_ust_ctl_consumer_channel_attr metadata_attr; @@ -251,14 +251,14 @@ struct ust_app_session { struct ust_app { /* Traffic initiated from the session daemon to the application. */ int sock; - pthread_mutex_t sock_lock; /* Protects sock protocol. */ + pthread_mutex_t sock_lock; /* Protects sock protocol. */ /* Traffic initiated from the application to the session daemon. */ int notify_sock; pid_t pid; pid_t ppid; - uid_t uid; /* User ID that owns the apps */ - gid_t gid; /* Group ID that owns the apps */ + uid_t uid; /* User ID that owns the apps */ + gid_t gid; /* Group ID that owns the apps */ /* App ABI. */ lttng::sessiond::trace::abi abi; @@ -267,8 +267,8 @@ struct ust_app { supported version of the session daemon, this flag is set to 0 (NOT compatible) else 1. */ struct lttng_ust_abi_tracer_version version; - uint32_t v_major; /* Version major number */ - uint32_t v_minor; /* Version minor number */ + uint32_t v_major; /* Version major number */ + uint32_t v_minor; /* Version minor number */ /* Extra for the NULL byte. */ char name[UST_APP_PROCNAME_LEN + 1]; /* Type of buffer this application uses. */ @@ -341,11 +341,17 @@ struct formatter : formatter { template typename FormatContextType::iterator format(const ust_app& app, FormatContextType& ctx) { - return format_to(ctx.out(), - "{{ procname = `{}`, ppid = {}, pid = {}, uid = {}, gid = {}, version = {}.{}, registration time = {} }}", - app.name, app.ppid, app.pid, app.uid, app.gid, app.v_major, - app.v_minor, - lttng::utils::time_to_iso8601_str(app.registration_time)); + return format_to( + ctx.out(), + "{{ procname = `{}`, ppid = {}, pid = {}, uid = {}, gid = {}, version = {}.{}, registration time = {} }}", + app.name, + app.ppid, + app.pid, + app.uid, + app.gid, + app.v_major, + app.v_minor, + lttng::utils::time_to_iso8601_str(app.registration_time)); } }; } /* namespace fmt */ @@ -362,17 +368,19 @@ int ust_app_destroy_trace_all(struct ltt_ust_session *usess); int ust_app_list_events(struct lttng_event **events); int ust_app_list_event_fields(struct lttng_event_field **fields); int ust_app_create_event_glb(struct ltt_ust_session *usess, - struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent); -int ust_app_disable_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); + struct ltt_ust_channel *uchan, + struct ltt_ust_event *uevent); +int ust_app_disable_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 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 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 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); void ust_app_global_update(struct ltt_ust_session *usess, struct ust_app *app); void ust_app_global_update_all(struct ltt_ust_session *usess); void ust_app_global_update_event_notifier_rules(struct ust_app *app); @@ -388,37 +396,38 @@ void ust_app_add(struct ust_app *app); struct ust_app *ust_app_create(struct ust_register_msg *msg, int sock); void ust_app_notify_sock_unregister(int sock); ssize_t ust_app_push_metadata(const lttng::sessiond::ust::registry_session::locked_ptr& registry, - struct consumer_socket *socket, - int send_zero_data); + struct consumer_socket *socket, + int send_zero_data); void ust_app_destroy(struct ust_app *app); -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); -uint64_t ust_app_get_size_one_more_packet_per_stream( - const struct ltt_ust_session *usess, uint64_t cur_nr_packets); +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); +uint64_t ust_app_get_size_one_more_packet_per_stream(const struct ltt_ust_session *usess, + uint64_t cur_nr_packets); struct ust_app *ust_app_find_by_sock(int sock); 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 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 ust_app_regenerate_statedump_all(struct ltt_ust_session *usess); enum lttng_error_code ust_app_rotate_session(struct ltt_session *session); -enum lttng_error_code ust_app_create_channel_subdirectories( - const struct ltt_ust_session *session); -int ust_app_release_object(struct ust_app *app, - struct lttng_ust_abi_object_data *data); +enum lttng_error_code ust_app_create_channel_subdirectories(const struct ltt_ust_session *session); +int ust_app_release_object(struct ust_app *app, struct lttng_ust_abi_object_data *data); enum lttng_error_code ust_app_clear_session(struct ltt_session *session); enum lttng_error_code ust_app_open_packets(struct ltt_session *session); int ust_app_setup_event_notifier_group(struct ust_app *app); -static inline -int ust_app_supported() +static inline int ust_app_supported() { return 1; } @@ -428,353 +437,293 @@ bool ust_app_supports_counters(const struct ust_app *app); #else /* HAVE_LIBLTTNG_UST_CTL */ -static inline -int ust_app_destroy_trace_all( - struct ltt_ust_session *usess __attribute__((unused))) +static inline int ust_app_destroy_trace_all(struct ltt_ust_session *usess __attribute__((unused))) { return 0; } -static inline -int ust_app_start_trace( - struct ltt_ust_session *usess __attribute__((unused)), - struct ust_app *app __attribute__((unused))) +static inline int ust_app_start_trace(struct ltt_ust_session *usess __attribute__((unused)), + struct ust_app *app __attribute__((unused))) { return 0; } -static inline -int ust_app_start_trace_all( - struct ltt_ust_session *usess __attribute__((unused))) +static inline int ust_app_start_trace_all(struct ltt_ust_session *usess __attribute__((unused))) { return 0; } -static inline -int ust_app_stop_trace_all( - struct ltt_ust_session *usess __attribute__((unused))) +static inline int ust_app_stop_trace_all(struct ltt_ust_session *usess __attribute__((unused))) { return 0; } -static inline -int ust_app_list_events( - struct lttng_event **events __attribute__((unused))) +static inline int ust_app_list_events(struct lttng_event **events __attribute__((unused))) { return -ENOSYS; } -static inline -int ust_app_list_event_fields( - struct lttng_event_field **fields __attribute__((unused))) +static inline int ust_app_list_event_fields(struct lttng_event_field **fields + __attribute__((unused))) { return -ENOSYS; } -static inline -int ust_app_register( - struct ust_register_msg *msg __attribute__((unused)), - int sock __attribute__((unused))) +static inline int ust_app_register(struct ust_register_msg *msg __attribute__((unused)), + int sock __attribute__((unused))) { return -ENOSYS; } -static inline -int ust_app_register_done(struct ust_app *app __attribute__((unused))) +static inline int ust_app_register_done(struct ust_app *app __attribute__((unused))) { return -ENOSYS; } -static inline -int ust_app_version(struct ust_app *app __attribute__((unused))) +static inline int ust_app_version(struct ust_app *app __attribute__((unused))) { return -ENOSYS; } -static inline -void ust_app_unregister(int sock __attribute__((unused))) +static inline void ust_app_unregister(int sock __attribute__((unused))) { } -static inline -void ust_app_clean_list(void) +static inline void ust_app_clean_list(void) { } -static inline -struct ust_app_list *ust_app_get_list(void) +static inline struct ust_app_list *ust_app_get_list(void) { return NULL; } -static inline -struct ust_app *ust_app_get_by_pid(pid_t pid __attribute__((unused))) +static inline struct ust_app *ust_app_get_by_pid(pid_t pid __attribute__((unused))) { return NULL; } -static inline -int ust_app_ht_alloc(void) +static inline int ust_app_ht_alloc(void) { return 0; } -static inline -void ust_app_global_update( - struct ltt_ust_session *usess __attribute__((unused)), - struct ust_app *app __attribute__((unused))) -{} +static inline void ust_app_global_update(struct ltt_ust_session *usess __attribute__((unused)), + struct ust_app *app __attribute__((unused))) +{ +} -static inline -void ust_app_global_update_event_notifier_rules( - struct ust_app *app __attribute__((unused))) -{} +static inline void ust_app_global_update_event_notifier_rules(struct ust_app *app + __attribute__((unused))) +{ +} -static inline -void ust_app_global_update_all_event_notifier_rules(void) -{} +static inline void ust_app_global_update_all_event_notifier_rules(void) +{ +} -static inline -int ust_app_setup_event_notifier_group( - struct ust_app *app __attribute__((unused))) +static inline int ust_app_setup_event_notifier_group(struct ust_app *app __attribute__((unused))) { return 0; } -static inline -int ust_app_disable_channel_glb( - struct ltt_ust_session *usess __attribute__((unused)), - struct ltt_ust_channel *uchan __attribute__((unused))) +static inline int ust_app_disable_channel_glb(struct ltt_ust_session *usess __attribute__((unused)), + struct ltt_ust_channel *uchan __attribute__((unused))) { return 0; } -static inline -int ust_app_enable_channel_glb( - struct ltt_ust_session *usess __attribute__((unused)), - struct ltt_ust_channel *uchan __attribute__((unused))) +static inline int ust_app_enable_channel_glb(struct ltt_ust_session *usess __attribute__((unused)), + struct ltt_ust_channel *uchan __attribute__((unused))) { return 0; } -static inline -int ust_app_create_event_glb( - struct ltt_ust_session *usess __attribute__((unused)), - struct ltt_ust_channel *uchan __attribute__((unused)), - struct ltt_ust_event *uevent __attribute__((unused))) +static inline int ust_app_create_event_glb(struct ltt_ust_session *usess __attribute__((unused)), + struct ltt_ust_channel *uchan __attribute__((unused)), + struct ltt_ust_event *uevent __attribute__((unused))) { return 0; } -static inline -int ust_app_disable_event_glb( - struct ltt_ust_session *usess __attribute__((unused)), - struct ltt_ust_channel *uchan __attribute__((unused)), - struct ltt_ust_event *uevent __attribute__((unused))) +static inline int ust_app_disable_event_glb(struct ltt_ust_session *usess __attribute__((unused)), + struct ltt_ust_channel *uchan __attribute__((unused)), + struct ltt_ust_event *uevent __attribute__((unused))) { return 0; } -static inline -int ust_app_enable_event_glb( - struct ltt_ust_session *usess __attribute__((unused)), - struct ltt_ust_channel *uchan __attribute__((unused)), - struct ltt_ust_event *uevent __attribute__((unused))) +static inline int ust_app_enable_event_glb(struct ltt_ust_session *usess __attribute__((unused)), + struct ltt_ust_channel *uchan __attribute__((unused)), + struct ltt_ust_event *uevent __attribute__((unused))) { return 0; } -static inline -int ust_app_add_ctx_channel_glb( - struct ltt_ust_session *usess __attribute__((unused)), - struct ltt_ust_channel *uchan __attribute__((unused)), - struct ltt_ust_context *uctx __attribute__((unused))) +static inline int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess __attribute__((unused)), + struct ltt_ust_channel *uchan __attribute__((unused)), + struct ltt_ust_context *uctx __attribute__((unused))) { return 0; } -static inline -int ust_app_enable_event_pid( - struct ltt_ust_session *usess __attribute__((unused)), - struct ltt_ust_channel *uchan __attribute__((unused)), - struct ltt_ust_event *uevent __attribute__((unused)), - pid_t pid __attribute__((unused))) +static inline int ust_app_enable_event_pid(struct ltt_ust_session *usess __attribute__((unused)), + struct ltt_ust_channel *uchan __attribute__((unused)), + struct ltt_ust_event *uevent __attribute__((unused)), + pid_t pid __attribute__((unused))) { return 0; } -static inline -int ust_app_recv_registration( - int sock __attribute__((unused)), - struct ust_register_msg *msg __attribute__((unused))) +static inline int ust_app_recv_registration(int sock __attribute__((unused)), + struct ust_register_msg *msg __attribute__((unused))) { return 0; } -static inline -int ust_app_recv_notify(int sock __attribute__((unused))) +static inline int ust_app_recv_notify(int sock __attribute__((unused))) { return 0; } -static inline -struct ust_app *ust_app_create( - struct ust_register_msg *msg __attribute__((unused)), - int sock __attribute__((unused))) +static inline struct ust_app *ust_app_create(struct ust_register_msg *msg __attribute__((unused)), + int sock __attribute__((unused))) { return NULL; } -static inline -void ust_app_add(struct ust_app *app __attribute__((unused))) +static inline void ust_app_add(struct ust_app *app __attribute__((unused))) { } -static inline -void ust_app_notify_sock_unregister(int sock __attribute__((unused))) +static inline void ust_app_notify_sock_unregister(int sock __attribute__((unused))) { } -static inline -ssize_t ust_app_push_metadata( - lttng::sessiond::ust::registry_session *registry __attribute__((unused)), - struct consumer_socket *socket __attribute__((unused)), - int send_zero_data __attribute__((unused))) +static inline ssize_t ust_app_push_metadata(lttng::sessiond::ust::registry_session *registry + __attribute__((unused)), + struct consumer_socket *socket __attribute__((unused)), + int send_zero_data __attribute__((unused))) { return 0; } -static inline -void ust_app_destroy(struct ust_app *app __attribute__((unused))) +static inline void ust_app_destroy(struct ust_app *app __attribute__((unused))) { return; } -static inline -enum lttng_error_code ust_app_snapshot_record( - struct ltt_ust_session *usess __attribute__((unused)), - const struct consumer_output *output __attribute__((unused)), - uint64_t max_stream_size __attribute__((unused))) +static inline enum lttng_error_code +ust_app_snapshot_record(struct ltt_ust_session *usess __attribute__((unused)), + const struct consumer_output *output __attribute__((unused)), + uint64_t max_stream_size __attribute__((unused))) { return LTTNG_ERR_UNK; } -static inline -unsigned int ust_app_get_nb_stream( - struct ltt_ust_session *usess __attribute__((unused))) +static inline unsigned int ust_app_get_nb_stream(struct ltt_ust_session *usess + __attribute__((unused))) { return 0; } -static inline -void ust_app_update_event_notifier_error_count( - struct lttng_trigger *lttng_trigger __attribute__((unused))) +static inline void ust_app_update_event_notifier_error_count(struct lttng_trigger *lttng_trigger + __attribute__((unused))) { return; } -static inline -int ust_app_supported(void) +static inline int ust_app_supported(void) { return 0; } -static inline -bool ust_app_supports_notifiers( - const struct ust_app *app __attribute__((unused))) +static inline bool ust_app_supports_notifiers(const struct ust_app *app __attribute__((unused))) { return false; } -static inline -bool ust_app_supports_counters( - const struct ust_app *app __attribute__((unused))) +static inline bool ust_app_supports_counters(const struct ust_app *app __attribute__((unused))) { return false; } -static inline -struct ust_app *ust_app_find_by_sock(int sock __attribute__((unused))) +static inline struct ust_app *ust_app_find_by_sock(int sock __attribute__((unused))) { return NULL; } -static inline -struct ust_app *ust_app_find_by_pid(pid_t pid __attribute__((unused))) +static inline struct ust_app *ust_app_find_by_pid(pid_t pid __attribute__((unused))) { return NULL; } -static inline -uint64_t ust_app_get_size_one_more_packet_per_stream( - const struct ltt_ust_session *usess __attribute__((unused)), - uint64_t cur_nr_packets __attribute__((unused))) { +static inline uint64_t +ust_app_get_size_one_more_packet_per_stream(const struct ltt_ust_session *usess + __attribute__((unused)), + uint64_t cur_nr_packets __attribute__((unused))) +{ return 0; } -static inline -int ust_app_uid_get_channel_runtime_stats( - uint64_t ust_session_id __attribute__((unused)), - struct cds_list_head *buffer_reg_uid_list __attribute__((unused)), - struct consumer_output *consumer __attribute__((unused)), - int overwrite __attribute__((unused)), - uint64_t uchan_id __attribute__((unused)), - uint64_t *discarded __attribute__((unused)), - uint64_t *lost __attribute__((unused))) +static inline int ust_app_uid_get_channel_runtime_stats(uint64_t ust_session_id + __attribute__((unused)), + struct cds_list_head *buffer_reg_uid_list + __attribute__((unused)), + struct consumer_output *consumer + __attribute__((unused)), + int overwrite __attribute__((unused)), + uint64_t uchan_id __attribute__((unused)), + uint64_t *discarded __attribute__((unused)), + uint64_t *lost __attribute__((unused))) { return 0; } -static inline -int ust_app_pid_get_channel_runtime_stats( - struct ltt_ust_session *usess __attribute__((unused)), - struct ltt_ust_channel *uchan __attribute__((unused)), - struct consumer_output *consumer __attribute__((unused)), - int overwrite __attribute__((unused)), - uint64_t *discarded __attribute__((unused)), - uint64_t *lost __attribute__((unused))) +static inline int +ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess __attribute__((unused)), + struct ltt_ust_channel *uchan __attribute__((unused)), + struct consumer_output *consumer __attribute__((unused)), + int overwrite __attribute__((unused)), + uint64_t *discarded __attribute__((unused)), + uint64_t *lost __attribute__((unused))) { return 0; } -static inline -int ust_app_regenerate_statedump_all( - struct ltt_ust_session *usess __attribute__((unused))) +static inline int ust_app_regenerate_statedump_all(struct ltt_ust_session *usess + __attribute__((unused))) { return 0; } -static inline -enum lttng_error_code ust_app_rotate_session( - struct ltt_session *session __attribute__((unused))) +static inline enum lttng_error_code ust_app_rotate_session(struct ltt_session *session + __attribute__((unused))) { return LTTNG_ERR_UNK; } -static inline -enum lttng_error_code ust_app_create_channel_subdirectories( - const struct ltt_ust_session *session __attribute__((unused))) +static inline enum lttng_error_code +ust_app_create_channel_subdirectories(const struct ltt_ust_session *session __attribute__((unused))) { return LTTNG_ERR_UNK; } -static inline -int ust_app_release_object(struct ust_app *app __attribute__((unused)), - struct lttng_ust_abi_object_data *data __attribute__((unused))) +static inline int ust_app_release_object(struct ust_app *app __attribute__((unused)), + struct lttng_ust_abi_object_data *data + __attribute__((unused))) { return 0; } -static inline -enum lttng_error_code ust_app_clear_session( - struct ltt_session *session __attribute__((unused))) +static inline enum lttng_error_code ust_app_clear_session(struct ltt_session *session + __attribute__((unused))) { return LTTNG_ERR_UNK; } -static inline -enum lttng_error_code ust_app_open_packets( - struct ltt_session *session __attribute__((unused))) +static inline enum lttng_error_code ust_app_open_packets(struct ltt_session *session + __attribute__((unused))) { return LTTNG_ERR_UNK; } diff --git a/src/bin/lttng-sessiond/ust-consumer.hpp b/src/bin/lttng-sessiond/ust-consumer.hpp index f752131b6..9fc83e6ab 100644 --- a/src/bin/lttng-sessiond/ust-consumer.hpp +++ b/src/bin/lttng-sessiond/ust-consumer.hpp @@ -10,34 +10,35 @@ #include "consumer.hpp" #include "ust-app.hpp" -#include + #include +#include + 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, - lttng::sessiond::ust::registry_session *registry, - struct lttng_trace_chunk *trace_chunk); + struct ust_app_channel *ua_chan, + struct consumer_output *consumer, + struct consumer_socket *socket, + lttng::sessiond::ust::registry_session *registry, + struct lttng_trace_chunk *trace_chunk); -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 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 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 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); #ifdef HAVE_LIBLTTNG_UST_CTL int ust_consumer_metadata_request(struct consumer_socket *sock); #else -static inline -int ust_consumer_metadata_request( - struct consumer_socket *sock __attribute__((unused))) +static inline int ust_consumer_metadata_request(struct consumer_socket *sock + __attribute__((unused))) { return -ENOSYS; } diff --git a/src/bin/lttng-sessiond/ust-ctl-internal.hpp b/src/bin/lttng-sessiond/ust-ctl-internal.hpp index aee3cd580..661c94725 100644 --- a/src/bin/lttng-sessiond/ust-ctl-internal.hpp +++ b/src/bin/lttng-sessiond/ust-ctl-internal.hpp @@ -9,42 +9,40 @@ #ifndef LTTNG_UST_CTL_INTERNAL_H #define LTTNG_UST_CTL_INTERNAL_H -#include -#include - #include "lttng-ust-abi.hpp" +#include +#include + #ifndef LTTNG_UST_UUID_LEN -#define LTTNG_UST_UUID_LEN 16 +#define LTTNG_UST_UUID_LEN 16 #endif /* Default unix socket path */ -#define LTTNG_UST_SOCK_FILENAME \ - "lttng-ust-sock-" \ - __ust_stringify(LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE) +#define LTTNG_UST_SOCK_FILENAME \ + "lttng-ust-sock-" __ust_stringify(LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE) /* * Shared memory files path are automatically related to shm root, e.g. * /dev/shm under linux. */ -#define LTTNG_UST_WAIT_FILENAME \ - "lttng-ust-wait-" \ - __ust_stringify(LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE) +#define LTTNG_UST_WAIT_FILENAME \ + "lttng-ust-wait-" __ust_stringify(LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE) struct lttng_ust_shm_handle; struct lttng_ust_lib_ring_buffer; struct lttng_ust_ctl_consumer_channel_attr { enum lttng_ust_abi_chan_type type; - uint64_t subbuf_size; /* bytes */ - uint64_t num_subbuf; /* power of 2 */ - int overwrite; /* 1: overwrite, 0: discard */ - unsigned int switch_timer_interval; /* usec */ - unsigned int read_timer_interval; /* usec */ - enum lttng_ust_abi_output output; /* splice, mmap */ - uint32_t chan_id; /* channel ID */ + uint64_t subbuf_size; /* bytes */ + uint64_t num_subbuf; /* power of 2 */ + int overwrite; /* 1: overwrite, 0: discard */ + unsigned int switch_timer_interval; /* usec */ + unsigned int read_timer_interval; /* usec */ + enum lttng_ust_abi_output output; /* splice, mmap */ + uint32_t chan_id; /* channel ID */ unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */ - int64_t blocking_timeout; /* Blocking timeout (usec) */ + int64_t blocking_timeout; /* Blocking timeout (usec) */ } LTTNG_PACKED; /* @@ -69,18 +67,23 @@ struct lttng_ust_context_attr { */ int lttng_ust_ctl_register_done(int sock); int lttng_ust_ctl_create_session(int sock); -int lttng_ust_ctl_create_event(int sock, struct lttng_ust_abi_event *ev, - struct lttng_ust_abi_object_data *channel_data, - struct lttng_ust_abi_object_data **event_data); -int lttng_ust_ctl_add_context(int sock, struct lttng_ust_context_attr *ctx, - struct lttng_ust_abi_object_data *obj_data, - struct lttng_ust_abi_object_data **context_data); -int lttng_ust_ctl_set_filter(int sock, struct lttng_ust_abi_filter_bytecode *bytecode, - struct lttng_ust_abi_object_data *obj_data); -int lttng_ust_ctl_set_capture(int sock, struct lttng_ust_abi_capture_bytecode *bytecode, - struct lttng_ust_abi_object_data *obj_data); -int lttng_ust_ctl_set_exclusion(int sock, struct lttng_ust_abi_event_exclusion *exclusion, - struct lttng_ust_abi_object_data *obj_data); +int lttng_ust_ctl_create_event(int sock, + struct lttng_ust_abi_event *ev, + struct lttng_ust_abi_object_data *channel_data, + struct lttng_ust_abi_object_data **event_data); +int lttng_ust_ctl_add_context(int sock, + struct lttng_ust_context_attr *ctx, + struct lttng_ust_abi_object_data *obj_data, + struct lttng_ust_abi_object_data **context_data); +int lttng_ust_ctl_set_filter(int sock, + struct lttng_ust_abi_filter_bytecode *bytecode, + struct lttng_ust_abi_object_data *obj_data); +int lttng_ust_ctl_set_capture(int sock, + struct lttng_ust_abi_capture_bytecode *bytecode, + struct lttng_ust_abi_object_data *obj_data); +int lttng_ust_ctl_set_exclusion(int sock, + struct lttng_ust_abi_event_exclusion *exclusion, + struct lttng_ust_abi_object_data *obj_data); int lttng_ust_ctl_enable(int sock, struct lttng_ust_abi_object_data *object); int lttng_ust_ctl_disable(int sock, struct lttng_ust_abi_object_data *object); @@ -94,8 +97,8 @@ int lttng_ust_ctl_stop_session(int sock, int handle); * of that group is fired. It returns a handle to be used when creating event * notifier in that group. */ -int lttng_ust_ctl_create_event_notifier_group(int sock, int pipe_fd, - struct lttng_ust_abi_object_data **event_notifier_group); +int lttng_ust_ctl_create_event_notifier_group( + int sock, int pipe_fd, struct lttng_ust_abi_object_data **event_notifier_group); /* * lttng_ust_ctl_create_event notifier creates a event notifier in a event notifier @@ -105,9 +108,9 @@ int lttng_ust_ctl_create_event_notifier_group(int sock, int pipe_fd, * notifier. */ int lttng_ust_ctl_create_event_notifier(int sock, - struct lttng_ust_abi_event_notifier *event_notifier, - struct lttng_ust_abi_object_data *event_notifier_group, - struct lttng_ust_abi_object_data **event_notifier_data); + struct lttng_ust_abi_event_notifier *event_notifier, + struct lttng_ust_abi_object_data *event_notifier_group, + struct lttng_ust_abi_object_data **event_notifier_data); /* * lttng_ust_ctl_tracepoint_list returns a tracepoint list handle, or negative @@ -120,8 +123,9 @@ int lttng_ust_ctl_tracepoint_list(int sock); * handle. End is iteration is reached when -LTTNG_UST_ERR_NOENT is * returned. */ -int lttng_ust_ctl_tracepoint_list_get(int sock, int tp_list_handle, - struct lttng_ust_abi_tracepoint_iter *iter); +int lttng_ust_ctl_tracepoint_list_get(int sock, + int tp_list_handle, + struct lttng_ust_abi_tracepoint_iter *iter); /* * lttng_ust_ctl_tracepoint_field_list returns a tracepoint field list handle, @@ -134,8 +138,9 @@ int lttng_ust_ctl_tracepoint_field_list(int sock); * list handle. End is iteration is reached when -LTTNG_UST_ERR_NOENT is * returned. */ -int lttng_ust_ctl_tracepoint_field_list_get(int sock, int tp_field_list_handle, - struct lttng_ust_abi_field_iter *iter); +int lttng_ust_ctl_tracepoint_field_list_get(int sock, + int tp_field_list_handle, + struct lttng_ust_abi_field_iter *iter); int lttng_ust_ctl_tracer_version(int sock, struct lttng_ust_abi_tracer_version *v); int lttng_ust_ctl_wait_quiescent(int sock); @@ -150,14 +155,15 @@ int lttng_ust_ctl_release_object(int sock, struct lttng_ust_abi_object_data *dat int lttng_ust_ctl_release_handle(int sock, int handle); int lttng_ust_ctl_recv_channel_from_consumer(int sock, - struct lttng_ust_abi_object_data **channel_data); + struct lttng_ust_abi_object_data **channel_data); int lttng_ust_ctl_recv_stream_from_consumer(int sock, - struct lttng_ust_abi_object_data **stream_data); -int lttng_ust_ctl_send_channel_to_ust(int sock, int session_handle, - struct lttng_ust_abi_object_data *channel_data); + struct lttng_ust_abi_object_data **stream_data); +int lttng_ust_ctl_send_channel_to_ust(int sock, + int session_handle, + struct lttng_ust_abi_object_data *channel_data); int lttng_ust_ctl_send_stream_to_ust(int sock, - struct lttng_ust_abi_object_data *channel_data, - struct lttng_ust_abi_object_data *stream_data); + struct lttng_ust_abi_object_data *channel_data, + struct lttng_ust_abi_object_data *stream_data); /* * lttng_ust_ctl_duplicate_ust_object_data allocated a new object in "dest" if @@ -165,7 +171,7 @@ int lttng_ust_ctl_send_stream_to_ust(int sock, * lttng_ust_ctl_release_object() and then freed with free(). */ int lttng_ust_ctl_duplicate_ust_object_data(struct lttng_ust_abi_object_data **dest, - struct lttng_ust_abi_object_data *src); + struct lttng_ust_abi_object_data *src); /* * API used by consumer. @@ -177,9 +183,8 @@ struct lttng_ust_ctl_consumer_channel_attr; int lttng_ust_ctl_get_nr_stream_per_channel(void); -struct lttng_ust_ctl_consumer_channel * - lttng_ust_ctl_create_channel(struct lttng_ust_ctl_consumer_channel_attr *attr, - const int *stream_fds, int nr_stream_fds); +struct lttng_ust_ctl_consumer_channel *lttng_ust_ctl_create_channel( + struct lttng_ust_ctl_consumer_channel_attr *attr, const int *stream_fds, int nr_stream_fds); /* * Each stream created needs to be destroyed before calling * lttng_ust_ctl_destroy_channel(). @@ -187,27 +192,25 @@ struct lttng_ust_ctl_consumer_channel * void lttng_ust_ctl_destroy_channel(struct lttng_ust_ctl_consumer_channel *chan); int lttng_ust_ctl_send_channel_to_sessiond(int sock, - struct lttng_ust_ctl_consumer_channel *channel); + struct lttng_ust_ctl_consumer_channel *channel); int lttng_ust_ctl_channel_close_wait_fd(struct lttng_ust_ctl_consumer_channel *consumer_chan); int lttng_ust_ctl_channel_close_wakeup_fd(struct lttng_ust_ctl_consumer_channel *consumer_chan); int lttng_ust_ctl_channel_get_wait_fd(struct lttng_ust_ctl_consumer_channel *consumer_chan); int lttng_ust_ctl_channel_get_wakeup_fd(struct lttng_ust_ctl_consumer_channel *consumer_chan); -int lttng_ust_ctl_write_metadata_to_channel( - struct lttng_ust_ctl_consumer_channel *channel, - const char *metadata_str, /* NOT null-terminated */ - size_t len); /* metadata length */ -ssize_t lttng_ust_ctl_write_one_packet_to_channel( - struct lttng_ust_ctl_consumer_channel *channel, - const char *metadata_str, /* NOT null-terminated */ - size_t len); /* metadata length */ +int lttng_ust_ctl_write_metadata_to_channel(struct lttng_ust_ctl_consumer_channel *channel, + const char *metadata_str, /* NOT null-terminated */ + size_t len); /* metadata length */ +ssize_t lttng_ust_ctl_write_one_packet_to_channel(struct lttng_ust_ctl_consumer_channel *channel, + const char *metadata_str, /* NOT null-terminated + */ + size_t len); /* metadata length */ /* * Send a NULL stream to finish iteration over all streams of a given * channel. */ -int lttng_ust_ctl_send_stream_to_sessiond(int sock, - struct lttng_ust_ctl_consumer_stream *stream); +int lttng_ust_ctl_send_stream_to_sessiond(int sock, struct lttng_ust_ctl_consumer_stream *stream); int lttng_ust_ctl_stream_close_wait_fd(struct lttng_ust_ctl_consumer_stream *stream); int lttng_ust_ctl_stream_close_wakeup_fd(struct lttng_ust_ctl_consumer_stream *stream); int lttng_ust_ctl_stream_get_wait_fd(struct lttng_ust_ctl_consumer_stream *stream); @@ -215,15 +218,13 @@ int lttng_ust_ctl_stream_get_wakeup_fd(struct lttng_ust_ctl_consumer_stream *str /* Create/destroy stream buffers for read */ struct lttng_ust_ctl_consumer_stream * - lttng_ust_ctl_create_stream(struct lttng_ust_ctl_consumer_channel *channel, - int cpu); +lttng_ust_ctl_create_stream(struct lttng_ust_ctl_consumer_channel *channel, int cpu); void lttng_ust_ctl_destroy_stream(struct lttng_ust_ctl_consumer_stream *stream); /* For mmap mode, readable without "get" operation */ -int lttng_ust_ctl_get_mmap_len(struct lttng_ust_ctl_consumer_stream *stream, - unsigned long *len); +int lttng_ust_ctl_get_mmap_len(struct lttng_ust_ctl_consumer_stream *stream, unsigned long *len); int lttng_ust_ctl_get_max_subbuf_size(struct lttng_ust_ctl_consumer_stream *stream, - unsigned long *len); + unsigned long *len); /* * For mmap mode, operate on the current packet (between get/put or @@ -231,11 +232,10 @@ int lttng_ust_ctl_get_max_subbuf_size(struct lttng_ust_ctl_consumer_stream *stre */ void *lttng_ust_ctl_get_mmap_base(struct lttng_ust_ctl_consumer_stream *stream); int lttng_ust_ctl_get_mmap_read_offset(struct lttng_ust_ctl_consumer_stream *stream, - unsigned long *off); -int lttng_ust_ctl_get_subbuf_size(struct lttng_ust_ctl_consumer_stream *stream, - unsigned long *len); + unsigned long *off); +int lttng_ust_ctl_get_subbuf_size(struct lttng_ust_ctl_consumer_stream *stream, unsigned long *len); int lttng_ust_ctl_get_padded_subbuf_size(struct lttng_ust_ctl_consumer_stream *stream, - unsigned long *len); + unsigned long *len); int lttng_ust_ctl_get_next_subbuf(struct lttng_ust_ctl_consumer_stream *stream); int lttng_ust_ctl_put_next_subbuf(struct lttng_ust_ctl_consumer_stream *stream); @@ -244,15 +244,13 @@ int lttng_ust_ctl_put_next_subbuf(struct lttng_ust_ctl_consumer_stream *stream); int lttng_ust_ctl_snapshot(struct lttng_ust_ctl_consumer_stream *stream); int lttng_ust_ctl_snapshot_sample_positions(struct lttng_ust_ctl_consumer_stream *stream); int lttng_ust_ctl_snapshot_get_consumed(struct lttng_ust_ctl_consumer_stream *stream, - unsigned long *pos); + unsigned long *pos); int lttng_ust_ctl_snapshot_get_produced(struct lttng_ust_ctl_consumer_stream *stream, - unsigned long *pos); -int lttng_ust_ctl_get_subbuf(struct lttng_ust_ctl_consumer_stream *stream, - unsigned long *pos); + unsigned long *pos); +int lttng_ust_ctl_get_subbuf(struct lttng_ust_ctl_consumer_stream *stream, unsigned long *pos); int lttng_ust_ctl_put_subbuf(struct lttng_ust_ctl_consumer_stream *stream); -int lttng_ust_ctl_flush_buffer(struct lttng_ust_ctl_consumer_stream *stream, - int producer_active); +int lttng_ust_ctl_flush_buffer(struct lttng_ust_ctl_consumer_stream *stream, int producer_active); int lttng_ust_ctl_clear_buffer(struct lttng_ust_ctl_consumer_stream *stream); /* index */ @@ -263,34 +261,30 @@ int lttng_ust_ctl_clear_buffer(struct lttng_ust_ctl_consumer_stream *stream); */ int lttng_ust_ctl_get_timestamp_begin(struct lttng_ust_ctl_consumer_stream *stream, - uint64_t *timestamp_begin); + uint64_t *timestamp_begin); int lttng_ust_ctl_get_timestamp_end(struct lttng_ust_ctl_consumer_stream *stream, - uint64_t *timestamp_end); + uint64_t *timestamp_end); int lttng_ust_ctl_get_events_discarded(struct lttng_ust_ctl_consumer_stream *stream, - uint64_t *events_discarded); + uint64_t *events_discarded); int lttng_ust_ctl_get_content_size(struct lttng_ust_ctl_consumer_stream *stream, - uint64_t *content_size); + uint64_t *content_size); int lttng_ust_ctl_get_packet_size(struct lttng_ust_ctl_consumer_stream *stream, - uint64_t *packet_size); -int lttng_ust_ctl_get_sequence_number(struct lttng_ust_ctl_consumer_stream *stream, - uint64_t *seq); + uint64_t *packet_size); +int lttng_ust_ctl_get_sequence_number(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *seq); /* * Getter returning state invariant for the stream, which can be used * without "get" operation. */ -int lttng_ust_ctl_get_stream_id(struct lttng_ust_ctl_consumer_stream *stream, - uint64_t *stream_id); -int lttng_ust_ctl_get_instance_id(struct lttng_ust_ctl_consumer_stream *stream, - uint64_t *id); +int lttng_ust_ctl_get_stream_id(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *stream_id); +int lttng_ust_ctl_get_instance_id(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *id); /* * Getter returning the current timestamp as perceived from the * tracer. */ -int lttng_ust_ctl_get_current_timestamp(struct lttng_ust_ctl_consumer_stream *stream, - uint64_t *ts); +int lttng_ust_ctl_get_current_timestamp(struct lttng_ust_ctl_consumer_stream *stream, uint64_t *ts); /* returns whether UST has perf counters support. */ int lttng_ust_ctl_has_perf_counters(void); @@ -321,13 +315,13 @@ enum lttng_ust_ctl_channel_header { enum lttng_ust_ctl_abstract_types { lttng_ust_ctl_atype_integer, - lttng_ust_ctl_atype_enum, /* legacy */ - lttng_ust_ctl_atype_array, /* legacy */ - lttng_ust_ctl_atype_sequence, /* legacy */ + lttng_ust_ctl_atype_enum, /* legacy */ + lttng_ust_ctl_atype_array, /* legacy */ + lttng_ust_ctl_atype_sequence, /* legacy */ lttng_ust_ctl_atype_string, lttng_ust_ctl_atype_float, - lttng_ust_ctl_atype_variant, /* legacy */ - lttng_ust_ctl_atype_struct, /* legacy */ + lttng_ust_ctl_atype_variant, /* legacy */ + lttng_ust_ctl_atype_struct, /* legacy */ lttng_ust_ctl_atype_enum_nestable, lttng_ust_ctl_atype_array_nestable, lttng_ust_ctl_atype_sequence_nestable, @@ -343,27 +337,27 @@ enum lttng_ust_ctl_string_encodings { NR_LTTNG_UST_CTL_STRING_ENCODINGS, }; -#define LTTNG_UST_CTL_UST_INTEGER_TYPE_PADDING 24 +#define LTTNG_UST_CTL_UST_INTEGER_TYPE_PADDING 24 struct lttng_ust_ctl_integer_type { - uint32_t size; /* in bits */ + uint32_t size; /* in bits */ uint32_t signedness; uint32_t reverse_byte_order; - uint32_t base; /* 2, 8, 10, 16, for pretty print */ - int32_t encoding; /* enum lttng_ust_ctl_string_encodings */ - uint16_t alignment; /* in bits */ + uint32_t base; /* 2, 8, 10, 16, for pretty print */ + int32_t encoding; /* enum lttng_ust_ctl_string_encodings */ + uint16_t alignment; /* in bits */ char padding[LTTNG_UST_CTL_UST_INTEGER_TYPE_PADDING]; } LTTNG_PACKED; -#define LTTNG_UST_CTL_UST_FLOAT_TYPE_PADDING 24 +#define LTTNG_UST_CTL_UST_FLOAT_TYPE_PADDING 24 struct lttng_ust_ctl_float_type { - uint32_t exp_dig; /* exponent digits, in bits */ - uint32_t mant_dig; /* mantissa digits, in bits */ + uint32_t exp_dig; /* exponent digits, in bits */ + uint32_t mant_dig; /* mantissa digits, in bits */ uint32_t reverse_byte_order; - uint16_t alignment; /* in bits */ + uint16_t alignment; /* in bits */ char padding[LTTNG_UST_CTL_UST_FLOAT_TYPE_PADDING]; } LTTNG_PACKED; -#define LTTNG_UST_CTL_UST_ENUM_VALUE_PADDING 15 +#define LTTNG_UST_CTL_UST_ENUM_VALUE_PADDING 15 struct lttng_ust_ctl_enum_value { uint64_t value; uint8_t signedness; @@ -374,7 +368,7 @@ enum lttng_ust_ctl_ust_enum_entry_options { LTTNG_UST_CTL_UST_ENUM_ENTRY_OPTION_IS_AUTO = 1U << 0, }; -#define LTTNG_UST_CTL_UST_ENUM_ENTRY_PADDING 32 +#define LTTNG_UST_CTL_UST_ENUM_ENTRY_PADDING 32 struct lttng_ust_ctl_enum_entry { struct lttng_ust_ctl_enum_value start, end; /* start and end are inclusive */ char string[LTTNG_UST_ABI_SYM_NAME_LEN]; @@ -387,16 +381,16 @@ struct lttng_ust_ctl_enum_entry { } LTTNG_PACKED; /* legacy */ -#define LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING 296 +#define LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING 296 union _lttng_ust_ctl_basic_type { struct lttng_ust_ctl_integer_type integer; struct { char name[LTTNG_UST_ABI_SYM_NAME_LEN]; struct lttng_ust_ctl_integer_type container_type; - uint64_t id; /* enum ID in sessiond. */ + uint64_t id; /* enum ID in sessiond. */ } enumeration; struct { - int32_t encoding; /* enum lttng_ust_ctl_string_encodings */ + int32_t encoding; /* enum lttng_ust_ctl_string_encodings */ } string; struct lttng_ust_ctl_float_type _float; char padding[LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING]; @@ -414,28 +408,28 @@ struct lttng_ust_ctl_basic_type { * Padding is derived from largest member: u.legacy.sequence which * contains two basic types, each with LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING. */ -#define LTTNG_UST_CTL_UST_TYPE_PADDING (2 * LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING) +#define LTTNG_UST_CTL_UST_TYPE_PADDING (2 * LTTNG_UST_CTL_UST_BASIC_TYPE_PADDING) struct lttng_ust_ctl_type { enum lttng_ust_ctl_abstract_types atype; union { struct lttng_ust_ctl_integer_type integer; struct lttng_ust_ctl_float_type _float; struct { - int32_t encoding; /* enum lttng_ust_ctl_string_encodings */ + int32_t encoding; /* enum lttng_ust_ctl_string_encodings */ } string; struct { char name[LTTNG_UST_ABI_SYM_NAME_LEN]; - uint64_t id; /* enum ID in sessiond. */ + uint64_t id; /* enum ID in sessiond. */ /* container_type follows after this struct lttng_ust_ctl_field. */ } enum_nestable; struct { - uint32_t length; /* num. elems. */ + uint32_t length; /* num. elems. */ uint32_t alignment; /* elem_type follows after this struct lttng_ust_ctl_field. */ } array_nestable; struct { char length_name[LTTNG_UST_ABI_SYM_NAME_LEN]; - uint32_t alignment; /* Alignment before elements. */ + uint32_t alignment; /* Alignment before elements. */ /* elem_type follows after the length_type. */ } sequence_nestable; struct { @@ -455,7 +449,7 @@ struct lttng_ust_ctl_type { union _lttng_ust_ctl_basic_type basic; struct { struct lttng_ust_ctl_basic_type elem_type; - uint32_t length; /* num. elems. */ + uint32_t length; /* num. elems. */ } array; struct { struct lttng_ust_ctl_basic_type length_type; @@ -475,7 +469,7 @@ struct lttng_ust_ctl_type { } u; } LTTNG_PACKED; -#define LTTNG_UST_CTL_UST_FIELD_PADDING 28 +#define LTTNG_UST_CTL_UST_FIELD_PADDING 28 struct lttng_ust_ctl_field { char name[LTTNG_UST_ABI_SYM_NAME_LEN]; struct lttng_ust_ctl_type type; @@ -488,21 +482,21 @@ struct lttng_ust_ctl_field { * the output fields are not populated. */ int lttng_ust_ctl_recv_reg_msg(int sock, - enum lttng_ust_ctl_socket_type *type, - uint32_t *major, - uint32_t *minor, - uint32_t *pid, - uint32_t *ppid, - uint32_t *uid, - uint32_t *gid, - uint32_t *bits_per_long, - uint32_t *uint8_t_alignment, - uint32_t *uint16_t_alignment, - uint32_t *uint32_t_alignment, - uint32_t *uint64_t_alignment, - uint32_t *long_alignment, - int *byte_order, - char *name); /* size LTTNG_UST_ABI_PROCNAME_LEN */ + enum lttng_ust_ctl_socket_type *type, + uint32_t *major, + uint32_t *minor, + uint32_t *pid, + uint32_t *ppid, + uint32_t *uid, + uint32_t *gid, + uint32_t *bits_per_long, + uint32_t *uint8_t_alignment, + uint32_t *uint16_t_alignment, + uint32_t *uint32_t_alignment, + uint32_t *uint64_t_alignment, + uint32_t *long_alignment, + int *byte_order, + char *name); /* size LTTNG_UST_ABI_PROCNAME_LEN */ /* * Returns 0 on success, negative UST or system error value on error. @@ -517,63 +511,63 @@ int lttng_ust_ctl_recv_notify(int sock, enum lttng_ust_ctl_notify_cmd *notify_cm * Returns 0 on success, negative UST or system error value on error. */ int lttng_ust_ctl_recv_register_event(int sock, - int *session_objd, /* session descriptor (output) */ - int *channel_objd, /* channel descriptor (output) */ - char *event_name, /* - * event name (output, - * size LTTNG_UST_ABI_SYM_NAME_LEN) - */ - int *loglevel, - char **signature, /* - * event signature - * (output, dynamically - * allocated, must be free(3)'d - * by the caller if function - * returns success.) - */ - size_t *nr_fields, - struct lttng_ust_ctl_field **fields, - char **model_emf_uri); + int *session_objd, /* session descriptor (output) */ + int *channel_objd, /* channel descriptor (output) */ + char *event_name, /* + * event name (output, + * size LTTNG_UST_ABI_SYM_NAME_LEN) + */ + int *loglevel, + char **signature, /* + * event signature + * (output, dynamically + * allocated, must be free(3)'d + * by the caller if function + * returns success.) + */ + size_t *nr_fields, + struct lttng_ust_ctl_field **fields, + char **model_emf_uri); /* * Returns 0 on success, negative error value on error. */ int lttng_ust_ctl_reply_register_event(int sock, - uint32_t id, /* event id (input) */ - int ret_code); /* return code. 0 ok, negative error */ + uint32_t id, /* event id (input) */ + int ret_code); /* return code. 0 ok, negative error */ /* * Returns 0 on success, negative UST or system error value on error. */ int lttng_ust_ctl_recv_register_enum(int sock, - int *session_objd, - char *enum_name, - struct lttng_ust_ctl_enum_entry **entries, - size_t *nr_entries); + int *session_objd, + char *enum_name, + struct lttng_ust_ctl_enum_entry **entries, + size_t *nr_entries); /* * Returns 0 on success, negative error value on error. */ int lttng_ust_ctl_reply_register_enum(int sock, - uint64_t id, /* enum id (input) */ - int ret_code); + uint64_t id, /* enum id (input) */ + int ret_code); /* * Returns 0 on success, negative UST or system error value on error. */ int lttng_ust_ctl_recv_register_channel(int sock, - int *session_objd, /* session descriptor (output) */ - int *channel_objd, /* channel descriptor (output) */ - size_t *nr_fields, /* context fields */ - struct lttng_ust_ctl_field **fields); + int *session_objd, /* session descriptor (output) */ + int *channel_objd, /* channel descriptor (output) */ + size_t *nr_fields, /* context fields */ + struct lttng_ust_ctl_field **fields); /* * Returns 0 on success, negative error value on error. */ int lttng_ust_ctl_reply_register_channel(int sock, - uint32_t chan_id, - enum lttng_ust_ctl_channel_header header_type, - int ret_code); /* return code. 0 ok, negative error */ + uint32_t chan_id, + enum lttng_ust_ctl_channel_header header_type, + int ret_code); /* return code. 0 ok, negative error */ /* * Counter API. @@ -585,8 +579,8 @@ enum lttng_ust_ctl_counter_bitness { }; enum lttng_ust_ctl_counter_arithmetic { - LTTNG_UST_CTL_COUNTER_ARITHMETIC_MODULAR = 0, - LTTNG_UST_CTL_COUNTER_ARITHMETIC_SATURATION = 1, + LTTNG_UST_CTL_COUNTER_ARITHMETIC_MODULAR = 0, + LTTNG_UST_CTL_COUNTER_ARITHMETIC_SATURATION = 1, }; /* Used as alloc flags. */ @@ -608,24 +602,25 @@ struct lttng_ust_ctl_counter_dimension { }; struct lttng_ust_ctl_daemon_counter * - lttng_ust_ctl_create_counter(size_t nr_dimensions, - const struct lttng_ust_ctl_counter_dimension *dimensions, - int64_t global_sum_step, - int global_counter_fd, - int nr_counter_cpu_fds, - const int *counter_cpu_fds, - enum lttng_ust_ctl_counter_bitness bitness, - enum lttng_ust_ctl_counter_arithmetic arithmetic, - uint32_t alloc_flags, - bool coalesce_hits); +lttng_ust_ctl_create_counter(size_t nr_dimensions, + const struct lttng_ust_ctl_counter_dimension *dimensions, + int64_t global_sum_step, + int global_counter_fd, + int nr_counter_cpu_fds, + const int *counter_cpu_fds, + enum lttng_ust_ctl_counter_bitness bitness, + enum lttng_ust_ctl_counter_arithmetic arithmetic, + uint32_t alloc_flags, + bool coalesce_hits); int lttng_ust_ctl_create_counter_data(struct lttng_ust_ctl_daemon_counter *counter, - struct lttng_ust_abi_object_data **counter_data); + struct lttng_ust_abi_object_data **counter_data); int lttng_ust_ctl_create_counter_global_data(struct lttng_ust_ctl_daemon_counter *counter, - struct lttng_ust_abi_object_data **counter_global_data); -int lttng_ust_ctl_create_counter_cpu_data(struct lttng_ust_ctl_daemon_counter *counter, int cpu, - struct lttng_ust_abi_object_data **counter_cpu_data); + struct lttng_ust_abi_object_data **counter_global_data); +int lttng_ust_ctl_create_counter_cpu_data(struct lttng_ust_ctl_daemon_counter *counter, + int cpu, + struct lttng_ust_abi_object_data **counter_cpu_data); /* * Each counter data and counter cpu data created need to be destroyed @@ -633,25 +628,30 @@ int lttng_ust_ctl_create_counter_cpu_data(struct lttng_ust_ctl_daemon_counter *c */ void lttng_ust_ctl_destroy_counter(struct lttng_ust_ctl_daemon_counter *counter); -int lttng_ust_ctl_send_counter_data_to_ust(int sock, int parent_handle, - struct lttng_ust_abi_object_data *counter_data); -int lttng_ust_ctl_send_counter_global_data_to_ust(int sock, - struct lttng_ust_abi_object_data *counter_data, - struct lttng_ust_abi_object_data *counter_global_data); +int lttng_ust_ctl_send_counter_data_to_ust(int sock, + int parent_handle, + struct lttng_ust_abi_object_data *counter_data); +int lttng_ust_ctl_send_counter_global_data_to_ust( + int sock, + struct lttng_ust_abi_object_data *counter_data, + struct lttng_ust_abi_object_data *counter_global_data); int lttng_ust_ctl_send_counter_cpu_data_to_ust(int sock, - struct lttng_ust_abi_object_data *counter_data, - struct lttng_ust_abi_object_data *counter_cpu_data); + struct lttng_ust_abi_object_data *counter_data, + struct lttng_ust_abi_object_data *counter_cpu_data); int lttng_ust_ctl_counter_read(struct lttng_ust_ctl_daemon_counter *counter, - const size_t *dimension_indexes, - int cpu, int64_t *value, - bool *overflow, bool *underflow); + const size_t *dimension_indexes, + int cpu, + int64_t *value, + bool *overflow, + bool *underflow); int lttng_ust_ctl_counter_aggregate(struct lttng_ust_ctl_daemon_counter *counter, - const size_t *dimension_indexes, - int64_t *value, - bool *overflow, bool *underflow); + const size_t *dimension_indexes, + int64_t *value, + bool *overflow, + bool *underflow); int lttng_ust_ctl_counter_clear(struct lttng_ust_ctl_daemon_counter *counter, - const size_t *dimension_indexes); + const size_t *dimension_indexes); void lttng_ust_ctl_sigbus_handle(void *addr); diff --git a/src/bin/lttng-sessiond/ust-error-internal.hpp b/src/bin/lttng-sessiond/ust-error-internal.hpp index 1cf05f2e3..7e59d0754 100644 --- a/src/bin/lttng-sessiond/ust-error-internal.hpp +++ b/src/bin/lttng-sessiond/ust-error-internal.hpp @@ -14,30 +14,30 @@ * These declarations should NOT be considered stable API. */ +#include "lttng-ust-abi.hpp" + #include #include -#include "lttng-ust-abi.hpp" - /* * ustcomm error code. */ enum lttng_ust_error_code { - LTTNG_UST_OK = 0, /* Ok */ - LTTNG_UST_ERR = 1024, /* Unknown Error */ - LTTNG_UST_ERR_NOENT = 1025, /* No entry */ - LTTNG_UST_ERR_EXIST = 1026, /* Object exists */ - LTTNG_UST_ERR_INVAL = 1027, /* Invalid argument */ - LTTNG_UST_ERR_PERM = 1028, /* Permission denied */ - LTTNG_UST_ERR_NOSYS = 1029, /* Not implemented */ - LTTNG_UST_ERR_EXITING = 1030, /* Process is exiting */ - - LTTNG_UST_ERR_INVAL_MAGIC = 1031, /* Invalid magic number */ - LTTNG_UST_ERR_INVAL_SOCKET_TYPE = 1032, /* Invalid socket type */ - LTTNG_UST_ERR_UNSUP_MAJOR = 1033, /* Unsupported major version */ + LTTNG_UST_OK = 0, /* Ok */ + LTTNG_UST_ERR = 1024, /* Unknown Error */ + LTTNG_UST_ERR_NOENT = 1025, /* No entry */ + LTTNG_UST_ERR_EXIST = 1026, /* Object exists */ + LTTNG_UST_ERR_INVAL = 1027, /* Invalid argument */ + LTTNG_UST_ERR_PERM = 1028, /* Permission denied */ + LTTNG_UST_ERR_NOSYS = 1029, /* Not implemented */ + LTTNG_UST_ERR_EXITING = 1030, /* Process is exiting */ + + LTTNG_UST_ERR_INVAL_MAGIC = 1031, /* Invalid magic number */ + LTTNG_UST_ERR_INVAL_SOCKET_TYPE = 1032, /* Invalid socket type */ + LTTNG_UST_ERR_UNSUP_MAJOR = 1033, /* Unsupported major version */ /* MUST be last element */ - LTTNG_UST_ERR_NR, /* Last element */ + LTTNG_UST_ERR_NR, /* Last element */ }; /* @@ -46,4 +46,4 @@ enum lttng_ust_error_code { */ extern const char *lttng_ust_strerror(int code); -#endif /* _LTTNG_UST_ERROR_H */ +#endif /* _LTTNG_UST_ERROR_H */ diff --git a/src/bin/lttng-sessiond/ust-field-convert.hpp b/src/bin/lttng-sessiond/ust-field-convert.hpp index c0e663983..063abcd68 100644 --- a/src/bin/lttng-sessiond/ust-field-convert.hpp +++ b/src/bin/lttng-sessiond/ust-field-convert.hpp @@ -9,12 +9,12 @@ #define LTTNG_UST_FIELD_CONVERT_H #include "field.hpp" -#include "ust-registry.hpp" #include "ust-registry-session.hpp" +#include "ust-registry.hpp" #include -#include #include +#include namespace lttng { namespace sessiond { @@ -42,12 +42,12 @@ inline ctl_field_quirks operator|(ctl_field_quirks lhs, ctl_field_quirks rhs) return ctl_field_quirks(static_cast(lhs) | static_cast(rhs)); } -std::vector create_trace_fields_from_ust_ctl_fields( - const lttng::sessiond::ust::registry_session& session, - const lttng_ust_ctl_field *fields, - std::size_t field_count, - trace::field_location::root lookup_root, - ctl_field_quirks quirks = ctl_field_quirks::NONE); +std::vector +create_trace_fields_from_ust_ctl_fields(const lttng::sessiond::ust::registry_session& session, + const lttng_ust_ctl_field *fields, + std::size_t field_count, + trace::field_location::root lookup_root, + ctl_field_quirks quirks = ctl_field_quirks::NONE); } /* namespace ust */ } /* namespace sessiond */ diff --git a/src/bin/lttng-sessiond/ust-registry-channel.hpp b/src/bin/lttng-sessiond/ust-registry-channel.hpp index 4e7229a69..636de94aa 100644 --- a/src/bin/lttng-sessiond/ust-registry-channel.hpp +++ b/src/bin/lttng-sessiond/ust-registry-channel.hpp @@ -15,8 +15,8 @@ #include -#include #include +#include struct ust_app; @@ -29,23 +29,24 @@ class registry_event; class registry_channel : public lttng::sessiond::trace::stream_class { public: using registered_listener_fn = std::function; - using event_added_listener_fn = std::function; + using event_added_listener_fn = + std::function; registry_channel(uint32_t channel_id, - const lttng::sessiond::trace::abi& trace_abi, - std::string default_clock_class_name, - registered_listener_fn channel_registered_listener, - event_added_listener_fn new_event_listener); + const lttng::sessiond::trace::abi& trace_abi, + std::string default_clock_class_name, + registered_listener_fn channel_registered_listener, + event_added_listener_fn new_event_listener); void add_event(int session_objd, - int channel_objd, - std::string name, - std::string signature, - std::vector event_fields, - int loglevel_value, - nonstd::optional model_emf_uri, - lttng_buffer_type buffer_type, - const ust_app& app, - uint32_t& out_event_id); + int channel_objd, + std::string name, + std::string signature, + std::vector event_fields, + int loglevel_value, + nonstd::optional model_emf_uri, + lttng_buffer_type buffer_type, + const ust_app& app, + uint32_t& out_event_id); ~registry_channel() override; registry_channel(const registry_channel&) = delete; registry_channel(registry_channel&&) = delete; @@ -75,7 +76,7 @@ public: private: void _accept_on_event_classes( - lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) const final; + lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) const final; registered_listener_fn _is_registered_listener; event_added_listener_fn _event_added_listener; diff --git a/src/bin/lttng-sessiond/ust-registry-event.hpp b/src/bin/lttng-sessiond/ust-registry-event.hpp index fe325fced..38d96eb8f 100644 --- a/src/bin/lttng-sessiond/ust-registry-event.hpp +++ b/src/bin/lttng-sessiond/ust-registry-event.hpp @@ -13,6 +13,7 @@ #include #include + #include #include @@ -28,14 +29,14 @@ namespace ust { class registry_event : public lttng::sessiond::trace::event_class { public: registry_event(unsigned int id, - unsigned int stream_class_id, - int session_objd, - int channel_objd, - std::string name, - std::string signature, - std::vector fields, - int loglevel_value, - nonstd::optional model_emf_uri); + unsigned int stream_class_id, + int session_objd, + int channel_objd, + std::string name, + std::string signature, + std::vector fields, + int loglevel_value, + nonstd::optional model_emf_uri); ~registry_event() override = default; registry_event(const registry_event&) = delete; registry_event(registry_event&&) = delete; @@ -75,13 +76,17 @@ namespace fmt { template <> struct formatter : formatter { template - typename FormatContextType::iterator format( - const lttng::sessiond::ust::registry_event& event, FormatContextType& ctx) + typename FormatContextType::iterator + format(const lttng::sessiond::ust::registry_event& event, FormatContextType& ctx) { - return format_to(ctx.out(), - "{{ name = `{}`, signature = `{}`, id = {}, session objd = {}, channel objd = {} }}", - event.name, event.signature, event.id, event.session_objd, - event.channel_objd); + return format_to( + ctx.out(), + "{{ name = `{}`, signature = `{}`, id = {}, session objd = {}, channel objd = {} }}", + event.name, + event.signature, + event.id, + event.session_objd, + event.channel_objd); } }; } /* namespace fmt */ diff --git a/src/bin/lttng-sessiond/ust-registry-session-pid.hpp b/src/bin/lttng-sessiond/ust-registry-session-pid.hpp index 4c414a1ec..4cd9911d4 100644 --- a/src/bin/lttng-sessiond/ust-registry-session-pid.hpp +++ b/src/bin/lttng-sessiond/ust-registry-session-pid.hpp @@ -11,9 +11,10 @@ #include "trace-class.hpp" #include "ust-registry-session.hpp" +#include + #include #include -#include #include #include @@ -24,18 +25,18 @@ namespace ust { class registry_session_per_pid : public registry_session { public: registry_session_per_pid(const struct ust_app& app, - const struct lttng::sessiond::trace::abi& trace_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 struct lttng::sessiond::trace::abi& trace_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); virtual lttng_buffer_type buffering_scheme() const noexcept override final; virtual void accept(lttng::sessiond::trace::trace_class_environment_visitor& - environment_visitor) const override final; + environment_visitor) const override final; private: const unsigned int _tracer_patch_level_version; diff --git a/src/bin/lttng-sessiond/ust-registry-session-uid.hpp b/src/bin/lttng-sessiond/ust-registry-session-uid.hpp index 01f55fc2e..69dc68c25 100644 --- a/src/bin/lttng-sessiond/ust-registry-session-uid.hpp +++ b/src/bin/lttng-sessiond/ust-registry-session-uid.hpp @@ -11,8 +11,9 @@ #include "trace-class.hpp" #include "ust-registry-session.hpp" -#include #include + +#include #include namespace lttng { @@ -22,21 +23,20 @@ namespace ust { class registry_session_per_uid : public registry_session { public: registry_session_per_uid(const struct lttng::sessiond::trace::abi& trace_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); virtual lttng_buffer_type buffering_scheme() const noexcept override final; virtual void accept(lttng::sessiond::trace::trace_class_environment_visitor& - environment_visitor) const override final; + environment_visitor) const override final; private: - const uid_t _tracing_uid; }; diff --git a/src/bin/lttng-sessiond/ust-registry-session.hpp b/src/bin/lttng-sessiond/ust-registry-session.hpp index 5a26d1aab..bfffe5b50 100644 --- a/src/bin/lttng-sessiond/ust-registry-session.hpp +++ b/src/bin/lttng-sessiond/ust-registry-session.hpp @@ -17,9 +17,10 @@ #include +#include + #include #include -#include #include #include @@ -36,10 +37,11 @@ void locked_registry_session_release(registry_session *session); class registry_session : public lttng::sessiond::trace::trace_class { public: - using locked_ptr = std::unique_ptr:: - deleter>; + using locked_ptr = + std::unique_ptr::deleter>; virtual lttng_buffer_type buffering_scheme() const noexcept = 0; locked_ptr lock() noexcept; @@ -52,12 +54,12 @@ public: void remove_channel(uint64_t channel_key, bool notify); void 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); - registry_enum::const_rcu_protected_reference enumeration( - const char *enum_name, uint64_t enum_id) const; + const char *enum_name, + struct lttng_ust_ctl_enum_entry *raw_entries, + size_t nr_entries, + uint64_t *enum_id); + registry_enum::const_rcu_protected_reference enumeration(const char *enum_name, + uint64_t enum_id) const; void regenerate_metadata(); @@ -102,15 +104,14 @@ public: protected: /* Prevent instanciation of this base class. */ registry_session(const struct lttng::sessiond::trace::abi& abi, - unsigned int app_tracer_version_major, - unsigned int app_tracer_version_minor, - const char *root_shm_path, - const char *shm_path, - uid_t euid, - gid_t egid, - uint64_t tracing_id); - void accept( - trace::trace_class_environment_visitor& environment_visitor) const override; + unsigned int app_tracer_version_major, + unsigned int app_tracer_version_minor, + const char *root_shm_path, + const char *shm_path, + uid_t euid, + gid_t egid, + uint64_t tracing_id); + void accept(trace::trace_class_environment_visitor& environment_visitor) const override; void _generate_metadata(); private: @@ -123,11 +124,9 @@ private: lttng::sessiond::trace::type::cuptr _create_packet_header() const; void _accept_on_clock_classes( - lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) - const final; + lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) const final; void _accept_on_stream_classes( - lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) - const final; + lttng::sessiond::trace::trace_class_visitor& trace_class_visitor) const final; /* Next channel ID available for a newly registered channel. */ uint32_t _next_channel_id = 0; diff --git a/src/bin/lttng-sessiond/ust-registry.hpp b/src/bin/lttng-sessiond/ust-registry.hpp index 5d8bdb7ce..4bb14be6f 100644 --- a/src/bin/lttng-sessiond/ust-registry.hpp +++ b/src/bin/lttng-sessiond/ust-registry.hpp @@ -34,8 +34,8 @@ #include #include -#define CTF_SPEC_MAJOR 1 -#define CTF_SPEC_MINOR 8 +#define CTF_SPEC_MAJOR 1 +#define CTF_SPEC_MINOR 8 struct ust_app; @@ -48,8 +48,8 @@ class registry_session; namespace details { template -typename trace::typed_enumeration_type::mappings mappings_from_ust_ctl_entries( - const lttng_ust_ctl_enum_entry *in_entries, size_t in_entry_count) +typename trace::typed_enumeration_type::mappings +mappings_from_ust_ctl_entries(const lttng_ust_ctl_enum_entry *in_entries, size_t in_entry_count) { typename trace::typed_enumeration_type::mappings mappings; @@ -66,10 +66,10 @@ typename trace::typed_enumeration_type::mappings mappings_fr } next_range_begin = range_end + 1; - mappings.emplace_back(entry.string, - typename trace::typed_enumeration_type< - MappingIntegerType>::mapping::range_t{ - range_begin, range_end}); + mappings.emplace_back( + entry.string, + typename trace::typed_enumeration_type::mapping::range_t{ + range_begin, range_end }); } return mappings; @@ -78,9 +78,11 @@ typename trace::typed_enumeration_type::mappings mappings_fr class registry_enum { public: - using const_rcu_protected_reference = lttng::locked_reference; + using const_rcu_protected_reference = + lttng::locked_reference; - registry_enum(std::string name, enum lttng::sessiond::trace::integer_type::signedness signedness); + registry_enum(std::string name, + enum lttng::sessiond::trace::integer_type::signedness signedness); virtual ~registry_enum() = default; registry_enum(const registry_enum&) = delete; registry_enum(registry_enum&&) = delete; @@ -97,6 +99,7 @@ public: struct rcu_head rcu_head; friend bool operator==(const registry_enum& lhs, const registry_enum& rhs) noexcept; + protected: virtual bool _is_equal(const registry_enum& other) const noexcept = 0; }; @@ -107,27 +110,27 @@ template class registry_typed_enum : public registry_enum { public: registry_typed_enum(const char *in_name, - const lttng_ust_ctl_enum_entry *entries, - size_t entry_count) : + const lttng_ust_ctl_enum_entry *entries, + size_t entry_count) : registry_enum(in_name, - std::is_signed::value ? - lttng::sessiond::trace::integer_type::signedness::SIGNED : - lttng::sessiond::trace::integer_type::signedness::UNSIGNED), - _mappings{std::make_shared< - typename trace::typed_enumeration_type::mappings>( - details::mappings_from_ust_ctl_entries( - entries, entry_count))} + std::is_signed::value ? + lttng::sessiond::trace::integer_type::signedness::SIGNED : + lttng::sessiond::trace::integer_type::signedness::UNSIGNED), + _mappings{ std::make_shared< + typename trace::typed_enumeration_type::mappings>( + details::mappings_from_ust_ctl_entries(entries, + entry_count)) } { } const typename std::shared_ptr::mappings> - _mappings; + MappingIntegerType>::mappings> + _mappings; protected: bool _is_equal(const registry_enum& base_other) const noexcept override { - const auto &other = static_cast(base_other); + const auto& other = static_cast(base_other); /* Don't compare IDs as some comparisons are performed before an id is assigned. */ return this->name == other.name && *this->_mappings == *other._mappings; @@ -148,112 +151,112 @@ using registry_unsigned_enum = registry_typed_enum; * * Return new instance on success, nullptr on error. */ -lttng::sessiond::ust::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); +lttng::sessiond::ust::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); /* * Create per-pid registry with default values. * * Return new instance on success, nullptr on error. */ -lttng::sessiond::ust::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); +lttng::sessiond::ust::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); void ust_registry_session_destroy(lttng::sessiond::ust::registry_session *session); void ust_registry_channel_destroy_event(lttng::sessiond::ust::registry_channel *chan, - lttng::sessiond::ust::registry_event *event); + lttng::sessiond::ust::registry_event *event); #else /* HAVE_LIBLTTNG_UST_CTL */ -static inline -lttng::sessiond::ust::registry_session *ust_registry_session_per_uid_create( - uint32_t bits_per_long __attribute__((unused)), - uint32_t uint8_t_alignment __attribute__((unused)), - uint32_t uint16_t_alignment __attribute__((unused)), - uint32_t uint32_t_alignment __attribute__((unused)), - uint32_t uint64_t_alignment __attribute__((unused)), - uint32_t long_alignment __attribute__((unused)), - int byte_order __attribute__((unused)), - uint32_t major __attribute__((unused)), - uint32_t minor __attribute__((unused)), - const char *root_shm_path __attribute__((unused)), - const char *shm_path __attribute__((unused)), - uid_t euid __attribute__((unused)), - gid_t egid __attribute__((unused)), - uint64_t tracing_id __attribute__((unused)), - uid_t tracing_uid __attribute__((unused))) +static inline lttng::sessiond::ust::registry_session * +ust_registry_session_per_uid_create(uint32_t bits_per_long __attribute__((unused)), + uint32_t uint8_t_alignment __attribute__((unused)), + uint32_t uint16_t_alignment __attribute__((unused)), + uint32_t uint32_t_alignment __attribute__((unused)), + uint32_t uint64_t_alignment __attribute__((unused)), + uint32_t long_alignment __attribute__((unused)), + int byte_order __attribute__((unused)), + uint32_t major __attribute__((unused)), + uint32_t minor __attribute__((unused)), + const char *root_shm_path __attribute__((unused)), + const char *shm_path __attribute__((unused)), + uid_t euid __attribute__((unused)), + gid_t egid __attribute__((unused)), + uint64_t tracing_id __attribute__((unused)), + uid_t tracing_uid __attribute__((unused))) { return nullptr; } -static inline -lttng::sessiond::ust::registry_session *ust_registry_session_per_pid_create( - struct ust_app *app __attribute__((unused)), - uint32_t bits_per_long __attribute__((unused)), - uint32_t uint8_t_alignment __attribute__((unused)), - uint32_t uint16_t_alignment __attribute__((unused)), - uint32_t uint32_t_alignment __attribute__((unused)), - uint32_t uint64_t_alignment __attribute__((unused)), - uint32_t long_alignment __attribute__((unused)), - int byte_order __attribute__((unused)), - uint32_t major __attribute__((unused)), - uint32_t minor __attribute__((unused)), - const char *root_shm_path __attribute__((unused)), - const char *shm_path __attribute__((unused)), - uid_t euid __attribute__((unused)), - gid_t egid __attribute__((unused)), - uint64_t tracing_id __attribute__((unused))) +static inline lttng::sessiond::ust::registry_session * +ust_registry_session_per_pid_create(struct ust_app *app __attribute__((unused)), + uint32_t bits_per_long __attribute__((unused)), + uint32_t uint8_t_alignment __attribute__((unused)), + uint32_t uint16_t_alignment __attribute__((unused)), + uint32_t uint32_t_alignment __attribute__((unused)), + uint32_t uint64_t_alignment __attribute__((unused)), + uint32_t long_alignment __attribute__((unused)), + int byte_order __attribute__((unused)), + uint32_t major __attribute__((unused)), + uint32_t minor __attribute__((unused)), + const char *root_shm_path __attribute__((unused)), + const char *shm_path __attribute__((unused)), + uid_t euid __attribute__((unused)), + gid_t egid __attribute__((unused)), + uint64_t tracing_id __attribute__((unused))) { return nullptr; } -static inline -void ust_registry_session_destroy( - lttng::sessiond::ust::registry_session *session __attribute__((unused))) -{} +static inline void ust_registry_session_destroy(lttng::sessiond::ust::registry_session *session + __attribute__((unused))) +{ +} -static inline -void ust_registry_destroy_event( - lttng::sessiond::ust::registry_channel *chan __attribute__((unused)), - lttng::sessiond::ust::registry_event *event __attribute__((unused))) -{} +static inline void ust_registry_destroy_event(lttng::sessiond::ust::registry_channel *chan + __attribute__((unused)), + lttng::sessiond::ust::registry_event *event + __attribute__((unused))) +{ +} /* The app object can be NULL for registry shared across applications. */ -static inline -int ust_metadata_session_statedump( - lttng::sessiond::ust::registry_session *session __attribute__((unused))) +static inline int ust_metadata_session_statedump(lttng::sessiond::ust::registry_session *session + __attribute__((unused))) { return 0; } -static inline -int ust_metadata_channel_statedump( - lttng::sessiond::ust::registry_session *session __attribute__((unused)), - lttng::sessiond::ust::registry_channel *chan __attribute__((unused))) +static inline int ust_metadata_channel_statedump(lttng::sessiond::ust::registry_session *session + __attribute__((unused)), + lttng::sessiond::ust::registry_channel *chan + __attribute__((unused))) { return 0; } -static inline -int ust_metadata_event_statedump( - lttng::sessiond::ust::registry_session *session __attribute__((unused)), - lttng::sessiond::ust::registry_channel *chan __attribute__((unused)), - lttng::sessiond::ust::registry_event *event __attribute__((unused))) +static inline int ust_metadata_event_statedump(lttng::sessiond::ust::registry_session *session + __attribute__((unused)), + lttng::sessiond::ust::registry_channel *chan + __attribute__((unused)), + lttng::sessiond::ust::registry_event *event + __attribute__((unused))) { return 0; } diff --git a/src/bin/lttng-sessiond/ust-sigbus.hpp b/src/bin/lttng-sessiond/ust-sigbus.hpp index 5c1ff2e73..f87a4aced 100644 --- a/src/bin/lttng-sessiond/ust-sigbus.hpp +++ b/src/bin/lttng-sessiond/ust-sigbus.hpp @@ -14,8 +14,7 @@ void lttng_ust_handle_sigbus(void *address); #else /* HAVE_LIBLTTNG_UST_CTL */ -static inline -void lttng_ust_handle_sigbus(void *address __attribute__((unused))) +static inline void lttng_ust_handle_sigbus(void *address __attribute__((unused))) { } diff --git a/src/bin/lttng-sessiond/utils.hpp b/src/bin/lttng-sessiond/utils.hpp index 5cbf7487f..9ad48e106 100644 --- a/src/bin/lttng-sessiond/utils.hpp +++ b/src/bin/lttng-sessiond/utils.hpp @@ -14,8 +14,11 @@ struct consumer_output; const char *get_home_dir(void); int notify_thread_pipe(int wpipe); -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); const char *session_get_base_path(const struct ltt_session *session); const char *consumer_output_get_base_path(const struct consumer_output *output); diff --git a/src/bin/lttng/command.hpp b/src/bin/lttng/command.hpp index c707267cd..2545104ed 100644 --- a/src/bin/lttng/command.hpp +++ b/src/bin/lttng/command.hpp @@ -8,32 +8,32 @@ #ifndef _LTTNG_CMD_H #define _LTTNG_CMD_H -#include +#include "conf.hpp" +#include "utils.hpp" + #include #include -#include "conf.hpp" -#include "utils.hpp" +#include -#define DECL_COMMAND(_name) \ - extern int cmd_##_name(int, const char **) +#define DECL_COMMAND(_name) extern int cmd_##_name(int, const char **) #ifdef LTTNG_EMBED_HELP -# define HELP_MSG_NAME help_msg -# define SHOW_HELP_ERROR_LINE ERR("Cannot show --help for `lttng-%s`", argv[0]); +#define HELP_MSG_NAME help_msg +#define SHOW_HELP_ERROR_LINE ERR("Cannot show --help for `lttng-%s`", argv[0]); #else -# define HELP_MSG_NAME NULL -# define SHOW_HELP_ERROR_LINE ; +#define HELP_MSG_NAME NULL +#define SHOW_HELP_ERROR_LINE ; #endif -#define SHOW_HELP() \ - do { \ - ret = show_cmd_help(argv[0], HELP_MSG_NAME); \ - \ - if (ret) { \ - SHOW_HELP_ERROR_LINE \ - ret = CMD_ERROR; \ - } \ +#define SHOW_HELP() \ + do { \ + ret = show_cmd_help(argv[0], HELP_MSG_NAME); \ + \ + if (ret) { \ + SHOW_HELP_ERROR_LINE \ + ret = CMD_ERROR; \ + } \ } while (0) enum cmd_error_code { @@ -81,7 +81,6 @@ DECL_COMMAND(add_trigger); DECL_COMMAND(list_triggers); DECL_COMMAND(remove_trigger); -extern int cmd_help(int argc, const char **argv, - const struct cmd_struct commands[]); +extern int cmd_help(int argc, const char **argv, const struct cmd_struct commands[]); #endif /* _LTTNG_CMD_H */ diff --git a/src/bin/lttng/commands/disable_events.cpp b/src/bin/lttng/commands/disable_events.cpp index 454cb755c..40e85e7c8 100644 --- a/src/bin/lttng/commands/disable_events.cpp +++ b/src/bin/lttng/commands/disable_events.cpp @@ -210,7 +210,8 @@ static int disable_events(char *session_name, char *event_list) event.type = (lttng_event_type) opt_event_type; if (opt_disable_all) { - const int disable_ret = lttng_disable_event_ext(handle, &event, channel_name, nullptr); + const int disable_ret = + lttng_disable_event_ext(handle, &event, channel_name, nullptr); if (disable_ret < 0) { ERR("%s", lttng_strerror(command_ret)); diff --git a/src/bin/lttng/loglevel.hpp b/src/bin/lttng/loglevel.hpp index f2cc9139b..76c5ce021 100644 --- a/src/bin/lttng/loglevel.hpp +++ b/src/bin/lttng/loglevel.hpp @@ -8,35 +8,33 @@ #ifndef _LTTNG_LOGLEVEL_UTILS_H #define _LTTNG_LOGLEVEL_UTILS_H -#include #include +#include + 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 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); 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 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); 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 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); 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); const char *loglevel_value_to_name(int loglevel); diff --git a/src/bin/lttng/uprobe.hpp b/src/bin/lttng/uprobe.hpp index 837331291..413dd02ab 100644 --- a/src/bin/lttng/uprobe.hpp +++ b/src/bin/lttng/uprobe.hpp @@ -12,7 +12,6 @@ struct lttng_userspace_probe_location; -int parse_userspace_probe_opts(const char *opt, - struct lttng_userspace_probe_location **uprobe_loc); +int parse_userspace_probe_opts(const char *opt, struct lttng_userspace_probe_location **uprobe_loc); #endif /* SRC_BIN_LTTNG_UPROBE_H */ diff --git a/src/bin/lttng/utils.hpp b/src/bin/lttng/utils.hpp index bb1c2cdfb..64605575e 100644 --- a/src/bin/lttng/utils.hpp +++ b/src/bin/lttng/utils.hpp @@ -8,15 +8,16 @@ #ifndef _LTTNG_UTILS_H #define _LTTNG_UTILS_H -#include #include #include #include +#include + extern char *opt_relayd_path; extern int opt_no_sessiond; -extern char * opt_sessiond_path; +extern char *opt_sessiond_path; extern pid_t sessiond_pid; struct cmd_struct; @@ -47,8 +48,7 @@ int get_count_order_ulong(unsigned long x); const char *get_event_type_str(enum lttng_event_type event_type); -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 spawn_relayd(const char *pathname, int port); int check_relayd(void); @@ -56,11 +56,10 @@ void print_session_stats(const char *session_name); int get_session_stats_str(const char *session_name, char **str); int show_cmd_help(const char *cmd_name, const char *help_msg); -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 validate_exclusion_list(const char *event_name, - const struct lttng_dynamic_pointer_array *exclusions); + const struct lttng_dynamic_pointer_array *exclusions); #endif /* _LTTNG_UTILS_H */ diff --git a/src/common/align.hpp b/src/common/align.hpp index c957824af..fab15af8c 100644 --- a/src/common/align.hpp +++ b/src/common/align.hpp @@ -14,19 +14,17 @@ * Align value to the next multiple of align. Returns val if it already is a * multiple of align. Align must be a power of two. */ -#define __lttng_align_ceil_mask(v, mask) (((v) + (mask)) & ~(mask)) +#define __lttng_align_ceil_mask(v, mask) (((v) + (mask)) & ~(mask)) -#define lttng_align_ceil(v, align) \ - __lttng_align_ceil_mask(v, (__typeof__(v)) (align) - 1) +#define lttng_align_ceil(v, align) __lttng_align_ceil_mask(v, (__typeof__(v)) (align) -1) /* * Align value to the previous multiple of align. Returns val if it already is a * multiple of align. Align must be a power of two. */ -#define __lttng_align_floor_mask(v, mask) ((v) & ~(mask)) +#define __lttng_align_floor_mask(v, mask) ((v) & ~(mask)) -#define lttng_align_floor(v, align) \ - __lttng_align_floor_mask(v, (__typeof__(v)) (align) - 1) +#define lttng_align_floor(v, align) __lttng_align_floor_mask(v, (__typeof__(v)) (align) -1) /** * lttng_offset_align - Calculate the offset needed to align an object on its natural @@ -37,11 +35,10 @@ * Returns the offset that must be added to align towards higher * addresses. */ -#define lttng_offset_align(align_drift, alignment) \ - ({ \ - LTTNG_BUILD_RUNTIME_BUG_ON((alignment) == 0 \ - || ((alignment) & ((alignment) - 1))); \ - (((alignment) - (align_drift)) & ((alignment) - 1)); \ +#define lttng_offset_align(align_drift, alignment) \ + ({ \ + LTTNG_BUILD_RUNTIME_BUG_ON((alignment) == 0 || ((alignment) & ((alignment) -1))); \ + (((alignment) - (align_drift)) & ((alignment) -1)); \ }) /** @@ -52,11 +49,10 @@ * * Returns the offset that must be substracted to align towards lower addresses. */ -#define lttng_offset_align_floor(align_drift, alignment) \ - ({ \ - LTTNG_BUILD_RUNTIME_BUG_ON((alignment) == 0 \ - || ((alignment) & ((alignment) - 1))); \ - (((align_drift) - (alignment)) & ((alignment) - 1)); \ +#define lttng_offset_align_floor(align_drift, alignment) \ + ({ \ + LTTNG_BUILD_RUNTIME_BUG_ON((alignment) == 0 || ((alignment) & ((alignment) -1))); \ + (((align_drift) - (alignment)) & ((alignment) -1)); \ }) #endif /* _LTTNG_ALIGN_H */ diff --git a/src/common/argpar-utils/argpar-utils.hpp b/src/common/argpar-utils/argpar-utils.hpp index b77609edd..4d25b3a70 100644 --- a/src/common/argpar-utils/argpar-utils.hpp +++ b/src/common/argpar-utils/argpar-utils.hpp @@ -8,20 +8,19 @@ #ifndef COMMON_ARGPAR_UTILS_H #define COMMON_ARGPAR_UTILS_H -#include - -#include #include +#include #include +#include + #ifdef __cplusplus extern "C" { #endif #define WHILE_PARSING_ARG_N_ARG_FMT "While parsing argument #%d (`%s`): " -enum parse_next_item_status -{ +enum parse_next_item_status { PARSE_NEXT_ITEM_STATUS_OK = 0, PARSE_NEXT_ITEM_STATUS_END = 1, PARSE_NEXT_ITEM_STATUS_ERROR = -1, @@ -53,10 +52,13 @@ enum parse_next_item_status */ ATTR_FORMAT_PRINTF(7, 8) 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, + ...); #ifdef __cplusplus } diff --git a/src/common/argpar/argpar.c b/src/common/argpar/argpar.c index 82b561cea..f8280ce14 100644 --- a/src/common/argpar/argpar.c +++ b/src/common/argpar/argpar.c @@ -5,19 +5,17 @@ * Copyright (c) 2020-2021 Simon Marchi */ +#include "argpar.h" + #include #include #include #include #include -#include "argpar.h" - -#define ARGPAR_REALLOC(_ptr, _type, _nmemb) \ - ((_type *) realloc(_ptr, (_nmemb) * sizeof(_type))) +#define ARGPAR_REALLOC(_ptr, _type, _nmemb) ((_type *) realloc(_ptr, (_nmemb) * sizeof(_type))) -#define ARGPAR_CALLOC(_type, _nmemb) \ - ((_type *) calloc((_nmemb), sizeof(_type))) +#define ARGPAR_CALLOC(_type, _nmemb) ((_type *) calloc((_nmemb), sizeof(_type))) #define ARGPAR_ZALLOC(_type) ARGPAR_CALLOC(_type, 1) @@ -26,10 +24,10 @@ * Force usage of the assertion condition to prevent unused variable warnings * when `assert()` are disabled by the `NDEBUG` definition. */ -# define ARGPAR_ASSERT(_cond) ((void) sizeof((void) (_cond), 0)) +#define ARGPAR_ASSERT(_cond) ((void) sizeof((void) (_cond), 0)) #else -# include -# define ARGPAR_ASSERT(_cond) assert(_cond) +#include +#define ARGPAR_ASSERT(_cond) assert(_cond) #endif /* @@ -45,7 +43,7 @@ struct argpar_iter { */ struct { unsigned int argc; - const char * const *argv; + const char *const *argv; const struct argpar_opt_descr *descrs; } user; @@ -128,15 +126,14 @@ struct argpar_error { }; ARGPAR_HIDDEN -enum argpar_item_type argpar_item_type(const struct argpar_item * const item) +enum argpar_item_type argpar_item_type(const struct argpar_item *const item) { ARGPAR_ASSERT(item); return item->type; } ARGPAR_HIDDEN -const struct argpar_opt_descr *argpar_item_opt_descr( - const struct argpar_item * const item) +const struct argpar_opt_descr *argpar_item_opt_descr(const struct argpar_item *const item) { ARGPAR_ASSERT(item); ARGPAR_ASSERT(item->type == ARGPAR_ITEM_TYPE_OPT); @@ -144,7 +141,7 @@ const struct argpar_opt_descr *argpar_item_opt_descr( } ARGPAR_HIDDEN -const char *argpar_item_opt_arg(const struct argpar_item * const item) +const char *argpar_item_opt_arg(const struct argpar_item *const item) { ARGPAR_ASSERT(item); ARGPAR_ASSERT(item->type == ARGPAR_ITEM_TYPE_OPT); @@ -152,7 +149,7 @@ const char *argpar_item_opt_arg(const struct argpar_item * const item) } ARGPAR_HIDDEN -const char *argpar_item_non_opt_arg(const struct argpar_item * const item) +const char *argpar_item_non_opt_arg(const struct argpar_item *const item) { ARGPAR_ASSERT(item); ARGPAR_ASSERT(item->type == ARGPAR_ITEM_TYPE_NON_OPT); @@ -160,8 +157,7 @@ const char *argpar_item_non_opt_arg(const struct argpar_item * const item) } ARGPAR_HIDDEN -unsigned int argpar_item_non_opt_orig_index( - const struct argpar_item * const item) +unsigned int argpar_item_non_opt_orig_index(const struct argpar_item *const item) { ARGPAR_ASSERT(item); ARGPAR_ASSERT(item->type == ARGPAR_ITEM_TYPE_NON_OPT); @@ -169,8 +165,7 @@ unsigned int argpar_item_non_opt_orig_index( } ARGPAR_HIDDEN -unsigned int argpar_item_non_opt_non_opt_index( - const struct argpar_item * const item) +unsigned int argpar_item_non_opt_non_opt_index(const struct argpar_item *const item) { ARGPAR_ASSERT(item); ARGPAR_ASSERT(item->type == ARGPAR_ITEM_TYPE_NON_OPT); @@ -178,15 +173,14 @@ unsigned int argpar_item_non_opt_non_opt_index( } ARGPAR_HIDDEN -void argpar_item_destroy(const struct argpar_item * const item) +void argpar_item_destroy(const struct argpar_item *const item) { if (!item) { goto end; } if (item->type == ARGPAR_ITEM_TYPE_OPT) { - struct argpar_item_opt * const opt_item = - (struct argpar_item_opt *) item; + struct argpar_item_opt *const opt_item = (struct argpar_item_opt *) item; free(opt_item->arg); } @@ -203,13 +197,10 @@ end: * * Returns `NULL` on memory error. */ -static -struct argpar_item_opt *create_opt_item( - const struct argpar_opt_descr * const descr, - const char * const arg) +static struct argpar_item_opt *create_opt_item(const struct argpar_opt_descr *const descr, + const char *const arg) { - struct argpar_item_opt *opt_item = - ARGPAR_ZALLOC(struct argpar_item_opt); + struct argpar_item_opt *opt_item = ARGPAR_ZALLOC(struct argpar_item_opt); if (!opt_item) { goto end; @@ -242,13 +233,11 @@ end: * * Returns `NULL` on memory error. */ -static -struct argpar_item_non_opt *create_non_opt_item(const char * const arg, - const unsigned int orig_index, - const unsigned int non_opt_index) +static struct argpar_item_non_opt *create_non_opt_item(const char *const arg, + const unsigned int orig_index, + const unsigned int non_opt_index) { - struct argpar_item_non_opt * const non_opt_item = - ARGPAR_ZALLOC(struct argpar_item_non_opt); + struct argpar_item_non_opt *const non_opt_item = ARGPAR_ZALLOC(struct argpar_item_non_opt); if (!non_opt_item) { goto end; @@ -274,12 +263,11 @@ end: * Returns 0 on success (including if `error` is `NULL`) or -1 on memory * error. */ -static -int set_error(struct argpar_error ** const error, - enum argpar_error_type type, - const char * const unknown_opt_name, - const struct argpar_opt_descr * const opt_descr, - const bool is_short) +static int set_error(struct argpar_error **const error, + enum argpar_error_type type, + const char *const unknown_opt_name, + const struct argpar_opt_descr *const opt_descr, + const bool is_short) { int ret = 0; @@ -295,8 +283,8 @@ int set_error(struct argpar_error ** const error, (*error)->type = type; if (unknown_opt_name) { - (*error)->unknown_opt_name = ARGPAR_CALLOC(char, - strlen(unknown_opt_name) + 1 + (is_short ? 1 : 2)); + (*error)->unknown_opt_name = + ARGPAR_CALLOC(char, strlen(unknown_opt_name) + 1 + (is_short ? 1 : 2)); if (!(*error)->unknown_opt_name) { goto error; } @@ -323,23 +311,21 @@ end: } ARGPAR_HIDDEN -enum argpar_error_type argpar_error_type( - const struct argpar_error * const error) +enum argpar_error_type argpar_error_type(const struct argpar_error *const error) { ARGPAR_ASSERT(error); return error->type; } ARGPAR_HIDDEN -unsigned int argpar_error_orig_index(const struct argpar_error * const error) +unsigned int argpar_error_orig_index(const struct argpar_error *const error) { ARGPAR_ASSERT(error); return error->orig_index; } ARGPAR_HIDDEN -const char *argpar_error_unknown_opt_name( - const struct argpar_error * const error) +const char *argpar_error_unknown_opt_name(const struct argpar_error *const error) { ARGPAR_ASSERT(error); ARGPAR_ASSERT(error->type == ARGPAR_ERROR_TYPE_UNKNOWN_OPT); @@ -348,12 +334,12 @@ const char *argpar_error_unknown_opt_name( } ARGPAR_HIDDEN -const struct argpar_opt_descr *argpar_error_opt_descr( - const struct argpar_error * const error, bool * const is_short) +const struct argpar_opt_descr *argpar_error_opt_descr(const struct argpar_error *const error, + bool *const is_short) { ARGPAR_ASSERT(error); ARGPAR_ASSERT(error->type == ARGPAR_ERROR_TYPE_MISSING_OPT_ARG || - error->type == ARGPAR_ERROR_TYPE_UNEXPECTED_OPT_ARG); + error->type == ARGPAR_ERROR_TYPE_UNEXPECTED_OPT_ARG); ARGPAR_ASSERT(error->opt_descr); if (is_short) { @@ -364,7 +350,7 @@ const struct argpar_opt_descr *argpar_error_opt_descr( } ARGPAR_HIDDEN -void argpar_error_destroy(const struct argpar_error * const error) +void argpar_error_destroy(const struct argpar_error *const error) { if (error) { free(error->unknown_opt_name); @@ -383,21 +369,18 @@ void argpar_error_destroy(const struct argpar_error * const error) * * Returns `NULL` if no descriptor is found. */ -static -const struct argpar_opt_descr *find_descr( - const struct argpar_opt_descr * const descrs, - const char short_name, const char * const long_name) +static const struct argpar_opt_descr *find_descr(const struct argpar_opt_descr *const descrs, + const char short_name, + const char *const long_name) { const struct argpar_opt_descr *descr; for (descr = descrs; descr->short_name || descr->long_name; descr++) { - if (short_name && descr->short_name && - short_name == descr->short_name) { + if (short_name && descr->short_name && short_name == descr->short_name) { goto end; } - if (long_name && descr->long_name && - strcmp(long_name, descr->long_name) == 0) { + if (long_name && descr->long_name && strcmp(long_name, descr->long_name) == 0) { goto end; } } @@ -422,14 +405,13 @@ enum parse_orig_arg_opt_ret { * On error (except for `PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY`), sets * `*error`. */ -static -enum parse_orig_arg_opt_ret parse_short_opt_group( - const char * const short_opt_group, - const char * const next_orig_arg, - const struct argpar_opt_descr * const descrs, - struct argpar_iter * const iter, - struct argpar_error ** const error, - struct argpar_item ** const item) +static enum parse_orig_arg_opt_ret +parse_short_opt_group(const char *const short_opt_group, + const char *const next_orig_arg, + const struct argpar_opt_descr *const descrs, + struct argpar_iter *const iter, + struct argpar_error **const error, + struct argpar_item **const item) { enum parse_orig_arg_opt_ret ret = PARSE_ORIG_ARG_OPT_RET_OK; bool used_next_orig_arg = false; @@ -446,13 +428,11 @@ enum parse_orig_arg_opt_ret parse_short_opt_group( /* Find corresponding option descriptor */ descr = find_descr(descrs, *iter->short_opt_group_ch, NULL); if (!descr) { - const char unknown_opt_name[] = - {*iter->short_opt_group_ch, '\0'}; + const char unknown_opt_name[] = { *iter->short_opt_group_ch, '\0' }; ret = PARSE_ORIG_ARG_OPT_RET_ERROR; - if (set_error(error, ARGPAR_ERROR_TYPE_UNKNOWN_OPT, - unknown_opt_name, NULL, true)) { + if (set_error(error, ARGPAR_ERROR_TYPE_UNKNOWN_OPT, unknown_opt_name, NULL, true)) { ret = PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY; } @@ -473,12 +453,10 @@ enum parse_orig_arg_opt_ret parse_short_opt_group( * We accept `-o ''` (empty option argument), but not * `-o` alone if an option argument is expected. */ - if (!opt_arg || (iter->short_opt_group_ch[1] && - strlen(opt_arg) == 0)) { + if (!opt_arg || (iter->short_opt_group_ch[1] && strlen(opt_arg) == 0)) { ret = PARSE_ORIG_ARG_OPT_RET_ERROR; - if (set_error(error, ARGPAR_ERROR_TYPE_MISSING_OPT_ARG, - NULL, descr, true)) { + if (set_error(error, ARGPAR_ERROR_TYPE_MISSING_OPT_ARG, NULL, descr, true)) { ret = PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY; } @@ -524,13 +502,12 @@ end: * On error (except for `PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY`), sets * `*error`. */ -static -enum parse_orig_arg_opt_ret parse_long_opt(const char * const long_opt_arg, - const char * const next_orig_arg, - const struct argpar_opt_descr * const descrs, - struct argpar_iter * const iter, - struct argpar_error ** const error, - struct argpar_item ** const item) +static enum parse_orig_arg_opt_ret parse_long_opt(const char *const long_opt_arg, + const char *const next_orig_arg, + const struct argpar_opt_descr *const descrs, + struct argpar_iter *const iter, + struct argpar_error **const error, + struct argpar_item **const item) { enum parse_orig_arg_opt_ret ret = PARSE_ORIG_ARG_OPT_RET_OK; const struct argpar_opt_descr *descr; @@ -556,8 +533,8 @@ enum parse_orig_arg_opt_ret parse_long_opt(const char * const long_opt_arg, /* Isolate the option name */ while (long_opt_name_size > iter->tmp_buf.size - 1) { iter->tmp_buf.size *= 2; - iter->tmp_buf.data = ARGPAR_REALLOC(iter->tmp_buf.data, - char, iter->tmp_buf.size); + iter->tmp_buf.data = + ARGPAR_REALLOC(iter->tmp_buf.data, char, iter->tmp_buf.size); if (!iter->tmp_buf.data) { ret = PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY; goto error; @@ -574,8 +551,7 @@ enum parse_orig_arg_opt_ret parse_long_opt(const char * const long_opt_arg, if (!descr) { ret = PARSE_ORIG_ARG_OPT_RET_ERROR; - if (set_error(error, ARGPAR_ERROR_TYPE_UNKNOWN_OPT, - long_opt_name, NULL, false)) { + if (set_error(error, ARGPAR_ERROR_TYPE_UNKNOWN_OPT, long_opt_name, NULL, false)) { ret = PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY; } @@ -592,8 +568,11 @@ enum parse_orig_arg_opt_ret parse_long_opt(const char * const long_opt_arg, if (!next_orig_arg) { ret = PARSE_ORIG_ARG_OPT_RET_ERROR; - if (set_error(error, ARGPAR_ERROR_TYPE_MISSING_OPT_ARG, - NULL, descr, false)) { + if (set_error(error, + ARGPAR_ERROR_TYPE_MISSING_OPT_ARG, + NULL, + descr, + false)) { ret = PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY; } @@ -610,8 +589,7 @@ enum parse_orig_arg_opt_ret parse_long_opt(const char * const long_opt_arg, */ ret = PARSE_ORIG_ARG_OPT_RET_ERROR; - if (set_error(error, ARGPAR_ERROR_TYPE_UNEXPECTED_OPT_ARG, - NULL, descr, false)) { + if (set_error(error, ARGPAR_ERROR_TYPE_UNEXPECTED_OPT_ARG, NULL, descr, false)) { ret = PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY; } @@ -648,13 +626,12 @@ end: * On error (except for `PARSE_ORIG_ARG_OPT_RET_ERROR_MEMORY`), sets * `*error`. */ -static -enum parse_orig_arg_opt_ret parse_orig_arg_opt(const char * const orig_arg, - const char * const next_orig_arg, - const struct argpar_opt_descr * const descrs, - struct argpar_iter * const iter, - struct argpar_error ** const error, - struct argpar_item ** const item) +static enum parse_orig_arg_opt_ret parse_orig_arg_opt(const char *const orig_arg, + const char *const next_orig_arg, + const struct argpar_opt_descr *const descrs, + struct argpar_iter *const iter, + struct argpar_error **const error, + struct argpar_item **const item) { enum parse_orig_arg_opt_ret ret = PARSE_ORIG_ARG_OPT_RET_OK; @@ -662,12 +639,10 @@ enum parse_orig_arg_opt_ret parse_orig_arg_opt(const char * const orig_arg, if (orig_arg[1] == '-') { /* Long option */ - ret = parse_long_opt(&orig_arg[2], - next_orig_arg, descrs, iter, error, item); + ret = parse_long_opt(&orig_arg[2], next_orig_arg, descrs, iter, error, item); } else { /* Short option */ - ret = parse_short_opt_group(&orig_arg[1], - next_orig_arg, descrs, iter, error, item); + ret = parse_short_opt_group(&orig_arg[1], next_orig_arg, descrs, iter, error, item); } return ret; @@ -675,8 +650,8 @@ enum parse_orig_arg_opt_ret parse_orig_arg_opt(const char * const orig_arg, ARGPAR_HIDDEN struct argpar_iter *argpar_iter_create(const unsigned int argc, - const char * const * const argv, - const struct argpar_opt_descr * const descrs) + const char *const *const argv, + const struct argpar_opt_descr *const descrs) { struct argpar_iter *iter = ARGPAR_ZALLOC(struct argpar_iter); @@ -700,7 +675,7 @@ end: } ARGPAR_HIDDEN -void argpar_iter_destroy(struct argpar_iter * const iter) +void argpar_iter_destroy(struct argpar_iter *const iter) { if (iter) { free(iter->tmp_buf.data); @@ -709,16 +684,15 @@ void argpar_iter_destroy(struct argpar_iter * const iter) } ARGPAR_HIDDEN -enum argpar_iter_next_status argpar_iter_next( - struct argpar_iter * const iter, - const struct argpar_item ** const item, - const struct argpar_error ** const error) +enum argpar_iter_next_status argpar_iter_next(struct argpar_iter *const iter, + const struct argpar_item **const item, + const struct argpar_error **const error) { enum argpar_iter_next_status status; enum parse_orig_arg_opt_ret parse_orig_arg_opt_ret; const char *orig_arg; const char *next_orig_arg; - struct argpar_error ** const nc_error = (struct argpar_error **) error; + struct argpar_error **const nc_error = (struct argpar_error **) error; ARGPAR_ASSERT(iter->i <= iter->user.argc); @@ -732,16 +706,12 @@ enum argpar_iter_next_status argpar_iter_next( } orig_arg = iter->user.argv[iter->i]; - next_orig_arg = - iter->i < (iter->user.argc - 1) ? - iter->user.argv[iter->i + 1] : NULL; + next_orig_arg = iter->i < (iter->user.argc - 1) ? iter->user.argv[iter->i + 1] : NULL; - if (strcmp(orig_arg, "-") == 0 || strcmp(orig_arg, "--") == 0 || - orig_arg[0] != '-') { + if (strcmp(orig_arg, "-") == 0 || strcmp(orig_arg, "--") == 0 || orig_arg[0] != '-') { /* Non-option argument */ - const struct argpar_item_non_opt * const non_opt_item = - create_non_opt_item(orig_arg, iter->i, - iter->non_opt_index); + const struct argpar_item_non_opt *const non_opt_item = + create_non_opt_item(orig_arg, iter->i, iter->non_opt_index); if (!non_opt_item) { status = ARGPAR_ITER_NEXT_STATUS_ERROR_MEMORY; @@ -757,8 +727,11 @@ enum argpar_iter_next_status argpar_iter_next( /* Option argument */ parse_orig_arg_opt_ret = parse_orig_arg_opt(orig_arg, - next_orig_arg, iter->user.descrs, iter, nc_error, - (struct argpar_item **) item); + next_orig_arg, + iter->user.descrs, + iter, + nc_error, + (struct argpar_item **) item); switch (parse_orig_arg_opt_ret) { case PARSE_ORIG_ARG_OPT_RET_OK: status = ARGPAR_ITER_NEXT_STATUS_OK; @@ -782,8 +755,7 @@ end: } ARGPAR_HIDDEN -unsigned int argpar_iter_ingested_orig_args( - const struct argpar_iter * const iter) +unsigned int argpar_iter_ingested_orig_args(const struct argpar_iter *const iter) { return iter->i; } diff --git a/src/common/argpar/argpar.h b/src/common/argpar/argpar.h index af9df9f5b..909da9cb3 100644 --- a/src/common/argpar/argpar.h +++ b/src/common/argpar/argpar.h @@ -119,9 +119,9 @@ argpar_iter_next() produces the following items, in this order: * . */ #if defined(_WIN32) || defined(__CYGWIN__) -# define ARGPAR_HIDDEN +#define ARGPAR_HIDDEN #else -# define ARGPAR_HIDDEN __attribute__((visibility("hidden"))) +#define ARGPAR_HIDDEN __attribute__((visibility("hidden"))) #endif struct argpar_opt_descr; @@ -190,8 +190,7 @@ enum argpar_item_type argpar_item_type(const struct argpar_item *item); /// @cond hidden_macro ARGPAR_HIDDEN /// @endcond -const struct argpar_opt_descr *argpar_item_opt_descr( - const struct argpar_item *item); +const struct argpar_opt_descr *argpar_item_opt_descr(const struct argpar_item *item); /*! @brief @@ -331,10 +330,10 @@ void argpar_item_destroy(const struct argpar_item *item); Item to destroy and variable to reset (const struct argpar_item * type). */ -#define ARGPAR_ITEM_DESTROY_AND_RESET(_item) \ - { \ - argpar_item_destroy(_item); \ - ((_item)) = NULL; \ +#define ARGPAR_ITEM_DESTROY_AND_RESET(_item) \ + { \ + argpar_item_destroy(_item); \ + ((_item)) = NULL; \ } /// @} @@ -468,8 +467,8 @@ const char *argpar_error_unknown_opt_name(const struct argpar_error *error); /// @cond hidden_macro ARGPAR_HIDDEN /// @endcond -const struct argpar_opt_descr *argpar_error_opt_descr( - const struct argpar_error *error, bool *is_short); +const struct argpar_opt_descr *argpar_error_opt_descr(const struct argpar_error *error, + bool *is_short); /*! @brief @@ -516,7 +515,7 @@ struct argpar_opt_descr { const char short_name; /// Long option name (without the \-- prefix), or \c NULL - const char * const long_name; + const char *const long_name; /// \c true if this option has an argument const bool with_arg; @@ -537,7 +536,10 @@ const struct argpar_opt_descr descrs[] = { }; @endcode */ -#define ARGPAR_OPT_DESCR_SENTINEL { -1, '\0', NULL, false } +#define ARGPAR_OPT_DESCR_SENTINEL \ + { \ + -1, '\0', NULL, false \ + } /*! @struct argpar_iter @@ -607,8 +609,8 @@ argpar_iter_next(). ARGPAR_HIDDEN /// @endcond struct argpar_iter *argpar_iter_create(unsigned int argc, - const char * const *argv, - const struct argpar_opt_descr *descrs); + const char *const *argv, + const struct argpar_opt_descr *descrs); /*! @brief @@ -681,9 +683,9 @@ If there are no more original arguments to parse, this function returns /// @cond hidden_macro ARGPAR_HIDDEN /// @endcond -enum argpar_iter_next_status argpar_iter_next( - struct argpar_iter *iter, const struct argpar_item **item, - const struct argpar_error **error); +enum argpar_iter_next_status argpar_iter_next(struct argpar_iter *iter, + const struct argpar_item **item, + const struct argpar_error **error); /* * Returns the number of ingested elements from `argv`, as passed to diff --git a/src/common/buffer-view.hpp b/src/common/buffer-view.hpp index 7e638c05e..131275af2 100644 --- a/src/common/buffer-view.hpp +++ b/src/common/buffer-view.hpp @@ -9,6 +9,7 @@ #define LTTNG_BUFFER_VIEW_H #include + #include #include #include @@ -31,8 +32,7 @@ struct lttng_buffer_view { * Note that a buffer view never assumes the ownership of the memory it * references. */ -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); /** * Checks if a buffer view is safe to access. @@ -58,9 +58,8 @@ bool lttng_buffer_view_is_valid(const struct lttng_buffer_view *view); * Note that a buffer view never assumes the ownership of the memory it * references. */ -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); /** * Return a buffer view referencing a subset of the memory referenced by a @@ -76,8 +75,7 @@ struct lttng_buffer_view lttng_buffer_view_from_view( * references. */ 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); /** * Verify that `buf` contains a string starting at `str` of length @@ -89,7 +87,7 @@ struct lttng_buffer_view lttng_buffer_view_from_dynamic_buffer( * NULL terminator. */ 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); #endif /* LTTNG_BUFFER_VIEW_H */ diff --git a/src/common/bug.hpp b/src/common/bug.hpp index f77c775a7..758fcf70c 100644 --- a/src/common/bug.hpp +++ b/src/common/bug.hpp @@ -8,22 +8,19 @@ #ifndef _LTTNG_BUG_H #define _LTTNG_BUG_H -#include #include #include +#include -#define LTTNG_BUG_ON(condition) \ - do { \ - if (caa_unlikely(condition)) { \ - fprintf(stderr, \ - "LTTng BUG in file %s, line %d.\n", \ - __FILE__, __LINE__); \ - exit(EXIT_FAILURE); \ - } \ +#define LTTNG_BUG_ON(condition) \ + do { \ + if (caa_unlikely(condition)) { \ + fprintf(stderr, "LTTng BUG in file %s, line %d.\n", __FILE__, __LINE__); \ + exit(EXIT_FAILURE); \ + } \ } while (0) -#define LTTNG_BUILD_BUG_ON(condition) \ - ((void) sizeof(char[-!!(condition)])) +#define LTTNG_BUILD_BUG_ON(condition) ((void) sizeof(char[-!!(condition)])) /** * LTTNG_BUILD_RUNTIME_BUG_ON - check condition at build (if constant) or runtime @@ -34,12 +31,12 @@ * if the condition is ever true. If the condition is constant and false, no * code is emitted. */ -#define LTTNG_BUILD_RUNTIME_BUG_ON(condition) \ - do { \ - if (__builtin_constant_p(condition)) \ - LTTNG_BUILD_BUG_ON(condition); \ - else \ - LTTNG_BUG_ON(condition); \ +#define LTTNG_BUILD_RUNTIME_BUG_ON(condition) \ + do { \ + if (__builtin_constant_p(condition)) \ + LTTNG_BUILD_BUG_ON(condition); \ + else \ + LTTNG_BUG_ON(condition); \ } while (0) #endif diff --git a/src/common/bytecode/bytecode.hpp b/src/common/bytecode/bytecode.hpp index 426cc489d..306a7ff76 100644 --- a/src/common/bytecode/bytecode.hpp +++ b/src/common/bytecode/bytecode.hpp @@ -8,11 +8,11 @@ #ifndef LTTNG_COMMON_BYTECODE_H #define LTTNG_COMMON_BYTECODE_H -#include - #include "common/macros.hpp" #include "common/sessiond-comm/sessiond-comm.hpp" +#include + /* * offsets are absolute from start of bytecode. */ @@ -44,149 +44,149 @@ struct literal_double { } LTTNG_PACKED; enum bytecode_op { - BYTECODE_OP_UNKNOWN = 0, + BYTECODE_OP_UNKNOWN = 0, - BYTECODE_OP_RETURN = 1, + BYTECODE_OP_RETURN = 1, /* binary */ - BYTECODE_OP_MUL = 2, - BYTECODE_OP_DIV = 3, - BYTECODE_OP_MOD = 4, - BYTECODE_OP_PLUS = 5, - BYTECODE_OP_MINUS = 6, - BYTECODE_OP_BIT_RSHIFT = 7, - BYTECODE_OP_BIT_LSHIFT = 8, - BYTECODE_OP_BIT_AND = 9, - BYTECODE_OP_BIT_OR = 10, - BYTECODE_OP_BIT_XOR = 11, + BYTECODE_OP_MUL = 2, + BYTECODE_OP_DIV = 3, + BYTECODE_OP_MOD = 4, + BYTECODE_OP_PLUS = 5, + BYTECODE_OP_MINUS = 6, + BYTECODE_OP_BIT_RSHIFT = 7, + BYTECODE_OP_BIT_LSHIFT = 8, + BYTECODE_OP_BIT_AND = 9, + BYTECODE_OP_BIT_OR = 10, + BYTECODE_OP_BIT_XOR = 11, /* binary comparators */ - BYTECODE_OP_EQ = 12, - BYTECODE_OP_NE = 13, - BYTECODE_OP_GT = 14, - BYTECODE_OP_LT = 15, - BYTECODE_OP_GE = 16, - BYTECODE_OP_LE = 17, + BYTECODE_OP_EQ = 12, + BYTECODE_OP_NE = 13, + BYTECODE_OP_GT = 14, + BYTECODE_OP_LT = 15, + BYTECODE_OP_GE = 16, + BYTECODE_OP_LE = 17, /* string binary comparator: apply to */ - BYTECODE_OP_EQ_STRING = 18, - BYTECODE_OP_NE_STRING = 19, - BYTECODE_OP_GT_STRING = 20, - BYTECODE_OP_LT_STRING = 21, - BYTECODE_OP_GE_STRING = 22, - BYTECODE_OP_LE_STRING = 23, + BYTECODE_OP_EQ_STRING = 18, + BYTECODE_OP_NE_STRING = 19, + BYTECODE_OP_GT_STRING = 20, + BYTECODE_OP_LT_STRING = 21, + BYTECODE_OP_GE_STRING = 22, + BYTECODE_OP_LE_STRING = 23, /* s64 binary comparator */ - BYTECODE_OP_EQ_S64 = 24, - BYTECODE_OP_NE_S64 = 25, - BYTECODE_OP_GT_S64 = 26, - BYTECODE_OP_LT_S64 = 27, - BYTECODE_OP_GE_S64 = 28, - BYTECODE_OP_LE_S64 = 29, + BYTECODE_OP_EQ_S64 = 24, + BYTECODE_OP_NE_S64 = 25, + BYTECODE_OP_GT_S64 = 26, + BYTECODE_OP_LT_S64 = 27, + BYTECODE_OP_GE_S64 = 28, + BYTECODE_OP_LE_S64 = 29, /* double binary comparator */ - BYTECODE_OP_EQ_DOUBLE = 30, - BYTECODE_OP_NE_DOUBLE = 31, - BYTECODE_OP_GT_DOUBLE = 32, - BYTECODE_OP_LT_DOUBLE = 33, - BYTECODE_OP_GE_DOUBLE = 34, - BYTECODE_OP_LE_DOUBLE = 35, + BYTECODE_OP_EQ_DOUBLE = 30, + BYTECODE_OP_NE_DOUBLE = 31, + BYTECODE_OP_GT_DOUBLE = 32, + BYTECODE_OP_LT_DOUBLE = 33, + BYTECODE_OP_GE_DOUBLE = 34, + BYTECODE_OP_LE_DOUBLE = 35, /* Mixed S64-double binary comparators */ - BYTECODE_OP_EQ_DOUBLE_S64 = 36, - BYTECODE_OP_NE_DOUBLE_S64 = 37, - BYTECODE_OP_GT_DOUBLE_S64 = 38, - BYTECODE_OP_LT_DOUBLE_S64 = 39, - BYTECODE_OP_GE_DOUBLE_S64 = 40, - BYTECODE_OP_LE_DOUBLE_S64 = 41, - - BYTECODE_OP_EQ_S64_DOUBLE = 42, - BYTECODE_OP_NE_S64_DOUBLE = 43, - BYTECODE_OP_GT_S64_DOUBLE = 44, - BYTECODE_OP_LT_S64_DOUBLE = 45, - BYTECODE_OP_GE_S64_DOUBLE = 46, - BYTECODE_OP_LE_S64_DOUBLE = 47, + BYTECODE_OP_EQ_DOUBLE_S64 = 36, + BYTECODE_OP_NE_DOUBLE_S64 = 37, + BYTECODE_OP_GT_DOUBLE_S64 = 38, + BYTECODE_OP_LT_DOUBLE_S64 = 39, + BYTECODE_OP_GE_DOUBLE_S64 = 40, + BYTECODE_OP_LE_DOUBLE_S64 = 41, + + BYTECODE_OP_EQ_S64_DOUBLE = 42, + BYTECODE_OP_NE_S64_DOUBLE = 43, + BYTECODE_OP_GT_S64_DOUBLE = 44, + BYTECODE_OP_LT_S64_DOUBLE = 45, + BYTECODE_OP_GE_S64_DOUBLE = 46, + BYTECODE_OP_LE_S64_DOUBLE = 47, /* unary */ - BYTECODE_OP_UNARY_PLUS = 48, - BYTECODE_OP_UNARY_MINUS = 49, - BYTECODE_OP_UNARY_NOT = 50, - BYTECODE_OP_UNARY_PLUS_S64 = 51, - BYTECODE_OP_UNARY_MINUS_S64 = 52, - BYTECODE_OP_UNARY_NOT_S64 = 53, - BYTECODE_OP_UNARY_PLUS_DOUBLE = 54, - BYTECODE_OP_UNARY_MINUS_DOUBLE = 55, - BYTECODE_OP_UNARY_NOT_DOUBLE = 56, + BYTECODE_OP_UNARY_PLUS = 48, + BYTECODE_OP_UNARY_MINUS = 49, + BYTECODE_OP_UNARY_NOT = 50, + BYTECODE_OP_UNARY_PLUS_S64 = 51, + BYTECODE_OP_UNARY_MINUS_S64 = 52, + BYTECODE_OP_UNARY_NOT_S64 = 53, + BYTECODE_OP_UNARY_PLUS_DOUBLE = 54, + BYTECODE_OP_UNARY_MINUS_DOUBLE = 55, + BYTECODE_OP_UNARY_NOT_DOUBLE = 56, /* logical */ - BYTECODE_OP_AND = 57, - BYTECODE_OP_OR = 58, + BYTECODE_OP_AND = 57, + BYTECODE_OP_OR = 58, /* load field ref */ - BYTECODE_OP_LOAD_FIELD_REF = 59, - BYTECODE_OP_LOAD_FIELD_REF_STRING = 60, - BYTECODE_OP_LOAD_FIELD_REF_SEQUENCE = 61, - BYTECODE_OP_LOAD_FIELD_REF_S64 = 62, - BYTECODE_OP_LOAD_FIELD_REF_DOUBLE = 63, + BYTECODE_OP_LOAD_FIELD_REF = 59, + BYTECODE_OP_LOAD_FIELD_REF_STRING = 60, + BYTECODE_OP_LOAD_FIELD_REF_SEQUENCE = 61, + BYTECODE_OP_LOAD_FIELD_REF_S64 = 62, + BYTECODE_OP_LOAD_FIELD_REF_DOUBLE = 63, /* load immediate from operand */ - BYTECODE_OP_LOAD_STRING = 64, - BYTECODE_OP_LOAD_S64 = 65, - BYTECODE_OP_LOAD_DOUBLE = 66, + BYTECODE_OP_LOAD_STRING = 64, + BYTECODE_OP_LOAD_S64 = 65, + BYTECODE_OP_LOAD_DOUBLE = 66, /* cast */ - BYTECODE_OP_CAST_TO_S64 = 67, - BYTECODE_OP_CAST_DOUBLE_TO_S64 = 68, - BYTECODE_OP_CAST_NOP = 69, + BYTECODE_OP_CAST_TO_S64 = 67, + BYTECODE_OP_CAST_DOUBLE_TO_S64 = 68, + BYTECODE_OP_CAST_NOP = 69, /* get context ref */ - BYTECODE_OP_GET_CONTEXT_REF = 70, - BYTECODE_OP_GET_CONTEXT_REF_STRING = 71, - BYTECODE_OP_GET_CONTEXT_REF_S64 = 72, - BYTECODE_OP_GET_CONTEXT_REF_DOUBLE = 73, + BYTECODE_OP_GET_CONTEXT_REF = 70, + BYTECODE_OP_GET_CONTEXT_REF_STRING = 71, + BYTECODE_OP_GET_CONTEXT_REF_S64 = 72, + BYTECODE_OP_GET_CONTEXT_REF_DOUBLE = 73, /* load userspace field ref */ - BYTECODE_OP_LOAD_FIELD_REF_USER_STRING = 74, - BYTECODE_OP_LOAD_FIELD_REF_USER_SEQUENCE = 75, + BYTECODE_OP_LOAD_FIELD_REF_USER_STRING = 74, + BYTECODE_OP_LOAD_FIELD_REF_USER_SEQUENCE = 75, /* * load immediate star globbing pattern (literal string) * from immediate */ - BYTECODE_OP_LOAD_STAR_GLOB_STRING = 76, + BYTECODE_OP_LOAD_STAR_GLOB_STRING = 76, /* globbing pattern binary operator: apply to */ - BYTECODE_OP_EQ_STAR_GLOB_STRING = 77, - BYTECODE_OP_NE_STAR_GLOB_STRING = 78, + BYTECODE_OP_EQ_STAR_GLOB_STRING = 77, + BYTECODE_OP_NE_STAR_GLOB_STRING = 78, /* * Instructions for recursive traversal through composed types. */ - BYTECODE_OP_GET_CONTEXT_ROOT = 79, - BYTECODE_OP_GET_APP_CONTEXT_ROOT = 80, - BYTECODE_OP_GET_PAYLOAD_ROOT = 81, - - BYTECODE_OP_GET_SYMBOL = 82, - BYTECODE_OP_GET_SYMBOL_FIELD = 83, - BYTECODE_OP_GET_INDEX_U16 = 84, - BYTECODE_OP_GET_INDEX_U64 = 85, - - BYTECODE_OP_LOAD_FIELD = 86, - BYTECODE_OP_LOAD_FIELD_S8 = 87, - BYTECODE_OP_LOAD_FIELD_S16 = 88, - BYTECODE_OP_LOAD_FIELD_S32 = 89, - BYTECODE_OP_LOAD_FIELD_S64 = 90, - BYTECODE_OP_LOAD_FIELD_U8 = 91, - BYTECODE_OP_LOAD_FIELD_U16 = 92, - BYTECODE_OP_LOAD_FIELD_U32 = 93, - BYTECODE_OP_LOAD_FIELD_U64 = 94, - BYTECODE_OP_LOAD_FIELD_STRING = 95, - BYTECODE_OP_LOAD_FIELD_SEQUENCE = 96, - BYTECODE_OP_LOAD_FIELD_DOUBLE = 97, - - BYTECODE_OP_UNARY_BIT_NOT = 98, - - BYTECODE_OP_RETURN_S64 = 99, + BYTECODE_OP_GET_CONTEXT_ROOT = 79, + BYTECODE_OP_GET_APP_CONTEXT_ROOT = 80, + BYTECODE_OP_GET_PAYLOAD_ROOT = 81, + + BYTECODE_OP_GET_SYMBOL = 82, + BYTECODE_OP_GET_SYMBOL_FIELD = 83, + BYTECODE_OP_GET_INDEX_U16 = 84, + BYTECODE_OP_GET_INDEX_U64 = 85, + + BYTECODE_OP_LOAD_FIELD = 86, + BYTECODE_OP_LOAD_FIELD_S8 = 87, + BYTECODE_OP_LOAD_FIELD_S16 = 88, + BYTECODE_OP_LOAD_FIELD_S32 = 89, + BYTECODE_OP_LOAD_FIELD_S64 = 90, + BYTECODE_OP_LOAD_FIELD_U8 = 91, + BYTECODE_OP_LOAD_FIELD_U16 = 92, + BYTECODE_OP_LOAD_FIELD_U32 = 93, + BYTECODE_OP_LOAD_FIELD_U64 = 94, + BYTECODE_OP_LOAD_FIELD_STRING = 95, + BYTECODE_OP_LOAD_FIELD_SEQUENCE = 96, + BYTECODE_OP_LOAD_FIELD_DOUBLE = 97, + + BYTECODE_OP_UNARY_BIT_NOT = 98, + + BYTECODE_OP_RETURN_S64 = 99, NR_BYTECODE_OPS, }; @@ -214,7 +214,7 @@ struct unary_op { /* skip_offset is absolute from start of bytecode */ struct logical_op { bytecode_opcode_t op; - uint16_t skip_offset; /* bytecode insn, if skip second test */ + uint16_t skip_offset; /* bytecode insn, if skip second test */ } LTTNG_PACKED; struct cast_op { @@ -231,29 +231,23 @@ struct lttng_bytecode_alloc { }; int bytecode_init(struct lttng_bytecode_alloc **fb); -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); int bytecode_push_logical(struct lttng_bytecode_alloc **fb, - struct logical_op *data, uint32_t align, uint32_t len, - uint16_t *skip_offset); -struct lttng_bytecode *lttng_bytecode_copy( - const struct lttng_bytecode *orig_f); - -int bytecode_push_get_payload_root( - struct lttng_bytecode_alloc **bytecode); -int bytecode_push_get_context_root( - struct lttng_bytecode_alloc **bytecode); -int bytecode_push_get_app_context_root( - struct lttng_bytecode_alloc **bytecode); -int bytecode_push_get_index_u64( - struct lttng_bytecode_alloc **bytecode, uint64_t index); -int bytecode_push_get_symbol( - struct lttng_bytecode_alloc **bytecode, - struct lttng_bytecode_alloc **bytecode_reloc, - const char *symbol); - -static inline -unsigned int bytecode_get_len(struct lttng_bytecode *bytecode) + struct logical_op *data, + uint32_t align, + uint32_t len, + uint16_t *skip_offset); +struct lttng_bytecode *lttng_bytecode_copy(const struct lttng_bytecode *orig_f); + +int bytecode_push_get_payload_root(struct lttng_bytecode_alloc **bytecode); +int bytecode_push_get_context_root(struct lttng_bytecode_alloc **bytecode); +int bytecode_push_get_app_context_root(struct lttng_bytecode_alloc **bytecode); +int bytecode_push_get_index_u64(struct lttng_bytecode_alloc **bytecode, uint64_t index); +int bytecode_push_get_symbol(struct lttng_bytecode_alloc **bytecode, + struct lttng_bytecode_alloc **bytecode_reloc, + const char *symbol); + +static inline unsigned int bytecode_get_len(struct lttng_bytecode *bytecode) { return bytecode->len; } diff --git a/src/common/common.hpp b/src/common/common.hpp index 926ebf36d..b784e5c0c 100644 --- a/src/common/common.hpp +++ b/src/common/common.hpp @@ -11,8 +11,8 @@ #include "error.hpp" #include "macros.hpp" -#include "runas.hpp" #include "readwrite.hpp" +#include "runas.hpp" #include "time.hpp" #endif /* _COMMON_H */ diff --git a/src/common/compat/directory-handle.hpp b/src/common/compat/directory-handle.hpp index ced720e5a..108ec4c86 100644 --- a/src/common/compat/directory-handle.hpp +++ b/src/common/compat/directory-handle.hpp @@ -10,6 +10,7 @@ #include #include + #include #include @@ -39,9 +40,7 @@ struct lttng_directory_handle { void *destroy_cb_data; }; -static inline -int lttng_directory_handle_get_dirfd( - const struct lttng_directory_handle *handle) +static inline int lttng_directory_handle_get_dirfd(const struct lttng_directory_handle *handle) { return handle->dirfd; } @@ -60,8 +59,7 @@ struct lttng_directory_handle { * The reference to the directory handle must be released using * lttng_directory_handle_put(). */ -struct lttng_directory_handle *lttng_directory_handle_create( - const char *path); +struct lttng_directory_handle *lttng_directory_handle_create(const char *path); /* * Create a new directory handle to a path relative to an existing handle. @@ -76,9 +74,9 @@ struct lttng_directory_handle *lttng_directory_handle_create( * The reference to the directory handle must be released using * lttng_directory_handle_put(). */ -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); /* * Create a new directory handle from an existing directory fd. @@ -90,8 +88,7 @@ struct lttng_directory_handle *lttng_directory_handle_create_from_handle( * The reference to the directory handle must be released using * lttng_directory_handle_put(). */ -struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd( - int dirfd); +struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd(int dirfd); /* * Copy a directory handle. @@ -99,8 +96,8 @@ struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd( * The reference to the directory handle must be released using * lttng_directory_handle_put(). */ -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); /* * Acquire a reference to a directory handle. @@ -115,105 +112,97 @@ void lttng_directory_handle_put(struct lttng_directory_handle *handle); /* * Create a subdirectory relative to a directory handle. */ -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); /* * Create a subdirectory relative to a directory handle * as a given user. */ -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); /* * Recursively create a directory relative to a directory handle. */ 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); /* * Recursively create a directory relative to a directory handle * as a given user. */ 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); /* * Open a file descriptor to a path relative to a directory handle. */ -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); /* * Open a file descriptor to a path relative to a directory handle * as a given user. */ -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); /* * Unlink a file to a path relative to a directory handle. */ -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); /* * Unlink a file to a path relative to a directory handle as a given user. */ -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); /* * Rename a file from a path relative to a directory handle to a new * name relative to another directory handle. */ -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); /* * Rename a file from a path relative to a directory handle to a new * name relative to another directory handle as a given user. */ -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); /* * Remove a subdirectory relative to a directory handle. */ -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); /* * Remove a subdirectory relative to a directory handle as a given user. */ -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); /* * Remove a subdirectory and remove its contents if it only @@ -221,8 +210,7 @@ int lttng_directory_handle_remove_subdirectory_as_user( * @flags: enum lttng_directory_handle_rmdir_recursive_flags */ 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); /* * Remove a subdirectory and remove its contents if it only @@ -230,25 +218,23 @@ int lttng_directory_handle_remove_subdirectory_recursive( * @flags: enum lttng_directory_handle_rmdir_recursive_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); /* * stat() a file relative to a directory handle. */ -int lttng_directory_handle_stat( - const struct lttng_directory_handle *handle, - const char *name, - struct stat *stat_buf); +int lttng_directory_handle_stat(const struct lttng_directory_handle *handle, + const char *name, + struct stat *stat_buf); /* * Returns true if this directory handle is backed by a file * descriptor, false otherwise. */ -bool lttng_directory_handle_uses_fd( - const struct lttng_directory_handle *handle); +bool lttng_directory_handle_uses_fd(const struct lttng_directory_handle *handle); /* * Compare two directory handles. @@ -256,7 +242,6 @@ bool lttng_directory_handle_uses_fd( * Returns true if the two directory handles are equal, false otherwise. */ bool lttng_directory_handle_equals(const struct lttng_directory_handle *lhs, - const struct lttng_directory_handle *rhs); - + const struct lttng_directory_handle *rhs); #endif /* _COMPAT_PATH_HANDLE_H */ diff --git a/src/common/compat/dirent.hpp b/src/common/compat/dirent.hpp index b760ed2db..d2dc5ed60 100644 --- a/src/common/compat/dirent.hpp +++ b/src/common/compat/dirent.hpp @@ -11,22 +11,22 @@ #include #ifdef HAVE_DIRFD -static inline -int lttng_dirfd(DIR *dir) { +static inline int lttng_dirfd(DIR *dir) +{ return dirfd(dir); } #else -# ifndef __XOPEN_OR_POSIX -static inline -int lttng_dirfd(DIR *dir) { +#ifndef __XOPEN_OR_POSIX +static inline int lttng_dirfd(DIR *dir) +{ return dir->dd_fd; } -# else -static inline -int lttng_dirfd(DIR *dir) { +#else +static inline int lttng_dirfd(DIR *dir) +{ return dir->d_fd; } -# endif +#endif #endif #endif /* _COMPAT_DIRENT_H */ diff --git a/src/common/compat/endian.hpp b/src/common/compat/endian.hpp index ff3837634..642e23b0c 100644 --- a/src/common/compat/endian.hpp +++ b/src/common/compat/endian.hpp @@ -38,8 +38,8 @@ #define _COMPAT_ENDIAN_H #if defined(__linux__) || defined(__CYGWIN__) -#include #include +#include /* * htobe/betoh are not defined for glibc <2.9, so add them @@ -47,97 +47,97 @@ */ #ifdef __USE_BSD /* Conversion interfaces. */ -# include - -# if __BYTE_ORDER == __LITTLE_ENDIAN -# ifndef htobe16 -# define htobe16(x) __bswap_16(x) -# endif -# ifndef htole16 -# define htole16(x) (x) -# endif -# ifndef be16toh -# define be16toh(x) __bswap_16(x) -# endif -# ifndef le16toh -# define le16toh(x) (x) -# endif - -# ifndef htobe32 -# define htobe32(x) __bswap_32(x) -# endif -# ifndef htole32 -# define htole32(x) (x) -# endif -# ifndef be32toh -# define be32toh(x) __bswap_32(x) -# endif -# ifndef le32toh -# define le32toh(x) (x) -# endif - -# ifndef htobe64 -# define htobe64(x) __bswap_64(x) -# endif -# ifndef htole64 -# define htole64(x) (x) -# endif -# ifndef be64toh -# define be64toh(x) __bswap_64(x) -# endif -# ifndef le64toh -# define le64toh(x) (x) -# endif - -# else /* __BYTE_ORDER == __LITTLE_ENDIAN */ -# ifndef htobe16 -# define htobe16(x) (x) -# endif -# ifndef htole16 -# define htole16(x) __bswap_16(x) -# endif -# ifndef be16toh -# define be16toh(x) (x) -# endif -# ifndef le16toh -# define le16toh(x) __bswap_16(x) -# endif - -# ifndef htobe32 -# define htobe32(x) (x) -# endif -# ifndef htole32 -# define htole32(x) __bswap_32(x) -# endif -# ifndef be32toh -# define be32toh(x) (x) -# endif -# ifndef le32toh -# define le32toh(x) __bswap_32(x) -# endif - -# ifndef htobe64 -# define htobe64(x) (x) -# endif -# ifndef htole64 -# define htole64(x) __bswap_64(x) -# endif -# ifndef be64toh -# define be64toh(x) (x) -# endif -# ifndef le64toh -# define le64toh(x) __bswap_64(x) -# endif - -# endif /* __BYTE_ORDER == __LITTLE_ENDIAN */ +#include + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#ifndef htobe16 +#define htobe16(x) __bswap_16(x) +#endif +#ifndef htole16 +#define htole16(x) (x) +#endif +#ifndef be16toh +#define be16toh(x) __bswap_16(x) +#endif +#ifndef le16toh +#define le16toh(x) (x) +#endif + +#ifndef htobe32 +#define htobe32(x) __bswap_32(x) +#endif +#ifndef htole32 +#define htole32(x) (x) +#endif +#ifndef be32toh +#define be32toh(x) __bswap_32(x) +#endif +#ifndef le32toh +#define le32toh(x) (x) +#endif + +#ifndef htobe64 +#define htobe64(x) __bswap_64(x) +#endif +#ifndef htole64 +#define htole64(x) (x) +#endif +#ifndef be64toh +#define be64toh(x) __bswap_64(x) +#endif +#ifndef le64toh +#define le64toh(x) (x) +#endif + +#else /* __BYTE_ORDER == __LITTLE_ENDIAN */ +#ifndef htobe16 +#define htobe16(x) (x) +#endif +#ifndef htole16 +#define htole16(x) __bswap_16(x) +#endif +#ifndef be16toh +#define be16toh(x) (x) +#endif +#ifndef le16toh +#define le16toh(x) __bswap_16(x) +#endif + +#ifndef htobe32 +#define htobe32(x) (x) +#endif +#ifndef htole32 +#define htole32(x) __bswap_32(x) +#endif +#ifndef be32toh +#define be32toh(x) (x) +#endif +#ifndef le32toh +#define le32toh(x) __bswap_32(x) +#endif + +#ifndef htobe64 +#define htobe64(x) (x) +#endif +#ifndef htole64 +#define htole64(x) __bswap_64(x) +#endif +#ifndef be64toh +#define be64toh(x) (x) +#endif +#ifndef le64toh +#define le64toh(x) __bswap_64(x) +#endif + +#endif /* __BYTE_ORDER == __LITTLE_ENDIAN */ #endif /* __USE_BSD */ #elif defined(__FreeBSD__) #include -#define bswap_16(x) bswap16(x) -#define bswap_32(x) bswap32(x) -#define bswap_64(x) bswap64(x) +#define bswap_16(x) bswap16(x) +#define bswap_32(x) bswap32(x) +#define bswap_64(x) bswap64(x) #elif defined(__sun__) #include @@ -155,9 +155,9 @@ #define __BYTE_ORDER __BIG_ENDIAN #endif /* _BIG_ENDIAN */ -#define LITTLE_ENDIAN __LITTLE_ENDIAN -#define BIG_ENDIAN __BIG_ENDIAN -#define BYTE_ORDER __BYTE_ORDER +#define LITTLE_ENDIAN __LITTLE_ENDIAN +#define BIG_ENDIAN __BIG_ENDIAN +#define BYTE_ORDER __BYTE_ORDER #define betoh16(x) BE_16(x) #define letoh16(x) LE_16(x) @@ -173,41 +173,41 @@ #define be64toh(x) BE_64(x) #elif defined(__APPLE__) -# include -# include - -# if BYTE_ORDER == LITTLE_ENDIAN -# define htobe16(x) OSSwapConstInt16(x) -# define htole16(x) (x) -# define be16toh(x) OSSwapConstInt16(x) -# define le16toh(x) (x) - -# define htobe32(x) OSSwapConstInt32(x) -# define htole32(x) (x) -# define be32toh(x) OSSwapConstInt32(x) -# define le32toh(x) (x) - -# define htobe64(x) OSSwapConstInt64(x) -# define htole64(x) (x) -# define be64toh(x) OSSwapConstInt64(x) -# define le64toh(x) (x) - -# else /* BYTE_ORDER == LITTLE_ENDIAN */ -# define htobe16(x) (x) -# define htole16(x) OSSwapConstInt16(x) -# define be16toh(x) (x) -# define le16toh(x) OSSwapConstInt16(x) - -# define htobe32(x) (x) -# define htole32(x) OSSwapConstInt32(x) -# define be32toh(x) (x) -# define le32toh(x) OSSwapConstInt32(x) - -# define htobe64(x) (x) -# define htole64(x) OSSwapConstInt64(x) -# define be64toh(x) (x) -# define le64toh(x) OSSwapConstInt64(x) -# endif +#include +#include + +#if BYTE_ORDER == LITTLE_ENDIAN +#define htobe16(x) OSSwapConstInt16(x) +#define htole16(x) (x) +#define be16toh(x) OSSwapConstInt16(x) +#define le16toh(x) (x) + +#define htobe32(x) OSSwapConstInt32(x) +#define htole32(x) (x) +#define be32toh(x) OSSwapConstInt32(x) +#define le32toh(x) (x) + +#define htobe64(x) OSSwapConstInt64(x) +#define htole64(x) (x) +#define be64toh(x) OSSwapConstInt64(x) +#define le64toh(x) (x) + +#else /* BYTE_ORDER == LITTLE_ENDIAN */ +#define htobe16(x) (x) +#define htole16(x) OSSwapConstInt16(x) +#define be16toh(x) (x) +#define le16toh(x) OSSwapConstInt16(x) + +#define htobe32(x) (x) +#define htole32(x) OSSwapConstInt32(x) +#define be32toh(x) (x) +#define le32toh(x) OSSwapConstInt32(x) + +#define htobe64(x) (x) +#define htole64(x) OSSwapConstInt64(x) +#define be64toh(x) (x) +#define le64toh(x) OSSwapConstInt64(x) +#endif #else #error "Please add support for your OS." diff --git a/src/common/compat/fcntl.hpp b/src/common/compat/fcntl.hpp index 08fe02cf4..ba8f05a95 100644 --- a/src/common/compat/fcntl.hpp +++ b/src/common/compat/fcntl.hpp @@ -8,11 +8,11 @@ #ifndef _COMPAT_FCNTL_H #define _COMPAT_FCNTL_H +#include + #include #include -#include - static_assert(sizeof(off_t) == sizeof(int64_t), "Build system is misconfigured, off_t must be 64-bit wide"); @@ -21,8 +21,7 @@ typedef off64_t loff_t; #endif #ifdef __linux__ -extern int compat_sync_file_range(int fd, off_t offset, off_t nbytes, - unsigned int flags); +extern int compat_sync_file_range(int fd, off_t offset, off_t nbytes, unsigned int flags); #define lttng_sync_file_range(fd, offset, nbytes, flags) \ compat_sync_file_range(fd, offset, nbytes, flags) @@ -32,15 +31,14 @@ extern int compat_sync_file_range(int fd, off_t offset, off_t nbytes, /* * Possible flags under Linux. Simply nullify them and avoid wrapper. */ -#define SYNC_FILE_RANGE_WAIT_AFTER 0 -#define SYNC_FILE_RANGE_WAIT_BEFORE 0 -#define SYNC_FILE_RANGE_WRITE 0 +#define SYNC_FILE_RANGE_WAIT_AFTER 0 +#define SYNC_FILE_RANGE_WAIT_BEFORE 0 +#define SYNC_FILE_RANGE_WRITE 0 -static inline int lttng_sync_file_range( - int fd __attribute__((unused)), - off_t offset __attribute__((unused)), - off_t nbytes __attribute__((unused)), - unsigned int flags __attribute__((unused))) +static inline int lttng_sync_file_range(int fd __attribute__((unused)), + off_t offset __attribute__((unused)), + off_t nbytes __attribute__((unused)), + unsigned int flags __attribute__((unused))) { return -ENOSYS; } @@ -50,24 +48,24 @@ static inline int lttng_sync_file_range( /* * Possible flags under Linux. Simply nullify them and avoid wrappers. */ -#define SPLICE_F_MOVE 0 -#define SPLICE_F_NONBLOCK 0 -#define SPLICE_F_MORE 0 -#define SPLICE_F_GIFT 0 +#define SPLICE_F_MOVE 0 +#define SPLICE_F_NONBLOCK 0 +#define SPLICE_F_MORE 0 +#define SPLICE_F_GIFT 0 -static inline ssize_t splice( - int fd_in __attribute__((unused)), - loff_t *off_in __attribute__((unused)), - int fd_out __attribute__((unused)), - loff_t *off_out __attribute__((unused)), - size_t len __attribute__((unused)), - unsigned int flags __attribute__((unused))) +static inline ssize_t splice(int fd_in __attribute__((unused)), + loff_t *off_in __attribute__((unused)), + int fd_out __attribute__((unused)), + loff_t *off_out __attribute__((unused)), + size_t len __attribute__((unused)), + unsigned int flags __attribute__((unused))) { return -ENOSYS; } #endif -#if !(defined(__linux__) || defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__) || defined(__APPLE__)) +#if !(defined(__linux__) || defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__) || \ + defined(__APPLE__)) #error "Please add support for your OS." #endif /* __linux__ , __FreeBSD__, __CYGWIN__, __sun__, __APPLE__ */ diff --git a/src/common/compat/getenv.hpp b/src/common/compat/getenv.hpp index 18b5dee97..d37db05fc 100644 --- a/src/common/compat/getenv.hpp +++ b/src/common/compat/getenv.hpp @@ -8,23 +8,22 @@ * */ +#include + #include -#include #include -#include +#include -static inline -int lttng_is_setuid_setgid() +static inline int lttng_is_setuid_setgid() { return geteuid() != getuid() || getegid() != getgid(); } -static inline -char *lttng_secure_getenv(const char *name) +static inline char *lttng_secure_getenv(const char *name) { if (lttng_is_setuid_setgid()) { WARN("Getting environment variable '%s' from setuid/setgid binary refused for security reasons.", - name); + name); return nullptr; } return getenv(name); diff --git a/src/common/compat/netdb.hpp b/src/common/compat/netdb.hpp index a8bf7e2d0..0f75771ca 100644 --- a/src/common/compat/netdb.hpp +++ b/src/common/compat/netdb.hpp @@ -11,19 +11,19 @@ #include #ifdef HAVE_GETHOSTBYNAME2 -static inline -struct hostent *lttng_gethostbyname2(const char *name, int af) { +static inline struct hostent *lttng_gethostbyname2(const char *name, int af) +{ return gethostbyname2(name, af); } #elif HAVE_GETIPNODEBYNAME -static inline -struct hostent *lttng_gethostbyname2(const char *name, int af) { +static inline struct hostent *lttng_gethostbyname2(const char *name, int af) +{ int unused; return getipnodebyname(name, af, AI_DEFAULT, &unused); } #else -# error "Missing compat for gethostbyname2()" +#error "Missing compat for gethostbyname2()" #endif #endif /* _COMPAT_NETDB_H */ diff --git a/src/common/compat/paths.hpp b/src/common/compat/paths.hpp index 0203ae80d..235538b42 100644 --- a/src/common/compat/paths.hpp +++ b/src/common/compat/paths.hpp @@ -11,7 +11,7 @@ #ifdef HAVE_PATHS_H #include #else -# define _PATH_DEVNULL "/dev/null" +#define _PATH_DEVNULL "/dev/null" #endif #endif /* _COMPAT_PATHS_H */ diff --git a/src/common/compat/poll.hpp b/src/common/compat/poll.hpp index e6de51474..bfb3da82b 100644 --- a/src/common/compat/poll.hpp +++ b/src/common/compat/poll.hpp @@ -8,11 +8,11 @@ #ifndef _LTT_POLL_H #define _LTT_POLL_H +#include + #include #include -#include - /* * Used by lttng_poll_clean to free the events structure in a lttng_poll_event. */ @@ -25,11 +25,12 @@ static inline void __lttng_poll_free(void *events) * epoll(7) implementation. */ #ifdef HAVE_EPOLL -#include -#include -#include #include +#include +#include +#include + /* See man epoll(7) for this define path */ #define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches" @@ -47,7 +48,7 @@ enum { LPOLLHUP = EPOLLHUP, LPOLLNVAL = EPOLLHUP, LPOLLRDHUP = EPOLLRDHUP, - /* Close on exec feature of epoll */ +/* Close on exec feature of epoll */ #if defined(HAVE_EPOLL_CREATE1) && defined(EPOLL_CLOEXEC) LTTNG_CLOEXEC = EPOLL_CLOEXEC, #else @@ -63,15 +64,15 @@ enum { struct compat_epoll_event { int epfd; - uint32_t nb_fd; /* Current number of fd in events */ + uint32_t nb_fd; /* Current number of fd in events */ uint32_t alloc_size; /* Size of events array */ - uint32_t init_size; /* Initial size of events array */ + uint32_t init_size; /* Initial size of events array */ struct epoll_event *events; }; #define lttng_poll_event compat_epoll_event -static inline int __lttng_epoll_get_prev_fd(struct lttng_poll_event *events, - int index, uint32_t nb_fd) +static inline int +__lttng_epoll_get_prev_fd(struct lttng_poll_event *events, int index, uint32_t nb_fd) { LTTNG_ASSERT(events); LTTNG_ASSERT(index != nb_fd); @@ -87,22 +88,18 @@ static inline int __lttng_epoll_get_prev_fd(struct lttng_poll_event *events, * For the following calls, consider 'e' to be a lttng_poll_event pointer and i * being the index of the events array. */ -#define LTTNG_POLL_GETFD(e, i) LTTNG_REF(e)->events[i].data.fd -#define LTTNG_POLL_GETEV(e, i) LTTNG_REF(e)->events[i].events -#define LTTNG_POLL_GETNB(e) LTTNG_REF(e)->nb_fd -#define LTTNG_POLL_GETSZ(e) LTTNG_REF(e)->events_size -#define LTTNG_POLL_GET_PREV_FD(e, i, nb_fd) \ - __lttng_epoll_get_prev_fd(LTTNG_REF(e), i, nb_fd) +#define LTTNG_POLL_GETFD(e, i) LTTNG_REF(e)->events[i].data.fd +#define LTTNG_POLL_GETEV(e, i) LTTNG_REF(e)->events[i].events +#define LTTNG_POLL_GETNB(e) LTTNG_REF(e)->nb_fd +#define LTTNG_POLL_GETSZ(e) LTTNG_REF(e)->events_size +#define LTTNG_POLL_GET_PREV_FD(e, i, nb_fd) __lttng_epoll_get_prev_fd(LTTNG_REF(e), i, nb_fd) /* Create the epoll set. */ -extern int compat_epoll_create(struct lttng_poll_event *events, - int size, int flags); -#define lttng_poll_create(events, size, flags) \ - compat_epoll_create(events, size, flags) +extern int compat_epoll_create(struct lttng_poll_event *events, int size, int flags); +#define lttng_poll_create(events, size, flags) compat_epoll_create(events, size, flags) #if defined(HAVE_EPOLL_CREATE1) && defined(EPOLL_CLOEXEC) -static inline int compat_glibc_epoll_create(int size __attribute__((unused)), - int flags) +static inline int compat_glibc_epoll_create(int size __attribute__((unused)), int flags) { return epoll_create1(flags); } @@ -125,42 +122,33 @@ static inline int compat_glibc_epoll_create(int size, int flags) * Wait on epoll set with the number of fd registered to the lttng_poll_event * data structure (events). */ -extern int compat_epoll_wait(struct lttng_poll_event *events, int timeout, - bool interruptible); -#define lttng_poll_wait(events, timeout) \ - compat_epoll_wait(events, timeout, false) -#define lttng_poll_wait_interruptible(events, timeout) \ - compat_epoll_wait(events, timeout, true) +extern int compat_epoll_wait(struct lttng_poll_event *events, int timeout, bool interruptible); +#define lttng_poll_wait(events, timeout) compat_epoll_wait(events, timeout, false) +#define lttng_poll_wait_interruptible(events, timeout) compat_epoll_wait(events, timeout, true) /* * Add a fd to the epoll set and resize the epoll_event structure if needed. */ -extern int compat_epoll_add(struct lttng_poll_event *events, - int fd, uint32_t req_events); -#define lttng_poll_add(events, fd, req_events) \ - compat_epoll_add(events, fd, req_events) +extern int compat_epoll_add(struct lttng_poll_event *events, int fd, uint32_t req_events); +#define lttng_poll_add(events, fd, req_events) compat_epoll_add(events, fd, req_events) /* * Remove a fd from the epoll set. */ extern int compat_epoll_del(struct lttng_poll_event *events, int fd); -#define lttng_poll_del(events, fd) \ - compat_epoll_del(events, fd) +#define lttng_poll_del(events, fd) compat_epoll_del(events, fd) /* * Modify an fd's events in the epoll set. */ -extern int compat_epoll_mod(struct lttng_poll_event *events, - int fd, uint32_t req_events); -#define lttng_poll_mod(events, fd, req_events) \ - compat_epoll_mod(events, fd, req_events) +extern int compat_epoll_mod(struct lttng_poll_event *events, int fd, uint32_t req_events); +#define lttng_poll_mod(events, fd, req_events) compat_epoll_mod(events, fd, req_events) /* * Set up the poll set limits variable poll_max_size */ extern int compat_epoll_set_max_size(); -#define lttng_poll_set_max_size() \ - compat_epoll_set_max_size() +#define lttng_poll_set_max_size() compat_epoll_set_max_size() /* * This function memset with zero the structure since it can be reused at each @@ -170,8 +158,7 @@ extern int compat_epoll_set_max_size(); static inline void lttng_poll_reset(struct lttng_poll_event *events) { if (events && events->events) { - memset(events->events, 0, - events->nb_fd * sizeof(struct epoll_event)); + memset(events->events, 0, events->nb_fd * sizeof(struct epoll_event)); } } @@ -208,7 +195,7 @@ static inline void lttng_poll_clean(struct lttng_poll_event *events) __lttng_poll_free((void *) events->events); } -#else /* HAVE_EPOLL */ +#else /* HAVE_EPOLL */ /* * Fallback on poll(2) API */ @@ -239,7 +226,7 @@ enum { }; struct compat_poll_event_array { - uint32_t nb_fd; /* Current number of fd in events */ + uint32_t nb_fd; /* Current number of fd in events */ uint32_t alloc_size; /* Size of events array */ /* Initial size of the pollset. We never shrink below that. */ uint32_t init_size; @@ -261,10 +248,10 @@ struct compat_poll_event { /* Indicate if wait.events need to be updated from current. */ int need_update:1; }; -#define lttng_poll_event compat_poll_event +#define lttng_poll_event compat_poll_event -static inline int __lttng_poll_get_prev_fd(struct lttng_poll_event *events, - int index, uint32_t nb_fd) +static inline int +__lttng_poll_get_prev_fd(struct lttng_poll_event *events, int index, uint32_t nb_fd) { LTTNG_ASSERT(events); LTTNG_ASSERT(index != nb_fd); @@ -282,38 +269,31 @@ static inline int __lttng_poll_get_prev_fd(struct lttng_poll_event *events, * LTTNG_POLL_GETNB is always used after lttng_poll_wait, thus we can use the * current list for test compatibility purposes. */ -#define LTTNG_POLL_GETFD(e, i) LTTNG_REF(e)->wait.events[i].fd -#define LTTNG_POLL_GETEV(e, i) LTTNG_REF(e)->wait.events[i].revents -#define LTTNG_POLL_GETNB(e) LTTNG_REF(e)->current.nb_fd -#define LTTNG_POLL_GETSZ(e) LTTNG_REF(e)->wait.events_size -#define LTTNG_POLL_GET_PREV_FD(e, i, nb_fd) \ - __lttng_poll_get_prev_fd(LTTNG_REF(e), i, nb_fd) +#define LTTNG_POLL_GETFD(e, i) LTTNG_REF(e)->wait.events[i].fd +#define LTTNG_POLL_GETEV(e, i) LTTNG_REF(e)->wait.events[i].revents +#define LTTNG_POLL_GETNB(e) LTTNG_REF(e)->current.nb_fd +#define LTTNG_POLL_GETSZ(e) LTTNG_REF(e)->wait.events_size +#define LTTNG_POLL_GET_PREV_FD(e, i, nb_fd) __lttng_poll_get_prev_fd(LTTNG_REF(e), i, nb_fd) /* * Create a pollfd structure of size 'size'. */ extern int compat_poll_create(struct lttng_poll_event *events, int size); -#define lttng_poll_create(events, size, flags) \ - compat_poll_create(events, size) +#define lttng_poll_create(events, size, flags) compat_poll_create(events, size) /* * Wait on poll(2) event with nb_fd registered to the lttng_poll_event data * structure. */ -extern int compat_poll_wait(struct lttng_poll_event *events, int timeout, - bool interruptible); -#define lttng_poll_wait(events, timeout) \ - compat_poll_wait(events, timeout, false) -#define lttng_poll_wait_interruptible(events, timeout) \ - compat_poll_wait(events, timeout, true) +extern int compat_poll_wait(struct lttng_poll_event *events, int timeout, bool interruptible); +#define lttng_poll_wait(events, timeout) compat_poll_wait(events, timeout, false) +#define lttng_poll_wait_interruptible(events, timeout) compat_poll_wait(events, timeout, true) /* * Add the fd to the pollfd structure. Resize if needed. */ -extern int compat_poll_add(struct lttng_poll_event *events, - int fd, uint32_t req_events); -#define lttng_poll_add(events, fd, req_events) \ - compat_poll_add(events, fd, req_events) +extern int compat_poll_add(struct lttng_poll_event *events, int fd, uint32_t req_events); +#define lttng_poll_add(events, fd, req_events) compat_poll_add(events, fd, req_events) /* * Remove the fd from the pollfd. Memory allocation is done to recreate a new @@ -321,30 +301,26 @@ extern int compat_poll_add(struct lttng_poll_event *events, * one is freed(). */ extern int compat_poll_del(struct lttng_poll_event *events, int fd); -#define lttng_poll_del(events, fd) \ - compat_poll_del(events, fd) +#define lttng_poll_del(events, fd) compat_poll_del(events, fd) /* * Modify an fd's events in the poll set. */ -extern int compat_poll_mod(struct lttng_poll_event *events, - int fd, uint32_t req_events); -#define lttng_poll_mod(events, fd, req_events) \ - compat_poll_mod(events, fd, req_events) +extern int compat_poll_mod(struct lttng_poll_event *events, int fd, uint32_t req_events); +#define lttng_poll_mod(events, fd, req_events) compat_poll_mod(events, fd, req_events) /* * Set up the poll set limits variable poll_max_size */ extern int compat_poll_set_max_size(void); -#define lttng_poll_set_max_size() \ - compat_poll_set_max_size() +#define lttng_poll_set_max_size() compat_poll_set_max_size() /* * No need to reset a pollfd structure for poll(2) */ -static inline void lttng_poll_reset( - struct lttng_poll_event *events __attribute__((unused))) -{} +static inline void lttng_poll_reset(struct lttng_poll_event *events __attribute__((unused))) +{ +} /* * Initialize an already allocated poll event data structure. diff --git a/src/common/compat/pthread.hpp b/src/common/compat/pthread.hpp index 7883cd1ba..f89089924 100644 --- a/src/common/compat/pthread.hpp +++ b/src/common/compat/pthread.hpp @@ -8,8 +8,9 @@ #ifndef _COMPAT_PTHREAD_H #define _COMPAT_PTHREAD_H -#include #include + +#include #include #ifdef __FreeBSD__ @@ -19,8 +20,7 @@ #define LTTNG_PTHREAD_NAMELEN 16 #if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID) -static inline -int lttng_pthread_setname_np(const char *name) +static inline int lttng_pthread_setname_np(const char *name) { /* * Some implementations don't error out, replicate this behavior for @@ -33,15 +33,13 @@ int lttng_pthread_setname_np(const char *name) return pthread_setname_np(pthread_self(), name); } #elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) -static inline -int lttng_pthread_setname_np(const char *name) +static inline int lttng_pthread_setname_np(const char *name) { return pthread_setname_np(name); } #elif defined(HAVE_PTHREAD_SET_NAME_NP_WITH_TID) -static inline -int lttng_pthread_setname_np(const char *name) +static inline int lttng_pthread_setname_np(const char *name) { /* Replicate pthread_setname_np's behavior. */ if (strnlen(name, LTTNG_PTHREAD_NAMELEN) >= LTTNG_PTHREAD_NAMELEN) { @@ -56,8 +54,7 @@ int lttng_pthread_setname_np(const char *name) /* Fallback on prtctl on Linux */ #include -static inline -int lttng_pthread_setname_np(const char *name) +static inline int lttng_pthread_setname_np(const char *name) { /* Replicate pthread_setname_np's behavior. */ if (strnlen(name, LTTNG_PTHREAD_NAMELEN) >= LTTNG_PTHREAD_NAMELEN) { @@ -69,29 +66,24 @@ int lttng_pthread_setname_np(const char *name) /* * For platforms without thread name support, do nothing. */ -static inline -int lttng_pthread_setname_np(const char *name) +static inline int lttng_pthread_setname_np(const char *name) { return -ENOSYS; } #endif - #if defined(HAVE_PTHREAD_GETNAME_NP_WITH_TID) -static inline -int lttng_pthread_getname_np(char *name, size_t len) +static inline int lttng_pthread_getname_np(char *name, size_t len) { return pthread_getname_np(pthread_self(), name, len); } #elif defined(HAVE_PTHREAD_GETNAME_NP_WITHOUT_TID) -static inline -int lttng_pthread_getname_np(char *name, size_t len) +static inline int lttng_pthread_getname_np(char *name, size_t len) { return pthread_getname_np(name, len); } #elif defined(HAVE_PTHREAD_GET_NAME_NP_WITH_TID) -static inline -int lttng_pthread_getname_np(char *name, size_t len) +static inline int lttng_pthread_getname_np(char *name, size_t len) { pthread_get_name_np(pthread_self(), name, len); return 0; @@ -101,8 +93,7 @@ int lttng_pthread_getname_np(char *name, size_t len) /* Fallback on prtctl on Linux */ #include -static inline -int lttng_pthread_getname_np(char *name, size_t len) +static inline int lttng_pthread_getname_np(char *name, size_t len) { return prctl(PR_GET_NAME, name, 0, 0, 0); } @@ -110,8 +101,7 @@ int lttng_pthread_getname_np(char *name, size_t len) /* * For platforms without thread name support, do nothing. */ -static inline -int lttng_pthread_getname_np(char *name, size_t len) +static inline int lttng_pthread_getname_np(char *name, size_t len) { return -ENOSYS; } diff --git a/src/common/compat/socket.hpp b/src/common/compat/socket.hpp index c1aa9d38d..dadd1fe8d 100644 --- a/src/common/compat/socket.hpp +++ b/src/common/compat/socket.hpp @@ -8,31 +8,30 @@ #ifndef _COMPAT_SOCKET_H #define _COMPAT_SOCKET_H +#include + #include #include #include -#include - #ifndef MSG_NOSIGNAL -# ifdef SO_NOSIGPIPE -# define MSG_NOSIGNAL SO_NOSIGPIPE -# endif +#ifdef SO_NOSIGPIPE +#define MSG_NOSIGNAL SO_NOSIGPIPE +#endif #endif #if defined(MSG_NOSIGNAL) -static inline -ssize_t lttng_recvmsg_nosigpipe(int sockfd, struct msghdr *msg) +static inline ssize_t lttng_recvmsg_nosigpipe(int sockfd, struct msghdr *msg) { return recvmsg(sockfd, msg, MSG_NOSIGNAL); } #else -#include #include -static inline -ssize_t lttng_recvmsg_nosigpipe(int sockfd, struct msghdr *msg) +#include + +static inline ssize_t lttng_recvmsg_nosigpipe(int sockfd, struct msghdr *msg) { ssize_t received; int saved_err; @@ -82,8 +81,7 @@ ssize_t lttng_recvmsg_nosigpipe(int sockfd, struct msghdr *msg) int ret; do { - ret = sigtimedwait(&sigpipe_set, NULL, - &timeout); + ret = sigtimedwait(&sigpipe_set, NULL, &timeout); } while (ret == -1 && errno == EINTR); } if (!sigpipe_was_pending) { @@ -100,25 +98,24 @@ ssize_t lttng_recvmsg_nosigpipe(int sockfd, struct msghdr *msg) #ifdef __sun__ -# ifndef CMSG_ALIGN -# ifdef _CMSG_DATA_ALIGN -# define CMSG_ALIGN(len) _CMSG_DATA_ALIGN(len) -# else - /* aligning to sizeof (long) is assumed to be portable (fd.o#40235) */ -# define CMSG_ALIGN(len) (((len) + sizeof (long) - 1) & ~(sizeof (long) - 1)) -# endif -# ifndef CMSG_SPACE -# define CMSG_SPACE(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + CMSG_ALIGN (len)) -# endif -# ifndef CMSG_LEN -# define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) -# endif -# endif +#ifndef CMSG_ALIGN +#ifdef _CMSG_DATA_ALIGN +#define CMSG_ALIGN(len) _CMSG_DATA_ALIGN(len) +#else +/* aligning to sizeof (long) is assumed to be portable (fd.o#40235) */ +#define CMSG_ALIGN(len) (((len) + sizeof(long) - 1) & ~(sizeof(long) - 1)) +#endif +#ifndef CMSG_SPACE +#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len)) +#endif +#ifndef CMSG_LEN +#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) +#endif +#endif #include -static inline -int getpeereid(int s, uid_t *euid, gid_t *gid) +static inline int getpeereid(int s, uid_t *euid, gid_t *gid) { int ret = 0; ucred_t *ucred = NULL; @@ -148,7 +145,6 @@ end: } #endif /* __sun__ */ - #if defined(__linux__) || defined(__CYGWIN__) #define LTTNG_SOCK_CREDS SCM_CREDENTIALS @@ -183,8 +179,7 @@ typedef struct lttng_sock_cred lttng_sock_cred; #ifdef __APPLE__ -static inline -int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid) +static inline int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid) { socklen_t pid_len = (socklen_t) sizeof(*pid); @@ -195,8 +190,7 @@ int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid) #elif defined(__sun__) /* Use the getpeerucreds interface on Solaris. */ -static inline -int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid) +static inline int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid) { int ret = 0; ucred_t *ucred = NULL; @@ -223,16 +217,14 @@ end: #include -static inline -int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid) +static inline int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid) { int ret; struct xucred sock_creds = {}; socklen_t sock_creds_len = (socklen_t) sizeof(sock_creds); /* Only available in FreeBSD 13.0 and up. */ - ret = getsockopt(socket_fd, SOL_LOCAL, LOCAL_PEERCRED, &sock_creds, - &sock_creds_len); + ret = getsockopt(socket_fd, SOL_LOCAL, LOCAL_PEERCRED, &sock_creds, &sock_creds_len); if (ret) { goto end; } @@ -244,9 +236,7 @@ end: #endif /* __APPLE__ */ - -static inline -int lttng_get_unix_socket_peer_creds(int socket_fd, struct lttng_sock_cred *creds) +static inline int lttng_get_unix_socket_peer_creds(int socket_fd, struct lttng_sock_cred *creds) { int ret; diff --git a/src/common/compat/string.hpp b/src/common/compat/string.hpp index 526f2b2ce..c34c7aa49 100644 --- a/src/common/compat/string.hpp +++ b/src/common/compat/string.hpp @@ -9,18 +9,16 @@ #ifndef _COMPAT_STRING_H #define _COMPAT_STRING_H -#include #include +#include #ifdef HAVE_STRNLEN -static inline -size_t lttng_strnlen(const char *str, size_t max) +static inline size_t lttng_strnlen(const char *str, size_t max) { return strnlen(str, max); } #else -static inline -size_t lttng_strnlen(const char *str, size_t max) +static inline size_t lttng_strnlen(const char *str, size_t max) { size_t ret; const char *end; @@ -38,14 +36,12 @@ size_t lttng_strnlen(const char *str, size_t max) #endif /* HAVE_STRNLEN */ #ifdef HAVE_STRNDUP -static inline -char *lttng_strndup(const char *s, size_t n) +static inline char *lttng_strndup(const char *s, size_t n) { return strndup(s, n); } #else -static inline -char *lttng_strndup(const char *s, size_t n) +static inline char *lttng_strndup(const char *s, size_t n) { char *ret; size_t navail; @@ -110,20 +106,18 @@ static inline int lttng_fls(int val) #endif /* HAVE_FLS */ #ifdef HAVE_MEMRCHR -static inline -void *lttng_memrchr(const void *s, int c, size_t n) +static inline void *lttng_memrchr(const void *s, int c, size_t n) { return (void *) memrchr(s, c, n); } #else -static inline -void *lttng_memrchr(const void *s, int c, size_t n) +static inline void *lttng_memrchr(const void *s, int c, size_t n) { int i; const char *str = (const char *) s; - for (i = n-1; i >= 0; i--) { - if (str[i] == (char)c) { - return (void *)(str+i); + for (i = n - 1; i >= 0; i--) { + if (str[i] == (char) c) { + return (void *) (str + i); } } return NULL; diff --git a/src/common/compat/time.hpp b/src/common/compat/time.hpp index 6cb5018c5..aed37ceed 100644 --- a/src/common/compat/time.hpp +++ b/src/common/compat/time.hpp @@ -16,10 +16,11 @@ typedef uint64_t timer_t; -#include -#include #include +#include +#include + #undef NSEC_PER_SEC #undef NSEC_PER_MSEC #undef NSEC_PER_USEC @@ -31,11 +32,10 @@ typedef uint64_t timer_t; #if defined(__APPLE__) && !defined(LTTNG_HAVE_CLOCK_GETTIME) typedef int clockid_t; -#define CLOCK_REALTIME CALENDAR_CLOCK +#define CLOCK_REALTIME CALENDAR_CLOCK #define CLOCK_MONOTONIC SYSTEM_CLOCK -static inline -int lttng_clock_gettime(clockid_t clk_id, struct timespec *tp) +static inline int lttng_clock_gettime(clockid_t clk_id, struct timespec *tp) { int ret = 0; clock_serv_t clock; @@ -66,8 +66,7 @@ end: #else /* __APPLE__ && !LTTNG_HAVE_CLOCK_GETTIME */ -static inline -int lttng_clock_gettime(clockid_t clk_id, struct timespec *tp) +static inline int lttng_clock_gettime(clockid_t clk_id, struct timespec *tp) { return clock_gettime(clk_id, tp); } diff --git a/src/common/config/config-session-abi.hpp b/src/common/config/config-session-abi.hpp index f921a7363..f56b4bd0d 100644 --- a/src/common/config/config-session-abi.hpp +++ b/src/common/config/config-session-abi.hpp @@ -10,173 +10,173 @@ #include -extern const char * const config_element_all; -LTTNG_EXPORT extern const char * const config_element_channel; -LTTNG_EXPORT extern const char * const config_element_channels; -LTTNG_EXPORT extern const char * const config_element_domain; -LTTNG_EXPORT extern const char * const config_element_domains; -LTTNG_EXPORT extern const char * const config_element_event; -LTTNG_EXPORT extern const char * const config_element_events; -LTTNG_EXPORT extern const char * const config_element_context; -LTTNG_EXPORT extern const char * const config_element_contexts; -LTTNG_EXPORT extern const char * const config_element_attributes; -LTTNG_EXPORT extern const char * const config_element_exclusion; -LTTNG_EXPORT extern const char * const config_element_exclusions; -LTTNG_EXPORT extern const char * const config_element_function_attributes; -LTTNG_EXPORT extern const char * const config_element_probe_attributes; -LTTNG_EXPORT extern const char * const config_element_symbol_name; -LTTNG_EXPORT extern const char * const config_element_address; -LTTNG_EXPORT extern const char * const config_element_offset; -extern const char * const config_element_userspace_probe_lookup; -extern const char * const config_element_userspace_probe_lookup_function_default; -extern const char * const config_element_userspace_probe_lookup_function_elf; -extern const char * const config_element_userspace_probe_lookup_tracepoint_sdt; -extern const char * const config_element_userspace_probe_location_binary_path; -extern const char * const config_element_userspace_probe_function_attributes; -extern const char * const config_element_userspace_probe_function_location_function_name; -extern const char * const config_element_userspace_probe_tracepoint_attributes; -extern const char * const config_element_userspace_probe_tracepoint_location_provider_name; -extern const char * const config_element_userspace_probe_tracepoint_location_probe_name; -extern const char * const config_element_name; -LTTNG_EXPORT extern const char * const config_element_enabled; -LTTNG_EXPORT extern const char * const config_element_overwrite_mode; -LTTNG_EXPORT extern const char * const config_element_subbuf_size; -LTTNG_EXPORT extern const char * const config_element_num_subbuf; -LTTNG_EXPORT extern const char * const config_element_switch_timer_interval; -LTTNG_EXPORT extern const char * const config_element_read_timer_interval; -extern const char * const config_element_monitor_timer_interval; -extern const char * const config_element_blocking_timeout; -LTTNG_EXPORT extern const char * const config_element_output; -LTTNG_EXPORT extern const char * const config_element_output_type; -LTTNG_EXPORT extern const char * const config_element_tracefile_size; -LTTNG_EXPORT extern const char * const config_element_tracefile_count; -LTTNG_EXPORT extern const char * const config_element_live_timer_interval; -extern const char * const config_element_discarded_events; -extern const char * const config_element_lost_packets; -LTTNG_EXPORT extern const char * const config_element_type; -LTTNG_EXPORT extern const char * const config_element_buffer_type; -LTTNG_EXPORT extern const char * const config_element_session; -LTTNG_EXPORT extern const char * const config_element_sessions; -extern const char * const config_element_context_perf; -extern const char * const config_element_context_app; -extern const char * const config_element_context_app_provider_name; -extern const char * const config_element_context_app_ctx_name; -LTTNG_EXPORT extern const char * const config_element_config; -LTTNG_EXPORT extern const char * const config_element_started; -LTTNG_EXPORT extern const char * const config_element_snapshot_mode; -LTTNG_EXPORT extern const char * const config_element_loglevel; -LTTNG_EXPORT extern const char * const config_element_loglevel_type; -LTTNG_EXPORT extern const char * const config_element_filter; -extern const char * const config_element_filter_expression; -LTTNG_EXPORT extern const char * const config_element_snapshot_outputs; -LTTNG_EXPORT extern const char * const config_element_consumer_output; -LTTNG_EXPORT extern const char * const config_element_destination; -LTTNG_EXPORT extern const char * const config_element_path; -LTTNG_EXPORT extern const char * const config_element_net_output; -LTTNG_EXPORT extern const char * const config_element_control_uri; -LTTNG_EXPORT extern const char * const config_element_data_uri; -LTTNG_EXPORT extern const char * const config_element_max_size; -LTTNG_EXPORT extern const char * const config_element_pid; -extern const char * const config_element_process_attr_id; -LTTNG_EXPORT extern const char * const config_element_pids; -LTTNG_EXPORT extern const char * const config_element_name; -LTTNG_EXPORT extern const char * const config_element_shared_memory_path; -extern const char * const config_element_process_attr_tracker_pid; -extern const char * const config_element_process_attr_tracker_vpid; -extern const char * const config_element_process_attr_tracker_uid; -extern const char * const config_element_process_attr_tracker_vuid; -extern const char * const config_element_process_attr_tracker_gid; -extern const char * const config_element_process_attr_tracker_vgid; -extern const char * const config_element_process_attr_trackers; -extern const char * const config_element_process_attr_values; -extern const char * const config_element_process_attr_value_type; -extern const char * const config_element_process_attr_pid_value; -extern const char * const config_element_process_attr_vpid_value; -extern const char * const config_element_process_attr_uid_value; -extern const char * const config_element_process_attr_vuid_value; -extern const char * const config_element_process_attr_gid_value; -extern const char * const config_element_process_attr_vgid_value; -extern const char * const config_element_process_attr_tracker_type; -extern const char * const config_element_rotation_timer_interval; -extern const char * const config_element_rotation_size; -extern const char * const config_element_rotation_schedule; +extern const char *const config_element_all; +LTTNG_EXPORT extern const char *const config_element_channel; +LTTNG_EXPORT extern const char *const config_element_channels; +LTTNG_EXPORT extern const char *const config_element_domain; +LTTNG_EXPORT extern const char *const config_element_domains; +LTTNG_EXPORT extern const char *const config_element_event; +LTTNG_EXPORT extern const char *const config_element_events; +LTTNG_EXPORT extern const char *const config_element_context; +LTTNG_EXPORT extern const char *const config_element_contexts; +LTTNG_EXPORT extern const char *const config_element_attributes; +LTTNG_EXPORT extern const char *const config_element_exclusion; +LTTNG_EXPORT extern const char *const config_element_exclusions; +LTTNG_EXPORT extern const char *const config_element_function_attributes; +LTTNG_EXPORT extern const char *const config_element_probe_attributes; +LTTNG_EXPORT extern const char *const config_element_symbol_name; +LTTNG_EXPORT extern const char *const config_element_address; +LTTNG_EXPORT extern const char *const config_element_offset; +extern const char *const config_element_userspace_probe_lookup; +extern const char *const config_element_userspace_probe_lookup_function_default; +extern const char *const config_element_userspace_probe_lookup_function_elf; +extern const char *const config_element_userspace_probe_lookup_tracepoint_sdt; +extern const char *const config_element_userspace_probe_location_binary_path; +extern const char *const config_element_userspace_probe_function_attributes; +extern const char *const config_element_userspace_probe_function_location_function_name; +extern const char *const config_element_userspace_probe_tracepoint_attributes; +extern const char *const config_element_userspace_probe_tracepoint_location_provider_name; +extern const char *const config_element_userspace_probe_tracepoint_location_probe_name; +extern const char *const config_element_name; +LTTNG_EXPORT extern const char *const config_element_enabled; +LTTNG_EXPORT extern const char *const config_element_overwrite_mode; +LTTNG_EXPORT extern const char *const config_element_subbuf_size; +LTTNG_EXPORT extern const char *const config_element_num_subbuf; +LTTNG_EXPORT extern const char *const config_element_switch_timer_interval; +LTTNG_EXPORT extern const char *const config_element_read_timer_interval; +extern const char *const config_element_monitor_timer_interval; +extern const char *const config_element_blocking_timeout; +LTTNG_EXPORT extern const char *const config_element_output; +LTTNG_EXPORT extern const char *const config_element_output_type; +LTTNG_EXPORT extern const char *const config_element_tracefile_size; +LTTNG_EXPORT extern const char *const config_element_tracefile_count; +LTTNG_EXPORT extern const char *const config_element_live_timer_interval; +extern const char *const config_element_discarded_events; +extern const char *const config_element_lost_packets; +LTTNG_EXPORT extern const char *const config_element_type; +LTTNG_EXPORT extern const char *const config_element_buffer_type; +LTTNG_EXPORT extern const char *const config_element_session; +LTTNG_EXPORT extern const char *const config_element_sessions; +extern const char *const config_element_context_perf; +extern const char *const config_element_context_app; +extern const char *const config_element_context_app_provider_name; +extern const char *const config_element_context_app_ctx_name; +LTTNG_EXPORT extern const char *const config_element_config; +LTTNG_EXPORT extern const char *const config_element_started; +LTTNG_EXPORT extern const char *const config_element_snapshot_mode; +LTTNG_EXPORT extern const char *const config_element_loglevel; +LTTNG_EXPORT extern const char *const config_element_loglevel_type; +LTTNG_EXPORT extern const char *const config_element_filter; +extern const char *const config_element_filter_expression; +LTTNG_EXPORT extern const char *const config_element_snapshot_outputs; +LTTNG_EXPORT extern const char *const config_element_consumer_output; +LTTNG_EXPORT extern const char *const config_element_destination; +LTTNG_EXPORT extern const char *const config_element_path; +LTTNG_EXPORT extern const char *const config_element_net_output; +LTTNG_EXPORT extern const char *const config_element_control_uri; +LTTNG_EXPORT extern const char *const config_element_data_uri; +LTTNG_EXPORT extern const char *const config_element_max_size; +LTTNG_EXPORT extern const char *const config_element_pid; +extern const char *const config_element_process_attr_id; +LTTNG_EXPORT extern const char *const config_element_pids; +LTTNG_EXPORT extern const char *const config_element_name; +LTTNG_EXPORT extern const char *const config_element_shared_memory_path; +extern const char *const config_element_process_attr_tracker_pid; +extern const char *const config_element_process_attr_tracker_vpid; +extern const char *const config_element_process_attr_tracker_uid; +extern const char *const config_element_process_attr_tracker_vuid; +extern const char *const config_element_process_attr_tracker_gid; +extern const char *const config_element_process_attr_tracker_vgid; +extern const char *const config_element_process_attr_trackers; +extern const char *const config_element_process_attr_values; +extern const char *const config_element_process_attr_value_type; +extern const char *const config_element_process_attr_pid_value; +extern const char *const config_element_process_attr_vpid_value; +extern const char *const config_element_process_attr_uid_value; +extern const char *const config_element_process_attr_vuid_value; +extern const char *const config_element_process_attr_gid_value; +extern const char *const config_element_process_attr_vgid_value; +extern const char *const config_element_process_attr_tracker_type; +extern const char *const config_element_rotation_timer_interval; +extern const char *const config_element_rotation_size; +extern const char *const config_element_rotation_schedule; -LTTNG_EXPORT extern const char * const config_domain_type_kernel; -LTTNG_EXPORT extern const char * const config_domain_type_ust; -LTTNG_EXPORT extern const char * const config_domain_type_jul; -LTTNG_EXPORT extern const char * const config_domain_type_log4j; -LTTNG_EXPORT extern const char * const config_domain_type_python; +LTTNG_EXPORT extern const char *const config_domain_type_kernel; +LTTNG_EXPORT extern const char *const config_domain_type_ust; +LTTNG_EXPORT extern const char *const config_domain_type_jul; +LTTNG_EXPORT extern const char *const config_domain_type_log4j; +LTTNG_EXPORT extern const char *const config_domain_type_python; -LTTNG_EXPORT extern const char * const config_buffer_type_per_pid; -LTTNG_EXPORT extern const char * const config_buffer_type_per_uid; -LTTNG_EXPORT extern const char * const config_buffer_type_global; +LTTNG_EXPORT extern const char *const config_buffer_type_per_pid; +LTTNG_EXPORT extern const char *const config_buffer_type_per_uid; +LTTNG_EXPORT extern const char *const config_buffer_type_global; -LTTNG_EXPORT extern const char * const config_overwrite_mode_discard; -LTTNG_EXPORT extern const char * const config_overwrite_mode_overwrite; +LTTNG_EXPORT extern const char *const config_overwrite_mode_discard; +LTTNG_EXPORT extern const char *const config_overwrite_mode_overwrite; -LTTNG_EXPORT extern const char * const config_output_type_splice; -LTTNG_EXPORT extern const char * const config_output_type_mmap; +LTTNG_EXPORT extern const char *const config_output_type_splice; +LTTNG_EXPORT extern const char *const config_output_type_mmap; -LTTNG_EXPORT extern const char * const config_loglevel_type_all; -LTTNG_EXPORT extern const char * const config_loglevel_type_range; -LTTNG_EXPORT extern const char * const config_loglevel_type_single; +LTTNG_EXPORT extern const char *const config_loglevel_type_all; +LTTNG_EXPORT extern const char *const config_loglevel_type_range; +LTTNG_EXPORT extern const char *const config_loglevel_type_single; -LTTNG_EXPORT extern const char * const config_event_type_all; -LTTNG_EXPORT extern const char * const config_event_type_tracepoint; -LTTNG_EXPORT extern const char * const config_event_type_probe; -extern const char * const config_event_type_userspace_probe; -LTTNG_EXPORT extern const char * const config_event_type_function; -LTTNG_EXPORT extern const char * const config_event_type_function_entry; -LTTNG_EXPORT extern const char * const config_event_type_noop; -LTTNG_EXPORT extern const char * const config_event_type_syscall; -LTTNG_EXPORT extern const char * const config_event_type_kprobe; -LTTNG_EXPORT extern const char * const config_event_type_kretprobe; +LTTNG_EXPORT extern const char *const config_event_type_all; +LTTNG_EXPORT extern const char *const config_event_type_tracepoint; +LTTNG_EXPORT extern const char *const config_event_type_probe; +extern const char *const config_event_type_userspace_probe; +LTTNG_EXPORT extern const char *const config_event_type_function; +LTTNG_EXPORT extern const char *const config_event_type_function_entry; +LTTNG_EXPORT extern const char *const config_event_type_noop; +LTTNG_EXPORT extern const char *const config_event_type_syscall; +LTTNG_EXPORT extern const char *const config_event_type_kprobe; +LTTNG_EXPORT extern const char *const config_event_type_kretprobe; -LTTNG_EXPORT extern const char * const config_event_context_pid; -LTTNG_EXPORT extern const char * const config_event_context_procname; -LTTNG_EXPORT extern const char * const config_event_context_prio; -LTTNG_EXPORT extern const char * const config_event_context_nice; -LTTNG_EXPORT extern const char * const config_event_context_vpid; -LTTNG_EXPORT extern const char * const config_event_context_tid; -LTTNG_EXPORT extern const char * const config_event_context_vtid; -LTTNG_EXPORT extern const char * const config_event_context_ppid; -LTTNG_EXPORT extern const char * const config_event_context_vppid; -LTTNG_EXPORT extern const char * const config_event_context_pthread_id; -LTTNG_EXPORT extern const char * const config_event_context_hostname; -LTTNG_EXPORT extern const char * const config_event_context_ip; -LTTNG_EXPORT extern const char * const config_event_context_perf_thread_counter; -extern const char * const config_event_context_app; -extern const char * const config_event_context_interruptible; -extern const char * const config_event_context_preemptible; -extern const char * const config_event_context_need_reschedule; -extern const char * const config_event_context_migratable; -extern const char * const config_event_context_callstack_user; -extern const char * const config_event_context_callstack_kernel; +LTTNG_EXPORT extern const char *const config_event_context_pid; +LTTNG_EXPORT extern const char *const config_event_context_procname; +LTTNG_EXPORT extern const char *const config_event_context_prio; +LTTNG_EXPORT extern const char *const config_event_context_nice; +LTTNG_EXPORT extern const char *const config_event_context_vpid; +LTTNG_EXPORT extern const char *const config_event_context_tid; +LTTNG_EXPORT extern const char *const config_event_context_vtid; +LTTNG_EXPORT extern const char *const config_event_context_ppid; +LTTNG_EXPORT extern const char *const config_event_context_vppid; +LTTNG_EXPORT extern const char *const config_event_context_pthread_id; +LTTNG_EXPORT extern const char *const config_event_context_hostname; +LTTNG_EXPORT extern const char *const config_event_context_ip; +LTTNG_EXPORT extern const char *const config_event_context_perf_thread_counter; +extern const char *const config_event_context_app; +extern const char *const config_event_context_interruptible; +extern const char *const config_event_context_preemptible; +extern const char *const config_event_context_need_reschedule; +extern const char *const config_event_context_migratable; +extern const char *const config_event_context_callstack_user; +extern const char *const config_event_context_callstack_kernel; -extern const char * const config_element_rotation_schedules; -extern const char * const config_element_rotation_schedule_periodic; -extern const char * const config_element_rotation_schedule_periodic_time_us; -extern const char * const config_element_rotation_schedule_size_threshold; -extern const char * const config_element_rotation_schedule_size_threshold_bytes; -extern const char * const config_event_context_cgroup_ns; -extern const char * const config_event_context_ipc_ns; -extern const char * const config_event_context_mnt_ns; -extern const char * const config_event_context_net_ns; -extern const char * const config_event_context_pid_ns; -extern const char * const config_event_context_time_ns; -extern const char * const config_event_context_user_ns; -extern const char * const config_event_context_uts_ns; -extern const char * const config_event_context_uid; -extern const char * const config_event_context_euid; -extern const char * const config_event_context_suid; -extern const char * const config_event_context_gid; -extern const char * const config_event_context_egid; -extern const char * const config_event_context_sgid; -extern const char * const config_event_context_vuid; -extern const char * const config_event_context_veuid; -extern const char * const config_event_context_vsuid; -extern const char * const config_event_context_vgid; -extern const char * const config_event_context_vegid; -extern const char * const config_event_context_vsgid; +extern const char *const config_element_rotation_schedules; +extern const char *const config_element_rotation_schedule_periodic; +extern const char *const config_element_rotation_schedule_periodic_time_us; +extern const char *const config_element_rotation_schedule_size_threshold; +extern const char *const config_element_rotation_schedule_size_threshold_bytes; +extern const char *const config_event_context_cgroup_ns; +extern const char *const config_event_context_ipc_ns; +extern const char *const config_event_context_mnt_ns; +extern const char *const config_event_context_net_ns; +extern const char *const config_event_context_pid_ns; +extern const char *const config_event_context_time_ns; +extern const char *const config_event_context_user_ns; +extern const char *const config_event_context_uts_ns; +extern const char *const config_event_context_uid; +extern const char *const config_event_context_euid; +extern const char *const config_event_context_suid; +extern const char *const config_event_context_gid; +extern const char *const config_event_context_egid; +extern const char *const config_event_context_sgid; +extern const char *const config_event_context_vuid; +extern const char *const config_event_context_veuid; +extern const char *const config_event_context_vsuid; +extern const char *const config_event_context_vgid; +extern const char *const config_event_context_vegid; +extern const char *const config_event_context_vsgid; #endif /* CONFIG_SESSION_INTERNAL_H */ diff --git a/src/common/config/session-config.hpp b/src/common/config/session-config.hpp index 71270a4ef..472ec8140 100644 --- a/src/common/config/session-config.hpp +++ b/src/common/config/session-config.hpp @@ -10,6 +10,7 @@ #include #include + #include struct config_load_session_override_attr { @@ -56,8 +57,7 @@ int config_writer_destroy(struct config_writer *writer); * Returns zero if the XML element could be opened. * Negative values indicate an error. */ -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); /* * Write an element tag attribute. @@ -70,7 +70,8 @@ int config_writer_open_element(struct config_writer *writer, * Negative values indicate an error. */ int config_writer_write_attribute(struct config_writer *writer, - const char *name, const char *value); + const char *name, + const char *value); /* * Close the current element tag. @@ -95,7 +96,8 @@ int config_writer_close_element(struct config_writer *writer); * Negative values indicate an error. */ 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); /* * Write an element of type signed int. @@ -110,7 +112,8 @@ int config_writer_write_element_unsigned_int(struct config_writer *writer, * Negative values indicate an error. */ 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); /* * Write an element of type boolean. @@ -125,7 +128,8 @@ int config_writer_write_element_signed_int(struct config_writer *writer, * Negative values indicate an error. */ int config_writer_write_element_bool(struct config_writer *writer, - const char *element_name, int value); + const char *element_name, + int value); /* * Write an element of type string. @@ -140,7 +144,8 @@ int config_writer_write_element_bool(struct config_writer *writer, * Negative values indicate an error. */ int config_writer_write_element_string(struct config_writer *writer, - const char *element_name, const char *value); + const char *element_name, + const char *value); /* * Write an element of type double. @@ -155,8 +160,8 @@ int config_writer_write_element_string(struct config_writer *writer, * Negative values indicate an error. */ int config_writer_write_element_double(struct config_writer *writer, - const char *element_name, - double value); + const char *element_name, + double value); /* * Load session configurations from a file. @@ -177,8 +182,10 @@ int config_writer_write_element_double(struct config_writer *writer, * Returns zero if the session could be loaded successfully. Returns * a negative LTTNG_ERR code on error. */ -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); #endif /* _CONFIG_H */ diff --git a/src/common/consumer/consumer-metadata-cache.hpp b/src/common/consumer/consumer-metadata-cache.hpp index 6e60e5c15..9f958ac58 100644 --- a/src/common/consumer/consumer-metadata-cache.hpp +++ b/src/common/consumer/consumer-metadata-cache.hpp @@ -52,11 +52,14 @@ struct consumer_metadata_cache { 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 consumer_metadata_cache_allocate(struct lttng_consumer_channel *channel); void consumer_metadata_cache_destroy(struct lttng_consumer_channel *channel); int consumer_metadata_cache_flushed(struct lttng_consumer_channel *channel, - uint64_t offset, int timer); + uint64_t offset, + int timer); #endif /* CONSUMER_METADATA_CACHE_H */ diff --git a/src/common/consumer/consumer-stream.hpp b/src/common/consumer/consumer-stream.hpp index ae43f7322..97fbd145b 100644 --- a/src/common/consumer/consumer-stream.hpp +++ b/src/common/consumer/consumer-stream.hpp @@ -21,18 +21,17 @@ enum consumer_stream_open_packet_status { * * The channel lock MUST be acquired. */ -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); /* * Close stream's file descriptors and, if needed, close stream also on the @@ -51,15 +50,14 @@ void consumer_stream_close_output(struct lttng_consumer_stream *stream); * 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); /* * Delete the stream from all possible hash tables. * * The consumer data 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); /* * Free the given stream within a RCU call. @@ -73,8 +71,7 @@ void consumer_stream_free(struct lttng_consumer_stream *stream); * * This MUST be called WITHOUT the consumer data and stream lock acquired. */ -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); /* * Destroy the stream's buffers on the tracer side. This is also called in a @@ -86,18 +83,16 @@ void consumer_stream_destroy_buffers(struct lttng_consumer_stream *stream); * Write index of a specific stream either on the relayd or local disk. */ int consumer_stream_write_index(struct lttng_consumer_stream *stream, - struct ctf_packet_index *index); + struct ctf_packet_index *index); -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); /* * Create the output files of a local stream. * * This must be called with the channel's and the stream's lock held. */ -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); /* * Rotate the output files of a local stream. This will change the @@ -123,8 +118,7 @@ bool consumer_stream_is_deleted(struct lttng_consumer_stream *stream); * * This must be called on initialization before any subbuffer is consumed. */ -int consumer_stream_enable_metadata_bucketization( - struct lttng_consumer_stream *stream); +int consumer_stream_enable_metadata_bucketization(struct lttng_consumer_stream *stream); /* * Set the version of a metadata stream (i.e. following a metadata @@ -133,16 +127,16 @@ int consumer_stream_enable_metadata_bucketization( * Changing the version of a metadata stream will cause any bucketized metadata * to be discarded and will mark the metadata stream for future `reset`. */ -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); /* * Attempt to open a packet in a stream. * * This function must be called with the stream and channel locks held. */ -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); /* * Flush a stream's buffer. @@ -153,7 +147,6 @@ enum consumer_stream_open_packet_status consumer_stream_open_packet( * * This function must be called with the stream and channel locks held. */ -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); #endif /* LTTNG_CONSUMER_STREAM_H */ diff --git a/src/common/consumer/consumer-timer.hpp b/src/common/consumer/consumer-timer.hpp index 656ebe036..50025d727 100644 --- a/src/common/consumer/consumer-timer.hpp +++ b/src/common/consumer/consumer-timer.hpp @@ -10,15 +10,15 @@ #ifndef CONSUMER_TIMER_H #define CONSUMER_TIMER_H -#include - #include "consumer.hpp" -#define LTTNG_CONSUMER_SIG_SWITCH ((SIGRTMIN + 10)) -#define LTTNG_CONSUMER_SIG_TEARDOWN ((SIGRTMIN + 11)) -#define LTTNG_CONSUMER_SIG_LIVE ((SIGRTMIN + 12)) -#define LTTNG_CONSUMER_SIG_MONITOR ((SIGRTMIN + 13)) -#define LTTNG_CONSUMER_SIG_EXIT ((SIGRTMIN + 14)) +#include + +#define LTTNG_CONSUMER_SIG_SWITCH ((SIGRTMIN + 10)) +#define LTTNG_CONSUMER_SIG_TEARDOWN ((SIGRTMIN + 11)) +#define LTTNG_CONSUMER_SIG_LIVE ((SIGRTMIN + 12)) +#define LTTNG_CONSUMER_SIG_MONITOR ((SIGRTMIN + 13)) +#define LTTNG_CONSUMER_SIG_EXIT ((SIGRTMIN + 14)) #define CLOCKID CLOCK_MONOTONIC @@ -29,20 +29,20 @@ * exclusion. */ struct timer_signal_data { - pthread_t tid; /* thread id managing signals */ + pthread_t tid; /* thread id managing signals */ int setup_done; int qs_done; pthread_mutex_t lock; }; void consumer_timer_switch_start(struct lttng_consumer_channel *channel, - unsigned int switch_timer_interval_us); + unsigned int switch_timer_interval_us); void consumer_timer_switch_stop(struct lttng_consumer_channel *channel); void consumer_timer_live_start(struct lttng_consumer_channel *channel, - unsigned int live_timer_interval_us); + unsigned int live_timer_interval_us); void consumer_timer_live_stop(struct lttng_consumer_channel *channel); int consumer_timer_monitor_start(struct lttng_consumer_channel *channel, - unsigned int monitor_timer_interval_us); + unsigned int monitor_timer_interval_us); int consumer_timer_monitor_stop(struct lttng_consumer_channel *channel); void *consumer_timer_thread(void *data); int consumer_signal_init(); diff --git a/src/common/consumer/consumer.hpp b/src/common/consumer/consumer.hpp index a28bc1609..1efbc4eee 100644 --- a/src/common/consumer/consumer.hpp +++ b/src/common/consumer/consumer.hpp @@ -11,25 +11,25 @@ #ifndef LIB_CONSUMER_H #define LIB_CONSUMER_H +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + #include #include #include #include #include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - struct lttng_consumer_local_data; /* Commands for consumer */ @@ -39,7 +39,7 @@ enum lttng_consumer_command { /* pause, delete, active depending on fd state */ LTTNG_CONSUMER_UPDATE_STREAM, /* inform the consumer to quit when all fd has hang up */ - LTTNG_CONSUMER_STOP, /* deprecated */ + LTTNG_CONSUMER_STOP, /* deprecated */ LTTNG_CONSUMER_ADD_RELAYD_SOCKET, /* Inform the consumer to kill a specific relayd connection */ LTTNG_CONSUMER_DESTROY_RELAYD, @@ -82,13 +82,13 @@ enum consumer_endpoint_status { }; enum consumer_channel_output { - CONSUMER_CHANNEL_MMAP = 0, - CONSUMER_CHANNEL_SPLICE = 1, + CONSUMER_CHANNEL_MMAP = 0, + CONSUMER_CHANNEL_SPLICE = 1, }; enum consumer_channel_type { - CONSUMER_CHANNEL_TYPE_METADATA = 0, - CONSUMER_CHANNEL_TYPE_DATA = 1, + CONSUMER_CHANNEL_TYPE_METADATA = 0, + CONSUMER_CHANNEL_TYPE_DATA = 1, }; enum sync_metadata_status { @@ -160,7 +160,7 @@ struct lttng_consumer_channel { enum consumer_channel_type type; /* For UST */ - uid_t ust_app_uid; /* Application UID. */ + uid_t ust_app_uid; /* Application UID. */ struct lttng_ust_ctl_consumer_channel *uchan; unsigned char uuid[LTTNG_UUID_STR_LEN]; /* @@ -721,8 +721,8 @@ struct lttng_consumer_local_data { * Returns the number of bytes read, or negative error value. */ ssize_t (*on_buffer_ready)(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); /* * function to call when we receive a new channel, it receives a * newly allocated channel, depending on the return code of this @@ -814,7 +814,7 @@ struct lttng_consumer_global_data { * This is nested OUTSIDE the stream lock. * This is nested OUTSIDE the consumer_relayd_sock_pair lock. */ - pthread_mutex_t lock {}; + pthread_mutex_t lock{}; /* * Number of streams in the data stream hash table declared outside. @@ -879,8 +879,7 @@ extern int consumer_quit; LTTNG_EXPORT extern int data_consumption_paused; /* Return a human-readable consumer type string that is suitable for logging. */ -static inline -const char *lttng_consumer_type_str(enum lttng_consumer_type type) +static inline const char *lttng_consumer_type_str(enum lttng_consumer_type type) { switch (type) { case LTTNG_CONSUMER_UNKNOWN: @@ -904,14 +903,12 @@ int lttng_consumer_init(); /* * Set the error socket for communication with a session daemon. */ -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); /* * Set the command socket path for communication with a session daemon. */ -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); /* * Send return code to session daemon. @@ -941,43 +938,39 @@ int lttng_consumer_poll_socket(struct pollfd *kconsumer_sockpoll); * Copy the fields from the channel that need to be accessed (read-only) * directly from the stream. */ -void consumer_stream_update_channel_attributes( - struct lttng_consumer_stream *stream, - struct lttng_consumer_channel *channel); - -struct lttng_consumer_stream *consumer_allocate_stream( - 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); +void consumer_stream_update_channel_attributes(struct lttng_consumer_stream *stream, + struct lttng_consumer_channel *channel); + +struct lttng_consumer_stream *consumer_allocate_stream(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_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); -void consumer_del_stream(struct lttng_consumer_stream *stream, - struct lttng_ht *ht); -void consumer_del_metadata_stream(struct lttng_consumer_stream *stream, - struct lttng_ht *ht); + 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); +void consumer_del_stream(struct lttng_consumer_stream *stream, struct lttng_ht *ht); +void consumer_del_metadata_stream(struct lttng_consumer_stream *stream, struct lttng_ht *ht); int consumer_add_channel(struct lttng_consumer_channel *channel, - struct lttng_consumer_local_data *ctx); + struct lttng_consumer_local_data *ctx); void consumer_del_channel(struct lttng_consumer_channel *channel); /* lttng-relayd consumer command */ @@ -986,33 +979,29 @@ int consumer_send_relayd_stream(struct lttng_consumer_stream *stream, char *path int consumer_send_relayd_streams_sent(uint64_t net_seq_idx); void close_relayd_stream(struct lttng_consumer_stream *stream); struct lttng_consumer_channel *consumer_find_channel(uint64_t key); -int consumer_handle_stream_before_relayd(struct lttng_consumer_stream *stream, - size_t data_size); +int consumer_handle_stream_before_relayd(struct lttng_consumer_stream *stream, size_t data_size); void consumer_steal_stream_key(int key, struct lttng_ht *ht); -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 sessiond_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 sessiond_key, uint32_t state)); void lttng_consumer_destroy(struct lttng_consumer_local_data *ctx); -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_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_mmap(struct lttng_consumer_stream *stream, + const struct lttng_buffer_view *buffer, + 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); int lttng_consumer_sample_snapshot_positions(struct lttng_consumer_stream *stream); int lttng_consumer_take_snapshot(struct lttng_consumer_stream *stream); -int lttng_consumer_get_produced_snapshot(struct lttng_consumer_stream *stream, - unsigned long *pos); -int lttng_consumer_get_consumed_snapshot(struct lttng_consumer_stream *stream, - unsigned long *pos); +int lttng_consumer_get_produced_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos); +int lttng_consumer_get_consumed_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos); int lttng_ustconsumer_get_wakeup_fd(struct lttng_consumer_stream *stream); int lttng_ustconsumer_close_wakeup_fd(struct lttng_consumer_stream *stream); void *consumer_thread_metadata_poll(void *data); @@ -1020,68 +1009,69 @@ void *consumer_thread_data_poll(void *data); void *consumer_thread_sessiond_poll(void *data); void *consumer_thread_channel_poll(void *data); int lttng_consumer_recv_cmd(struct lttng_consumer_local_data *ctx, - int sock, struct pollfd *consumer_sockpoll); + int sock, + struct pollfd *consumer_sockpoll); 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); int lttng_consumer_on_recv_stream(struct lttng_consumer_stream *stream); 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); -void consumer_flag_relayd_for_destroy( - struct consumer_relayd_sock_pair *relayd); + 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); +void consumer_flag_relayd_for_destroy(struct consumer_relayd_sock_pair *relayd); int consumer_data_pending(uint64_t id); int consumer_send_status_msg(int sock, int ret_code); -int consumer_send_status_channel(int sock, - struct lttng_consumer_channel *channel); -void notify_thread_del_channel(struct lttng_consumer_local_data *ctx, - uint64_t key); +int consumer_send_status_channel(int sock, struct lttng_consumer_channel *channel); +void notify_thread_del_channel(struct lttng_consumer_local_data *ctx, uint64_t key); void consumer_destroy_relayd(struct consumer_relayd_sock_pair *relayd); 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); void consumer_add_data_stream(struct lttng_consumer_stream *stream); void consumer_del_stream_for_data(struct lttng_consumer_stream *stream); void consumer_add_metadata_stream(struct lttng_consumer_stream *stream); void consumer_del_stream_for_metadata(struct lttng_consumer_stream *stream); int consumer_create_index_file(struct lttng_consumer_stream *stream); 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 lttng_consumer_stream_is_rotate_ready(struct lttng_consumer_stream *stream); int lttng_consumer_rotate_stream(struct lttng_consumer_stream *stream); -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); void lttng_consumer_reset_stream_rotate_state(struct lttng_consumer_stream *stream); -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_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_trace_chunk_exists( - const uint64_t *relayd_id, uint64_t session_id, - uint64_t chunk_id); +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_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_trace_chunk_exists(const uint64_t *relayd_id, + uint64_t session_id, + uint64_t chunk_id); void lttng_consumer_cleanup_relayd(struct consumer_relayd_sock_pair *relayd); -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); int lttng_consumer_clear_channel(struct lttng_consumer_channel *channel); -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); int consumer_metadata_wakeup_pipe(const struct lttng_consumer_channel *channel); void lttng_consumer_sigbus_handle(void *addr); void sample_and_send_channel_buffer_stats(struct lttng_consumer_channel *channel); diff --git a/src/common/consumer/metadata-bucket.hpp b/src/common/consumer/metadata-bucket.hpp index dfa73faea..ca9ee28c5 100644 --- a/src/common/consumer/metadata-bucket.hpp +++ b/src/common/consumer/metadata-bucket.hpp @@ -19,13 +19,12 @@ enum metadata_bucket_status { METADATA_BUCKET_STATUS_ERROR, }; -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); void metadata_bucket_destroy(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); void metadata_bucket_reset(struct metadata_bucket *bucket); diff --git a/src/common/context.hpp b/src/common/context.hpp index 324ef535e..bcf34cd2d 100644 --- a/src/common/context.hpp +++ b/src/common/context.hpp @@ -21,7 +21,6 @@ * Returns 0 if the string is a valid application context, else a negative * value on error. */ -int parse_application_context(const char *str, char **provider_name, - char **ctx_name); +int parse_application_context(const char *str, char **provider_name, char **ctx_name); #endif /* LTTNG_COMMON_CONTEXT_H */ diff --git a/src/common/credentials.hpp b/src/common/credentials.hpp index 340e64ee9..70eaa77b4 100644 --- a/src/common/credentials.hpp +++ b/src/common/credentials.hpp @@ -8,12 +8,12 @@ #ifndef LTTNG_CREDENTIALS_H #define LTTNG_CREDENTIALS_H -#include -#include #include "macros.hpp" - #include "optional.hpp" +#include +#include + struct lttng_credentials { LTTNG_OPTIONAL(uid_t) uid; LTTNG_OPTIONAL(gid_t) gid; @@ -24,12 +24,12 @@ uid_t lttng_credentials_get_uid(const struct lttng_credentials *creds); 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); bool lttng_credentials_is_equal_gid(const struct lttng_credentials *a, - const struct lttng_credentials *b); + const struct lttng_credentials *b); bool lttng_credentials_is_equal(const struct lttng_credentials *a, - const struct lttng_credentials *b); + const struct lttng_credentials *b); #endif /* LTTNG_CREDENTIALS_H */ diff --git a/src/common/daemonize.hpp b/src/common/daemonize.hpp index d1ec1cb42..9e39e2b19 100644 --- a/src/common/daemonize.hpp +++ b/src/common/daemonize.hpp @@ -9,9 +9,10 @@ * */ -#include #include +#include + /* * Daemonize this process by forking and making the parent wait for the child * to signal it indicating readiness. Once received, the parent successfully @@ -22,7 +23,6 @@ * * Return 0 on success else -1 on error. */ -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); #endif /* LTTNG_DAEMONIZE_H */ diff --git a/src/common/defaults.hpp b/src/common/defaults.hpp index cae1ec5fc..4b4d902dd 100644 --- a/src/common/defaults.hpp +++ b/src/common/defaults.hpp @@ -10,80 +10,81 @@ #ifndef _DEFAULTS_H #define _DEFAULTS_H -#include #include +#include + /* Default unix group name for tracing. */ -#define DEFAULT_TRACING_GROUP "tracing" +#define DEFAULT_TRACING_GROUP "tracing" /* * This value is defined in the CTF specification (see * git://git.efficios.com/ctf.git in the file * common-trace-format-specification.txt. */ -#define DEFAULT_METADATA_NAME "metadata" +#define DEFAULT_METADATA_NAME "metadata" /* Environment variable to set session daemon binary path. */ -#define DEFAULT_SESSIOND_PATH_ENV "LTTNG_SESSIOND_PATH" +#define DEFAULT_SESSIOND_PATH_ENV "LTTNG_SESSIOND_PATH" /* Environment variable to set man pager binary path. */ -#define DEFAULT_MAN_BIN_PATH_ENV "LTTNG_MAN_BIN_PATH" +#define DEFAULT_MAN_BIN_PATH_ENV "LTTNG_MAN_BIN_PATH" /* Default man pager binary path. */ -#define DEFAULT_MAN_BIN_PATH "/usr/bin/man" +#define DEFAULT_MAN_BIN_PATH "/usr/bin/man" /* Default trace output directory name */ -#define DEFAULT_TRACE_DIR_NAME "lttng-traces" +#define DEFAULT_TRACE_DIR_NAME "lttng-traces" /* Default size of a hash table */ -#define DEFAULT_HT_SIZE 4 +#define DEFAULT_HT_SIZE 4 /* Default session daemon paths */ -#define DEFAULT_HOME_DIR "/tmp" -#define DEFAULT_UST_SOCK_DIR DEFAULT_HOME_DIR "/ust-app-socks" -#define DEFAULT_GLOBAL_APPS_PIPE DEFAULT_UST_SOCK_DIR "/global" -#define DEFAULT_TRACE_OUTPUT DEFAULT_HOME_DIR "/lttng" +#define DEFAULT_HOME_DIR "/tmp" +#define DEFAULT_UST_SOCK_DIR DEFAULT_HOME_DIR "/ust-app-socks" +#define DEFAULT_GLOBAL_APPS_PIPE DEFAULT_UST_SOCK_DIR "/global" +#define DEFAULT_TRACE_OUTPUT DEFAULT_HOME_DIR "/lttng" /* Default directory where the trace are written in per domain */ -#define DEFAULT_KERNEL_TRACE_DIR "kernel" -#define DEFAULT_UST_TRACE_DIR "ust" +#define DEFAULT_KERNEL_TRACE_DIR "kernel" +#define DEFAULT_UST_TRACE_DIR "ust" /* Subpath for per PID or UID sessions. */ -#define DEFAULT_UST_TRACE_PID_PATH "pid" -#define DEFAULT_UST_TRACE_UID_PATH "uid/%d/%u-bit" +#define DEFAULT_UST_TRACE_PID_PATH "pid" +#define DEFAULT_UST_TRACE_UID_PATH "uid/%d/%u-bit" /* * Default session name for the lttng command line. This default value will * get the date and time appended (%Y%m%d-%H%M%S) to it. */ -#define DEFAULT_SESSION_NAME "auto" +#define DEFAULT_SESSION_NAME "auto" /* Default consumer paths */ -#define DEFAULT_CONSUMERD_FILE "lttng-consumerd" +#define DEFAULT_CONSUMERD_FILE "lttng-consumerd" /* Default consumer paths */ -#define DEFAULT_CONSUMERD_RUNDIR "%s" +#define DEFAULT_CONSUMERD_RUNDIR "%s" /* Kernel consumer path */ -#define DEFAULT_KCONSUMERD_PATH DEFAULT_CONSUMERD_RUNDIR "/kconsumerd" -#define DEFAULT_KCONSUMERD_CMD_SOCK_PATH DEFAULT_KCONSUMERD_PATH "/command" -#define DEFAULT_KCONSUMERD_ERR_SOCK_PATH DEFAULT_KCONSUMERD_PATH "/error" +#define DEFAULT_KCONSUMERD_PATH DEFAULT_CONSUMERD_RUNDIR "/kconsumerd" +#define DEFAULT_KCONSUMERD_CMD_SOCK_PATH DEFAULT_KCONSUMERD_PATH "/command" +#define DEFAULT_KCONSUMERD_ERR_SOCK_PATH DEFAULT_KCONSUMERD_PATH "/error" /* UST 64-bit consumer path */ -#define DEFAULT_USTCONSUMERD64_PATH DEFAULT_CONSUMERD_RUNDIR "/ustconsumerd64" -#define DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH DEFAULT_USTCONSUMERD64_PATH "/command" -#define DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH DEFAULT_USTCONSUMERD64_PATH "/error" +#define DEFAULT_USTCONSUMERD64_PATH DEFAULT_CONSUMERD_RUNDIR "/ustconsumerd64" +#define DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH DEFAULT_USTCONSUMERD64_PATH "/command" +#define DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH DEFAULT_USTCONSUMERD64_PATH "/error" /* UST 32-bit consumer path */ -#define DEFAULT_USTCONSUMERD32_PATH DEFAULT_CONSUMERD_RUNDIR "/ustconsumerd32" -#define DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH DEFAULT_USTCONSUMERD32_PATH "/command" -#define DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH DEFAULT_USTCONSUMERD32_PATH "/error" +#define DEFAULT_USTCONSUMERD32_PATH DEFAULT_CONSUMERD_RUNDIR "/ustconsumerd32" +#define DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH DEFAULT_USTCONSUMERD32_PATH "/command" +#define DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH DEFAULT_USTCONSUMERD32_PATH "/error" /* Relayd path */ -#define DEFAULT_RELAYD_RUNDIR "%s" -#define DEFAULT_RELAYD_PATH DEFAULT_RELAYD_RUNDIR "/relayd" +#define DEFAULT_RELAYD_RUNDIR "%s" +#define DEFAULT_RELAYD_PATH DEFAULT_RELAYD_RUNDIR "/relayd" -#define DEFAULT_RELAYD_MIN_FD_POOL_SIZE 100 +#define DEFAULT_RELAYD_MIN_FD_POOL_SIZE 100 /* * The file descriptor pool size needs a reserve buffer to accommodates the * indirect use of short-lived file descriptors. For instance, glibc will @@ -96,74 +97,70 @@ * * This value must be less than DEFAULT_RELAYD_MIN_FD_POOL_SIZE. */ -#define DEFAULT_RELAYD_FD_POOL_SIZE_RESERVE 10 +#define DEFAULT_RELAYD_FD_POOL_SIZE_RESERVE 10 /* Default lttng run directory */ -#define DEFAULT_LTTNG_HOME_ENV_VAR "LTTNG_HOME" -#define DEFAULT_LTTNG_FALLBACK_HOME_ENV_VAR "HOME" -#define DEFAULT_LTTNG_RUNDIR CONFIG_LTTNG_SYSTEM_RUNDIR -#define DEFAULT_LTTNG_HOME_RUNDIR "%s/.lttng" -#define DEFAULT_LTTNG_SESSIOND_PIDFILE "lttng-sessiond.pid" -#define DEFAULT_LTTNG_SESSIOND_AGENTPORT_FILE "agent.port" -#define DEFAULT_LTTNG_SESSIOND_LOCKFILE "lttng-sessiond.lck" +#define DEFAULT_LTTNG_HOME_ENV_VAR "LTTNG_HOME" +#define DEFAULT_LTTNG_FALLBACK_HOME_ENV_VAR "HOME" +#define DEFAULT_LTTNG_RUNDIR CONFIG_LTTNG_SYSTEM_RUNDIR +#define DEFAULT_LTTNG_HOME_RUNDIR "%s/.lttng" +#define DEFAULT_LTTNG_SESSIOND_PIDFILE "lttng-sessiond.pid" +#define DEFAULT_LTTNG_SESSIOND_AGENTPORT_FILE "agent.port" +#define DEFAULT_LTTNG_SESSIOND_LOCKFILE "lttng-sessiond.lck" /* Default probes list */ -#define DEFAULT_LTTNG_KMOD_PROBES "LTTNG_KMOD_PROBES" +#define DEFAULT_LTTNG_KMOD_PROBES "LTTNG_KMOD_PROBES" /* Default extra probes list */ -#define DEFAULT_LTTNG_EXTRA_KMOD_PROBES "LTTNG_EXTRA_KMOD_PROBES" +#define DEFAULT_LTTNG_EXTRA_KMOD_PROBES "LTTNG_EXTRA_KMOD_PROBES" /* Default unix socket path */ -#define DEFAULT_GLOBAL_CLIENT_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/client-lttng-sessiond" -#define DEFAULT_HOME_CLIENT_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/client-lttng-sessiond" -#define DEFAULT_GLOBAL_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/sessiond-health" -#define DEFAULT_HOME_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/sessiond-health" -#define DEFAULT_GLOBAL_NOTIFICATION_CHANNEL_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/sessiond-notification" -#define DEFAULT_HOME_NOTIFICATION_CHANNEL_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/sessiond-notification" +#define DEFAULT_GLOBAL_CLIENT_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/client-lttng-sessiond" +#define DEFAULT_HOME_CLIENT_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/client-lttng-sessiond" +#define DEFAULT_GLOBAL_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/sessiond-health" +#define DEFAULT_HOME_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/sessiond-health" +#define DEFAULT_GLOBAL_NOTIFICATION_CHANNEL_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/sessiond-notification" +#define DEFAULT_HOME_NOTIFICATION_CHANNEL_UNIX_SOCK \ + DEFAULT_LTTNG_HOME_RUNDIR "/sessiond-notification" /* Default consumer health unix socket path */ -#define DEFAULT_GLOBAL_USTCONSUMER32_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/ustconsumerd32/health" -#define DEFAULT_HOME_USTCONSUMER32_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/ustconsumerd32/health" -#define DEFAULT_GLOBAL_USTCONSUMER64_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/ustconsumerd64/health" -#define DEFAULT_HOME_USTCONSUMER64_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/ustconsumerd64/health" -#define DEFAULT_GLOBAL_KCONSUMER_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/kconsumerd/health" -#define DEFAULT_HOME_KCONSUMER_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/kconsumerd/health" +#define DEFAULT_GLOBAL_USTCONSUMER32_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/ustconsumerd32/health" +#define DEFAULT_HOME_USTCONSUMER32_HEALTH_UNIX_SOCK \ + DEFAULT_LTTNG_HOME_RUNDIR "/ustconsumerd32/health" +#define DEFAULT_GLOBAL_USTCONSUMER64_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/ustconsumerd64/health" +#define DEFAULT_HOME_USTCONSUMER64_HEALTH_UNIX_SOCK \ + DEFAULT_LTTNG_HOME_RUNDIR "/ustconsumerd64/health" +#define DEFAULT_GLOBAL_KCONSUMER_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/kconsumerd/health" +#define DEFAULT_HOME_KCONSUMER_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/kconsumerd/health" /* Default relay health unix socket path */ -#define DEFAULT_GLOBAL_RELAY_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/relayd/health-%d" -#define DEFAULT_HOME_RELAY_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/relayd/health-%d" +#define DEFAULT_GLOBAL_RELAY_HEALTH_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/relayd/health-%d" +#define DEFAULT_HOME_RELAY_HEALTH_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/relayd/health-%d" /* Default daemon configuration file path */ -#define DEFAULT_SYSTEM_CONFIGPATH CONFIG_LTTNG_SYSTEM_CONFIGDIR \ +#define DEFAULT_SYSTEM_CONFIGPATH \ + CONFIG_LTTNG_SYSTEM_CONFIGDIR \ "/lttng" -#define DEFAULT_DAEMON_CONFIG_FILE "lttng.conf" -#define DEFAULT_DAEMON_HOME_CONFIGPATH DEFAULT_LTTNG_HOME_RUNDIR "/" \ - DEFAULT_DAEMON_CONFIG_FILE -#define DEFAULT_DAEMON_SYSTEM_CONFIGPATH DEFAULT_SYSTEM_CONFIGPATH "/" \ - DEFAULT_DAEMON_CONFIG_FILE +#define DEFAULT_DAEMON_CONFIG_FILE "lttng.conf" +#define DEFAULT_DAEMON_HOME_CONFIGPATH DEFAULT_LTTNG_HOME_RUNDIR "/" DEFAULT_DAEMON_CONFIG_FILE +#define DEFAULT_DAEMON_SYSTEM_CONFIGPATH DEFAULT_SYSTEM_CONFIGPATH "/" DEFAULT_DAEMON_CONFIG_FILE /* Default session configuration file path */ -#define DEFAULT_SESSION_PATH "sessions" +#define DEFAULT_SESSION_PATH "sessions" /* Auto load session in that directory. */ -#define DEFAULT_SESSION_CONFIG_AUTOLOAD "auto" -#define DEFAULT_SESSION_HOME_CONFIGPATH DEFAULT_LTTNG_HOME_RUNDIR "/" \ - DEFAULT_SESSION_PATH -#define DEFAULT_SESSION_SYSTEM_CONFIGPATH DEFAULT_SYSTEM_CONFIGPATH "/" \ - DEFAULT_SESSION_PATH -#define DEFAULT_SESSION_CONFIG_FILE_EXTENSION ".lttng" -#define DEFAULT_SESSION_CONFIG_XSD_FILENAME "session.xsd" -#define DEFAULT_SESSION_CONFIG_XSD_PATH CONFIG_LTTNG_SYSTEM_DATADIR "/xml/lttng/" -#define DEFAULT_SESSION_CONFIG_XSD_PATH_ENV "LTTNG_SESSION_CONFIG_XSD_PATH" - -#define DEFAULT_GLOBAL_APPS_UNIX_SOCK \ - DEFAULT_LTTNG_RUNDIR "/" LTTNG_UST_SOCK_FILENAME -#define DEFAULT_HOME_APPS_UNIX_SOCK \ - DEFAULT_LTTNG_HOME_RUNDIR "/" LTTNG_UST_SOCK_FILENAME -#define DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH \ - "/" LTTNG_UST_WAIT_FILENAME -#define DEFAULT_HOME_APPS_WAIT_SHM_PATH \ - DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH "-%d" +#define DEFAULT_SESSION_CONFIG_AUTOLOAD "auto" +#define DEFAULT_SESSION_HOME_CONFIGPATH DEFAULT_LTTNG_HOME_RUNDIR "/" DEFAULT_SESSION_PATH +#define DEFAULT_SESSION_SYSTEM_CONFIGPATH DEFAULT_SYSTEM_CONFIGPATH "/" DEFAULT_SESSION_PATH +#define DEFAULT_SESSION_CONFIG_FILE_EXTENSION ".lttng" +#define DEFAULT_SESSION_CONFIG_XSD_FILENAME "session.xsd" +#define DEFAULT_SESSION_CONFIG_XSD_PATH CONFIG_LTTNG_SYSTEM_DATADIR "/xml/lttng/" +#define DEFAULT_SESSION_CONFIG_XSD_PATH_ENV "LTTNG_SESSION_CONFIG_XSD_PATH" + +#define DEFAULT_GLOBAL_APPS_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/" LTTNG_UST_SOCK_FILENAME +#define DEFAULT_HOME_APPS_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/" LTTNG_UST_SOCK_FILENAME +#define DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH "/" LTTNG_UST_WAIT_FILENAME +#define DEFAULT_HOME_APPS_WAIT_SHM_PATH DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH "-%d" /* * Value taken from the hard limit allowed by the kernel when using setrlimit @@ -180,180 +177,184 @@ #define DEFAULT_STREAM_NAME_LEN (LTTNG_SYMBOL_NAME_LEN + 8) /* Default channel attributes */ -#define DEFAULT_CHANNEL_NAME "channel0" +#define DEFAULT_CHANNEL_NAME "channel0" /* Default JUL domain channel name. */ -#define DEFAULT_JUL_CHANNEL_NAME "lttng_jul_channel" +#define DEFAULT_JUL_CHANNEL_NAME "lttng_jul_channel" /* Default JUL tracepoint name. This is a wildcard for the JUL domain. */ -#define DEFAULT_JUL_EVENT_COMPONENT "lttng_jul" -#define DEFAULT_JUL_EVENT_NAME DEFAULT_JUL_EVENT_COMPONENT ":*" +#define DEFAULT_JUL_EVENT_COMPONENT "lttng_jul" +#define DEFAULT_JUL_EVENT_NAME DEFAULT_JUL_EVENT_COMPONENT ":*" /* Default log4j domain channel name. */ -#define DEFAULT_LOG4J_CHANNEL_NAME "lttng_log4j_channel" +#define DEFAULT_LOG4J_CHANNEL_NAME "lttng_log4j_channel" /* Default log4j tracepoint name. This is a wildcard for the log4j domain. */ -#define DEFAULT_LOG4J_EVENT_COMPONENT "lttng_log4j" -#define DEFAULT_LOG4J_EVENT_NAME DEFAULT_LOG4J_EVENT_COMPONENT ":*" +#define DEFAULT_LOG4J_EVENT_COMPONENT "lttng_log4j" +#define DEFAULT_LOG4J_EVENT_NAME DEFAULT_LOG4J_EVENT_COMPONENT ":*" /* Default Python domain channel name. */ -#define DEFAULT_PYTHON_CHANNEL_NAME "lttng_python_channel" +#define DEFAULT_PYTHON_CHANNEL_NAME "lttng_python_channel" /* Default Python tracepoint name. This is a wildcard for the python domain. */ -#define DEFAULT_PYTHON_EVENT_COMPONENT "lttng_python" -#define DEFAULT_PYTHON_EVENT_NAME DEFAULT_PYTHON_EVENT_COMPONENT ":*" +#define DEFAULT_PYTHON_EVENT_COMPONENT "lttng_python" +#define DEFAULT_PYTHON_EVENT_NAME DEFAULT_PYTHON_EVENT_COMPONENT ":*" #define DEFAULT_CHANNEL_OVERWRITE (-1) -#define DEFAULT_CHANNEL_TRACEFILE_SIZE CONFIG_DEFAULT_CHANNEL_TRACEFILE_SIZE +#define DEFAULT_CHANNEL_TRACEFILE_SIZE CONFIG_DEFAULT_CHANNEL_TRACEFILE_SIZE #define DEFAULT_CHANNEL_TRACEFILE_COUNT CONFIG_DEFAULT_CHANNEL_TRACEFILE_COUNT -#define _DEFAULT_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_CHANNEL_SUBBUF_SIZE -#define _DEFAULT_CHANNEL_OUTPUT LTTNG_EVENT_MMAP +#define _DEFAULT_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_CHANNEL_SUBBUF_SIZE +#define _DEFAULT_CHANNEL_OUTPUT LTTNG_EVENT_MMAP /* Metadata channel defaults. */ -#define DEFAULT_METADATA_SUBBUF_SIZE CONFIG_DEFAULT_METADATA_SUBBUF_SIZE -#define DEFAULT_METADATA_SUBBUF_NUM CONFIG_DEFAULT_METADATA_SUBBUF_NUM -#define DEFAULT_METADATA_CACHE_SIZE CONFIG_DEFAULT_METADATA_CACHE_SIZE -#define DEFAULT_METADATA_SWITCH_TIMER 0 -#define DEFAULT_METADATA_READ_TIMER 0 -#define DEFAULT_METADATA_OVERWRITE 0 -#define DEFAULT_METADATA_OUTPUT LTTNG_EVENT_MMAP +#define DEFAULT_METADATA_SUBBUF_SIZE CONFIG_DEFAULT_METADATA_SUBBUF_SIZE +#define DEFAULT_METADATA_SUBBUF_NUM CONFIG_DEFAULT_METADATA_SUBBUF_NUM +#define DEFAULT_METADATA_CACHE_SIZE CONFIG_DEFAULT_METADATA_CACHE_SIZE +#define DEFAULT_METADATA_SWITCH_TIMER 0 +#define DEFAULT_METADATA_READ_TIMER 0 +#define DEFAULT_METADATA_OVERWRITE 0 +#define DEFAULT_METADATA_OUTPUT LTTNG_EVENT_MMAP /* Kernel has different defaults */ /* DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE must always be a power of 2 */ -#define DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE +#define DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE /* * DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM must always be a power of 2. * Update help manually if override. */ -#define DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM +#define DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM /* See lttng-kernel.h enum lttng_kernel_output for channel output */ -#define DEFAULT_KERNEL_CHANNEL_OUTPUT LTTNG_EVENT_SPLICE +#define DEFAULT_KERNEL_CHANNEL_OUTPUT LTTNG_EVENT_SPLICE #define DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER #define DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER #define DEFAULT_KERNEL_CHANNEL_READ_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_READ_TIMER #define DEFAULT_KERNEL_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_LIVE_TIMER -#define DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT +#define DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT /* User space defaults */ /* Must be a power of 2 */ -#define DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE -#define DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE +#define DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE +#define DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE /* Must be a power of 2. Update help manuall if override. */ -#define DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM -#define DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM +#define DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM +#define DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM /* See lttng-ust.h enum lttng_ust_output */ -#define DEFAULT_UST_PID_CHANNEL_OUTPUT _DEFAULT_CHANNEL_OUTPUT -#define DEFAULT_UST_UID_CHANNEL_OUTPUT _DEFAULT_CHANNEL_OUTPUT +#define DEFAULT_UST_PID_CHANNEL_OUTPUT _DEFAULT_CHANNEL_OUTPUT +#define DEFAULT_UST_UID_CHANNEL_OUTPUT _DEFAULT_CHANNEL_OUTPUT /* Timers in usec. */ -#define DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER -#define DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER -#define DEFAULT_UST_PID_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_LIVE_TIMER -#define DEFAULT_UST_UID_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_LIVE_TIMER -#define DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER -#define DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER +#define DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER +#define DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER +#define DEFAULT_UST_PID_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_LIVE_TIMER +#define DEFAULT_UST_UID_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_LIVE_TIMER +#define DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER +#define DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER -#define DEFAULT_UST_PID_CHANNEL_READ_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_READ_TIMER -#define DEFAULT_UST_UID_CHANNEL_READ_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_READ_TIMER +#define DEFAULT_UST_PID_CHANNEL_READ_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_READ_TIMER +#define DEFAULT_UST_UID_CHANNEL_READ_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_READ_TIMER -#define DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT -#define DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT +#define DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT +#define DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT /* * Default timeout value for the sem_timedwait() call. Blocking forever is not * wanted so a timeout is used to control the data flow and not freeze the * session daemon. */ -#define DEFAULT_SEM_WAIT_TIMEOUT 30 /* in seconds */ +#define DEFAULT_SEM_WAIT_TIMEOUT 30 /* in seconds */ /* Default bind addresses for network services. */ -#define DEFAULT_NETWORK_CONTROL_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_CONTROL_BIND_ADDRESS -#define DEFAULT_NETWORK_DATA_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_DATA_BIND_ADDRESS -#define DEFAULT_NETWORK_VIEWER_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_VIEWER_BIND_ADDRESS -#define DEFAULT_AGENT_BIND_ADDRESS CONFIG_DEFAULT_AGENT_BIND_ADDRESS +#define DEFAULT_NETWORK_CONTROL_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_CONTROL_BIND_ADDRESS +#define DEFAULT_NETWORK_DATA_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_DATA_BIND_ADDRESS +#define DEFAULT_NETWORK_VIEWER_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_VIEWER_BIND_ADDRESS +#define DEFAULT_AGENT_BIND_ADDRESS CONFIG_DEFAULT_AGENT_BIND_ADDRESS /* Default network ports for trace streaming support. */ -#define DEFAULT_NETWORK_CONTROL_PORT CONFIG_DEFAULT_NETWORK_CONTROL_PORT -#define DEFAULT_NETWORK_DATA_PORT CONFIG_DEFAULT_NETWORK_DATA_PORT -#define DEFAULT_NETWORK_VIEWER_PORT CONFIG_DEFAULT_NETWORK_VIEWER_PORT +#define DEFAULT_NETWORK_CONTROL_PORT CONFIG_DEFAULT_NETWORK_CONTROL_PORT +#define DEFAULT_NETWORK_DATA_PORT CONFIG_DEFAULT_NETWORK_DATA_PORT +#define DEFAULT_NETWORK_VIEWER_PORT CONFIG_DEFAULT_NETWORK_VIEWER_PORT /* Agent registration TCP port range. */ -#define DEFAULT_AGENT_TCP_PORT_RANGE_BEGIN CONFIG_DEFAULT_AGENT_TCP_PORT_RANGE_BEGIN -#define DEFAULT_AGENT_TCP_PORT_RANGE_END CONFIG_DEFAULT_AGENT_TCP_PORT_RANGE_END +#define DEFAULT_AGENT_TCP_PORT_RANGE_BEGIN CONFIG_DEFAULT_AGENT_TCP_PORT_RANGE_BEGIN +#define DEFAULT_AGENT_TCP_PORT_RANGE_END CONFIG_DEFAULT_AGENT_TCP_PORT_RANGE_END /* Number of buckets in the event notifier error count map. */ -#define DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE CONFIG_DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE +#define DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE \ + CONFIG_DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE /* * If a thread stalls for this amount of time, it will be considered bogus (bad * health). */ -#define DEFAULT_HEALTH_CHECK_DELTA_S 20 -#define DEFAULT_HEALTH_CHECK_DELTA_NS 0 +#define DEFAULT_HEALTH_CHECK_DELTA_S 20 +#define DEFAULT_HEALTH_CHECK_DELTA_NS 0 /* * Wait period before retrying the lttng_data_pending command in the lttng * stop command of liblttng-ctl. */ -#define DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US 200000 /* usec */ +#define DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US 200000 /* usec */ /* * Wait period before retrying the lttng_consumer_flushed_cache when * the consumer receives metadata. */ -#define DEFAULT_METADATA_AVAILABILITY_WAIT_TIME 200000 /* usec */ +#define DEFAULT_METADATA_AVAILABILITY_WAIT_TIME 200000 /* usec */ /* * The usual value for the maximum TCP SYN retries time and TCP FIN timeout is * 180 and 60 seconds on most Linux system and the default value since kernel * 2.2 thus using the highest value. See tcp(7) for more details. */ -#define DEFAULT_INET_TCP_TIMEOUT 180 /* sec */ +#define DEFAULT_INET_TCP_TIMEOUT 180 /* sec */ /* Maximum payload size for a control connection */ -#define DEFAULT_NETWORK_RELAYD_CTRL_MAX_PAYLOAD_SIZE CONFIG_DEFAULT_NETWORK_RELAYD_CTRL_MAX_PAYLOAD_SIZE +#define DEFAULT_NETWORK_RELAYD_CTRL_MAX_PAYLOAD_SIZE \ + CONFIG_DEFAULT_NETWORK_RELAYD_CTRL_MAX_PAYLOAD_SIZE /* * Default receiving and sending timeout for an application socket. */ -#define DEFAULT_APP_SOCKET_RW_TIMEOUT CONFIG_DEFAULT_APP_SOCKET_RW_TIMEOUT -#define DEFAULT_APP_SOCKET_TIMEOUT_ENV "LTTNG_APP_SOCKET_TIMEOUT" +#define DEFAULT_APP_SOCKET_RW_TIMEOUT CONFIG_DEFAULT_APP_SOCKET_RW_TIMEOUT +#define DEFAULT_APP_SOCKET_TIMEOUT_ENV "LTTNG_APP_SOCKET_TIMEOUT" -#define DEFAULT_UST_STREAM_FD_NUM 2 /* Number of fd per UST stream. */ +#define DEFAULT_UST_STREAM_FD_NUM 2 /* Number of fd per UST stream. */ -#define DEFAULT_SNAPSHOT_NAME "snapshot" -#define DEFAULT_SNAPSHOT_MAX_SIZE 0 /* Unlimited. */ +#define DEFAULT_SNAPSHOT_NAME "snapshot" +#define DEFAULT_SNAPSHOT_MAX_SIZE 0 /* Unlimited. */ /* Suffix of an index file. */ -#define DEFAULT_INDEX_FILE_SUFFIX ".idx" -#define DEFAULT_INDEX_DIR "index" +#define DEFAULT_INDEX_FILE_SUFFIX ".idx" +#define DEFAULT_INDEX_DIR "index" /* Default lttng command live timer value in usec. */ -#define DEFAULT_LTTNG_LIVE_TIMER CONFIG_DEFAULT_LTTNG_LIVE_TIMER +#define DEFAULT_LTTNG_LIVE_TIMER CONFIG_DEFAULT_LTTNG_LIVE_TIMER /* Default runas worker name */ -#define DEFAULT_RUN_AS_WORKER_NAME "lttng-runas" +#define DEFAULT_RUN_AS_WORKER_NAME "lttng-runas" /* Default LTTng MI XML namespace. */ -#define DEFAULT_LTTNG_MI_NAMESPACE "https://lttng.org/xml/ns/lttng-mi" +#define DEFAULT_LTTNG_MI_NAMESPACE "https://lttng.org/xml/ns/lttng-mi" /* Default thread stack size; the default mandated by pthread_create(3) */ -#define DEFAULT_LTTNG_THREAD_STACK_SIZE 2097152 +#define DEFAULT_LTTNG_THREAD_STACK_SIZE 2097152 /* Default maximal size of message notification channel message payloads. */ -#define DEFAULT_MAX_NOTIFICATION_CLIENT_MESSAGE_PAYLOAD_SIZE 65536 +#define DEFAULT_MAX_NOTIFICATION_CLIENT_MESSAGE_PAYLOAD_SIZE 65536 /* Default maximal size of trace archive location. */ -#define DEFAULT_MAX_TRACE_ARCHIVE_LOCATION_PAYLOAD_SIZE 65536 +#define DEFAULT_MAX_TRACE_ARCHIVE_LOCATION_PAYLOAD_SIZE 65536 /* Default maximal size of message notification channel message payloads. */ -#define DEFAULT_CLIENT_MAX_QUEUED_NOTIFICATIONS_COUNT 100 - +#define DEFAULT_CLIENT_MAX_QUEUED_NOTIFICATIONS_COUNT 100 -#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ENV "LTTNG_RELAYD_TCP_KEEP_ALIVE" +#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ENV "LTTNG_RELAYD_TCP_KEEP_ALIVE" #define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME_ENV "LTTNG_RELAYD_TCP_KEEP_ALIVE_IDLE_TIME" -#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT_ENV "LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT" -#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL_ENV "LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL" -#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV "LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD" +#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT_ENV \ + "LTTNG_RELAYD_TCP_KEEP_ALIVE_MAX_PROBE_COUNT" +#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL_ENV \ + "LTTNG_RELAYD_TCP_KEEP_ALIVE_PROBE_INTERVAL" +#define DEFAULT_LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD_ENV \ + "LTTNG_RELAYD_TCP_KEEP_ALIVE_ABORT_THRESHOLD" #define DEFAULT_LTTNG_RELAYD_DISALLOW_CLEAR_ENV "LTTNG_RELAYD_DISALLOW_CLEAR" #define DEFAULT_LTTNG_RELAYD_WORKING_DIRECTORY_ENV "LTTNG_RELAYD_WORKING_DIRECTORY" @@ -362,16 +363,16 @@ * Name of the intermediate directory used to rename the trace chunk of a * session's first rotation. */ -#define DEFAULT_CHUNK_TMP_OLD_DIRECTORY ".tmp_old_chunk" -#define DEFAULT_CHUNK_TMP_NEW_DIRECTORY ".tmp_new_chunk" -#define DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY "archives" -#define DEFAULT_UNLINKED_FILES_DIRECTORY ".unlinked" +#define DEFAULT_CHUNK_TMP_OLD_DIRECTORY ".tmp_old_chunk" +#define DEFAULT_CHUNK_TMP_NEW_DIRECTORY ".tmp_new_chunk" +#define DEFAULT_ARCHIVED_TRACE_CHUNKS_DIRECTORY "archives" +#define DEFAULT_UNLINKED_FILES_DIRECTORY ".unlinked" /* * Default timer value in usec for the rotate pending polling check on the * relay when a rotation has completed on the consumer. */ -#define DEFAULT_ROTATE_PENDING_TIMER CONFIG_DEFAULT_ROTATE_PENDING_TIMER +#define DEFAULT_ROTATE_PENDING_TIMER CONFIG_DEFAULT_ROTATE_PENDING_TIMER /* * Returns the default subbuf size. diff --git a/src/common/dynamic-array.hpp b/src/common/dynamic-array.hpp index 2a1f22943..a50fac10b 100644 --- a/src/common/dynamic-array.hpp +++ b/src/common/dynamic-array.hpp @@ -29,15 +29,13 @@ struct lttng_dynamic_pointer_array { * allocation and can't fail. */ 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); /* * Returns the number of elements in the dynamic array. */ -static inline -size_t lttng_dynamic_array_get_count( - const struct lttng_dynamic_array *array) +static inline size_t lttng_dynamic_array_get_count(const struct lttng_dynamic_array *array) { return array->size; } @@ -46,9 +44,8 @@ size_t lttng_dynamic_array_get_count( * Returns a pointer to the element. Mutating operations on the array invalidate * the returned pointer. */ -static inline -void *lttng_dynamic_array_get_element(const struct lttng_dynamic_array *array, - size_t element_index) +static inline void *lttng_dynamic_array_get_element(const struct lttng_dynamic_array *array, + size_t element_index) { LTTNG_ASSERT(element_index < array->size); return array->buffer.data + (element_index * array->element_size); @@ -69,8 +66,7 @@ void *lttng_dynamic_array_get_element(const struct lttng_dynamic_array *array, * NOTE: It is striclty _invalid_ to access memory after _size_, regardless * of prior calls to set_capacity(). */ -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); /* * Add an element to the end of a dynamic array. The array's element count is @@ -78,16 +74,14 @@ int lttng_dynamic_array_set_count(struct lttng_dynamic_array *array, * * element is a pointer to the element to add (copy) to the array. */ -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); /* * Remove an element from the dynamic array. The array's element count is * decreased by one and the following elements are shifted to take its place * (when applicable). */ -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); /* Release any memory used by the dynamic array. */ void lttng_dynamic_array_reset(struct lttng_dynamic_array *array); @@ -106,16 +100,14 @@ void lttng_dynamic_array_clear(struct lttng_dynamic_array *array); * Initialize a resizable array of fixed-size elements. This performs no * allocation and can't fail. */ -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); /* * Returns the number of pointers in the dynamic pointer array. */ -static inline -size_t lttng_dynamic_pointer_array_get_count( - const struct lttng_dynamic_pointer_array *array) +static inline size_t +lttng_dynamic_pointer_array_get_count(const struct lttng_dynamic_pointer_array *array) { return lttng_dynamic_array_get_count(&array->array); } @@ -123,9 +115,9 @@ size_t lttng_dynamic_pointer_array_get_count( /* * Returns the pointer at index `index`. */ -static inline -void *lttng_dynamic_pointer_array_get_pointer( - const struct lttng_dynamic_pointer_array *array, size_t index) +static inline void * +lttng_dynamic_pointer_array_get_pointer(const struct lttng_dynamic_pointer_array *array, + size_t index) { void **element = (void **) lttng_dynamic_array_get_element(&array->array, index); @@ -137,9 +129,8 @@ void *lttng_dynamic_pointer_array_get_pointer( * run the destructor. */ -static inline -void *lttng_dynamic_pointer_array_steal_pointer( - struct lttng_dynamic_pointer_array *array, size_t index) +static inline void * +lttng_dynamic_pointer_array_steal_pointer(struct lttng_dynamic_pointer_array *array, size_t index) { void **p_element = (void **) lttng_dynamic_array_get_element(&array->array, index); void *element = *p_element; @@ -154,9 +145,8 @@ void *lttng_dynamic_pointer_array_steal_pointer( * count is increased by one and its underlying capacity is adjusted * automatically. */ -static inline -int lttng_dynamic_pointer_array_add_pointer( - struct lttng_dynamic_pointer_array *array, void *pointer) +static inline int lttng_dynamic_pointer_array_add_pointer(struct lttng_dynamic_pointer_array *array, + void *pointer) { return lttng_dynamic_array_add_element(&array->array, &pointer); } @@ -166,15 +156,13 @@ int lttng_dynamic_pointer_array_add_pointer( * count is decreased by one and the following pointers are shifted to * take the place of the removed pointer (if applicable). */ -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); /* 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); /* Remove all elements from the dynamic pointer 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); #endif /* LTTNG_DYNAMIC_ARRAY_H */ diff --git a/src/common/dynamic-buffer.hpp b/src/common/dynamic-buffer.hpp index 65b15752d..228b0c5ea 100644 --- a/src/common/dynamic-buffer.hpp +++ b/src/common/dynamic-buffer.hpp @@ -8,9 +8,10 @@ #ifndef LTTNG_DYNAMIC_BUFFER_H #define LTTNG_DYNAMIC_BUFFER_H +#include + #include #include -#include struct lttng_buffer_view; @@ -36,8 +37,7 @@ void lttng_dynamic_buffer_init(struct lttng_dynamic_buffer *buffer); * (after its current "size"). The dynamic buffer's size is increased by * "len", and its capacity is adjusted automatically. */ -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); /* * Performs the same action as lttng_dynamic_buffer_append(), but using another @@ -45,7 +45,7 @@ int lttng_dynamic_buffer_append(struct lttng_dynamic_buffer *buffer, * of "len". */ 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); /* * Performs the same action as lttng_dynamic_buffer_append(), but using a @@ -53,7 +53,7 @@ int lttng_dynamic_buffer_append_buffer(struct lttng_dynamic_buffer *dst_buffer, * of "len". */ int lttng_dynamic_buffer_append_view(struct lttng_dynamic_buffer *buffer, - const struct lttng_buffer_view *view); + const struct lttng_buffer_view *view); /* * Set the buffer's size to new_size. The capacity of the buffer will @@ -71,8 +71,7 @@ int lttng_dynamic_buffer_append_view(struct lttng_dynamic_buffer *buffer, * NOTE: It is striclty _invalid_ to access memory after _size_, regardless * of prior calls to set_capacity(). */ -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); /* * Set the buffer's capacity to accommodates the new_capacity, allocating memory @@ -82,14 +81,12 @@ int lttng_dynamic_buffer_set_size(struct lttng_dynamic_buffer *buffer, * * If the current size > new_capacity, the operation will fail. */ -int lttng_dynamic_buffer_set_capacity(struct lttng_dynamic_buffer *buffer, - size_t new_capacity); +int lttng_dynamic_buffer_set_capacity(struct lttng_dynamic_buffer *buffer, size_t new_capacity); /* Release any memory used by the dynamic buffer. */ void lttng_dynamic_buffer_reset(struct lttng_dynamic_buffer *buffer); /* Get the space left in the buffer before a new resize is needed. */ -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); #endif /* LTTNG_DYNAMIC_BUFFER_H */ diff --git a/src/common/error.hpp b/src/common/error.hpp index 390c4dccc..885902bb9 100644 --- a/src/common/error.hpp +++ b/src/common/error.hpp @@ -24,9 +24,10 @@ #error "lttng-tools error.h needs _GNU_SOURCE" #endif -#include #include +#include + /* Avoid conflict with Solaris */ #if defined(ERR) && defined(__sun__) #undef ERR @@ -34,7 +35,7 @@ /* Stringify the expansion of a define */ #define XSTR(d) STR(d) -#define STR(s) #s +#define STR(s) #s /* * Contains the string of the log entry time. This is used as a thread local @@ -45,7 +46,7 @@ struct log_time { /* Format: 00:00:00.000000000 plus NULL byte. */ char str[19]; }; -extern LTTNG_EXPORT DECLARE_URCU_TLS(struct log_time, error_log_time); +extern LTTNG_EXPORT DECLARE_URCU_TLS(struct log_time, error_log_time); extern DECLARE_URCU_TLS(const char *, logger_thread_name); extern int lttng_opt_quiet; @@ -54,13 +55,13 @@ extern int lttng_opt_mi; /* Error type. */ enum lttng_error_level { - PRINT_ERR = 0, - PRINT_BUG = 1, - PRINT_WARN = 2, - PRINT_MSG = 3, - PRINT_DBG = 4, - PRINT_DBG2 = 5, - PRINT_DBG3 = 6, + PRINT_ERR = 0, + PRINT_BUG = 1, + PRINT_WARN = 2, + PRINT_MSG = 3, + PRINT_DBG = 4, + PRINT_DBG2 = 5, + PRINT_DBG3 = 6, }; static inline bool __lttng_print_check_opt(enum lttng_error_level type) @@ -135,101 +136,99 @@ static inline void __lttng_print_check_abort(enum lttng_error_level type) * want any nested msg to show up when printing mi to stdout(if it's the case). * All warnings and errors should be printed to stderr as normal. */ -#define __lttng_print(type, fmt, args...) \ - do { \ - if (__lttng_print_check_opt(type)) { \ - fprintf((type) == PRINT_MSG ? stdout : stderr, fmt, ## args); \ - } \ - __lttng_print_check_abort(type); \ +#define __lttng_print(type, fmt, args...) \ + do { \ + if (__lttng_print_check_opt(type)) { \ + fprintf((type) == PRINT_MSG ? stdout : stderr, fmt, ##args); \ + } \ + __lttng_print_check_abort(type); \ } while (0) /* Three level of debug. Use -v, -vv or -vvv for the levels */ -#define _ERRMSG(msg, type, fmt, args...) \ - do { \ - if (caa_unlikely(__lttng_print_check_opt(type))) { \ - char generic_name[MAX_INT_DEC_LEN(long) + \ - MAX_INT_DEC_LEN(long)]; \ - \ - snprintf(generic_name, sizeof(generic_name), \ - "%ld/%ld", (long) getpid(), \ - (long) lttng_gettid()); \ - \ - __lttng_print(type, \ - msg " - %s [%s]: " fmt \ - " (in %s() at " __FILE__ \ - ":" XSTR(__LINE__) ")\n", \ - log_add_time(), \ - URCU_TLS(logger_thread_name) ?: \ - generic_name, \ - ##args, __func__); \ - } \ +#define _ERRMSG(msg, type, fmt, args...) \ + do { \ + if (caa_unlikely(__lttng_print_check_opt(type))) { \ + char generic_name[MAX_INT_DEC_LEN(long) + MAX_INT_DEC_LEN(long)]; \ + \ + snprintf(generic_name, \ + sizeof(generic_name), \ + "%ld/%ld", \ + (long) getpid(), \ + (long) lttng_gettid()); \ + \ + __lttng_print(type, \ + msg " - %s [%s]: " fmt " (in %s() at " __FILE__ \ + ":" XSTR(__LINE__) ")\n", \ + log_add_time(), \ + URCU_TLS(logger_thread_name) ?: generic_name, \ + ##args, \ + __func__); \ + } \ } while (0) -#define _ERRMSG_NO_LOC(msg, type, fmt, args...) \ - do { \ - if (caa_unlikely(__lttng_print_check_opt(type))) { \ - char generic_name[MAX_INT_DEC_LEN(long) + \ - MAX_INT_DEC_LEN(long)]; \ - \ - snprintf(generic_name, sizeof(generic_name), \ - "%ld/%ld", (long) getpid(), \ - (long) lttng_gettid()); \ - \ - __lttng_print(type, msg " - %s [%s]: " fmt "\n", \ - log_add_time(), \ - URCU_TLS(logger_thread_name) ?: \ - generic_name, \ - ##args); \ - } \ +#define _ERRMSG_NO_LOC(msg, type, fmt, args...) \ + do { \ + if (caa_unlikely(__lttng_print_check_opt(type))) { \ + char generic_name[MAX_INT_DEC_LEN(long) + MAX_INT_DEC_LEN(long)]; \ + \ + snprintf(generic_name, \ + sizeof(generic_name), \ + "%ld/%ld", \ + (long) getpid(), \ + (long) lttng_gettid()); \ + \ + __lttng_print(type, \ + msg " - %s [%s]: " fmt "\n", \ + log_add_time(), \ + URCU_TLS(logger_thread_name) ?: generic_name, \ + ##args); \ + } \ } while (0) -#define MSG(fmt, args...) \ - __lttng_print(PRINT_MSG, fmt "\n", ## args) -#define _MSG(fmt, args...) \ - __lttng_print(PRINT_MSG, fmt, ## args) -#define ERR(fmt, args...) \ - __lttng_print(PRINT_ERR, "Error: " fmt "\n", ## args) -#define WARN(fmt, args...) \ - __lttng_print(PRINT_WARN, "Warning: " fmt "\n", ## args) +#define MSG(fmt, args...) __lttng_print(PRINT_MSG, fmt "\n", ##args) +#define _MSG(fmt, args...) __lttng_print(PRINT_MSG, fmt, ##args) +#define ERR(fmt, args...) __lttng_print(PRINT_ERR, "Error: " fmt "\n", ##args) +#define WARN(fmt, args...) __lttng_print(PRINT_WARN, "Warning: " fmt "\n", ##args) -#define BUG(fmt, args...) _ERRMSG("BUG", PRINT_BUG, fmt, ## args) +#define BUG(fmt, args...) _ERRMSG("BUG", PRINT_BUG, fmt, ##args) -#define DBG(fmt, args...) _ERRMSG("DBG1", PRINT_DBG, fmt, ## args) -#define DBG_NO_LOC(fmt, args...) _ERRMSG_NO_LOC("DBG1", PRINT_DBG, fmt, ## args) -#define DBG2(fmt, args...) _ERRMSG("DBG2", PRINT_DBG2, fmt, ## args) -#define DBG3(fmt, args...) _ERRMSG("DBG3", PRINT_DBG3, fmt, ## args) -#define LOG(type, fmt, args...) \ - do { \ - switch (type) { \ - case PRINT_ERR: \ - ERR(fmt, ## args); \ - break; \ - case PRINT_WARN: \ - WARN(fmt, ## args); \ - break; \ - case PRINT_BUG: \ - BUG(fmt, ## args); \ - break; \ - case PRINT_MSG: \ - MSG(fmt, ## args); \ - break; \ - case PRINT_DBG: \ - DBG(fmt, ## args); \ - break; \ - case PRINT_DBG2: \ - DBG2(fmt, ## args); \ - break; \ - case PRINT_DBG3: \ - DBG3(fmt, ## args); \ - break; \ - default: \ - abort(); \ - } \ - } while(0); +#define DBG(fmt, args...) _ERRMSG("DBG1", PRINT_DBG, fmt, ##args) +#define DBG_NO_LOC(fmt, args...) _ERRMSG_NO_LOC("DBG1", PRINT_DBG, fmt, ##args) +#define DBG2(fmt, args...) _ERRMSG("DBG2", PRINT_DBG2, fmt, ##args) +#define DBG3(fmt, args...) _ERRMSG("DBG3", PRINT_DBG3, fmt, ##args) +#define LOG(type, fmt, args...) \ + do { \ + switch (type) { \ + case PRINT_ERR: \ + ERR(fmt, ##args); \ + break; \ + case PRINT_WARN: \ + WARN(fmt, ##args); \ + break; \ + case PRINT_BUG: \ + BUG(fmt, ##args); \ + break; \ + case PRINT_MSG: \ + MSG(fmt, ##args); \ + break; \ + case PRINT_DBG: \ + DBG(fmt, ##args); \ + break; \ + case PRINT_DBG2: \ + DBG2(fmt, ##args); \ + break; \ + case PRINT_DBG3: \ + DBG3(fmt, ##args); \ + break; \ + default: \ + abort(); \ + } \ + } while (0); -#define _PERROR(fmt, args...) _ERRMSG("PERROR", PRINT_ERR, fmt, ## args) +#define _PERROR(fmt, args...) _ERRMSG("PERROR", PRINT_ERR, fmt, ##args) -#if !defined(__GLIBC__) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE)) +#if !defined(__GLIBC__) || \ + ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE)) /* * Version using XSI strerror_r. @@ -244,13 +243,12 @@ static inline void __lttng_print_check_abort(enum lttng_error_level type) /* * Version using GNU strerror_r, for linux with appropriate defines. */ -#define PERROR(call, args...) \ - do { \ - char *_perror_buf; \ - char _perror_tmp[200]; \ - _perror_buf = strerror_r( \ - errno, _perror_tmp, sizeof(_perror_tmp)); \ - _PERROR(call ": %s", ##args, _perror_buf); \ +#define PERROR(call, args...) \ + do { \ + char *_perror_buf; \ + char _perror_tmp[200]; \ + _perror_buf = strerror_r(errno, _perror_tmp, sizeof(_perror_tmp)); \ + _PERROR(call ": %s", ##args, _perror_buf); \ } while (0); #endif diff --git a/src/common/event-rule/user-tracepoint.cpp b/src/common/event-rule/user-tracepoint.cpp index 83c7c885c..e892b0ce8 100644 --- a/src/common/event-rule/user-tracepoint.cpp +++ b/src/common/event-rule/user-tracepoint.cpp @@ -160,7 +160,8 @@ static int lttng_event_rule_user_tracepoint_serialize(const struct lttng_event_r serialized_len = len; /* Append exclusion length, includes the null terminator. */ - ret = lttng_dynamic_buffer_append(&payload->buffer, &serialized_len, sizeof(serialized_len)); + ret = lttng_dynamic_buffer_append( + &payload->buffer, &serialized_len, sizeof(serialized_len)); if (ret) { goto end; } diff --git a/src/common/exception.hpp b/src/common/exception.hpp index a3b0a83e2..e43094bb6 100644 --- a/src/common/exception.hpp +++ b/src/common/exception.hpp @@ -8,12 +8,12 @@ #ifndef LTTNG_EXCEPTION_H_ #define LTTNG_EXCEPTION_H_ -#include +#include + #include +#include #include -#include - #define LTTNG_THROW_CTL(msg, error_code) \ throw lttng::ctl::error(msg, error_code, __FILE__, __func__, __LINE__) #define LTTNG_THROW_POSIX(msg, errno_code) \ @@ -32,17 +32,17 @@ namespace lttng { class runtime_error : public std::runtime_error { public: explicit 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); }; class unsupported_error : public std::runtime_error { public: explicit 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); }; namespace ctl { @@ -68,34 +68,34 @@ private: class posix_error : public std::system_error { public: explicit 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); }; class communication_error : public runtime_error { public: explicit 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); }; class protocol_error : public communication_error { public: explicit 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); }; class invalid_argument_error : public runtime_error { public: explicit 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); }; }; /* namespace lttng */ diff --git a/src/common/fd-tracker/fd-tracker.hpp b/src/common/fd-tracker/fd-tracker.hpp index b75fc91c4..06e9b1d14 100644 --- a/src/common/fd-tracker/fd-tracker.hpp +++ b/src/common/fd-tracker/fd-tracker.hpp @@ -10,6 +10,7 @@ #include #include + #include #include @@ -49,8 +50,7 @@ using fd_close_cb = int (*)(void *, int *); * under which unlinked files will be stored for as long as a reference to them * is held. */ -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); /* Returns an error if file descriptors are leaked. */ int fd_tracker_destroy(struct fd_tracker *tracker); @@ -78,10 +78,10 @@ int fd_tracker_destroy(struct fd_tracker *tracker); * open. */ 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); /* * Open a tracked unsuspendable file descriptor. @@ -106,11 +106,11 @@ struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker, * accommodates the request for a new unsuspendable entry. */ 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 *data); + int *out_fds, + const char **names, + unsigned int fd_count, + fd_open_cb open, + void *data); /* * Close a tracked unsuspendable file descriptor. @@ -127,11 +127,8 @@ int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker, * Closed fds are set to -1 in the fds array which, in the event of an error, * allows the user to know which file descriptors are no longer being tracked. */ -int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker, - int *fds, - unsigned int fd_count, - fd_close_cb close, - void *data); +int fd_tracker_close_unsuspendable_fd( + struct fd_tracker *tracker, int *fds, unsigned int fd_count, fd_close_cb close, void *data); /* * Log the contents of the fd_tracker. diff --git a/src/common/fd-tracker/inode.hpp b/src/common/fd-tracker/inode.hpp index d4cb28239..7f4f6fb59 100644 --- a/src/common/fd-tracker/inode.hpp +++ b/src/common/fd-tracker/inode.hpp @@ -9,6 +9,7 @@ #define FD_TRACKER_INODE_H #include + #include struct lttng_inode; @@ -24,38 +25,34 @@ struct lttng_directory_handle; * by the fd-tracker. Users of the fd-tracker should account for this extra * file descriptor. */ -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); -void lttng_unlinked_file_pool_destroy( - struct lttng_unlinked_file_pool *pool); +void lttng_unlinked_file_pool_destroy(struct lttng_unlinked_file_pool *pool); /* The inode registry is protected by the fd-tracker's lock. */ struct lttng_inode_registry *lttng_inode_registry_create(void); -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 *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 *pool); void lttng_inode_registry_destroy(struct lttng_inode_registry *registry); 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); /* Returns a new reference to the inode's location directory handle. */ -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); 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); + 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_unlink(struct lttng_inode *inode); diff --git a/src/common/fd-tracker/utils.hpp b/src/common/fd-tracker/utils.hpp index f75256496..0dfdb29f9 100644 --- a/src/common/fd-tracker/utils.hpp +++ b/src/common/fd-tracker/utils.hpp @@ -22,27 +22,23 @@ int fd_tracker_util_close_fd(void *, int *fd); /* * Create a pipe and track its underlying fds. */ -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 fd_tracker_util_pipe_close(struct fd_tracker *tracker, int *pipe); /* * Create a poll event and track its underlying fd, if applicable. */ int fd_tracker_util_poll_create(struct fd_tracker *tracker, - const char *name, - struct lttng_poll_event *events, - int size, - int flags); -int fd_tracker_util_poll_clean( - struct fd_tracker *tracker, struct lttng_poll_event *events); + const char *name, + struct lttng_poll_event *events, + int size, + int flags); +int fd_tracker_util_poll_clean(struct fd_tracker *tracker, struct lttng_poll_event *events); -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); struct lttng_directory_handle *fd_tracker_create_directory_handle_from_handle( - struct fd_tracker *tracker, - struct lttng_directory_handle *handle, - const char *path); + struct fd_tracker *tracker, struct lttng_directory_handle *handle, const char *path); #endif /* FD_TRACKER_UTILS_H */ diff --git a/src/common/file-descriptor.hpp b/src/common/file-descriptor.hpp index 68686a4ad..c0076eb9c 100644 --- a/src/common/file-descriptor.hpp +++ b/src/common/file-descriptor.hpp @@ -43,6 +43,7 @@ public: void write(const void *buffer, std::size_t size); int fd() const noexcept; + protected: void _cleanup() noexcept; diff --git a/src/common/filter.hpp b/src/common/filter.hpp index 085d6d034..ae061fd93 100644 --- a/src/common/filter.hpp +++ b/src/common/filter.hpp @@ -16,8 +16,7 @@ struct bytecode_symbol_iterator; * Create an iterator on a bytecode's symbols. The iterator points to the * first element after creation. */ -struct bytecode_symbol_iterator *bytecode_symbol_iterator_create( - struct lttng_bytecode *bytecode); +struct bytecode_symbol_iterator *bytecode_symbol_iterator_create(struct lttng_bytecode *bytecode); /* * Advance iterator of one element. @@ -28,8 +27,7 @@ int bytecode_symbol_iterator_next(struct bytecode_symbol_iterator *it); int bytecode_symbol_iterator_get_type(struct bytecode_symbol_iterator *it); -const char *bytecode_symbol_iterator_get_name( - struct bytecode_symbol_iterator *it); +const char *bytecode_symbol_iterator_get_name(struct bytecode_symbol_iterator *it); void bytecode_symbol_iterator_destroy(struct bytecode_symbol_iterator *it); diff --git a/src/common/filter/filter-ast.hpp b/src/common/filter/filter-ast.hpp index ecafee229..51a36326b 100644 --- a/src/common/filter/filter-ast.hpp +++ b/src/common/filter/filter-ast.hpp @@ -16,14 +16,14 @@ * Note: filter-ast.h should be included before filter-parser.h. */ -#include -#include #include +#include +#include -#define printf_debug(fmt, args...) \ - do { \ - if (filter_parser_debug) \ - fprintf(stdout, "[debug] " fmt, ## args); \ +#define printf_debug(fmt, args...) \ + do { \ + if (filter_parser_debug) \ + fprintf(stdout, "[debug] " fmt, ##args); \ } while (0) // the parameter name (of the reentrant 'yyparse' function) @@ -117,8 +117,8 @@ struct filter_node { } root; struct { enum ast_expt_type type; - enum ast_link_type post_op; /* reverse */ - enum ast_link_type pre_op; /* forward */ + enum ast_link_type post_op; /* reverse */ + enum ast_link_type pre_op; /* forward */ union { const char *string; uint64_t constant; @@ -169,17 +169,15 @@ struct filter_parser_ctx { struct filter_parser_ctx *filter_parser_ctx_alloc(FILE *input); void filter_parser_ctx_free(struct filter_parser_ctx *parser_ctx); int filter_parser_ctx_append_ast(struct filter_parser_ctx *parser_ctx); -int filter_parser_ctx_create_from_filter_expression( - const char *filter_expression, struct filter_parser_ctx **ctxp); +int filter_parser_ctx_create_from_filter_expression(const char *filter_expression, + struct filter_parser_ctx **ctxp); -static inline -struct filter_ast *filter_parser_get_ast(struct filter_parser_ctx *parser_ctx) +static inline struct filter_ast *filter_parser_get_ast(struct filter_parser_ctx *parser_ctx) { return parser_ctx->ast; } -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); int filter_visitor_ir_generate(struct filter_parser_ctx *ctx); void filter_ir_free(struct filter_parser_ctx *ctx); int filter_visitor_bytecode_generate(struct filter_parser_ctx *ctx); diff --git a/src/common/filter/filter-ir.hpp b/src/common/filter/filter-ir.hpp index 958f4e902..715f78eaa 100644 --- a/src/common/filter/filter-ir.hpp +++ b/src/common/filter/filter-ir.hpp @@ -20,21 +20,20 @@ enum ir_op_signedness { IR_SIGN_UNKNOWN = 0, IR_SIGNED, IR_UNSIGNED, - IR_SIGN_DYN, /* signedness determined dynamically */ + IR_SIGN_DYN, /* signedness determined dynamically */ }; enum ir_data_type { IR_DATA_UNKNOWN = 0, IR_DATA_STRING, - IR_DATA_NUMERIC, /* numeric and boolean */ + IR_DATA_NUMERIC, /* numeric and boolean */ IR_DATA_FLOAT, IR_DATA_FIELD_REF, IR_DATA_GET_CONTEXT_REF, IR_DATA_EXPRESSION, }; -static inline -const char *ir_data_type_str(enum ir_data_type type) +static inline const char *ir_data_type_str(enum ir_data_type type) { switch (type) { case IR_DATA_UNKNOWN: @@ -65,8 +64,7 @@ enum ir_op_type { IR_OP_LOGICAL, }; -static inline -const char *ir_op_type_str(enum ir_op_type type) +static inline const char *ir_op_type_str(enum ir_op_type type) { switch (type) { case IR_OP_UNKNOWN: @@ -117,8 +115,7 @@ enum ir_load_expression_type { IR_LOAD_EXPRESSION_LOAD_FIELD, }; -static inline -const char *ir_load_expression_type_str(enum ir_load_expression_type type) +static inline const char *ir_load_expression_type_str(enum ir_load_expression_type type) { switch (type) { case IR_LOAD_EXPRESSION_GET_CONTEXT_ROOT: diff --git a/src/common/filter/filter-symbols.hpp b/src/common/filter/filter-symbols.hpp index 27aaada54..acae7aafb 100644 --- a/src/common/filter/filter-symbols.hpp +++ b/src/common/filter/filter-symbols.hpp @@ -12,34 +12,34 @@ * */ -#define yy_create_buffer lttng_filter_yy_create_buffer -#define yy_delete_buffer lttng_filter_yy_delete_buffer -#define yy_flush_buffer lttng_filter_yy_flush_buffer -#define yy_scan_buffer lttng_filter_yy_scan_buffer -#define yy_scan_bytes lttng_filter_yy_scan_bytes -#define yy_scan_string lttng_filter_yy_scan_string +#define yy_create_buffer lttng_filter_yy_create_buffer +#define yy_delete_buffer lttng_filter_yy_delete_buffer +#define yy_flush_buffer lttng_filter_yy_flush_buffer +#define yy_scan_buffer lttng_filter_yy_scan_buffer +#define yy_scan_bytes lttng_filter_yy_scan_bytes +#define yy_scan_string lttng_filter_yy_scan_string #define yy_switch_to_buffer lttng_filter_yy_switch_to_buffer -#define yyalloc lttng_filter_yyalloc -#define yyfree lttng_filter_yyfree -#define yyget_column lttng_filter_yyget_column -#define yyget_debug lttng_filter_yyget_debug -#define yyget_extra lttng_filter_yyget_extra -#define yyget_in lttng_filter_yyget_in -#define yyget_leng lttng_filter_yyget_leng -#define yyget_lineno lttng_filter_yyget_lineno -#define yyget_lval lttng_filter_yyget_lval -#define yyget_out lttng_filter_yyget_out -#define yyget_text lttng_filter_yyget_text -#define yylex_init lttng_filter_yylex_init -#define yypop_buffer_state lttng_filter_yypop_buffer_state +#define yyalloc lttng_filter_yyalloc +#define yyfree lttng_filter_yyfree +#define yyget_column lttng_filter_yyget_column +#define yyget_debug lttng_filter_yyget_debug +#define yyget_extra lttng_filter_yyget_extra +#define yyget_in lttng_filter_yyget_in +#define yyget_leng lttng_filter_yyget_leng +#define yyget_lineno lttng_filter_yyget_lineno +#define yyget_lval lttng_filter_yyget_lval +#define yyget_out lttng_filter_yyget_out +#define yyget_text lttng_filter_yyget_text +#define yylex_init lttng_filter_yylex_init +#define yypop_buffer_state lttng_filter_yypop_buffer_state #define yypush_buffer_state lttng_filter_yypush_buffer_state -#define yyrealloc lttng_filter_yyrealloc -#define yyset_column lttng_filter_yyset_column -#define yyset_debug lttng_filter_yyset_debug -#define yyset_extra lttng_filter_yyset_extra -#define yyset_in lttng_filter_yyset_in -#define yyset_lineno lttng_filter_yyset_lineno -#define yyset_lval lttng_filter_yyset_lval -#define yyset_out lttng_filter_yyset_out +#define yyrealloc lttng_filter_yyrealloc +#define yyset_column lttng_filter_yyset_column +#define yyset_debug lttng_filter_yyset_debug +#define yyset_extra lttng_filter_yyset_extra +#define yyset_in lttng_filter_yyset_in +#define yyset_lineno lttng_filter_yyset_lineno +#define yyset_lval lttng_filter_yyset_lval +#define yyset_out lttng_filter_yyset_out #endif /* _FILTER_SYMBOLS_H */ diff --git a/src/common/filter/memstream.hpp b/src/common/filter/memstream.hpp index 26b124a95..4fbdc02fe 100644 --- a/src/common/filter/memstream.hpp +++ b/src/common/filter/memstream.hpp @@ -11,24 +11,23 @@ #ifdef LTTNG_HAVE_FMEMOPEN #include -static inline -FILE *lttng_fmemopen(void *buf, size_t size, const char *mode) +static inline FILE *lttng_fmemopen(void *buf, size_t size, const char *mode) { return fmemopen(buf, size, mode); } #else /* LTTNG_HAVE_FMEMOPEN */ -#include -#include #include +#include +#include + /* * Fallback for systems which don't have fmemopen. Copy buffer to a * temporary file, and use that file as FILE * input. */ -static inline -FILE *lttng_fmemopen(void *buf, size_t size, const char *mode) +static inline FILE *lttng_fmemopen(void *buf, size_t size, const char *mode) { char tmpname[PATH_MAX]; size_t len; diff --git a/src/common/format.hpp b/src/common/format.hpp index 67509c275..389bc596a 100644 --- a/src/common/format.hpp +++ b/src/common/format.hpp @@ -9,8 +9,8 @@ #include -#include #include +#include DIAGNOSTIC_PUSH DIAGNOSTIC_IGNORE_SUGGEST_ATTRIBUTE_FORMAT diff --git a/src/common/fs-handle.hpp b/src/common/fs-handle.hpp index 8b3a882a9..491db0a13 100644 --- a/src/common/fs-handle.hpp +++ b/src/common/fs-handle.hpp @@ -9,6 +9,7 @@ #define FS_HANDLE_H #include + #include struct fs_handle; diff --git a/src/common/hashtable/hashtable-symbols.hpp b/src/common/hashtable/hashtable-symbols.hpp index 5f22c0e82..5fd1cbe2b 100644 --- a/src/common/hashtable/hashtable-symbols.hpp +++ b/src/common/hashtable/hashtable-symbols.hpp @@ -12,22 +12,22 @@ * */ -#define _cds_lfht_new lttng__cds_lfht_new -#define cds_lfht_add lttng_cds_lfht_add -#define cds_lfht_add_replace lttng_cds_lfht_add_replace -#define cds_lfht_add_unique lttng_cds_lfht_add_unique -#define cds_lfht_count_nodes lttng_cds_lfht_count_nodes -#define cds_lfht_del lttng_cds_lfht_del -#define cds_lfht_destroy lttng_cds_lfht_destroy -#define cds_lfht_first lttng_cds_lfht_first -#define cds_lfht_fls_ulong lttng_cds_lfht_fls_ulong -#define cds_lfht_get_count_order_u32 lttng_cds_lfht_get_count_order_u32 +#define _cds_lfht_new lttng__cds_lfht_new +#define cds_lfht_add lttng_cds_lfht_add +#define cds_lfht_add_replace lttng_cds_lfht_add_replace +#define cds_lfht_add_unique lttng_cds_lfht_add_unique +#define cds_lfht_count_nodes lttng_cds_lfht_count_nodes +#define cds_lfht_del lttng_cds_lfht_del +#define cds_lfht_destroy lttng_cds_lfht_destroy +#define cds_lfht_first lttng_cds_lfht_first +#define cds_lfht_fls_ulong lttng_cds_lfht_fls_ulong +#define cds_lfht_get_count_order_u32 lttng_cds_lfht_get_count_order_u32 #define cds_lfht_get_count_order_ulong lttng_cds_lfht_get_count_order_ulong -#define cds_lfht_is_node_deleted lttng_cds_lfht_is_node_deleted -#define cds_lfht_lookup lttng_cds_lfht_lookup -#define cds_lfht_next lttng_cds_lfht_next -#define cds_lfht_next_duplicate lttng_cds_lfht_next_duplicate -#define cds_lfht_replace lttng_cds_lfht_replace -#define cds_lfht_resize lttng_cds_lfht_resize +#define cds_lfht_is_node_deleted lttng_cds_lfht_is_node_deleted +#define cds_lfht_lookup lttng_cds_lfht_lookup +#define cds_lfht_next lttng_cds_lfht_next +#define cds_lfht_next_duplicate lttng_cds_lfht_next_duplicate +#define cds_lfht_replace lttng_cds_lfht_replace +#define cds_lfht_resize lttng_cds_lfht_resize #endif /* _HASHTABLE_SYMBOLS_H */ diff --git a/src/common/hashtable/hashtable.hpp b/src/common/hashtable/hashtable.hpp index 1feab4d39..ac1af7eed 100644 --- a/src/common/hashtable/hashtable.hpp +++ b/src/common/hashtable/hashtable.hpp @@ -8,12 +8,13 @@ #ifndef _LTT_HT_H #define _LTT_HT_H -#include -#include -#include - #include + #include + +#include +#include +#include #include LTTNG_EXPORT extern unsigned long lttng_ht_seed; @@ -74,60 +75,47 @@ struct lttng_ht_node_two_u64 { struct lttng_ht *lttng_ht_new(unsigned long size, enum lttng_ht_type type); void lttng_ht_destroy(struct lttng_ht *ht); struct lttng_ht_deleter { - void operator()(lttng_ht *ht) { lttng_ht_destroy(ht); }; + void operator()(lttng_ht *ht) + { + lttng_ht_destroy(ht); + }; }; /* Specialized node init and free functions */ void lttng_ht_node_init_str(struct lttng_ht_node_str *node, char *key); -void lttng_ht_node_init_ulong(struct lttng_ht_node_ulong *node, - unsigned long key); -void lttng_ht_node_init_u64(struct lttng_ht_node_u64 *node, - uint64_t key); -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_ulong(struct lttng_ht_node_ulong *node, unsigned long key); +void lttng_ht_node_init_u64(struct lttng_ht_node_u64 *node, uint64_t key); +void lttng_ht_node_init_two_u64(struct lttng_ht_node_two_u64 *node, uint64_t key1, uint64_t key2); void lttng_ht_node_free_str(struct lttng_ht_node_str *node); void lttng_ht_node_free_ulong(struct lttng_ht_node_ulong *node); void lttng_ht_node_free_u64(struct lttng_ht_node_u64 *node); void lttng_ht_node_free_two_u64(struct lttng_ht_node_two_u64 *node); -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); /* Specialized add unique functions */ -void lttng_ht_add_unique_str(struct lttng_ht *ht, - struct lttng_ht_node_str *node); -void lttng_ht_add_unique_ulong(struct lttng_ht *ht, - struct lttng_ht_node_ulong *node); -void lttng_ht_add_unique_u64(struct lttng_ht *ht, - struct lttng_ht_node_u64 *node); -void lttng_ht_add_unique_two_u64(struct lttng_ht *ht, - struct lttng_ht_node_two_u64 *node); -struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong( - struct lttng_ht *ht, struct lttng_ht_node_ulong *node); -struct lttng_ht_node_u64 *lttng_ht_add_replace_u64( - struct lttng_ht *ht, struct lttng_ht_node_u64 *node); -void lttng_ht_add_str(struct lttng_ht *ht, - struct lttng_ht_node_str *node); -void lttng_ht_add_ulong(struct lttng_ht *ht, - struct lttng_ht_node_ulong *node); -void lttng_ht_add_u64(struct lttng_ht *ht, - struct lttng_ht_node_u64 *node); +void lttng_ht_add_unique_str(struct lttng_ht *ht, struct lttng_ht_node_str *node); +void lttng_ht_add_unique_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node); +void lttng_ht_add_unique_u64(struct lttng_ht *ht, struct lttng_ht_node_u64 *node); +void lttng_ht_add_unique_two_u64(struct lttng_ht *ht, struct lttng_ht_node_two_u64 *node); +struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong(struct lttng_ht *ht, + struct lttng_ht_node_ulong *node); +struct lttng_ht_node_u64 *lttng_ht_add_replace_u64(struct lttng_ht *ht, + struct lttng_ht_node_u64 *node); +void lttng_ht_add_str(struct lttng_ht *ht, struct lttng_ht_node_str *node); +void lttng_ht_add_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node); +void lttng_ht_add_u64(struct lttng_ht *ht, struct lttng_ht_node_u64 *node); int lttng_ht_del(struct lttng_ht *ht, struct lttng_ht_iter *iter); -void lttng_ht_get_first(struct lttng_ht *ht, - struct lttng_ht_iter *iter); +void lttng_ht_get_first(struct lttng_ht *ht, struct lttng_ht_iter *iter); void lttng_ht_get_next(struct lttng_ht *ht, struct lttng_ht_iter *iter); unsigned long lttng_ht_get_count(struct lttng_ht *ht); -struct lttng_ht_node_str *lttng_ht_iter_get_node_str( - struct lttng_ht_iter *iter); -struct lttng_ht_node_ulong *lttng_ht_iter_get_node_ulong( - struct lttng_ht_iter *iter); -struct lttng_ht_node_u64 *lttng_ht_iter_get_node_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 lttng_ht_node_str *lttng_ht_iter_get_node_str(struct lttng_ht_iter *iter); +struct lttng_ht_node_ulong *lttng_ht_iter_get_node_ulong(struct lttng_ht_iter *iter); +struct lttng_ht_node_u64 *lttng_ht_iter_get_node_u64(struct lttng_ht_iter *iter); +struct lttng_ht_node_two_u64 *lttng_ht_iter_get_node_two_u64(struct lttng_ht_iter *iter); #endif /* _LTT_HT_H */ diff --git a/src/common/index-allocator.hpp b/src/common/index-allocator.hpp index ee7c2ec75..2fa340412 100644 --- a/src/common/index-allocator.hpp +++ b/src/common/index-allocator.hpp @@ -8,9 +8,10 @@ #ifndef _COMMON_INDEX_ALLOCATOR_H #define _COMMON_INDEX_ALLOCATOR_H -#include #include +#include + struct lttng_index_allocator; enum lttng_index_allocator_status { @@ -22,37 +23,31 @@ enum lttng_index_allocator_status { /* * Create an index allocator of `index_count` slots. */ -extern "C" LTTNG_EXPORT -struct lttng_index_allocator *lttng_index_allocator_create( - uint64_t index_count); +extern "C" LTTNG_EXPORT struct lttng_index_allocator * +lttng_index_allocator_create(uint64_t index_count); /* * Get the number of indexes currently in use. */ -extern "C" LTTNG_EXPORT -uint64_t lttng_index_allocator_get_index_count( - struct lttng_index_allocator *allocator); +extern "C" LTTNG_EXPORT uint64_t +lttng_index_allocator_get_index_count(struct lttng_index_allocator *allocator); /* * Allocate (i.e. reserve) a slot. */ -extern "C" LTTNG_EXPORT -enum lttng_index_allocator_status lttng_index_allocator_alloc( - struct lttng_index_allocator *allocator, - uint64_t *index); +extern "C" LTTNG_EXPORT enum lttng_index_allocator_status +lttng_index_allocator_alloc(struct lttng_index_allocator *allocator, uint64_t *index); /* * Release a slot by index. The slot will be re-used by the index allocator * in future 'alloc' calls. */ -extern "C" LTTNG_EXPORT -enum lttng_index_allocator_status lttng_index_allocator_release( - struct lttng_index_allocator *allocator, uint64_t index); +extern "C" LTTNG_EXPORT enum lttng_index_allocator_status +lttng_index_allocator_release(struct lttng_index_allocator *allocator, uint64_t index); /* * Destroy an index allocator. */ -extern "C" LTTNG_EXPORT -void lttng_index_allocator_destroy(struct lttng_index_allocator *allocator); +extern "C" LTTNG_EXPORT void lttng_index_allocator_destroy(struct lttng_index_allocator *allocator); #endif /* _COMMON_INDEX_ALLOCATOR_H */ diff --git a/src/common/index/ctf-index.hpp b/src/common/index/ctf-index.hpp index 2b9bc5428..1d7839122 100644 --- a/src/common/index/ctf-index.hpp +++ b/src/common/index/ctf-index.hpp @@ -13,9 +13,9 @@ #include #include -#include #include #include +#include #define CTF_INDEX_MAGIC 0xC1F1DCC1 #define CTF_INDEX_MAJOR 1 @@ -38,16 +38,16 @@ struct ctf_packet_index_file_hdr { * All integer fields are stored in big endian. */ struct ctf_packet_index { - uint64_t offset; /* offset of the packet in the file, in bytes */ - uint64_t packet_size; /* packet size, in bits */ - uint64_t content_size; /* content size, in bits */ + uint64_t offset; /* offset of the packet in the file, in bytes */ + uint64_t packet_size; /* packet size, in bits */ + uint64_t content_size; /* content size, in bits */ uint64_t timestamp_begin; uint64_t timestamp_end; uint64_t events_discarded; - uint64_t stream_id; /* ID of the channel */ + uint64_t stream_id; /* ID of the channel */ /* CTF_INDEX 1.0 limit */ - uint64_t stream_instance_id; /* ID of the channel instance */ - uint64_t packet_seq_num; /* packet sequence number */ + uint64_t stream_instance_id; /* ID of the channel instance */ + uint64_t packet_seq_num; /* packet sequence number */ } __attribute__((__packed__)); static inline size_t ctf_packet_index_len(uint32_t major, uint32_t minor) @@ -55,13 +55,11 @@ static inline size_t ctf_packet_index_len(uint32_t major, uint32_t minor) if (major == 1) { switch (minor) { case 0: - return offsetof(struct ctf_packet_index, stream_id) - + member_sizeof(struct ctf_packet_index, - stream_id); + return offsetof(struct ctf_packet_index, stream_id) + + member_sizeof(struct ctf_packet_index, stream_id); case 1: - return offsetof(struct ctf_packet_index, packet_seq_num) - + member_sizeof(struct ctf_packet_index, - packet_seq_num); + return offsetof(struct ctf_packet_index, packet_seq_num) + + member_sizeof(struct ctf_packet_index, packet_seq_num); default: abort(); } @@ -70,7 +68,7 @@ static inline size_t ctf_packet_index_len(uint32_t major, uint32_t minor) } static inline uint32_t lttng_to_index_major(uint32_t lttng_major, - uint32_t lttng_minor __attribute__((unused))) + uint32_t lttng_minor __attribute__((unused))) { if (lttng_major == 2) { return 1; @@ -78,8 +76,7 @@ static inline uint32_t lttng_to_index_major(uint32_t lttng_major, abort(); } -static inline uint32_t lttng_to_index_minor(uint32_t lttng_major, - uint32_t lttng_minor) +static inline uint32_t lttng_to_index_minor(uint32_t lttng_major, uint32_t lttng_minor) { if (lttng_major == 2) { if (lttng_minor < 8) { @@ -91,16 +88,15 @@ static inline uint32_t lttng_to_index_minor(uint32_t lttng_major, abort(); } -static inline void ctf_packet_index_file_hdr_init( - struct ctf_packet_index_file_hdr *hdr, - uint32_t idx_major, uint32_t idx_minor) +static inline void ctf_packet_index_file_hdr_init(struct ctf_packet_index_file_hdr *hdr, + uint32_t idx_major, + uint32_t idx_minor) { memset(hdr, 0, sizeof(*hdr)); hdr->magic = htobe32(CTF_INDEX_MAGIC); hdr->index_major = htobe32(idx_major); hdr->index_minor = htobe32(idx_minor); - hdr->packet_index_len = htobe32( - ctf_packet_index_len(idx_major, idx_minor)); + hdr->packet_index_len = htobe32(ctf_packet_index_len(idx_major, idx_minor)); } #endif /* LTTNG_INDEX_H */ diff --git a/src/common/index/index.hpp b/src/common/index/index.hpp index 00d8203d3..8a6d4b3a0 100644 --- a/src/common/index/index.hpp +++ b/src/common/index/index.hpp @@ -10,13 +10,14 @@ #ifndef _INDEX_H #define _INDEX_H -#include -#include - #include "ctf-index.hpp" + #include #include +#include +#include + struct lttng_index_file { struct fs_handle *file; uint32_t major; @@ -30,24 +31,32 @@ struct lttng_index_file { * create and open have refcount of 1. Use put to decrement the * refcount. Destroys when reaching 0. Use "get" to increment refcount. */ -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_count, - 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_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(struct lttng_trace_chunk *chunk, + const char *channel_path, + const char *stream_name, + uint64_t stream_file_size, + uint64_t stream_count, + 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_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); int lttng_index_file_write(const struct lttng_index_file *index_file, - const struct ctf_packet_index *element); + const struct ctf_packet_index *element); int lttng_index_file_read(const struct lttng_index_file *index_file, - struct ctf_packet_index *element); + struct ctf_packet_index *element); void lttng_index_file_get(struct lttng_index_file *index_file); void lttng_index_file_put(struct lttng_index_file *index_file); diff --git a/src/common/ini-config/ini-config.hpp b/src/common/ini-config/ini-config.hpp index d1712489a..3e6c85187 100644 --- a/src/common/ini-config/ini-config.hpp +++ b/src/common/ini-config/ini-config.hpp @@ -41,8 +41,10 @@ using config_entry_handler_cb = int (*)(const struct config_entry *, void *); * Returns 0 on success. Negative values are error codes. If the return value * is positive, it represents the line number on which a parsing error occurred. */ -int config_get_section_entries(const char *path, const char *section, - config_entry_handler_cb handler, void *user_data); +int config_get_section_entries(const char *path, + const char *section, + config_entry_handler_cb handler, + void *user_data); /* * Parse a configuration value. diff --git a/src/common/kernel-consumer/kernel-consumer.hpp b/src/common/kernel-consumer/kernel-consumer.hpp index 7070cfaee..14e0140b3 100644 --- a/src/common/kernel-consumer/kernel-consumer.hpp +++ b/src/common/kernel-consumer/kernel-consumer.hpp @@ -10,21 +10,19 @@ #ifndef _LTTNG_KCONSUMER_H #define _LTTNG_KCONSUMER_H -#include #include +#include + int lttng_kconsumer_take_snapshot(struct lttng_consumer_stream *stream); -int lttng_kconsumer_sample_snapshot_positions( - struct lttng_consumer_stream *stream); -int lttng_kconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream, - unsigned long *pos); -int lttng_kconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream, - unsigned long *pos); +int lttng_kconsumer_sample_snapshot_positions(struct lttng_consumer_stream *stream); +int lttng_kconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos); +int lttng_kconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos); int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, - int sock, struct pollfd *consumer_sockpoll); + int sock, + struct pollfd *consumer_sockpoll); int lttng_kconsumer_on_recv_stream(struct lttng_consumer_stream *stream); int lttng_kconsumer_data_pending(struct lttng_consumer_stream *stream); -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); #endif /* _LTTNG_KCONSUMER_H */ diff --git a/src/common/kernel-ctl/kernel-ctl.hpp b/src/common/kernel-ctl/kernel-ctl.hpp index 4f47488b5..f3cfe38ce 100644 --- a/src/common/kernel-ctl/kernel-ctl.hpp +++ b/src/common/kernel-ctl/kernel-ctl.hpp @@ -9,12 +9,13 @@ #ifndef _LTTNG_KERNEL_CTL_H #define _LTTNG_KERNEL_CTL_H -#include +#include +#include +#include /* for struct lttng_filter_bytecode */ #include -#include -#include -#include /* for struct lttng_filter_bytecode */ + +#include int kernctl_create_session(int fd); int kernctl_open_metadata(int fd, struct lttng_channel_attr *chops); @@ -32,15 +33,14 @@ int kernctl_create_event_notifier_group(int fd); /* Apply on event notifier_group file descriptor. */ int kernctl_create_event_notifier_group_notification_fd(int fd); -int kernctl_create_event_notifier_group_error_counter(int fd, - const struct lttng_kernel_abi_counter_conf *error_counter_conf); +int kernctl_create_event_notifier_group_error_counter( + int fd, const struct lttng_kernel_abi_counter_conf *error_counter_conf); int kernctl_create_event_notifier(int fd, - const struct lttng_kernel_abi_event_notifier *event_notifier); + const struct lttng_kernel_abi_event_notifier *event_notifier); int kernctl_counter_get_aggregate_value(int counter_fd, - struct lttng_kernel_abi_counter_aggregate *value); -int kernctl_counter_clear(int counter_fd, - struct lttng_kernel_abi_counter_clear *clear); + struct lttng_kernel_abi_counter_aggregate *value); +int kernctl_counter_clear(int counter_fd, struct lttng_kernel_abi_counter_clear *clear); /* Apply on event file descriptor. */ int kernctl_filter(int fd, const struct lttng_bytecode *filter); @@ -65,8 +65,7 @@ int kernctl_wait_quiescent(int fd); * It returns 0 if OK, -1 on error. In all cases (error and OK), * @syscall_mask should be freed by the caller with free(3). */ -int kernctl_syscall_mask(int fd, char **syscall_mask, - uint32_t *nr_bits); +int kernctl_syscall_mask(int fd, char **syscall_mask, uint32_t *nr_bits); /* Process ID tracking can be applied to session file descriptor. */ int kernctl_track_pid(int fd, int pid); diff --git a/src/common/kernel-ctl/kernel-ioctl.hpp b/src/common/kernel-ctl/kernel-ioctl.hpp index 68bcc472c..45b01821a 100644 --- a/src/common/kernel-ctl/kernel-ioctl.hpp +++ b/src/common/kernel-ctl/kernel-ioctl.hpp @@ -9,207 +9,182 @@ #ifndef _LTT_KERNEL_IOCTL_H #define _LTT_KERNEL_IOCTL_H -#define LTTNG_KERNEL_ABI_MAJOR_VERSION 2 -#define LTTNG_KERNEL_ABI_MINOR_VERSION 6 +#define LTTNG_KERNEL_ABI_MAJOR_VERSION 2 +#define LTTNG_KERNEL_ABI_MINOR_VERSION 6 /* Get a snapshot of the current ring buffer producer and consumer positions */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT _IO(0xF6, 0x00) +#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT _IO(0xF6, 0x00) /* Get the consumer position (iteration start) */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_CONSUMED _IOR(0xF6, 0x01, unsigned long) +#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_CONSUMED _IOR(0xF6, 0x01, unsigned long) /* Get the producer position (iteration end) */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_PRODUCED _IOR(0xF6, 0x02, unsigned long) +#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_PRODUCED _IOR(0xF6, 0x02, unsigned long) /* Get exclusive read access to the specified sub-buffer position */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF _IOW(0xF6, 0x03, unsigned long) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF _IOW(0xF6, 0x03, unsigned long) /* Release exclusive sub-buffer access */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_PUT_SUBBUF _IO(0xF6, 0x04) +#define LTTNG_KERNEL_ABI_RING_BUFFER_PUT_SUBBUF _IO(0xF6, 0x04) /* Get exclusive read access to the next sub-buffer that can be read. */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF _IO(0xF6, 0x05) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF _IO(0xF6, 0x05) /* Release exclusive sub-buffer access, move consumer forward. */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_PUT_NEXT_SUBBUF _IO(0xF6, 0x06) +#define LTTNG_KERNEL_ABI_RING_BUFFER_PUT_NEXT_SUBBUF _IO(0xF6, 0x06) /* returns the size of the current sub-buffer, without padding (for mmap). */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF_SIZE _IOR(0xF6, 0x07, unsigned long) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF_SIZE _IOR(0xF6, 0x07, unsigned long) /* returns the size of the current sub-buffer, with padding (for splice). */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_PADDED_SUBBUF_SIZE _IOR(0xF6, 0x08, unsigned long) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_PADDED_SUBBUF_SIZE _IOR(0xF6, 0x08, unsigned long) /* returns the maximum size for sub-buffers. */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_MAX_SUBBUF_SIZE _IOR(0xF6, 0x09, unsigned long) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_MAX_SUBBUF_SIZE _IOR(0xF6, 0x09, unsigned long) /* returns the length to mmap. */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_LEN _IOR(0xF6, 0x0A, unsigned long) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_LEN _IOR(0xF6, 0x0A, unsigned long) /* returns the offset of the subbuffer belonging to the mmap reader. */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_READ_OFFSET _IOR(0xF6, 0x0B, unsigned long) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_READ_OFFSET _IOR(0xF6, 0x0B, unsigned long) /* Flush the current sub-buffer, if non-empty. */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH _IO(0xF6, 0x0C) +#define LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH _IO(0xF6, 0x0C) /* Get the current version of the metadata cache (after a get_next). */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_METADATA_VERSION _IOR(0xF6, 0x0D, uint64_t) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_METADATA_VERSION _IOR(0xF6, 0x0D, uint64_t) /* * Get a snapshot of the current ring buffer producer and consumer positions, * regardless of whether or not the two positions are contained within the same * sub-buffer. */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS _IO(0xF6, 0x0E) +#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS _IO(0xF6, 0x0E) /* Flush the current sub-buffer, even if empty. */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY _IO(0xF6, 0x0F) +#define LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY _IO(0xF6, 0x0F) /* * Reset the position of what has been consumed from the metadata cache to 0 * so it can be read again. */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_METADATA_CACHE_DUMP _IO(0xF6, 0x10) +#define LTTNG_KERNEL_ABI_RING_BUFFER_METADATA_CACHE_DUMP _IO(0xF6, 0x10) /* Clear ring buffer content */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_CLEAR _IO(0xF6, 0x11) +#define LTTNG_KERNEL_ABI_RING_BUFFER_CLEAR _IO(0xF6, 0x11) #define LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK _IOR(0xF6, 0x12, uint32_t) /* returns the timestamp begin of the current sub-buffer */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_BEGIN _IOR(0xF6, 0x20, uint64_t) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_BEGIN _IOR(0xF6, 0x20, uint64_t) /* returns the timestamp end of the current sub-buffer */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_END _IOR(0xF6, 0x21, uint64_t) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_END _IOR(0xF6, 0x21, uint64_t) /* returns the number of events discarded */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_EVENTS_DISCARDED _IOR(0xF6, 0x22, uint64_t) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_EVENTS_DISCARDED _IOR(0xF6, 0x22, uint64_t) /* returns the packet payload size */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_CONTENT_SIZE _IOR(0xF6, 0x23, uint64_t) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_CONTENT_SIZE _IOR(0xF6, 0x23, uint64_t) /* returns the actual packet size */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_PACKET_SIZE _IOR(0xF6, 0x24, uint64_t) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_PACKET_SIZE _IOR(0xF6, 0x24, uint64_t) /* returns the stream id */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_STREAM_ID _IOR(0xF6, 0x25, uint64_t) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_STREAM_ID _IOR(0xF6, 0x25, uint64_t) /* returns the current timestamp */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_CURRENT_TIMESTAMP _IOR(0xF6, 0x26, uint64_t) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_CURRENT_TIMESTAMP _IOR(0xF6, 0x26, uint64_t) /* returns the packet sequence number */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_SEQ_NUM _IOR(0xF6, 0x27, uint64_t) +#define LTTNG_KERNEL_ABI_RING_BUFFER_GET_SEQ_NUM _IOR(0xF6, 0x27, uint64_t) /* returns the stream instance id */ -#define LTTNG_KERNEL_ABI_RING_BUFFER_INSTANCE_ID _IOR(0xF6, 0x28, uint64_t) +#define LTTNG_KERNEL_ABI_RING_BUFFER_INSTANCE_ID _IOR(0xF6, 0x28, uint64_t) /* Old ABI (without support for 32/64 bits compat) */ /* LTTng file descriptor ioctl */ -#define LTTNG_KERNEL_ABI_OLD_SESSION _IO(0xF6, 0x40) -#define LTTNG_KERNEL_ABI_OLD_TRACER_VERSION \ - _IOR(0xF6, 0x41, struct lttng_kernel_abi_old_tracer_version) -#define LTTNG_KERNEL_ABI_OLD_TRACEPOINT_LIST _IO(0xF6, 0x42) -#define LTTNG_KERNEL_ABI_OLD_WAIT_QUIESCENT _IO(0xF6, 0x43) +#define LTTNG_KERNEL_ABI_OLD_SESSION _IO(0xF6, 0x40) +#define LTTNG_KERNEL_ABI_OLD_TRACER_VERSION \ + _IOR(0xF6, 0x41, struct lttng_kernel_abi_old_tracer_version) +#define LTTNG_KERNEL_ABI_OLD_TRACEPOINT_LIST _IO(0xF6, 0x42) +#define LTTNG_KERNEL_ABI_OLD_WAIT_QUIESCENT _IO(0xF6, 0x43) /* Session FD ioctl */ -#define LTTNG_KERNEL_ABI_OLD_METADATA \ - _IOW(0xF6, 0x50, struct lttng_kernel_abi_old_channel) -#define LTTNG_KERNEL_ABI_OLD_CHANNEL \ - _IOW(0xF6, 0x51, struct lttng_kernel_abi_old_channel) -#define LTTNG_KERNEL_ABI_OLD_SESSION_START _IO(0xF6, 0x52) -#define LTTNG_KERNEL_ABI_OLD_SESSION_STOP _IO(0xF6, 0x53) +#define LTTNG_KERNEL_ABI_OLD_METADATA _IOW(0xF6, 0x50, struct lttng_kernel_abi_old_channel) +#define LTTNG_KERNEL_ABI_OLD_CHANNEL _IOW(0xF6, 0x51, struct lttng_kernel_abi_old_channel) +#define LTTNG_KERNEL_ABI_OLD_SESSION_START _IO(0xF6, 0x52) +#define LTTNG_KERNEL_ABI_OLD_SESSION_STOP _IO(0xF6, 0x53) /* Channel FD ioctl */ -#define LTTNG_KERNEL_ABI_OLD_STREAM _IO(0xF6, 0x60) -#define LTTNG_KERNEL_ABI_OLD_EVENT \ - _IOW(0xF6, 0x61, struct lttng_kernel_abi_old_event) +#define LTTNG_KERNEL_ABI_OLD_STREAM _IO(0xF6, 0x60) +#define LTTNG_KERNEL_ABI_OLD_EVENT _IOW(0xF6, 0x61, struct lttng_kernel_abi_old_event) /* Event and Channel FD ioctl */ -#define LTTNG_KERNEL_ABI_OLD_CONTEXT \ - _IOW(0xF6, 0x70, struct lttng_kernel_abi_old_context) +#define LTTNG_KERNEL_ABI_OLD_CONTEXT _IOW(0xF6, 0x70, struct lttng_kernel_abi_old_context) /* Event, Channel and Session ioctl */ -#define LTTNG_KERNEL_ABI_OLD_ENABLE _IO(0xF6, 0x80) -#define LTTNG_KERNEL_ABI_OLD_DISABLE _IO(0xF6, 0x81) - +#define LTTNG_KERNEL_ABI_OLD_ENABLE _IO(0xF6, 0x80) +#define LTTNG_KERNEL_ABI_OLD_DISABLE _IO(0xF6, 0x81) /* Current ABI (with suport for 32/64 bits compat) */ /* LTTng file descriptor ioctl */ -#define LTTNG_KERNEL_ABI_SESSION _IO(0xF6, 0x45) -#define LTTNG_KERNEL_ABI_TRACER_VERSION \ - _IOR(0xF6, 0x46, struct lttng_kernel_abi_tracer_version) -#define LTTNG_KERNEL_ABI_TRACEPOINT_LIST _IO(0xF6, 0x47) -#define LTTNG_KERNEL_ABI_WAIT_QUIESCENT _IO(0xF6, 0x48) -#define LTTNG_KERNEL_ABI_SYSCALL_LIST _IO(0xF6, 0x4A) -#define LTTNG_KERNEL_ABI_TRACER_ABI_VERSION \ +#define LTTNG_KERNEL_ABI_SESSION _IO(0xF6, 0x45) +#define LTTNG_KERNEL_ABI_TRACER_VERSION _IOR(0xF6, 0x46, struct lttng_kernel_abi_tracer_version) +#define LTTNG_KERNEL_ABI_TRACEPOINT_LIST _IO(0xF6, 0x47) +#define LTTNG_KERNEL_ABI_WAIT_QUIESCENT _IO(0xF6, 0x48) +#define LTTNG_KERNEL_ABI_SYSCALL_LIST _IO(0xF6, 0x4A) +#define LTTNG_KERNEL_ABI_TRACER_ABI_VERSION \ _IOR(0xF6, 0x4B, struct lttng_kernel_abi_tracer_abi_version) -#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_CREATE \ - _IO(0xF6, 0x4C) +#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_CREATE _IO(0xF6, 0x4C) /* Session FD ioctl */ -#define LTTNG_KERNEL_ABI_METADATA \ - _IOW(0xF6, 0x54, struct lttng_kernel_abi_channel) -#define LTTNG_KERNEL_ABI_CHANNEL \ - _IOW(0xF6, 0x55, struct lttng_kernel_abi_channel) -#define LTTNG_KERNEL_ABI_SESSION_START _IO(0xF6, 0x56) -#define LTTNG_KERNEL_ABI_SESSION_STOP _IO(0xF6, 0x57) -#define LTTNG_KERNEL_ABI_SESSION_TRACK_PID \ - _IOW(0xF6, 0x58, int32_t) -#define LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID \ - _IOW(0xF6, 0x59, int32_t) +#define LTTNG_KERNEL_ABI_METADATA _IOW(0xF6, 0x54, struct lttng_kernel_abi_channel) +#define LTTNG_KERNEL_ABI_CHANNEL _IOW(0xF6, 0x55, struct lttng_kernel_abi_channel) +#define LTTNG_KERNEL_ABI_SESSION_START _IO(0xF6, 0x56) +#define LTTNG_KERNEL_ABI_SESSION_STOP _IO(0xF6, 0x57) +#define LTTNG_KERNEL_ABI_SESSION_TRACK_PID _IOW(0xF6, 0x58, int32_t) +#define LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID _IOW(0xF6, 0x59, int32_t) /* * ioctl 0x58 and 0x59 are duplicated here. It works, since _IOR vs _IO * are generating two different ioctl numbers, but this was not done on * purpose. We should generally try to avoid those duplications. */ -#define LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_PIDS _IO(0xF6, 0x58) -#define LTTNG_KERNEL_ABI_SESSION_METADATA_REGEN _IO(0xF6, 0x59) +#define LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_PIDS _IO(0xF6, 0x58) +#define LTTNG_KERNEL_ABI_SESSION_METADATA_REGEN _IO(0xF6, 0x59) /* 0x5A and 0x5B are reserved for a future ABI-breaking cleanup. */ -#define LTTNG_KERNEL_ABI_SESSION_STATEDUMP _IO(0xF6, 0x5C) -#define LTTNG_KERNEL_ABI_SESSION_SET_NAME \ - _IOW(0xF6, 0x5D, struct lttng_kernel_abi_session_name) -#define LTTNG_KERNEL_ABI_SESSION_SET_CREATION_TIME \ +#define LTTNG_KERNEL_ABI_SESSION_STATEDUMP _IO(0xF6, 0x5C) +#define LTTNG_KERNEL_ABI_SESSION_SET_NAME _IOW(0xF6, 0x5D, struct lttng_kernel_abi_session_name) +#define LTTNG_KERNEL_ABI_SESSION_SET_CREATION_TIME \ _IOW(0xF6, 0x5E, struct lttng_kernel_abi_session_creation_time) /* Channel FD ioctl */ -#define LTTNG_KERNEL_ABI_STREAM _IO(0xF6, 0x62) -#define LTTNG_KERNEL_ABI_EVENT \ - _IOW(0xF6, 0x63, struct lttng_kernel_abi_event) -#define LTTNG_KERNEL_ABI_SYSCALL_MASK \ - _IOWR(0xF6, 0x64, struct lttng_kernel_abi_syscall_mask) +#define LTTNG_KERNEL_ABI_STREAM _IO(0xF6, 0x62) +#define LTTNG_KERNEL_ABI_EVENT _IOW(0xF6, 0x63, struct lttng_kernel_abi_event) +#define LTTNG_KERNEL_ABI_SYSCALL_MASK _IOWR(0xF6, 0x64, struct lttng_kernel_abi_syscall_mask) /* Event and Channel FD ioctl */ -#define LTTNG_KERNEL_ABI_CONTEXT \ - _IOW(0xF6, 0x71, struct lttng_kernel_abi_context) +#define LTTNG_KERNEL_ABI_CONTEXT _IOW(0xF6, 0x71, struct lttng_kernel_abi_context) /* Event, event notifier, Channel and Session ioctl */ -#define LTTNG_KERNEL_ABI_ENABLE _IO(0xF6, 0x82) -#define LTTNG_KERNEL_ABI_DISABLE _IO(0xF6, 0x83) +#define LTTNG_KERNEL_ABI_ENABLE _IO(0xF6, 0x82) +#define LTTNG_KERNEL_ABI_DISABLE _IO(0xF6, 0x83) /* Event notifier group ioctl */ -#define LTTNG_KERNEL_ABI_COUNTER \ - _IOW(0xF6, 0x84, struct lttng_kernel_abi_counter_conf) +#define LTTNG_KERNEL_ABI_COUNTER _IOW(0xF6, 0x84, struct lttng_kernel_abi_counter_conf) /* Event and event notifier FD ioctl */ -#define LTTNG_KERNEL_ABI_FILTER _IO(0xF6, 0x90) -#define LTTNG_KERNEL_ABI_ADD_CALLSITE _IO(0xF6, 0x91) +#define LTTNG_KERNEL_ABI_FILTER _IO(0xF6, 0x90) +#define LTTNG_KERNEL_ABI_ADD_CALLSITE _IO(0xF6, 0x91) /* Session FD ioctl (continued) */ -#define LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_IDS \ +#define LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_IDS \ _IOW(0xF6, 0xA0, struct lttng_kernel_abi_tracker_args) -#define LTTNG_KERNEL_ABI_SESSION_TRACK_ID \ - _IOW(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args) -#define LTTNG_KERNEL_ABI_SESSION_UNTRACK_ID \ - _IOW(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args) +#define LTTNG_KERNEL_ABI_SESSION_TRACK_ID _IOW(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args) +#define LTTNG_KERNEL_ABI_SESSION_UNTRACK_ID _IOW(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args) /* Event notifier group file descriptor ioctl */ -#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_CREATE \ +#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_CREATE \ _IOW(0xF6, 0xB0, struct lttng_kernel_abi_event_notifier) -#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD \ - _IO(0xF6, 0xB1) +#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD _IO(0xF6, 0xB1) /* Event notifier file descriptor ioctl */ -#define LTTNG_KERNEL_ABI_CAPTURE _IO(0xF6, 0xB8) +#define LTTNG_KERNEL_ABI_CAPTURE _IO(0xF6, 0xB8) /* Counter file descriptor ioctl */ -#define LTTNG_KERNEL_ABI_COUNTER_READ \ - IOWR(0xF6, 0xC0, struct lttng_kernel_abi_counter_read) -#define LTTNG_KERNEL_ABI_COUNTER_AGGREGATE \ +#define LTTNG_KERNEL_ABI_COUNTER_READ IOWR(0xF6, 0xC0, struct lttng_kernel_abi_counter_read) +#define LTTNG_KERNEL_ABI_COUNTER_AGGREGATE \ _IOWR(0xF6, 0xC1, struct lttng_kernel_abi_counter_aggregate) -#define LTTNG_KERNEL_ABI_COUNTER_CLEAR \ - _IOW(0xF6, 0xC2, struct lttng_kernel_abi_counter_clear) +#define LTTNG_KERNEL_ABI_COUNTER_CLEAR _IOW(0xF6, 0xC2, struct lttng_kernel_abi_counter_clear) /* - * Those ioctl numbers use the wrong direction, but are kept for ABI backward - * compatibility. - */ - #define LTTNG_KERNEL_ABI_OLD_SESSION_SET_NAME \ - _IOR(0xF6, 0x5D, struct lttng_kernel_abi_session_name) - #define LTTNG_KERNEL_ABI_OLD_SESSION_SET_CREATION_TIME \ - _IOR(0xF6, 0x5E, struct lttng_kernel_abi_session_creation_time) - #define LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_PID \ - _IOW(0xF6, 0x58, int32_t) - #define LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_PID \ - _IOW(0xF6, 0x59, int32_t) - #define LTTNG_KERNEL_ABI_OLD_SESSION_LIST_TRACKER_IDS \ - _IOR(0xF6, 0xA0, struct lttng_kernel_abi_tracker_args) - #define LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_ID \ - _IOR(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args) - #define LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_ID \ - _IOR(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args) + * Those ioctl numbers use the wrong direction, but are kept for ABI backward + * compatibility. + */ +#define LTTNG_KERNEL_ABI_OLD_SESSION_SET_NAME _IOR(0xF6, 0x5D, struct lttng_kernel_abi_session_name) +#define LTTNG_KERNEL_ABI_OLD_SESSION_SET_CREATION_TIME \ + _IOR(0xF6, 0x5E, struct lttng_kernel_abi_session_creation_time) +#define LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_PID _IOW(0xF6, 0x58, int32_t) +#define LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_PID _IOW(0xF6, 0x59, int32_t) +#define LTTNG_KERNEL_ABI_OLD_SESSION_LIST_TRACKER_IDS \ + _IOR(0xF6, 0xA0, struct lttng_kernel_abi_tracker_args) +#define LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_ID _IOR(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args) +#define LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_ID \ + _IOR(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args) #endif /* _LTT_KERNEL_IOCTL_H */ diff --git a/src/common/locked-reference.hpp b/src/common/locked-reference.hpp index e0ff3f280..6ccfad70d 100644 --- a/src/common/locked-reference.hpp +++ b/src/common/locked-reference.hpp @@ -46,7 +46,7 @@ public: return _value; } - WrappedType* operator->() const + WrappedType *operator->() const { return &_value; } diff --git a/src/common/lttng-elf.hpp b/src/common/lttng-elf.hpp index 41dd49605..98c388f56 100644 --- a/src/common/lttng-elf.hpp +++ b/src/common/lttng-elf.hpp @@ -10,11 +10,12 @@ #include -extern "C" LTTNG_EXPORT -int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset); +extern "C" LTTNG_EXPORT int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset); -extern "C" LTTNG_EXPORT -int lttng_elf_get_sdt_probe_offsets(int fd, const char *provider_name, - const char *probe_name, uint64_t **offsets, uint32_t *nb_probe); +extern "C" LTTNG_EXPORT int lttng_elf_get_sdt_probe_offsets(int fd, + const char *provider_name, + const char *probe_name, + uint64_t **offsets, + uint32_t *nb_probe); -#endif /* _LTTNG_ELF_H */ +#endif /* _LTTNG_ELF_H */ diff --git a/src/common/lttng-kernel-old.hpp b/src/common/lttng-kernel-old.hpp index 4e13cb4a7..f746c3475 100644 --- a/src/common/lttng-kernel-old.hpp +++ b/src/common/lttng-kernel-old.hpp @@ -9,9 +9,10 @@ #ifndef _LTTNG_KERNEL_OLD_H #define _LTTNG_KERNEL_OLD_H -#include #include +#include + /* * LTTng DebugFS ABI structures. * @@ -26,8 +27,8 @@ struct lttng_kernel_abi_old_perf_counter_ctx { }; /* Event/Channel context */ -#define LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING1 16 -#define LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32)) +#define LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING1 16 +#define LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32)) struct lttng_kernel_abi_old_context { enum lttng_kernel_abi_context_type ctx; char padding[LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING1]; @@ -60,8 +61,8 @@ struct lttng_kernel_abi_old_function { char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; }; -#define LTTNG_KERNEL_ABI_OLD_EVENT_PADDING1 16 -#define LTTNG_KERNEL_ABI_OLD_EVENT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32)) +#define LTTNG_KERNEL_ABI_OLD_EVENT_PADDING1 16 +#define LTTNG_KERNEL_ABI_OLD_EVENT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32)) struct lttng_kernel_abi_old_event { char name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; enum lttng_kernel_abi_instrumentation instrumentation; @@ -87,12 +88,12 @@ struct lttng_kernel_abi_old_tracer_version { */ #define LTTNG_KERNEL_ABI_OLD_CHANNEL_PADDING1 ((LTTNG_SYMBOL_NAME_LEN + 32)) struct lttng_kernel_abi_old_channel { - int overwrite; /* 1: overwrite, 0: discard */ - uint64_t subbuf_size; /* bytes */ - uint64_t num_subbuf; /* power of 2 */ + int overwrite; /* 1: overwrite, 0: discard */ + uint64_t subbuf_size; /* bytes */ + uint64_t num_subbuf; /* power of 2 */ unsigned int switch_timer_interval; /* usec */ - unsigned int read_timer_interval; /* usec */ - enum lttng_event_output output; /* splice, mmap */ + unsigned int read_timer_interval; /* usec */ + enum lttng_event_output output; /* splice, mmap */ char padding[LTTNG_KERNEL_ABI_OLD_CHANNEL_PADDING1]; }; diff --git a/src/common/lttng-kernel.hpp b/src/common/lttng-kernel.hpp index 2de7ef810..ad8d03acf 100644 --- a/src/common/lttng-kernel.hpp +++ b/src/common/lttng-kernel.hpp @@ -9,16 +9,18 @@ #ifndef _LTTNG_KERNEL_H #define _LTTNG_KERNEL_H -#include #include #include + #include #include -#define LTTNG_KERNEL_ABI_SYM_NAME_LEN 256 -#define LTTNG_KERNEL_ABI_MAX_UPROBE_NUM 32 -#define LTTNG_KERNEL_ABI_SESSION_NAME_LEN 256 -#define LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN 26 +#include + +#define LTTNG_KERNEL_ABI_SYM_NAME_LEN 256 +#define LTTNG_KERNEL_ABI_MAX_UPROBE_NUM 32 +#define LTTNG_KERNEL_ABI_SESSION_NAME_LEN 256 +#define LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN 26 /* * LTTng DebugFS ABI structures. @@ -27,55 +29,55 @@ */ enum lttng_kernel_abi_instrumentation { - LTTNG_KERNEL_ABI_ALL = -1, /* Used within lttng-tools */ - LTTNG_KERNEL_ABI_TRACEPOINT = 0, - LTTNG_KERNEL_ABI_KPROBE = 1, - LTTNG_KERNEL_ABI_FUNCTION = 2, - LTTNG_KERNEL_ABI_KRETPROBE = 3, - LTTNG_KERNEL_ABI_NOOP = 4, /* not hooked */ - LTTNG_KERNEL_ABI_SYSCALL = 5, - LTTNG_KERNEL_ABI_UPROBE = 6, + LTTNG_KERNEL_ABI_ALL = -1, /* Used within lttng-tools */ + LTTNG_KERNEL_ABI_TRACEPOINT = 0, + LTTNG_KERNEL_ABI_KPROBE = 1, + LTTNG_KERNEL_ABI_FUNCTION = 2, + LTTNG_KERNEL_ABI_KRETPROBE = 3, + LTTNG_KERNEL_ABI_NOOP = 4, /* not hooked */ + LTTNG_KERNEL_ABI_SYSCALL = 5, + LTTNG_KERNEL_ABI_UPROBE = 6, }; enum lttng_kernel_abi_context_type { - LTTNG_KERNEL_ABI_CONTEXT_PID = 0, + LTTNG_KERNEL_ABI_CONTEXT_PID = 0, LTTNG_KERNEL_ABI_CONTEXT_PERF_CPU_COUNTER = 1, - LTTNG_KERNEL_ABI_CONTEXT_PROCNAME = 2, - LTTNG_KERNEL_ABI_CONTEXT_PRIO = 3, - LTTNG_KERNEL_ABI_CONTEXT_NICE = 4, - LTTNG_KERNEL_ABI_CONTEXT_VPID = 5, - LTTNG_KERNEL_ABI_CONTEXT_TID = 6, - LTTNG_KERNEL_ABI_CONTEXT_VTID = 7, - LTTNG_KERNEL_ABI_CONTEXT_PPID = 8, - LTTNG_KERNEL_ABI_CONTEXT_VPPID = 9, - LTTNG_KERNEL_ABI_CONTEXT_HOSTNAME = 10, - LTTNG_KERNEL_ABI_CONTEXT_CPU_ID = 11, - LTTNG_KERNEL_ABI_CONTEXT_INTERRUPTIBLE = 12, - LTTNG_KERNEL_ABI_CONTEXT_PREEMPTIBLE = 13, + LTTNG_KERNEL_ABI_CONTEXT_PROCNAME = 2, + LTTNG_KERNEL_ABI_CONTEXT_PRIO = 3, + LTTNG_KERNEL_ABI_CONTEXT_NICE = 4, + LTTNG_KERNEL_ABI_CONTEXT_VPID = 5, + LTTNG_KERNEL_ABI_CONTEXT_TID = 6, + LTTNG_KERNEL_ABI_CONTEXT_VTID = 7, + LTTNG_KERNEL_ABI_CONTEXT_PPID = 8, + LTTNG_KERNEL_ABI_CONTEXT_VPPID = 9, + LTTNG_KERNEL_ABI_CONTEXT_HOSTNAME = 10, + LTTNG_KERNEL_ABI_CONTEXT_CPU_ID = 11, + LTTNG_KERNEL_ABI_CONTEXT_INTERRUPTIBLE = 12, + LTTNG_KERNEL_ABI_CONTEXT_PREEMPTIBLE = 13, LTTNG_KERNEL_ABI_CONTEXT_NEED_RESCHEDULE = 14, - LTTNG_KERNEL_ABI_CONTEXT_MIGRATABLE = 15, + LTTNG_KERNEL_ABI_CONTEXT_MIGRATABLE = 15, LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_KERNEL = 16, - LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_USER = 17, - LTTNG_KERNEL_ABI_CONTEXT_CGROUP_NS = 18, - LTTNG_KERNEL_ABI_CONTEXT_IPC_NS = 19, - LTTNG_KERNEL_ABI_CONTEXT_MNT_NS = 20, - LTTNG_KERNEL_ABI_CONTEXT_NET_NS = 21, - LTTNG_KERNEL_ABI_CONTEXT_PID_NS = 22, - LTTNG_KERNEL_ABI_CONTEXT_USER_NS = 23, - LTTNG_KERNEL_ABI_CONTEXT_UTS_NS = 24, - LTTNG_KERNEL_ABI_CONTEXT_UID = 25, - LTTNG_KERNEL_ABI_CONTEXT_EUID = 26, - LTTNG_KERNEL_ABI_CONTEXT_SUID = 27, - LTTNG_KERNEL_ABI_CONTEXT_GID = 28, - LTTNG_KERNEL_ABI_CONTEXT_EGID = 29, - LTTNG_KERNEL_ABI_CONTEXT_SGID = 30, - LTTNG_KERNEL_ABI_CONTEXT_VUID = 31, - LTTNG_KERNEL_ABI_CONTEXT_VEUID = 32, - LTTNG_KERNEL_ABI_CONTEXT_VSUID = 33, - LTTNG_KERNEL_ABI_CONTEXT_VGID = 34, - LTTNG_KERNEL_ABI_CONTEXT_VEGID = 35, - LTTNG_KERNEL_ABI_CONTEXT_VSGID = 36, - LTTNG_KERNEL_ABI_CONTEXT_TIME_NS = 37, + LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_USER = 17, + LTTNG_KERNEL_ABI_CONTEXT_CGROUP_NS = 18, + LTTNG_KERNEL_ABI_CONTEXT_IPC_NS = 19, + LTTNG_KERNEL_ABI_CONTEXT_MNT_NS = 20, + LTTNG_KERNEL_ABI_CONTEXT_NET_NS = 21, + LTTNG_KERNEL_ABI_CONTEXT_PID_NS = 22, + LTTNG_KERNEL_ABI_CONTEXT_USER_NS = 23, + LTTNG_KERNEL_ABI_CONTEXT_UTS_NS = 24, + LTTNG_KERNEL_ABI_CONTEXT_UID = 25, + LTTNG_KERNEL_ABI_CONTEXT_EUID = 26, + LTTNG_KERNEL_ABI_CONTEXT_SUID = 27, + LTTNG_KERNEL_ABI_CONTEXT_GID = 28, + LTTNG_KERNEL_ABI_CONTEXT_EGID = 29, + LTTNG_KERNEL_ABI_CONTEXT_SGID = 30, + LTTNG_KERNEL_ABI_CONTEXT_VUID = 31, + LTTNG_KERNEL_ABI_CONTEXT_VEUID = 32, + LTTNG_KERNEL_ABI_CONTEXT_VSUID = 33, + LTTNG_KERNEL_ABI_CONTEXT_VGID = 34, + LTTNG_KERNEL_ABI_CONTEXT_VEGID = 35, + LTTNG_KERNEL_ABI_CONTEXT_VSGID = 36, + LTTNG_KERNEL_ABI_CONTEXT_TIME_NS = 37, }; /* Perf counter attributes */ @@ -86,8 +88,8 @@ struct lttng_kernel_abi_perf_counter_ctx { } LTTNG_PACKED; /* Event/Channel context */ -#define LTTNG_KERNEL_ABI_CONTEXT_PADDING1 16 -#define LTTNG_KERNEL_ABI_CONTEXT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32)) +#define LTTNG_KERNEL_ABI_CONTEXT_PADDING1 16 +#define LTTNG_KERNEL_ABI_CONTEXT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32)) struct lttng_kernel_abi_context { enum lttng_kernel_abi_context_type ctx; char padding[LTTNG_KERNEL_ABI_CONTEXT_PADDING1]; @@ -130,28 +132,28 @@ struct lttng_kernel_abi_event_callsite { } LTTNG_PACKED; enum lttng_kernel_abi_syscall_entryexit { - LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT = 0, - LTTNG_KERNEL_ABI_SYSCALL_ENTRY = 1, - LTTNG_KERNEL_ABI_SYSCALL_EXIT = 2, + LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT = 0, + LTTNG_KERNEL_ABI_SYSCALL_ENTRY = 1, + LTTNG_KERNEL_ABI_SYSCALL_EXIT = 2, }; enum lttng_kernel_abi_syscall_abi { - LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL = 0, + LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL = 0, LTTNG_KERNEL_ABI_SYSCALL_ABI_NATIVE = 1, LTTNG_KERNEL_ABI_SYSCALL_ABI_COMPAT = 2, }; enum lttng_kernel_abi_syscall_match { LTTNG_KERNEL_ABI_SYSCALL_MATCH_NAME = 0, - LTTNG_KERNEL_ABI_SYSCALL_MATCH_NR = 1, + LTTNG_KERNEL_ABI_SYSCALL_MATCH_NR = 1, }; struct lttng_kernel_abi_syscall { - uint8_t entryexit; /* enum lttng_kernel_abi_syscall_entryexit */ - uint8_t abi; /* enum lttng_kernel_abi_syscall_abi */ - uint8_t match; /* enum lttng_kernel_abi_syscall_match */ + uint8_t entryexit; /* enum lttng_kernel_abi_syscall_entryexit */ + uint8_t abi; /* enum lttng_kernel_abi_syscall_abi */ + uint8_t match; /* enum lttng_kernel_abi_syscall_match */ uint8_t padding; - uint32_t nr; /* For LTTNG_SYSCALL_MATCH_NR */ + uint32_t nr; /* For LTTNG_SYSCALL_MATCH_NR */ } LTTNG_PACKED; /* Function tracer */ @@ -159,8 +161,8 @@ struct lttng_kernel_abi_function { char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; } LTTNG_PACKED; -#define LTTNG_KERNEL_ABI_EVENT_PADDING1 8 -#define LTTNG_KERNEL_ABI_EVENT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32)) +#define LTTNG_KERNEL_ABI_EVENT_PADDING1 8 +#define LTTNG_KERNEL_ABI_EVENT_PADDING2 ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32)) struct lttng_kernel_abi_event { char name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; enum lttng_kernel_abi_instrumentation instrumentation; @@ -178,7 +180,7 @@ struct lttng_kernel_abi_event { } u; } LTTNG_PACKED; -#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_PADDING 32 +#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_PADDING 32 struct lttng_kernel_abi_event_notifier { struct lttng_kernel_abi_event event; uint64_t error_counter_idx; @@ -186,7 +188,7 @@ struct lttng_kernel_abi_event_notifier { char padding[LTTNG_KERNEL_ABI_EVENT_NOTIFIER_PADDING]; } LTTNG_PACKED; -#define LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX 4 +#define LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX 4 enum lttng_kernel_abi_counter_arithmetic { LTTNG_KERNEL_ABI_COUNTER_ARITHMETIC_MODULAR = 0, @@ -205,10 +207,10 @@ struct lttng_kernel_abi_counter_dimension { uint8_t has_overflow; } LTTNG_PACKED; -#define LTTNG_KERNEL_ABI_COUNTER_CONF_PADDING1 67 +#define LTTNG_KERNEL_ABI_COUNTER_CONF_PADDING1 67 struct lttng_kernel_abi_counter_conf { - uint32_t arithmetic; /* enum lttng_kernel_abi_counter_arithmetic */ - uint32_t bitness; /* enum lttng_kernel_abi_counter_bitness */ + uint32_t arithmetic; /* enum lttng_kernel_abi_counter_arithmetic */ + uint32_t bitness; /* enum lttng_kernel_abi_counter_bitness */ uint32_t number_dimensions; int64_t global_sum_step; struct lttng_kernel_abi_counter_dimension dimensions[LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX]; @@ -230,15 +232,15 @@ struct lttng_kernel_abi_counter_value { #define LTTNG_KERNEL_ABI_COUNTER_READ_PADDING 32 struct lttng_kernel_abi_counter_read { struct lttng_kernel_abi_counter_index index; - int32_t cpu; /* -1 for global counter, >= 0 for specific cpu. */ - struct lttng_kernel_abi_counter_value value; /* output */ + int32_t cpu; /* -1 for global counter, >= 0 for specific cpu. */ + struct lttng_kernel_abi_counter_value value; /* output */ char padding[LTTNG_KERNEL_ABI_COUNTER_READ_PADDING]; } LTTNG_PACKED; #define LTTNG_KERNEL_ABI_COUNTER_AGGREGATE_PADDING 32 struct lttng_kernel_abi_counter_aggregate { struct lttng_kernel_abi_counter_index index; - struct lttng_kernel_abi_counter_value value; /* output */ + struct lttng_kernel_abi_counter_value value; /* output */ char padding[LTTNG_KERNEL_ABI_COUNTER_AGGREGATE_PADDING]; } LTTNG_PACKED; @@ -255,7 +257,7 @@ struct lttng_kernel_abi_event_notifier_notification { char padding[LTTNG_KERNEL_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING]; } LTTNG_PACKED; -#define LTTNG_KERNEL_ABI_CAPTURE_BYTECODE_MAX_LEN 65536 +#define LTTNG_KERNEL_ABI_CAPTURE_BYTECODE_MAX_LEN 65536 struct lttng_kernel_abi_capture_bytecode { uint32_t len; uint32_t reloc_offset; @@ -275,7 +277,7 @@ struct lttng_kernel_abi_tracer_abi_version { } LTTNG_PACKED; struct lttng_kernel_abi_syscall_mask { - uint32_t len; /* in bits */ + uint32_t len; /* in bits */ char mask[LTTNG_FLEXIBLE_ARRAY_MEMBER_LENGTH]; } LTTNG_PACKED; @@ -284,17 +286,17 @@ struct lttng_kernel_abi_syscall_mask { */ #define LTTNG_KERNEL_ABI_CHANNEL_PADDING1 ((LTTNG_SYMBOL_NAME_LEN + 32)) struct lttng_kernel_abi_channel { - uint64_t subbuf_size; /* bytes */ - uint64_t num_subbuf; /* power of 2 */ + uint64_t subbuf_size; /* bytes */ + uint64_t num_subbuf; /* power of 2 */ unsigned int switch_timer_interval; /* usec */ - unsigned int read_timer_interval; /* usec */ - enum lttng_event_output output; /* splice, mmap */ + unsigned int read_timer_interval; /* usec */ + enum lttng_event_output output; /* splice, mmap */ - int overwrite; /* 1: overwrite, 0: discard */ + int overwrite; /* 1: overwrite, 0: discard */ char padding[LTTNG_KERNEL_ABI_CHANNEL_PADDING1]; } LTTNG_PACKED; -#define KERNEL_FILTER_BYTECODE_MAX_LEN 65536 +#define KERNEL_FILTER_BYTECODE_MAX_LEN 65536 struct lttng_kernel_abi_filter_bytecode { uint32_t len; uint32_t reloc_offset; @@ -317,14 +319,14 @@ struct lttng_kernel_abi_session_creation_time { } LTTNG_PACKED; enum lttng_kernel_abi_tracker_type { - LTTNG_KERNEL_ABI_TRACKER_UNKNOWN = -1, - - LTTNG_KERNEL_ABI_TRACKER_PID = 0, - LTTNG_KERNEL_ABI_TRACKER_VPID = 1, - LTTNG_KERNEL_ABI_TRACKER_UID = 2, - LTTNG_KERNEL_ABI_TRACKER_VUID = 3, - LTTNG_KERNEL_ABI_TRACKER_GID = 4, - LTTNG_KERNEL_ABI_TRACKER_VGID = 5, + LTTNG_KERNEL_ABI_TRACKER_UNKNOWN = -1, + + LTTNG_KERNEL_ABI_TRACKER_PID = 0, + LTTNG_KERNEL_ABI_TRACKER_VPID = 1, + LTTNG_KERNEL_ABI_TRACKER_UID = 2, + LTTNG_KERNEL_ABI_TRACKER_VUID = 3, + LTTNG_KERNEL_ABI_TRACKER_GID = 4, + LTTNG_KERNEL_ABI_TRACKER_VGID = 5, }; struct lttng_kernel_abi_tracker_args { diff --git a/src/common/macros.hpp b/src/common/macros.hpp index ff0d5bb93..f1d039a1f 100644 --- a/src/common/macros.hpp +++ b/src/common/macros.hpp @@ -11,12 +11,11 @@ #include +#include +#include #include #include #include - -#include -#include #include /* @@ -43,21 +42,20 @@ #ifdef NDEBUG /* -* Force usage of the assertion condition to prevent unused variable warnings -* when `assert()` are disabled by the `NDEBUG` definition. -*/ -# define LTTNG_ASSERT(_cond) ((void) sizeof((void) (_cond), 0)) + * Force usage of the assertion condition to prevent unused variable warnings + * when `assert()` are disabled by the `NDEBUG` definition. + */ +#define LTTNG_ASSERT(_cond) ((void) sizeof((void) (_cond), 0)) #else -# include -# define LTTNG_ASSERT(_cond) assert(_cond) +#include +#define LTTNG_ASSERT(_cond) assert(_cond) #endif /* * Memory allocation zeroed */ -static inline -void *zmalloc_internal(size_t size) +static inline void *zmalloc_internal(size_t size) { return calloc(1, size); } @@ -133,10 +131,10 @@ AllocatedType *malloc() * Malloc a buffer of size `size`, asserting that AllocatedType can be safely * malloc-ed (is trivially constructible). */ -template +template AllocatedType *malloc(size_t size) { - static_assert (can_malloc::value, "type can be malloc'ed"); + static_assert(can_malloc::value, "type can be malloc'ed"); return (AllocatedType *) malloc(size); } @@ -153,9 +151,8 @@ AllocatedType *malloc(size_t size) * pointers to void, these will not be checked. */ -template -struct can_free -{ +template +struct can_free { /* * gcc versions before 5.0 lack some type traits defined in C++11. * Since in this instance we use the trait to prevent misuses @@ -185,9 +182,8 @@ template ::value>::type> void *memset(InitializedType *s, int c, size_t n) = delete; -template -struct can_memcpy -{ +template +struct can_memcpy { /* * gcc versions before 5.0 lack some type traits defined in C++11. * Since in this instance we use the trait to prevent misuses @@ -233,7 +229,7 @@ template field) +#define member_sizeof(type, field) sizeof(((type *) 0)->field) -#define ASSERT_LOCKED(lock) LTTNG_ASSERT(pthread_mutex_trylock(&(lock))) -#define ASSERT_RCU_READ_LOCKED() LTTNG_ASSERT(rcu_read_ongoing()) +#define ASSERT_LOCKED(lock) LTTNG_ASSERT(pthread_mutex_trylock(&(lock))) +#define ASSERT_RCU_READ_LOCKED() LTTNG_ASSERT(rcu_read_ongoing()) #define ASSERT_RCU_READ_UNLOCKED() LTTNG_ASSERT(!rcu_read_ongoing()) /* Attribute suitable to tag functions as having printf()-like arguments. */ @@ -259,39 +255,36 @@ void *memmove(DestinationType *d, const SourceType *s, size_t n) = delete; __attribute__((format(printf, _string_index, _first_to_check))) /* Attribute suitable to tag functions as having strftime()-like arguments. */ -#define ATTR_FORMAT_STRFTIME(_string_index) \ - __attribute__((format(strftime, _string_index, 0))) +#define ATTR_FORMAT_STRFTIME(_string_index) __attribute__((format(strftime, _string_index, 0))) /* Macros used to ignore specific compiler diagnostics. */ #define DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") -#define DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") +#define DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") #if defined(__clang__) - /* Clang */ -# define DIAGNOSTIC_IGNORE_SUGGEST_ATTRIBUTE_FORMAT -# define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \ +/* Clang */ +#define DIAGNOSTIC_IGNORE_SUGGEST_ATTRIBUTE_FORMAT +#define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \ _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") -# define DIAGNOSTIC_IGNORE_LOGICAL_OP -# define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES -# define DIAGNOSTIC_IGNORE_INVALID_OFFSETOF - _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"") +#define DIAGNOSTIC_IGNORE_LOGICAL_OP +#define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES +#define DIAGNOSTIC_IGNORE_INVALID_OFFSETOF +_Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"") #else - /* GCC */ -# define DIAGNOSTIC_IGNORE_SUGGEST_ATTRIBUTE_FORMAT \ +/* GCC */ +#define DIAGNOSTIC_IGNORE_SUGGEST_ATTRIBUTE_FORMAT \ _Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=format\"") -# define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \ +#define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \ _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") -# define DIAGNOSTIC_IGNORE_LOGICAL_OP \ - _Pragma("GCC diagnostic ignored \"-Wlogical-op\"") +#define DIAGNOSTIC_IGNORE_LOGICAL_OP _Pragma("GCC diagnostic ignored \"-Wlogical-op\"") #if __GNUG__ && __GNUC__ >= 7 -# define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES \ +#define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES \ _Pragma("GCC diagnostic ignored \"-Wduplicated-branches\"") #else -# define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES +#define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES #endif /* __GNUG__ && __GNUC__ >= 7 */ -# define DIAGNOSTIC_IGNORE_INVALID_OFFSETOF \ - _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"") +#define DIAGNOSTIC_IGNORE_INVALID_OFFSETOF _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"") #endif /* Used to make specific C++ functions to C code. */ @@ -301,17 +294,16 @@ void *memmove(DestinationType *d, const SourceType *s, size_t n) = delete; #define C_LINKAGE #endif -/* - * lttng_strncpy returns 0 on success, or nonzero on failure. - * It checks that the @src string fits into @dst_len before performing - * the copy. On failure, no copy has been performed. - * - * Assumes that 'src' is null-terminated. - * - * dst_len includes the string's trailing NULL. - */ -static inline -int lttng_strncpy(char *dst, const char *src, size_t dst_len) + /* + * lttng_strncpy returns 0 on success, or nonzero on failure. + * It checks that the @src string fits into @dst_len before performing + * the copy. On failure, no copy has been performed. + * + * Assumes that 'src' is null-terminated. + * + * dst_len includes the string's trailing NULL. + */ + static inline int lttng_strncpy(char *dst, const char *src, size_t dst_len) { if (strlen(src) >= dst_len) { /* Fail since copying would result in truncation. */ diff --git a/src/common/make-unique-wrapper.hpp b/src/common/make-unique-wrapper.hpp index 50d1916f2..9381ce971 100644 --- a/src/common/make-unique-wrapper.hpp +++ b/src/common/make-unique-wrapper.hpp @@ -38,8 +38,7 @@ namespace lttng { * a proper, idiomatic, wrapper. */ -namespace details -{ +namespace details { template struct create_unique_class { struct deleter { @@ -69,7 +68,8 @@ void free(Type *ptr) } template -std::unique_ptr::deleter> +std::unique_ptr::deleter> make_unique_wrapper(WrappedType *instance) { const details::create_unique_class unique_deleter; diff --git a/src/common/mi-lttng.hpp b/src/common/mi-lttng.hpp index c4ccf9414..d6d9db944 100644 --- a/src/common/mi-lttng.hpp +++ b/src/common/mi-lttng.hpp @@ -9,13 +9,14 @@ #ifndef _MI_LTTNG_H #define _MI_LTTNG_H -#include - +#include #include #include -#include + #include +#include + /* Don't want to reference snapshot-internal.h here */ struct lttng_snapshot_output; @@ -55,190 +56,188 @@ struct mi_lttng_error_query_callbacks { }; /* Strings related to command */ -LTTNG_EXPORT extern const char * const mi_lttng_element_command; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_action; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_add_context; -extern const char * const mi_lttng_element_command_add_trigger; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_create; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_destroy; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_disable_channel; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_disable_event; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_enable_channels; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_enable_event; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_list; -extern const char * const mi_lttng_element_command_list_trigger; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_load; -extern const char * const mi_lttng_element_command_metadata; -extern const char * const mi_lttng_element_command_metadata_action; -extern const char * const mi_lttng_element_command_regenerate; -extern const char * const mi_lttng_element_command_regenerate_action; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_name; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_output; -extern const char * const mi_lttng_element_command_remove_trigger; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_save; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_set_session; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_snapshot; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_snapshot_add; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_snapshot_del; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_snapshot_list; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_snapshot_record; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_start; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_stop; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_success; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_track; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_untrack; -LTTNG_EXPORT extern const char * const mi_lttng_element_command_version; -extern const char * const mi_lttng_element_command_rotate; -extern const char * const mi_lttng_element_command_enable_rotation; -extern const char * const mi_lttng_element_command_disable_rotation; -extern const char * const mi_lttng_element_command_clear; +LTTNG_EXPORT extern const char *const mi_lttng_element_command; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_action; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_add_context; +extern const char *const mi_lttng_element_command_add_trigger; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_create; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_destroy; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_disable_channel; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_disable_event; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_enable_channels; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_enable_event; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_list; +extern const char *const mi_lttng_element_command_list_trigger; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_load; +extern const char *const mi_lttng_element_command_metadata; +extern const char *const mi_lttng_element_command_metadata_action; +extern const char *const mi_lttng_element_command_regenerate; +extern const char *const mi_lttng_element_command_regenerate_action; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_name; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_output; +extern const char *const mi_lttng_element_command_remove_trigger; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_save; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_set_session; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_snapshot; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_snapshot_add; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_snapshot_del; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_snapshot_list; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_snapshot_record; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_start; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_stop; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_success; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_track; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_untrack; +LTTNG_EXPORT extern const char *const mi_lttng_element_command_version; +extern const char *const mi_lttng_element_command_rotate; +extern const char *const mi_lttng_element_command_enable_rotation; +extern const char *const mi_lttng_element_command_disable_rotation; +extern const char *const mi_lttng_element_command_clear; /* Strings related to version command */ -LTTNG_EXPORT extern const char * const mi_lttng_element_version; -LTTNG_EXPORT extern const char * const mi_lttng_element_version_commit; -LTTNG_EXPORT extern const char * const mi_lttng_element_version_description; -LTTNG_EXPORT extern const char * const mi_lttng_element_version_license; -LTTNG_EXPORT extern const char * const mi_lttng_element_version_major; -LTTNG_EXPORT extern const char * const mi_lttng_element_version_minor; -LTTNG_EXPORT extern const char * const mi_lttng_element_version_patch_level; -LTTNG_EXPORT extern const char * const mi_lttng_element_version_str; -LTTNG_EXPORT extern const char * const mi_lttng_element_version_web; +LTTNG_EXPORT extern const char *const mi_lttng_element_version; +LTTNG_EXPORT extern const char *const mi_lttng_element_version_commit; +LTTNG_EXPORT extern const char *const mi_lttng_element_version_description; +LTTNG_EXPORT extern const char *const mi_lttng_element_version_license; +LTTNG_EXPORT extern const char *const mi_lttng_element_version_major; +LTTNG_EXPORT extern const char *const mi_lttng_element_version_minor; +LTTNG_EXPORT extern const char *const mi_lttng_element_version_patch_level; +LTTNG_EXPORT extern const char *const mi_lttng_element_version_str; +LTTNG_EXPORT extern const char *const mi_lttng_element_version_web; /* String related to a lttng_event_field */ -LTTNG_EXPORT extern const char * const mi_lttng_element_event_field; -LTTNG_EXPORT extern const char * const mi_lttng_element_event_fields; +LTTNG_EXPORT extern const char *const mi_lttng_element_event_field; +LTTNG_EXPORT extern const char *const mi_lttng_element_event_fields; /* String related to lttng_event_perf_counter_ctx */ -LTTNG_EXPORT extern const char * const mi_lttng_element_perf_counter_context; +LTTNG_EXPORT extern const char *const mi_lttng_element_perf_counter_context; /* Strings related to pid */ -LTTNG_EXPORT extern const char * const mi_lttng_element_pid_id; +LTTNG_EXPORT extern const char *const mi_lttng_element_pid_id; /* Strings related to save command */ -LTTNG_EXPORT extern const char * const mi_lttng_element_save; +LTTNG_EXPORT extern const char *const mi_lttng_element_save; /* Strings related to load command */ -LTTNG_EXPORT extern const char * const mi_lttng_element_load; -extern const char * const mi_lttng_element_load_overrides; -extern const char * const mi_lttng_element_load_override_url; +LTTNG_EXPORT extern const char *const mi_lttng_element_load; +extern const char *const mi_lttng_element_load_overrides; +extern const char *const mi_lttng_element_load_override_url; /* General element of mi_lttng */ -LTTNG_EXPORT extern const char * const mi_lttng_element_empty; -LTTNG_EXPORT extern const char * const mi_lttng_element_id; -LTTNG_EXPORT extern const char * const mi_lttng_element_nowrite; -LTTNG_EXPORT extern const char * const mi_lttng_element_success; -LTTNG_EXPORT extern const char * const mi_lttng_element_type_enum; -LTTNG_EXPORT extern const char * const mi_lttng_element_type_float; -LTTNG_EXPORT extern const char * const mi_lttng_element_type_integer; -LTTNG_EXPORT extern const char * const mi_lttng_element_type_other; -LTTNG_EXPORT extern const char * const mi_lttng_element_type_string; +LTTNG_EXPORT extern const char *const mi_lttng_element_empty; +LTTNG_EXPORT extern const char *const mi_lttng_element_id; +LTTNG_EXPORT extern const char *const mi_lttng_element_nowrite; +LTTNG_EXPORT extern const char *const mi_lttng_element_success; +LTTNG_EXPORT extern const char *const mi_lttng_element_type_enum; +LTTNG_EXPORT extern const char *const mi_lttng_element_type_float; +LTTNG_EXPORT extern const char *const mi_lttng_element_type_integer; +LTTNG_EXPORT extern const char *const mi_lttng_element_type_other; +LTTNG_EXPORT extern const char *const mi_lttng_element_type_string; /* String related to loglevel */ -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_alert; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_crit; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_function; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_line; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_module; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_process; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_program; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_system; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_debug_unit; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_emerg; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_err; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_info; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_notice; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_unknown; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_warning; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_alert; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_crit; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_debug; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_debug_function; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_debug_line; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_debug_module; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_debug_process; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_debug_program; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_debug_system; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_debug_unit; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_emerg; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_err; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_info; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_notice; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_unknown; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_warning; /* String related to loglevel JUL */ -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_all; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_config; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_fine; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_finer; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_finest; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_info; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_off; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_severe; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_jul_warning; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_jul_all; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_jul_config; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_jul_fine; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_jul_finer; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_jul_finest; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_jul_info; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_jul_off; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_jul_severe; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_jul_warning; /* String related to loglevel Log4j */ -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_off; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_fatal; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_error; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_warn; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_info; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_debug; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_trace; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_log4j_all; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_log4j_off; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_log4j_fatal; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_log4j_error; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_log4j_warn; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_log4j_info; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_log4j_debug; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_log4j_trace; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_log4j_all; /* String related to loglevel Python */ -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_python_critical; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_python_error; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_python_warning; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_python_info; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_python_debug; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_str_python_notset; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_python_critical; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_python_error; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_python_warning; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_python_info; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_python_debug; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_str_python_notset; /* String related to loglevel type */ -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_type_all; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_type_range; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_type_single; -LTTNG_EXPORT extern const char * const mi_lttng_loglevel_type_unknown; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_type_all; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_type_range; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_type_single; +LTTNG_EXPORT extern const char *const mi_lttng_loglevel_type_unknown; /* String related to a lttng_snapshot */ -LTTNG_EXPORT extern const char * const mi_lttng_element_snapshot_ctrl_url; -LTTNG_EXPORT extern const char * const mi_lttng_element_snapshot_data_url; -LTTNG_EXPORT extern const char * const mi_lttng_element_snapshot_max_size; -LTTNG_EXPORT extern const char * const mi_lttng_element_snapshot_n_ptr; -LTTNG_EXPORT extern const char * const mi_lttng_element_snapshot_session_name; -LTTNG_EXPORT extern const char * const mi_lttng_element_snapshots; +LTTNG_EXPORT extern const char *const mi_lttng_element_snapshot_ctrl_url; +LTTNG_EXPORT extern const char *const mi_lttng_element_snapshot_data_url; +LTTNG_EXPORT extern const char *const mi_lttng_element_snapshot_max_size; +LTTNG_EXPORT extern const char *const mi_lttng_element_snapshot_n_ptr; +LTTNG_EXPORT extern const char *const mi_lttng_element_snapshot_session_name; +LTTNG_EXPORT extern const char *const mi_lttng_element_snapshots; /* String related to track/untrack command */ -LTTNG_EXPORT extern const char * const mi_lttng_element_track_untrack_all_wildcard; +LTTNG_EXPORT extern const char *const mi_lttng_element_track_untrack_all_wildcard; -extern const char * const mi_lttng_element_session_name; +extern const char *const mi_lttng_element_session_name; /* String related to rotate command */ -extern const char * const mi_lttng_element_rotation; -extern const char * const mi_lttng_element_rotate_status; -extern const char * const mi_lttng_element_rotation_schedule; -extern const char * const mi_lttng_element_rotation_schedules; -extern const char * const mi_lttng_element_rotation_schedule_periodic; -extern const char * const mi_lttng_element_rotation_schedule_periodic_time_us; -extern const char * const mi_lttng_element_rotation_schedule_size_threshold; -extern const char * const mi_lttng_element_rotation_schedule_size_threshold_bytes; -extern const char * const mi_lttng_element_rotation_schedule_result; -extern const char * const mi_lttng_element_rotation_schedule_results; -extern const char * const mi_lttng_element_rotation_state; -extern const char * const mi_lttng_element_rotation_location; -extern const char * const mi_lttng_element_rotation_location_local; -extern const char * const mi_lttng_element_rotation_location_local_absolute_path; -extern const char * const mi_lttng_element_rotation_location_relay; -extern const char * const mi_lttng_element_rotation_location_relay_host; -extern const char * const mi_lttng_element_rotation_location_relay_control_port; -extern const char * const mi_lttng_element_rotation_location_relay_data_port; -extern const char * const mi_lttng_element_rotation_location_relay_protocol; -extern const char * const mi_lttng_element_rotation_location_relay_relative_path; +extern const char *const mi_lttng_element_rotation; +extern const char *const mi_lttng_element_rotate_status; +extern const char *const mi_lttng_element_rotation_schedule; +extern const char *const mi_lttng_element_rotation_schedules; +extern const char *const mi_lttng_element_rotation_schedule_periodic; +extern const char *const mi_lttng_element_rotation_schedule_periodic_time_us; +extern const char *const mi_lttng_element_rotation_schedule_size_threshold; +extern const char *const mi_lttng_element_rotation_schedule_size_threshold_bytes; +extern const char *const mi_lttng_element_rotation_schedule_result; +extern const char *const mi_lttng_element_rotation_schedule_results; +extern const char *const mi_lttng_element_rotation_state; +extern const char *const mi_lttng_element_rotation_location; +extern const char *const mi_lttng_element_rotation_location_local; +extern const char *const mi_lttng_element_rotation_location_local_absolute_path; +extern const char *const mi_lttng_element_rotation_location_relay; +extern const char *const mi_lttng_element_rotation_location_relay_host; +extern const char *const mi_lttng_element_rotation_location_relay_control_port; +extern const char *const mi_lttng_element_rotation_location_relay_data_port; +extern const char *const mi_lttng_element_rotation_location_relay_protocol; +extern const char *const mi_lttng_element_rotation_location_relay_relative_path; /* String related to enum lttng_rotation_state */ -extern const char * const mi_lttng_rotation_state_str_ongoing; -extern const char * const mi_lttng_rotation_state_str_completed; -extern const char * const mi_lttng_rotation_state_str_expired; -extern const char * const mi_lttng_rotation_state_str_error; +extern const char *const mi_lttng_rotation_state_str_ongoing; +extern const char *const mi_lttng_rotation_state_str_completed; +extern const char *const mi_lttng_rotation_state_str_expired; +extern const char *const mi_lttng_rotation_state_str_error; /* String related to enum lttng_trace_archive_location_relay_protocol_type */ -extern const char * const mi_lttng_rotation_location_relay_protocol_str_tcp; +extern const char *const mi_lttng_rotation_location_relay_protocol_str_tcp; /* String related to rate_policy elements */ extern const char *const mi_lttng_element_rate_policy; extern const char *const mi_lttng_element_rate_policy_every_n; extern const char *const mi_lttng_element_rate_policy_once_after_n; -extern const char - *const mi_lttng_element_rate_policy_every_n_interval; -extern const char - *const mi_lttng_element_rate_policy_once_after_n_threshold; +extern const char *const mi_lttng_element_rate_policy_every_n_interval; +extern const char *const mi_lttng_element_rate_policy_once_after_n_threshold; /* String related to action elements */ extern const char *const mi_lttng_element_action; @@ -248,25 +247,17 @@ extern const char *const mi_lttng_element_action_start_session; extern const char *const mi_lttng_element_action_stop_session; extern const char *const mi_lttng_element_action_rotate_session; extern const char *const mi_lttng_element_action_snapshot_session; -extern const char - *const mi_lttng_element_action_snapshot_session_output; +extern const char *const mi_lttng_element_action_snapshot_session_output; /* String related to condition */ extern const char *const mi_lttng_element_condition; -extern const char - *const mi_lttng_element_condition_buffer_usage_high; -extern const char - *const mi_lttng_element_condition_buffer_usage_low; -extern const char - *const mi_lttng_element_condition_event_rule_matches; -extern const char - *const mi_lttng_element_condition_session_consumed_size; -extern const char - *const mi_lttng_element_condition_session_rotation; -extern const char - *const mi_lttng_element_condition_session_rotation_completed; -extern const char - *const mi_lttng_element_condition_session_rotation_ongoing; +extern const char *const mi_lttng_element_condition_buffer_usage_high; +extern const char *const mi_lttng_element_condition_buffer_usage_low; +extern const char *const mi_lttng_element_condition_event_rule_matches; +extern const char *const mi_lttng_element_condition_session_consumed_size; +extern const char *const mi_lttng_element_condition_session_rotation; +extern const char *const mi_lttng_element_condition_session_rotation_completed; +extern const char *const mi_lttng_element_condition_session_rotation_ongoing; extern const char *const mi_lttng_element_condition_channel_name; extern const char *const mi_lttng_element_condition_threshold_ratio; extern const char *const mi_lttng_element_condition_threshold_bytes; @@ -278,12 +269,9 @@ extern const char *const mi_lttng_element_capture_descriptors; /* String related to event expression */ extern const char *const mi_lttng_element_event_expr; extern const char *const mi_lttng_element_event_expr_payload_field; -extern const char - *const mi_lttng_element_event_expr_channel_context_field; -extern const char - *const mi_lttng_element_event_expr_app_specific_context_field; -extern const char - *const mi_lttng_element_event_expr_array_field_element; +extern const char *const mi_lttng_element_event_expr_channel_context_field; +extern const char *const mi_lttng_element_event_expr_app_specific_context_field; +extern const char *const mi_lttng_element_event_expr_array_field_element; extern const char *const mi_lttng_element_event_expr_provider_name; extern const char *const mi_lttng_element_event_expr_type_name; @@ -295,87 +283,59 @@ extern const char *const mi_lttng_element_event_rule; /* String related to lttng_event_rule */ extern const char *const mi_lttng_element_event_rule_event_name; extern const char *const mi_lttng_element_event_rule_name_pattern; -extern const char - *const mi_lttng_element_event_rule_filter_expression; +extern const char *const mi_lttng_element_event_rule_filter_expression; extern const char *const mi_lttng_element_event_rule_jul_logging; extern const char *const mi_lttng_element_event_rule_kernel_kprobe; extern const char *const mi_lttng_element_event_rule_kernel_syscall; -extern const char - *const mi_lttng_element_event_rule_kernel_tracepoint; +extern const char *const mi_lttng_element_event_rule_kernel_tracepoint; extern const char *const mi_lttng_element_event_rule_kernel_uprobe; extern const char *const mi_lttng_element_event_rule_log4j_logging; extern const char *const mi_lttng_element_event_rule_python_logging; -extern const char - *const mi_lttng_element_event_rule_user_tracepoint; +extern const char *const mi_lttng_element_event_rule_user_tracepoint; /* String related to lttng_event_rule_kernel_syscall. */ -extern const char - *const mi_lttng_element_event_rule_kernel_syscall_emission_site; +extern const char *const mi_lttng_element_event_rule_kernel_syscall_emission_site; /* String related to enum lttng_event_rule_kernel_syscall_emission_site. */ -extern const char *const - mi_lttng_event_rule_kernel_syscall_emission_site_entry_exit; -extern const char - *const mi_lttng_event_rule_kernel_syscall_emission_site_entry; -extern const char - *const mi_lttng_event_rule_kernel_syscall_emission_site_exit; - -extern const char *const - mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusions; -extern const char *const - mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusion; +extern const char *const mi_lttng_event_rule_kernel_syscall_emission_site_entry_exit; +extern const char *const mi_lttng_event_rule_kernel_syscall_emission_site_entry; +extern const char *const mi_lttng_event_rule_kernel_syscall_emission_site_exit; + +extern const char *const mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusions; +extern const char *const mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusion; /* String related to log level rule. */ extern const char *const mi_lttng_element_log_level_rule; extern const char *const mi_lttng_element_log_level_rule_exactly; -extern const char - *const mi_lttng_element_log_level_rule_at_least_as_severe_as; -extern const char *const - mi_lttng_element_log_level_rule_at_least_as_severe_as_thre; +extern const char *const mi_lttng_element_log_level_rule_at_least_as_severe_as; +extern const char *const mi_lttng_element_log_level_rule_at_least_as_severe_as_thre; extern const char *const mi_lttng_element_log_level_rule_level; /* String related to kernel probe location. */ extern const char *const mi_lttng_element_kernel_probe_location; -extern const char - *const mi_lttng_element_kernel_probe_location_symbol_offset; -extern const char *const - mi_lttng_element_kernel_probe_location_symbol_offset_name; -extern const char *const - mi_lttng_element_kernel_probe_location_symbol_offset_offset; -extern const char - *const mi_lttng_element_kernel_probe_location_address; -extern const char - *const mi_lttng_element_kernel_probe_location_address_address; +extern const char *const mi_lttng_element_kernel_probe_location_symbol_offset; +extern const char *const mi_lttng_element_kernel_probe_location_symbol_offset_name; +extern const char *const mi_lttng_element_kernel_probe_location_symbol_offset_offset; +extern const char *const mi_lttng_element_kernel_probe_location_address; +extern const char *const mi_lttng_element_kernel_probe_location_address_address; /* String related to userspace probe location. */ extern const char *const mi_lttng_element_userspace_probe_location; -extern const char - *const mi_lttng_element_userspace_probe_location_binary_path; -extern const char - *const mi_lttng_element_userspace_probe_location_function; -extern const char - *const mi_lttng_element_userspace_probe_location_function_name; -extern const char - *const mi_lttng_element_userspace_probe_location_lookup_method; -extern const char *const - mi_lttng_element_userspace_probe_location_lookup_method_function_default; -extern const char *const - mi_lttng_element_userspace_probe_location_lookup_method_function_elf; -extern const char *const - mi_lttng_element_userspace_probe_location_lookup_method_tracepoint_sdt; -extern const char - *const mi_lttng_element_userspace_probe_location_tracepoint; -extern const char *const - mi_lttng_element_userspace_probe_location_tracepoint_probe_name; -extern const char *const - mi_lttng_element_userspace_probe_location_tracepoint_provider_name; +extern const char *const mi_lttng_element_userspace_probe_location_binary_path; +extern const char *const mi_lttng_element_userspace_probe_location_function; +extern const char *const mi_lttng_element_userspace_probe_location_function_name; +extern const char *const mi_lttng_element_userspace_probe_location_lookup_method; +extern const char *const mi_lttng_element_userspace_probe_location_lookup_method_function_default; +extern const char *const mi_lttng_element_userspace_probe_location_lookup_method_function_elf; +extern const char *const mi_lttng_element_userspace_probe_location_lookup_method_tracepoint_sdt; +extern const char *const mi_lttng_element_userspace_probe_location_tracepoint; +extern const char *const mi_lttng_element_userspace_probe_location_tracepoint_probe_name; +extern const char *const mi_lttng_element_userspace_probe_location_tracepoint_provider_name; /* String related to enum * lttng_userspace_probe_location_function_instrumentation_type */ -extern const char *const - mi_lttng_element_userspace_probe_location_function_instrumentation_type; -extern const char *const - mi_lttng_userspace_probe_location_function_instrumentation_type_entry; +extern const char *const mi_lttng_element_userspace_probe_location_function_instrumentation_type; +extern const char *const mi_lttng_userspace_probe_location_function_instrumentation_type_entry; /* String related to trigger */ extern const char *const mi_lttng_element_triggers; @@ -384,18 +344,15 @@ extern const char *const mi_lttng_element_trigger_owner_uid; /* String related to error_query. */ extern const char *const mi_lttng_element_error_query_result; -extern const char - *const mi_lttng_element_error_query_result_counter; -extern const char - *const mi_lttng_element_error_query_result_counter_value; -extern const char - *const mi_lttng_element_error_query_result_description; +extern const char *const mi_lttng_element_error_query_result_counter; +extern const char *const mi_lttng_element_error_query_result_counter_value; +extern const char *const mi_lttng_element_error_query_result_description; extern const char *const mi_lttng_element_error_query_result_name; extern const char *const mi_lttng_element_error_query_result_type; extern const char *const mi_lttng_element_error_query_results; /* String related to add-context command */ -extern const char * const mi_lttng_element_context_symbol; +extern const char *const mi_lttng_element_context_symbol; /* Utility string function */ const char *mi_lttng_loglevel_string(int value, enum lttng_domain_type domain); @@ -405,7 +362,7 @@ const char *mi_lttng_domaintype_string(enum lttng_domain_type value); const char *mi_lttng_buffertype_string(enum lttng_buffer_type value); 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); /* * Create an instance of a machine interface writer. @@ -458,8 +415,7 @@ int mi_lttng_writer_command_close(struct mi_writer *writer); * Returns zero if the XML document could be closed cleanly. * Negative values indicate an error. */ -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); /* * Close the current element tag. @@ -480,8 +436,7 @@ int mi_lttng_writer_close_element(struct mi_writer *writer); * Returns zero if the XML document could be closed cleanly. * Negative values indicate an error. */ -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); /* * Write an element of type unsigned int. @@ -494,7 +449,8 @@ int mi_lttng_close_multi_element(struct mi_writer *writer, * Negative values indicate an error. */ 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); /* * Write an element of type signed int. @@ -507,7 +463,8 @@ int mi_lttng_writer_write_element_unsigned_int(struct mi_writer *writer, * Negative values indicate an error. */ 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); /* * Write an element of type boolean. @@ -520,7 +477,8 @@ int mi_lttng_writer_write_element_signed_int(struct mi_writer *writer, * Negative values indicate an error. */ int mi_lttng_writer_write_element_bool(struct mi_writer *writer, - const char *element_name, int value); + const char *element_name, + int value); /* * Write an element of type string. @@ -533,7 +491,8 @@ int mi_lttng_writer_write_element_bool(struct mi_writer *writer, * Negative values indicate an error. */ 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); /* * Write an element of type double. @@ -546,8 +505,8 @@ int mi_lttng_writer_write_element_string(struct mi_writer *writer, * Negative values indicate an error. */ int mi_lttng_writer_write_element_double(struct mi_writer *writer, - const char *element_name, - double value); + const char *element_name, + double value); /* * Machine interface of struct version. @@ -560,8 +519,10 @@ int mi_lttng_writer_write_element_double(struct mi_writer *writer, * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* * Machine interface: open a sessions element. @@ -587,8 +548,7 @@ int mi_lttng_sessions_open(struct mi_writer *writer); * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* * Machine interface: open a domains element. @@ -615,8 +575,7 @@ int mi_lttng_domains_open(struct mi_writer *writer); * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* * Machine interface: open a channels element. @@ -643,8 +602,7 @@ int mi_lttng_channels_open(struct mi_writer *writer); * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* * Machine interface of struct channel_attr. @@ -655,27 +613,25 @@ int mi_lttng_channel(struct mi_writer *writer, * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* -* Machine interface for event common attributes. -* -* writer An instance of a mi writer. -* event single trace event. -* -* The common attribute are: -* - mi event element -* - event name -* - event type -* - enabled tag -* - event filter -* -* Returns zero if the element's value could be written. -* Negative values indicate an error. -*/ -int mi_lttng_event_common_attributes(struct mi_writer *writer, - struct lttng_event *event); + * Machine interface for event common attributes. + * + * writer An instance of a mi writer. + * event single trace event. + * + * The common attribute are: + * - mi event element + * - event name + * - event type + * - enabled tag + * - event filter + * + * Returns zero if the element's value could be written. + * Negative values indicate an error. + */ +int mi_lttng_event_common_attributes(struct mi_writer *writer, struct lttng_event *event); /* * Machine interface for kernel tracepoint event with a loglevel. @@ -688,7 +644,8 @@ int mi_lttng_event_common_attributes(struct mi_writer *writer, * Negative values indicate an error. */ 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); /* * Machine interface for kernel tracepoint event with no loglevel. @@ -699,8 +656,7 @@ int mi_lttng_event_tracepoint_loglevel(struct mi_writer *writer, * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* * Machine interface for kernel function and probe event. @@ -711,8 +667,7 @@ int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer, * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* * Machine interface for kernel function entry event. @@ -723,8 +678,7 @@ int mi_lttng_event_function_probe(struct mi_writer *writer, * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* * Machine interface: open an events element. @@ -756,8 +710,10 @@ int mi_lttng_events_open(struct mi_writer *writer); * Returns zero if the element's value could be written. * Negative values indicate an error. */ -int mi_lttng_event(struct mi_writer *writer, struct lttng_event *event, - int is_open, enum lttng_domain_type domain); +int mi_lttng_event(struct mi_writer *writer, + struct lttng_event *event, + int is_open, + enum lttng_domain_type domain); /* * Machine interface for struct lttng_event_field. @@ -768,8 +724,7 @@ int mi_lttng_event(struct mi_writer *writer, struct lttng_event *event, * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* * Machine interface: open a event_fields element. @@ -801,8 +756,8 @@ int mi_lttng_trackers_open(struct mi_writer *writer); * * Note: A targets element is also opened for each tracker definition */ -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); /* * Machine interface: open a PIDs element. @@ -839,8 +794,7 @@ int mi_lttng_processes_open(struct mi_writer *writer); * Returns zero if the element's value could be written. * Negative values indicate an error. */ -int mi_lttng_process(struct mi_writer *writer, pid_t pid , const char *name, - int is_open); +int mi_lttng_process(struct mi_writer *writer, pid_t pid, const char *name, int is_open); /* * TODO: move pid of lttng list -u to process semantic on mi api bump @@ -858,8 +812,7 @@ int mi_lttng_process(struct mi_writer *writer, pid_t pid , const char *name, * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* * Machine interface: open a process attribute values element. @@ -880,8 +833,8 @@ int mi_lttng_process_attr_values_open(struct mi_writer *writer); * Negative values indicate an error. */ 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); /* * Machine interface for track/untrack of an integral process attribute value. @@ -892,9 +845,9 @@ int mi_lttng_all_process_attribute_value(struct mi_writer *writer, * Negative values indicate an error. */ 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); /* * Machine interface for track/untrack of a string process attribute value. @@ -905,9 +858,9 @@ int mi_lttng_integral_process_attribute_value(struct mi_writer *writer, * Negative values indicate an error. */ 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); /* * Machine interface of a context. @@ -922,8 +875,7 @@ int mi_lttng_string_process_attribute_value(struct mi_writer *writer, * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* * Machine interface of a perf_counter_context. @@ -936,7 +888,7 @@ int mi_lttng_context(struct mi_writer *writer, * Negative values indicate an error. */ 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); /* * Machine interface of the snapshot list_output. @@ -954,8 +906,7 @@ int mi_lttng_perf_counter_context(struct mi_writer *writer, * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* * Machine interface of the snapshot output. @@ -974,7 +925,7 @@ int mi_lttng_snapshot_output_session_name(struct mi_writer *writer, * Negative values indicate an error. */ int mi_lttng_snapshot_list_output(struct mi_writer *writer, - const struct lttng_snapshot_output *output); + const struct lttng_snapshot_output *output); /* * Machine interface of the output of the command snapshot del output @@ -997,8 +948,10 @@ int mi_lttng_snapshot_list_output(struct mi_writer *writer, * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* * Machine interface of the output of the command snapshot add output @@ -1024,8 +977,9 @@ int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id, * Negative values indicate an error. */ 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); /* * Machine interface of the output of the command snapshot @@ -1045,8 +999,10 @@ int mi_lttng_snapshot_add_output(struct mi_writer *writer, * Returns zero if the element's value could be written. * Negative values indicate an error. */ -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); /* * Machine interface representation of a session rotation schedule. @@ -1062,7 +1018,7 @@ int mi_lttng_snapshot_record(struct mi_writer *writer, const char *url, * Negative values indicate an error. */ int mi_lttng_rotation_schedule(struct mi_writer *writer, - const struct lttng_rotation_schedule *schedule); + const struct lttng_rotation_schedule *schedule); /* * Machine interface of a session rotation schedule result. @@ -1083,8 +1039,8 @@ int mi_lttng_rotation_schedule(struct mi_writer *writer, * Negative values indicate an error. */ 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); /* * Machine interface of a session rotation result. @@ -1107,8 +1063,8 @@ int mi_lttng_rotation_schedule_result(struct mi_writer *writer, * Negative values indicate an error. */ 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); #endif /* _MI_LTTNG_H */ diff --git a/src/common/optional.hpp b/src/common/optional.hpp index 4bb774739..69bba5be5 100644 --- a/src/common/optional.hpp +++ b/src/common/optional.hpp @@ -37,10 +37,10 @@ * * LTTNG_OPTIONAL_UNSET(&foo.b); */ -#define LTTNG_OPTIONAL(type) \ - struct { \ +#define LTTNG_OPTIONAL(type) \ + struct { \ uint8_t is_set; \ - type value; \ + type value; \ } /* @@ -60,10 +60,10 @@ * Since this returns the 'optional' by value, it is not suitable for all * wrapped optional types. It is meant to be used with PODs. */ -#define LTTNG_OPTIONAL_GET(optional) \ - ({ \ - LTTNG_ASSERT((optional).is_set); \ - (optional).value; \ +#define LTTNG_OPTIONAL_GET(optional) \ + ({ \ + LTTNG_ASSERT((optional).is_set); \ + (optional).value; \ }) /* @@ -71,10 +71,10 @@ * an optional value is set to LTTNG_ASSERT() that it is set when fecthing the * underlying value's address. */ -#define LTTNG_OPTIONAL_GET_PTR(optional) \ - ({ \ - LTTNG_ASSERT((optional).is_set); \ - &(optional).value; \ +#define LTTNG_OPTIONAL_GET_PTR(optional) \ + ({ \ + LTTNG_ASSERT((optional).is_set); \ + &(optional).value; \ }) /* @@ -83,7 +83,9 @@ * The wrapped field is set to the value it would gave if it had static storage * duration. */ -#define LTTNG_OPTIONAL_INIT_UNSET {} +#define LTTNG_OPTIONAL_INIT_UNSET \ + { \ + } /* * Initialize an optional field as 'set' with a given value. @@ -94,16 +96,16 @@ } /* Set the value of an optional field. */ -#define LTTNG_OPTIONAL_SET(field_ptr, val) \ - do { \ - (field_ptr)->is_set = 1; \ - (field_ptr)->value = (val); \ +#define LTTNG_OPTIONAL_SET(field_ptr, val) \ + do { \ + (field_ptr)->is_set = 1; \ + (field_ptr)->value = (val); \ } while (0) /* Put an optional field in the "unset" (NULL-ed) state. */ -#define LTTNG_OPTIONAL_UNSET(field_ptr) \ - do { \ - (field_ptr)->is_set = 0; \ +#define LTTNG_OPTIONAL_UNSET(field_ptr) \ + do { \ + (field_ptr)->is_set = 0; \ } while (0) #endif /* LTTNG_OPTIONAL_H */ diff --git a/src/common/payload-view.hpp b/src/common/payload-view.hpp index 06bb3d157..1980c0a2f 100644 --- a/src/common/payload-view.hpp +++ b/src/common/payload-view.hpp @@ -75,9 +75,8 @@ bool lttng_payload_view_is_valid(const struct lttng_payload_view *view); * cause the view to reference the whole payload from the * offset provided. */ -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 a payload view referencing a subset of a payload referenced by @@ -89,9 +88,8 @@ struct lttng_payload_view lttng_payload_view_from_payload( * cause the payload view to reference the whole payload view's * buffer view from the offset provided. */ -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 a payload view referencing a subset of a dynamic buffer. @@ -106,8 +104,7 @@ struct lttng_payload_view lttng_payload_view_from_view( * offset provided. */ 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 a payload view referencing a subset of a dynamic buffer. @@ -121,9 +118,9 @@ struct lttng_payload_view lttng_payload_view_from_dynamic_buffer( * cause the payload view to reference the whole payload from the * offset provided. */ -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 a payload view referencing a subset of the memory referenced by a raw @@ -136,8 +133,8 @@ struct lttng_payload_view lttng_payload_view_from_buffer_view( * Note that a payload view never assumes the ownership of the memory it * references. */ -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); /** * Get the number of file descriptor handles left in a payload view. @@ -146,8 +143,7 @@ struct lttng_payload_view lttng_payload_view_init_from_buffer( * * Returns the number of file descriptor handles left on success, -1 on error. */ -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); /** * Pop an fd handle from a payload view. @@ -158,7 +154,6 @@ int lttng_payload_view_get_fd_handle_count( * * Returns an fd_handle on success, -1 on error. */ -struct fd_handle *lttng_payload_view_pop_fd_handle( - struct lttng_payload_view *payload_view); +struct fd_handle *lttng_payload_view_pop_fd_handle(struct lttng_payload_view *payload_view); #endif /* LTTNG_PAYLOAD_VIEW_H */ diff --git a/src/common/payload.hpp b/src/common/payload.hpp index 9747f59ef..0e27efa2c 100644 --- a/src/common/payload.hpp +++ b/src/common/payload.hpp @@ -8,8 +8,8 @@ #ifndef LTTNG_PAYLOAD_H #define LTTNG_PAYLOAD_H -#include #include +#include #include /* @@ -30,8 +30,7 @@ struct lttng_payload { void lttng_payload_init(struct lttng_payload *payload); /* Copy a payload. */ -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); /* Release any memory and references held by the payload. */ void lttng_payload_reset(struct lttng_payload *payload); @@ -54,7 +53,6 @@ void lttng_payload_clear(struct lttng_payload *payload); * * Returns 0 on success, -1 on allocation error. */ -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); #endif /* LTTNG_PAYLOAD_H */ diff --git a/src/common/pipe.hpp b/src/common/pipe.hpp index 4e6afc567..7c8cf89b6 100644 --- a/src/common/pipe.hpp +++ b/src/common/pipe.hpp @@ -79,15 +79,13 @@ static inline int lttng_pipe_get_writefd(const struct lttng_pipe *pipe) } struct lttng_pipe *lttng_pipe_open(int flags); -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 lttng_pipe_write_close(struct lttng_pipe *pipe); int lttng_pipe_read_close(struct lttng_pipe *pipe); void lttng_pipe_destroy(struct lttng_pipe *pipe); ssize_t lttng_pipe_read(struct lttng_pipe *pipe, void *buf, size_t count); -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); /* Returns and releases the read end of the pipe. */ int lttng_pipe_release_readfd(struct lttng_pipe *pipe); /* Returns and releases the write end of the pipe. */ diff --git a/src/common/pthread-lock.hpp b/src/common/pthread-lock.hpp index b34b45935..7d037e472 100644 --- a/src/common/pthread-lock.hpp +++ b/src/common/pthread-lock.hpp @@ -10,8 +10,8 @@ #include -#include #include +#include namespace lttng { namespace pthread { diff --git a/src/common/random.cpp b/src/common/random.cpp index dfab9538c..5a038a563 100644 --- a/src/common/random.cpp +++ b/src/common/random.cpp @@ -73,9 +73,8 @@ void getrandom_nonblock(char *out_data, std::size_t size) } } #else /* defined(__linux__) && defined(SYS_getrandom) && defined(HAVE_SYS_RANDOM_H) */ -__attribute__((noreturn)) -void getrandom_nonblock(char *out_data __attribute__((unused)), - std::size_t size __attribute__((unused))) +__attribute__((noreturn)) void getrandom_nonblock(char *out_data __attribute__((unused)), + std::size_t size __attribute__((unused))) { LTTNG_THROW_RANDOM_PRODUCTION_ERROR("getrandom() is not supported by this platform"); } diff --git a/src/common/random.hpp b/src/common/random.hpp index 0430485c3..7ba6ede50 100644 --- a/src/common/random.hpp +++ b/src/common/random.hpp @@ -21,9 +21,9 @@ using seed_t = unsigned int; class production_error : public ::lttng::runtime_error { public: explicit 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); }; /* diff --git a/src/common/readwrite.hpp b/src/common/readwrite.hpp index 1818fdb26..d3f80929d 100644 --- a/src/common/readwrite.hpp +++ b/src/common/readwrite.hpp @@ -8,9 +8,10 @@ * */ -#include #include +#include + /* * lttng_read and lttng_write take care of EINTR and partial read/write. * Upon success, they return the "count" received as parameter. diff --git a/src/common/relayd/relayd.hpp b/src/common/relayd/relayd.hpp index 05d1ec684..f7b162298 100644 --- a/src/common/relayd/relayd.hpp +++ b/src/common/relayd/relayd.hpp @@ -8,13 +8,13 @@ #ifndef _RELAYD_H #define _RELAYD_H -#include -#include - +#include #include #include #include -#include + +#include +#include struct relayd_stream_rotation_position { uint64_t stream_id; @@ -30,51 +30,63 @@ struct relayd_stream_rotation_position { int relayd_connect(struct lttcomm_relayd_sock *sock); int relayd_close(struct lttcomm_relayd_sock *sock); 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); -int relayd_add_stream(struct lttcomm_relayd_sock *sock, 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); + 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 relayd_add_stream(struct lttcomm_relayd_sock *sock, + 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_streams_sent(struct lttcomm_relayd_sock *rsock); -int relayd_send_close_stream(struct lttcomm_relayd_sock *sock, uint64_t stream_id, - uint64_t last_net_seq_num); +int relayd_send_close_stream(struct lttcomm_relayd_sock *sock, + uint64_t stream_id, + uint64_t last_net_seq_num); int relayd_version_check(struct lttcomm_relayd_sock *sock); int relayd_start_data(struct lttcomm_relayd_sock *sock); int relayd_send_metadata(struct lttcomm_relayd_sock *sock, size_t len); int relayd_send_data_hdr(struct lttcomm_relayd_sock *sock, - struct lttcomm_relayd_data_hdr *hdr, size_t size); -int relayd_data_pending(struct lttcomm_relayd_sock *sock, uint64_t stream_id, - uint64_t last_net_seq_num); -int relayd_quiescent_control(struct lttcomm_relayd_sock *sock, - uint64_t metadata_stream_id); + struct lttcomm_relayd_data_hdr *hdr, + size_t size); +int relayd_data_pending(struct lttcomm_relayd_sock *sock, + uint64_t stream_id, + uint64_t last_net_seq_num); +int relayd_quiescent_control(struct lttcomm_relayd_sock *sock, uint64_t metadata_stream_id); int relayd_begin_data_pending(struct lttcomm_relayd_sock *sock, uint64_t id); -int relayd_end_data_pending(struct lttcomm_relayd_sock *sock, uint64_t id, - unsigned int *is_data_inflight); +int relayd_end_data_pending(struct lttcomm_relayd_sock *sock, + uint64_t id, + unsigned int *is_data_inflight); int relayd_send_index(struct lttcomm_relayd_sock *rsock, - struct ctf_packet_index *index, uint64_t relay_stream_id, - uint64_t net_seq_num); -int relayd_reset_metadata(struct lttcomm_relayd_sock *rsock, - uint64_t stream_id, uint64_t version); + struct ctf_packet_index *index, + uint64_t relay_stream_id, + uint64_t net_seq_num); +int relayd_reset_metadata(struct lttcomm_relayd_sock *rsock, uint64_t stream_id, uint64_t version); /* `positions` is an array of `stream_count` relayd_stream_rotation_position. */ 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); -int relayd_create_trace_chunk(struct lttcomm_relayd_sock *sock, - struct lttng_trace_chunk *chunk); + unsigned int stream_count, + const uint64_t *new_chunk_id, + const struct relayd_stream_rotation_position *positions); +int relayd_create_trace_chunk(struct lttcomm_relayd_sock *sock, struct lttng_trace_chunk *chunk); 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 relayd_trace_chunk_exists(struct lttcomm_relayd_sock *sock, - uint64_t chunk_id, bool *chunk_exists); + uint64_t chunk_id, + bool *chunk_exists); 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); #endif /* _RELAYD_H */ diff --git a/src/common/runas.hpp b/src/common/runas.hpp index 86c56c987..db3ba5042 100644 --- a/src/common/runas.hpp +++ b/src/common/runas.hpp @@ -9,13 +9,13 @@ * */ +#include +#include + #include #include #include -#include -#include - /* * The run-as process is launched by forking without an exec*() call. This means * that any resource allocated before the run-as worker is launched should be @@ -32,14 +32,11 @@ using post_fork_cleanup_cb = int (*)(void *); int run_as_mkdir_recursive(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 run_as_mkdirat_recursive(int dirfd, const char *path, mode_t mode, uid_t uid, gid_t gid); int run_as_mkdir(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 run_as_mkdirat(int dirfd, const char *path, 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); -int run_as_openat(int dirfd, const char *filename, int flags, mode_t mode, - uid_t uid, gid_t gid); +int run_as_openat(int dirfd, const char *filename, int flags, mode_t mode, uid_t uid, gid_t gid); int run_as_unlink(const char *path, uid_t uid, gid_t gid); int run_as_unlinkat(int dirfd, const char *filename, uid_t uid, gid_t gid); int run_as_rmdir(const char *path, uid_t uid, gid_t gid); @@ -47,18 +44,27 @@ int run_as_rmdir_recursive(const char *path, uid_t uid, gid_t gid, int flags); int run_as_rmdirat(int dirfd, const char *path, uid_t uid, gid_t gid); int run_as_rmdirat_recursive(int dirfd, const char *path, uid_t uid, gid_t gid, int flags); int run_as_rename(const char *old_name, 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 run_as_extract_elf_symbol_offset(int fd, const char* function, - uid_t uid, gid_t gid, uint64_t *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 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_extract_elf_symbol_offset( + int fd, const char *function, uid_t uid, gid_t gid, uint64_t *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 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 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); void run_as_destroy_worker(); #endif /* _RUNAS_H */ diff --git a/src/common/sessiond-comm/agent.hpp b/src/common/sessiond-comm/agent.hpp index 65d379ec0..2d2d0fa4a 100644 --- a/src/common/sessiond-comm/agent.hpp +++ b/src/common/sessiond-comm/agent.hpp @@ -9,22 +9,23 @@ #ifndef AGENT_COMM #define AGENT_COMM -#include - #include #include + #include +#include + /* * Command value passed in the header. */ enum lttcomm_agent_command { - AGENT_CMD_LIST = 1, - AGENT_CMD_ENABLE = 2, - AGENT_CMD_DISABLE = 3, - AGENT_CMD_REG_DONE = 4, /* End registration process. */ - AGENT_CMD_APP_CTX_ENABLE = 5, - AGENT_CMD_APP_CTX_DISABLE = 6, + AGENT_CMD_LIST = 1, + AGENT_CMD_ENABLE = 2, + AGENT_CMD_DISABLE = 3, + AGENT_CMD_REG_DONE = 4, /* End registration process. */ + AGENT_CMD_APP_CTX_ENABLE = 5, + AGENT_CMD_APP_CTX_DISABLE = 6, }; /* @@ -32,11 +33,11 @@ enum lttcomm_agent_command { */ enum lttcomm_agent_ret_code { /* Success, assumed to be the first entry */ - AGENT_RET_CODE_SUCCESS = 1, + AGENT_RET_CODE_SUCCESS = 1, /* Invalid command */ - AGENT_RET_CODE_INVALID = 2, + AGENT_RET_CODE_INVALID = 2, /* Unknown logger name */ - AGENT_RET_CODE_UNKNOWN_NAME = 3, + AGENT_RET_CODE_UNKNOWN_NAME = 3, AGENT_RET_CODE_NR, }; @@ -44,9 +45,9 @@ enum lttcomm_agent_ret_code { * Agent application communication header. */ struct lttcomm_agent_hdr { - uint64_t data_size; /* data size following this header */ - uint32_t cmd; /* Enum of agent command. */ - uint32_t cmd_version; /* command version */ + uint64_t data_size; /* data size following this header */ + uint32_t cmd; /* Enum of agent command. */ + uint32_t cmd_version; /* command version */ } LTTNG_PACKED; /* @@ -91,4 +92,4 @@ struct lttcomm_agent_list_reply { char payload[LTTNG_FLEXIBLE_ARRAY_MEMBER_LENGTH]; } LTTNG_PACKED; -#endif /* AGENT_COMM */ +#endif /* AGENT_COMM */ diff --git a/src/common/sessiond-comm/inet.hpp b/src/common/sessiond-comm/inet.hpp index 6e24fb3eb..f1fc4c069 100644 --- a/src/common/sessiond-comm/inet.hpp +++ b/src/common/sessiond-comm/inet.hpp @@ -8,10 +8,13 @@ #ifndef _LTTCOMM_INET_H #define _LTTCOMM_INET_H -#include - #include "sessiond-comm.hpp" +#include + +#include +#include + /* See man tcp(7) for more detail about this value. */ #define LTTCOMM_INET_PROC_SYN_RETRIES_PATH "/proc/sys/net/ipv4/tcp_syn_retries" #define LTTCOMM_INET_PROC_FIN_TIMEOUT_PATH "/proc/sys/net/ipv4/tcp_fin_timeout" @@ -24,7 +27,7 @@ * (180/5) by considering that it grows linearly. This is of course uncertain * but this is the best approximation we can do at runtime. */ -#define LTTCOMM_INET_SYN_TIMEOUT_FACTOR 36 +#define LTTCOMM_INET_SYN_TIMEOUT_FACTOR 36 /* * Maximum timeout value in seconds of a TCP connection for both send/recv and @@ -36,8 +39,7 @@ LTTNG_EXPORT extern unsigned long lttcomm_inet_tcp_timeout; struct lttcomm_sock; /* Net family callback */ -extern int lttcomm_create_inet_sock(struct lttcomm_sock *sock, int type, - int proto); +extern int lttcomm_create_inet_sock(struct lttcomm_sock *sock, int type, int proto); extern struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock); extern int lttcomm_bind_inet_sock(struct lttcomm_sock *sock); @@ -45,12 +47,12 @@ extern int lttcomm_close_inet_sock(struct lttcomm_sock *sock); extern int lttcomm_connect_inet_sock(struct lttcomm_sock *sock); extern int lttcomm_listen_inet_sock(struct lttcomm_sock *sock, int backlog); -extern ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf, - size_t len, int flags); -extern ssize_t lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock, - const void *buf, size_t len, int flags); +extern ssize_t +lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf, size_t len, int flags); +extern ssize_t +lttcomm_sendmsg_inet_sock(struct lttcomm_sock *sock, const void *buf, size_t len, int flags); /* Initialize inet communication layer. */ extern void lttcomm_inet_init(); -#endif /* _LTTCOMM_INET_H */ +#endif /* _LTTCOMM_INET_H */ diff --git a/src/common/sessiond-comm/inet6.hpp b/src/common/sessiond-comm/inet6.hpp index d6122fdfa..674751e55 100644 --- a/src/common/sessiond-comm/inet6.hpp +++ b/src/common/sessiond-comm/inet6.hpp @@ -8,27 +8,26 @@ #ifndef _LTTCOMM_INET6_H #define _LTTCOMM_INET6_H -#include - #include "sessiond-comm.hpp" +#include +#include + /* Stub */ struct lttcomm_sock; /* Net family callback */ -extern int lttcomm_create_inet6_sock(struct lttcomm_sock *sock, int type, - int proto); +extern int lttcomm_create_inet6_sock(struct lttcomm_sock *sock, int type, int proto); -extern struct lttcomm_sock *lttcomm_accept_inet6_sock( - struct lttcomm_sock *sock); +extern struct lttcomm_sock *lttcomm_accept_inet6_sock(struct lttcomm_sock *sock); extern int lttcomm_bind_inet6_sock(struct lttcomm_sock *sock); extern int lttcomm_close_inet6_sock(struct lttcomm_sock *sock); extern int lttcomm_connect_inet6_sock(struct lttcomm_sock *sock); extern int lttcomm_listen_inet6_sock(struct lttcomm_sock *sock, int backlog); -extern ssize_t lttcomm_recvmsg_inet6_sock(struct lttcomm_sock *sock, void *buf, - size_t len, int flags); -extern ssize_t lttcomm_sendmsg_inet6_sock(struct lttcomm_sock *sock, - const void *buf, size_t len, int flags); +extern ssize_t +lttcomm_recvmsg_inet6_sock(struct lttcomm_sock *sock, void *buf, size_t len, int flags); +extern ssize_t +lttcomm_sendmsg_inet6_sock(struct lttcomm_sock *sock, const void *buf, size_t len, int flags); -#endif /* _LTTCOMM_INET6_H */ +#endif /* _LTTCOMM_INET6_H */ diff --git a/src/common/sessiond-comm/relayd.hpp b/src/common/sessiond-comm/relayd.hpp index 0865254fa..6a0a79201 100644 --- a/src/common/sessiond-comm/relayd.hpp +++ b/src/common/sessiond-comm/relayd.hpp @@ -9,24 +9,25 @@ #ifndef _RELAYD_COMM #define _RELAYD_COMM -#include -#include - -#include #include #include #include #include -#include #include +#include + +#include + +#include +#include -#define RELAYD_VERSION_COMM_MAJOR VERSION_MAJOR -#define RELAYD_VERSION_COMM_MINOR VERSION_MINOR +#define RELAYD_VERSION_COMM_MAJOR VERSION_MAJOR +#define RELAYD_VERSION_COMM_MINOR VERSION_MINOR -#define RELAYD_COMM_LTTNG_HOST_NAME_MAX_2_4 64 -#define RELAYD_COMM_LTTNG_NAME_MAX_2_4 255 -#define RELAYD_COMM_LTTNG_PATH_MAX 4096 -#define RELAYD_COMM_DEFAULT_STREAM_NAME_LEN 264 /* 256 + 8 */ +#define RELAYD_COMM_LTTNG_HOST_NAME_MAX_2_4 64 +#define RELAYD_COMM_LTTNG_NAME_MAX_2_4 255 +#define RELAYD_COMM_LTTNG_PATH_MAX 4096 +#define RELAYD_COMM_DEFAULT_STREAM_NAME_LEN 264 /* 256 + 8 */ /* * lttng-relayd communication header. @@ -34,9 +35,9 @@ struct lttcomm_relayd_hdr { /* Circuit ID not used for now so always ignored */ uint64_t circuit_id; - uint64_t data_size; /* data size following this header */ - uint32_t cmd; /* enum lttcomm_relayd_command */ - uint32_t cmd_version; /* command version */ + uint64_t data_size; /* data size following this header */ + uint32_t cmd; /* enum lttcomm_relayd_command */ + uint32_t cmd_version; /* command version */ } LTTNG_PACKED; /* @@ -45,10 +46,10 @@ struct lttcomm_relayd_hdr { struct lttcomm_relayd_data_hdr { /* Circuit ID not used for now so always ignored */ uint64_t circuit_id; - uint64_t stream_id; /* Stream ID known by the relayd */ - uint64_t net_seq_num; /* Network sequence number, per stream. */ - uint32_t data_size; /* data size following this header */ - uint32_t padding_size; /* Size of 0 padding the data */ + uint64_t stream_id; /* Stream ID known by the relayd */ + uint64_t net_seq_num; /* Network sequence number, per stream. */ + uint32_t data_size; /* data size following this header */ + uint32_t padding_size; /* Size of 0 padding the data */ } LTTNG_PACKED; /* @@ -124,7 +125,7 @@ struct lttcomm_relayd_metadata_payload { */ struct lttcomm_relayd_close_stream { uint64_t stream_id; - uint64_t last_net_seq_num; /* sequence number of last packet */ + uint64_t last_net_seq_num; /* sequence number of last packet */ } LTTNG_PACKED; /* @@ -170,13 +171,11 @@ static inline size_t lttcomm_relayd_index_len(uint32_t major, uint32_t minor) if (major == 1) { switch (minor) { case 0: - return offsetof(struct lttcomm_relayd_index, stream_id) - + member_sizeof(struct lttcomm_relayd_index, - stream_id); + return offsetof(struct lttcomm_relayd_index, stream_id) + + member_sizeof(struct lttcomm_relayd_index, stream_id); case 1: - return offsetof(struct lttcomm_relayd_index, packet_seq_num) - + member_sizeof(struct lttcomm_relayd_index, - packet_seq_num); + return offsetof(struct lttcomm_relayd_index, packet_seq_num) + + member_sizeof(struct lttcomm_relayd_index, packet_seq_num); default: abort(); } @@ -358,4 +357,4 @@ struct lttcomm_relayd_get_configuration_reply { char payload[LTTNG_FLEXIBLE_ARRAY_MEMBER_LENGTH]; } LTTNG_PACKED; -#endif /* _RELAYD_COMM */ +#endif /* _RELAYD_COMM */ diff --git a/src/common/sessiond-comm/sessiond-comm.hpp b/src/common/sessiond-comm/sessiond-comm.hpp index e9cb85a05..982d517f1 100644 --- a/src/common/sessiond-comm/sessiond-comm.hpp +++ b/src/common/sessiond-comm/sessiond-comm.hpp @@ -14,39 +14,40 @@ #ifndef _LTTNG_SESSIOND_COMM_H #define _LTTNG_SESSIOND_COMM_H -#include -#include -#include -#include -#include -#include -#include +#include "inet.hpp" +#include "inet6.hpp" + #include #include -#include #include -#include #include #include +#include +#include +#include + +#include +#include +#include +#include +#include +#include #include +#include #include #include #include -#include "inet.hpp" -#include "inet6.hpp" -#include - /* Queue size of listen(2) */ #define LTTNG_SESSIOND_COMM_MAX_LISTEN 64 /* Maximum number of FDs that can be sent over a Unix socket */ #if defined(__linux__) /* Based on the kernel's SCM_MAX_FD which is 253 since 2.6.38 (255 before) */ -#define LTTCOMM_MAX_SEND_FDS 253 +#define LTTCOMM_MAX_SEND_FDS 253 #else -#define LTTCOMM_MAX_SEND_FDS 16 +#define LTTCOMM_MAX_SEND_FDS 16 #endif enum lttcomm_sessiond_command { @@ -97,14 +98,12 @@ enum lttcomm_sessiond_command { LTTCOMM_SESSIOND_COMMAND_MAX, }; -static inline -bool lttcomm_sessiond_command_is_valid(enum lttcomm_sessiond_command cmd) +static inline bool lttcomm_sessiond_command_is_valid(enum lttcomm_sessiond_command cmd) { return cmd > LTTCOMM_SESSIOND_COMMAND_MIN && cmd < LTTCOMM_SESSIOND_COMMAND_MAX; } -static inline -const char *lttcomm_sessiond_command_str(enum lttcomm_sessiond_command cmd) +static inline const char *lttcomm_sessiond_command_str(enum lttcomm_sessiond_command cmd) { switch (cmd) { case LTTCOMM_SESSIOND_COMMAND_ADD_CONTEXT: @@ -199,42 +198,41 @@ const char *lttcomm_sessiond_command_str(enum lttcomm_sessiond_command cmd) } enum lttcomm_relayd_command { - RELAYD_ADD_STREAM = 1, - RELAYD_CREATE_SESSION = 2, - RELAYD_START_DATA = 3, - RELAYD_UPDATE_SYNC_INFO = 4, - RELAYD_VERSION = 5, - RELAYD_SEND_METADATA = 6, - RELAYD_CLOSE_STREAM = 7, - RELAYD_DATA_PENDING = 8, - RELAYD_QUIESCENT_CONTROL = 9, - RELAYD_BEGIN_DATA_PENDING = 10, - RELAYD_END_DATA_PENDING = 11, - RELAYD_ADD_INDEX = 12, - RELAYD_SEND_INDEX = 13, - RELAYD_CLOSE_INDEX = 14, + RELAYD_ADD_STREAM = 1, + RELAYD_CREATE_SESSION = 2, + RELAYD_START_DATA = 3, + RELAYD_UPDATE_SYNC_INFO = 4, + RELAYD_VERSION = 5, + RELAYD_SEND_METADATA = 6, + RELAYD_CLOSE_STREAM = 7, + RELAYD_DATA_PENDING = 8, + RELAYD_QUIESCENT_CONTROL = 9, + RELAYD_BEGIN_DATA_PENDING = 10, + RELAYD_END_DATA_PENDING = 11, + RELAYD_ADD_INDEX = 12, + RELAYD_SEND_INDEX = 13, + RELAYD_CLOSE_INDEX = 14, /* Live-reading commands (2.4+). */ - RELAYD_LIST_SESSIONS = 15, + RELAYD_LIST_SESSIONS = 15, /* All streams of the channel have been sent to the relayd (2.4+). */ - RELAYD_STREAMS_SENT = 16, + RELAYD_STREAMS_SENT = 16, /* Ask the relay to reset the metadata trace file (2.8+) */ - RELAYD_RESET_METADATA = 17, + RELAYD_RESET_METADATA = 17, /* Ask the relay to rotate a set of stream files (2.11+) */ - RELAYD_ROTATE_STREAMS = 18, + RELAYD_ROTATE_STREAMS = 18, /* Ask the relay to create a trace chunk (2.11+) */ - RELAYD_CREATE_TRACE_CHUNK = 19, + RELAYD_CREATE_TRACE_CHUNK = 19, /* Ask the relay to close a trace chunk (2.11+) */ - RELAYD_CLOSE_TRACE_CHUNK = 20, + RELAYD_CLOSE_TRACE_CHUNK = 20, /* Ask the relay whether a trace chunk exists (2.11+) */ - RELAYD_TRACE_CHUNK_EXISTS = 21, + RELAYD_TRACE_CHUNK_EXISTS = 21, /* Get the current configuration of a relayd peer (2.12+) */ - RELAYD_GET_CONFIGURATION = 22, + RELAYD_GET_CONFIGURATION = 22, /* Feature branch specific commands start at 10000. */ }; -static inline -const char *lttcomm_relayd_command_str(lttcomm_relayd_command cmd) +static inline const char *lttcomm_relayd_command_str(lttcomm_relayd_command cmd) { switch (cmd) { case RELAYD_ADD_STREAM: @@ -290,7 +288,7 @@ const char *lttcomm_relayd_command_str(lttcomm_relayd_command cmd) * lttcomm error code. */ enum lttcomm_return_code { - LTTCOMM_CONSUMERD_SUCCESS = 0, /* Everything went fine. */ + LTTCOMM_CONSUMERD_SUCCESS = 0, /* Everything went fine. */ /* * Some code paths use -1 to express an error, others * negate this consumer return code. Starting codes at @@ -298,39 +296,39 @@ enum lttcomm_return_code { * and legitimate status codes. */ LTTCOMM_CONSUMERD_COMMAND_SOCK_READY = 100, /* Command socket ready */ - LTTCOMM_CONSUMERD_SUCCESS_RECV_FD, /* Success on receiving fds */ - LTTCOMM_CONSUMERD_ERROR_RECV_FD, /* Error on receiving fds */ - LTTCOMM_CONSUMERD_ERROR_RECV_CMD, /* Error on receiving command */ - LTTCOMM_CONSUMERD_POLL_ERROR, /* Error in polling thread */ - LTTCOMM_CONSUMERD_POLL_NVAL, /* Poll on closed fd */ - LTTCOMM_CONSUMERD_POLL_HUP, /* All fds have hungup */ - LTTCOMM_CONSUMERD_EXIT_SUCCESS, /* Consumerd exiting normally */ - LTTCOMM_CONSUMERD_EXIT_FAILURE, /* Consumerd exiting on error */ - LTTCOMM_CONSUMERD_OUTFD_ERROR, /* Error opening the tracefile */ - LTTCOMM_CONSUMERD_SPLICE_EBADF, /* EBADF from splice(2) */ - LTTCOMM_CONSUMERD_SPLICE_EINVAL, /* EINVAL from splice(2) */ - LTTCOMM_CONSUMERD_SPLICE_ENOMEM, /* ENOMEM from splice(2) */ - LTTCOMM_CONSUMERD_SPLICE_ESPIPE, /* ESPIPE from splice(2) */ - LTTCOMM_CONSUMERD_ENOMEM, /* Consumer is out of memory */ - LTTCOMM_CONSUMERD_ERROR_METADATA, /* Error with metadata. */ - LTTCOMM_CONSUMERD_FATAL, /* Fatal error. */ - LTTCOMM_CONSUMERD_RELAYD_FAIL, /* Error on remote relayd */ - LTTCOMM_CONSUMERD_CHANNEL_FAIL, /* Channel creation failed. */ - LTTCOMM_CONSUMERD_CHAN_NOT_FOUND, /* Channel not found. */ - LTTCOMM_CONSUMERD_ALREADY_SET, /* Resource already set. */ - LTTCOMM_CONSUMERD_ROTATION_FAIL, /* Rotation has failed. */ - LTTCOMM_CONSUMERD_SNAPSHOT_FAILED, /* snapshot has failed. */ - LTTCOMM_CONSUMERD_CREATE_TRACE_CHUNK_FAILED,/* Trace chunk creation failed. */ + LTTCOMM_CONSUMERD_SUCCESS_RECV_FD, /* Success on receiving fds */ + LTTCOMM_CONSUMERD_ERROR_RECV_FD, /* Error on receiving fds */ + LTTCOMM_CONSUMERD_ERROR_RECV_CMD, /* Error on receiving command */ + LTTCOMM_CONSUMERD_POLL_ERROR, /* Error in polling thread */ + LTTCOMM_CONSUMERD_POLL_NVAL, /* Poll on closed fd */ + LTTCOMM_CONSUMERD_POLL_HUP, /* All fds have hungup */ + LTTCOMM_CONSUMERD_EXIT_SUCCESS, /* Consumerd exiting normally */ + LTTCOMM_CONSUMERD_EXIT_FAILURE, /* Consumerd exiting on error */ + LTTCOMM_CONSUMERD_OUTFD_ERROR, /* Error opening the tracefile */ + LTTCOMM_CONSUMERD_SPLICE_EBADF, /* EBADF from splice(2) */ + LTTCOMM_CONSUMERD_SPLICE_EINVAL, /* EINVAL from splice(2) */ + LTTCOMM_CONSUMERD_SPLICE_ENOMEM, /* ENOMEM from splice(2) */ + LTTCOMM_CONSUMERD_SPLICE_ESPIPE, /* ESPIPE from splice(2) */ + LTTCOMM_CONSUMERD_ENOMEM, /* Consumer is out of memory */ + LTTCOMM_CONSUMERD_ERROR_METADATA, /* Error with metadata. */ + LTTCOMM_CONSUMERD_FATAL, /* Fatal error. */ + LTTCOMM_CONSUMERD_RELAYD_FAIL, /* Error on remote relayd */ + LTTCOMM_CONSUMERD_CHANNEL_FAIL, /* Channel creation failed. */ + LTTCOMM_CONSUMERD_CHAN_NOT_FOUND, /* Channel not found. */ + LTTCOMM_CONSUMERD_ALREADY_SET, /* Resource already set. */ + LTTCOMM_CONSUMERD_ROTATION_FAIL, /* Rotation has failed. */ + LTTCOMM_CONSUMERD_SNAPSHOT_FAILED, /* snapshot has failed. */ + LTTCOMM_CONSUMERD_CREATE_TRACE_CHUNK_FAILED, /* Trace chunk creation failed. */ LTTCOMM_CONSUMERD_CLOSE_TRACE_CHUNK_FAILED, /* Trace chunk close failed. */ - LTTCOMM_CONSUMERD_INVALID_PARAMETERS, /* Invalid parameters. */ + LTTCOMM_CONSUMERD_INVALID_PARAMETERS, /* Invalid parameters. */ LTTCOMM_CONSUMERD_TRACE_CHUNK_EXISTS_LOCAL, /* Trace chunk exists on consumer daemon. */ - LTTCOMM_CONSUMERD_TRACE_CHUNK_EXISTS_REMOTE,/* Trace chunk exists on relay daemon. */ - LTTCOMM_CONSUMERD_UNKNOWN_TRACE_CHUNK, /* Unknown trace chunk. */ - LTTCOMM_CONSUMERD_RELAYD_CLEAR_DISALLOWED, /* Relayd does not accept clear command. */ - LTTCOMM_CONSUMERD_UNKNOWN_ERROR, /* Unknown error. */ + LTTCOMM_CONSUMERD_TRACE_CHUNK_EXISTS_REMOTE, /* Trace chunk exists on relay daemon. */ + LTTCOMM_CONSUMERD_UNKNOWN_TRACE_CHUNK, /* Unknown trace chunk. */ + LTTCOMM_CONSUMERD_RELAYD_CLEAR_DISALLOWED, /* Relayd does not accept clear command. */ + LTTCOMM_CONSUMERD_UNKNOWN_ERROR, /* Unknown error. */ /* MUST be last element */ - LTTCOMM_NR, /* Last element */ + LTTCOMM_NR, /* Last element */ }; /* lttng socket protocol. */ @@ -343,8 +341,8 @@ enum lttcomm_sock_proto { * Index in the net_families array below. Please keep in sync! */ enum lttcomm_sock_domain { - LTTCOMM_INET = 0, - LTTCOMM_INET6 = 1, + LTTCOMM_INET = 0, + LTTCOMM_INET6 = 1, }; enum lttcomm_metadata_command { @@ -393,19 +391,17 @@ struct lttcomm_relayd_sock { struct lttcomm_net_family { int family; - int (*create) (struct lttcomm_sock *sock, int type, int proto); + int (*create)(struct lttcomm_sock *sock, int type, int proto); }; struct lttcomm_proto_ops { - int (*bind) (struct lttcomm_sock *sock); - int (*close) (struct lttcomm_sock *sock); - int (*connect) (struct lttcomm_sock *sock); - struct lttcomm_sock *(*accept) (struct lttcomm_sock *sock); - int (*listen) (struct lttcomm_sock *sock, int backlog); - ssize_t (*recvmsg) (struct lttcomm_sock *sock, void *buf, size_t len, - int flags); - ssize_t (*sendmsg) (struct lttcomm_sock *sock, const void *buf, - size_t len, int flags); + int (*bind)(struct lttcomm_sock *sock); + int (*close)(struct lttcomm_sock *sock); + int (*connect)(struct lttcomm_sock *sock); + struct lttcomm_sock *(*accept)(struct lttcomm_sock *sock); + int (*listen)(struct lttcomm_sock *sock, int backlog); + ssize_t (*recvmsg)(struct lttcomm_sock *sock, void *buf, size_t len, int flags); + ssize_t (*sendmsg)(struct lttcomm_sock *sock, const void *buf, size_t len, int flags); }; struct process_attr_integral_value_comm { @@ -419,7 +415,7 @@ struct process_attr_integral_value_comm { * Data structure received from lttng client to session daemon. */ struct lttcomm_session_msg { - uint32_t cmd_type; /* enum lttcomm_sessiond_command */ + uint32_t cmd_type; /* enum lttcomm_sessiond_command */ struct lttng_session session; struct lttng_domain domain; union { @@ -464,7 +460,7 @@ struct lttcomm_session_msg { } LTTNG_PACKED snapshot_record; struct { uint32_t nb_uri; - unsigned int timer_interval; /* usec */ + unsigned int timer_interval; /* usec */ } LTTNG_PACKED session_live; struct { struct lttng_save_session_attr attr; @@ -538,17 +534,17 @@ struct lttcomm_session_msg { uint32_t fd_count; } LTTNG_PACKED; -#define LTTNG_FILTER_MAX_LEN 65536 -#define LTTNG_SESSION_DESCRIPTOR_MAX_LEN 65536 +#define LTTNG_FILTER_MAX_LEN 65536 +#define LTTNG_SESSION_DESCRIPTOR_MAX_LEN 65536 /* * Filter bytecode data. The reloc table is located at the end of the * bytecode. It is made of tuples: (uint16_t, var. len. string). It * starts at reloc_table_offset. */ -#define LTTNG_FILTER_PADDING 32 +#define LTTNG_FILTER_PADDING 32 struct lttng_bytecode { - uint32_t len; /* len of data */ + uint32_t len; /* len of data */ uint32_t reloc_table_offset; uint64_t seqnum; char padding[LTTNG_FILTER_PADDING]; @@ -560,15 +556,14 @@ struct lttng_bytecode { * by zero or more names, where the actual number of names is given by * the 'count' item of the structure. */ -#define LTTNG_EVENT_EXCLUSION_PADDING 32 +#define LTTNG_EVENT_EXCLUSION_PADDING 32 struct lttng_event_exclusion { uint32_t count; char padding[LTTNG_EVENT_EXCLUSION_PADDING]; char names[LTTNG_FLEXIBLE_ARRAY_MEMBER_LENGTH][LTTNG_SYMBOL_NAME_LEN]; } LTTNG_PACKED; -#define LTTNG_EVENT_EXCLUSION_NAME_AT(_exclusion, _i) \ - ((_exclusion)->names[_i]) +#define LTTNG_EVENT_EXCLUSION_NAME_AT(_exclusion, _i) ((_exclusion)->names[_i]) /* * Listing command header. @@ -622,9 +617,9 @@ struct lttcomm_tracker_command_header { * Data structure for the response from sessiond to the lttng client. */ struct lttcomm_lttng_msg { - uint32_t cmd_type; /* enum lttcomm_sessiond_command */ - uint32_t ret_code; /* enum lttcomm_return_code */ - uint32_t pid; /* pid_t */ + uint32_t cmd_type; /* enum lttcomm_sessiond_command */ + uint32_t ret_code; /* enum lttcomm_return_code */ + uint32_t pid; /* pid_t */ uint32_t cmd_header_size; uint32_t data_size; uint32_t fd_count; @@ -640,7 +635,7 @@ struct lttcomm_lttng_output_id { * operation. */ struct lttcomm_consumer_msg { - uint32_t cmd_type; /* enum lttng_consumer_command */ + uint32_t cmd_type; /* enum lttng_consumer_command */ union { struct { uint64_t channel_key; @@ -669,10 +664,10 @@ struct lttcomm_consumer_msg { struct { uint64_t stream_key; uint64_t channel_key; - int32_t cpu; /* On which CPU this stream is assigned. */ + int32_t cpu; /* On which CPU this stream is assigned. */ /* Tells the consumer if the stream should be or not monitored. */ uint32_t no_monitor; - } LTTNG_PACKED stream; /* Only used by Kernel. */ + } LTTNG_PACKED stream; /* Only used by Kernel. */ struct { uint64_t net_index; enum lttng_stream_type type; @@ -691,33 +686,33 @@ struct lttcomm_consumer_msg { uint64_t session_id; } LTTNG_PACKED data_pending; struct { - uint64_t subbuf_size; /* bytes */ - uint64_t num_subbuf; /* power of 2 */ - int32_t overwrite; /* 1: overwrite, 0: discard */ - uint32_t switch_timer_interval; /* usec */ - uint32_t read_timer_interval; /* usec */ - unsigned int live_timer_interval; /* usec */ - uint8_t is_live; /* is part of a live session */ - uint32_t monitor_timer_interval; /* usec */ - int32_t output; /* splice, mmap */ - int32_t type; /* metadata or per_cpu */ - uint64_t session_id; /* Tracing session id */ - char pathname[PATH_MAX]; /* Channel file path. */ - char name[LTTNG_SYMBOL_NAME_LEN]; /* Channel name. */ + uint64_t subbuf_size; /* bytes */ + uint64_t num_subbuf; /* power of 2 */ + int32_t overwrite; /* 1: overwrite, 0: discard */ + uint32_t switch_timer_interval; /* usec */ + uint32_t read_timer_interval; /* usec */ + unsigned int live_timer_interval; /* usec */ + uint8_t is_live; /* is part of a live session */ + uint32_t monitor_timer_interval; /* usec */ + int32_t output; /* splice, mmap */ + int32_t type; /* metadata or per_cpu */ + uint64_t session_id; /* Tracing session id */ + char pathname[PATH_MAX]; /* Channel file path. */ + char name[LTTNG_SYMBOL_NAME_LEN]; /* Channel name. */ /* Credentials used to open the UST buffer shared mappings. */ struct { uint32_t uid; uint32_t gid; } LTTNG_PACKED buffer_credentials; - uint64_t relayd_id; /* Relayd id if apply. */ - uint64_t key; /* Unique channel key. */ + uint64_t relayd_id; /* Relayd id if apply. */ + uint64_t key; /* Unique channel key. */ /* ID of the session's current trace chunk. */ LTTNG_OPTIONAL_COMM(uint64_t) LTTNG_PACKED chunk_id; - unsigned char uuid[LTTNG_UUID_LEN]; /* uuid for ust tracer. */ - uint32_t chan_id; /* Channel ID on the tracer side. */ - uint64_t tracefile_size; /* bytes */ - uint32_t tracefile_count; /* number of tracefiles */ - uint64_t session_id_per_pid; /* Per-pid session ID. */ + unsigned char uuid[LTTNG_UUID_LEN]; /* uuid for ust tracer. */ + uint32_t chan_id; /* Channel ID on the tracer side. */ + uint64_t tracefile_size; /* bytes */ + uint32_t tracefile_count; /* number of tracefiles */ + uint64_t session_id_per_pid; /* Per-pid session ID. */ /* Tells the consumer if the stream should be or not monitored. */ uint32_t monitor; /* @@ -738,29 +733,29 @@ struct lttcomm_consumer_msg { uint64_t key; } LTTNG_PACKED destroy_channel; struct { - uint64_t key; /* Metadata channel key. */ - uint64_t target_offset; /* Offset in the consumer */ - uint64_t len; /* Length of metadata to be received. */ + uint64_t key; /* Metadata channel key. */ + uint64_t target_offset; /* Offset in the consumer */ + uint64_t len; /* Length of metadata to be received. */ uint64_t version; /* Version of the metadata. */ } LTTNG_PACKED push_metadata; struct { - uint64_t key; /* Metadata channel key. */ + uint64_t key; /* Metadata channel key. */ } LTTNG_PACKED close_metadata; struct { - uint64_t key; /* Metadata channel key. */ + uint64_t key; /* Metadata channel key. */ } LTTNG_PACKED setup_metadata; struct { - uint64_t key; /* Channel key. */ + uint64_t key; /* Channel key. */ } LTTNG_PACKED flush_channel; struct { - uint64_t key; /* Channel key. */ + uint64_t key; /* Channel key. */ } LTTNG_PACKED clear_quiescent_channel; struct { char pathname[PATH_MAX]; /* Indicate if the snapshot goes on the relayd or locally. */ uint32_t use_relayd; - uint32_t metadata; /* This a metadata snapshot. */ - uint64_t relayd_id; /* Relayd id if apply. */ + uint32_t metadata; /* This a metadata snapshot. */ + uint64_t relayd_id; /* Relayd id if apply. */ uint64_t key; uint64_t nb_packets_per_stream; } LTTNG_PACKED snapshot_channel; @@ -812,7 +807,8 @@ struct lttcomm_consumer_msg { LTTNG_OPTIONAL_COMM(struct { uint32_t uid; uint32_t gid; - } LTTNG_PACKED ) LTTNG_PACKED credentials; + } LTTNG_PACKED) + LTTNG_PACKED credentials; } LTTNG_PACKED create_trace_chunk; struct { LTTNG_OPTIONAL_COMM(uint64_t) LTTNG_PACKED relayd_id; @@ -903,8 +899,8 @@ struct lttcomm_ust_msg { struct lttcomm_ust_reply { uint32_t handle; uint32_t cmd; - uint32_t ret_code; /* enum lttcomm_return_code */ - uint32_t ret_val; /* return value */ + uint32_t ret_code; /* enum lttcomm_return_code */ + uint32_t ret_val; /* return value */ union { struct { uint64_t memory_map_size; @@ -921,30 +917,30 @@ struct lttcomm_ust_reply { const char *lttcomm_get_readable_code(enum lttcomm_return_code code); int lttcomm_init_inet_sockaddr(struct lttcomm_sockaddr *sockaddr, - const char *ip, unsigned int port); + const char *ip, + unsigned int port); int lttcomm_init_inet6_sockaddr(struct lttcomm_sockaddr *sockaddr, - const char *ip, unsigned int port); + const char *ip, + unsigned int port); struct lttcomm_sock *lttcomm_alloc_sock(enum lttcomm_sock_proto proto); int lttcomm_populate_sock_from_open_socket(struct lttcomm_sock *sock, - int fd, - enum lttcomm_sock_proto protocol); + int fd, + enum lttcomm_sock_proto protocol); int lttcomm_create_sock(struct lttcomm_sock *sock); struct lttcomm_sock *lttcomm_alloc_sock_from_uri(struct lttng_uri *uri); void lttcomm_destroy_sock(struct lttcomm_sock *sock); struct lttcomm_sock *lttcomm_alloc_copy_sock(struct lttcomm_sock *src); -void lttcomm_copy_sock(struct lttcomm_sock *dst, - struct lttcomm_sock *src); +void lttcomm_copy_sock(struct lttcomm_sock *dst, struct lttcomm_sock *src); /* Relayd socket object. */ -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 lttcomm_setsockopt_rcv_timeout(int sock, unsigned int msec); int lttcomm_setsockopt_snd_timeout(int sock, unsigned int msec); -int lttcomm_sock_get_port(const struct lttcomm_sock *sock, - uint16_t *port); +int lttcomm_sock_get_port(const struct lttcomm_sock *sock, uint16_t *port); /* * Set a port to an lttcomm_sock. This will have no effect is the socket is * already bound. @@ -955,4 +951,4 @@ void lttcomm_init(); /* Get network timeout, in milliseconds */ unsigned long lttcomm_get_network_timeout(); -#endif /* _LTTNG_SESSIOND_COMM_H */ +#endif /* _LTTNG_SESSIOND_COMM_H */ diff --git a/src/common/snapshot.hpp b/src/common/snapshot.hpp index d7442152f..3018fb813 100644 --- a/src/common/snapshot.hpp +++ b/src/common/snapshot.hpp @@ -20,20 +20,16 @@ struct mi_writer; bool lttng_snapshot_output_validate(const struct lttng_snapshot_output *output); -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); -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); -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); -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); #endif /* COMMON_SNAPSHOT_H */ diff --git a/src/common/spawn-viewer.hpp b/src/common/spawn-viewer.hpp index 4c2fe0252..f7c7a82b5 100644 --- a/src/common/spawn-viewer.hpp +++ b/src/common/spawn-viewer.hpp @@ -9,6 +9,7 @@ */ #include + #include /* @@ -21,7 +22,7 @@ * This symbol was mistakenly made public before the 2.12 release. It can't * be removed (but it can be stubbed-out if necessary). */ -extern "C" LTTNG_EXPORT -int spawn_viewer(const char *trace_path, char *opt_viewer, bool opt_live_mode); +extern "C" LTTNG_EXPORT int +spawn_viewer(const char *trace_path, char *opt_viewer, bool opt_live_mode); #endif /* ifndef LTTNG_SPAWN_VIEWER_H */ diff --git a/src/common/string-utils/format.hpp b/src/common/string-utils/format.hpp index 244652332..2cc9ed66e 100644 --- a/src/common/string-utils/format.hpp +++ b/src/common/string-utils/format.hpp @@ -16,6 +16,6 @@ * assumes that no grouping/locale-aware formatting is performed (i.e. using * the `'` specifier in POSIX formatting functions). */ -#define MAX_INT_DEC_LEN(val) ((3 * sizeof(val)) + 2) +#define MAX_INT_DEC_LEN(val) ((3 * sizeof(val)) + 2) #endif /* _STRING_UTILS_FORMAT_H */ diff --git a/src/common/string-utils/string-utils.hpp b/src/common/string-utils/string-utils.hpp index 4be165f9c..f6c9b8f82 100644 --- a/src/common/string-utils/string-utils.hpp +++ b/src/common/string-utils/string-utils.hpp @@ -8,9 +8,10 @@ #ifndef _STRING_UTILS_H #define _STRING_UTILS_H -#include -#include #include +#include + +#include void strutils_normalize_star_glob_pattern(char *pattern); @@ -20,12 +21,14 @@ bool strutils_is_star_at_the_end_only_glob_pattern(const char *pattern); char *strutils_unescape_string(const char *input, char only_char); -int strutils_split(const char *input, char delim, bool escape_delim, - struct lttng_dynamic_pointer_array *out_strings); +int strutils_split(const char *input, + char delim, + bool escape_delim, + struct lttng_dynamic_pointer_array *out_strings); void strutils_free_null_terminated_array_of_strings(char **array); -size_t strutils_array_of_strings_len(char * const *array); +size_t strutils_array_of_strings_len(char *const *array); /* * Append `append` to the malloc-end string `str`. @@ -41,7 +44,6 @@ C_LINKAGE int strutils_append_str(char **str, const char *append); * Like `strutils_append_str`, but the appended string is formatted using * `fmt` and the following arguments. */ -C_LINKAGE ATTR_FORMAT_PRINTF(2, 3) -int strutils_appendf(char **s, const char *fmt, ...); +C_LINKAGE ATTR_FORMAT_PRINTF(2, 3) int strutils_appendf(char **s, const char *fmt, ...); #endif /* _STRING_UTILS_H */ diff --git a/src/common/testpoint/testpoint.hpp b/src/common/testpoint/testpoint.hpp index 33cb9aa34..3682493ea 100644 --- a/src/common/testpoint/testpoint.hpp +++ b/src/common/testpoint/testpoint.hpp @@ -23,40 +23,38 @@ void *lttng_testpoint_lookup(const char *name); * set. * Return a non-zero error code to indicate failure. */ -#define testpoint(name) \ - ((caa_unlikely(lttng_testpoint_activated)) \ - ? __testpoint_##name##_wrapper() : 0) +#define testpoint(name) \ + ((caa_unlikely(lttng_testpoint_activated)) ? __testpoint_##name##_wrapper() : 0) /* * One wrapper per testpoint is generated. This is to keep track of the symbol * lookup status and the corresponding function pointer, if any. */ -#define _TESTPOINT_DECL(_name) \ - static inline int __testpoint_##_name##_wrapper(void) \ - { \ - int ret = 0; \ - static int (*tp)(void); \ - static int found; \ - const char *tp_name = "__testpoint_" #_name; \ - \ - if (tp) { \ - ret = tp(); \ - } else { \ - if (!found) { \ - tp = (int (*)(void)) lttng_testpoint_lookup(tp_name); \ - if (tp) { \ - found = 1; \ - ret = tp(); \ - } else { \ - found = -1; \ - } \ - } \ - } \ - return ret; \ +#define _TESTPOINT_DECL(_name) \ + static inline int __testpoint_##_name##_wrapper(void) \ + { \ + int ret = 0; \ + static int (*tp)(void); \ + static int found; \ + const char *tp_name = "__testpoint_" #_name; \ + \ + if (tp) { \ + ret = tp(); \ + } else { \ + if (!found) { \ + tp = (int (*)(void)) lttng_testpoint_lookup(tp_name); \ + if (tp) { \ + found = 1; \ + ret = tp(); \ + } else { \ + found = -1; \ + } \ + } \ + } \ + return ret; \ } /* Testpoint declaration */ -#define TESTPOINT_DECL(name) \ - _TESTPOINT_DECL(name) +#define TESTPOINT_DECL(name) _TESTPOINT_DECL(name) #endif /* NTESTPOINT */ diff --git a/src/common/time.hpp b/src/common/time.hpp index 2c52f334c..d07152c18 100644 --- a/src/common/time.hpp +++ b/src/common/time.hpp @@ -8,38 +8,38 @@ #ifndef LTTNG_TIME_H #define LTTNG_TIME_H -#include +#include +#include + #include #include #include +#include -#include -#include - -#define MSEC_PER_SEC 1000ULL -#define NSEC_PER_SEC 1000000000ULL -#define NSEC_PER_MSEC 1000000ULL -#define NSEC_PER_USEC 1000ULL -#define USEC_PER_SEC 1000000ULL -#define USEC_PER_MSEC 1000ULL +#define MSEC_PER_SEC 1000ULL +#define NSEC_PER_SEC 1000000000ULL +#define NSEC_PER_MSEC 1000000ULL +#define NSEC_PER_USEC 1000ULL +#define USEC_PER_SEC 1000000ULL +#define USEC_PER_MSEC 1000ULL -#define SEC_PER_MINUTE 60ULL +#define SEC_PER_MINUTE 60ULL #define MINUTE_PER_HOUR 60ULL #define USEC_PER_MINUTE (USEC_PER_SEC * SEC_PER_MINUTE) -#define USEC_PER_HOURS (USEC_PER_MINUTE * MINUTE_PER_HOUR) +#define USEC_PER_HOURS (USEC_PER_MINUTE * MINUTE_PER_HOUR) -#define ISO8601_STR_LEN sizeof("YYYYmmddTHHMMSS+HHMM") +#define ISO8601_STR_LEN sizeof("YYYYmmddTHHMMSS+HHMM") #define DATETIME_STR_LEN sizeof("YYYYmmdd-HHMMSS") bool locale_supports_utf8(); -#define NSEC_UNIT "ns" -#define USEC_UNIT (locale_supports_utf8() ? "µs" : "us") -#define MSEC_UNIT "ms" -#define SEC_UNIT "s" -#define MIN_UNIT "m" -#define HR_UNIT "h" +#define NSEC_UNIT "ns" +#define USEC_UNIT (locale_supports_utf8() ? "µs" : "us") +#define MSEC_UNIT "ms" +#define SEC_UNIT "s" +#define MIN_UNIT "m" +#define HR_UNIT "h" /* * timespec_to_ms: Convert timespec to milliseconds. diff --git a/src/common/trace-chunk-registry.hpp b/src/common/trace-chunk-registry.hpp index 3731f33ba..89125ca50 100644 --- a/src/common/trace-chunk-registry.hpp +++ b/src/common/trace-chunk-registry.hpp @@ -8,12 +8,13 @@ #ifndef LTTNG_TRACE_CHUNK_REGISTRY_H #define LTTNG_TRACE_CHUNK_REGISTRY_H -#include -#include -#include #include #include +#include +#include +#include + struct lttng_trace_chunk_registry; /* @@ -38,8 +39,7 @@ struct lttng_trace_chunk_registry *lttng_trace_chunk_registry_create(); * (i.e. all references to the trace chunks it contains must be released) before * it is destroyed. */ -void lttng_trace_chunk_registry_destroy( - struct lttng_trace_chunk_registry *registry); +void lttng_trace_chunk_registry_destroy(struct lttng_trace_chunk_registry *registry); /* * Publish a trace chunk for a given session id. @@ -54,13 +54,14 @@ void lttng_trace_chunk_registry_destroy( * * Returns an lttng_trace_chunk on success, NULL on error. */ -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); +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); /* * Adds the `previously_published` parameter which allows the caller * to know if a trace chunk equivalent to `chunk` was previously published. - * + * * The registry holds a reference to the published trace chunks it contains. * Trace chunks automatically unpublish themselves from their registry on * destruction. @@ -68,7 +69,7 @@ struct lttng_trace_chunk *lttng_trace_chunk_registry_publish_chunk( * This information is necessary to drop the reference of newly published * chunks when a user doesn't wish to explicitly maintain all references * to a given trace chunk. - * + * * For instance, the relay daemon doesn't need the registry to hold a * reference since it controls the lifetime of its trace chunks. * Conversely, the consumer daemons rely on the session daemon to inform @@ -76,10 +77,11 @@ struct lttng_trace_chunk *lttng_trace_chunk_registry_publish_chunk( * belong to a specific top-level object: they are always retrieved from * the registry by `id`. */ -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); +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); /* * Look-up a trace chunk by session_id and chunk_id. @@ -87,19 +89,18 @@ struct lttng_trace_chunk *lttng_trace_chunk_registry_publish_chunk( * * Returns an lttng_trace_chunk on success, NULL if the chunk does not exist. */ -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); /* * Query the existence of a trace chunk by session_id and chunk_id. * * Returns 0 on success, a negative value on error. */ -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); /* * Look-up an anonymous trace chunk by session_id. @@ -108,11 +109,10 @@ int lttng_trace_chunk_registry_chunk_exists( * Returns an lttng_trace_chunk on success, NULL if the chunk does not exist. */ 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); -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); #endif /* LTTNG_TRACE_CHUNK_REGISTRY_H */ diff --git a/src/common/trace-chunk.hpp b/src/common/trace-chunk.hpp index 3fcf833c2..5364f5cd6 100644 --- a/src/common/trace-chunk.hpp +++ b/src/common/trace-chunk.hpp @@ -12,6 +12,7 @@ #include #include #include + #include #include #include @@ -72,110 +73,101 @@ enum lttng_trace_chunk_command_type { struct lttng_trace_chunk *lttng_trace_chunk_create_anonymous(); -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); void lttng_trace_chunk_set_fd_tracker(struct lttng_trace_chunk *chunk, - struct fd_tracker *fd_tracker); + struct fd_tracker *fd_tracker); /* * Copy a trace chunk. The copy that is returned is always a _user_ * mode chunk even if the source chunk was an _owner_ as there can never be * two _owners_ of the same trace output. */ -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); -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 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 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 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 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); bool lttng_trace_chunk_get_name_overridden(struct lttng_trace_chunk *chunk); -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 lttng_trace_chunk_rename_path(struct lttng_trace_chunk *chunk, + const char *path); + +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_set_credentials(struct lttng_trace_chunk *chunk, + const struct lttng_credentials *credentials); + +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_as_owner(struct lttng_trace_chunk *chunk, + struct lttng_directory_handle *session_output_directory); -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_set_as_user(struct lttng_trace_chunk *chunk, + struct lttng_directory_handle *chunk_directory); -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_session_output_directory_handle(struct lttng_trace_chunk *chunk, + struct lttng_directory_handle **handle); -enum lttng_trace_chunk_status lttng_trace_chunk_set_credentials( - struct lttng_trace_chunk *chunk, - const struct lttng_credentials *credentials); +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_set_credentials_current_user( - struct lttng_trace_chunk *chunk); +enum lttng_trace_chunk_status lttng_trace_chunk_create_subdirectory(struct lttng_trace_chunk *chunk, + const char *subdirectory_path); -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_open_file(struct lttng_trace_chunk *chunk, + const char *filename, + int flags, + mode_t mode, + int *out_fd, + bool expect_no_file); -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_open_fs_handle(struct lttng_trace_chunk *chunk, + const char *filename, + int flags, + mode_t mode, + struct fs_handle **out_handle, + bool expect_no_file); + +int lttng_trace_chunk_unlink_file(struct lttng_trace_chunk *chunk, const char *filename); + +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_session_output_directory_handle( - struct lttng_trace_chunk *chunk, - 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 lttng_trace_chunk_create_subdirectory( - struct lttng_trace_chunk *chunk, - const char *subdirectory_path); - -enum lttng_trace_chunk_status lttng_trace_chunk_open_file( - struct lttng_trace_chunk *chunk, - const char *filename, - int flags, - mode_t mode, - int *out_fd, - bool expect_no_file); - -enum lttng_trace_chunk_status lttng_trace_chunk_open_fs_handle( - struct lttng_trace_chunk *chunk, - const char *filename, - int flags, - mode_t mode, - struct fs_handle **out_handle, - bool expect_no_file); - -int lttng_trace_chunk_unlink_file(struct lttng_trace_chunk *chunk, - const char *filename); - -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_set_close_command( - struct lttng_trace_chunk *chunk, - enum lttng_trace_chunk_command_type command_type); - -const char *lttng_trace_chunk_command_type_get_name( - enum lttng_trace_chunk_command_type command); +lttng_trace_chunk_set_close_command(struct lttng_trace_chunk *chunk, + enum lttng_trace_chunk_command_type command_type); + +const char *lttng_trace_chunk_command_type_get_name(enum lttng_trace_chunk_command_type command); 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); /* Returns true on success. */ bool lttng_trace_chunk_get(struct lttng_trace_chunk *chunk); diff --git a/src/common/tracker.hpp b/src/common/tracker.hpp index e53a2a185..3d6c20c3f 100644 --- a/src/common/tracker.hpp +++ b/src/common/tracker.hpp @@ -9,14 +9,14 @@ #ifndef LTTNG_COMMON_TRACKER_H #define LTTNG_COMMON_TRACKER_H -#include -#include - #include #include #include #include +#include +#include + struct process_attr_value { enum lttng_process_attr_value_type type; union value { @@ -38,42 +38,37 @@ const char *lttng_process_attr_to_string(enum lttng_process_attr process_attr); struct lttng_process_attr_values *lttng_process_attr_values_create(); /* Prefixed with '_' since the name conflicts with a public API. */ -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); -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); -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); -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); -void lttng_process_attr_values_destroy( - struct lttng_process_attr_values *values); +void lttng_process_attr_values_destroy(struct lttng_process_attr_values *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); 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); void process_attr_value_destroy(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); +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); #endif /* LTTNG_COMMON_TRACKER_H */ diff --git a/src/common/unix.hpp b/src/common/unix.hpp index 22ddf2edb..5a4984b71 100644 --- a/src/common/unix.hpp +++ b/src/common/unix.hpp @@ -8,13 +8,13 @@ #ifndef _LTTCOMM_UNIX_H #define _LTTCOMM_UNIX_H -#include -#include - #include #include -#include #include +#include + +#include +#include int lttcomm_create_unix_sock(const char *pathname); int lttcomm_create_anon_unix_socketpair(int *fds); @@ -25,20 +25,17 @@ int lttcomm_close_unix_sock(int sock); /* Send a message accompanied by fd(s) over a unix socket. */ ssize_t lttcomm_send_fds_unix_sock(int sock, const int *fds, size_t nb_fd); -ssize_t lttcomm_send_payload_view_fds_unix_sock(int sock, - struct lttng_payload_view *view); -ssize_t lttcomm_send_fds_unix_sock_non_block( - int sock, const int *fds, size_t nb_fd); +ssize_t lttcomm_send_payload_view_fds_unix_sock(int sock, struct lttng_payload_view *view); +ssize_t lttcomm_send_fds_unix_sock_non_block(int sock, const int *fds, size_t nb_fd); ssize_t lttcomm_send_payload_view_fds_unix_sock_non_block(int sock, - struct lttng_payload_view *view); + struct lttng_payload_view *view); /* Recv a message accompanied by fd(s) from a unix socket */ ssize_t lttcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd); -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); ssize_t lttcomm_recv_fds_unix_sock_non_block(int sock, int *fds, size_t nb_fd); -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); ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len); ssize_t lttcomm_recv_unix_sock_non_block(int sock, void *buf, size_t len); @@ -46,9 +43,8 @@ ssize_t lttcomm_send_unix_sock(int sock, const void *buf, size_t len); ssize_t lttcomm_send_unix_sock_non_block(int sock, const void *buf, size_t len); ssize_t lttcomm_send_creds_unix_sock(int sock, const void *buf, size_t len); -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); int lttcomm_setsockopt_creds_unix_sock(int sock); -#endif /* _LTTCOMM_UNIX_H */ +#endif /* _LTTCOMM_UNIX_H */ diff --git a/src/common/urcu.hpp b/src/common/urcu.hpp index edb53b7b5..35bb2905c 100644 --- a/src/common/urcu.hpp +++ b/src/common/urcu.hpp @@ -9,8 +9,8 @@ #define LTTNG_URCU_H #define _LGPL_SOURCE -#include #include +#include namespace lttng { namespace urcu { diff --git a/src/common/uri.hpp b/src/common/uri.hpp index fe5c02afd..7cc352943 100644 --- a/src/common/uri.hpp +++ b/src/common/uri.hpp @@ -8,20 +8,22 @@ #ifndef URI_H #define URI_H -#include -#include #include +#include + +#include + /* Destination type of lttng URI */ enum lttng_dst_type { - LTTNG_DST_IPV4 = 1, - LTTNG_DST_IPV6 = 2, - LTTNG_DST_PATH = 3, + LTTNG_DST_IPV4 = 1, + LTTNG_DST_IPV6 = 2, + LTTNG_DST_PATH = 3, }; /* Type of lttng URI where it is a final destination or a hop */ enum lttng_uri_type { - LTTNG_URI_DST, /* The URI is a final destination */ + LTTNG_URI_DST, /* The URI is a final destination */ /* * Hops are not supported yet but planned for a future release. * @@ -40,8 +42,8 @@ enum lttng_stream_type { * should be ignored. */ enum lttng_proto_type { - LTTNG_PROTO_TYPE_NONE = 0, - LTTNG_TCP = 1, + LTTNG_PROTO_TYPE_NONE = 0, + LTTNG_TCP = 1, /* * UDP protocol is not supported for now. * @@ -69,8 +71,7 @@ struct lttng_uri { int uri_compare(struct lttng_uri *uri1, struct lttng_uri *uri2); void uri_free(struct lttng_uri *uri); ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris); -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); int uri_to_str_url(struct lttng_uri *uri, char *dst, size_t size); #endif /* _LTT_URI_H */ diff --git a/src/common/ust-consumer/ust-consumer.hpp b/src/common/ust-consumer/ust-consumer.hpp index 1996a5b51..7d0e00614 100644 --- a/src/common/ust-consumer/ust-consumer.hpp +++ b/src/common/ust-consumer/ust-consumer.hpp @@ -11,21 +11,22 @@ #include #include + #include #ifdef HAVE_LIBLTTNG_UST_CTL int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream); -int lttng_ustconsumer_sample_snapshot_positions( - struct lttng_consumer_stream *stream); +int lttng_ustconsumer_sample_snapshot_positions(struct lttng_consumer_stream *stream); -int lttng_ustconsumer_get_produced_snapshot( - struct lttng_consumer_stream *stream, unsigned long *pos); -int lttng_ustconsumer_get_consumed_snapshot( - struct lttng_consumer_stream *stream, unsigned long *pos); +int lttng_ustconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream, + unsigned long *pos); +int lttng_ustconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream, + unsigned long *pos); int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, - int sock, struct pollfd *consumer_sockpoll); + int sock, + struct pollfd *consumer_sockpoll); extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan); extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan); @@ -33,246 +34,224 @@ extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream); extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream); int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, - struct lttng_consumer_local_data *ctx); + struct lttng_consumer_local_data *ctx); int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream); void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream); -int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream, - int producer_active); -int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream, - uint64_t *stream_id); +int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream, int producer_active); +int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream, uint64_t *stream_id); int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream); void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht); void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata); void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream); -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 lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx, - struct lttng_consumer_channel *channel, int timer, int wait); -enum sync_metadata_status lttng_ustconsumer_sync_metadata( - struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *metadata); -int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, - int producer); + struct lttng_consumer_channel *channel, + int timer, + int wait); +enum sync_metadata_status lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx, + struct lttng_consumer_stream *metadata); +int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, int producer); int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream); -int lttng_ustconsumer_get_current_timestamp( - struct lttng_consumer_stream *stream, uint64_t *ts); -int lttng_ustconsumer_get_sequence_number( - struct lttng_consumer_stream *stream, uint64_t *seq); +int lttng_ustconsumer_get_current_timestamp(struct lttng_consumer_stream *stream, uint64_t *ts); +int lttng_ustconsumer_get_sequence_number(struct lttng_consumer_stream *stream, uint64_t *seq); void lttng_ustconsumer_sigbus_handle(void *addr); #else /* HAVE_LIBLTTNG_UST_CTL */ -static inline -ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( - struct lttng_consumer_local_data *ctx __attribute__((unused)), - struct lttng_consumer_stream *stream __attribute__((unused)), - unsigned long len __attribute__((unused)), - unsigned long padding __attribute__((unused))) +static inline ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( + struct lttng_consumer_local_data *ctx __attribute__((unused)), + struct lttng_consumer_stream *stream __attribute__((unused)), + unsigned long len __attribute__((unused)), + unsigned long padding __attribute__((unused))) { return -ENOSYS; } -static inline -ssize_t lttng_ustconsumer_on_read_subbuffer_splice( - struct lttng_consumer_local_data *ctx __attribute__((unused)), - struct lttng_consumer_stream *uststream __attribute__((unused)), - unsigned long len __attribute__((unused)), - unsigned long padding __attribute__((unused))) +static inline ssize_t lttng_ustconsumer_on_read_subbuffer_splice( + struct lttng_consumer_local_data *ctx __attribute__((unused)), + struct lttng_consumer_stream *uststream __attribute__((unused)), + unsigned long len __attribute__((unused)), + unsigned long padding __attribute__((unused))) { return -ENOSYS; } -static inline -int lttng_ustconsumer_take_snapshot( - struct lttng_consumer_stream *stream __attribute__((unused))) +static inline int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream + __attribute__((unused))) { return -ENOSYS; } -static inline -int lttng_ustconsumer_sample_snapshot_positions( - struct lttng_consumer_stream *stream __attribute__((unused))) +static inline int lttng_ustconsumer_sample_snapshot_positions(struct lttng_consumer_stream *stream + __attribute__((unused))) { return -ENOSYS; } -static inline -int lttng_ustconsumer_get_produced_snapshot( - struct lttng_consumer_stream *stream __attribute__((unused)), - unsigned long *pos __attribute__((unused))) +static inline int lttng_ustconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream + __attribute__((unused)), + unsigned long *pos + __attribute__((unused))) { return -ENOSYS; } -static inline -int lttng_ustconsumer_get_consumed_snapshot( - struct lttng_consumer_stream *stream __attribute__((unused)), - unsigned long *pos __attribute__((unused))) +static inline int lttng_ustconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream + __attribute__((unused)), + unsigned long *pos + __attribute__((unused))) { return -ENOSYS; } -static inline -int lttng_ustconsumer_recv_cmd( - struct lttng_consumer_local_data *ctx __attribute__((unused)), - int sock __attribute__((unused)), - struct pollfd *consumer_sockpoll __attribute__((unused))) +static inline int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx + __attribute__((unused)), + int sock __attribute__((unused)), + struct pollfd *consumer_sockpoll + __attribute__((unused))) { return -ENOSYS; } -static inline -void lttng_ustconsumer_del_channel( - struct lttng_consumer_channel *chan __attribute__((unused))) +static inline void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan + __attribute__((unused))) { } -static inline -void lttng_ustconsumer_free_channel( - struct lttng_consumer_channel *chan __attribute__((unused))) +static inline void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan + __attribute__((unused))) { } -static inline -int lttng_ustconsumer_add_stream( - struct lttng_consumer_stream *stream __attribute__((unused))) +static inline int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream + __attribute__((unused))) { return -ENOSYS; } -static inline -void lttng_ustconsumer_del_stream( - struct lttng_consumer_stream *stream __attribute__((unused))) +static inline void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream + __attribute__((unused))) { } -static inline -int lttng_ustconsumer_read_subbuffer( - struct lttng_consumer_stream *stream __attribute__((unused)), - struct lttng_consumer_local_data *ctx __attribute__((unused))) +static inline int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream + __attribute__((unused)), + struct lttng_consumer_local_data *ctx + __attribute__((unused))) { return -ENOSYS; } -static inline -int lttng_ustconsumer_on_recv_stream( - struct lttng_consumer_stream *stream __attribute__((unused))) +static inline int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream + __attribute__((unused))) { return -ENOSYS; } -static inline -void lttng_ustconsumer_on_stream_hangup( - struct lttng_consumer_stream *stream __attribute__((unused))) +static inline void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream + __attribute__((unused))) { } -static inline -int lttng_ustconsumer_data_pending( - struct lttng_consumer_stream *stream __attribute__((unused))) +static inline int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream + __attribute__((unused))) { return -ENOSYS; } -static inline -int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream __attribute__((unused)), - int producer_active __attribute__((unused))) +static inline int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream + __attribute__((unused)), + int producer_active __attribute__((unused))) { return -ENOSYS; } -static inline -void lttng_ustconsumer_close_all_metadata( - struct lttng_ht *ht __attribute__((unused))) +static inline void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht __attribute__((unused))) { } -static inline -void lttng_ustconsumer_close_metadata( - struct lttng_consumer_channel *metadata __attribute__((unused))) +static inline void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata + __attribute__((unused))) { } -static inline -void lttng_ustconsumer_close_stream_wakeup( - struct lttng_consumer_stream *stream __attribute__((unused))) +static inline void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream + __attribute__((unused))) { } -static inline -int lttng_ustconsumer_recv_metadata(int sock __attribute__((unused)), - uint64_t key __attribute__((unused)), - uint64_t offset __attribute__((unused)), - uint64_t len __attribute__((unused)), - uint64_t version __attribute__((unused)), - struct lttng_consumer_channel *channel __attribute__((unused)), - int timer __attribute__((unused))) +static inline int lttng_ustconsumer_recv_metadata(int sock __attribute__((unused)), + uint64_t key __attribute__((unused)), + uint64_t offset __attribute__((unused)), + uint64_t len __attribute__((unused)), + uint64_t version __attribute__((unused)), + struct lttng_consumer_channel *channel + __attribute__((unused)), + int timer __attribute__((unused))) { return -ENOSYS; } -static inline -int lttng_ustconsumer_request_metadata( - struct lttng_consumer_local_data *ctx __attribute__((unused)), - struct lttng_consumer_channel *channel __attribute__((unused)), - int timer __attribute__((unused)), - int wait __attribute__((unused))) +static inline int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx + __attribute__((unused)), + struct lttng_consumer_channel *channel + __attribute__((unused)), + int timer __attribute__((unused)), + int wait __attribute__((unused))) { return -ENOSYS; } -static inline -enum sync_metadata_status lttng_ustconsumer_sync_metadata( - struct lttng_consumer_local_data *ctx __attribute__((unused)), - struct lttng_consumer_stream *metadata __attribute__((unused))) +static inline enum sync_metadata_status +lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx __attribute__((unused)), + struct lttng_consumer_stream *metadata __attribute__((unused))) { return SYNC_METADATA_STATUS_ERROR; } -static inline -int lttng_ustconsumer_flush_buffer( - struct lttng_consumer_stream *stream __attribute__((unused)), - int producer __attribute__((unused))) +static inline int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream + __attribute__((unused)), + int producer __attribute__((unused))) { return -ENOSYS; } -static inline -int lttng_ustconsumer_clear_buffer( - struct lttng_consumer_stream *stream __attribute__((unused))) +static inline int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream + __attribute__((unused))) { return -ENOSYS; } -static inline -int lttng_ustconsumer_get_current_timestamp( - struct lttng_consumer_stream *stream __attribute__((unused)), - uint64_t *ts __attribute__((unused))) +static inline int lttng_ustconsumer_get_current_timestamp(struct lttng_consumer_stream *stream + __attribute__((unused)), + uint64_t *ts __attribute__((unused))) { return -ENOSYS; } -static inline -int lttng_ustconsumer_get_sequence_number( - struct lttng_consumer_stream *stream __attribute__((unused)), - uint64_t *seq __attribute__((unused))) +static inline int lttng_ustconsumer_get_sequence_number(struct lttng_consumer_stream *stream + __attribute__((unused)), + uint64_t *seq __attribute__((unused))) { return -ENOSYS; } -static inline -int lttng_ustconsumer_get_stream_id( - struct lttng_consumer_stream *stream __attribute__((unused)), - uint64_t *stream_id __attribute__((unused))) +static inline int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream + __attribute__((unused)), + uint64_t *stream_id __attribute__((unused))) { return -ENOSYS; } -static inline -void lttng_ustconsumer_sigbus_handle( - void *addr __attribute__((unused))) +static inline void lttng_ustconsumer_sigbus_handle(void *addr __attribute__((unused))) { } #endif /* HAVE_LIBLTTNG_UST_CTL */ diff --git a/src/common/utils.hpp b/src/common/utils.hpp index 12fafe2e3..b190a9b28 100644 --- a/src/common/utils.hpp +++ b/src/common/utils.hpp @@ -8,15 +8,16 @@ #ifndef _COMMON_UTILS_H #define _COMMON_UTILS_H -#include +#include + #include + +#include #include #include #include #include -#include - #define KIBI_LOG2 10 #define MEBI_LOG2 20 #define GIBI_LOG2 30 @@ -30,11 +31,15 @@ int utils_set_fd_cloexec(int fd); int utils_create_pid_file(pid_t pid, const char *filepath); int utils_mkdir(const char *path, mode_t mode, int uid, int gid); int utils_mkdir_recursive(const char *path, mode_t mode, int uid, int gid); -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_parse_size_suffix(char const * const str, uint64_t * const size); -int utils_parse_time_suffix(char const * const str, uint64_t * const time_us); +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_parse_size_suffix(char const *const str, uint64_t *const size); +int utils_parse_time_suffix(char const *const str, uint64_t *const time_us); int utils_get_count_order_u32(uint32_t x); int utils_get_count_order_u64(uint64_t x); const char *utils_get_home_dir(); @@ -44,8 +49,7 @@ size_t utils_get_current_time_str(const char *format, char *dst, size_t len) ATTR_FORMAT_STRFTIME(1); int utils_get_group_id(const char *name, bool warn, gid_t *gid); -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 utils_create_lock_file(const char *filepath); int utils_recursive_rmdir(const char *path); int utils_truncate_stream_file(int fd, off_t length); @@ -53,10 +57,8 @@ int utils_show_help(int section, const char *page_name, const char *help_msg); int utils_get_memory_available(uint64_t *value); int utils_get_memory_total(uint64_t *value); int utils_change_working_directory(const char *path); -enum lttng_error_code utils_user_id_from_name( - const char *user_name, uid_t *user_id); -enum lttng_error_code utils_group_id_from_name( - const char *group_name, gid_t *group_id); +enum lttng_error_code utils_user_id_from_name(const char *user_name, uid_t *user_id); +enum lttng_error_code utils_group_id_from_name(const char *group_name, gid_t *group_id); /* * Parse `str` as an unsigned long long value. @@ -66,7 +68,6 @@ enum lttng_error_code utils_group_id_from_name( * - `str` is zero length * - `str` contains invalid */ -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); #endif /* _COMMON_UTILS_H */ diff --git a/src/common/uuid.hpp b/src/common/uuid.hpp index 586c2ad67..9bec2d55a 100644 --- a/src/common/uuid.hpp +++ b/src/common/uuid.hpp @@ -9,34 +9,34 @@ #define LTTNG_UUID_H #include + +#include +#include #include #include -#include -#include #include /* * Includes final \0. */ -#define LTTNG_UUID_STR_LEN 37 -#define LTTNG_UUID_LEN 16 -#define LTTNG_UUID_VER 4 +#define LTTNG_UUID_STR_LEN 37 +#define LTTNG_UUID_LEN 16 +#define LTTNG_UUID_VER 4 -#define LTTNG_UUID_FMT \ - "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "-%02" SCNx8 \ - "%02" SCNx8 "-%02" SCNx8 "%02" SCNx8 "-%02" SCNx8 "%02" SCNx8 \ - "-%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 \ - "%02" SCNx8 +#define LTTNG_UUID_FMT \ + "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "-%02" SCNx8 "%02" SCNx8 "-%02" SCNx8 \ + "%02" SCNx8 "-%02" SCNx8 "%02" SCNx8 "-%02" SCNx8 "%02" SCNx8 "%02" SCNx8 "%02" SCNx8 \ + "%02" SCNx8 "%02" SCNx8 -#define LTTNG_UUID_FMT_VALUES(uuid) \ - (uuid)[0], (uuid)[1], (uuid)[2], (uuid)[3], (uuid)[4], (uuid)[5], \ - (uuid)[6], (uuid)[7], (uuid)[8], (uuid)[9], (uuid)[10], (uuid)[11], \ - (uuid)[12], (uuid)[13], (uuid)[14], (uuid)[15] +#define LTTNG_UUID_FMT_VALUES(uuid) \ + (uuid)[0], (uuid)[1], (uuid)[2], (uuid)[3], (uuid)[4], (uuid)[5], (uuid)[6], (uuid)[7], \ + (uuid)[8], (uuid)[9], (uuid)[10], (uuid)[11], (uuid)[12], (uuid)[13], (uuid)[14], \ + (uuid)[15] -#define LTTNG_UUID_SCAN_VALUES(uuid) \ - &(uuid)[0], &(uuid)[1], &(uuid)[2], &(uuid)[3], &(uuid)[4], &(uuid)[5], \ - &(uuid)[6], &(uuid)[7], &(uuid)[8], &(uuid)[9], &(uuid)[10], &(uuid)[11], \ - &(uuid)[12], &(uuid)[13], &(uuid)[14], &(uuid)[15] +#define LTTNG_UUID_SCAN_VALUES(uuid) \ + &(uuid)[0], &(uuid)[1], &(uuid)[2], &(uuid)[3], &(uuid)[4], &(uuid)[5], &(uuid)[6], \ + &(uuid)[7], &(uuid)[8], &(uuid)[9], &(uuid)[10], &(uuid)[11], &(uuid)[12], \ + &(uuid)[13], &(uuid)[14], &(uuid)[15] using lttng_uuid = std::array; diff --git a/src/common/waiter.hpp b/src/common/waiter.hpp index 75c9ac447..d88fe0f66 100644 --- a/src/common/waiter.hpp +++ b/src/common/waiter.hpp @@ -12,10 +12,11 @@ #define _LGPL_SOURCE +#include "macros.hpp" + +#include #include #include -#include -#include "macros.hpp" struct lttng_waiter { struct cds_wfs_node wait_queue_node; diff --git a/src/lib/lttng-ctl/lttng-ctl-health.cpp b/src/lib/lttng-ctl/lttng-ctl-health.cpp index 8ec359074..c490f8993 100644 --- a/src/lib/lttng-ctl/lttng-ctl-health.cpp +++ b/src/lib/lttng-ctl/lttng-ctl-health.cpp @@ -13,8 +13,8 @@ #define _LGPL_SOURCE #include "lttng-ctl-helper.hpp" -#include #include +#include #include #include diff --git a/src/lib/lttng-ctl/lttng-ctl-helper.hpp b/src/lib/lttng-ctl/lttng-ctl-helper.hpp index 4b025a4e2..843462e9f 100644 --- a/src/lib/lttng-ctl/lttng-ctl-helper.hpp +++ b/src/lib/lttng-ctl/lttng-ctl-helper.hpp @@ -8,14 +8,14 @@ #ifndef LTTNG_CTL_HELPER_H #define LTTNG_CTL_HELPER_H -#include - #include + #include +#include + /* Copy helper functions. */ -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); /* * Sends the lttcomm message to the session daemon and fills buf if the @@ -25,10 +25,13 @@ void lttng_ctl_copy_lttng_domain(struct lttng_domain *dst, * error code. If buf is NULL, 0 is returned on success. */ 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); /* * Sends the lttcomm message to the session daemon and fills the reply payload. @@ -36,37 +39,34 @@ int lttng_ctl_ask_sessiond_fds_varlen(struct lttcomm_session_msg *lsm, * Return the size of the received data on success or else a negative lttng * error code. */ -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); /* * Calls lttng_ctl_ask_sessiond_fds_varlen() with no expected command header. */ -static inline int lttng_ctl_ask_sessiond_varlen_no_cmd_header( - struct lttcomm_session_msg *lsm, - const void *vardata, - size_t vardata_len, - void **user_payload_buf) +static inline int lttng_ctl_ask_sessiond_varlen_no_cmd_header(struct lttcomm_session_msg *lsm, + const void *vardata, + size_t vardata_len, + void **user_payload_buf) { - return lttng_ctl_ask_sessiond_fds_varlen(lsm, NULL, 0, vardata, - vardata_len, user_payload_buf, NULL, NULL); + return lttng_ctl_ask_sessiond_fds_varlen( + lsm, NULL, 0, vardata, vardata_len, user_payload_buf, NULL, NULL); } /* * Calls lttng_ctl_ask_sessiond_fds_varlen() with fds and no expected command header. */ -static inline -int lttng_ctl_ask_sessiond_fds_no_cmd_header(struct lttcomm_session_msg *lsm, - const int *fds, size_t nb_fd, void **buf __attribute__((unused))) +static inline int lttng_ctl_ask_sessiond_fds_no_cmd_header(struct lttcomm_session_msg *lsm, + const int *fds, + size_t nb_fd, + void **buf __attribute__((unused))) { - return lttng_ctl_ask_sessiond_fds_varlen(lsm, fds, nb_fd, NULL, - 0, NULL, NULL, NULL); + return lttng_ctl_ask_sessiond_fds_varlen(lsm, fds, nb_fd, NULL, 0, NULL, NULL, NULL); } /* * Use this if no variable length data needs to be sent. */ -static inline -int lttng_ctl_ask_sessiond(struct lttcomm_session_msg *lsm, void **buf) +static inline int lttng_ctl_ask_sessiond(struct lttcomm_session_msg *lsm, void **buf) { return lttng_ctl_ask_sessiond_varlen_no_cmd_header(lsm, NULL, 0, buf); } diff --git a/tests/perf/find_event.c b/tests/perf/find_event.c index aa1c964c3..7a8b549f1 100644 --- a/tests/perf/find_event.c +++ b/tests/perf/find_event.c @@ -6,12 +6,11 @@ */ #include -#include -#include - #include #include #include +#include +#include int main(int argc, char **argv) { @@ -25,14 +24,16 @@ int main(int argc, char **argv) struct perf_event_attr attr; if (argc != 2) { - fprintf(stderr, "Usage: %s \n" - "ex: %s UNHALTED_REFERENCE_CYCLES\n" - "Returns the event raw number if found and actionable with" - "return code 0.\n" - "If not found returns 1," - "If not actionable return 2," - "on error returns 255\n", - argv[0], argv[0]); + fprintf(stderr, + "Usage: %s \n" + "ex: %s UNHALTED_REFERENCE_CYCLES\n" + "Returns the event raw number if found and actionable with" + "return code 0.\n" + "If not found returns 1," + "If not actionable return 2," + "on error returns 255\n", + argv[0], + argv[0]); ret = -1; goto end; } @@ -54,18 +55,15 @@ int main(int argc, char **argv) ret = pfm_initialize(); if (ret != PFM_SUCCESS) { - fprintf(stderr, "Failed to initialise libpfm: %s", - pfm_strerror(ret)); + fprintf(stderr, "Failed to initialise libpfm: %s", pfm_strerror(ret)); ret = 255; goto end; } - ret = pfm_get_os_event_encoding(argv[1], - PFM_PLM0 | PFM_PLM1 | PFM_PLM2 | PFM_PLM3, - PFM_OS_PERF_EVENT, &pencoder); + ret = pfm_get_os_event_encoding( + argv[1], PFM_PLM0 | PFM_PLM1 | PFM_PLM2 | PFM_PLM3, PFM_OS_PERF_EVENT, &pencoder); if (ret != PFM_SUCCESS) { - fprintf(stderr, "libpfm: error pfm_get_os_event_encoding: %s\n", - pfm_strerror(ret)); + fprintf(stderr, "libpfm: error pfm_get_os_event_encoding: %s\n", pfm_strerror(ret)); ret = 1; goto end; } @@ -93,8 +91,7 @@ int main(int argc, char **argv) /* perf_event_open is provided by perfmon/perf_event.h. */ fd = perf_event_open(pencoder.attr, 0, -1, -1, 0); if (fd == -1) { - fprintf(stderr, "perf: error perf_event_open: %d: %s\n", errno, - strerror(errno)); + fprintf(stderr, "perf: error perf_event_open: %d: %s\n", errno, strerror(errno)); ret = 2; goto end; } diff --git a/tests/regression/tools/filtering/gen-ust-events.c b/tests/regression/tools/filtering/gen-ust-events.c index d4f8a57bd..681d19178 100644 --- a/tests/regression/tools/filtering/gen-ust-events.c +++ b/tests/regression/tools/filtering/gen-ust-events.c @@ -46,8 +46,17 @@ int main(int argc, char **argv) for (i = 0; i < nr_iter; i++) { netint = htonl(i); - tracepoint(tp, tptest, i, netint, values, text, strlen(text), escape, dbl, flt, - net_values); + tracepoint(tp, + tptest, + i, + netint, + values, + text, + strlen(text), + escape, + dbl, + flt, + net_values); usleep(nr_usec); } diff --git a/tests/regression/tools/filtering/tp.h b/tests/regression/tools/filtering/tp.h index ce2b6d1e9..44ca83573 100644 --- a/tests/regression/tools/filtering/tp.h +++ b/tests/regression/tools/filtering/tp.h @@ -13,30 +13,55 @@ #include -TRACEPOINT_EVENT(tp, tptest, - TP_ARGS(int, anint, int, netint, long *, values, - char *, text, size_t, textlen, - char *, etext, double, doublearg, float, floatarg, - uint32_t *, net_values), - TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer_hex(int, intfield2, anint) - ctf_integer(long, longfield, anint) - ctf_integer_network(int, netintfield, netint) - ctf_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) - ctf_array_network(uint32_t, arrfield3, net_values, 3) - ctf_sequence(char, seqfield1, text, size_t, textlen) - ctf_sequence_text(char, seqfield2, text, size_t, textlen) - ctf_sequence_network(uint32_t, seqfield3, net_values, size_t, 3) - ctf_sequence(long, seqfield4, values, size_t, 3) - ctf_string(stringfield, text) - ctf_string(stringfield2, etext) - ctf_float(float, floatfield, floatarg) - ctf_float(double, doublefield, doublearg) - ) -) +TRACEPOINT_EVENT( + tp, + tptest, + TP_ARGS(int, + anint, + int, + netint, + long *, + values, + char *, + text, + size_t, + textlen, + char *, + etext, + double, + doublearg, + float, + floatarg, + uint32_t *, + net_values), + TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex( + int, intfield2, anint) ctf_integer(long, longfield, anint) + ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex( + int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3) + ctf_array_text(char, arrfield2, text, 10) ctf_array_network( + uint32_t, + arrfield3, + net_values, + 3) ctf_sequence(char, seqfield1, text, size_t, textlen) + ctf_sequence_text(char, seqfield2, text, size_t, textlen) + ctf_sequence_network(uint32_t, + seqfield3, + net_values, + size_t, + 3) ctf_sequence(long, + seqfield4, + values, + size_t, + 3) + ctf_string(stringfield, + text) ctf_string(stringfield2, + etext) + ctf_float(float, + floatfield, + floatarg) + ctf_float(double, + doublefield, + doublearg))) #endif /* _TRACEPOINT_TP_H */ diff --git a/tests/regression/tools/health/health_check.c b/tests/regression/tools/health/health_check.c index deeab67b9..805eff884 100644 --- a/tests/regression/tools/health/health_check.c +++ b/tests/regression/tools/health/health_check.c @@ -6,17 +6,16 @@ * */ +#include + #include #include #include -#include - static const char *relayd_path; -static -int check_component(struct lttng_health *lh, const char *component_name, - int ok_if_not_running) +static int +check_component(struct lttng_health *lh, const char *component_name, int ok_if_not_running) { const struct lttng_health_thread *thread; int nr_threads, i, status; @@ -25,8 +24,7 @@ int check_component(struct lttng_health *lh, const char *component_name, if (ok_if_not_running) { return 0; } - fprintf(stderr, "Error querying %s health\n", - component_name); + fprintf(stderr, "Error querying %s health\n", component_name); return -1; } status = lttng_health_state(lh); @@ -54,15 +52,13 @@ int check_component(struct lttng_health *lh, const char *component_name, continue; } printf("Thread \"%s\" is not responding in component \"%s\".\n", - lttng_health_thread_name(thread), - component_name); - + lttng_health_thread_name(thread), + component_name); } return status; } -static -int check_sessiond(void) +static int check_sessiond(void) { struct lttng_health *lh; int status; @@ -80,8 +76,7 @@ int check_sessiond(void) return status; } -static -int check_consumerd(enum lttng_health_consumerd hc) +static int check_consumerd(enum lttng_health_consumerd hc) { struct lttng_health *lh; int status; @@ -104,8 +99,7 @@ int check_consumerd(enum lttng_health_consumerd hc) return status; } -static -int check_relayd(const char *path) +static int check_relayd(const char *path) { struct lttng_health *lh; int status; @@ -129,11 +123,12 @@ int main(int argc, char *argv[]) for (i = 1; i < argc; i++) { size_t relayd_path_arg_len = strlen("--relayd-path="); - if (!strncmp(argv[i], "--relayd-path=", - relayd_path_arg_len)) { + if (!strncmp(argv[i], "--relayd-path=", relayd_path_arg_len)) { relayd_path = &argv[i][relayd_path_arg_len]; } else { - fprintf(stderr, "Unknown option \"%s\". Try --relayd-path=PATH.\n", argv[i]); + fprintf(stderr, + "Unknown option \"%s\". Try --relayd-path=PATH.\n", + argv[i]); exit(EXIT_FAILURE); } } diff --git a/tests/regression/tools/health/health_fail.c b/tests/regression/tools/health/health_fail.c index 6520337e4..2994694fd 100644 --- a/tests/regression/tools/health/health_fail.c +++ b/tests/regression/tools/health/health_fail.c @@ -7,17 +7,17 @@ */ #include + +#include #include #include -#include #include /* * Check if the specified environment variable is set. * Return 1 if set, otherwise 0. */ -static -int check_env_var(const char *env) +static int check_env_var(const char *env) { if (env) { char *env_val = getenv(env); diff --git a/tests/regression/tools/health/health_stall.c b/tests/regression/tools/health/health_stall.c index d01ad4cb9..c88e5742a 100644 --- a/tests/regression/tools/health/health_stall.c +++ b/tests/regression/tools/health/health_stall.c @@ -7,9 +7,10 @@ */ #include + +#include #include #include -#include #include #include @@ -19,8 +20,7 @@ * Check if the specified environment variable is set. * Return 1 if set, otherwise 0. */ -static -int check_env_var(const char *env) +static int check_env_var(const char *env) { if (env) { char *env_val = getenv(env); @@ -32,8 +32,7 @@ int check_env_var(const char *env) return 0; } -static -void do_stall(void) +static void do_stall(void) { unsigned int sleep_time = STALL_TIME; diff --git a/tests/regression/tools/notification/base_client.c b/tests/regression/tools/notification/base_client.c index b7e1a9f42..1f7158aea 100644 --- a/tests/regression/tools/notification/base_client.c +++ b/tests/regression/tools/notification/base_client.c @@ -9,12 +9,6 @@ * */ -#include -#include -#include -#include -#include - #include #include #include @@ -23,10 +17,16 @@ #include #include #include +#include #include #include #include -#include + +#include +#include +#include +#include +#include static unsigned int nr_notifications = 0; static unsigned int nr_expected_notifications = 0; @@ -39,12 +39,10 @@ static bool use_action_list = false; static enum lttng_condition_type buffer_usage_type = LTTNG_CONDITION_TYPE_UNKNOWN; static enum lttng_domain_type domain_type = LTTNG_DOMAIN_NONE; -int handle_condition( - const struct lttng_condition *condition, - const struct lttng_evaluation *condition_evaluation); +int handle_condition(const struct lttng_condition *condition, + const struct lttng_evaluation *condition_evaluation); -static -int parse_arguments(char **argv) +static int parse_arguments(char **argv) { int sscanf_ret; const char *domain_type_string = NULL; @@ -91,32 +89,29 @@ int parse_arguments(char **argv) /* Ratio or bytes ? */ if (!strcasecmp("bytes", buffer_usage_threshold_type)) { is_threshold_ratio = false; - sscanf_ret = sscanf(buffer_usage_threshold_value, "%" SCNu64, - &threshold_bytes); + sscanf_ret = sscanf(buffer_usage_threshold_value, "%" SCNu64, &threshold_bytes); if (sscanf_ret != 1) { printf("error: Invalid buffer usage threshold value bytes (integer), sscanf returned %d\n", - sscanf_ret); + sscanf_ret); goto error; } } if (!strcasecmp("ratio", buffer_usage_threshold_type)) { is_threshold_ratio = true; - sscanf_ret = sscanf(buffer_usage_threshold_value, "%lf", - &threshold_ratio); + sscanf_ret = sscanf(buffer_usage_threshold_value, "%lf", &threshold_ratio); if (sscanf_ret != 1) { printf("error: Invalid buffer usage threshold value ratio (float), sscanf returned %d\n", - sscanf_ret); + sscanf_ret); goto error; } } /* Number of notification to expect */ - sscanf_ret = sscanf(nr_expected_notifications_string, "%d", - &nr_expected_notifications); + sscanf_ret = sscanf(nr_expected_notifications_string, "%d", &nr_expected_notifications); if (sscanf_ret != 1) { printf("error: Invalid nr_expected_notifications, sscanf returned %d\n", - sscanf_ret); + sscanf_ret); goto error; } @@ -162,8 +157,8 @@ int main(int argc, char **argv) } /* Setup */ - 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) { printf("error: Could not create notification channel\n"); ret = 1; @@ -191,10 +186,10 @@ int main(int argc, char **argv) if (is_threshold_ratio) { condition_status = lttng_condition_buffer_usage_set_threshold_ratio( - condition, threshold_ratio); + condition, threshold_ratio); } else { - condition_status = lttng_condition_buffer_usage_set_threshold( - condition, threshold_bytes); + condition_status = + lttng_condition_buffer_usage_set_threshold(condition, threshold_bytes); } if (condition_status != LTTNG_CONDITION_STATUS_OK) { @@ -203,22 +198,19 @@ int main(int argc, char **argv) goto end; } - 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) { printf("error: Could not set session name\n"); 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) { printf("error: Could not set channel name\n"); 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) { printf("error: Could not set domain type\n"); ret = 1; @@ -302,9 +294,8 @@ int main(int argc, char **argv) goto end; } /* Receive the next notification. */ - status = lttng_notification_channel_get_next_notification( - notification_channel, - ¬ification); + status = lttng_notification_channel_get_next_notification(notification_channel, + ¬ification); switch (status) { case LTTNG_NOTIFICATION_CHANNEL_STATUS_OK: @@ -355,9 +346,8 @@ end: return ret; } -int handle_condition( - const struct lttng_condition *condition, - const struct lttng_evaluation *evaluation) +int handle_condition(const struct lttng_condition *condition, + const struct lttng_evaluation *evaluation) { int ret = 0; const char *string_low = "low"; @@ -379,22 +369,19 @@ int handle_condition( } /* Fetch info to test */ - ret = lttng_condition_buffer_usage_get_session_name(condition, - &condition_session_name); + ret = lttng_condition_buffer_usage_get_session_name(condition, &condition_session_name); if (ret) { printf("error: session name could not be fetched\n"); ret = 1; goto end; } - ret = lttng_condition_buffer_usage_get_channel_name(condition, - &condition_channel_name); + ret = lttng_condition_buffer_usage_get_channel_name(condition, &condition_channel_name); if (ret) { printf("error: channel name could not be fetched\n"); ret = 1; goto end; } - ret = lttng_condition_buffer_usage_get_domain_type(condition, - &condition_domain_type); + ret = lttng_condition_buffer_usage_get_domain_type(condition, &condition_domain_type); if (ret) { printf("error: domain type could not be fetched\n"); ret = 1; @@ -420,8 +407,7 @@ int handle_condition( } if (is_threshold_ratio) { - lttng_evaluation_buffer_usage_get_usage_ratio( - evaluation, &buffer_usage_ratio); + lttng_evaluation_buffer_usage_get_usage_ratio(evaluation, &buffer_usage_ratio); switch (condition_type) { case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW: if (buffer_usage_ratio > threshold_ratio) { @@ -443,8 +429,7 @@ int handle_condition( goto end; } } else { - lttng_evaluation_buffer_usage_get_usage( - evaluation, &buffer_usage_bytes); + lttng_evaluation_buffer_usage_get_usage(evaluation, &buffer_usage_bytes); switch (condition_type) { case LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW: if (buffer_usage_bytes > threshold_bytes) { diff --git a/tests/regression/tools/notification/rotation.c b/tests/regression/tools/notification/rotation.c index 55ee2e69e..1007de44e 100644 --- a/tests/regression/tools/notification/rotation.c +++ b/tests/regression/tools/notification/rotation.c @@ -9,12 +9,13 @@ * */ -#include -#include -#include +#include + #include +#include #include -#include +#include +#include #define TEST_COUNT 36 @@ -25,41 +26,35 @@ struct session { uint64_t expected_rotation_id = UINT64_MAX; -static -int test_condition(struct lttng_condition *condition, const char *type_name) +static int test_condition(struct lttng_condition *condition, const char *type_name) { int ret = 0; const char *out_session_name; - const char * const session_name = "test session name"; + const char *const session_name = "test session name"; enum lttng_condition_status status; - status = lttng_condition_session_rotation_get_session_name(condition, - &out_session_name); + status = lttng_condition_session_rotation_get_session_name(condition, &out_session_name); ok(status == LTTNG_CONDITION_STATUS_UNSET, - "Getting unset name of %s condition fails with LTTNG_CONDITION_STATUS_UNSET", - type_name); + "Getting unset name of %s condition fails with LTTNG_CONDITION_STATUS_UNSET", + type_name); - status = lttng_condition_session_rotation_set_session_name(condition, - session_name); + status = lttng_condition_session_rotation_set_session_name(condition, session_name); ok(status == LTTNG_CONDITION_STATUS_OK, - "Setting session name \"%s\" of %s condition succeeds", - session_name, type_name); + "Setting session name \"%s\" of %s condition succeeds", + session_name, + type_name); - status = lttng_condition_session_rotation_get_session_name(condition, - &out_session_name); - ok(status == LTTNG_CONDITION_STATUS_OK, - "Getting name of %s condition succeeds", - type_name); + status = lttng_condition_session_rotation_get_session_name(condition, &out_session_name); + ok(status == LTTNG_CONDITION_STATUS_OK, "Getting name of %s condition succeeds", type_name); ok(out_session_name && !strcmp(session_name, out_session_name), - "Session name returned by %s condition matches the expected name", - type_name); + "Session name returned by %s condition matches the expected name", + type_name); return ret; } -static -int setup_rotation_trigger(const struct session *session, - struct lttng_notification_channel *notification_channel) +static int setup_rotation_trigger(const struct session *session, + struct lttng_notification_channel *notification_channel) { int ret; struct lttng_condition *rotation_ongoing_condition = NULL; @@ -78,8 +73,7 @@ int setup_rotation_trigger(const struct session *session, } /* Create rotation ongoing and completed conditions. */ - rotation_ongoing_condition = - lttng_condition_session_rotation_ongoing_create(); + rotation_ongoing_condition = lttng_condition_session_rotation_ongoing_create(); ok(rotation_ongoing_condition, "Create session rotation ongoing condition"); if (!rotation_ongoing_condition) { ret = -1; @@ -90,15 +84,14 @@ int setup_rotation_trigger(const struct session *session, goto end; } condition_status = lttng_condition_session_rotation_set_session_name( - rotation_ongoing_condition, session->name); + rotation_ongoing_condition, session->name); if (condition_status != LTTNG_CONDITION_STATUS_OK) { ret = -1; diag("Failed to set session name on session rotation ongoing condition"); goto end; } - rotation_completed_condition = - lttng_condition_session_rotation_completed_create(); + rotation_completed_condition = lttng_condition_session_rotation_completed_create(); ok(rotation_completed_condition, "Create session rotation completed condition"); if (!rotation_completed_condition) { ret = -1; @@ -110,42 +103,38 @@ int setup_rotation_trigger(const struct session *session, goto end; } condition_status = lttng_condition_session_rotation_set_session_name( - rotation_completed_condition, session->name); + rotation_completed_condition, session->name); if (condition_status != LTTNG_CONDITION_STATUS_OK) { ret = -1; goto end; } notification_channel_status = lttng_notification_channel_subscribe( - notification_channel, rotation_ongoing_condition); + notification_channel, rotation_ongoing_condition); ok(notification_channel_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK, - "Subscribe to session rotation ongoing notifications"); - if (notification_channel_status != - LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) { + "Subscribe to session rotation ongoing notifications"); + if (notification_channel_status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) { ret = -1; goto end; } notification_channel_status = lttng_notification_channel_subscribe( - notification_channel, rotation_completed_condition); + notification_channel, rotation_completed_condition); ok(notification_channel_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK, - "Subscribe to session rotation completed notifications"); - if (notification_channel_status != - LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) { + "Subscribe to session rotation completed notifications"); + if (notification_channel_status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) { ret = -1; goto end; } /* Create rotation ongoing and completed triggers. */ - rotation_ongoing_trigger = lttng_trigger_create( - rotation_ongoing_condition, notify); + rotation_ongoing_trigger = lttng_trigger_create(rotation_ongoing_condition, notify); ok(rotation_ongoing_trigger, "Create a rotation ongoing notification trigger"); if (!rotation_ongoing_trigger) { ret = -1; goto end; } - rotation_completed_trigger = lttng_trigger_create( - rotation_completed_condition, notify); + rotation_completed_trigger = lttng_trigger_create(rotation_completed_condition, notify); ok(rotation_completed_trigger, "Create a rotation completed notification trigger"); if (!rotation_completed_trigger) { ret = -1; @@ -153,18 +142,15 @@ int setup_rotation_trigger(const struct session *session, } /* Register rotation ongoing and completed triggers. */ - ret_code = lttng_register_trigger_with_automatic_name( - rotation_ongoing_trigger); + ret_code = lttng_register_trigger_with_automatic_name(rotation_ongoing_trigger); ok(ret_code == LTTNG_OK, "Registered session rotation ongoing trigger"); if (ret_code != LTTNG_OK) { ret = -ret_code; goto end; } - ret_code = lttng_register_trigger_with_automatic_name( - rotation_completed_trigger); - ok(ret_code == LTTNG_OK, - "Registered session rotation completed trigger"); + ret_code = lttng_register_trigger_with_automatic_name(rotation_completed_trigger); + ok(ret_code == LTTNG_OK, "Registered session rotation completed trigger"); if (ret_code != LTTNG_OK) { ret = -ret_code; goto end; @@ -179,12 +165,10 @@ end: return ret; } -static -int test_notification( - struct lttng_notification_channel *notification_channel, - const struct session *session, - const char *expected_notification_type_name, - enum lttng_condition_type expected_condition_type) +static int test_notification(struct lttng_notification_channel *notification_channel, + const struct session *session, + const char *expected_notification_type_name, + enum lttng_condition_type expected_condition_type) { int ret = 0; bool notification_pending; @@ -202,28 +186,28 @@ int test_notification( const char *chunk_path = NULL; notification_channel_status = lttng_notification_channel_has_pending_notification( - notification_channel, ¬ification_pending); + notification_channel, ¬ification_pending); ok(notification_channel_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK, - "Check for %s notification pending on notification channel", - expected_notification_type_name); + "Check for %s notification pending on notification channel", + expected_notification_type_name); if (notification_channel_status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) { ret = -1; goto end; } ok(notification_pending, - "Session %s notification is pending on notification channel", - expected_notification_type_name); + "Session %s notification is pending on notification channel", + expected_notification_type_name); if (!notification_pending) { ret = -1; goto end; } notification_channel_status = lttng_notification_channel_get_next_notification( - notification_channel, ¬ification); + notification_channel, ¬ification); ok(notification_channel_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK && notification, - "Get %s notification from notification channel", - expected_notification_type_name); + "Get %s notification from notification channel", + expected_notification_type_name); if (notification_channel_status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK || !notification) { ret = -1; goto end; @@ -238,18 +222,18 @@ int test_notification( condition_type = lttng_condition_get_type(condition); ok(condition_type == expected_condition_type, - "Notification condition obtained from notification channel is of type \"%s\"", - expected_notification_type_name); + "Notification condition obtained from notification channel is of type \"%s\"", + expected_notification_type_name); if (condition_type != expected_condition_type) { ret = -1; goto end; } - condition_status = lttng_condition_session_rotation_get_session_name( - condition, &session_name); + condition_status = + lttng_condition_session_rotation_get_session_name(condition, &session_name); ok(condition_status == LTTNG_CONDITION_STATUS_OK && session_name && - !strcmp(session_name, session->name), - "Condition obtained from notification has the correct session name assigned"); + !strcmp(session_name, session->name), + "Condition obtained from notification has the correct session name assigned"); if (condition_status != LTTNG_CONDITION_STATUS_OK || !session_name) { ret = -1; goto end; @@ -263,18 +247,17 @@ int test_notification( } condition_type = lttng_evaluation_get_type(evaluation); ok(condition_type == expected_condition_type, - "Condition evaluation obtained from notification channel is of type \"%s\"", - expected_notification_type_name); + "Condition evaluation obtained from notification channel is of type \"%s\"", + expected_notification_type_name); if (condition_type != expected_condition_type) { ret = -1; goto end; } - evaluation_status = lttng_evaluation_session_rotation_get_id(evaluation, - &rotation_id); + evaluation_status = lttng_evaluation_session_rotation_get_id(evaluation, &rotation_id); ok(evaluation_status == LTTNG_EVALUATION_STATUS_OK, - "Get %s id from notification evaluation", - expected_notification_type_name); + "Get %s id from notification evaluation", + expected_notification_type_name); if (evaluation_status != LTTNG_EVALUATION_STATUS_OK) { ret = -1; goto end; @@ -288,51 +271,52 @@ int test_notification( goto end; } - evaluation_status = lttng_evaluation_session_rotation_completed_get_location( - evaluation, &location); + evaluation_status = + lttng_evaluation_session_rotation_completed_get_location(evaluation, &location); ok(evaluation_status == LTTNG_EVALUATION_STATUS_OK && location, - "Get session %s chunk location from evaluation", - expected_notification_type_name); + "Get session %s chunk location from evaluation", + expected_notification_type_name); if (evaluation_status != LTTNG_EVALUATION_STATUS_OK || !location) { ret = -1; goto end; } - ok(lttng_trace_archive_location_get_type(location) == LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL, - "Location returned from the session rotation completed notification is of type 'local'"); + ok(lttng_trace_archive_location_get_type(location) == + LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL, + "Location returned from the session rotation completed notification is of type 'local'"); - location_status = lttng_trace_archive_location_local_get_absolute_path( - location, &chunk_path); + location_status = + lttng_trace_archive_location_local_get_absolute_path(location, &chunk_path); ok(location_status == LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK && chunk_path, - "Retrieved path from location returned by the session rotation completed notification"); + "Retrieved path from location returned by the session rotation completed notification"); diag("Chunk available at %s", chunk_path ? chunk_path : "NULL"); ok(chunk_path && !strncmp(session->output_path, chunk_path, strlen(session->output_path)), - "Returned path from location starts with the output path"); + "Returned path from location starts with the output path"); end: lttng_notification_destroy(notification); return ret; } -static -int test_rotation_ongoing_notification( - struct lttng_notification_channel *notification_channel, - struct session *session) +static int +test_rotation_ongoing_notification(struct lttng_notification_channel *notification_channel, + struct session *session) { - return test_notification(notification_channel, session, - "rotation ongoing", - LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING); + return test_notification(notification_channel, + session, + "rotation ongoing", + LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING); } -static -int test_rotation_completed_notification( - struct lttng_notification_channel *notification_channel, - struct session *session) +static int +test_rotation_completed_notification(struct lttng_notification_channel *notification_channel, + struct session *session) { - return test_notification(notification_channel, session, - "rotation completed", - LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED); + return test_notification(notification_channel, + session, + "rotation completed", + LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED); } int main(int argc, const char *argv[]) @@ -342,8 +326,7 @@ int main(int argc, const char *argv[]) struct lttng_notification_channel *notification_channel = NULL; struct lttng_rotation_handle *rotation_handle = NULL; enum lttng_rotation_status rotation_status; - enum lttng_rotation_state rotation_state = - LTTNG_ROTATION_STATE_NO_ROTATION; + enum lttng_rotation_state rotation_state = LTTNG_ROTATION_STATE_NO_ROTATION; if (argc != 3) { puts("Usage: rotation SESSION_NAME SESSION_OUTPUT_PATH"); @@ -356,8 +339,8 @@ int main(int argc, const char *argv[]) plan_tests(TEST_COUNT); - 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) { diag("Failed to create notification channel"); ret = -1; @@ -371,20 +354,19 @@ int main(int argc, const char *argv[]) /* Start rotation and wait for its completion. */ ret = lttng_rotate_session(session.name, NULL, &rotation_handle); - ok(ret >= 0 && rotation_handle, "Start rotation of session \"%s\"", - session.name); + ok(ret >= 0 && rotation_handle, "Start rotation of session \"%s\"", session.name); if (ret < 0 || !rotation_handle) { goto error; } do { - rotation_status = lttng_rotation_handle_get_state( - rotation_handle, &rotation_state); + rotation_status = lttng_rotation_handle_get_state(rotation_handle, &rotation_state); } while (rotation_state == LTTNG_ROTATION_STATE_ONGOING && - rotation_status == LTTNG_ROTATION_STATUS_OK); + rotation_status == LTTNG_ROTATION_STATUS_OK); ok(rotation_status == LTTNG_ROTATION_STATUS_OK && - rotation_state == LTTNG_ROTATION_STATE_COMPLETED, - "Complete rotation of session \"%s\"", session.name); + rotation_state == LTTNG_ROTATION_STATE_COMPLETED, + "Complete rotation of session \"%s\"", + session.name); /* * After a rotation has completed, we can expect two notifications to @@ -392,14 +374,12 @@ int main(int argc, const char *argv[]) * - Session rotation ongoing * - Session rotation completed */ - ret = test_rotation_ongoing_notification(notification_channel, - &session); + ret = test_rotation_ongoing_notification(notification_channel, &session); if (ret) { goto error; } - ret = test_rotation_completed_notification(notification_channel, - &session); + ret = test_rotation_completed_notification(notification_channel, &session); if (ret) { goto error; } diff --git a/tests/regression/tools/rotation/schedule_api.c b/tests/regression/tools/rotation/schedule_api.c index 009473893..3a195c12b 100644 --- a/tests/regression/tools/rotation/schedule_api.c +++ b/tests/regression/tools/rotation/schedule_api.c @@ -9,22 +9,21 @@ * */ -#include +#include + #include +#include #include -#include - #define NUM_TESTS 26 #define SIZE_THRESHOLD_BYTES 1024 -#define PERIODIC_TIME_US 1000000 +#define PERIODIC_TIME_US 1000000 const char *session_name; -static -bool schedules_equal(const struct lttng_rotation_schedule *a, - const struct lttng_rotation_schedule *b) +static bool schedules_equal(const struct lttng_rotation_schedule *a, + const struct lttng_rotation_schedule *b) { bool equal = false; enum lttng_rotation_schedule_type a_type, b_type; @@ -34,22 +33,19 @@ bool schedules_equal(const struct lttng_rotation_schedule *a, a_type = lttng_rotation_schedule_get_type(a); b_type = lttng_rotation_schedule_get_type(b); if (a_type != b_type) { - diag("Schedules are not of the same type (%i != %i)", - a_type, b_type); + diag("Schedules are not of the same type (%i != %i)", a_type, b_type); goto end; } switch (a_type) { case LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD: { - status = lttng_rotation_schedule_size_threshold_get_threshold(a, - &a_value); + status = lttng_rotation_schedule_size_threshold_get_threshold(a, &a_value); if (status != LTTNG_ROTATION_STATUS_OK) { diag("Failed to retrieve size threshold of schedule 'a'"); goto end; } - status = lttng_rotation_schedule_size_threshold_get_threshold(b, - &b_value); + status = lttng_rotation_schedule_size_threshold_get_threshold(b, &b_value); if (status != LTTNG_ROTATION_STATUS_OK) { diag("Failed to retrieve size threshold of schedule 'b'"); goto end; @@ -58,14 +54,12 @@ bool schedules_equal(const struct lttng_rotation_schedule *a, } case LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC: { - status = lttng_rotation_schedule_periodic_get_period(a, - &a_value); + status = lttng_rotation_schedule_periodic_get_period(a, &a_value); if (status != LTTNG_ROTATION_STATUS_OK) { diag("Failed to retrieve period of schedule 'a'"); goto end; } - status = lttng_rotation_schedule_periodic_get_period(b, - &b_value); + status = lttng_rotation_schedule_periodic_get_period(b, &b_value); if (status != LTTNG_ROTATION_STATUS_OK) { diag("Failed to retrieve period of schedule 'b'"); goto end; @@ -85,8 +79,7 @@ end: return equal; } -static -void test_add_null_session(void) +static void test_add_null_session(void) { enum lttng_rotation_status status; struct lttng_rotation_schedule *size_schedule = NULL; @@ -95,49 +88,43 @@ void test_add_null_session(void) status = lttng_session_add_rotation_schedule(NULL, size_schedule); ok(status == LTTNG_ROTATION_STATUS_INVALID, - "NULL session name rejected by lttng_session_add_rotation_schedule()"); + "NULL session name rejected by lttng_session_add_rotation_schedule()"); lttng_rotation_schedule_destroy(size_schedule); } -static -void test_add_null_schedule(void) +static void test_add_null_schedule(void) { enum lttng_rotation_status status; status = lttng_session_add_rotation_schedule(session_name, NULL); ok(status == LTTNG_ROTATION_STATUS_INVALID, - "NULL schedule rejected by lttng_session_add_rotation_schedule()"); + "NULL schedule rejected by lttng_session_add_rotation_schedule()"); } -static -void test_add_uninitialized_schedule(void) +static void test_add_uninitialized_schedule(void) { enum lttng_rotation_status status; - struct lttng_rotation_schedule *size_schedule = NULL, - *periodic_schedule = NULL; + struct lttng_rotation_schedule *size_schedule = NULL, *periodic_schedule = NULL; size_schedule = lttng_rotation_schedule_size_threshold_create(); ok(size_schedule, "Created a size threshold session rotation schedule"); - status = lttng_session_add_rotation_schedule(session_name, - size_schedule); + status = lttng_session_add_rotation_schedule(session_name, size_schedule); ok(status == LTTNG_ROTATION_STATUS_INVALID, - "Uninitialized size schedule rejected by lttng_session_add_rotation_schedule()"); + "Uninitialized size schedule rejected by lttng_session_add_rotation_schedule()"); periodic_schedule = lttng_rotation_schedule_periodic_create(); ok(periodic_schedule, "Created a periodic session rotation schedule"); - status = lttng_session_add_rotation_schedule(session_name, - periodic_schedule); + status = lttng_session_add_rotation_schedule(session_name, periodic_schedule); ok(status == LTTNG_ROTATION_STATUS_INVALID, - "Uninitialized periodic schedule rejected by lttng_session_add_rotation_schedule()"); + "Uninitialized periodic schedule rejected by lttng_session_add_rotation_schedule()"); lttng_rotation_schedule_destroy(size_schedule); lttng_rotation_schedule_destroy(periodic_schedule); } -static -void test_remove_null_session(void) +static void test_remove_null_session(void) { enum lttng_rotation_status status; struct lttng_rotation_schedule *size_schedule = NULL; @@ -146,71 +133,59 @@ void test_remove_null_session(void) status = lttng_session_remove_rotation_schedule(NULL, size_schedule); ok(status == LTTNG_ROTATION_STATUS_INVALID, - "NULL session name rejected by lttng_session_remove_rotation_schedule()"); + "NULL session name rejected by lttng_session_remove_rotation_schedule()"); lttng_rotation_schedule_destroy(size_schedule); } -static -void test_remove_null_schedule(void) +static void test_remove_null_schedule(void) { enum lttng_rotation_status status; status = lttng_session_remove_rotation_schedule(session_name, NULL); ok(status == LTTNG_ROTATION_STATUS_INVALID, - "NULL schedule rejected by lttng_session_remove_rotation_schedule()"); + "NULL schedule rejected by lttng_session_remove_rotation_schedule()"); } -static -void test_remove_uninitialized_schedule(void) +static void test_remove_uninitialized_schedule(void) { enum lttng_rotation_status status; - struct lttng_rotation_schedule *size_schedule = NULL, - *periodic_schedule = NULL; + struct lttng_rotation_schedule *size_schedule = NULL, *periodic_schedule = NULL; size_schedule = lttng_rotation_schedule_size_threshold_create(); - status = lttng_session_remove_rotation_schedule(session_name, - size_schedule); + status = lttng_session_remove_rotation_schedule(session_name, size_schedule); ok(status == LTTNG_ROTATION_STATUS_INVALID, - "Uninitialized size schedule rejected by lttng_session_remove_rotation_schedule()"); + "Uninitialized size schedule rejected by lttng_session_remove_rotation_schedule()"); periodic_schedule = lttng_rotation_schedule_periodic_create(); - status = lttng_session_remove_rotation_schedule(session_name, - periodic_schedule); + status = lttng_session_remove_rotation_schedule(session_name, periodic_schedule); ok(status == LTTNG_ROTATION_STATUS_INVALID, - "Uninitialized periodic schedule rejected by lttng_session_remove_rotation_schedule()"); + "Uninitialized periodic schedule rejected by lttng_session_remove_rotation_schedule()"); lttng_rotation_schedule_destroy(size_schedule); lttng_rotation_schedule_destroy(periodic_schedule); } -static -void test_uninitialized_schedule_get(void) +static void test_uninitialized_schedule_get(void) { uint64_t value; enum lttng_rotation_status status; - struct lttng_rotation_schedule *size_schedule = NULL, - *periodic_schedule = NULL; + struct lttng_rotation_schedule *size_schedule = NULL, *periodic_schedule = NULL; size_schedule = lttng_rotation_schedule_size_threshold_create(); periodic_schedule = lttng_rotation_schedule_periodic_create(); - status = lttng_rotation_schedule_size_threshold_get_threshold( - size_schedule, &value); + status = lttng_rotation_schedule_size_threshold_get_threshold(size_schedule, &value); ok(status == LTTNG_ROTATION_STATUS_UNAVAILABLE, - "Getter on size threshold rotation schedule returns LTTNG_ROTATION_STATUS_UNAVAILABLE by default"); - status = lttng_rotation_schedule_periodic_get_period(periodic_schedule, - &value); + "Getter on size threshold rotation schedule returns LTTNG_ROTATION_STATUS_UNAVAILABLE by default"); + status = lttng_rotation_schedule_periodic_get_period(periodic_schedule, &value); ok(status == LTTNG_ROTATION_STATUS_UNAVAILABLE, - "Getter on periodic rotation schedule returns LTTNG_ROTATION_STATUS_UNAVAILABLE by default"); + "Getter on periodic rotation schedule returns LTTNG_ROTATION_STATUS_UNAVAILABLE by default"); lttng_rotation_schedule_destroy(size_schedule); lttng_rotation_schedule_destroy(periodic_schedule); - } -static -void test_add_list_remove_schedule( - const struct lttng_rotation_schedule *original_schedule) +static void test_add_list_remove_schedule(const struct lttng_rotation_schedule *original_schedule) { int ret; unsigned int schedules_count = 0; @@ -218,68 +193,57 @@ void test_add_list_remove_schedule( const struct lttng_rotation_schedule *list_schedule; struct lttng_rotation_schedules *list_schedules; - status = lttng_session_add_rotation_schedule(session_name, - original_schedule); + status = lttng_session_add_rotation_schedule(session_name, original_schedule); ok(status == LTTNG_ROTATION_STATUS_OK, - "Add a rotation schedule to session \'%s\'", - session_name); + "Add a rotation schedule to session \'%s\'", + session_name); - ret = lttng_session_list_rotation_schedules(session_name, - &list_schedules); + ret = lttng_session_list_rotation_schedules(session_name, &list_schedules); ok(ret == LTTNG_OK && list_schedules, - "List rotation schedules of session \'%s\'", - session_name); + "List rotation schedules of session \'%s\'", + session_name); - status = lttng_rotation_schedules_get_count(list_schedules, - &schedules_count); + status = lttng_rotation_schedules_get_count(list_schedules, &schedules_count); ok(status == LTTNG_ROTATION_STATUS_OK && schedules_count == 1, - "Listing returned 1 rotation schedule"); + "Listing returned 1 rotation schedule"); - list_schedule = lttng_rotation_schedules_get_at_index(list_schedules, - 0); - ok(list_schedule, - "Obtain the first schedule of a schedules list"); + list_schedule = lttng_rotation_schedules_get_at_index(list_schedules, 0); + ok(list_schedule, "Obtain the first schedule of a schedules list"); ok(schedules_equal(original_schedule, list_schedule), - "Schedule returned by the listing is equal to the reference schedule that was added"); + "Schedule returned by the listing is equal to the reference schedule that was added"); - status = lttng_session_remove_rotation_schedule(session_name, - list_schedule); + status = lttng_session_remove_rotation_schedule(session_name, list_schedule); ok(status == LTTNG_ROTATION_STATUS_OK, - "Remove rotation schedule returned by the schedules listing"); + "Remove rotation schedule returned by the schedules listing"); lttng_rotation_schedules_destroy(list_schedules); - (void) lttng_session_list_rotation_schedules(session_name, - &list_schedules); - status = lttng_rotation_schedules_get_count(list_schedules, - &schedules_count); + (void) lttng_session_list_rotation_schedules(session_name, &list_schedules); + status = lttng_rotation_schedules_get_count(list_schedules, &schedules_count); ok(status == LTTNG_ROTATION_STATUS_OK && schedules_count == 0, - "Listing returned 0 rotation schedules after removal"); + "Listing returned 0 rotation schedules after removal"); lttng_rotation_schedules_destroy(list_schedules); } -static -void test_add_list_remove_size_schedule(void) +static void test_add_list_remove_size_schedule(void) { struct lttng_rotation_schedule *size_schedule; diag("Add, list, and remove a size threshold rotation schedule"); size_schedule = lttng_rotation_schedule_size_threshold_create(); - (void) lttng_rotation_schedule_size_threshold_set_threshold( - size_schedule, SIZE_THRESHOLD_BYTES); + (void) lttng_rotation_schedule_size_threshold_set_threshold(size_schedule, + SIZE_THRESHOLD_BYTES); test_add_list_remove_schedule(size_schedule); lttng_rotation_schedule_destroy(size_schedule); } -static -void test_add_list_remove_periodic_schedule(void) +static void test_add_list_remove_periodic_schedule(void) { struct lttng_rotation_schedule *periodic_schedule; diag("Add, list, and remove a periodic rotation schedule"); periodic_schedule = lttng_rotation_schedule_periodic_create(); - (void) lttng_rotation_schedule_periodic_set_period( - periodic_schedule, PERIODIC_TIME_US); + (void) lttng_rotation_schedule_periodic_set_period(periodic_schedule, PERIODIC_TIME_US); test_add_list_remove_schedule(periodic_schedule); lttng_rotation_schedule_destroy(periodic_schedule); } diff --git a/tests/regression/tools/trigger/utils/notification-client.c b/tests/regression/tools/trigger/utils/notification-client.c index 11e920696..b656d726b 100644 --- a/tests/regression/tools/trigger/utils/notification-client.c +++ b/tests/regression/tools/trigger/utils/notification-client.c @@ -5,6 +5,11 @@ * */ +#include "utils.h" + +#include +#include + #include #include #include @@ -14,34 +19,26 @@ #include #include -#include -#include - -#include "utils.h" - -static struct option long_options[] = -{ +static struct option long_options[] = { /* These options set a flag. */ - {"trigger", required_argument, 0, 't'}, - {"sync-after-notif-register", required_argument, 0, 'a'}, + { "trigger", required_argument, 0, 't' }, + { "sync-after-notif-register", required_argument, 0, 'a' }, /* Default alue for count is 1 */ - {"count", required_argument, 0, 'b'}, + { "count", required_argument, 0, 'b' }, /* * When end-trigger is present the reception loop is exited only when a * notification matching the end trigger is received. * Otherwise the loop is exited when the count of notification received * for `trigger` math the `count` argument. */ - {"end-trigger", required_argument, 0, 'c'}, - {0, 0, 0, 0} + { "end-trigger", required_argument, 0, 'c' }, + { 0, 0, 0, 0 } }; -static bool action_list_contains_notify( - const struct lttng_action *action_list) +static bool action_list_contains_notify(const struct lttng_action *action_list) { unsigned int i, count; - enum lttng_action_status status = - lttng_action_list_get_count(action_list, &count); + enum lttng_action_status status = lttng_action_list_get_count(action_list, &count); if (status != LTTNG_ACTION_STATUS_OK) { printf("Failed to get action count from action list\n"); @@ -49,11 +46,8 @@ static bool action_list_contains_notify( } for (i = 0; i < count; i++) { - const struct lttng_action *action = - lttng_action_list_get_at_index( - action_list, 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_list, i); + const enum lttng_action_type action_type = lttng_action_get_type(action); if (action_type == LTTNG_ACTION_TYPE_NOTIFY) { return true; @@ -64,7 +58,7 @@ static bool action_list_contains_notify( /* Only expects named triggers. */ static bool is_trigger_name(const char *expected_trigger_name, - struct lttng_notification *notification) + struct lttng_notification *notification) { const char *trigger_name = NULL; enum lttng_trigger_status trigger_status; @@ -87,8 +81,10 @@ static bool is_trigger_name(const char *expected_trigger_name, names_match = strcmp(expected_trigger_name, trigger_name) == 0; if (!names_match) { - fprintf(stderr, "Got an unexpected trigger name: name = '%s', expected name = '%s'\n", - trigger_name, expected_trigger_name); + fprintf(stderr, + "Got an unexpected trigger name: name = '%s', expected name = '%s'\n", + trigger_name, + expected_trigger_name); } end: return names_match; @@ -108,8 +104,7 @@ int main(int argc, char **argv) struct lttng_notification_channel *notification_channel = NULL; int expected_notifications = 1, notification_count = 0; - while ((option = getopt_long(argc, argv, "a:b:c:t:", long_options, - &option_index)) != -1) { + while ((option = getopt_long(argc, argv, "a:b:c:t:", long_options, &option_index)) != -1) { switch (option) { case 'a': after_notif_register_file_path = strdup(optarg); @@ -136,9 +131,8 @@ int main(int argc, char **argv) goto end; } - - 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; @@ -161,14 +155,11 @@ int main(int argc, char **argv) /* Look for the trigger we want to subscribe to. */ 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; @@ -176,23 +167,23 @@ int main(int argc, char **argv) if (strcmp(trigger_name, expected_trigger_name) != 0) { /* Might match the end event trigger */ if (end_trigger_name != NULL && - strcmp(trigger_name, - end_trigger_name) != 0) { + strcmp(trigger_name, end_trigger_name) != 0) { continue; } } if (!((action_type == LTTNG_ACTION_TYPE_LIST && - action_list_contains_notify(action)) || - action_type == LTTNG_ACTION_TYPE_NOTIFY)) { + action_list_contains_notify(action)) || + action_type == LTTNG_ACTION_TYPE_NOTIFY)) { /* "The action of trigger is not notify, skipping. */ continue; } - channel_status = lttng_notification_channel_subscribe( - notification_channel, condition); + channel_status = + lttng_notification_channel_subscribe(notification_channel, condition); 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; } @@ -225,10 +216,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, - ¬ification); + channel_status = lttng_notification_channel_get_next_notification( + notification_channel, ¬ification); switch (channel_status) { case LTTNG_NOTIFICATION_CHANNEL_STATUS_NOTIFICATIONS_DROPPED: printf("Dropped notification\n"); @@ -243,18 +232,17 @@ 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; } /* Early exit check. */ - if (end_trigger_name != NULL && - is_trigger_name(end_trigger_name, - notification)) { + if (end_trigger_name != NULL && is_trigger_name(end_trigger_name, notification)) { /* Exit the loop immediately. */ printf("Received end event notification from trigger %s\n", - end_trigger_name); + end_trigger_name); lttng_notification_destroy(notification); goto evaluate_success; } @@ -266,11 +254,9 @@ int main(int argc, char **argv) goto end; } - printf("Received event notification from trigger %s\n", - expected_trigger_name); + printf("Received event notification from trigger %s\n", expected_trigger_name); notification_count++; - if (end_trigger_name == NULL && - expected_notifications == notification_count) { + if (end_trigger_name == NULL && expected_notifications == notification_count) { /* * Here the loop exit is controlled by the number of * notification and not by the reception of the end @@ -287,8 +273,10 @@ evaluate_success: /* Success */ ret = 0; } else { - fprintf(stderr, "Expected %d notification got %d\n", - expected_notifications, notification_count); + fprintf(stderr, + "Expected %d notification got %d\n", + expected_notifications, + notification_count); ret = 1; } diff --git a/tests/regression/ust/baddr-statedump/tp.h b/tests/regression/ust/baddr-statedump/tp.h index bbde2b7be..d1dcec434 100644 --- a/tests/regression/ust/baddr-statedump/tp.h +++ b/tests/regression/ust/baddr-statedump/tp.h @@ -16,18 +16,11 @@ #include -TRACEPOINT_EVENT( - my_provider, - my_first_tracepoint, - TP_ARGS( - int, my_integer_arg, - char*, my_string_arg - ), - TP_FIELDS( - ctf_string(my_string_field, my_string_arg) - ctf_integer(int, my_integer_field, my_integer_arg) - ) -) +TRACEPOINT_EVENT(my_provider, + my_first_tracepoint, + TP_ARGS(int, my_integer_arg, char *, my_string_arg), + TP_FIELDS(ctf_string(my_string_field, my_string_arg) + ctf_integer(int, my_integer_field, my_integer_arg))) #endif /* _TP_H */ diff --git a/tests/regression/ust/clock-override/lttng-ust-clock-override-test.c b/tests/regression/ust/clock-override/lttng-ust-clock-override-test.c index a38cd515e..180712ee8 100644 --- a/tests/regression/ust/clock-override/lttng-ust-clock-override-test.c +++ b/tests/regression/ust/clock-override/lttng-ust-clock-override-test.c @@ -10,42 +10,39 @@ * */ -#include #include -#include -#include + #include #include -static -uint64_t plugin_read64(void) +#include +#include +#include + +static uint64_t plugin_read64(void) { /* Freeze time */ return 0; } -static -uint64_t plugin_freq(void) +static uint64_t plugin_freq(void) { - return 1000; /* 1KHz clock (very coarse!) */ + return 1000; /* 1KHz clock (very coarse!) */ } -static -int plugin_uuid(char *uuid) +static int plugin_uuid(char *uuid) { const char myuuid[] = "83c63deb-7aa4-48fb-abda-946f400d76e6"; memcpy(uuid, myuuid, LTTNG_UST_UUID_STR_LEN); return 0; } -static -const char *plugin_name(void) +static const char *plugin_name(void) { return "lttng_test_clock_override"; } -static -const char *plugin_description(void) +static const char *plugin_description(void) { return "Freeze time with 1KHz for regression test"; } @@ -57,41 +54,39 @@ void lttng_ust_clock_plugin_init(void) ret = lttng_ust_trace_clock_set_read64_cb(plugin_read64); if (ret) { - fprintf(stderr, "Error setting clock override read64 callback: %s\n", + fprintf(stderr, + "Error setting clock override read64 callback: %s\n", strerror(-ret)); goto error; } ret = lttng_ust_trace_clock_set_freq_cb(plugin_freq); if (ret) { - fprintf(stderr, "Error setting clock override freq callback: %s\n", - strerror(-ret)); + fprintf(stderr, "Error setting clock override freq callback: %s\n", strerror(-ret)); goto error; } ret = lttng_ust_trace_clock_set_uuid_cb(plugin_uuid); if (ret) { - fprintf(stderr, "Error setting clock override uuid callback: %s\n", - strerror(-ret)); + fprintf(stderr, "Error setting clock override uuid callback: %s\n", strerror(-ret)); goto error; } ret = lttng_ust_trace_clock_set_name_cb(plugin_name); if (ret) { - fprintf(stderr, "Error setting clock override name callback: %s\n", - strerror(-ret)); + fprintf(stderr, "Error setting clock override name callback: %s\n", strerror(-ret)); goto error; } ret = lttng_ust_trace_clock_set_description_cb(plugin_description); if (ret) { - fprintf(stderr, "Error setting clock override description callback: %s\n", + fprintf(stderr, + "Error setting clock override description callback: %s\n", strerror(-ret)); goto error; } ret = lttng_ust_enable_trace_clock_override(); if (ret) { - fprintf(stderr, "Error enabling clock override: %s\n", - strerror(-ret)); + fprintf(stderr, "Error enabling clock override: %s\n", strerror(-ret)); goto error; } diff --git a/tests/regression/ust/daemon/daemon.c b/tests/regression/ust/daemon/daemon.c index 44ec182fa..1ce1b50df 100644 --- a/tests/regression/ust/daemon/daemon.c +++ b/tests/regression/ust/daemon/daemon.c @@ -7,9 +7,9 @@ */ #include -#include -#include #include +#include +#include #define TRACEPOINT_DEFINE #define TRACEPOINT_CREATE_PROBES diff --git a/tests/regression/ust/daemon/ust_tests_daemon.h b/tests/regression/ust/daemon/ust_tests_daemon.h index 60fec4a94..4dea6aa6c 100644 --- a/tests/regression/ust/daemon/ust_tests_daemon.h +++ b/tests/regression/ust/daemon/ust_tests_daemon.h @@ -12,26 +12,20 @@ #define _TRACEPOINT_UST_TESTS_DAEMON_H #include + #include -TRACEPOINT_EVENT(ust_tests_daemon, before_daemon, - TP_ARGS(pid_t, pid), - TP_FIELDS( - ctf_integer(pid_t, pid, pid) - ) -) - -TRACEPOINT_EVENT(ust_tests_daemon, after_daemon_child, - TP_ARGS(pid_t, pid), - TP_FIELDS( - ctf_integer(pid_t, pid, pid) - ) -) - -TRACEPOINT_EVENT(ust_tests_daemon, after_daemon_parent, - TP_ARGS(), - TP_FIELDS() -) +TRACEPOINT_EVENT(ust_tests_daemon, + before_daemon, + TP_ARGS(pid_t, pid), + TP_FIELDS(ctf_integer(pid_t, pid, pid))) + +TRACEPOINT_EVENT(ust_tests_daemon, + after_daemon_child, + TP_ARGS(pid_t, pid), + TP_FIELDS(ctf_integer(pid_t, pid, pid))) + +TRACEPOINT_EVENT(ust_tests_daemon, after_daemon_parent, TP_ARGS(), TP_FIELDS()) #endif /* _TRACEPOINT_UST_TESTS_DAEMON_H */ diff --git a/tests/regression/ust/exit-fast/ust_tests_exitfast.h b/tests/regression/ust/exit-fast/ust_tests_exitfast.h index 1952981f1..1827fdcc1 100644 --- a/tests/regression/ust/exit-fast/ust_tests_exitfast.h +++ b/tests/regression/ust/exit-fast/ust_tests_exitfast.h @@ -14,10 +14,10 @@ #include -TRACEPOINT_EVENT(ust_tests_exitfast, message, - TP_ARGS(char *, text), - TP_FIELDS(ctf_string(message, text)) -) +TRACEPOINT_EVENT(ust_tests_exitfast, + message, + TP_ARGS(char *, text), + TP_FIELDS(ctf_string(message, text))) TRACEPOINT_LOGLEVEL(ust_tests_exitfast, message, TRACE_INFO) diff --git a/tests/regression/ust/fork/fork.c b/tests/regression/ust/fork/fork.c index 7030a293d..2387f245e 100644 --- a/tests/regression/ust/fork/fork.c +++ b/tests/regression/ust/fork/fork.c @@ -7,10 +7,10 @@ */ #include -#include +#include #include #include -#include +#include #define TRACEPOINT_DEFINE #define TRACEPOINT_CREATE_PROBES diff --git a/tests/regression/ust/fork/ust_tests_fork.h b/tests/regression/ust/fork/ust_tests_fork.h index 92c2a630b..fb417717f 100644 --- a/tests/regression/ust/fork/ust_tests_fork.h +++ b/tests/regression/ust/fork/ust_tests_fork.h @@ -12,35 +12,28 @@ #define _TRACEPOINT_UST_TESTS_FORK_H #include + #include -TRACEPOINT_EVENT(ust_tests_fork, before_fork, - TP_ARGS(pid_t, pid), - TP_FIELDS( - ctf_integer(pid_t, pid, pid) - ) -) - -TRACEPOINT_EVENT(ust_tests_fork, after_fork_child, - TP_ARGS(pid_t, pid), - TP_FIELDS( - ctf_integer(pid_t, pid, pid) - ) -) - -TRACEPOINT_EVENT(ust_tests_fork, after_fork_parent, - TP_ARGS(pid_t, pid), - TP_FIELDS( - ctf_integer(pid_t, pid, pid) - ) -) - -TRACEPOINT_EVENT(ust_tests_fork, after_exec, - TP_ARGS(pid_t, pid), - TP_FIELDS( - ctf_integer(pid_t, pid, pid) - ) -) +TRACEPOINT_EVENT(ust_tests_fork, + before_fork, + TP_ARGS(pid_t, pid), + TP_FIELDS(ctf_integer(pid_t, pid, pid))) + +TRACEPOINT_EVENT(ust_tests_fork, + after_fork_child, + TP_ARGS(pid_t, pid), + TP_FIELDS(ctf_integer(pid_t, pid, pid))) + +TRACEPOINT_EVENT(ust_tests_fork, + after_fork_parent, + TP_ARGS(pid_t, pid), + TP_FIELDS(ctf_integer(pid_t, pid, pid))) + +TRACEPOINT_EVENT(ust_tests_fork, + after_exec, + TP_ARGS(pid_t, pid), + TP_FIELDS(ctf_integer(pid_t, pid, pid))) #endif /* _TRACEPOINT_UST_TESTS_FORK_H */ diff --git a/tests/regression/ust/getcpu-override/lttng-ust-getcpu-override-test.c b/tests/regression/ust/getcpu-override/lttng-ust-getcpu-override-test.c index 80240f1f5..c98d70700 100644 --- a/tests/regression/ust/getcpu-override/lttng-ust-getcpu-override-test.c +++ b/tests/regression/ust/getcpu-override/lttng-ust-getcpu-override-test.c @@ -9,18 +9,19 @@ * */ -#include #include -#include -#include -#include + #include #include +#include +#include +#include +#include + static long nprocessors; -static -int plugin_getcpu(void) +static int plugin_getcpu(void) { /* Generate a sequence based on the number of configurated processor * by using sequence[i] % nb_configured_processors. Where sequence @@ -31,26 +32,24 @@ int plugin_getcpu(void) * plugin but provide a strong argument of it's validity. */ static int i = 0; - static int seq_seed[256] = { 100, 57, 232, 236, 42, 193, 224, 184, 216, - 150, 92, 91, 108, 118, 55, 243, 65, 101, 209, 0, 147, 36, 29, - 34, 49, 188, 174, 105, 253, 245, 227, 238, 112, 20, 222, 201, - 102, 175, 119, 19, 132, 41, 78, 90, 114, 64, 138, 14, 48, 18, - 162, 85, 204, 124, 133, 73, 172, 106, 241, 126, 28, 104, 111, - 21, 127, 219, 9, 244, 237, 189, 59, 214, 52, 141, 107, 26, 25, - 199, 3, 157, 117, 234, 33, 44, 46, 84, 69, 155, 122, 250, 231, - 86, 239, 76, 190, 120, 1, 94, 206, 8, 148, 159, 167, 215, 164, - 31, 217, 61, 71, 125, 68, 109, 195, 177, 95, 82, 142, 182, 129, - 87, 37, 140, 134, 186, 173, 39, 116, 143, 254, 229, 131, 67, - 121, 192, 240, 15, 221, 30, 242, 185, 80, 170, 135, 51, 187, - 194, 246, 12, 225, 181, 137, 211, 228, 88, 218, 27, 233, 161, - 77, 252, 123, 93, 220, 248, 205, 223, 144, 128, 196, 70, 247, - 210, 178, 203, 154, 24, 169, 149, 163, 35, 7, 151, 103, 197, - 139, 165, 158, 207, 72, 113, 145, 45, 183, 11, 198, 43, 81, 230, - 97, 96, 2, 66, 213, 146, 179, 22, 58, 54, 38, 160, 200, 235, - 226, 156, 56, 208, 249, 32, 176, 168, 110, 191, 79, 152, 115, - 10, 74, 60, 251, 17, 83, 180, 171, 202, 40, 166, 255, 53, 212, - 98, 5, 50, 99, 4, 89, 13, 63, 6, 136, 153, 23, 16, 47, 130, 75, - 62 }; + static int seq_seed[256] = { + 100, 57, 232, 236, 42, 193, 224, 184, 216, 150, 92, 91, 108, 118, 55, 243, + 65, 101, 209, 0, 147, 36, 29, 34, 49, 188, 174, 105, 253, 245, 227, 238, + 112, 20, 222, 201, 102, 175, 119, 19, 132, 41, 78, 90, 114, 64, 138, 14, + 48, 18, 162, 85, 204, 124, 133, 73, 172, 106, 241, 126, 28, 104, 111, 21, + 127, 219, 9, 244, 237, 189, 59, 214, 52, 141, 107, 26, 25, 199, 3, 157, + 117, 234, 33, 44, 46, 84, 69, 155, 122, 250, 231, 86, 239, 76, 190, 120, + 1, 94, 206, 8, 148, 159, 167, 215, 164, 31, 217, 61, 71, 125, 68, 109, + 195, 177, 95, 82, 142, 182, 129, 87, 37, 140, 134, 186, 173, 39, 116, 143, + 254, 229, 131, 67, 121, 192, 240, 15, 221, 30, 242, 185, 80, 170, 135, 51, + 187, 194, 246, 12, 225, 181, 137, 211, 228, 88, 218, 27, 233, 161, 77, 252, + 123, 93, 220, 248, 205, 223, 144, 128, 196, 70, 247, 210, 178, 203, 154, 24, + 169, 149, 163, 35, 7, 151, 103, 197, 139, 165, 158, 207, 72, 113, 145, 45, + 183, 11, 198, 43, 81, 230, 97, 96, 2, 66, 213, 146, 179, 22, 58, 54, + 38, 160, 200, 235, 226, 156, 56, 208, 249, 32, 176, 168, 110, 191, 79, 152, + 115, 10, 74, 60, 251, 17, 83, 180, 171, 202, 40, 166, 255, 53, 212, 98, + 5, 50, 99, 4, 89, 13, 63, 6, 136, 153, 23, 16, 47, 130, 75, 62 + }; int ret; ret = seq_seed[i] % nprocessors; @@ -72,8 +71,7 @@ void lttng_ust_getcpu_plugin_init(void) ret = lttng_ust_getcpu_override(plugin_getcpu); if (ret) { - fprintf(stderr, "Error enabling getcpu override: %s\n", - strerror(-ret)); + fprintf(stderr, "Error enabling getcpu override: %s\n", strerror(-ret)); goto error; } return; diff --git a/tests/regression/ust/high-throughput/main.c b/tests/regression/ust/high-throughput/main.c index 055d8823e..2306c2da1 100644 --- a/tests/regression/ust/high-throughput/main.c +++ b/tests/regression/ust/high-throughput/main.c @@ -6,28 +6,26 @@ * */ -#include -#include -#include -#include -#include -#include +#include #include #include -#include -#include +#include +#include #include +#include +#include +#include +#include +#include #define TRACEPOINT_DEFINE #include "tp.h" -static -void inthandler(int sig __attribute__((unused))) +static void inthandler(int sig __attribute__((unused))) { } -static -int init_int_handler(void) +static int init_int_handler(void) { int result; struct sigaction act; @@ -72,8 +70,7 @@ int main(int argc, char **argv) for (i = 0; i < 1000000; i++) { netint = htonl(i); - tracepoint(tp, tptest, i, netint, values, text, - strlen(text), dbl, flt); + tracepoint(tp, tptest, i, netint, values, text, strlen(text), dbl, flt); } return 0; diff --git a/tests/regression/ust/high-throughput/tp.h b/tests/regression/ust/high-throughput/tp.h index 9c74d8c0a..79fcfe57a 100644 --- a/tests/regression/ust/high-throughput/tp.h +++ b/tests/regression/ust/high-throughput/tp.h @@ -13,24 +13,35 @@ #include -TRACEPOINT_EVENT(tp, tptest, - TP_ARGS(int, anint, int, netint, long *, values, - char *, text, size_t, textlen, double, doublearg, float, floatarg), - TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer_hex(int, intfield2, anint) - ctf_integer(long, longfield, anint) - ctf_integer_network(int, netintfield, netint) - ctf_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) - ctf_sequence(char, seqfield1, text, size_t, textlen) - ctf_sequence_text(char, seqfield2, text, size_t, textlen) - ctf_string(stringfield, text) - ctf_float(float, floatfield, floatarg) - ctf_float(double, doublefield, doublearg) - ) -) +TRACEPOINT_EVENT( + tp, + tptest, + TP_ARGS(int, + anint, + int, + netint, + long *, + values, + char *, + text, + size_t, + textlen, + double, + doublearg, + float, + floatarg), + TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex( + int, intfield2, anint) ctf_integer(long, longfield, anint) + ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex( + int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3) + ctf_array_text(char, arrfield2, text, 10) ctf_sequence( + char, seqfield1, text, size_t, textlen) + ctf_sequence_text(char, seqfield2, text, size_t, textlen) + ctf_string(stringfield, text) + ctf_float(float, floatfield, floatarg) + ctf_float(double, + doublefield, + doublearg))) #endif /* _TRACEPOINT_TP_H */ diff --git a/tests/regression/ust/libc-wrapper/prog.c b/tests/regression/ust/libc-wrapper/prog.c index c7aa0d307..882dbb82f 100644 --- a/tests/regression/ust/libc-wrapper/prog.c +++ b/tests/regression/ust/libc-wrapper/prog.c @@ -7,8 +7,8 @@ /* This program is used to test malloc instrumentation with libustinstr-malloc. */ -#include #include +#include #define N_ITER 1000 @@ -19,7 +19,7 @@ int main(void) void *ptrs[N_ITER]; for (i = 0; i < N_ITER; i++) { - ptrs[i] = malloc(i+1000); + ptrs[i] = malloc(i + 1000); if (!ptrs[i]) { exit(EXIT_FAILURE); } diff --git a/tests/regression/ust/linking/demo.c b/tests/regression/ust/linking/demo.c index 74d1d22a6..43b0f641c 100644 --- a/tests/regression/ust/linking/demo.c +++ b/tests/regression/ust/linking/demo.c @@ -6,17 +6,17 @@ * */ -#include -#include -#include -#include -#include -#include +#include #include #include -#include -#include +#include +#include #include +#include +#include +#include +#include +#include #define TRACEPOINT_DEFINE @@ -48,8 +48,7 @@ int main(int argc, char **argv) tracepoint(ust_tests_demo, starting, 123); for (i = 0; i < 5; i++) { netint = htonl(i); - tracepoint(ust_tests_demo2, loop, i, netint, values, - text, strlen(text), dbl, flt); + tracepoint(ust_tests_demo2, loop, i, netint, values, text, strlen(text), dbl, flt); } tracepoint(ust_tests_demo, done, 456); tracepoint(ust_tests_demo3, done, 42); diff --git a/tests/regression/ust/linking/ust_tests_demo.h b/tests/regression/ust/linking/ust_tests_demo.h index 627873e4c..f08c40786 100644 --- a/tests/regression/ust/linking/ust_tests_demo.h +++ b/tests/regression/ust/linking/ust_tests_demo.h @@ -13,20 +13,16 @@ #include -TRACEPOINT_EVENT(ust_tests_demo, starting, - TP_ARGS(int, value), - TP_FIELDS( - ctf_integer(int, value, value) - ) -) +TRACEPOINT_EVENT(ust_tests_demo, + starting, + TP_ARGS(int, value), + TP_FIELDS(ctf_integer(int, value, value))) TRACEPOINT_LOGLEVEL(ust_tests_demo, starting, TRACE_CRIT) -TRACEPOINT_EVENT(ust_tests_demo, done, - TP_ARGS(int, value), - TP_FIELDS( - ctf_integer(int, value, value) - ) -) +TRACEPOINT_EVENT(ust_tests_demo, + done, + TP_ARGS(int, value), + TP_FIELDS(ctf_integer(int, value, value))) TRACEPOINT_LOGLEVEL(ust_tests_demo, done, TRACE_CRIT) #endif /* _TRACEPOINT_UST_TESTS_DEMO_H */ diff --git a/tests/regression/ust/linking/ust_tests_demo2.h b/tests/regression/ust/linking/ust_tests_demo2.h index b45f38991..6df9e1c4e 100644 --- a/tests/regression/ust/linking/ust_tests_demo2.h +++ b/tests/regression/ust/linking/ust_tests_demo2.h @@ -13,27 +13,35 @@ #include -TRACEPOINT_EVENT(ust_tests_demo2, loop, - TP_ARGS(int, anint, int, netint, long *, values, - char *, text, size_t, textlen, - double, doublearg, float, floatarg), - TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer_hex(int, intfield2, anint) - ctf_integer(long, longfield, anint) - ctf_integer_network(int, netintfield, netint) - ctf_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) - ctf_sequence(char, seqfield1, text, - size_t, textlen) - ctf_sequence_text(char, seqfield2, text, - size_t, textlen) - ctf_string(stringfield, text) - ctf_float(float, floatfield, floatarg) - ctf_float(double, doublefield, doublearg) - ) -) +TRACEPOINT_EVENT( + ust_tests_demo2, + loop, + TP_ARGS(int, + anint, + int, + netint, + long *, + values, + char *, + text, + size_t, + textlen, + double, + doublearg, + float, + floatarg), + TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex( + int, intfield2, anint) ctf_integer(long, longfield, anint) + ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex( + int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3) + ctf_array_text(char, arrfield2, text, 10) ctf_sequence( + char, seqfield1, text, size_t, textlen) + ctf_sequence_text(char, seqfield2, text, size_t, textlen) + ctf_string(stringfield, text) + ctf_float(float, floatfield, floatarg) + ctf_float(double, + doublefield, + doublearg))) TRACEPOINT_LOGLEVEL(ust_tests_demo2, loop, TRACE_WARNING) #endif /* _TRACEPOINT_UST_TESTS_DEMO2_H */ diff --git a/tests/regression/ust/linking/ust_tests_demo3.h b/tests/regression/ust/linking/ust_tests_demo3.h index e220f8bab..7d4ca287a 100644 --- a/tests/regression/ust/linking/ust_tests_demo3.h +++ b/tests/regression/ust/linking/ust_tests_demo3.h @@ -13,12 +13,10 @@ #include -TRACEPOINT_EVENT(ust_tests_demo3, done, - TP_ARGS(int, value), - TP_FIELDS( - ctf_integer(int, value, value) - ) -) +TRACEPOINT_EVENT(ust_tests_demo3, + done, + TP_ARGS(int, value), + TP_FIELDS(ctf_integer(int, value, value))) TRACEPOINT_LOGLEVEL(ust_tests_demo3, done, TRACE_WARNING) #endif /* _TRACEPOINT_UST_TESTS_DEMO3_H */ diff --git a/tests/regression/ust/low-throughput/tp.h b/tests/regression/ust/low-throughput/tp.h index 961f2e907..d17d2bae0 100644 --- a/tests/regression/ust/low-throughput/tp.h +++ b/tests/regression/ust/low-throughput/tp.h @@ -13,13 +13,10 @@ #include -TRACEPOINT_EVENT(tp, slow, - TP_ARGS(unsigned int, c, const char *, thread_name), - TP_FIELDS( - ctf_integer(unsigned int, counter, c) - ctf_string(th_name, thread_name) - ) -) +TRACEPOINT_EVENT(tp, + slow, + TP_ARGS(unsigned int, c, const char *, thread_name), + TP_FIELDS(ctf_integer(unsigned int, counter, c) ctf_string(th_name, thread_name))) #endif /* _TRACEPOINT_TP_H */ diff --git a/tests/regression/ust/multi-lib/callsites.c b/tests/regression/ust/multi-lib/callsites.c index ed86a0ed9..d847e5b66 100644 --- a/tests/regression/ust/multi-lib/callsites.c +++ b/tests/regression/ust/multi-lib/callsites.c @@ -7,14 +7,13 @@ #define TRACEPOINT_DEFINE #define TRACEPOINT_PROBE_DYNAMIC_LINKAGE +#include "callsites.h" #include "probes.h" +#include #include #include #include -#include - -#include "callsites.h" #ifndef VALUE #define VALUE (-1) @@ -24,4 +23,3 @@ void call_tracepoint(void) { tracepoint(multi, tp, VALUE); } - diff --git a/tests/regression/ust/multi-lib/multi-lib-test.c b/tests/regression/ust/multi-lib/multi-lib-test.c index eb1416248..155ef81ae 100644 --- a/tests/regression/ust/multi-lib/multi-lib-test.c +++ b/tests/regression/ust/multi-lib/multi-lib-test.c @@ -6,10 +6,10 @@ */ #include +#include #include #include #include -#include #if HAS_CALLSITES #include "callsites.h" @@ -23,19 +23,20 @@ void exec_callsite(void) #endif } -static -void print_list(void) +static void print_list(void) { fprintf(stderr, "Test list (-t X):\n"); - fprintf(stderr, "\t0: dlopen() all libraries pass in arguments and execute " - "the callsite.\n"); - fprintf(stderr, "\t1: simulate the upgrade of a probe provider using dlopen() and dlclose(). \n"); - fprintf(stderr, "\t2: simulate the upgrade of a library containing the callsites using dlopen() and dlclose(). \n"); + fprintf(stderr, + "\t0: dlopen() all libraries pass in arguments and execute " + "the callsite.\n"); + fprintf(stderr, + "\t1: simulate the upgrade of a probe provider using dlopen() and dlclose(). \n"); + fprintf(stderr, + "\t2: simulate the upgrade of a library containing the callsites using dlopen() and dlclose(). \n"); } #if HAS_CALLSITES -static -int dl_open_all(int nb_libraries, char **libraries) +static int dl_open_all(int nb_libraries, char **libraries) { int i, ret = 0; void **handles; @@ -65,8 +66,7 @@ error: * Takes 2 paths to libraries, dlopen() the first, trace, dlopen() the second, * and dlclose the first to simulate the upgrade of a library. */ -static -int upgrade_lib(int nb_libraries, char **libraries) +static int upgrade_lib(int nb_libraries, char **libraries) { int i, ret = 0; void *handles[2]; @@ -104,8 +104,7 @@ error: * Simulate the upgrade of a library containing a callsite. * Receives two libraries containing callsites for the same tracepoint. */ -static -int upgrade_callsite(int nb_libraries, char **libraries) +static int upgrade_callsite(int nb_libraries, char **libraries) { int ret = 0; void *handles[2]; @@ -175,10 +174,9 @@ int main(int argc, const char **argv) char **libraries = NULL; poptContext optCon; 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 }, - 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 }, + POPT_AUTOHELP{ NULL, 0, 0, NULL, 0, NULL, NULL } }; optCon = poptGetContext(NULL, argc, argv, optionsTable, 0); @@ -189,7 +187,7 @@ int main(int argc, const char **argv) } while ((c = poptGetNextOpt(optCon)) >= 0) { - switch(c) { + switch (c) { case 'l': print_list(); goto error; @@ -212,29 +210,35 @@ int main(int argc, const char **argv) libraries[nb_libraries - 1] = (char *) poptGetArg(optCon); } - switch(test) { + switch (test) { case 0: #if HAS_CALLSITES ret = dl_open_all(nb_libraries, libraries); #else - fprintf(stderr, "Test not implemented for configuration " - "(HAS_CALLSITES=%d)\n", HAS_CALLSITES == 1); + fprintf(stderr, + "Test not implemented for configuration " + "(HAS_CALLSITES=%d)\n", + HAS_CALLSITES == 1); #endif break; case 1: #if HAS_CALLSITES ret = upgrade_lib(nb_libraries, libraries); #else - fprintf(stderr, "Test not implemented for configuration " - "(HAS_CALLSITES=%d)\n", HAS_CALLSITES == 1); + fprintf(stderr, + "Test not implemented for configuration " + "(HAS_CALLSITES=%d)\n", + HAS_CALLSITES == 1); #endif break; case 2: #if !HAS_CALLSITES ret = upgrade_callsite(nb_libraries, libraries); #else - fprintf(stderr, "Test not implemented for configuration " - "(HAS_CALLSITES=%d)\n", HAS_CALLSITES == 1); + fprintf(stderr, + "Test not implemented for configuration " + "(HAS_CALLSITES=%d)\n", + HAS_CALLSITES == 1); #endif break; default: diff --git a/tests/regression/ust/multi-lib/probes.h b/tests/regression/ust/multi-lib/probes.h index 05bab2dd7..d58fa2684 100644 --- a/tests/regression/ust/multi-lib/probes.h +++ b/tests/regression/ust/multi-lib/probes.h @@ -15,178 +15,114 @@ #define PROBES_H #include + #include #if defined(ACTIVATE_PROBES_A) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_integer(uint64_t, arg_long_A, arg) - ) -) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_integer(uint64_t, arg_long_A, arg))) #elif defined(ACTIVATE_PROBES_B) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_integer(uint64_t, arg_long_B, arg) - ctf_float(float, arg_float_B, (float) arg) - ) -) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_integer(uint64_t, arg_long_B, arg) + ctf_float(float, arg_float_B, (float) arg))) #elif defined(ACTIVATE_PROBES_C) -TRACEPOINT_ENUM(multi, enum_a, - TP_ENUM_VALUES( - ctf_enum_value("FIELD_A", 0) - ctf_enum_value("FIELD_B", 1) - ctf_enum_range("RANGE_C", 2, 10) - ) -) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_unused(arg) - ctf_enum(multi, enum_a, int16_t, enum_short_C, 0) - ctf_enum(multi, enum_a, int32_t, enum_int_C, 1) - ctf_enum(multi, enum_a, uint64_t, enum_long_C, 2) - ) -) +TRACEPOINT_ENUM(multi, + enum_a, + TP_ENUM_VALUES(ctf_enum_value("FIELD_A", 0) ctf_enum_value("FIELD_B", 1) + ctf_enum_range("RANGE_C", 2, 10))) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_unused(arg) ctf_enum(multi, enum_a, int16_t, enum_short_C, 0) + ctf_enum(multi, enum_a, int32_t, enum_int_C, 1) + ctf_enum(multi, enum_a, uint64_t, enum_long_C, 2))) #elif defined(ACTIVATE_PROBES_D) -TRACEPOINT_ENUM(multi, enum_a, - TP_ENUM_VALUES( - ctf_enum_value("FIELD_A", 0) - ctf_enum_value("FIELD_B", 1) - ctf_enum_range("RANGE_C_PRIME", 2, 10) - ) -) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_unused(arg) - ctf_enum(multi, enum_a, int32_t, enum_int_D, 1) - ctf_enum(multi, enum_a, int16_t, enum_short_D, 0) - ctf_enum(multi, enum_a, uint64_t, enum_long_D, 2) - ) -) +TRACEPOINT_ENUM(multi, + enum_a, + TP_ENUM_VALUES(ctf_enum_value("FIELD_A", 0) ctf_enum_value("FIELD_B", 1) + ctf_enum_range("RANGE_C_PRIME", 2, 10))) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_unused(arg) ctf_enum(multi, enum_a, int32_t, enum_int_D, 1) + ctf_enum(multi, enum_a, int16_t, enum_short_D, 0) + ctf_enum(multi, enum_a, uint64_t, enum_long_D, 2))) #elif defined(ACTIVATE_PROBES_E) /* * Here we declare tracepoints really similar to one another but are different. * This is meant to test tracepoint comparaison code. */ -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_integer(uint64_t, arg_long, arg) - ) -) +TRACEPOINT_EVENT(multi, tp, TP_ARGS(uint64_t, arg), TP_FIELDS(ctf_integer(uint64_t, arg_long, arg))) #elif defined(ACTIVATE_PROBES_F) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_integer(int64_t, arg_long, arg) - ) -) +TRACEPOINT_EVENT(multi, tp, TP_ARGS(uint64_t, arg), TP_FIELDS(ctf_integer(int64_t, arg_long, arg))) #elif defined(ACTIVATE_PROBES_G) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_integer_hex(int64_t, arg_long, arg) - ) -) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_integer_hex(int64_t, arg_long, arg))) #elif defined(ACTIVATE_PROBES_H) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_integer_hex(int16_t, arg_long, arg) - ) -) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_integer_hex(int16_t, arg_long, arg))) #elif defined(ACTIVATE_PROBES_I) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_integer_hex(int32_t, arg_long, arg) - ) -) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_integer_hex(int32_t, arg_long, arg))) #elif defined(ACTIVATE_PROBES_J) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_float(float, arg_float, (float) arg) - ) -) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_float(float, arg_float, (float) arg))) #elif defined(ACTIVATE_PROBES_K) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_float(double, arg_float, (double) arg) - ) -) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_float(double, arg_float, (double) arg))) #elif defined(ACTIVATE_PROBES_L) -TRACEPOINT_ENUM(multi, enum_a, - TP_ENUM_VALUES( - ctf_enum_value("FIELD_A", 0) - ctf_enum_value("FIELD_B", 1) - ctf_enum_range("RANGE_C", 2, 10) - ) -) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_unused(arg) - ctf_enum(multi, enum_a, int32_t, enum_int, 1) - ) -) +TRACEPOINT_ENUM(multi, + enum_a, + TP_ENUM_VALUES(ctf_enum_value("FIELD_A", 0) ctf_enum_value("FIELD_B", 1) + ctf_enum_range("RANGE_C", 2, 10))) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_unused(arg) ctf_enum(multi, enum_a, int32_t, enum_int, 1))) #elif defined(ACTIVATE_PROBES_M) -TRACEPOINT_ENUM(multi, enum_a, - TP_ENUM_VALUES( - ctf_enum_value("FIELD_A", 0) - ctf_enum_value("FIELD_B", 1) - ctf_enum_range("RANGE_C", 2, 10) - ) -) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_unused(arg) - ctf_enum(multi, enum_a, int64_t, enum_int, 1) - ) -) +TRACEPOINT_ENUM(multi, + enum_a, + TP_ENUM_VALUES(ctf_enum_value("FIELD_A", 0) ctf_enum_value("FIELD_B", 1) + ctf_enum_range("RANGE_C", 2, 10))) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_unused(arg) ctf_enum(multi, enum_a, int64_t, enum_int, 1))) #elif defined(ACTIVATE_PROBES_N) -TRACEPOINT_ENUM(multi, enum_a, - TP_ENUM_VALUES( - ctf_enum_value("FIELD_A", 0) - ctf_enum_value("FIELD_B", 1) - ctf_enum_range("RANGE_C", 2, 10) - ) -) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_unused(arg) - ctf_enum(multi, enum_a, int16_t, enum_int, 1) - ) -) +TRACEPOINT_ENUM(multi, + enum_a, + TP_ENUM_VALUES(ctf_enum_value("FIELD_A", 0) ctf_enum_value("FIELD_B", 1) + ctf_enum_range("RANGE_C", 2, 10))) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_unused(arg) ctf_enum(multi, enum_a, int16_t, enum_int, 1))) #elif defined(ACTIVATE_PROBES_O) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_unused(arg) - ctf_string(arg_string, "string") - ) -) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_unused(arg) ctf_string(arg_string, "string"))) #elif defined(ACTIVATE_PROBES_P) -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_unused(arg) - ctf_string(my_arg_string, "string") - ) -) +TRACEPOINT_EVENT(multi, + tp, + TP_ARGS(uint64_t, arg), + TP_FIELDS(ctf_unused(arg) ctf_string(my_arg_string, "string"))) #else -TRACEPOINT_EVENT(multi, tp, - TP_ARGS(uint64_t, arg), - TP_FIELDS( - ctf_unused(arg) - ) -) +TRACEPOINT_EVENT(multi, tp, TP_ARGS(uint64_t, arg), TP_FIELDS(ctf_unused(arg))) #endif #endif /* PROBES_H */ diff --git a/tests/regression/ust/multi-session/ust_gen_nevents.h b/tests/regression/ust/multi-session/ust_gen_nevents.h index 09fb640a9..09a4683be 100644 --- a/tests/regression/ust/multi-session/ust_gen_nevents.h +++ b/tests/regression/ust/multi-session/ust_gen_nevents.h @@ -13,37 +13,25 @@ #include -TRACEPOINT_EVENT(ust_gen_nevents, tptest0, - TP_ARGS(int, anint, long, value), - TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer(long, longfield, value) - ) -) - -TRACEPOINT_EVENT(ust_gen_nevents, tptest1, - TP_ARGS(int, anint, long, value), - TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer(long, longfield, value) - ) -) - -TRACEPOINT_EVENT(ust_gen_nevents, tptest2, - TP_ARGS(int, anint, long, value), - TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer(long, longfield, value) - ) -) - -TRACEPOINT_EVENT(ust_gen_nevents, tptest3, - TP_ARGS(int, anint, long, value), - TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer(long, longfield, value) - ) -) +TRACEPOINT_EVENT(ust_gen_nevents, + tptest0, + TP_ARGS(int, anint, long, value), + TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer(long, longfield, value))) + +TRACEPOINT_EVENT(ust_gen_nevents, + tptest1, + TP_ARGS(int, anint, long, value), + TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer(long, longfield, value))) + +TRACEPOINT_EVENT(ust_gen_nevents, + tptest2, + TP_ARGS(int, anint, long, value), + TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer(long, longfield, value))) + +TRACEPOINT_EVENT(ust_gen_nevents, + tptest3, + TP_ARGS(int, anint, long, value), + TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer(long, longfield, value))) #endif /* _TRACEPOINT_UST_GEN_NEVENTS_H */ diff --git a/tests/regression/ust/overlap/demo/demo.c b/tests/regression/ust/overlap/demo/demo.c index 4ca61cd02..12286293f 100644 --- a/tests/regression/ust/overlap/demo/demo.c +++ b/tests/regression/ust/overlap/demo/demo.c @@ -6,17 +6,17 @@ * */ -#include -#include -#include -#include -#include -#include +#include #include #include -#include -#include +#include +#include #include +#include +#include +#include +#include +#include #define TRACEPOINT_DEFINE #define TRACEPOINT_PROBE_DYNAMIC_LINKAGE @@ -44,8 +44,7 @@ int main(int argc, char **argv) tracepoint(ust_tests_demo, starting, 123); for (i = 0; i < 5; i++) { netint = htonl(i); - tracepoint(ust_tests_demo2, loop, i, netint, values, - text, strlen(text), dbl, flt); + tracepoint(ust_tests_demo2, loop, i, netint, values, text, strlen(text), dbl, flt); } tracepoint(ust_tests_demo, done, 456); tracepoint(ust_tests_demo3, done, 42); diff --git a/tests/regression/ust/overlap/demo/ust_tests_demo.h b/tests/regression/ust/overlap/demo/ust_tests_demo.h index 8c9c89058..c9d12eaed 100644 --- a/tests/regression/ust/overlap/demo/ust_tests_demo.h +++ b/tests/regression/ust/overlap/demo/ust_tests_demo.h @@ -13,31 +13,29 @@ #include -TRACEPOINT_EVENT(ust_tests_demo, starting, - TP_ARGS(int, value), - TP_FIELDS( - ctf_integer(int, value, value) - ) -) +TRACEPOINT_EVENT(ust_tests_demo, + starting, + TP_ARGS(int, value), + TP_FIELDS(ctf_integer(int, value, value))) TRACEPOINT_LOGLEVEL(ust_tests_demo, starting, TRACE_CRIT) /* * Dummy model information, just for example. TODO: we should check if * EMF model URI have some standard format we should follow. */ -TRACEPOINT_MODEL_EMF_URI(ust_tests_demo, starting, - "http://example.com/path_to_model?q=ust_tests_demo:starting") - -TRACEPOINT_EVENT(ust_tests_demo, done, - TP_ARGS(int, value), - TP_FIELDS( - ctf_integer(int, value, value) - ) -) +TRACEPOINT_MODEL_EMF_URI(ust_tests_demo, + starting, + "http://example.com/path_to_model?q=ust_tests_demo:starting") + +TRACEPOINT_EVENT(ust_tests_demo, + done, + TP_ARGS(int, value), + TP_FIELDS(ctf_integer(int, value, value))) TRACEPOINT_LOGLEVEL(ust_tests_demo, done, TRACE_CRIT) -TRACEPOINT_MODEL_EMF_URI(ust_tests_demo, done, - "http://example.com/path_to_model?q=ust_tests_demo:done") +TRACEPOINT_MODEL_EMF_URI(ust_tests_demo, + done, + "http://example.com/path_to_model?q=ust_tests_demo:done") #endif /* _TRACEPOINT_UST_TESTS_DEMO_H */ diff --git a/tests/regression/ust/overlap/demo/ust_tests_demo2.h b/tests/regression/ust/overlap/demo/ust_tests_demo2.h index a8b30e8a1..0c39786b6 100644 --- a/tests/regression/ust/overlap/demo/ust_tests_demo2.h +++ b/tests/regression/ust/overlap/demo/ust_tests_demo2.h @@ -12,27 +12,35 @@ #include -TRACEPOINT_EVENT(ust_tests_demo2, loop, - TP_ARGS(int, anint, int, netint, long *, values, - char *, text, size_t, textlen, - double, doublearg, float, floatarg), - TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer_hex(int, intfield2, anint) - ctf_integer(long, longfield, anint) - ctf_integer_network(int, netintfield, netint) - ctf_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) - ctf_sequence(char, seqfield1, text, - size_t, textlen) - ctf_sequence_text(char, seqfield2, text, - size_t, textlen) - ctf_string(stringfield, text) - ctf_float(float, floatfield, floatarg) - ctf_float(double, doublefield, doublearg) - ) -) +TRACEPOINT_EVENT( + ust_tests_demo2, + loop, + TP_ARGS(int, + anint, + int, + netint, + long *, + values, + char *, + text, + size_t, + textlen, + double, + doublearg, + float, + floatarg), + TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex( + int, intfield2, anint) ctf_integer(long, longfield, anint) + ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex( + int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3) + ctf_array_text(char, arrfield2, text, 10) ctf_sequence( + char, seqfield1, text, size_t, textlen) + ctf_sequence_text(char, seqfield2, text, size_t, textlen) + ctf_string(stringfield, text) + ctf_float(float, floatfield, floatarg) + ctf_float(double, + doublefield, + doublearg))) TRACEPOINT_LOGLEVEL(ust_tests_demo2, loop, TRACE_WARNING) #endif /* _TRACEPOINT_UST_TESTS_DEMO2_H */ diff --git a/tests/regression/ust/overlap/demo/ust_tests_demo3.h b/tests/regression/ust/overlap/demo/ust_tests_demo3.h index 7511c2dc1..8018f22ac 100644 --- a/tests/regression/ust/overlap/demo/ust_tests_demo3.h +++ b/tests/regression/ust/overlap/demo/ust_tests_demo3.h @@ -13,12 +13,10 @@ #include -TRACEPOINT_EVENT(ust_tests_demo3, done, - TP_ARGS(int, value), - TP_FIELDS( - ctf_integer(int, value, value) - ) -) +TRACEPOINT_EVENT(ust_tests_demo3, + done, + TP_ARGS(int, value), + TP_FIELDS(ctf_integer(int, value, value))) TRACEPOINT_LOGLEVEL(ust_tests_demo3, done, TRACE_WARNING) #endif /* _TRACEPOINT_UST_TESTS_DEMO3_H */ diff --git a/tests/regression/ust/type-declarations/type-declarations.c b/tests/regression/ust/type-declarations/type-declarations.c index d7d2aff73..7ac8981ca 100644 --- a/tests/regression/ust/type-declarations/type-declarations.c +++ b/tests/regression/ust/type-declarations/type-declarations.c @@ -20,8 +20,8 @@ int main(void) int i; for (i = 0; i < 2; i++) { - tracepoint(ust_tests_td, tptest, i % 2, (i+1) % 2, i % 21); - tracepoint(ust_tests_td, tptest_bis, i % 2); + tracepoint(ust_tests_td, tptest, i % 2, (i + 1) % 2, i % 21); + tracepoint(ust_tests_td, tptest_bis, i % 2); } tracepoint(ust_tests_td, test_auto); diff --git a/tests/regression/ust/type-declarations/ust_tests_td.h b/tests/regression/ust/type-declarations/ust_tests_td.h index 84a8f7c32..8551b328d 100644 --- a/tests/regression/ust/type-declarations/ust_tests_td.h +++ b/tests/regression/ust/type-declarations/ust_tests_td.h @@ -13,71 +13,54 @@ #include -TRACEPOINT_ENUM(ust_tests_td, testenum, - TP_ENUM_VALUES( - ctf_enum_value("zero", 0) - ctf_enum_value("one", 1) - ) -) +TRACEPOINT_ENUM(ust_tests_td, + testenum, + TP_ENUM_VALUES(ctf_enum_value("zero", 0) ctf_enum_value("one", 1))) -TRACEPOINT_ENUM(ust_tests_td, testenum2, - TP_ENUM_VALUES( - ctf_enum_value("zero", 0) - ctf_enum_value("five", 5) - ctf_enum_range("ten_to_twenty", 10, 20) - ) -) +TRACEPOINT_ENUM(ust_tests_td, + testenum2, + TP_ENUM_VALUES(ctf_enum_value("zero", 0) ctf_enum_value("five", 5) + ctf_enum_range("ten_to_twenty", 10, 20))) -TRACEPOINT_ENUM(ust_tests_td, testenum3, - TP_ENUM_VALUES( - ctf_enum_auto("zero") - ctf_enum_value("two", 2) - ctf_enum_auto("three") - ctf_enum_range("ten_to_twenty", 10, 20) - ctf_enum_auto("twenty_one") - ) -) +TRACEPOINT_ENUM(ust_tests_td, + testenum3, + TP_ENUM_VALUES(ctf_enum_auto("zero") ctf_enum_value("two", 2) ctf_enum_auto("three") + ctf_enum_range("ten_to_twenty", 10, 20) + ctf_enum_auto("twenty_one"))) /* * Enumeration field is used twice to make sure the global type declaration * is entered only once in the metadata file. */ -TRACEPOINT_EVENT(ust_tests_td, tptest, +TRACEPOINT_EVENT( + ust_tests_td, + tptest, TP_ARGS(int, enumval, int, enumval2, int, enumval3), TP_FIELDS( - ctf_enum(ust_tests_td, testenum, int, enumfield, enumval) - ctf_enum(ust_tests_td, testenum, long long, - enumfield_bis, enumval2) - ctf_enum(ust_tests_td, testenum2, unsigned int, - enumfield_third, enumval3) - ) -) + ctf_enum(ust_tests_td, testenum, int, enumfield, enumval) ctf_enum( + ust_tests_td, testenum, long long, enumfield_bis, enumval2) + ctf_enum(ust_tests_td, testenum2, unsigned int, enumfield_third, enumval3))) /* * Another tracepoint using the global types to make sure each global type is * entered only once in the metadata file. */ -TRACEPOINT_EVENT(ust_tests_td, tptest_bis, - TP_ARGS(int, enumval), - TP_FIELDS( - ctf_enum(ust_tests_td, testenum, unsigned char, - enumfield, enumval) - ) -) +TRACEPOINT_EVENT(ust_tests_td, + tptest_bis, + TP_ARGS(int, enumval), + TP_FIELDS(ctf_enum(ust_tests_td, testenum, unsigned char, enumfield, enumval))) /* * Test autoincrementing enumeration values. */ -TRACEPOINT_EVENT(ust_tests_td, test_auto, - TP_ARGS(void), - TP_FIELDS( - ctf_enum(ust_tests_td, testenum3, int, zero, 0) - ctf_enum(ust_tests_td, testenum3, int, two, 2) - ctf_enum(ust_tests_td, testenum3, int, three, 3) - ctf_enum(ust_tests_td, testenum3, int, fifteen, 15) - ctf_enum(ust_tests_td, testenum3, int, twenty_one, 21) - ) -) +TRACEPOINT_EVENT(ust_tests_td, + test_auto, + TP_ARGS(void), + TP_FIELDS(ctf_enum(ust_tests_td, testenum3, int, zero, 0) ctf_enum( + ust_tests_td, testenum3, int, two, 2) + ctf_enum(ust_tests_td, testenum3, int, three, 3) ctf_enum( + ust_tests_td, testenum3, int, fifteen, 15) + ctf_enum(ust_tests_td, testenum3, int, twenty_one, 21))) #endif /* _TRACEPOINT_UST_TESTS_TD_H */ diff --git a/tests/regression/ust/ust-dl/libbar-tp.h b/tests/regression/ust/ust-dl/libbar-tp.h index 13ff1f2d1..ef7c68d7d 100644 --- a/tests/regression/ust/ust-dl/libbar-tp.h +++ b/tests/regression/ust/ust-dl/libbar-tp.h @@ -16,12 +16,7 @@ #include -TRACEPOINT_EVENT( - libbar, - bar, - TP_ARGS(void), - TP_FIELDS() -) +TRACEPOINT_EVENT(libbar, bar, TP_ARGS(void), TP_FIELDS()) #endif /* _LIBBAR_TP_H */ diff --git a/tests/regression/ust/ust-dl/libbar.h b/tests/regression/ust/ust-dl/libbar.h index 1f1a0bbfd..7248e5d6f 100644 --- a/tests/regression/ust/ust-dl/libbar.h +++ b/tests/regression/ust/ust-dl/libbar.h @@ -12,4 +12,4 @@ LTTNG_EXPORT int bar(void); -#endif /* _LIBBAR_H */ +#endif /* _LIBBAR_H */ diff --git a/tests/regression/ust/ust-dl/libfoo-tp.h b/tests/regression/ust/ust-dl/libfoo-tp.h index c95a08852..5dcc2507c 100644 --- a/tests/regression/ust/ust-dl/libfoo-tp.h +++ b/tests/regression/ust/ust-dl/libfoo-tp.h @@ -16,12 +16,7 @@ #include -TRACEPOINT_EVENT( - libfoo, - foo, - TP_ARGS(void), - TP_FIELDS() -) +TRACEPOINT_EVENT(libfoo, foo, TP_ARGS(void), TP_FIELDS()) #endif /* _LIBFOO_TP_H */ diff --git a/tests/regression/ust/ust-dl/libfoo.c b/tests/regression/ust/ust-dl/libfoo.c index 3c92464d8..908eb1f80 100644 --- a/tests/regression/ust/ust-dl/libfoo.c +++ b/tests/regression/ust/ust-dl/libfoo.c @@ -5,8 +5,8 @@ * */ -#include "libfoo.h" #include "libbar.h" +#include "libfoo.h" #define TRACEPOINT_DEFINE #define TRACEPOINT_PROBE_DYNAMIC_LINKAGE diff --git a/tests/regression/ust/ust-dl/libfoo.h b/tests/regression/ust/ust-dl/libfoo.h index 43ae5b9b8..30e94a086 100644 --- a/tests/regression/ust/ust-dl/libfoo.h +++ b/tests/regression/ust/ust-dl/libfoo.h @@ -12,4 +12,4 @@ LTTNG_EXPORT int foo(void); -#endif /* _LIBFOO_H */ +#endif /* _LIBFOO_H */ diff --git a/tests/regression/ust/ust-dl/libzzz-tp.h b/tests/regression/ust/ust-dl/libzzz-tp.h index c7390fa27..17761a422 100644 --- a/tests/regression/ust/ust-dl/libzzz-tp.h +++ b/tests/regression/ust/ust-dl/libzzz-tp.h @@ -16,12 +16,7 @@ #include -TRACEPOINT_EVENT( - libzzz, - zzz, - TP_ARGS(void), - TP_FIELDS() -) +TRACEPOINT_EVENT(libzzz, zzz, TP_ARGS(void), TP_FIELDS()) #endif /* _LIBZZZ_TP_H */ diff --git a/tests/regression/ust/ust-dl/libzzz.h b/tests/regression/ust/ust-dl/libzzz.h index e1ea4ce9c..ba7d84c86 100644 --- a/tests/regression/ust/ust-dl/libzzz.h +++ b/tests/regression/ust/ust-dl/libzzz.h @@ -10,4 +10,4 @@ int zzz(void); -#endif /* _LIBZZZ_H */ +#endif /* _LIBZZZ_H */ diff --git a/tests/regression/ust/ust-dl/prog.c b/tests/regression/ust/ust-dl/prog.c index e4288928f..60fb0d1dc 100644 --- a/tests/regression/ust/ust-dl/prog.c +++ b/tests/regression/ust/ust-dl/prog.c @@ -6,12 +6,12 @@ */ /* _GNU_SOURCE is defined by config.h */ +#include + #include #include -#include #include - -#include +#include /* * libfoo has a direct dependency on libbar. diff --git a/tests/utils/tap/tap.c b/tests/utils/tap/tap.c index 9f41408bd..a7ec3db2c 100644 --- a/tests/utils/tap/tap.c +++ b/tests/utils/tap/tap.c @@ -5,15 +5,15 @@ * Copyright (C) 2017 Jérémie Galarneau */ +#include "tap.h" + +#include #include +#include #include #include #include #include -#include -#include - -#include "tap.h" static int no_plan = 0; static int skip_all = 0; @@ -31,11 +31,11 @@ static int test_died = 0; #ifdef HAVE_LIBPTHREAD #include static pthread_mutex_t M = PTHREAD_MUTEX_INITIALIZER; -# define LOCK pthread_mutex_lock(&M); -# define UNLOCK pthread_mutex_unlock(&M); +#define LOCK pthread_mutex_lock(&M); +#define UNLOCK pthread_mutex_unlock(&M); #else -# define LOCK -# define UNLOCK +#define LOCK +#define UNLOCK #endif static void _expected_tests(unsigned int); @@ -43,14 +43,14 @@ static void _tap_init(void); static void _cleanup(void); #ifdef __MINGW32__ -static inline -void flockfile (FILE * filehandle) { - return; +static inline void flockfile(FILE *filehandle) +{ + return; } -static inline -void funlockfile(FILE * filehandle) { - return; +static inline void funlockfile(FILE *filehandle) +{ + return; } #endif @@ -61,9 +61,8 @@ void funlockfile(FILE * filehandle) { * test_name -- the name of the test, may be NULL * test_comment -- a comment to print afterwards, may be NULL */ -unsigned int -_gen_result(int ok, const char *func, const char *file, unsigned int line, - const char *test_name, ...) +unsigned int _gen_result( + int ok, const char *func, const char *file, unsigned int line, const char *test_name, ...) { va_list ap; char *local_test_name = NULL; @@ -76,7 +75,7 @@ _gen_result(int ok, const char *func, const char *file, unsigned int line, /* Start by taking the test name and performing any printf() expansions on it */ - if(test_name != NULL) { + if (test_name != NULL) { va_start(ap, test_name); if (vasprintf(&local_test_name, test_name, ap) == -1) { local_test_name = NULL; @@ -86,43 +85,44 @@ _gen_result(int ok, const char *func, const char *file, unsigned int line, /* Make sure the test name contains more than digits and spaces. Emit an error message and exit if it does */ - if(local_test_name) { + if (local_test_name) { name_is_digits = 1; - for(c = local_test_name; *c != '\0'; c++) { - if(!isdigit((unsigned char) *c) && !isspace((unsigned char) *c)) { + for (c = local_test_name; *c != '\0'; c++) { + if (!isdigit((unsigned char) *c) && !isspace((unsigned char) *c)) { name_is_digits = 0; break; } } - if(name_is_digits) { - diag(" You named your test '%s'. You shouldn't use numbers for your test names.", local_test_name); + if (name_is_digits) { + diag(" You named your test '%s'. You shouldn't use numbers for your test names.", + local_test_name); diag(" Very confusing."); } } } - if(!ok) { + if (!ok) { printf("not "); failures++; } printf("ok %d", test_count); - if(test_name != NULL) { + if (test_name != NULL) { printf(" - "); /* Print the test name, escaping any '#' characters it might contain */ - if(local_test_name != NULL) { + if (local_test_name != NULL) { flockfile(stdout); - for(c = local_test_name; *c != '\0'; c++) { - if(*c == '#') + for (c = local_test_name; *c != '\0'; c++) { + if (*c == '#') fputc('\\', stdout); - fputc((int)*c, stdout); + fputc((int) *c, stdout); } funlockfile(stdout); - } else { /* vasprintf() failed, use a fixed message */ + } else { /* vasprintf() failed, use a fixed message */ printf("%s", todo_msg_fixed); } } @@ -134,20 +134,23 @@ _gen_result(int ok, const char *func, const char *file, unsigned int line, This is not counted as a failure, so decrement the counter if the test failed. */ - if(todo) { + if (todo) { printf(" # TODO %s", todo_msg ? todo_msg : todo_msg_fixed); - if(!ok) + if (!ok) failures--; } printf("\n"); - if(!ok) { - if(getenv("HARNESS_ACTIVE") != NULL) + if (!ok) { + if (getenv("HARNESS_ACTIVE") != NULL) fputs("\n", stderr); diag(" Failed %stest (%s:%s() at line %d)", - todo ? "(TODO) " : "", file, func, line); + todo ? "(TODO) " : "", + file, + func, + line); } free(local_test_name); @@ -162,12 +165,11 @@ _gen_result(int ok, const char *func, const char *file, unsigned int line, * Initialise the TAP library. Will only do so once, however many times it's * called. */ -void -_tap_init(void) +void _tap_init(void) { static int run_once = 0; - if(!run_once) { + if (!run_once) { atexit(_cleanup); /* stdout needs to be unbuffered so that the output appears @@ -181,15 +183,13 @@ _tap_init(void) /* * Note that there's no plan. */ -int -plan_no_plan(void) +int plan_no_plan(void) { - LOCK; _tap_init(); - if(have_plan != 0) { + if (have_plan != 0) { fprintf(stderr, "You tried to plan twice!\n"); test_died = 1; UNLOCK; @@ -207,10 +207,8 @@ plan_no_plan(void) /* * Note that the plan is to skip all tests */ -int -plan_skip_all(const char *reason) +int plan_skip_all(const char *reason) { - LOCK; _tap_init(); @@ -219,7 +217,7 @@ plan_skip_all(const char *reason) printf("1..0"); - if(reason != NULL) + if (reason != NULL) printf(" # Skip %s", reason); printf("\n"); @@ -232,22 +230,20 @@ plan_skip_all(const char *reason) /* * Note the number of tests that will be run. */ -int -plan_tests(unsigned int tests) +int plan_tests(unsigned int tests) { - LOCK; _tap_init(); - if(have_plan != 0) { + if (have_plan != 0) { fprintf(stderr, "You tried to plan twice!\n"); test_died = 1; UNLOCK; exit(255); } - if(tests == 0) { + if (tests == 0) { fprintf(stderr, "You said to run 0 tests! You've got to run something.\n"); test_died = 1; UNLOCK; @@ -263,8 +259,7 @@ plan_tests(unsigned int tests) return e_tests; } -unsigned int -diag(const char *fmt, ...) +unsigned int diag(const char *fmt, ...) { va_list ap; @@ -279,8 +274,7 @@ diag(const char *fmt, ...) return 0; } -void -diag_multiline(const char *val) +void diag_multiline(const char *val) { size_t len, i, line_start_idx = 0; @@ -301,16 +295,13 @@ diag_multiline(const char *val) } } -void -_expected_tests(unsigned int tests) +void _expected_tests(unsigned int tests) { - printf("1..%d\n", tests); e_tests = tests; } -int -skip(unsigned int n, const char *fmt, ...) +int skip(unsigned int n, const char *fmt, ...) { va_list ap; char *skip_msg = NULL; @@ -323,11 +314,11 @@ skip(unsigned int n, const char *fmt, ...) } va_end(ap); - while(n-- > 0) { + while (n-- > 0) { test_count++; - printf("ok %d # skip %s\n", test_count, - skip_msg != NULL ? - skip_msg : "libtap():malloc() failed"); + printf("ok %d # skip %s\n", + test_count, + skip_msg != NULL ? skip_msg : "libtap():malloc() failed"); } free(skip_msg); @@ -337,8 +328,7 @@ skip(unsigned int n, const char *fmt, ...) return 1; } -void -todo_start(const char *fmt, ...) +void todo_start(const char *fmt, ...) { va_list ap; @@ -355,10 +345,8 @@ todo_start(const char *fmt, ...) UNLOCK; } -void -todo_end(void) +void todo_end(void) { - LOCK; todo = 0; @@ -367,22 +355,21 @@ todo_end(void) UNLOCK; } -int -exit_status(void) +int exit_status(void) { int r; LOCK; /* If there's no plan, just return the number of failures */ - if(no_plan || !have_plan) { + if (no_plan || !have_plan) { UNLOCK; return failures; } /* Ran too many tests? Return the number of tests that were run that shouldn't have been */ - if(e_tests < test_count) { + if (e_tests < test_count) { r = test_count - e_tests; UNLOCK; return r; @@ -400,51 +387,54 @@ exit_status(void) * Cleanup at the end of the run, produce any final output that might be * required. */ -void -_cleanup(void) +void _cleanup(void) { - LOCK; /* If plan_no_plan() wasn't called, and we don't have a plan, and we're not skipping everything, then something happened before we could produce any output */ - if(!no_plan && !have_plan && !skip_all) { + if (!no_plan && !have_plan && !skip_all) { diag("Looks like your test died before it could output anything."); UNLOCK; return; } - if(test_died) { + if (test_died) { diag("Looks like your test died just after %d.", test_count); UNLOCK; return; } - /* No plan provided, but now we know how many tests were run, and can print the header at the end */ - if(!skip_all && (no_plan || !have_plan)) { + if (!skip_all && (no_plan || !have_plan)) { printf("1..%d\n", test_count); } - if((have_plan && !no_plan) && e_tests < test_count) { + if ((have_plan && !no_plan) && e_tests < test_count) { diag("Looks like you planned %d %s but ran %d extra.", - e_tests, e_tests == 1 ? "test" : "tests", test_count - e_tests); + e_tests, + e_tests == 1 ? "test" : "tests", + test_count - e_tests); UNLOCK; return; } - if((have_plan || !no_plan) && e_tests > test_count) { + if ((have_plan || !no_plan) && e_tests > test_count) { diag("Looks like you planned %d %s but only ran %d.", - e_tests, e_tests == 1 ? "test" : "tests", test_count); + e_tests, + e_tests == 1 ? "test" : "tests", + test_count); UNLOCK; return; } - if(failures) + if (failures) diag("Looks like you failed %d %s of %d.", - failures, failures == 1 ? "test" : "tests", test_count); + failures, + failures == 1 ? "test" : "tests", + test_count); UNLOCK; } diff --git a/tests/utils/tap/tap.h b/tests/utils/tap/tap.h index bc6745a73..5da691919 100644 --- a/tests/utils/tap/tap.h +++ b/tests/utils/tap/tap.h @@ -13,74 +13,69 @@ extern "C" { and requires the caller to add the final comma if they've ommitted the optional arguments */ #ifdef __GNUC__ -# define ok(e, test, ...) ((e) ? \ - _gen_result(1, __func__, __FILE__, __LINE__, \ - test, ## __VA_ARGS__) : \ - _gen_result(0, __func__, __FILE__, __LINE__, \ - test, ## __VA_ARGS__)) - -# define ok1(e) ((e) ? \ - _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \ - _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e)) - -# define pass(test, ...) ok(1, test, ## __VA_ARGS__) -# define fail(test, ...) ok(0, test, ## __VA_ARGS__) - -# define skip_start(test, n, fmt, ...) \ - do { \ - if((test)) { \ - skip(n, fmt, ## __VA_ARGS__); \ - continue; \ +#define ok(e, test, ...) \ + ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, test, ##__VA_ARGS__) : \ + _gen_result(0, __func__, __FILE__, __LINE__, test, ##__VA_ARGS__)) + +#define ok1(e) \ + ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \ + _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e)) + +#define pass(test, ...) ok(1, test, ##__VA_ARGS__) +#define fail(test, ...) ok(0, test, ##__VA_ARGS__) + +#define skip_start(test, n, fmt, ...) \ + do { \ + if ((test)) { \ + skip(n, fmt, ##__VA_ARGS__); \ + continue; \ } #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* __GNUC__ */ -# define ok(e, ...) ((e) ? \ - _gen_result(1, __func__, __FILE__, __LINE__, \ - __VA_ARGS__) : \ - _gen_result(0, __func__, __FILE__, __LINE__, \ - __VA_ARGS__)) - -# define ok1(e) ((e) ? \ - _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \ - _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e)) - -# define pass(...) ok(1, __VA_ARGS__) -# define fail(...) ok(0, __VA_ARGS__) - -# define skip_start(test, n, ...) \ - do { \ - if((test)) { \ - skip(n, __VA_ARGS__); \ - continue; \ +#define ok(e, ...) \ + ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, __VA_ARGS__) : \ + _gen_result(0, __func__, __FILE__, __LINE__, __VA_ARGS__)) + +#define ok1(e) \ + ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \ + _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e)) + +#define pass(...) ok(1, __VA_ARGS__) +#define fail(...) ok(0, __VA_ARGS__) + +#define skip_start(test, n, ...) \ + do { \ + if ((test)) { \ + skip(n, __VA_ARGS__); \ + continue; \ } #else /* __STDC_VERSION__ */ -# error "Needs gcc or C99 compiler for variadic macros." +#error "Needs gcc or C99 compiler for variadic macros." #endif /* __STDC_VERSION__ */ -#define skip_end() } while(0); +#define skip_end() \ + } \ + while (0) \ + ; #ifdef __MINGW_PRINTF_FORMAT -# define TAP_PRINTF_FORMAT __MINGW_PRINTF_FORMAT +#define TAP_PRINTF_FORMAT __MINGW_PRINTF_FORMAT #else -# define TAP_PRINTF_FORMAT printf +#define TAP_PRINTF_FORMAT printf #endif -__attribute__((format(TAP_PRINTF_FORMAT, 5, 6))) -unsigned int _gen_result(int, const char *, const char *, unsigned int, const char *, ...); +__attribute__((format(TAP_PRINTF_FORMAT, 5, 6))) unsigned int +_gen_result(int, const char *, const char *, unsigned int, const char *, ...); int plan_no_plan(void); -__attribute__((noreturn)) -int plan_skip_all(const char *); +__attribute__((noreturn)) int plan_skip_all(const char *); int plan_tests(unsigned int); -__attribute__((format(TAP_PRINTF_FORMAT, 1, 2))) -unsigned int diag(const char *, ...); +__attribute__((format(TAP_PRINTF_FORMAT, 1, 2))) unsigned int diag(const char *, ...); void diag_multiline(const char *); -__attribute__((format(TAP_PRINTF_FORMAT, 2, 3))) -int skip(unsigned int, const char *, ...); +__attribute__((format(TAP_PRINTF_FORMAT, 2, 3))) int skip(unsigned int, const char *, ...); -__attribute__((format(TAP_PRINTF_FORMAT, 1, 2))) -void todo_start(const char *, ...); +__attribute__((format(TAP_PRINTF_FORMAT, 1, 2))) void todo_start(const char *, ...); void todo_end(void); int exit_status(void); diff --git a/tests/utils/testapp/gen-kernel-test-events/gen-kernel-test-events.c b/tests/utils/testapp/gen-kernel-test-events/gen-kernel-test-events.c index 5e488f982..af8b76a17 100644 --- a/tests/utils/testapp/gen-kernel-test-events/gen-kernel-test-events.c +++ b/tests/utils/testapp/gen-kernel-test-events/gen-kernel-test-events.c @@ -6,6 +6,8 @@ * */ +#include "utils.h" + #include #include #include @@ -13,8 +15,6 @@ #include #include -#include "utils.h" - #define LTTNG_MODULES_FILE "/proc/lttng-test-filter-event" /* @@ -31,8 +31,7 @@ int main(int argc, char **argv) if (argc != 3) { fprintf(stderr, "Error: Missing argument\n"); - fprintf(stderr, "USAGE: %s PATH_WAIT_FILE NR_EVENTS\n", - argv[0]); + fprintf(stderr, "USAGE: %s PATH_WAIT_FILE NR_EVENTS\n", argv[0]); ret = -1; goto end; } diff --git a/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack.c b/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack.c index 9d3e030b7..bee03a42c 100644 --- a/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack.c +++ b/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack.c @@ -5,6 +5,8 @@ * */ +#include "utils.h" + #include #include #include @@ -15,8 +17,6 @@ #include #include -#include "utils.h" - /** * The process waits for the creation of a file passed as argument from an * external processes to execute a syscall and exiting. This is useful for tests @@ -33,50 +33,34 @@ volatile int val = 0; long nooptimization my_gettid(void); -long nooptimization -my_gettid(void) +long nooptimization my_gettid(void) { - long ret; + long ret; #ifdef __x86_64 - asm volatile - ( - "syscall" - : "=a" (ret) - : "0"(__NR_gettid) - : "cc", "rcx", "r11", "memory" - ); + asm volatile("syscall" : "=a"(ret) : "0"(__NR_gettid) : "cc", "rcx", "r11", "memory"); #elif defined(__i386) - asm volatile - ( - "int $0x80" - : "=a" (ret) - : "0"(__NR_gettid) - : "cc", "edi", "esi", "memory" - ); + asm volatile("int $0x80" : "=a"(ret) : "0"(__NR_gettid) : "cc", "edi", "esi", "memory"); #else #error "Userspace callstack test not supported for this architecture." #endif - return ret; + return ret; } int nooptimization fct_c(void); -int nooptimization -fct_c(void) +int nooptimization fct_c(void) { return my_gettid(); } int nooptimization fct_b(void); -int nooptimization -fct_b(void) +int nooptimization fct_b(void) { val += fct_c(); return val; } int nooptimization fct_a(void); -int nooptimization -fct_a(void) +int nooptimization fct_a(void) { val += fct_b(); return val; diff --git a/tests/utils/testapp/gen-ust-events-ns/tp.h b/tests/utils/testapp/gen-ust-events-ns/tp.h index b9540e53f..624bb5c07 100644 --- a/tests/utils/testapp/gen-ust-events-ns/tp.h +++ b/tests/utils/testapp/gen-ust-events-ns/tp.h @@ -11,15 +11,11 @@ #if !defined(_TRACEPOINT_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ) #define _TRACEPOINT_TP_H -#include #include -TRACEPOINT_EVENT(tp, tptest, - TP_ARGS(ino_t, ns_ino), - TP_FIELDS( - ctf_integer(ino_t, ns_ino, ns_ino) - ) -) +#include + +TRACEPOINT_EVENT(tp, tptest, TP_ARGS(ino_t, ns_ino), TP_FIELDS(ctf_integer(ino_t, ns_ino, ns_ino))) #endif /* _TRACEPOINT_TP_H */ diff --git a/tests/utils/testapp/gen-ust-events/tp.h b/tests/utils/testapp/gen-ust-events/tp.h index 6f22887cf..08c5f92de 100644 --- a/tests/utils/testapp/gen-ust-events/tp.h +++ b/tests/utils/testapp/gen-ust-events/tp.h @@ -12,59 +12,107 @@ #define _TRACEPOINT_TP_H #include + #include -TRACEPOINT_ENUM( - tp, tptest_enum, - TP_ENUM_VALUES( - ctf_enum_auto("AUTO: EXPECT 0") - ctf_enum_value("VALUE: 23", 23) - ctf_enum_value("VALUE: 27", 27) - ctf_enum_auto("AUTO: EXPECT 28") - ctf_enum_range("RANGE: 101 TO 303", 101, 303) - ctf_enum_auto("AUTO: EXPECT 304") - ctf_enum_value("VALUE: -1", -1) - ) -) +TRACEPOINT_ENUM(tp, + tptest_enum, + TP_ENUM_VALUES(ctf_enum_auto("AUTO: EXPECT 0") ctf_enum_value("VALUE: 23", 23) + ctf_enum_value("VALUE: 27", + 27) ctf_enum_auto("AUTO: EXPECT 28") + ctf_enum_range("RANGE: 101 TO 303", 101, 303) + ctf_enum_auto("AUTO: EXPECT 304") + ctf_enum_value("VALUE: -1", -1))) -TRACEPOINT_EVENT(tp, tptest, - TP_ARGS(int, anint, int, netint, long *, values, - char *, text, size_t, textlen, - char *, etext, uint32_t * , net_values, - double, doublearg, float, floatarg), +TRACEPOINT_EVENT( + tp, + tptest, + TP_ARGS(int, + anint, + int, + netint, + long *, + values, + char *, + text, + size_t, + textlen, + char *, + etext, + uint32_t *, + net_values, + double, + doublearg, + float, + floatarg), TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer_hex(int, intfield2, anint) - ctf_integer(long, longfield, anint) - ctf_integer(int, signedfield, -1) - ctf_integer_network(int, netintfield, netint) - ctf_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) - ctf_array_network(uint32_t, arrfield3, net_values, 3) - ctf_sequence(char, seqfield1, text, size_t, textlen) - ctf_sequence_text(char, seqfield2, text, size_t, textlen) - ctf_sequence_network(uint32_t, seqfield3, net_values, size_t, 3) - ctf_sequence(long, seqfield4, values, size_t, 3) - ctf_string(stringfield, text) - ctf_string(stringfield2, etext) - ctf_float(float, floatfield, floatarg) - ctf_float(double, doublefield, doublearg) - ctf_enum(tp, tptest_enum, int, enum0, 0) - ctf_enum(tp, tptest_enum, int, enum23, 23) - ctf_enum(tp, tptest_enum, int, enum27, 27) - ctf_enum(tp, tptest_enum, int, enum28, 28) - ctf_enum(tp, tptest_enum, int, enum202, 202) - ctf_enum(tp, tptest_enum, int, enum304, 304) - ctf_enum(tp, tptest_enum, int, enumnegative, -1) - ) -) + ctf_integer(int, intfield, anint) ctf_integer_hex(int, intfield2, anint) ctf_integer( + long, longfield, anint) ctf_integer(int, + signedfield, + -1) ctf_integer_network(int, + netintfield, + netint) + ctf_integer_network_hex(int, netintfieldhex, netint) ctf_array( + long, + arrfield1, + values, + 3) ctf_array_text(char, + arrfield2, + text, + 10) ctf_array_network(uint32_t, + arrfield3, + net_values, + 3) ctf_sequence(char, + seqfield1, + text, + size_t, + textlen) + ctf_sequence_text(char, + seqfield2, + text, + size_t, + textlen) ctf_sequence_network(uint32_t, + seqfield3, + net_values, + size_t, + 3) + ctf_sequence(long, seqfield4, values, size_t, 3) ctf_string( + stringfield, + text) ctf_string(stringfield2, + etext) ctf_float(float, + floatfield, + floatarg) + ctf_float(double, doublefield, doublearg) ctf_enum( + tp, + tptest_enum, + int, + enum0, + 0) ctf_enum(tp, + tptest_enum, + int, + enum23, + 23) ctf_enum(tp, + tptest_enum, + int, + enum27, + 27) + ctf_enum(tp, tptest_enum, int, enum28, 28) + ctf_enum(tp, + tptest_enum, + int, + enum202, + 202) ctf_enum(tp, + tptest_enum, + int, + enum304, + 304) + ctf_enum(tp, + tptest_enum, + int, + enumnegative, + -1))) -TRACEPOINT_EVENT(tp, end, - TP_ARGS(), - TP_FIELDS( - ) -) +TRACEPOINT_EVENT(tp, end, TP_ARGS(), TP_FIELDS()) #endif /* _TRACEPOINT_TP_H */ diff --git a/tests/utils/testapp/gen-ust-nevents-str/tp.h b/tests/utils/testapp/gen-ust-nevents-str/tp.h index b9fe38429..3a4054a84 100644 --- a/tests/utils/testapp/gen-ust-nevents-str/tp.h +++ b/tests/utils/testapp/gen-ust-nevents-str/tp.h @@ -13,18 +13,11 @@ #include -TRACEPOINT_EVENT(tp, the_string, - TP_ARGS( - int, i, - int, arg_i, - const char *, str - ), - TP_FIELDS( - ctf_integer(int, i, i) - ctf_integer(long, arg_i, arg_i) - ctf_string(str, str) - ) -) +TRACEPOINT_EVENT(tp, + the_string, + TP_ARGS(int, i, int, arg_i, const char *, str), + TP_FIELDS(ctf_integer(int, i, i) ctf_integer(long, arg_i, arg_i) + ctf_string(str, str))) #endif /* _TRACEPOINT_TP_H */ diff --git a/tests/utils/testapp/gen-ust-nevents/tp.h b/tests/utils/testapp/gen-ust-nevents/tp.h index 8b68b374d..c9f214ea4 100644 --- a/tests/utils/testapp/gen-ust-nevents/tp.h +++ b/tests/utils/testapp/gen-ust-nevents/tp.h @@ -13,101 +13,151 @@ #include -TRACEPOINT_EVENT(tp, tptest1, - TP_ARGS(int, anint, int, netint, long *, values, - char *, text, size_t, textlen, - double, doublearg, float, floatarg), - TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer_hex(int, intfield2, anint) - ctf_integer(long, longfield, anint) - ctf_integer_network(int, netintfield, netint) - ctf_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) - ctf_sequence(char, seqfield1, text, size_t, textlen) - ctf_sequence_text(char, seqfield2, text, size_t, textlen) - ctf_string(stringfield, text) - ctf_float(float, floatfield, floatarg) - ctf_float(double, doublefield, doublearg) - ) -) -TRACEPOINT_EVENT(tp, tptest2, - TP_ARGS(int, anint, int, netint, long *, values, - char *, text, size_t, textlen, - double, doublearg, float, floatarg), - TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer_hex(int, intfield2, anint) - ctf_integer(long, longfield, anint) - ctf_integer_network(int, netintfield, netint) - ctf_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) - ctf_sequence(char, seqfield1, text, size_t, textlen) - ctf_sequence_text(char, seqfield2, text, size_t, textlen) - ctf_string(stringfield, text) - ctf_float(float, floatfield, floatarg) - ctf_float(double, doublefield, doublearg) - ) -) -TRACEPOINT_EVENT(tp, tptest3, - TP_ARGS(int, anint, int, netint, long *, values, - char *, text, size_t, textlen, - double, doublearg, float, floatarg), - TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer_hex(int, intfield2, anint) - ctf_integer(long, longfield, anint) - ctf_integer_network(int, netintfield, netint) - ctf_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) - ctf_sequence(char, seqfield1, text, size_t, textlen) - ctf_sequence_text(char, seqfield2, text, size_t, textlen) - ctf_string(stringfield, text) - ctf_float(float, floatfield, floatarg) - ctf_float(double, doublefield, doublearg) - ) -) -TRACEPOINT_EVENT(tp, tptest4, - TP_ARGS(int, anint, int, netint, long *, values, - char *, text, size_t, textlen, - double, doublearg, float, floatarg), - TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer_hex(int, intfield2, anint) - ctf_integer(long, longfield, anint) - ctf_integer_network(int, netintfield, netint) - ctf_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) - ctf_sequence(char, seqfield1, text, size_t, textlen) - ctf_sequence_text(char, seqfield2, text, size_t, textlen) - ctf_string(stringfield, text) - ctf_float(float, floatfield, floatarg) - ctf_float(double, doublefield, doublearg) - ) -) -TRACEPOINT_EVENT(tp, tptest5, - TP_ARGS(int, anint, int, netint, long *, values, - char *, text, size_t, textlen, - double, doublearg, float, floatarg), - TP_FIELDS( - ctf_integer(int, intfield, anint) - ctf_integer_hex(int, intfield2, anint) - ctf_integer(long, longfield, anint) - ctf_integer_network(int, netintfield, netint) - ctf_integer_network_hex(int, netintfieldhex, netint) - ctf_array(long, arrfield1, values, 3) - ctf_array_text(char, arrfield2, text, 10) - ctf_sequence(char, seqfield1, text, size_t, textlen) - ctf_sequence_text(char, seqfield2, text, size_t, textlen) - ctf_string(stringfield, text) - ctf_float(float, floatfield, floatarg) - ctf_float(double, doublefield, doublearg) - ) -) +TRACEPOINT_EVENT( + tp, + tptest1, + TP_ARGS(int, + anint, + int, + netint, + long *, + values, + char *, + text, + size_t, + textlen, + double, + doublearg, + float, + floatarg), + TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex( + int, intfield2, anint) ctf_integer(long, longfield, anint) + ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex( + int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3) + ctf_array_text(char, arrfield2, text, 10) ctf_sequence( + char, seqfield1, text, size_t, textlen) + ctf_sequence_text(char, seqfield2, text, size_t, textlen) + ctf_string(stringfield, text) + ctf_float(float, floatfield, floatarg) + ctf_float(double, + doublefield, + doublearg))) +TRACEPOINT_EVENT( + tp, + tptest2, + TP_ARGS(int, + anint, + int, + netint, + long *, + values, + char *, + text, + size_t, + textlen, + double, + doublearg, + float, + floatarg), + TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex( + int, intfield2, anint) ctf_integer(long, longfield, anint) + ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex( + int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3) + ctf_array_text(char, arrfield2, text, 10) ctf_sequence( + char, seqfield1, text, size_t, textlen) + ctf_sequence_text(char, seqfield2, text, size_t, textlen) + ctf_string(stringfield, text) + ctf_float(float, floatfield, floatarg) + ctf_float(double, + doublefield, + doublearg))) +TRACEPOINT_EVENT( + tp, + tptest3, + TP_ARGS(int, + anint, + int, + netint, + long *, + values, + char *, + text, + size_t, + textlen, + double, + doublearg, + float, + floatarg), + TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex( + int, intfield2, anint) ctf_integer(long, longfield, anint) + ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex( + int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3) + ctf_array_text(char, arrfield2, text, 10) ctf_sequence( + char, seqfield1, text, size_t, textlen) + ctf_sequence_text(char, seqfield2, text, size_t, textlen) + ctf_string(stringfield, text) + ctf_float(float, floatfield, floatarg) + ctf_float(double, + doublefield, + doublearg))) +TRACEPOINT_EVENT( + tp, + tptest4, + TP_ARGS(int, + anint, + int, + netint, + long *, + values, + char *, + text, + size_t, + textlen, + double, + doublearg, + float, + floatarg), + TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex( + int, intfield2, anint) ctf_integer(long, longfield, anint) + ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex( + int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3) + ctf_array_text(char, arrfield2, text, 10) ctf_sequence( + char, seqfield1, text, size_t, textlen) + ctf_sequence_text(char, seqfield2, text, size_t, textlen) + ctf_string(stringfield, text) + ctf_float(float, floatfield, floatarg) + ctf_float(double, + doublefield, + doublearg))) +TRACEPOINT_EVENT( + tp, + tptest5, + TP_ARGS(int, + anint, + int, + netint, + long *, + values, + char *, + text, + size_t, + textlen, + double, + doublearg, + float, + floatarg), + TP_FIELDS(ctf_integer(int, intfield, anint) ctf_integer_hex( + int, intfield2, anint) ctf_integer(long, longfield, anint) + ctf_integer_network(int, netintfield, netint) ctf_integer_network_hex( + int, netintfieldhex, netint) ctf_array(long, arrfield1, values, 3) + ctf_array_text(char, arrfield2, text, 10) ctf_sequence( + char, seqfield1, text, size_t, textlen) + ctf_sequence_text(char, seqfield2, text, size_t, textlen) + ctf_string(stringfield, text) + ctf_float(float, floatfield, floatarg) + ctf_float(double, + doublefield, + doublearg))) #endif /* _TRACEPOINT_TP_H */ diff --git a/tests/utils/testapp/signal-helper.hpp b/tests/utils/testapp/signal-helper.hpp index ba2c86a39..26272e37e 100644 --- a/tests/utils/testapp/signal-helper.hpp +++ b/tests/utils/testapp/signal-helper.hpp @@ -13,16 +13,14 @@ static volatile int should_quit; -static -void sighandler(int sig) +static void sighandler(int sig) { if (sig == SIGTERM) { should_quit = 1; } } -static -int set_signal_handler() +static int set_signal_handler() { int ret; struct sigaction sa {}; diff --git a/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary.c b/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary.c index d530be269..7a5040051 100644 --- a/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary.c +++ b/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary.c @@ -8,8 +8,8 @@ #include "foo.h" volatile int not_a_function = 0; -void __attribute__ ((noinline)) test_function(void); -void __attribute__ ((noinline)) test_function(void) +void __attribute__((noinline)) test_function(void); +void __attribute__((noinline)) test_function(void) { not_a_function += 1; } diff --git a/tests/utils/testapp/userspace-probe-elf-cxx-binary/test_class.hpp b/tests/utils/testapp/userspace-probe-elf-cxx-binary/test_class.hpp index aa518e425..05babd4ce 100644 --- a/tests/utils/testapp/userspace-probe-elf-cxx-binary/test_class.hpp +++ b/tests/utils/testapp/userspace-probe-elf-cxx-binary/test_class.hpp @@ -5,12 +5,9 @@ * */ -class test_class -{ +class test_class { public: test_class(); void test_method(); volatile int test_member; }; - - diff --git a/tests/utils/testapp/userspace-probe-sdt-binary/libbar.c b/tests/utils/testapp/userspace-probe-sdt-binary/libbar.c index a504ac89e..633fa0561 100644 --- a/tests/utils/testapp/userspace-probe-sdt-binary/libbar.c +++ b/tests/utils/testapp/userspace-probe-sdt-binary/libbar.c @@ -5,8 +5,10 @@ * */ -#include #include "foobar_provider.h" -void bar_function() { + +#include +void bar_function() +{ FOOBAR_TP_IN_DLOPEN(); } diff --git a/tests/utils/testapp/userspace-probe-sdt-binary/libfoo.c b/tests/utils/testapp/userspace-probe-sdt-binary/libfoo.c index 103b3d729..78c79fb84 100644 --- a/tests/utils/testapp/userspace-probe-sdt-binary/libfoo.c +++ b/tests/utils/testapp/userspace-probe-sdt-binary/libfoo.c @@ -5,10 +5,13 @@ * */ -#include #include "foobar_provider.h" -void foo_function() { + +#include +void foo_function() +{ FOOBAR_TP_IN_SHARED_OBJECT(); } -void overridable_function() { +void overridable_function() +{ } diff --git a/tests/utils/testapp/userspace-probe-sdt-binary/libzzz.c b/tests/utils/testapp/userspace-probe-sdt-binary/libzzz.c index 64660283e..ee7599f9e 100644 --- a/tests/utils/testapp/userspace-probe-sdt-binary/libzzz.c +++ b/tests/utils/testapp/userspace-probe-sdt-binary/libzzz.c @@ -5,8 +5,10 @@ * */ -#include #include "foobar_provider.h" -void overridable_function() { + +#include +void overridable_function() +{ FOOBAR_TP_IN_LDPRELOAD(); } diff --git a/tests/utils/testapp/userspace-probe-sdt-binary/sema.c b/tests/utils/testapp/userspace-probe-sdt-binary/sema.c index 3126e91ad..ffe2b5c60 100644 --- a/tests/utils/testapp/userspace-probe-sdt-binary/sema.c +++ b/tests/utils/testapp/userspace-probe-sdt-binary/sema.c @@ -6,7 +6,9 @@ */ #include "foobar_provider.h" + #include -void sema_function() { +void sema_function() +{ FOOBAR_TP_WITH_SEMAPHORE(); } diff --git a/tests/utils/testapp/userspace-probe-sdt-binary/userspace-probe-sdt-binary.c b/tests/utils/testapp/userspace-probe-sdt-binary/userspace-probe-sdt-binary.c index 03bdb3a45..c9c803697 100644 --- a/tests/utils/testapp/userspace-probe-sdt-binary/userspace-probe-sdt-binary.c +++ b/tests/utils/testapp/userspace-probe-sdt-binary/userspace-probe-sdt-binary.c @@ -9,20 +9,19 @@ #define _GNU_SOURCE #endif +#include "foobar_provider.h" +#include "libfoo.h" +#include "sema.h" + #include #include #include #include #include +#include #include #include -#include - -#include "foobar_provider.h" -#include "libfoo.h" -#include "sema.h" - int main(int argc, char *argv[]) { void *handle; @@ -48,7 +47,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Can't dlopen libbar.so"); return -1; } - bar_function = (void (*)())dlsym(handle, "bar_function"); + bar_function = (void (*)()) dlsym(handle, "bar_function"); bar_function(); dlclose(handle); @@ -68,4 +67,3 @@ int main(int argc, char *argv[]) sema_function(); return 0; } - diff --git a/tests/utils/utils.h b/tests/utils/utils.h index 8f04413c6..87b4918de 100644 --- a/tests/utils/utils.h +++ b/tests/utils/utils.h @@ -14,7 +14,8 @@ extern "C" { #endif -#if !defined(__GLIBC__) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE)) +#if !defined(__GLIBC__) || \ + ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE)) /* * Version using XSI strerror_r. @@ -29,13 +30,12 @@ extern "C" { /* * Version using GNU strerror_r, for linux with appropriate defines. */ -#define PERROR_NO_LOGGER(msg, args...) \ - do { \ - char *_perror_buf; \ - char _perror_tmp[200]; \ - _perror_buf = strerror_r( \ - errno, _perror_tmp, sizeof(_perror_tmp)); \ - fprintf(stderr, msg ": %s\n", ##args, _perror_buf); \ +#define PERROR_NO_LOGGER(msg, args...) \ + do { \ + char *_perror_buf; \ + char _perror_tmp[200]; \ + _perror_buf = strerror_r(errno, _perror_tmp, sizeof(_perror_tmp)); \ + fprintf(stderr, msg ": %s\n", ##args, _perror_buf); \ } while (0); #endif -- 2.34.1