Implement io_object_get_retain_count()

This commit is contained in:
Sergey Bugaev 2020-04-16 14:18:28 +03:00
parent f382cc2c20
commit 3c362a9bb2
2 changed files with 16 additions and 10 deletions

View File

@ -142,3 +142,19 @@ kern_return_t is_io_object_conforms_to
*conforms = o->conformsTo(className);
return kIOReturnSuccess;
}
kern_return_t is_io_object_get_retain_count
(
mach_port_t object,
uint32_t *retainCount
)
{
IOObject* o = IOObject::lookup(object);
if (!o)
{
// Unlike other methods, this just returns 0 for invalid ports.
*retainCount = 0;
return KERN_SUCCESS;
}
return mach_port_get_refs(mach_task_self(), o->port(), MACH_PORT_RIGHT_SEND, retainCount);
}

View File

@ -214,16 +214,6 @@ kern_return_t is_io_registry_entry_in_plane
return KERN_NOT_SUPPORTED;
}
kern_return_t is_io_object_get_retain_count
(
mach_port_t object,
uint32_t *retainCount
)
{
STUB();
return KERN_NOT_SUPPORTED;
}
kern_return_t is_io_service_get_busy_state
(
mach_port_t service,