OSDN Git Service

libbpf: Factor out common logic of testing and closing FD
authorAndrii Nakryiko <andriin@fb.com>
Tue, 18 Aug 2020 21:33:52 +0000 (14:33 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 19 Aug 2020 00:16:15 +0000 (17:16 -0700)
commitbb180fb2401dfed0ba85699064e60d62af351ff9
tree0c6ba401827dad65fc08dddd000da2ff60e138d1
parent47b6cb4d0add454859f386337e6079e01ac7db8f
libbpf: Factor out common logic of testing and closing FD

Factor out common piece of logic that detects support for a feature based on
successfully created FD. Also take care of closing FD, if it was created.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200818213356.2629020-4-andriin@fb.com
tools/lib/bpf/libbpf.c