2 .\" Copyright (c) 2004, 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.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" 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 the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH CT_EVENT_READ 3CONTRACT "April 9, 2016"
8 ct_event_read, ct_event_read_critical, ct_event_reset, ct_event_reliable,
9 ct_event_free, ct_event_get_flags, ct_event_get_ctid, ct_event_get_evid,
10 ct_event_get_type, ct_event_get_nevid, ct_event_get_newct \- common contract
15 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB -lcontract \fR [ \fIlibrary\fR\&.\|.\|. ]
16 #include <libcontract.h>
18 \fBint\fR \fBct_event_read\fR(\fBint\fR \fIfd\fR, \fBct_evthdl_t *\fR\fIevthndlp\fR);
23 \fBint\fR \fBct_event_read_critical\fR(\fBint\fR \fIfd\fR, \fBct_evthdl_t *\fR\fIevthndlp\fR);
28 \fBint\fR \fBct_event_reset\fR(\fBint\fR \fIfd\fR);
33 \fBint\fR \fBct_event_reliable\fR(\fBint\fR \fIfd\fR);
38 \fBvoid\fR \fBct_event_free\fR(\fBct_evthdl_t\fR \fIevthndl\fR);
43 \fBctid_t\fR \fBct_event_get_ctid\fR(\fBct_evthdl_t\fR \fIevthndl\fR);
48 \fBctevid_t\fR \fBct_event_get_evid\fR(\fBct_evthdl_t\fR \fIevthndl\fR);
53 \fBuint_t\fR \fBct_event_get_flags\fR(\fBct_evthdl_t\fR \fIevthndl\fR);
58 \fBuint_t\fR \fBct_event_get_type\fR(\fBct_evthdl_t\fR \fIevthndl\fR);
63 \fBint\fR \fBct_event_get_nevid\fR(\fBct_evthdl_t\fR \fIevthndl\fR, \fBctevid_t *\fR\fIevidp\fR);
68 \fBint\fR \fBct_event_get_newct\fR(\fBct_evthdl_t\fR \fIevthndl\fR, \fBctid_t *\fR\fIctidp\fR);
73 These functions operate on contract event endpoint file descriptors obtained
74 from the \fBcontract\fR(4) file system and event object handles returned by
75 \fBct_event_read()\fR and \fBct_event_read_critical()\fR.
78 The \fBct_event_read()\fR function reads the next event from the queue
79 referenced by the file descriptor \fIfd\fR and initializes the event object
80 handle pointed to by \fIevthndlp\fR. After a successful call to
81 \fBct_event_read()\fR, the caller is responsible for calling
82 \fBct_event_free()\fR on this event object handle when it has finished using
86 The \fBct_event_read_critical()\fR function behaves like \fBct_event_read()\fR
87 except that it reads the next critical event from the queue, skipping any
91 The \fBct_event_reset()\fR function resets the location of the listener to the
92 beginning of the queue. This function can be used to re-read events, or read
93 events that were sent before the event endpoint was opened. Informative and
94 acknowledged critical events, however, might have been removed from the queue.
97 The \fBct_event_reliable()\fR function indicates that no event published to the
98 specified event queue should be dropped by the system until the specified
99 listener has read the event. This function requires that the caller have the
100 {\fBPRIV_CONTRACT_EVENT\fR} privilege in its effective set.
103 The \fBct_event_free()\fR function frees any storage associated with the event
104 object handle specified by \fIevthndl\fR.
107 The \fBct_event_get_ctid()\fR function returns the ID of the contract that sent
111 The \fBct_event_get_evid()\fR function returns the ID of the specified event.
114 The \fBct_event_get_flags()\fR function returns the event flags for the
115 specified event. Valid event flags are:
122 The event is an informative event.
131 The event has been acknowledged (for critical and negotiation messages).
140 The message represents an exit negotiation.
145 The \fBct_event_get_type()\fR function reads the event type. The value is one
146 of the event types described in \fBcontract\fR(4) or the contract type's manual
150 The \fBct_event_get_nevid()\fR function reads the negotiation ID from an
151 \fBCT_EV_NEGEND\fR event.
154 The \fBct_event_get_newct()\fR function obtains the ID of the contract created
155 when the negotiation referenced by the \fBCT_EV_NEGEND\fR event succeeded. If
156 no contract was created, \fIctidp\fR will be 0. If the operation was
157 cancelled, *\fIctidp\fR will equal the ID of the existing contract.
160 Upon successful completion, \fBct_event_read()\fR,
161 \fBct_event_read_critical()\fR, \fBct_event_reset()\fR,
162 \fBct_event_reliable()\fR, \fBct_event_get_nevid()\fR, and
163 \fBct_event_get_newct()\fR return 0. Otherwise, they return a non-zero error
167 The \fBct_event_get_flags()\fR, \fBct_event_get_ctid()\fR,
168 \fBct_event_get_evid()\fR, and \fBct_event_get_type()\fR functions return data
169 as described in the DESCRIPTION.
172 The \fBct_event_reliable()\fR function will fail if:
179 The caller does not have {\fBPRIV_CONTRACT_EVENT\fR} in its effective set.
184 The \fBct_event_read()\fR and \fBct_event_read_critical()\fR functions will
192 The event endpoint was opened \fBO_NONBLOCK\fR and no applicable events were
193 available to be read.
198 The \fBct_event_get_nevid()\fR and \fBct_event_get_newct()\fR functions
206 The \fIevthndl\fR argument is not a \fBCT_EV_NEGEND\fR event object.
211 See \fBattributes\fR(5) for descriptions of the following attributes:
219 ATTRIBUTE TYPE ATTRIBUTE VALUE
221 Interface Stability Evolving
228 \fBlibcontract\fR(3LIB), \fBcontract\fR(4), \fBattributes\fR(5)