1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2019 Facebook
4 #include <linux/version.h>
5 #include <bpf/bpf_helpers.h>
7 __u32 sig
= 0, pid
= 0, status
= 0, signal_thread
= 0;
9 static __always_inline
int bpf_send_signal_test(void *ctx
)
13 if (status
!= 0 || sig
== 0 || pid
== 0)
16 if ((bpf_get_current_pid_tgid() >> 32) == pid
) {
18 ret
= bpf_send_signal_thread(sig
);
20 ret
= bpf_send_signal(sig
);
28 SEC("tracepoint/syscalls/sys_enter_nanosleep")
29 int send_signal_tp(void *ctx
)
31 return bpf_send_signal_test(ctx
);
34 SEC("tracepoint/sched/sched_switch")
35 int send_signal_tp_sched(void *ctx
)
37 return bpf_send_signal_test(ctx
);
41 int send_signal_perf(void *ctx
)
43 return bpf_send_signal_test(ctx
);
46 char __license
[] SEC("license") = "GPL";