xref: /titanic_41/usr/src/uts/common/sys/contract.h (revision fd9cb95cbb2f626355a60efb9d02c5f0a33c10e6)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_CONTRACT_H
28 #define	_SYS_CONTRACT_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 typedef uint64_t	ctevid_t;
39 
40 /*
41  * Common event types
42  */
43 #define	CT_EV_NEGEND	0
44 
45 /*
46  * Level of status detail requested
47  */
48 #define	CTD_COMMON	0	/* No additional detail */
49 #define	CTD_FIXED	1	/* O(1) info */
50 #define	CTD_ALL		2	/* O(n) info */
51 
52 /*
53  * Values for ctev_flags.
54  */
55 #define	CTE_ACK		0x1
56 #define	CTE_INFO	0x2
57 #define	CTE_NEG		0x4
58 
59 #define	CTP_EV_CRITICAL	100
60 #define	CTP_EV_INFO	101
61 #define	CTP_COOKIE	102
62 
63 #define	CTS_NEWCT	"cts_newct"
64 #define	CTS_NEVID	"cts_nevid"
65 
66 typedef enum ctstate {
67 	CTS_OWNED,	/* contract is owned by a process */
68 	CTS_INHERITED,	/* contract has been inherited by its parent */
69 	CTS_ORPHAN,	/* contract has no parent */
70 	CTS_DEAD	/* contract has been destroyed */
71 } ctstate_t;
72 
73 typedef enum ct_typeid {
74 	CTT_PROCESS,	/* process contract */
75 	CTT_MAXTYPE
76 } ct_typeid_t;
77 
78 typedef struct ct_event {
79 	ctid_t	ctev_id;
80 	uint32_t ctev_pad1;
81 	ctevid_t ctev_evid;
82 	ct_typeid_t ctev_cttype;
83 	uint32_t ctev_flags;
84 	uint32_t ctev_type;
85 	uint32_t ctev_nbytes;
86 	uint32_t ctev_goffset;
87 	uint32_t ctev_pad2;
88 	char	*ctev_buffer;
89 } ct_event_t;
90 
91 typedef struct ct_status {
92 	ctid_t	ctst_id;
93 	zoneid_t ctst_zoneid;
94 	ct_typeid_t ctst_type;
95 	pid_t	ctst_holder;
96 	ctstate_t ctst_state;
97 	int	ctst_nevents;
98 	int	ctst_ntime;
99 	int	ctst_qtime;
100 	uint64_t ctst_nevid;
101 	uint_t	ctst_detail;
102 	size_t	ctst_nbytes;
103 	uint_t	ctst_critical;
104 	uint_t	ctst_informative;
105 	uint64_t ctst_cookie;
106 	char	*ctst_buffer;
107 } ct_status_t;
108 
109 typedef struct ct_param {
110 	uint32_t ctpm_id;
111 	uint32_t ctpm_pad;
112 	uint64_t ctpm_value;
113 } ct_param_t;
114 
115 #ifdef	__cplusplus
116 }
117 #endif
118 
119 #endif	/* _SYS_CONTRACT_H */
120