1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2019 Facebook
4 #include <linux/ptrace.h>
6 #include "bpf_helpers.h"
9 __uint(type
, BPF_MAP_TYPE_PERF_EVENT_ARRAY
);
10 __uint(key_size
, sizeof(int));
11 __uint(value_size
, sizeof(int));
12 } perf_buf_map
SEC(".maps");
14 SEC("kprobe/sys_nanosleep")
15 int handle_sys_nanosleep_entry(struct pt_regs
*ctx
)
17 int cpu
= bpf_get_smp_processor_id();
19 bpf_perf_event_output(ctx
, &perf_buf_map
, BPF_F_CURRENT_CPU
,
24 char _license
[] SEC("license") = "GPL";
25 __u32 _version
SEC("version") = 1;