diff options
author | Andreas Kling <kling@serenityos.org> | 2022-01-29 01:29:07 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-29 02:17:09 +0100 |
commit | b56646e2936c98a9b9ff89adbdd2e437ce218d92 (patch) | |
tree | 054666f9715fa1d05213e81c316ee18df8b398d5 /Kernel/Syscalls/dup2.cpp | |
parent | 8ebec2938cd43d16655404ba86b20c73bfb724a7 (diff) | |
download | serenity-b56646e2936c98a9b9ff89adbdd2e437ce218d92.zip |
Kernel: Switch process file descriptor table from spinlock to mutex
There's no reason for this to use a spinlock. Instead, let's allow
threads to block if someone else is using the descriptor table.
Diffstat (limited to 'Kernel/Syscalls/dup2.cpp')
-rw-r--r-- | Kernel/Syscalls/dup2.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Syscalls/dup2.cpp b/Kernel/Syscalls/dup2.cpp index 74273b56f0..9ddf754934 100644 --- a/Kernel/Syscalls/dup2.cpp +++ b/Kernel/Syscalls/dup2.cpp @@ -13,7 +13,7 @@ ErrorOr<FlatPtr> Process::sys$dup2(int old_fd, int new_fd) { VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this); TRY(require_promise(Pledge::stdio)); - return m_fds.with([&](auto& fds) -> ErrorOr<FlatPtr> { + return m_fds.with_exclusive([&](auto& fds) -> ErrorOr<FlatPtr> { auto description = TRY(fds.open_file_description(old_fd)); if (old_fd == new_fd) return new_fd; |