summaryrefslogtreecommitdiff
path: root/kern/task.c
diff options
context:
space:
mode:
Diffstat (limited to 'kern/task.c')
-rw-r--r--kern/task.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/kern/task.c b/kern/task.c
index 1874af69..735b9e59 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -73,7 +73,7 @@ void task_init(void)
* Task_create must assign to kernel_task as a side effect,
* for other initialization. (:-()
*/
- (void) task_create(TASK_NULL, FALSE, &kernel_task);
+ (void) task_create_kernel(TASK_NULL, FALSE, &kernel_task);
(void) task_set_name(kernel_task, "gnumach");
vm_map_set_name(kernel_map, kernel_task->name);
}
@@ -83,6 +83,19 @@ kern_return_t task_create(
boolean_t inherit_memory,
task_t *child_task) /* OUT */
{
+ if (parent_task == TASK_NULL)
+ return KERN_INVALID_TASK;
+
+ return task_create_kernel (parent_task, inherit_memory,
+ child_task);
+}
+
+kern_return_t
+task_create_kernel(
+ task_t parent_task,
+ boolean_t inherit_memory,
+ task_t *child_task) /* OUT */
+{
task_t new_task;
processor_set_t pset;
#if FAST_TAS
@@ -189,14 +202,16 @@ kern_return_t task_create(
new_task);
else
snprintf (new_task->name, sizeof new_task->name, "(%.*s)",
- sizeof new_task->name - 3, parent_task->name);
+ (int) (sizeof new_task->name - 3), parent_task->name);
if (new_task_notification != NULL) {
task_reference (new_task);
task_reference (parent_task);
mach_notify_new_task (new_task_notification,
convert_task_to_port (new_task),
- convert_task_to_port (parent_task));
+ parent_task
+ ? convert_task_to_port (parent_task)
+ : IP_NULL);
}
ipc_task_enable(new_task);
@@ -1209,7 +1224,8 @@ void consider_task_collect(void)
task_collect_max_rate = hz;
if (task_collect_allowed &&
- (sched_tick > (task_collect_last_tick + task_collect_max_rate))) {
+ (sched_tick > (task_collect_last_tick +
+ task_collect_max_rate / (hz / 1)))) {
task_collect_last_tick = sched_tick;
task_collect_scan();
}