mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:25:08 +00:00
Kernel: Make VirtualRangeAllocator return KResultOr<VirtualRange>
This achieves two things: - The allocator can report more specific errors - Callers can (and now do) use TRY() :^)
This commit is contained in:
parent
21f7932ae2
commit
f4a9a0d561
9 changed files with 82 additions and 95 deletions
|
@ -1190,13 +1190,10 @@ KResult Thread::make_thread_specific_region(Badge<Process>)
|
|||
if (!process().m_master_tls_region)
|
||||
return KSuccess;
|
||||
|
||||
auto range = process().address_space().allocate_range({}, thread_specific_region_size());
|
||||
if (!range.has_value())
|
||||
return ENOMEM;
|
||||
auto range = TRY(process().address_space().try_allocate_range({}, thread_specific_region_size()));
|
||||
auto* region = TRY(process().address_space().allocate_region(range, "Thread-specific", PROT_READ | PROT_WRITE));
|
||||
|
||||
auto* region = TRY(process().address_space().allocate_region(range.value(), "Thread-specific", PROT_READ | PROT_WRITE));
|
||||
|
||||
m_thread_specific_range = range.value();
|
||||
m_thread_specific_range = range;
|
||||
|
||||
SmapDisabler disabler;
|
||||
auto* thread_specific_data = (ThreadSpecificData*)region->vaddr().offset(align_up_to(process().m_master_tls_size, thread_specific_region_alignment())).as_ptr();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue