#include <IOKit/IOService.h>
IOKit/IOService.h
@header
This header contains the definition of the IOService class. IOService is the sole direct subclass of IORegistryEntry and is the base class of almost all I/O Kit family superclasses. IOService defines methods that support the life cycle of I/O Kit drivers. For more information on IOService, see {@linkdoc //apple_ref/doc/uid/TP0000011 I/O Kit Fundamentals}.
@seealso //apple_ref/doc/header/IORegistryEntry.h IORegistryEntry
enum(anonymous)
| kIODefaultProbeScore | 0 |
enum(anonymous)
masks for getState()
| kIOServiceInactiveState | 1 | |
| kIOServiceRegisteredState | 2 | |
| kIOServiceMatchedState | 4 | |
| kIOServiceFirstPublishState | 8 | |
| kIOServiceFirstMatchState | 16 | |
| kIOServiceReservedMatchState | 2147483648 |
enum(anonymous)
| kIOServiceExclusive | 1 | options for registerService() |
| kIOServiceRequired | 1 | options for terminate() |
| kIOServiceTerminate | 4 | |
| kIOServiceTerminateWithRematch | 16 | |
| kIOServiceTerminateWithRematchCurrentDext | 32 | |
| kIOServiceSynchronous | 2 | options for registerService() & terminate() |
| kIOServiceAsynchronous | 8 | options for registerService() |
| kIOServiceDextRequirePowerForMatching | 16 |
typedefIONotificationRef
typedef void * IONotificationRef
variablegIOServicePlane
extern const IORegistryPlane * gIOServicePlane
variablegIOPowerPlane
extern const IORegistryPlane * gIOPowerPlane
variablegIOResourcesKey
extern const OSSymbol * gIOResourcesKey
variablegIOResourceMatchKey
extern const OSSymbol * gIOResourceMatchKey
variablegIOResourceMatchedKey
extern const OSSymbol * gIOResourceMatchedKey
variablegIOResourceIOKitKey
extern const OSSymbol * gIOResourceIOKitKey
variablegIOProviderClassKey
extern const OSSymbol * gIOProviderClassKey
variablegIONameMatchKey
extern const OSSymbol * gIONameMatchKey
variablegIONameMatchedKey
extern const OSSymbol * gIONameMatchedKey
variablegIOPropertyMatchKey
extern const OSSymbol * gIOPropertyMatchKey
variablegIOPropertyExistsMatchKey
extern const OSSymbol * gIOPropertyExistsMatchKey
variablegIOLocationMatchKey
extern const OSSymbol * gIOLocationMatchKey
variablegIOParentMatchKey
extern const OSSymbol * gIOParentMatchKey
variablegIOPathMatchKey
extern const OSSymbol * gIOPathMatchKey
variablegIOMatchCategoryKey
extern const OSSymbol * gIOMatchCategoryKey
variablegIODefaultMatchCategoryKey
extern const OSSymbol * gIODefaultMatchCategoryKey
variablegIOMatchedServiceCountKey
extern const OSSymbol * gIOMatchedServiceCountKey
variablegIOMatchedPersonalityKey
extern const OSSymbol * gIOMatchedPersonalityKey
variablegIORematchPersonalityKey
extern const OSSymbol * gIORematchPersonalityKey
variablegIORematchCountKey
extern const OSSymbol * gIORematchCountKey
variablegIODEXTMatchCountKey
extern const OSSymbol * gIODEXTMatchCountKey
variablegIOUserClientClassKey
extern const OSSymbol * gIOUserClientClassKey
variablegIOUserClassKey
extern const OSSymbol * gIOUserClassKey
variablegIOUserClassesKey
extern const OSSymbol * gIOUserClassesKey
variablegIOUserServerClassKey
extern const OSSymbol * gIOUserServerClassKey
variablegIOUserServerNameKey
extern const OSSymbol * gIOUserServerNameKey
variablegIOUserServerTagKey
extern const OSSymbol * gIOUserServerTagKey
variablegIOUserUserClientKey
extern const OSSymbol * gIOUserUserClientKey
variablegIOAssociatedServicesKey
extern const OSSymbol * gIOAssociatedServicesKey
variablegIOUserServerPreserveUserspaceRebootKey
extern const OSSymbol * gIOUserServerPreserveUserspaceRebootKey
variablegIOKitDebugKey
extern const OSSymbol * gIOKitDebugKey
variablegIOServiceKey
extern const OSSymbol * gIOServiceKey
variablegIOCommandPoolSizeKey
extern const OSSymbol * gIOCommandPoolSizeKey
variablegIOPublishNotification
extern const OSSymbol * gIOPublishNotification
variablegIOFirstPublishNotification
extern const OSSymbol * gIOFirstPublishNotification
variablegIOMatchedNotification
extern const OSSymbol * gIOMatchedNotification
variablegIOFirstMatchNotification
extern const OSSymbol * gIOFirstMatchNotification
variablegIOTerminatedNotification
extern const OSSymbol * gIOTerminatedNotification
variablegIOWillTerminateNotification
extern const OSSymbol * gIOWillTerminateNotification
variablegIOGeneralInterest
extern const OSSymbol * gIOGeneralInterest
variablegIOBusyInterest
extern const OSSymbol * gIOBusyInterest
variablegIOOpenInterest
extern const OSSymbol * gIOOpenInterest
variablegIOAppPowerStateInterest
extern const OSSymbol * gIOAppPowerStateInterest
variablegIOPriorityPowerStateInterest
extern const OSSymbol * gIOPriorityPowerStateInterest
variablegIOConsoleSecurityInterest
extern const OSSymbol * gIOConsoleSecurityInterest
variablegIODeviceMemoryKey
extern const OSSymbol * gIODeviceMemoryKey
variablegIOInterruptControllersKey
extern const OSSymbol * gIOInterruptControllersKey
variablegIOInterruptSpecifiersKey
extern const OSSymbol * gIOInterruptSpecifiersKey
variablegIOSupportedPropertiesKey
extern const OSSymbol * gIOSupportedPropertiesKey
variablegIOUserServicePropertiesKey
extern const OSSymbol * gIOUserServicePropertiesKey
variablegIOCompatibilityMatchKey
extern const OSSymbol * gIOCompatibilityMatchKey
variablegIOCompatibilityPropertiesKey
extern const OSSymbol * gIOCompatibilityPropertiesKey
variablegIOPathKey
extern const OSSymbol * gIOPathKey
variablegIOBSDNameKey
extern const OSSymbol * gIOBSDNameKey
variablegIOBSDMajorKey
extern const OSSymbol * gIOBSDMajorKey
variablegIOBSDMinorKey
extern const OSSymbol * gIOBSDMinorKey
variablegIOBSDUnitKey
extern const OSSymbol * gIOBSDUnitKey
variablegIOUserClientEntitlementsKey
extern const OSSymbol * gIOUserClientEntitlementsKey
variablegIODriverKitEntitlementKey
extern const OSSymbol * gIODriverKitEntitlementKey
variablegIOServiceDEXTEntitlementsKey
extern const OSSymbol * gIOServiceDEXTEntitlementsKey
variablegIODriverKitUserClientEntitlementsKey
extern const OSSymbol * gIODriverKitUserClientEntitlementsKey
variablegIODriverKitUserClientEntitlementAllowAnyKey
extern const OSSymbol * gIODriverKitUserClientEntitlementAllowAnyKey
variablegIODriverKitRequiredEntitlementsKey
extern const OSSymbol * gIODriverKitRequiredEntitlementsKey
variablegIODriverKitTestDriverEntitlementKey
extern const OSSymbol * gIODriverKitTestDriverEntitlementKey
variablegIODriverKitUserClientEntitlementCommunicatesWithDriversKey
extern const OSSymbol * gIODriverKitUserClientEntitlementCommunicatesWithDriversKey
variablegIODriverKitUserClientEntitlementAllowThirdPartyUserClientsKey
extern const OSSymbol * gIODriverKitUserClientEntitlementAllowThirdPartyUserClientsKey
variablegIOMatchDeferKey
extern const OSSymbol * gIOMatchDeferKey
variablegIOExclaveAssignedKey
extern const OSSymbol * gIOExclaveAssignedKey
variablegIOAllCPUInitializedKey
extern const OSSymbol * gIOAllCPUInitializedKey
functionIOServiceOrdering
extern SInt32 IOServiceOrdering( const OSMetaClassBase * inObj1, const OSMetaClassBase * inObj2, void * ref )
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu iokit/Kernel/IOService.cpp
Ordering function for OSOrderedSet collections of IOService matching structures. Evaluates each object's ordering value with IOServiceObjectOrder, using ref as the key of the property holding the value (e.g. gIOProbeScoreKey), and returns the difference val1 - val2. Used to keep driver personalities and probe candidates sorted by probe score.
typedefIOInterruptAction
typedef void (*)(OSObject *, void *, IOService *, int) IOInterruptAction;
typedefIOInterruptActionBlock
typedef void (^IOInterruptActionBlock)(IOService * nub, int source)
typedefIOStateNotificationHandler
typedef kern_return_t (^IOStateNotificationHandler)(void)
typedefIOStateNotificationListenerRef
typedef void * IOStateNotificationListenerRef
typedefIOServiceNotificationHandler
typedef bool (*)(void *, void *, IOService *) IOServiceNotificationHandler;
typedefIOServiceMatchingNotificationHandler
typedef bool (*)(void *, void *, IOService *, IONotifier *) IOServiceMatchingNotificationHandler;
typedefIOServiceMatchingNotificationHandlerBlock
typedef bool (^)(IOService *, IONotifier *) IOServiceMatchingNotificationHandlerBlock;
typedefIOServiceInterestHandler
typedef IOReturn (*)(void *, void *, UInt32, IOService *, void *, vm_size_t) IOServiceInterestHandler;
typedefIOServiceInterestHandlerBlock
typedef IOReturn (^)(uint32_t, IOService *, void *, size_t) IOServiceInterestHandlerBlock;
typedefIOServiceApplierFunction
typedef void (*IOServiceApplierFunction)(IOService * service, void * context)
typedefOSObjectApplierFunction
typedef void (*OSObjectApplierFunction)(OSObject * object, void * context)
typedefIOServiceApplierBlock
typedef void (^IOServiceApplierBlock)(IOService * service)
typedefOSObjectApplierBlock
typedef void (^OSObjectApplierBlock)(OSObject * object)
classIOService
: public IORegistryEntry
| ExpansionData * | reserved | |
| bool | initialized | |
| void * | pm_vars | |
| int | _numInterruptSources | |
| IOInterruptSource * | _interruptSources |
virtual bool requestTerminate(IOService * provider, IOOptionBits options)virtual
virtual bool willTerminate(IOService * provider, IOOptionBits options)virtual
virtual bool didTerminate(IOService * provider, IOOptionBits options, bool * defer)virtual
virtual SInt32 nextIdleTimeout( AbsoluteTime currentTime, AbsoluteTime lastActivity, unsigned int powerState )virtual
virtual void systemWillShutdown(IOOptionBits specifier)virtual
virtual IOReturn configureReport( IOReportChannelList *channels, IOReportConfigureAction action, void *result, void *destination )virtual
@function configureReport
@abstract configure IOReporting channels
@availability SPI on OS X v10.9 / iOS 7 and later
@param channels - channels to configure
@param action - enable/disable/size, etc
@param result - action-specific returned value
@param destination - action-specific default destination
virtual IOReturn updateReport( IOReportChannelList *channels, IOReportUpdateAction action, void *result, void *destination )virtual
@function updateReport
@abstract request current data for the specified channels
@availability SPI on OS X 10.9 / iOS 7 and later
@param channels - channels to be updated
@param action - type/style of update
@param result - returned details about what was updated
@param destination - destination for this update (action-specific)
IOReturn _ConfigureReport( IOReportChannelList *channels, IOReportConfigureAction action, void *result, void *destination )protected
these are helper methods for DriverKit
IOReturn _UpdateReport( IOReportChannelList *channels, IOReportUpdateAction action, void *result, void *destination )protected
virtual IOOptionBits getState(void) constvirtual
bool isInactive(void) const
virtual void registerService(IOOptionBits options = 0)virtual
virtual LIBKERN_RETURNS_NOT_RETAINED IOService * probe( IOService * provider, SInt32 * score )virtual
virtual bool start(IOService * provider)virtual
virtual void stop(IOService * provider)virtual
virtual bool open(IOService * forClient, IOOptionBits options = 0, void * arg = NULL)virtual
virtual void close(IOService * forClient, IOOptionBits options = 0)virtual
virtual bool handleOpen(IOService * forClient, IOOptionBits options, void * arg)virtual
virtual void handleClose(IOService * forClient, IOOptionBits options)virtual
virtual bool handleIsOpen(const IOService * forClient) constvirtual
virtual bool terminate(IOOptionBits options = 0)virtual
virtual bool finalize(IOOptionBits options)virtual
APPLE_KEXT_OVERRIDE virtual bool init(OSDictionary * dictionary = NULL)virtual
@function init
@abstract Initializes generic IOService data structures (expansion data, etc).
APPLE_KEXT_OVERRIDE virtual bool init(IORegistryEntry * from, const IORegistryPlane * inPlane)virtual
@function init
@abstract Initializes generic IOService data structures (expansion data, etc).
APPLE_KEXT_OVERRIDE
virtual void free(void)virtualvirtual bool lockForArbitration(bool isSuccessRequired = true)virtual
virtual void unlockForArbitration(void)virtual
virtual bool terminateClient(IOService * client, IOOptionBits options)virtual
virtual UInt32 getBusyState(void)virtual
virtual void adjustBusy(SInt32 delta)virtual
APPLE_KEXT_DEPRECATED IOReturn waitQuiet(mach_timespec_t * timeout)· deprecated
IOReturn waitQuiet(uint64_t timeout = UINT64_MAX)
virtual bool matchPropertyTable(OSDictionary * table, SInt32 * score)virtual
virtual bool matchPropertyTable(OSDictionary * table)virtual
virtual LIBKERN_RETURNS_NOT_RETAINED IOService * matchLocation(IOService * client)virtual
virtual bool addNeededResource(const char * key)virtual
APPLE_KEXT_DEPRECATED static OSPtr<IONotifier> addNotification( const OSSymbol * type, OSDictionary * matching, IOServiceNotificationHandler handler, void * target, void * ref = NULL, SInt32 priority = 0 )static · deprecated
static IONotifier * addMatchingNotification( const OSSymbol * type, OSDictionary * matching, IOServiceMatchingNotificationHandler handler, void * target, void * ref = NULL, SInt32 priority = 0 )static
static IONotifier * addMatchingNotification( const OSSymbol * type, OSDictionary * matching, SInt32 priority, IOServiceMatchingNotificationHandlerBlock handler )static
static LIBKERN_RETURNS_NOT_RETAINED IOService * waitForService( LIBKERN_CONSUMED OSDictionary * matching, mach_timespec_t * timeout = NULL )static
static OSPtr<IOService> waitForMatchingService( OSDictionary * matching, uint64_t timeout = UINT64_MAX )static
static OSPtr<OSIterator> getMatchingServices(OSDictionary * matching)static
static OSPtr<IOService> copyMatchingService(OSDictionary * matching)static
static OSPtr<OSDictionary> serviceMatching( const char * className, OSDictionary * table = NULL )static
static OSSharedPtr<OSDictionary> serviceMatching( const char * className, OSSharedPtr<OSDictionary> table )static
static OSPtr<OSDictionary> serviceMatching( const OSString * className, OSDictionary * table = NULL )static
static OSSharedPtr<OSDictionary> serviceMatching( const OSString * className, OSSharedPtr<OSDictionary> table )static
static OSPtr<OSDictionary> nameMatching(const char * name, OSDictionary * table = NULL)static
static OSSharedPtr<OSDictionary> nameMatching( const char * name, OSSharedPtr<OSDictionary> table )static
static OSPtr<OSDictionary> nameMatching(const OSString* name, OSDictionary * table = NULL)static
static OSSharedPtr<OSDictionary> nameMatching( const OSString* name, OSSharedPtr<OSDictionary> table )static
static OSPtr<OSDictionary> resourceMatching( const char * name, OSDictionary * table = NULL )static
static OSSharedPtr<OSDictionary> resourceMatching( const char * name, OSSharedPtr<OSDictionary> table )static
static OSPtr<OSDictionary> resourceMatching( const OSString * name, OSDictionary * table = NULL )static
static OSSharedPtr<OSDictionary> resourceMatching( const OSString * name, OSSharedPtr<OSDictionary> table )static
static OSPtr<OSDictionary> propertyMatching( const OSSymbol * key, const OSObject * value, OSDictionary * table = NULL )static
static OSSharedPtr<OSDictionary> propertyMatching( const OSSymbol * key, const OSObject * value, OSSharedPtr<OSDictionary> table )static
static OSDictionary * registryEntryIDMatching( uint64_t entryID, OSDictionary * table = NULL )static
static OSSharedPtr<OSDictionary> registryEntryIDMatching( uint64_t entryID, OSSharedPtr<OSDictionary> table )static
static OSPtr<OSDictionary> addLocation(OSDictionary * table)static
virtual bool compareProperty(OSDictionary * matching, const char * key)virtual
virtual bool compareProperty(OSDictionary * matching, const OSString * key)virtual
virtual bool compareProperties(OSDictionary * matching, OSCollection * keys)virtual
virtual bool attach(IOService * provider)virtual
virtual void detach(IOService * provider)virtual
virtual IOService * getProvider(void) constvirtual
virtual IOWorkLoop * getWorkLoop() constvirtual
virtual OSPtr<OSIterator> getProviderIterator(void) constvirtual
virtual OSPtr<OSIterator> getOpenProviderIterator(void) constvirtual
virtual IOService * getClient(void) constvirtual
virtual OSPtr<OSIterator> getClientIterator(void) constvirtual
virtual OSPtr<OSIterator> getOpenClientIterator(void) constvirtual
virtual IOReturn callPlatformFunction( const OSSymbol * functionName, bool waitForFunction, void *param1, void *param2, void *param3, void *param4 )virtual
virtual IOReturn callPlatformFunction( const char * functionName, bool waitForFunction, void *param1, void *param2, void *param3, void *param4 )virtual
static IOPlatformExpert * getPlatform(void)static
static class IOPMrootDomain * getPMRootDomain(void)static
static IOService * getServiceRoot(void)static
static IOService * getResourceService(void)static
static IOService * getSystemStateNotificationService(void)static
virtual IOReturn getResources(void)virtual
virtual IOItemCount getDeviceMemoryCount(void)virtual
virtual IODeviceMemory * getDeviceMemoryWithIndex(unsigned int index)virtual
virtual IOMemoryMap * mapDeviceMemoryWithIndex( unsigned int index, IOOptionBits options = 0 )virtual
virtual OSArray * getDeviceMemory(void)virtual
virtual void setDeviceMemory(OSArray * array)virtual
virtual IOReturn registerInterrupt( int source, OSObject *target, IOInterruptAction handler, void *refCon = NULL )virtual
IOReturn registerInterruptBlock( int source, OSObject *target, IOInterruptActionBlock handler )
virtual IOReturn unregisterInterrupt(int source)virtual
IOReturn addInterruptStatistics(IOInterruptAccountingData * statistics, int source)
@function addInterruptStatistics
@abstract Adds a statistics object to the IOService for the given interrupt.
@discussion This method associates a set of statistics and a reporter for those statistics with an interrupt for this IOService, so that we can interrogate the IOService for statistics pertaining to that interrupt.
@param statistics The IOInterruptAccountingData container we wish to associate the IOService with.
@param source The index of the interrupt source in the device.
IOReturn removeInterruptStatistics(int source)
@function removeInterruptStatistics
@abstract Removes any statistics from the IOService for the given interrupt.
@discussion This method disassociates any IOInterruptAccountingData container we may have for the given interrupt from the IOService; this indicates that the the interrupt target (at the moment, likely an IOInterruptEventSource) is being destroyed.
@param source The index of the interrupt source in the device.
virtual IOReturn getInterruptType(int source, int *interruptType)virtual
virtual IOReturn enableInterrupt(int source)virtual
virtual IOReturn disableInterrupt(int source)virtual
virtual IOReturn causeInterrupt(int source)virtual
virtual IOReturn requestProbe(IOOptionBits options)virtual
virtual IOReturn messageClient( UInt32 messageType, OSObject * client, void * messageArgument = NULL, vm_size_t argSize = 0 )virtual
virtual IOReturn messageClients( UInt32 type, void * argument = NULL, vm_size_t argSize = 0 )virtual
virtual OSPtr<IONotifier> registerInterest( const OSSymbol * typeOfInterest, IOServiceInterestHandler handler, void * target, void * ref = NULL )virtual
OSPtr<IONotifier> registerInterest( const OSSymbol * typeOfInterest, IOServiceInterestHandlerBlock handler )
virtual void applyToProviders(IOServiceApplierFunction applier, void * context)virtual
virtual void applyToClients(IOServiceApplierFunction applier, void * context)virtual
void applyToProviders(IOServiceApplierBlock applier)
void applyToClients(IOServiceApplierBlock applier)
virtual void applyToInterested( const OSSymbol * typeOfInterest, OSObjectApplierFunction applier, void * context )virtual
virtual IOReturn acknowledgeNotification( IONotificationRef notification, IOOptionBits response )virtual
virtual IOReturn newUserClient( task_t owningTask, void * securityID, UInt32 type, OSDictionary * properties, LIBKERN_RETURNS_RETAINED IOUserClient ** handler )virtual
virtual IOReturn newUserClient( task_t owningTask, void * securityID, UInt32 type, LIBKERN_RETURNS_RETAINED IOUserClient ** handler )virtual
IOReturn newUserClient( task_t owningTask, void * securityID, UInt32 type, OSDictionary * properties, OSSharedPtr<IOUserClient>& handler )
IOReturn newUserClient( task_t owningTask, void * securityID, UInt32 type, OSSharedPtr<IOUserClient>& handler )
virtual const char * stringFromReturn(IOReturn rtn)virtual
virtual int errnoFromReturn(IOReturn rtn)virtual
IOReturn requireMaxInterruptDelay(uint32_t ns)
APPLE_KEXT_DEPRECATED IOService * getClientWithCategory(const OSSymbol * category)· deprecated
virtual void PMinit(void)virtual
virtual void PMstop(void)virtual
virtual void joinPMtree(IOService * driver)virtual
virtual IOReturn registerPowerDriver( IOService * controllingDriver, IOPMPowerState * powerStates, unsigned long numberOfStates )virtual
IOPMPowerFlags registerInterestedDriver(IOService * theDriver)
IOReturn acknowledgeSetPowerState(void)
virtual IOReturn requestPowerDomainState( IOPMPowerFlags desiredState, IOPowerConnection * whichChild, unsigned long specificationFlags )virtual
IOReturn makeUsable(void)
IOReturn temporaryPowerClampOn(void)
IOReturn changePowerStateTo(unsigned long ordinal)
IOPMPowerFlags currentCapability(void)
unsigned long currentPowerConsumption(void)
virtual bool activityTickle(unsigned long type, unsigned long stateNumber = 0)virtual
virtual IOReturn setAggressiveness(unsigned long type, unsigned long newLevel)virtual
virtual IOReturn getAggressiveness(unsigned long type, unsigned long * currentLevel)virtual
virtual IOReturn removePowerChild(IOPowerConnection * theChild)virtual
void start_PM_idle_timer(void)
virtual IOReturn setIdleTimerPeriod(unsigned long period)virtual
UInt32 getPowerState(void)
UInt32 getDesiredPowerState(void)
virtual unsigned long maxCapabilityForDomainState(IOPMPowerFlags domainState)virtual
virtual unsigned long initialPowerStateForDomainState(IOPMPowerFlags domainState)virtual
virtual unsigned long powerStateForDomainState(IOPMPowerFlags domainState)virtual
virtual IOReturn powerStateWillChangeTo( IOPMPowerFlags capabilities, unsigned long stateNumber, IOService * whatDevice )virtual
virtual IOReturn powerStateDidChangeTo( IOPMPowerFlags capabilities, unsigned long stateNumber, IOService * whatDevice )virtual
virtual bool askChangeDown(unsigned long)virtual
virtual bool tellChangeDown(unsigned long)virtual
virtual void tellNoChangeDown(unsigned long)virtual
virtual void tellChangeUp(unsigned long)virtual
virtual IOReturn allowPowerChange(unsigned long refcon)virtual
virtual IOReturn cancelPowerChange(unsigned long refcon)virtual
IOReturn changePowerStateToPriv(unsigned long ordinal)
IOReturn powerOverrideOnPriv(void)
IOReturn powerOverrideOffPriv(void)
virtual void powerChangeDone(unsigned long stateNumber)virtual