Kernel: Use Vector::unstable_remove() in a couple of places

This commit is contained in:
Andreas Kling 2020-01-15 19:25:27 +01:00
parent 575664cda3
commit e23536d682
Notes: sideshowbarker 2024-07-19 10:02:54 +09:00
3 changed files with 5 additions and 5 deletions

View file

@ -73,7 +73,7 @@ KResult VFS::unmount(InodeIdentifier guest_inode_id)
return result;
}
dbg() << "VFS: found fs " << mount.guest_fs().fsid() << " at mount index " << i << "! Unmounting...";
m_mounts.remove(i);
m_mounts.unstable_remove(i);
return KSuccess;
}
}

View file

@ -185,7 +185,7 @@ bool Process::deallocate_region(Region& region)
InterruptDisabler disabler;
for (int i = 0; i < m_regions.size(); ++i) {
if (&m_regions[i] == &region) {
m_regions.remove(i);
m_regions.unstable_remove(i);
return true;
}
}
@ -757,7 +757,7 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
prot |= PROT_READ;
if (is_writable)
prot |= PROT_WRITE;
if (auto* region = allocate_region(vaddr.offset(totally_random_offset), size, String(name), prot))
if (auto* region = allocate_region(vaddr.offset(totally_random_offset), size, String(name), prot))
return region->vaddr().as_ptr();
return nullptr;
};

View file

@ -99,7 +99,7 @@ void SharedBuffer::deref_for_process(Process& process)
dbgprintf("Releasing shared buffer reference on %d of size %d by PID %d\n", m_shared_buffer_id, size(), process.pid());
#endif
process.deallocate_region(*ref.region);
m_refs.remove(i);
m_refs.unstable_remove(i);
#ifdef SHARED_BUFFER_DEBUG
dbgprintf("Released shared buffer reference on %d of size %d by PID %d\n", m_shared_buffer_id, size(), process.pid());
#endif
@ -124,7 +124,7 @@ void SharedBuffer::disown(pid_t pid)
dbgprintf("Disowning shared buffer %d of size %d by PID %d\n", m_shared_buffer_id, size(), pid);
#endif
m_total_refs -= ref.count;
m_refs.remove(i);
m_refs.unstable_remove(i);
#ifdef SHARED_BUFFER_DEBUG
dbgprintf("Disowned shared buffer %d of size %d by PID %d\n", m_shared_buffer_id, size(), pid);
#endif