File Index
Files and directories
Sign in
FILE

uprobe_syscall_executed.c

File preview with syntax highlighting.

linux-6.19.14/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c C
 1// SPDX-License-Identifier: GPL-2.0
 2#include "vmlinux.h"
 3#include <bpf/bpf_helpers.h>
 4#include <bpf/bpf_tracing.h>
 5#include <bpf/usdt.bpf.h>
 6#include <string.h>
 7
 8struct pt_regs regs;
 9
10char _license[] SEC("license") = "GPL";
11
12int executed = 0;
13int pid;
14
15SEC("uprobe")
16int BPF_UPROBE(test_uprobe)
17{
18	if (bpf_get_current_pid_tgid() >> 32 != pid)
19		return 0;
20
21	executed++;
22	return 0;
23}
24
25SEC("uretprobe")
26int BPF_URETPROBE(test_uretprobe)
27{
28	if (bpf_get_current_pid_tgid() >> 32 != pid)
29		return 0;
30
31	executed++;
32	return 0;
33}
34
35SEC("uprobe.multi")
36int test_uprobe_multi(struct pt_regs *ctx)
37{
38	if (bpf_get_current_pid_tgid() >> 32 != pid)
39		return 0;
40
41	executed++;
42	return 0;
43}
44
45SEC("uretprobe.multi")
46int test_uretprobe_multi(struct pt_regs *ctx)
47{
48	if (bpf_get_current_pid_tgid() >> 32 != pid)
49		return 0;
50
51	executed++;
52	return 0;
53}
54
55SEC("uprobe.session")
56int test_uprobe_session(struct pt_regs *ctx)
57{
58	if (bpf_get_current_pid_tgid() >> 32 != pid)
59		return 0;
60
61	executed++;
62	return 0;
63}
64
65SEC("usdt")
66int test_usdt(struct pt_regs *ctx)
67{
68	if (bpf_get_current_pid_tgid() >> 32 != pid)
69		return 0;
70
71	executed++;
72	return 0;
73}
~/ Read-only file preview.