libbpf: Add bpf_obj_get_opts()
authorJoe Burton <jevburton@google.com>
Fri, 29 Jul 2022 20:27:27 +0000 (20:27 +0000)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 29 Jul 2022 22:30:06 +0000 (15:30 -0700)
commit395fc4fa33e98944384d0d6c8b3ecd9fb4b50d00
treeca8f08c202735460a66276f9f461a3352689a1ae
parentd0b80a9edb1a029ff913e81b47540e57ad034329
libbpf: Add bpf_obj_get_opts()

Add an extensible variant of bpf_obj_get() capable of setting the
`file_flags` parameter.

This parameter is needed to enable unprivileged access to BPF maps.
Without a method like this, users must manually make the syscall.

Signed-off-by: Joe Burton <jevburton@google.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220729202727.3311806-1-jevburton.kernel@gmail.com
tools/lib/bpf/bpf.c
tools/lib/bpf/bpf.h
tools/lib/bpf/libbpf.map