[kernel] Add process_give_handle syscall
This syscall allows a process to give another process access to an object it has a handle to. The value of the handle as seen in the receiver process is returned to the caller, so that the caller may notify the recipient which handle was given.
This commit is contained in:
@@ -24,4 +24,11 @@ object process : kobject {
|
|||||||
param entrypoint address # The address of the main thread entrypoint
|
param entrypoint address # The address of the main thread entrypoint
|
||||||
param handles object kobject [list] # A list of parent handles to send to the child process
|
param handles object kobject [list] # A list of parent handles to send to the child process
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Give the given process a handle that points to the same
|
||||||
|
# object as the specified handle.
|
||||||
|
method give_handle {
|
||||||
|
param sender object kobject # A handle in the caller process to send
|
||||||
|
param receiver object kobject [out] # The handle as the recipient will see it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,4 +56,18 @@ process_exit(int32_t status)
|
|||||||
return j6_err_unexpected;
|
return j6_err_unexpected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
j6_status_t
|
||||||
|
process_give_handle(j6_handle_t handle, j6_handle_t sender, j6_handle_t *receiver)
|
||||||
|
{
|
||||||
|
process *dest = get_handle<process>(handle);
|
||||||
|
if (!dest) return j6_err_invalid_arg;
|
||||||
|
|
||||||
|
kobject *o = get_handle<kobject>(sender);
|
||||||
|
j6_handle_t out = dest->add_handle(o);
|
||||||
|
|
||||||
|
if (receiver)
|
||||||
|
*receiver = out;
|
||||||
|
return j6_status_ok;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace syscalls
|
} // namespace syscalls
|
||||||
|
|||||||
Reference in New Issue
Block a user