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 | #include "bpf_misc.h" |
8 | |
9 | struct { |
10 | __uint(type, BPF_MAP_TYPE_ARRAY); |
11 | __uint(max_entries, 1); |
12 | __type(key, __u32); |
13 | __type(value, __u64); |
14 | } test_map_id SEC(".maps" ); |
15 | |
16 | SEC("raw_tp/sys_enter" ) |
17 | int test_obj_id(void *ctx) |
18 | { |
19 | __u32 key = 0; |
20 | __u64 *value; |
21 | |
22 | value = bpf_map_lookup_elem(&test_map_id, &key); |
23 | __sink(value); |
24 | |
25 | return 0; |
26 | } |
27 | |