mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
Kernel: Add MADV_GET_VOLATILE for checking the volatile flag
Sometimes you might want to know if a purgeable region is volatile.
This commit is contained in:
@@ -363,6 +363,12 @@ int Process::sys$madvise(void* address, size_t size, int advice)
|
||||
vmobject.set_was_purged(false);
|
||||
return was_purged ? 1 : 0;
|
||||
}
|
||||
if (advice & MADV_GET_VOLATILE) {
|
||||
if (!region->vmobject().is_purgeable())
|
||||
return -EPERM;
|
||||
auto& vmobject = static_cast<PurgeableVMObject&>(region->vmobject());
|
||||
return vmobject.is_volatile() ? 0 : 1;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user