summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/contract/process.h
blob: 2c70d7c9f1f1a7f72cce45e6682ec03a805c5f4c (plain)
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
/*
 * CDDL HEADER START
 *
 * 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]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 * Copyright 2015 Joyent, Inc.
 */

#ifndef	_SYS_CONTRACT_PROCESS_H
#define	_SYS_CONTRACT_PROCESS_H

#include <sys/contract.h>
#include <sys/time.h>

#ifdef	__cplusplus
extern "C" {
#endif

typedef struct ctmpl_process ctmpl_process_t;
typedef struct cont_process cont_process_t;

/*
 * Default value for FMRI terms
 */
#define	CT_PR_SVC_DEFAULT	"inherit:"

/*
 * zone_enter() pseudo-FMRI
 */
#define	CT_PR_SVC_FMRI_ZONE_ENTER	"svc:/system/zone_enter:default"

/*
 * ctr_params flags
 */
#define	CT_PR_INHERIT	0x1	/* give contract to parent */
#define	CT_PR_NOORPHAN	0x2	/* kill when contract is abandoned */
#define	CT_PR_PGRPONLY	0x4	/* only kill process group on fatal errors */
#define	CT_PR_REGENT	0x8	/* automatically detach inherited contracts */
#define	CT_PR_KEEP_EXEC	0x10	/* preserve template accross exec */
#define	CT_PR_ALLPARAM	0x1f

/*
 * ctr_ev_* flags
 */
#define	CT_PR_EV_EMPTY	0x1	/* contract is empty */
#define	CT_PR_EV_FORK	0x2	/* process was forked (and was added) */
#define	CT_PR_EV_EXIT	0x4	/* process exited (and left contract) */
#define	CT_PR_EV_CORE	0x8	/* process dumps core */
#define	CT_PR_EV_SIGNAL	0x10	/* process received fatal signal */
#define	CT_PR_EV_HWERR	0x20	/* process experienced uncorrectable error */
#define	CT_PR_ALLEVENT	0x3f
#define	CT_PR_ALLFATAL	(CT_PR_EV_CORE | CT_PR_EV_SIGNAL | CT_PR_EV_HWERR)

/*
 * ctp_id values
 */
#define	CTPP_EV_FATAL		0
#define	CTPP_PARAMS		1
#define	CTPP_SUBSUME		2
#define	CTPP_SVC_FMRI		3
#define	CTPP_SVC_CTID		4
#define	CTPP_SVC_CREATOR	5
#define	CTPP_CREATOR_AUX	6

/*
 * Status fields
 */
#define	CTPS_PARAMS		"ctps_params"
#define	CTPS_EV_FATAL		"ctps_ev_fatal"
#define	CTPS_MEMBERS		"ctps_members"
#define	CTPS_CONTRACTS		"ctps_contracts"
#define	CTPS_SVC_FMRI		"ctps_svc_fmri"
#define	CTPS_SVC_CTID		"ctps_svc_ctid"
#define	CTPS_SVC_CREATOR	"ctps_svc_creator"
#define	CTPS_CREATOR_AUX	"ctps_creator_aux"

/*
 * Event fields
 */
#define	CTPE_PID	"ctpe_pid"
#define	CTPE_PPID	"ctpe_ppid"
#define	CTPE_ZCOREFILE	"ctpe_zcorefile"
#define	CTPE_GCOREFILE	"ctpe_gcorefile"
#define	CTPE_PCOREFILE	"ctpe_pcorefile"
#define	CTPE_SIGNAL	"ctpe_signal"
#define	CTPE_SENDER	"ctpe_sender"
#define	CTPE_SENDCT	"ctpe_sendct"
#define	CTPE_EXITSTATUS	"ctpe_exitstatus"

#ifdef	__cplusplus
}
#endif

#endif	/* _SYS_CONTRACT_PROCESS_H */