diff options
| author | Paul Buetow <paul@buetow.org> | 2024-02-27 09:52:36 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-02-27 09:52:36 +0200 |
| commit | 2745f74f3db314a94ae181fb53963bf853db3833 (patch) | |
| tree | 143cf8557089835906e3d899c8b18fcb00023cac /internal/c/tracepoints/open.c | |
| parent | d8441fff4bbf2739cc0e6c046035bf176158954a (diff) | |
use generated tracepoints.c
Diffstat (limited to 'internal/c/tracepoints/open.c')
| -rw-r--r-- | internal/c/tracepoints/open.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/internal/c/tracepoints/open.c b/internal/c/tracepoints/open.c index fa0fbf3..0b5d825 100644 --- a/internal/c/tracepoints/open.c +++ b/internal/c/tracepoints/open.c @@ -1,6 +1,11 @@ //+build ignore -static __always_inline int _handle_enter_open(struct trace_event_raw_sys_enter *ctx, __u32 op_id) { +#define SYS_ENTER_OPEN 1 +#define SYS_EXIT_OPEN 2 +#define SYS_ENTER_OPENAT 3 +#define SYS_EXIT_OPENAT 4 + +static __always_inline int _handle_enter_open(struct trace_event_raw_sys_enter *ctx, __u32 syscall_id) { __u32 pid, tid; if (filter(&pid, &tid)) return 0; @@ -9,7 +14,7 @@ static __always_inline int _handle_enter_open(struct trace_event_raw_sys_enter * if (!ev) return 0; - ev->op_id = op_id; + ev->syscall_id = syscall_id; ev->pid = pid; ev->tid = tid; ev->time = bpf_ktime_get_ns() / 1000; @@ -23,7 +28,7 @@ static __always_inline int _handle_enter_open(struct trace_event_raw_sys_enter * return 0; } -static __always_inline int _handle_exit_open(struct trace_event_raw_sys_exit *ctx, __u32 op_id) { +static __always_inline int _handle_exit_open(struct trace_event_raw_sys_exit *ctx, __u32 syscall_id) { __u32 pid, tid; if (filter(&pid, &tid)) return 0; @@ -32,7 +37,7 @@ static __always_inline int _handle_exit_open(struct trace_event_raw_sys_exit *ct if (!ev) return 0; - ev->op_id = op_id; + ev->syscall_id = syscall_id; ev->pid = pid; ev->tid = tid; ev->time = bpf_ktime_get_ns() / 1000; @@ -45,20 +50,20 @@ static __always_inline int _handle_exit_open(struct trace_event_raw_sys_exit *ct SEC("tracepoint/syscalls/sys_enter_openat") int handle_enter_openat(struct trace_event_raw_sys_enter *ctx) { - return _handle_enter_open(ctx, OPENAT_ENTER_OP_ID); + return _handle_enter_open(ctx, SYS_ENTER_OPENAT); } SEC("tracepoint/syscalls/sys_exit_openat") int handle_exit_openat(struct trace_event_raw_sys_exit *ctx) { - return _handle_exit_open(ctx, OPENAT_EXIT_OP_ID); + return _handle_exit_open(ctx, SYS_EXIT_OPENAT); } SEC("tracepoint/syscalls/sys_enter_open") int handle_enter_open(struct trace_event_raw_sys_enter *ctx) { - return _handle_enter_open(ctx, OPEN_ENTER_OP_ID); + return _handle_enter_open(ctx, SYS_ENTER_OPEN); } SEC("tracepoint/syscalls/sys_exit_open") int handle_exit_open(struct trace_event_raw_sys_exit *ctx) { - return _handle_exit_open(ctx, OPEN_EXIT_OP_ID); + return _handle_exit_open(ctx, SYS_EXIT_OPEN); } |
