linux-zen-desktop/tools/testing/selftests/bpf/progs/cgrp_ls_negative.c

27 lines
633 B
C
Raw Normal View History

2023-08-30 17:31:07 +02:00
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */
#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
char _license[] SEC("license") = "GPL";
struct {
__uint(type, BPF_MAP_TYPE_CGRP_STORAGE);
__uint(map_flags, BPF_F_NO_PREALLOC);
__type(key, int);
__type(value, long);
} map_a SEC(".maps");
SEC("tp_btf/sys_enter")
int BPF_PROG(on_enter, struct pt_regs *regs, long id)
{
struct task_struct *task;
task = bpf_get_current_task_btf();
(void)bpf_cgrp_storage_get(&map_a, (struct cgroup *)task, 0,
BPF_LOCAL_STORAGE_GET_F_CREATE);
return 0;
}