WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / test_autoload.c
blob62c8cdec6d5de356ed86906b8bfd85dda182067f
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2020 Facebook */
4 #include "vmlinux.h"
5 #include <bpf/bpf_helpers.h>
6 #include <bpf/bpf_tracing.h>
7 #include <bpf/bpf_core_read.h>
9 bool prog1_called = false;
10 bool prog2_called = false;
11 bool prog3_called = false;
13 SEC("raw_tp/sys_enter")
14 int prog1(const void *ctx)
16 prog1_called = true;
17 return 0;
20 SEC("raw_tp/sys_exit")
21 int prog2(const void *ctx)
23 prog2_called = true;
24 return 0;
27 struct fake_kernel_struct {
28 int whatever;
29 } __attribute__((preserve_access_index));
31 SEC("fentry/unexisting-kprobe-will-fail-if-loaded")
32 int prog3(const void *ctx)
34 struct fake_kernel_struct *fake = (void *)ctx;
35 fake->whatever = 123;
36 prog3_called = true;
37 return 0;
40 char _license[] SEC("license") = "GPL";