Merge "Check supported kernel version in V and 25Q2+" into main
This commit is contained in:
commit
d2668178e4
1 changed files with 17 additions and 0 deletions
|
|
@ -70,6 +70,13 @@ static Status checkProgramAccessible(const char* programPath) {
|
|||
return netdutils::status::ok;
|
||||
}
|
||||
|
||||
// Checks if the device is running on release version of Android 25Q2 or newer.
|
||||
static bool isAtLeast25Q2() {
|
||||
return android_get_device_api_level() >= 36 ||
|
||||
(android_get_device_api_level() == 35 &&
|
||||
modules::sdklevel::detail::IsAtLeastPreReleaseCodename("Baklava"));
|
||||
}
|
||||
|
||||
static Status initPrograms(const char* cg2_path) {
|
||||
if (!cg2_path) return Status("cg2_path is NULL");
|
||||
|
||||
|
|
@ -91,6 +98,16 @@ static Status initPrograms(const char* cg2_path) {
|
|||
return Status("U+ platform with cg2_path != /sys/fs/cgroup is unsupported");
|
||||
}
|
||||
|
||||
// V bumps the kernel requirement up to 4.19
|
||||
if (modules::sdklevel::IsAtLeastV() && !bpf::isAtLeastKernelVersion(4, 19, 0)) {
|
||||
return Status("V+ platform with kernel version < 4.19.0 is unsupported");
|
||||
}
|
||||
|
||||
// 25Q2 bumps the kernel requirement up to 5.4
|
||||
if (isAtLeast25Q2() && !bpf::isAtLeastKernelVersion(5, 4, 0)) {
|
||||
return Status("25Q2+ platform with kernel version < 5.4.0 is unsupported");
|
||||
}
|
||||
|
||||
unique_fd cg_fd(open(cg2_path, O_DIRECTORY | O_RDONLY | O_CLOEXEC));
|
||||
if (!cg_fd.ok()) {
|
||||
const int err = errno;
|
||||
|
|
|
|||
Loading…
Reference in a new issue