Mac Developer Library

Developer

RootDomain.h Reference

Options
Deployment Target:

On This Page

RootDomain.h Reference

Included Headers

  • <IOKit/IOService.h>

  • <IOKit/pwr_mgt/IOPM.h>

  • <IOKit/IOBufferMemoryDescriptor.h>

Functions

  • Copy the current value for a PM setting. Returns an OSNumber or OSData depending on the setting.

    Declaration

    Objective-C

    OSObject * copyPMSetting( OSSymbol *whichSetting );

    Parameters

    whichSetting

    Name of the desired setting.

    Return Value

    OSObject value if valid, NULL otherwise.

    Import Statement

  • Creates an assertion to influence system power behavior.

    Declaration

    Objective-C

    IOPMDriverAssertionID createPMAssertion( IOPMDriverAssertionType whichAssertionsBits, IOPMDriverAssertionLevel assertionLevel, IOService *ownerService, const char *ownerDescription);

    Parameters

    whichAssertionBits

    A bitfield specify the assertion that the caller requests.

    assertionLevel

    An integer detailing the initial assertion level, kIOPMDriverAssertionLevelOn or kIOPMDriverAssertionLevelOff.

    ownerService

    A pointer to the caller's IOService class, for tracking.

    ownerDescription

    A reverse-DNS string describing the caller's identity and reason.

    Return Value

    On success, returns a new assertion of type IOPMDriverAssertionID

    Import Statement

  • Declaration

    Objective-C

    IOPMDriverAssertionLevel getPMAssertionLevel( IOPMDriverAssertionType whichAssertionBits);

    Parameters

    whichAssertionBits

    Bits defining the assertion or assertions the caller is interested in the level of. If in doubt, pass kIOPMDriverAssertionCPUBit in IOPM.h User-Space Reference as the argument.

    Return Value

    Returns kIOPMDriverAssertionLevelOff or kIOPMDriverAssertionLevelOn indicating the specified assertion's levels, if available. If the assertions aren't supported on this machine, or aren't recognized by the OS, the result is undefined.

    Discussion

    Returns kIOPMDriverAssertionLevelOff or kIOPMDriverAssertionLevelOn. If multiple assertions are specified in the bitfield, only returns kIOPMDriverAssertionLevelOn if all assertions are active.

    Import Statement

  • Register for callbacks on changes to certain PM settings.

    Declaration

    Objective-C

    IOReturn registerPMSettingController( const OSSymbol *settings[], IOPMSettingControllerCallback callout, OSObject *target, uintptr_t refcon, OSObject **handle); // out param

    Parameters

    settings

    NULL terminated array of C strings, each string for a PM setting that the caller is interested in and wants to get callbacks for.

    callout

    C function ptr or member function cast as such.

    target

    The target of the callback, usually 'this'

    refcon

    Will be passed to caller in callback; for caller's use.

    handle

    Caller should keep the OSObject * returned here. If non-NULL, handle will have a retain count of 1 on return. To deregister, pass to unregisterPMSettingController()

    Return Value

    kIOReturnSuccess on success.

    Import Statement

  • Register for callbacks on changes to certain PM settings.

    Declaration

    Objective-C

    IOReturn registerPMSettingController( const OSSymbol *settings[], uint32_t supportedPowerSources, IOPMSettingControllerCallback callout, OSObject *target, uintptr_t refcon, OSObject **handle); // out param

    Parameters

    settings

    NULL terminated array of C strings, each string for a PM setting that the caller is interested in and wants to get callbacks for.

    supportedPowerSources

    bitfield indicating which power sources these settings are supported for (kIOPMSupportedOnAC, etc.)

    callout

    C function ptr or member function cast as such.

    target

    The target of the callback, usually 'this'

    refcon

    Will be passed to caller in callback; for caller's use.

    handle

    Caller should keep the OSObject * returned here. If non-NULL, handle will have a retain count of 1 on return. To deregister, pass to unregisterPMSettingController()

    Return Value

    kIOReturnSuccess on success.

    Import Statement

  • Removes an assertion to influence system power behavior.

    Declaration

    Objective-C

    IOReturn releasePMAssertion( IOPMDriverAssertionID releaseAssertion);

    Return Value

    On success, returns a new assertion of type IOPMDriverAssertionID *

    Import Statement

  • Other drivers may inform IOPMrootDomain of system PM events

    Declaration

    Objective-C

    IOReturn systemPowerEventOccurred( const OSSymbol *event, uint32_t intValue );

    Parameters

    event

    An OSSymbol describing the type of power event.

    value

    A 32-bit integer value associated with the event.

    shouldUpdate

    indicates whether the root domain should send a notification to interested parties. Pass false if you're calling systemPowerEventOccurred several times in succession; and pass true only on the last invocatino.

    Return Value

    kIOReturnSuccess on success

    Discussion

    systemPowerEventOccurred is a richer alternative to receivePowerNotification() Only Apple-owned kexts should have reason to call systemPowerEventOccurred.

    Import Statement

Data Types

See the Overview section above for header-level documentation.

  • Declaration

    Objective-C

    /*! IOPMDriverAssertionType */ typedef uint64_t IOPMDriverAssertionType;

    Discussion

    Types for PM Assertions For creating, releasing, and getting PM assertion levels.

    Import Statement

    Availability

    Available in OS X v10.7 and later.