1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
'\" te
.\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
.\" 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. 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 the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH CT_STATUS_READ 3CONTRACT "Apr 1, 2004"
.SH NAME
ct_status_read, ct_status_free, ct_status_get_id, ct_status_get_zoneid,
ct_status_get_type, ct_status_get_state, ct_status_get_holder,
ct_status_get_nevents, ct_status_get_ntime, ct_status_get_qtime,
ct_status_get_nevid, ct_status_get_cookie, ct_status_get_informative,
ct_status_get_critical \- common contract status functions
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-D_LARGEFILE64_SOURCE\fR \fB -lcontract \fR [ \fIlibrary\fR\&.\|.\|. ]
#include <libcontract.h>
\fBint\fR \fBct_status_read\fR(\fBint\fR \fIfd\fR, \fBint\fR \fIdetail\fR, \fBct_stathdl_t *\fR\fIstathdlp\fR);
.fi
.LP
.nf
\fBvoid\fR \fBct_status_free\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
.fi
.LP
.nf
\fBctid_t\fR \fBct_status_get_id\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
.fi
.LP
.nf
\fBzoneid_t\fR \fBct_status_get_zoneid\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
.fi
.LP
.nf
\fBchar *\fR\fBct_status_get_type\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
.fi
.LP
.nf
\fBuint_t\fR \fBct_status_get_state\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
.fi
.LP
.nf
\fBpid_t\fR \fBct_status_get_holder\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
.fi
.LP
.nf
\fBint\fR \fBct_status_get_nevents\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
.fi
.LP
.nf
\fBint\fR \fBct_status_get_ntime\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
.fi
.LP
.nf
\fBint\fR \fBct_status_get_qtime\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
.fi
.LP
.nf
\fBctevid_t\fR \fBct_status_get_nevid\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
.fi
.LP
.nf
\fBuint64_t\fR \fBct_status_get_cookie\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
.fi
.LP
.nf
\fBctevid_t\fR \fBct_status_get_informative\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
.fi
.LP
.nf
\fBuint_t\fR \fBct_status_get_critical\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
.fi
.SH DESCRIPTION
.sp
.LP
These functions operate on contract status file descriptors obtained from the
\fBcontract\fR(4) file system and status object handles returned by
\fBct_status_read()\fR.
.sp
.LP
The \fBct_status_read()\fR function reads the contract's status and initializes
the status object handle pointed to by \fIstathdlp\fR. After a successful call
to \fBct_status_read()\fR, the caller is responsible for calling
\fBct_status_free()\fR on this status object handle when it has finished using
it. Because the amount of information available for a contract might be large,
the \fIdetail\fR argument allows the caller to specify how much information
\fBct_status_read()\fR should obtain. A value of \fBCTD_COMMON\fR fetches only
those data accessible by the functions on this manual page. \fBCTD_FIXED\fR
fetches \fBCTD_COMMON\fR data as well as fixed-size contract type-specific
data. \fBCTD_ALL\fR fetches \fBCTD_FIXED\fR data as well as variable lengthed
data, such as arrays. See the manual pages for contract type-specific status
accessor functions for information concerning which data are fetched by
\fBCTD_FIXED\fR and \fBCTD_ALL\fR.
.sp
.LP
The \fBct_status_free()\fR function frees any storage associated with the
specified status object handle.
.sp
.LP
The remaining functions all return contract information obtained from a status
object.
.sp
.LP
The \fBct_status_get_id()\fR function returns the contract's ID.
.sp
.LP
The \fBct_status_get_zoneid()\fR function returns the contract's creator's zone
ID, or \(mi1 if the creator's zone no longer exists.
.sp
.LP
The \fBct_status_get_type()\fR function returns the contract's type. The string
should be neither modified nor freed.
.sp
.LP
The \fBct_status_get_state()\fR function returns the state of the contract.
Valid state values are:
.sp
.ne 2
.na
\fB\fBCTS_OWNED\fR\fR
.ad
.RS 17n
a contract that is currently owned by a process
.RE
.sp
.ne 2
.na
\fB\fBCTS_INHERITED\fR\fR
.ad
.RS 17n
a contract that has been inherited by a regent process contract
.RE
.sp
.ne 2
.na
\fB\fBCTS_ORPHAN\fR\fR
.ad
.RS 17n
a contract that has no owner and has not been inherited
.RE
.sp
.ne 2
.na
\fB\fBCTS_DEAD\fR\fR
.ad
.RS 17n
a contract that is no longer in effect and will be automatically removed from
the system as soon as the last reference to it is release (for example, an open
status file descriptor)
.RE
.sp
.LP
The \fBct_status_get_holder()\fR function returns the process ID of the
contract's owner if the contract is in the \fBCTS_OWNED\fR state, or the ID of
the regent process contract if the contract is in the \fBCTS_INHERITED\fR
state.
.sp
.LP
The \fBct_status_get_nevents()\fR function returns the number of unacknowledged
critical events on the contract's event queue.
.sp
.LP
The \fBct_status_get_ntime()\fR function returns the amount of time remaining
(in seconds) before the ongoing exit negotiation times out, or -1 if there is
no negotiation ongoing.
.sp
.LP
The \fBct_status_get_qtime()\fR function returns the amount of time remaining
(in seconds) in the quantum before the ongoing exit negotiation times out, or
-1 if there is no negotiation ongoing.
.sp
.LP
The \fBct_status_get_nevid()\fR function returns the event ID of the ongoing
negotiation, or 0 if there are none.
.sp
.LP
The \fBct_status_get_cookie()\fR function returns the cookie term of the
contract.
.sp
.LP
The \fBct_status_get_critical()\fR function is used to read the critical event
set term. The value is a collection of bits as described in the contract type's
manual page.
.sp
.LP
The \fBct_status_get_informative()\fR function is used to read the informative
event set term. The value is a collection of bits as described in the contract
type's manual page.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBct_status_read()\fR returns 0. Otherwise, it
returns a non-zero error value.
.sp
.LP
Upon successful completion, \fBct_status_get_id()\fR,
\fBct_status_get_type()\fR, \fBct_status_get_holder()\fR,
\fBct_status_get_state()\fR, \fBct_status_get_nevents()\fR,
\fBct_status_get_ntime()\fR, \fBct_status_get_qtime()\fR,
\fBct_status_get_nevid()\fR, \fBct_status_get_cookie()\fR,
\fBct_status_get_critical()\fR, and \fBct_status_get_informative()\fR return
the data described in the DESCRIPTION.
.SH ERRORS
.sp
.LP
The \fBct_status_read()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
The \fIdetail\fR level specified is invalid.
.RE
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE ATTRIBUTE VALUE
_
Interface Stability Evolving
_
MT-Level Safe
.TE
.SH SEE ALSO
.sp
.LP
\fBlibcontract\fR(3LIB), \fBcontract\fR(4), \fBattributes\fR(5),
\fBlfcompile\fR(5)
|