xref: /onnv-gate/usr/src/uts/common/sys/contract.h (revision 6073:47f6aa7a8077)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
54845Svikram  * Common Development and Distribution License (the "License").
64845Svikram  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*6073Sacruz  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_CONTRACT_H
270Sstevel@tonic-gate #define	_SYS_CONTRACT_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #include <sys/types.h>
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #ifdef	__cplusplus
340Sstevel@tonic-gate extern "C" {
350Sstevel@tonic-gate #endif
360Sstevel@tonic-gate 
370Sstevel@tonic-gate typedef uint64_t	ctevid_t;
380Sstevel@tonic-gate 
390Sstevel@tonic-gate /*
40*6073Sacruz  * Contract parameter maximum size, in bytes
41*6073Sacruz  */
42*6073Sacruz #define	CT_PARAM_MAX_SIZE	8192
43*6073Sacruz 
44*6073Sacruz /*
450Sstevel@tonic-gate  * Common event types
460Sstevel@tonic-gate  */
470Sstevel@tonic-gate #define	CT_EV_NEGEND	0
480Sstevel@tonic-gate 
490Sstevel@tonic-gate /*
500Sstevel@tonic-gate  * Level of status detail requested
510Sstevel@tonic-gate  */
520Sstevel@tonic-gate #define	CTD_COMMON	0	/* No additional detail */
530Sstevel@tonic-gate #define	CTD_FIXED	1	/* O(1) info */
540Sstevel@tonic-gate #define	CTD_ALL		2	/* O(n) info */
550Sstevel@tonic-gate 
560Sstevel@tonic-gate /*
570Sstevel@tonic-gate  * Values for ctev_flags.
580Sstevel@tonic-gate  */
590Sstevel@tonic-gate #define	CTE_ACK		0x1
600Sstevel@tonic-gate #define	CTE_INFO	0x2
610Sstevel@tonic-gate #define	CTE_NEG		0x4
620Sstevel@tonic-gate 
630Sstevel@tonic-gate #define	CTP_EV_CRITICAL	100
640Sstevel@tonic-gate #define	CTP_EV_INFO	101
650Sstevel@tonic-gate #define	CTP_COOKIE	102
660Sstevel@tonic-gate 
670Sstevel@tonic-gate #define	CTS_NEWCT	"cts_newct"
680Sstevel@tonic-gate #define	CTS_NEVID	"cts_nevid"
690Sstevel@tonic-gate 
700Sstevel@tonic-gate typedef enum ctstate {
710Sstevel@tonic-gate 	CTS_OWNED,	/* contract is owned by a process */
720Sstevel@tonic-gate 	CTS_INHERITED,	/* contract has been inherited by its parent */
730Sstevel@tonic-gate 	CTS_ORPHAN,	/* contract has no parent */
740Sstevel@tonic-gate 	CTS_DEAD	/* contract has been destroyed */
750Sstevel@tonic-gate } ctstate_t;
760Sstevel@tonic-gate 
770Sstevel@tonic-gate typedef enum ct_typeid {
780Sstevel@tonic-gate 	CTT_PROCESS,	/* process contract */
794845Svikram 	CTT_DEVICE,	/* device contract */
800Sstevel@tonic-gate 	CTT_MAXTYPE
810Sstevel@tonic-gate } ct_typeid_t;
820Sstevel@tonic-gate 
830Sstevel@tonic-gate typedef struct ct_event {
840Sstevel@tonic-gate 	ctid_t	ctev_id;
850Sstevel@tonic-gate 	uint32_t ctev_pad1;
860Sstevel@tonic-gate 	ctevid_t ctev_evid;
870Sstevel@tonic-gate 	ct_typeid_t ctev_cttype;
880Sstevel@tonic-gate 	uint32_t ctev_flags;
890Sstevel@tonic-gate 	uint32_t ctev_type;
900Sstevel@tonic-gate 	uint32_t ctev_nbytes;
910Sstevel@tonic-gate 	uint32_t ctev_goffset;
920Sstevel@tonic-gate 	uint32_t ctev_pad2;
930Sstevel@tonic-gate 	char	*ctev_buffer;
940Sstevel@tonic-gate } ct_event_t;
950Sstevel@tonic-gate 
960Sstevel@tonic-gate typedef struct ct_status {
970Sstevel@tonic-gate 	ctid_t	ctst_id;
980Sstevel@tonic-gate 	zoneid_t ctst_zoneid;
990Sstevel@tonic-gate 	ct_typeid_t ctst_type;
1000Sstevel@tonic-gate 	pid_t	ctst_holder;
1010Sstevel@tonic-gate 	ctstate_t ctst_state;
1020Sstevel@tonic-gate 	int	ctst_nevents;
1030Sstevel@tonic-gate 	int	ctst_ntime;
1040Sstevel@tonic-gate 	int	ctst_qtime;
1050Sstevel@tonic-gate 	uint64_t ctst_nevid;
1060Sstevel@tonic-gate 	uint_t	ctst_detail;
1070Sstevel@tonic-gate 	size_t	ctst_nbytes;
1080Sstevel@tonic-gate 	uint_t	ctst_critical;
1090Sstevel@tonic-gate 	uint_t	ctst_informative;
1100Sstevel@tonic-gate 	uint64_t ctst_cookie;
1110Sstevel@tonic-gate 	char	*ctst_buffer;
1120Sstevel@tonic-gate } ct_status_t;
1130Sstevel@tonic-gate 
1140Sstevel@tonic-gate typedef struct ct_param {
1150Sstevel@tonic-gate 	uint32_t ctpm_id;
116*6073Sacruz 	uint32_t ctpm_size;
117*6073Sacruz 	void	 *ctpm_value;
1180Sstevel@tonic-gate } ct_param_t;
1190Sstevel@tonic-gate 
1200Sstevel@tonic-gate #ifdef	__cplusplus
1210Sstevel@tonic-gate }
1220Sstevel@tonic-gate #endif
1230Sstevel@tonic-gate 
1240Sstevel@tonic-gate #endif	/* _SYS_CONTRACT_H */
125