Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /* Copyright (c) 2017 Facebook
0003  */
0004 #include <stddef.h>
0005 #include <linux/bpf.h>
0006 #include <bpf/bpf_helpers.h>
0007 
0008 struct {
0009     __uint(type, BPF_MAP_TYPE_ARRAY);
0010     __uint(max_entries, 1);
0011     __type(key, __u32);
0012     __type(value, __u64);
0013 } test_map_id SEC(".maps");
0014 
0015 SEC("raw_tp/sys_enter")
0016 int test_obj_id(void *ctx)
0017 {
0018     __u32 key = 0;
0019     __u64 *value;
0020 
0021     value = bpf_map_lookup_elem(&test_map_id, &key);
0022 
0023     return 0;
0024 }