Contents

addNotification

Deprecated use addMatchingNotification(). Adds a persistant notification handler to be notified of IOService events.

Declaration

static IONotifier * addNotification( 
 const OSSymbol *type,
 OSDictionary *matching, 
 IOServiceNotificationHandler handler, 
 void *target,
 void *ref = 0, 
 SInt32 priority = 0 ) __attribute__((deprecated));

Parameters

  • type:

    An OSSymbol identifying the type of notification and IOService state:

    gIOPublishNotification Delivered when an IOService object is registered.

    gIOFirstPublishNotification Delivered when an IOService object is registered, but only once per IOService instance. Some IOService objects may be reregistered when their state is changed.

    gIOMatchedNotification Delivered when an IOService object has been matched with all client drivers, and they have been probed and started.

    gIOFirstMatchNotification Delivered when an IOService object has been matched with all client drivers, but only once per IOService instance. Some IOService objects may be reregistered when their state is changed.

    gIOTerminatedNotification Delivered after an IOService object has been terminated, during its finalize stage.

  • matching:

    A matching dictionary to restrict notifications to only matching IOService objects. The dictionary will be released when the notification is removed, consuming the passed-in reference.

  • handler:

    A C function callback to deliver notifications.

  • target:

    An instance reference for the callback's use.

  • ref:

    A reference constant for the callback's use.

  • priority:

    A constant ordering all notifications of a each type.

Return Value

An instance of an IONotifier object that can be used to control or destroy the notification request.

Overview

IOService will deliver notifications of changes in state of an IOService object to registered clients. The type of notification is specified by a symbol, for example gIOMatchedNotification or gIOTerminatedNotification, and notifications will only include IOService objects that match the supplied matching dictionary. Notifications are ordered by a priority set with addNotification. When the notification is installed, its handler will be called with each of any currently existing IOService objects that are in the correct state (eg. registered) and match the supplied matching dictionary, avoiding races between finding preexisting and new IOService events. The notification request is identified by an instance of an IONotifier object, through which it can be enabled, disabled, or removed. addNotification consumes a retain count on the matching dictionary when the notification is removed.

See Also

Miscellaneous