mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
Kernel+LibC: Add minherit() and MAP_INHERIT_ZERO
This patch adds the minherit() syscall originally invented by OpenBSD. Only the MAP_INHERIT_ZERO mode is supported for now. If set on an mmap region, that region will be zeroed out on fork().
This commit is contained in:
parent
dd00175ae2
commit
c19b56dc99
8 changed files with 58 additions and 1 deletions
|
@ -68,6 +68,16 @@ NonnullOwnPtr<Region> Region::clone()
|
|||
{
|
||||
ASSERT(Process::current);
|
||||
|
||||
if (m_inherit_mode == InheritMode::ZeroedOnFork) {
|
||||
ASSERT(m_mmap);
|
||||
ASSERT(!m_shared);
|
||||
ASSERT(vmobject().is_anonymous());
|
||||
auto zeroed_region = Region::create_user_accessible(m_range, AnonymousVMObject::create_with_size(size()), 0, m_name, m_access);
|
||||
zeroed_region->set_mmap(m_mmap);
|
||||
zeroed_region->set_inherit_mode(m_inherit_mode);
|
||||
return zeroed_region;
|
||||
}
|
||||
|
||||
if (m_shared) {
|
||||
ASSERT(!m_stack);
|
||||
#ifdef MM_DEBUG
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue