diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-07-25 18:23:10 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-07-25 20:12:14 +0200 |
commit | 3db15a3f80f193826e144b1944727a65c13340fe (patch) | |
tree | f6eef1e163de6a5dccdc1067300c5fce333d722b /kern/task.c | |
parent | bb23879791cf015f17cb50b6443bac44b1cfbc72 (diff) | |
download | gnumach-3db15a3f80f193826e144b1944727a65c13340fe.tar.gz gnumach-3db15a3f80f193826e144b1944727a65c13340fe.tar.bz2 gnumach-3db15a3f80f193826e144b1944727a65c13340fe.zip |
kern: add boot-time clock, use it for time stamps
The kernel keeps track of task and thread creation times by saving a
time stamp. Previously, the real-time clock was used for this. When
the real-time clock is changed, however, the reference frame for the
time stamps is lost. This surfaced in Hurd systems reporting
spuriously long uptimes.
Fix this by creating a boot-time clock and use it as reference frame
for the time stamps.
* kern/mach_clock.c (clock_boottime_offset): Create clock by keeping
track of the offset from the real-time.
(clock_boottime_update): New function.
(record_time_stamp): Use the boot-time clock for time stamps.
(read_time_stamp): New function to convert it back to real-time.
(host_set_time): Call `clock_boottime_update'.
* kern/mach_clock.h (record_time_stamp): Amend comment.
(read_time_stamp): New declaration.
* kern/task.c (task_info): Use `read_time_stamp'.
* kern/thread.c (thread_info): Likewise.
Diffstat (limited to 'kern/task.c')
-rw-r--r-- | kern/task.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kern/task.c b/kern/task.c index b384347f..9a3d8482 100644 --- a/kern/task.c +++ b/kern/task.c @@ -783,7 +783,8 @@ kern_return_t task_info( = task->total_system_time.seconds; basic_info->system_time.microseconds = task->total_system_time.microseconds; - basic_info->creation_time = task->creation_time; + read_time_stamp(&task->creation_time, + &basic_info->creation_time); task_unlock(task); if (*task_info_count > TASK_BASIC_INFO_COUNT) |