xref: /titanic_44/usr/src/uts/common/sys/contract.h (revision 25e8c5aa2b496d9026e958ac731a610167574f59)
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
5*25e8c5aaSvikram  * Common Development and Distribution License (the "License").
6*25e8c5aaSvikram  * 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*25e8c5aaSvikram  * Copyright 2007 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 /*
407c478bd9Sstevel@tonic-gate  * Common event types
417c478bd9Sstevel@tonic-gate  */
427c478bd9Sstevel@tonic-gate #define	CT_EV_NEGEND	0
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /*
457c478bd9Sstevel@tonic-gate  * Level of status detail requested
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate #define	CTD_COMMON	0	/* No additional detail */
487c478bd9Sstevel@tonic-gate #define	CTD_FIXED	1	/* O(1) info */
497c478bd9Sstevel@tonic-gate #define	CTD_ALL		2	/* O(n) info */
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate /*
527c478bd9Sstevel@tonic-gate  * Values for ctev_flags.
537c478bd9Sstevel@tonic-gate  */
547c478bd9Sstevel@tonic-gate #define	CTE_ACK		0x1
557c478bd9Sstevel@tonic-gate #define	CTE_INFO	0x2
567c478bd9Sstevel@tonic-gate #define	CTE_NEG		0x4
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate #define	CTP_EV_CRITICAL	100
597c478bd9Sstevel@tonic-gate #define	CTP_EV_INFO	101
607c478bd9Sstevel@tonic-gate #define	CTP_COOKIE	102
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate #define	CTS_NEWCT	"cts_newct"
637c478bd9Sstevel@tonic-gate #define	CTS_NEVID	"cts_nevid"
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate typedef enum ctstate {
667c478bd9Sstevel@tonic-gate 	CTS_OWNED,	/* contract is owned by a process */
677c478bd9Sstevel@tonic-gate 	CTS_INHERITED,	/* contract has been inherited by its parent */
687c478bd9Sstevel@tonic-gate 	CTS_ORPHAN,	/* contract has no parent */
697c478bd9Sstevel@tonic-gate 	CTS_DEAD	/* contract has been destroyed */
707c478bd9Sstevel@tonic-gate } ctstate_t;
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate typedef enum ct_typeid {
737c478bd9Sstevel@tonic-gate 	CTT_PROCESS,	/* process contract */
74*25e8c5aaSvikram 	CTT_DEVICE,	/* device contract */
757c478bd9Sstevel@tonic-gate 	CTT_MAXTYPE
767c478bd9Sstevel@tonic-gate } ct_typeid_t;
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate typedef struct ct_event {
797c478bd9Sstevel@tonic-gate 	ctid_t	ctev_id;
807c478bd9Sstevel@tonic-gate 	uint32_t ctev_pad1;
817c478bd9Sstevel@tonic-gate 	ctevid_t ctev_evid;
827c478bd9Sstevel@tonic-gate 	ct_typeid_t ctev_cttype;
837c478bd9Sstevel@tonic-gate 	uint32_t ctev_flags;
847c478bd9Sstevel@tonic-gate 	uint32_t ctev_type;
857c478bd9Sstevel@tonic-gate 	uint32_t ctev_nbytes;
867c478bd9Sstevel@tonic-gate 	uint32_t ctev_goffset;
877c478bd9Sstevel@tonic-gate 	uint32_t ctev_pad2;
887c478bd9Sstevel@tonic-gate 	char	*ctev_buffer;
897c478bd9Sstevel@tonic-gate } ct_event_t;
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate typedef struct ct_status {
927c478bd9Sstevel@tonic-gate 	ctid_t	ctst_id;
937c478bd9Sstevel@tonic-gate 	zoneid_t ctst_zoneid;
947c478bd9Sstevel@tonic-gate 	ct_typeid_t ctst_type;
957c478bd9Sstevel@tonic-gate 	pid_t	ctst_holder;
967c478bd9Sstevel@tonic-gate 	ctstate_t ctst_state;
977c478bd9Sstevel@tonic-gate 	int	ctst_nevents;
987c478bd9Sstevel@tonic-gate 	int	ctst_ntime;
997c478bd9Sstevel@tonic-gate 	int	ctst_qtime;
1007c478bd9Sstevel@tonic-gate 	uint64_t ctst_nevid;
1017c478bd9Sstevel@tonic-gate 	uint_t	ctst_detail;
1027c478bd9Sstevel@tonic-gate 	size_t	ctst_nbytes;
1037c478bd9Sstevel@tonic-gate 	uint_t	ctst_critical;
1047c478bd9Sstevel@tonic-gate 	uint_t	ctst_informative;
1057c478bd9Sstevel@tonic-gate 	uint64_t ctst_cookie;
1067c478bd9Sstevel@tonic-gate 	char	*ctst_buffer;
1077c478bd9Sstevel@tonic-gate } ct_status_t;
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate typedef struct ct_param {
1107c478bd9Sstevel@tonic-gate 	uint32_t ctpm_id;
1117c478bd9Sstevel@tonic-gate 	uint32_t ctpm_pad;
1127c478bd9Sstevel@tonic-gate 	uint64_t ctpm_value;
1137c478bd9Sstevel@tonic-gate } ct_param_t;
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1167c478bd9Sstevel@tonic-gate }
1177c478bd9Sstevel@tonic-gate #endif
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate #endif	/* _SYS_CONTRACT_H */
120