commit | 0ce7758487675d19a2acb9d7efe684f049375d5c | [log] [tgz] |
---|---|---|
author | Maciej Żenczykowski <maze@google.com> | Mon Jun 20 18:11:03 2022 -0700 |
committer | Maciej Żenczykowski <maze@google.com> | Thu Jun 23 13:20:39 2022 +0000 |
tree | a5c159fbfc1ca48fb1722c05463c4b1595b01f5f | |
parent | 7e538299bb6b9ef9f927b2dad5662dd2fd41b9fa [diff] |
add more comments about bpfGetFd... and kernel version compatibility Per request on: https://googleplex-android-review.googlesource.com/c/platform/frameworks/libs/net/+/18992756 Test: N/A Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I853d177623dc64fdac70ddefde3e0cc65d6b2c9a
diff --git a/staticlibs/native/bpf_syscall_wrappers/include/BpfSyscallWrappers.h b/staticlibs/native/bpf_syscall_wrappers/include/BpfSyscallWrappers.h index 4b29c44..d5b7670 100644 --- a/staticlibs/native/bpf_syscall_wrappers/include/BpfSyscallWrappers.h +++ b/staticlibs/native/bpf_syscall_wrappers/include/BpfSyscallWrappers.h
@@ -150,8 +150,12 @@ }); } -// requires 4.14+ kernel - +// BPF_OBJ_GET_INFO_BY_FD requires 4.14+ kernel +// +// Note: some fields are only defined in newer kernels (ie. the map_info struct grows +// over time), so we need to check that the field we're interested in is actually +// supported/returned by the running kernel. We do this by checking it is fully +// within the bounds of the struct size as reported by the kernel. #define DEFINE_BPF_GET_FD_INFO(NAME, FIELD) \ inline int bpfGetFd ## NAME(const BPF_FD_TYPE map_fd) { \ struct bpf_map_info map_info = {}; \