1ldi_add_event_handler(9F)Kernel Functions for Driversldi_add_event_handler(9F)
2
3
4

NAME

6       ldi_add_event_handler - add NDI event service callback handler
7

SYNOPSIS

9       #include <sys/ddi_obsolete.h>
10
11       int ldi_add_event_handler(ldi_handle_t lh, ddi_eventcookie_t ec,
12            void (*handler)(ldi_handle_t, ddi_eventcookie_t,
13            void *, void *) void *arg, ldi_callback_id_t *id);
14
15

INTERFACE LEVEL

17       Obsolete
18

PARAMETERS

20       ldi_handle_t lh
21
22           Layered handle representing event notification device.
23
24
25       ddi_eventcookie_t ec
26
27           Cookie returned from call to ldi_get_eventcookie(9F).
28
29
30       void (*handler)(ldi_handle_t, ddi_eventcookie_t, void *, void *)
31
32           Callback handler for NDI event service notification.
33
34
35       void *arg
36
37           Pointer  to  opaque  data  supplied by caller. Typically, this is a
38           pointer to the layered driver's softstate structure.
39
40
41       ldi_callback_id_t *id
42
43           Pointer to registration id,  where  a  unique  registration  id  is
44           returned.  Registration  id  must  be  saved  and used when calling
45           ldi_remove_event_handler(9F) to unregister a callback handler.
46
47

DESCRIPTION

49       This function is obsolete and is only maintained for compatibility. Use
50       of  this function is strongly discouraged. For equivalent functionality
51       provided by new interfaces, see ldi_ev_get_cookie(9F) and ldi_ev_regis‐
52       ter_callbacks(9F).
53
54
55       The  ldi_add_event_handler()  function  adds  a  callback handler to be
56       invoked at the occurance of the event specified by the cookie. Adding a
57       callback  handler  is  also known as subscribing to an event. Upon suc‐
58       cessful subscription, the handler is invoked when the event occurs. You
59       can unregister the handler by using ldi_remove_event_handler(9F).
60
61
62       An  instance  of a layered driver can register multiple handlers for an
63       event or a single handler for multiple events. Callback  order  is  not
64       defined and should be assumed to be random.
65
66
67       The routine handler is invoked with the following arguments:
68
69       ldi_handle_t lh         Layered  handle  representing  the  device  for
70                               which the event notification is requested.
71
72
73       ddi_eventcookie_t ec    Structure describing event that occurred.
74
75
76       void *arg               Opaque data pointer provided by the driver dur‐
77                               ing callback registration.
78
79
80       void *impl_data         Pointer  to  event specific data defined by the
81                               framework that invokes the callback function.
82
83

RETURN VALUES

85       DDI_SUCCESS    Callback handler registered successfully.
86
87
88       DDI_FAILURE    Failed to register callback  handler.  Possible  reasons
89                      include lack of resources or a bad cookie.
90
91

CONTEXT

93       The ldi_add_event_handler() function can be called from user and kernel
94       contexts only.
95

SEE ALSO

97       ldi_ev_get_cookie(9F),  ldi_ev_register_callbacks(9F),   ldi_get_event‐
98       cookie(9F), ldi_remove_event_handler(9F)
99
100
101       Writing Device Drivers
102

NOTES

104       Layered  drivers  must  remove  all  registered callback handlers for a
105       device  instance,  represented  by  the  layered  handle,  by   calling
106       ldi_remove_event_handler(9F)  before  the  layered  driver's detach(9E)
107       routine completes.
108
109
110
111SunOS 5.11                        21 Aug 2007        ldi_add_event_handler(9F)
Impressum