.. | .. |
---|
7 | 7 | #include <linux/ptrace.h> |
---|
8 | 8 | #include <linux/version.h> |
---|
9 | 9 | #include <uapi/linux/bpf.h> |
---|
10 | | -#include "bpf_helpers.h" |
---|
| 10 | +#include <bpf/bpf_helpers.h> |
---|
| 11 | +#include <bpf/bpf_tracing.h> |
---|
11 | 12 | |
---|
12 | 13 | struct pair { |
---|
13 | 14 | u64 val; |
---|
14 | 15 | u64 ip; |
---|
15 | 16 | }; |
---|
16 | 17 | |
---|
17 | | -struct bpf_map_def SEC("maps") my_map = { |
---|
18 | | - .type = BPF_MAP_TYPE_HASH, |
---|
19 | | - .key_size = sizeof(long), |
---|
20 | | - .value_size = sizeof(struct pair), |
---|
21 | | - .max_entries = 1000000, |
---|
22 | | -}; |
---|
| 18 | +struct { |
---|
| 19 | + __uint(type, BPF_MAP_TYPE_HASH); |
---|
| 20 | + __type(key, long); |
---|
| 21 | + __type(value, struct pair); |
---|
| 22 | + __uint(max_entries, 1000000); |
---|
| 23 | +} my_map SEC(".maps"); |
---|
23 | 24 | |
---|
24 | 25 | /* kprobe is NOT a stable ABI. If kernel internals change this bpf+kprobe |
---|
25 | 26 | * example will no longer be meaningful |
---|