hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/samples/bpf/trace_output_kern.c
....@@ -1,16 +1,17 @@
11 #include <linux/ptrace.h>
22 #include <linux/version.h>
33 #include <uapi/linux/bpf.h>
4
-#include "bpf_helpers.h"
4
+#include <bpf/bpf_helpers.h>
5
+#include "trace_common.h"
56
6
-struct bpf_map_def SEC("maps") my_map = {
7
- .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
8
- .key_size = sizeof(int),
9
- .value_size = sizeof(u32),
10
- .max_entries = 2,
11
-};
7
+struct {
8
+ __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
9
+ __uint(key_size, sizeof(int));
10
+ __uint(value_size, sizeof(u32));
11
+ __uint(max_entries, 2);
12
+} my_map SEC(".maps");
1213
13
-SEC("kprobe/sys_write")
14
+SEC("kprobe/" SYSCALL(sys_write))
1415 int bpf_prog1(struct pt_regs *ctx)
1516 {
1617 struct S {