treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / test_attach_probe.c
blobdd8fae6660ab6316c571ddfecc20f163da3c3f89
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>
8 int kprobe_res = 0;
9 int kretprobe_res = 0;
10 int uprobe_res = 0;
11 int uretprobe_res = 0;
13 SEC("kprobe/sys_nanosleep")
14 int handle_kprobe(struct pt_regs *ctx)
16 kprobe_res = 1;
17 return 0;
20 SEC("kretprobe/sys_nanosleep")
21 int handle_kretprobe(struct pt_regs *ctx)
23 kretprobe_res = 2;
24 return 0;
27 SEC("uprobe/trigger_func")
28 int handle_uprobe(struct pt_regs *ctx)
30 uprobe_res = 3;
31 return 0;
34 SEC("uretprobe/trigger_func")
35 int handle_uretprobe(struct pt_regs *ctx)
37 uretprobe_res = 4;
38 return 0;
41 char _license[] SEC("license") = "GPL";