mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
Kernel: Automatically sync shared file mappings when unmapped
To make sure we don't lose changes, shared file mappings will now be fully synced when they are unmapped, whether explicitly or implicitly (by the program exiting/crashing/etc.) This can incur a lot of work, since we don't keep track of dirty pages, but that's something we can optimize down the road. :^)
This commit is contained in:
parent
af6358e1e1
commit
1f894cee59
1 changed files with 5 additions and 0 deletions
|
@ -38,6 +38,11 @@ Region::Region(VirtualRange const& range, NonnullRefPtr<VMObject> vmobject, size
|
|||
|
||||
Region::~Region()
|
||||
{
|
||||
if (is_writable() && vmobject().is_shared_inode()) {
|
||||
// FIXME: This is very aggressive. Find a way to do less work!
|
||||
(void)static_cast<SharedInodeVMObject&>(vmobject()).sync();
|
||||
}
|
||||
|
||||
m_vmobject->remove_region(*this);
|
||||
|
||||
MM.unregister_region(*this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue