1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include "vmlinux.h"
4 #include <bpf/bpf_helpers.h>
5 
6 __u32 set_pid = 0;
7 __u64 set_key = 0;
8 __u64 set_value = 0;
9 
10 struct {
11 	__uint(type, BPF_MAP_TYPE_HASH);
12 	__uint(max_entries, 2);
13 	__type(key, __u64);
14 	__type(value, __u64);
15 } hash_map SEC(".maps");
16 
17 SEC("tp/syscalls/sys_enter_getpgid")
bpf_lookup_and_delete_test(const void * ctx)18 int bpf_lookup_and_delete_test(const void *ctx)
19 {
20 	if (set_pid == bpf_get_current_pid_tgid() >> 32)
21 		bpf_map_update_elem(&hash_map, &set_key, &set_value, BPF_NOEXIST);
22 
23 	return 0;
24 }
25 
26 char _license[] SEC("license") = "GPL";
27