xref: /illumos-gate/usr/src/uts/common/sys/contract.h (revision fafb665d)
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 #include <sys/types.h>
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate typedef uint64_t	ctevid_t;
367c478bd9Sstevel@tonic-gate 
37*7b209c2cSacruz /*
38*7b209c2cSacruz  * Contract parameter maximum size, in bytes
39*7b209c2cSacruz  */
40*7b209c2cSacruz #define	CT_PARAM_MAX_SIZE	8192
41*7b209c2cSacruz 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * Common event types
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate #define	CT_EV_NEGEND	0
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /*
487c478bd9Sstevel@tonic-gate  * Level of status detail requested
497c478bd9Sstevel@tonic-gate  */
507c478bd9Sstevel@tonic-gate #define	CTD_COMMON	0	/* No additional detail */
517c478bd9Sstevel@tonic-gate #define	CTD_FIXED	1	/* O(1) info */
527c478bd9Sstevel@tonic-gate #define	CTD_ALL		2	/* O(n) info */
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate  * Values for ctev_flags.
567c478bd9Sstevel@tonic-gate  */
577c478bd9Sstevel@tonic-gate #define	CTE_ACK		0x1
587c478bd9Sstevel@tonic-gate #define	CTE_INFO	0x2
597c478bd9Sstevel@tonic-gate #define	CTE_NEG		0x4
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate #define	CTP_EV_CRITICAL	100
627c478bd9Sstevel@tonic-gate #define	CTP_EV_INFO	101
637c478bd9Sstevel@tonic-gate #define	CTP_COOKIE	102
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate #define	CTS_NEWCT	"cts_newct"
667c478bd9Sstevel@tonic-gate #define	CTS_NEVID	"cts_nevid"
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate typedef enum ctstate {
697c478bd9Sstevel@tonic-gate 	CTS_OWNED,	/* contract is owned by a process */
707c478bd9Sstevel@tonic-gate 	CTS_INHERITED,	/* contract has been inherited by its parent */
717c478bd9Sstevel@tonic-gate 	CTS_ORPHAN,	/* contract has no parent */
727c478bd9Sstevel@tonic-gate 	CTS_DEAD	/* contract has been destroyed */
737c478bd9Sstevel@tonic-gate } ctstate_t;
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate typedef enum ct_typeid {
767c478bd9Sstevel@tonic-gate 	CTT_PROCESS,	/* process contract */
7725e8c5aaSvikram 	CTT_DEVICE,	/* device contract */
787c478bd9Sstevel@tonic-gate 	CTT_MAXTYPE
797c478bd9Sstevel@tonic-gate } ct_typeid_t;
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate typedef struct ct_event {
827c478bd9Sstevel@tonic-gate 	ctid_t	ctev_id;
837c478bd9Sstevel@tonic-gate 	uint32_t ctev_pad1;
847c478bd9Sstevel@tonic-gate 	ctevid_t ctev_evid;
857c478bd9Sstevel@tonic-gate 	ct_typeid_t ctev_cttype;
867c478bd9Sstevel@tonic-gate 	uint32_t ctev_flags;
877c478bd9Sstevel@tonic-gate 	uint32_t ctev_type;
887c478bd9Sstevel@tonic-gate 	uint32_t ctev_nbytes;
897c478bd9Sstevel@tonic-gate 	uint32_t ctev_goffset;
907c478bd9Sstevel@tonic-gate 	uint32_t ctev_pad2;
917c478bd9Sstevel@tonic-gate 	char	*ctev_buffer;
927c478bd9Sstevel@tonic-gate } ct_event_t;
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate typedef struct ct_status {
957c478bd9Sstevel@tonic-gate 	ctid_t	ctst_id;
967c478bd9Sstevel@tonic-gate 	zoneid_t ctst_zoneid;
977c478bd9Sstevel@tonic-gate 	ct_typeid_t ctst_type;
987c478bd9Sstevel@tonic-gate 	pid_t	ctst_holder;
997c478bd9Sstevel@tonic-gate 	ctstate_t ctst_state;
1007c478bd9Sstevel@tonic-gate 	int	ctst_nevents;
1017c478bd9Sstevel@tonic-gate 	int	ctst_ntime;
1027c478bd9Sstevel@tonic-gate 	int	ctst_qtime;
1037c478bd9Sstevel@tonic-gate 	uint64_t ctst_nevid;
1047c478bd9Sstevel@tonic-gate 	uint_t	ctst_detail;
1057c478bd9Sstevel@tonic-gate 	size_t	ctst_nbytes;
1067c478bd9Sstevel@tonic-gate 	uint_t	ctst_critical;
1077c478bd9Sstevel@tonic-gate 	uint_t	ctst_informative;
1087c478bd9Sstevel@tonic-gate 	uint64_t ctst_cookie;
1097c478bd9Sstevel@tonic-gate 	char	*ctst_buffer;
1107c478bd9Sstevel@tonic-gate } ct_status_t;
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate typedef struct ct_param {
1137c478bd9Sstevel@tonic-gate 	uint32_t ctpm_id;
114*7b209c2cSacruz 	uint32_t ctpm_size;
115*7b209c2cSacruz 	void	 *ctpm_value;
1167c478bd9Sstevel@tonic-gate } ct_param_t;
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1197c478bd9Sstevel@tonic-gate }
1207c478bd9Sstevel@tonic-gate #endif
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate #endif	/* _SYS_CONTRACT_H */
123