1  // SPDX-License-Identifier: GPL-2.0
2  /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */
3  
4  #include "vmlinux.h"
5  #include <bpf/bpf_helpers.h>
6  #include <bpf/bpf_tracing.h>
7  
8  char _license[] SEC("license") = "GPL";
9  
10  struct {
11  	__uint(type, BPF_MAP_TYPE_CGRP_STORAGE);
12  	__uint(map_flags, BPF_F_NO_PREALLOC);
13  	__type(key, int);
14  	__type(value, long);
15  } map_a SEC(".maps");
16  
17  SEC("tp_btf/sys_enter")
BPF_PROG(on_enter,struct pt_regs * regs,long id)18  int BPF_PROG(on_enter, struct pt_regs *regs, long id)
19  {
20  	struct task_struct *task;
21  
22  	task = bpf_get_current_task_btf();
23  	(void)bpf_cgrp_storage_get(&map_a, (struct cgroup *)task, 0,
24  				   BPF_LOCAL_STORAGE_GET_F_CREATE);
25  	return 0;
26  }
27