1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 23:25:08 +00:00

Kernel: Implement basic support for sys$mmap() with MAP_PRIVATE

You can now mmap a file as private and writable, and the changes you
make will only be visible to you.

This works because internally a MAP_PRIVATE region is backed by a
unique PrivateInodeVMObject instead of using the globally shared
SharedInodeVMObject like we always did before. :^)

Fixes #1045.
This commit is contained in:
Andreas Kling 2020-02-28 20:47:27 +01:00
parent aa1e209845
commit 8fbdda5a2d
11 changed files with 45 additions and 31 deletions

View file

@ -281,10 +281,10 @@ InodeMetadata FileDescription::metadata() const
return {};
}
KResultOr<Region*> FileDescription::mmap(Process& process, VirtualAddress vaddr, size_t offset, size_t size, int prot)
KResultOr<Region*> FileDescription::mmap(Process& process, VirtualAddress vaddr, size_t offset, size_t size, int prot, bool shared)
{
LOCKER(m_lock);
return m_file->mmap(process, *this, vaddr, offset, size, prot);
return m_file->mmap(process, *this, vaddr, offset, size, prot, shared);
}
KResult FileDescription::truncate(u64 length)