1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2021 Hengqi Chen */
5 #include <bpf/bpf_helpers.h>
6 #include <bpf/bpf_tracing.h>
8 const volatile pid_t my_pid = 0;
11 SEC("raw_tp/sys_enter")
12 int tailcall_1(void *ctx)
19 __uint(type, BPF_MAP_TYPE_PROG_ARRAY);
20 __uint(max_entries, 2);
21 __uint(key_size, sizeof(__u32));
22 __array(values, int (void *));
23 } prog_array_init SEC(".maps") = {
25 [1] = (void *)&tailcall_1,
29 SEC("raw_tp/sys_enter")
32 pid_t pid = bpf_get_current_pid_tgid() >> 32;
37 bpf_tail_call(ctx, &prog_array_init, 1);