libbpf: Introduce bpf_link_get_fd_by_id_opts()
authorRoberto Sassu <roberto.sassu@huawei.com>
Thu, 6 Oct 2022 11:07:35 +0000 (13:07 +0200)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 10 Oct 2022 23:49:20 +0000 (16:49 -0700)
commit97c8f9dd5db839f2387785ee936d0a5b257b31d3
tree7187d54b1216e04a58ee53bbbab571f6be527a5c
parent2ce7cbf2ba71bb03542af739af80e86b6855ae48
libbpf: Introduce bpf_link_get_fd_by_id_opts()

Introduce bpf_link_get_fd_by_id_opts(), for symmetry with
bpf_map_get_fd_by_id_opts(), to let the caller pass the newly introduced
data structure bpf_get_fd_by_id_opts. Keep the existing
bpf_link_get_fd_by_id(), and call bpf_link_get_fd_by_id_opts() with NULL as
opts argument, to prevent setting open_flags.

Currently, the kernel does not support non-zero open_flags for
bpf_link_get_fd_by_id_opts(), and a call with them will result in an error
returned by the bpf() system call. The caller should always pass zero
open_flags.

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20221006110736.84253-6-roberto.sassu@huaweicloud.com
tools/lib/bpf/bpf.c
tools/lib/bpf/bpf.h
tools/lib/bpf/libbpf.map