Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ldi_add_event_handler(9f) [opensolaris man page]

ldi_add_event_handler(9F)				   Kernel Functions for Drivers 				 ldi_add_event_handler(9F)

NAME
ldi_add_event_handler - add NDI event service callback handler SYNOPSIS
#include <sys/ddi_obsolete.h> int ldi_add_event_handler(ldi_handle_t lh, ddi_eventcookie_t ec, void (*handler)(ldi_handle_t, ddi_eventcookie_t, void *, void *) void *arg, ldi_callback_id_t *id); INTERFACE LEVEL
Obsolete PARAMETERS
ldi_handle_t lh Layered handle representing event notification device. ddi_eventcookie_t ec Cookie returned from call to ldi_get_eventcookie(9F). void (*handler)(ldi_handle_t, ddi_eventcookie_t, 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. ldi_callback_id_t *id Pointer to registration id, where a unique registration id is returned. Registration id must be saved and used when calling ldi_remove_event_handler(9F) to unregister a callback handler. DESCRIPTION
This function is obsolete and is only maintained for compatibility. Use of this function is strongly discouraged. For equivalent function- ality provided by new interfaces, see ldi_ev_get_cookie(9F) and ldi_ev_register_callbacks(9F). The ldi_add_event_handler() 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 subscribing to an event. Upon successful subscription, the handler is invoked when the event occurs. You can unregister the handler by using ldi_remove_event_handler(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: ldi_handle_t lh Layered handle representing the device for which the event notification is requested. ddi_eventcookie_t ec Structure describing event that occurred. void *arg Opaque data pointer provided by the driver during callback registration. void *impl_data Pointer to event specific data defined by the framework that invokes the callback function. RETURN VALUES
DDI_SUCCESS Callback handler registered successfully. DDI_FAILURE Failed to register callback handler. Possible reasons include lack of resources or a bad cookie. CONTEXT
The ldi_add_event_handler() function can be called from user and kernel contexts only. SEE ALSO
ldi_ev_get_cookie(9F), ldi_ev_register_callbacks(9F), ldi_get_eventcookie(9F), ldi_remove_event_handler(9F) Writing Device Drivers NOTES
Layered drivers must remove all registered callback handlers for a device instance, represented by the layered handle, by calling ldi_remove_event_handler(9F) before the layered driver's detach(9E) routine completes. SunOS 5.11 21 Aug 2007 ldi_add_event_handler(9F)

Check Out this Related Man Page

ptree_register_handler(3PICLTREE)			  PICL Plug-In Library Functions			 ptree_register_handler(3PICLTREE)

NAME
ptree_register_handler - register a handler for the event SYNOPSIS
cc [ flag... ] file... -lpicltree [ library... ] #include <picltree.h> int ptree_register_handler(const char *ename, void (*evt_handler)(const char *ename, const void *earg, size_t size, void *cookie), void *cookie); DESCRIPTION
The ptree_register_handler() function registers an event handler for a PICL event. The argument ename specifies the name of the PICL event for which to register the handler. The argument evt_handler specifies the event handler function. The argument cookie is a pointer to call- er-specific data to be passed as an argument to the event handler when it is invoked. The event handler function must be defined as void evt_handler(const char *ename, const void *earg, size_t size, void *cookie) where, ename, earg, size, and cookie are the arguments passed to the event handler when it is invoked. The argument ename is the PICL event name for which the handler is invoked. The arguments earg and size gives the pointer to the event argument buffer and its size, respec- tively. The argument cookie is the pointer to the caller specific data registered with the handler. The arguments ename and earg point to buffers that are transient and shall not be modified by the event handler or reused after the event handler finishes execution. The PICL framework invokes the event handlers in the order in which they were registered when dispatching an event. If the event handler execution order is required to be the same as the plug-in dependency order, then a plug-in should register its handlers from its init func- tion. The handlers that do not have any ordering dependencies on other plug-in handlers can be registered at any time. The registered handler may be called at any time after this function is called. RETURN VALUES
Upon successful completion, 0 is returned. On failure, a non-negative integer is returned to indicate an error and the handler is not reg- istered. ERRORS
PICL_INVALIDARG Invalid argument PICL_FAILURE General system failure ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
ptree_unregister_handler(3PICLTREE), attributes(5) SunOS 5.11 1 Aug 2000 ptree_register_handler(3PICLTREE)
Man Page