• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2019 Facebook */
3 
4 #include <stdbool.h>
5 #include <linux/bpf.h>
6 #include <bpf/bpf_helpers.h>
7 
8 __u64 out__bpf_link_fops = -1;
9 __u64 out__bpf_link_fops1 = -1;
10 __u64 out__btf_size = -1;
11 __u64 out__per_cpu_start = -1;
12 
13 extern const void bpf_link_fops __ksym;
14 extern const void __start_BTF __ksym;
15 extern const void __stop_BTF __ksym;
16 extern const void __per_cpu_start __ksym;
17 /* non-existing symbol, weak, default to zero */
18 extern const void bpf_link_fops1 __ksym __weak;
19 
20 SEC("raw_tp/sys_enter")
handler(const void * ctx)21 int handler(const void *ctx)
22 {
23 	out__bpf_link_fops = (__u64)&bpf_link_fops;
24 	out__btf_size = (__u64)(&__stop_BTF - &__start_BTF);
25 	out__per_cpu_start = (__u64)&__per_cpu_start;
26 
27 	out__bpf_link_fops1 = (__u64)&bpf_link_fops1;
28 
29 	return 0;
30 }
31 
32 char _license[] SEC("license") = "GPL";
33