diff options
author | Thomas Bushnell <thomas@gnu.org> | 1997-08-20 20:31:38 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1997-08-20 20:31:38 +0000 |
commit | 1ed9c11c8bac06eee70182600c872f24552e8dd4 (patch) | |
tree | 37ad773785169d6f5ce51000ff58fad81bf95842 /kern/thread.c | |
parent | 4c4451c49c52b33f1714f3dd61c055cc84a91a8e (diff) | |
download | gnumach-1ed9c11c8bac06eee70182600c872f24552e8dd4.tar.gz gnumach-1ed9c11c8bac06eee70182600c872f24552e8dd4.tar.bz2 gnumach-1ed9c11c8bac06eee70182600c872f24552e8dd4.zip |
Wed Aug 20 16:05:19 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* kern/thread.h (struct thread): New member `creation_time'.
* include/mach/thread_info.h: New member `creation_time'.
* kern/thread.c (thread_create): Set creation time stamp.
(thread_info) [THREAD_BASIC_INFO]: Fill in new creation time
field. Carefully preserve compatibility with old callers.
* kern/task.h (struct task): New member `creation_time'.
* include/mach/task_info.h: New member `creation_time'.
* kern/task.c (task_create): Set creation time stamp.
(task_info) [TASK_BASIC_INFO]: Fill in new creation time field.
Carefully preserve compatibility with old callers.
* kern/mach_clock.c (record_time_stamp): New function.
* kern/time_out.h (record_time_stamp): Add prototype.
Diffstat (limited to 'kern/thread.c')
-rw-r--r-- | kern/thread.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/kern/thread.c b/kern/thread.c index 1d7a3783..d1862985 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -429,6 +429,8 @@ kern_return_t thread_create( *new_thread = thread_template; + record_time_stamp (&new_thread->creation_time); + /* * Initialize runtime-dependent fields */ @@ -1473,7 +1475,11 @@ kern_return_t thread_info( if (flavor == THREAD_BASIC_INFO) { register thread_basic_info_t basic_info; - if (*thread_info_count < THREAD_BASIC_INFO_COUNT) { + /* Allow *thread_info_count to be one smaller than the + usual amount, because creation_time is a new member + that some callers might not know about. */ + + if (*thread_info_count < THREAD_BASIC_INFO_COUNT - 1) { return KERN_INVALID_ARGUMENT; } @@ -1496,6 +1502,7 @@ kern_return_t thread_info( &basic_info->system_time); basic_info->base_priority = thread->priority; basic_info->cur_priority = thread->sched_pri; + basic_info->creation_time = thread->creation_time; /* * To calculate cpu_usage, first correct for timer rate, @@ -1547,7 +1554,8 @@ kern_return_t thread_info( thread_unlock(thread); splx(s); - *thread_info_count = THREAD_BASIC_INFO_COUNT; + if (*thread_info_count > THREAD_BASIC_INFO_COUNT) + *thread_info_count = THREAD_BASIC_INFO_COUNT; return KERN_SUCCESS; } else if (flavor == THREAD_SCHED_INFO) { |