0001
0002
0003 #include "vmlinux.h"
0004 #include <bpf/bpf_helpers.h>
0005
0006 __u32 set_pid = 0;
0007 __u64 set_key = 0;
0008 __u64 set_value = 0;
0009
0010 struct {
0011 __uint(type, BPF_MAP_TYPE_HASH);
0012 __uint(max_entries, 2);
0013 __type(key, __u64);
0014 __type(value, __u64);
0015 } hash_map SEC(".maps");
0016
0017 SEC("tp/syscalls/sys_enter_getpgid")
0018 int bpf_lookup_and_delete_test(const void *ctx)
0019 {
0020 if (set_pid == bpf_get_current_pid_tgid() >> 32)
0021 bpf_map_update_elem(&hash_map, &set_key, &set_value, BPF_NOEXIST);
0022
0023 return 0;
0024 }
0025
0026 char _license[] SEC("license") = "GPL";