diff options
author | 2024-01-23 18:21:20 -0800 | |
---|---|---|
committer | 2024-01-24 16:21:02 -0800 | |
commit | 05f9cdd55d61cf9c6283fd3dc0edc7cad09bd7fe (patch) | |
tree | beee721bec04ba2a6e3e9a21adfd8183827ca4d3 /tools/lib/bpf/libbpf_internal.h | |
parent | libbpf: Further decouple feature checking logic from bpf_object (diff) | |
download | wireguard-linux-05f9cdd55d61cf9c6283fd3dc0edc7cad09bd7fe.tar.xz wireguard-linux-05f9cdd55d61cf9c6283fd3dc0edc7cad09bd7fe.zip |
libbpf: Move feature detection code into its own file
It's quite a lot of well isolated code, so it seems like a good
candidate to move it out of libbpf.c to reduce its size.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20240124022127.2379740-24-andrii@kernel.org
Diffstat (limited to 'tools/lib/bpf/libbpf_internal.h')
-rw-r--r-- | tools/lib/bpf/libbpf_internal.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h index 622892fc841d..fa25e1232bc8 100644 --- a/tools/lib/bpf/libbpf_internal.h +++ b/tools/lib/bpf/libbpf_internal.h @@ -361,10 +361,20 @@ enum kern_feature_id { __FEAT_CNT, }; -struct kern_feature_cache; +enum kern_feature_result { + FEAT_UNKNOWN = 0, + FEAT_SUPPORTED = 1, + FEAT_MISSING = 2, +}; + +struct kern_feature_cache { + enum kern_feature_result res[__FEAT_CNT]; +}; + bool feat_supported(struct kern_feature_cache *cache, enum kern_feature_id feat_id); bool kernel_supports(const struct bpf_object *obj, enum kern_feature_id feat_id); +int probe_kern_syscall_wrapper(void); int probe_memcg_account(void); int bump_rlimit_memlock(void); @@ -626,4 +636,6 @@ int elf_resolve_syms_offsets(const char *binary_path, int cnt, int elf_resolve_pattern_offsets(const char *binary_path, const char *pattern, unsigned long **poffsets, size_t *pcnt); +int probe_fd(int fd); + #endif /* __LIBBPF_LIBBPF_INTERNAL_H */ |