1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2019 Facebook
4 #include <linux/version.h>
5 #include "bpf_helpers.h"
8 __uint(type
, BPF_MAP_TYPE_ARRAY
);
9 __uint(max_entries
, 1);
12 } info_map
SEC(".maps");
15 __uint(type
, BPF_MAP_TYPE_ARRAY
);
16 __uint(max_entries
, 1);
19 } status_map
SEC(".maps");
21 SEC("send_signal_demo")
22 int bpf_send_signal_test(void *ctx
)
24 __u64
*info_val
, *status_val
;
25 __u32 key
= 0, pid
, sig
;
28 status_val
= bpf_map_lookup_elem(&status_map
, &key
);
29 if (!status_val
|| *status_val
!= 0)
32 info_val
= bpf_map_lookup_elem(&info_map
, &key
);
33 if (!info_val
|| *info_val
== 0)
36 sig
= *info_val
>> 32;
37 pid
= *info_val
& 0xffffFFFF;
39 if ((bpf_get_current_pid_tgid() >> 32) == pid
) {
40 ret
= bpf_send_signal(sig
);
47 char __license
[] SEC("license") = "GPL";