kernel: add a syscall to query generic information about an object
This commit is contained in:
@@ -80,3 +80,32 @@ cleanup:
|
||||
self_thread->tr_state = THREAD_READY;
|
||||
return status;
|
||||
}
|
||||
|
||||
kern_status_t sys_kern_object_query(
|
||||
kern_handle_t object_handle,
|
||||
kern_object_info_t *out)
|
||||
{
|
||||
struct task *self = current_task();
|
||||
|
||||
if (!out) {
|
||||
return KERN_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (!validate_access_w(self, out, sizeof *out)) {
|
||||
return KERN_MEMORY_FAULT;
|
||||
}
|
||||
|
||||
struct object *obj = NULL;
|
||||
handle_flags_t flags = 0;
|
||||
kern_status_t status
|
||||
= task_resolve_handle(self, object_handle, &obj, &flags);
|
||||
if (status != KERN_OK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
out->obj_id = obj->ob_id;
|
||||
|
||||
object_unref(obj);
|
||||
|
||||
return KERN_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user