mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-22 05:16:12 +03:00
allocator: Ignore madvise ENOSYS error
Support kernels built without CONFIG_ADVISE_SYSCALLS on small embedded devices.
This commit is contained in:
parent
81e86afa3e
commit
e998809fd2
@ -394,7 +394,12 @@ void DiscardSystemPagesInternal(uintptr_t address, size_t length) {
|
||||
// performance benefits unclear.
|
||||
//
|
||||
// Therefore, we just do the simple thing: MADV_DONTNEED.
|
||||
PA_PCHECK(0 == madvise(ptr, length, MADV_DONTNEED));
|
||||
int ret = madvise(ptr, length, MADV_DONTNEED);
|
||||
if (ret && errno == ENOSYS) {
|
||||
// Ignores when the kernel is built without CONFIG_ADVISE_SYSCALLS
|
||||
return;
|
||||
}
|
||||
PA_PCHECK(ret == 0);
|
||||
#endif // BUILDFLAG(IS_APPLE)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user