mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:17:35 +00:00
Kernel: Return EEXIST in VirtualRangeAllocator::try_allocate_specific()
This error only ever gets propagated to the userspace if MAP_FIXED_NOREPLACE is requested, as MAP_FIXED unmaps intersecting ranges beforehand, and non-fixed mmap() calls will just fall back to allocating anywhere. Linux specifies MAP_FIXED_NOREPLACE to return EEXIST when it can't allocate, we now match that behavior.
This commit is contained in:
parent
143dbba562
commit
4195a7ef4b
1 changed files with 2 additions and 2 deletions
|
@ -146,9 +146,9 @@ ErrorOr<VirtualRange> VirtualRangeAllocator::try_allocate_specific(VirtualAddres
|
|||
SpinlockLocker lock(m_lock);
|
||||
auto available_range = m_available_ranges.find_largest_not_above(base.get());
|
||||
if (!available_range)
|
||||
return ENOMEM;
|
||||
return EEXIST;
|
||||
if (!available_range->contains(allocated_range))
|
||||
return ENOMEM;
|
||||
return EEXIST;
|
||||
if (*available_range == allocated_range) {
|
||||
m_available_ranges.remove(available_range->base().get());
|
||||
return allocated_range;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue