Function

IOServiceOpen

A request to create a connection to an IOService.

Declaration

kern_return_t IOServiceOpen(io_service_t service, task_port_t owningTask, uint32_t type, io_connect_t *connect);

Parameters

service

The IOService object to open a connection to, usually obtained via the IOServiceGetMatchingServices or IOServiceAddNotification APIs.

owningTask

The mach task requesting the connection.

type

A constant specifying the type of connection to be created, interpreted only by the IOService's family.

connect

An io_connect_t handle is returned on success, to be used with the IOConnectXXX APIs. It should be destroyed with IOServiceClose().

Return Value

A return code generated by IOService::newUserClient.

Discussion

A non kernel client may request a connection be opened via the IOServiceOpen() library function, which will call IOService::newUserClient in the kernel. The rules & capabilities of user level clients are family dependent, the default IOService implementation returns kIOReturnUnsupported.