mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-30 23:12:56 +00:00
Kernel: Make AddressSpace::add_region() return KResultOr<Region*>
This allows us to use TRY() in a few places.
This commit is contained in:
parent
062cc804e7
commit
a994f11f10
Notes:
sideshowbarker
2024-07-18 04:38:46 +09:00
Author: https://github.com/awesomekling
Commit: a994f11f10
3 changed files with 9 additions and 20 deletions
|
@ -94,12 +94,7 @@ KResultOr<FlatPtr> Process::sys$fork(RegisterState& regs)
|
|||
for (auto& region : address_space().regions()) {
|
||||
dbgln_if(FORK_DEBUG, "fork: cloning Region({}) '{}' @ {}", region, region->name(), region->vaddr());
|
||||
auto region_clone = TRY(region->try_clone());
|
||||
auto* child_region = child->address_space().add_region(move(region_clone));
|
||||
if (!child_region) {
|
||||
dbgln("fork: Cannot add region, insufficient memory");
|
||||
// TODO: tear down new process?
|
||||
return ENOMEM;
|
||||
}
|
||||
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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue