Libbpf userspace function bpf_map__reuse_fd
Let a bpf_map
reuse a file descriptor.
Definition
int bpf_map__reuse_fd(struct bpf_map *map, int fd);
Parameters
map
: Pointer to thebpf_map
object.fd
: File descriptor to reuse.
Return
0
on success, a negative error code on failure.
Usage
This function assigns an existing file descriptor to a bpf_map
object. When a program references this map, it will use the file descriptor provided by the user instead of creating a new one. If the map is already used by other programs, it will cause the map to be shared.
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome