1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:18:12 +00:00

Kernel: Make Memory::Region::map() return KResult

..and use TRY() at the call sites to propagate errors. :^)
This commit is contained in:
Andreas Kling 2021-09-06 12:52:23 +02:00
parent 7981422500
commit e3a716ceff
6 changed files with 17 additions and 25 deletions

View file

@ -95,8 +95,7 @@ KResultOr<FlatPtr> Process::sys$fork(RegisterState& regs)
dbgln_if(FORK_DEBUG, "fork: cloning Region({}) '{}' @ {}", region, region->name(), region->vaddr());
auto region_clone = TRY(region->try_clone());
auto* child_region = TRY(child->address_space().add_region(move(region_clone)));
if (!child_region->map(child->address_space().page_directory(), Memory::ShouldFlushTLB::No))
return ENOMEM;
TRY(child_region->map(child->address_space().page_directory(), Memory::ShouldFlushTLB::No));
if (region == m_master_tls_region.unsafe_ptr())
child->m_master_tls_region = child_region;