Skip to content

Libbpf eBPF macro __uint

v0.0.6

The __uint macros is used to define unsigned integer properties of BTF maps.

Definition

#define __uint(name, val) int (*name)[val]

Usage

This macro is used to encode unsigned integer properties in BTF map definitions. BTF does not have a notion of literal values, we encode them as pointers to arrays of size X, were X is the actual number we want to communicate.

Example

struct {
    __uint(type, BPF_MAP_TYPE_HASH);
    __uint(max_entries, 1024);
    __uint(key_size, sizeof(int));
    __uint(value_size, sizeof(long));
} SEC(".maps") my_map;