xref: /linux/tools/testing/selftests/bpf/progs/test_fill_link_info.c (revision d0d106a2bd21499901299160744e5fe9f4c83ddb)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (C) 2023 Yafang Shao <laoar.shao@gmail.com> */
3 
4 #include "vmlinux.h"
5 #include <bpf/bpf_tracing.h>
6 #include <stdbool.h>
7 
8 extern bool CONFIG_X86_KERNEL_IBT __kconfig __weak;
9 extern bool CONFIG_PPC_FTRACE_OUT_OF_LINE __kconfig __weak;
10 extern bool CONFIG_KPROBES_ON_FTRACE __kconfig __weak;
11 extern bool CONFIG_PPC64 __kconfig __weak;
12 
13 /* This function is here to have CONFIG_X86_KERNEL_IBT,
14  * CONFIG_PPC_FTRACE_OUT_OF_LINE, CONFIG_KPROBES_ON_FTRACE,
15  * CONFIG_PPC6 used and added to object BTF.
16  */
unused(void)17 int unused(void)
18 {
19 	return CONFIG_X86_KERNEL_IBT ||
20 			CONFIG_PPC_FTRACE_OUT_OF_LINE ||
21 			CONFIG_KPROBES_ON_FTRACE ||
22 			CONFIG_PPC64 ? 0 : 1;
23 }
24 
25 SEC("kprobe")
BPF_PROG(kprobe_run)26 int BPF_PROG(kprobe_run)
27 {
28 	return 0;
29 }
30 
31 SEC("uprobe")
BPF_PROG(uprobe_run)32 int BPF_PROG(uprobe_run)
33 {
34 	return 0;
35 }
36 
37 SEC("tracepoint")
BPF_PROG(tp_run)38 int BPF_PROG(tp_run)
39 {
40 	return 0;
41 }
42 
43 SEC("perf_event")
event_run(void * ctx)44 int event_run(void *ctx)
45 {
46 	return 0;
47 }
48 
49 SEC("kprobe.multi")
BPF_PROG(kmulti_run)50 int BPF_PROG(kmulti_run)
51 {
52 	return 0;
53 }
54 
55 SEC("uprobe.multi")
BPF_PROG(umulti_run)56 int BPF_PROG(umulti_run)
57 {
58 	return 0;
59 }
60 
61 char _license[] SEC("license") = "GPL";
62