Print this page
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/man/man4/process.4.man.txt
+++ new/usr/src/man/man4/process.4.man.txt
1 1 PROCESS(4) File Formats and Configurations PROCESS(4)
2 2
3 3
4 4
5 5 NAME
6 6 process - process contract type
7 7
8 8 SYNOPSIS
9 9 /system/contract/process
10 10
11 11
12 12 DESCRIPTION
13 13 Process contracts allow processes to create a fault boundary around a
14 14 set of subprocesses and observe events which occur within that
15 15 boundary.
16 16
17 17
18 18 Process contracts are managed using the contract(4) file system and the
19 19 libcontract(3LIB) library. The process contract type directory is
20 20 /system/contract/process.
21 21
22 22 CREATION
23 23 A process contract is created when an LWP that has an active process
24 24 contract template calls fork(2). Initially, the child process created
25 25 by fork() is the only resource managed by the contract. When an LWP
26 26 that does not have an active process contract template calls fork(),
27 27 the child process created by fork() is added as a resource to the
28 28 process contract of which the parent was a member.
29 29
30 30 EVENT TYPES
31 31 The following events types are defined:
32 32
33 33 CT_PR_EV_EMPTY
34 34
35 35 The last member of the process contract exited.
36 36
37 37
38 38 CT_PR_EV_FORK
39 39
40 40 A new process has been added to the process contract.
41 41
42 42
43 43 CT_PR_EV_EXIT
44 44
45 45 A member of the process contract exited.
46 46
47 47
48 48 CT_PR_EV_CORE
49 49
50 50 A process failed and dumped core. This could also occur if the
51 51 process would have dumped core had appropriate coreadm(1M) options
52 52 been enabled and core file size was unlimited.
53 53
54 54
55 55 CT_PR_EV_SIGNAL
56 56
57 57 A process received a fatal signal from a process, other than the
58 58 owner of the process contract, that is a member of a different
59 59 process contract.
60 60
61 61
62 62 CT_PR_EV_HWERR
63 63
64 64 A process was killed because of an uncorrectable hardware error.
65 65
66 66
67 67 TERMS
68 68 The following common contract terms, defined in contract(4), have
69 69 process-contract specific attributes:
70 70
71 71 critical event set
72 72
73 73 The default value for the critical event set is (CT_PR_EV_EMPTY |
74 74 CT_PR_EV_HWERR).
75 75
76 76 An attempt by a user without the {PRIV_CONTRACT_EVENT} privilege in
77 77 its effective set to add an event, other than CT_PR_EV_EMPTY, to
78 78 the critical event set which is not present in the fatal set, or if
79 79 the CT_PR_PGONLY parameter is set and the same user attempts to add
80 80 any event, other than CT_PR_EV_EMPTY, to the critical event set,
81 81 fails.
82 82
83 83
84 84 informative event set
85 85
86 86 The default value for the informative event set is (CT_PR_EV_CORE |
87 87 CT_PR_EV_SIGNAL).
88 88
89 89
90 90
91 91 The following contract terms can be read from or written to a process
92 92 contract template using the named libcontract(3LIB) interfaces. These
93 93 contract terms are in addition to those described in contract(4).
94 94
95 95 creator's aux
96 96
97 97 Auxiliary contract description. The purpose of this field is to
98 98 provide the contract creator with a way to differentiate process
99 99 contracts it creates under the same service FMRI. Use
100 100 ct_pr_tmpl_set_svc_aux(3CONTRACT) to set this term. The default
101 101 value is an empty string. The contents of this field should be
102 102 limited to 7-bit ASCII values.
103 103
104 104
105 105 fatal event set
106 106
107 107 Defines a set of events which, when generated, causes all members
108 108 of the process contract to be killed with SIGKILL, or the
109 109 intersection of the contract and the containing process group if
110 110 the CT_PR_PGRPONLY parameter is set. Set this term with
111 111 ct_pr_tmpl_set_fatal(3CONTRACT). The fatal event set is restricted
112 112 to CT_PR_EV_CORE, CT_PR_EV_SIGNAL, and CT_PR_EV_HWERR. For
113 113 CT_PR_EV_CORE and CT_PR_EV_SIGNAL events, the scope of SIGKILL is
114 114 limited to those processes which the contract author or the event
115 115 source could have normally sent signals to.
116 116
117 117 The default value for the fatal event set is CT_PR_EV_HWERR.
118 118
119 119 If a user without the {PRIV_CONTRACT_EVENT} privilege in its
120 120 effective set removes an event from the fatal event set which is
121 121 present in the critical event set, the corresponding event is
122 122 automatically removed from the critical event set and added to the
123 123 informative event set.
124 124
125 125
126 126 parameter set
127 127
128 128 Defines miscellaneous other settings. Use
129 129 ct_pr_tmpl_set_param(3CONTRACT) to set this term.
130 130
131 131 The default parameter set is empty.
132 132
133 133 The value is a bit vector comprised of some or all of:
134 134
135 135 CT_PR_INHERIT
136 136
137 137 If set, indicates that the process contract is to be inherited
138 138 by the process contract the contract owner is a member of if
139 139 the contract owner exits before explicitly abandoning the
140 140 process contract.
141 141
142 142 If not set, the process contract is automatically abandoned
143 143 when the owner exits.
144 144
145 145
146 146 CT_PR_KEEP_EXEC
147 147
148 148 If set, the process contract template remains active across
149 149 exec(2). This can be used to setup a contract for children of
150 150 an application which is not contract-aware. If this is not set
151 151 then the system clears the active template when the process
152 152 execs. Because this option is intended for an application which
153 153 is not contract-aware, new child process contracts will be
154 154 automatically abandoned by the parent.
155 155
156 156
157 157 CT_PR_NOORPHAN
158 158
159 159 If set, all processes in a process contract are sent SIGKILL if
160 160 the process contract is abandoned, either explicitly or because
161 161 the holder died and CT_PR_INHERIT was not set. The scope of
162 162 SIGKILL is limited to those processes which the contract author
163 163 or the event source could have normally sent signals to.
164 164
165 165 If this is not set and the process contract is abandoned, the
166 166 process contract is orphaned, that is, continues to exist
167 167 without owner.
168 168
169 169
170 170 CT_PR_PGRPONLY
171 171
172 172 If set, only those processes within the same process group and
173 173 process contract as a fatal error-generating process are
174 174 killed.
175 175
176 176 If not set, all processes within the process contract are
177 177 killed if a member process encounters an error specified in the
178 178 fatal set.
179 179
180 180 If a user without the {PRIV_CONTRACT_EVENT} privilege in its
181 181 effective set adds CT_PR_PGRPONLY to a template's parameter
182 182 set, any events other than CT_PR_EV_EMPTY are automatically
183 183 removed from the critical event set and added to the
184 184 informative event set.
185 185
186 186
187 187 CT_PR_REGENT
188 188
189 189 If set, the process contract can inherit unabandoned contracts
190 190 left by exiting member processes.
191 191
192 192 If not set, indicates that the process contract should not
193 193 inherit contracts from member processes. If a process exits
194 194 before abandoning a contract it owns and is a member of a
195 195 process contract which does not have CT_PR_REGENT set, the
196 196 system automatically abandons the contract.
197 197
198 198 If a regent process contract has inherited contracts and is
199 199 abandoned by its owner, its inherited contracts are abandoned.
200 200
201 201
202 202
203 203 service FMRI
204 204
205 205 Specifies the service FMRI associated with the process contract.
206 206 Use ct_pr_tmpl_set_svc_fmri(3CONTRACT) to set this term. The
207 207 default is to inherit the value from the creator's process
208 208 contract. When this term is uninitialized,
209 209 ct_pr_tmpl_get_svc_fmri(3CONTRACT) returns the token string
210 210 inherited: to indicate the value has not been set and is inherited.
211 211 Setting the service FMRI to inherited: clears the current (B value
212 212 and the term is inherited from the creator's process contract. To
213 213 set this term a process must have {PRIV_CONTRACT_IDENTITY} in its
214 214 effective set.
215 215
216 216
217 217 transfer contract
218 218
219 219 Specifies the ID of an empty process contract held by the caller
220 220 whose inherited process contracts are to be transferred to the
221 221 newly created contract. Use ct_pr_tmpl_set_transfer(3CONTRACT) to
222 222 set the tranfer contract. Attempts to specify a contract not held
223 223 by the calling process, or a contract which still has processes in
224 224 it, fail.
225 225
226 226 The default transfer term is 0, that is, no contract.
227 227
228 228
229 229 STATUS
230 230 In addition to the standard items, the status object read from a status
231 231 file descriptor contains the following items to obtain this information
232 232 respectively:
233 233
234 234 service contract ID
235 235
236 236 Specifies the process contract id which defined the service FMRI
237 237 term. Use ct_pr_status_get_svc_ctid(3CONTRACT) to read the term's
238 238 value. It can be used to determine if the service FMRI was
239 239 inherited as in the example below.
240 240
241 241 ctid_t ctid; /* our contract id */
242 242 int fd; /* fd of ctid's status file */
243 243
244 244 ct_stathdl_(Bt status;
245 245 ctid_t svc_ctid;
246 246
247 247 if (ct_status_read(fd, CTD_FIXED, &status) == 0) {
248 248 if (ct_pr_status_get_svc_ctid(status, &svc_ctid) == 0) {
249 249 if (svc_ctid == ctid)
250 250 /* not inherited */
251 251 else
252 252 /* inherited */
253 253 }
254 254 ct_status_free(status);
255 255 }
256 256
257 257
258 258
259 259
260 260
261 261 If CTD_ALL is specified, the following items are also available:
262 262
263 263 Member list
264 264
265 265 The PIDs of processes which are members of the process contract.
266 266 Use ct_pr_status_get_members(3CONTRACT) for this information.
267 267
268 268
269 269 Inherited contract list
270 270
271 271 The IDs of contracts which have been inherited by the process
272 272 contract. Use ct_pr_status_get_contracts(3CONTRACT) to obtain this
273 273 information.
274 274
275 275
276 276 Service FMRI (term)
277 277
278 278 Values equal to the terms used when the contract was written. The
279 279 Service FMRI term of the process contract of a process en(Btering a
280 280 zone has the value svc:/system/zone_enter:default when read from
281 281 the non-global zone.
282 282
283 283
284 284 contract creator
285 285
286 286 Specifies the process that created the process contract. Use
287 287 ct_pr_status_get_svc_creator(3CONTRACT) to read the term's value.
288 288
289 289
290 290 creator's aux (term)
291 291
292 292 Values equal to the terms used when the contract was written.
293 293
294 294
295 295
296 296 The following standard status items have different meanings in some
297 297 situations:
298 298
299 299 Ownership state
300 300
301 301 If the process contract has a state of CTS_OWNED or CTS_INHERITED
302 302 and is held by an entity in the global zone, but contains processes
303 303 in a non-global zone, it appears to have the state CTS_OWNED when
304 304 observed by processes in the non-global zone.
305 305
306 306
307 307 Contract holder
308 308
309 309 If the process contract has a state of CTS_OWNED or CTS_INHERITED
310 310 and is held by an entity in the global zone, but contains processes
311 311 in a non-global zone, it appears to be held by the non-global
312 312 zone's zsched when observed by processes in the non-global zone.
313 313
314 314
315 315 EVENTS
316 316 In addition to the standard items, an event generated by a process
317 317 contract contains the following information:
318 318
319 319 Generating PID
320 320
321 321 The process ID of the member process which experienced the event,
322 322 or caused the contract event to be generated (in the case of
323 323 CT_PR_EV_EMPTY). Use ct_pr_event_get_pid(3CONTRACT) to obtain this
324 324 information.
325 325
326 326
327 327
328 328 If the event type is CT_PR_EV_FORK, the event contains:
329 329
330 330 Parent PID
331 331
332 332 The process ID which forked [Generating PID]. Use
333 333 ct_pr_event_get_ppid(3CONTRACT) to obtain this information.
334 334
335 335
336 336
337 337 If the event type is CT_PR_EV_EXIT, the event contains:
338 338
339 339 Exit status
340 340
341 341 The exit status of the process. Use
342 342 ct_pr_event_get_exitstatus(3CONTRACT) to obtain this information.
343 343
344 344
345 345
346 346 If the event type is CT_PR_EV_CORE, the event can contain:
347 347
348 348 Process core name
349 349
350 350 The name of the per-process core file. Use
351 351 ct_pr_event_get_pcorefile(3CONTRACT) to obtain this information.
352 352
353 353
354 354 Global core name
355 355
356 356 The name of the process's zone's global core file. Use
357 357 ct_pr_event_get_gcorefile(3CONTRACT) to obtain this information.
358 358
359 359
360 360 Zone core name
361 361
362 362 The name of the system-wide core file in the global zone. Use
363 363 ct_pr_event_get_zcorefile(3CONTRACT) to obtain this information.
364 364
365 365
366 366
367 367 See coreadm(1M) for more information about per-process, global, and
368 368 system-wide core files.
369 369
370 370
371 371 If the event type is CT_PR_EV_SIGNAL, the event contains:
372 372
373 373 Signal
374 374
375 375 The number of the signal which killed the process. Use
376 376 ct_pr_event_get_signal(3CONTRACT) to obtain this information.
377 377
378 378
379 379
380 380 It can contain:
381 381
382 382 sender
383 383
384 384 The PID of the process which sent the signal. Use
385 385 ct_pr_event_get_sender(3CONTRACT) to obtain this information.
386 386
387 387
388 388 FILES
389 389 /usr/include/sys/contract/process.h
390 390
391 391 Contains definitions of event-type macros.
392 392
393 393
394 394 SEE ALSO
395 395 ctrun(1), ctstat(1), ctwatch(1), coreadm(1M), close(2), fork(2),
396 396 ioctl(2), open(2), poll(2), ct_pr_event_get_exitstatus(3CONTRACT),
397 397 ct_pr_event_get_gcorefile(3CONTRACT),
398 398 ct_pr_event_get_pcorefile(3CONTRACT), ct_pr_event_get_pid(3CONTRACT),
399 399 ct_pr_event_get_ppid(3CONTRACT), ct_pr_event_get_signal(3CONTRACT),
400 400 ct_pr_event_get_zcorefile(3CONTRACT),
401 401 ct_pr_status_get_contracts(3CONTRACT),
402 402 ct_pr_status_get_members(3CONTRACT), ct_pr_status_get_param(3CONTRACT),
403 403 ct_pr_tmpl_set_fatal(3CONTRACT), ct_pr_tmpl_set_param(3CONTRACT),
404 404 ct_pr_tmpl_set_transfer(3CONTRACT), ct_tmpl_set_cookie(3CONTRACT),
405 405 ct_tmpl_set_critical(3CONTRACT), ct_tmpl_set_informative(3CONTRACT),
406 406 libcontract(3LIB), contract(4), privileges(5)
407 407
408 408
409 409
410 410 Sept 6, 2016 PROCESS(4)
|
↓ open down ↓ |
410 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX