Contents

IOServiceOpen(_:_:_:_:)

A request to create a connection to an IOService.

Declaration

func IOServiceOpen(_ service: io_service_t, _ owningTask: task_port_t, _ type: UInt32, _ connect: UnsafeMutablePointer<io_connect_t>!) -> kern_return_t

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.

See Also

Miscellaneous