summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/fork.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-01-29 01:22:28 +0100
committerAndreas Kling <kling@serenityos.org>2022-01-29 02:17:06 +0100
commit8ebec2938cd43d16655404ba86b20c73bfb724a7 (patch)
tree66af99284c69870ffc150c4137dedf8811147f3a /Kernel/Syscalls/fork.cpp
parent93e90e16c3857badd86991b8dcca4c5ebc3ed5a7 (diff)
downloadserenity-8ebec2938cd43d16655404ba86b20c73bfb724a7.zip
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.
Diffstat (limited to 'Kernel/Syscalls/fork.cpp')
-rw-r--r--Kernel/Syscalls/fork.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Kernel/Syscalls/fork.cpp b/Kernel/Syscalls/fork.cpp
index 711f0d4947..8ae899b168 100644
--- a/Kernel/Syscalls/fork.cpp
+++ b/Kernel/Syscalls/fork.cpp
@@ -23,7 +23,11 @@ ErrorOr<FlatPtr> Process::sys$fork(RegisterState& regs)
child->m_veil_state = m_veil_state;
child->m_unveiled_paths = m_unveiled_paths.deep_copy();
- TRY(child->m_fds.try_clone(m_fds));
+ TRY(child->m_fds.with([&](auto& child_fds) {
+ return m_fds.with([&](auto& parent_fds) {
+ return child_fds.try_clone(parent_fds);
+ });
+ }));
child->m_pg = m_pg;