mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:27:43 +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
|
@ -481,7 +481,7 @@ ErrorOr<void> Process::do_exec(NonnullRefPtr<OpenFileDescription> main_program_d
|
|||
// (For dynamically linked executable) Allocate an FD for passing the main executable to the dynamic loader.
|
||||
Optional<ScopedDescriptionAllocation> main_program_fd_allocation;
|
||||
if (has_interpreter)
|
||||
main_program_fd_allocation = TRY(m_fds.allocate());
|
||||
main_program_fd_allocation = TRY(allocate_fd());
|
||||
|
||||
// We commit to the new executable at this point. There is no turning back!
|
||||
|
||||
|
@ -536,14 +536,16 @@ ErrorOr<void> Process::do_exec(NonnullRefPtr<OpenFileDescription> main_program_d
|
|||
|
||||
clear_futex_queues_on_exec();
|
||||
|
||||
fds().change_each([&](auto& file_description_metadata) {
|
||||
if (file_description_metadata.is_valid() && file_description_metadata.flags() & FD_CLOEXEC)
|
||||
file_description_metadata = {};
|
||||
m_fds.with([&](auto& fds) {
|
||||
fds.change_each([&](auto& file_description_metadata) {
|
||||
if (file_description_metadata.is_valid() && file_description_metadata.flags() & FD_CLOEXEC)
|
||||
file_description_metadata = {};
|
||||
});
|
||||
});
|
||||
|
||||
if (main_program_fd_allocation.has_value()) {
|
||||
main_program_description->set_readable(true);
|
||||
m_fds[main_program_fd_allocation->fd].set(move(main_program_description), FD_CLOEXEC);
|
||||
m_fds.with([&](auto& fds) { fds[main_program_fd_allocation->fd].set(move(main_program_description), FD_CLOEXEC); });
|
||||
}
|
||||
|
||||
new_main_thread = nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue