xref: /linux/tools/testing/selftests/bpf/progs/test_overhead.c (revision 07fdad3a93756b872da7b53647715c48d0f4a2d0)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2019 Facebook */
3 #include "vmlinux.h"
4 #include <bpf/bpf_helpers.h>
5 #include <bpf/bpf_tracing.h>
6 
7 struct task_struct;
8 
9 SEC("kprobe/__set_task_comm")
10 int BPF_KPROBE(prog1, struct task_struct *tsk, const char *buf, bool exec)
11 {
12 	return !tsk;
13 }
14 
15 SEC("kretprobe/__set_task_comm")
16 int BPF_KRETPROBE(prog2, int ret)
17 {
18 	return ret;
19 }
20 
21 SEC("raw_tp/task_rename")
22 int prog3(struct bpf_raw_tracepoint_args *ctx)
23 {
24 	return !ctx->args[0];
25 }
26 
27 SEC("fentry/__set_task_comm")
28 int BPF_PROG(prog4, struct task_struct *tsk, const char *buf, bool exec)
29 {
30 	return 0;
31 }
32 
33 SEC("fexit/__set_task_comm")
34 int BPF_PROG(prog5, struct task_struct *tsk, const char *buf, bool exec)
35 {
36 	return 0;
37 }
38 
39 char _license[] SEC("license") = "GPL";
40