From: Francis Deslauriers Date: Wed, 25 Nov 2020 17:06:38 +0000 (-0500) Subject: kernel: Add `struct lttng_kernel_syscall` to ABI X-Git-Tag: v2.13.0-rc1~403 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c863e5a69d06f11312e8e5a7d9c1b20d56f2cb6e;p=lttng-tools.git kernel: Add `struct lttng_kernel_syscall` to ABI This struct is now used by the kernel tracer to allow to selectively turn on and off syscalls event firing. This way, the sessiond can decide to turn on only syscall entries, exits, or both. This will be used by the upcoming event notifier features to only generate a notification on syscall entry. This new struct doesn't change the layout of the `lttng_kernel_event` structure. Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau Change-Id: I478de30b91b415f517e9d0ac0686f3130f79d86b --- diff --git a/src/bin/lttng-sessiond/trace-kernel.c b/src/bin/lttng-sessiond/trace-kernel.c index dfdc9fd14..a8154a3cc 100644 --- a/src/bin/lttng-sessiond/trace-kernel.c +++ b/src/bin/lttng-sessiond/trace-kernel.c @@ -434,6 +434,9 @@ enum lttng_error_code trace_kernel_create_event( 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; break; case LTTNG_EVENT_ALL: attr->instrumentation = LTTNG_KERNEL_ALL; diff --git a/src/common/lttng-kernel.h b/src/common/lttng-kernel.h index fc2a1e259..565f53928 100644 --- a/src/common/lttng-kernel.h +++ b/src/common/lttng-kernel.h @@ -129,6 +129,31 @@ struct lttng_kernel_event_callsite { } 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_syscall_abi { + LTTNG_KERNEL_SYSCALL_ABI_ALL = 0, + LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1, + LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2, +}; + +enum lttng_kernel_syscall_match { + LTTNG_KERNEL_SYSCALL_MATCH_NAME = 0, + LTTNG_KERNEL_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 */ + 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]; @@ -145,8 +170,9 @@ struct lttng_kernel_event { union { struct lttng_kernel_kretprobe kretprobe; struct lttng_kernel_kprobe kprobe; - struct lttng_kernel_uprobe uprobe; struct lttng_kernel_function ftrace; + struct lttng_kernel_uprobe uprobe; + struct lttng_kernel_syscall syscall; char padding[LTTNG_KERNEL_EVENT_PADDING2]; } u; } LTTNG_PACKED;