sched: task: implement task_config_get and task_config_set

This commit is contained in:
2026-04-30 19:08:02 +01:00
parent 02a44f67b9
commit 607efa961f
4 changed files with 129 additions and 0 deletions
+83
View File
@@ -292,6 +292,89 @@ kern_status_t sys_task_get_address_space(
return KERN_OK;
}
kern_status_t sys_task_config_get(
kern_handle_t task_handle,
kern_config_key_t key,
void *ptr,
size_t len)
{
unsigned long flags;
struct task *self = get_current_task();
if (!validate_access_w(self, ptr, len)) {
put_current_task(self);
return KERN_MEMORY_FAULT;
}
struct object *task_obj;
handle_flags_t task_flags;
task_lock_irqsave(self, &flags);
kern_status_t status = task_resolve_handle(
self,
task_handle,
&task_obj,
&task_flags);
put_current_task(self);
task_unlock_irqrestore(self, flags);
if (status != KERN_OK) {
return status;
}
struct task *task = task_cast(task_obj);
task_unlock_irqrestore(self, flags);
if (task) {
status = task_config_get(task, key, ptr, len);
} else {
status = KERN_INVALID_ARGUMENT;
}
object_unref(task_obj);
return status;
}
kern_status_t sys_task_config_set(
kern_handle_t task_handle,
kern_config_key_t key,
const void *ptr,
size_t len)
{
unsigned long flags;
struct task *self = get_current_task();
if (!validate_access_w(self, ptr, len)) {
put_current_task(self);
return KERN_MEMORY_FAULT;
}
struct object *task_obj;
handle_flags_t task_flags;
task_lock_irqsave(self, &flags);
kern_status_t status = task_resolve_handle(
self,
task_handle,
&task_obj,
&task_flags);
task_unlock_irqrestore(self, flags);
put_current_task(self);
if (status != KERN_OK) {
return status;
}
struct task *task = task_cast(task_obj);
if (task) {
status = task_config_set(task, key, ptr, len);
} else {
status = KERN_INVALID_ARGUMENT;
}
object_unref(task_obj);
return status;
}
kern_status_t sys_thread_self(kern_handle_t *out)
{
struct task *self = get_current_task();