Kernel Functions for Drivers ldiaddeventhandler(9F)
NAME
ldiaddeventhandler - add NDI event service callback
handler
SYNOPSIS
#include
int ldiaddeventhandler(ldihandlet lh, ddieventcookiet ec,
void (*handler)(ldihandlet, ddieventcookiet,
void *, void *) void *arg, ldicallbackidt *id);
INTERFACE LEVEL
Obsolete
PARAMETERS
ldihandlet lh
Layered handle representing event notification device.
ddieventcookiet ec
Cookie returned from call to ldigeteventcookie(9F).
void (*handler)(ldihandlet, ddieventcookiet, void *,
void *)
Callback handler for NDI event service notification.
void *arg
Pointer to opaque data supplied by caller. Typically,
this is a pointer to the layered driver's softstate
structure.
ldicallbackidt *id
Pointer to registration id, where a unique registration
id is returned. Registration id must be saved and used
when calling ldiremoveeventhandler(9F) to unregister
a callback handler.
DESCRIPTION
This function is obsolete and is only maintained for compa-
tibility. Use of this function is strongly discouraged. For
equivalent functionality provided by new interfaces, see
ldievgetcookie(9F) and ldievregistercallbacks(9F).
SunOS 5.11 Last change: 21 Aug 2007 1
Kernel Functions for Drivers ldiaddeventhandler(9F)
The ldiaddeventhandler() function adds a callback handler
to be invoked at the occurance of the event specified by the
cookie. Adding a callback handler is also known as subscrib-
ing to an event. Upon successful subscription, the handler
is invoked when the event occurs. You can unregister the
handler by using ldiremoveeventhandler(9F).
An instance of a layered driver can register multiple
handlers for an event or a single handler for multiple
events. Callback order is not defined and should be assumed
to be random.
The routine handler is invoked with the following arguments:
ldihandlet lh Layered handle representing the dev-
ice for which the event notification
is requested.
ddieventcookiet ec Structure describing event that
occurred.
void *arg Opaque data pointer provided by the
driver during callback registration.
void *impldata Pointer to event specific data
defined by the framework that
invokes the callback function.
RETURN VALUES
DISUCES Callback handler registered successfully.
DIFAILURE Failed to register callback handler. Possible
reasons include lack of resources or a bad
cookie.
CONTEXT
The ldiaddeventhandler() function can be called from user
and kernel contexts only.
SEE ALSO
ldievgetcookie(9F), ldievregistercallbacks(9F),
ldigeteventcookie(9F), ldiremoveeventhandler(9F)
SunOS 5.11 Last change: 21 Aug 2007 2
Kernel Functions for Drivers ldiaddeventhandler(9F)
Writing Device Drivers
NOTES
Layered drivers must remove all registered callback handlers
for a device instance, represented by the layered handle, by
calling ldiremoveeventhandler(9F) before the layered
driver's detach(9E) routine completes.
SunOS 5.11 Last change: 21 Aug 2007 3
|