Framework

DriverKit

Develop device drivers that run in user space.

Overview

Use DriverKit to create device drivers that the user installs on their Mac. Drivers built with DriverKit run in user space, rather than as kernel extensions, for improved system security and stability.

The DriverKit framework provides C++ classes for IO services, device matching, memory descriptors, and dispatch queues. It also defines IO-appropriate types for numbers, collections, strings, and other common types. You use these with family-specific driver frameworks like USBDriverKit and HIDDriverKit.

Develop your driver with DriverKit, and package it in an app that uses the SystemExtensions framework to install and upgrade the driver on the user’s Mac.

Topics

Essentials

IOService

The entry point for managing the setup and registration of your driver.

Event Management

IODispatchQueue

A dispatch queue that serially executes blocks of code.

IOInterruptDispatchSource

A dispatch source that reports hardware-related interrupt events to your driver.

IOTimerDispatchSource

A dispatch source that notifies your driver at a specific time.

IODataQueueDispatchSource

A dispatch source that manages a shared memory data queue.

IODispatchSource

The common base class for dispatch sources.

OSAction

A callback that you use to implement your driver's custom behavior.

Memory Management

IOBufferMemoryDescriptor

A memory buffer allocated in the caller's address space.

IOMemoryDescriptor

The base class for memory descriptors.

IOMemoryMap

A reference to a block of memory, belonging either to the current process or a different process.

Memory Utilities

Allocate and deallocate memory and manage memory pointers in different address spaces.

Registry Data Types

OSArray

A container for an ordered, random-access collection of objects.

OSDictionary

A container for a collection whose elements are key-value pairs.

OSBoolean

A container for a true or false value.

OSData

A container for untyped data.

OSNumber

A container for an integer value.

OSString

A container for managing an array of characters.

OSSerialization

A container for one or more objects, serialized in a binary data format that is suitable for messaging.

OSCollection

The base class for DriverKit collection objects.

OSContainer

The base class for DriverKit data objects.

OSObject

The base class for DriverKit objects

OSSymbol

A container for managing an array of characters.

IOFixed

A fixed-point number.

External Drivers

IOUserClient

A connection to another service managed by the system.

IOUserServer

A system-managed service.

com.apple.developer.driverkit.userclient-access

A Boolean value that indicates whether your code may communicate with other DriverKit services.

Runtime Support

OSDynamicCast

Casts an object safely to the specified type, returning NULL if the object is not the correct type.

OSRequiredCast

Casts the object to the specified type, killing the process if the object is not of the correct type.

IMPL

The macro for defining your custom implementation of a DriverKit method in your source file.

TYPE

A macro for annotating a method declaration to indicate that it conforms to an existing method signature.

SUPERDISPATCH

The macro to use when calling the superclass' implementation of a DriverKit method.

QUEUENAME

A macro for executing a method on the specified queue.

Error Codes

Determine the reason an operation failed.