xref: /titanic_50/usr/src/uts/common/sys/contract/process_impl.h (revision 1886f67eb9de99edbcda88765f2c603a30c87fc2)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_CONTRACT_PROCESS_IMPL_H
27 #define	_SYS_CONTRACT_PROCESS_IMPL_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/contract.h>
32 #include <sys/contract_impl.h>
33 #include <sys/contract/process.h>
34 #include <sys/time.h>
35 #include <sys/types.h>
36 #include <sys/refstr.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 #define	PRCTID(pp) \
43 	((pp)->p_ct_process ? (pp)->p_ct_process->conp_contract.ct_id : 0)
44 
45 struct ctmpl_process {
46 	ct_template_t	ctp_ctmpl;
47 	contract_t	*ctp_subsume;
48 	uint_t		ctp_params;
49 	uint_t		ctp_ev_fatal;
50 	refstr_t	*ctp_svc_fmri;	/* Service FMRI */
51 	refstr_t	*ctp_svc_aux;	/* Creator Auxiliary field */
52 };
53 
54 struct cont_process {
55 	contract_t	conp_contract;	/* common contract data */
56 	cred_t		*conp_cred;
57 	list_t		conp_members;	/* member processes */
58 	list_t		conp_inherited;	/* unclaimed child contracts */
59 	uint_t		conp_params;	/* contract parameters */
60 	uint_t		conp_ev_fatal;	/* events to kill on */
61 	uint_t		conp_nmembers;
62 	uint_t		conp_ninherited;
63 	refstr_t	*conp_svc_fmri;		/* Service FMRI */
64 	ctid_t		conp_svc_ctid;		/* Service FMRI creator ctid */
65 	refstr_t	*conp_svc_creator;	/* contract creator */
66 	refstr_t	*conp_svc_aux;		/* Creator Auxiliary field */
67 	ctid_t		conp_svc_zone_enter;	/* zone_enter flag */
68 						/* requires ct_lock for */
69 						/* access */
70 };
71 
72 /*
73  * Kernel APIs
74  */
75 ctmpl_process_t *sys_process_tmpl;
76 ct_type_t *process_type;
77 
78 struct proc;
79 void contract_process_init(void);
80 cont_process_t *contract_process_fork(ctmpl_process_t *, struct proc *,
81     struct proc *, int);
82 void contract_process_exit(cont_process_t *, struct proc *, int);
83 void contract_process_core(cont_process_t *, struct proc *, int,
84     const char *, const char *, const char *);
85 void contract_process_hwerr(cont_process_t *, struct proc *);
86 void contract_process_sig(cont_process_t *, struct proc *, int, pid_t, ctid_t,
87     zoneid_t);
88 void contract_process_take(contract_t *, contract_t *);
89 int contract_process_accept(contract_t *);
90 void contract_process_adopt(contract_t *, proc_t *);
91 
92 #ifdef	__cplusplus
93 }
94 #endif
95 
96 #endif	/* _SYS_CONTRACT_PROCESS_IMPL_H */
97