1sysevent_bind_handle(3SYSSEyVsEtNeTm)Event Library Funscytsieovnesnt_bind_handle(3SYSEVENT)
2
3
4
6 sysevent_bind_handle, sysevent_unbind_handle - bind or unbind sub‐
7 scriber handle
8
10 cc [flag...] file ... -lsysevent [library ...]
11 #include <libsysevent.h>
12
13 sysevent_handle_t *sysevent_bind_handle(void (*event_handler)
14 (sysevent_t *ev));
15
16
17 void sysevent_unbind_handle(sysevent_handle_t *sysevent_hdl);
18
19
21 ev pointer to sysevent buffer handle
22
23
24 event_handler pointer to an event handling function
25
26
27 sysevent_hdl pointer to a sysevent subscriber handle
28
29
31 The sysevent_bind_handle() function allocates memory associated with a
32 subscription handle and binds it to the caller's event_handler. The
33 event_handler is invoked during subsequent system event notifications
34 once a subscription has been made with sysevent_subscribe_event(3SYSEV‐
35 ENT).
36
37
38 The system event is represented by the argument ev and is passed as an
39 argument to the invoked event delivery function, event_handler.
40
41
42 Additional threads are created to service communication between sysev‐
43 entd(1M) and the calling process and to run the event handler routine,
44 event_handler.
45
46
47 The sysevent_unbind_handle() function deallocates memory and other
48 resources associated with a subscription handle and deactivates all
49 system event notifications for the calling process. All event notifi‐
50 cations are guaranteed to stop upon return from sysevent_unbind_han‐
51 dle().
52
54 The sysevent_bind_handle() function returns a valid sysevent subscriber
55 handle if the handle is successfully allocated. Otherwise, NULL is
56 returned and errno is set to indicate the error.
57
58
59 The sysevent_unbind_handle() function returns no value.
60
62 The sysevent_bind_handle() function will fail if:
63
64 EACCES The calling process has an ID other than the privileged user.
65
66
67 EBUSY There are no resources available.
68
69
70 EINVAL The pointer to the function event_handler is NULL.
71
72
73 EMFILE The process has too many open descriptors.
74
75
76 ENOMEM There are insufficient resources to allocate the handle.
77
78
80 See attributes(5) for descriptions of the following attributes:
81
82
83
84
85 ┌─────────────────────────────┬─────────────────────────────┐
86 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
87 ├─────────────────────────────┼─────────────────────────────┤
88 │Interface Stability │Committed │
89 ├─────────────────────────────┼─────────────────────────────┤
90 │MT-Level │MT-Safe │
91 └─────────────────────────────┴─────────────────────────────┘
92
94 syseventd(1M), sysevent_subscribe_event(3SYSEVENT), attributes(5)
95
97 Event notifications are revoked by syseventd when the bound process
98 dies. Event notification is suspended if a signal is caught and han‐
99 dled by the event_handler thread. Event notification is also suspended
100 when the calling process attempts to use fork(2) or fork1(2). Event
101 notifications might be lost during suspension periods.
102
103
104 The libsysevent interfaces do not work at all in non-global zones.
105
106
107
108SunOS 5.11 24 Jul 2009 sysevent_bind_handle(3SYSEVENT)