mirror of
https://github.com/justinian/jsix.git
synced 2025-12-09 16:04:32 -08:00
[kernel] Allow for not passing handles in new mailbox calls
In the new mailbox structure, passing a j6_handle_invalid with a message would result in a permission denied result, as the process did not have a handle "0".
This commit is contained in:
@@ -25,6 +25,11 @@ T * construct_handle(j6_handle_t *id, Args... args)
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
j6_status_t get_handle(j6_handle_t id, j6_cap_t caps, T *&object)
|
j6_status_t get_handle(j6_handle_t id, j6_cap_t caps, T *&object)
|
||||||
{
|
{
|
||||||
|
if (id == j6_handle_invalid) {
|
||||||
|
object = nullptr;
|
||||||
|
return j6_status_ok;
|
||||||
|
}
|
||||||
|
|
||||||
capability *capdata = g_cap_table.find(id);
|
capability *capdata = g_cap_table.find(id);
|
||||||
if (!capdata || capdata->type != T::type)
|
if (!capdata || capdata->type != T::type)
|
||||||
return j6_err_invalid_arg;
|
return j6_err_invalid_arg;
|
||||||
@@ -46,6 +51,11 @@ inline j6_status_t get_handle(j6_handle_t *id, j6_cap_t caps, T *&object)
|
|||||||
template <>
|
template <>
|
||||||
inline j6_status_t get_handle<obj::kobject>(j6_handle_t id, j6_cap_t caps, obj::kobject *&object)
|
inline j6_status_t get_handle<obj::kobject>(j6_handle_t id, j6_cap_t caps, obj::kobject *&object)
|
||||||
{
|
{
|
||||||
|
if (id == j6_handle_invalid) {
|
||||||
|
object = nullptr;
|
||||||
|
return j6_status_ok;
|
||||||
|
}
|
||||||
|
|
||||||
capability *capdata = g_cap_table.find(id);
|
capability *capdata = g_cap_table.find(id);
|
||||||
if (!capdata)
|
if (!capdata)
|
||||||
return j6_err_invalid_arg;
|
return j6_err_invalid_arg;
|
||||||
|
|||||||
Reference in New Issue
Block a user