| .. | .. |
|---|
| 8 | 8 | #include <linux/ptrace.h> |
|---|
| 9 | 9 | #include <uapi/linux/bpf.h> |
|---|
| 10 | 10 | #include <linux/version.h> |
|---|
| 11 | | -#include "bpf_helpers.h" |
|---|
| 11 | +#include <bpf/bpf_helpers.h> |
|---|
| 12 | 12 | #include <uapi/linux/utsname.h> |
|---|
| 13 | +#include "trace_common.h" |
|---|
| 13 | 14 | |
|---|
| 14 | | -struct bpf_map_def SEC("maps") cgroup_map = { |
|---|
| 15 | | - .type = BPF_MAP_TYPE_CGROUP_ARRAY, |
|---|
| 16 | | - .key_size = sizeof(u32), |
|---|
| 17 | | - .value_size = sizeof(u32), |
|---|
| 18 | | - .max_entries = 1, |
|---|
| 19 | | -}; |
|---|
| 15 | +struct { |
|---|
| 16 | + __uint(type, BPF_MAP_TYPE_CGROUP_ARRAY); |
|---|
| 17 | + __uint(key_size, sizeof(u32)); |
|---|
| 18 | + __uint(value_size, sizeof(u32)); |
|---|
| 19 | + __uint(max_entries, 1); |
|---|
| 20 | +} cgroup_map SEC(".maps"); |
|---|
| 20 | 21 | |
|---|
| 21 | | -struct bpf_map_def SEC("maps") perf_map = { |
|---|
| 22 | | - .type = BPF_MAP_TYPE_ARRAY, |
|---|
| 23 | | - .key_size = sizeof(u32), |
|---|
| 24 | | - .value_size = sizeof(u64), |
|---|
| 25 | | - .max_entries = 1, |
|---|
| 26 | | -}; |
|---|
| 22 | +struct { |
|---|
| 23 | + __uint(type, BPF_MAP_TYPE_ARRAY); |
|---|
| 24 | + __type(key, u32); |
|---|
| 25 | + __type(value, u64); |
|---|
| 26 | + __uint(max_entries, 1); |
|---|
| 27 | +} perf_map SEC(".maps"); |
|---|
| 27 | 28 | |
|---|
| 28 | 29 | /* Writes the last PID that called sync to a map at index 0 */ |
|---|
| 29 | | -SEC("kprobe/sys_sync") |
|---|
| 30 | +SEC("kprobe/" SYSCALL(sys_sync)) |
|---|
| 30 | 31 | int bpf_prog1(struct pt_regs *ctx) |
|---|
| 31 | 32 | { |
|---|
| 32 | 33 | u64 pid = bpf_get_current_pid_tgid(); |
|---|