brintos

brintos / linux-shallow public Read only

0
0
Text · 633 B · d41f90e Raw
27 lines · c
1// SPDX-License-Identifier: GPL-2.02/* 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 8char _license[] SEC("license") = "GPL";9 10struct {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 17SEC("tp_btf/sys_enter")18int 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