mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:35:06 +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:
parent
1ad5568759
commit
487f9b373b
3 changed files with 8 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue