kernel: all string parameters now take a corresponding length parameter
This commit is contained in:
15
sched/task.c
15
sched/task.c
@@ -91,6 +91,7 @@ kern_status_t setup_kernel_task(void)
|
||||
vm_region_create(
|
||||
NULL,
|
||||
"root",
|
||||
4,
|
||||
VM_KERNEL_BASE,
|
||||
VM_KERNEL_LIMIT - VM_KERNEL_BASE,
|
||||
VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXEC | VM_PROT_SVR,
|
||||
@@ -172,7 +173,7 @@ struct task *task_alloc(void)
|
||||
return t;
|
||||
}
|
||||
|
||||
struct task *task_create(struct task *parent, const char *name)
|
||||
struct task *task_create(const char *name, size_t name_len)
|
||||
{
|
||||
struct task *task = task_alloc();
|
||||
if (!task) {
|
||||
@@ -190,25 +191,23 @@ struct task *task_create(struct task *parent, const char *name)
|
||||
vm_region_create(
|
||||
NULL,
|
||||
"root",
|
||||
4,
|
||||
VM_USER_BASE,
|
||||
VM_USER_LIMIT - VM_USER_BASE,
|
||||
VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXEC | VM_PROT_USER,
|
||||
&task->t_address_space);
|
||||
|
||||
task->t_address_space->vr_pmap = pmap;
|
||||
task->t_state = TASK_STOPPED;
|
||||
task->t_state = TASK_RUNNING;
|
||||
task->t_handles = handle_table_create();
|
||||
|
||||
if (name) {
|
||||
strncpy(task->t_name, name, sizeof task->t_name);
|
||||
task->t_name[sizeof task->t_name - 1] = '\0';
|
||||
name_len = MIN(name_len, sizeof task->t_name - 1);
|
||||
memcpy(task->t_name, name, name_len);
|
||||
task->t_name[name_len] = '\0';
|
||||
}
|
||||
|
||||
unsigned long flags;
|
||||
task_lock_irqsave(parent, &flags);
|
||||
queue_push_back(&parent->t_children, &task->t_child_entry);
|
||||
task_unlock_irqrestore(parent, flags);
|
||||
|
||||
spin_lock_irqsave(&task_list_lock, &flags);
|
||||
task_list_insert(&task_list, task);
|
||||
spin_unlock_irqrestore(&task_list_lock, flags);
|
||||
|
||||
Reference in New Issue
Block a user