From b8e2fb80c105c5a8241f7b35744e4a86d7e4125c Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Tue, 27 Apr 2021 12:13:57 -0400 Subject: [PATCH] Sync lttng-modules ABI in internal kernel-ioctl.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This commit bumps the modules minor version number in `kernel-ioctl.h` and applies the following renames: define renames: `LTTNG_KERNEL_x` -> `LTTNG_KERNEL_ABI_x` `RING_BUFFER_x` -> `LTTNG_KERNEL_ABI_RING_BUFFER_x` struct renames: `struct lttng_kernel_x` -> `struct lttng_kernel_abi_x` No behavior change intended. Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau Change-Id: I0bb0ac6bca56b6740ea2d543a6d1bd618d39b36c --- src/bin/lttng-sessiond/cmd.c | 22 +- src/bin/lttng-sessiond/context.c | 74 ++-- .../event-notifier-error-accounting.c | 12 +- src/bin/lttng-sessiond/globals.c | 4 +- src/bin/lttng-sessiond/kernel.c | 16 +- src/bin/lttng-sessiond/kernel.h | 4 +- src/bin/lttng-sessiond/lttng-sessiond.h | 4 +- .../notification-thread-events.c | 2 +- src/bin/lttng-sessiond/save.c | 118 +++---- src/bin/lttng-sessiond/trace-kernel.c | 72 ++-- src/bin/lttng-sessiond/trace-kernel.h | 8 +- src/common/kernel-ctl/kernel-ctl.c | 274 +++++++-------- src/common/kernel-ctl/kernel-ctl.h | 18 +- src/common/kernel-ctl/kernel-ioctl.h | 202 +++++------ src/common/lttng-kernel-old.h | 58 ++-- src/common/lttng-kernel.h | 316 +++++++++--------- src/common/runas.c | 4 +- tests/unit/test_kernel_data.c | 2 +- 18 files changed, 611 insertions(+), 599 deletions(-) diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index f0d5c571d..712b68089 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -681,34 +681,34 @@ static int list_lttng_kernel_events(char *channel_name, event.filter = (unsigned char) !!kevent->filter_expression; switch (kevent->event->instrumentation) { - case LTTNG_KERNEL_TRACEPOINT: + case LTTNG_KERNEL_ABI_TRACEPOINT: event.type = LTTNG_EVENT_TRACEPOINT; break; - case LTTNG_KERNEL_KRETPROBE: + case LTTNG_KERNEL_ABI_KRETPROBE: event.type = LTTNG_EVENT_FUNCTION; memcpy(&event.attr.probe, &kevent->event->u.kprobe, - sizeof(struct lttng_kernel_kprobe)); + sizeof(struct lttng_kernel_abi_kprobe)); break; - case LTTNG_KERNEL_KPROBE: + case LTTNG_KERNEL_ABI_KPROBE: event.type = LTTNG_EVENT_PROBE; memcpy(&event.attr.probe, &kevent->event->u.kprobe, - sizeof(struct lttng_kernel_kprobe)); + sizeof(struct lttng_kernel_abi_kprobe)); break; - case LTTNG_KERNEL_UPROBE: + case LTTNG_KERNEL_ABI_UPROBE: event.type = LTTNG_EVENT_USERSPACE_PROBE; break; - case LTTNG_KERNEL_FUNCTION: + case LTTNG_KERNEL_ABI_FUNCTION: event.type = LTTNG_EVENT_FUNCTION; memcpy(&event.attr.ftrace, &kevent->event->u.ftrace, - sizeof(struct lttng_kernel_function)); + sizeof(struct lttng_kernel_abi_function)); break; - case LTTNG_KERNEL_NOOP: + case LTTNG_KERNEL_ABI_NOOP: event.type = LTTNG_EVENT_NOOP; break; - case LTTNG_KERNEL_SYSCALL: + case LTTNG_KERNEL_ABI_SYSCALL: event.type = LTTNG_EVENT_SYSCALL; break; - case LTTNG_KERNEL_ALL: + case LTTNG_KERNEL_ABI_ALL: /* fall-through. */ default: assert(0); diff --git a/src/bin/lttng-sessiond/context.c b/src/bin/lttng-sessiond/context.c index 621c0b9fb..0ea6c400f 100644 --- a/src/bin/lttng-sessiond/context.c +++ b/src/bin/lttng-sessiond/context.c @@ -206,116 +206,116 @@ int context_kernel_add(struct ltt_kernel_session *ksession, /* Setup kernel context structure */ switch (ctx->ctx) { case LTTNG_EVENT_CONTEXT_PID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_PID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_PID; break; case LTTNG_EVENT_CONTEXT_PROCNAME: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_PROCNAME; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_PROCNAME; break; case LTTNG_EVENT_CONTEXT_PRIO: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_PRIO; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_PRIO; break; case LTTNG_EVENT_CONTEXT_NICE: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_NICE; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_NICE; break; case LTTNG_EVENT_CONTEXT_VPID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VPID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_VPID; break; case LTTNG_EVENT_CONTEXT_TID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_TID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_TID; break; case LTTNG_EVENT_CONTEXT_VTID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VTID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_VTID; break; case LTTNG_EVENT_CONTEXT_PPID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_PPID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_PPID; break; case LTTNG_EVENT_CONTEXT_VPPID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VPPID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_VPPID; break; case LTTNG_EVENT_CONTEXT_HOSTNAME: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_HOSTNAME; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_HOSTNAME; break; case LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER: case LTTNG_EVENT_CONTEXT_PERF_COUNTER: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_PERF_CPU_COUNTER; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_PERF_CPU_COUNTER; break; case LTTNG_EVENT_CONTEXT_INTERRUPTIBLE: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_INTERRUPTIBLE; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_INTERRUPTIBLE; break; case LTTNG_EVENT_CONTEXT_PREEMPTIBLE: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_PREEMPTIBLE; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_PREEMPTIBLE; break; case LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_NEED_RESCHEDULE; break; case LTTNG_EVENT_CONTEXT_MIGRATABLE: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_MIGRATABLE; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_MIGRATABLE; break; case LTTNG_EVENT_CONTEXT_CALLSTACK_KERNEL: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_CALLSTACK_KERNEL; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_KERNEL; break; case LTTNG_EVENT_CONTEXT_CALLSTACK_USER: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_CALLSTACK_USER; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_USER; break; case LTTNG_EVENT_CONTEXT_CGROUP_NS: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_CGROUP_NS; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_CGROUP_NS; break; case LTTNG_EVENT_CONTEXT_IPC_NS: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_IPC_NS; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_IPC_NS; break; case LTTNG_EVENT_CONTEXT_MNT_NS: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_MNT_NS; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_MNT_NS; break; case LTTNG_EVENT_CONTEXT_NET_NS: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_NET_NS; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_NET_NS; break; case LTTNG_EVENT_CONTEXT_PID_NS: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_PID_NS; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_PID_NS; break; case LTTNG_EVENT_CONTEXT_TIME_NS: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_TIME_NS; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_TIME_NS; break; case LTTNG_EVENT_CONTEXT_USER_NS: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_USER_NS; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_USER_NS; break; case LTTNG_EVENT_CONTEXT_UTS_NS: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_UTS_NS; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_UTS_NS; break; case LTTNG_EVENT_CONTEXT_UID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_UID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_UID; break; case LTTNG_EVENT_CONTEXT_EUID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_EUID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_EUID; break; case LTTNG_EVENT_CONTEXT_SUID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_SUID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_SUID; break; case LTTNG_EVENT_CONTEXT_GID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_GID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_GID; break; case LTTNG_EVENT_CONTEXT_EGID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_EGID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_EGID; break; case LTTNG_EVENT_CONTEXT_SGID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_SGID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_SGID; break; case LTTNG_EVENT_CONTEXT_VUID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VUID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_VUID; break; case LTTNG_EVENT_CONTEXT_VEUID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VEUID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_VEUID; break; case LTTNG_EVENT_CONTEXT_VSUID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VSUID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_VSUID; break; case LTTNG_EVENT_CONTEXT_VGID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VGID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_VGID; break; case LTTNG_EVENT_CONTEXT_VEGID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VEGID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_VEGID; break; case LTTNG_EVENT_CONTEXT_VSGID: - kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VSGID; + kctx->ctx.ctx = LTTNG_KERNEL_ABI_CONTEXT_VSGID; break; default: ret = LTTNG_ERR_KERN_CONTEXT_FAIL; diff --git a/src/bin/lttng-sessiond/event-notifier-error-accounting.c b/src/bin/lttng-sessiond/event-notifier-error-accounting.c index c8d1ae332..47366e9e9 100644 --- a/src/bin/lttng-sessiond/event-notifier-error-accounting.c +++ b/src/bin/lttng-sessiond/event-notifier-error-accounting.c @@ -915,7 +915,7 @@ event_notifier_error_accounting_kernel_clear( int ret; uint64_t error_counter_index; enum event_notifier_error_accounting_status status; - struct lttng_kernel_counter_clear counter_clear = {}; + struct lttng_kernel_abi_counter_clear counter_clear = {}; status = get_error_counter_index_for_token(&kernel_state, lttng_trigger_get_tracer_token(trigger), @@ -963,11 +963,11 @@ event_notifier_error_accounting_register_kernel( { int error_counter_fd = -1, ret; enum event_notifier_error_accounting_status status; - const struct lttng_kernel_counter_conf error_counter_conf = { - .arithmetic = LTTNG_KERNEL_COUNTER_ARITHMETIC_MODULAR, + const struct lttng_kernel_abi_counter_conf error_counter_conf = { + .arithmetic = LTTNG_KERNEL_ABI_COUNTER_ARITHMETIC_MODULAR, .bitness = sizeof(void *) == sizeof(uint32_t) ? - LTTNG_KERNEL_COUNTER_BITNESS_32 : - LTTNG_KERNEL_COUNTER_BITNESS_64, + LTTNG_KERNEL_ABI_COUNTER_BITNESS_32 : + LTTNG_KERNEL_ABI_COUNTER_BITNESS_64, .global_sum_step = 0, .number_dimensions = 1, .dimensions[0].size = kernel_state.number_indices, @@ -1145,7 +1145,7 @@ enum event_notifier_error_accounting_status event_notifier_error_accounting_kernel_get_count( const struct lttng_trigger *trigger, uint64_t *count) { - struct lttng_kernel_counter_aggregate counter_aggregate = {}; + struct lttng_kernel_abi_counter_aggregate counter_aggregate = {}; enum event_notifier_error_accounting_status status; uint64_t error_counter_index; int ret; diff --git a/src/bin/lttng-sessiond/globals.c b/src/bin/lttng-sessiond/globals.c index 53be62d7e..ee08ef1b0 100644 --- a/src/bin/lttng-sessiond/globals.c +++ b/src/bin/lttng-sessiond/globals.c @@ -24,8 +24,8 @@ struct notification_thread_handle *the_notification_thread_handle; struct lttng_ht *the_agent_apps_ht_by_sock = NULL; struct lttng_ht *the_trigger_agents_ht_by_domain = NULL; -struct lttng_kernel_tracer_version the_kernel_tracer_version; -struct lttng_kernel_tracer_abi_version the_kernel_tracer_abi_version; +struct lttng_kernel_abi_tracer_version the_kernel_tracer_version; +struct lttng_kernel_abi_tracer_abi_version the_kernel_tracer_abi_version; int the_kernel_poll_pipe[2] = {-1, -1}; diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c index e99d8be44..f1e61846d 100644 --- a/src/bin/lttng-sessiond/kernel.c +++ b/src/bin/lttng-sessiond/kernel.c @@ -436,7 +436,7 @@ int userspace_probe_add_callsite( switch (type) { case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF: { - struct lttng_kernel_event_callsite callsite; + struct lttng_kernel_abi_event_callsite callsite; uint64_t offset; ret = extract_userspace_probe_offset_function_elf(location, @@ -460,7 +460,7 @@ int userspace_probe_add_callsite( int i; uint64_t *offsets = NULL; uint32_t offsets_count; - struct lttng_kernel_event_callsite callsite; + struct lttng_kernel_abi_event_callsite callsite; /* * This call allocates the offsets buffer. This buffer must be freed @@ -1493,8 +1493,8 @@ error: /* * Get kernel version and validate it. */ -int kernel_validate_version(struct lttng_kernel_tracer_version *version, - struct lttng_kernel_tracer_abi_version *abi_version) +int kernel_validate_version(struct lttng_kernel_abi_tracer_version *version, + struct lttng_kernel_abi_tracer_abi_version *abi_version) { int ret; @@ -1515,10 +1515,10 @@ int kernel_validate_version(struct lttng_kernel_tracer_version *version, ERR("Failed to retrieve lttng-modules ABI version"); goto error; } - if (abi_version->major != LTTNG_MODULES_ABI_MAJOR_VERSION) { + if (abi_version->major != LTTNG_KERNEL_ABI_MAJOR_VERSION) { ERR("Kernel tracer ABI version (%d.%d) does not match the expected ABI major version (%d.*)", abi_version->major, abi_version->minor, - LTTNG_MODULES_ABI_MAJOR_VERSION); + LTTNG_KERNEL_ABI_MAJOR_VERSION); goto error; } DBG2("Kernel tracer version validated (%d.%d, ABI %d.%d)", @@ -1782,7 +1782,7 @@ static int kernel_tracer_abi_greater_or_equal(unsigned int major, unsigned int minor) { int ret; - struct lttng_kernel_tracer_abi_version abi; + struct lttng_kernel_abi_tracer_abi_version abi; ret = kernctl_tracer_abi_version(kernel_tracer_fd, &abi); if (ret < 0) { @@ -2301,7 +2301,7 @@ static enum lttng_error_code kernel_create_event_notifier_rule( enum lttng_condition_type condition_type; enum lttng_event_rule_type event_rule_type; struct ltt_kernel_event_notifier_rule *event_notifier_rule; - struct lttng_kernel_event_notifier kernel_event_notifier = {}; + struct lttng_kernel_abi_event_notifier kernel_event_notifier = {}; unsigned int capture_bytecode_count = 0, i; const struct lttng_condition *condition = NULL; const struct lttng_event_rule *event_rule = NULL; diff --git a/src/bin/lttng-sessiond/kernel.h b/src/bin/lttng-sessiond/kernel.h index a2dd7f060..7af1928ea 100644 --- a/src/bin/lttng-sessiond/kernel.h +++ b/src/bin/lttng-sessiond/kernel.h @@ -58,8 +58,8 @@ int kernel_start_session(struct ltt_kernel_session *session); 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_tracer_version *kernel_tracer_version, - struct lttng_kernel_tracer_abi_version *kernel_tracer_abi_version); +int kernel_validate_version(struct lttng_kernel_abi_tracer_version *kernel_tracer_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); diff --git a/src/bin/lttng-sessiond/lttng-sessiond.h b/src/bin/lttng-sessiond/lttng-sessiond.h index 0403b2c49..8a82c45f7 100644 --- a/src/bin/lttng-sessiond/lttng-sessiond.h +++ b/src/bin/lttng-sessiond/lttng-sessiond.h @@ -61,8 +61,8 @@ extern enum consumerd_state the_ust_consumerd_state; extern enum consumerd_state the_kernel_consumerd_state; /* Set in main.c at boot time of the daemon */ -extern struct lttng_kernel_tracer_version the_kernel_tracer_version; -extern struct lttng_kernel_tracer_abi_version the_kernel_tracer_abi_version; +extern struct lttng_kernel_abi_tracer_version the_kernel_tracer_version; +extern struct lttng_kernel_abi_tracer_abi_version the_kernel_tracer_abi_version; /* Notification thread handle. */ extern struct notification_thread_handle *the_notification_thread_handle; diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c index 655400f94..2d37af07c 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -4475,7 +4475,7 @@ struct lttng_event_notifier_notification *recv_one_event_notifier_notification( size_t reception_size; struct lttng_ust_abi_event_notifier_notification ust_notification; - struct lttng_kernel_event_notifier_notification kernel_notification; + struct lttng_kernel_abi_event_notifier_notification kernel_notification; /* Init lttng_event_notifier_notification */ switch(domain) { diff --git a/src/bin/lttng-sessiond/save.c b/src/bin/lttng-sessiond/save.c index 249d30302..f1929a5f0 100644 --- a/src/bin/lttng-sessiond/save.c +++ b/src/bin/lttng-sessiond/save.c @@ -216,33 +216,33 @@ end: static const char *get_kernel_instrumentation_string( - enum lttng_kernel_instrumentation instrumentation) + enum lttng_kernel_abi_instrumentation instrumentation) { const char *instrumentation_string; switch (instrumentation) { - case LTTNG_KERNEL_ALL: + case LTTNG_KERNEL_ABI_ALL: instrumentation_string = config_event_type_all; break; - case LTTNG_KERNEL_TRACEPOINT: + case LTTNG_KERNEL_ABI_TRACEPOINT: instrumentation_string = config_event_type_tracepoint; break; - case LTTNG_KERNEL_KPROBE: + case LTTNG_KERNEL_ABI_KPROBE: instrumentation_string = config_event_type_probe; break; - case LTTNG_KERNEL_UPROBE: + case LTTNG_KERNEL_ABI_UPROBE: instrumentation_string = config_event_type_userspace_probe; break; - case LTTNG_KERNEL_FUNCTION: + case LTTNG_KERNEL_ABI_FUNCTION: instrumentation_string = config_event_type_function_entry; break; - case LTTNG_KERNEL_KRETPROBE: + case LTTNG_KERNEL_ABI_KRETPROBE: instrumentation_string = config_event_type_function; break; - case LTTNG_KERNEL_NOOP: + case LTTNG_KERNEL_ABI_NOOP: instrumentation_string = config_event_type_noop; break; - case LTTNG_KERNEL_SYSCALL: + case LTTNG_KERNEL_ABI_SYSCALL: instrumentation_string = config_event_type_syscall; break; default: @@ -254,117 +254,117 @@ const char *get_kernel_instrumentation_string( static const char *get_kernel_context_type_string( - enum lttng_kernel_context_type context_type) + enum lttng_kernel_abi_context_type context_type) { const char *context_type_string; switch (context_type) { - case LTTNG_KERNEL_CONTEXT_PID: + case LTTNG_KERNEL_ABI_CONTEXT_PID: context_type_string = config_event_context_pid; break; - case LTTNG_KERNEL_CONTEXT_PROCNAME: + case LTTNG_KERNEL_ABI_CONTEXT_PROCNAME: context_type_string = config_event_context_procname; break; - case LTTNG_KERNEL_CONTEXT_PRIO: + case LTTNG_KERNEL_ABI_CONTEXT_PRIO: context_type_string = config_event_context_prio; break; - case LTTNG_KERNEL_CONTEXT_NICE: + case LTTNG_KERNEL_ABI_CONTEXT_NICE: context_type_string = config_event_context_nice; break; - case LTTNG_KERNEL_CONTEXT_VPID: + case LTTNG_KERNEL_ABI_CONTEXT_VPID: context_type_string = config_event_context_vpid; break; - case LTTNG_KERNEL_CONTEXT_TID: + case LTTNG_KERNEL_ABI_CONTEXT_TID: context_type_string = config_event_context_tid; break; - case LTTNG_KERNEL_CONTEXT_VTID: + case LTTNG_KERNEL_ABI_CONTEXT_VTID: context_type_string = config_event_context_vtid; break; - case LTTNG_KERNEL_CONTEXT_PPID: + case LTTNG_KERNEL_ABI_CONTEXT_PPID: context_type_string = config_event_context_ppid; break; - case LTTNG_KERNEL_CONTEXT_VPPID: + case LTTNG_KERNEL_ABI_CONTEXT_VPPID: context_type_string = config_event_context_vppid; break; - case LTTNG_KERNEL_CONTEXT_HOSTNAME: + case LTTNG_KERNEL_ABI_CONTEXT_HOSTNAME: context_type_string = config_event_context_hostname; break; - case LTTNG_KERNEL_CONTEXT_INTERRUPTIBLE: + case LTTNG_KERNEL_ABI_CONTEXT_INTERRUPTIBLE: context_type_string = config_event_context_interruptible; break; - case LTTNG_KERNEL_CONTEXT_PREEMPTIBLE: + case LTTNG_KERNEL_ABI_CONTEXT_PREEMPTIBLE: context_type_string = config_event_context_preemptible; break; - case LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE: + case LTTNG_KERNEL_ABI_CONTEXT_NEED_RESCHEDULE: context_type_string = config_event_context_need_reschedule; break; - case LTTNG_KERNEL_CONTEXT_MIGRATABLE: + case LTTNG_KERNEL_ABI_CONTEXT_MIGRATABLE: context_type_string = config_event_context_migratable; break; - case LTTNG_KERNEL_CONTEXT_CALLSTACK_USER: + case LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_USER: context_type_string = config_event_context_callstack_user; break; - case LTTNG_KERNEL_CONTEXT_CALLSTACK_KERNEL: + case LTTNG_KERNEL_ABI_CONTEXT_CALLSTACK_KERNEL: context_type_string = config_event_context_callstack_kernel; break; - case LTTNG_KERNEL_CONTEXT_CGROUP_NS: + case LTTNG_KERNEL_ABI_CONTEXT_CGROUP_NS: context_type_string = config_event_context_cgroup_ns; break; - case LTTNG_KERNEL_CONTEXT_IPC_NS: + case LTTNG_KERNEL_ABI_CONTEXT_IPC_NS: context_type_string = config_event_context_ipc_ns; break; - case LTTNG_KERNEL_CONTEXT_MNT_NS: + case LTTNG_KERNEL_ABI_CONTEXT_MNT_NS: context_type_string = config_event_context_mnt_ns; break; - case LTTNG_KERNEL_CONTEXT_NET_NS: + case LTTNG_KERNEL_ABI_CONTEXT_NET_NS: context_type_string = config_event_context_net_ns; break; - case LTTNG_KERNEL_CONTEXT_PID_NS: + case LTTNG_KERNEL_ABI_CONTEXT_PID_NS: context_type_string = config_event_context_pid_ns; break; - case LTTNG_KERNEL_CONTEXT_TIME_NS: + case LTTNG_KERNEL_ABI_CONTEXT_TIME_NS: context_type_string = config_event_context_time_ns; break; - case LTTNG_KERNEL_CONTEXT_USER_NS: + case LTTNG_KERNEL_ABI_CONTEXT_USER_NS: context_type_string = config_event_context_user_ns; break; - case LTTNG_KERNEL_CONTEXT_UTS_NS: + case LTTNG_KERNEL_ABI_CONTEXT_UTS_NS: context_type_string = config_event_context_uts_ns; break; - case LTTNG_KERNEL_CONTEXT_UID: + case LTTNG_KERNEL_ABI_CONTEXT_UID: context_type_string = config_event_context_uid; break; - case LTTNG_KERNEL_CONTEXT_EUID: + case LTTNG_KERNEL_ABI_CONTEXT_EUID: context_type_string = config_event_context_euid; break; - case LTTNG_KERNEL_CONTEXT_SUID: + case LTTNG_KERNEL_ABI_CONTEXT_SUID: context_type_string = config_event_context_suid; break; - case LTTNG_KERNEL_CONTEXT_GID: + case LTTNG_KERNEL_ABI_CONTEXT_GID: context_type_string = config_event_context_gid; break; - case LTTNG_KERNEL_CONTEXT_EGID: + case LTTNG_KERNEL_ABI_CONTEXT_EGID: context_type_string = config_event_context_egid; break; - case LTTNG_KERNEL_CONTEXT_SGID: + case LTTNG_KERNEL_ABI_CONTEXT_SGID: context_type_string = config_event_context_sgid; break; - case LTTNG_KERNEL_CONTEXT_VUID: + case LTTNG_KERNEL_ABI_CONTEXT_VUID: context_type_string = config_event_context_vuid; break; - case LTTNG_KERNEL_CONTEXT_VEUID: + case LTTNG_KERNEL_ABI_CONTEXT_VEUID: context_type_string = config_event_context_veuid; break; - case LTTNG_KERNEL_CONTEXT_VSUID: + case LTTNG_KERNEL_ABI_CONTEXT_VSUID: context_type_string = config_event_context_vsuid; break; - case LTTNG_KERNEL_CONTEXT_VGID: + case LTTNG_KERNEL_ABI_CONTEXT_VGID: context_type_string = config_event_context_vgid; break; - case LTTNG_KERNEL_CONTEXT_VEGID: + case LTTNG_KERNEL_ABI_CONTEXT_VEGID: context_type_string = config_event_context_vegid; break; - case LTTNG_KERNEL_CONTEXT_VSGID: + case LTTNG_KERNEL_ABI_CONTEXT_VSGID: context_type_string = config_event_context_vsgid; break; default: @@ -540,7 +540,7 @@ int save_kernel_kprobe_event(struct config_writer *writer, uint64_t offset; switch (event->event->instrumentation) { - case LTTNG_KERNEL_KPROBE: + case LTTNG_KERNEL_ABI_KPROBE: /* * Comments in lttng-kernel.h mention that * either addr or symbol_name are set, not both. @@ -549,7 +549,7 @@ int save_kernel_kprobe_event(struct config_writer *writer, offset = event->event->u.kprobe.offset; symbol_name = addr ? NULL : event->event->u.kprobe.symbol_name; break; - case LTTNG_KERNEL_KRETPROBE: + case LTTNG_KERNEL_ABI_KRETPROBE: addr = event->event->u.kretprobe.addr; offset = event->event->u.kretprobe.offset; symbol_name = addr ? NULL : event->event->u.kretprobe.symbol_name; @@ -929,10 +929,10 @@ int save_kernel_event(struct config_writer *writer, } } - if (event->event->instrumentation == LTTNG_KERNEL_FUNCTION || - event->event->instrumentation == LTTNG_KERNEL_KPROBE || - event->event->instrumentation == LTTNG_KERNEL_UPROBE || - event->event->instrumentation == LTTNG_KERNEL_KRETPROBE) { + if (event->event->instrumentation == LTTNG_KERNEL_ABI_FUNCTION || + event->event->instrumentation == LTTNG_KERNEL_ABI_KPROBE || + event->event->instrumentation == LTTNG_KERNEL_ABI_UPROBE || + event->event->instrumentation == LTTNG_KERNEL_ABI_KRETPROBE) { ret = config_writer_open_element(writer, config_element_attributes); @@ -942,21 +942,21 @@ int save_kernel_event(struct config_writer *writer, } switch (event->event->instrumentation) { - case LTTNG_KERNEL_SYSCALL: - case LTTNG_KERNEL_FUNCTION: + case LTTNG_KERNEL_ABI_SYSCALL: + case LTTNG_KERNEL_ABI_FUNCTION: ret = save_kernel_function_event(writer, event); if (ret) { goto end; } break; - case LTTNG_KERNEL_KPROBE: - case LTTNG_KERNEL_KRETPROBE: + case LTTNG_KERNEL_ABI_KPROBE: + case LTTNG_KERNEL_ABI_KRETPROBE: ret = save_kernel_kprobe_event(writer, event); if (ret) { goto end; } break; - case LTTNG_KERNEL_UPROBE: + case LTTNG_KERNEL_ABI_UPROBE: ret = save_kernel_userspace_probe_event(writer, event); if (ret) { goto end; @@ -1280,7 +1280,7 @@ end: /* Return LTTNG_OK on success else a LTTNG_ERR* code. */ static int save_kernel_context(struct config_writer *writer, - struct lttng_kernel_context *ctx) + struct lttng_kernel_abi_context *ctx) { int ret = LTTNG_OK; @@ -1294,7 +1294,7 @@ int save_kernel_context(struct config_writer *writer, goto end; } - if (ctx->ctx == LTTNG_KERNEL_CONTEXT_PERF_CPU_COUNTER) { + if (ctx->ctx == LTTNG_KERNEL_ABI_CONTEXT_PERF_CPU_COUNTER) { ret = config_writer_open_element(writer, config_element_context_perf); if (ret) { diff --git a/src/bin/lttng-sessiond/trace-kernel.c b/src/bin/lttng-sessiond/trace-kernel.c index 86cbb5e25..3a32893a1 100644 --- a/src/bin/lttng-sessiond/trace-kernel.c +++ b/src/bin/lttng-sessiond/trace-kernel.c @@ -251,7 +251,7 @@ struct ltt_kernel_channel *trace_kernel_create_channel( strncpy(lkc->channel->name, DEFAULT_CHANNEL_NAME, sizeof(lkc->channel->name)); } - lkc->channel->name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; + lkc->channel->name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0'; lkc->fd = -1; lkc->stream_count = 0; @@ -280,7 +280,7 @@ error: * Return the allocated object or NULL on error. */ struct ltt_kernel_context *trace_kernel_create_context( - struct lttng_kernel_context *ctx) + struct lttng_kernel_abi_context *ctx) { struct ltt_kernel_context *kctx; @@ -334,14 +334,14 @@ enum lttng_error_code trace_kernel_create_event( struct ltt_kernel_event **kernel_event) { enum lttng_error_code ret; - struct lttng_kernel_event *attr; + struct lttng_kernel_abi_event *attr; struct ltt_kernel_event *local_kernel_event; struct lttng_userspace_probe_location *userspace_probe_location = NULL; assert(ev); local_kernel_event = zmalloc(sizeof(struct ltt_kernel_event)); - attr = zmalloc(sizeof(struct lttng_kernel_event)); + attr = zmalloc(sizeof(struct lttng_kernel_abi_event)); if (local_kernel_event == NULL || attr == NULL) { PERROR("kernel event zmalloc"); ret = LTTNG_ERR_NOMEM; @@ -350,12 +350,12 @@ enum lttng_error_code trace_kernel_create_event( switch (ev->type) { case LTTNG_EVENT_PROBE: - attr->instrumentation = LTTNG_KERNEL_KPROBE; + attr->instrumentation = LTTNG_KERNEL_ABI_KPROBE; attr->u.kprobe.addr = ev->attr.probe.addr; attr->u.kprobe.offset = ev->attr.probe.offset; strncpy(attr->u.kprobe.symbol_name, - ev->attr.probe.symbol_name, LTTNG_KERNEL_SYM_NAME_LEN); - attr->u.kprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; + ev->attr.probe.symbol_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN); + attr->u.kprobe.symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0'; break; case LTTNG_EVENT_USERSPACE_PROBE: { @@ -376,7 +376,7 @@ enum lttng_error_code trace_kernel_create_event( * In the interactions with the kernel tracer, we use the * uprobe term. */ - attr->instrumentation = LTTNG_KERNEL_UPROBE; + attr->instrumentation = LTTNG_KERNEL_ABI_UPROBE; lookup = lttng_userspace_probe_location_get_lookup_method( location); @@ -422,30 +422,30 @@ enum lttng_error_code trace_kernel_create_event( break; } case LTTNG_EVENT_FUNCTION: - attr->instrumentation = LTTNG_KERNEL_KRETPROBE; + attr->instrumentation = LTTNG_KERNEL_ABI_KRETPROBE; attr->u.kretprobe.addr = ev->attr.probe.addr; attr->u.kretprobe.offset = ev->attr.probe.offset; strncpy(attr->u.kretprobe.symbol_name, - ev->attr.probe.symbol_name, LTTNG_KERNEL_SYM_NAME_LEN); - attr->u.kretprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; + ev->attr.probe.symbol_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN); + attr->u.kretprobe.symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0'; break; case LTTNG_EVENT_FUNCTION_ENTRY: - attr->instrumentation = LTTNG_KERNEL_FUNCTION; + attr->instrumentation = LTTNG_KERNEL_ABI_FUNCTION; strncpy(attr->u.ftrace.symbol_name, - ev->attr.ftrace.symbol_name, LTTNG_KERNEL_SYM_NAME_LEN); - attr->u.ftrace.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; + ev->attr.ftrace.symbol_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN); + attr->u.ftrace.symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0'; break; case LTTNG_EVENT_TRACEPOINT: - attr->instrumentation = LTTNG_KERNEL_TRACEPOINT; + attr->instrumentation = LTTNG_KERNEL_ABI_TRACEPOINT; break; case LTTNG_EVENT_SYSCALL: - attr->instrumentation = LTTNG_KERNEL_SYSCALL; - attr->u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_ALL; - attr->u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRYEXIT; - attr->u.syscall.match = LTTNG_KERNEL_SYSCALL_MATCH_NAME; + attr->instrumentation = LTTNG_KERNEL_ABI_SYSCALL; + attr->u.syscall.abi = LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL; + attr->u.syscall.entryexit = LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT; + attr->u.syscall.match = LTTNG_KERNEL_ABI_SYSCALL_MATCH_NAME; break; case LTTNG_EVENT_ALL: - attr->instrumentation = LTTNG_KERNEL_ALL; + attr->instrumentation = LTTNG_KERNEL_ABI_ALL; break; default: ERR("Unknown kernel instrumentation type (%d)", ev->type); @@ -454,8 +454,8 @@ enum lttng_error_code trace_kernel_create_event( } /* Copy event name */ - strncpy(attr->name, ev->name, LTTNG_KERNEL_SYM_NAME_LEN); - attr->name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; + strncpy(attr->name, ev->name, LTTNG_KERNEL_ABI_SYM_NAME_LEN); + attr->name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0'; /* Setting up a kernel event */ local_kernel_event->fd = -1; @@ -545,7 +545,7 @@ error: */ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule( const struct lttng_event_rule *rule, - struct lttng_kernel_event_notifier *kernel_event_notifier) + struct lttng_kernel_abi_event_notifier *kernel_event_notifier) { enum lttng_error_code ret_code; const char *name; @@ -587,13 +587,13 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule( abort(); } - kernel_event_notifier->event.instrumentation = LTTNG_KERNEL_KPROBE; + kernel_event_notifier->event.instrumentation = LTTNG_KERNEL_ABI_KPROBE; kernel_event_notifier->event.u.kprobe.addr = address; kernel_event_notifier->event.u.kprobe.offset = offset; if (symbol_name) { strncpy_ret = lttng_strncpy( kernel_event_notifier->event.u.kprobe.symbol_name, - symbol_name, LTTNG_KERNEL_SYM_NAME_LEN); + symbol_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN); if (strncpy_ret) { ret_code = LTTNG_ERR_INVALID; @@ -601,7 +601,7 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule( } } - kernel_event_notifier->event.u.kprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; + kernel_event_notifier->event.u.kprobe.symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0'; status = lttng_event_rule_kernel_probe_get_event_name(rule, &name); assert(status == LTTNG_EVENT_RULE_STATUS_OK); @@ -620,7 +620,7 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule( goto error; } - kernel_event_notifier->event.instrumentation = LTTNG_KERNEL_UPROBE; + kernel_event_notifier->event.instrumentation = LTTNG_KERNEL_ABI_UPROBE; lookup = lttng_userspace_probe_location_get_lookup_method( location); @@ -666,7 +666,7 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule( assert(domain == LTTNG_DOMAIN_KERNEL); assert(status == LTTNG_EVENT_RULE_STATUS_OK); kernel_event_notifier->event.instrumentation = - LTTNG_KERNEL_TRACEPOINT; + LTTNG_KERNEL_ABI_TRACEPOINT; ret_code = LTTNG_OK; break; @@ -679,20 +679,20 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule( const enum lttng_event_rule_syscall_emission_site_type emission_site_type = lttng_event_rule_syscall_get_emission_site_type(rule); - enum lttng_kernel_syscall_entryexit entryexit; + enum lttng_kernel_abi_syscall_entryexit entryexit; assert(status == LTTNG_EVENT_RULE_STATUS_OK); assert(emission_site_type != LTTNG_EVENT_RULE_SYSCALL_EMISSION_SITE_UNKNOWN); switch(emission_site_type) { case LTTNG_EVENT_RULE_SYSCALL_EMISSION_SITE_ENTRY: - entryexit = LTTNG_KERNEL_SYSCALL_ENTRY; + entryexit = LTTNG_KERNEL_ABI_SYSCALL_ENTRY; break; case LTTNG_EVENT_RULE_SYSCALL_EMISSION_SITE_EXIT: - entryexit = LTTNG_KERNEL_SYSCALL_EXIT; + entryexit = LTTNG_KERNEL_ABI_SYSCALL_EXIT; break; case LTTNG_EVENT_RULE_SYSCALL_EMISSION_SITE_ENTRY_EXIT: - entryexit = LTTNG_KERNEL_SYSCALL_ENTRYEXIT; + entryexit = LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT; break; default: abort(); @@ -700,13 +700,13 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule( } kernel_event_notifier->event.instrumentation = - LTTNG_KERNEL_SYSCALL; + LTTNG_KERNEL_ABI_SYSCALL; kernel_event_notifier->event.u.syscall.abi = - LTTNG_KERNEL_SYSCALL_ABI_ALL; + LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL; kernel_event_notifier->event.u.syscall.entryexit = entryexit; kernel_event_notifier->event.u.syscall.match = - LTTNG_KERNEL_SYSCALL_MATCH_NAME; + LTTNG_KERNEL_ABI_SYSCALL_MATCH_NAME; ret_code = LTTNG_OK; break; } @@ -717,7 +717,7 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule( } strncpy_ret = lttng_strncpy(kernel_event_notifier->event.name, name, - LTTNG_KERNEL_SYM_NAME_LEN); + LTTNG_KERNEL_ABI_SYM_NAME_LEN); if (strncpy_ret) { ret_code = LTTNG_ERR_INVALID; goto error; diff --git a/src/bin/lttng-sessiond/trace-kernel.h b/src/bin/lttng-sessiond/trace-kernel.h index c0a244ef0..f6ad56c99 100644 --- a/src/bin/lttng-sessiond/trace-kernel.h +++ b/src/bin/lttng-sessiond/trace-kernel.h @@ -34,7 +34,7 @@ struct ltt_kernel_channel_list { }; struct ltt_kernel_context { - struct lttng_kernel_context ctx; + struct lttng_kernel_abi_context ctx; struct cds_list_head list; /* Indicates whether or not the context is in a list. */ bool in_list; @@ -45,7 +45,7 @@ struct ltt_kernel_event { int fd; int enabled; enum lttng_event_type type; - struct lttng_kernel_event *event; + struct lttng_kernel_abi_event *event; struct cds_list_head list; char *filter_expression; struct lttng_bytecode *filter; @@ -164,7 +164,7 @@ struct ltt_kernel_metadata *trace_kernel_create_metadata(void); 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_context *ctx); + 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, @@ -175,7 +175,7 @@ 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_event_notifier *kernel_event_notifier); + 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/common/kernel-ctl/kernel-ctl.c b/src/common/kernel-ctl/kernel-ctl.c index ff85b2c9b..877de5f86 100644 --- a/src/common/kernel-ctl/kernel-ctl.c +++ b/src/common/kernel-ctl/kernel-ctl.c @@ -41,11 +41,11 @@ * kernel is 64-bit. The old ABI is kept here for compatibility but is * deprecated and will be removed eventually. */ -static int lttng_kernel_use_old_abi = -1; +static int lttng_kernel_abi_use_old_abi = -1; /* * Execute the new or old ioctl depending on the ABI version. - * If the ABI version is not determined yet (lttng_kernel_use_old_abi = -1), + * If the ABI version is not determined yet (lttng_kernel_abi_use_old_abi = -1), * this function tests if the new ABI is available and otherwise fallbacks * on the old one. * This function takes the fd on which the ioctl must be executed and the old @@ -57,15 +57,15 @@ static inline int compat_ioctl_no_arg(int fd, unsigned long oldname, { int ret; - if (lttng_kernel_use_old_abi == -1) { + if (lttng_kernel_abi_use_old_abi == -1) { ret = LTTNG_IOCTL_NO_CHECK(fd, newname); if (!ret) { - lttng_kernel_use_old_abi = 0; + lttng_kernel_abi_use_old_abi = 0; goto end; } - lttng_kernel_use_old_abi = 1; + lttng_kernel_abi_use_old_abi = 1; } - if (lttng_kernel_use_old_abi) { + if (lttng_kernel_abi_use_old_abi) { ret = LTTNG_IOCTL_NO_CHECK(fd, oldname); } else { ret = LTTNG_IOCTL_NO_CHECK(fd, newname); @@ -77,17 +77,17 @@ end: int kernctl_create_session(int fd) { - return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_SESSION, - LTTNG_KERNEL_SESSION); + return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_SESSION, + LTTNG_KERNEL_ABI_SESSION); } /* open the metadata global channel */ int kernctl_open_metadata(int fd, struct lttng_channel_attr *chops) { - struct lttng_kernel_channel channel; + struct lttng_kernel_abi_channel channel; - if (lttng_kernel_use_old_abi) { - struct lttng_kernel_old_channel old_channel; + if (lttng_kernel_abi_use_old_abi) { + struct lttng_kernel_abi_old_channel old_channel; memset(&old_channel, 0, sizeof(old_channel)); old_channel.overwrite = chops->overwrite; @@ -104,7 +104,7 @@ int kernctl_open_metadata(int fd, struct lttng_channel_attr *chops) */ memcpy(old_channel.padding, chops->padding, sizeof(chops->padding)); - return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_OLD_METADATA, + return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_OLD_METADATA, &old_channel); } @@ -117,16 +117,16 @@ int kernctl_open_metadata(int fd, struct lttng_channel_attr *chops) channel.output = chops->output; memcpy(channel.padding, chops->padding, sizeof(chops->padding)); - return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_METADATA, &channel); + return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_METADATA, &channel); } int kernctl_create_channel(int fd, struct lttng_channel_attr *chops) { - struct lttng_kernel_channel channel; + struct lttng_kernel_abi_channel channel; memset(&channel, 0, sizeof(channel)); - if (lttng_kernel_use_old_abi) { - struct lttng_kernel_old_channel old_channel; + if (lttng_kernel_abi_use_old_abi) { + struct lttng_kernel_abi_old_channel old_channel; old_channel.overwrite = chops->overwrite; old_channel.subbuf_size = chops->subbuf_size; @@ -142,7 +142,7 @@ int kernctl_create_channel(int fd, struct lttng_channel_attr *chops) */ memcpy(old_channel.padding, chops->padding, sizeof(chops->padding)); - return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_OLD_CHANNEL, + return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_OLD_CHANNEL, &old_channel); } @@ -154,12 +154,12 @@ int kernctl_create_channel(int fd, struct lttng_channel_attr *chops) channel.output = chops->output; memcpy(channel.padding, chops->padding, sizeof(chops->padding)); - return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_CHANNEL, &channel); + return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_CHANNEL, &channel); } int kernctl_syscall_mask(int fd, char **syscall_mask, uint32_t *nr_bits) { - struct lttng_kernel_syscall_mask kmask_len, *kmask = NULL; + struct lttng_kernel_abi_syscall_mask kmask_len, *kmask = NULL; size_t array_alloc_len; char *new_mask; int ret = 0; @@ -175,7 +175,7 @@ int kernctl_syscall_mask(int fd, char **syscall_mask, uint32_t *nr_bits) } kmask_len.len = 0; - ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SYSCALL_MASK, &kmask_len); + ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SYSCALL_MASK, &kmask_len); if (ret) { goto end; } @@ -189,7 +189,7 @@ int kernctl_syscall_mask(int fd, char **syscall_mask, uint32_t *nr_bits) } kmask->len = kmask_len.len; - ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SYSCALL_MASK, kmask); + ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SYSCALL_MASK, kmask); if (ret) { goto end; } @@ -210,94 +210,94 @@ end: int kernctl_track_pid(int fd, int pid) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_TRACK_PID, pid); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_TRACK_PID, pid); } int kernctl_untrack_pid(int fd, int pid) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_UNTRACK_PID, pid); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID, pid); } int kernctl_list_tracker_pids(int fd) { - return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_SESSION_LIST_TRACKER_PIDS); + return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_PIDS); } -static enum lttng_kernel_tracker_type get_kernel_tracker_type( +static enum lttng_kernel_abi_tracker_type get_kernel_tracker_type( enum lttng_process_attr process_attr) { switch (process_attr) { case LTTNG_PROCESS_ATTR_PROCESS_ID: - return LTTNG_KERNEL_TRACKER_PID; + return LTTNG_KERNEL_ABI_TRACKER_PID; case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID: - return LTTNG_KERNEL_TRACKER_VPID; + return LTTNG_KERNEL_ABI_TRACKER_VPID; case LTTNG_PROCESS_ATTR_USER_ID: - return LTTNG_KERNEL_TRACKER_UID; + return LTTNG_KERNEL_ABI_TRACKER_UID; case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID: - return LTTNG_KERNEL_TRACKER_VUID; + return LTTNG_KERNEL_ABI_TRACKER_VUID; case LTTNG_PROCESS_ATTR_GROUP_ID: - return LTTNG_KERNEL_TRACKER_GID; + return LTTNG_KERNEL_ABI_TRACKER_GID; case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID: - return LTTNG_KERNEL_TRACKER_VGID; + return LTTNG_KERNEL_ABI_TRACKER_VGID; default: - return LTTNG_KERNEL_TRACKER_UNKNOWN; + return LTTNG_KERNEL_ABI_TRACKER_UNKNOWN; } } int kernctl_track_id(int fd, enum lttng_process_attr process_attr, int id) { - struct lttng_kernel_tracker_args args; + struct lttng_kernel_abi_tracker_args args; args.id = id; args.type = get_kernel_tracker_type(process_attr); - if (args.type == LTTNG_KERNEL_TRACKER_UNKNOWN) { + if (args.type == LTTNG_KERNEL_ABI_TRACKER_UNKNOWN) { errno = EINVAL; return -1; } - return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_TRACK_ID, &args); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_TRACK_ID, &args); } int kernctl_untrack_id(int fd, enum lttng_process_attr process_attr, int id) { - struct lttng_kernel_tracker_args args; + struct lttng_kernel_abi_tracker_args args; args.id = id; args.type = get_kernel_tracker_type(process_attr); - if (args.type == LTTNG_KERNEL_TRACKER_UNKNOWN) { + if (args.type == LTTNG_KERNEL_ABI_TRACKER_UNKNOWN) { errno = EINVAL; return -1; } - return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_UNTRACK_ID, &args); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_UNTRACK_ID, &args); } int kernctl_list_tracker_ids(int fd, enum lttng_process_attr process_attr) { - struct lttng_kernel_tracker_args args; + struct lttng_kernel_abi_tracker_args args; args.id = -1; args.type = get_kernel_tracker_type(process_attr); - if (args.type == LTTNG_KERNEL_TRACKER_UNKNOWN) { + if (args.type == LTTNG_KERNEL_ABI_TRACKER_UNKNOWN) { errno = EINVAL; return -1; } return LTTNG_IOCTL_NO_CHECK( - fd, LTTNG_KERNEL_SESSION_LIST_TRACKER_IDS, &args); + fd, LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_IDS, &args); } int kernctl_session_regenerate_metadata(int fd) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_METADATA_REGEN); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_METADATA_REGEN); } int kernctl_session_regenerate_statedump(int fd) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_STATEDUMP); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_STATEDUMP); } int kernctl_session_set_name(int fd, const char *name) { int ret; - struct lttng_kernel_session_name session_name; + struct lttng_kernel_abi_session_name session_name; ret = lttng_strncpy(session_name.name, name, sizeof(session_name.name)); if (ret) { @@ -305,7 +305,7 @@ int kernctl_session_set_name(int fd, const char *name) } ret = LTTNG_IOCTL_CHECK( - fd, LTTNG_KERNEL_SESSION_SET_NAME, &session_name); + fd, LTTNG_KERNEL_ABI_SESSION_SET_NAME, &session_name); end: return ret; } @@ -313,7 +313,7 @@ end: int kernctl_session_set_creation_time(int fd, time_t time) { int ret; - struct lttng_kernel_session_creation_time creation_time; + struct lttng_kernel_abi_session_creation_time creation_time; ret = time_to_iso8601_str(time, creation_time.iso8601, sizeof(creation_time.iso8601)); @@ -321,7 +321,7 @@ int kernctl_session_set_creation_time(int fd, time_t time) goto end; } - ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_SET_CREATION_TIME, + ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_SET_CREATION_TIME, &creation_time); end: return ret; @@ -329,34 +329,34 @@ end: int kernctl_create_stream(int fd) { - return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_STREAM, - LTTNG_KERNEL_STREAM); + return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_STREAM, + LTTNG_KERNEL_ABI_STREAM); } -int kernctl_create_event(int fd, struct lttng_kernel_event *ev) +int kernctl_create_event(int fd, struct lttng_kernel_abi_event *ev) { - if (lttng_kernel_use_old_abi) { - struct lttng_kernel_old_event old_event; + if (lttng_kernel_abi_use_old_abi) { + struct lttng_kernel_abi_old_event old_event; memset(&old_event, 0, sizeof(old_event)); memcpy(old_event.name, ev->name, sizeof(old_event.name)); old_event.instrumentation = ev->instrumentation; switch (ev->instrumentation) { - case LTTNG_KERNEL_KPROBE: + case LTTNG_KERNEL_ABI_KPROBE: old_event.u.kprobe.addr = ev->u.kprobe.addr; old_event.u.kprobe.offset = ev->u.kprobe.offset; memcpy(old_event.u.kprobe.symbol_name, ev->u.kprobe.symbol_name, sizeof(old_event.u.kprobe.symbol_name)); break; - case LTTNG_KERNEL_KRETPROBE: + case LTTNG_KERNEL_ABI_KRETPROBE: old_event.u.kretprobe.addr = ev->u.kretprobe.addr; old_event.u.kretprobe.offset = ev->u.kretprobe.offset; memcpy(old_event.u.kretprobe.symbol_name, ev->u.kretprobe.symbol_name, sizeof(old_event.u.kretprobe.symbol_name)); break; - case LTTNG_KERNEL_FUNCTION: + case LTTNG_KERNEL_ABI_FUNCTION: memcpy(old_event.u.ftrace.symbol_name, ev->u.ftrace.symbol_name, sizeof(old_event.u.ftrace.symbol_name)); @@ -365,21 +365,21 @@ int kernctl_create_event(int fd, struct lttng_kernel_event *ev) break; } - return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_OLD_EVENT, + return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_OLD_EVENT, &old_event); } - return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_EVENT, ev); + return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_EVENT, ev); } -int kernctl_add_context(int fd, struct lttng_kernel_context *ctx) +int kernctl_add_context(int fd, struct lttng_kernel_abi_context *ctx) { - if (lttng_kernel_use_old_abi) { - struct lttng_kernel_old_context old_ctx; + if (lttng_kernel_abi_use_old_abi) { + struct lttng_kernel_abi_old_context old_ctx; memset(&old_ctx, 0, sizeof(old_ctx)); old_ctx.ctx = ctx->ctx; /* only type that uses the union */ - if (ctx->ctx == LTTNG_KERNEL_CONTEXT_PERF_CPU_COUNTER) { + if (ctx->ctx == LTTNG_KERNEL_ABI_CONTEXT_PERF_CPU_COUNTER) { old_ctx.u.perf_counter.type = ctx->u.perf_counter.type; old_ctx.u.perf_counter.config = @@ -388,82 +388,83 @@ int kernctl_add_context(int fd, struct lttng_kernel_context *ctx) ctx->u.perf_counter.name, sizeof(old_ctx.u.perf_counter.name)); } - return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_OLD_CONTEXT, &old_ctx); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_OLD_CONTEXT, + &old_ctx); } - return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_CONTEXT, ctx); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_CONTEXT, ctx); } /* Enable event, channel and session LTTNG_IOCTL_CHECK */ int kernctl_enable(int fd) { - return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_ENABLE, - LTTNG_KERNEL_ENABLE); + return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_ENABLE, + LTTNG_KERNEL_ABI_ENABLE); } /* Disable event, channel and session LTTNG_IOCTL_CHECK */ int kernctl_disable(int fd) { - return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_DISABLE, - LTTNG_KERNEL_DISABLE); + return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_DISABLE, + LTTNG_KERNEL_ABI_DISABLE); } int kernctl_start_session(int fd) { - return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_SESSION_START, - LTTNG_KERNEL_SESSION_START); + return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_SESSION_START, + LTTNG_KERNEL_ABI_SESSION_START); } int kernctl_stop_session(int fd) { - return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_SESSION_STOP, - LTTNG_KERNEL_SESSION_STOP); + return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_SESSION_STOP, + LTTNG_KERNEL_ABI_SESSION_STOP); } int kernctl_create_event_notifier_group(int fd) { return LTTNG_IOCTL_NO_CHECK(fd, - LTTNG_KERNEL_EVENT_NOTIFIER_GROUP_CREATE); + LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_CREATE); } int kernctl_create_event_notifier_group_notification_fd(int group_fd) { return LTTNG_IOCTL_NO_CHECK(group_fd, - LTTNG_KERNEL_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD); + LTTNG_KERNEL_ABI_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD); } int kernctl_create_event_notifier_group_error_counter(int group_fd, - const struct lttng_kernel_counter_conf *error_counter_conf) + const struct lttng_kernel_abi_counter_conf *error_counter_conf) { - return LTTNG_IOCTL_NO_CHECK(group_fd, LTTNG_KERNEL_COUNTER, + return LTTNG_IOCTL_NO_CHECK(group_fd, LTTNG_KERNEL_ABI_COUNTER, error_counter_conf); } int kernctl_counter_get_aggregate_value(int counter_fd, - struct lttng_kernel_counter_aggregate *value) + struct lttng_kernel_abi_counter_aggregate *value) { - return LTTNG_IOCTL_NO_CHECK(counter_fd, LTTNG_KERNEL_COUNTER_AGGREGATE, + return LTTNG_IOCTL_NO_CHECK(counter_fd, LTTNG_KERNEL_ABI_COUNTER_AGGREGATE, value); } int kernctl_counter_clear(int counter_fd, - struct lttng_kernel_counter_clear *clear) + struct lttng_kernel_abi_counter_clear *clear) { - return LTTNG_IOCTL_NO_CHECK(counter_fd, LTTNG_KERNEL_COUNTER_CLEAR, + return LTTNG_IOCTL_NO_CHECK(counter_fd, LTTNG_KERNEL_ABI_COUNTER_CLEAR, clear); } int kernctl_create_event_notifier(int group_fd, - const struct lttng_kernel_event_notifier *event_notifier) + const struct lttng_kernel_abi_event_notifier *event_notifier) { return LTTNG_IOCTL_NO_CHECK(group_fd, - LTTNG_KERNEL_EVENT_NOTIFIER_CREATE, event_notifier); + LTTNG_KERNEL_ABI_EVENT_NOTIFIER_CREATE, event_notifier); } int kernctl_capture(int fd, const struct lttng_bytecode *capture) { int ret; - struct lttng_kernel_capture_bytecode *kb; + struct lttng_kernel_abi_capture_bytecode *kb; /* Translate bytecode to kernel bytecode. */ kb = zmalloc(sizeof(*kb) + capture->len); @@ -476,7 +477,7 @@ int kernctl_capture(int fd, const struct lttng_bytecode *capture) kb->reloc_offset = capture->reloc_table_offset; kb->seqnum = capture->seqnum; memcpy(kb->data, capture->data, capture->len); - ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_CAPTURE, kb); + ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_CAPTURE, kb); free(kb); end: return ret; @@ -484,7 +485,7 @@ end: int kernctl_filter(int fd, const struct lttng_bytecode *filter) { - struct lttng_kernel_filter_bytecode *kb; + struct lttng_kernel_abi_filter_bytecode *kb; uint32_t len; int ret; @@ -496,43 +497,43 @@ int kernctl_filter(int fd, const struct lttng_bytecode *filter) kb->reloc_offset = filter->reloc_table_offset; kb->seqnum = filter->seqnum; memcpy(kb->data, filter->data, len); - ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_FILTER, kb); + ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_FILTER, kb); free(kb); return ret; } -int kernctl_add_callsite(int fd, struct lttng_kernel_event_callsite *callsite) +int kernctl_add_callsite(int fd, struct lttng_kernel_abi_event_callsite *callsite) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ADD_CALLSITE, callsite); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_ADD_CALLSITE, callsite); } int kernctl_tracepoint_list(int fd) { - return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_TRACEPOINT_LIST, - LTTNG_KERNEL_TRACEPOINT_LIST); + return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_TRACEPOINT_LIST, + LTTNG_KERNEL_ABI_TRACEPOINT_LIST); } int kernctl_syscall_list(int fd) { - return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_SYSCALL_LIST); + return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_ABI_SYSCALL_LIST); } -int kernctl_tracer_version(int fd, struct lttng_kernel_tracer_version *v) +int kernctl_tracer_version(int fd, struct lttng_kernel_abi_tracer_version *v) { int ret; - if (lttng_kernel_use_old_abi == -1) { - ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_TRACER_VERSION, v); + if (lttng_kernel_abi_use_old_abi == -1) { + ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_TRACER_VERSION, v); if (!ret) { - lttng_kernel_use_old_abi = 0; + lttng_kernel_abi_use_old_abi = 0; goto end; } - lttng_kernel_use_old_abi = 1; + lttng_kernel_abi_use_old_abi = 1; } - if (lttng_kernel_use_old_abi) { - struct lttng_kernel_old_tracer_version old_v; + if (lttng_kernel_abi_use_old_abi) { + struct lttng_kernel_abi_old_tracer_version old_v; - ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_OLD_TRACER_VERSION, &old_v); + ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_OLD_TRACER_VERSION, &old_v); if (ret) { goto end; } @@ -540,7 +541,7 @@ int kernctl_tracer_version(int fd, struct lttng_kernel_tracer_version *v) v->minor = old_v.minor; v->patchlevel = old_v.patchlevel; } else { - ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_TRACER_VERSION, v); + ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_TRACER_VERSION, v); } end: @@ -548,48 +549,49 @@ end: } int kernctl_tracer_abi_version(int fd, - struct lttng_kernel_tracer_abi_version *v) + struct lttng_kernel_abi_tracer_abi_version *v) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_TRACER_ABI_VERSION, v); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_TRACER_ABI_VERSION, v); } int kernctl_wait_quiescent(int fd) { - return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_WAIT_QUIESCENT, - LTTNG_KERNEL_WAIT_QUIESCENT); + return compat_ioctl_no_arg(fd, LTTNG_KERNEL_ABI_OLD_WAIT_QUIESCENT, + LTTNG_KERNEL_ABI_WAIT_QUIESCENT); } int kernctl_buffer_flush(int fd) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_FLUSH); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH); } int kernctl_buffer_flush_empty(int fd) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_FLUSH_EMPTY); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY); } int kernctl_buffer_clear(int fd) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_CLEAR); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_CLEAR); } int kernctl_get_next_subbuf_metadata_check(int fd, bool *consistent) { return LTTNG_IOCTL_NO_CHECK(fd, - RING_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK, + LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK, consistent); } /* returns the version of the metadata. */ int kernctl_get_metadata_version(int fd, uint64_t *version) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_GET_METADATA_VERSION, version); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_METADATA_VERSION, + version); } int kernctl_metadata_cache_dump(int fd) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_METADATA_CACHE_DUMP); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_METADATA_CACHE_DUMP); } /* Buffer operations */ @@ -599,13 +601,15 @@ int kernctl_metadata_cache_dump(int fd) /* returns the length to mmap. */ int kernctl_get_mmap_len(int fd, unsigned long *len) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_GET_MMAP_LEN, len); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_LEN, + len); } /* returns the maximum size for sub-buffers. */ int kernctl_get_max_subbuf_size(int fd, unsigned long *len) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_GET_MAX_SUBBUF_SIZE, len); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_MAX_SUBBUF_SIZE, + len); } /* @@ -616,32 +620,35 @@ int kernctl_get_max_subbuf_size(int fd, unsigned long *len) /* returns the offset of the subbuffer belonging to the mmap reader. */ int kernctl_get_mmap_read_offset(int fd, unsigned long *off) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_GET_MMAP_READ_OFFSET, off); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_MMAP_READ_OFFSET, + off); } /* returns the size of the current sub-buffer, without padding (for mmap). */ int kernctl_get_subbuf_size(int fd, unsigned long *len) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_GET_SUBBUF_SIZE, len); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF_SIZE, + len); } /* returns the size of the current sub-buffer, without padding (for mmap). */ int kernctl_get_padded_subbuf_size(int fd, unsigned long *len) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_GET_PADDED_SUBBUF_SIZE, len); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_PADDED_SUBBUF_SIZE, + len); } /* Get exclusive read access to the next sub-buffer that can be read. */ int kernctl_get_next_subbuf(int fd) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_GET_NEXT_SUBBUF); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF); } /* Release exclusive sub-buffer access, move consumer forward. */ int kernctl_put_next_subbuf(int fd) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_PUT_NEXT_SUBBUF); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_PUT_NEXT_SUBBUF); } /* snapshot */ @@ -649,7 +656,7 @@ int kernctl_put_next_subbuf(int fd) /* Get a snapshot of the current ring buffer producer and consumer positions */ int kernctl_snapshot(int fd) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_SNAPSHOT); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT); } /* @@ -659,90 +666,95 @@ int kernctl_snapshot(int fd) */ int kernctl_snapshot_sample_positions(int fd) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS); } /* Get the consumer position (iteration start) */ int kernctl_snapshot_get_consumed(int fd, unsigned long *pos) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_SNAPSHOT_GET_CONSUMED, pos); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_CONSUMED, + pos); } /* Get the producer position (iteration end) */ int kernctl_snapshot_get_produced(int fd, unsigned long *pos) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_SNAPSHOT_GET_PRODUCED, pos); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT_GET_PRODUCED, + pos); } /* Get exclusive read access to the specified sub-buffer position */ int kernctl_get_subbuf(int fd, unsigned long *len) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_GET_SUBBUF, len); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_SUBBUF, + len); } /* Release exclusive sub-buffer access */ int kernctl_put_subbuf(int fd) { - return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_PUT_SUBBUF); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_PUT_SUBBUF); } /* Returns the timestamp begin of the current sub-buffer. */ int kernctl_get_timestamp_begin(int fd, uint64_t *timestamp_begin) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN, + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_BEGIN, timestamp_begin); } /* Returns the timestamp end of the current sub-buffer. */ int kernctl_get_timestamp_end(int fd, uint64_t *timestamp_end) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_RING_BUFFER_GET_TIMESTAMP_END, + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_TIMESTAMP_END, timestamp_end); } /* Returns the number of discarded events in the current sub-buffer. */ int kernctl_get_events_discarded(int fd, uint64_t *events_discarded) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_RING_BUFFER_GET_EVENTS_DISCARDED, + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_EVENTS_DISCARDED, events_discarded); } /* Returns the content size in the current sub-buffer. */ int kernctl_get_content_size(int fd, uint64_t *content_size) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_RING_BUFFER_GET_CONTENT_SIZE, + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_CONTENT_SIZE, content_size); } /* Returns the packet size in the current sub-buffer. */ int kernctl_get_packet_size(int fd, uint64_t *packet_size) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_RING_BUFFER_GET_PACKET_SIZE, + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_PACKET_SIZE, packet_size); } /* Returns the stream id of the current sub-buffer. */ int kernctl_get_stream_id(int fd, uint64_t *stream_id) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_RING_BUFFER_GET_STREAM_ID, + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_STREAM_ID, stream_id); } /* Returns the current timestamp. */ int kernctl_get_current_timestamp(int fd, uint64_t *ts) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_RING_BUFFER_GET_CURRENT_TIMESTAMP, + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_CURRENT_TIMESTAMP, ts); } /* Returns the packet sequence number of the current sub-buffer. */ int kernctl_get_sequence_number(int fd, uint64_t *seq) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_RING_BUFFER_GET_SEQ_NUM, seq); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_GET_SEQ_NUM, + seq); } /* Returns the stream instance id. */ int kernctl_get_instance_id(int fd, uint64_t *id) { - return LTTNG_IOCTL_CHECK(fd, LTTNG_RING_BUFFER_INSTANCE_ID, id); + return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_RING_BUFFER_INSTANCE_ID, + id); } diff --git a/src/common/kernel-ctl/kernel-ctl.h b/src/common/kernel-ctl/kernel-ctl.h index d3645a678..e6805a983 100644 --- a/src/common/kernel-ctl/kernel-ctl.h +++ b/src/common/kernel-ctl/kernel-ctl.h @@ -20,8 +20,8 @@ int kernctl_create_session(int fd); int kernctl_open_metadata(int fd, struct lttng_channel_attr *chops); int kernctl_create_channel(int fd, struct lttng_channel_attr *chops); int kernctl_create_stream(int fd); -int kernctl_create_event(int fd, struct lttng_kernel_event *ev); -int kernctl_add_context(int fd, struct lttng_kernel_context *ctx); +int kernctl_create_event(int fd, struct lttng_kernel_abi_event *ev); +int kernctl_add_context(int fd, struct lttng_kernel_abi_context *ctx); int kernctl_enable(int fd); int kernctl_disable(int fd); @@ -33,24 +33,24 @@ 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_counter_conf *error_counter_conf); + const struct lttng_kernel_abi_counter_conf *error_counter_conf); int kernctl_create_event_notifier(int fd, - const struct lttng_kernel_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_counter_aggregate *value); + struct lttng_kernel_abi_counter_aggregate *value); int kernctl_counter_clear(int counter_fd, - struct lttng_kernel_counter_clear *clear); + struct lttng_kernel_abi_counter_clear *clear); /* Apply on event file descriptor. */ int kernctl_filter(int fd, const struct lttng_bytecode *filter); -int kernctl_add_callsite(int fd, struct lttng_kernel_event_callsite *callsite); +int kernctl_add_callsite(int fd, struct lttng_kernel_abi_event_callsite *callsite); int kernctl_capture(int fd, const struct lttng_bytecode *capture); int kernctl_tracepoint_list(int fd); int kernctl_syscall_list(int fd); -int kernctl_tracer_version(int fd, struct lttng_kernel_tracer_version *v); -int kernctl_tracer_abi_version(int fd, struct lttng_kernel_tracer_abi_version *v); +int kernctl_tracer_version(int fd, struct lttng_kernel_abi_tracer_version *v); +int kernctl_tracer_abi_version(int fd, struct lttng_kernel_abi_tracer_abi_version *v); int kernctl_wait_quiescent(int fd); /* diff --git a/src/common/kernel-ctl/kernel-ioctl.h b/src/common/kernel-ctl/kernel-ioctl.h index 5ee916b70..6da9676a2 100644 --- a/src/common/kernel-ctl/kernel-ioctl.h +++ b/src/common/kernel-ctl/kernel-ioctl.h @@ -9,189 +9,189 @@ #ifndef _LTT_KERNEL_IOCTL_H #define _LTT_KERNEL_IOCTL_H -#define LTTNG_MODULES_ABI_MAJOR_VERSION 2 -#define LTTNG_MODULES_ABI_MINOR_VERSION 5 +#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 RING_BUFFER_SNAPSHOT _IO(0xF6, 0x00) +#define LTTNG_KERNEL_ABI_RING_BUFFER_SNAPSHOT _IO(0xF6, 0x00) /* Get the consumer position (iteration start) */ -#define 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 RING_BUFFER_CLEAR _IO(0xF6, 0x11) -#define RING_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK _IOR(0xF6, 0x12, uint32_t) +#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_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_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_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_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_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_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_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_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_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_OLD_SESSION _IO(0xF6, 0x40) -#define LTTNG_KERNEL_OLD_TRACER_VERSION \ - _IOR(0xF6, 0x41, struct lttng_kernel_old_tracer_version) -#define LTTNG_KERNEL_OLD_TRACEPOINT_LIST _IO(0xF6, 0x42) -#define LTTNG_KERNEL_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_OLD_METADATA \ - _IOW(0xF6, 0x50, struct lttng_kernel_old_channel) -#define LTTNG_KERNEL_OLD_CHANNEL \ - _IOW(0xF6, 0x51, struct lttng_kernel_old_channel) -#define LTTNG_KERNEL_OLD_SESSION_START _IO(0xF6, 0x52) -#define LTTNG_KERNEL_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_OLD_STREAM _IO(0xF6, 0x60) -#define LTTNG_KERNEL_OLD_EVENT \ - _IOW(0xF6, 0x61, struct lttng_kernel_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_OLD_CONTEXT \ - _IOW(0xF6, 0x70, struct lttng_kernel_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_OLD_ENABLE _IO(0xF6, 0x80) -#define LTTNG_KERNEL_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_SESSION _IO(0xF6, 0x45) -#define LTTNG_KERNEL_TRACER_VERSION \ - _IOR(0xF6, 0x46, struct lttng_kernel_tracer_version) -#define LTTNG_KERNEL_TRACEPOINT_LIST _IO(0xF6, 0x47) -#define LTTNG_KERNEL_WAIT_QUIESCENT _IO(0xF6, 0x48) -#define LTTNG_KERNEL_SYSCALL_LIST _IO(0xF6, 0x4A) -#define LTTNG_KERNEL_TRACER_ABI_VERSION \ - _IOR(0xF6, 0x4B, struct lttng_kernel_tracer_abi_version) -#define LTTNG_KERNEL_EVENT_NOTIFIER_GROUP_CREATE \ +#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) /* Session FD ioctl */ -#define LTTNG_KERNEL_METADATA \ - _IOW(0xF6, 0x54, struct lttng_kernel_channel) -#define LTTNG_KERNEL_CHANNEL \ - _IOW(0xF6, 0x55, struct lttng_kernel_channel) -#define LTTNG_KERNEL_SESSION_START _IO(0xF6, 0x56) -#define LTTNG_KERNEL_SESSION_STOP _IO(0xF6, 0x57) -#define LTTNG_KERNEL_SESSION_TRACK_PID \ +#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 \ _IOR(0xF6, 0x58, int32_t) -#define LTTNG_KERNEL_SESSION_UNTRACK_PID \ +#define LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID \ _IOR(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_SESSION_LIST_TRACKER_PIDS _IO(0xF6, 0x58) -#define LTTNG_KERNEL_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_SESSION_STATEDUMP _IO(0xF6, 0x5C) -#define LTTNG_KERNEL_SESSION_SET_NAME \ - _IOR(0xF6, 0x5D, struct lttng_kernel_session_name) -#define LTTNG_KERNEL_SESSION_SET_CREATION_TIME \ - _IOR(0xF6, 0x5E, struct lttng_kernel_session_creation_time) +#define LTTNG_KERNEL_ABI_SESSION_STATEDUMP _IO(0xF6, 0x5C) +#define LTTNG_KERNEL_ABI_SESSION_SET_NAME \ + _IOR(0xF6, 0x5D, struct lttng_kernel_abi_session_name) +#define LTTNG_KERNEL_ABI_SESSION_SET_CREATION_TIME \ + _IOR(0xF6, 0x5E, struct lttng_kernel_abi_session_creation_time) /* Channel FD ioctl */ -#define LTTNG_KERNEL_STREAM _IO(0xF6, 0x62) -#define LTTNG_KERNEL_EVENT \ - _IOW(0xF6, 0x63, struct lttng_kernel_event) -#define LTTNG_KERNEL_SYSCALL_MASK \ - _IOWR(0xF6, 0x64, struct lttng_kernel_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_CONTEXT \ - _IOW(0xF6, 0x71, struct lttng_kernel_context) +#define LTTNG_KERNEL_ABI_CONTEXT \ + _IOW(0xF6, 0x71, struct lttng_kernel_abi_context) /* Event, event notifier, Channel and Session ioctl */ -#define LTTNG_KERNEL_ENABLE _IO(0xF6, 0x82) -#define LTTNG_KERNEL_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_COUNTER \ - _IOW(0xF6, 0x84, struct lttng_kernel_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_FILTER _IO(0xF6, 0x90) -#define LTTNG_KERNEL_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_SESSION_LIST_TRACKER_IDS \ - _IOR(0xF6, 0xA0, struct lttng_kernel_tracker_args) -#define LTTNG_KERNEL_SESSION_TRACK_ID \ - _IOR(0xF6, 0xA1, struct lttng_kernel_tracker_args) -#define LTTNG_KERNEL_SESSION_UNTRACK_ID \ - _IOR(0xF6, 0xA2, struct lttng_kernel_tracker_args) +#define LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_IDS \ + _IOR(0xF6, 0xA0, struct lttng_kernel_abi_tracker_args) +#define LTTNG_KERNEL_ABI_SESSION_TRACK_ID \ + _IOR(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args) +#define LTTNG_KERNEL_ABI_SESSION_UNTRACK_ID \ + _IOR(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args) /* Event notifier group file descriptor ioctl */ -#define LTTNG_KERNEL_EVENT_NOTIFIER_CREATE \ - _IOW(0xF6, 0xB0, struct lttng_kernel_event_notifier) -#define LTTNG_KERNEL_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD \ +#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) /* Event notifier file descriptor ioctl */ -#define LTTNG_KERNEL_CAPTURE _IO(0xF6, 0xB8) +#define LTTNG_KERNEL_ABI_CAPTURE _IO(0xF6, 0xB8) /* Counter file descriptor ioctl */ -#define LTTNG_KERNEL_COUNTER_READ \ - IOWR(0xF6, 0xC0, struct lttng_kernel_counter_read) -#define LTTNG_KERNEL_COUNTER_AGGREGATE \ - _IOWR(0xF6, 0xC1, struct lttng_kernel_counter_aggregate) -#define LTTNG_KERNEL_COUNTER_CLEAR \ - _IOW(0xF6, 0xC2, struct lttng_kernel_counter_clear) +#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) #endif /* _LTT_KERNEL_IOCTL_H */ diff --git a/src/common/lttng-kernel-old.h b/src/common/lttng-kernel-old.h index dd602a375..14f9cb470 100644 --- a/src/common/lttng-kernel-old.h +++ b/src/common/lttng-kernel-old.h @@ -20,64 +20,64 @@ */ /* Perf counter attributes */ -struct lttng_kernel_old_perf_counter_ctx { +struct lttng_kernel_abi_old_perf_counter_ctx { uint32_t type; uint64_t config; - char name[LTTNG_KERNEL_SYM_NAME_LEN]; + char name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; }; /* Event/Channel context */ -#define LTTNG_KERNEL_OLD_CONTEXT_PADDING1 16 -#define LTTNG_KERNEL_OLD_CONTEXT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32 -struct lttng_kernel_old_context { - enum lttng_kernel_context_type ctx; - char padding[LTTNG_KERNEL_OLD_CONTEXT_PADDING1]; +#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]; union { - struct lttng_kernel_old_perf_counter_ctx perf_counter; - char padding[LTTNG_KERNEL_OLD_CONTEXT_PADDING2]; + struct lttng_kernel_abi_old_perf_counter_ctx perf_counter; + char padding[LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING2]; } u; }; -struct lttng_kernel_old_kretprobe { +struct lttng_kernel_abi_old_kretprobe { uint64_t addr; uint64_t offset; - char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; + char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; }; /* * Either addr is used, or symbol_name and offset. */ -struct lttng_kernel_old_kprobe { +struct lttng_kernel_abi_old_kprobe { uint64_t addr; uint64_t offset; - char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; + char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; }; /* Function tracer */ -struct lttng_kernel_old_function { - char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; +struct lttng_kernel_abi_old_function { + char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; }; -#define LTTNG_KERNEL_OLD_EVENT_PADDING1 16 -#define LTTNG_KERNEL_OLD_EVENT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32 -struct lttng_kernel_old_event { - char name[LTTNG_KERNEL_SYM_NAME_LEN]; - enum lttng_kernel_instrumentation instrumentation; - char padding[LTTNG_KERNEL_OLD_EVENT_PADDING1]; +#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; + char padding[LTTNG_KERNEL_ABI_OLD_EVENT_PADDING1]; /* Per instrumentation type configuration */ union { - struct lttng_kernel_old_kretprobe kretprobe; - struct lttng_kernel_old_kprobe kprobe; - struct lttng_kernel_old_function ftrace; - char padding[LTTNG_KERNEL_OLD_EVENT_PADDING2]; + struct lttng_kernel_abi_old_kretprobe kretprobe; + struct lttng_kernel_abi_old_kprobe kprobe; + struct lttng_kernel_abi_old_function ftrace; + char padding[LTTNG_KERNEL_ABI_OLD_EVENT_PADDING2]; } u; }; -struct lttng_kernel_old_tracer_version { +struct lttng_kernel_abi_old_tracer_version { uint32_t major; uint32_t minor; uint32_t patchlevel; @@ -86,8 +86,8 @@ struct lttng_kernel_old_tracer_version { /* * kernel channel */ -#define LTTNG_KERNEL_OLD_CHANNEL_PADDING1 LTTNG_SYMBOL_NAME_LEN + 32 -struct lttng_kernel_old_channel { +#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 */ @@ -95,7 +95,7 @@ struct lttng_kernel_old_channel { unsigned int read_timer_interval; /* usec */ enum lttng_event_output output; /* splice, mmap */ - char padding[LTTNG_KERNEL_OLD_CHANNEL_PADDING1]; + char padding[LTTNG_KERNEL_ABI_OLD_CHANNEL_PADDING1]; }; #endif /* _LTTNG_KERNEL_OLD_H */ diff --git a/src/common/lttng-kernel.h b/src/common/lttng-kernel.h index aeab89d98..82f242bbd 100644 --- a/src/common/lttng-kernel.h +++ b/src/common/lttng-kernel.h @@ -15,10 +15,10 @@ #include #include -#define LTTNG_KERNEL_SYM_NAME_LEN 256 -#define LTTNG_KERNEL_MAX_UPROBE_NUM 32 -#define LTTNG_KERNEL_SESSION_NAME_LEN 256 -#define LTTNG_KERNEL_SESSION_CREATION_TIME_ISO8601_LEN 26 +#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. @@ -26,178 +26,178 @@ * This is the kernel ABI copied from lttng-modules tree. */ -enum lttng_kernel_instrumentation { - LTTNG_KERNEL_ALL = -1, /* Used within lttng-tools */ - LTTNG_KERNEL_TRACEPOINT = 0, - LTTNG_KERNEL_KPROBE = 1, - LTTNG_KERNEL_FUNCTION = 2, - LTTNG_KERNEL_KRETPROBE = 3, - LTTNG_KERNEL_NOOP = 4, /* not hooked */ - LTTNG_KERNEL_SYSCALL = 5, - LTTNG_KERNEL_UPROBE = 6, +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, }; -enum lttng_kernel_context_type { - LTTNG_KERNEL_CONTEXT_PID = 0, - LTTNG_KERNEL_CONTEXT_PERF_CPU_COUNTER = 1, - LTTNG_KERNEL_CONTEXT_PROCNAME = 2, - LTTNG_KERNEL_CONTEXT_PRIO = 3, - LTTNG_KERNEL_CONTEXT_NICE = 4, - LTTNG_KERNEL_CONTEXT_VPID = 5, - LTTNG_KERNEL_CONTEXT_TID = 6, - LTTNG_KERNEL_CONTEXT_VTID = 7, - LTTNG_KERNEL_CONTEXT_PPID = 8, - LTTNG_KERNEL_CONTEXT_VPPID = 9, - LTTNG_KERNEL_CONTEXT_HOSTNAME = 10, - LTTNG_KERNEL_CONTEXT_CPU_ID = 11, - LTTNG_KERNEL_CONTEXT_INTERRUPTIBLE = 12, - LTTNG_KERNEL_CONTEXT_PREEMPTIBLE = 13, - LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE = 14, - LTTNG_KERNEL_CONTEXT_MIGRATABLE = 15, - LTTNG_KERNEL_CONTEXT_CALLSTACK_KERNEL = 16, - LTTNG_KERNEL_CONTEXT_CALLSTACK_USER = 17, - LTTNG_KERNEL_CONTEXT_CGROUP_NS = 18, - LTTNG_KERNEL_CONTEXT_IPC_NS = 19, - LTTNG_KERNEL_CONTEXT_MNT_NS = 20, - LTTNG_KERNEL_CONTEXT_NET_NS = 21, - LTTNG_KERNEL_CONTEXT_PID_NS = 22, - LTTNG_KERNEL_CONTEXT_USER_NS = 23, - LTTNG_KERNEL_CONTEXT_UTS_NS = 24, - LTTNG_KERNEL_CONTEXT_UID = 25, - LTTNG_KERNEL_CONTEXT_EUID = 26, - LTTNG_KERNEL_CONTEXT_SUID = 27, - LTTNG_KERNEL_CONTEXT_GID = 28, - LTTNG_KERNEL_CONTEXT_EGID = 29, - LTTNG_KERNEL_CONTEXT_SGID = 30, - LTTNG_KERNEL_CONTEXT_VUID = 31, - LTTNG_KERNEL_CONTEXT_VEUID = 32, - LTTNG_KERNEL_CONTEXT_VSUID = 33, - LTTNG_KERNEL_CONTEXT_VGID = 34, - LTTNG_KERNEL_CONTEXT_VEGID = 35, - LTTNG_KERNEL_CONTEXT_VSGID = 36, - LTTNG_KERNEL_CONTEXT_TIME_NS = 37, +enum lttng_kernel_abi_context_type { + 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_NEED_RESCHEDULE = 14, + 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, }; /* Perf counter attributes */ -struct lttng_kernel_perf_counter_ctx { +struct lttng_kernel_abi_perf_counter_ctx { uint32_t type; uint64_t config; - char name[LTTNG_KERNEL_SYM_NAME_LEN]; + char name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; } LTTNG_PACKED; /* Event/Channel context */ -#define LTTNG_KERNEL_CONTEXT_PADDING1 16 -#define LTTNG_KERNEL_CONTEXT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32 -struct lttng_kernel_context { - enum lttng_kernel_context_type ctx; - char padding[LTTNG_KERNEL_CONTEXT_PADDING1]; +#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]; union { - struct lttng_kernel_perf_counter_ctx perf_counter; - char padding[LTTNG_KERNEL_CONTEXT_PADDING2]; + struct lttng_kernel_abi_perf_counter_ctx perf_counter; + char padding[LTTNG_KERNEL_ABI_CONTEXT_PADDING2]; } u; } LTTNG_PACKED; -struct lttng_kernel_kretprobe { +struct lttng_kernel_abi_kretprobe { uint64_t addr; uint64_t offset; - char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; + char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; } LTTNG_PACKED; /* * Either addr is used, or symbol_name and offset. */ -struct lttng_kernel_kprobe { +struct lttng_kernel_abi_kprobe { uint64_t addr; uint64_t offset; - char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; + char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; } LTTNG_PACKED; -struct lttng_kernel_uprobe { +struct lttng_kernel_abi_uprobe { int fd; } LTTNG_PACKED; -struct lttng_kernel_event_callsite_uprobe { +struct lttng_kernel_abi_event_callsite_uprobe { uint64_t offset; } LTTNG_PACKED; -struct lttng_kernel_event_callsite { +struct lttng_kernel_abi_event_callsite { union { - struct lttng_kernel_event_callsite_uprobe uprobe; + struct lttng_kernel_abi_event_callsite_uprobe uprobe; } u; } LTTNG_PACKED; -enum lttng_kernel_syscall_entryexit { - LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0, - LTTNG_KERNEL_SYSCALL_ENTRY = 1, - LTTNG_KERNEL_SYSCALL_EXIT = 2, +enum lttng_kernel_abi_syscall_entryexit { + LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT = 0, + LTTNG_KERNEL_ABI_SYSCALL_ENTRY = 1, + LTTNG_KERNEL_ABI_SYSCALL_EXIT = 2, }; -enum lttng_kernel_syscall_abi { - LTTNG_KERNEL_SYSCALL_ABI_ALL = 0, - LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1, - LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2, +enum lttng_kernel_abi_syscall_abi { + LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL = 0, + LTTNG_KERNEL_ABI_SYSCALL_ABI_NATIVE = 1, + LTTNG_KERNEL_ABI_SYSCALL_ABI_COMPAT = 2, }; -enum lttng_kernel_syscall_match { - LTTNG_KERNEL_SYSCALL_MATCH_NAME = 0, - LTTNG_KERNEL_SYSCALL_MATCH_NR = 1, +enum lttng_kernel_abi_syscall_match { + LTTNG_KERNEL_ABI_SYSCALL_MATCH_NAME = 0, + LTTNG_KERNEL_ABI_SYSCALL_MATCH_NR = 1, }; -struct lttng_kernel_syscall { - uint8_t entryexit; /* enum lttng_kernel_syscall_entryexit */ - uint8_t abi; /* enum lttng_kernel_syscall_abi */ - uint8_t match; /* enum lttng_kernel_syscall_match */ +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 padding; uint32_t nr; /* For LTTNG_SYSCALL_MATCH_NR */ } LTTNG_PACKED; /* Function tracer */ -struct lttng_kernel_function { - char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN]; +struct lttng_kernel_abi_function { + char symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN]; } LTTNG_PACKED; -#define LTTNG_KERNEL_EVENT_PADDING1 8 -#define LTTNG_KERNEL_EVENT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32 -struct lttng_kernel_event { - char name[LTTNG_KERNEL_SYM_NAME_LEN]; - enum lttng_kernel_instrumentation instrumentation; +#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; uint64_t token; - char padding[LTTNG_KERNEL_EVENT_PADDING1]; + char padding[LTTNG_KERNEL_ABI_EVENT_PADDING1]; /* Per instrumentation type configuration */ union { - struct lttng_kernel_kretprobe kretprobe; - struct lttng_kernel_kprobe kprobe; - struct lttng_kernel_function ftrace; - struct lttng_kernel_uprobe uprobe; - struct lttng_kernel_syscall syscall; - char padding[LTTNG_KERNEL_EVENT_PADDING2]; + struct lttng_kernel_abi_kretprobe kretprobe; + struct lttng_kernel_abi_kprobe kprobe; + struct lttng_kernel_abi_function ftrace; + struct lttng_kernel_abi_uprobe uprobe; + struct lttng_kernel_abi_syscall syscall; + char padding[LTTNG_KERNEL_ABI_EVENT_PADDING2]; } u; } LTTNG_PACKED; -#define LTTNG_KERNEL_EVENT_NOTIFIER_PADDING 32 -struct lttng_kernel_event_notifier { - struct lttng_kernel_event event; +#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; - char padding[LTTNG_KERNEL_EVENT_NOTIFIER_PADDING]; + char padding[LTTNG_KERNEL_ABI_EVENT_NOTIFIER_PADDING]; } LTTNG_PACKED; -#define LTTNG_KERNEL_COUNTER_DIMENSION_MAX 4 +#define LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX 4 -enum lttng_kernel_counter_arithmetic { - LTTNG_KERNEL_COUNTER_ARITHMETIC_MODULAR = 0, +enum lttng_kernel_abi_counter_arithmetic { + LTTNG_KERNEL_ABI_COUNTER_ARITHMETIC_MODULAR = 0, }; -enum lttng_kernel_counter_bitness { - LTTNG_KERNEL_COUNTER_BITNESS_32 = 0, - LTTNG_KERNEL_COUNTER_BITNESS_64 = 1, +enum lttng_kernel_abi_counter_bitness { + LTTNG_KERNEL_ABI_COUNTER_BITNESS_32 = 0, + LTTNG_KERNEL_ABI_COUNTER_BITNESS_64 = 1, }; -struct lttng_kernel_counter_dimension { +struct lttng_kernel_abi_counter_dimension { uint64_t size; uint64_t underflow_index; uint64_t overflow_index; @@ -205,76 +205,76 @@ struct lttng_kernel_counter_dimension { uint8_t has_overflow; } LTTNG_PACKED; -#define LTTNG_KERNEL_COUNTER_CONF_PADDING1 67 -struct lttng_kernel_counter_conf { - uint32_t arithmetic; /* enum lttng_kernel_counter_arithmetic */ - uint32_t bitness; /* enum lttng_kernel_counter_bitness */ +#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 number_dimensions; int64_t global_sum_step; - struct lttng_kernel_counter_dimension dimensions[LTTNG_KERNEL_COUNTER_DIMENSION_MAX]; + struct lttng_kernel_abi_counter_dimension dimensions[LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX]; uint8_t coalesce_hits; - char padding[LTTNG_KERNEL_COUNTER_CONF_PADDING1]; + char padding[LTTNG_KERNEL_ABI_COUNTER_CONF_PADDING1]; } LTTNG_PACKED; -struct lttng_kernel_counter_index { +struct lttng_kernel_abi_counter_index { uint32_t number_dimensions; - uint64_t dimension_indexes[LTTNG_KERNEL_COUNTER_DIMENSION_MAX]; + uint64_t dimension_indexes[LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX]; } LTTNG_PACKED; -struct lttng_kernel_counter_value { +struct lttng_kernel_abi_counter_value { int64_t value; uint8_t underflow; uint8_t overflow; } LTTNG_PACKED; -#define LTTNG_KERNEL_COUNTER_READ_PADDING 32 -struct lttng_kernel_counter_read { - struct lttng_kernel_counter_index index; +#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_counter_value value; /* output */ - char padding[LTTNG_KERNEL_COUNTER_READ_PADDING]; + struct lttng_kernel_abi_counter_value value; /* output */ + char padding[LTTNG_KERNEL_ABI_COUNTER_READ_PADDING]; } LTTNG_PACKED; -#define LTTNG_KERNEL_COUNTER_AGGREGATE_PADDING 32 -struct lttng_kernel_counter_aggregate { - struct lttng_kernel_counter_index index; - struct lttng_kernel_counter_value value; /* output */ - char padding[LTTNG_KERNEL_COUNTER_AGGREGATE_PADDING]; +#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 */ + char padding[LTTNG_KERNEL_ABI_COUNTER_AGGREGATE_PADDING]; } LTTNG_PACKED; -#define LTTNG_KERNEL_COUNTER_CLEAR_PADDING 32 -struct lttng_kernel_counter_clear { - struct lttng_kernel_counter_index index; - char padding[LTTNG_KERNEL_COUNTER_CLEAR_PADDING]; +#define LTTNG_KERNEL_ABI_COUNTER_CLEAR_PADDING 32 +struct lttng_kernel_abi_counter_clear { + struct lttng_kernel_abi_counter_index index; + char padding[LTTNG_KERNEL_ABI_COUNTER_CLEAR_PADDING]; } LTTNG_PACKED; -#define LTTNG_KERNEL_EVENT_NOTIFIER_NOTIFICATION_PADDING 32 -struct lttng_kernel_event_notifier_notification { +#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING 32 +struct lttng_kernel_abi_event_notifier_notification { uint64_t token; uint16_t capture_buf_size; - char padding[LTTNG_KERNEL_EVENT_NOTIFIER_NOTIFICATION_PADDING]; + char padding[LTTNG_KERNEL_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING]; } LTTNG_PACKED; -#define LTTNG_KERNEL_CAPTURE_BYTECODE_MAX_LEN 65536 -struct lttng_kernel_capture_bytecode { +#define LTTNG_KERNEL_ABI_CAPTURE_BYTECODE_MAX_LEN 65536 +struct lttng_kernel_abi_capture_bytecode { uint32_t len; uint32_t reloc_offset; uint64_t seqnum; char data[0]; } LTTNG_PACKED; -struct lttng_kernel_tracer_version { +struct lttng_kernel_abi_tracer_version { uint32_t major; uint32_t minor; uint32_t patchlevel; } LTTNG_PACKED; -struct lttng_kernel_tracer_abi_version { +struct lttng_kernel_abi_tracer_abi_version { uint32_t major; uint32_t minor; } LTTNG_PACKED; -struct lttng_kernel_syscall_mask { +struct lttng_kernel_abi_syscall_mask { uint32_t len; /* in bits */ char mask[]; } LTTNG_PACKED; @@ -282,8 +282,8 @@ struct lttng_kernel_syscall_mask { /* * kernel channel */ -#define LTTNG_KERNEL_CHANNEL_PADDING1 LTTNG_SYMBOL_NAME_LEN + 32 -struct lttng_kernel_channel { +#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 */ unsigned int switch_timer_interval; /* usec */ @@ -291,11 +291,11 @@ struct lttng_kernel_channel { enum lttng_event_output output; /* splice, mmap */ int overwrite; /* 1: overwrite, 0: discard */ - char padding[LTTNG_KERNEL_CHANNEL_PADDING1]; + char padding[LTTNG_KERNEL_ABI_CHANNEL_PADDING1]; } LTTNG_PACKED; #define KERNEL_FILTER_BYTECODE_MAX_LEN 65536 -struct lttng_kernel_filter_bytecode { +struct lttng_kernel_abi_filter_bytecode { uint32_t len; uint32_t reloc_offset; uint64_t seqnum; @@ -305,30 +305,30 @@ struct lttng_kernel_filter_bytecode { /* * kernel session name */ -struct lttng_kernel_session_name { - char name[LTTNG_KERNEL_SESSION_NAME_LEN]; +struct lttng_kernel_abi_session_name { + char name[LTTNG_KERNEL_ABI_SESSION_NAME_LEN]; } LTTNG_PACKED; /* * kernel session creation datetime */ -struct lttng_kernel_session_creation_time { - char iso8601[LTTNG_KERNEL_SESSION_CREATION_TIME_ISO8601_LEN]; +struct lttng_kernel_abi_session_creation_time { + char iso8601[LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN]; } LTTNG_PACKED; -enum lttng_kernel_tracker_type { - LTTNG_KERNEL_TRACKER_UNKNOWN = -1, +enum lttng_kernel_abi_tracker_type { + LTTNG_KERNEL_ABI_TRACKER_UNKNOWN = -1, - LTTNG_KERNEL_TRACKER_PID = 0, - LTTNG_KERNEL_TRACKER_VPID = 1, - LTTNG_KERNEL_TRACKER_UID = 2, - LTTNG_KERNEL_TRACKER_VUID = 3, - LTTNG_KERNEL_TRACKER_GID = 4, - LTTNG_KERNEL_TRACKER_VGID = 5, + 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_tracker_args { - enum lttng_kernel_tracker_type type; +struct lttng_kernel_abi_tracker_args { + enum lttng_kernel_abi_tracker_type type; int32_t id; }; diff --git a/src/common/runas.c b/src/common/runas.c index 09fdaf40a..849635c7f 100644 --- a/src/common/runas.c +++ b/src/common/runas.c @@ -124,7 +124,7 @@ struct run_as_extract_elf_symbol_offset_ret { struct run_as_extract_sdt_probe_offsets_ret { uint32_t num_offset; - uint64_t offsets[LTTNG_KERNEL_MAX_UPROBE_NUM]; + uint64_t offsets[LTTNG_KERNEL_ABI_MAX_UPROBE_NUM]; } LTTNG_PACKED; struct run_as_generate_filter_bytecode_ret { @@ -607,7 +607,7 @@ int _extract_sdt_probe_offsets(struct run_as_data *data, goto end; } - if (num_offset <= 0 || num_offset > LTTNG_KERNEL_MAX_UPROBE_NUM) { + if (num_offset <= 0 || num_offset > LTTNG_KERNEL_ABI_MAX_UPROBE_NUM) { DBG("Wrong number of probes."); ret = -1; ret_value->_error = true; diff --git a/tests/unit/test_kernel_data.c b/tests/unit/test_kernel_data.c index d575d2518..7ed0453af 100644 --- a/tests/unit/test_kernel_data.c +++ b/tests/unit/test_kernel_data.c @@ -149,7 +149,7 @@ static void test_create_kernel_event(void) ok(event->fd == -1 && event->enabled == 1 && - event->event->instrumentation == LTTNG_KERNEL_TRACEPOINT && + event->event->instrumentation == LTTNG_KERNEL_ABI_TRACEPOINT && strlen(event->event->name), "Validate kernel event"); -- 2.34.1