How to use DriverKit IOWorkGroup

50 views Asked by At

I can see that there is this file with this comment:

 * @class IOWorkGroup
 *
 * @abstract
 * Workgroups allow multiple threads to coordinate activities for realtime operations.
 *
 * @discussion
 *
 * Applications that open user clients to a DriverKit driver can send a workgroup to use in the driver.
 *
 * The application will have to first create an workgroup object. The application then should copy the
 * workgroup port with os_workgroup_copy_port(). To send the workgroup port to the driver, use:
 *
 * const char * name = "Work Group Name"; // This must match the name the driver used in IOWorkGroup::Create().
 * kern_return_t ret = IOConnectTrap3(connect, // user client connection (io_connect_t)
 *                                    1, // specifies event link configuration trap
 *                                    (uintptr_t)name,
 *                                    (uintptr_t)strlen(name),
 *                                    (uintptr_t)wgPort // port from os_workgroup_copy_port
 *                                    );
 *
 * Once the workgroup port has been sent to the driver, the driver should be notified with a user-defined external method
 * or other existing signaling mechanism.

I have tried to include IOWorkGroup.iig in the iig file of one of my user clients, and I've also tried to include IOWorkGroup.h in the cpp file of the user client. Xcode is not able to find any of those files. I've set the deployment target for the driver to macOS 14, and the DriverKit version is 23. Am I supposed to be able to use this or is IOWorkGroup not available to drivers not shipped with macOS?

1

There are 1 answers

0
pmdj On

Strangely enough, it's in the headers for the DriverKit.framework that's part of the macOS SDK, not the DriverKit SDK. The symbols do appear to be exported from the DriverKit SDK version of the framework (see DriverKit.tbd) so there's a reasonable chance it'll work if you just copy the two files over into the DriverKit SDK version of the framework.

I haven't tried this myself though!