2019-05-28 10:10:09 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2017-06-05 12:15:53 -07:00
|
|
|
/* Copyright (c) 2017 Facebook
|
|
|
|
*/
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <linux/bpf.h>
|
2020-01-20 14:06:45 +01:00
|
|
|
#include <bpf/bpf_helpers.h>
|
2017-06-05 12:15:53 -07:00
|
|
|
|
2019-07-05 08:50:12 -07:00
|
|
|
struct {
|
|
|
|
__uint(type, BPF_MAP_TYPE_ARRAY);
|
|
|
|
__uint(max_entries, 1);
|
|
|
|
__type(key, __u32);
|
|
|
|
__type(value, __u64);
|
|
|
|
} test_map_id SEC(".maps");
|
2017-06-05 12:15:53 -07:00
|
|
|
|
2020-04-28 17:16:10 -07:00
|
|
|
SEC("raw_tp/sys_enter")
|
|
|
|
int test_obj_id(void *ctx)
|
2017-06-05 12:15:53 -07:00
|
|
|
{
|
|
|
|
__u32 key = 0;
|
|
|
|
__u64 *value;
|
|
|
|
|
|
|
|
value = bpf_map_lookup_elem(&test_map_id, &key);
|
|
|
|
|
2020-04-28 17:16:10 -07:00
|
|
|
return 0;
|
2017-06-05 12:15:53 -07:00
|
|
|
}
|