staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / test_send_signal_kern.c
blob0e6be01157e682d91bc0da1e16bc5bdfef6912f8
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2019 Facebook
3 #include <linux/bpf.h>
4 #include <linux/version.h>
5 #include "bpf_helpers.h"
7 struct {
8 __uint(type, BPF_MAP_TYPE_ARRAY);
9 __uint(max_entries, 1);
10 __type(key, __u32);
11 __type(value, __u64);
12 } info_map SEC(".maps");
14 struct {
15 __uint(type, BPF_MAP_TYPE_ARRAY);
16 __uint(max_entries, 1);
17 __type(key, __u32);
18 __type(value, __u64);
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;
26 int ret;
28 status_val = bpf_map_lookup_elem(&status_map, &key);
29 if (!status_val || *status_val != 0)
30 return 0;
32 info_val = bpf_map_lookup_elem(&info_map, &key);
33 if (!info_val || *info_val == 0)
34 return 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);
41 if (ret == 0)
42 *status_val = 1;
45 return 0;
47 char __license[] SEC("license") = "GPL";