sched: task: optional handle_table pointer can now be passed to task_create
This commit is contained in:
@@ -39,7 +39,10 @@ struct task {
|
||||
|
||||
extern struct task *task_alloc(void);
|
||||
extern struct task *task_cast(struct object *obj);
|
||||
extern struct task *task_create(const char *name, size_t name_len);
|
||||
extern struct task *task_create(
|
||||
const char *name,
|
||||
size_t name_len,
|
||||
struct handle_table *handles);
|
||||
static inline struct task *task_ref(struct task *task)
|
||||
{
|
||||
return OBJECT_CAST(struct task, t_base, object_ref(&task->t_base));
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ void kernel_init(uintptr_t arg)
|
||||
bsp.bsp_trailer.bsp_exec_entry,
|
||||
bsp.bsp_vmo);
|
||||
|
||||
struct task *bootstrap_task = task_create("bootstrap", 9);
|
||||
struct task *bootstrap_task = task_create("bootstrap", 9, NULL);
|
||||
tracek("created bootstrap task (pid=%u)", bootstrap_task->t_id);
|
||||
|
||||
status = bsp_launch_async(&bsp, bootstrap_task);
|
||||
|
||||
+9
-2
@@ -171,7 +171,10 @@ struct task *task_alloc(void)
|
||||
return t;
|
||||
}
|
||||
|
||||
struct task *task_create(const char *name, size_t name_len)
|
||||
struct task *task_create(
|
||||
const char *name,
|
||||
size_t name_len,
|
||||
struct handle_table *handles)
|
||||
{
|
||||
struct task *task = task_alloc();
|
||||
if (!task) {
|
||||
@@ -191,9 +194,13 @@ struct task *task_create(const char *name, size_t name_len)
|
||||
VM_USER_LIMIT,
|
||||
&task->t_address_space);
|
||||
|
||||
if (!handles) {
|
||||
handles = handle_table_create();
|
||||
}
|
||||
|
||||
task->t_address_space->s_pmap = pmap;
|
||||
task->t_state = TASK_RUNNING;
|
||||
task->t_handles = handle_table_create();
|
||||
task->t_handles = handles;
|
||||
|
||||
if (name) {
|
||||
name_len = MIN(name_len, sizeof task->t_name - 1);
|
||||
|
||||
+5
-2
@@ -124,7 +124,7 @@ kern_status_t sys_task_create(
|
||||
|
||||
task_unlock_irqrestore(self, flags);
|
||||
|
||||
struct task *child = task_create(name, name_len);
|
||||
struct task *child = task_create(name, name_len, NULL);
|
||||
if (!child) {
|
||||
object_unref(parent_obj);
|
||||
|
||||
@@ -493,7 +493,10 @@ kern_status_t sys_task_duplicate(
|
||||
return status;
|
||||
}
|
||||
|
||||
struct task *new_task = task_create(self->t_name, strlen(self->t_name));
|
||||
struct task *new_task = task_create(
|
||||
self->t_name,
|
||||
strlen(self->t_name),
|
||||
NULL);
|
||||
if (!new_task) {
|
||||
put_current_task(self);
|
||||
return KERN_NO_MEMORY;
|
||||
|
||||
Reference in New Issue
Block a user