<!--
{
  "documentType" : "article",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/c-runtime-support",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "C++ Runtime Support"
}
-->

# C++ Runtime Support

Examine low-level types that DriverKit uses to support kernel-level operations.

## Topics

### Object Support

[`extern kern_return_t OSObjectAllocate(OSMetaClass *meta, OSObject **pObject);`](/documentation/DriverKit/OSObjectAllocate)

Helper function for OSTypeAlloc(). Not to be called directly.

[`void OSObjectRetain(OSObjectPtr container);`](/documentation/DriverKit/OSObjectRetain)

[`void OSObjectRelease(OSObjectPtr container);`](/documentation/DriverKit/OSObjectRelease)

### Additional Types

[`typedef kern_return_t IOReturn;`](/documentation/DriverKit/IOReturn)

[`typedef UInt32 IOOptionBits;`](/documentation/DriverKit/IOOptionBits)

[`typedef int32_t integer_t;`](/documentation/DriverKit/integer_t)

[`typedef uint32_t natural_t;`](/documentation/DriverKit/natural_t)

[`typedef int kern_return_t;`](/documentation/DriverKit/kern_return_t)

[`typedef UInt32 IOItemCount;`](/documentation/DriverKit/IOItemCount)

[`typedef UInt32 IOVersion;`](/documentation/DriverKit/IOVersion)

### Log Support

[`void OSObjectLog(OSObjectPtr obj);`](/documentation/DriverKit/OSObjectLog)

[`void IOLogBuffer(const char *title, const void *buffer, size_t size);`](/documentation/DriverKit/IOLogBuffer)

[`uint32_t crc32(uint32_t crc, const void *buf, size_t size);`](/documentation/DriverKit/crc32)

### Base Classes

[`class OSMetaClass;`](/documentation/DriverKit/OSMetaClass)

Base class for DriverKit runtime class system. Not called directly.

[`class OSMetaClassBase;`](/documentation/DriverKit/OSMetaClassBase)

Base class for DriverKit objects.

### RPC Support

[`struct IORPC;`](/documentation/DriverKit/IORPC)

[`struct IORPCMessage;`](/documentation/DriverKit/IORPCMessage)

[`struct IORPCMessageMach;`](/documentation/DriverKit/IORPCMessageMach)

[`struct IORPCMessageErrorReturn;`](/documentation/DriverKit/IORPCMessageErrorReturn)

[`struct OSClassLoadInformation;`](/documentation/DriverKit/OSClassLoadInformation)

[`struct OSClassDescription;`](/documentation/DriverKit/OSClassDescription)

[`typedef int (*)(class OSMetaClassBase *, struct IORPC) OSDispatchMethod;`](/documentation/DriverKit/OSDispatchMethod)

[RPC Message ID](/documentation/DriverKit/3222959-rpc_message_id)

[RPC Message Types](/documentation/DriverKit/3222960-rpc_message_types)

[RPC Capabilities](/documentation/DriverKit/3222961-rpc_capabilities)

[RPC Version](/documentation/DriverKit/3353062-rpc_version)

[`IORPCMessage *IORPCMessageFromMach(IORPCMessageMach *msg, bool reply);`](/documentation/DriverKit/IORPCMessageFromMach)

### Mach Ports

[`typedef natural_t mach_port_name_t;`](/documentation/DriverKit/mach_port_name_t)

[`typedef natural_t mach_port_t;`](/documentation/DriverKit/mach_port_t)

### Mach Timebase

[`uint64_t mach_absolute_time();`](/documentation/DriverKit/mach_absolute_time)

Returns current value of a clock that increments monotonically in tick units (starting at an arbitrary point), this clock does not increment while the system is asleep.

[`uint64_t mach_continuous_time();`](/documentation/DriverKit/mach_continuous_time)

Returns current value of a clock that increments monotonically in tick units (starting at an arbitrary point), including while the system is asleep.

[`kern_return_t mach_timebase_info(mach_timebase_info_t info);`](/documentation/DriverKit/mach_timebase_info-c.func)

Returns fraction to multiply a value in mach tick units with to convert it to nanoseconds.

[`typedef struct mach_timebase_info * mach_timebase_info_t;`](/documentation/DriverKit/mach_timebase_info_t)

[Time Scales](/documentation/DriverKit/3223112-time_scales)

### Mach Messages

[`typedef unsigned int mach_msg_bits_t;`](/documentation/DriverKit/mach_msg_bits_t)

[`typedef unsigned int mach_msg_copy_options_t;`](/documentation/DriverKit/mach_msg_copy_options_t)

[`typedef unsigned int mach_msg_descriptor_type_t;`](/documentation/DriverKit/mach_msg_descriptor_type_t)

[`typedef integer_t mach_msg_id_t;`](/documentation/DriverKit/mach_msg_id_t)

[`typedef natural_t mach_msg_size_t;`](/documentation/DriverKit/mach_msg_size_t)

[`typedef unsigned int mach_msg_type_name_t;`](/documentation/DriverKit/mach_msg_type_name_t)

[`typedef struct { ... } mach_msg_body_t;`](/documentation/DriverKit/mach_msg_body_t)

[`typedef struct { ... } mach_msg_header_t;`](/documentation/DriverKit/mach_msg_header_t)

[`typedef struct { ... } mach_msg_max_trailer_t;`](/documentation/DriverKit/mach_msg_max_trailer_t)

[`typedef struct { ... } mach_msg_ool_descriptor_t;`](/documentation/DriverKit/mach_msg_ool_descriptor_t)

[`typedef struct { ... } mach_msg_port_descriptor_t;`](/documentation/DriverKit/mach_msg_port_descriptor_t)

[`typedef struct mach_timebase_info mach_timebase_info_data_t;`](/documentation/DriverKit/mach_timebase_info_data_t)

Raw Mach Time API In general prefer to use the <time.h> API clock_gettime_nsec_np(3), which deals in the same clocks (and more) in ns units. Conversion of ns to (resp. from) tick units as returned by the mach time APIs is performed by division (resp. multiplication) with the fraction returned by mach_timebase_info().

### Boot Support

[`bool IOParseBootArgNumber(const char *arg_string, void *arg_ptr, int max_len);`](/documentation/DriverKit/IOParseBootArgNumber)

Parses any boot arguments in the macOS kernel boot-args.

[`bool IOParseBootArgString(const char *arg_string, char *arg_ptr, int strlen);`](/documentation/DriverKit/IOParseBootArgString)

Parses any boot arguments in the macOS kernel boot-args.

### Thread Utilities

[`void IODelay(uint64_t us);`](/documentation/DriverKit/IODelay)

Sleep the calling thread for a number of microseconds.

[`void IOSleep(uint64_t ms);`](/documentation/DriverKit/IOSleep)

Sleep the calling thread for a number of milliseconds.

### Additional Utilities

[`void OSReportWithBacktrace(const char *str, ...);`](/documentation/DriverKit/OSReportWithBacktrace)

Generates a backtrace and message for debugging.

[`void OSSynchronizeIO();`](/documentation/DriverKit/OSSynchronizeIO)

Performs an `mfence` instruction on Intel-based Mac computers.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)