summaryrefslogtreecommitdiff
path: root/kern/task.c
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1997-08-20 20:31:38 +0000
committerThomas Bushnell <thomas@gnu.org>1997-08-20 20:31:38 +0000
commit1ed9c11c8bac06eee70182600c872f24552e8dd4 (patch)
tree37ad773785169d6f5ce51000ff58fad81bf95842 /kern/task.c
parent4c4451c49c52b33f1714f3dd61c055cc84a91a8e (diff)
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/task.c')
-rw-r--r--kern/task.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/kern/task.c b/kern/task.c
index f72bb0f..9302e6a 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -166,6 +166,8 @@ kern_return_t task_create(
new_task->total_system_time.seconds = 0;
new_task->total_system_time.microseconds = 0;
+ record_time_stamp (&new_task->creation_time);
+
if (parent_task != TASK_NULL) {
task_lock(parent_task);
pset = parent_task->processor_set;
@@ -774,7 +776,11 @@ kern_return_t task_info(
{
register task_basic_info_t basic_info;
- if (*task_info_count < TASK_BASIC_INFO_COUNT) {
+ /* Allow *task_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 (*task_info_count < TASK_BASIC_INFO_COUNT - 1) {
return KERN_INVALID_ARGUMENT;
}
@@ -797,9 +803,11 @@ 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;
task_unlock(task);
- *task_info_count = TASK_BASIC_INFO_COUNT;
+ if (*task_info_count > TASK_BASIC_INFO_COUNT)
+ *task_info_count = TASK_BASIC_INFO_COUNT;
break;
}