#include <IOKit/IOLib.h>
IOKit/IOLib.h
IOMin/IOMax macros.
macroIOMin
#define IOMin(a, b) ((a) < (b) ? (a) : (b))
macroIOMax
#define IOMax(a, b) ((a) > (b) ? (a) : (b))
macromin
FIXME(rdar://155575647): Remove deprecated `max` and `min` macros from <IOKit/IOLib.h>
#define min(a, b) _Pragma("message \"min is deprecated. Please use IOMin instead.\"")
IOMin(a, b)macromax
#define max(a, b) _Pragma("message \"max is deprecated. Please use IOMax instead.\"")
IOMax(a, b)functionIOMallocArraySize
static inline vm_size_t IOMallocArraySize( vm_size_t hdr_size, vm_size_t elem_size, vm_size_t elem_count )
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/IOKit/IOLib.h
Computes the byte size of an array allocation as hdr_size + elem_size * elem_count, using overflow-checked arithmetic. On overflow, or if the result has its high bit set, returns a saturated size (1 << (8 * sizeof(vm_size_t) - 1)) that IOMalloc rejects before asking the VM, so the subsequent allocation always returns NULL. Used internally by the IONew, IONewZero, IODelete and IODeleteData macros to size allocations safely.
macroIOKIT_TYPE_IS_COMPATIBLE_PTR
#define IOKIT_TYPE_IS_COMPATIBLE_PTR(ptr, type) (__builtin_xnu_types_compatible(os_get_pointee_type(ptr), type) || __builtin_xnu_types_compatible(os_get_pointee_type(ptr), void))
macroIOKIT_TYPE_ASSERT_COMPATIBLE_POINTER
#define IOKIT_TYPE_ASSERT_COMPATIBLE_POINTER(ptr, type) _Static_assert(IOKIT_TYPE_IS_COMPATIBLE_PTR(ptr, type), "Pointer type is not compatible with specified type")
typedefIOThreadFunc
typedef void (*IOThreadFunc)(void *argument)
functionIOMalloc
__attribute__((alloc_size(1))) void * IOMalloc(vm_size_t size)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Allocates general purpose, wired kernel memory from the default kalloc heap (KHEAP_DEFAULT), tagged VM_KERN_MEMORY_IOKIT. No alignment guarantee is given on the returned memory. May block, and so must not be called from interrupt level or while a simple lock is held. Free with IOFree, passing the identical size. New code should prefer the typed allocators (IOMallocType, IONew) for structures, or IOMallocData for pure data buffers.
Returns a pointer to the allocated memory, or zero on failure.
functionIOMallocZero
__attribute__((alloc_size(1))) void * IOMallocZero(vm_size_t size)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Same as IOMalloc, but the returned memory is zero filled (allocated with Z_ZERO). Free with IOFree, passing the identical size. Returns a pointer to the allocated memory, or zero on failure.
functionIOFree
void IOFree(void * address, vm_size_t size)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Frees memory allocated with IOMalloc or IOMallocZero. The address must be the exact result of the prior allocation and size must equal the size that was requested; a mismatched size is reported (and corrected when allocation tracking is enabled). A NULL address is ignored. May block, and so must not be called from interrupt level or while a simple lock is held.
functionIOMallocAligned
__attribute__((alloc_size(1))) void * IOMallocAligned(vm_size_t size, vm_offset_t alignment)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Allocates wired kernel memory with an alignment restriction given as a byte count (for example 256 for an address with bits 0-7 zero); the alignment is rounded up to a power of two. Allocations of a page or more are made from kernel_map with kernel_memory_allocate; smaller requests come from the kalloc heap with a hidden header recording the original allocation, so the memory must be freed with IOFreeAligned using the same size. May block, and so must not be called from interrupt level or while a simple lock is held. Returns a pointer to the allocated memory, or zero on failure or for a zero size.
functionIOFreeAligned
void IOFreeAligned(void * address, vm_size_t size)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Frees memory allocated with IOMallocAligned; address and size must match the original allocation. A NULL address is ignored. May block, and so must not be called from interrupt level or while a simple lock is held.
functionIOMallocContiguous
__attribute__((deprecated)) __attribute__((alloc_size(1))) void * IOMallocContiguous( vm_size_t size, vm_size_t alignment, IOPhysicalAddress * physicalAddress )
deprecated
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Deprecated - use IOBufferMemoryDescriptor. Allocates wired, physically contiguous kernel memory with the specified alignment. The request may fail if physical memory is fragmented, and may cause large amounts of paging activity. When physicalAddress is non-NULL the allocation is made through an IOBufferMemoryDescriptor with kIOMemoryPhysicallyContiguous restricted to 32-bit physical addresses, and the buffer's physical address is returned there; that argument is itself deprecated - pass NULL and use IODMACommand with a memory descriptor to obtain physical addresses. May block. Free with IOFreeContiguous. Returns the virtual address of the allocation, or zero on failure.
functionIOFreeContiguous
__attribute__((deprecated)) void IOFreeContiguous(void * address, vm_size_t size)
deprecated
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Deprecated - use IOBufferMemoryDescriptor. Frees memory allocated with IOMallocContiguous, releasing the underlying IOBufferMemoryDescriptor if one was created to satisfy the allocation. A NULL address is ignored. May block.
functionIOMallocPageable
__attribute__((alloc_size(1))) void * IOMallocPageable(vm_size_t size, vm_size_t alignment)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Allocates pageable memory from the IOKit pageable submap (gIOKitPageableMap). Alignment is given as a byte count and may not exceed the page size; the request size is limited by kIOPageableMaxAllocSize. May block, and so must not be called from interrupt level or while a simple lock is held. Free with IOFreePageable, passing the identical size. Returns a pointer to the allocated memory, or zero on failure.
functionIOMallocPageableZero
__attribute__((alloc_size(1))) void * IOMallocPageableZero(vm_size_t size, vm_size_t alignment)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Same as IOMallocPageable, but guarantees the returned memory is zero filled. Free with IOFreePageable, passing the identical size. Returns a pointer to the allocated memory, or zero on failure.
functionIOFreePageable
void IOFreePageable(void * address, vm_size_t size)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Frees memory allocated with IOMallocPageable or IOMallocPageableZero, returning it to the IOKit pageable map; size must match the original allocation. May block, and so must not be called from interrupt level or while a simple lock is held.
functionIOMallocData
__attribute__((alloc_size(1))) void * IOMallocData(vm_size_t size)
@function IOMallocData
@abstract Allocates wired memory in the kernel map, from a separate section meant for pure data.
@discussion Same as IOMalloc except that this function should be used for allocating pure data.
@param size Size of the memory requested.
@result Pointer to the allocated memory, or zero on failure.
functionIOMallocZeroData
__attribute__((alloc_size(1))) void * IOMallocZeroData(vm_size_t size)
@function IOMallocZeroData
@abstract Allocates wired memory in the kernel map, from a separate section meant for pure data bytes that don't contain pointers.
@discussion Same as IOMallocData except that the memory returned is zeroed.
@param size Size of the memory requested.
@result Pointer to the allocated memory, or zero on failure.
functionIOFreeData
void IOFreeData(void * address, vm_size_t size)
@function IOFreeData
@abstract Frees memory allocated with IOMallocData or IOMallocZeroData.
@discussion This function frees memory allocated with IOMallocData/IOMallocZeroData, it may block and so should not be called from interrupt level or while a simple lock is held.
@param address Virtual address of the allocated memory. Passing NULL here is acceptable.
@param size Size of the memory allocated. It is acceptable to pass 0 size for a NULL address.
macroIONewData
#define IONewData(type, count) ((type *)IOMallocData(IOMallocArraySize(0, sizeof(type), count)))
macroIONewZeroData
#define IONewZeroData(type, count) ((type *)IOMallocZeroData(IOMallocArraySize(0, sizeof(type), count)))
macroIODeleteData
#define IODeleteData(ptr, type, count) ({
vm_size_t __count = (vm_size_t)(count);
IOKIT_TYPE_ASSERT_COMPATIBLE_POINTER(ptr, type);
IOFreeData(os_ptr_load_and_erase(ptr),
IOMallocArraySize(0, sizeof(type), __count));
})macroIONew
IONew/IONewZero/IODelete/IOSafeDeleteNULL
Those functions come in 2 variants:
1. IONew(element_type, count)
IONewZero(element_type, count)
IODelete(ptr, element_type, count)
IOSafeDeleteNULL(ptr, element_type, count)
Those allocate/free arrays of `count` elements of type `element_type`.
2. IONew(hdr_type, element_type, count)
IONewZero(hdr_type, element_type, count)
IODelete(ptr, hdr_type, element_type, count)
IOSafeDeleteNULL(ptr, hdr_type, element_type, count)
Those allocate/free arrays with `count` elements of type `element_type`,
prefixed with a header of type `hdr_type`, like this:
Those perform safe math with the sizes, checking for overflow.
An overflow in the sizes will cause the allocation to return NULL.
#define IONew(...) __IOKIT_DISPATCH(IONew, ##__VA_ARGS__)
macroIONewZero
#define IONewZero(...) __IOKIT_DISPATCH(IONewZero, ##__VA_ARGS__)
macroIODelete
#define IODelete(...) __IOKIT_DISPATCH(IODelete, ##__VA_ARGS__)
macroIOSafeDeleteNULL
#define IOSafeDeleteNULL(...) __IOKIT_DISPATCH(IOSafeDeleteNULL, ##__VA_ARGS__)
macroIONew_2
#define IONew_2(e_ty, count) ((e_ty *)IOMalloc(IOMallocArraySize(0, sizeof(e_ty), count)))
macroIONew_3
#define IONew_3(h_ty, e_ty, count) ((h_ty *)IOMalloc(IOMallocArraySize(sizeof(h_ty), sizeof(e_ty), count)))
macroIONewZero_2
#define IONewZero_2(e_ty, count) ((e_ty *)IOMallocZero(IOMallocArraySize(0, sizeof(e_ty), count)))
macroIONewZero_3
#define IONewZero_3(h_ty, e_ty, count) ((h_ty *)IOMallocZero(IOMallocArraySize(sizeof(h_ty), sizeof(e_ty), count)))
macroIODelete_3
#define IODelete_3(ptr, e_ty, count) IOFree(ptr, IOMallocArraySize(0, sizeof(e_ty), count));
macroIODelete_4
#define IODelete_4(ptr, h_ty, e_ty, count) IOFree(ptr, IOMallocArraySize(sizeof(h_ty), sizeof(e_ty), count));
macroIOSafeDeleteNULL_3
#define IOSafeDeleteNULL_3(ptr, e_ty, count) ({
vm_size_t __s = IOMallocArraySize(0, sizeof(e_ty), count);
IOFree(os_ptr_load_and_erase(ptr), __s);
})macroIOSafeDeleteNULL_4
#define IOSafeDeleteNULL_4(ptr, h_ty, e_ty, count) ({
vm_size_t __s = IOMallocArraySize(sizeof(h_ty), sizeof(e_ty), count);
IOFree(os_ptr_load_and_erase(ptr), __s);
})functionIOMappedRead8
UInt8 IOMappedRead8(IOPhysicalAddress address)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOMapper.cpp, iokit/IOKit/IOLib.h
Reads one byte from the given physical (IOSpace) address, an address such as those returned by IOMemoryDescriptor::getPhysicalSegment. If a system IOMapper (a DMA address translator such as a DART) is present, the address is first translated to a true physical address with the mapper's mapToPhysicalAddress; the access is then performed with the ml_phys_read family. Returns the data at that location.
functionIOMappedRead16
UInt16 IOMappedRead16(IOPhysicalAddress address)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOMapper.cpp, iokit/IOKit/IOLib.h
Reads two bytes from the given physical (IOSpace) address, an address such as those returned by IOMemoryDescriptor::getPhysicalSegment. If a system IOMapper (a DMA address translator such as a DART) is present, the address is first translated to a true physical address with the mapper's mapToPhysicalAddress; the access is then performed with the ml_phys_read family. Returns the data at that location.
functionIOMappedRead32
UInt32 IOMappedRead32(IOPhysicalAddress address)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOMapper.cpp, iokit/IOKit/IOLib.h
Reads four bytes from the given physical (IOSpace) address, an address such as those returned by IOMemoryDescriptor::getPhysicalSegment. If a system IOMapper (a DMA address translator such as a DART) is present, the address is first translated to a true physical address with the mapper's mapToPhysicalAddress; the access is then performed with the ml_phys_read family. Returns the data at that location.
functionIOMappedRead64
UInt64 IOMappedRead64(IOPhysicalAddress address)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOMapper.cpp, iokit/IOKit/IOLib.h
Reads eight bytes from the given physical (IOSpace) address, an address such as those returned by IOMemoryDescriptor::getPhysicalSegment. If a system IOMapper (a DMA address translator such as a DART) is present, the address is first translated to a true physical address with the mapper's mapToPhysicalAddress; the access is then performed with the ml_phys_read family. Returns the data at that location.
functionIOMappedWrite8
void IOMappedWrite8(IOPhysicalAddress address, UInt8 value)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOMapper.cpp, iokit/IOKit/IOLib.h
Writes one byte of data to the given physical (IOSpace) address, an address such as those returned by IOMemoryDescriptor::getPhysicalSegment. If a system IOMapper (a DMA address translator such as a DART) is present, the address is first translated to a true physical address with the mapper's mapToPhysicalAddress; the access is then performed with the ml_phys_write family.
functionIOMappedWrite16
void IOMappedWrite16(IOPhysicalAddress address, UInt16 value)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOMapper.cpp, iokit/IOKit/IOLib.h
Writes two bytes of data to the given physical (IOSpace) address, an address such as those returned by IOMemoryDescriptor::getPhysicalSegment. If a system IOMapper (a DMA address translator such as a DART) is present, the address is first translated to a true physical address with the mapper's mapToPhysicalAddress; the access is then performed with the ml_phys_write family.
functionIOMappedWrite32
void IOMappedWrite32(IOPhysicalAddress address, UInt32 value)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOMapper.cpp, iokit/IOKit/IOLib.h
Writes four bytes of data to the given physical (IOSpace) address, an address such as those returned by IOMemoryDescriptor::getPhysicalSegment. If a system IOMapper (a DMA address translator such as a DART) is present, the address is first translated to a true physical address with the mapper's mapToPhysicalAddress; the access is then performed with the ml_phys_write family.
functionIOMappedWrite64
void IOMappedWrite64(IOPhysicalAddress address, UInt64 value)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOMapper.cpp, iokit/IOKit/IOLib.h
Writes eight bytes of data to the given physical (IOSpace) address, an address such as those returned by IOMemoryDescriptor::getPhysicalSegment. If a system IOMapper (a DMA address translator such as a DART) is present, the address is first translated to a true physical address with the mapper's mapToPhysicalAddress; the access is then performed with the ml_phys_write family.
functionIOSetProcessorCacheMode
__attribute__((deprecated)) IOReturn IOSetProcessorCacheMode( task_t task, IOVirtualAddress address, IOByteCount length, IOOptionBits cacheMode )
deprecated
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Deprecated - cache settings may be specified for allocated memory with the IOBufferMemoryDescriptor API, or when mapping with IOMemoryDescriptor. Changes the processor cache mode of an existing, page aligned mapped range by remapping each resident page with the cache mode encoded in the mapping (IOUnmapPages then IOMapPages). Only the kernel task is supported; returns kIOReturnUnsupported for any other task or if address or length is not page aligned, and kIOReturnVMError if a page in the range has no physical translation.
functionIOFlushProcessorCache
IOReturn IOFlushProcessorCache(task_t task, IOVirtualAddress address, IOByteCount length)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Flushes the processor data cache for an already mapped memory range, using flush_dcache64. Only the kernel task is supported; returns kIOReturnUnsupported for any other task, kIOReturnSuccess otherwise. In most cases IOMemoryDescriptor::prepare and complete are preferable for managing cache coherency, since they are aware of the architecture's requirements; explicit flushing is not required for coherency in most situations.
macroIOThreadSelf
#define IOThreadSelf() (current_thread())
functionIOCreateThread
__attribute__((deprecated)) IOThread IOCreateThread(IOThreadFunc function, void *argument)
deprecated
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Deprecated - use kernel_thread_start (kern/thread.h). Creates a kernel thread running the given function with the caller supplied argument, then drops the returned thread reference. The returned IOThread (a thread_t) is not reliable: the new thread may already have terminated by the time the call returns, so the value is useful for little more than comparison against zero. Returns NULL if the thread could not be created.
functionIOExitThread
__attribute__((deprecated))
void IOExitThread(void)deprecated
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Deprecated - use thread_terminate(current_thread()). Terminates execution of the calling kernel thread; does not return to the caller.
functionIOSleep
void IOSleep(unsigned milliseconds)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Blocks the calling thread for at least the given number of milliseconds, giving time to other threads (delay_for_interval with kMillisecondScale).
functionIOSleepWithLeeway
void IOSleepWithLeeway(unsigned intervalMilliseconds, unsigned leewayMilliseconds)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Blocks the calling thread for at least intervalMilliseconds, giving time to other threads. The kernel may additionally delay wakeup by up to leewayMilliseconds, using the leeway as a guideline for timer coalescing (delay_for_interval_with_leeway).
functionIODelay
void IODelay(unsigned microseconds)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Spins for at least the given number of microseconds. The CPU busy-waits, so no time is made available to other threads; use only for short periods. The AbsoluteTime based APIs of kern/clock.h provide finer grained and lower cost delays.
functionIOPause
void IOPause(unsigned nanoseconds)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Spins for at least the given number of nanoseconds. The CPU busy-waits, so no time is made available to other threads; use only for short periods.
functionIOLog
__attribute__((format(printf, 1, 2)))
void IOLog(const char *format, ...)▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Logs a printf(3)-style formatted message from a driver. The message is sent to the default os_log (attributed to the caller's return address) and, unless serial output is disabled, printed to the console; messages appear in the system log. Must not be called from interrupt context or with interrupts disabled (asserted in the implementation).
functionIOLogv
__attribute__((format(printf, 1, 0))) void IOLogv(const char *format, va_list ap)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
macro_FN_KPRINTF_DECLARED
#define _FN_KPRINTF_DECLARED
functionIOFindNameForValue
const char *IOFindNameForValue(int value, const IONamedValue *namedValueArray)
Convert a integer constant (typically a #define or enum) to a string
via an array of IONamedValue.
functionIOFindValueForName
IOReturn IOFindValueForName( const char *string, const IONamedValue *regValueArray, /* RETURNED */ int *value )
Convert a string to an int via an array of IONamedValue. Returns
kIOReturnSuccess of string found, else returns kIOReturnBadArgument.
functionDebugger
void Debugger(const char * reason)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/debug.c, iokit/IOKit/IOLib.h
Enters the built-in kernel debugger, freezing the kernel; the reason string describes why the debugger is being entered. Calls DebuggerWithContext with DEBUGGER_OPTION_NONE. It may not be possible to exit the debugger without a second machine attached.
functionIOBSDNameMatching
OSDictionary * struct OSDictionary * IOBSDNameMatching(const char * name)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/bsddev/IOKitBSDInit.cpp
Returns a matching dictionary for IOService lookups that matches the service whose kIOBSDNameKey ("BSD Name") property equals the given name, e.g. a disk or network interface's BSD device name. Built with IOService::serviceMatching; the caller consumes one reference (dictionaries passed to matching lookups are consumed, otherwise release the result). Returns NULL on allocation failure.
functionIOOFPathMatching
__attribute__((deprecated)) OSDictionary * struct OSDictionary * IOOFPathMatching( const char * path, char * buf, int maxLen )
deprecated
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/bsddev/IOKitBSDInit.cpp
Deprecated. Returns a matching dictionary that matches a registry entry by path in the device tree plane: a kIOPathMatchKey property is set to "IODeviceTree:" prepended to the given path, composed in the caller supplied buf of maxLen bytes. Returns NULL if the buffer is too small or allocation fails; the caller releases the result.
functionIOSizeToAlignment
IOAlignment IOSizeToAlignment(unsigned int size)
Convert between size and a power-of-two alignment.
functionIOAlignmentToSize
unsigned int IOAlignmentToSize(IOAlignment align)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOLib.cpp, iokit/IOKit/IOLib.h
Converts an IOAlignment value, a power-of-two exponent, to the corresponding byte size (1 << align). Inverse of IOSizeToAlignment.
functionIOFixedMultiply
static inline IOFixed IOFixedMultiply(IOFixed a, IOFixed b)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/IOKit/IOLib.h
Multiplies two IOFixed (16.16 fixed point) values, using a 64-bit intermediate product shifted right 16 bits. Returns the fixed point product.
functionIOFixedDivide
static inline IOFixed IOFixedDivide(IOFixed a, IOFixed b)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/IOKit/IOLib.h
Divides one IOFixed (16.16 fixed point) value by another, shifting the dividend left 16 bits into a 64-bit intermediate before dividing. Returns the fixed point quotient; division by zero is not checked.
macroIORound
IORound and IOTrunc convenience functions, in the spirit
of vm's round_page() and trunc_page().
#define IORound(value, multiple) ((((value) + (multiple) - 1) / (multiple)) * (multiple))
macroIOTrunc
#define IOTrunc(value, multiple) (((value) / (multiple)) * (multiple));
functionIOGetTime
__attribute__((deprecated)) void IOGetTime(mach_timespec_t * clock_time)
deprecated
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/device/iokit_rpc.c, iokit/IOKit/IOLib.h
Deprecated - the API exported by kern/clock.h should be used for high resolution timing. Returns the system uptime as a mach_timespec_t, obtained from clock_get_system_nanotime.
macroIOFREETYPE_ASSERT_COMPATIBLE_POINTER
#define IOFREETYPE_ASSERT_COMPATIBLE_POINTER(ptr, type) do {} while (0)