mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[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:
@@ -135,6 +135,19 @@ process::add_handle(kobject *obj, j6_cap_t caps)
|
|||||||
return id;
|
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
|
bool
|
||||||
process::remove_handle(j6_handle_t id)
|
process::remove_handle(j6_handle_t id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,9 +62,14 @@ public:
|
|||||||
/// Start tracking an object with a handle.
|
/// Start tracking an object with a handle.
|
||||||
/// \args obj The object this handle refers to
|
/// \args obj The object this handle refers to
|
||||||
/// \args caps The capabilities on this handle
|
/// \args caps The capabilities on this handle
|
||||||
/// \returns The new handle for this object
|
/// \returns The new handle id for this object
|
||||||
j6_handle_t add_handle(kobject *obj, j6_cap_t caps);
|
j6_handle_t add_handle(kobject *obj, j6_cap_t caps);
|
||||||
|
|
||||||
|
/// Start tracking an object with a handle.
|
||||||
|
/// \args hnd An existing handle to copy into this process
|
||||||
|
/// \returns The new handle id for this object
|
||||||
|
j6_handle_t add_handle(const handle &hnd);
|
||||||
|
|
||||||
/// Stop tracking an object with a handle.
|
/// Stop tracking an object with a handle.
|
||||||
/// \args handle The handle that refers to the object
|
/// \args handle The handle that refers to the object
|
||||||
/// \returns True if the handle was removed
|
/// \returns True if the handle was removed
|
||||||
|
|||||||
Reference in New Issue
Block a user