xref: /illumos-gate/usr/src/uts/common/sys/contract/process_impl.h (revision dea3b854661cb94b40277d9397e510728497a69f)
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 #include <sys/contract.h>
30 #include <sys/contract_impl.h>
31 #include <sys/contract/process.h>
32 #include <sys/time.h>
33 #include <sys/types.h>
34 #include <sys/refstr.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 #define	PRCTID(pp) \
41 	((pp)->p_ct_process ? (pp)->p_ct_process->conp_contract.ct_id : 0)
42 
43 struct ctmpl_process {
44 	ct_template_t	ctp_ctmpl;
45 	contract_t	*ctp_subsume;
46 	uint_t		ctp_params;
47 	uint_t		ctp_ev_fatal;
48 	refstr_t	*ctp_svc_fmri;	/* Service FMRI */
49 	refstr_t	*ctp_svc_aux;	/* Creator Auxiliary field */
50 };
51 
52 struct cont_process {
53 	contract_t	conp_contract;	/* common contract data */
54 	cred_t		*conp_cred;
55 	list_t		conp_members;	/* member processes */
56 	list_t		conp_inherited;	/* unclaimed child contracts */
57 	uint_t		conp_params;	/* contract parameters */
58 	uint_t		conp_ev_fatal;	/* events to kill on */
59 	uint_t		conp_nmembers;
60 	uint_t		conp_ninherited;
61 	refstr_t	*conp_svc_fmri;		/* Service FMRI */
62 	ctid_t		conp_svc_ctid;		/* Service FMRI creator ctid */
63 	refstr_t	*conp_svc_creator;	/* contract creator */
64 	refstr_t	*conp_svc_aux;		/* Creator Auxiliary field */
65 	ctid_t		conp_svc_zone_enter;	/* zone_enter flag */
66 						/* requires ct_lock for */
67 						/* access */
68 };
69 
70 /*
71  * Kernel APIs
72  */
73 extern ctmpl_process_t *sys_process_tmpl;
74 extern ct_type_t *process_type;
75 
76 struct proc;
77 void contract_process_init(void);
78 cont_process_t *contract_process_fork(ctmpl_process_t *, struct proc *,
79     struct proc *, int);
80 void contract_process_exit(cont_process_t *, struct proc *, int);
81 void contract_process_core(cont_process_t *, struct proc *, int,
82     const char *, const char *, const char *);
83 void contract_process_hwerr(cont_process_t *, struct proc *);
84 void contract_process_sig(cont_process_t *, struct proc *, int, pid_t, ctid_t,
85     zoneid_t);
86 void contract_process_take(contract_t *, contract_t *);
87 int contract_process_accept(contract_t *);
88 void contract_process_adopt(contract_t *, proc_t *);
89 
90 #ifdef	__cplusplus
91 }
92 #endif
93 
94 #endif	/* _SYS_CONTRACT_PROCESS_IMPL_H */
95