Libbpf userspace function bpf_map__set_initial_value
Set the initial value of a
Definition
int bpf_map__set_initial_value(struct bpf_map *map, const void *data, size_t size);
Parameters
map
: Pointer to the BPF map.data
: Pointer to the initial value.size
: Size of the initial value.
Return
0
on success, or a negative error in case of failure.
Usage
Libbpf automatically creates array maps for certain ELF sections in which global variables are stored. This function allows you to set the initial value of these maps and arena maps.
This function should be used after creating the map, but before loading the programs that use it.
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome