.. | .. |
---|
1 | 1 | #include <linux/ptrace.h> |
---|
2 | 2 | #include <linux/version.h> |
---|
3 | 3 | #include <uapi/linux/bpf.h> |
---|
4 | | -#include "bpf_helpers.h" |
---|
| 4 | +#include <bpf/bpf_helpers.h> |
---|
| 5 | +#include "trace_common.h" |
---|
5 | 6 | |
---|
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"); |
---|
12 | 13 | |
---|
13 | | -SEC("kprobe/sys_write") |
---|
| 14 | +SEC("kprobe/" SYSCALL(sys_write)) |
---|
14 | 15 | int bpf_prog1(struct pt_regs *ctx) |
---|
15 | 16 | { |
---|
16 | 17 | struct S { |
---|