github.com/cilium/ebpf@v0.10.0/testdata/common.h (about) 1 #pragma once 2 3 typedef unsigned int uint32_t; 4 typedef 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 */ 22 struct 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 30 static void *(*map_lookup_elem)(const void *map, const void *key) = (void *)1; 31 32 static long (*map_update_elem)(const void *map, const void *key, const void *value, uint64_t flags) = (void *)2; 33 34 static long (*trace_printk)(const char *fmt, uint32_t fmt_size, ...) = (void *)6; 35 36 static long (*tail_call)(void *ctx, void *prog_array_map, uint32_t index) = (void *)12; 37 38 static int (*perf_event_output)(const void *ctx, const void *map, uint64_t index, const void *data, uint64_t size) = (void *)25; 39 40 static uint32_t (*get_smp_processor_id)(void) = (void *)8; 41 42 static long (*for_each_map_elem)(const void *map, void *callback_fn, void *callback_ctx, uint64_t flags) = (void *)164;