import less(1)
[unleashed/tickless.git] / share / man / man3sysevent / sysevent_bind_handle.3sysevent
blob356e666a0b62815fa69b8a5081c145d6e646878d
1 '\" te
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"
7 .SH NAME
8 sysevent_bind_handle, sysevent_unbind_handle \- bind or unbind subscriber
9 handle
10 .SH SYNOPSIS
11 .LP
12 .nf
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));
18 .fi
20 .LP
21 .nf
22 \fBvoid\fR \fBsysevent_unbind_handle\fR(\fBsysevent_handle_t *\fR\fIsysevent_hdl\fR);
23 .fi
25 .SH PARAMETERS
26 .sp
27 .ne 2
28 .na
29 \fB\fIev\fR\fR
30 .ad
31 .RS 17n
32 pointer to \fBsysevent\fR buffer handle
33 .RE
35 .sp
36 .ne 2
37 .na
38 \fB\fIevent_handler\fR\fR
39 .ad
40 .RS 17n
41 pointer to an event handling function
42 .RE
44 .sp
45 .ne 2
46 .na
47 \fB\fIsysevent_hdl\fR\fR
48 .ad
49 .RS 17n
50 pointer to a \fBsysevent\fR subscriber handle
51 .RE
53 .SH DESCRIPTION
54 .sp
55 .LP
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).
61 .sp
62 .LP
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.
65 .sp
66 .LP
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.
70 .sp
71 .LP
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.
76 .SH RETURN VALUES
77 .sp
78 .LP
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.
82 .sp
83 .LP
84 The \fBsysevent_unbind_handle()\fR function returns no value.
85 .SH ERRORS
86 .sp
87 .LP
88 The \fBsysevent_bind_handle()\fR function will fail if:
89 .sp
90 .ne 2
91 .na
92 \fB\fBEACCES\fR\fR
93 .ad
94 .RS 10n
95 The calling process has an ID other than the privileged user.
96 .RE
98 .sp
99 .ne 2
101 \fB\fBEBUSY\fR\fR
103 .RS 10n
104 There are no resources available.
108 .ne 2
110 \fB\fBEINVAL\fR\fR
112 .RS 10n
113 The pointer to the function \fIevent_handler\fR is \fINULL\fR.
117 .ne 2
119 \fB\fBEMFILE\fR\fR
121 .RS 10n
122 The process has too many open descriptors.
126 .ne 2
128 \fB\fBENOMEM\fR\fR
130 .RS 10n
131 There are insufficient resources to allocate the handle.
134 .SH ATTRIBUTES
137 See \fBattributes\fR(5) for descriptions of the following attributes:
142 box;
143 c | c
144 l | l .
145 ATTRIBUTE TYPE  ATTRIBUTE VALUE
147 Interface Stability     Committed
149 MT-Level        MT-Safe
152 .SH SEE ALSO
155 \fBsyseventd\fR(1M), \fBsysevent_subscribe_event\fR(3SYSEVENT),
156 \fBattributes\fR(5)
157 .SH NOTES
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.