1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:07:46 +00:00

Implement basic support for times().

The kernel now bills processes for time spent in kernelspace and userspace
separately. The accounting is forwarded to the parent process in reap().

This makes the "time" builtin in bash work.
This commit is contained in:
Andreas Kling 2018-12-03 01:12:26 +01:00
parent 4bc87dc7b9
commit e7cc08226f
10 changed files with 50 additions and 7 deletions

View file

@ -172,6 +172,7 @@ public:
int sys$fcntl(int fd, int cmd, dword extra_arg);
int sys$ioctl(int fd, unsigned request, unsigned arg);
int sys$mkdir(const char* pathname, mode_t mode);
Unix::clock_t sys$times(Unix::tms*);
static void initialize();
@ -187,6 +188,12 @@ public:
void did_schedule() { ++m_timesScheduled; }
dword timesScheduled() const { return m_timesScheduled; }
dword m_ticks_in_user { 0 };
dword m_ticks_in_kernel { 0 };
dword m_ticks_in_user_for_dead_children { 0 };
dword m_ticks_in_kernel_for_dead_children { 0 };
pid_t waitee_pid() const { return m_waitee_pid; }
dword framePtr() const { return m_tss.ebp; }