hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/samples/bpf/tracex6_kern.c
....@@ -1,26 +1,28 @@
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>
55
6
-struct bpf_map_def SEC("maps") counters = {
7
- .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
8
- .key_size = sizeof(int),
9
- .value_size = sizeof(u32),
10
- .max_entries = 64,
11
-};
12
-struct bpf_map_def SEC("maps") values = {
13
- .type = BPF_MAP_TYPE_HASH,
14
- .key_size = sizeof(int),
15
- .value_size = sizeof(u64),
16
- .max_entries = 64,
17
-};
18
-struct bpf_map_def SEC("maps") values2 = {
19
- .type = BPF_MAP_TYPE_HASH,
20
- .key_size = sizeof(int),
21
- .value_size = sizeof(struct bpf_perf_event_value),
22
- .max_entries = 64,
23
-};
6
+struct {
7
+ __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
8
+ __uint(key_size, sizeof(int));
9
+ __uint(value_size, sizeof(u32));
10
+ __uint(max_entries, 64);
11
+} counters SEC(".maps");
12
+
13
+struct {
14
+ __uint(type, BPF_MAP_TYPE_HASH);
15
+ __type(key, int);
16
+ __type(value, u64);
17
+ __uint(max_entries, 64);
18
+} values SEC(".maps");
19
+
20
+struct {
21
+ __uint(type, BPF_MAP_TYPE_HASH);
22
+ __type(key, int);
23
+ __type(value, struct bpf_perf_event_value);
24
+ __uint(max_entries, 64);
25
+} values2 SEC(".maps");
2426
2527 SEC("kprobe/htab_map_get_next_key")
2628 int bpf_prog1(struct pt_regs *ctx)