xref: /linux/tools/testing/selftests/bpf/progs/test_subskeleton.c (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) Meta Platforms, Inc. and affiliates. */
3 
4 #include <stdbool.h>
5 #include <linux/bpf.h>
6 #include <bpf/bpf_helpers.h>
7 
8 /* volatile to force a read, compiler may assume 0 otherwise */
9 const volatile int rovar1;
10 int out1;
11 
12 /* Override weak symbol in test_subskeleton_lib */
13 int var5 = 5;
14 
15 extern volatile bool CONFIG_BPF_SYSCALL __kconfig;
16 
17 extern int lib_routine(void);
18 
19 SEC("raw_tp/sys_enter")
handler1(const void * ctx)20 int handler1(const void *ctx)
21 {
22 	(void) CONFIG_BPF_SYSCALL;
23 
24 	out1 = lib_routine() * rovar1;
25 	return 0;
26 }
27 
28 char LICENSE[] SEC("license") = "GPL";
29