xref: /titanic_41/usr/src/uts/common/sys/contract/process_impl.h (revision 549ec3fff108310966327d1dc9004551b63210b7)
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_PROCESS_IMPL_H
28 #define	_SYS_CONTRACT_PROCESS_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/contract.h>
33 #include <sys/contract_impl.h>
34 #include <sys/contract/process.h>
35 #include <sys/time.h>
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 #define	PRCTID(pp) \
42 	((pp)->p_ct_process ? (pp)->p_ct_process->conp_contract.ct_id : 0)
43 
44 struct ctmpl_process {
45 	ct_template_t	ctp_ctmpl;
46 	contract_t	*ctp_subsume;
47 	uint_t		ctp_params;
48 	uint_t		ctp_ev_fatal;
49 };
50 
51 struct cont_process {
52 	contract_t	conp_contract;	/* common contract data */
53 	cred_t		*conp_cred;
54 	list_t		conp_members;	/* member processes */
55 	list_t		conp_inherited;	/* unclaimed child contracts */
56 	uint_t		conp_params;	/* contract parameters */
57 	uint_t		conp_ev_fatal;	/* events to kill on */
58 	uint_t		conp_nmembers;
59 	uint_t		conp_ninherited;
60 };
61 
62 /*
63  * Kernel APIs
64  */
65 ctmpl_process_t *sys_process_tmpl;
66 ct_type_t *process_type;
67 
68 struct proc;
69 void contract_process_init(void);
70 cont_process_t *contract_process_fork(ctmpl_process_t *, struct proc *,
71     struct proc *, int);
72 void contract_process_exit(cont_process_t *, struct proc *, int);
73 void contract_process_core(cont_process_t *, struct proc *, int,
74     const char *, const char *, const char *);
75 void contract_process_hwerr(cont_process_t *, struct proc *);
76 void contract_process_sig(cont_process_t *, struct proc *, int, pid_t, ctid_t,
77     zoneid_t);
78 void contract_process_take(contract_t *, contract_t *);
79 int contract_process_accept(contract_t *);
80 void contract_process_adopt(contract_t *, proc_t *);
81 
82 #ifdef	__cplusplus
83 }
84 #endif
85 
86 #endif	/* _SYS_CONTRACT_PROCESS_IMPL_H */
87