xref: /linux/tools/testing/selftests/bpf/progs/tracing_multi_rollback.c (revision 68f4e480b089abae26fbab0c38c3df3cbac3d79d)
1 // SPDX-License-Identifier: GPL-2.0
2 #include <vmlinux.h>
3 #include <bpf/bpf_helpers.h>
4 #include <bpf/bpf_tracing.h>
5 
6 char _license[] SEC("license") = "GPL";
7 
8 int pid = 0;
9 
10 __u64 test_result_fentry = 0;
11 __u64 test_result_fexit = 0;
12 
13 SEC("?fentry.multi")
14 int BPF_PROG(test_fentry)
15 {
16 	if (bpf_get_current_pid_tgid() >> 32 != pid)
17 		return 0;
18 
19 	test_result_fentry++;
20 	return 0;
21 }
22 
23 SEC("?fexit.multi")
24 int BPF_PROG(test_fexit)
25 {
26 	if (bpf_get_current_pid_tgid() >> 32 != pid)
27 		return 0;
28 
29 	test_result_fexit++;
30 	return 0;
31 }
32 
33 SEC("?fentry/bpf_fentry_test1")
34 int BPF_PROG(extra)
35 {
36 	return 0;
37 }
38 
39 SEC("?fentry/bpf_fentry_test10")
40 int BPF_PROG(filler)
41 {
42 	return 0;
43 }
44