Files
android/tools/testing/selftests/bpf/test_map_init.c
T
threeeye bc1d038eac REVVL 6 Pro kernel bring-up: full working tree snapshot (2026-09-12)
Squashed backup commit (no shallow-clone history issues) of
xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream
commit 9eece662e) plus all fixes applied to get everpal_defconfig building
clean against a modern (GCC 15.2.0) toolchain -- see the previous commit
message on the lineage-23.2 branch (also in this repo history is not
available here since this is a squashed snapshot; full incremental history
lives in the local DL380 checkout and the upstream GitHub remote).

Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
2026-09-12 13:36:46 +00:00

34 lines
752 B
C

// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Tessares SA <http://www.tessares.net> */
#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
__u64 inKey = 0;
__u64 inValue = 0;
__u32 inPid = 0;
struct {
__uint(type, BPF_MAP_TYPE_PERCPU_HASH);
__uint(max_entries, 2);
__type(key, __u64);
__type(value, __u64);
} hashmap1 SEC(".maps");
SEC("tp/syscalls/sys_enter_getpgid")
int sysenter_getpgid(const void *ctx)
{
/* Just do it for once, when called from our own test prog. This
* ensures the map value is only updated for a single CPU.
*/
int cur_pid = bpf_get_current_pid_tgid() >> 32;
if (cur_pid == inPid)
bpf_map_update_elem(&hashmap1, &inKey, &inValue, BPF_NOEXIST);
return 0;
}
char _license[] SEC("license") = "GPL";