1ct_status_read(3CONTRACCoTn)tract Management Library Functcito_nsstatus_read(3CONTRACT)
2
3
4
6 ct_status_read, ct_status_free, ct_status_get_id, ct_status_get_zoneid,
7 ct_status_get_type, ct_status_get_state, ct_status_get_holder, ct_sta‐
8 tus_get_nevents, ct_status_get_ntime, ct_status_get_qtime, ct_sta‐
9 tus_get_nevid, ct_status_get_cookie, ct_status_get_informative, ct_sta‐
10 tus_get_critical - common contract status functions
11
13 cc [ flag... ] file... -D_LARGEFILE64_SOURCE -lcontract [ library... ]
14 #include <libcontract.h>
15
16 int ct_status_read(int fd, int detail, ct_stathdl_t *stathdlp);
17
18
19 void ct_status_free(ct_stathdl_t stathdl);
20
21
22 ctid_t ct_status_get_id(ct_stathdl_t stathdl);
23
24
25 zoneid_t ct_status_get_zoneid(ct_stathdl_t stathdl);
26
27
28 char *ct_status_get_type(ct_stathdl_t stathdl);
29
30
31 uint_t ct_status_get_state(ct_stathdl_t stathdl);
32
33
34 pid_t ct_status_get_holder(ct_stathdl_t stathdl);
35
36
37 int ct_status_get_nevents(ct_stathdl_t stathdl);
38
39
40 int ct_status_get_ntime(ct_stathdl_t stathdl);
41
42
43 int ct_status_get_qtime(ct_stathdl_t stathdl);
44
45
46 ctevid_t ct_status_get_nevid(ct_stathdl_t stathdl);
47
48
49 uint64_t ct_status_get_cookie(ct_stathdl_t stathdl);
50
51
52 ctevid_t ct_status_get_informative(ct_stathdl_t stathdl);
53
54
55 uint_t ct_status_get_critical(ct_stathdl_t stathdl);
56
57
59 These functions operate on contract status file descriptors obtained
60 from the contract(4) file system and status object handles returned by
61 ct_status_read().
62
63
64 The ct_status_read() function reads the contract's status and initial‐
65 izes the status object handle pointed to by stathdlp. After a success‐
66 ful call to ct_status_read(), the caller is responsible for calling
67 ct_status_free() on this status object handle when it has finished
68 using it. Because the amount of information available for a contract
69 might be large, the detail argument allows the caller to specify how
70 much information ct_status_read() should obtain. A value of CTD_COMMON
71 fetches only those data accessible by the functions on this manual
72 page. CTD_FIXED fetches CTD_COMMON data as well as fixed-size contract
73 type-specific data. CTD_ALL fetches CTD_FIXED data as well as variable
74 lengthed data, such as arrays. See the manual pages for contract type-
75 specific status accessor functions for information concerning which
76 data are fetched by CTD_FIXED and CTD_ALL.
77
78
79 The ct_status_free() function frees any storage associated with the
80 specified status object handle.
81
82
83 The remaining functions all return contract information obtained from a
84 status object.
85
86
87 The ct_status_get_id() function returns the contract's ID.
88
89
90 The ct_status_get_zoneid() function returns the contract's creator's
91 zone ID, or −1 if the creator's zone no longer exists.
92
93
94 The ct_status_get_type() function returns the contract's type. The
95 string should be neither modified nor freed.
96
97
98 The ct_status_get_state() function returns the state of the contract.
99 Valid state values are:
100
101 CTS_OWNED a contract that is currently owned by a process
102
103
104 CTS_INHERITED a contract that has been inherited by a regent process
105 contract
106
107
108 CTS_ORPHAN a contract that has no owner and has not been inher‐
109 ited
110
111
112 CTS_DEAD a contract that is no longer in effect and will be
113 automatically removed from the system as soon as the
114 last reference to it is release (for example, an open
115 status file descriptor)
116
117
118
119 The ct_status_get_holder() function returns the process ID of the con‐
120 tract's owner if the contract is in the CTS_OWNED state, or the ID of
121 the regent process contract if the contract is in the CTS_INHERITED
122 state.
123
124
125 The ct_status_get_nevents() function returns the number of unacknowl‐
126 edged critical events on the contract's event queue.
127
128
129 The ct_status_get_ntime() function returns the amount of time remaining
130 (in seconds) before the ongoing exit negotiation times out, or -1 if
131 there is no negotiation ongoing.
132
133
134 The ct_status_get_qtime() function returns the amount of time remaining
135 (in seconds) in the quantum before the ongoing exit negotiation times
136 out, or -1 if there is no negotiation ongoing.
137
138
139 The ct_status_get_nevid() function returns the event ID of the ongoing
140 negotiation, or 0 if there are none.
141
142
143 The ct_status_get_cookie() function returns the cookie term of the con‐
144 tract.
145
146
147 The ct_status_get_critical() function is used to read the critical
148 event set term. The value is a collection of bits as described in the
149 contract type's manual page.
150
151
152 The ct_status_get_informative() function is used to read the informa‐
153 tive event set term. The value is a collection of bits as described in
154 the contract type's manual page.
155
157 Upon successful completion, ct_status_read() returns 0. Otherwise, it
158 returns a non-zero error value.
159
160
161 Upon successful completion, ct_status_get_id(), ct_status_get_type(),
162 ct_status_get_holder(), ct_status_get_state(), ct_status_get_nevents(),
163 ct_status_get_ntime(), ct_status_get_qtime(), ct_status_get_nevid(),
164 ct_status_get_cookie(), ct_status_get_critical(), and ct_sta‐
165 tus_get_informative() return the data described in the DESCRIPTION.
166
168 The ct_status_read() function will fail if:
169
170 EINVAL The detail level specified is invalid.
171
172
174 See attributes(5) for descriptions of the following attributes:
175
176
177
178
179 ┌─────────────────────────────┬─────────────────────────────┐
180 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
181 ├─────────────────────────────┼─────────────────────────────┤
182 │Interface Stability │Evolving │
183 ├─────────────────────────────┼─────────────────────────────┤
184 │MT-Level │Safe │
185 └─────────────────────────────┴─────────────────────────────┘
186
188 libcontract(3LIB), contract(4), attributes(5), lfcompile(5)
189
190
191
192SunOS 5.11 1 Apr 2004 ct_status_read(3CONTRACT)