sched: task: implement task creation flags

This commit is contained in:
2026-04-30 19:06:46 +01:00
parent 562b856488
commit 02a44f67b9
5 changed files with 26 additions and 22 deletions
+15 -5
View File
@@ -172,10 +172,12 @@ struct task *task_alloc(void)
}
struct task *task_create(
struct task *parent,
task_flags_t task_flags,
const char *name,
size_t name_len,
struct handle_table *handles)
size_t name_len)
{
kern_status_t status = KERN_OK;
struct task *task = task_alloc();
if (!task) {
return NULL;
@@ -194,13 +196,21 @@ struct task *task_create(
VM_USER_LIMIT,
&task->t_address_space);
if (!handles) {
handles = handle_table_create();
if (task_flags & TASK_F_CLONE_ALL_HANDLES) {
status = handle_table_duplicate(
parent->t_handles,
&task->t_handles);
} else {
task->t_handles = handle_table_create();
}
if (status != KERN_OK) {
object_unref(&task->t_base);
return NULL;
}
task->t_address_space->s_pmap = pmap;
task->t_state = TASK_RUNNING;
task->t_handles = handles;
if (name) {
name_len = MIN(name_len, sizeof task->t_name - 1);