summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-04-03 17:29:14 +0200
committerAndreas Kling <kling@serenityos.org>2023-04-04 10:33:42 +0200
commit5bc7882b6877240accc29854203645f79a4e78a6 (patch)
tree503d8725ebae56f65d04880b27c66ca207440338 /Kernel/Syscalls
parentb98f537f117b341788023ab82e0c11ca9ae29a57 (diff)
downloadserenity-5bc7882b6877240accc29854203645f79a4e78a6.zip
Kernel: Make sys$times not use the big lock
...and also make the Process tick counters clock_t instead of u32. It seems harmless to get interrupted in the middle of reading these counters and reporting slightly fewer ticks in some category.
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r--Kernel/Syscalls/times.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Kernel/Syscalls/times.cpp b/Kernel/Syscalls/times.cpp
index 90993bf054..8c8858896a 100644
--- a/Kernel/Syscalls/times.cpp
+++ b/Kernel/Syscalls/times.cpp
@@ -11,8 +11,11 @@ namespace Kernel {
ErrorOr<FlatPtr> Process::sys$times(Userspace<tms*> user_times)
{
- VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
+ VERIFY_NO_PROCESS_BIG_LOCK(this);
TRY(require_promise(Pledge::stdio));
+
+ // There's no lock here, as it seems harmless to report intermediate values
+ // as long as each individual counter is intact.
tms times = {};
times.tms_utime = m_ticks_in_user;
times.tms_stime = m_ticks_in_kernel;