...
1#pragma once
2
3typedef unsigned int uint32_t;
4typedef unsigned long uint64_t;
5
6#define __section(NAME) __attribute__((section(NAME), used))
7#define __uint(name, val) int(*name)[val]
8#define __type(name, val) typeof(val) *name
9#define __array(name, val) typeof(val) *name[]
10
11#define BPF_MAP_TYPE_HASH (1)
12#define BPF_MAP_TYPE_ARRAY (2)
13#define BPF_MAP_TYPE_PROG_ARRAY (3)
14#define BPF_MAP_TYPE_PERF_EVENT_ARRAY (4)
15#define BPF_MAP_TYPE_ARRAY_OF_MAPS (12)
16#define BPF_MAP_TYPE_HASH_OF_MAPS (13)
17
18#define BPF_F_NO_PREALLOC (1U << 0)
19#define BPF_F_CURRENT_CPU (0xffffffffULL)
20
21/* From tools/lib/bpf/libbpf.h */
22struct bpf_map_def {
23 unsigned int type;
24 unsigned int key_size;
25 unsigned int value_size;
26 unsigned int max_entries;
27 unsigned int map_flags;
28};
29
30static void *(*map_lookup_elem)(const void *map, const void *key) = (void *)1;
31
32static long (*map_update_elem)(const void *map, const void *key, const void *value, uint64_t flags) = (void *)2;
33
34static long (*trace_printk)(const char *fmt, uint32_t fmt_size, ...) = (void *)6;
35
36static long (*tail_call)(void *ctx, void *prog_array_map, uint32_t index) = (void *)12;
37
38static int (*perf_event_output)(const void *ctx, const void *map, uint64_t index, const void *data, uint64_t size) = (void *)25;
39
40static uint32_t (*get_smp_processor_id)(void) = (void *)8;
41
42static long (*for_each_map_elem)(const void *map, void *callback_fn, void *callback_ctx, uint64_t flags) = (void *)164;
View as plain text