teach manpages about largefile's demise
[unleashed.git] / share / man / man3contract / ct_status_read.3contract
blobef565e80ac0b609a2cb22a5976ff4e1414aee96f
1 '\" te
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_STATUS_READ 3CONTRACT "Apr 1, 2004"
7 .SH NAME
8 ct_status_read, ct_status_free, ct_status_get_id, ct_status_get_zoneid,
9 ct_status_get_type, ct_status_get_state, ct_status_get_holder,
10 ct_status_get_nevents, ct_status_get_ntime, ct_status_get_qtime,
11 ct_status_get_nevid, ct_status_get_cookie, ct_status_get_informative,
12 ct_status_get_critical \- common contract status functions
13 .SH SYNOPSIS
14 .LP
15 .nf
16 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB -lcontract \fR [ \fIlibrary\fR\&.\|.\|. ]
17 #include <libcontract.h>
19 \fBint\fR \fBct_status_read\fR(\fBint\fR \fIfd\fR, \fBint\fR \fIdetail\fR, \fBct_stathdl_t *\fR\fIstathdlp\fR);
20 .fi
22 .LP
23 .nf
24 \fBvoid\fR \fBct_status_free\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
25 .fi
27 .LP
28 .nf
29 \fBctid_t\fR \fBct_status_get_id\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
30 .fi
32 .LP
33 .nf
34 \fBzoneid_t\fR \fBct_status_get_zoneid\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
35 .fi
37 .LP
38 .nf
39 \fBchar *\fR\fBct_status_get_type\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
40 .fi
42 .LP
43 .nf
44 \fBuint_t\fR \fBct_status_get_state\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
45 .fi
47 .LP
48 .nf
49 \fBpid_t\fR \fBct_status_get_holder\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
50 .fi
52 .LP
53 .nf
54 \fBint\fR \fBct_status_get_nevents\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
55 .fi
57 .LP
58 .nf
59 \fBint\fR \fBct_status_get_ntime\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
60 .fi
62 .LP
63 .nf
64 \fBint\fR \fBct_status_get_qtime\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
65 .fi
67 .LP
68 .nf
69 \fBctevid_t\fR \fBct_status_get_nevid\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
70 .fi
72 .LP
73 .nf
74 \fBuint64_t\fR \fBct_status_get_cookie\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
75 .fi
77 .LP
78 .nf
79 \fBctevid_t\fR \fBct_status_get_informative\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
80 .fi
82 .LP
83 .nf
84 \fBuint_t\fR \fBct_status_get_critical\fR(\fBct_stathdl_t\fR \fIstathdl\fR);
85 .fi
87 .SH DESCRIPTION
88 .sp
89 .LP
90 These functions operate on contract status file descriptors obtained from the
91 \fBcontract\fR(4) file system and status object handles returned by
92 \fBct_status_read()\fR.
93 .sp
94 .LP
95 The \fBct_status_read()\fR function reads the contract's status and initializes
96 the status object handle pointed to by \fIstathdlp\fR. After a successful call
97 to \fBct_status_read()\fR, the caller is responsible for calling
98 \fBct_status_free()\fR on this status object handle when it has finished using
99 it. Because the amount of information available for a contract might be large,
100 the \fIdetail\fR argument allows the caller to specify how much information
101 \fBct_status_read()\fR should obtain. A value of \fBCTD_COMMON\fR fetches only
102 those data accessible by the functions on this manual page. \fBCTD_FIXED\fR
103 fetches \fBCTD_COMMON\fR data as well as fixed-size contract type-specific
104 data. \fBCTD_ALL\fR fetches \fBCTD_FIXED\fR data as well as variable lengthed
105 data, such as arrays. See the manual pages for contract type-specific status
106 accessor functions for information concerning which data are fetched by
107 \fBCTD_FIXED\fR and \fBCTD_ALL\fR.
110 The \fBct_status_free()\fR function frees any storage associated with the
111 specified status object handle.
114 The remaining functions all return contract information obtained from a status
115 object.
118 The \fBct_status_get_id()\fR function returns the contract's ID.
121 The \fBct_status_get_zoneid()\fR function returns the contract's creator's zone
122 ID, or \(mi1 if the creator's zone no longer exists.
125 The \fBct_status_get_type()\fR function returns the contract's type. The string
126 should be neither modified nor freed.
129 The \fBct_status_get_state()\fR function returns the state of the contract.
130 Valid state values are:
132 .ne 2
134 \fB\fBCTS_OWNED\fR\fR
136 .RS 17n
137 a contract that is currently owned by a process
141 .ne 2
143 \fB\fBCTS_INHERITED\fR\fR
145 .RS 17n
146 a contract that has been inherited by a regent process contract
150 .ne 2
152 \fB\fBCTS_ORPHAN\fR\fR
154 .RS 17n
155 a contract that has no owner and has not been inherited
159 .ne 2
161 \fB\fBCTS_DEAD\fR\fR
163 .RS 17n
164 a contract that is no longer in effect and will be automatically removed from
165 the system as soon as the last reference to it is release (for example, an open
166 status file descriptor)
171 The \fBct_status_get_holder()\fR function returns the process ID of the
172 contract's owner if the contract is in the \fBCTS_OWNED\fR state, or the ID of
173 the regent process contract if the contract is in the \fBCTS_INHERITED\fR
174 state.
177 The \fBct_status_get_nevents()\fR function returns the number of unacknowledged
178 critical events on the contract's event queue.
181 The \fBct_status_get_ntime()\fR function returns the amount of time remaining
182 (in seconds) before the ongoing exit negotiation times out, or -1 if there is
183 no negotiation ongoing.
186 The \fBct_status_get_qtime()\fR function returns the amount of time remaining
187 (in seconds) in the quantum before the ongoing exit negotiation times out, or
188 -1 if there is no negotiation ongoing.
191 The \fBct_status_get_nevid()\fR function returns the event ID of the ongoing
192 negotiation, or 0 if there are none.
195 The \fBct_status_get_cookie()\fR function returns the cookie term of the
196 contract.
199 The \fBct_status_get_critical()\fR function is used to read the critical event
200 set term. The value is a collection of bits as described in the contract type's
201 manual page.
204 The \fBct_status_get_informative()\fR function is used to read the informative
205 event set term. The value is a collection of bits as described in the contract
206 type's manual page.
207 .SH RETURN VALUES
210 Upon successful completion, \fBct_status_read()\fR returns 0. Otherwise, it
211 returns a non-zero error value.
214 Upon successful completion, \fBct_status_get_id()\fR,
215 \fBct_status_get_type()\fR, \fBct_status_get_holder()\fR,
216 \fBct_status_get_state()\fR, \fBct_status_get_nevents()\fR,
217 \fBct_status_get_ntime()\fR, \fBct_status_get_qtime()\fR,
218 \fBct_status_get_nevid()\fR, \fBct_status_get_cookie()\fR,
219 \fBct_status_get_critical()\fR, and \fBct_status_get_informative()\fR return
220 the data described in the DESCRIPTION.
221 .SH ERRORS
224 The \fBct_status_read()\fR function will fail if:
226 .ne 2
228 \fB\fBEINVAL\fR\fR
230 .RS 10n
231 The \fIdetail\fR level specified is invalid.
234 .SH ATTRIBUTES
237 See \fBattributes\fR(5) for descriptions of the following attributes:
242 box;
243 c | c
244 l | l .
245 ATTRIBUTE TYPE  ATTRIBUTE VALUE
247 Interface Stability     Evolving
249 MT-Level        Safe
252 .SH SEE ALSO
255 \fBlibcontract\fR(3LIB), \fBcontract\fR(4), \fBattributes\fR(5)