diff options
author | Luke Wilde <lukew@serenityos.org> | 2022-04-09 18:30:20 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-04-09 21:51:16 +0200 |
commit | 1682b0b6d89c11f5102befd501d6298055ccfebc (patch) | |
tree | 1a4a2f75a4d7b5462e35b9f9863001ec8fa15d91 /Kernel/Process.cpp | |
parent | 343aec2200cb5adb08a46c43d82a4a77c4edef00 (diff) | |
download | serenity-1682b0b6d89c11f5102befd501d6298055ccfebc.zip |
Kernel: Remove big lock from `sys$set_coredump_metadata`
The only requirement for this syscall is to make
Process::m_coredump_properties SpinlockProtected.
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r-- | Kernel/Process.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 1057328ab2..0b60ae622d 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -874,15 +874,18 @@ void Process::set_dumpable(bool dumpable) ErrorOr<void> Process::set_coredump_property(NonnullOwnPtr<KString> key, NonnullOwnPtr<KString> value) { - // Write it into the first available property slot. - for (auto& slot : m_coredump_properties) { - if (slot.key) - continue; - slot.key = move(key); - slot.value = move(value); - return {}; - } - return ENOBUFS; + return m_coredump_properties.with([&](auto& coredump_properties) -> ErrorOr<void> { + // Write it into the first available property slot. + for (auto& slot : coredump_properties) { + if (slot.key) + continue; + slot.key = move(key); + slot.value = move(value); + return {}; + } + + return ENOBUFS; + }); } ErrorOr<void> Process::try_set_coredump_property(StringView key, StringView value) |