mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
Kernel: Convert process file descriptor table to a SpinlockProtected
Instead of manually locking in the various member functions of Process::OpenFileDescriptions, simply wrap it in a SpinlockProtected.
This commit is contained in:
parent
93e90e16c3
commit
8ebec2938c
30 changed files with 257 additions and 190 deletions
|
@ -25,7 +25,7 @@ ErrorOr<FlatPtr> Process::sys$anon_create(size_t size, int options)
|
|||
if (size > NumericLimits<ssize_t>::max())
|
||||
return EINVAL;
|
||||
|
||||
auto new_fd = TRY(m_fds.allocate());
|
||||
auto new_fd = TRY(allocate_fd());
|
||||
auto vmobject = TRY(Memory::AnonymousVMObject::try_create_purgeable_with_size(size, AllocationStrategy::Reserve));
|
||||
auto anon_file = TRY(AnonymousFile::try_create(move(vmobject)));
|
||||
auto description = TRY(OpenFileDescription::try_create(move(anon_file)));
|
||||
|
@ -37,7 +37,7 @@ ErrorOr<FlatPtr> Process::sys$anon_create(size_t size, int options)
|
|||
if (options & O_CLOEXEC)
|
||||
fd_flags |= FD_CLOEXEC;
|
||||
|
||||
m_fds[new_fd.fd].set(move(description), fd_flags);
|
||||
m_fds.with([&](auto& fds) { fds[new_fd.fd].set(move(description), fd_flags); });
|
||||
return new_fd.fd;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue