xref: /titanic_51/usr/src/uts/common/sys/contract.h (revision 7b209c2cc5ea45251aba06dcc6181d3f23da807a)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
525e8c5aaSvikram  * Common Development and Distribution License (the "License").
625e8c5aaSvikram  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*7b209c2cSacruz  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_CONTRACT_H
277c478bd9Sstevel@tonic-gate #define	_SYS_CONTRACT_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #include <sys/types.h>
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate typedef uint64_t	ctevid_t;
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /*
40*7b209c2cSacruz  * Contract parameter maximum size, in bytes
41*7b209c2cSacruz  */
42*7b209c2cSacruz #define	CT_PARAM_MAX_SIZE	8192
43*7b209c2cSacruz 
44*7b209c2cSacruz /*
457c478bd9Sstevel@tonic-gate  * Common event types
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate #define	CT_EV_NEGEND	0
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate /*
507c478bd9Sstevel@tonic-gate  * Level of status detail requested
517c478bd9Sstevel@tonic-gate  */
527c478bd9Sstevel@tonic-gate #define	CTD_COMMON	0	/* No additional detail */
537c478bd9Sstevel@tonic-gate #define	CTD_FIXED	1	/* O(1) info */
547c478bd9Sstevel@tonic-gate #define	CTD_ALL		2	/* O(n) info */
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate /*
577c478bd9Sstevel@tonic-gate  * Values for ctev_flags.
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate #define	CTE_ACK		0x1
607c478bd9Sstevel@tonic-gate #define	CTE_INFO	0x2
617c478bd9Sstevel@tonic-gate #define	CTE_NEG		0x4
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate #define	CTP_EV_CRITICAL	100
647c478bd9Sstevel@tonic-gate #define	CTP_EV_INFO	101
657c478bd9Sstevel@tonic-gate #define	CTP_COOKIE	102
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate #define	CTS_NEWCT	"cts_newct"
687c478bd9Sstevel@tonic-gate #define	CTS_NEVID	"cts_nevid"
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate typedef enum ctstate {
717c478bd9Sstevel@tonic-gate 	CTS_OWNED,	/* contract is owned by a process */
727c478bd9Sstevel@tonic-gate 	CTS_INHERITED,	/* contract has been inherited by its parent */
737c478bd9Sstevel@tonic-gate 	CTS_ORPHAN,	/* contract has no parent */
747c478bd9Sstevel@tonic-gate 	CTS_DEAD	/* contract has been destroyed */
757c478bd9Sstevel@tonic-gate } ctstate_t;
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate typedef enum ct_typeid {
787c478bd9Sstevel@tonic-gate 	CTT_PROCESS,	/* process contract */
7925e8c5aaSvikram 	CTT_DEVICE,	/* device contract */
807c478bd9Sstevel@tonic-gate 	CTT_MAXTYPE
817c478bd9Sstevel@tonic-gate } ct_typeid_t;
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate typedef struct ct_event {
847c478bd9Sstevel@tonic-gate 	ctid_t	ctev_id;
857c478bd9Sstevel@tonic-gate 	uint32_t ctev_pad1;
867c478bd9Sstevel@tonic-gate 	ctevid_t ctev_evid;
877c478bd9Sstevel@tonic-gate 	ct_typeid_t ctev_cttype;
887c478bd9Sstevel@tonic-gate 	uint32_t ctev_flags;
897c478bd9Sstevel@tonic-gate 	uint32_t ctev_type;
907c478bd9Sstevel@tonic-gate 	uint32_t ctev_nbytes;
917c478bd9Sstevel@tonic-gate 	uint32_t ctev_goffset;
927c478bd9Sstevel@tonic-gate 	uint32_t ctev_pad2;
937c478bd9Sstevel@tonic-gate 	char	*ctev_buffer;
947c478bd9Sstevel@tonic-gate } ct_event_t;
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate typedef struct ct_status {
977c478bd9Sstevel@tonic-gate 	ctid_t	ctst_id;
987c478bd9Sstevel@tonic-gate 	zoneid_t ctst_zoneid;
997c478bd9Sstevel@tonic-gate 	ct_typeid_t ctst_type;
1007c478bd9Sstevel@tonic-gate 	pid_t	ctst_holder;
1017c478bd9Sstevel@tonic-gate 	ctstate_t ctst_state;
1027c478bd9Sstevel@tonic-gate 	int	ctst_nevents;
1037c478bd9Sstevel@tonic-gate 	int	ctst_ntime;
1047c478bd9Sstevel@tonic-gate 	int	ctst_qtime;
1057c478bd9Sstevel@tonic-gate 	uint64_t ctst_nevid;
1067c478bd9Sstevel@tonic-gate 	uint_t	ctst_detail;
1077c478bd9Sstevel@tonic-gate 	size_t	ctst_nbytes;
1087c478bd9Sstevel@tonic-gate 	uint_t	ctst_critical;
1097c478bd9Sstevel@tonic-gate 	uint_t	ctst_informative;
1107c478bd9Sstevel@tonic-gate 	uint64_t ctst_cookie;
1117c478bd9Sstevel@tonic-gate 	char	*ctst_buffer;
1127c478bd9Sstevel@tonic-gate } ct_status_t;
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate typedef struct ct_param {
1157c478bd9Sstevel@tonic-gate 	uint32_t ctpm_id;
116*7b209c2cSacruz 	uint32_t ctpm_size;
117*7b209c2cSacruz 	void	 *ctpm_value;
1187c478bd9Sstevel@tonic-gate } ct_param_t;
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1217c478bd9Sstevel@tonic-gate }
1227c478bd9Sstevel@tonic-gate #endif
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate #endif	/* _SYS_CONTRACT_H */
125