WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / test_attach_probe.c
blob8056a4c6d9182f9fe55bcb6b97bc35a834301196
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2017 Facebook
4 #include <linux/ptrace.h>
5 #include <linux/bpf.h>
6 #include <bpf/bpf_helpers.h>
7 #include <bpf/bpf_tracing.h>
9 int kprobe_res = 0;
10 int kretprobe_res = 0;
11 int uprobe_res = 0;
12 int uretprobe_res = 0;
14 SEC("kprobe/sys_nanosleep")
15 int handle_kprobe(struct pt_regs *ctx)
17 kprobe_res = 1;
18 return 0;
21 SEC("kretprobe/sys_nanosleep")
22 int BPF_KRETPROBE(handle_kretprobe)
24 kretprobe_res = 2;
25 return 0;
28 SEC("uprobe/trigger_func")
29 int handle_uprobe(struct pt_regs *ctx)
31 uprobe_res = 3;
32 return 0;
35 SEC("uretprobe/trigger_func")
36 int handle_uretprobe(struct pt_regs *ctx)
38 uretprobe_res = 4;
39 return 0;
42 char _license[] SEC("license") = "GPL";