[kernel] Let process::add_handle take a handle argument

The process::add_handle() method takes an id and an object. This change
adds an overridden version that accecpts an actual handle object to
copy.
This commit is contained in:
Justin C. Miller
2022-02-03 00:04:09 -08:00
parent 7d5feb943f
commit ad5ebae304
2 changed files with 19 additions and 1 deletions

View File

@@ -135,6 +135,19 @@ process::add_handle(kobject *obj, j6_cap_t caps)
return id;
}
j6_handle_t
process::add_handle(const handle &hnd)
{
if (!hnd.object || hnd.id == j6_handle_invalid)
return j6_handle_invalid;
handle h {m_next_handle++, hnd.object, hnd.caps()};
j6_handle_t id = h.id;
m_handles.insert(id, h);
return id;
}
bool
process::remove_handle(j6_handle_t id)
{