mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:47:34 +00:00
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.
This commit is contained in:
parent
b98f537f11
commit
5bc7882b68
3 changed files with 9 additions and 7 deletions
|
@ -188,7 +188,7 @@ enum class NeedsBigProcessLock {
|
|||
S(symlink, NeedsBigProcessLock::No) \
|
||||
S(sync, NeedsBigProcessLock::No) \
|
||||
S(sysconf, NeedsBigProcessLock::No) \
|
||||
S(times, NeedsBigProcessLock::Yes) \
|
||||
S(times, NeedsBigProcessLock::No) \
|
||||
S(umask, NeedsBigProcessLock::No) \
|
||||
S(umount, NeedsBigProcessLock::Yes) \
|
||||
S(uname, NeedsBigProcessLock::No) \
|
||||
|
|
|
@ -465,11 +465,10 @@ public:
|
|||
const TTY* tty() const { return m_tty; }
|
||||
void set_tty(TTY*);
|
||||
|
||||
u32 m_ticks_in_user { 0 };
|
||||
u32 m_ticks_in_kernel { 0 };
|
||||
|
||||
u32 m_ticks_in_user_for_dead_children { 0 };
|
||||
u32 m_ticks_in_kernel_for_dead_children { 0 };
|
||||
clock_t m_ticks_in_user { 0 };
|
||||
clock_t m_ticks_in_kernel { 0 };
|
||||
clock_t m_ticks_in_user_for_dead_children { 0 };
|
||||
clock_t m_ticks_in_kernel_for_dead_children { 0 };
|
||||
|
||||
NonnullRefPtr<Custody> current_directory();
|
||||
RefPtr<Custody> executable();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue