xref: /illumos-gate/usr/src/uts/common/sys/contract/process.h (revision 2d6eb4a5e0a47d30189497241345dc5466bb68ab)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_CONTRACT_PROCESS_H
27 #define	_SYS_CONTRACT_PROCESS_H
28 
29 #include <sys/contract.h>
30 #include <sys/time.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 typedef struct ctmpl_process ctmpl_process_t;
37 typedef struct cont_process cont_process_t;
38 
39 /*
40  * Default value for FMRI terms
41  */
42 #define	CT_PR_SVC_DEFAULT	"inherit:"
43 
44 /*
45  * zone_enter() pseudo-FMRI
46  */
47 #define	CT_PR_SVC_FMRI_ZONE_ENTER	"svc:/system/zone_enter:default"
48 
49 /*
50  * ctr_params flags
51  */
52 #define	CT_PR_INHERIT	0x1	/* give contract to parent */
53 #define	CT_PR_NOORPHAN	0x2	/* kill when contract is abandoned */
54 #define	CT_PR_PGRPONLY	0x4	/* only kill process group on fatal errors */
55 #define	CT_PR_REGENT	0x8	/* automatically detach inherited contracts */
56 #define	CT_PR_ALLPARAM	0xf
57 
58 /*
59  * ctr_ev_* flags
60  */
61 #define	CT_PR_EV_EMPTY	0x1	/* contract is empty */
62 #define	CT_PR_EV_FORK	0x2	/* process was forked (and was added) */
63 #define	CT_PR_EV_EXIT	0x4	/* process exited (and left contract) */
64 #define	CT_PR_EV_CORE	0x8	/* process dumps core */
65 #define	CT_PR_EV_SIGNAL	0x10	/* process received fatal signal */
66 #define	CT_PR_EV_HWERR	0x20	/* process experienced uncorrectable error */
67 #define	CT_PR_ALLEVENT	0x3f
68 #define	CT_PR_ALLFATAL	(CT_PR_EV_CORE | CT_PR_EV_SIGNAL | CT_PR_EV_HWERR)
69 
70 /*
71  * ctp_id values
72  */
73 #define	CTPP_EV_FATAL		0
74 #define	CTPP_PARAMS		1
75 #define	CTPP_SUBSUME		2
76 #define	CTPP_SVC_FMRI		3
77 #define	CTPP_SVC_CTID		4
78 #define	CTPP_SVC_CREATOR	5
79 #define	CTPP_CREATOR_AUX	6
80 
81 /*
82  * Status fields
83  */
84 #define	CTPS_PARAMS		"ctps_params"
85 #define	CTPS_EV_FATAL		"ctps_ev_fatal"
86 #define	CTPS_MEMBERS		"ctps_members"
87 #define	CTPS_CONTRACTS		"ctps_contracts"
88 #define	CTPS_SVC_FMRI		"ctps_svc_fmri"
89 #define	CTPS_SVC_CTID		"ctps_svc_ctid"
90 #define	CTPS_SVC_CREATOR	"ctps_svc_creator"
91 #define	CTPS_CREATOR_AUX	"ctps_creator_aux"
92 
93 /*
94  * Event fields
95  */
96 #define	CTPE_PID	"ctpe_pid"
97 #define	CTPE_PPID	"ctpe_ppid"
98 #define	CTPE_ZCOREFILE	"ctpe_zcorefile"
99 #define	CTPE_GCOREFILE	"ctpe_gcorefile"
100 #define	CTPE_PCOREFILE	"ctpe_pcorefile"
101 #define	CTPE_SIGNAL	"ctpe_signal"
102 #define	CTPE_SENDER	"ctpe_sender"
103 #define	CTPE_SENDCT	"ctpe_sendct"
104 #define	CTPE_EXITSTATUS	"ctpe_exitstatus"
105 
106 #ifdef	__cplusplus
107 }
108 #endif
109 
110 #endif	/* _SYS_CONTRACT_PROCESS_H */
111