Linux Audio

Check our new training course

Loading...
v6.13.7
 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
 9struct {
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
16SEC("raw_tp/sys_enter")
17int 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}
v5.14.15
 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}