2 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
4 .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
5 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH SYSEVENT_BIND_HANDLE 3SYSEVENT "Jul 24, 2009"
8 sysevent_bind_handle, sysevent_unbind_handle \- bind or unbind subscriber
13 \fBcc\fR [\fIflag\fR\&.\|.\|.] \fIfile\fR \&.\|.\|. \fB-lsysevent\fR [\fIlibrary\fR \&.\|.\|.]
14 #include <libsysevent.h>
16 \fBsysevent_handle_t *\fR\fBsysevent_bind_handle\fR(\fBvoid (*\fR\fIevent_handler\fR)
17 (sysevent_t *\fIev\fR));
22 \fBvoid\fR \fBsysevent_unbind_handle\fR(\fBsysevent_handle_t *\fR\fIsysevent_hdl\fR);
32 pointer to \fBsysevent\fR buffer handle
38 \fB\fIevent_handler\fR\fR
41 pointer to an event handling function
47 \fB\fIsysevent_hdl\fR\fR
50 pointer to a \fBsysevent\fR subscriber handle
56 The \fBsysevent_bind_handle()\fR function allocates memory associated with a
57 subscription handle and binds it to the caller's \fIevent_handler\fR. The
58 \fIevent_handler\fR is invoked during subsequent system event notifications
59 once a subscription has been made with
60 \fBsysevent_subscribe_event\fR(3SYSEVENT).
63 The system event is represented by the argument \fIev\fR and is passed as an
64 argument to the invoked event delivery function, \fIevent_handler\fR.
67 Additional threads are created to service communication between
68 \fBsyseventd\fR(1M) and the calling process and to run the event handler
69 routine, \fIevent_handler\fR.
72 The \fBsysevent_unbind_handle()\fR function deallocates memory and other
73 resources associated with a subscription handle and deactivates all system
74 event notifications for the calling process. All event notifications are
75 guaranteed to stop upon return from \fBsysevent_unbind_handle()\fR.
79 The \fBsysevent_bind_handle()\fR function returns a valid \fBsysevent\fR
80 subscriber handle if the handle is successfully allocated. Otherwise,
81 \fINULL\fR is returned and \fBerrno\fR is set to indicate the error.
84 The \fBsysevent_unbind_handle()\fR function returns no value.
88 The \fBsysevent_bind_handle()\fR function will fail if:
95 The calling process has an ID other than the privileged user.
104 There are no resources available.
113 The pointer to the function \fIevent_handler\fR is \fINULL\fR.
122 The process has too many open descriptors.
131 There are insufficient resources to allocate the handle.
137 See \fBattributes\fR(5) for descriptions of the following attributes:
145 ATTRIBUTE TYPE ATTRIBUTE VALUE
147 Interface Stability Committed
155 \fBsyseventd\fR(1M), \fBsysevent_subscribe_event\fR(3SYSEVENT),
160 Event notifications are revoked by \fBsyseventd\fR when the bound process dies.
161 Event notification is suspended if a signal is caught and handled by the
162 \fIevent_handler\fR thread. Event notification is also suspended when the
163 calling process attempts to use \fBfork\fR(2) or \fBfork1\fR(2). Event
164 notifications might be lost during suspension periods.
167 The \fBlibsysevent\fR interfaces do not work at all in non-global zones.