IOServiceGetMatchingService

Function IOServiceGetMatchingService 

Source
pub unsafe extern "C-unwind" fn IOServiceGetMatchingService(
    main_port: mach_port_t,
    matching: Option<CFRetained<CFDictionary>>,
) -> io_service_t
Available on crate feature libc only.
Expand description

Look up a registered IOService object that matches a matching dictionary.

This is the preferred method of finding IOService objects currently registered by IOKit (that is, objects that have had their registerService() methods invoked). To find IOService objects that aren’t yet registered, use an iterator as created by IORegistryEntryCreateIterator(). IOServiceAddMatchingNotification can also supply this information and install a notification of new IOServices. The matching information used in the matching dictionary may vary depending on the class of service being looked up.

Parameter mainPort: The main port obtained from IOMainPort(). Pass kIOMainPortDefault to look up the default main port.

Parameter matching: A CF dictionary containing matching information, of which one reference is always consumed by this function (Note prior to the Tiger release there was a small chance that the dictionary might not be released if there was an error attempting to serialize the dictionary). IOKitLib can construct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOServiceNameMatching, IOBSDNameMatching.

Returns: The first service matched is returned on success. The service must be released by the caller.