linux/tools/testing/selftests/bpf/progs/test_obj_id.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0-only
   2/* Copyright (c) 2017 Facebook
   3 */
   4#include <stddef.h>
   5#include <linux/bpf.h>
   6#include <bpf/bpf_helpers.h>
   7
   8struct {
   9        __uint(type, BPF_MAP_TYPE_ARRAY);
  10        __uint(max_entries, 1);
  11        __type(key, __u32);
  12        __type(value, __u64);
  13} test_map_id SEC(".maps");
  14
  15SEC("raw_tp/sys_enter")
  16int test_obj_id(void *ctx)
  17{
  18        __u32 key = 0;
  19        __u64 *value;
  20
  21        value = bpf_map_lookup_elem(&test_map_id, &key);
  22
  23        return 0;
  24}
  25